diff --git a/crates/swc/tests/fixture/issues-2xxx/2011/reduced/output/index.js b/crates/swc/tests/fixture/issues-2xxx/2011/reduced/output/index.js index 6d0bf6ba0a68..d853080ee285 100644 --- a/crates/swc/tests/fixture/issues-2xxx/2011/reduced/output/index.js +++ b/crates/swc/tests/fixture/issues-2xxx/2011/reduced/output/index.js @@ -1,8 +1,8 @@ -var t, n = function() {}; +var t; module.exports = ((t = function() { "use strict"; function t() {} return t.prototype.it = function() { this.bb = new t.MyA(); }, t; -}()).MyA = n, t); +}()).MyA = function() {}, t); diff --git a/crates/swc/tests/fixture/issues-3xxx/3126/1/output/index.js b/crates/swc/tests/fixture/issues-3xxx/3126/1/output/index.js index a393fe483d0b..88e961d8f6a2 100644 --- a/crates/swc/tests/fixture/issues-3xxx/3126/1/output/index.js +++ b/crates/swc/tests/fixture/issues-3xxx/3126/1/output/index.js @@ -1,10 +1,9 @@ !function() { - var __webpack_modules__ = { + __webpack_require__.m = { 746: function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__1) { Object.prototype.hasOwnProperty; } - }; - __webpack_require__.m = __webpack_modules__, __webpack_require__.O = function(result, chunkIds, fn, priority) { + }, __webpack_require__.O = function(result, chunkIds, fn, priority) { for(var j = 0; j < chunkIds.length; j++)Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); }); diff --git a/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.2.minified.js b/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.2.minified.js index d5342d59e7cf..9382b65c90e9 100644 --- a/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.2.minified.js +++ b/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.2.minified.js @@ -2,12 +2,9 @@ //// [classPoint.ts] var A; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -!function(A) { - var Point = function Point(x, y) { - "use strict"; - _class_call_check(this, Point), this.x = x, this.y = y; - }; - A.Point = Point; -}(A || (A = {})); +(A || (A = {})).Point = function Point(x, y) { + "use strict"; + _class_call_check(this, Point), this.x = x, this.y = y; +}; //// [test.ts] A.Point.Origin, new A.Point(0, 0); diff --git a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.2.minified.js b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.2.minified.js index d2714b2a1a4c..f131fe84a816 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.2.minified.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.2.minified.js @@ -7,9 +7,6 @@ var clodule = function() { } return clodule.fn = function(id) {}, clodule; }(); -!function(clodule) { - var fn = function(x, y) { - return x; - }; - clodule.fn = fn; -}(clodule || (clodule = {})); +(clodule || (clodule = {})).fn = function(x, y) { + return x; +}; diff --git a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.2.minified.js b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.2.minified.js index 7a667115505d..72fcfbd420fb 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.2.minified.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.2.minified.js @@ -7,9 +7,6 @@ var clodule = function() { } return clodule.fn = function(id) {}, clodule; }(); -!function(clodule) { - var fn = function(x, y) { - return x; - }; - clodule.fn = fn; -}(clodule || (clodule = {})); +(clodule || (clodule = {})).fn = function(x, y) { + return x; +}; diff --git a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.2.minified.js b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.2.minified.js index d15d88442cfb..17d0375c3148 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.2.minified.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.2.minified.js @@ -9,9 +9,6 @@ var clodule = function() { return 42; }, clodule; }(); -!function(clodule1) { - var fn = function(x, y) { - return clodule.sfn("a"); - }; - clodule1.fn = fn; -}(clodule || (clodule = {})); +(clodule || (clodule = {})).fn = function(x, y) { + return clodule.sfn("a"); +}; diff --git a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.2.minified.js b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.2.minified.js index 51e856b5a25a..35dbe798edfd 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.2.minified.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.2.minified.js @@ -12,12 +12,9 @@ var A, Point = function() { }; }, Point; }(); -!function(Point) { - var Origin = function() { - return null; - }; - Point.Origin = Origin; -}(Point || (Point = {})), function(A) { +(Point || (Point = {})).Origin = function() { + return null; +}, function(A) { var Point = function() { "use strict"; function Point(x, y) { diff --git a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot.2.minified.js b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot.2.minified.js index c1e5ee4d02f6..682088d6d707 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot.2.minified.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot.2.minified.js @@ -2,11 +2,10 @@ var X; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(X) { - var Y, Point; - Y = X.Y || (X.Y = {}), Point = function Point(x, y) { + (X.Y || (X.Y = {})).Point = function Point(x, y) { "use strict"; _class_call_check(this, Point), this.x = x, this.y = y; - }, Y.Point = Point; + }; }(X || (X = {})); //// [module.ts] var X; diff --git a/crates/swc/tests/tsc-references/EnumAndModuleWithSameNameAndCommonRoot.2.minified.js b/crates/swc/tests/tsc-references/EnumAndModuleWithSameNameAndCommonRoot.2.minified.js index f48cf9091ba0..2f7556bc5004 100644 --- a/crates/swc/tests/tsc-references/EnumAndModuleWithSameNameAndCommonRoot.2.minified.js +++ b/crates/swc/tests/tsc-references/EnumAndModuleWithSameNameAndCommonRoot.2.minified.js @@ -3,10 +3,7 @@ var enumdule; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(enumdule) { enumdule[enumdule.Red = 0] = "Red", enumdule[enumdule.Blue = 1] = "Blue"; -}(enumdule || (enumdule = {})), function(enumdule) { - var Point = function Point(x, y) { - "use strict"; - _class_call_check(this, Point), this.x = x, this.y = y; - }; - enumdule.Point = Point; -}(enumdule || (enumdule = {})), enumdule.Red, new enumdule.Point(0, 0); +}(enumdule || (enumdule = {})), (enumdule || (enumdule = {})).Point = function Point(x, y) { + "use strict"; + _class_call_check(this, Point), this.x = x, this.y = y; +}, enumdule.Red, new enumdule.Point(0, 0); diff --git a/crates/swc/tests/tsc-references/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.2.minified.js b/crates/swc/tests/tsc-references/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.2.minified.js index f9d01f0e2e92..fd97fc89e3ca 100644 --- a/crates/swc/tests/tsc-references/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.2.minified.js @@ -25,10 +25,8 @@ import _create_super from "@swc/helpers/src/_create_super.mjs"; x: 0, y: 0, z: 0 - }; - var Line = function Line(start, end) { + }, A.Line = function Line(start, end) { "use strict"; _class_call_check(this, Line), this.start = start, this.end = end; }; - A.Line = Line; }(A || (A = {})); diff --git a/crates/swc/tests/tsc-references/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.2.minified.js b/crates/swc/tests/tsc-references/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.2.minified.js index 71ea0375f366..cebdfd1ecb0b 100644 --- a/crates/swc/tests/tsc-references/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.2.minified.js @@ -1,10 +1,7 @@ //// [ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.ts] var A; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -!function(A) { - var points = function points() { - "use strict"; - _class_call_check(this, points); - }; - A.points = points; -}(A || (A = {})); +(A || (A = {})).points = function points() { + "use strict"; + _class_call_check(this, points); +}; diff --git a/crates/swc/tests/tsc-references/ExportClassWithInaccessibleTypeInTypeParameterConstraint.2.minified.js b/crates/swc/tests/tsc-references/ExportClassWithInaccessibleTypeInTypeParameterConstraint.2.minified.js index 53e49004468e..593f98687240 100644 --- a/crates/swc/tests/tsc-references/ExportClassWithInaccessibleTypeInTypeParameterConstraint.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportClassWithInaccessibleTypeInTypeParameterConstraint.2.minified.js @@ -4,10 +4,6 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; !function(A) { - var Point = function Point() { - "use strict"; - _class_call_check(this, Point); - }; A.Origin = { x: 0, y: 0 @@ -20,7 +16,10 @@ import _create_super from "@swc/helpers/src/_create_super.mjs"; return _class_call_check(this, Point3d), _super.apply(this, arguments); } return Point3d; - }(Point); + }(function Point() { + "use strict"; + _class_call_check(this, Point); + }); A.Point3d = Point3d, A.Origin3d = { x: 0, y: 0, diff --git a/crates/swc/tests/tsc-references/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.2.minified.js b/crates/swc/tests/tsc-references/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.2.minified.js index 134e6a226aed..a61a43252c73 100644 --- a/crates/swc/tests/tsc-references/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.2.minified.js @@ -2,19 +2,18 @@ var A; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(A) { - var fromOrigin = function(p) { - return new Line({ - x: 0, - y: 0 - }, p); - }, Point = function Point() { + A.Point = function Point() { "use strict"; _class_call_check(this, Point); }; - A.Point = Point; var Line = function Line(start, end) { "use strict"; _class_call_check(this, Line), this.start = start, this.end = end; }; - A.Line = Line, A.fromOrigin = fromOrigin; + A.Line = Line, A.fromOrigin = function(p) { + return new Line({ + x: 0, + y: 0 + }, p); + }; }(A || (A = {})); diff --git a/crates/swc/tests/tsc-references/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.2.minified.js b/crates/swc/tests/tsc-references/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.2.minified.js index bcb9fe977319..9358bb714830 100644 --- a/crates/swc/tests/tsc-references/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.2.minified.js @@ -2,14 +2,14 @@ var A; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(A) { - var fromOrigin = function(p) { + var Line = function Line(start, end) { + "use strict"; + _class_call_check(this, Line), this.start = start, this.end = end; + }; + A.Line = Line, A.fromOrigin = function(p) { return new Line({ x: 0, y: 0 }, p); - }, Line = function Line(start, end) { - "use strict"; - _class_call_check(this, Line), this.start = start, this.end = end; }; - A.Line = Line, A.fromOrigin = fromOrigin; }(A || (A = {})); diff --git a/crates/swc/tests/tsc-references/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.2.minified.js b/crates/swc/tests/tsc-references/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.2.minified.js index fb2c8a61a072..7f309688b977 100644 --- a/crates/swc/tests/tsc-references/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.2.minified.js @@ -2,19 +2,18 @@ var A; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(A) { - var fromOrigin = function(p) { - return new Line({ - x: 0, - y: 0 - }, p); - }, Point = function Point() { + A.Point = function Point() { "use strict"; _class_call_check(this, Point); }; - A.Point = Point; var Line = function Line(start, end) { "use strict"; _class_call_check(this, Line), this.start = start, this.end = end; }; - A.fromOrigin = fromOrigin; + A.fromOrigin = function(p) { + return new Line({ + x: 0, + y: 0 + }, p); + }; }(A || (A = {})); diff --git a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot.2.minified.js b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot.2.minified.js index de17adffcd35..b9f9388b4539 100644 --- a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot.2.minified.js +++ b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot.2.minified.js @@ -1,14 +1,11 @@ //// [function.ts] var A; -!function(A) { - var Point = function() { - return { - x: 0, - y: 0 - }; +(A || (A = {})).Point = function() { + return { + x: 0, + y: 0 }; - A.Point = Point; -}(A || (A = {})); +}; //// [module.ts] var A; !function(A) { diff --git a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndDifferentCommonRoot.2.minified.js b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndDifferentCommonRoot.2.minified.js index 8c9750e14f33..1152cb29917b 100644 --- a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndDifferentCommonRoot.2.minified.js +++ b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndDifferentCommonRoot.2.minified.js @@ -1,14 +1,11 @@ //// [function.ts] var A; -!function(A) { - var Point = function() { - return { - x: 0, - y: 0 - }; +(A || (A = {})).Point = function() { + return { + x: 0, + y: 0 }; - A.Point = Point; -}(A || (A = {})); +}; //// [module.ts] var B; !function(B) { diff --git a/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot.2.minified.js b/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot.2.minified.js index 229a9d2b8191..9459f135754d 100644 --- a/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot.2.minified.js +++ b/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot.2.minified.js @@ -8,11 +8,10 @@ var X; var X; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(X) { - var Y, Point; - Y = X.Y || (X.Y = {}), Point = function Point(x, y) { + (X.Y || (X.Y = {})).Point = function Point(x, y) { "use strict"; _class_call_check(this, Point), this.x = x, this.y = y; - }, Y.Point = Point; + }; }(X || (X = {})); //// [simple.ts] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; diff --git a/crates/swc/tests/tsc-references/ModuleAndEnumWithSameNameAndCommonRoot.2.minified.js b/crates/swc/tests/tsc-references/ModuleAndEnumWithSameNameAndCommonRoot.2.minified.js index e5eefbb15f5f..5197a15fbcc9 100644 --- a/crates/swc/tests/tsc-references/ModuleAndEnumWithSameNameAndCommonRoot.2.minified.js +++ b/crates/swc/tests/tsc-references/ModuleAndEnumWithSameNameAndCommonRoot.2.minified.js @@ -1,12 +1,9 @@ //// [ModuleAndEnumWithSameNameAndCommonRoot.ts] var enumdule; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -!function(enumdule) { - var Point = function Point(x, y) { - "use strict"; - _class_call_check(this, Point), this.x = x, this.y = y; - }; - enumdule.Point = Point; -}(enumdule || (enumdule = {})), function(enumdule) { +(enumdule || (enumdule = {})).Point = function Point(x, y) { + "use strict"; + _class_call_check(this, Point), this.x = x, this.y = y; +}, function(enumdule) { enumdule[enumdule.Red = 0] = "Red", enumdule[enumdule.Blue = 1] = "Blue"; }(enumdule || (enumdule = {})), enumdule.Red, new enumdule.Point(0, 0); diff --git a/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot.2.minified.js b/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot.2.minified.js index d4f3f84565d0..806c88a9a230 100644 --- a/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot.2.minified.js +++ b/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot.2.minified.js @@ -8,15 +8,12 @@ var A; }(A || (A = {})); //// [function.ts] var A; -!function(A) { - var Point = function() { - return { - x: 0, - y: 0 - }; +(A || (A = {})).Point = function() { + return { + x: 0, + y: 0 }; - A.Point = Point; -}(A || (A = {})); +}; //// [simple.ts] var B; !function(B) { diff --git a/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedClasses.2.minified.js b/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedClasses.2.minified.js index 27de5622f365..af9fe7d729ce 100644 --- a/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedClasses.2.minified.js +++ b/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedClasses.2.minified.js @@ -2,14 +2,11 @@ var A; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(A) { - var _$A = function A() { + A.A = function A() { "use strict"; _class_call_check(this, A); - }; - A.A = _$A; - var AG = function AG() { + }, A.AG = function AG() { "use strict"; _class_call_check(this, AG); }; - A.AG = AG; }(A || (A = {})), new A.A(), new A.AG(), new A.A2(), new A.A2(); diff --git a/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedFunctions.2.minified.js b/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedFunctions.2.minified.js index ff61f2d6ddf4..c1a6aeca8670 100644 --- a/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedFunctions.2.minified.js +++ b/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedFunctions.2.minified.js @@ -1,10 +1,9 @@ //// [ModuleWithExportedAndNonExportedFunctions.ts] var A; !function(A) { - var fn = function(s) { + A.fn = function(s) { return !0; - }, fng = function(s) { + }, A.fng = function(s) { return null; }; - A.fn = fn, A.fng = fng; }(A || (A = {})), A.fn, A.fng, A.fn2, A.fng2; diff --git a/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedImportAlias.2.minified.js b/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedImportAlias.2.minified.js index 6ec3ce1eeba2..12bda674a9eb 100644 --- a/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedImportAlias.2.minified.js +++ b/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedImportAlias.2.minified.js @@ -1,13 +1,10 @@ //// [ModuleWithExportedAndNonExportedImportAlias.ts] var B, Geometry; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -!function(B) { - var Line = function Line(start, end) { - "use strict"; - _class_call_check(this, Line), this.start = start, this.end = end; - }; - B.Line = Line; -}(B || (B = {})), function(Geometry) { +(B || (B = {})).Line = function Line(start, end) { + "use strict"; + _class_call_check(this, Line), this.start = start, this.end = end; +}, function(Geometry) { var Points = A; Geometry.Points = Points; var Lines = B, Origin = Geometry.Origin = { diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.2.minified.js index 8424dd08ffaf..3bca6e3437de 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.2.minified.js @@ -1,18 +1,15 @@ //// [TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts] var A, X; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -!function(A) { - var Point = function Point() { - "use strict"; - _class_call_check(this, Point); - }; - A.Point = Point; -}(A || (A = {})), A || (A = {}), function(X) { - var Y, Z, Line; - Z = (Y = X.Y || (X.Y = {})).Z || (Y.Z = {}), Line = function Line() { +(A || (A = {})).Point = function Point() { + "use strict"; + _class_call_check(this, Point); +}, A || (A = {}), function(X) { + var Y; + ((Y = X.Y || (X.Y = {})).Z || (Y.Z = {})).Line = function Line() { "use strict"; _class_call_check(this, Line); - }, Z.Line = Line; + }; }(X || (X = {})), function(X) { var Y; (Y = X.Y || (X.Y = {})).Z || (Y.Z = {}); diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.2.minified.js index 3c36fff9c93b..3306442912b5 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.2.minified.js @@ -15,11 +15,10 @@ var A; var A; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(A) { - var Utils, Plane; - Utils = A.Utils || (A.Utils = {}), Plane = function Plane(tl, br) { + (A.Utils || (A.Utils = {})).Plane = function Plane(tl, br) { "use strict"; _class_call_check(this, Plane), this.tl = tl, this.br = br; - }, Utils.Plane = Plane; + }; }(A || (A = {})); //// [part3.ts] var o = A.Origin, o = A.Utils.mirror(o); diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.2.minified.js index d8e0167e87c0..7f04134c7454 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.2.minified.js @@ -1,28 +1,22 @@ //// [TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts] var A, X; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -!function(A) { - var Point = function Point() { - "use strict"; - _class_call_check(this, Point); - }; - A.Point = Point; -}(A || (A = {})), function(A) { - var Point = function Point() { - "use strict"; - _class_call_check(this, Point); - }; - A.Point = Point; -}(A || (A = {})), function(X) { - var Y, Z, Line; - Z = (Y = X.Y || (X.Y = {})).Z || (Y.Z = {}), Line = function Line() { +(A || (A = {})).Point = function Point() { + "use strict"; + _class_call_check(this, Point); +}, (A || (A = {})).Point = function Point() { + "use strict"; + _class_call_check(this, Point); +}, function(X) { + var Y; + ((Y = X.Y || (X.Y = {})).Z || (Y.Z = {})).Line = function Line() { "use strict"; _class_call_check(this, Line); - }, Z.Line = Line; + }; }(X || (X = {})), function(X) { - var Y, Z, Line; - Z = (Y = X.Y || (X.Y = {})).Z || (Y.Z = {}), Line = function Line() { + var Y; + ((Y = X.Y || (X.Y = {})).Z || (Y.Z = {})).Line = function Line() { "use strict"; _class_call_check(this, Line); - }, Z.Line = Line; + }; }(X || (X = {})); diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.2.minified.js index 8c217a1bdd1c..793e80daedd4 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.2.minified.js @@ -15,12 +15,11 @@ export var A; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var A; !function(A) { - var Utils, Plane; A.Origin = { x: 0, y: 0 - }, Utils = A.Utils || (A.Utils = {}), Plane = function Plane(tl, br) { + }, (A.Utils || (A.Utils = {})).Plane = function Plane(tl, br) { "use strict"; _class_call_check(this, Plane), this.tl = tl, this.br = br; - }, Utils.Plane = Plane; + }; }(A || (A = {})); diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.2.minified.js index 7a1d3ba50a3c..ee09c7056e6f 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.2.minified.js @@ -8,15 +8,15 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var B, x; (B || (B = {})).x = x; }(A || (A = {})), A.B.x, function(X) { - var Y, Z, Line; - Z = (Y = X.Y || (X.Y = {})).Z || (Y.Z = {}), Line = function Line() { + var Y; + ((Y = X.Y || (X.Y = {})).Z || (Y.Z = {})).Line = function Line() { "use strict"; _class_call_check(this, Line); - }, Z.Line = Line; + }; }(X || (X = {})), function(X) { - var Z, Z1, Line; - X.Y || (X.Y = {}), Z1 = Z || (Z = {}), Line = function Line() { + var Z; + X.Y || (X.Y = {}), (Z || (Z = {})).Line = function Line() { "use strict"; _class_call_check(this, Line); - }, Z1.Line = Line; + }; }(X || (X = {})); diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.2.minified.js index 45cd25e6cf8e..48a7cf7f0b13 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.2.minified.js @@ -13,12 +13,12 @@ var Root; var otherRoot; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(otherRoot) { - var A, Utils, Plane; + var A; (A = otherRoot.A || (otherRoot.A = {})).Origin = { x: 0, y: 0 - }, Utils = A.Utils || (A.Utils = {}), Plane = function Plane(tl, br) { + }, (A.Utils || (A.Utils = {})).Plane = function Plane(tl, br) { "use strict"; _class_call_check(this, Plane), this.tl = tl, this.br = br; - }, Utils.Plane = Plane; + }; }(otherRoot || (otherRoot = {})); diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot.2.minified.js index d6520e749ca7..dd15097ce32f 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot.2.minified.js @@ -12,14 +12,13 @@ var A; var A; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(A) { - var Utils, Plane; A.Origin = { x: 0, y: 0 - }, Utils = A.Utils || (A.Utils = {}), Plane = function Plane(tl, br) { + }, (A.Utils || (A.Utils = {})).Plane = function Plane(tl, br) { "use strict"; _class_call_check(this, Plane), this.tl = tl, this.br = br; - }, Utils.Plane = Plane; + }; }(A || (A = {})); //// [part3.ts] var o = A.Origin, o = A.Utils.mirror(o); diff --git a/crates/swc/tests/tsc-references/asOperatorASI.2.minified.js b/crates/swc/tests/tsc-references/asOperatorASI.2.minified.js index b51862a27b4f..6caeb37a504d 100644 --- a/crates/swc/tests/tsc-references/asOperatorASI.2.minified.js +++ b/crates/swc/tests/tsc-references/asOperatorASI.2.minified.js @@ -9,8 +9,7 @@ function _templateObject() { return data; }, data; } -var Foo = function Foo() { +as(_templateObject()), as(function Foo() { "use strict"; _class_call_check(this, Foo); -}; -as(_templateObject()), as(Foo); +}); diff --git a/crates/swc/tests/tsc-references/bestCommonTypeOfTuple.2.minified.js b/crates/swc/tests/tsc-references/bestCommonTypeOfTuple.2.minified.js index 587cb7ace50e..811e2121adcf 100644 --- a/crates/swc/tests/tsc-references/bestCommonTypeOfTuple.2.minified.js +++ b/crates/swc/tests/tsc-references/bestCommonTypeOfTuple.2.minified.js @@ -1,24 +1,14 @@ //// [bestCommonTypeOfTuple.ts] -var E1, E2, t1, t2, t3, t4; +var E1, E2, t2, t4; !function(E1) { E1[E1.one = 0] = "one"; }(E1 || (E1 = {})), function(E2) { E2[E2.two = 0] = "two"; -}(E2 || (E2 = {})), t1 = [ - function(x) { - return "foo"; - }, - function(x) { - return 10; - } -], t2 = [ +}(E2 || (E2 = {})), t2 = [ E1.one, E2.two -], t3 = [ - 5, - void 0 ], t4 = [ E1.one, E2.two, 20 -], t1[2], t2[2], t3[2], t4[3]; +], t2[2], t4[3]; diff --git a/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference.2.minified.js b/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference.2.minified.js index 1b7b094b086d..63ca8e8a275b 100644 --- a/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference.2.minified.js +++ b/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference.2.minified.js @@ -9,12 +9,10 @@ function m1() { }(), function(x) { void 0 === x || _type_of(x); }(1), function(M) { - M.x = 1; - var C = function C() { + M.x = 1, M.C = function C() { "use strict"; _class_call_check(this, C); }; - M.C = C; }(M || (M = {})), (m1 || (m1 = {})).y = 2; var M, e1, c1 = function c1(x) { "use strict"; diff --git a/crates/swc/tests/tsc-references/circularImportAlias.2.minified.js b/crates/swc/tests/tsc-references/circularImportAlias.2.minified.js index 0dd48392f0c2..51c4f569c1f1 100644 --- a/crates/swc/tests/tsc-references/circularImportAlias.2.minified.js +++ b/crates/swc/tests/tsc-references/circularImportAlias.2.minified.js @@ -17,11 +17,10 @@ import _create_super from "@swc/helpers/src/_create_super.mjs"; }(a.C); B.D = D; }(B || (B = {})), function(A) { - var C = function C() { + A.C = function C() { "use strict"; _class_call_check(this, C); }; - A.C = C; var b = B; A.b = b; }(A || (A = {})), new B.a.C(); diff --git a/crates/swc/tests/tsc-references/classAbstractSingleLineDecl.2.minified.js b/crates/swc/tests/tsc-references/classAbstractSingleLineDecl.2.minified.js index 4128daab047d..6f244f51e195 100644 --- a/crates/swc/tests/tsc-references/classAbstractSingleLineDecl.2.minified.js +++ b/crates/swc/tests/tsc-references/classAbstractSingleLineDecl.2.minified.js @@ -1,17 +1,12 @@ //// [classAbstractSingleLineDecl.ts] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var A = function A() { +abstract, abstract, new function A() { "use strict"; _class_call_check(this, A); -}; -abstract; -var B = function B() { +}, new function B() { "use strict"; _class_call_check(this, B); -}; -abstract; -var C = function C() { +}, new function C() { "use strict"; _class_call_check(this, C); }; -new A, new B, new C; diff --git a/crates/swc/tests/tsc-references/classConstructorAccessibility.2.minified.js b/crates/swc/tests/tsc-references/classConstructorAccessibility.2.minified.js index f40451c6ca14..4915a5424b92 100644 --- a/crates/swc/tests/tsc-references/classConstructorAccessibility.2.minified.js +++ b/crates/swc/tests/tsc-references/classConstructorAccessibility.2.minified.js @@ -1,25 +1,22 @@ //// [classConstructorAccessibility.ts] +var Generic; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var Generic, D = function D(x) { +new function C(x) { + "use strict"; + _class_call_check(this, C), this.x = x; +}(1), new function D(x) { "use strict"; _class_call_check(this, D), this.x = x; -}, E = function E(x) { +}(1), new function E(x) { "use strict"; _class_call_check(this, E), this.x = x; -}; -new function C(x) { +}(1), Generic || (Generic = {}), new function C(x) { "use strict"; _class_call_check(this, C), this.x = x; -}(1), new D(1), new E(1), function(Generic) { - var D = function D(x) { - "use strict"; - _class_call_check(this, D), this.x = x; - }, E = function E(x) { - "use strict"; - _class_call_check(this, E), this.x = x; - }; - new function C(x) { - "use strict"; - _class_call_check(this, C), this.x = x; - }(1), new D(1), new E(1); -}(Generic || (Generic = {})); +}(1), new function D(x) { + "use strict"; + _class_call_check(this, D), this.x = x; +}(1), new function E(x) { + "use strict"; + _class_call_check(this, E), this.x = x; +}(1); diff --git a/crates/swc/tests/tsc-references/classDoesNotDependOnPrivateMember.2.minified.js b/crates/swc/tests/tsc-references/classDoesNotDependOnPrivateMember.2.minified.js index 6d2a717a13a4..88a0a98b452b 100644 --- a/crates/swc/tests/tsc-references/classDoesNotDependOnPrivateMember.2.minified.js +++ b/crates/swc/tests/tsc-references/classDoesNotDependOnPrivateMember.2.minified.js @@ -1,10 +1,7 @@ //// [classDoesNotDependOnPrivateMember.ts] var M; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -!function(M) { - var C = function C() { - "use strict"; - _class_call_check(this, C); - }; - M.C = C; -}(M || (M = {})); +(M || (M = {})).C = function C() { + "use strict"; + _class_call_check(this, C); +}; diff --git a/crates/swc/tests/tsc-references/commonJSAliasedExport.2.minified.js b/crates/swc/tests/tsc-references/commonJSAliasedExport.2.minified.js index 6aed407dd15a..0ad837853c9d 100644 --- a/crates/swc/tests/tsc-references/commonJSAliasedExport.2.minified.js +++ b/crates/swc/tests/tsc-references/commonJSAliasedExport.2.minified.js @@ -1,8 +1,7 @@ //// [commonJSAliasedExport.js] -var donkey = function(ast) { +module.exports = function(ast) { return ast; -}; -module.exports = donkey, module.exports.funky = function(declaration) { +}, module.exports.funky = function(declaration) { return !1; }; //// [bug43713.js] diff --git a/crates/swc/tests/tsc-references/contextualTypeWithTuple.2.minified.js b/crates/swc/tests/tsc-references/contextualTypeWithTuple.2.minified.js index a9787c205504..eb4b8ca35a04 100644 --- a/crates/swc/tests/tsc-references/contextualTypeWithTuple.2.minified.js +++ b/crates/swc/tests/tsc-references/contextualTypeWithTuple.2.minified.js @@ -3,8 +3,8 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var C = function C() { "use strict"; _class_call_check(this, C); -}, D = function D() { +}; +new C(), new C(), new C(), new function D() { "use strict"; _class_call_check(this, D); -}; -new C(), new C(), new C(), new D(); +}(); diff --git a/crates/swc/tests/tsc-references/controlFlowInstanceofExtendsFunction.2.minified.js b/crates/swc/tests/tsc-references/controlFlowInstanceofExtendsFunction.2.minified.js index 44080b794540..6fde636ceb8d 100644 --- a/crates/swc/tests/tsc-references/controlFlowInstanceofExtendsFunction.2.minified.js +++ b/crates/swc/tests/tsc-references/controlFlowInstanceofExtendsFunction.2.minified.js @@ -12,10 +12,10 @@ var X = function() { return X.prototype.why = function() {}, X.now = function() { return {}; }, X; -}(), Y = function Y() { +}(); +console.log(X.now()), console.log((function Y() { "use strict"; _class_call_check(this, Y); -}; -console.log(X.now()), console.log(Y.now()); +}).now()); export var x = Math.random() > 0.5 ? new X() : 1; _instanceof(x, X) && x.why(); diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithAnyOtherType.2.minified.js b/crates/swc/tests/tsc-references/decrementOperatorWithAnyOtherType.2.minified.js index 4467b6e32ebf..10adafb9eb5d 100644 --- a/crates/swc/tests/tsc-references/decrementOperatorWithAnyOtherType.2.minified.js +++ b/crates/swc/tests/tsc-references/decrementOperatorWithAnyOtherType.2.minified.js @@ -6,13 +6,13 @@ var ANY, ANY1, M, ANY2 = [ ], obj = { x: 1, y: null -}, A = function A() { - "use strict"; - _class_call_check(this, A); }; !function(M) { var n; M.n = n; }(M || (M = {})); -var objA = new A(); +var objA = new function A() { + "use strict"; + _class_call_check(this, A); +}(); --ANY, --ANY1, ANY1--, ANY1--, --ANY2[0], --obj.x, --obj.y, --objA.a, --M.n, ANY2[0]--, obj.x--, obj.y--, objA.a--, M.n--, --ANY, --ANY1, --ANY2[0], --ANY, --ANY1, --objA.a, --M.n, ANY--, ANY1--, ANY2[0]--, ANY--, ANY1--, objA.a--, M.n--; diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithNumberType.2.minified.js b/crates/swc/tests/tsc-references/decrementOperatorWithNumberType.2.minified.js index 767098909238..ab5c12af02a1 100644 --- a/crates/swc/tests/tsc-references/decrementOperatorWithNumberType.2.minified.js +++ b/crates/swc/tests/tsc-references/decrementOperatorWithNumberType.2.minified.js @@ -3,13 +3,13 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var NUMBER, M, NUMBER1 = [ 1, 2 -], A = function A() { - "use strict"; - _class_call_check(this, A); -}; +]; !function(M) { var n; M.n = n; }(M || (M = {})); -var objA = new A(); +var objA = new function A() { + "use strict"; + _class_call_check(this, A); +}(); --NUMBER, NUMBER--, --objA.a, --M.n, objA.a--, M.n--, NUMBER1[0]--, --NUMBER, --NUMBER1[0], --objA.a, --M.n, --objA.a, M.n, NUMBER--, NUMBER1[0]--, objA.a--, M.n--, objA.a--, M.n--; diff --git a/crates/swc/tests/tsc-references/es6modulekindWithES5Target4.2.minified.js b/crates/swc/tests/tsc-references/es6modulekindWithES5Target4.2.minified.js index 8b8d38d8095b..e353f29598bf 100644 --- a/crates/swc/tests/tsc-references/es6modulekindWithES5Target4.2.minified.js +++ b/crates/swc/tests/tsc-references/es6modulekindWithES5Target4.2.minified.js @@ -1,7 +1,6 @@ //// [es6modulekindWithES5Target4.ts] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var E = function E() { +export default function E() { "use strict"; _class_call_check(this, E); }; -export default E; diff --git a/crates/swc/tests/tsc-references/esnextmodulekindWithES5Target4.2.minified.js b/crates/swc/tests/tsc-references/esnextmodulekindWithES5Target4.2.minified.js index 332cea56c771..cbf5f9e5370e 100644 --- a/crates/swc/tests/tsc-references/esnextmodulekindWithES5Target4.2.minified.js +++ b/crates/swc/tests/tsc-references/esnextmodulekindWithES5Target4.2.minified.js @@ -1,7 +1,6 @@ //// [esnextmodulekindWithES5Target4.ts] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var E = function E() { +export default function E() { "use strict"; _class_call_check(this, E); }; -export default E; diff --git a/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInitializer.2.minified.js b/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInitializer.2.minified.js index f3167f151092..612b10b5d184 100644 --- a/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInitializer.2.minified.js +++ b/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInitializer.2.minified.js @@ -3,16 +3,15 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var M, C = function C() { "use strict"; _class_call_check(this, C); -}, D = function D() { - "use strict"; - _class_call_check(this, D); }; !function(M) { - var F2 = function(x) { - return x.toString(); - }, A = function A() { + M.A = function A() { "use strict"; _class_call_check(this, A); + }, M.F2 = function(x) { + return x.toString(); }; - M.A = A, M.F2 = F2; -}(M || (M = {})), new C(), new C(), new D(), new C(), new M.A(); +}(M || (M = {})), new C(), new C(), new function D() { + "use strict"; + _class_call_check(this, D); +}(), new C(), new M.A(); diff --git a/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInvalidInitializer.2.minified.js b/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInvalidInitializer.2.minified.js index a7ab4b43e2dd..03b185d736b6 100644 --- a/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInvalidInitializer.2.minified.js +++ b/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInvalidInitializer.2.minified.js @@ -8,19 +8,17 @@ var M, N, C = function C() { _class_call_check(this, D); }; !function(M) { - var _$F2 = function(x) { - return x.toString(); - }, A = function A() { + M.A = function A() { "use strict"; _class_call_check(this, A); + }, M.F2 = function(x) { + return x.toString(); }; - M.A = A, M.F2 = _$F2; }(M || (M = {})), function(N) { - var _$F2 = function(x) { - return x.toString(); - }, A = function A() { + N.A = function A() { "use strict"; _class_call_check(this, A); + }, N.F2 = function(x) { + return x.toString(); }; - N.A = A, N.F2 = _$F2; }(N || (N = {})), new D(), new D(), new C(), new C(), new N.A(); diff --git a/crates/swc/tests/tsc-references/everyTypeWithInitializer.2.minified.js b/crates/swc/tests/tsc-references/everyTypeWithInitializer.2.minified.js index 698e020b7f0f..1c84e0b6e07d 100644 --- a/crates/swc/tests/tsc-references/everyTypeWithInitializer.2.minified.js +++ b/crates/swc/tests/tsc-references/everyTypeWithInitializer.2.minified.js @@ -3,16 +3,15 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var M, C = function C() { "use strict"; _class_call_check(this, C); -}, D = function D() { - "use strict"; - _class_call_check(this, D); }; !function(M) { - var F2 = function(x) { - return x.toString(); - }, A = function A() { + M.A = function A() { "use strict"; _class_call_check(this, A); + }, M.F2 = function(x) { + return x.toString(); }; - M.A = A, M.F2 = F2; -}(M || (M = {})), new C(), new C(), new D(), new M.A(), M.F2; +}(M || (M = {})), new C(), new C(), new function D() { + "use strict"; + _class_call_check(this, D); +}(), new M.A(), M.F2; diff --git a/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType.2.minified.js index 5f325e4cad15..6ea7081e9f54 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType.2.minified.js @@ -1,10 +1,10 @@ //// [foo_0.ts] "use strict"; -var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default, Foo = function Foo(x) { +var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default; +module.exports = function Foo(x) { "use strict"; _classCallCheck(this, Foo); }; -module.exports = Foo; //// [foo_1.ts] "use strict"; Object.defineProperty(exports, "__esModule", { diff --git a/crates/swc/tests/tsc-references/exportAssignmentGenericType.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentGenericType.2.minified.js index cd92e1da55c7..196551170b2e 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentGenericType.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentGenericType.2.minified.js @@ -1,10 +1,10 @@ //// [foo_0.ts] "use strict"; -var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default, Foo = function Foo() { +var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default; +module.exports = function Foo() { "use strict"; _classCallCheck(this, Foo); }; -module.exports = Foo; //// [foo_1.ts] "use strict"; Object.defineProperty(exports, "__esModule", { diff --git a/crates/swc/tests/tsc-references/exportAssignmentMergedModule.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentMergedModule.2.minified.js index 29779e1e494f..4ba41c799904 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentMergedModule.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentMergedModule.2.minified.js @@ -2,15 +2,13 @@ "use strict"; var Foo; !function(Foo) { - var a = function() { + Foo.a = function() { return 5; - }; - Foo.a = a, Foo.b = !0; + }, Foo.b = !0; }(Foo || (Foo = {})), function(Foo) { - var c = function(a) { + Foo.c = function(a) { return a; - }; - Foo.c = c, (Foo.Test || (Foo.Test = {})).answer = 42; + }, (Foo.Test || (Foo.Test = {})).answer = 42; }(Foo || (Foo = {})), module.exports = Foo; //// [foo_1.ts] "use strict"; diff --git a/crates/swc/tests/tsc-references/exportCodeGen.2.minified.js b/crates/swc/tests/tsc-references/exportCodeGen.2.minified.js index 393c410883da..e42f4704db70 100644 --- a/crates/swc/tests/tsc-references/exportCodeGen.2.minified.js +++ b/crates/swc/tests/tsc-references/exportCodeGen.2.minified.js @@ -1,19 +1,14 @@ //// [exportCodeGen.ts] var A, B, C, D, E, F; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -(A || (A = {})).x = 12, B || (B = {}), C || (C = {}), function(D) { - var yes = function() { - return !0; - }; - D.yes = yes; -}(D || (D = {})), function(E) { - var Color, fn = function() {}; - (Color = E.Color || (E.Color = {}))[Color.Red = 0] = "Red", E.fn = fn; - var C = function C() { +(A || (A = {})).x = 12, B || (B = {}), C || (C = {}), (D || (D = {})).yes = function() { + return !0; +}, function(E) { + var Color; + (Color = E.Color || (E.Color = {}))[Color.Red = 0] = "Red", E.fn = function() {}, E.C = function C() { "use strict"; _class_call_check(this, C); - }; - E.C = C, (E.M || (E.M = {})).x = 42; + }, (E.M || (E.M = {})).x = 42; }(E || (E = {})), function(F) { var Color, M, Color1; (Color1 = Color || (Color = {}))[Color1.Red = 0] = "Red", M || (M = {}); diff --git a/crates/swc/tests/tsc-references/exportImportAlias.2.minified.js b/crates/swc/tests/tsc-references/exportImportAlias.2.minified.js index 79ab0747d645..7d87d377c448 100644 --- a/crates/swc/tests/tsc-references/exportImportAlias.2.minified.js +++ b/crates/swc/tests/tsc-references/exportImportAlias.2.minified.js @@ -2,23 +2,21 @@ var A, C, X, Z, K, M; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(A) { - A.x = "hello world"; - var Point = function Point(x, y) { + A.x = "hello world", A.Point = function Point(x, y) { "use strict"; _class_call_check(this, Point), this.x = x, this.y = y; }; - A.Point = Point; }(A || (A = {})), function(C) { var a = A; C.a = a; }(C || (C = {})), C.a.x, new C.a.Point(0, 0), function(X) { - var Y, Point, Y1 = function() { + var Y = function() { return 42; }; - X.Y = Y1, Y = Y1 = X.Y || (X.Y = {}), Point = function Point(x, y) { + X.Y = Y, (Y = X.Y || (X.Y = {})).Point = function Point(x, y) { "use strict"; _class_call_check(this, Point), this.x = x, this.y = y; - }, Y.Point = Point; + }; }(X || (X = {})), function(Z) { var y = X.Y; Z.y = y; diff --git a/crates/swc/tests/tsc-references/extendClassExpressionFromModule.2.minified.js b/crates/swc/tests/tsc-references/extendClassExpressionFromModule.2.minified.js index 3301d1da52f3..2fce65ce5d96 100644 --- a/crates/swc/tests/tsc-references/extendClassExpressionFromModule.2.minified.js +++ b/crates/swc/tests/tsc-references/extendClassExpressionFromModule.2.minified.js @@ -1,10 +1,10 @@ //// [foo1.ts] "use strict"; -var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default, x = function x() { +var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default; +module.exports = function x() { "use strict"; _classCallCheck(this, x); }; -module.exports = x; //// [foo2.ts] "use strict"; Object.defineProperty(exports, "__esModule", { diff --git a/crates/swc/tests/tsc-references/filterNamespace_import.2.minified.js b/crates/swc/tests/tsc-references/filterNamespace_import.2.minified.js index 773ecca17d06..991f375af955 100644 --- a/crates/swc/tests/tsc-references/filterNamespace_import.2.minified.js +++ b/crates/swc/tests/tsc-references/filterNamespace_import.2.minified.js @@ -2,14 +2,13 @@ var ns; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(ns) { - var nested, NestedClass, Class = function Class() { + ns.Class = function Class() { "use strict"; _class_call_check(this, Class); - }; - ns.Class = Class, ns.Value = "", nested = ns.nested || (ns.nested = {}), NestedClass = function NestedClass() { + }, ns.Value = "", (ns.nested || (ns.nested = {})).NestedClass = function NestedClass() { "use strict"; _class_call_check(this, NestedClass); - }, nested.NestedClass = NestedClass; + }; }(ns || (ns = {})); export default ns; //// [/a.ts] diff --git a/crates/swc/tests/tsc-references/for-inStatements.2.minified.js b/crates/swc/tests/tsc-references/for-inStatements.2.minified.js index 44cd26b3366f..3072458a49ba 100644 --- a/crates/swc/tests/tsc-references/for-inStatements.2.minified.js +++ b/crates/swc/tests/tsc-references/for-inStatements.2.minified.js @@ -33,13 +33,10 @@ for(var x in function(x, y) { return x + y; }); for(var x in i[42]); -for(var x in !function(M) { - var X = function X() { - "use strict"; - _class_call_check(this, X); - }; - M.X = X; -}(M || (M = {})), M); +for(var x in (M || (M = {})).X = function X() { + "use strict"; + _class_call_check(this, X); +}, M); for(var x in M.X); for(var x in !function(Color) { Color[Color.Red = 0] = "Red", Color[Color.Blue = 1] = "Blue"; diff --git a/crates/swc/tests/tsc-references/forStatements.2.minified.js b/crates/swc/tests/tsc-references/forStatements.2.minified.js index bd413820e3d5..3ec4b2517e13 100644 --- a/crates/swc/tests/tsc-references/forStatements.2.minified.js +++ b/crates/swc/tests/tsc-references/forStatements.2.minified.js @@ -3,18 +3,14 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var M, C = function C() { "use strict"; _class_call_check(this, C); -}, D = function D() { - "use strict"; - _class_call_check(this, D); }; for(!function(M) { - var F2 = function(x) { - return x.toString(); - }, A = function A() { + M.A = function A() { "use strict"; _class_call_check(this, A); + }, M.F2 = function(x) { + return x.toString(); }; - M.A = A, M.F2 = F2; }(M || (M = {}));;); for(;;); for(;;); @@ -24,7 +20,10 @@ for(;;); for(;;); for(new C();;); for(new C();;); -for(new D();;); +for(new function D() { + "use strict"; + _class_call_check(this, D); +}();;); for(;;); for(new C();;); for(;;); diff --git a/crates/swc/tests/tsc-references/forStatementsMultipleInvalidDecl.2.minified.js b/crates/swc/tests/tsc-references/forStatementsMultipleInvalidDecl.2.minified.js index afc70bfaf19f..e5e8926d20bf 100644 --- a/crates/swc/tests/tsc-references/forStatementsMultipleInvalidDecl.2.minified.js +++ b/crates/swc/tests/tsc-references/forStatementsMultipleInvalidDecl.2.minified.js @@ -18,13 +18,12 @@ var M, a, b, arr, m, C = function C() { _class_call_check(this, D); }; for(!function(M) { - var F2 = function(x) { - return x.toString(); - }, A = function A() { + M.A = function A() { "use strict"; _class_call_check(this, A); + }, M.F2 = function(x) { + return x.toString(); }; - M.A = A, M.F2 = F2; }(M || (M = {}));;); for(;;); for(;;); diff --git a/crates/swc/tests/tsc-references/forgottenNew.2.minified.js b/crates/swc/tests/tsc-references/forgottenNew.2.minified.js index c52d29355144..1c260c7b0cfa 100644 --- a/crates/swc/tests/tsc-references/forgottenNew.2.minified.js +++ b/crates/swc/tests/tsc-references/forgottenNew.2.minified.js @@ -1,10 +1,7 @@ //// [forgottenNew.ts] var Tools; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -!function(Tools) { - var NullLogger = function NullLogger() { - "use strict"; - _class_call_check(this, NullLogger); - }; - Tools.NullLogger = NullLogger; -}(Tools || (Tools = {})), Tools.NullLogger(); +(Tools || (Tools = {})).NullLogger = function NullLogger() { + "use strict"; + _class_call_check(this, NullLogger); +}, Tools.NullLogger(); diff --git a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints3.2.minified.js b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints3.2.minified.js index 6bb35658ff44..7fab8c6df6ec 100644 --- a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints3.2.minified.js +++ b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints3.2.minified.js @@ -2,7 +2,7 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -var y, y1, Base = function Base() { +var Base = function Base() { "use strict"; _class_call_check(this, Base); }, Derived = function(Base) { @@ -22,8 +22,4 @@ var y, y1, Base = function Base() { } return Derived2; }(Base); -new Derived(), new Derived2(), new Derived(), new Derived2(), new Derived(), new Derived2(), y = function(x) { - return x; -}, new Base(), y(null), y1 = function(x) { - return x; -}, new Derived(), y1(null); +new Derived(), new Derived2(), new Derived(), new Derived2(), new Derived(), new Derived2(), new Base(), new Derived(); diff --git a/crates/swc/tests/tsc-references/genericClassExpressionInFunction.2.minified.js b/crates/swc/tests/tsc-references/genericClassExpressionInFunction.2.minified.js index c546d9883144..888d246505a8 100644 --- a/crates/swc/tests/tsc-references/genericClassExpressionInFunction.2.minified.js +++ b/crates/swc/tests/tsc-references/genericClassExpressionInFunction.2.minified.js @@ -5,16 +5,6 @@ import _create_super from "@swc/helpers/src/_create_super.mjs"; var A = function A() { "use strict"; _class_call_check(this, A); -}, B2 = function B2() { - "use strict"; - _class_call_check(this, B2), this.anon = function(A) { - _inherits(_class, A); - var _super = _create_super(_class); - function _class() { - return _class_call_check(this, _class), _super.apply(this, arguments); - } - return _class; - }(A); }, K = function(_superClass) { "use strict"; _inherits(K, _superClass); @@ -39,7 +29,17 @@ var A = function A() { return _class_call_check(this, C), _super.apply(this, arguments); } return C; -}(new B2().anon), S = function(b3Number) { +}(new function B2() { + "use strict"; + _class_call_check(this, B2), this.anon = function(A) { + _inherits(_class, A); + var _super = _create_super(_class); + function _class() { + return _class_call_check(this, _class), _super.apply(this, arguments); + } + return _class; + }(A); +}().anon), S = function(b3Number) { "use strict"; _inherits(S, b3Number); var _super = _create_super(S); diff --git a/crates/swc/tests/tsc-references/ifDoWhileStatements.2.minified.js b/crates/swc/tests/tsc-references/ifDoWhileStatements.2.minified.js index fcc3f12952e9..a23e1ade4e6c 100644 --- a/crates/swc/tests/tsc-references/ifDoWhileStatements.2.minified.js +++ b/crates/swc/tests/tsc-references/ifDoWhileStatements.2.minified.js @@ -10,21 +10,19 @@ var M, N, C = function C() { _class_call_check(this, D); }; for(!function(M) { - var F2 = function(x) { - return x.toString(); - }, A = function A() { + M.A = function A() { "use strict"; _class_call_check(this, A); + }, M.F2 = function(x) { + return x.toString(); }; - M.A = A, M.F2 = F2; }(M || (M = {})), function(N) { - var F2 = function(x) { - return x.toString(); - }, A = function A() { + N.A = function A() { "use strict"; _class_call_check(this, A); + }, N.F2 = function(x) { + return x.toString(); }; - N.A = A, N.F2 = F2; }(N || (N = {}));;); for(;;); for(;;); diff --git a/crates/swc/tests/tsc-references/importAliasIdentifiers.2.minified.js b/crates/swc/tests/tsc-references/importAliasIdentifiers.2.minified.js index 30ad3005670b..354908aa7911 100644 --- a/crates/swc/tests/tsc-references/importAliasIdentifiers.2.minified.js +++ b/crates/swc/tests/tsc-references/importAliasIdentifiers.2.minified.js @@ -1,12 +1,9 @@ //// [importAliasIdentifiers.ts] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -!function(moduleA) { - var Point = function Point(x, y) { - "use strict"; - _class_call_check(this, Point), this.x = x, this.y = y; - }; - moduleA.Point = Point; -}(moduleA || (moduleA = {})); +(moduleA || (moduleA = {})).Point = function Point(x, y) { + "use strict"; + _class_call_check(this, Point), this.x = x, this.y = y; +}; var moduleA, clodule = function clodule() { "use strict"; _class_call_check(this, clodule); diff --git a/crates/swc/tests/tsc-references/importStatements.2.minified.js b/crates/swc/tests/tsc-references/importStatements.2.minified.js index ca7b72a2865a..b21122a8b8c5 100644 --- a/crates/swc/tests/tsc-references/importStatements.2.minified.js +++ b/crates/swc/tests/tsc-references/importStatements.2.minified.js @@ -8,8 +8,8 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; }; A.Point = Point, A.Origin = new Point(0, 0); }(A || (A = {})), C || (C = {}), D || (D = {}), new A.Point(1, 1), function(E) { - var xDist = function(x) { + var a = A; + E.xDist = function(x) { return a.Origin.x - x.x; - }, a = A; - E.xDist = xDist; + }; }(E || (E = {})); diff --git a/crates/swc/tests/tsc-references/importStatementsInterfaces.2.minified.js b/crates/swc/tests/tsc-references/importStatementsInterfaces.2.minified.js index e42544d24bf2..4334d5daa9d8 100644 --- a/crates/swc/tests/tsc-references/importStatementsInterfaces.2.minified.js +++ b/crates/swc/tests/tsc-references/importStatementsInterfaces.2.minified.js @@ -1,8 +1,5 @@ //// [importStatementsInterfaces.ts] var C, D, E; -C || (C = {}), D || (D = {}), function(E) { - var xDist = function(x) { - return 0 - x.x; - }; - E.xDist = xDist; -}(E || (E = {})); +C || (C = {}), D || (D = {}), (E || (E = {})).xDist = function(x) { + return 0 - x.x; +}; diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithAnyOtherType.2.minified.js b/crates/swc/tests/tsc-references/incrementOperatorWithAnyOtherType.2.minified.js index 86b3049e6c1e..7d8123cdf5ed 100644 --- a/crates/swc/tests/tsc-references/incrementOperatorWithAnyOtherType.2.minified.js +++ b/crates/swc/tests/tsc-references/incrementOperatorWithAnyOtherType.2.minified.js @@ -6,13 +6,13 @@ var ANY, ANY1, M, ANY2 = [ ], obj = { x: 1, y: null -}, A = function A() { - "use strict"; - _class_call_check(this, A); }; !function(M) { var n; M.n = n; }(M || (M = {})); -var objA = new A(); +var objA = new function A() { + "use strict"; + _class_call_check(this, A); +}(); ++ANY, ++ANY1, ANY1++, ANY1++, ++ANY2[0], ++obj.x, ++obj.y, ++objA.a, ++M.n, ANY2[0]++, obj.x++, obj.y++, objA.a++, M.n++, ++ANY, ++ANY1, ++ANY2[0], ++ANY, ++ANY1, ++objA.a, ++M.n, ANY++, ANY1++, ANY2[0]++, ANY++, ANY1++, objA.a++, M.n++; diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithNumberType.2.minified.js b/crates/swc/tests/tsc-references/incrementOperatorWithNumberType.2.minified.js index 875f67552c0e..e4c9b5d7ee50 100644 --- a/crates/swc/tests/tsc-references/incrementOperatorWithNumberType.2.minified.js +++ b/crates/swc/tests/tsc-references/incrementOperatorWithNumberType.2.minified.js @@ -3,13 +3,13 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var NUMBER, M, NUMBER1 = [ 1, 2 -], A = function A() { - "use strict"; - _class_call_check(this, A); -}; +]; !function(M) { var n; M.n = n; }(M || (M = {})); -var objA = new A(); +var objA = new function A() { + "use strict"; + _class_call_check(this, A); +}(); ++NUMBER, NUMBER++, ++objA.a, ++M.n, objA.a++, M.n++, NUMBER1[0]++, ++NUMBER, ++NUMBER1[0], ++objA.a, ++M.n, ++objA.a, M.n, NUMBER++, NUMBER1[0]++, objA.a++, M.n++, objA.a++, M.n++; diff --git a/crates/swc/tests/tsc-references/interfaceWithPropertyOfEveryType.2.minified.js b/crates/swc/tests/tsc-references/interfaceWithPropertyOfEveryType.2.minified.js index 662c4b360466..c5d27eb70d23 100644 --- a/crates/swc/tests/tsc-references/interfaceWithPropertyOfEveryType.2.minified.js +++ b/crates/swc/tests/tsc-references/interfaceWithPropertyOfEveryType.2.minified.js @@ -1,9 +1,9 @@ //// [interfaceWithPropertyOfEveryType.ts] +var M, E; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var M, E, C = function C() { - "use strict"; - _class_call_check(this, C); -}; (M || (M = {})).y = 1, function(E) { E[E.A = 0] = "A"; -}(E || (E = {})), new C(), E.A; +}(E || (E = {})), new function C() { + "use strict"; + _class_call_check(this, C); +}(), E.A; diff --git a/crates/swc/tests/tsc-references/invalidMultipleVariableDeclarations.2.minified.js b/crates/swc/tests/tsc-references/invalidMultipleVariableDeclarations.2.minified.js index cfbb5c6f0f6a..dfc9ca7b859a 100644 --- a/crates/swc/tests/tsc-references/invalidMultipleVariableDeclarations.2.minified.js +++ b/crates/swc/tests/tsc-references/invalidMultipleVariableDeclarations.2.minified.js @@ -18,11 +18,10 @@ var M, C = function C() { _class_call_check(this, D); }; !function(M) { - var F2 = function(x) { - return x.toString(); - }, A = function A() { + M.A = function A() { "use strict"; _class_call_check(this, A); + }, M.F2 = function(x) { + return x.toString(); }; - M.A = A, M.F2 = F2; }(M || (M = {})), new C(), new D(), new C(), new C2(), new C(), new C2(), new D(), new D(), M.A; diff --git a/crates/swc/tests/tsc-references/invalidNestedModules.2.minified.js b/crates/swc/tests/tsc-references/invalidNestedModules.2.minified.js index 03dfe7f83247..5ead8a551653 100644 --- a/crates/swc/tests/tsc-references/invalidNestedModules.2.minified.js +++ b/crates/swc/tests/tsc-references/invalidNestedModules.2.minified.js @@ -2,23 +2,21 @@ var A, M2; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(A) { - var B, C, Point; - C = (B = A.B || (A.B = {})).C || (B.C = {}), Point = function Point() { + var B; + ((B = A.B || (A.B = {})).C || (B.C = {})).Point = function Point() { "use strict"; _class_call_check(this, Point); - }, C.Point = Point; + }; }(A || (A = {})), function(A) { - var B, C; - B = A.B || (A.B = {}), C = function C() { + (A.B || (A.B = {})).C = function C() { "use strict"; _class_call_check(this, C); - }, B.C = C; + }; }(A || (A = {})), function(M2) { - var X, Point; - X = M2.X || (M2.X = {}), Point = function Point() { + (M2.X || (M2.X = {})).Point = function Point() { "use strict"; _class_call_check(this, Point); - }, X.Point = Point; + }; }(M2 || (M2 = {})), function(M2) { var Point; (M2.X || (M2.X = {})).Point = Point; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsClassExtendsVisibility.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsClassExtendsVisibility.2.minified.js index f32c5e79ff37..fb4e8cb2ccff 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsClassExtendsVisibility.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsClassExtendsVisibility.2.minified.js @@ -1,10 +1,9 @@ //// [bar.js] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var Bar = function Bar() { +module.exports = function Bar() { "use strict"; _class_call_check(this, Bar); }; -module.exports = Bar; //// [cls.js] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsCommonjsRelativePath.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsCommonjsRelativePath.2.minified.js index e2bc9122471a..8f2f1c7ffe5e 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsCommonjsRelativePath.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsCommonjsRelativePath.2.minified.js @@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: !0 }); -var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default, Thing = function Thing() { - _classCallCheck(this, Thing); -}; +var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default; module.exports = { - Thing: Thing + Thing: function Thing() { + _classCallCheck(this, Thing); + } }; //// [reexport.js] "use strict"; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsDocCommentsOnConsts.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsDocCommentsOnConsts.2.minified.js index f43f4aec4ad0..5a61a8883ad0 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsDocCommentsOnConsts.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsDocCommentsOnConsts.2.minified.js @@ -1,9 +1,8 @@ //// [index1.js] -var x = function(a) { - return ""; -}; module.exports = { - x: x, + x: function(a) { + return ""; + }, b: function() { return 0; } diff --git a/crates/swc/tests/tsc-references/jsDeclarationsExportAssignedClassInstance1.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsExportAssignedClassInstance1.2.minified.js index 9c068e47d9fa..796f2818c1ac 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsExportAssignedClassInstance1.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsExportAssignedClassInstance1.2.minified.js @@ -1,7 +1,6 @@ //// [index.js] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var Foo = function Foo() { +module.exports = new function Foo() { "use strict"; _class_call_check(this, Foo); -}; -module.exports = new Foo(); +}(); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsExportAssignedVisibility.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsExportAssignedVisibility.2.minified.js index 8a7220d357bf..d16785bc9966 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsExportAssignedVisibility.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsExportAssignedVisibility.2.minified.js @@ -6,8 +6,8 @@ module.exports = function Obj() { }; //// [index.js] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var Obj = require("./obj"), Container = function Container() { +var Obj = require("./obj"); +module.exports = function Container() { "use strict"; _class_call_check(this, Container), this.usage = new Obj(); }; -module.exports = Container; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsExportSubAssignments.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsExportSubAssignments.2.minified.js index 284b61b2da29..97116d88fd44 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsExportSubAssignments.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsExportSubAssignments.2.minified.js @@ -1,10 +1,9 @@ //// [cls.js] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var Foo = function Foo() { +module.exports = function Foo() { "use strict"; _class_call_check(this, Foo); -}; -module.exports = Foo, module.exports.Strings = { +}, module.exports.Strings = { a: "A", b: "B" }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsModuleReferenceHasEmit.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsModuleReferenceHasEmit.2.minified.js index 2e0dd704d388..3b1c619cbf56 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsModuleReferenceHasEmit.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsModuleReferenceHasEmit.2.minified.js @@ -1,8 +1,7 @@ //// [index.js] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var A = function A() { +export var el = null; +export default function A() { "use strict"; _class_call_check(this, A); }; -export var el = null; -export default A; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsReexportAliasesEsModuleInterop.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsReexportAliasesEsModuleInterop.2.minified.js index b2d16ec3dd10..7f24462932c6 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsReexportAliasesEsModuleInterop.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsReexportAliasesEsModuleInterop.2.minified.js @@ -1,10 +1,9 @@ //// [cls.js] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var Foo = function Foo() { +module.exports = function Foo() { "use strict"; _class_call_check(this, Foo); }; -module.exports = Foo; //// [usage.js] import { default as Fooa } from "./cls"; export var x = new Fooa(); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsReferenceToClassInstanceCrossFile.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsReferenceToClassInstanceCrossFile.2.minified.js index 2c196a3a0215..037788cb97e8 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsReferenceToClassInstanceCrossFile.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsReferenceToClassInstanceCrossFile.2.minified.js @@ -1,11 +1,10 @@ //// [rectangle.js] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var Rectangle = function Rectangle() { - "use strict"; - _class_call_check(this, Rectangle), console.log("I'm a rectangle!"); -}; module.exports = { - Rectangle: Rectangle + Rectangle: function Rectangle() { + "use strict"; + _class_call_check(this, Rectangle), console.log("I'm a rectangle!"); + } }; //// [index.js] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases.2.minified.js index e36970221659..84505ba211b8 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases.2.minified.js @@ -2,15 +2,14 @@ export { }; //// [mixed.js] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var ExportedThing = function ExportedThing() { - "use strict"; - _class_call_check(this, ExportedThing), this.z = "ok"; -}; module.exports = { doTheThing: function(x) { return { x: "" + x }; }, - ExportedThing: ExportedThing + ExportedThing: function ExportedThing() { + "use strict"; + _class_call_check(this, ExportedThing), this.z = "ok"; + } }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes.2.minified.js index 20909705e345..c7d351940e8d 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes.2.minified.js @@ -10,10 +10,9 @@ var Conn = function() { module.exports = Conn; //// [usage.js] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var Wrap = function Wrap(c) { - "use strict"; - _class_call_check(this, Wrap), this.connItem = c.item, this.another = ""; -}; module.exports = { - Wrap: Wrap + Wrap: function Wrap(c) { + "use strict"; + _class_call_check(this, Wrap), this.connItem = c.item, this.another = ""; + } }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment.2.minified.js index bfbea32b7ab2..4a3718820dc0 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment.2.minified.js @@ -15,9 +15,7 @@ module.exports = { //// [index.js] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var ref = require("./module.js"); -ref.taskGroups, ref.taskNameToGroup; -var MainThreadTasks = function MainThreadTasks(x, y) { +ref.taskGroups, ref.taskNameToGroup, module.exports = function MainThreadTasks(x, y) { "use strict"; _class_call_check(this, MainThreadTasks); }; -module.exports = MainThreadTasks; diff --git a/crates/swc/tests/tsc-references/mixinAccessModifiers.2.minified.js b/crates/swc/tests/tsc-references/mixinAccessModifiers.2.minified.js index 570e95172836..3023a301d12d 100644 --- a/crates/swc/tests/tsc-references/mixinAccessModifiers.2.minified.js +++ b/crates/swc/tests/tsc-references/mixinAccessModifiers.2.minified.js @@ -10,18 +10,10 @@ var Private = function Private() { "use strict"; for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; _class_call_check(this, Protected); -}, Protected2 = function Protected2() { - "use strict"; - for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; - _class_call_check(this, Protected2); }, Public = function Public() { "use strict"; for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; _class_call_check(this, Public); -}, Public2 = function Public2() { - "use strict"; - for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; - _class_call_check(this, Public2); }; Mix(Private, function Private2() { "use strict"; @@ -40,7 +32,11 @@ var C4 = function(_superClass) { }, C4.g = function() { C4.s, C5.s, C6.s; }, C4; -}(Mix(Protected, Protected2)), C5 = function(_superClass) { +}(Mix(Protected, function Protected2() { + "use strict"; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + _class_call_check(this, Protected2); +})), C5 = function(_superClass) { "use strict"; _inherits(C5, _superClass); var _super = _create_super(C5); @@ -64,4 +60,8 @@ var C4 = function(_superClass) { }, C6.g = function() { C4.s, C5.s, C6.s; }, C6; -}(Mix(Public, Public2)); +}(Mix(Public, function Public2() { + "use strict"; + for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + _class_call_check(this, Public2); +})); diff --git a/crates/swc/tests/tsc-references/moduleExportAlias3.2.minified.js b/crates/swc/tests/tsc-references/moduleExportAlias3.2.minified.js index 8b2d0265935f..deafb11133cf 100644 --- a/crates/swc/tests/tsc-references/moduleExportAlias3.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleExportAlias3.2.minified.js @@ -1,9 +1,8 @@ //// [bug24062.js] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var C = function C() { - "use strict"; - _class_call_check(this, C); -}; module.exports = { - C: C + C: function C() { + "use strict"; + _class_call_check(this, C); + } }; diff --git a/crates/swc/tests/tsc-references/moduleWithStatementsOfEveryKind.2.minified.js b/crates/swc/tests/tsc-references/moduleWithStatementsOfEveryKind.2.minified.js index f31e9ce02b3e..a6765ea5d417 100644 --- a/crates/swc/tests/tsc-references/moduleWithStatementsOfEveryKind.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleWithStatementsOfEveryKind.2.minified.js @@ -7,9 +7,7 @@ import _create_super from "@swc/helpers/src/_create_super.mjs"; var Module, Color, Color1; Module || (Module = {}), (Color1 = Color || (Color = {}))[Color1.Blue = 0] = "Blue", Color1[Color1.Red = 1] = "Red"; }(A || (A = {})), function(Y) { - var Color, F = function(s) { - return 2; - }, A = function A() { + var Color, A = function A() { "use strict"; _class_call_check(this, A); }; @@ -38,7 +36,9 @@ import _create_super from "@swc/helpers/src/_create_super.mjs"; } return BB; }(A); - Y.BB = BB, Y.Module || (Y.Module = {}), (Color = Y.Color || (Y.Color = {}))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red", Y.x = 12, Y.F = F, Y.array = null, Y.fn = function(s) { + Y.BB = BB, Y.Module || (Y.Module = {}), (Color = Y.Color || (Y.Color = {}))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red", Y.x = 12, Y.F = function(s) { + return 2; + }, Y.array = null, Y.fn = function(s) { return "hello " + s; }, Y.ol = { s: "hello", diff --git a/crates/swc/tests/tsc-references/nestedNamespace.2.minified.js b/crates/swc/tests/tsc-references/nestedNamespace.2.minified.js index b2546d436fb9..06e09b0ec70b 100644 --- a/crates/swc/tests/tsc-references/nestedNamespace.2.minified.js +++ b/crates/swc/tests/tsc-references/nestedNamespace.2.minified.js @@ -1,12 +1,9 @@ //// [a.ts] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var types; -!function(types) { - var A = function A() { - "use strict"; - _class_call_check(this, A); - }; - types.A = A; -}(types || (types = {})); +(types || (types = {})).A = function A() { + "use strict"; + _class_call_check(this, A); +}; //// [b.ts] export { }; diff --git a/crates/swc/tests/tsc-references/newOperatorConformance.2.minified.js b/crates/swc/tests/tsc-references/newOperatorConformance.2.minified.js index f1772a468e61..c84826968b58 100644 --- a/crates/swc/tests/tsc-references/newOperatorConformance.2.minified.js +++ b/crates/swc/tests/tsc-references/newOperatorConformance.2.minified.js @@ -1,12 +1,11 @@ //// [newOperatorConformance.ts] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var anyCtor, anyCtor1, nestedCtor, T = function T(n) { - "use strict"; - _class_call_check(this, T); -}; new function C0() { "use strict"; _class_call_check(this, C0); -}, new T, new anyCtor, new anyCtor1(void 0); -var nested = new new new nestedCtor()()(); +}, new function T(n) { + "use strict"; + _class_call_check(this, T); +}, new anyCtor, new anyCtor1(void 0); +var anyCtor, anyCtor1, nested = new new new (void 0)()()(); new nested(), new nested(); diff --git a/crates/swc/tests/tsc-references/nonInstantiatedModule.2.minified.js b/crates/swc/tests/tsc-references/nonInstantiatedModule.2.minified.js index 9d4a2ec66e49..56cc7f081efc 100644 --- a/crates/swc/tests/tsc-references/nonInstantiatedModule.2.minified.js +++ b/crates/swc/tests/tsc-references/nonInstantiatedModule.2.minified.js @@ -9,10 +9,7 @@ M.a, m.a, function(M2) { y: 0 }; }; -}(M2 || (M2 = {})), function(M3) { - var Utils = function Utils() { - "use strict"; - _class_call_check(this, Utils); - }; - M3.Utils = Utils; -}(M3 || (M3 = {})); +}(M2 || (M2 = {})), (M3 || (M3 = {})).Utils = function Utils() { + "use strict"; + _class_call_check(this, Utils); +}; diff --git a/crates/swc/tests/tsc-references/parserModule1.2.minified.js b/crates/swc/tests/tsc-references/parserModule1.2.minified.js index 260be6670691..71c4755dd041 100644 --- a/crates/swc/tests/tsc-references/parserModule1.2.minified.js +++ b/crates/swc/tests/tsc-references/parserModule1.2.minified.js @@ -3,10 +3,10 @@ export var CompilerDiagnostics; !function(CompilerDiagnostics) { var Alert = function(output) { diagnosticWriter && diagnosticWriter.Alert(output); - }, debugPrint = function(s) { + }, debug = CompilerDiagnostics.debug = !1, diagnosticWriter = CompilerDiagnostics.diagnosticWriter = null; + CompilerDiagnostics.analysisPass = 0, CompilerDiagnostics.Alert = Alert, CompilerDiagnostics.debugPrint = function(s) { debug && Alert(s); - }, assert = function(condition, s) { + }, CompilerDiagnostics.assert = function(condition, s) { debug && !condition && Alert(s); - }, debug = CompilerDiagnostics.debug = !1, diagnosticWriter = CompilerDiagnostics.diagnosticWriter = null; - CompilerDiagnostics.analysisPass = 0, CompilerDiagnostics.Alert = Alert, CompilerDiagnostics.debugPrint = debugPrint, CompilerDiagnostics.assert = assert; + }; }(CompilerDiagnostics || (CompilerDiagnostics = {})); diff --git a/crates/swc/tests/tsc-references/parserRealSource1.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource1.2.minified.js index bff12e85b5d7..fb3ad2991278 100644 --- a/crates/swc/tests/tsc-references/parserRealSource1.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource1.2.minified.js @@ -2,50 +2,6 @@ var TypeScript; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(TypeScript) { - var timeFunction = function(logger, funcDescription, func) { - var start = +new Date(), result = func(), end = +new Date(); - return logger.log(funcDescription + " completed in " + (end - start) + " msec"), result; - }, stringToLiteral = function(value, length) { - var result = "", addChar = function(index) { - switch(value.charCodeAt(index)){ - case 0x09: - result += "\\t"; - break; - case 0x0a: - result += "\\n"; - break; - case 0x0b: - result += "\\v"; - break; - case 0x0c: - result += "\\f"; - break; - case 0x0d: - result += "\\r"; - break; - case 0x22: - result += '\\"'; - break; - case 0x27: - result += "\\'"; - break; - case 0x5c: - result += "\\"; - break; - default: - result += value.charAt(index); - } - }; - if (value.length > length) { - for(var mid = length >> 1, i = 0; i < mid; i++)addChar(i); - result += "(...)"; - for(var i = value.length - mid; i < value.length; i++)addChar(i); - } else { - length = value.length; - for(var i = 0; i < length; i++)addChar(i); - } - return result; - }; !function(CompilerDiagnostics) { var debug = CompilerDiagnostics.debug = !1, diagnosticWriter = CompilerDiagnostics.diagnosticWriter = null; function Alert(output) { @@ -117,5 +73,48 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; this.logContents.push(s); }, BufferedLogger; }(); - TypeScript.BufferedLogger = BufferedLogger, TypeScript.timeFunction = timeFunction, TypeScript.stringToLiteral = stringToLiteral; + TypeScript.BufferedLogger = BufferedLogger, TypeScript.timeFunction = function(logger, funcDescription, func) { + var start = +new Date(), result = func(), end = +new Date(); + return logger.log(funcDescription + " completed in " + (end - start) + " msec"), result; + }, TypeScript.stringToLiteral = function(value, length) { + var result = "", addChar = function(index) { + switch(value.charCodeAt(index)){ + case 0x09: + result += "\\t"; + break; + case 0x0a: + result += "\\n"; + break; + case 0x0b: + result += "\\v"; + break; + case 0x0c: + result += "\\f"; + break; + case 0x0d: + result += "\\r"; + break; + case 0x22: + result += '\\"'; + break; + case 0x27: + result += "\\'"; + break; + case 0x5c: + result += "\\"; + break; + default: + result += value.charAt(index); + } + }; + if (value.length > length) { + for(var mid = length >> 1, i = 0; i < mid; i++)addChar(i); + result += "(...)"; + for(var i = value.length - mid; i < value.length; i++)addChar(i); + } else { + length = value.length; + for(var i = 0; i < length; i++)addChar(i); + } + return result; + }; }(TypeScript || (TypeScript = {})); diff --git a/crates/swc/tests/tsc-references/parserRealSource12.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource12.2.minified.js index 08d47bdd3839..6114a71a2e74 100644 --- a/crates/swc/tests/tsc-references/parserRealSource12.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource12.2.minified.js @@ -2,9 +2,7 @@ var TypeScript; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(TypeScript) { - var globalAstWalkerFactory, ChildrenWalkers, getAstWalkerFactory = function() { - return globalAstWalkerFactory || (globalAstWalkerFactory = new AstWalkerFactory()), globalAstWalkerFactory; - }, AstWalkOptions = function() { + var globalAstWalkerFactory, ChildrenWalkers, AstWalkOptions = function() { "use strict"; function AstWalkOptions() { _class_call_check(this, AstWalkOptions), this.goChildren = !0, this.goNextSibling = !0, this.reverseSiblings = !1; @@ -46,7 +44,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; for(var e in this.childrenWalkers[NodeType.None] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Empty] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.EmptyExpr] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.True] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.False] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.This] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Super] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.QString] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Regex] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Null] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.ArrayLit] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.ObjectLit] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Void] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Comma] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Pos] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Neg] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Delete] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Await] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.In] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Dot] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.From] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Is] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.InstOf] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Typeof] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.NumberLit] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Name] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.TypeRef] = ChildrenWalkers.walkTypeReferenceChildren, this.childrenWalkers[NodeType.Index] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Call] = ChildrenWalkers.walkCallExpressionChildren, this.childrenWalkers[NodeType.New] = ChildrenWalkers.walkCallExpressionChildren, this.childrenWalkers[NodeType.Asg] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAdd] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgSub] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgDiv] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMul] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMod] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAnd] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgXor] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgOr] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgLsh] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRsh] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRs2] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.ConditionalExpression] = ChildrenWalkers.walkTrinaryExpressionChildren, this.childrenWalkers[NodeType.LogOr] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.LogAnd] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Or] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Xor] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.And] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eq] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ne] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eqv] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.NEqv] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lt] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Le] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Gt] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ge] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Add] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Sub] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mul] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Div] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mod] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lsh] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rsh] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rs2] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Not] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.LogNot] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPre] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPre] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPost] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPost] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.TypeAssertion] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.FuncDecl] = ChildrenWalkers.walkFuncDeclChildren, this.childrenWalkers[NodeType.Member] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.VarDecl] = ChildrenWalkers.walkBoundDeclChildren, this.childrenWalkers[NodeType.ArgDecl] = ChildrenWalkers.walkBoundDeclChildren, this.childrenWalkers[NodeType.Return] = ChildrenWalkers.walkReturnStatementChildren, this.childrenWalkers[NodeType.Break] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Continue] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Throw] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.For] = ChildrenWalkers.walkForStatementChildren, this.childrenWalkers[NodeType.ForIn] = ChildrenWalkers.walkForInStatementChildren, this.childrenWalkers[NodeType.If] = ChildrenWalkers.walkIfStatementChildren, this.childrenWalkers[NodeType.While] = ChildrenWalkers.walkWhileStatementChildren, this.childrenWalkers[NodeType.DoWhile] = ChildrenWalkers.walkDoWhileStatementChildren, this.childrenWalkers[NodeType.Block] = ChildrenWalkers.walkBlockChildren, this.childrenWalkers[NodeType.Case] = ChildrenWalkers.walkCaseStatementChildren, this.childrenWalkers[NodeType.Switch] = ChildrenWalkers.walkSwitchStatementChildren, this.childrenWalkers[NodeType.Try] = ChildrenWalkers.walkTryChildren, this.childrenWalkers[NodeType.TryCatch] = ChildrenWalkers.walkTryCatchChildren, this.childrenWalkers[NodeType.TryFinally] = ChildrenWalkers.walkTryFinallyChildren, this.childrenWalkers[NodeType.Finally] = ChildrenWalkers.walkFinallyChildren, this.childrenWalkers[NodeType.Catch] = ChildrenWalkers.walkCatchChildren, this.childrenWalkers[NodeType.List] = ChildrenWalkers.walkListChildren, this.childrenWalkers[NodeType.Script] = ChildrenWalkers.walkScriptChildren, this.childrenWalkers[NodeType.ClassDeclaration] = ChildrenWalkers.walkClassDeclChildren, this.childrenWalkers[NodeType.InterfaceDeclaration] = ChildrenWalkers.walkTypeDeclChildren, this.childrenWalkers[NodeType.ModuleDeclaration] = ChildrenWalkers.walkModuleDeclChildren, this.childrenWalkers[NodeType.ImportDeclaration] = ChildrenWalkers.walkImportDeclChildren, this.childrenWalkers[NodeType.With] = ChildrenWalkers.walkWithStatementChildren, this.childrenWalkers[NodeType.Label] = ChildrenWalkers.walkLabelChildren, this.childrenWalkers[NodeType.LabeledStatement] = ChildrenWalkers.walkLabeledStatementChildren, this.childrenWalkers[NodeType.EBStart] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.GotoEB] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.EndCode] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Error] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Comment] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Debugger] = ChildrenWalkers.walkNone, NodeType._map)if (void 0 === this.childrenWalkers[e]) throw Error("initWalkers function is not up to date with enum content!"); }, AstWalkerFactory; }(); - TypeScript.AstWalkerFactory = AstWalkerFactory, TypeScript.getAstWalkerFactory = getAstWalkerFactory, function(ChildrenWalkers) { + TypeScript.AstWalkerFactory = AstWalkerFactory, TypeScript.getAstWalkerFactory = function() { + return globalAstWalkerFactory || (globalAstWalkerFactory = new AstWalkerFactory()), globalAstWalkerFactory; + }, function(ChildrenWalkers) { function walkRecordChildren(preAst, parent, walker) { preAst.name = walker.walk(preAst.name, preAst), walker.options.goNextSibling && preAst.members && (preAst.members = walker.walk(preAst.members, preAst)); } diff --git a/crates/swc/tests/tsc-references/parserRealSource13.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource13.2.minified.js index 3bb7ab0b2fc5..a9b928686f59 100644 --- a/crates/swc/tests/tsc-references/parserRealSource13.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource13.2.minified.js @@ -7,11 +7,11 @@ var TypeScript; return callback[callbackString] ? callback[callbackString](pre, ast) : !callback.DefaultCallback || callback.DefaultCallback(pre, ast); } AstWalkerWithDetailCallback.walk = function(script, callback) { - var pre = function(cur, parent) { + var walker = TypeScript.getAstWalkerFactory().getWalker(function(cur, parent) { return walker.options.goChildren = AstWalkerCallback(!0, cur, callback), cur; - }, post = function(cur, parent) { + }, function(cur, parent) { return AstWalkerCallback(!1, cur, callback), cur; - }, walker = TypeScript.getAstWalkerFactory().getWalker(pre, post); + }); walker.walk(script, null); }; }(TypeScript1.AstWalkerWithDetailCallback || (TypeScript1.AstWalkerWithDetailCallback = {})); diff --git a/crates/swc/tests/tsc-references/parserRealSource14.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource14.2.minified.js index 37940ed96521..35c70b712df4 100644 --- a/crates/swc/tests/tsc-references/parserRealSource14.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource14.2.minified.js @@ -6,43 +6,12 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; return null === items || 0 === items.length ? null : items[items.length - 1]; }, max = function(a, b) { return a >= b ? a : b; - }, min = function(a, b) { - return a <= b ? a : b; }, isValidAstNode = function(ast) { return null !== ast && -1 !== ast.minChar && -1 !== ast.limChar; - }, getAstPathToPosition = function(script, pos) { - var options = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : GetAstPathOptions1.Default, lookInComments = function(comments) { - if (comments && comments.length > 0) for(var i = 0; i < comments.length; i++){ - var minChar = comments[i].minChar, limChar = comments[i].limChar; - !comments[i].isBlockComment && limChar++, pos >= minChar && pos < limChar && ctx.path.push(comments[i]); - } - }, pre = function(cur, parent, walker) { - if (isValidAstNode(cur)) { - var inclusive = hasFlag(options, GetAstPathOptions1.EdgeInclusive) || cur.nodeType === TypeScript.NodeType.Name || pos === script.limChar, minChar = cur.minChar, limChar = cur.limChar + (inclusive ? 1 : 0); - if (pos >= minChar && pos < limChar) { - var previous = ctx.path.ast(); - (null == previous || cur.minChar >= previous.minChar && cur.limChar <= previous.limChar) && ctx.path.push(cur); - } - pos < limChar && lookInComments(cur.preComments), pos >= minChar && lookInComments(cur.postComments), hasFlag(options, GetAstPathOptions1.DontPruneSearchBasedOnPosition) || (walker.options.goChildren = minChar <= pos && pos <= limChar); - } - return cur; - }, ctx = new AstPathContext(); - return TypeScript.getAstWalkerFactory().walk(script, pre, null, null, ctx), ctx.path; - }, getTokenizationOffset = function(script, position) { - var bestOffset = 0, pre = function(cur, parent, walker) { - return TypeScript.isValidAstNode(cur) && (cur.minChar <= position && (bestOffset = max(bestOffset, cur.minChar)), (cur.minChar > position || cur.limChar < bestOffset) && (walker.options.goChildren = !1)), cur; - }; - return TypeScript.getAstWalkerFactory().walk(script, pre), bestOffset; - }, walkAST = function(ast, callback) { - var pre = function(cur, parent, walker) { - var path = walker.state; - return path.push(cur), callback(path, walker), cur; - }, post = function(cur, parent, walker) { - return walker.state.pop(), cur; - }, path = new AstPath(); - TypeScript.getAstWalkerFactory().walk(ast, pre, post, null, path); }; - TypeScript1.lastOf = lastOf, TypeScript1.max = max, TypeScript1.min = min; + TypeScript1.lastOf = lastOf, TypeScript1.max = max, TypeScript1.min = function(a, b) { + return a <= b ? a : b; + }; var AstPath = function() { "use strict"; function AstPath() { @@ -189,5 +158,36 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; "use strict"; _class_call_check(this, AstPathContext), this.path = new TypeScript.AstPath(); }; - TypeScript1.AstPathContext = AstPathContext, (GetAstPathOptions = GetAstPathOptions1 = TypeScript1.GetAstPathOptions || (TypeScript1.GetAstPathOptions = {}))[GetAstPathOptions.Default = 0] = "Default", GetAstPathOptions[GetAstPathOptions.EdgeInclusive = 1] = "EdgeInclusive", GetAstPathOptions[GetAstPathOptions.DontPruneSearchBasedOnPosition = 2] = "DontPruneSearchBasedOnPosition", TypeScript1.getAstPathToPosition = getAstPathToPosition, TypeScript1.getTokenizationOffset = getTokenizationOffset, TypeScript1.walkAST = walkAST; + TypeScript1.AstPathContext = AstPathContext, (GetAstPathOptions = GetAstPathOptions1 = TypeScript1.GetAstPathOptions || (TypeScript1.GetAstPathOptions = {}))[GetAstPathOptions.Default = 0] = "Default", GetAstPathOptions[GetAstPathOptions.EdgeInclusive = 1] = "EdgeInclusive", GetAstPathOptions[GetAstPathOptions.DontPruneSearchBasedOnPosition = 2] = "DontPruneSearchBasedOnPosition", TypeScript1.getAstPathToPosition = function(script, pos) { + var options = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : GetAstPathOptions1.Default, lookInComments = function(comments) { + if (comments && comments.length > 0) for(var i = 0; i < comments.length; i++){ + var minChar = comments[i].minChar, limChar = comments[i].limChar; + !comments[i].isBlockComment && limChar++, pos >= minChar && pos < limChar && ctx.path.push(comments[i]); + } + }, ctx = new AstPathContext(); + return TypeScript.getAstWalkerFactory().walk(script, function(cur, parent, walker) { + if (isValidAstNode(cur)) { + var inclusive = hasFlag(options, GetAstPathOptions1.EdgeInclusive) || cur.nodeType === TypeScript.NodeType.Name || pos === script.limChar, minChar = cur.minChar, limChar = cur.limChar + (inclusive ? 1 : 0); + if (pos >= minChar && pos < limChar) { + var previous = ctx.path.ast(); + (null == previous || cur.minChar >= previous.minChar && cur.limChar <= previous.limChar) && ctx.path.push(cur); + } + pos < limChar && lookInComments(cur.preComments), pos >= minChar && lookInComments(cur.postComments), hasFlag(options, GetAstPathOptions1.DontPruneSearchBasedOnPosition) || (walker.options.goChildren = minChar <= pos && pos <= limChar); + } + return cur; + }, null, null, ctx), ctx.path; + }, TypeScript1.getTokenizationOffset = function(script, position) { + var bestOffset = 0; + return TypeScript.getAstWalkerFactory().walk(script, function(cur, parent, walker) { + return TypeScript.isValidAstNode(cur) && (cur.minChar <= position && (bestOffset = max(bestOffset, cur.minChar)), (cur.minChar > position || cur.limChar < bestOffset) && (walker.options.goChildren = !1)), cur; + }), bestOffset; + }, TypeScript1.walkAST = function(ast, callback) { + var path = new AstPath(); + TypeScript.getAstWalkerFactory().walk(ast, function(cur, parent, walker) { + var path = walker.state; + return path.push(cur), callback(path, walker), cur; + }, function(cur, parent, walker) { + return walker.state.pop(), cur; + }, null, path); + }; }(TypeScript || (TypeScript = {})); diff --git a/crates/swc/tests/tsc-references/parserRealSource2.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource2.2.minified.js index f80b589b335a..5ba4748e0a2d 100644 --- a/crates/swc/tests/tsc-references/parserRealSource2.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource2.2.minified.js @@ -1,11 +1,12 @@ //// [parserRealSource2.ts] var TypeScript; !function(TypeScript) { - var ErrorRecoverySet, AllowedElements, Modifiers, ASTFlags, DeclFlags, ModuleFlags, SymbolFlags, VarFlags, FncFlags, SignatureFlags, TypeFlags, TypeRelationshipFlags, CodeGenTarget, ModuleGenTarget, CodeGenTarget1, ModuleGenTarget1, hasFlag = function(val, flag) { + var CodeGenTarget, ModuleGenTarget, ErrorRecoverySet, AllowedElements, Modifiers, ASTFlags, DeclFlags, ModuleFlags, SymbolFlags, VarFlags, FncFlags, SignatureFlags, TypeFlags, TypeRelationshipFlags, CodeGenTarget1, ModuleGenTarget1; + TypeScript.hasFlag = function(val, flag) { return (val & flag) != 0; - }, ToDeclFlags = function(fncOrVarOrSymbolOrModuleFlags) { + }, (ErrorRecoverySet = TypeScript.ErrorRecoverySet || (TypeScript.ErrorRecoverySet = {}))[ErrorRecoverySet.None = 0] = "None", ErrorRecoverySet[ErrorRecoverySet.Comma = 1] = "Comma", ErrorRecoverySet[ErrorRecoverySet.SColon = 2] = "SColon", ErrorRecoverySet[ErrorRecoverySet.Asg = 4] = "Asg", ErrorRecoverySet[ErrorRecoverySet.BinOp = 8] = "BinOp", ErrorRecoverySet[ErrorRecoverySet.RBrack = 16] = "RBrack", ErrorRecoverySet[ErrorRecoverySet.RCurly = 32] = "RCurly", ErrorRecoverySet[ErrorRecoverySet.RParen = 64] = "RParen", ErrorRecoverySet[ErrorRecoverySet.Dot = 128] = "Dot", ErrorRecoverySet[ErrorRecoverySet.Colon = 256] = "Colon", ErrorRecoverySet[ErrorRecoverySet.PrimType = 512] = "PrimType", ErrorRecoverySet[ErrorRecoverySet.AddOp = 1024] = "AddOp", ErrorRecoverySet[ErrorRecoverySet.LCurly = 2048] = "LCurly", ErrorRecoverySet[ErrorRecoverySet.PreOp = 4096] = "PreOp", ErrorRecoverySet[ErrorRecoverySet.RegExp = 8192] = "RegExp", ErrorRecoverySet[ErrorRecoverySet.LParen = 16384] = "LParen", ErrorRecoverySet[ErrorRecoverySet.LBrack = 32768] = "LBrack", ErrorRecoverySet[ErrorRecoverySet.Scope = 65536] = "Scope", ErrorRecoverySet[ErrorRecoverySet.In = 131072] = "In", ErrorRecoverySet[ErrorRecoverySet.SCase = 262144] = "SCase", ErrorRecoverySet[ErrorRecoverySet.Else = 524288] = "Else", ErrorRecoverySet[ErrorRecoverySet.Catch = 1048576] = "Catch", ErrorRecoverySet[ErrorRecoverySet.Var = 2097152] = "Var", ErrorRecoverySet[ErrorRecoverySet.Stmt = 4194304] = "Stmt", ErrorRecoverySet[ErrorRecoverySet.While = 8388608] = "While", ErrorRecoverySet[ErrorRecoverySet.ID = 16777216] = "ID", ErrorRecoverySet[ErrorRecoverySet.Prefix = 33554432] = "Prefix", ErrorRecoverySet[ErrorRecoverySet.Literal = 67108864] = "Literal", ErrorRecoverySet[ErrorRecoverySet.RLit = 134217728] = "RLit", ErrorRecoverySet[ErrorRecoverySet.Func = 268435456] = "Func", ErrorRecoverySet[ErrorRecoverySet.EOF = 536870912] = "EOF", ErrorRecoverySet[ErrorRecoverySet.TypeScriptS = 1073741824] = "TypeScriptS", ErrorRecoverySet[ErrorRecoverySet.ExprStart = 520158210] = "ExprStart", ErrorRecoverySet[ErrorRecoverySet.StmtStart = 1608580098] = "StmtStart", ErrorRecoverySet[ErrorRecoverySet.Postfix = 49280] = "Postfix", (AllowedElements = TypeScript.AllowedElements || (TypeScript.AllowedElements = {}))[AllowedElements.None = 0] = "None", AllowedElements[AllowedElements.ModuleDeclarations = 4] = "ModuleDeclarations", AllowedElements[AllowedElements.ClassDeclarations = 8] = "ClassDeclarations", AllowedElements[AllowedElements.InterfaceDeclarations = 16] = "InterfaceDeclarations", AllowedElements[AllowedElements.AmbientDeclarations = 1024] = "AmbientDeclarations", AllowedElements[AllowedElements.Properties = 2048] = "Properties", AllowedElements[AllowedElements.Global = 1052] = "Global", AllowedElements[AllowedElements.QuickParse = 3100] = "QuickParse", (Modifiers = TypeScript.Modifiers || (TypeScript.Modifiers = {}))[Modifiers.None = 0] = "None", Modifiers[Modifiers.Private = 1] = "Private", Modifiers[Modifiers.Public = 2] = "Public", Modifiers[Modifiers.Readonly = 4] = "Readonly", Modifiers[Modifiers.Ambient = 8] = "Ambient", Modifiers[Modifiers.Exported = 16] = "Exported", Modifiers[Modifiers.Getter = 32] = "Getter", Modifiers[Modifiers.Setter = 64] = "Setter", Modifiers[Modifiers.Static = 128] = "Static", (ASTFlags = TypeScript.ASTFlags || (TypeScript.ASTFlags = {}))[ASTFlags.None = 0] = "None", ASTFlags[ASTFlags.ExplicitSemicolon = 1] = "ExplicitSemicolon", ASTFlags[ASTFlags.AutomaticSemicolon = 2] = "AutomaticSemicolon", ASTFlags[ASTFlags.Writeable = 4] = "Writeable", ASTFlags[ASTFlags.Error = 8] = "Error", ASTFlags[ASTFlags.DotLHSPartial = 16] = "DotLHSPartial", ASTFlags[ASTFlags.DotLHS = 32] = "DotLHS", ASTFlags[ASTFlags.IsStatement = 64] = "IsStatement", ASTFlags[ASTFlags.StrictMode = 128] = "StrictMode", ASTFlags[ASTFlags.PossibleOptionalParameter = 256] = "PossibleOptionalParameter", ASTFlags[ASTFlags.ClassBaseConstructorCall = 512] = "ClassBaseConstructorCall", ASTFlags[ASTFlags.OptionalName = 1024] = "OptionalName", ASTFlags[ASTFlags.SkipNextRParen = 2048] = "SkipNextRParen", (DeclFlags = TypeScript.DeclFlags || (TypeScript.DeclFlags = {}))[DeclFlags.None = 0] = "None", DeclFlags[DeclFlags.Exported = 1] = "Exported", DeclFlags[DeclFlags.Private = 2] = "Private", DeclFlags[DeclFlags.Public = 4] = "Public", DeclFlags[DeclFlags.Ambient = 8] = "Ambient", DeclFlags[DeclFlags.Static = 16] = "Static", DeclFlags[DeclFlags.LocalStatic = 32] = "LocalStatic", DeclFlags[DeclFlags.GetAccessor = 64] = "GetAccessor", DeclFlags[DeclFlags.SetAccessor = 128] = "SetAccessor", (ModuleFlags = TypeScript.ModuleFlags || (TypeScript.ModuleFlags = {}))[ModuleFlags.None = 0] = "None", ModuleFlags[ModuleFlags.Exported = 1] = "Exported", ModuleFlags[ModuleFlags.Private = 2] = "Private", ModuleFlags[ModuleFlags.Public = 4] = "Public", ModuleFlags[ModuleFlags.Ambient = 8] = "Ambient", ModuleFlags[ModuleFlags.Static = 16] = "Static", ModuleFlags[ModuleFlags.LocalStatic = 32] = "LocalStatic", ModuleFlags[ModuleFlags.GetAccessor = 64] = "GetAccessor", ModuleFlags[ModuleFlags.SetAccessor = 128] = "SetAccessor", ModuleFlags[ModuleFlags.IsEnum = 256] = "IsEnum", ModuleFlags[ModuleFlags.ShouldEmitModuleDecl = 512] = "ShouldEmitModuleDecl", ModuleFlags[ModuleFlags.IsWholeFile = 1024] = "IsWholeFile", ModuleFlags[ModuleFlags.IsDynamic = 2048] = "IsDynamic", ModuleFlags[ModuleFlags.MustCaptureThis = 4096] = "MustCaptureThis", (SymbolFlags = TypeScript.SymbolFlags || (TypeScript.SymbolFlags = {}))[SymbolFlags.None = 0] = "None", SymbolFlags[SymbolFlags.Exported = 1] = "Exported", SymbolFlags[SymbolFlags.Private = 2] = "Private", SymbolFlags[SymbolFlags.Public = 4] = "Public", SymbolFlags[SymbolFlags.Ambient = 8] = "Ambient", SymbolFlags[SymbolFlags.Static = 16] = "Static", SymbolFlags[SymbolFlags.LocalStatic = 32] = "LocalStatic", SymbolFlags[SymbolFlags.GetAccessor = 64] = "GetAccessor", SymbolFlags[SymbolFlags.SetAccessor = 128] = "SetAccessor", SymbolFlags[SymbolFlags.Property = 256] = "Property", SymbolFlags[SymbolFlags.Readonly = 512] = "Readonly", SymbolFlags[SymbolFlags.ModuleMember = 1024] = "ModuleMember", SymbolFlags[SymbolFlags.InterfaceMember = 2048] = "InterfaceMember", SymbolFlags[SymbolFlags.ClassMember = 4096] = "ClassMember", SymbolFlags[SymbolFlags.BuiltIn = 8192] = "BuiltIn", SymbolFlags[SymbolFlags.TypeSetDuringScopeAssignment = 16384] = "TypeSetDuringScopeAssignment", SymbolFlags[SymbolFlags.Constant = 32768] = "Constant", SymbolFlags[SymbolFlags.Optional = 65536] = "Optional", SymbolFlags[SymbolFlags.RecursivelyReferenced = 131072] = "RecursivelyReferenced", SymbolFlags[SymbolFlags.Bound = 262144] = "Bound", SymbolFlags[SymbolFlags.CompilerGenerated = 524288] = "CompilerGenerated", (VarFlags = TypeScript.VarFlags || (TypeScript.VarFlags = {}))[VarFlags.None = 0] = "None", VarFlags[VarFlags.Exported = 1] = "Exported", VarFlags[VarFlags.Private = 2] = "Private", VarFlags[VarFlags.Public = 4] = "Public", VarFlags[VarFlags.Ambient = 8] = "Ambient", VarFlags[VarFlags.Static = 16] = "Static", VarFlags[VarFlags.LocalStatic = 32] = "LocalStatic", VarFlags[VarFlags.GetAccessor = 64] = "GetAccessor", VarFlags[VarFlags.SetAccessor = 128] = "SetAccessor", VarFlags[VarFlags.AutoInit = 256] = "AutoInit", VarFlags[VarFlags.Property = 512] = "Property", VarFlags[VarFlags.Readonly = 1024] = "Readonly", VarFlags[VarFlags.Class = 2048] = "Class", VarFlags[VarFlags.ClassProperty = 4096] = "ClassProperty", VarFlags[VarFlags.ClassBodyProperty = 8192] = "ClassBodyProperty", VarFlags[VarFlags.ClassConstructorProperty = 16384] = "ClassConstructorProperty", VarFlags[VarFlags.ClassSuperMustBeFirstCallInConstructor = 32768] = "ClassSuperMustBeFirstCallInConstructor", VarFlags[VarFlags.Constant = 65536] = "Constant", VarFlags[VarFlags.MustCaptureThis = 131072] = "MustCaptureThis", (FncFlags = TypeScript.FncFlags || (TypeScript.FncFlags = {}))[FncFlags.None = 0] = "None", FncFlags[FncFlags.Exported = 1] = "Exported", FncFlags[FncFlags.Private = 2] = "Private", FncFlags[FncFlags.Public = 4] = "Public", FncFlags[FncFlags.Ambient = 8] = "Ambient", FncFlags[FncFlags.Static = 16] = "Static", FncFlags[FncFlags.LocalStatic = 32] = "LocalStatic", FncFlags[FncFlags.GetAccessor = 64] = "GetAccessor", FncFlags[FncFlags.SetAccessor = 128] = "SetAccessor", FncFlags[FncFlags.Definition = 256] = "Definition", FncFlags[FncFlags.Signature = 512] = "Signature", FncFlags[FncFlags.Method = 1024] = "Method", FncFlags[FncFlags.HasReturnExpression = 2048] = "HasReturnExpression", FncFlags[FncFlags.CallMember = 4096] = "CallMember", FncFlags[FncFlags.ConstructMember = 8192] = "ConstructMember", FncFlags[FncFlags.HasSelfReference = 16384] = "HasSelfReference", FncFlags[FncFlags.IsFatArrowFunction = 32768] = "IsFatArrowFunction", FncFlags[FncFlags.IndexerMember = 65536] = "IndexerMember", FncFlags[FncFlags.IsFunctionExpression = 131072] = "IsFunctionExpression", FncFlags[FncFlags.ClassMethod = 262144] = "ClassMethod", FncFlags[FncFlags.ClassPropertyMethodExported = 524288] = "ClassPropertyMethodExported", (SignatureFlags = TypeScript.SignatureFlags || (TypeScript.SignatureFlags = {}))[SignatureFlags.None = 0] = "None", SignatureFlags[SignatureFlags.IsIndexer = 1] = "IsIndexer", SignatureFlags[SignatureFlags.IsStringIndexer = 2] = "IsStringIndexer", SignatureFlags[SignatureFlags.IsNumberIndexer = 4] = "IsNumberIndexer", TypeScript.ToDeclFlags = function(fncOrVarOrSymbolOrModuleFlags) { return fncOrVarOrSymbolOrModuleFlags; - }, flagsToString = function(e, flags) { + }, (TypeFlags = TypeScript.TypeFlags || (TypeScript.TypeFlags = {}))[TypeFlags.None = 0] = "None", TypeFlags[TypeFlags.HasImplementation = 1] = "HasImplementation", TypeFlags[TypeFlags.HasSelfReference = 2] = "HasSelfReference", TypeFlags[TypeFlags.MergeResult = 4] = "MergeResult", TypeFlags[TypeFlags.IsEnum = 8] = "IsEnum", TypeFlags[TypeFlags.BuildingName = 16] = "BuildingName", TypeFlags[TypeFlags.HasBaseType = 32] = "HasBaseType", TypeFlags[TypeFlags.HasBaseTypeOfObject = 64] = "HasBaseTypeOfObject", TypeFlags[TypeFlags.IsClass = 128] = "IsClass", (TypeRelationshipFlags = TypeScript.TypeRelationshipFlags || (TypeScript.TypeRelationshipFlags = {}))[TypeRelationshipFlags.SuccessfulComparison = 0] = "SuccessfulComparison", TypeRelationshipFlags[TypeRelationshipFlags.SourceIsNullTargetIsVoidOrUndefined = 1] = "SourceIsNullTargetIsVoidOrUndefined", TypeRelationshipFlags[TypeRelationshipFlags.RequiredPropertyIsMissing = 2] = "RequiredPropertyIsMissing", TypeRelationshipFlags[TypeRelationshipFlags.IncompatibleSignatures = 4] = "IncompatibleSignatures", TypeRelationshipFlags[TypeRelationshipFlags.SourceSignatureHasTooManyParameters = 3] = "SourceSignatureHasTooManyParameters", TypeRelationshipFlags[TypeRelationshipFlags.IncompatibleReturnTypes = 16] = "IncompatibleReturnTypes", TypeRelationshipFlags[TypeRelationshipFlags.IncompatiblePropertyTypes = 32] = "IncompatiblePropertyTypes", TypeRelationshipFlags[TypeRelationshipFlags.IncompatibleParameterTypes = 64] = "IncompatibleParameterTypes", (CodeGenTarget1 = CodeGenTarget = TypeScript.CodeGenTarget || (TypeScript.CodeGenTarget = {}))[CodeGenTarget1.ES3 = 0] = "ES3", CodeGenTarget1[CodeGenTarget1.ES5 = 1] = "ES5", (ModuleGenTarget1 = ModuleGenTarget = TypeScript.ModuleGenTarget || (TypeScript.ModuleGenTarget = {}))[ModuleGenTarget1.Synchronous = 0] = "Synchronous", ModuleGenTarget1[ModuleGenTarget1.Asynchronous = 1] = "Asynchronous", ModuleGenTarget1[ModuleGenTarget1.Local = 2] = "Local", TypeScript.codeGenTarget = CodeGenTarget.ES3, TypeScript.moduleGenTarget = ModuleGenTarget.Synchronous, TypeScript.optimizeModuleCodeGen = !0, TypeScript.flagsToString = function(e, flags) { for(var builder = "", i = 1; i < -2147483648; i <<= 1)if ((flags & i) != 0) { for(var k in e)if (e[k] == i) { builder.length > 0 && (builder += "|"), builder += k; @@ -14,5 +15,4 @@ var TypeScript; } return builder; }; - TypeScript.hasFlag = hasFlag, (ErrorRecoverySet = TypeScript.ErrorRecoverySet || (TypeScript.ErrorRecoverySet = {}))[ErrorRecoverySet.None = 0] = "None", ErrorRecoverySet[ErrorRecoverySet.Comma = 1] = "Comma", ErrorRecoverySet[ErrorRecoverySet.SColon = 2] = "SColon", ErrorRecoverySet[ErrorRecoverySet.Asg = 4] = "Asg", ErrorRecoverySet[ErrorRecoverySet.BinOp = 8] = "BinOp", ErrorRecoverySet[ErrorRecoverySet.RBrack = 16] = "RBrack", ErrorRecoverySet[ErrorRecoverySet.RCurly = 32] = "RCurly", ErrorRecoverySet[ErrorRecoverySet.RParen = 64] = "RParen", ErrorRecoverySet[ErrorRecoverySet.Dot = 128] = "Dot", ErrorRecoverySet[ErrorRecoverySet.Colon = 256] = "Colon", ErrorRecoverySet[ErrorRecoverySet.PrimType = 512] = "PrimType", ErrorRecoverySet[ErrorRecoverySet.AddOp = 1024] = "AddOp", ErrorRecoverySet[ErrorRecoverySet.LCurly = 2048] = "LCurly", ErrorRecoverySet[ErrorRecoverySet.PreOp = 4096] = "PreOp", ErrorRecoverySet[ErrorRecoverySet.RegExp = 8192] = "RegExp", ErrorRecoverySet[ErrorRecoverySet.LParen = 16384] = "LParen", ErrorRecoverySet[ErrorRecoverySet.LBrack = 32768] = "LBrack", ErrorRecoverySet[ErrorRecoverySet.Scope = 65536] = "Scope", ErrorRecoverySet[ErrorRecoverySet.In = 131072] = "In", ErrorRecoverySet[ErrorRecoverySet.SCase = 262144] = "SCase", ErrorRecoverySet[ErrorRecoverySet.Else = 524288] = "Else", ErrorRecoverySet[ErrorRecoverySet.Catch = 1048576] = "Catch", ErrorRecoverySet[ErrorRecoverySet.Var = 2097152] = "Var", ErrorRecoverySet[ErrorRecoverySet.Stmt = 4194304] = "Stmt", ErrorRecoverySet[ErrorRecoverySet.While = 8388608] = "While", ErrorRecoverySet[ErrorRecoverySet.ID = 16777216] = "ID", ErrorRecoverySet[ErrorRecoverySet.Prefix = 33554432] = "Prefix", ErrorRecoverySet[ErrorRecoverySet.Literal = 67108864] = "Literal", ErrorRecoverySet[ErrorRecoverySet.RLit = 134217728] = "RLit", ErrorRecoverySet[ErrorRecoverySet.Func = 268435456] = "Func", ErrorRecoverySet[ErrorRecoverySet.EOF = 536870912] = "EOF", ErrorRecoverySet[ErrorRecoverySet.TypeScriptS = 1073741824] = "TypeScriptS", ErrorRecoverySet[ErrorRecoverySet.ExprStart = 520158210] = "ExprStart", ErrorRecoverySet[ErrorRecoverySet.StmtStart = 1608580098] = "StmtStart", ErrorRecoverySet[ErrorRecoverySet.Postfix = 49280] = "Postfix", (AllowedElements = TypeScript.AllowedElements || (TypeScript.AllowedElements = {}))[AllowedElements.None = 0] = "None", AllowedElements[AllowedElements.ModuleDeclarations = 4] = "ModuleDeclarations", AllowedElements[AllowedElements.ClassDeclarations = 8] = "ClassDeclarations", AllowedElements[AllowedElements.InterfaceDeclarations = 16] = "InterfaceDeclarations", AllowedElements[AllowedElements.AmbientDeclarations = 1024] = "AmbientDeclarations", AllowedElements[AllowedElements.Properties = 2048] = "Properties", AllowedElements[AllowedElements.Global = 1052] = "Global", AllowedElements[AllowedElements.QuickParse = 3100] = "QuickParse", (Modifiers = TypeScript.Modifiers || (TypeScript.Modifiers = {}))[Modifiers.None = 0] = "None", Modifiers[Modifiers.Private = 1] = "Private", Modifiers[Modifiers.Public = 2] = "Public", Modifiers[Modifiers.Readonly = 4] = "Readonly", Modifiers[Modifiers.Ambient = 8] = "Ambient", Modifiers[Modifiers.Exported = 16] = "Exported", Modifiers[Modifiers.Getter = 32] = "Getter", Modifiers[Modifiers.Setter = 64] = "Setter", Modifiers[Modifiers.Static = 128] = "Static", (ASTFlags = TypeScript.ASTFlags || (TypeScript.ASTFlags = {}))[ASTFlags.None = 0] = "None", ASTFlags[ASTFlags.ExplicitSemicolon = 1] = "ExplicitSemicolon", ASTFlags[ASTFlags.AutomaticSemicolon = 2] = "AutomaticSemicolon", ASTFlags[ASTFlags.Writeable = 4] = "Writeable", ASTFlags[ASTFlags.Error = 8] = "Error", ASTFlags[ASTFlags.DotLHSPartial = 16] = "DotLHSPartial", ASTFlags[ASTFlags.DotLHS = 32] = "DotLHS", ASTFlags[ASTFlags.IsStatement = 64] = "IsStatement", ASTFlags[ASTFlags.StrictMode = 128] = "StrictMode", ASTFlags[ASTFlags.PossibleOptionalParameter = 256] = "PossibleOptionalParameter", ASTFlags[ASTFlags.ClassBaseConstructorCall = 512] = "ClassBaseConstructorCall", ASTFlags[ASTFlags.OptionalName = 1024] = "OptionalName", ASTFlags[ASTFlags.SkipNextRParen = 2048] = "SkipNextRParen", (DeclFlags = TypeScript.DeclFlags || (TypeScript.DeclFlags = {}))[DeclFlags.None = 0] = "None", DeclFlags[DeclFlags.Exported = 1] = "Exported", DeclFlags[DeclFlags.Private = 2] = "Private", DeclFlags[DeclFlags.Public = 4] = "Public", DeclFlags[DeclFlags.Ambient = 8] = "Ambient", DeclFlags[DeclFlags.Static = 16] = "Static", DeclFlags[DeclFlags.LocalStatic = 32] = "LocalStatic", DeclFlags[DeclFlags.GetAccessor = 64] = "GetAccessor", DeclFlags[DeclFlags.SetAccessor = 128] = "SetAccessor", (ModuleFlags = TypeScript.ModuleFlags || (TypeScript.ModuleFlags = {}))[ModuleFlags.None = 0] = "None", ModuleFlags[ModuleFlags.Exported = 1] = "Exported", ModuleFlags[ModuleFlags.Private = 2] = "Private", ModuleFlags[ModuleFlags.Public = 4] = "Public", ModuleFlags[ModuleFlags.Ambient = 8] = "Ambient", ModuleFlags[ModuleFlags.Static = 16] = "Static", ModuleFlags[ModuleFlags.LocalStatic = 32] = "LocalStatic", ModuleFlags[ModuleFlags.GetAccessor = 64] = "GetAccessor", ModuleFlags[ModuleFlags.SetAccessor = 128] = "SetAccessor", ModuleFlags[ModuleFlags.IsEnum = 256] = "IsEnum", ModuleFlags[ModuleFlags.ShouldEmitModuleDecl = 512] = "ShouldEmitModuleDecl", ModuleFlags[ModuleFlags.IsWholeFile = 1024] = "IsWholeFile", ModuleFlags[ModuleFlags.IsDynamic = 2048] = "IsDynamic", ModuleFlags[ModuleFlags.MustCaptureThis = 4096] = "MustCaptureThis", (SymbolFlags = TypeScript.SymbolFlags || (TypeScript.SymbolFlags = {}))[SymbolFlags.None = 0] = "None", SymbolFlags[SymbolFlags.Exported = 1] = "Exported", SymbolFlags[SymbolFlags.Private = 2] = "Private", SymbolFlags[SymbolFlags.Public = 4] = "Public", SymbolFlags[SymbolFlags.Ambient = 8] = "Ambient", SymbolFlags[SymbolFlags.Static = 16] = "Static", SymbolFlags[SymbolFlags.LocalStatic = 32] = "LocalStatic", SymbolFlags[SymbolFlags.GetAccessor = 64] = "GetAccessor", SymbolFlags[SymbolFlags.SetAccessor = 128] = "SetAccessor", SymbolFlags[SymbolFlags.Property = 256] = "Property", SymbolFlags[SymbolFlags.Readonly = 512] = "Readonly", SymbolFlags[SymbolFlags.ModuleMember = 1024] = "ModuleMember", SymbolFlags[SymbolFlags.InterfaceMember = 2048] = "InterfaceMember", SymbolFlags[SymbolFlags.ClassMember = 4096] = "ClassMember", SymbolFlags[SymbolFlags.BuiltIn = 8192] = "BuiltIn", SymbolFlags[SymbolFlags.TypeSetDuringScopeAssignment = 16384] = "TypeSetDuringScopeAssignment", SymbolFlags[SymbolFlags.Constant = 32768] = "Constant", SymbolFlags[SymbolFlags.Optional = 65536] = "Optional", SymbolFlags[SymbolFlags.RecursivelyReferenced = 131072] = "RecursivelyReferenced", SymbolFlags[SymbolFlags.Bound = 262144] = "Bound", SymbolFlags[SymbolFlags.CompilerGenerated = 524288] = "CompilerGenerated", (VarFlags = TypeScript.VarFlags || (TypeScript.VarFlags = {}))[VarFlags.None = 0] = "None", VarFlags[VarFlags.Exported = 1] = "Exported", VarFlags[VarFlags.Private = 2] = "Private", VarFlags[VarFlags.Public = 4] = "Public", VarFlags[VarFlags.Ambient = 8] = "Ambient", VarFlags[VarFlags.Static = 16] = "Static", VarFlags[VarFlags.LocalStatic = 32] = "LocalStatic", VarFlags[VarFlags.GetAccessor = 64] = "GetAccessor", VarFlags[VarFlags.SetAccessor = 128] = "SetAccessor", VarFlags[VarFlags.AutoInit = 256] = "AutoInit", VarFlags[VarFlags.Property = 512] = "Property", VarFlags[VarFlags.Readonly = 1024] = "Readonly", VarFlags[VarFlags.Class = 2048] = "Class", VarFlags[VarFlags.ClassProperty = 4096] = "ClassProperty", VarFlags[VarFlags.ClassBodyProperty = 8192] = "ClassBodyProperty", VarFlags[VarFlags.ClassConstructorProperty = 16384] = "ClassConstructorProperty", VarFlags[VarFlags.ClassSuperMustBeFirstCallInConstructor = 32768] = "ClassSuperMustBeFirstCallInConstructor", VarFlags[VarFlags.Constant = 65536] = "Constant", VarFlags[VarFlags.MustCaptureThis = 131072] = "MustCaptureThis", (FncFlags = TypeScript.FncFlags || (TypeScript.FncFlags = {}))[FncFlags.None = 0] = "None", FncFlags[FncFlags.Exported = 1] = "Exported", FncFlags[FncFlags.Private = 2] = "Private", FncFlags[FncFlags.Public = 4] = "Public", FncFlags[FncFlags.Ambient = 8] = "Ambient", FncFlags[FncFlags.Static = 16] = "Static", FncFlags[FncFlags.LocalStatic = 32] = "LocalStatic", FncFlags[FncFlags.GetAccessor = 64] = "GetAccessor", FncFlags[FncFlags.SetAccessor = 128] = "SetAccessor", FncFlags[FncFlags.Definition = 256] = "Definition", FncFlags[FncFlags.Signature = 512] = "Signature", FncFlags[FncFlags.Method = 1024] = "Method", FncFlags[FncFlags.HasReturnExpression = 2048] = "HasReturnExpression", FncFlags[FncFlags.CallMember = 4096] = "CallMember", FncFlags[FncFlags.ConstructMember = 8192] = "ConstructMember", FncFlags[FncFlags.HasSelfReference = 16384] = "HasSelfReference", FncFlags[FncFlags.IsFatArrowFunction = 32768] = "IsFatArrowFunction", FncFlags[FncFlags.IndexerMember = 65536] = "IndexerMember", FncFlags[FncFlags.IsFunctionExpression = 131072] = "IsFunctionExpression", FncFlags[FncFlags.ClassMethod = 262144] = "ClassMethod", FncFlags[FncFlags.ClassPropertyMethodExported = 524288] = "ClassPropertyMethodExported", (SignatureFlags = TypeScript.SignatureFlags || (TypeScript.SignatureFlags = {}))[SignatureFlags.None = 0] = "None", SignatureFlags[SignatureFlags.IsIndexer = 1] = "IsIndexer", SignatureFlags[SignatureFlags.IsStringIndexer = 2] = "IsStringIndexer", SignatureFlags[SignatureFlags.IsNumberIndexer = 4] = "IsNumberIndexer", TypeScript.ToDeclFlags = ToDeclFlags, (TypeFlags = TypeScript.TypeFlags || (TypeScript.TypeFlags = {}))[TypeFlags.None = 0] = "None", TypeFlags[TypeFlags.HasImplementation = 1] = "HasImplementation", TypeFlags[TypeFlags.HasSelfReference = 2] = "HasSelfReference", TypeFlags[TypeFlags.MergeResult = 4] = "MergeResult", TypeFlags[TypeFlags.IsEnum = 8] = "IsEnum", TypeFlags[TypeFlags.BuildingName = 16] = "BuildingName", TypeFlags[TypeFlags.HasBaseType = 32] = "HasBaseType", TypeFlags[TypeFlags.HasBaseTypeOfObject = 64] = "HasBaseTypeOfObject", TypeFlags[TypeFlags.IsClass = 128] = "IsClass", (TypeRelationshipFlags = TypeScript.TypeRelationshipFlags || (TypeScript.TypeRelationshipFlags = {}))[TypeRelationshipFlags.SuccessfulComparison = 0] = "SuccessfulComparison", TypeRelationshipFlags[TypeRelationshipFlags.SourceIsNullTargetIsVoidOrUndefined = 1] = "SourceIsNullTargetIsVoidOrUndefined", TypeRelationshipFlags[TypeRelationshipFlags.RequiredPropertyIsMissing = 2] = "RequiredPropertyIsMissing", TypeRelationshipFlags[TypeRelationshipFlags.IncompatibleSignatures = 4] = "IncompatibleSignatures", TypeRelationshipFlags[TypeRelationshipFlags.SourceSignatureHasTooManyParameters = 3] = "SourceSignatureHasTooManyParameters", TypeRelationshipFlags[TypeRelationshipFlags.IncompatibleReturnTypes = 16] = "IncompatibleReturnTypes", TypeRelationshipFlags[TypeRelationshipFlags.IncompatiblePropertyTypes = 32] = "IncompatiblePropertyTypes", TypeRelationshipFlags[TypeRelationshipFlags.IncompatibleParameterTypes = 64] = "IncompatibleParameterTypes", (CodeGenTarget = CodeGenTarget1 = TypeScript.CodeGenTarget || (TypeScript.CodeGenTarget = {}))[CodeGenTarget.ES3 = 0] = "ES3", CodeGenTarget[CodeGenTarget.ES5 = 1] = "ES5", (ModuleGenTarget = ModuleGenTarget1 = TypeScript.ModuleGenTarget || (TypeScript.ModuleGenTarget = {}))[ModuleGenTarget.Synchronous = 0] = "Synchronous", ModuleGenTarget[ModuleGenTarget.Asynchronous = 1] = "Asynchronous", ModuleGenTarget[ModuleGenTarget.Local = 2] = "Local", TypeScript.codeGenTarget = CodeGenTarget1.ES3, TypeScript.moduleGenTarget = ModuleGenTarget1.Synchronous, TypeScript.optimizeModuleCodeGen = !0, TypeScript.flagsToString = flagsToString; }(TypeScript || (TypeScript = {})); diff --git a/crates/swc/tests/tsc-references/parserRealSource5.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource5.2.minified.js index e318750197b9..e292593705c7 100644 --- a/crates/swc/tests/tsc-references/parserRealSource5.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource5.2.minified.js @@ -2,12 +2,7 @@ var TypeScript; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(TypeScript) { - var prePrintAST = function(ast, parent, walker) { - var pc = walker.state; - return ast.print(pc), pc.increaseIndent(), ast; - }, postPrintAST = function(ast, parent, walker) { - return walker.state.decreaseIndent(), ast; - }, PrintContext = function() { + var PrintContext = function() { "use strict"; function PrintContext(outfile, parser) { _class_call_check(this, PrintContext), this.outfile = outfile, this.parser = parser, this.builder = "", this.indent1 = " ", this.indentStrings = [], this.indentAmt = 0; @@ -32,5 +27,10 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; this.builder += s, this.outfile.WriteLine(this.builder), this.builder = ""; }, PrintContext; }(); - TypeScript.PrintContext = PrintContext, TypeScript.prePrintAST = prePrintAST, TypeScript.postPrintAST = postPrintAST; + TypeScript.PrintContext = PrintContext, TypeScript.prePrintAST = function(ast, parent, walker) { + var pc = walker.state; + return ast.print(pc), pc.increaseIndent(), ast; + }, TypeScript.postPrintAST = function(ast, parent, walker) { + return walker.state.decreaseIndent(), ast; + }; }(TypeScript || (TypeScript = {})); diff --git a/crates/swc/tests/tsc-references/parserRealSource6.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource6.2.minified.js index 8b498b8ffbb1..f89f30e95e0d 100644 --- a/crates/swc/tests/tsc-references/parserRealSource6.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource6.2.minified.js @@ -2,15 +2,7 @@ var TypeScript; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(TypeScript1) { - var preFindMemberScope = function(ast, parent, walker) { - var memScope = walker.state; - return hasFlag(ast.flags, memScope.matchFlag) && (memScope.pos < 0 || memScope.pos == ast.limChar) && (memScope.ast = ast, null == ast.type && memScope.pos >= 0 && memScope.flow.inScopeTypeCheck(ast, memScope.scope), memScope.type = ast.type, memScope.options.stopWalk()), ast; - }, pushTypeCollectionScope = function(container, valueMembers, ambientValueMembers, enclosedTypes, ambientEnclosedTypes, context, thisType, classType, moduleDecl) { - var builder = new SymbolScopeBuilder(valueMembers, ambientValueMembers, enclosedTypes, ambientEnclosedTypes, null, container), chain = new ScopeChain(container, context.scopeChain, builder); - chain.thisType = thisType, chain.classType = classType, chain.moduleDecl = moduleDecl, context.scopeChain = chain; - }, popTypeCollectionScope = function(context) { - context.scopeChain = context.scopeChain.previous; - }, preFindEnclosingScope = function(ast, parent, walker) { + var preFindEnclosingScope = function(ast, parent, walker) { var context = walker.state, minChar = ast.minChar, limChar = ast.limChar; if (ast.nodeType == NodeType.Script && context.pos > limChar && (limChar = context.pos), minChar <= context.pos && limChar >= context.pos) { switch(ast.nodeType){ @@ -49,19 +41,14 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; walker.options.goChildren = !0; } else walker.options.goChildren = !1; return ast; - }, findEnclosingScopeAt = function(logger, script, text, pos, isMemberCompletion) { - var context = new EnclosingScopeContext(logger, script, text, pos, isMemberCompletion); - return (TypeScript.getAstWalkerFactory().walk(script, preFindEnclosingScope, null, null, context), null === context.scopeStartAST) ? null : context; - }, TypeCollectionContext = function TypeCollectionContext(scopeChain, checker) { + }; + TypeScript1.TypeCollectionContext = function TypeCollectionContext(scopeChain, checker) { "use strict"; _class_call_check(this, TypeCollectionContext), this.scopeChain = scopeChain, this.checker = checker, this.script = null; - }; - TypeScript1.TypeCollectionContext = TypeCollectionContext; - var MemberScopeContext = function MemberScopeContext(flow, pos, matchFlag) { + }, TypeScript1.MemberScopeContext = function MemberScopeContext(flow, pos, matchFlag) { "use strict"; _class_call_check(this, MemberScopeContext), this.flow = flow, this.pos = pos, this.matchFlag = matchFlag, this.type = null, this.ast = null, this.options = new AstWalkOptions(); }; - TypeScript1.MemberScopeContext = MemberScopeContext; var EnclosingScopeContext = function() { "use strict"; function EnclosingScopeContext(logger, script, text, pos, isMemberCompletion) { @@ -88,5 +75,16 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; return this.scriptFragment; }, EnclosingScopeContext; }(); - TypeScript1.EnclosingScopeContext = EnclosingScopeContext, TypeScript1.preFindMemberScope = preFindMemberScope, TypeScript1.pushTypeCollectionScope = pushTypeCollectionScope, TypeScript1.popTypeCollectionScope = popTypeCollectionScope, TypeScript1.preFindEnclosingScope = preFindEnclosingScope, TypeScript1.findEnclosingScopeAt = findEnclosingScopeAt; + TypeScript1.EnclosingScopeContext = EnclosingScopeContext, TypeScript1.preFindMemberScope = function(ast, parent, walker) { + var memScope = walker.state; + return hasFlag(ast.flags, memScope.matchFlag) && (memScope.pos < 0 || memScope.pos == ast.limChar) && (memScope.ast = ast, null == ast.type && memScope.pos >= 0 && memScope.flow.inScopeTypeCheck(ast, memScope.scope), memScope.type = ast.type, memScope.options.stopWalk()), ast; + }, TypeScript1.pushTypeCollectionScope = function(container, valueMembers, ambientValueMembers, enclosedTypes, ambientEnclosedTypes, context, thisType, classType, moduleDecl) { + var builder = new SymbolScopeBuilder(valueMembers, ambientValueMembers, enclosedTypes, ambientEnclosedTypes, null, container), chain = new ScopeChain(container, context.scopeChain, builder); + chain.thisType = thisType, chain.classType = classType, chain.moduleDecl = moduleDecl, context.scopeChain = chain; + }, TypeScript1.popTypeCollectionScope = function(context) { + context.scopeChain = context.scopeChain.previous; + }, TypeScript1.preFindEnclosingScope = preFindEnclosingScope, TypeScript1.findEnclosingScopeAt = function(logger, script, text, pos, isMemberCompletion) { + var context = new EnclosingScopeContext(logger, script, text, pos, isMemberCompletion); + return (TypeScript.getAstWalkerFactory().walk(script, preFindEnclosingScope, null, null, context), null === context.scopeStartAST) ? null : context; + }; }(TypeScript || (TypeScript = {})); diff --git a/crates/swc/tests/tsc-references/parserRealSource8.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource8.2.minified.js index 1865ed192936..c9eab5ef3502 100644 --- a/crates/swc/tests/tsc-references/parserRealSource8.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource8.2.minified.js @@ -73,17 +73,11 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var catchTable = new ScopedMembers(new DualStringHashTable(new StringHashTable(), new StringHashTable())), catchLocals = new SymbolScopeBuilder(catchTable, null, null, null, context.scopeChain.scope, context.scopeChain.scope.container); catchBlock.containedScope = catchLocals, pushAssignScope(catchLocals, context, context.scopeChain.thisType, context.scopeChain.classType, context.scopeChain.fnc); } - }, preAssignScopes = function(ast, parent, walker) { - var context = walker.state, go = !0; - return ast && (ast.nodeType == NodeType.List ? ast.enclosingScope = context.scopeChain.scope : ast.nodeType == NodeType.ModuleDeclaration ? preAssignModuleScopes(ast, context) : ast.nodeType == NodeType.ClassDeclaration ? preAssignClassScopes(ast, context) : ast.nodeType == NodeType.InterfaceDeclaration ? preAssignInterfaceScopes(ast, context) : ast.nodeType == NodeType.With ? preAssignWithScopes(ast, context) : ast.nodeType == NodeType.FuncDecl ? preAssignFuncDeclScopes(ast, context) : ast.nodeType == NodeType.Catch ? preAssignCatchScopes(ast, context) : ast.nodeType == NodeType.TypeRef && (go = !1)), walker.options.goChildren = go, ast; - }, postAssignScopes = function(ast, parent, walker) { - var context = walker.state, go = !0; - return ast && (ast.nodeType == NodeType.ModuleDeclaration ? (popAssignScope(context), context.modDeclChain.pop(), context.modDeclChain.length >= 1 && (context.typeFlow.checker.currentModDecl = context.modDeclChain[context.modDeclChain.length - 1])) : ast.nodeType == NodeType.ClassDeclaration ? popAssignScope(context) : ast.nodeType == NodeType.InterfaceDeclaration ? popAssignScope(context) : ast.nodeType == NodeType.With ? popAssignScope(context) : ast.nodeType == NodeType.FuncDecl ? (!ast.isConstructor || hasFlag(ast.fncFlags, FncFlags.ClassMethod)) && !ast.isOverload && popAssignScope(context) : ast.nodeType == NodeType.Catch ? ast.param && popAssignScope(context) : go = !1), walker.options.goChildren = go, ast; - }, AssignScopeContext = function AssignScopeContext(scopeChain, typeFlow, modDeclChain) { + }; + TypeScript1.AssignScopeContext = function AssignScopeContext(scopeChain, typeFlow, modDeclChain) { "use strict"; _class_call_check(this, AssignScopeContext), this.scopeChain = scopeChain, this.typeFlow = typeFlow, this.modDeclChain = modDeclChain; - }; - TypeScript1.AssignScopeContext = AssignScopeContext, TypeScript1.pushAssignScope = pushAssignScope, TypeScript1.popAssignScope = popAssignScope, TypeScript1.instanceCompare = instanceCompare, TypeScript1.instanceFilterStop = instanceFilterStop; + }, TypeScript1.pushAssignScope = pushAssignScope, TypeScript1.popAssignScope = popAssignScope, TypeScript1.instanceCompare = instanceCompare, TypeScript1.instanceFilterStop = instanceFilterStop; var ScopeSearchFilter = function() { "use strict"; function ScopeSearchFilter(select, stop) { @@ -96,5 +90,11 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; return this.result = this.select(this.result, b), !!this.result && this.stop(this.result); }, ScopeSearchFilter; }(); - TypeScript1.ScopeSearchFilter = ScopeSearchFilter, TypeScript1.instanceFilter = new ScopeSearchFilter(instanceCompare, instanceFilterStop), TypeScript1.preAssignModuleScopes = preAssignModuleScopes, TypeScript1.preAssignClassScopes = preAssignClassScopes, TypeScript1.preAssignInterfaceScopes = preAssignInterfaceScopes, TypeScript1.preAssignWithScopes = preAssignWithScopes, TypeScript1.preAssignFuncDeclScopes = preAssignFuncDeclScopes, TypeScript1.preAssignCatchScopes = preAssignCatchScopes, TypeScript1.preAssignScopes = preAssignScopes, TypeScript1.postAssignScopes = postAssignScopes; + TypeScript1.ScopeSearchFilter = ScopeSearchFilter, TypeScript1.instanceFilter = new ScopeSearchFilter(instanceCompare, instanceFilterStop), TypeScript1.preAssignModuleScopes = preAssignModuleScopes, TypeScript1.preAssignClassScopes = preAssignClassScopes, TypeScript1.preAssignInterfaceScopes = preAssignInterfaceScopes, TypeScript1.preAssignWithScopes = preAssignWithScopes, TypeScript1.preAssignFuncDeclScopes = preAssignFuncDeclScopes, TypeScript1.preAssignCatchScopes = preAssignCatchScopes, TypeScript1.preAssignScopes = function(ast, parent, walker) { + var context = walker.state, go = !0; + return ast && (ast.nodeType == NodeType.List ? ast.enclosingScope = context.scopeChain.scope : ast.nodeType == NodeType.ModuleDeclaration ? preAssignModuleScopes(ast, context) : ast.nodeType == NodeType.ClassDeclaration ? preAssignClassScopes(ast, context) : ast.nodeType == NodeType.InterfaceDeclaration ? preAssignInterfaceScopes(ast, context) : ast.nodeType == NodeType.With ? preAssignWithScopes(ast, context) : ast.nodeType == NodeType.FuncDecl ? preAssignFuncDeclScopes(ast, context) : ast.nodeType == NodeType.Catch ? preAssignCatchScopes(ast, context) : ast.nodeType == NodeType.TypeRef && (go = !1)), walker.options.goChildren = go, ast; + }, TypeScript1.postAssignScopes = function(ast, parent, walker) { + var context = walker.state, go = !0; + return ast && (ast.nodeType == NodeType.ModuleDeclaration ? (popAssignScope(context), context.modDeclChain.pop(), context.modDeclChain.length >= 1 && (context.typeFlow.checker.currentModDecl = context.modDeclChain[context.modDeclChain.length - 1])) : ast.nodeType == NodeType.ClassDeclaration ? popAssignScope(context) : ast.nodeType == NodeType.InterfaceDeclaration ? popAssignScope(context) : ast.nodeType == NodeType.With ? popAssignScope(context) : ast.nodeType == NodeType.FuncDecl ? (!ast.isConstructor || hasFlag(ast.fncFlags, FncFlags.ClassMethod)) && !ast.isOverload && popAssignScope(context) : ast.nodeType == NodeType.Catch ? ast.param && popAssignScope(context) : go = !1), walker.options.goChildren = go, ast; + }; }(TypeScript || (TypeScript = {})); diff --git a/crates/swc/tests/tsc-references/privateWriteOnlyAccessorRead.2.minified.js b/crates/swc/tests/tsc-references/privateWriteOnlyAccessorRead.2.minified.js index ca07dfdb8b7b..fff31b512d9a 100644 --- a/crates/swc/tests/tsc-references/privateWriteOnlyAccessorRead.2.minified.js +++ b/crates/swc/tests/tsc-references/privateWriteOnlyAccessorRead.2.minified.js @@ -11,7 +11,6 @@ function set_valueOne(v) {} function set_valueCompound(v) {} new class { m() { - var _tmp; let foo = { bar: 1 }; @@ -27,9 +26,9 @@ new class { foo }), ({ foo: _write_only_error("#value").foo } = { foo - }), _tmp = { + }), _write_only_error("#value").foo = _extends({}, { foo - }, _write_only_error("#value").foo = _extends({}, _tmp.foo), _write_only_error("#value"), [_class_private_field_destructure(this, _valueOne).value, ..._class_private_field_destructure(this, _valueRest).value] = [ + }.foo), _write_only_error("#value"), [_class_private_field_destructure(this, _valueOne).value, ..._class_private_field_destructure(this, _valueRest).value] = [ 1, 2, 3 diff --git a/crates/swc/tests/tsc-references/reexportClassDefinition.2.minified.js b/crates/swc/tests/tsc-references/reexportClassDefinition.2.minified.js index 5057554befdb..7e01ed732877 100644 --- a/crates/swc/tests/tsc-references/reexportClassDefinition.2.minified.js +++ b/crates/swc/tests/tsc-references/reexportClassDefinition.2.minified.js @@ -1,10 +1,10 @@ //// [foo1.ts] "use strict"; -var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default, x = function x() { +var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default; +module.exports = function x() { "use strict"; _classCallCheck(this, x); }; -module.exports = x; //// [foo2.ts] "use strict"; var foo1 = require("./foo1"); diff --git a/crates/swc/tests/tsc-references/stringNamedPropertyAccess.2.minified.js b/crates/swc/tests/tsc-references/stringNamedPropertyAccess.2.minified.js index c85a7dcc217e..6598e594a16d 100644 --- a/crates/swc/tests/tsc-references/stringNamedPropertyAccess.2.minified.js +++ b/crates/swc/tests/tsc-references/stringNamedPropertyAccess.2.minified.js @@ -1,7 +1,4 @@ //// [stringNamedPropertyAccess.ts] +var i, a; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var i, a, C = function C() { - "use strict"; - _class_call_check(this, C); -}; -(void 0)["a b"], C["c d"], i["a b"], a["a b"]; +(void 0)["a b"], i["a b"], a["a b"]; diff --git a/crates/swc/tests/tsc-references/switchStatements.2.minified.js b/crates/swc/tests/tsc-references/switchStatements.2.minified.js index 2bc7c7544b2d..df1d4bd43910 100644 --- a/crates/swc/tests/tsc-references/switchStatements.2.minified.js +++ b/crates/swc/tests/tsc-references/switchStatements.2.minified.js @@ -3,12 +3,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _type_of from "@swc/helpers/src/_type_of.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -!function(M) { - var fn = function(x) { - return ""; - }; - M.fn = fn; -}(M || (M = {})), void 0 === x || _type_of(x), void 0 === M || _type_of(M), M.fn(1); +(M || (M = {})).fn = function(x) { + return ""; +}, void 0 === x || _type_of(x), void 0 === M || _type_of(M), M.fn(1); var M, x, C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/throwStatements.2.minified.js b/crates/swc/tests/tsc-references/throwStatements.2.minified.js index fc6e1719e8fa..6971018ff94b 100644 --- a/crates/swc/tests/tsc-references/throwStatements.2.minified.js +++ b/crates/swc/tests/tsc-references/throwStatements.2.minified.js @@ -3,11 +3,10 @@ var M; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _type_of from "@swc/helpers/src/_type_of.mjs"; throw !function(M) { - var F2 = function(x) { - return x.toString(); - }, A = function A() { + M.A = function A() { "use strict"; _class_call_check(this, A); + }, M.F2 = function(x) { + return x.toString(); }; - M.A = A, M.F2 = F2; }(M || (M = {})), 9.9; diff --git a/crates/swc/tests/tsc-references/tsxElementResolution.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution.2.minified.js index 1f0d26a76a87..0655bb62d689 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution.2.minified.js @@ -1,10 +1,7 @@ //// [tsxElementResolution.tsx] var Dotted; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -!function(Dotted) { - var Name = function Name() { - "use strict"; - _class_call_check(this, Name); - }; - Dotted.Name = Name; -}(Dotted || (Dotted = {})), Dotted.Name; +(Dotted || (Dotted = {})).Name = function Name() { + "use strict"; + _class_call_check(this, Name); +}, Dotted.Name; diff --git a/crates/swc/tests/tsc-references/tsxEmit3.2.minified.js b/crates/swc/tests/tsc-references/tsxEmit3.2.minified.js index 7e038d738bcf..c55243b302ef 100644 --- a/crates/swc/tests/tsc-references/tsxEmit3.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxEmit3.2.minified.js @@ -2,14 +2,13 @@ var M; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(M) { - var S1, Bar1, Foo1 = function Foo1() { + M.Foo = function Foo1() { "use strict"; _class_call_check(this, Foo1); - }; - M.Foo = Foo1, S1 = M.S || (M.S = {}), Bar1 = function Bar1() { + }, (M.S || (M.S = {})).Bar = function Bar1() { "use strict"; _class_call_check(this, Bar1); - }, S1.Bar = Bar1; + }; }(M || (M = {})), function(M) { Foo, Foo, M.S || (M.S = {}), Foo, Foo, Bar, Bar; }(M || (M = {})), M || (M = {}), S.Bar, S.Bar, M || (M = {}), Foo, Foo; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment29.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment29.2.minified.js index 98b733bdd2be..554277f2f249 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment29.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment29.2.minified.js @@ -25,10 +25,10 @@ function ExpandoMerge(n) { ExpandoArrow.prop = 2, ExpandoArrow.m = function(n) { return n + 1; }, ExpandoMerge.p1 = 111, (ExpandoMerge || (ExpandoMerge = {})).p2 = 222, (ExpandoMerge || (ExpandoMerge = {})).p3 = 333, ExpandoMerge.p1, ExpandoMerge.p2, ExpandoMerge.p3, ExpandoMerge(1), function(Ns) { - var ExpandoNamespace = function() {}, foo = function() { + var ExpandoNamespace = function() {}; + ExpandoNamespace.p6 = 42, Ns.foo = function() { return ExpandoNamespace; }; - ExpandoNamespace.p6 = 42, Ns.foo = foo; }(Ns || (Ns = {})); var ExpandoExpr2 = function(n) { return n.toString(); diff --git a/crates/swc/tests/tsc-references/typedefCrossModule4.2.minified.js b/crates/swc/tests/tsc-references/typedefCrossModule4.2.minified.js index 6936addef946..d16d96ebe330 100644 --- a/crates/swc/tests/tsc-references/typedefCrossModule4.2.minified.js +++ b/crates/swc/tests/tsc-references/typedefCrossModule4.2.minified.js @@ -1,9 +1,8 @@ //// [mod3.js] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var Bar = function Bar() { - "use strict"; - _class_call_check(this, Bar); -}; module.exports = { - Foo: Bar + Foo: function Bar() { + "use strict"; + _class_call_check(this, Bar); + } }; diff --git a/crates/swc/tests/tsc-references/typeofANonExportedType.2.minified.js b/crates/swc/tests/tsc-references/typeofANonExportedType.2.minified.js index 0aa39866972d..8a1cb11af1ec 100644 --- a/crates/swc/tests/tsc-references/typeofANonExportedType.2.minified.js +++ b/crates/swc/tests/tsc-references/typeofANonExportedType.2.minified.js @@ -11,12 +11,10 @@ export var i; export var r5; export var r5; !function(M) { - M.foo = ""; - var C = function C() { + M.foo = "", M.C = function C() { "use strict"; _class_call_check(this, C); }; - M.C = C; }(M || (M = {})); export var r6; export var r7; @@ -30,11 +28,9 @@ export var r11; export var r12; function foo() {} !function(foo) { - foo.y = 1; - var C = function C() { + foo.y = 1, foo.C = function C() { "use strict"; _class_call_check(this, C); }; - foo.C = C; }(foo || (foo = {})); export var r13; diff --git a/crates/swc/tests/tsc-references/typeofAnExportedType.2.minified.js b/crates/swc/tests/tsc-references/typeofAnExportedType.2.minified.js index 363906e60a3b..bb8dc32ad449 100644 --- a/crates/swc/tests/tsc-references/typeofAnExportedType.2.minified.js +++ b/crates/swc/tests/tsc-references/typeofAnExportedType.2.minified.js @@ -19,12 +19,10 @@ export var r5; export var r5; export var M; !function(M) { - M.foo = ""; - var C = function C() { + M.foo = "", M.C = function C() { "use strict"; _class_call_check(this, C); }; - M.C = C; }(M || (M = {})); export var r6; export var r7; @@ -40,11 +38,9 @@ export var r11; export var r12; export function foo() {} !function(foo) { - foo.y = 1; - var C = function C() { + foo.y = 1, foo.C = function C() { "use strict"; _class_call_check(this, C); }; - foo.C = C; }(foo || (foo = {})); export var r13; diff --git a/crates/swc/tests/vercel/full/d3-time-format/1/output/index.js b/crates/swc/tests/vercel/full/d3-time-format/1/output/index.js index e8d318cd9592..e878e5e8ea66 100644 --- a/crates/swc/tests/vercel/full/d3-time-format/1/output/index.js +++ b/crates/swc/tests/vercel/full/d3-time-format/1/output/index.js @@ -48,60 +48,23 @@ export default function v(e) { for(var u, c, i = 0, o = t.length, f = e.length; i < o;){ if (r >= f) return -1; if (37 === (u = t.charCodeAt(i++))) { - if (!(c = n9[(u = t.charAt(i++)) in y ? t.charAt(i++) : u]) || (r = c(n, e, r)) < 0) return -1; + if (!(c = nI[(u = t.charAt(i++)) in y ? t.charAt(i++) : u]) || (r = c(n, e, r)) < 0) return -1; } else if (u != e.charCodeAt(r++)) return -1; } return r; - }, a = function(n, t, e) { - var r = nk.exec(t.slice(e)); - return r ? (n.p = nJ.get(r[0].toLowerCase()), e + r[0].length) : -1; - }, l = function(n, t, e) { - var r = n0.exec(t.slice(e)); - return r ? (n.w = n1.get(r[0].toLowerCase()), e + r[0].length) : -1; - }, v = function(n, t, e) { - var r = nK.exec(t.slice(e)); - return r ? (n.w = nN.get(r[0].toLowerCase()), e + r[0].length) : -1; - }, C = function(n, t, e) { - var r = n4.exec(t.slice(e)); - return r ? (n.m = n7.get(r[0].toLowerCase()), e + r[0].length) : -1; - }, U = function(n, t, e) { - var r = n2.exec(t.slice(e)); - return r ? (n.m = n3.get(r[0].toLowerCase()), e + r[0].length) : -1; - }, d = function(n, t, e) { - return o(n, nI, t, e); - }, D = function(n, t, e) { - return o(n, n$, t, e); - }, x = function(n, t, e) { - return o(n, n_, t, e); - }, nn = function(n) { - return nO[n.getDay()]; - }, nx = function(n) { - return nE[n.getDay()]; - }, nA = function(n) { - return nR[n.getMonth()]; - }, nV = function(n) { - return nP[n.getMonth()]; - }, nW = function(n) { - return nz[+(n.getHours() >= 12)]; - }, nj = function(n) { - return 1 + ~~(n.getMonth() / 3); - }, nq = function(n) { - return nO[n.getUTCDay()]; - }, nQ = function(n) { - return nE[n.getUTCDay()]; - }, nX = function(n) { - return nR[n.getUTCMonth()]; - }, nb = function(n) { - return nP[n.getUTCMonth()]; - }, nB = function(n) { - return nz[+(n.getUTCHours() >= 12)]; - }, nG = function(n) { - return 1 + ~~(n.getUTCMonth() / 3); - }, nI = e.dateTime, n$ = e.date, n_ = e.time, nz = e.periods, nE = e.days, nO = e.shortDays, nP = e.months, nR = e.shortMonths, nk = T(nz), nJ = m(nz), nK = T(nE), nN = m(nE), n0 = T(nO), n1 = m(nO), n2 = T(nP), n3 = m(nP), n4 = T(nR), n7 = m(nR), n6 = { - a: nn, - A: nx, - b: nA, - B: nV, + }, a = e.dateTime, l = e.date, v = e.time, C = e.periods, U = e.days, d = e.shortDays, D = e.months, x = e.shortMonths, nn = T(C), nx = m(C), nA = T(U), nV = m(U), nW = T(d), nj = m(d), nq = T(D), nQ = m(D), nX = T(x), nb = m(x), nB = { + a: function(n) { + return d[n.getDay()]; + }, + A: function(n) { + return U[n.getDay()]; + }, + b: function(n) { + return x[n.getMonth()]; + }, + B: function(n) { + return D[n.getMonth()]; + }, c: null, d: $, e: $, @@ -114,8 +77,12 @@ export default function v(e) { L: O, m: R, M: k, - p: nW, - q: nj, + p: function(n) { + return C[+(n.getHours() >= 12)]; + }, + q: function(n) { + return 1 + ~~(n.getMonth() / 3); + }, Q: nF, s: nZ, S: J, @@ -130,11 +97,19 @@ export default function v(e) { Y: ni, Z: nf, "%": nY - }, n5 = { - a: nq, - A: nQ, - b: nX, - B: nb, + }, nG = { + a: function(n) { + return d[n.getUTCDay()]; + }, + A: function(n) { + return U[n.getUTCDay()]; + }, + b: function(n) { + return x[n.getUTCMonth()]; + }, + B: function(n) { + return D[n.getUTCMonth()]; + }, c: null, d: na, e: na, @@ -147,8 +122,12 @@ export default function v(e) { L: nh, m: ny, M: nC, - p: nB, - q: nG, + p: function(n) { + return C[+(n.getUTCHours() >= 12)]; + }, + q: function(n) { + return 1 + ~~(n.getUTCMonth() / 3); + }, Q: nF, s: nZ, S: nU, @@ -163,12 +142,26 @@ export default function v(e) { Y: nH, Z: nS, "%": nY - }, n9 = { - a: l, - A: v, - b: C, - B: U, - c: d, + }, nI = { + a: function(n, t, e) { + var r = nW.exec(t.slice(e)); + return r ? (n.w = nj.get(r[0].toLowerCase()), e + r[0].length) : -1; + }, + A: function(n, t, e) { + var r = nA.exec(t.slice(e)); + return r ? (n.w = nV.get(r[0].toLowerCase()), e + r[0].length) : -1; + }, + b: function(n, t, e) { + var r = nX.exec(t.slice(e)); + return r ? (n.m = nb.get(r[0].toLowerCase()), e + r[0].length) : -1; + }, + B: function(n, t, e) { + var r = nq.exec(t.slice(e)); + return r ? (n.m = nQ.get(r[0].toLowerCase()), e + r[0].length) : -1; + }, + c: function(n, t, e) { + return o(n, a, t, e); + }, d: V, e: V, f: b, @@ -180,7 +173,10 @@ export default function v(e) { L: X, m: A, M: q, - p: a, + p: function(n, t, e) { + var r = nn.exec(t.slice(e)); + return r ? (n.p = nx.get(r[0].toLowerCase()), e + r[0].length) : -1; + }, q: Z, Q: G, s: I, @@ -190,16 +186,20 @@ export default function v(e) { V: H, w: w, W: L, - x: D, - X: x, + x: function(n, t, e) { + return o(n, l, t, e); + }, + X: function(n, t, e) { + return o(n, v, t, e); + }, y: Y, Y: S, Z: F, "%": B }; - return n6.x = u(n$, n6), n6.X = u(n_, n6), n6.c = u(nI, n6), n5.x = u(n$, n5), n5.X = u(n_, n5), n5.c = u(nI, n5), { + return nB.x = u(l, nB), nB.X = u(v, nB), nB.c = u(a, nB), nG.x = u(l, nG), nG.X = u(v, nG), nG.c = u(a, nG), { format: function(n) { - var t = u(n += "", n6); + var t = u(n += "", nB); return t.toString = function() { return n; }, t; @@ -211,7 +211,7 @@ export default function v(e) { }, t; }, utcFormat: function(n) { - var t = u(n += "", n5); + var t = u(n += "", nG); return t.toString = function() { return n; }, t; diff --git a/crates/swc/tests/vercel/full/firebase/dist/1/output/index.js b/crates/swc/tests/vercel/full/firebase/dist/1/output/index.js index 7ca2734a6d01..c5bf5d6ccf1f 100644 --- a/crates/swc/tests/vercel/full/firebase/dist/1/output/index.js +++ b/crates/swc/tests/vercel/full/firebase/dist/1/output/index.js @@ -68,67 +68,67 @@ var e, t = require("@firebase/util"), n = require("tslib"), r = require("@fireba }; }, e; }(), s = ((e = {})["no-app"] = "No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()", e["invalid-app-argument"] = "firebase.{$appName}() takes either no argument or a Firebase App instance.", e), c = new t.ErrorFactory("app-compat", "Firebase", s), u = function e() { - var r, i, a, s, u, l, d, f, m = function(e) { - t.deepExtend(b, e); - }, b = (r = p, i = function(e) { - delete d[e]; - }, a = function(e) { - if (e = e || o._DEFAULT_ENTRY_NAME, !t.contains(d, e)) throw c.create("no-app", { + var r, i, a, s, u = (r = p, i = function(e) { + if (e = e || o._DEFAULT_ENTRY_NAME, !t.contains(a, e)) throw c.create("no-app", { appName: e }); - return d[e]; - }, s = function() { - return Object.keys(d).map(function(e) { - return d[e]; - }); - }, u = function(e) { - var n = e.name, i = n.replace("-compat", ""); - if (o._registerComponent(e) && "PUBLIC" === e.type) { - var p = function(e) { - if (void 0 === e && (e = a()), "function" != typeof e[i]) throw c.create("invalid-app-argument", { - appName: n - }); - return e[i](); - }; - void 0 !== e.serviceProps && t.deepExtend(p, e.serviceProps), f[i] = p, r.prototype[i] = function() { - for(var t = [], r = 0; r < arguments.length; r++)t[r] = arguments[r]; - return this._getService.bind(this, n).apply(this, e.multipleInstances ? t : []); - }; - } - return "PUBLIC" === e.type ? f[i] : null; - }, l = function(e, t) { - return "serverAuth" === t ? null : t; - }, d = {}, (f = { + return a[e]; + }, a = {}, (s = { __esModule: !0, initializeApp: function(e, n) { void 0 === n && (n = {}); var i = o.initializeApp(e, n); - if (t.contains(d, i.name)) return d[i.name]; - var a = new r(i, f); - return d[i.name] = a, a; + if (t.contains(a, i.name)) return a[i.name]; + var p = new r(i, s); + return a[i.name] = p, p; }, - app: a, + app: i, registerVersion: o.registerVersion, setLogLevel: o.setLogLevel, onLog: o.onLog, apps: null, SDK_VERSION: o.SDK_VERSION, INTERNAL: { - registerComponent: u, - removeApp: i, - useAsService: l, + registerComponent: function(e) { + var n = e.name, a = n.replace("-compat", ""); + if (o._registerComponent(e) && "PUBLIC" === e.type) { + var p = function(e) { + if (void 0 === e && (e = i()), "function" != typeof e[a]) throw c.create("invalid-app-argument", { + appName: n + }); + return e[a](); + }; + void 0 !== e.serviceProps && t.deepExtend(p, e.serviceProps), s[a] = p, r.prototype[a] = function() { + for(var t = [], r = 0; r < arguments.length; r++)t[r] = arguments[r]; + return this._getService.bind(this, n).apply(this, e.multipleInstances ? t : []); + }; + } + return "PUBLIC" === e.type ? s[a] : null; + }, + removeApp: function(e) { + delete a[e]; + }, + useAsService: function(e, t) { + return "serverAuth" === t ? null : t; + }, modularAPIs: o } - }).default = f, Object.defineProperty(f, "apps", { - get: s - }), a.App = r, f); - return b.INTERNAL = n.__assign(n.__assign({}, b.INTERNAL), { + }).default = s, Object.defineProperty(s, "apps", { + get: function() { + return Object.keys(a).map(function(e) { + return a[e]; + }); + } + }), i.App = r, s); + return u.INTERNAL = n.__assign(n.__assign({}, u.INTERNAL), { createFirebaseNamespace: e, - extendNamespace: m, + extendNamespace: function(e) { + t.deepExtend(u, e); + }, createSubscribe: t.createSubscribe, ErrorFactory: t.ErrorFactory, deepExtend: t.deepExtend - }), b; + }), u; }(), l = new a.Logger("@firebase/app-compat"); if (t.isBrowser() && void 0 !== self.firebase) { l.warn("\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n "); diff --git a/crates/swc/tests/vercel/full/react-instantsearch/2/output/index.js b/crates/swc/tests/vercel/full/react-instantsearch/2/output/index.js index af263d891577..e4417d82f9da 100644 --- a/crates/swc/tests/vercel/full/react-instantsearch/2/output/index.js +++ b/crates/swc/tests/vercel/full/react-instantsearch/2/output/index.js @@ -28,33 +28,27 @@ var f = function(e) { return r && !a ? -1 : !r && a ? 1 : 0; }; export default function S(u) { - var o, l, S = u.indexName, v = u.initialState, x = u.searchClient, y = u.resultsState, w = u.stalledSearchDelay, F = function() { - E = !0; - }, _ = function(e) { - d(e), J.setClient(e), b(); - }, V = function() { - J.clearCache(), b(); - }, I = function(e) { - return U.getWidgets().filter(function(e) { + var o, l, S = u.indexName, v = u.initialState, x = u.searchClient, y = u.resultsState, w = u.stalledSearchDelay, F = function(e) { + return O.getWidgets().filter(function(e) { return Boolean(e.getMetadata); }).map(function(t) { return t.getMetadata(e); }); - }, j = function() { - var a = U.getWidgets().filter(function(e) { + }, _ = function() { + var a = O.getWidgets().filter(function(e) { return Boolean(e.getSearchParameters); }).filter(function(e) { return !f(e) && !p(e); }).reduce(function(e, t) { return t.getSearchParameters(e); - }, k), n = U.getWidgets().filter(function(e) { + }, N), n = O.getWidgets().filter(function(e) { return Boolean(e.getSearchParameters); }).filter(function(e) { var t = f(e) && m(e, S), r = p(e) && g(e, S); return t || r; }).sort(h).reduce(function(e, t) { return t.getSearchParameters(e); - }, a), s = U.getWidgets().filter(function(e) { + }, a), s = O.getWidgets().filter(function(e) { return Boolean(e.getSearchParameters); }).filter(function(e) { var t = f(e) && !m(e, S), r = p(e) && !g(e, S); @@ -74,58 +68,49 @@ export default function S(u) { mainParameters: n, derivedParameters: c }; - }, b = function() { - if (!E) { - var e = j(J.state), t = e.mainParameters, r = e.derivedParameters; - J.derivedHelpers.slice().forEach(function(e) { + }, V = function() { + if (!R) { + var e = _(P.state), t = e.mainParameters, r = e.derivedParameters; + P.derivedHelpers.slice().forEach(function(e) { e.detach(); }), r.forEach(function(e) { var t = e.indexId, r = e.parameters; - J.derive(function() { + P.derive(function() { return r; - }).on("result", A({ + }).on("result", I({ indexId: t - })).on("error", P); - }), J.setState(t), J.search(); + })).on("error", j); + }), P.setState(t), P.search(); } - }, A = function(n) { + }, I = function(n) { var s = n.indexId; return function(n) { - var c = D.getState(), i = !J.derivedHelpers.length, u = c.results ? c.results : {}; + var c = q.getState(), i = !P.derivedHelpers.length, u = c.results ? c.results : {}; u = !i && u.getFacetByName ? {} : u, u = i ? n.results : r(t({}, u), e({}, s, n.results)); - var o = D.getState(), l = o.isSearchStalled; - J.hasPendingRequests() || (clearTimeout(T), T = null, l = !1), o.resultsFacetValues; + var o = q.getState(), l = o.isSearchStalled; + P.hasPendingRequests() || (clearTimeout(C), C = null, l = !1), o.resultsFacetValues; var d = a(o, [ "resultsFacetValues" ]); - D.setState(r(t({}, d), { + q.setState(r(t({}, d), { results: u, isSearchStalled: l, searching: !1, error: null })); }; - }, P = function(e) { - var n = e.error, s = D.getState(), c = s.isSearchStalled; - J.hasPendingRequests() || (clearTimeout(T), c = !1), s.resultsFacetValues; + }, j = function(e) { + var n = e.error, s = q.getState(), c = s.isSearchStalled; + P.hasPendingRequests() || (clearTimeout(C), c = !1), s.resultsFacetValues; var i = a(s, [ "resultsFacetValues" ]); - D.setState(r(t({}, i), { + q.setState(r(t({}, i), { isSearchStalled: c, error: n, searching: !1 })); - }, R = function() { - T || (T = setTimeout(function() { - var e = D.getState(), n = (e.resultsFacetValues, a(e, [ - "resultsFacetValues" - ])); - D.setState(r(t({}, n), { - isSearchStalled: !0 - })); - }, w)); - }, C = function(a, n) { + }, b = function(a, n) { if (a.transporter) { a.transporter.responsesCache.set({ method: "search", @@ -161,7 +146,7 @@ export default function S(u) { return e.concat(t.rawResults); }, []) }))); - }, N = function(a, n) { + }, A = function(a, n) { if (a.transporter) { a.transporter.responsesCache.set({ method: "search", @@ -189,58 +174,26 @@ export default function S(u) { a.cache = r(t({}, a.cache), e({}, s, JSON.stringify({ results: n.rawResults }))); - }, O = function() { - var e = I(D.getState().widgets); - D.setState(r(t({}, D.getState()), { - metadata: e, - searching: !0 - })), b(); - }, q = function(e) { - var t = D.getState().widgets; - return U.getWidgets().filter(function(e) { - return Boolean(e.transitionState); - }).reduce(function(e, r) { - return r.transitionState(t, e); - }, e); - }, B = function(e) { - var a = I(e); - D.setState(r(t({}, D.getState()), { - widgets: e, - metadata: a, - searching: !0 - })), b(); - }, H = function(a) { - var n = a.facetName, s = a.query, c = a.maxFacetHits; - D.setState(r(t({}, D.getState()), { - searchingForFacetValues: !0 - })), J.searchForFacetValues(n, s, Math.max(1, Math.min(void 0 === c ? 10 : c, 100))).then(function(a) { - var c; - D.setState(r(t({}, D.getState()), { - error: null, - searchingForFacetValues: !1, - resultsFacetValues: r(t({}, D.getState().resultsFacetValues), (e(c = {}, n, a.facetHits), e(c, "query", s), c)) - })); - }, function(e) { - D.setState(r(t({}, D.getState()), { - searchingForFacetValues: !1, - error: e + }, P = s(x, S, t({}, i)); + d(x), P.on("search", function() { + C || (C = setTimeout(function() { + var e = q.getState(), n = (e.resultsFacetValues, a(e, [ + "resultsFacetValues" + ])); + q.setState(r(t({}, n), { + isSearchStalled: !0 })); - }).catch(function(e) { - setTimeout(function() { - throw e; - }); - }); - }, W = function(e) { - k = k.setIndex(e); - }, M = function() { - return D.getState().metadata.reduce(function(e, t) { - return void 0 !== t.id ? e.concat(t.id) : e; - }, []); - }, J = s(x, S, t({}, i)); - d(x), J.on("search", R).on("result", A({ + }, w)); + }).on("result", I({ indexId: S - })).on("error", P); - var E = !1, T = null, k = J.state, U = c(O); + })).on("error", j); + var R = !1, C = null, N = P.state, O = c(function() { + var e = F(q.getState().widgets); + q.setState(r(t({}, q.getState()), { + metadata: e, + searching: !0 + })), V(); + }); !function(e, a) { if (a && (e.transporter && !e._cacheHydrated || e._useCache && "function" == typeof e.addAlgoliaAgent)) { if (e.transporter && !e._cacheHydrated) { @@ -276,13 +229,13 @@ export default function S(u) { }; } if (Array.isArray(a.results)) { - C(e, a.results); + b(e, a.results); return; } - N(e, a); + A(e, a); } }(x, y); - var D = (o = { + var q = (o = { widgets: void 0 === v ? {} : v, metadata: y ? y.metadata.map(function(e) { return r(t({ @@ -330,16 +283,63 @@ export default function S(u) { } }); return { - store: D, - widgetsManager: U, - getWidgetsIds: M, - getSearchParameters: j, - onSearchForFacetValues: H, - onExternalStateUpdate: B, - transitionState: q, - updateClient: _, - updateIndex: W, - clearCache: V, - skipSearch: F + store: q, + widgetsManager: O, + getWidgetsIds: function() { + return q.getState().metadata.reduce(function(e, t) { + return void 0 !== t.id ? e.concat(t.id) : e; + }, []); + }, + getSearchParameters: _, + onSearchForFacetValues: function(a) { + var n = a.facetName, s = a.query, c = a.maxFacetHits; + q.setState(r(t({}, q.getState()), { + searchingForFacetValues: !0 + })), P.searchForFacetValues(n, s, Math.max(1, Math.min(void 0 === c ? 10 : c, 100))).then(function(a) { + var c; + q.setState(r(t({}, q.getState()), { + error: null, + searchingForFacetValues: !1, + resultsFacetValues: r(t({}, q.getState().resultsFacetValues), (e(c = {}, n, a.facetHits), e(c, "query", s), c)) + })); + }, function(e) { + q.setState(r(t({}, q.getState()), { + searchingForFacetValues: !1, + error: e + })); + }).catch(function(e) { + setTimeout(function() { + throw e; + }); + }); + }, + onExternalStateUpdate: function(e) { + var a = F(e); + q.setState(r(t({}, q.getState()), { + widgets: e, + metadata: a, + searching: !0 + })), V(); + }, + transitionState: function(e) { + var t = q.getState().widgets; + return O.getWidgets().filter(function(e) { + return Boolean(e.transitionState); + }).reduce(function(e, r) { + return r.transitionState(t, e); + }, e); + }, + updateClient: function(e) { + d(e), P.setClient(e), V(); + }, + updateIndex: function(e) { + N = N.setIndex(e); + }, + clearCache: function() { + P.clearCache(), V(); + }, + skipSearch: function() { + R = !0; + } }; } diff --git a/crates/swc_ecma_minifier/src/analyzer/mod.rs b/crates/swc_ecma_minifier/src/analyzer/mod.rs index 3e8e98095452..c9b4447b6da0 100644 --- a/crates/swc_ecma_minifier/src/analyzer/mod.rs +++ b/crates/swc_ecma_minifier/src/analyzer/mod.rs @@ -201,6 +201,16 @@ impl VarUsageInfo { + self.assign_count) > 1 } + + pub fn can_inline_var(&self) -> bool { + !self.mutated + || (self.assign_count == 0 && !self.reassigned() && !self.has_property_mutation) + } + + pub fn can_inline_fn_once(&self) -> bool { + self.callee_count > 0 + || !self.executed_multiple_time && (self.is_fn_local || !self.used_in_non_child_fn) + } } #[derive(Debug, Clone, Copy, PartialEq, Eq)] diff --git a/crates/swc_ecma_minifier/src/analyzer/storage/normal.rs b/crates/swc_ecma_minifier/src/analyzer/storage/normal.rs index 09dac113cb6d..b988d68cf1c2 100644 --- a/crates/swc_ecma_minifier/src/analyzer/storage/normal.rs +++ b/crates/swc_ecma_minifier/src/analyzer/storage/normal.rs @@ -254,6 +254,7 @@ impl ProgramData { } } } + // Passing object as a argument is possibly modification. e.mutated |= is_modify || (ctx.in_call_arg && ctx.is_exact_arg); e.executed_multiple_time |= ctx.executed_multiple_time; diff --git a/crates/swc_ecma_minifier/src/compress/optimize/inline.rs b/crates/swc_ecma_minifier/src/compress/optimize/inline.rs index a55f0584bded..d5e5f7876cde 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/inline.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/inline.rs @@ -171,10 +171,7 @@ where // Mutation of properties are ok if is_inline_enabled && usage.declared_count == 1 - && (!usage.mutated - || (usage.assign_count == 0 - && !usage.reassigned() - && !usage.has_property_mutation)) + && (usage.can_inline_var()) && match init { Expr::Ident(Ident { sym: js_word!("eval"), @@ -253,9 +250,10 @@ where // Single use => inlined if is_inline_enabled + && usage.declared && !should_preserve && !usage.reassigned() - && (!usage.mutated || usage.is_mutated_only_by_one_call()) + && (usage.can_inline_var() || usage.is_mutated_only_by_one_call()) && ref_count == 1 { match init { @@ -291,6 +289,10 @@ where Expr::Lit(..) => {} + Expr::Fn(_) if !usage.can_inline_fn_once() => { + return; + } + Expr::Fn(f) => { let excluded: Vec = find_pat_ids(&f.function.params); @@ -307,6 +309,11 @@ where } } } + + Expr::Arrow(..) if usage.callee_count == 0 => { + return; + } + Expr::Arrow(f) => { let excluded: Vec = find_pat_ids(&f.params); @@ -353,12 +360,6 @@ where } } - if usage.callee_count == 0 { - if let Expr::Fn(..) | Expr::Arrow(..) = init { - return; - } - } - if usage.used_as_arg && !usage.is_fn_local { if let Expr::Fn(..) | Expr::Arrow(..) = init { return; @@ -618,9 +619,7 @@ where // if (self.options.reduce_vars || self.options.collapse_vars || self.options.inline != 0) && usage.ref_count == 1 - && (usage.callee_count > 0 - || !usage.executed_multiple_time - && (usage.is_fn_local || !usage.used_in_non_child_fn)) + && (usage.can_inline_fn_once()) && !usage.inline_prevented && (match decl { Decl::Class(..) => !usage.used_above_decl, diff --git a/crates/swc_ecma_minifier/tests/benches-full/echarts.js b/crates/swc_ecma_minifier/tests/benches-full/echarts.js index d9ccc2de233b..0f86dca9d4c3 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/echarts.js +++ b/crates/swc_ecma_minifier/tests/benches-full/echarts.js @@ -4,7 +4,7 @@ ], factory) : factory((global1 = 'undefined' != typeof globalThis ? globalThis : global1 || self).echarts = {}); }(this, function(exports1) { 'use strict'; - var ua, env, browser, firefox, ie, edge, weChat, style, mouseHandlerNames, pointerEventNameMap, pointerHandlerNames, target, classAttr, target1, subTypeDefaulters, loadingFx, theme, _super, mainType, creator, _ctx, _cachedFont, requestAnimationFrame, reCreateSeriesIndices, assertSeriesInitialized, initBase, _a, _b, _c, providerMethods, mountMethods, seriesType, nodeParsers, prepare, prepareView, updateDirectly, updateMethods, doConvertPixel, updateStreamModes, doDispatchAction, flushPendingActions, triggerUpdatedEvent, bindRenderedEvent, bindMouseEvent, clearColorPalette, render, renderComponents, renderSeries, performPostUpdateFuncs, createExtensionAPI, enableConnect, setTransitionOpt, markStatusToUpdate, applyChangedStates, defaultDimValueGetters, prepareInvertedIndex, getIndicesCtor, prepareStorage, getRawIndexWithoutIndices, getRawIndexWithIndices, getId, getIdNameFromStore, makeIdFromName, normalizeDimensions, validateDimensions, cloneListForMapAndSample, getInitialExtent, setItemDataAndSeriesIndex, transferProperties, checkNonStyleTansitionRefer, checkTransformPropRefer, extendStatics = function(d, b) { + var ua, env, browser, firefox, ie, edge, weChat, style, mouseHandlerNames, pointerEventNameMap, pointerHandlerNames, target, classAttr, target1, subTypeDefaulters, _super, mainType, creator, _ctx, _cachedFont, requestAnimationFrame, reCreateSeriesIndices, assertSeriesInitialized, initBase, _a, _b, _c, providerMethods, mountMethods, seriesType, nodeParsers, prepare, prepareView, updateDirectly, updateMethods, doConvertPixel, updateStreamModes, doDispatchAction, flushPendingActions, triggerUpdatedEvent, bindRenderedEvent, bindMouseEvent, clearColorPalette, render, renderComponents, renderSeries, performPostUpdateFuncs, createExtensionAPI, enableConnect, setTransitionOpt, markStatusToUpdate, applyChangedStates, defaultDimValueGetters, prepareInvertedIndex, getIndicesCtor, prepareStorage, getRawIndexWithoutIndices, getRawIndexWithIndices, getId, getIdNameFromStore, makeIdFromName, normalizeDimensions, validateDimensions, cloneListForMapAndSample, getInitialExtent, setItemDataAndSeriesIndex, transferProperties, checkNonStyleTansitionRefer, checkTransformPropRefer, extendStatics = function(d, b) { return (extendStatics = Object.setPrototypeOf || ({ __proto__: [] }) instanceof Array && function(d, b) { @@ -10479,7 +10479,7 @@ '#ff8a45', '#8d48e3', '#dd79ff' - ], theme1 = { + ], theme = { darkMode: !0, color: colorPalette, backgroundColor: backgroundColor, @@ -10631,7 +10631,7 @@ } } }; - theme1.categoryAxis.splitLine.show = !1; + theme.categoryAxis.splitLine.show = !1; var ECEventProcessor = function() { function ECEventProcessor() {} return ECEventProcessor.prototype.normalizeQuery = function(query) { @@ -13856,7 +13856,7 @@ stackInfoList.length && data.setCalculationInfo('stackedOnSeries', stackInfoList[stackInfoList.length - 1].seriesModel), stackInfoList.push(stackInfo); } }), stackInfoMap.each(calculateStack); - }), loadingFx = function(api, opts) { + }), loadingEffects.default = function(api, opts) { defaults(opts = opts || {}, { text: 'loading', textColor: '#000', @@ -13936,7 +13936,7 @@ height: api.getHeight() }); }, group.resize(), group; - }, loadingEffects.default = loadingFx, registerAction({ + }, registerAction({ type: HIGHLIGHT_ACTION_TYPE, event: HIGHLIGHT_ACTION_TYPE, update: HIGHLIGHT_ACTION_TYPE @@ -13956,7 +13956,7 @@ type: TOGGLE_SELECT_ACTION_TYPE, event: TOGGLE_SELECT_ACTION_TYPE, update: TOGGLE_SELECT_ACTION_TYPE - }, noop), theme = { + }, noop), themeStorage.light = { color: colorAll, colorLayer: [ [ @@ -13985,7 +13985,7 @@ ], colorAll ] - }, themeStorage.light = theme, themeStorage.dark = theme1; + }, themeStorage.dark = theme; var extensions = [], extensionRegisters = { registerPreprocessor: registerPreprocessor, registerProcessor: registerProcessor, @@ -25916,11 +25916,7 @@ dataGroup.remove(line); }).execute(), !this._initialized) { this._initialized = !0; - var cb, parallelModel, rect, rectEl, dim, clipPath = (cb = function() { - setTimeout(function() { - dataGroup.removeClipPath(); - }); - }, parallelModel = coordSys.model, rect = coordSys.getRect(), rectEl = new Rect({ + var parallelModel, rect, rectEl, dim, clipPath = (parallelModel = coordSys.model, rect = coordSys.getRect(), rectEl = new Rect({ shape: { x: rect.x, y: rect.y, @@ -25932,7 +25928,11 @@ width: rect.width, height: rect.height } - }, seriesModel, cb), rectEl); + }, seriesModel, function() { + setTimeout(function() { + dataGroup.removeClipPath(); + }); + }), rectEl); dataGroup.setClipPath(clipPath); } this._data = data; @@ -27176,7 +27176,7 @@ return _this.type = SankeyView.type, _this._focusAdjacencyDisabled = !1, _this; } return __extends(SankeyView, _super), SankeyView.prototype.render = function(seriesModel, ecModel, api) { - var rect, cb, rectEl, sankeyView = this, graph = seriesModel.getGraph(), group = this.group, layoutInfo = seriesModel.layoutInfo, width = layoutInfo.width, height = layoutInfo.height, nodeData = seriesModel.getData(), edgeData = seriesModel.getData('edge'), orient = seriesModel.get('orient'); + var rect, rectEl, sankeyView = this, graph = seriesModel.getGraph(), group = this.group, layoutInfo = seriesModel.layoutInfo, width = layoutInfo.width, height = layoutInfo.height, nodeData = seriesModel.getData(), edgeData = seriesModel.getData('edge'), orient = seriesModel.get('orient'); this._model = seriesModel, group.removeAll(), group.x = layoutInfo.x, group.y = layoutInfo.y, graph.eachEdge(function(edge) { var x1, y1, x2, y2, cpx1, cpy1, cpx2, cpy2, curve = new SankeyPath(), ecData = getECData(curve); ecData.dataIndex = edge.dataIndex, ecData.seriesIndex = seriesModel.seriesIndex, ecData.dataType = 'edge'; @@ -27246,9 +27246,7 @@ }, el.ondragend = function() { sankeyView._focusAdjacencyDisabled = !1; }, el.draggable = !0, el.cursor = 'move'); - }), !this._data && seriesModel.isAnimationEnabled() && group.setClipPath((rect = group.getBoundingRect(), cb = function() { - group.removeClipPath(); - }, initProps(rectEl = new Rect({ + }), !this._data && seriesModel.isAnimationEnabled() && group.setClipPath((rect = group.getBoundingRect(), initProps(rectEl = new Rect({ shape: { x: rect.x - 10, y: rect.y - 10, @@ -27259,7 +27257,9 @@ shape: { width: rect.width + 20 } - }, seriesModel, cb), rectEl)), this._data = seriesModel.getData(); + }, seriesModel, function() { + group.removeClipPath(); + }), rectEl)), this._data = seriesModel.getData(); }, SankeyView.prototype.dispose = function() {}, SankeyView.type = 'sankey', SankeyView; }(ChartView), SankeySeriesModel = function(_super) { function SankeySeriesModel() { @@ -29447,7 +29447,7 @@ } var textLayout = data.getItemLayout(indices[0]), margin = seriesModel.getModel('label').get('margin'), emphasisModel = seriesModel.getModel('emphasis'); if ('add' === status) { - var rect, cb, rectEl, layerGroup = newLayersGroups[idx] = new Group(); + var rect, rectEl, layerGroup = newLayersGroups[idx] = new Group(); polygon = new ECPolygon({ shape: { points: points0, @@ -29457,9 +29457,7 @@ smoothConstraint: !1 }, z2: 0 - }), layerGroup.add(polygon), group.add(layerGroup), seriesModel.isAnimationEnabled() && polygon.setClipPath((rect = polygon.getBoundingRect(), cb = function() { - polygon.removeClipPath(); - }, initProps(rectEl = new Rect({ + }), layerGroup.add(polygon), group.add(layerGroup), seriesModel.isAnimationEnabled() && polygon.setClipPath((rect = polygon.getBoundingRect(), initProps(rectEl = new Rect({ shape: { x: rect.x - 10, y: rect.y - 10, @@ -29472,7 +29470,9 @@ width: rect.width + 100, height: rect.height + 20 } - }, seriesModel, cb), rectEl)); + }, seriesModel, function() { + polygon.removeClipPath(); + }), rectEl)); } else { var layerGroup = oldLayersGroups[oldIdx]; polygon = layerGroup.childAt(0), group.add(layerGroup), newLayersGroups[idx] = layerGroup, updateProps(polygon, { @@ -34615,7 +34615,17 @@ if (seriesOptGenreator[type]) { var newOption = { series: [] - }, generateNewSeriesTypes = function(seriesModel) { + }; + each(radioTypes, function(radio) { + indexOf(radio, type) >= 0 && each(radio, function(item) { + model.setIconStatus(item, 'normal'); + }); + }), model.setIconStatus(type, 'emphasis'), ecModel.eachComponent({ + mainType: 'series', + query: null == seriesIndex ? null : { + seriesIndex: seriesIndex + } + }, function(seriesModel) { var seriesType = seriesModel.subType, seriesId = seriesModel.id, newSeriesOpt = seriesOptGenreator[type](seriesType, seriesId, seriesModel, model); newSeriesOpt && (defaults(newSeriesOpt, seriesModel.option), newOption.series.push(newSeriesOpt)); var coordSys = seriesModel.coordinateSystem; @@ -34628,17 +34638,7 @@ newOption[axisType][axisIndex].boundaryGap = 'bar' === type; } } - }; - each(radioTypes, function(radio) { - indexOf(radio, type) >= 0 && each(radio, function(item) { - model.setIconStatus(item, 'normal'); - }); - }), model.setIconStatus(type, 'emphasis'), ecModel.eachComponent({ - mainType: 'series', - query: null == seriesIndex ? null : { - seriesIndex: seriesIndex - } - }, generateNewSeriesTypes), 'stack' === type && (newTitle = merge({ + }), 'stack' === type && (newTitle = merge({ stack: model.option.title.tiled, tiled: model.option.title.stack }, model.option.title)), api.dispatchAction({ diff --git a/crates/swc_ecma_minifier/tests/benches-full/jquery.js b/crates/swc_ecma_minifier/tests/benches-full/jquery.js index 72b034e930b5..1586659030c6 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/jquery.js +++ b/crates/swc_ecma_minifier/tests/benches-full/jquery.js @@ -1223,10 +1223,10 @@ }, dequeue: function(elem, type) { type = type || "fx"; - var queue = jQuery.queue(elem, type), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks(elem, type), next = function() { + var queue = jQuery.queue(elem, type), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks(elem, type); + "inprogress" === fn && (fn = queue.shift(), startLength--), fn && ("fx" === type && queue.unshift("inprogress"), delete hooks.stop, fn.call(elem, function() { jQuery.dequeue(elem, type); - }; - "inprogress" === fn && (fn = queue.shift(), startLength--), fn && ("fx" === type && queue.unshift("inprogress"), delete hooks.stop, fn.call(elem, next, hooks)), !startLength && hooks && hooks.empty.fire(); + }, hooks)), !startLength && hooks && hooks.empty.fire(); }, _queueHooks: function(elem, type) { var key = type + "queueHooks"; diff --git a/crates/swc_ecma_minifier/tests/benches-full/moment.js b/crates/swc_ecma_minifier/tests/benches-full/moment.js index 1fa39702c192..65762db554b4 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/moment.js +++ b/crates/swc_ecma_minifier/tests/benches-full/moment.js @@ -850,9 +850,7 @@ for(i = 1, res = moments[0]; i < moments.length; ++i)(!moments[i].isValid() || moments[i][fn](res)) && (res = moments[i]); return res; } - var now = function() { - return Date.now ? Date.now() : +new Date(); - }, ordering = [ + var ordering = [ 'year', 'quarter', 'month', @@ -1707,8 +1705,8 @@ } function toISOString$1() { if (!this.isValid()) return this.localeData().invalidDate(); - var minutes, hours, years, s, totalSign, ymSign, daysSign, hmsSign, seconds = abs$1(this._milliseconds) / 1000, days = abs$1(this._days), months = abs$1(this._months), total = this.asSeconds(); - return total ? (minutes = absFloor(seconds / 60), hours = absFloor(minutes / 60), seconds %= 60, minutes %= 60, years = absFloor(months / 12), months %= 12, s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '', totalSign = total < 0 ? '-' : '', ymSign = sign(this._months) !== sign(total) ? '-' : '', daysSign = sign(this._days) !== sign(total) ? '-' : '', hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '', totalSign + 'P' + (years ? ymSign + years + 'Y' : '') + (months ? ymSign + months + 'M' : '') + (days ? daysSign + days + 'D' : '') + (hours || minutes || seconds ? 'T' : '') + (hours ? hmsSign + hours + 'H' : '') + (minutes ? hmsSign + minutes + 'M' : '') + (seconds ? hmsSign + s + 'S' : '')) : 'P0D'; + var minutes, hours, years, s, ymSign, daysSign, hmsSign, seconds = abs$1(this._milliseconds) / 1000, days = abs$1(this._days), months = abs$1(this._months), total = this.asSeconds(); + return total ? (minutes = absFloor(seconds / 60), hours = absFloor(minutes / 60), seconds %= 60, minutes %= 60, years = absFloor(months / 12), months %= 12, s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '', ymSign = sign(this._months) !== sign(total) ? '-' : '', daysSign = sign(this._days) !== sign(total) ? '-' : '', hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '', (total < 0 ? '-' : '') + 'P' + (years ? ymSign + years + 'Y' : '') + (months ? ymSign + months + 'M' : '') + (days ? daysSign + days + 'D' : '') + (hours || minutes || seconds ? 'T' : '') + (hours ? hmsSign + hours + 'H' : '') + (minutes ? hmsSign + minutes + 'M' : '') + (seconds ? hmsSign + s + 'S' : '')) : 'P0D'; } var proto$2 = Duration.prototype; return proto$2.isValid = function() { @@ -1808,7 +1806,9 @@ }, hooks.max = function() { var args = [].slice.call(arguments, 0); return pickBy('isAfter', args); - }, hooks.now = now, hooks.utc = createUTC, hooks.unix = function(input) { + }, hooks.now = function() { + return Date.now ? Date.now() : +new Date(); + }, hooks.utc = createUTC, hooks.unix = function(input) { return createLocal(1000 * input); }, hooks.months = function(format, index) { return listMonthsImpl(format, index, 'months'); diff --git a/crates/swc_ecma_minifier/tests/benches-full/react.js b/crates/swc_ecma_minifier/tests/benches-full/react.js index 607ae98c6ce6..d931e2e62697 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/react.js +++ b/crates/swc_ecma_minifier/tests/benches-full/react.js @@ -603,20 +603,6 @@ try { Object.freeze({}); } catch (e) {} - var cloneElement$1 = function(element, props, children) { - for(var newElement = cloneElement.apply(this, arguments), i = 2; i < arguments.length; i++)validateChildKeys(arguments[i], newElement.type); - return validatePropTypes(newElement), newElement; - }, createFactory = function(type) { - var validatedFactory = createElementWithValidation.bind(null, type); - return validatedFactory.type = type, didWarnAboutDeprecatedCreateFactory || (didWarnAboutDeprecatedCreateFactory = !0, warn("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")), Object.defineProperty(validatedFactory, 'type', { - enumerable: !1, - get: function() { - return warn("Factory.type is deprecated. Access the class directly before passing it to createFactory."), Object.defineProperty(this, 'type', { - value: type - }), type; - } - }), validatedFactory; - }; exports.Children = { map: mapChildren, forEach: function(children, forEachFunc, forEachContext) { @@ -639,7 +625,10 @@ if (!isValidElement(children)) throw Error("React.Children.only expected to receive a single React element child."); return children; } - }, exports.Component = Component, exports.PureComponent = PureComponent, exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals, exports.cloneElement = cloneElement$1, exports.createContext = function(defaultValue, calculateChangedBits) { + }, exports.Component = Component, exports.PureComponent = PureComponent, exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals, exports.cloneElement = function(element, props, children) { + for(var newElement = cloneElement.apply(this, arguments), i = 2; i < arguments.length; i++)validateChildKeys(arguments[i], newElement.type); + return validatePropTypes(newElement), newElement; + }, exports.createContext = function(defaultValue, calculateChangedBits) { void 0 === calculateChangedBits ? calculateChangedBits = null : null !== calculateChangedBits && 'function' != typeof calculateChangedBits && error("createContext: Expected the optional second argument to be a function. Instead received: %s", calculateChangedBits); var context = { $$typeof: REACT_CONTEXT_TYPE, @@ -706,7 +695,17 @@ } } }), context.Consumer = Consumer, context._currentRenderer = null, context._currentRenderer2 = null, context; - }, exports.createElement = createElementWithValidation, exports.createFactory = createFactory, exports.createRef = function() { + }, exports.createElement = createElementWithValidation, exports.createFactory = function(type) { + var validatedFactory = createElementWithValidation.bind(null, type); + return validatedFactory.type = type, didWarnAboutDeprecatedCreateFactory || (didWarnAboutDeprecatedCreateFactory = !0, warn("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")), Object.defineProperty(validatedFactory, 'type', { + enumerable: !1, + get: function() { + return warn("Factory.type is deprecated. Access the class directly before passing it to createFactory."), Object.defineProperty(this, 'type', { + value: type + }), type; + } + }), validatedFactory; + }, exports.createRef = function() { var refObject = { current: null }; diff --git a/crates/swc_ecma_minifier/tests/benches-full/terser.js b/crates/swc_ecma_minifier/tests/benches-full/terser.js index d8a044e6f084..4e40d19e1364 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/terser.js +++ b/crates/swc_ecma_minifier/tests/benches-full/terser.js @@ -4288,9 +4288,7 @@ var a = str.split(/\r?\n/), n = a.length - 1; current_line += n, current_col += a[0].length, n > 0 && (ensure_line_len(), current_col = a[n].length), last = str; } - var star = function() { - print("*"); - }, space = options.beautify ? function() { + var space = options.beautify ? function() { print(" "); } : function() { might_need_space = !0; @@ -4359,7 +4357,9 @@ }, newline: newline, print: print, - star: star, + star: function() { + print("*"); + }, space: space, comma: function() { print(","), space(); diff --git a/crates/swc_ecma_minifier/tests/benches-full/victory.js b/crates/swc_ecma_minifier/tests/benches-full/victory.js index 47a447491f79..0b3c60ebd4c6 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/victory.js +++ b/crates/swc_ecma_minifier/tests/benches-full/victory.js @@ -6642,8 +6642,7 @@ }; }, "../../../node_modules/delaunator/delaunator.js": function(module1, exports1, __webpack_require__) { - var factory; - factory = function() { + module1.exports = function() { 'use strict'; var EDGE_STACK = new Uint32Array(512), Delaunator = function(coords) { var n = coords.length >> 1; @@ -6808,7 +6807,7 @@ var t = this.trianglesLen; return this._triangles[t] = i0, this._triangles[t + 1] = i1, this._triangles[t + 2] = i2, this._link(t, a), this._link(t + 1, b), this._link(t + 2, c), this.trianglesLen += 3, t; }, Delaunator; - }, module1.exports = factory(); + }(); }, "../../../node_modules/delaunay-find/lib/index.js": function(module1, exports1, __webpack_require__) { "use strict"; @@ -8194,10 +8193,10 @@ }; }, "../../../node_modules/lodash/now.js": function(module1, exports1, __webpack_require__) { - var root = __webpack_require__("../../../node_modules/lodash/_root.js"), now = function() { + var root = __webpack_require__("../../../node_modules/lodash/_root.js"); + module1.exports = function() { return root.Date.now(); }; - module1.exports = now; }, "../../../node_modules/lodash/omitBy.js": function(module1, exports1, __webpack_require__) { var baseIteratee = __webpack_require__("../../../node_modules/lodash/_baseIteratee.js"), negate = __webpack_require__("../../../node_modules/lodash/negate.js"), pickBy = __webpack_require__("../../../node_modules/lodash/pickBy.js"); @@ -10994,10 +10993,7 @@ }, {}); return acc[eventKey] = dataObj, TYPES.forEach(function(type) { var labelText = getText(dataProps, type), labelProp = props.labels || props["".concat(type, "Labels")]; - if (null != labelText || labelProp && (events || sharedEvents)) { - var target = "".concat(type, "Labels"); - acc[eventKey][target] = getLabelProps(lodash_assign__WEBPACK_IMPORTED_MODULE_5___default()({}, props, dataProps), labelText, type); - } + (null != labelText || labelProp && (events || sharedEvents)) && (acc[eventKey]["".concat(type, "Labels")] = getLabelProps(lodash_assign__WEBPACK_IMPORTED_MODULE_5___default()({}, props, dataProps), labelText, type)); }), acc; }, initialChildProps); }; @@ -12920,10 +12916,7 @@ } return TYPES.forEach(function(type) { var labelText = getText(extendedProps, type), labelProp = props.labels || props["".concat(type, "Labels")]; - if (null != labelText || labelProp && (events || sharedEvents)) { - var target = "".concat(type, "Labels"); - childProps[eventKey][target] = getLabelProps(extendedProps, labelText, style, type); - } + (null != labelText || labelProp && (events || sharedEvents)) && (childProps[eventKey]["".concat(type, "Labels")] = getLabelProps(extendedProps, labelText, style, type)); }), childProps; }, initialChildProps); }; @@ -15562,7 +15555,7 @@ return target; }).apply(this, arguments); } - var Circle = function(props) { + __webpack_exports__.default = function(props) { var desc = props.desc, rest = function(source, excluded) { if (null == source) return {}; var key, i, target = {}, sourceKeys = Object.keys(source); @@ -15581,7 +15574,6 @@ vectorEffect: "non-scaling-stroke" }, rest)); }; - __webpack_exports__.default = Circle; }, "../../victory-core/es/victory-primitives/clip-path.js": function(module1, __webpack_exports__, __webpack_require__) { "use strict"; @@ -15677,7 +15669,7 @@ return target; }).apply(this, arguments); } - var Line = function(props) { + __webpack_exports__.default = function(props) { var desc = props.desc, rest = function(source, excluded) { if (null == source) return {}; var key, i, target = {}, sourceKeys = Object.keys(source); @@ -15696,7 +15688,6 @@ vectorEffect: "non-scaling-stroke" }, rest)); }; - __webpack_exports__.default = Line; }, "../../victory-core/es/victory-primitives/path-helpers.js": function(module1, __webpack_exports__, __webpack_require__) { "use strict"; @@ -15746,7 +15737,8 @@ "../../victory-core/es/victory-primitives/path.js": function(module1, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); - var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("react"), react__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__), Path = function(props) { + var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("react"), react__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); + __webpack_exports__.default = function(props) { var desc = props.desc, rest = function(source, excluded) { if (null == source) return {}; var key, i, target = {}, sourceKeys = Object.keys(source); @@ -15761,7 +15753,6 @@ ]); return desc ? react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("path", rest, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("desc", null, desc)) : react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("path", rest); }; - __webpack_exports__.default = Path; }, "../../victory-core/es/victory-primitives/point.js": function(module1, __webpack_exports__, __webpack_require__) { "use strict"; @@ -15867,7 +15858,7 @@ return target; }).apply(this, arguments); } - var Rect = function(props) { + __webpack_exports__.default = function(props) { var desc = props.desc, rest = function(source, excluded) { if (null == source) return {}; var key, i, target = {}, sourceKeys = Object.keys(source); @@ -15886,7 +15877,6 @@ vectorEffect: "non-scaling-stroke" }, rest)); }; - __webpack_exports__.default = Rect; }, "../../victory-core/es/victory-primitives/text.js": function(module1, __webpack_exports__, __webpack_require__) { "use strict"; @@ -15917,10 +15907,10 @@ "../../victory-core/es/victory-primitives/tspan.js": function(module1, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); - var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("react"), react__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__), TSpan = function(props) { + var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("react"), react__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); + __webpack_exports__.default = function(props) { return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("tspan", props); }; - __webpack_exports__.default = TSpan; }, "../../victory-core/es/victory-primitives/whisker.js": function(module1, __webpack_exports__, __webpack_require__) { "use strict"; @@ -17085,16 +17075,14 @@ return filteredTickFormat[index]; }; } - if (!(tickFormat && lodash_isFunction__WEBPACK_IMPORTED_MODULE_8___default()(tickFormat))) return function(x) { - return x; - }; - var applyStringTicks = function(tick, index, ticks) { + return tickFormat && lodash_isFunction__WEBPACK_IMPORTED_MODULE_8___default()(tickFormat) ? stringMap ? function(tick, index, ticks) { var invertedStringMap = lodash_invert__WEBPACK_IMPORTED_MODULE_6___default()(stringMap), stringTickArray = ticks.map(function(t) { return invertedStringMap[t]; }); return props.tickFormat(invertedStringMap[tick], index, stringTickArray); + } : tickFormat : function(x) { + return x; }; - return stringMap ? applyStringTicks : tickFormat; } var defaultTickFormat = function(props) { var tickValues = props.tickValues, axis = getAxis(props), stringMap = props.stringMap && props.stringMap[axis], fallbackFormat = tickValues && !_collection__WEBPACK_IMPORTED_MODULE_13__.default.containsDates(tickValues) ? function(x) { @@ -18117,10 +18105,9 @@ }, getPartialEvents: function(events, eventKey, childProps) { return events ? lodash_keys__WEBPACK_IMPORTED_MODULE_0___default()(events).reduce(function(memo, eventName) { - var appliedEvent = function(evt) { + return memo[eventName] = function(evt) { return events[eventName](evt, childProps, eventKey, eventName); - }; - return memo[eventName] = appliedEvent, memo; + }, memo; }, {}) : {}; }, getEventState: function(eventKey, namespace, childType) { @@ -22377,18 +22364,18 @@ }(widths) || function() { throw TypeError("Invalid attempt to spread non-iterable instance"); }()); - }, approximateTextSize = function(text, style) { - var angle = Array.isArray(style) ? style[0] && style[0].angle : style && style.angle, height = void 0 === text || "" === text || null === text ? 0 : _splitToLines(text).reduce(function(total, line, index) { - var lineStyle = _prepareParams(style, index), height = line.toString().match(/[(A-Z)(0-9)]/) ? lineStyle.fontSize * coefficients.lineCapitalCoef : lineStyle.fontSize; - return total + lineStyle.lineHeight * height; - }, 0), width = _approximateTextWidthInternal(text, style); - return { - width: angle ? _getSizeWithRotate(width, height, angle) : width, - height: (angle ? _getSizeWithRotate(height, width, angle) : height) * coefficients.heightOverlapCoef - }; }; __webpack_exports__.default = { - approximateTextSize: approximateTextSize, + approximateTextSize: function(text, style) { + var angle = Array.isArray(style) ? style[0] && style[0].angle : style && style.angle, height = void 0 === text || "" === text || null === text ? 0 : _splitToLines(text).reduce(function(total, line, index) { + var lineStyle = _prepareParams(style, index), height = line.toString().match(/[(A-Z)(0-9)]/) ? lineStyle.fontSize * coefficients.lineCapitalCoef : lineStyle.fontSize; + return total + lineStyle.lineHeight * height; + }, 0), width = _approximateTextWidthInternal(text, style); + return { + width: angle ? _getSizeWithRotate(width, height, angle) : width, + height: (angle ? _getSizeWithRotate(height, width, angle) : height) * coefficients.heightOverlapCoef + }; + }, convertLengthToPixels: convertLengthToPixels }; }, @@ -22712,12 +22699,12 @@ }, getScale: function(props, axis, childComponents) { if (props.data) return _scale__WEBPACK_IMPORTED_MODULE_19__.default.getBaseScale(props, axis); - var children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_10___default.a.Children.toArray(props.children), iteratee = function(child) { + var children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_10___default.a.Children.toArray(props.children), childScale = lodash_uniq__WEBPACK_IMPORTED_MODULE_5___default()(_helpers__WEBPACK_IMPORTED_MODULE_18__.default.reduceChildren(children, function(child) { var sharedProps = lodash_assign__WEBPACK_IMPORTED_MODULE_9___default()({}, child.props, { horizontal: props.horizontal }); return _scale__WEBPACK_IMPORTED_MODULE_19__.default.getScaleType(sharedProps, axis); - }, childScale = lodash_uniq__WEBPACK_IMPORTED_MODULE_5___default()(_helpers__WEBPACK_IMPORTED_MODULE_18__.default.reduceChildren(children, iteratee, props)); + }, props)); return childScale.length > 1 ? _scale__WEBPACK_IMPORTED_MODULE_19__.default.getScaleFromName("linear") : _scale__WEBPACK_IMPORTED_MODULE_19__.default.getScaleFromName(childScale[0]); }, setAnimationState: function(props, nextProps) { @@ -22788,10 +22775,10 @@ categories: categories }, parentProps = parentData ? lodash_assign__WEBPACK_IMPORTED_MODULE_9___default()(baseParentProps, { data: parentData - }) : baseParentProps, iteratee = function(child) { + }) : baseParentProps, childDomains = _helpers__WEBPACK_IMPORTED_MODULE_18__.default.reduceChildren(children, function(child) { var sharedProps = lodash_assign__WEBPACK_IMPORTED_MODULE_9___default()({}, child.props, parentProps); return _domain__WEBPACK_IMPORTED_MODULE_15__.default.isDomainComponent(child) ? child.type && lodash_isFunction__WEBPACK_IMPORTED_MODULE_6___default()(child.type.getDomain) ? child.props && child.type.getDomain(sharedProps, axis) : _domain__WEBPACK_IMPORTED_MODULE_15__.default.getDomain(sharedProps, axis) : null; - }, childDomains = _helpers__WEBPACK_IMPORTED_MODULE_18__.default.reduceChildren(children, iteratee, props); + }, props); return [ 0 === childDomains.length ? 0 : _collection__WEBPACK_IMPORTED_MODULE_17__.default.getMinValue(childDomains), 0 === childDomains.length ? 1 : _collection__WEBPACK_IMPORTED_MODULE_17__.default.getMaxValue(childDomains) @@ -22860,7 +22847,9 @@ childComponents: childComponents, parentProps: parentProps }); - var iteratee = function(child, childName, parent) { + var stacked = children.filter(function(c) { + return c.type && "stack" === c.type.role; + }).length, datasets = _helpers__WEBPACK_IMPORTED_MODULE_18__.default.reduceChildren(children, function(child, childName, parent) { var childData, childProps = lodash_assign__WEBPACK_IMPORTED_MODULE_9___default()({}, child.props, parentProps); return _data__WEBPACK_IMPORTED_MODULE_14__.default.isDataComponent(child) ? (childData = child.type && lodash_isFunction__WEBPACK_IMPORTED_MODULE_6___default()(child.type.getData) ? (child = parent ? react__WEBPACK_IMPORTED_MODULE_10___default.a.cloneElement(child, parent.props) : child).type.getData(childProps) : _data__WEBPACK_IMPORTED_MODULE_14__.default.getData(childProps), stack += 1, childData.map(function(datum, index) { return lodash_assign__WEBPACK_IMPORTED_MODULE_9___default()({ @@ -22868,11 +22857,9 @@ _group: index }, datum); })) : null; - }, stacked = children.filter(function(c) { - return c.type && "stack" === c.type.role; - }).length, combine = function(memo, val) { + }, props, [], function(memo, val) { return memo.concat(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_2___default()(val, "_group")); - }, datasets = _helpers__WEBPACK_IMPORTED_MODULE_18__.default.reduceChildren(children, iteratee, props, [], combine); + }); return lodash_values__WEBPACK_IMPORTED_MODULE_1___default()(lodash_groupBy__WEBPACK_IMPORTED_MODULE_3___default()(datasets, stacked ? "_group" : "_stack")); }, getColor: function(calculatedProps, child, index) { @@ -22909,18 +22896,17 @@ }; }, getStringsFromCategories: function(childComponents, axis) { - var iteratee = function(child) { + return _helpers__WEBPACK_IMPORTED_MODULE_18__.default.reduceChildren(childComponents.slice(0), function(child) { var childProps = child.props || {}; if (!_domain__WEBPACK_IMPORTED_MODULE_15__.default.isDomainComponent(child) || !childProps.categories) return null; var categories = childProps.categories && !Array.isArray(childProps.categories) ? childProps.categories[axis] : childProps.props.categories, categoryStrings = categories && categories.filter(function(val) { return "string" == typeof val; }); return categoryStrings ? _collection__WEBPACK_IMPORTED_MODULE_17__.default.removeUndefined(categoryStrings) : []; - }; - return _helpers__WEBPACK_IMPORTED_MODULE_18__.default.reduceChildren(childComponents.slice(0), iteratee); + }); }, getStringsFromData: function(childComponents) { - var iteratee = function(child) { + return _helpers__WEBPACK_IMPORTED_MODULE_18__.default.reduceChildren(childComponents.slice(0), function(child) { var childProps = child.props || {}; return _data__WEBPACK_IMPORTED_MODULE_14__.default.isDataComponent(child) ? (child.type && lodash_isFunction__WEBPACK_IMPORTED_MODULE_6___default()(child.type.getData) ? child.type.getData(childProps) : _data__WEBPACK_IMPORTED_MODULE_14__.default.getData(childProps)).map(function(d) { return { @@ -22928,7 +22914,10 @@ y: d.yName }; }) : null; - }, combine = function(memo, datum) { + }, {}, { + x: [], + y: [] + }, function(memo, datum) { var x = Array.isArray(datum) ? datum.map(function(d) { return d.x; }).filter(Boolean) : datum.x, y = Array.isArray(datum) ? datum.map(function(d) { @@ -22938,11 +22927,7 @@ x: void 0 !== x ? memo.x.concat(x) : memo.x, y: void 0 !== y ? memo.y.concat(y) : memo.y }; - }; - return _helpers__WEBPACK_IMPORTED_MODULE_18__.default.reduceChildren(childComponents.slice(0), iteratee, {}, { - x: [], - y: [] - }, combine); + }); }, getCategoryAndAxisStringsFromChildren: function(props, axis, childComponents) { var categories = lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_0___default()(props.categories) ? props.categories[axis] : props.categories, axisComponent = _axis__WEBPACK_IMPORTED_MODULE_11__.default.getAxisComponent(childComponents, axis), axisStrings = axisComponent ? _data__WEBPACK_IMPORTED_MODULE_14__.default.getStringsFromAxes(axisComponent.props, axis) : [], categoryStrings = categories || this.getStringsFromCategories(childComponents, axis); @@ -26919,11 +26904,6 @@ }, getAxisType = function(props) { var typicalType = props.dependentAxis ? "radial" : "angular"; return props.horizontal ? "angular" === typicalType ? "radial" : "angular" : typicalType; - }, filterTicks = function(ticks, scale) { - var compareTicks = function(t) { - return scale(t) % (2 * Math.PI); - }; - return lodash_uniqBy__WEBPACK_IMPORTED_MODULE_1___default()(ticks, compareTicks); }, getEvaluatedStyles = function(style, props) { return { tickStyle: victory_core__WEBPACK_IMPORTED_MODULE_3__.Helpers.evaluateStyle(style.ticks, props), @@ -27099,7 +27079,9 @@ }, getCalculatedValues = function(props) { var defaultStyles = getStyleObject(props = lodash_assign__WEBPACK_IMPORTED_MODULE_2___default()({ polar: !0 - }, props)), style = getStyles(props, defaultStyles), padding = victory_core__WEBPACK_IMPORTED_MODULE_3__.Helpers.getPadding(props), axis = victory_core__WEBPACK_IMPORTED_MODULE_3__.Axis.getAxis(props), axisType = getAxisType(props), stringTicks = victory_core__WEBPACK_IMPORTED_MODULE_3__.Axis.stringTicks(props) ? props.tickValues : void 0, domain = victory_core__WEBPACK_IMPORTED_MODULE_3__.Axis.getDomain(props, axis), range = getRange(props, axis), scale = getScale(props), initialTicks = victory_core__WEBPACK_IMPORTED_MODULE_3__.Axis.getTicks(props, scale), ticks = "angular" === axisType ? filterTicks(initialTicks, scale) : initialTicks, tickFormat = victory_core__WEBPACK_IMPORTED_MODULE_3__.Axis.getTickFormat(props, scale); + }, props)), style = getStyles(props, defaultStyles), padding = victory_core__WEBPACK_IMPORTED_MODULE_3__.Helpers.getPadding(props), axis = victory_core__WEBPACK_IMPORTED_MODULE_3__.Axis.getAxis(props), axisType = getAxisType(props), stringTicks = victory_core__WEBPACK_IMPORTED_MODULE_3__.Axis.stringTicks(props) ? props.tickValues : void 0, domain = victory_core__WEBPACK_IMPORTED_MODULE_3__.Axis.getDomain(props, axis), range = getRange(props, axis), scale = getScale(props), initialTicks = victory_core__WEBPACK_IMPORTED_MODULE_3__.Axis.getTicks(props, scale), ticks = "angular" === axisType ? lodash_uniqBy__WEBPACK_IMPORTED_MODULE_1___default()(initialTicks, function(t) { + return scale(t) % (2 * Math.PI); + }) : initialTicks, tickFormat = victory_core__WEBPACK_IMPORTED_MODULE_3__.Axis.getTickFormat(props, scale); return { axis: axis, style: style, @@ -27780,7 +27762,8 @@ var getData = function(childProps) { var data = victory_core__WEBPACK_IMPORTED_MODULE_5__.Data.getData(childProps); return Array.isArray(data) && data.length > 0 ? data : void 0; - }, iteratee = function(child, childName, parent) { + }; + return victory_core__WEBPACK_IMPORTED_MODULE_5__.Helpers.reduceChildren(react__WEBPACK_IMPORTED_MODULE_6___default.a.Children.toArray(props.children), function(child, childName, parent) { var blacklist = props.selectionBlacklist || []; if (!victory_core__WEBPACK_IMPORTED_MODULE_5__.Data.isDataComponent(child) || lodash_includes__WEBPACK_IMPORTED_MODULE_0___default()(blacklist, childName)) return null; if (child.type && lodash_isFunction__WEBPACK_IMPORTED_MODULE_1___default()(child.type.getData)) { @@ -27795,8 +27778,7 @@ childName: childName, data: _childData } : null; - }; - return victory_core__WEBPACK_IMPORTED_MODULE_5__.Helpers.reduceChildren(react__WEBPACK_IMPORTED_MODULE_6___default.a.Children.toArray(props.children), iteratee, props); + }, props); }, filterDatasets: function(props, datasets, bounds) { var _this = this, filtered = datasets.reduce(function(memo, dataset) { @@ -28293,7 +28275,7 @@ { key: "getBasePropsFromChildren", value: function(childComponents) { - var iteratee = function(child, childName) { + var baseProps = victory_core__WEBPACK_IMPORTED_MODULE_9__.Helpers.reduceChildren(childComponents, function(child, childName) { if (!(child.type && lodash_isFunction__WEBPACK_IMPORTED_MODULE_5___default()(child.type.getBaseProps))) return null; var _baseProps = child.props && child.type.getBaseProps(child.props); return _baseProps ? [ @@ -28302,7 +28284,7 @@ _baseProps ] ] : null; - }, baseProps = victory_core__WEBPACK_IMPORTED_MODULE_9__.Helpers.reduceChildren(childComponents, iteratee); + }); return lodash_fromPairs__WEBPACK_IMPORTED_MODULE_2___default()(baseProps); } }, @@ -29826,15 +29808,15 @@ var getData = function(childProps) { var data = victory_core__WEBPACK_IMPORTED_MODULE_7__.Data.getData(childProps); return Array.isArray(data) && data.length > 0 ? data : void 0; - }, iteratee = function(child, childName) { + }; + return victory_core__WEBPACK_IMPORTED_MODULE_7__.Helpers.reduceChildren(children, function(child, childName) { var name = (child.props || {}).name || childName, blacklist = props.voronoiBlacklist || [], blacklistStr = blacklist.filter(lodash_isString__WEBPACK_IMPORTED_MODULE_1___default.a), isRegExpMatch = blacklist.filter(lodash_isRegExp__WEBPACK_IMPORTED_MODULE_0___default.a).some(function(regExp) { return regExp.test(name); }); if (!victory_core__WEBPACK_IMPORTED_MODULE_7__.Data.isDataComponent(child) || lodash_includes__WEBPACK_IMPORTED_MODULE_2___default()(blacklistStr, name) || isRegExpMatch) return null; var childData = (child.type && lodash_isFunction__WEBPACK_IMPORTED_MODULE_4___default()(child.type.getData) ? child.type.getData : getData)(child.props); return childData ? addMeta(childData, name, child) : null; - }; - return victory_core__WEBPACK_IMPORTED_MODULE_7__.Helpers.reduceChildren(children, iteratee, props); + }, props); }, findPoints: function(datasets, point) { return datasets.filter(function(d) { @@ -30644,11 +30626,9 @@ }, handleAnimation: function(ctx) { var animationTimer = ctx.context.animationTimer, transitionTimer = ctx.context.transitionTimer; - transitionTimer.bypassAnimation(), animationTimer.bypassAnimation(); - var resumeAnimation = function() { + return transitionTimer.bypassAnimation(), animationTimer.bypassAnimation(), lodash_delay__WEBPACK_IMPORTED_MODULE_0___default()(function() { animationTimer.resumeAnimation(), transitionTimer.resumeAnimation(); - }; - return lodash_delay__WEBPACK_IMPORTED_MODULE_0___default()(resumeAnimation, 16); + }, 16); }, getLastDomain: function(targetProps, originalDomain) { var zoomDomain = targetProps.zoomDomain, cachedZoomDomain = targetProps.cachedZoomDomain, currentDomain = targetProps.currentDomain, domain = targetProps.domain; diff --git a/crates/swc_ecma_minifier/tests/benches-full/vue.js b/crates/swc_ecma_minifier/tests/benches-full/vue.js index e74c80ff852f..9a78b840d071 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/vue.js +++ b/crates/swc_ecma_minifier/tests/benches-full/vue.js @@ -1623,9 +1623,7 @@ var namespaceMap = { svg: 'http://www.w3.org/2000/svg', math: 'http://www.w3.org/1998/Math/MathML' - }, isHTMLTag = makeMap("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot"), isSVG = makeMap("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view", !0), isPreTag = function(tag) { - return 'pre' === tag; - }, isReservedTag = function(tag) { + }, isHTMLTag = makeMap("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot"), isSVG = makeMap("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view", !0), isReservedTag = function(tag) { return isHTMLTag(tag) || isSVG(tag); }; function getTagNamespace(tag) { @@ -2951,7 +2949,9 @@ dir.value && addProp(el, 'innerHTML', "_s(" + dir.value + ")", dir); } }, - isPreTag: isPreTag, + isPreTag: function(tag) { + return 'pre' === tag; + }, isUnaryTag: isUnaryTag, mustUseProp: mustUseProp, canBeLeftOpenTag: canBeLeftOpenTag, diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js index fa8263e0ab7b..a23ffaf6fe4f 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js @@ -67,7 +67,8 @@ alignItems: "center", margin: "100px 0", color: "#ed3131" - }, ErrorBoundaryFallback = function(param) { + }; + exports.default = function(param) { var componentStack = param.componentStack, error = param.error; return _jsxRuntime.jsxs("div", { style: style, @@ -99,7 +100,6 @@ ] }); }; - exports.default = ErrorBoundaryFallback; }, 11179: function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; @@ -162,22 +162,22 @@ Object.defineProperty(exports, "__esModule", { value: !0 }), exports.default = void 0; - var swcHelpers = __webpack_require__(547), _runtime = swcHelpers.interopRequireDefault(__webpack_require__(66902)), _runtime1 = swcHelpers.interopRequireDefault(__webpack_require__(2526)), _runtime2 = swcHelpers.interopRequireDefault(__webpack_require__(8900)), _default = function(runtime) { + var swcHelpers = __webpack_require__(547), _runtime = swcHelpers.interopRequireDefault(__webpack_require__(66902)), _runtime1 = swcHelpers.interopRequireDefault(__webpack_require__(2526)), _runtime2 = swcHelpers.interopRequireDefault(__webpack_require__(8900)); + exports.default = function(runtime) { runtime.loadModule(_runtime.default), runtime.loadModule(_runtime1.default), runtime.loadModule(_runtime2.default); }; - exports.default = _default; }, 98565: function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.default = void 0; - var _runtime = __webpack_require__(547).interopRequireDefault(__webpack_require__(53380)), _default = function(appConfig) { + var _runtime = __webpack_require__(547).interopRequireDefault(__webpack_require__(53380)); + exports.default = function(appConfig) { _runtime.default({ appConfig: appConfig }); }; - exports.default = _default; }, 8000: function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; @@ -217,30 +217,17 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: !0 - }), exports.default = void 0; - var module = function(param) { + }), exports.default = void 0, exports.default = function(param) { var addProvider = param.addProvider, appConfig = param.appConfig; appConfig.app && appConfig.app.addProvider && addProvider(appConfig.app.addProvider); }; - exports.default = module; }, 45440: function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.Provider = exports.withAuth = exports.useAuth = void 0; - var swcHelpers = __webpack_require__(547), _jsxRuntime = __webpack_require__(37712), _react = __webpack_require__(59301), Context = _react.createContext(null), Provider = function(param) { - var _value = param.value, children = param.children, ref = _react.useState(void 0 === _value ? {} : _value), state = ref[0], setState = ref[1], updateState = function(param) { - setState(swcHelpers.objectSpread({}, state, void 0 === param ? {} : param)); - }; - return _jsxRuntime.jsx(Context.Provider, { - value: [ - state, - updateState - ], - children: children - }); - }, useAuth = function() { + var swcHelpers = __webpack_require__(547), _jsxRuntime = __webpack_require__(37712), _react = __webpack_require__(59301), Context = _react.createContext(null), useAuth = function() { return _react.useContext(Context); }; exports.useAuth = useAuth, exports.withAuth = function(Component) { @@ -251,14 +238,26 @@ setAuth: setAuth })); }; - }, exports.Provider = Provider; + }, exports.Provider = function(param) { + var _value = param.value, children = param.children, ref = _react.useState(void 0 === _value ? {} : _value), state = ref[0], setState = ref[1]; + return _jsxRuntime.jsx(Context.Provider, { + value: [ + state, + function(param) { + setState(swcHelpers.objectSpread({}, state, void 0 === param ? {} : param)); + } + ], + children: children + }); + }; }, 8900: function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.default = void 0; - var swcHelpers = __webpack_require__(547), _jsxRuntime = __webpack_require__(37712), _auth = __webpack_require__(45440), _default = function(param) { + var swcHelpers = __webpack_require__(547), _jsxRuntime = __webpack_require__(37712), _auth = __webpack_require__(45440); + exports.default = function(param) { var context = param.context, appConfig = param.appConfig, addProvider = param.addProvider, wrapperPageComponent = param.wrapperPageComponent, initialAuth = (context && context.initialData ? context.initialData : {}).auth || {}, authConfig = appConfig.auth || {}; addProvider(function(param) { var children = param.children; @@ -267,7 +266,8 @@ children: children }); }), wrapperPageComponent(function(PageComponent) { - var _pageConfig = PageComponent.pageConfig, pageConfig = void 0 === _pageConfig ? {} : _pageConfig, AuthWrappedComponent = function(props) { + var _pageConfig = PageComponent.pageConfig, pageConfig = void 0 === _pageConfig ? {} : _pageConfig; + return _auth.withAuth(function(props) { var auth = props.auth, rest = (props.setAuth, swcHelpers.objectWithoutProperties(props, [ "auth", "setAuth" @@ -276,11 +276,9 @@ return Array.isArray(pageConfigAuth) && pageConfigAuth.length && !Object.keys(auth).filter(function(item) { return !!pageConfigAuth.includes(item) && auth[item]; }).length ? authConfig.NoAuthFallback ? "function" == typeof authConfig.NoAuthFallback ? _jsxRuntime.jsx(authConfig.NoAuthFallback, {}) : authConfig.NoAuthFallback : null : _jsxRuntime.jsx(PageComponent, swcHelpers.objectSpread({}, rest)); - }; - return _auth.withAuth(AuthWrappedComponent); + }); }); }; - exports.default = _default; }, 1481: function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; @@ -289,30 +287,21 @@ }), exports.default = void 0; var _runtime = __webpack_require__(56128), DEFAULE_CONFIG = {}, axiosInstance = { default: _runtime.axios.create(DEFAULE_CONFIG) - }, _default = function(instanceName) { + }; + exports.default = function(instanceName) { if (instanceName) { if (axiosInstance[instanceName]) return axiosInstance; axiosInstance[instanceName] = _runtime.axios.create(DEFAULE_CONFIG); } return axiosInstance; }; - exports.default = _default; }, 53380: function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.default = void 0; - var swcHelpers = __webpack_require__(547), _createAxiosInstance = swcHelpers.interopRequireDefault(__webpack_require__(1481)), module = function(param) { - var appConfig = param.appConfig; - if (appConfig.request) { - var tmp = appConfig.request, requestConfig = void 0 === tmp ? {} : tmp; - "[object Array]" === Object.prototype.toString.call(requestConfig) ? requestConfig.forEach(function(requestItem) { - var instanceName = requestItem.instanceName ? requestItem.instanceName : "default"; - instanceName && setAxiosInstance(requestItem, _createAxiosInstance.default(instanceName)[instanceName]); - }) : setAxiosInstance(requestConfig, _createAxiosInstance.default().default); - } - }; + var swcHelpers = __webpack_require__(547), _createAxiosInstance = swcHelpers.interopRequireDefault(__webpack_require__(1481)); function setAxiosInstance(requestConfig, axiosInstance) { var _interceptors = requestConfig.interceptors, interceptors = void 0 === _interceptors ? {} : _interceptors, requestOptions = swcHelpers.objectWithoutProperties(requestConfig, [ "interceptors" @@ -329,7 +318,16 @@ return Promise.reject(error); }); } - exports.default = module; + exports.default = function(param) { + var appConfig = param.appConfig; + if (appConfig.request) { + var tmp = appConfig.request, requestConfig = void 0 === tmp ? {} : tmp; + "[object Array]" === Object.prototype.toString.call(requestConfig) ? requestConfig.forEach(function(requestItem) { + var instanceName = requestItem.instanceName ? requestItem.instanceName : "default"; + instanceName && setAxiosInstance(requestItem, _createAxiosInstance.default(instanceName)[instanceName]); + }) : setAxiosInstance(requestConfig, _createAxiosInstance.default().default); + } + }; }, 2526: function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; @@ -337,7 +335,8 @@ Object.defineProperty(exports, "__esModule", { value: !0 }), exports.default = void 0; - var swcHelpers = __webpack_require__(547), _jsxRuntime = __webpack_require__(37712), _errorBoundary = swcHelpers.interopRequireDefault(__webpack_require__(11179)), _routes = swcHelpers.interopRequireDefault(__webpack_require__(72791)), _router = __webpack_require__(37447), _formatRoutes = swcHelpers.interopRequireWildcard(__webpack_require__(14710)), module = function(param) { + var swcHelpers = __webpack_require__(547), _jsxRuntime = __webpack_require__(37712), _errorBoundary = swcHelpers.interopRequireDefault(__webpack_require__(11179)), _routes = swcHelpers.interopRequireDefault(__webpack_require__(72791)), _router = __webpack_require__(37447), _formatRoutes = swcHelpers.interopRequireWildcard(__webpack_require__(14710)); + exports.default = function(param) { var setRenderApp = param.setRenderApp, appConfig = param.appConfig, modifyRoutes = param.modifyRoutes, wrapperPageComponent = param.wrapperPageComponent, modifyRoutesComponent = param.modifyRoutesComponent, buildConfig = param.buildConfig, context = param.context, applyRuntimeAPI = param.applyRuntimeAPI, tmp = appConfig.router, appConfigRouter = void 0 === tmp ? {} : tmp, _app = appConfig.app, app = void 0 === _app ? {} : _app, ErrorBoundaryFallback = app.ErrorBoundaryFallback, onErrorBoundaryHandler = app.onErrorBoundaryHandler, _parseSearchParams = app.parseSearchParams, parseSearchParams = void 0 === _parseSearchParams || _parseSearchParams; wrapperPageComponent(function(PageComponent) { return function(props) { @@ -350,8 +349,7 @@ return _formatRoutes.default(appConfigRouter.routes || _routes.default, ""); }), modifyRoutesComponent(function() { return _router.Routes; - }); - var wrapperPageErrorBoundary = function(PageComponent) { + }), wrapperPageComponent(process.env.__IS_SERVER__ ? _formatRoutes.wrapperPageWithSSR(context) : _formatRoutes.wrapperPageWithCSR()), wrapperPageComponent(function(PageComponent) { var _pageConfig = PageComponent.pageConfig, pageConfig = void 0 === _pageConfig ? {} : _pageConfig; return function(props) { return pageConfig.errorBoundary ? _jsxRuntime.jsx(_errorBoundary.default, { @@ -360,8 +358,7 @@ children: _jsxRuntime.jsx(PageComponent, swcHelpers.objectSpread({}, props)) }) : _jsxRuntime.jsx(PageComponent, swcHelpers.objectSpread({}, props)); }; - }; - wrapperPageComponent(process.env.__IS_SERVER__ ? _formatRoutes.wrapperPageWithSSR(context) : _formatRoutes.wrapperPageWithCSR()), wrapperPageComponent(wrapperPageErrorBoundary), appConfigRouter.modifyRoutes && modifyRoutes(appConfigRouter.modifyRoutes); + }), appConfigRouter.modifyRoutes && modifyRoutes(appConfigRouter.modifyRoutes); var lazy = buildConfig && buildConfig.router && buildConfig.router.lazy; setRenderApp(function(routes, RoutesComponent, param) { var customRouterProps = void 0 === param ? {} : param; @@ -391,7 +388,6 @@ }; }); }; - exports.default = module; }, 37447: function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; @@ -572,8 +568,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: !0 - }), exports.default = void 0; - var _default = function() { + }), exports.default = void 0, exports.default = function() { for(var _len = arguments.length, strArray = Array(_len), _key = 0; _key < _len; _key++)strArray[_key] = arguments[_key]; if (0 === strArray.length) return ""; var resultArray = [], filterStrArray = strArray.filter(function(str) { @@ -585,14 +580,14 @@ index > 0 && (routePath = routePath.replace(/^[/]+/, "")), routePath = index < filterStrArray.length - 1 ? routePath.replace(/[/]+$/, "") : routePath.replace(/[/]+$/, "/"), resultArray.push(routePath); }), resultArray.join("/"); }; - exports.default = _default; }, 56905: function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.default = void 0; - var swcHelpers = __webpack_require__(547), _jsxRuntime = __webpack_require__(37712), _indexModuleScss = swcHelpers.interopRequireDefault(__webpack_require__(89704)), Guide = function() { + var swcHelpers = __webpack_require__(547), _jsxRuntime = __webpack_require__(37712), _indexModuleScss = swcHelpers.interopRequireDefault(__webpack_require__(89704)); + exports.default = function() { return _jsxRuntime.jsxs("div", { className: _indexModuleScss.default.container, children: [ @@ -627,17 +622,16 @@ ] }); }; - exports.default = Guide; }, 43361: function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.default = void 0; - var swcHelpers = __webpack_require__(547), _jsxRuntime = __webpack_require__(37712), _guide = swcHelpers.interopRequireDefault(__webpack_require__(56905)), Home = function() { + var swcHelpers = __webpack_require__(547), _jsxRuntime = __webpack_require__(37712), _guide = swcHelpers.interopRequireDefault(__webpack_require__(56905)); + exports.default = function() { return console.log(1), _jsxRuntime.jsx(_guide.default, {}); }; - exports.default = Home; }, 72791: function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; @@ -2668,46 +2662,10 @@ }, BigIntArrayConstructorsList = { BigInt64Array: 8, BigUint64Array: 8 - }, isView = function(it) { - if (!isObject(it)) return !1; - var klass = classof(it); - return "DataView" === klass || has(TypedArrayConstructorsList, klass) || has(BigIntArrayConstructorsList, klass); }, isTypedArray = function(it) { if (!isObject(it)) return !1; var klass = classof(it); return has(TypedArrayConstructorsList, klass) || has(BigIntArrayConstructorsList, klass); - }, aTypedArray = function(it) { - if (isTypedArray(it)) return it; - throw TypeError("Target is not a typed array"); - }, aTypedArrayConstructor = function(C) { - if (isCallable(C) && (!setPrototypeOf || isPrototypeOf.call(TypedArray, C))) return C; - throw TypeError(tryToString(C) + " is not a typed array constructor"); - }, exportTypedArrayMethod = function(KEY, property, forced) { - if (DESCRIPTORS) { - if (forced) for(var ARRAY in TypedArrayConstructorsList){ - var TypedArrayConstructor = global[ARRAY]; - if (TypedArrayConstructor && has(TypedArrayConstructor.prototype, KEY)) try { - delete TypedArrayConstructor.prototype[KEY]; - } catch (error) {} - } - (!TypedArrayPrototype[KEY] || forced) && redefine(TypedArrayPrototype, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property); - } - }, exportTypedArrayStaticMethod = function(KEY, property, forced) { - var ARRAY, TypedArrayConstructor; - if (DESCRIPTORS) { - if (setPrototypeOf) { - if (forced) { - for(ARRAY in TypedArrayConstructorsList)if ((TypedArrayConstructor = global[ARRAY]) && has(TypedArrayConstructor, KEY)) try { - delete TypedArrayConstructor[KEY]; - } catch (error) {} - } - if (TypedArray[KEY] && !forced) return; - try { - return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property); - } catch (error1) {} - } - for(ARRAY in TypedArrayConstructorsList)(TypedArrayConstructor = global[ARRAY]) && (!TypedArrayConstructor[KEY] || forced) && redefine(TypedArrayConstructor, KEY, property); - } }; for(NAME in TypedArrayConstructorsList)(Prototype = (Constructor = global[NAME]) && Constructor.prototype) ? createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR, Constructor) : NATIVE_ARRAY_BUFFER_VIEWS = !1; for(NAME in BigIntArrayConstructorsList)(Prototype = (Constructor = global[NAME]) && Constructor.prototype) && createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR, Constructor); @@ -2724,11 +2682,47 @@ NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS, TYPED_ARRAY_CONSTRUCTOR: TYPED_ARRAY_CONSTRUCTOR, TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG, - aTypedArray: aTypedArray, - aTypedArrayConstructor: aTypedArrayConstructor, - exportTypedArrayMethod: exportTypedArrayMethod, - exportTypedArrayStaticMethod: exportTypedArrayStaticMethod, - isView: isView, + aTypedArray: function(it) { + if (isTypedArray(it)) return it; + throw TypeError("Target is not a typed array"); + }, + aTypedArrayConstructor: function(C) { + if (isCallable(C) && (!setPrototypeOf || isPrototypeOf.call(TypedArray, C))) return C; + throw TypeError(tryToString(C) + " is not a typed array constructor"); + }, + exportTypedArrayMethod: function(KEY, property, forced) { + if (DESCRIPTORS) { + if (forced) for(var ARRAY in TypedArrayConstructorsList){ + var TypedArrayConstructor = global[ARRAY]; + if (TypedArrayConstructor && has(TypedArrayConstructor.prototype, KEY)) try { + delete TypedArrayConstructor.prototype[KEY]; + } catch (error) {} + } + (!TypedArrayPrototype[KEY] || forced) && redefine(TypedArrayPrototype, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property); + } + }, + exportTypedArrayStaticMethod: function(KEY, property, forced) { + var ARRAY, TypedArrayConstructor; + if (DESCRIPTORS) { + if (setPrototypeOf) { + if (forced) { + for(ARRAY in TypedArrayConstructorsList)if ((TypedArrayConstructor = global[ARRAY]) && has(TypedArrayConstructor, KEY)) try { + delete TypedArrayConstructor[KEY]; + } catch (error) {} + } + if (TypedArray[KEY] && !forced) return; + try { + return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property); + } catch (error1) {} + } + for(ARRAY in TypedArrayConstructorsList)(TypedArrayConstructor = global[ARRAY]) && (!TypedArrayConstructor[KEY] || forced) && redefine(TypedArrayConstructor, KEY, property); + } + }, + isView: function(it) { + if (!isObject(it)) return !1; + var klass = classof(it); + return "DataView" === klass || has(TypedArrayConstructorsList, klass) || has(BigIntArrayConstructorsList, klass); + }, isTypedArray: isTypedArray, TypedArray: TypedArray, TypedArrayPrototype: TypedArrayPrototype @@ -3834,25 +3828,25 @@ }); }, 43571: function(module) { - var abs = Math.abs, pow = Math.pow, floor = Math.floor, log = Math.log, LN2 = Math.LN2, pack = function(number, mantissaLength, bytes) { - var exponent, mantissa, c, buffer = Array(bytes), exponentLength = 8 * bytes - mantissaLength - 1, eMax = (1 << exponentLength) - 1, eBias = eMax >> 1, rt = 23 === mantissaLength ? pow(2, -24) - pow(2, -77) : 0, sign = number < 0 || 0 === number && 1 / number < 0 ? 1 : 0, index = 0; - for((number = abs(number)) != number || number === 1 / 0 ? (mantissa = number != number ? 1 : 0, exponent = eMax) : (exponent = floor(log(number) / LN2), number * (c = pow(2, -exponent)) < 1 && (exponent--, c *= 2), exponent + eBias >= 1 ? number += rt / c : number += rt * pow(2, 1 - eBias), number * c >= 2 && (exponent++, c /= 2), exponent + eBias >= eMax ? (mantissa = 0, exponent = eMax) : exponent + eBias >= 1 ? (mantissa = (number * c - 1) * pow(2, mantissaLength), exponent += eBias) : (mantissa = number * pow(2, eBias - 1) * pow(2, mantissaLength), exponent = 0)); mantissaLength >= 8; buffer[index++] = 255 & mantissa, mantissa /= 256, mantissaLength -= 8); - for(exponent = exponent << mantissaLength | mantissa, exponentLength += mantissaLength; exponentLength > 0; buffer[index++] = 255 & exponent, exponent /= 256, exponentLength -= 8); - return buffer[--index] |= 128 * sign, buffer; - }, unpack = function(buffer, mantissaLength) { - var mantissa, bytes = buffer.length, exponentLength = 8 * bytes - mantissaLength - 1, eMax = (1 << exponentLength) - 1, eBias = eMax >> 1, nBits = exponentLength - 7, index = bytes - 1, sign = buffer[index--], exponent = 127 & sign; - for(sign >>= 7; nBits > 0; exponent = 256 * exponent + buffer[index], index--, nBits -= 8); - for(mantissa = exponent & (1 << -nBits) - 1, exponent >>= -nBits, nBits += mantissaLength; nBits > 0; mantissa = 256 * mantissa + buffer[index], index--, nBits -= 8); - if (0 === exponent) exponent = 1 - eBias; - else { - if (exponent === eMax) return mantissa ? NaN : sign ? -1 / 0 : 1 / 0; - mantissa += pow(2, mantissaLength), exponent -= eBias; - } - return (sign ? -1 : 1) * mantissa * pow(2, exponent - mantissaLength); - }; + var abs = Math.abs, pow = Math.pow, floor = Math.floor, log = Math.log, LN2 = Math.LN2; module.exports = { - pack: pack, - unpack: unpack + pack: function(number, mantissaLength, bytes) { + var exponent, mantissa, c, buffer = Array(bytes), exponentLength = 8 * bytes - mantissaLength - 1, eMax = (1 << exponentLength) - 1, eBias = eMax >> 1, rt = 23 === mantissaLength ? pow(2, -24) - pow(2, -77) : 0, sign = number < 0 || 0 === number && 1 / number < 0 ? 1 : 0, index = 0; + for((number = abs(number)) != number || number === 1 / 0 ? (mantissa = number != number ? 1 : 0, exponent = eMax) : (exponent = floor(log(number) / LN2), number * (c = pow(2, -exponent)) < 1 && (exponent--, c *= 2), exponent + eBias >= 1 ? number += rt / c : number += rt * pow(2, 1 - eBias), number * c >= 2 && (exponent++, c /= 2), exponent + eBias >= eMax ? (mantissa = 0, exponent = eMax) : exponent + eBias >= 1 ? (mantissa = (number * c - 1) * pow(2, mantissaLength), exponent += eBias) : (mantissa = number * pow(2, eBias - 1) * pow(2, mantissaLength), exponent = 0)); mantissaLength >= 8; buffer[index++] = 255 & mantissa, mantissa /= 256, mantissaLength -= 8); + for(exponent = exponent << mantissaLength | mantissa, exponentLength += mantissaLength; exponentLength > 0; buffer[index++] = 255 & exponent, exponent /= 256, exponentLength -= 8); + return buffer[--index] |= 128 * sign, buffer; + }, + unpack: function(buffer, mantissaLength) { + var mantissa, bytes = buffer.length, exponentLength = 8 * bytes - mantissaLength - 1, eMax = (1 << exponentLength) - 1, eBias = eMax >> 1, nBits = exponentLength - 7, index = bytes - 1, sign = buffer[index--], exponent = 127 & sign; + for(sign >>= 7; nBits > 0; exponent = 256 * exponent + buffer[index], index--, nBits -= 8); + for(mantissa = exponent & (1 << -nBits) - 1, exponent >>= -nBits, nBits += mantissaLength; nBits > 0; mantissa = 256 * mantissa + buffer[index], index--, nBits -= 8); + if (0 === exponent) exponent = 1 - eBias; + else { + if (exponent === eMax) return mantissa ? NaN : sign ? -1 / 0 : 1 / 0; + mantissa += pow(2, mantissaLength), exponent -= eBias; + } + return (sign ? -1 : 1) * mantissa * pow(2, exponent - mantissaLength); + } }; }, 51478: function(module, __unused_webpack_exports, __webpack_require__) { @@ -3886,57 +3880,49 @@ weakData: {} } }); - }, fastKey = function(it, create) { - if (!isObject(it)) return "symbol" == typeof it ? it : ("string" == typeof it ? "S" : "P") + it; - if (!has(it, METADATA)) { - if (!isExtensible(it)) return "F"; - if (!create) return "E"; - setMetadata(it); - } - return it[METADATA].objectID; - }, getWeakData = function(it, create) { - if (!has(it, METADATA)) { - if (!isExtensible(it)) return !0; - if (!create) return !1; - setMetadata(it); - } - return it[METADATA].weakData; - }, onFreeze = function(it) { - return FREEZING && REQUIRED && isExtensible(it) && !has(it, METADATA) && setMetadata(it), it; - }, enable = function() { - meta.enable = function() {}, REQUIRED = !0; - var getOwnPropertyNames = getOwnPropertyNamesModule.f, splice = [].splice, test = {}; - test[METADATA] = 1, getOwnPropertyNames(test).length && (getOwnPropertyNamesModule.f = function(it) { - for(var result = getOwnPropertyNames(it), i = 0, length = result.length; i < length; i++)if (result[i] === METADATA) { - splice.call(result, i, 1); - break; - } - return result; - }, $({ - target: "Object", - stat: !0, - forced: !0 - }, { - getOwnPropertyNames: getOwnPropertyNamesExternalModule.f - })); }, meta = module.exports = { - enable: enable, - fastKey: fastKey, - getWeakData: getWeakData, - onFreeze: onFreeze + enable: function() { + meta.enable = function() {}, REQUIRED = !0; + var getOwnPropertyNames = getOwnPropertyNamesModule.f, splice = [].splice, test = {}; + test[METADATA] = 1, getOwnPropertyNames(test).length && (getOwnPropertyNamesModule.f = function(it) { + for(var result = getOwnPropertyNames(it), i = 0, length = result.length; i < length; i++)if (result[i] === METADATA) { + splice.call(result, i, 1); + break; + } + return result; + }, $({ + target: "Object", + stat: !0, + forced: !0 + }, { + getOwnPropertyNames: getOwnPropertyNamesExternalModule.f + })); + }, + fastKey: function(it, create) { + if (!isObject(it)) return "symbol" == typeof it ? it : ("string" == typeof it ? "S" : "P") + it; + if (!has(it, METADATA)) { + if (!isExtensible(it)) return "F"; + if (!create) return "E"; + setMetadata(it); + } + return it[METADATA].objectID; + }, + getWeakData: function(it, create) { + if (!has(it, METADATA)) { + if (!isExtensible(it)) return !0; + if (!create) return !1; + setMetadata(it); + } + return it[METADATA].weakData; + }, + onFreeze: function(it) { + return FREEZING && REQUIRED && isExtensible(it) && !has(it, METADATA) && setMetadata(it), it; + } }; hiddenKeys[METADATA] = !0; }, 44670: function(module, __unused_webpack_exports, __webpack_require__) { - var set, get, has, NATIVE_WEAK_MAP = __webpack_require__(83165), global = __webpack_require__(19514), isObject = __webpack_require__(39817), createNonEnumerableProperty = __webpack_require__(48181), objectHas = __webpack_require__(1521), shared = __webpack_require__(88986), sharedKey = __webpack_require__(16735), hiddenKeys = __webpack_require__(38276), OBJECT_ALREADY_INITIALIZED = "Object already initialized", WeakMap1 = global.WeakMap, enforce = function(it) { - return has(it) ? get(it) : set(it, {}); - }, getterFor = function(TYPE) { - return function(it) { - var state; - if (!isObject(it) || (state = get(it)).type !== TYPE) throw TypeError("Incompatible receiver, " + TYPE + " required"); - return state; - }; - }; + var set, get, has, NATIVE_WEAK_MAP = __webpack_require__(83165), global = __webpack_require__(19514), isObject = __webpack_require__(39817), createNonEnumerableProperty = __webpack_require__(48181), objectHas = __webpack_require__(1521), shared = __webpack_require__(88986), sharedKey = __webpack_require__(16735), hiddenKeys = __webpack_require__(38276), OBJECT_ALREADY_INITIALIZED = "Object already initialized", WeakMap1 = global.WeakMap; if (NATIVE_WEAK_MAP || shared.state) { var store = shared.state || (shared.state = new WeakMap1()), wmget = store.get, wmhas = store.has, wmset = store.set; set = function(it, metadata) { @@ -3962,8 +3948,16 @@ set: set, get: get, has: has, - enforce: enforce, - getterFor: getterFor + enforce: function(it) { + return has(it) ? get(it) : set(it, {}); + }, + getterFor: function(TYPE) { + return function(it) { + var state; + if (!isObject(it) || (state = get(it)).type !== TYPE) throw TypeError("Incompatible receiver, " + TYPE + " required"); + return state; + }; + } }; }, 58011: function(module, __unused_webpack_exports, __webpack_require__) { @@ -3991,7 +3985,13 @@ } catch (error) { return !1; } - }, isConstructorLegacy = function(argument) { + }; + module.exports = !construct || fails(function() { + var called; + return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function() { + called = !0; + }) || called; + }) ? function(argument) { if (!isCallable(argument)) return !1; switch(classof(argument)){ case "AsyncFunction": @@ -4000,13 +4000,7 @@ return !1; } return INCORRECT_TO_STRING || !!exec.call(constructorRegExp, inspectSource(argument)); - }; - module.exports = !construct || fails(function() { - var called; - return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function() { - called = !0; - }) || called; - }) ? isConstructorLegacy : isConstructorModern; + } : isConstructorModern; }, 69518: function(module, __unused_webpack_exports, __webpack_require__) { var has = __webpack_require__(1521); @@ -7734,8 +7728,6 @@ return $forEach(keys, function(key) { (!DESCRIPTORS || $propertyIsEnumerable.call(properties, key)) && $defineProperty(O, key, properties[key]); }), O; - }, $create = function(O, Properties) { - return void 0 === Properties ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties); }, $propertyIsEnumerable = function(V) { var P = toPropertyKey(V), enumerable = nativePropertyIsEnumerable.call(this, P); return (!(this === ObjectPrototype && has(AllSymbols, P)) || !!has(ObjectPrototypeSymbols, P)) && (!(enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P]) || enumerable); @@ -7814,7 +7806,9 @@ forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, { - create: $create, + create: function(O, Properties) { + return void 0 === Properties ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties); + }, defineProperty: $defineProperty, defineProperties: $defineProperties, getOwnPropertyDescriptor: $getOwnPropertyDescriptor diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/1/output.js index 2207a5d02aac..ae10cb639e8d 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/1/output.js @@ -10,7 +10,7 @@ return Global; } }); - var fn, cache, func, cursor, react = __webpack_require__(7294), StyleSheet = function() { + var cache, func, cursor, react = __webpack_require__(7294), StyleSheet = function() { function StyleSheet(options) { var _this = this; this._insertTag = function(tag) { @@ -320,26 +320,23 @@ copy(replace(element.value, "@", "@" + WEBKIT), element, "") ], callback); case Enum_RULESET: - if (element.length) { - var array, callback1; - return array = element.props, callback1 = function(value) { - var value1; - switch(value1 = value, (value1 = /(::plac\w+|:read-\w+)/.exec(value1)) ? value1[0] : value1){ - case ":read-only": - case ":read-write": - return serialize([ - copy(replace(value, /:(read-\w+)/, ":" + MOZ + "$1"), element, "") - ], callback); - case "::placeholder": - return serialize([ - copy(replace(value, /:(plac\w+)/, ":" + WEBKIT + "input-$1"), element, ""), - copy(replace(value, /:(plac\w+)/, ":" + MOZ + "$1"), element, ""), - copy(replace(value, /:(plac\w+)/, MS + "input-$1"), element, "") - ], callback); - } - return ""; - }, array.map(callback1).join(""); - } + if (element.length) return element.props.map(function(value) { + var value1; + switch(value1 = value, (value1 = /(::plac\w+|:read-\w+)/.exec(value1)) ? value1[0] : value1){ + case ":read-only": + case ":read-write": + return serialize([ + copy(replace(value, /:(read-\w+)/, ":" + MOZ + "$1"), element, "") + ], callback); + case "::placeholder": + return serialize([ + copy(replace(value, /:(plac\w+)/, ":" + WEBKIT + "input-$1"), element, ""), + copy(replace(value, /:(plac\w+)/, ":" + MOZ + "$1"), element, ""), + copy(replace(value, /:(plac\w+)/, MS + "input-$1"), element, "") + ], callback); + } + return ""; + }).join(""); } } ], hash_browser_esm = function(str) { @@ -403,10 +400,8 @@ return 45 === property.charCodeAt(1); }, isProcessableValue = function(value) { return null != value && "boolean" != typeof value; - }, processStyleName = (fn = function(styleName) { - return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, "-$&").toLowerCase(); - }, cache = Object.create(null), function(arg) { - return void 0 === cache[arg] && (cache[arg] = fn(arg)), cache[arg]; + }, processStyleName = (cache = Object.create(null), function(arg) { + return void 0 === cache[arg] && (cache[arg] = isCustomProperty(arg) ? arg : arg.replace(hyphenateRegex, "-$&").toLowerCase()), cache[arg]; }), processStyleValue = function(key, value) { switch(key){ case "animation": @@ -490,7 +485,7 @@ }; Object.prototype.hasOwnProperty; var EmotionCacheContext = (0, react.createContext)("undefined" != typeof HTMLElement ? function(options) { - var collection, length, callback, container, _insert, currentSheet, key = options.key; + var collection, length, callback, container, currentSheet, key = options.key; if ("css" === key) { var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); Array.prototype.forEach.call(ssrStyles, function(node) { @@ -617,11 +612,7 @@ ], value = alloc(value = styles), 0, [ 0 ], value), characters = "", value1), serializer); - }; - _insert = function(selector, serialized, sheet, shouldCache) { - currentSheet = sheet, stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles), shouldCache && (cache.inserted[serialized.name] = !0); - }; - var cache = { + }, cache = { key: key, sheet: new StyleSheet({ key: key, @@ -633,7 +624,9 @@ nonce: options.nonce, inserted: inserted, registered: {}, - insert: _insert + insert: function(selector, serialized, sheet, shouldCache) { + currentSheet = sheet, stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles), shouldCache && (cache.inserted[serialized.name] = !0); + } }; return cache.sheet.hydrate(nodesToHydrate), cache; }({ @@ -785,7 +778,7 @@ prefetched[href + "%" + as + (curLocale ? "%" + curLocale : "")] = !0; } } - var _default = function(props) { + exports.default = function(props) { var child, p = !1 !== props.prefetch, router = _router1.useRouter(), ref2 = _react.default.useMemo(function() { var ref = _slicedToArray(_router.resolveHref(router, props.href, !0), 2), resolvedHref = ref[0], resolvedAs = ref[1]; return { @@ -840,7 +833,6 @@ } return _react.default.cloneElement(child, childProps); }; - exports.default = _default; }, 7190: function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; @@ -866,10 +858,8 @@ }(arr, 2) || function() { throw TypeError("Invalid attempt to destructure non-iterable instance"); }(), visible = ref[0], setVisible = ref[1], setRef = _react.useCallback(function(el) { - var callback, ref, id, observer, elements; - unobserve.current && (unobserve.current(), unobserve.current = void 0), !isDisabled && !visible && el && el.tagName && (unobserve.current = (callback = function(isVisible) { - return isVisible && setVisible(isVisible); - }, id = (ref = function(options) { + var ref, id, observer, elements; + unobserve.current && (unobserve.current(), unobserve.current = void 0), !isDisabled && !visible && el && el.tagName && (unobserve.current = (id = (ref = function(options) { var id = options.rootMargin || "", instance = observers.get(id); if (instance) return instance; var elements = new Map(), observer = new IntersectionObserver(function(entries) { @@ -885,7 +875,9 @@ }), instance; }({ rootMargin: rootMargin - })).id, observer = ref.observer, (elements = ref.elements).set(el, callback), observer.observe(el), function() { + })).id, observer = ref.observer, (elements = ref.elements).set(el, function(isVisible) { + return isVisible && setVisible(isVisible); + }), observer.observe(el), function() { elements.delete(el), observer.unobserve(el), 0 === elements.size && (observer.disconnect(), observers.delete(id)); })); }, [ diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js index adaefbc1846f..289ca0671d5e 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js @@ -1519,8 +1519,8 @@ this.g.setRequestHeader(h, f); }, this), this.J && (this.g.responseType = this.J), "withCredentials" in this.g && this.g.withCredentials !== this.L && (this.g.withCredentials = this.L); try { - var a1, a2, b1; - Ad(this), 0 < this.B && ((this.K = (a1 = this.g, y && (a2 = function() { + var a1, b1; + Ad(this), 0 < this.B && ((this.K = (a1 = this.g, y && (b1 = Ga, Object.prototype.hasOwnProperty.call(b1, 9) ? b1[9] : b1[9] = function() { let a = 0; const b = ta(String(Na)).split("."), c = ta("9").split("."), d = Math.max(b.length, c.length); for(let h = 0; 0 == a && h < d; h++){ @@ -1541,7 +1541,7 @@ }while (0 == a) } return 0 <= a; - }, b1 = Ga, Object.prototype.hasOwnProperty.call(b1, 9) ? b1[9] : b1[9] = a2(9)) && "number" == typeof a1.timeout && void 0 !== a1.ontimeout)) ? (this.g.timeout = this.B, this.g.ontimeout = q(this.pa, this)) : this.A = Gb(this.pa, this.B, this)), this.v = !0, this.g.send(a), this.v = !1; + }(9)) && "number" == typeof a1.timeout && void 0 !== a1.ontimeout)) ? (this.g.timeout = this.B, this.g.ontimeout = q(this.pa, this)) : this.A = Gb(this.pa, this.B, this)), this.v = !0, this.g.send(a), this.v = !1; } catch (f1) { zd(this, f1); } @@ -2089,10 +2089,8 @@ }(arr, 2) || function() { throw TypeError("Invalid attempt to destructure non-iterable instance"); }(), visible = ref[0], setVisible = ref[1], setRef = _react.useCallback(function(el) { - var callback, ref, id, observer, elements; - unobserve.current && (unobserve.current(), unobserve.current = void 0), !isDisabled && !visible && el && el.tagName && (unobserve.current = (callback = function(isVisible) { - return isVisible && setVisible(isVisible); - }, id = (ref = function(options) { + var ref, id, observer, elements; + unobserve.current && (unobserve.current(), unobserve.current = void 0), !isDisabled && !visible && el && el.tagName && (unobserve.current = (id = (ref = function(options) { var id = options.rootMargin || "", instance = observers.get(id); if (instance) return instance; var elements = new Map(), observer = new IntersectionObserver(function(entries) { @@ -2108,7 +2106,9 @@ }), instance; }({ rootMargin: rootMargin - })).id, observer = ref.observer, (elements = ref.elements).set(el, callback), observer.observe(el), function() { + })).id, observer = ref.observer, (elements = ref.elements).set(el, function(isVisible) { + return isVisible && setVisible(isVisible); + }), observer.observe(el), function() { elements.delete(el), observer.unobserve(el), 0 === elements.size && (observer.disconnect(), observers.delete(id)); })); }, [ diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/output.js index d68b1f6dfc2c..e073acc00204 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/output.js @@ -850,9 +850,7 @@ for(i = 1, res = moments[0]; i < moments.length; ++i)(!moments[i].isValid() || moments[i][fn](res)) && (res = moments[i]); return res; } - var now = function() { - return Date.now ? Date.now() : +new Date(); - }, ordering = [ + var ordering = [ "year", "quarter", "month", @@ -1703,8 +1701,8 @@ } function toISOString$1() { if (!this.isValid()) return this.localeData().invalidDate(); - var minutes, hours, years, s, totalSign, ymSign, daysSign, hmsSign, seconds = abs$1(this._milliseconds) / 1000, days = abs$1(this._days), months = abs$1(this._months), total = this.asSeconds(); - return total ? (minutes = absFloor(seconds / 60), hours = absFloor(minutes / 60), seconds %= 60, minutes %= 60, years = absFloor(months / 12), months %= 12, s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, "") : "", totalSign = total < 0 ? "-" : "", ymSign = sign(this._months) !== sign(total) ? "-" : "", daysSign = sign(this._days) !== sign(total) ? "-" : "", hmsSign = sign(this._milliseconds) !== sign(total) ? "-" : "", totalSign + "P" + (years ? ymSign + years + "Y" : "") + (months ? ymSign + months + "M" : "") + (days ? daysSign + days + "D" : "") + (hours || minutes || seconds ? "T" : "") + (hours ? hmsSign + hours + "H" : "") + (minutes ? hmsSign + minutes + "M" : "") + (seconds ? hmsSign + s + "S" : "")) : "P0D"; + var minutes, hours, years, s, ymSign, daysSign, hmsSign, seconds = abs$1(this._milliseconds) / 1000, days = abs$1(this._days), months = abs$1(this._months), total = this.asSeconds(); + return total ? (minutes = absFloor(seconds / 60), hours = absFloor(minutes / 60), seconds %= 60, minutes %= 60, years = absFloor(months / 12), months %= 12, s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, "") : "", ymSign = sign(this._months) !== sign(total) ? "-" : "", daysSign = sign(this._days) !== sign(total) ? "-" : "", hmsSign = sign(this._milliseconds) !== sign(total) ? "-" : "", (total < 0 ? "-" : "") + "P" + (years ? ymSign + years + "Y" : "") + (months ? ymSign + months + "M" : "") + (days ? daysSign + days + "D" : "") + (hours || minutes || seconds ? "T" : "") + (hours ? hmsSign + hours + "H" : "") + (minutes ? hmsSign + minutes + "M" : "") + (seconds ? hmsSign + s + "S" : "")) : "P0D"; } var proto$2 = Duration.prototype; return proto$2.isValid = function() { @@ -1804,7 +1802,9 @@ }, hooks.max = function() { var args = [].slice.call(arguments, 0); return pickBy("isAfter", args); - }, hooks.now = now, hooks.utc = createUTC, hooks.unix = function(input) { + }, hooks.now = function() { + return Date.now ? Date.now() : +new Date(); + }, hooks.utc = createUTC, hooks.unix = function(input) { return createLocal(1000 * input); }, hooks.months = function(format, index) { return listMonthsImpl(format, index, "months"); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/react-countup/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/react-countup/1/output.js index bd51dc9a54ec..327d9927f784 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/react-countup/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/react-countup/1/output.js @@ -480,10 +480,8 @@ }(arr, 2) || function() { throw TypeError("Invalid attempt to destructure non-iterable instance"); }(), visible = ref[0], setVisible = ref[1], setRef = _react.useCallback(function(el) { - var callback, ref, id, observer, elements; - unobserve.current && (unobserve.current(), unobserve.current = void 0), !isDisabled && !visible && el && el.tagName && (unobserve.current = (callback = function(isVisible) { - return isVisible && setVisible(isVisible); - }, id = (ref = function(options) { + var ref, id, observer, elements; + unobserve.current && (unobserve.current(), unobserve.current = void 0), !isDisabled && !visible && el && el.tagName && (unobserve.current = (id = (ref = function(options) { var id = options.rootMargin || "", instance = observers.get(id); if (instance) return instance; var elements = new Map(), observer = new IntersectionObserver(function(entries) { @@ -499,7 +497,9 @@ }), instance; }({ rootMargin: rootMargin - })).id, observer = ref.observer, (elements = ref.elements).set(el, callback), observer.observe(el), function() { + })).id, observer = ref.observer, (elements = ref.elements).set(el, function(isVisible) { + return isVisible && setVisible(isVisible); + }), observer.observe(el), function() { elements.delete(el), observer.unobserve(el), 0 === elements.size && (observer.disconnect(), observers.delete(id)); })); }, [ @@ -764,7 +764,8 @@ "containerProps", "children", "style" - ], CountUp = function(props) { + ]; + exports.ZP = function(props) { var className = props.className, redraw = props.redraw, containerProps = props.containerProps, children = props.children, style = props.style, useCountUpProps = _objectWithoutProperties(props, _excluded), containerRef = React__default.default.useRef(null), isInitializedRef = React__default.default.useRef(!1), _useCountUp = useCountUp(_objectSpread2(_objectSpread2({}, useCountUpProps), {}, { ref: containerRef, startOnMount: "function" != typeof children || 0 === props.delay, @@ -824,7 +825,6 @@ style: style }, containerProps)); }; - exports.ZP = CountUp; } } ]); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/react-instancesearch/004/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/react-instancesearch/004/output.js index 03b0c2c9b4bf..d25508fdb95c 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/react-instancesearch/004/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/react-instancesearch/004/output.js @@ -24,13 +24,7 @@ var _obj, isMultiIndexContext = function(widget) { return isFirstWidgetIndex && !isSecondWidgetIndex ? -1 : !isFirstWidgetIndex && isSecondWidgetIndex ? 1 : 0; }; export default function createInstantSearchManager(param) { - var state, listeners, indexName = param.indexName, _initialState = param.initialState, searchClient = param.searchClient, resultsState = param.resultsState, stalledSearchDelay = param.stalledSearchDelay, skipSearch = function() { - skip = !0; - }, updateClient = function(client) { - addAlgoliaAgents(client), helper.setClient(client), search(); - }, clearCache = function() { - helper.clearCache(), search(); - }, getMetadata = function(state) { + var state, listeners, indexName = param.indexName, _initialState = param.initialState, searchClient = param.searchClient, resultsState = param.resultsState, stalledSearchDelay = param.stalledSearchDelay, getMetadata = function(state) { return widgetsManager.getWidgets().filter(function(widget) { return Boolean(widget.getMetadata); }).map(function(widget) { @@ -112,15 +106,6 @@ export default function createInstantSearchManager(param) { error: error, searching: !1 })); - }, handleNewSearch = function() { - stalledSearchTimer || (stalledSearchTimer = setTimeout(function() { - var _ref = store.getState(), partialState = (_ref.resultsFacetValues, swcHelpers.objectWithoutProperties(_ref, [ - "resultsFacetValues" - ])); - store.setState(swcHelpers.objectSpread({}, partialState, { - isSearchStalled: !0 - })); - }, stalledSearchDelay)); }, hydrateSearchClientWithMultiIndexRequest = function(client, results) { if (client.transporter) { client.transporter.responsesCache.set({ @@ -185,57 +170,26 @@ export default function createInstantSearchManager(param) { client.cache = swcHelpers.objectSpread({}, client.cache, swcHelpers.defineProperty({}, key, JSON.stringify({ results: results.rawResults }))); - }, onWidgetsUpdate = function() { + }, helper = algoliasearchHelper(searchClient, indexName, swcHelpers.objectSpread({}, HIGHLIGHT_TAGS)); + addAlgoliaAgents(searchClient), helper.on("search", function() { + stalledSearchTimer || (stalledSearchTimer = setTimeout(function() { + var _ref = store.getState(), partialState = (_ref.resultsFacetValues, swcHelpers.objectWithoutProperties(_ref, [ + "resultsFacetValues" + ])); + store.setState(swcHelpers.objectSpread({}, partialState, { + isSearchStalled: !0 + })); + }, stalledSearchDelay)); + }).on("result", handleSearchSuccess({ + indexId: indexName + })).on("error", handleSearchError); + var skip = !1, stalledSearchTimer = null, initialSearchParameters = helper.state, widgetsManager = createWidgetsManager(function() { var metadata = getMetadata(store.getState().widgets); store.setState(swcHelpers.objectSpread({}, store.getState(), { metadata: metadata, searching: !0 })), search(); - }, transitionState = function(nextSearchState) { - var searchState = store.getState().widgets; - return widgetsManager.getWidgets().filter(function(widget) { - return Boolean(widget.transitionState); - }).reduce(function(res, widget) { - return widget.transitionState(searchState, res); - }, nextSearchState); - }, onExternalStateUpdate = function(nextSearchState) { - var metadata = getMetadata(nextSearchState); - store.setState(swcHelpers.objectSpread({}, store.getState(), { - widgets: nextSearchState, - metadata: metadata, - searching: !0 - })), search(); - }, onSearchForFacetValues = function(param) { - var facetName = param.facetName, query = param.query, _maxFacetHits = param.maxFacetHits; - store.setState(swcHelpers.objectSpread({}, store.getState(), { - searchingForFacetValues: !0 - })), helper.searchForFacetValues(facetName, query, Math.max(1, Math.min(void 0 === _maxFacetHits ? 10 : _maxFacetHits, 100))).then(function(content) { - store.setState(swcHelpers.objectSpread({}, store.getState(), { - error: null, - searchingForFacetValues: !1, - resultsFacetValues: swcHelpers.objectSpread({}, store.getState().resultsFacetValues, (_obj = {}, swcHelpers.defineProperty(_obj, facetName, content.facetHits), swcHelpers.defineProperty(_obj, "query", query), _obj)) - })); - }, function(error) { - store.setState(swcHelpers.objectSpread({}, store.getState(), { - searchingForFacetValues: !1, - error: error - })); - }).catch(function(error) { - setTimeout(function() { - throw error; - }); - }); - }, updateIndex = function(newIndex) { - initialSearchParameters = initialSearchParameters.setIndex(newIndex); - }, getWidgetsIds = function() { - return store.getState().metadata.reduce(function(res, meta) { - return void 0 !== meta.id ? res.concat(meta.id) : res; - }, []); - }, helper = algoliasearchHelper(searchClient, indexName, swcHelpers.objectSpread({}, HIGHLIGHT_TAGS)); - addAlgoliaAgents(searchClient), helper.on("search", handleNewSearch).on("result", handleSearchSuccess({ - indexId: indexName - })).on("error", handleSearchError); - var skip = !1, stalledSearchTimer = null, initialSearchParameters = helper.state, widgetsManager = createWidgetsManager(onWidgetsUpdate); + }); !function(client, results) { if (results && (client.transporter && !client._cacheHydrated || client._useCache && "function" == typeof client.addAlgoliaAgent)) { if (client.transporter && !client._cacheHydrated) { @@ -327,14 +281,60 @@ export default function createInstantSearchManager(param) { return { store: store, widgetsManager: widgetsManager, - getWidgetsIds: getWidgetsIds, + getWidgetsIds: function() { + return store.getState().metadata.reduce(function(res, meta) { + return void 0 !== meta.id ? res.concat(meta.id) : res; + }, []); + }, getSearchParameters: getSearchParameters, - onSearchForFacetValues: onSearchForFacetValues, - onExternalStateUpdate: onExternalStateUpdate, - transitionState: transitionState, - updateClient: updateClient, - updateIndex: updateIndex, - clearCache: clearCache, - skipSearch: skipSearch + onSearchForFacetValues: function(param) { + var facetName = param.facetName, query = param.query, _maxFacetHits = param.maxFacetHits; + store.setState(swcHelpers.objectSpread({}, store.getState(), { + searchingForFacetValues: !0 + })), helper.searchForFacetValues(facetName, query, Math.max(1, Math.min(void 0 === _maxFacetHits ? 10 : _maxFacetHits, 100))).then(function(content) { + store.setState(swcHelpers.objectSpread({}, store.getState(), { + error: null, + searchingForFacetValues: !1, + resultsFacetValues: swcHelpers.objectSpread({}, store.getState().resultsFacetValues, (_obj = {}, swcHelpers.defineProperty(_obj, facetName, content.facetHits), swcHelpers.defineProperty(_obj, "query", query), _obj)) + })); + }, function(error) { + store.setState(swcHelpers.objectSpread({}, store.getState(), { + searchingForFacetValues: !1, + error: error + })); + }).catch(function(error) { + setTimeout(function() { + throw error; + }); + }); + }, + onExternalStateUpdate: function(nextSearchState) { + var metadata = getMetadata(nextSearchState); + store.setState(swcHelpers.objectSpread({}, store.getState(), { + widgets: nextSearchState, + metadata: metadata, + searching: !0 + })), search(); + }, + transitionState: function(nextSearchState) { + var searchState = store.getState().widgets; + return widgetsManager.getWidgets().filter(function(widget) { + return Boolean(widget.transitionState); + }).reduce(function(res, widget) { + return widget.transitionState(searchState, res); + }, nextSearchState); + }, + updateClient: function(client) { + addAlgoliaAgents(client), helper.setClient(client), search(); + }, + updateIndex: function(newIndex) { + initialSearchParameters = initialSearchParameters.setIndex(newIndex); + }, + clearCache: function() { + helper.clearCache(), search(); + }, + skipSearch: function() { + skip = !0; + } }; } diff --git a/crates/swc_ecma_minifier/tests/fixture/next/31084/xml2js/parser/output.js b/crates/swc_ecma_minifier/tests/fixture/next/31084/xml2js/parser/output.js index 6d1854573911..aeeaa4c7d787 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/31084/xml2js/parser/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/31084/xml2js/parser/output.js @@ -1,6 +1,6 @@ (function() { "use strict"; - var bom, defaults, events, isEmpty, processItem, processors, sax, setImmediate, bind = function(fn, me) { + var bom, defaults, events, processItem, processors, sax, setImmediate, bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; @@ -11,9 +11,7 @@ } return ctor.prototype = parent.prototype, child.prototype = new ctor(), child.__super__ = parent.prototype, child; }, hasProp = {}.hasOwnProperty; - sax = require("sax"), events = require("events"), bom = require("./bom"), processors = require("./processors"), setImmediate = require("timers").setImmediate, defaults = require("./defaults").defaults, isEmpty = function(thing) { - return "object" == typeof thing && null != thing && 0 === Object.keys(thing).length; - }, processItem = function(processors, item, key) { + sax = require("sax"), events = require("events"), bom = require("./bom"), processors = require("./processors"), setImmediate = require("timers").setImmediate, defaults = require("./defaults").defaults, processItem = function(processors, item, key) { var i, len; for(i = 0, len = processors.length; i < len; i++)item = (0, processors[i])(item, key); return item; @@ -57,8 +55,8 @@ local: node.local }), stack.push(obj); }), this.saxParser.onclosetag = (_this3 = this, function() { - var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath; - if (nodeName = (obj = stack.pop())["#name"], _this3.options.explicitChildren && _this3.options.preserveChildrenOrder || delete obj["#name"], !0 === obj.cdata && (cdata = obj.cdata, delete obj.cdata), s = stack[stack.length - 1], obj[charkey].match(/^\s*$/) && !cdata ? (emptyStr = obj[charkey], delete obj[charkey]) : (_this3.options.trim && (obj[charkey] = obj[charkey].trim()), _this3.options.normalize && (obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim()), obj[charkey] = _this3.options.valueProcessors ? processItem(_this3.options.valueProcessors, obj[charkey], nodeName) : obj[charkey], 1 === Object.keys(obj).length && charkey in obj && !_this3.EXPLICIT_CHARKEY && (obj = obj[charkey])), isEmpty(obj) && (obj = "" !== _this3.options.emptyTag ? _this3.options.emptyTag : emptyStr), null != _this3.options.validator && (xpath = "/" + (function() { + var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath, thing; + if (nodeName = (obj = stack.pop())["#name"], _this3.options.explicitChildren && _this3.options.preserveChildrenOrder || delete obj["#name"], !0 === obj.cdata && (cdata = obj.cdata, delete obj.cdata), s = stack[stack.length - 1], obj[charkey].match(/^\s*$/) && !cdata ? (emptyStr = obj[charkey], delete obj[charkey]) : (_this3.options.trim && (obj[charkey] = obj[charkey].trim()), _this3.options.normalize && (obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim()), obj[charkey] = _this3.options.valueProcessors ? processItem(_this3.options.valueProcessors, obj[charkey], nodeName) : obj[charkey], 1 === Object.keys(obj).length && charkey in obj && !_this3.EXPLICIT_CHARKEY && (obj = obj[charkey])), "object" == typeof (thing = obj) && null != thing && 0 === Object.keys(thing).length && (obj = "" !== _this3.options.emptyTag ? _this3.options.emptyTag : emptyStr), null != _this3.options.validator && (xpath = "/" + (function() { var i, len, results; for(i = 0, results = [], len = stack.length; i < len; i++)node = stack[i], results.push(node["#name"]); return results; diff --git a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js index 209738287271..7ad555e435c5 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js @@ -7,17 +7,9 @@ 5215: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { for(var match, match1, result, version, browserApi, videojs$1, FakeWeakMap, _supportsPassive, EVENT_MAP, canPlayType, Vhs$1, global_window__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8908), global_window__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_0__), global_document__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9144), global_document__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(global_document__WEBPACK_IMPORTED_MODULE_1__), _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(7462), _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(7326), _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(4578), safe_json_parse_tuple__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5974), safe_json_parse_tuple__WEBPACK_IMPORTED_MODULE_2___default = __webpack_require__.n(safe_json_parse_tuple__WEBPACK_IMPORTED_MODULE_2__), keycode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7537), keycode__WEBPACK_IMPORTED_MODULE_3___default = __webpack_require__.n(keycode__WEBPACK_IMPORTED_MODULE_3__), _videojs_xhr__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9603), _videojs_xhr__WEBPACK_IMPORTED_MODULE_4___default = __webpack_require__.n(_videojs_xhr__WEBPACK_IMPORTED_MODULE_4__), videojs_vtt_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3407), videojs_vtt_js__WEBPACK_IMPORTED_MODULE_5___default = __webpack_require__.n(videojs_vtt_js__WEBPACK_IMPORTED_MODULE_5__), _babel_runtime_helpers_construct__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(8852), _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(136), _videojs_vhs_utils_es_resolve_url_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(779), m3u8_parser__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(9323), _videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(2260), _videojs_vhs_utils_es_media_types_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(8485), mpd_parser__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(973), mux_js_lib_tools_parse_sidx__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(4221), mux_js_lib_tools_parse_sidx__WEBPACK_IMPORTED_MODULE_10___default = __webpack_require__.n(mux_js_lib_tools_parse_sidx__WEBPACK_IMPORTED_MODULE_10__), _videojs_vhs_utils_es_id3_helpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(8925), _videojs_vhs_utils_es_containers__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(6185), _videojs_vhs_utils_es_byte_helpers__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(562), mux_js_lib_utils_clock__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(1489), version$5 = "7.17.0", hooks_ = {}, hooks = function(type, fn) { return hooks_[type] = hooks_[type] || [], fn && (hooks_[type] = hooks_[type].concat(fn)), hooks_[type]; - }, hook = function(type, fn) { - hooks(type, fn); }, removeHook = function(type, fn) { var index = hooks(type).indexOf(fn); return !(index <= -1) && (hooks_[type] = hooks_[type].slice(), hooks_[type].splice(index, 1), !0); - }, hookOnce = function(type, fn) { - hooks(type, [].concat(fn).map(function(original) { - return function wrapper() { - return removeHook(type, wrapper), original.apply(void 0, arguments); - }; - })); }, FullscreenApi = { prefixed: !0 }, apiMap = [ @@ -571,15 +563,15 @@ }; }, debounce = function(func, wait, immediate, context) { void 0 === context && (context = global_window__WEBPACK_IMPORTED_MODULE_0___default()); - var timeout, cancel = function() { - context.clearTimeout(timeout), timeout = null; - }, debounced = function() { + var timeout, debounced = function() { var self1 = this, args = arguments, _later = function() { timeout = null, _later = null, immediate || func.apply(self1, args); }; !timeout && immediate && func.apply(self1, args), context.clearTimeout(timeout), timeout = context.setTimeout(_later, wait); }; - return debounced.cancel = cancel, debounced; + return debounced.cancel = function() { + context.clearTimeout(timeout), timeout = null; + }, debounced; }, EventTarget$2 = function() {}; EventTarget$2.prototype.allowedEvents_ = {}, EventTarget$2.prototype.on = function(type, fn) { var ael = this.addEventListener; @@ -870,14 +862,7 @@ }, _proto.initChildren = function() { var _this = this, children = this.options_.children; if (children) { - var workingChildren, parentOptions = this.options_, handleAdd = function(child) { - var name = child.name, opts = child.opts; - if (void 0 !== parentOptions[name] && (opts = parentOptions[name]), !1 !== opts) { - !0 === opts && (opts = {}), opts.playerOptions = _this.options_.playerOptions; - var newChild = _this.addChild(name, opts); - newChild && (_this[name] = newChild); - } - }, Tech = Component.getComponent("Tech"); + var workingChildren, parentOptions = this.options_, Tech = Component.getComponent("Tech"); (workingChildren = Array.isArray(children) ? children : Object.keys(children)).concat(Object.keys(this.options_).filter(function(child) { return !workingChildren.some(function(wchild) { return "string" == typeof wchild ? child === wchild : child === wchild.name; @@ -891,7 +876,14 @@ }).filter(function(child) { var c = Component.getComponent(child.opts.componentClass || toTitleCase$1(child.name)); return c && !Tech.isTech(c); - }).forEach(handleAdd); + }).forEach(function(child) { + var name = child.name, opts = child.opts; + if (void 0 !== parentOptions[name] && (opts = parentOptions[name]), !1 !== opts) { + !0 === opts && (opts = {}), opts.playerOptions = _this.options_.playerOptions; + var newChild = _this.addChild(name, opts); + newChild && (_this[name] = newChild); + } + }); } }, _proto.buildCSSClass = function() { return ""; @@ -1599,10 +1591,10 @@ ("metadata" === settings.kind || "chapters" === settings.kind) && (mode = "hidden"), (_this = _Track.call(this, settings) || this).tech_ = settings.tech, _this.cues_ = [], _this.activeCues_ = [], _this.preload_ = !1 !== _this.tech_.preloadTextTracks; var cues = new TextTrackCueList(_this.cues_), activeCues = new TextTrackCueList(_this.activeCues_), changed = !1, timeupdateHandler = bind((0, _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_17__.Z)(_this), function() { !(!this.tech_.isReady_ || this.tech_.isDisposed()) && (this.activeCues = this.activeCues, changed && (this.trigger("cuechange"), changed = !1)); - }), disposeHandler = function() { + }); + return _this.tech_.one("dispose", function() { _this.tech_.off("timeupdate", timeupdateHandler); - }; - return _this.tech_.one("dispose", disposeHandler), "disabled" !== mode && _this.tech_.on("timeupdate", timeupdateHandler), Object.defineProperties((0, _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_17__.Z)(_this), { + }), "disabled" !== mode && _this.tech_.on("timeupdate", timeupdateHandler), Object.defineProperties((0, _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_17__.Z)(_this), { default: { get: function() { return default_; @@ -4802,13 +4794,9 @@ } }, _proto.duration = function() { var _this5 = this; - if (this.el_.duration === 1 / 0 && IS_ANDROID && IS_CHROME && 0 === this.el_.currentTime) { - var checkProgress = function checkProgress() { - _this5.el_.currentTime > 0 && (_this5.el_.duration === 1 / 0 && _this5.trigger("durationchange"), _this5.off("timeupdate", checkProgress)); - }; - return this.on("timeupdate", checkProgress), NaN; - } - return this.el_.duration || NaN; + return this.el_.duration === 1 / 0 && IS_ANDROID && IS_CHROME && 0 === this.el_.currentTime ? (this.on("timeupdate", function checkProgress() { + _this5.el_.currentTime > 0 && (_this5.el_.duration === 1 / 0 && _this5.trigger("durationchange"), _this5.off("timeupdate", checkProgress)); + }), NaN) : this.el_.duration || NaN; }, _proto.width = function() { return this.el_.offsetWidth; }, _proto.height = function() { @@ -5478,10 +5466,10 @@ }, _proto.handleTechWaiting_ = function() { var _this8 = this; this.addClass("vjs-waiting"), this.trigger("waiting"); - var timeWhenWaiting = this.currentTime(), timeUpdateListener = function timeUpdateListener() { + var timeWhenWaiting = this.currentTime(); + this.on("timeupdate", function timeUpdateListener() { timeWhenWaiting !== _this8.currentTime() && (_this8.removeClass("vjs-waiting"), _this8.off("timeupdate", timeUpdateListener)); - }; - this.on("timeupdate", timeUpdateListener); + }); }, _proto.handleTechCanPlay_ = function() { this.removeClass("vjs-waiting"), this.trigger("canplay"); }, _proto.handleTechCanPlayThrough_ = function() { @@ -6009,14 +5997,14 @@ }), this.userActivity_ = !1, this.removeClass("vjs-user-active"), this.addClass("vjs-user-inactive"), this.trigger("userinactive"); } }, _proto.listenForUserActivity_ = function() { - var mouseInProgress, lastMoveX, lastMoveY, inactivityTimeout, handleActivity = bind(this, this.reportUserActivity), handleMouseMove = function(e) { - (e.screenX !== lastMoveX || e.screenY !== lastMoveY) && (lastMoveX = e.screenX, lastMoveY = e.screenY, handleActivity()); - }, handleMouseDown = function() { - handleActivity(), this.clearInterval(mouseInProgress), mouseInProgress = this.setInterval(handleActivity, 250); - }, handleMouseUpAndMouseLeave = function(event) { + var mouseInProgress, lastMoveX, lastMoveY, inactivityTimeout, handleActivity = bind(this, this.reportUserActivity), handleMouseUpAndMouseLeave = function(event) { handleActivity(), this.clearInterval(mouseInProgress); }; - this.on("mousedown", handleMouseDown), this.on("mousemove", handleMouseMove), this.on("mouseup", handleMouseUpAndMouseLeave), this.on("mouseleave", handleMouseUpAndMouseLeave); + this.on("mousedown", function() { + handleActivity(), this.clearInterval(mouseInProgress), mouseInProgress = this.setInterval(handleActivity, 250); + }), this.on("mousemove", function(e) { + (e.screenX !== lastMoveX || e.screenY !== lastMoveY) && (lastMoveX = e.screenX, lastMoveY = e.screenY, handleActivity()); + }), this.on("mouseup", handleMouseUpAndMouseLeave), this.on("mouseleave", handleMouseUpAndMouseLeave); var controlBar = this.getChild("controlBar"); !controlBar || IS_IOS || IS_ANDROID || (controlBar.on("mouseenter", function(event) { 0 !== this.player().options_.inactivityTimeout && (this.player().cache_.inactivityTimeout = this.player().options_.inactivityTimeout), this.player().options_.inactivityTimeout = 0; @@ -6296,14 +6284,7 @@ }, Player.prototype.hasPlugin = function(name) { return !!pluginExists(name); }; - var extend = function(superClass, subClassMethods) { - void 0 === subClassMethods && (subClassMethods = {}); - var subClass = function() { - superClass.apply(this, arguments); - }, methods = {}; - for(var name in "object" == typeof subClassMethods ? (subClassMethods.constructor !== Object.prototype.constructor && (subClass = subClassMethods.constructor), methods = subClassMethods) : "function" == typeof subClassMethods && (subClass = subClassMethods), (0, _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_19__.Z)(subClass, superClass), superClass && (subClass.super_ = superClass), methods)methods.hasOwnProperty(name) && (subClass.prototype[name] = methods[name]); - return subClass; - }, normalizeId = function(id) { + var normalizeId = function(id) { return 0 === id.indexOf("#") ? id.slice(1) : id; }; function videojs(id, options, ready) { @@ -6322,7 +6303,15 @@ return hookFunction(player); }), player; } - if (videojs.hooks_ = hooks_, videojs.hooks = hooks, videojs.hook = hook, videojs.hookOnce = hookOnce, videojs.removeHook = removeHook, !0 !== global_window__WEBPACK_IMPORTED_MODULE_0___default().VIDEOJS_NO_DYNAMIC_STYLE && isReal()) { + if (videojs.hooks_ = hooks_, videojs.hooks = hooks, videojs.hook = function(type, fn) { + hooks(type, fn); + }, videojs.hookOnce = function(type, fn) { + hooks(type, [].concat(fn).map(function(original) { + return function wrapper() { + return removeHook(type, wrapper), original.apply(void 0, arguments); + }; + })); + }, videojs.removeHook = removeHook, !0 !== global_window__WEBPACK_IMPORTED_MODULE_0___default().VIDEOJS_NO_DYNAMIC_STYLE && isReal()) { var style = $(".vjs-styles-defaults"); if (!style) { style = createStyleElement("vjs-styles-defaults"); @@ -6359,7 +6348,14 @@ value: TERMINATOR, writeable: !1, enumerable: !0 - }), videojs.browser = browser, videojs.TOUCH_ENABLED = TOUCH_ENABLED, videojs.extend = extend, videojs.mergeOptions = mergeOptions$3, videojs.bind = bind, videojs.registerPlugin = Plugin.registerPlugin, videojs.deregisterPlugin = Plugin.deregisterPlugin, videojs.plugin = function(name, plugin) { + }), videojs.browser = browser, videojs.TOUCH_ENABLED = TOUCH_ENABLED, videojs.extend = function(superClass, subClassMethods) { + void 0 === subClassMethods && (subClassMethods = {}); + var subClass = function() { + superClass.apply(this, arguments); + }, methods = {}; + for(var name in "object" == typeof subClassMethods ? (subClassMethods.constructor !== Object.prototype.constructor && (subClass = subClassMethods.constructor), methods = subClassMethods) : "function" == typeof subClassMethods && (subClass = subClassMethods), (0, _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_19__.Z)(subClass, superClass), superClass && (subClass.super_ = superClass), methods)methods.hasOwnProperty(name) && (subClass.prototype[name] = methods[name]); + return subClass; + }, videojs.mergeOptions = mergeOptions$3, videojs.bind = bind, videojs.registerPlugin = Plugin.registerPlugin, videojs.deregisterPlugin = Plugin.deregisterPlugin, videojs.plugin = function(name, plugin) { return log$1.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"), Plugin.registerPlugin(name, plugin); }, videojs.getPlugins = Plugin.getPlugins, videojs.getPlugin = Plugin.getPlugin, videojs.getPluginVersion = Plugin.getPluginVersion, videojs.addLanguage = function(code, data) { var _mergeOptions; @@ -6600,8 +6596,6 @@ return !playlist.disabled && !blacklisted; }, hasAttribute = function(attr, playlist) { return playlist.attributes && playlist.attributes[attr]; - }, estimateSegmentRequestTime = function(segmentDuration, bandwidth, playlist, bytesReceived) { - return (void 0 === bytesReceived && (bytesReceived = 0), hasAttribute("BANDWIDTH", playlist)) ? (segmentDuration * playlist.attributes.BANDWIDTH - 8 * bytesReceived) / bandwidth : NaN; }, isLowestEnabledRendition = function(master, media) { if (1 === master.playlists.length) return !0; var currentBandwidth = media.attributes.BANDWIDTH || Number.MAX_VALUE; @@ -6715,7 +6709,9 @@ return !1; }, hasAttribute: hasAttribute, - estimateSegmentRequestTime: estimateSegmentRequestTime, + estimateSegmentRequestTime: function(segmentDuration, bandwidth, playlist, bytesReceived) { + return (void 0 === bytesReceived && (bytesReceived = 0), hasAttribute("BANDWIDTH", playlist)) ? (segmentDuration * playlist.attributes.BANDWIDTH - 8 * bytesReceived) / bandwidth : NaN; + }, isLowestEnabledRendition: isLowestEnabledRendition, isAudioOnly: isAudioOnly, playlistMatch: playlistMatch, @@ -7140,15 +7136,15 @@ }, hexDump = function(data) { for(var bytes = Array.prototype.slice.call(data), result = "", j = 0; j < bytes.length / 16; j++)result += bytes.slice(16 * j, 16 * j + 16).map(formatHexString).join("") + " " + bytes.slice(16 * j, 16 * j + 16).map(formatAsciiString).join("") + "\n"; return result; - }, tagDump = function(_ref) { - return hexDump(_ref.bytes); }, utils = Object.freeze({ __proto__: null, createTransferableMessage: createTransferableMessage, initSegmentId: initSegmentId, segmentKeyId: segmentKeyId, hexDump: hexDump, - tagDump: tagDump, + tagDump: function(_ref) { + return hexDump(_ref.bytes); + }, textRanges: function(ranges) { var i, i1, result = ""; for(i1 = 0; i1 < ranges.length; i1++)result += (i = i1, ranges.start(i) + "-" + ranges.end(i) + " "); @@ -7246,10 +7242,10 @@ callback: callback }); })); - var seekToTime = segment.start + mediaOffset, seekedCallback = function() { + var seekToTime = segment.start + mediaOffset; + tech.one("seeked", function() { return callback(null, tech.currentTime()); - }; - tech.one("seeked", seekedCallback), pauseAfterSeek && tech.pause(), seekTo(seekToTime); + }), pauseAfterSeek && tech.pause(), seekTo(seekToTime); }, callbackOnCompleted = function(request, cb) { if (4 === request.readyState) return cb(); }, containerRequest = function(uri, xhr, cb) { @@ -7582,7 +7578,7 @@ }, getWorkerString = function(fn) { return fn.toString().replace(/^function.+?{/, "").slice(0, -1); }, TransmuxWorker = factory(transform(getWorkerString(function() { - var _TransportPacketStream, _TransportParseStream, _ElementaryStream, _AdtsStream, ExpGolomb, _H264Stream, _NalByteStream, PROFILES_WITH_OPTIONAL_SPS_DATA, _AacStream, _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream, timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader, Stream = function() { + var _TransportPacketStream, _TransportParseStream, _ElementaryStream, _AdtsStream, _H264Stream, _NalByteStream, PROFILES_WITH_OPTIONAL_SPS_DATA, _AacStream, _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream, getTimescaleFromMediaHeader, Stream = function() { this.init = function() { var listeners = {}; this.on = function(type, listener) { @@ -7841,8 +7837,6 @@ return result; }, ftyp = function() { return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND); - }, mdat = function(data) { - return box(types.mdat, data); }, mdhd = function(track) { var result = new Uint8Array([ 0x00, @@ -7874,25 +7868,8 @@ }, mdia = function(track) { var type; return box(types.mdia, mdhd(track), (type = track.type, box(types.hdlr, HDLR_TYPES[type])), minf(track)); - }, mfhd = function(sequenceNumber) { - return box(types.mfhd, new Uint8Array([ - 0x00, - 0x00, - 0x00, - 0x00, - (0xff000000 & sequenceNumber) >> 24, - (0xff0000 & sequenceNumber) >> 16, - (0xff00 & sequenceNumber) >> 8, - 0xff & sequenceNumber - ])); }, minf = function(track) { return box(types.minf, "video" === track.type ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), box(types.dinf, box(types.dref, DREF)), stbl(track)); - }, moof = function(sequenceNumber, tracks) { - for(var trackFragments = [], i = tracks.length; i--;)trackFragments[i] = traf(tracks[i]); - return box.apply(null, [ - types.moof, - mfhd(sequenceNumber) - ].concat(trackFragments)); }, moov = function(tracks) { for(var i = tracks.length, boxes = []; i--;)boxes[i] = trak(tracks[i]); return box.apply(null, [ @@ -8401,8 +8378,25 @@ }; var mp4Generator = { ftyp: ftyp, - mdat: mdat, - moof: moof, + mdat: function(data) { + return box(types.mdat, data); + }, + moof: function(sequenceNumber, tracks) { + for(var trackFragments = [], i = tracks.length; i--;)trackFragments[i] = traf(tracks[i]); + return box.apply(null, [ + types.moof, + box(types.mfhd, new Uint8Array([ + 0x00, + 0x00, + 0x00, + 0x00, + (0xff000000 & sequenceNumber) >> 24, + (0xff0000 & sequenceNumber) >> 16, + (0xff00 & sequenceNumber) >> 8, + 0xff & sequenceNumber + ])) + ].concat(trackFragments)); + }, moov: moov, initSegment: function(tracks) { var result, fileType = ftyp(), movie = moov(tracks); @@ -8709,31 +8703,29 @@ }, {}); } return silence; - }; - secondsToVideoTs = function(seconds) { - return 90000 * seconds; - }, secondsToAudioTs = function(seconds, sampleRate) { - return seconds * sampleRate; - }, videoTsToSeconds = function(timestamp) { - return timestamp / 90000; - }, audioTsToSeconds = function(timestamp, sampleRate) { - return timestamp / sampleRate; - }, audioTsToVideoTs = function(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); - }, videoTsToAudioTs = function(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); - }, metadataTsToSeconds = function(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); - }; - var clock = { + }, clock = { ONE_SECOND_IN_TS: 90000, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds + secondsToVideoTs: secondsToVideoTs = function(seconds) { + return 90000 * seconds; + }, + secondsToAudioTs: secondsToAudioTs = function(seconds, sampleRate) { + return seconds * sampleRate; + }, + videoTsToSeconds: videoTsToSeconds = function(timestamp) { + return timestamp / 90000; + }, + audioTsToSeconds: audioTsToSeconds = function(timestamp, sampleRate) { + return timestamp / sampleRate; + }, + audioTsToVideoTs: function(timestamp, sampleRate) { + return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); + }, + videoTsToAudioTs: function(timestamp, sampleRate) { + return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); + }, + metadataTsToSeconds: function(timestamp, timelineStartPts, keepOriginalTimestamps) { + return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); + } }, sumFrameByteLengths = function(array) { var i, sum = 0; for(i = 0; i < array.length; i++)sum += array[i].data.byteLength; @@ -9310,7 +9302,7 @@ }; }; TimestampRolloverStream$1.prototype = new Stream(); - var videoSample, audioSample, audioTrun, videoTrun, trunHeader, box, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS, silence, secondsToVideoTs, secondsToAudioTs, videoTsToSeconds, audioTsToSeconds, audioTsToVideoTs, videoTsToAudioTs, metadataTsToSeconds, _MetadataStream, timestampRolloverStream = { + var videoSample, audioSample, audioTrun, videoTrun, trunHeader, box, ftyp, minf, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS, silence, secondsToVideoTs, secondsToAudioTs, videoTsToSeconds, audioTsToSeconds, _MetadataStream, timestampRolloverStream = { TimestampRolloverStream: TimestampRolloverStream$1, handleRollover: handleRollover$1 }, percentEncode$1 = function(bytes, start, end) { @@ -9608,7 +9600,8 @@ }, this.endTimeline = function() { buffer = void 0, this.trigger("endedtimeline"); }; - }).prototype = new Stream(), ExpGolomb = function(workingData) { + }).prototype = new Stream(); + var expGolomb = function(workingData) { var workingBytesAvailable = workingData.byteLength, workingWord = 0, workingBitsAvailable = 0; this.length = function() { return 8 * workingBytesAvailable; @@ -9643,7 +9636,8 @@ }, this.readUnsignedByte = function() { return this.readBits(8); }, this.loadWord(); - }, (_NalByteStream = function() { + }; + (_NalByteStream = function() { var i, buffer, syncPoint = 0; _NalByteStream.prototype.init.call(this), this.push = function(data) { buffer ? ((swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength)).set(buffer), swapBuffer.set(data.data, buffer.byteLength), buffer = swapBuffer) : buffer = data.data; @@ -9757,7 +9751,7 @@ 1, 1 ]; - if (profileIdc = (expGolombDecoder = new ExpGolomb(data)).readUnsignedByte(), profileCompatibility = expGolombDecoder.readUnsignedByte(), levelIdc = expGolombDecoder.readUnsignedByte(), expGolombDecoder.skipUnsignedExpGolomb(), PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc] && (3 === (chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb()) && expGolombDecoder.skipBits(1), expGolombDecoder.skipUnsignedExpGolomb(), expGolombDecoder.skipUnsignedExpGolomb(), expGolombDecoder.skipBits(1), expGolombDecoder.readBoolean())) for(i = 0, scalingListCount = 3 !== chromaFormatIdc ? 8 : 12; i < scalingListCount; i++)expGolombDecoder.readBoolean() && (i < 6 ? skipScalingList(16, expGolombDecoder) : skipScalingList(64, expGolombDecoder)); + if (profileIdc = (expGolombDecoder = new expGolomb(data)).readUnsignedByte(), profileCompatibility = expGolombDecoder.readUnsignedByte(), levelIdc = expGolombDecoder.readUnsignedByte(), expGolombDecoder.skipUnsignedExpGolomb(), PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc] && (3 === (chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb()) && expGolombDecoder.skipBits(1), expGolombDecoder.skipUnsignedExpGolomb(), expGolombDecoder.skipUnsignedExpGolomb(), expGolombDecoder.skipBits(1), expGolombDecoder.readBoolean())) for(i = 0, scalingListCount = 3 !== chromaFormatIdc ? 8 : 12; i < scalingListCount; i++)expGolombDecoder.readBoolean() && (i < 6 ? skipScalingList(16, expGolombDecoder) : skipScalingList(64, expGolombDecoder)); if (expGolombDecoder.skipUnsignedExpGolomb(), 0 === (picOrderCntType = expGolombDecoder.readUnsignedExpGolomb())) expGolombDecoder.readUnsignedExpGolomb(); else if (1 === picOrderCntType) for(expGolombDecoder.skipBits(1), expGolombDecoder.skipExpGolomb(), expGolombDecoder.skipExpGolomb(), numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb(), i = 0; i < numRefFramesInPicOrderCntCycle; i++)expGolombDecoder.skipExpGolomb(); if (expGolombDecoder.skipUnsignedExpGolomb(), expGolombDecoder.skipBits(1), picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb(), picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb(), 0 === (frameMbsOnlyFlag = expGolombDecoder.readBits(1)) && expGolombDecoder.skipBits(1), expGolombDecoder.skipBits(1), expGolombDecoder.readBoolean() && (frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb(), frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb(), frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb(), frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb()), expGolombDecoder.readBoolean() && expGolombDecoder.readBoolean()) { @@ -10249,22 +10243,22 @@ toHexString: function(value) { return ("00" + value.toString(16)).slice(-2); } - }, parseType$1 = function(buffer) { + }, parseType_1 = function(buffer) { var result = ""; return result += String.fromCharCode(buffer[0]), result += String.fromCharCode(buffer[1]), result += String.fromCharCode(buffer[2]), result += String.fromCharCode(buffer[3]); - }, toUnsigned$2 = bin.toUnsigned, findBox = function findBox(data, path) { + }, toUnsigned$2 = bin.toUnsigned, findBox_1 = function findBox(data, path) { var i, size, type, end, subresults, results = []; if (!path.length) return null; - for(i = 0; i < data.byteLength;)size = toUnsigned$2(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]), type = parseType$1(data.subarray(i + 4, i + 8)), end = size > 1 ? i + size : data.byteLength, type === path[0] && (1 === path.length ? results.push(data.subarray(i + 8, end)) : (subresults = findBox(data.subarray(i + 8, end), path.slice(1))).length && (results = results.concat(subresults))), i = end; + for(i = 0; i < data.byteLength;)size = toUnsigned$2(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]), type = parseType_1(data.subarray(i + 4, i + 8)), end = size > 1 ? i + size : data.byteLength, type === path[0] && (1 === path.length ? results.push(data.subarray(i + 8, end)) : (subresults = findBox(data.subarray(i + 8, end), path.slice(1))).length && (results = results.concat(subresults))), i = end; return results; - }, toUnsigned$1 = bin.toUnsigned, tfdt = function(data) { + }, toUnsigned$1 = bin.toUnsigned, parseTfdt = function(data) { var result = { version: data[0], flags: new Uint8Array(data.subarray(1, 4)), baseMediaDecodeTime: toUnsigned$1(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]) }; return 1 === result.version && (result.baseMediaDecodeTime *= 4294967296, result.baseMediaDecodeTime += toUnsigned$1(data[8] << 24 | data[9] << 16 | data[10] << 8 | data[11])), result; - }, parseSampleFlags = function(flags) { + }, parseSampleFlags_1 = function(flags) { return { isLeading: (0x0c & flags[0]) >>> 2, dependsOn: 0x03 & flags[0], @@ -10274,17 +10268,17 @@ isNonSyncSample: 0x01 & flags[1], degradationPriority: flags[2] << 8 | flags[3] }; - }, trun = function(data) { + }, parseTrun = function(data) { var sample, result = { version: data[0], flags: new Uint8Array(data.subarray(1, 4)), samples: [] }, view = new DataView(data.buffer, data.byteOffset, data.byteLength), dataOffsetPresent = 0x01 & result.flags[2], firstSampleFlagsPresent = 0x04 & result.flags[2], sampleDurationPresent = 0x01 & result.flags[1], sampleSizePresent = 0x02 & result.flags[1], sampleFlagsPresent = 0x04 & result.flags[1], sampleCompositionTimeOffsetPresent = 0x08 & result.flags[1], sampleCount = view.getUint32(4), offset = 8; for(dataOffsetPresent && (result.dataOffset = view.getInt32(offset), offset += 4), firstSampleFlagsPresent && sampleCount && (sample = { - flags: parseSampleFlags(data.subarray(offset, offset + 4)) - }, offset += 4, sampleDurationPresent && (sample.duration = view.getUint32(offset), offset += 4), sampleSizePresent && (sample.size = view.getUint32(offset), offset += 4), sampleCompositionTimeOffsetPresent && (1 === result.version ? sample.compositionTimeOffset = view.getInt32(offset) : sample.compositionTimeOffset = view.getUint32(offset), offset += 4), result.samples.push(sample), sampleCount--); sampleCount--;)sample = {}, sampleDurationPresent && (sample.duration = view.getUint32(offset), offset += 4), sampleSizePresent && (sample.size = view.getUint32(offset), offset += 4), sampleFlagsPresent && (sample.flags = parseSampleFlags(data.subarray(offset, offset + 4)), offset += 4), sampleCompositionTimeOffsetPresent && (1 === result.version ? sample.compositionTimeOffset = view.getInt32(offset) : sample.compositionTimeOffset = view.getUint32(offset), offset += 4), result.samples.push(sample); + flags: parseSampleFlags_1(data.subarray(offset, offset + 4)) + }, offset += 4, sampleDurationPresent && (sample.duration = view.getUint32(offset), offset += 4), sampleSizePresent && (sample.size = view.getUint32(offset), offset += 4), sampleCompositionTimeOffsetPresent && (1 === result.version ? sample.compositionTimeOffset = view.getInt32(offset) : sample.compositionTimeOffset = view.getUint32(offset), offset += 4), result.samples.push(sample), sampleCount--); sampleCount--;)sample = {}, sampleDurationPresent && (sample.duration = view.getUint32(offset), offset += 4), sampleSizePresent && (sample.size = view.getUint32(offset), offset += 4), sampleFlagsPresent && (sample.flags = parseSampleFlags_1(data.subarray(offset, offset + 4)), offset += 4), sampleCompositionTimeOffsetPresent && (1 === result.version ? sample.compositionTimeOffset = view.getInt32(offset) : sample.compositionTimeOffset = view.getUint32(offset), offset += 4), result.samples.push(sample); return result; - }, tfhd = function(data) { + }, parseTfhd = function(data) { var i, view = new DataView(data.buffer, data.byteOffset, data.byteLength), result = { version: data[0], flags: new Uint8Array(data.subarray(1, 4)), @@ -10326,17 +10320,17 @@ return result; }, parseSamples = function(truns, baseMediaDecodeTime, tfhd) { var currentDts = baseMediaDecodeTime, defaultSampleDuration = tfhd.defaultSampleDuration || 0, defaultSampleSize = tfhd.defaultSampleSize || 0, trackId = tfhd.trackId, allSamples = []; - return truns.forEach(function(trun1) { - var samples = trun(trun1).samples; + return truns.forEach(function(trun) { + var samples = parseTrun(trun).samples; samples.forEach(function(sample) { void 0 === sample.duration && (sample.duration = defaultSampleDuration), void 0 === sample.size && (sample.size = defaultSampleSize), sample.trackId = trackId, sample.dts = currentDts, void 0 === sample.compositionTimeOffset && (sample.compositionTimeOffset = 0), sample.pts = currentDts + sample.compositionTimeOffset, currentDts += sample.duration; }), allSamples = allSamples.concat(samples); }), allSamples; }, parseCaptionNals = function(segment, videoTrackId) { - var trafs = findBox(segment, [ + var trafs = findBox_1(segment, [ "moof", "traf" - ]), mdats = findBox(segment, [ + ]), mdats = findBox_1(segment, [ "mdat" ]), captionNals = {}, mdatTrafPairs = []; return mdats.forEach(function(mdat, index) { @@ -10346,11 +10340,11 @@ traf: matchingTraf }); }), mdatTrafPairs.forEach(function(pair) { - var result, mdat = pair.mdat, traf = pair.traf, headerInfo = tfhd(findBox(traf, [ + var result, mdat = pair.mdat, traf = pair.traf, headerInfo = parseTfhd(findBox_1(traf, [ "tfhd" - ])[0]), trackId = headerInfo.trackId, tfdt1 = findBox(traf, [ + ])[0]), trackId = headerInfo.trackId, tfdt = findBox_1(traf, [ "tfdt" - ]), baseMediaDecodeTime = tfdt1.length > 0 ? tfdt(tfdt1[0]).baseMediaDecodeTime : 0, truns = findBox(traf, [ + ]), baseMediaDecodeTime = tfdt.length > 0 ? parseTfdt(tfdt[0]).baseMediaDecodeTime : 0, truns = findBox_1(traf, [ "trun" ]); videoTrackId === trackId && truns.length > 0 && (result = findSeiNals(mdat, parseSamples(truns, baseMediaDecodeTime, headerInfo), trackId), captionNals[trackId] || (captionNals[trackId] = { @@ -10366,7 +10360,7 @@ logs: trackNals.logs, timescale: timescale }; - }, CaptionParser = function() { + }, captionParser = function() { var captionStream, segmentCache, trackId, timescale, parsedCaptions, parsingPartial, isInitialized = !1; this.isInitialized = function() { return isInitialized; @@ -10414,125 +10408,123 @@ logs: [] }, this.resetCaptionStream(); }, this.reset(); - }, toUnsigned = bin.toUnsigned, toHexString = bin.toHexString; - timescale = function(init) { - return findBox(init, [ - "moov", - "trak" - ]).reduce(function(result, trak) { - var tkhd, index, id, mdhd; - return (tkhd = findBox(trak, [ - "tkhd" - ])[0]) && (id = toUnsigned(tkhd[index = 0 === tkhd[0] ? 12 : 20] << 24 | tkhd[index + 1] << 16 | tkhd[index + 2] << 8 | tkhd[index + 3]), mdhd = findBox(trak, [ - "mdia", - "mdhd" - ])[0]) ? (index = 0 === mdhd[0] ? 12 : 20, result[id] = toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]), result) : null; - }, {}); - }, startTime = function(timescale, fragment) { - var trafs, baseTimes, result; - return trafs = findBox(fragment, [ - "moof", - "traf" - ]), baseTimes = [].concat.apply([], trafs.map(function(traf) { - return findBox(traf, [ - "tfhd" - ]).map(function(tfhd) { - var scale, baseTime; - return scale = timescale[toUnsigned(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7])] || 90e3, (baseTime = "number" != typeof (baseTime = findBox(traf, [ + }, toUnsigned = bin.toUnsigned, toHexString = bin.toHexString, probe$2 = { + findBox: findBox_1, + parseType: parseType_1, + timescale: function(init) { + return findBox_1(init, [ + "moov", + "trak" + ]).reduce(function(result, trak) { + var tkhd, index, id, mdhd; + return (tkhd = findBox_1(trak, [ + "tkhd" + ])[0]) && (id = toUnsigned(tkhd[index = 0 === tkhd[0] ? 12 : 20] << 24 | tkhd[index + 1] << 16 | tkhd[index + 2] << 8 | tkhd[index + 3]), mdhd = findBox_1(trak, [ + "mdia", + "mdhd" + ])[0]) ? (index = 0 === mdhd[0] ? 12 : 20, result[id] = toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]), result) : null; + }, {}); + }, + startTime: function(timescale, fragment) { + var trafs, baseTimes, result; + return trafs = findBox_1(fragment, [ + "moof", + "traf" + ]), baseTimes = [].concat.apply([], trafs.map(function(traf) { + return findBox_1(traf, [ + "tfhd" + ]).map(function(tfhd) { + var scale, baseTime; + return scale = timescale[toUnsigned(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7])] || 90e3, (baseTime = "number" != typeof (baseTime = findBox_1(traf, [ + "tfdt" + ]).map(function(tfdt) { + var version, result; + return version = tfdt[0], result = toUnsigned(tfdt[4] << 24 | tfdt[5] << 16 | tfdt[6] << 8 | tfdt[7]), 1 === version && (result *= 4294967296, result += toUnsigned(tfdt[8] << 24 | tfdt[9] << 16 | tfdt[10] << 8 | tfdt[11])), result; + })[0]) || isNaN(baseTime) ? 1 / 0 : baseTime) / scale; + }); + })), isFinite(result = Math.min.apply(null, baseTimes)) ? result : 0; + }, + compositionStartTime: function(timescales, fragment) { + var trackId, trafBoxes = findBox_1(fragment, [ + "moof", + "traf" + ]), baseMediaDecodeTime = 0, compositionTimeOffset = 0; + if (trafBoxes && trafBoxes.length) { + var tfhd = findBox_1(trafBoxes[0], [ + "tfhd" + ])[0], trun = findBox_1(trafBoxes[0], [ + "trun" + ])[0], tfdt = findBox_1(trafBoxes[0], [ "tfdt" - ]).map(function(tfdt) { - var version, result; - return version = tfdt[0], result = toUnsigned(tfdt[4] << 24 | tfdt[5] << 16 | tfdt[6] << 8 | tfdt[7]), 1 === version && (result *= 4294967296, result += toUnsigned(tfdt[8] << 24 | tfdt[9] << 16 | tfdt[10] << 8 | tfdt[11])), result; - })[0]) || isNaN(baseTime) ? 1 / 0 : baseTime) / scale; - }); - })), isFinite(result = Math.min.apply(null, baseTimes)) ? result : 0; - }, compositionStartTime = function(timescales, fragment) { - var trackId, trafBoxes = findBox(fragment, [ - "moof", - "traf" - ]), baseMediaDecodeTime = 0, compositionTimeOffset = 0; - if (trafBoxes && trafBoxes.length) { - var tfhd1 = findBox(trafBoxes[0], [ - "tfhd" - ])[0], trun1 = findBox(trafBoxes[0], [ - "trun" - ])[0], tfdt1 = findBox(trafBoxes[0], [ - "tfdt" - ])[0]; - if (tfhd1 && (trackId = tfhd(tfhd1).trackId), tfdt1 && (baseMediaDecodeTime = tfdt(tfdt1).baseMediaDecodeTime), trun1) { - var parsedTrun = trun(trun1); - parsedTrun.samples && parsedTrun.samples.length && (compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0); - } - } - return (baseMediaDecodeTime + compositionTimeOffset) / (timescales[trackId] || 90e3); - }, getVideoTrackIds = function(init) { - var traks = findBox(init, [ - "moov", - "trak" - ]), videoTrackIds = []; - return traks.forEach(function(trak) { - var hdlrs = findBox(trak, [ - "mdia", - "hdlr" - ]), tkhds = findBox(trak, [ - "tkhd" - ]); - hdlrs.forEach(function(hdlr, index) { - var view, trackId, handlerType = parseType$1(hdlr.subarray(8, 12)), tkhd = tkhds[index]; - "vide" === handlerType && (trackId = 0 === (view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength)).getUint8(0) ? view.getUint32(12) : view.getUint32(20), videoTrackIds.push(trackId)); - }); - }), videoTrackIds; - }, getTimescaleFromMediaHeader = function(mdhd) { - var index = 0 === mdhd[0] ? 12 : 20; - return toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - }, getTracks = function(init) { - var traks = findBox(init, [ - "moov", - "trak" - ]), tracks = []; - return traks.forEach(function(trak) { - var track = {}, tkhd = findBox(trak, [ - "tkhd" - ])[0]; - tkhd && (tkhdVersion = (view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength)).getUint8(0), track.id = 0 === tkhdVersion ? view.getUint32(12) : view.getUint32(20)); - var hdlr = findBox(trak, [ - "mdia", - "hdlr" - ])[0]; - if (hdlr) { - var type = parseType$1(hdlr.subarray(8, 12)); - "vide" === type ? track.type = "video" : "soun" === type ? track.type = "audio" : track.type = type; - } - var stsd = findBox(trak, [ - "mdia", - "minf", - "stbl", - "stsd" - ])[0]; - if (stsd) { - var view, tkhdVersion, codecConfig, sampleDescriptions = stsd.subarray(8); - track.codec = parseType$1(sampleDescriptions.subarray(4, 8)); - var codecBox = findBox(sampleDescriptions, [ - track.codec ])[0]; - codecBox && (/^[asm]vc[1-9]$/i.test(track.codec) ? "avcC" === parseType$1((codecConfig = codecBox.subarray(78)).subarray(4, 8)) && codecConfig.length > 11 ? (track.codec += ".", track.codec += toHexString(codecConfig[9]), track.codec += toHexString(codecConfig[10]), track.codec += toHexString(codecConfig[11])) : track.codec = "avc1.4d400d" : /^mp4[a,v]$/i.test(track.codec) ? "esds" === parseType$1((codecConfig = codecBox.subarray(28)).subarray(4, 8)) && codecConfig.length > 20 && 0 !== codecConfig[19] ? (track.codec += "." + toHexString(codecConfig[19]), track.codec += "." + toHexString(codecConfig[20] >>> 2 & 0x3f).replace(/^0/, "")) : track.codec = "mp4a.40.2" : track.codec = track.codec.toLowerCase()); - } - var mdhd = findBox(trak, [ - "mdia", - "mdhd" - ])[0]; - mdhd && (track.timescale = getTimescaleFromMediaHeader(mdhd)), tracks.push(track); - }), tracks; - }; - var probe$2 = { - findBox: findBox, - parseType: parseType$1, - timescale: timescale, - startTime: startTime, - compositionStartTime: compositionStartTime, - videoTrackIds: getVideoTrackIds, - tracks: getTracks, - getTimescaleFromMediaHeader: getTimescaleFromMediaHeader + if (tfhd && (trackId = parseTfhd(tfhd).trackId), tfdt && (baseMediaDecodeTime = parseTfdt(tfdt).baseMediaDecodeTime), trun) { + var parsedTrun = parseTrun(trun); + parsedTrun.samples && parsedTrun.samples.length && (compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0); + } + } + return (baseMediaDecodeTime + compositionTimeOffset) / (timescales[trackId] || 90e3); + }, + videoTrackIds: function(init) { + var traks = findBox_1(init, [ + "moov", + "trak" + ]), videoTrackIds = []; + return traks.forEach(function(trak) { + var hdlrs = findBox_1(trak, [ + "mdia", + "hdlr" + ]), tkhds = findBox_1(trak, [ + "tkhd" + ]); + hdlrs.forEach(function(hdlr, index) { + var view, trackId, handlerType = parseType_1(hdlr.subarray(8, 12)), tkhd = tkhds[index]; + "vide" === handlerType && (trackId = 0 === (view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength)).getUint8(0) ? view.getUint32(12) : view.getUint32(20), videoTrackIds.push(trackId)); + }); + }), videoTrackIds; + }, + tracks: function(init) { + var traks = findBox_1(init, [ + "moov", + "trak" + ]), tracks = []; + return traks.forEach(function(trak) { + var track = {}, tkhd = findBox_1(trak, [ + "tkhd" + ])[0]; + tkhd && (tkhdVersion = (view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength)).getUint8(0), track.id = 0 === tkhdVersion ? view.getUint32(12) : view.getUint32(20)); + var hdlr = findBox_1(trak, [ + "mdia", + "hdlr" + ])[0]; + if (hdlr) { + var type = parseType_1(hdlr.subarray(8, 12)); + "vide" === type ? track.type = "video" : "soun" === type ? track.type = "audio" : track.type = type; + } + var stsd = findBox_1(trak, [ + "mdia", + "minf", + "stbl", + "stsd" + ])[0]; + if (stsd) { + var view, tkhdVersion, codecConfig, sampleDescriptions = stsd.subarray(8); + track.codec = parseType_1(sampleDescriptions.subarray(4, 8)); + var codecBox = findBox_1(sampleDescriptions, [ + track.codec + ])[0]; + codecBox && (/^[asm]vc[1-9]$/i.test(track.codec) ? "avcC" === parseType_1((codecConfig = codecBox.subarray(78)).subarray(4, 8)) && codecConfig.length > 11 ? (track.codec += ".", track.codec += toHexString(codecConfig[9]), track.codec += toHexString(codecConfig[10]), track.codec += toHexString(codecConfig[11])) : track.codec = "avc1.4d400d" : /^mp4[a,v]$/i.test(track.codec) ? "esds" === parseType_1((codecConfig = codecBox.subarray(28)).subarray(4, 8)) && codecConfig.length > 20 && 0 !== codecConfig[19] ? (track.codec += "." + toHexString(codecConfig[19]), track.codec += "." + toHexString(codecConfig[20] >>> 2 & 0x3f).replace(/^0/, "")) : track.codec = "mp4a.40.2" : track.codec = track.codec.toLowerCase()); + } + var mdhd = findBox_1(trak, [ + "mdia", + "mdhd" + ])[0]; + mdhd && (track.timescale = getTimescaleFromMediaHeader(mdhd)), tracks.push(track); + }), tracks; + }, + getTimescaleFromMediaHeader: getTimescaleFromMediaHeader = function(mdhd) { + var index = 0 === mdhd[0] ? 12 : 20; + return toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); + } }, parsePid = function(packet) { var pid = 0x1f & packet[1]; return pid <<= 8, pid |= packet[2]; @@ -10541,39 +10533,6 @@ }, parseAdaptionField = function(packet) { var offset = 0; return (0x30 & packet[3]) >>> 4 > 0x01 && (offset += packet[4] + 1), offset; - }, parseType = function(packet, pmtPid) { - var pid = parsePid(packet); - return 0 === pid ? "pat" : pid === pmtPid ? "pmt" : pmtPid ? "pes" : null; - }, parsePat = function(packet) { - var pusi = parsePayloadUnitStartIndicator(packet), offset = 4 + parseAdaptionField(packet); - return pusi && (offset += packet[offset] + 1), (0x1f & packet[offset + 10]) << 8 | packet[offset + 11]; - }, parsePmt = function(packet) { - var tableEnd, programMapTable = {}, pusi = parsePayloadUnitStartIndicator(packet), payloadOffset = 4 + parseAdaptionField(packet); - if (pusi && (payloadOffset += packet[payloadOffset] + 1), 0x01 & packet[payloadOffset + 5]) { - tableEnd = 3 + ((0x0f & packet[payloadOffset + 1]) << 8 | packet[payloadOffset + 2]) - 4; - for(var offset = 12 + ((0x0f & packet[payloadOffset + 10]) << 8 | packet[payloadOffset + 11]); offset < tableEnd;){ - var i = payloadOffset + offset; - programMapTable[(0x1f & packet[i + 1]) << 8 | packet[i + 2]] = packet[i], offset += ((0x0f & packet[i + 3]) << 8 | packet[i + 4]) + 5; - } - return programMapTable; - } - }, parsePesType = function(packet, programMapTable) { - switch(programMapTable[parsePid(packet)]){ - case streamTypes.H264_STREAM_TYPE: - return "video"; - case streamTypes.ADTS_STREAM_TYPE: - return "audio"; - case streamTypes.METADATA_STREAM_TYPE: - return "timed-metadata"; - default: - return null; - } - }, parsePesTime = function(packet) { - if (!parsePayloadUnitStartIndicator(packet)) return null; - var ptsDtsFlags, offset = 4 + parseAdaptionField(packet); - if (offset >= packet.byteLength) return null; - var pes = null; - return 0xc0 & (ptsDtsFlags = packet[offset + 7]) && ((pes = {}).pts = (0x0e & packet[offset + 9]) << 27 | (0xff & packet[offset + 10]) << 20 | (0xfe & packet[offset + 11]) << 12 | (0xff & packet[offset + 12]) << 5 | (0xfe & packet[offset + 13]) >>> 3, pes.pts *= 4, pes.pts += (0x06 & packet[offset + 13]) >>> 1, pes.dts = pes.pts, 0x40 & ptsDtsFlags && (pes.dts = (0x0e & packet[offset + 14]) << 27 | (0xff & packet[offset + 15]) << 20 | (0xfe & packet[offset + 16]) << 12 | (0xff & packet[offset + 17]) << 5 | (0xfe & packet[offset + 18]) >>> 3, pes.dts *= 4, pes.dts += (0x06 & packet[offset + 18]) >>> 1)), pes; }, parseNalUnitType = function(type) { switch(type){ case 0x05: @@ -10589,46 +10548,79 @@ default: return null; } - }, videoPacketContainsKeyFrame = function(packet) { - for(var offset = 4 + parseAdaptionField(packet), frameBuffer = packet.subarray(offset), frameI = 0, frameSyncPoint = 0, foundKeyFrame = !1; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++)if (1 === frameBuffer[frameSyncPoint + 2]) { - frameI = frameSyncPoint + 5; - break; - } - for(; frameI < frameBuffer.byteLength;)switch(frameBuffer[frameI]){ - case 0: - if (0 !== frameBuffer[frameI - 1]) { - frameI += 2; - break; - } - if (0 !== frameBuffer[frameI - 2]) { - frameI++; - break; + }, handleRollover = timestampRolloverStream.handleRollover, probe = {}; + probe.ts = { + parseType: function(packet, pmtPid) { + var pid = parsePid(packet); + return 0 === pid ? "pat" : pid === pmtPid ? "pmt" : pmtPid ? "pes" : null; + }, + parsePat: function(packet) { + var pusi = parsePayloadUnitStartIndicator(packet), offset = 4 + parseAdaptionField(packet); + return pusi && (offset += packet[offset] + 1), (0x1f & packet[offset + 10]) << 8 | packet[offset + 11]; + }, + parsePmt: function(packet) { + var tableEnd, programMapTable = {}, pusi = parsePayloadUnitStartIndicator(packet), payloadOffset = 4 + parseAdaptionField(packet); + if (pusi && (payloadOffset += packet[payloadOffset] + 1), 0x01 & packet[payloadOffset + 5]) { + tableEnd = 3 + ((0x0f & packet[payloadOffset + 1]) << 8 | packet[payloadOffset + 2]) - 4; + for(var offset = 12 + ((0x0f & packet[payloadOffset + 10]) << 8 | packet[payloadOffset + 11]); offset < tableEnd;){ + var i = payloadOffset + offset; + programMapTable[(0x1f & packet[i + 1]) << 8 | packet[i + 2]] = packet[i], offset += ((0x0f & packet[i + 3]) << 8 | packet[i + 4]) + 5; } - frameSyncPoint + 3 !== frameI - 2 && "slice_layer_without_partitioning_rbsp_idr" === parseNalUnitType(0x1f & frameBuffer[frameSyncPoint + 3]) && (foundKeyFrame = !0); - do frameI++; - while (1 !== frameBuffer[frameI] && frameI < frameBuffer.length) - frameSyncPoint = frameI - 2, frameI += 3; + return programMapTable; + } + }, + parsePayloadUnitStartIndicator: parsePayloadUnitStartIndicator, + parsePesType: function(packet, programMapTable) { + switch(programMapTable[parsePid(packet)]){ + case streamTypes.H264_STREAM_TYPE: + return "video"; + case streamTypes.ADTS_STREAM_TYPE: + return "audio"; + case streamTypes.METADATA_STREAM_TYPE: + return "timed-metadata"; + default: + return null; + } + }, + parsePesTime: function(packet) { + if (!parsePayloadUnitStartIndicator(packet)) return null; + var ptsDtsFlags, offset = 4 + parseAdaptionField(packet); + if (offset >= packet.byteLength) return null; + var pes = null; + return 0xc0 & (ptsDtsFlags = packet[offset + 7]) && ((pes = {}).pts = (0x0e & packet[offset + 9]) << 27 | (0xff & packet[offset + 10]) << 20 | (0xfe & packet[offset + 11]) << 12 | (0xff & packet[offset + 12]) << 5 | (0xfe & packet[offset + 13]) >>> 3, pes.pts *= 4, pes.pts += (0x06 & packet[offset + 13]) >>> 1, pes.dts = pes.pts, 0x40 & ptsDtsFlags && (pes.dts = (0x0e & packet[offset + 14]) << 27 | (0xff & packet[offset + 15]) << 20 | (0xfe & packet[offset + 16]) << 12 | (0xff & packet[offset + 17]) << 5 | (0xfe & packet[offset + 18]) >>> 3, pes.dts *= 4, pes.dts += (0x06 & packet[offset + 18]) >>> 1)), pes; + }, + videoPacketContainsKeyFrame: function(packet) { + for(var offset = 4 + parseAdaptionField(packet), frameBuffer = packet.subarray(offset), frameI = 0, frameSyncPoint = 0, foundKeyFrame = !1; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++)if (1 === frameBuffer[frameSyncPoint + 2]) { + frameI = frameSyncPoint + 5; break; - case 1: - if (0 !== frameBuffer[frameI - 1] || 0 !== frameBuffer[frameI - 2]) { - frameI += 3; + } + for(; frameI < frameBuffer.byteLength;)switch(frameBuffer[frameI]){ + case 0: + if (0 !== frameBuffer[frameI - 1]) { + frameI += 2; + break; + } + if (0 !== frameBuffer[frameI - 2]) { + frameI++; + break; + } + frameSyncPoint + 3 !== frameI - 2 && "slice_layer_without_partitioning_rbsp_idr" === parseNalUnitType(0x1f & frameBuffer[frameSyncPoint + 3]) && (foundKeyFrame = !0); + do frameI++; + while (1 !== frameBuffer[frameI] && frameI < frameBuffer.length) + frameSyncPoint = frameI - 2, frameI += 3; break; - } - "slice_layer_without_partitioning_rbsp_idr" === parseNalUnitType(0x1f & frameBuffer[frameSyncPoint + 3]) && (foundKeyFrame = !0), frameSyncPoint = frameI - 2, frameI += 3; - break; - default: - frameI += 3; + case 1: + if (0 !== frameBuffer[frameI - 1] || 0 !== frameBuffer[frameI - 2]) { + frameI += 3; + break; + } + "slice_layer_without_partitioning_rbsp_idr" === parseNalUnitType(0x1f & frameBuffer[frameSyncPoint + 3]) && (foundKeyFrame = !0), frameSyncPoint = frameI - 2, frameI += 3; + break; + default: + frameI += 3; + } + return frameBuffer = frameBuffer.subarray(frameSyncPoint), frameI -= frameSyncPoint, frameSyncPoint = 0, frameBuffer && frameBuffer.byteLength > 3 && "slice_layer_without_partitioning_rbsp_idr" === parseNalUnitType(0x1f & frameBuffer[frameSyncPoint + 3]) && (foundKeyFrame = !0), foundKeyFrame; } - return frameBuffer = frameBuffer.subarray(frameSyncPoint), frameI -= frameSyncPoint, frameSyncPoint = 0, frameBuffer && frameBuffer.byteLength > 3 && "slice_layer_without_partitioning_rbsp_idr" === parseNalUnitType(0x1f & frameBuffer[frameSyncPoint + 3]) && (foundKeyFrame = !0), foundKeyFrame; - }, handleRollover = timestampRolloverStream.handleRollover, probe = {}; - probe.ts = { - parseType: parseType, - parsePat: parsePat, - parsePmt: parsePmt, - parsePayloadUnitStartIndicator: parsePayloadUnitStartIndicator, - parsePesType: parsePesType, - parsePesTime: parsePesTime, - videoPacketContainsKeyFrame: videoPacketContainsKeyFrame }, probe.aac = utils; var ONE_SECOND_IN_TS = clock.ONE_SECOND_IN_TS, parsePsi_ = function(bytes, pmt) { for(var packet, startIndex = 0, endIndex = 188; endIndex < bytes.byteLength;){ @@ -10872,7 +10864,7 @@ return _proto.init = function() { this.transmuxer && this.transmuxer.dispose(), this.transmuxer = new transmuxer.Transmuxer(this.options), wireTransmuxerEvents(this.self, this.transmuxer); }, _proto.pushMp4Captions = function(data) { - this.captionParser || (this.captionParser = new CaptionParser(), this.captionParser.init()); + this.captionParser || (this.captionParser = new captionParser(), this.captionParser.init()); var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength), parsed = this.captionParser.parse(segment, data.trackIds, data.timescales); this.self.postMessage({ action: "mp4Captions", @@ -10972,15 +10964,15 @@ }, processTransmux = function(options) { var transmuxer = options.transmuxer, bytes = options.bytes, audioAppendStart = options.audioAppendStart, gopsToAlignWith = options.gopsToAlignWith, remux = options.remux, onData = options.onData, onTrackInfo = options.onTrackInfo, onAudioTimingInfo = options.onAudioTimingInfo, onVideoTimingInfo = options.onVideoTimingInfo, onVideoSegmentTimingInfo = options.onVideoSegmentTimingInfo, onAudioSegmentTimingInfo = options.onAudioSegmentTimingInfo, onId3 = options.onId3, onCaptions = options.onCaptions, onDone = options.onDone, onEndedTimeline = options.onEndedTimeline, onTransmuxerLog = options.onTransmuxerLog, isEndOfTimeline = options.isEndOfTimeline, transmuxedData = { buffer: [] - }, waitForEndedTimelineEvent = isEndOfTimeline, handleMessage = function(event) { + }, waitForEndedTimelineEvent = isEndOfTimeline; + if (transmuxer.onmessage = function(event) { transmuxer.currentTransmux === options && ("data" === event.data.action && handleData_(event, transmuxedData, onData), "trackinfo" === event.data.action && onTrackInfo(event.data.trackInfo), "gopInfo" === event.data.action && handleGopInfo_(event, transmuxedData), "audioTimingInfo" === event.data.action && onAudioTimingInfo(event.data.audioTimingInfo), "videoTimingInfo" === event.data.action && onVideoTimingInfo(event.data.videoTimingInfo), "videoSegmentTimingInfo" === event.data.action && onVideoSegmentTimingInfo(event.data.videoSegmentTimingInfo), "audioSegmentTimingInfo" === event.data.action && onAudioSegmentTimingInfo(event.data.audioSegmentTimingInfo), "id3Frame" === event.data.action && onId3([ event.data.id3Frame ], event.data.id3Frame.dispatchType), "caption" === event.data.action && onCaptions(event.data.caption), "endedtimeline" === event.data.action && (waitForEndedTimelineEvent = !1, onEndedTimeline()), "log" === event.data.action && onTransmuxerLog(event.data.log), "transmuxed" !== event.data.type || waitForEndedTimelineEvent || (transmuxer.onmessage = null, handleDone_({ transmuxedData: transmuxedData, callback: onDone }), dequeue(transmuxer))); - }; - if (transmuxer.onmessage = handleMessage, audioAppendStart && transmuxer.postMessage({ + }, audioAppendStart && transmuxer.postMessage({ action: "setAudioAppendStart", appendStart: audioAppendStart }), Array.isArray(gopsToAlignWith) && transmuxer.postMessage({ @@ -11047,10 +11039,10 @@ endAction: null, transmuxer: null, callback: null - }), listenForEndEvent = function listenForEndEvent(event) { + }); + if (transmuxer.addEventListener("message", function listenForEndEvent(event) { event.data.action === endAction && (transmuxer.removeEventListener("message", listenForEndEvent), event.data.data && (event.data.data = new Uint8Array(event.data.data, options.byteOffset || 0, options.byteLength || event.data.data.byteLength), options.data && (options.data = event.data.data)), callback(event.data)); - }; - if (transmuxer.addEventListener("message", listenForEndEvent), options.data) { + }), options.data) { var isArrayBuffer = options.data instanceof ArrayBuffer; message.byteOffset = isArrayBuffer ? 0 : options.data.byteOffset, message.byteLength = options.data.byteLength; var transfers = [ @@ -11287,14 +11279,14 @@ onTransmuxerLog: onTransmuxerLog }); }, decrypt = function(_ref7, callback) { - var keyBytes, id = _ref7.id, key = _ref7.key, encryptedBytes = _ref7.encryptedBytes, decryptionWorker = _ref7.decryptionWorker, decryptionHandler = function decryptionHandler(event) { + var keyBytes, id = _ref7.id, key = _ref7.key, encryptedBytes = _ref7.encryptedBytes, decryptionWorker = _ref7.decryptionWorker; + decryptionWorker.addEventListener("message", function decryptionHandler(event) { if (event.data.source === id) { decryptionWorker.removeEventListener("message", decryptionHandler); var decrypted = event.data.decrypted; callback(new Uint8Array(decrypted.bytes, decrypted.byteOffset, decrypted.byteLength)); } - }; - decryptionWorker.addEventListener("message", decryptionHandler), keyBytes = key.bytes.slice ? key.bytes.slice() : new Uint32Array(Array.prototype.slice.call(key.bytes)), decryptionWorker.postMessage(createTransferableMessage({ + }), keyBytes = key.bytes.slice ? key.bytes.slice() : new Uint32Array(Array.prototype.slice.call(key.bytes)), decryptionWorker.postMessage(createTransferableMessage({ source: id, encrypted: encryptedBytes, key: keyBytes, @@ -11525,9 +11517,6 @@ }, comparePlaylistBandwidth = function(left, right) { var leftBandwidth, rightBandwidth; return left.attributes.BANDWIDTH && (leftBandwidth = left.attributes.BANDWIDTH), leftBandwidth = leftBandwidth || global_window__WEBPACK_IMPORTED_MODULE_0___default().Number.MAX_VALUE, right.attributes.BANDWIDTH && (rightBandwidth = right.attributes.BANDWIDTH), leftBandwidth - (rightBandwidth = rightBandwidth || global_window__WEBPACK_IMPORTED_MODULE_0___default().Number.MAX_VALUE); - }, comparePlaylistResolution = function(left, right) { - var leftWidth, rightWidth; - return (left.attributes.RESOLUTION && left.attributes.RESOLUTION.width && (leftWidth = left.attributes.RESOLUTION.width), leftWidth = leftWidth || global_window__WEBPACK_IMPORTED_MODULE_0___default().Number.MAX_VALUE, right.attributes.RESOLUTION && right.attributes.RESOLUTION.width && (rightWidth = right.attributes.RESOLUTION.width), leftWidth === (rightWidth = rightWidth || global_window__WEBPACK_IMPORTED_MODULE_0___default().Number.MAX_VALUE) && left.attributes.BANDWIDTH && right.attributes.BANDWIDTH) ? left.attributes.BANDWIDTH - right.attributes.BANDWIDTH : leftWidth - rightWidth; }, simpleSelector = function(master, playerBandwidth, playerWidth, playerHeight, limitRenditionByPlayerDimensions, masterPlaylistController) { if (master) { var resolutionPlusOneList, resolutionPlusOneSmallest, resolutionPlusOneRep, leastPixelDiffRep, options = { @@ -11607,13 +11596,6 @@ }, lastBandwidthSelector = function() { var pixelRatio = this.useDevicePixelRatio && global_window__WEBPACK_IMPORTED_MODULE_0___default().devicePixelRatio || 1; return simpleSelector(this.playlists.master, this.systemBandwidth, parseInt(safeGetComputedStyle(this.tech_.el(), "width"), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), "height"), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_); - }, movingAverageBandwidthSelector = function(decay) { - var average = -1, lastSystemBandwidth = -1; - if (decay < 0 || decay > 1) throw Error("Moving average bandwidth decay must be between 0 and 1."); - return function() { - var pixelRatio = this.useDevicePixelRatio && global_window__WEBPACK_IMPORTED_MODULE_0___default().devicePixelRatio || 1; - return average < 0 && (average = this.systemBandwidth, lastSystemBandwidth = this.systemBandwidth), this.systemBandwidth > 0 && this.systemBandwidth !== lastSystemBandwidth && (average = decay * this.systemBandwidth + (1 - decay) * average, lastSystemBandwidth = this.systemBandwidth), simpleSelector(this.playlists.master, average, parseInt(safeGetComputedStyle(this.tech_.el(), "width"), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), "height"), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_); - }; }, minRebufferMaxBandwidthSelector = function(settings) { var master = settings.master, currentTime = settings.currentTime, bandwidth = settings.bandwidth, duration = settings.duration, segmentDuration = settings.segmentDuration, timeUntilRebuffer = settings.timeUntilRebuffer, currentTimeline = settings.currentTimeline, syncController = settings.syncController, compatiblePlaylists = master.playlists.filter(function(playlist) { return !Playlist.isIncompatible(playlist); @@ -11635,13 +11617,6 @@ }), noRebufferingPlaylists.length) ? noRebufferingPlaylists[0] : (stableSort(rebufferingEstimates, function(a, b) { return a.rebufferingImpact - b.rebufferingImpact; }), rebufferingEstimates[0] || null); - }, lowestBitrateCompatibleVariantSelector = function() { - var _this = this, playlists = this.playlists.master.playlists.filter(Playlist.isEnabled); - return stableSort(playlists, function(a, b) { - return comparePlaylistBandwidth(a, b); - }), playlists.filter(function(playlist) { - return !!codecsForPlaylist(_this.playlists.master, playlist).video; - })[0] || null; }, concatSegments = function(segmentObj) { var tempBuffer, offset = 0; return segmentObj.bytes && (tempBuffer = new Uint8Array(segmentObj.bytes), segmentObj.segments.forEach(function(segment) { @@ -12923,10 +12898,9 @@ var _this2 = this, segmentInfo = this.chooseNextRequest_(); if (segmentInfo) { if (null === this.syncController_.timestampOffsetForTimeline(segmentInfo.timeline)) { - var checkTimestampOffset = function() { + this.syncController_.one("timestampoffset", function() { _this2.state = "READY", _this2.paused() || _this2.monitorBuffer_(); - }; - this.syncController_.one("timestampoffset", checkTimestampOffset), this.state = "WAITING_ON_TIMELINE"; + }), this.state = "WAITING_ON_TIMELINE"; return; } this.loadSegment_(segmentInfo); @@ -14619,22 +14593,37 @@ return lastCalled = Date.now(), localOptions.getSource.call(player, setSource); }, cleanupEvents = function cleanupEvents() { player.off("loadedmetadata", loadedMetadataHandler), player.off("error", errorHandler), player.off("dispose", cleanupEvents); - }, reinitPlugin = function(newOptions) { + }; + player.on("error", errorHandler), player.on("dispose", cleanupEvents), player.reloadSourceOnError = function(newOptions) { cleanupEvents(), initPlugin(player, newOptions); }; - player.on("error", errorHandler), player.on("dispose", cleanupEvents), player.reloadSourceOnError = reinitPlugin; - }, reloadSourceOnError = function(options) { - initPlugin(this, options); }, version$4 = "2.12.0", Vhs = { PlaylistLoader: PlaylistLoader, Playlist: Playlist, utils: utils, STANDARD_PLAYLIST_SELECTOR: lastBandwidthSelector, - INITIAL_PLAYLIST_SELECTOR: lowestBitrateCompatibleVariantSelector, + INITIAL_PLAYLIST_SELECTOR: function() { + var _this = this, playlists = this.playlists.master.playlists.filter(Playlist.isEnabled); + return stableSort(playlists, function(a, b) { + return comparePlaylistBandwidth(a, b); + }), playlists.filter(function(playlist) { + return !!codecsForPlaylist(_this.playlists.master, playlist).video; + })[0] || null; + }, lastBandwidthSelector: lastBandwidthSelector, - movingAverageBandwidthSelector: movingAverageBandwidthSelector, + movingAverageBandwidthSelector: function(decay) { + var average = -1, lastSystemBandwidth = -1; + if (decay < 0 || decay > 1) throw Error("Moving average bandwidth decay must be between 0 and 1."); + return function() { + var pixelRatio = this.useDevicePixelRatio && global_window__WEBPACK_IMPORTED_MODULE_0___default().devicePixelRatio || 1; + return average < 0 && (average = this.systemBandwidth, lastSystemBandwidth = this.systemBandwidth), this.systemBandwidth > 0 && this.systemBandwidth !== lastSystemBandwidth && (average = decay * this.systemBandwidth + (1 - decay) * average, lastSystemBandwidth = this.systemBandwidth), simpleSelector(this.playlists.master, average, parseInt(safeGetComputedStyle(this.tech_.el(), "width"), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), "height"), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_); + }; + }, comparePlaylistBandwidth: comparePlaylistBandwidth, - comparePlaylistResolution: comparePlaylistResolution, + comparePlaylistResolution: function(left, right) { + var leftWidth, rightWidth; + return (left.attributes.RESOLUTION && left.attributes.RESOLUTION.width && (leftWidth = left.attributes.RESOLUTION.width), leftWidth = leftWidth || global_window__WEBPACK_IMPORTED_MODULE_0___default().Number.MAX_VALUE, right.attributes.RESOLUTION && right.attributes.RESOLUTION.width && (rightWidth = right.attributes.RESOLUTION.width), leftWidth === (rightWidth = rightWidth || global_window__WEBPACK_IMPORTED_MODULE_0___default().Number.MAX_VALUE) && left.attributes.BANDWIDTH && right.attributes.BANDWIDTH) ? left.attributes.BANDWIDTH - right.attributes.BANDWIDTH : leftWidth - rightWidth; + }, xhr: xhrFactory() }; Object.keys(Config).forEach(function(prop) { @@ -15174,7 +15163,9 @@ return videojs.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead."), Vhs; }, configurable: !0 - }), videojs.use || (videojs.registerComponent("Hls", Vhs), videojs.registerComponent("Vhs", Vhs)), videojs.options.vhs = videojs.options.vhs || {}, videojs.options.hls = videojs.options.hls || {}, videojs.getPlugin && videojs.getPlugin("reloadSourceOnError") || (videojs.registerPlugin || videojs.plugin)("reloadSourceOnError", reloadSourceOnError), __webpack_exports__.Z = videojs; + }), videojs.use || (videojs.registerComponent("Hls", Vhs), videojs.registerComponent("Vhs", Vhs)), videojs.options.vhs = videojs.options.vhs || {}, videojs.options.hls = videojs.options.hls || {}, videojs.getPlugin && videojs.getPlugin("reloadSourceOnError") || (videojs.registerPlugin || videojs.plugin)("reloadSourceOnError", function(options) { + initPlugin(this, options); + }), __webpack_exports__.Z = videojs; } } ]); diff --git a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js index 35e1e7a18618..fd14a60344f8 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js @@ -773,7 +773,8 @@ }, 779: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; - var url_toolkit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9945), url_toolkit__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(url_toolkit__WEBPACK_IMPORTED_MODULE_0__), global_window__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8908), global_window__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_1__), DEFAULT_LOCATION = "http://example.com", resolveUrl = function(baseUrl, relativeUrl) { + var url_toolkit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9945), url_toolkit__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(url_toolkit__WEBPACK_IMPORTED_MODULE_0__), global_window__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8908), global_window__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_1__), DEFAULT_LOCATION = "http://example.com"; + __webpack_exports__.Z = function(baseUrl, relativeUrl) { if (/^[a-z]+:/i.test(relativeUrl)) return relativeUrl; /^data:/.test(baseUrl) && (baseUrl = global_window__WEBPACK_IMPORTED_MODULE_1___default().location && global_window__WEBPACK_IMPORTED_MODULE_1___default().location.href || ""); var nativeURL = "function" == typeof global_window__WEBPACK_IMPORTED_MODULE_1___default().URL, protocolLess = /^\/\//.test(baseUrl), removeLocation = !global_window__WEBPACK_IMPORTED_MODULE_1___default().location && !/\/\//i.test(baseUrl); @@ -783,11 +784,11 @@ } return url_toolkit__WEBPACK_IMPORTED_MODULE_0___default().buildAbsoluteURL(baseUrl, relativeUrl); }; - __webpack_exports__.Z = resolveUrl; }, 3490: function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; - var window1 = __webpack_require__(8908), httpResponseHandler = function(callback, decodeResponseBody) { + var window1 = __webpack_require__(8908); + module.exports = function(callback, decodeResponseBody) { return void 0 === decodeResponseBody && (decodeResponseBody = !1), function(err, response, responseBody) { if (err) { callback(err); @@ -814,7 +815,6 @@ callback(null, responseBody); }; }; - module.exports = httpResponseHandler; }, 9603: function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -2617,11 +2617,7 @@ "BYTERANGE-START", "BYTERANGE-LENGTH" ].forEach(function(key) { - if (event.attributes.hasOwnProperty(key)) { - event.attributes[key] = parseInt(event.attributes[key], 10); - var subkey = "BYTERANGE-LENGTH" === key ? "length" : "offset"; - event.attributes.byterange = event.attributes.byterange || {}, event.attributes.byterange[subkey] = event.attributes[key], delete event.attributes[key]; - } + event.attributes.hasOwnProperty(key) && (event.attributes[key] = parseInt(event.attributes[key], 10), event.attributes.byterange = event.attributes.byterange || {}, event.attributes.byterange["BYTERANGE-LENGTH" === key ? "length" : "offset"] = event.attributes[key], delete event.attributes[key]); }), _this2.trigger("data", event); return; } @@ -2656,19 +2652,17 @@ }), !0; }); }, _proto.addTagMapper = function(_ref2) { - var expression = _ref2.expression, map = _ref2.map, mapFn = function(line) { + var expression = _ref2.expression, map = _ref2.map; + this.tagMappers.push(function(line) { return expression.test(line) ? map(line) : line; - }; - this.tagMappers.push(mapFn); + }); }, ParseStream; - }(Stream), camelCase = function(str) { - return str.toLowerCase().replace(/-(\w)/g, function(a) { - return a[1].toUpperCase(); - }); - }, camelCaseKeys = function(attributes) { + }(Stream), camelCaseKeys = function(attributes) { var result = {}; return Object.keys(attributes).forEach(function(key) { - result[camelCase(key)] = attributes[key]; + result[key.toLowerCase().replace(/-(\w)/g, function(a) { + return a[1].toUpperCase(); + })] = attributes[key]; }), result; }, setHoldBack = function(manifest) { var serverControl = manifest.serverControl, targetDuration = manifest.targetDuration, partTargetDuration = manifest.partTargetDuration; @@ -3599,7 +3593,7 @@ }; }, 4221: function(module) { - var parseSidx = function(data) { + module.exports = function(data) { var view = new DataView(data.buffer, data.byteOffset, data.byteLength), result = { version: data[0], flags: new Uint8Array(data.subarray(1, 4)), @@ -3619,10 +3613,9 @@ }); return result; }; - module.exports = parseSidx; }, 1489: function(module) { - var secondsToVideoTs, secondsToAudioTs, videoTsToSeconds, audioTsToSeconds, audioTsToVideoTs, videoTsToAudioTs, metadataTsToSeconds; + var secondsToVideoTs, secondsToAudioTs, videoTsToSeconds, audioTsToSeconds; secondsToVideoTs = function(seconds) { return 90000 * seconds; }, secondsToAudioTs = function(seconds, sampleRate) { @@ -3631,21 +3624,21 @@ return timestamp / 90000; }, audioTsToSeconds = function(timestamp, sampleRate) { return timestamp / sampleRate; - }, audioTsToVideoTs = function(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); - }, videoTsToAudioTs = function(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); - }, metadataTsToSeconds = function(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); }, module.exports = { ONE_SECOND_IN_TS: 90000, secondsToVideoTs: secondsToVideoTs, secondsToAudioTs: secondsToAudioTs, videoTsToSeconds: videoTsToSeconds, audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds + audioTsToVideoTs: function(timestamp, sampleRate) { + return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); + }, + videoTsToAudioTs: function(timestamp, sampleRate) { + return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); + }, + metadataTsToSeconds: function(timestamp, timelineStartPts, keepOriginalTimestamps) { + return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); + } }; }, 8581: function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { @@ -3665,7 +3658,7 @@ }); var jsx_runtime = __webpack_require__(5893), react = __webpack_require__(7294), Home_module = __webpack_require__(214), Home_module_default = __webpack_require__.n(Home_module), video_es = __webpack_require__(5215); __webpack_require__(3512); - var VideoJS = function(props) { + var components_VideoJS = function(props) { var videoRef = react.useRef(null), playerRef = react.useRef(null), options = props.options, onReady = props.onReady; return react.useEffect(function() { if (!playerRef.current) { @@ -3694,18 +3687,12 @@ }); }; function Home() { - var playerRef = (0, react.useRef)(null), handlePlayerReady = function(player) { - playerRef.current = player, player.on("waiting", function() { - console.log("player is waiting"); - }), player.on("dispose", function() { - console.log("player will dispose"); - }); - }; + var playerRef = (0, react.useRef)(null); return (0, jsx_runtime.jsx)("div", { className: Home_module_default().container, children: (0, jsx_runtime.jsx)("main", { className: Home_module_default().main, - children: (0, jsx_runtime.jsx)(VideoJS, { + children: (0, jsx_runtime.jsx)(components_VideoJS, { options: { autoplay: !0, controls: !0, @@ -3718,7 +3705,13 @@ } ] }, - onReady: handlePlayerReady + onReady: function(player) { + playerRef.current = player, player.on("waiting", function() { + console.log("player is waiting"); + }), player.on("dispose", function() { + console.log("player will dispose"); + }); + } }) }) }); diff --git a/crates/swc_ecma_minifier/tests/fixture/next/39538/static/chunks/pages/index-1bd068cedc2b5af3/output.js b/crates/swc_ecma_minifier/tests/fixture/next/39538/static/chunks/pages/index-1bd068cedc2b5af3/output.js index 3bec7e0f167e..2a6c94784c73 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/39538/static/chunks/pages/index-1bd068cedc2b5af3/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/39538/static/chunks/pages/index-1bd068cedc2b5af3/output.js @@ -469,10 +469,8 @@ return _react.useEffect(function() { if (hasIntersectionObserver) { if (unobserve.current && (unobserve.current(), unobserve.current = void 0), !isDisabled && !visible) { - var callback, ref, id, observer, elements; - return element && element.tagName && (unobserve.current = (callback = function(isVisible) { - return isVisible && setVisible(isVisible); - }, id = (ref = function(options) { + var ref, id, observer, elements; + return element && element.tagName && (unobserve.current = (id = (ref = function(options) { var instance, id = { root: options.root || null, margin: options.rootMargin || "" @@ -494,7 +492,9 @@ }({ root: null == rootRef ? void 0 : rootRef.current, rootMargin: rootMargin - })).id, observer = ref.observer, (elements = ref.elements).set(element, callback), observer.observe(element), function() { + })).id, observer = ref.observer, (elements = ref.elements).set(element, function(isVisible) { + return isVisible && setVisible(isVisible); + }), observer.observe(element), function() { if (elements.delete(element), observer.unobserve(element), 0 === elements.size) { observer.disconnect(), observers.delete(id); var index = idList.findIndex(function(obj) { diff --git a/crates/swc_ecma_minifier/tests/fixture/next/chakra/output.js b/crates/swc_ecma_minifier/tests/fixture/next/chakra/output.js index c714a73221b3..0bb4dafc83f0 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/chakra/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/chakra/output.js @@ -10,7 +10,7 @@ return _app; } }); - var initialState, state, listeners, setState, _lg$1, _md$1, _sm$1, _baseStyleRoot, _Input$baseStyle$fiel, _Input$baseStyle, _Input$variants$unsty$1, _xs, _sm, _md, _lg, _xl, _container2, _container3, _container4, _Input$variants$unsty, _Input$sizes$xs$field, _Input$sizes$sm$field, _Input$sizes$md$field, _Input$sizes$lg$field, jsx_runtime = __webpack_require__(5893), react = __webpack_require__(7294), emotion_react_browser_esm = __webpack_require__(917), CSSReset = function() { + var initialState, state, listeners, setState, _lg$1, _md$1, _sm$1, _baseStyleRoot, _Input$baseStyle$fiel, _Input$baseStyle, _Input$variants$unsty$1, _xs, _sm, _md, _lg, _xl, _container2, _container3, _container4, _Input$variants$unsty, _Input$sizes$xs$field, _Input$sizes$sm$field, _Input$sizes$md$field, _Input$sizes$lg$field, jsx_runtime = __webpack_require__(5893), react = __webpack_require__(7294), emotion_react_browser_esm = __webpack_require__(917), CSSReset$1 = function() { return react.createElement(emotion_react_browser_esm.xB, { styles: '\n html {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n font-family: system-ui, sans-serif;\n -webkit-font-smoothing: antialiased;\n text-rendering: optimizeLegibility;\n -moz-osx-font-smoothing: grayscale;\n touch-action: manipulation;\n }\n\n body {\n position: relative;\n min-height: 100%;\n font-feature-settings: \'kern\';\n }\n\n *,\n *::before,\n *::after {\n border-width: 0;\n border-style: solid;\n box-sizing: border-box;\n }\n\n main {\n display: block;\n }\n\n hr {\n border-top-width: 1px;\n box-sizing: content-box;\n height: 0;\n overflow: visible;\n }\n\n pre,\n code,\n kbd,\n samp {\n font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n font-size: 1em;\n }\n\n a {\n background-color: transparent;\n color: inherit;\n text-decoration: inherit;\n }\n\n abbr[title] {\n border-bottom: none;\n text-decoration: underline;\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n }\n\n b,\n strong {\n font-weight: bold;\n }\n\n small {\n font-size: 80%;\n }\n\n sub,\n sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n }\n\n sub {\n bottom: -0.25em;\n }\n\n sup {\n top: -0.5em;\n }\n\n img {\n border-style: none;\n }\n\n button,\n input,\n optgroup,\n select,\n textarea {\n font-family: inherit;\n font-size: 100%;\n line-height: 1.15;\n margin: 0;\n }\n\n button,\n input {\n overflow: visible;\n }\n\n button,\n select {\n text-transform: none;\n }\n\n button::-moz-focus-inner,\n [type="button"]::-moz-focus-inner,\n [type="reset"]::-moz-focus-inner,\n [type="submit"]::-moz-focus-inner {\n border-style: none;\n padding: 0;\n }\n\n fieldset {\n padding: 0.35em 0.75em 0.625em;\n }\n\n legend {\n box-sizing: border-box;\n color: inherit;\n display: table;\n max-width: 100%;\n padding: 0;\n white-space: normal;\n }\n\n progress {\n vertical-align: baseline;\n }\n\n textarea {\n overflow: auto;\n }\n\n [type="checkbox"],\n [type="radio"] {\n box-sizing: border-box;\n padding: 0;\n }\n\n [type="number"]::-webkit-inner-spin-button,\n [type="number"]::-webkit-outer-spin-button {\n -webkit-appearance: none !important;\n }\n\n input[type="number"] {\n -moz-appearance: textfield;\n }\n\n [type="search"] {\n -webkit-appearance: textfield;\n outline-offset: -2px;\n }\n\n [type="search"]::-webkit-search-decoration {\n -webkit-appearance: none !important;\n }\n\n ::-webkit-file-upload-button {\n -webkit-appearance: button;\n font: inherit;\n }\n\n details {\n display: block;\n }\n\n summary {\n display: list-item;\n }\n\n template {\n display: none;\n }\n\n [hidden] {\n display: none !important;\n }\n\n body,\n blockquote,\n dl,\n dd,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n hr,\n figure,\n p,\n pre {\n margin: 0;\n }\n\n button {\n background: transparent;\n padding: 0;\n }\n\n fieldset {\n margin: 0;\n padding: 0;\n }\n\n ol,\n ul {\n margin: 0;\n padding: 0;\n }\n\n textarea {\n resize: vertical;\n }\n\n button,\n [role="button"] {\n cursor: pointer;\n }\n\n button::-moz-focus-inner {\n border: 0 !important;\n }\n\n table {\n border-collapse: collapse;\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n\n button,\n input,\n optgroup,\n select,\n textarea {\n padding: 0;\n line-height: inherit;\n color: inherit;\n }\n\n img,\n svg,\n video,\n canvas,\n audio,\n iframe,\n embed,\n object {\n display: block;\n }\n\n img,\n video {\n max-width: 100%;\n height: auto;\n }\n\n [data-js-focus-visible] :focus:not([data-focus-visible-added]):not([data-focus-visible-disabled]) {\n outline: none;\n box-shadow: none;\n }\n\n select::-ms-expand {\n display: none;\n }\n ' }); @@ -225,7 +225,7 @@ }, react.createElement(chakra_ui_color_mode_esm.SG, { colorModeManager: colorModeManager, options: theme.config - }, (void 0 === _props$resetCSS || _props$resetCSS) && react.createElement(CSSReset, null), react.createElement(chakra_ui_system_esm.ZL, null), portalZIndex ? react.createElement(PortalManager, { + }, (void 0 === _props$resetCSS || _props$resetCSS) && react.createElement(CSSReset$1, null), react.createElement(chakra_ui_system_esm.ZL, null), portalZIndex ? react.createElement(PortalManager, { zIndex: portalZIndex }, _children) : _children)); }, spacing = { @@ -1492,60 +1492,7 @@ var theme = props.theme, c = props.colorScheme; return mode(getColor(theme, c + ".100", c), transparentize(c + ".200", 0.16)(theme))(props); } - var variantSubtle$1 = function(props) { - var c = props.colorScheme; - return { - container: { - bg: getBg(props) - }, - icon: { - color: mode(c + ".500", c + ".200")(props) - }, - spinner: { - color: mode(c + ".500", c + ".200")(props) - } - }; - }, variantLeftAccent = function(props) { - var c = props.colorScheme; - return { - container: { - paddingStart: 3, - borderStartWidth: "4px", - borderStartColor: mode(c + ".500", c + ".200")(props), - bg: getBg(props) - }, - icon: { - color: mode(c + ".500", c + ".200")(props) - }, - spinner: { - color: mode(c + ".500", c + ".200")(props) - } - }; - }, variantTopAccent = function(props) { - var c = props.colorScheme; - return { - container: { - pt: 2, - borderTopWidth: "4px", - borderTopColor: mode(c + ".500", c + ".200")(props), - bg: getBg(props) - }, - icon: { - color: mode(c + ".500", c + ".200")(props) - }, - spinner: { - color: mode(c + ".500", c + ".200")(props) - } - }; - }, variantSolid$3 = function(props) { - var c = props.colorScheme; - return { - container: { - bg: mode(c + ".500", c + ".200")(props), - color: mode("white", "gray.900")(props) - } - }; - }, Alert = { + var Alert = { parts: alertAnatomy.keys, baseStyle: { container: { @@ -1574,10 +1521,63 @@ } }, variants: { - subtle: variantSubtle$1, - "left-accent": variantLeftAccent, - "top-accent": variantTopAccent, - solid: variantSolid$3 + subtle: function(props) { + var c = props.colorScheme; + return { + container: { + bg: getBg(props) + }, + icon: { + color: mode(c + ".500", c + ".200")(props) + }, + spinner: { + color: mode(c + ".500", c + ".200")(props) + } + }; + }, + "left-accent": function(props) { + var c = props.colorScheme; + return { + container: { + paddingStart: 3, + borderStartWidth: "4px", + borderStartColor: mode(c + ".500", c + ".200")(props), + bg: getBg(props) + }, + icon: { + color: mode(c + ".500", c + ".200")(props) + }, + spinner: { + color: mode(c + ".500", c + ".200")(props) + } + }; + }, + "top-accent": function(props) { + var c = props.colorScheme; + return { + container: { + pt: 2, + borderTopWidth: "4px", + borderTopColor: mode(c + ".500", c + ".200")(props), + bg: getBg(props) + }, + icon: { + color: mode(c + ".500", c + ".200")(props) + }, + spinner: { + color: mode(c + ".500", c + ".200")(props) + } + }; + }, + solid: function(props) { + var c = props.colorScheme; + return { + container: { + bg: mode(c + ".500", c + ".200")(props), + color: mode("white", "gray.900")(props) + } + }; + } }, defaultProps: { variant: "subtle", @@ -1689,19 +1689,6 @@ borderColor: mode("white", "gray.800")(props), verticalAlign: "top" }; - }, baseStyle$B = function(props) { - return { - badge: { - transform: "translate(25%, 25%)", - borderRadius: "full", - border: "0.2em solid", - borderColor: mode("white", "gray.800")(props) - }, - excessLabel: { - bg: mode("gray.200", "whiteAlpha.400")(props) - }, - container: baseStyleContainer$3(props) - }; }; function getSize$3(size) { var themeSize = "100%" !== size ? sizes[size] : void 0; @@ -1732,7 +1719,20 @@ full: getSize$3("100%") }, Avatar = { parts: avatarAnatomy.keys, - baseStyle: baseStyle$B, + baseStyle: function(props) { + return { + badge: { + transform: "translate(25%, 25%)", + borderRadius: "full", + border: "0.2em solid", + borderColor: mode("white", "gray.800")(props) + }, + excessLabel: { + bg: mode("gray.200", "whiteAlpha.400")(props) + }, + container: baseStyleContainer$3(props) + }; + }, sizes: sizes$k, defaultProps: { size: "md" @@ -1813,15 +1813,6 @@ bg: mode(c + ".100", darkActiveBg)(props) } }; - }, variantOutline$1 = function(props) { - var c = props.colorScheme, borderColor = mode("gray.200", "whiteAlpha.300")(props); - return sizes_501602a9_esm_extends({ - border: "1px solid", - borderColor: "gray" === c ? borderColor : "currentColor", - ".chakra-button__group[data-attached] > &:not(:last-of-type)": { - marginEnd: "-1px" - } - }, variantGhost(props)); }, accessibleColorMap = { yellow: { bg: "yellow.400", @@ -1835,55 +1826,6 @@ hoverBg: "cyan.500", activeBg: "cyan.600" } - }, variantSolid$1 = function(props) { - var _accessibleColorMap$c, c = props.colorScheme; - if ("gray" === c) { - var _bg = mode("gray.100", "whiteAlpha.200")(props); - return { - bg: _bg, - _hover: { - bg: mode("gray.200", "whiteAlpha.300")(props), - _disabled: { - bg: _bg - } - }, - _active: { - bg: mode("gray.300", "whiteAlpha.400")(props) - } - }; - } - var _ref = null != (_accessibleColorMap$c = accessibleColorMap[c]) ? _accessibleColorMap$c : {}, _ref$bg = _ref.bg, _ref$color = _ref.color, _ref$hoverBg = _ref.hoverBg, _ref$activeBg = _ref.activeBg, background = mode(void 0 === _ref$bg ? c + ".500" : _ref$bg, c + ".200")(props); - return { - bg: background, - color: mode(void 0 === _ref$color ? "white" : _ref$color, "gray.800")(props), - _hover: { - bg: mode(void 0 === _ref$hoverBg ? c + ".600" : _ref$hoverBg, c + ".300")(props), - _disabled: { - bg: background - } - }, - _active: { - bg: mode(void 0 === _ref$activeBg ? c + ".700" : _ref$activeBg, c + ".400")(props) - } - }; - }, variantLink = function(props) { - var c = props.colorScheme; - return { - padding: 0, - height: "auto", - lineHeight: "normal", - verticalAlign: "baseline", - color: mode(c + ".500", c + ".200")(props), - _hover: { - textDecoration: "underline", - _disabled: { - textDecoration: "none" - } - }, - _active: { - color: mode(c + ".700", c + ".500")(props) - } - }; }, baseStyleControl$1 = function(props) { var c = props.colorScheme; return { @@ -1936,16 +1878,16 @@ }, baseStyleIcon$4 = { transitionProperty: "transform", transitionDuration: "normal" - }, baseStyle$x = function(props) { - return { - icon: baseStyleIcon$4, - container: baseStyleContainer$2, - control: baseStyleControl$1(props), - label: baseStyleLabel$3 - }; }, Checkbox = { parts: checkboxAnatomy.keys, - baseStyle: baseStyle$x, + baseStyle: function(props) { + return { + icon: baseStyleIcon$4, + container: baseStyleContainer$2, + control: baseStyleControl$1(props), + label: baseStyleLabel$3 + }; + }, sizes: { sm: { control: { @@ -1988,34 +1930,7 @@ size: "md", colorScheme: "blue" } - }, $size$1 = cssVar("close-button-size"), baseStyle$w = function(props) { - var hoverBg = mode("blackAlpha.100", "whiteAlpha.100")(props), activeBg = mode("blackAlpha.200", "whiteAlpha.200")(props); - return { - w: [ - $size$1.reference - ], - h: [ - $size$1.reference - ], - borderRadius: "md", - transitionProperty: "common", - transitionDuration: "normal", - _disabled: { - opacity: 0.4, - cursor: "not-allowed", - boxShadow: "none" - }, - _hover: { - bg: hoverBg - }, - _active: { - bg: activeBg - }, - _focusVisible: { - boxShadow: "outline" - } - }; - }, sizes$h = { + }, $size$1 = cssVar("close-button-size"), sizes$h = { lg: ((_lg$1 = {})[$size$1.variable] = "40px", _lg$1.fontSize = "16px", _lg$1), md: ((_md$1 = {})[$size$1.variable] = "32px", _md$1.fontSize = "12px", _md$1), sm: ((_sm$1 = {})[$size$1.variable] = "24px", _sm$1.fontSize = "10px", _sm$1) @@ -2056,24 +1971,6 @@ }, baseStyleFooter$2 = { px: 6, py: 4 - }, baseStyle$s = function(props) { - return { - overlay: baseStyleOverlay$1, - dialogContainer: baseStyleDialogContainer$1, - dialog: sizes_501602a9_esm_extends({}, props.isFullHeight && { - height: "100vh" - }, { - zIndex: "modal", - maxH: "100vh", - bg: mode("white", "gray.700")(props), - color: "inherit", - boxShadow: mode("lg", "dark-lg")(props) - }), - header: baseStyleHeader$2, - closeButton: baseStyleCloseButton$3, - body: baseStyleBody$2, - footer: baseStyleFooter$2 - }; }, sizes$g = { xs: getSize$2("xs"), sm: getSize$2("md"), @@ -2083,7 +1980,25 @@ full: getSize$2("full") }, Drawer = { parts: drawerAnatomy.keys, - baseStyle: baseStyle$s, + baseStyle: function(props) { + return { + overlay: baseStyleOverlay$1, + dialogContainer: baseStyleDialogContainer$1, + dialog: sizes_501602a9_esm_extends({}, props.isFullHeight && { + height: "100vh" + }, { + zIndex: "modal", + maxH: "100vh", + bg: mode("white", "gray.700")(props), + color: "inherit", + boxShadow: mode("lg", "dark-lg")(props) + }), + header: baseStyleHeader$2, + closeButton: baseStyleCloseButton$3, + body: baseStyleBody$2, + footer: baseStyleFooter$2 + }; + }, sizes: sizes$g, defaultProps: { size: "xs" @@ -2124,42 +2039,42 @@ } } } - }, baseStyle$q = function(props) { - return { - container: { - width: "100%", - position: "relative" - }, - requiredIndicator: { - marginStart: 1, - color: mode("red.500", "red.300")(props) - }, - helperText: { - mt: 2, - color: mode("gray.500", "whiteAlpha.600")(props), - lineHeight: "normal", - fontSize: "sm" - } - }; }, Form = { parts: formAnatomy.keys, - baseStyle: baseStyle$q - }, baseStyle$p = function(props) { - return { - text: { - color: mode("red.500", "red.300")(props), - mt: 2, - fontSize: "sm", - lineHeight: "normal" - }, - icon: { - marginEnd: "0.5em", - color: mode("red.500", "red.300")(props) - } - }; + baseStyle: function(props) { + return { + container: { + width: "100%", + position: "relative" + }, + requiredIndicator: { + marginStart: 1, + color: mode("red.500", "red.300")(props) + }, + helperText: { + mt: 2, + color: mode("gray.500", "whiteAlpha.600")(props), + lineHeight: "normal", + fontSize: "sm" + } + }; + } }, FormError = { parts: formErrorAnatomy.keys, - baseStyle: baseStyle$p + baseStyle: function(props) { + return { + text: { + color: mode("red.500", "red.300")(props), + mt: 2, + fontSize: "sm", + lineHeight: "normal" + }, + icon: { + marginEnd: "0.5em", + color: mode("red.500", "red.300")(props) + } + }; + } }, size = { lg: { fontSize: "lg", @@ -2210,103 +2125,7 @@ errorBorderColor: ec || mode("red.500", "red.300")(props) }; } - var variantOutline = function(props) { - var theme = props.theme, _getDefaults = getDefaults(props), fc = _getDefaults.focusBorderColor, ec = _getDefaults.errorBorderColor; - return { - field: { - border: "1px solid", - borderColor: "inherit", - bg: "inherit", - _hover: { - borderColor: mode("gray.300", "whiteAlpha.400")(props) - }, - _readOnly: { - boxShadow: "none !important", - userSelect: "all" - }, - _disabled: { - opacity: 0.4, - cursor: "not-allowed" - }, - _invalid: { - borderColor: getColor(theme, ec), - boxShadow: "0 0 0 1px " + getColor(theme, ec) - }, - _focusVisible: { - zIndex: 1, - borderColor: getColor(theme, fc), - boxShadow: "0 0 0 1px " + getColor(theme, fc) - } - }, - addon: { - border: "1px solid", - borderColor: mode("inherit", "whiteAlpha.50")(props), - bg: mode("gray.100", "whiteAlpha.300")(props) - } - }; - }, variantFilled = function(props) { - var theme = props.theme, _getDefaults2 = getDefaults(props), fc = _getDefaults2.focusBorderColor, ec = _getDefaults2.errorBorderColor; - return { - field: { - border: "2px solid", - borderColor: "transparent", - bg: mode("gray.100", "whiteAlpha.50")(props), - _hover: { - bg: mode("gray.200", "whiteAlpha.100")(props) - }, - _readOnly: { - boxShadow: "none !important", - userSelect: "all" - }, - _disabled: { - opacity: 0.4, - cursor: "not-allowed" - }, - _invalid: { - borderColor: getColor(theme, ec) - }, - _focusVisible: { - bg: "transparent", - borderColor: getColor(theme, fc) - } - }, - addon: { - border: "2px solid", - borderColor: "transparent", - bg: mode("gray.100", "whiteAlpha.50")(props) - } - }; - }, variantFlushed = function(props) { - var theme = props.theme, _getDefaults3 = getDefaults(props), fc = _getDefaults3.focusBorderColor, ec = _getDefaults3.errorBorderColor; - return { - field: { - borderBottom: "1px solid", - borderColor: "inherit", - borderRadius: 0, - px: 0, - bg: "transparent", - _readOnly: { - boxShadow: "none !important", - userSelect: "all" - }, - _invalid: { - borderColor: getColor(theme, ec), - boxShadow: "0px 1px 0px 0px " + getColor(theme, ec) - }, - _focusVisible: { - borderColor: getColor(theme, fc), - boxShadow: "0px 1px 0px 0px " + getColor(theme, fc) - } - }, - addon: { - borderBottom: "2px solid", - borderColor: "inherit", - borderRadius: 0, - px: 0, - bg: "transparent" - } - }; - }, Input = { + var Input = { parts: inputAnatomy.keys, baseStyle: { field: { @@ -2321,9 +2140,105 @@ }, sizes: sizes$e, variants: { - outline: variantOutline, - filled: variantFilled, - flushed: variantFlushed, + outline: function(props) { + var theme = props.theme, _getDefaults = getDefaults(props), fc = _getDefaults.focusBorderColor, ec = _getDefaults.errorBorderColor; + return { + field: { + border: "1px solid", + borderColor: "inherit", + bg: "inherit", + _hover: { + borderColor: mode("gray.300", "whiteAlpha.400")(props) + }, + _readOnly: { + boxShadow: "none !important", + userSelect: "all" + }, + _disabled: { + opacity: 0.4, + cursor: "not-allowed" + }, + _invalid: { + borderColor: getColor(theme, ec), + boxShadow: "0 0 0 1px " + getColor(theme, ec) + }, + _focusVisible: { + zIndex: 1, + borderColor: getColor(theme, fc), + boxShadow: "0 0 0 1px " + getColor(theme, fc) + } + }, + addon: { + border: "1px solid", + borderColor: mode("inherit", "whiteAlpha.50")(props), + bg: mode("gray.100", "whiteAlpha.300")(props) + } + }; + }, + filled: function(props) { + var theme = props.theme, _getDefaults2 = getDefaults(props), fc = _getDefaults2.focusBorderColor, ec = _getDefaults2.errorBorderColor; + return { + field: { + border: "2px solid", + borderColor: "transparent", + bg: mode("gray.100", "whiteAlpha.50")(props), + _hover: { + bg: mode("gray.200", "whiteAlpha.100")(props) + }, + _readOnly: { + boxShadow: "none !important", + userSelect: "all" + }, + _disabled: { + opacity: 0.4, + cursor: "not-allowed" + }, + _invalid: { + borderColor: getColor(theme, ec) + }, + _focusVisible: { + bg: "transparent", + borderColor: getColor(theme, fc) + } + }, + addon: { + border: "2px solid", + borderColor: "transparent", + bg: mode("gray.100", "whiteAlpha.50")(props) + } + }; + }, + flushed: function(props) { + var theme = props.theme, _getDefaults3 = getDefaults(props), fc = _getDefaults3.focusBorderColor, ec = _getDefaults3.errorBorderColor; + return { + field: { + borderBottom: "1px solid", + borderColor: "inherit", + borderRadius: 0, + px: 0, + bg: "transparent", + _readOnly: { + boxShadow: "none !important", + userSelect: "all" + }, + _invalid: { + borderColor: getColor(theme, ec), + boxShadow: "0px 1px 0px 0px " + getColor(theme, ec) + }, + _focusVisible: { + borderColor: getColor(theme, fc), + boxShadow: "0px 1px 0px 0px " + getColor(theme, fc) + } + }, + addon: { + borderBottom: "2px solid", + borderColor: "inherit", + borderRadius: 0, + px: 0, + bg: "transparent" + } + }; + }, unstyled: { field: { bg: "transparent", @@ -2341,18 +2256,6 @@ size: "md", variant: "outline" } - }, baseStyle$l = function(props) { - return { - bg: mode("gray.100", "whiteAlpha")(props), - borderRadius: "md", - borderWidth: "1px", - borderBottomWidth: "3px", - fontSize: "0.8em", - fontWeight: "bold", - lineHeight: "normal", - px: "0.4em", - whiteSpace: "nowrap" - }; }, List = { parts: listAnatomy.keys, baseStyle: { @@ -2380,46 +2283,46 @@ }, baseStyleButton = { transitionProperty: "common", transitionDuration: "normal" - }, baseStyle$i = function(props) { - return { - button: baseStyleButton, - list: { - bg: mode("#fff", "gray.700")(props), - boxShadow: mode("sm", "dark-lg")(props), - color: "inherit", - minW: "3xs", - py: "2", - zIndex: 1, - borderRadius: "md", - borderWidth: "1px" - }, - item: { - py: "0.4rem", - px: "0.8rem", - transitionProperty: "background", - transitionDuration: "ultra-fast", - transitionTimingFunction: "ease-in", - _focus: { - bg: mode("gray.100", "whiteAlpha.100")(props) - }, - _active: { - bg: mode("gray.200", "whiteAlpha.200")(props) - }, - _expanded: { - bg: mode("gray.100", "whiteAlpha.100")(props) - }, - _disabled: { - opacity: 0.4, - cursor: "not-allowed" - } - }, - groupTitle: baseStyleGroupTitle, - command: baseStyleCommand, - divider: baseStyleDivider - }; }, Menu = { parts: menuAnatomy.keys, - baseStyle: baseStyle$i + baseStyle: function(props) { + return { + button: baseStyleButton, + list: { + bg: mode("#fff", "gray.700")(props), + boxShadow: mode("sm", "dark-lg")(props), + color: "inherit", + minW: "3xs", + py: "2", + zIndex: 1, + borderRadius: "md", + borderWidth: "1px" + }, + item: { + py: "0.4rem", + px: "0.8rem", + transitionProperty: "background", + transitionDuration: "ultra-fast", + transitionTimingFunction: "ease-in", + _focus: { + bg: mode("gray.100", "whiteAlpha.100")(props) + }, + _active: { + bg: mode("gray.200", "whiteAlpha.200")(props) + }, + _expanded: { + bg: mode("gray.100", "whiteAlpha.100")(props) + }, + _disabled: { + opacity: 0.4, + cursor: "not-allowed" + } + }, + groupTitle: baseStyleGroupTitle, + command: baseStyleCommand, + divider: baseStyleDivider + }; + } }, baseStyleOverlay = { bg: "blackAlpha.600", zIndex: "modal" @@ -2446,27 +2349,6 @@ }, baseStyleFooter$1 = { px: 6, py: 4 - }, baseStyle$h = function(props) { - return { - overlay: baseStyleOverlay, - dialogContainer: { - display: "flex", - zIndex: "modal", - justifyContent: "center", - alignItems: props.isCentered ? "center" : "flex-start", - overflow: "inside" === props.scrollBehavior ? "hidden" : "auto" - }, - dialog: baseStyleDialog(props), - header: baseStyleHeader$1, - closeButton: baseStyleCloseButton$2, - body: { - px: 6, - py: 2, - flex: 1, - overflow: "inside" === props.scrollBehavior ? "auto" : void 0 - }, - footer: baseStyleFooter$1 - }; }; function getSize$1(value) { return "full" === value ? { @@ -2498,7 +2380,28 @@ full: getSize$1("full") }, Modal = { parts: modalAnatomy.keys, - baseStyle: baseStyle$h, + baseStyle: function(props) { + return { + overlay: baseStyleOverlay, + dialogContainer: { + display: "flex", + zIndex: "modal", + justifyContent: "center", + alignItems: props.isCentered ? "center" : "flex-start", + overflow: "inside" === props.scrollBehavior ? "hidden" : "auto" + }, + dialog: baseStyleDialog(props), + header: baseStyleHeader$1, + closeButton: baseStyleCloseButton$2, + body: { + px: 6, + py: 2, + flex: 1, + overflow: "inside" === props.scrollBehavior ? "auto" : void 0 + }, + footer: baseStyleFooter$1 + }; + }, sizes: sizes$d, defaultProps: { size: "md" @@ -2507,24 +2410,6 @@ width: [ $stepperWidth.reference ] - }, baseStyle$g = function(props) { - return { - root: baseStyleRoot$1, - field: baseStyleField$1, - stepperGroup: baseStyleStepperGroup, - stepper: { - borderStart: "1px solid", - borderStartColor: mode("inherit", "whiteAlpha.300")(props), - color: mode("inherit", "whiteAlpha.800")(props), - _active: { - bg: mode("gray.200", "whiteAlpha.300")(props) - }, - _disabled: { - opacity: 0.4, - cursor: "not-allowed" - } - } - }; }; function getSize(size) { var _sizeStyle$field$font, _sizeStyle$field, sizeStyle = Input.sizes[size], radius = { @@ -2558,7 +2443,25 @@ lg: getSize("lg") }, NumberInput = { parts: numberInputAnatomy.keys, - baseStyle: baseStyle$g, + baseStyle: function(props) { + return { + root: baseStyleRoot$1, + field: baseStyleField$1, + stepperGroup: baseStyleStepperGroup, + stepper: { + borderStart: "1px solid", + borderStartColor: mode("inherit", "whiteAlpha.300")(props), + color: mode("inherit", "whiteAlpha.800")(props), + _active: { + bg: mode("gray.200", "whiteAlpha.300")(props) + }, + _disabled: { + opacity: 0.4, + cursor: "not-allowed" + } + } + }; + }, sizes: sizes$c, variants: variants$5, defaultProps: defaultProps$b @@ -2603,19 +2506,19 @@ top: 1, insetEnd: 2, padding: 2 - }, baseStyle$e = function(props) { - return { - popper: baseStylePopper, - content: baseStyleContent(props), - header: baseStyleHeader, - body: baseStyleBody, - footer: baseStyleFooter, - arrow: {}, - closeButton: baseStyleCloseButton$1 - }; }, Popover = { parts: popoverAnatomy.keys, - baseStyle: baseStyle$e + baseStyle: function(props) { + return { + popper: baseStylePopper, + content: baseStyleContent(props), + header: baseStyleHeader, + body: baseStyleBody, + footer: baseStyleFooter, + arrow: {}, + closeButton: baseStyleCloseButton$1 + }; + } }, baseStyleLabel$2 = { lineHeight: "1", fontSize: "0.25em", @@ -2631,14 +2534,6 @@ } : { bgColor: bgColor }))); - }, baseStyle$d = function(props) { - return { - label: baseStyleLabel$2, - filledTrack: baseStyleFilledTrack$1(props), - track: { - bg: mode("gray.100", "whiteAlpha.300")(props) - } - }; }, Progress = { parts: progressAnatomy.keys, sizes: { @@ -2663,7 +2558,15 @@ } } }, - baseStyle: baseStyle$d, + baseStyle: function(props) { + return { + label: baseStyleLabel$2, + filledTrack: baseStyleFilledTrack$1(props), + track: { + bg: mode("gray.100", "whiteAlpha.300")(props) + } + }; + }, defaultProps: { size: "md", colorScheme: "blue" @@ -2684,15 +2587,15 @@ } }) }); - }, baseStyle$c = function(props) { - return { - label: Checkbox.baseStyle(props).label, - container: Checkbox.baseStyle(props).container, - control: baseStyleControl(props) - }; }, Radio = { parts: radioAnatomy.keys, - baseStyle: baseStyle$c, + baseStyle: function(props) { + return { + label: Checkbox.baseStyle(props).label, + container: Checkbox.baseStyle(props).container, + control: baseStyleControl(props) + }; + }, sizes: { md: { control: { @@ -2736,19 +2639,6 @@ _disabled: { opacity: 0.5 } - }, baseStyle$b = function(props) { - return { - field: sizes_501602a9_esm_extends({}, Input.baseStyle.field, { - bg: mode("white", "gray.700")(props), - appearance: "none", - paddingBottom: "1px", - lineHeight: "normal", - "> option, > optgroup": { - bg: mode("white", "gray.700")(props) - } - }), - icon: baseStyleIcon$1 - }; }, iconSpacing = { paddingInlineEnd: "2rem" }, sizes$8 = lodash_mergewith_default()({}, Input.sizes, { @@ -2769,41 +2659,23 @@ } }), Select = { parts: selectAnatomy.keys, - baseStyle: baseStyle$b, + baseStyle: function(props) { + return { + field: sizes_501602a9_esm_extends({}, Input.baseStyle.field, { + bg: mode("white", "gray.700")(props), + appearance: "none", + paddingBottom: "1px", + lineHeight: "normal", + "> option, > optgroup": { + bg: mode("white", "gray.700")(props) + } + }), + icon: baseStyleIcon$1 + }; + }, sizes: sizes$8, variants: Input.variants, defaultProps: Input.defaultProps - }, baseStyle$a = function(props) { - var defaultStartColor = mode("gray.100", "gray.800")(props), defaultEndColor = mode("gray.400", "gray.600")(props), _props$startColor = props.startColor, _props$endColor = props.endColor, speed = props.speed, theme = props.theme, start = getColor(theme, void 0 === _props$startColor ? defaultStartColor : _props$startColor), end = getColor(theme, void 0 === _props$endColor ? defaultEndColor : _props$endColor); - return { - opacity: 0.7, - borderRadius: "2px", - borderColor: start, - background: end, - animation: speed + "s linear infinite alternate " + (0, emotion_react_browser_esm.F4)({ - from: { - borderColor: start, - background: start - }, - to: { - borderColor: end, - background: end - } - }) - }; - }, baseStyle$9 = function(props) { - return { - borderRadius: "md", - fontWeight: "semibold", - _focusVisible: { - boxShadow: "outline", - padding: "1rem", - position: "fixed", - top: "1.5rem", - insetStart: "1.5rem", - bg: mode("white", "gray.700")(props) - } - }; }, baseStyleFilledTrack = function(props) { var c = props.colorScheme; return { @@ -2811,129 +2683,129 @@ height: "inherit", bg: mode(c + ".500", c + ".200")(props) }; - }, baseStyle$8 = function(props) { - return { - container: sizes_501602a9_esm_extends({ - display: "inline-block", - position: "relative", - cursor: "pointer", - _disabled: { - opacity: 0.6, - cursor: "default", - pointerEvents: "none" - } - }, orient({ - orientation: props.orientation, - vertical: { - h: "100%" - }, - horizontal: { - w: "100%" - } - })), - track: { - overflow: "hidden", - borderRadius: "sm", - bg: mode("gray.200", "whiteAlpha.200")(props), - _disabled: { - bg: mode("gray.300", "whiteAlpha.300")(props) - } + }, Slider = { + parts: sliderAnatomy.keys, + sizes: { + lg: function(props) { + return { + thumb: { + w: "16px", + h: "16px" + }, + track: orient({ + orientation: props.orientation, + horizontal: { + h: "4px" + }, + vertical: { + w: "4px" + } + }) + }; }, - thumb: sizes_501602a9_esm_extends({ - display: "flex", - alignItems: "center", - justifyContent: "center", - position: "absolute", - outline: 0, - zIndex: 1, - borderRadius: "full", - bg: "white", - boxShadow: "base", - border: "1px solid", - borderColor: "transparent", - transitionProperty: "transform", - transitionDuration: "normal", - _focusVisible: { - boxShadow: "outline" - }, - _disabled: { - bg: "gray.300" - } - }, orient({ - orientation: props.orientation, - vertical: { - left: "50%", - transform: "translateX(-50%)", - _active: { - transform: "translateX(-50%) scale(1.15)" + md: function(props) { + return { + thumb: { + w: "14px", + h: "14px" + }, + track: orient({ + orientation: props.orientation, + horizontal: { + h: "4px" + }, + vertical: { + w: "4px" + } + }) + }; + }, + sm: function(props) { + return { + thumb: { + w: "10px", + h: "10px" + }, + track: orient({ + orientation: props.orientation, + horizontal: { + h: "2px" + }, + vertical: { + w: "2px" + } + }) + }; + } + }, + baseStyle: function(props) { + return { + container: sizes_501602a9_esm_extends({ + display: "inline-block", + position: "relative", + cursor: "pointer", + _disabled: { + opacity: 0.6, + cursor: "default", + pointerEvents: "none" } - }, - horizontal: { - top: "50%", - transform: "translateY(-50%)", - _active: { - transform: "translateY(-50%) scale(1.15)" + }, orient({ + orientation: props.orientation, + vertical: { + h: "100%" + }, + horizontal: { + w: "100%" + } + })), + track: { + overflow: "hidden", + borderRadius: "sm", + bg: mode("gray.200", "whiteAlpha.200")(props), + _disabled: { + bg: mode("gray.300", "whiteAlpha.300")(props) } - } - })), - filledTrack: baseStyleFilledTrack(props) - }; - }, sizeLg = function(props) { - return { - thumb: { - w: "16px", - h: "16px" - }, - track: orient({ - orientation: props.orientation, - horizontal: { - h: "4px" - }, - vertical: { - w: "4px" - } - }) - }; - }, sizeMd = function(props) { - return { - thumb: { - w: "14px", - h: "14px" - }, - track: orient({ - orientation: props.orientation, - horizontal: { - h: "4px" - }, - vertical: { - w: "4px" - } - }) - }; - }, sizeSm = function(props) { - return { - thumb: { - w: "10px", - h: "10px" - }, - track: orient({ - orientation: props.orientation, - horizontal: { - h: "2px" }, - vertical: { - w: "2px" - } - }) - }; - }, Slider = { - parts: sliderAnatomy.keys, - sizes: { - lg: sizeLg, - md: sizeMd, - sm: sizeSm + thumb: sizes_501602a9_esm_extends({ + display: "flex", + alignItems: "center", + justifyContent: "center", + position: "absolute", + outline: 0, + zIndex: 1, + borderRadius: "full", + bg: "white", + boxShadow: "base", + border: "1px solid", + borderColor: "transparent", + transitionProperty: "transform", + transitionDuration: "normal", + _focusVisible: { + boxShadow: "outline" + }, + _disabled: { + bg: "gray.300" + } + }, orient({ + orientation: props.orientation, + vertical: { + left: "50%", + transform: "translateX(-50%)", + _active: { + transform: "translateX(-50%) scale(1.15)" + } + }, + horizontal: { + top: "50%", + transform: "translateY(-50%)", + _active: { + transform: "translateY(-50%) scale(1.15)" + } + } + })), + filledTrack: baseStyleFilledTrack(props) + }; }, - baseStyle: baseStyle$8, defaultProps: { size: "md", colorScheme: "blue" @@ -3028,13 +2900,6 @@ _checked: { transform: "translateX(" + $translateX.reference + ")" } - }, baseStyle$5 = function(props) { - var _rtl, _container; - return { - container: ((_container = {})[$diff.variable] = diffValue, _container[$translateX.variable] = $diff.reference, _container._rtl = ((_rtl = {})[$translateX.variable] = calc($diff).negate().toString(), _rtl), _container), - track: baseStyleTrack(props), - thumb: baseStyleThumb - }; }, sizes$4 = { sm: { container: ((_container2 = {})[$width.variable] = "1.375rem", _container2[$height.variable] = "0.75rem", _container2) @@ -3047,7 +2912,14 @@ } }, Switch = { parts: switchAnatomy.keys, - baseStyle: baseStyle$5, + baseStyle: function(props) { + var _rtl, _container; + return { + container: ((_container = {})[$diff.variable] = diffValue, _container[$translateX.variable] = $diff.reference, _container._rtl = ((_rtl = {})[$translateX.variable] = calc($diff).negate().toString(), _rtl), _container), + track: baseStyleTrack(props), + thumb: baseStyleThumb + }; + }, sizes: sizes$4, defaultProps: { size: "md", @@ -3057,69 +2929,6 @@ "&[data-is-numeric=true]": { textAlign: "end" } - }, variantSimple = function(props) { - var c = props.colorScheme; - return { - th: sizes_501602a9_esm_extends({ - color: mode("gray.600", "gray.400")(props), - borderBottom: "1px", - borderColor: mode(c + ".100", c + ".700")(props) - }, numericStyles), - td: sizes_501602a9_esm_extends({ - borderBottom: "1px", - borderColor: mode(c + ".100", c + ".700")(props) - }, numericStyles), - caption: { - color: mode("gray.600", "gray.100")(props) - }, - tfoot: { - tr: { - "&:last-of-type": { - th: { - borderBottomWidth: 0 - } - } - } - } - }; - }, variantStripe = function(props) { - var c = props.colorScheme; - return { - th: sizes_501602a9_esm_extends({ - color: mode("gray.600", "gray.400")(props), - borderBottom: "1px", - borderColor: mode(c + ".100", c + ".700")(props) - }, numericStyles), - td: sizes_501602a9_esm_extends({ - borderBottom: "1px", - borderColor: mode(c + ".100", c + ".700")(props) - }, numericStyles), - caption: { - color: mode("gray.600", "gray.100")(props) - }, - tbody: { - tr: { - "&:nth-of-type(odd)": { - "th, td": { - borderBottomWidth: "1px", - borderColor: mode(c + ".100", c + ".700")(props) - }, - td: { - background: mode(c + ".100", c + ".700")(props) - } - } - } - }, - tfoot: { - tr: { - "&:last-of-type": { - th: { - borderBottomWidth: 0 - } - } - } - } - }; }, Table = { parts: tableAnatomy.keys, baseStyle: { @@ -3146,8 +2955,71 @@ } }, variants: { - simple: variantSimple, - striped: variantStripe, + simple: function(props) { + var c = props.colorScheme; + return { + th: sizes_501602a9_esm_extends({ + color: mode("gray.600", "gray.400")(props), + borderBottom: "1px", + borderColor: mode(c + ".100", c + ".700")(props) + }, numericStyles), + td: sizes_501602a9_esm_extends({ + borderBottom: "1px", + borderColor: mode(c + ".100", c + ".700")(props) + }, numericStyles), + caption: { + color: mode("gray.600", "gray.100")(props) + }, + tfoot: { + tr: { + "&:last-of-type": { + th: { + borderBottomWidth: 0 + } + } + } + } + }; + }, + striped: function(props) { + var c = props.colorScheme; + return { + th: sizes_501602a9_esm_extends({ + color: mode("gray.600", "gray.400")(props), + borderBottom: "1px", + borderColor: mode(c + ".100", c + ".700")(props) + }, numericStyles), + td: sizes_501602a9_esm_extends({ + borderBottom: "1px", + borderColor: mode(c + ".100", c + ".700")(props) + }, numericStyles), + caption: { + color: mode("gray.600", "gray.100")(props) + }, + tbody: { + tr: { + "&:nth-of-type(odd)": { + "th, td": { + borderBottomWidth: "1px", + borderColor: mode(c + ".100", c + ".700")(props) + }, + td: { + background: mode(c + ".100", c + ".700")(props) + } + } + } + }, + tfoot: { + tr: { + "&:last-of-type": { + th: { + borderBottomWidth: 0 + } + } + } + } + }; + }, unstyled: {} }, sizes: { @@ -3224,116 +3096,30 @@ }; }, baseStyleTabpanel = { p: 4 - }, baseStyle$3 = function(props) { - return { - root: { - display: "vertical" === props.orientation ? "flex" : "block" - }, - tab: { - flex: props.isFitted ? 1 : void 0, - transitionProperty: "common", - transitionDuration: "normal", - _focusVisible: { - zIndex: 1, - boxShadow: "outline" - }, - _disabled: { - cursor: "not-allowed", - opacity: 0.4 - } - }, - tablist: baseStyleTablist(props), - tabpanel: baseStyleTabpanel - }; - }, variantLine = function(props) { - var _tablist, _tab, c = props.colorScheme, orientation = props.orientation, borderProp = "vertical" === orientation ? "borderStart" : "borderBottom", marginProp = "vertical" === orientation ? "marginStart" : "marginBottom"; - return { - tablist: ((_tablist = {})[borderProp] = "2px solid", _tablist.borderColor = "inherit", _tablist), - tab: ((_tab = {})[borderProp] = "2px solid", _tab.borderColor = "transparent", _tab[marginProp] = "-2px", _tab._selected = { - color: mode(c + ".600", c + ".300")(props), - borderColor: "currentColor" - }, _tab._active = { - bg: mode("gray.200", "whiteAlpha.300")(props) - }, _tab._disabled = { - _active: { - bg: "none" - } - }, _tab) - }; - }, variantEnclosed = function(props) { - var c = props.colorScheme; - return { - tab: { - borderTopRadius: "md", - border: "1px solid", - borderColor: "transparent", - mb: "-1px", - _selected: { - color: mode(c + ".600", c + ".300")(props), - borderColor: "inherit", - borderBottomColor: mode("white", "gray.800")(props) - } - }, - tablist: { - mb: "-1px", - borderBottom: "1px solid", - borderColor: "inherit" - } - }; - }, variantEnclosedColored = function(props) { - var c = props.colorScheme; - return { - tab: { - border: "1px solid", - borderColor: "inherit", - bg: mode("gray.50", "whiteAlpha.50")(props), - mb: "-1px", - _notLast: { - marginEnd: "-1px" - }, - _selected: { - bg: mode("#fff", "gray.800")(props), - color: mode(c + ".600", c + ".300")(props), - borderColor: "inherit", - borderTopColor: "currentColor", - borderBottomColor: "transparent" - } - }, - tablist: { - mb: "-1px", - borderBottom: "1px solid", - borderColor: "inherit" - } - }; - }, variantSoftRounded = function(props) { - var c = props.colorScheme, theme = props.theme; - return { - tab: { - borderRadius: "full", - fontWeight: "semibold", - color: "gray.600", - _selected: { - color: getColor(theme, c + ".700"), - bg: getColor(theme, c + ".100") - } - } - }; - }, variantSolidRounded = function(props) { - var c = props.colorScheme; - return { - tab: { - borderRadius: "full", - fontWeight: "semibold", - color: mode("gray.600", "inherit")(props), - _selected: { - color: mode("#fff", "gray.800")(props), - bg: mode(c + ".600", c + ".300")(props) - } - } - }; }, Tabs = { parts: tabsAnatomy.keys, - baseStyle: baseStyle$3, + baseStyle: function(props) { + return { + root: { + display: "vertical" === props.orientation ? "flex" : "block" + }, + tab: { + flex: props.isFitted ? 1 : void 0, + transitionProperty: "common", + transitionDuration: "normal", + _focusVisible: { + zIndex: 1, + boxShadow: "outline" + }, + _disabled: { + cursor: "not-allowed", + opacity: 0.4 + } + }, + tablist: baseStyleTablist(props), + tabpanel: baseStyleTabpanel + }; + }, sizes: { sm: { tab: { @@ -3358,11 +3144,97 @@ } }, variants: { - line: variantLine, - enclosed: variantEnclosed, - "enclosed-colored": variantEnclosedColored, - "soft-rounded": variantSoftRounded, - "solid-rounded": variantSolidRounded, + line: function(props) { + var _tablist, _tab, c = props.colorScheme, orientation = props.orientation, borderProp = "vertical" === orientation ? "borderStart" : "borderBottom"; + return { + tablist: ((_tablist = {})[borderProp] = "2px solid", _tablist.borderColor = "inherit", _tablist), + tab: ((_tab = {})[borderProp] = "2px solid", _tab.borderColor = "transparent", _tab["vertical" === orientation ? "marginStart" : "marginBottom"] = "-2px", _tab._selected = { + color: mode(c + ".600", c + ".300")(props), + borderColor: "currentColor" + }, _tab._active = { + bg: mode("gray.200", "whiteAlpha.300")(props) + }, _tab._disabled = { + _active: { + bg: "none" + } + }, _tab) + }; + }, + enclosed: function(props) { + var c = props.colorScheme; + return { + tab: { + borderTopRadius: "md", + border: "1px solid", + borderColor: "transparent", + mb: "-1px", + _selected: { + color: mode(c + ".600", c + ".300")(props), + borderColor: "inherit", + borderBottomColor: mode("white", "gray.800")(props) + } + }, + tablist: { + mb: "-1px", + borderBottom: "1px solid", + borderColor: "inherit" + } + }; + }, + "enclosed-colored": function(props) { + var c = props.colorScheme; + return { + tab: { + border: "1px solid", + borderColor: "inherit", + bg: mode("gray.50", "whiteAlpha.50")(props), + mb: "-1px", + _notLast: { + marginEnd: "-1px" + }, + _selected: { + bg: mode("#fff", "gray.800")(props), + color: mode(c + ".600", c + ".300")(props), + borderColor: "inherit", + borderTopColor: "currentColor", + borderBottomColor: "transparent" + } + }, + tablist: { + mb: "-1px", + borderBottom: "1px solid", + borderColor: "inherit" + } + }; + }, + "soft-rounded": function(props) { + var c = props.colorScheme, theme = props.theme; + return { + tab: { + borderRadius: "full", + fontWeight: "semibold", + color: "gray.600", + _selected: { + color: getColor(theme, c + ".700"), + bg: getColor(theme, c + ".100") + } + } + }; + }, + "solid-rounded": function(props) { + var c = props.colorScheme; + return { + tab: { + borderRadius: "full", + fontWeight: "semibold", + color: mode("gray.600", "inherit")(props), + _selected: { + color: mode("#fff", "gray.800")(props), + bg: mode(c + ".600", c + ".300")(props) + } + } + }; + }, unstyled: {} }, defaultProps: { @@ -3487,14 +3359,7 @@ sm: null != (_Input$sizes$sm$field = Input.sizes.sm.field) ? _Input$sizes$sm$field : {}, md: null != (_Input$sizes$md$field = Input.sizes.md.field) ? _Input$sizes$md$field : {}, lg: null != (_Input$sizes$lg$field = Input.sizes.lg.field) ? _Input$sizes$lg$field : {} - }, $bg = cssVar("tooltip-bg"), $arrowBg = cssVar("popper-arrow-bg"), baseStyle = function(props) { - var _ref, bg = mode("gray.700", "gray.300")(props); - return (_ref = {})[$bg.variable] = "colors." + bg, _ref.px = "8px", _ref.py = "2px", _ref.bg = [ - $bg.reference - ], _ref[$arrowBg.variable] = [ - $bg.reference - ], _ref.color = mode("whiteAlpha.900", "gray.900")(props), _ref.borderRadius = "sm", _ref.fontWeight = "medium", _ref.fontSize = "sm", _ref.boxShadow = "md", _ref.maxW = "320px", _ref.zIndex = "tooltip", _ref; - }, foundations = sizes_501602a9_esm_extends({ + }, $bg = cssVar("tooltip-bg"), $arrowBg = cssVar("popper-arrow-bg"), foundations = sizes_501602a9_esm_extends({ breakpoints: ((0, chakra_ui_utils_esm.ZK)({ condition: !0, message: "[chakra-ui]: createBreakpoints(...) will be deprecated pretty soonsimply pass the breakpoints as an object. Remove the createBreakpoint(..) call" @@ -3863,9 +3728,67 @@ }, variants: { ghost: variantGhost, - outline: variantOutline$1, - solid: variantSolid$1, - link: variantLink, + outline: function(props) { + var c = props.colorScheme, borderColor = mode("gray.200", "whiteAlpha.300")(props); + return sizes_501602a9_esm_extends({ + border: "1px solid", + borderColor: "gray" === c ? borderColor : "currentColor", + ".chakra-button__group[data-attached] > &:not(:last-of-type)": { + marginEnd: "-1px" + } + }, variantGhost(props)); + }, + solid: function(props) { + var _accessibleColorMap$c, c = props.colorScheme; + if ("gray" === c) { + var _bg = mode("gray.100", "whiteAlpha.200")(props); + return { + bg: _bg, + _hover: { + bg: mode("gray.200", "whiteAlpha.300")(props), + _disabled: { + bg: _bg + } + }, + _active: { + bg: mode("gray.300", "whiteAlpha.400")(props) + } + }; + } + var _ref = null != (_accessibleColorMap$c = accessibleColorMap[c]) ? _accessibleColorMap$c : {}, _ref$bg = _ref.bg, _ref$color = _ref.color, _ref$hoverBg = _ref.hoverBg, _ref$activeBg = _ref.activeBg, background = mode(void 0 === _ref$bg ? c + ".500" : _ref$bg, c + ".200")(props); + return { + bg: background, + color: mode(void 0 === _ref$color ? "white" : _ref$color, "gray.800")(props), + _hover: { + bg: mode(void 0 === _ref$hoverBg ? c + ".600" : _ref$hoverBg, c + ".300")(props), + _disabled: { + bg: background + } + }, + _active: { + bg: mode(void 0 === _ref$activeBg ? c + ".700" : _ref$activeBg, c + ".400")(props) + } + }; + }, + link: function(props) { + var c = props.colorScheme; + return { + padding: 0, + height: "auto", + lineHeight: "normal", + verticalAlign: "baseline", + color: mode(c + ".500", c + ".200")(props), + _hover: { + textDecoration: "underline", + _disabled: { + textDecoration: "none" + } + }, + _active: { + color: mode(c + ".700", c + ".500")(props) + } + }; + }, unstyled: { bg: "none", color: "inherit", @@ -3909,7 +3832,34 @@ }, Checkbox: Checkbox, CloseButton: { - baseStyle: baseStyle$w, + baseStyle: function(props) { + var hoverBg = mode("blackAlpha.100", "whiteAlpha.100")(props), activeBg = mode("blackAlpha.200", "whiteAlpha.200")(props); + return { + w: [ + $size$1.reference + ], + h: [ + $size$1.reference + ], + borderRadius: "md", + transitionProperty: "common", + transitionDuration: "normal", + _disabled: { + opacity: 0.4, + cursor: "not-allowed", + boxShadow: "none" + }, + _hover: { + bg: hoverBg + }, + _active: { + bg: activeBg + }, + _focusVisible: { + boxShadow: "outline" + } + }; + }, sizes: sizes$h, defaultProps: { size: "md" @@ -4045,7 +3995,19 @@ }, Input: Input, Kbd: { - baseStyle: baseStyle$l + baseStyle: function(props) { + return { + bg: mode("gray.100", "whiteAlpha")(props), + borderRadius: "md", + borderWidth: "1px", + borderBottomWidth: "3px", + fontSize: "0.8em", + fontWeight: "bold", + lineHeight: "normal", + px: "0.4em", + whiteSpace: "nowrap" + }; + } }, Link: { baseStyle: { @@ -4104,10 +4066,41 @@ Radio: Radio, Select: Select, Skeleton: { - baseStyle: baseStyle$a + baseStyle: function(props) { + var defaultStartColor = mode("gray.100", "gray.800")(props), defaultEndColor = mode("gray.400", "gray.600")(props), _props$startColor = props.startColor, _props$endColor = props.endColor, speed = props.speed, theme = props.theme, start = getColor(theme, void 0 === _props$startColor ? defaultStartColor : _props$startColor), end = getColor(theme, void 0 === _props$endColor ? defaultEndColor : _props$endColor); + return { + opacity: 0.7, + borderRadius: "2px", + borderColor: start, + background: end, + animation: speed + "s linear infinite alternate " + (0, emotion_react_browser_esm.F4)({ + from: { + borderColor: start, + background: start + }, + to: { + borderColor: end, + background: end + } + }) + }; + } }, SkipLink: { - baseStyle: baseStyle$9 + baseStyle: function(props) { + return { + borderRadius: "md", + fontWeight: "semibold", + _focusVisible: { + boxShadow: "outline", + padding: "1rem", + position: "fixed", + top: "1.5rem", + insetStart: "1.5rem", + bg: mode("white", "gray.700")(props) + } + }; + } }, Slider: Slider, Spinner: { @@ -4132,7 +4125,14 @@ } }, Tooltip: { - baseStyle: baseStyle + baseStyle: function(props) { + var _ref, bg = mode("gray.700", "gray.300")(props); + return (_ref = {})[$bg.variable] = "colors." + bg, _ref.px = "8px", _ref.py = "2px", _ref.bg = [ + $bg.reference + ], _ref[$arrowBg.variable] = [ + $bg.reference + ], _ref.color = mode("whiteAlpha.900", "gray.900")(props), _ref.borderRadius = "sm", _ref.fontWeight = "medium", _ref.fontSize = "sm", _ref.boxShadow = "md", _ref.maxW = "320px", _ref.zIndex = "tooltip", _ref; + } } }, styles: { @@ -4215,21 +4215,7 @@ return target; }).apply(this, arguments); } - var CheckIcon = function(props) { - return react.createElement(chakra_ui_icon_esm.JO, chakra_ui_alert_esm_extends({ - viewBox: "0 0 24 24" - }, props), react.createElement("path", { - fill: "currentColor", - d: "M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z" - })); - }, InfoIcon = function(props) { - return react.createElement(chakra_ui_icon_esm.JO, chakra_ui_alert_esm_extends({ - viewBox: "0 0 24 24" - }, props), react.createElement("path", { - fill: "currentColor", - d: "M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z" - })); - }, WarningIcon = function(props) { + var WarningIcon = function(props) { return react.createElement(chakra_ui_icon_esm.JO, chakra_ui_alert_esm_extends({ viewBox: "0 0 24 24" }, props), react.createElement("path", { @@ -4240,7 +4226,14 @@ "status" ], _createStylesContext = (0, chakra_ui_system_esm.eC)("Alert"), StylesProvider = _createStylesContext[0], useStyles = _createStylesContext[1], STATUSES = { info: { - icon: InfoIcon, + icon: function(props) { + return react.createElement(chakra_ui_icon_esm.JO, chakra_ui_alert_esm_extends({ + viewBox: "0 0 24 24" + }, props), react.createElement("path", { + fill: "currentColor", + d: "M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z" + })); + }, colorScheme: "blue" }, warning: { @@ -4248,7 +4241,14 @@ colorScheme: "orange" }, success: { - icon: CheckIcon, + icon: function(props) { + return react.createElement(chakra_ui_icon_esm.JO, chakra_ui_alert_esm_extends({ + viewBox: "0 0 24 24" + }, props), react.createElement("path", { + fill: "currentColor", + d: "M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z" + })); + }, colorScheme: "green" }, error: { @@ -4564,11 +4564,7 @@ }, [ duration ]); - var onMouseEnter = function() { - return setDelay(null); - }, onMouseLeave = function() { - return setDelay(duration); - }, close = function() { + var close = function() { isPresent && onRequestRemove(); }; react.useEffect(function() { @@ -4605,8 +4601,12 @@ initial: "initial", animate: "animate", exit: "exit", - onHoverStart: onMouseEnter, - onHoverEnd: onMouseLeave, + onHoverStart: function() { + return setDelay(null); + }, + onHoverEnd: function() { + return setDelay(duration); + }, custom: { position: position }, diff --git a/crates/swc_ecma_minifier/tests/fixture/next/feedback-3/579-dcac359116b2707c/output.js b/crates/swc_ecma_minifier/tests/fixture/next/feedback-3/579-dcac359116b2707c/output.js index cd1d2fdb002c..eac7aa43b216 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/feedback-3/579-dcac359116b2707c/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/feedback-3/579-dcac359116b2707c/output.js @@ -4,1305 +4,1300 @@ ], { 7029: function(t, e, r) { - var o; - r.g, o = function() { - return (()=>{ - var t = { - 873 (t) { - t.exports = function(t) { - if (void 0 === t) throw ReferenceError("this hasn't been initialised - super() hasn't been called"); - return t; - }, t.exports.default = t.exports, t.exports.__esModule = !0; - }, - 575 (t) { - t.exports = function(t, e) { - if (!(t instanceof e)) throw TypeError("Cannot call a class as a function"); - }, t.exports.default = t.exports, t.exports.__esModule = !0; - }, - 754 (t) { - function e(r) { - return t.exports = e = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { - return t.__proto__ || Object.getPrototypeOf(t); - }, t.exports.default = t.exports, t.exports.__esModule = !0, e(r); + r.g, t.exports = (()=>{ + var t = { + 873 (t) { + t.exports = function(t) { + if (void 0 === t) throw ReferenceError("this hasn't been initialised - super() hasn't been called"); + return t; + }, t.exports.default = t.exports, t.exports.__esModule = !0; + }, + 575 (t) { + t.exports = function(t, e) { + if (!(t instanceof e)) throw TypeError("Cannot call a class as a function"); + }, t.exports.default = t.exports, t.exports.__esModule = !0; + }, + 754 (t) { + function e(r) { + return t.exports = e = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { + return t.__proto__ || Object.getPrototypeOf(t); + }, t.exports.default = t.exports, t.exports.__esModule = !0, e(r); + } + t.exports = e, t.exports.default = t.exports, t.exports.__esModule = !0; + }, + 205 (t, e, r) { + var o = r(489); + t.exports = function(t, e) { + if ("function" != typeof e && null !== e) throw TypeError("Super expression must either be null or a function"); + t.prototype = Object.create(e && e.prototype, { + constructor: { + value: t, + writable: !0, + configurable: !0 + } + }), e && o(t, e); + }, t.exports.default = t.exports, t.exports.__esModule = !0; + }, + 585 (t, e, r) { + var o = r(8).default, n = r(873); + t.exports = function(t, e) { + return e && ("object" === o(e) || "function" == typeof e) ? e : n(t); + }, t.exports.default = t.exports, t.exports.__esModule = !0; + }, + 489 (t) { + function e(r, o) { + return t.exports = e = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, t; + }, t.exports.default = t.exports, t.exports.__esModule = !0, e(r, o); + } + t.exports = e, t.exports.default = t.exports, t.exports.__esModule = !0; + }, + 8 (t) { + function e(r) { + return "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? (t.exports = e = function(t) { + return typeof t; + }, t.exports.default = t.exports, t.exports.__esModule = !0) : (t.exports = e = function(t) { + return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t; + }, t.exports.default = t.exports, t.exports.__esModule = !0), e(r); + } + t.exports = e, t.exports.default = t.exports, t.exports.__esModule = !0; + }, + 924 (t, e, r) { + "use strict"; + var o = r(210), n = r(559), i = n(o("String.prototype.indexOf")); + t.exports = function(t, e) { + var r = o(t, !!e); + return "function" == typeof r && i(t, ".prototype.") > -1 ? n(r) : r; + }; + }, + 559 (t, e, r) { + "use strict"; + var o = r(612), n = r(210), i = n("%Function.prototype.apply%"), a = n("%Function.prototype.call%"), p = n("%Reflect.apply%", !0) || o.call(a, i), c = n("%Object.getOwnPropertyDescriptor%", !0), u = n("%Object.defineProperty%", !0), f = n("%Math.max%"); + if (u) try { + u({}, "a", { + value: 1 + }); + } catch (y) { + u = null; + } + t.exports = function(t) { + var e = p(o, a, arguments); + return c && u && c(e, "length").configurable && u(e, "length", { + value: 1 + f(0, t.length - (arguments.length - 1)) + }), e; + }; + var l = function() { + return p(o, i, arguments); + }; + u ? u(t.exports, "apply", { + value: l + }) : t.exports.apply = l; + }, + 729 (t) { + "use strict"; + var e = Object.prototype.hasOwnProperty, r = "~"; + function o() {} + function n(t, e, r) { + this.fn = t, this.context = e, this.once = r || !1; + } + function i(t, e, o, i, a) { + if ("function" != typeof o) throw TypeError("The listener must be a function"); + var p = new n(o, i || t, a), c = r ? r + e : e; + return t._events[c] ? t._events[c].fn ? t._events[c] = [ + t._events[c], + p + ] : t._events[c].push(p) : (t._events[c] = p, t._eventsCount++), t; + } + function a(t, e) { + 0 == --t._eventsCount ? t._events = new o : delete t._events[e]; + } + function p() { + this._events = new o, this._eventsCount = 0; + } + Object.create && (o.prototype = Object.create(null), (new o).__proto__ || (r = !1)), p.prototype.eventNames = function() { + var t, o, n = []; + if (0 === this._eventsCount) return n; + for(o in t = this._events)e.call(t, o) && n.push(r ? o.slice(1) : o); + return Object.getOwnPropertySymbols ? n.concat(Object.getOwnPropertySymbols(t)) : n; + }, p.prototype.listeners = function(t) { + var e = r ? r + t : t, o = this._events[e]; + if (!o) return []; + if (o.fn) return [ + o.fn + ]; + for(var n = 0, i = o.length, a = Array(i); n < i; n++)a[n] = o[n].fn; + return a; + }, p.prototype.listenerCount = function(t) { + var e = r ? r + t : t, o = this._events[e]; + return o ? o.fn ? 1 : o.length : 0; + }, p.prototype.emit = function(t, e, o, n, i, a) { + var p = r ? r + t : t; + if (!this._events[p]) return !1; + var c, u, f = this._events[p], y = arguments.length; + if (f.fn) { + switch(f.once && this.removeListener(t, f.fn, void 0, !0), y){ + case 1: + return f.fn.call(f.context), !0; + case 2: + return f.fn.call(f.context, e), !0; + case 3: + return f.fn.call(f.context, e, o), !0; + case 4: + return f.fn.call(f.context, e, o, n), !0; + case 5: + return f.fn.call(f.context, e, o, n, i), !0; + case 6: + return f.fn.call(f.context, e, o, n, i, a), !0; + } + for(u = 1, c = Array(y - 1); u < y; u++)c[u - 1] = arguments[u]; + f.fn.apply(f.context, c); + } else { + var l, s = f.length; + for(u = 0; u < s; u++)switch(f[u].once && this.removeListener(t, f[u].fn, void 0, !0), y){ + case 1: + f[u].fn.call(f[u].context); + break; + case 2: + f[u].fn.call(f[u].context, e); + break; + case 3: + f[u].fn.call(f[u].context, e, o); + break; + case 4: + f[u].fn.call(f[u].context, e, o, n); + break; + default: + if (!c) for(l = 1, c = Array(y - 1); l < y; l++)c[l - 1] = arguments[l]; + f[u].fn.apply(f[u].context, c); + } + } + return !0; + }, p.prototype.on = function(t, e, r) { + return i(this, t, e, r, !1); + }, p.prototype.once = function(t, e, r) { + return i(this, t, e, r, !0); + }, p.prototype.removeListener = function(t, e, o, n) { + var i = r ? r + t : t; + if (!this._events[i]) return this; + if (!e) return a(this, i), this; + var p = this._events[i]; + if (p.fn) p.fn !== e || n && !p.once || o && p.context !== o || a(this, i); + else { + for(var c = 0, u = [], f = p.length; c < f; c++)(p[c].fn !== e || n && !p[c].once || o && p[c].context !== o) && u.push(p[c]); + u.length ? this._events[i] = 1 === u.length ? u[0] : u : a(this, i); + } + return this; + }, p.prototype.removeAllListeners = function(t) { + var e; + return t ? (e = r ? r + t : t, this._events[e] && a(this, e)) : (this._events = new o, this._eventsCount = 0), this; + }, p.prototype.off = p.prototype.removeListener, p.prototype.addListener = p.prototype.on, p.prefixed = r, p.EventEmitter = p, t.exports = p; + }, + 648 (t) { + "use strict"; + var e = Array.prototype.slice, r = Object.prototype.toString; + t.exports = function(t) { + var o = this; + if ("function" != typeof o || "[object Function]" !== r.call(o)) throw TypeError("Function.prototype.bind called on incompatible " + o); + for(var n, i = e.call(arguments, 1), a = Math.max(0, o.length - i.length), p = [], c = 0; c < a; c++)p.push("$" + c); + if (n = Function("binder", "return function (" + p.join(",") + "){ return binder.apply(this,arguments); }")(function() { + if (this instanceof n) { + var r = o.apply(this, i.concat(e.call(arguments))); + return Object(r) === r ? r : this; + } + return o.apply(t, i.concat(e.call(arguments))); + }), o.prototype) { + var u = function() {}; + u.prototype = o.prototype, n.prototype = new u, u.prototype = null; + } + return n; + }; + }, + 612 (t, e, r) { + "use strict"; + var o = r(648); + t.exports = Function.prototype.bind || o; + }, + 210 (t, e, r) { + "use strict"; + var o, n = SyntaxError, i = Function, a = TypeError, p = function(t) { + try { + return i('"use strict"; return (' + t + ").constructor;")(); + } catch (e) {} + }, c = Object.getOwnPropertyDescriptor; + if (c) try { + c({}, ""); + } catch (u) { + c = null; + } + var f = function() { + throw new a; + }, y = c ? function() { + try { + return f; + } catch (e) { + try { + return c(arguments, "callee").get; + } catch (t) { + return f; + } + } + }() : f, l = r(405)(), s = Object.getPrototypeOf || function(t) { + return t.__proto__; + }, d = {}, b = "undefined" == typeof Uint8Array ? o : s(Uint8Array), g = { + "%AggregateError%": "undefined" == typeof AggregateError ? o : AggregateError, + "%Array%": Array, + "%ArrayBuffer%": "undefined" == typeof ArrayBuffer ? o : ArrayBuffer, + "%ArrayIteratorPrototype%": l ? s([][Symbol.iterator]()) : o, + "%AsyncFromSyncIteratorPrototype%": o, + "%AsyncFunction%": d, + "%AsyncGenerator%": d, + "%AsyncGeneratorFunction%": d, + "%AsyncIteratorPrototype%": d, + "%Atomics%": "undefined" == typeof Atomics ? o : Atomics, + "%BigInt%": "undefined" == typeof BigInt ? o : BigInt, + "%Boolean%": Boolean, + "%DataView%": "undefined" == typeof DataView ? o : DataView, + "%Date%": Date, + "%decodeURI%": decodeURI, + "%decodeURIComponent%": decodeURIComponent, + "%encodeURI%": encodeURI, + "%encodeURIComponent%": encodeURIComponent, + "%Error%": Error, + "%eval%": eval, + "%EvalError%": EvalError, + "%Float32Array%": "undefined" == typeof Float32Array ? o : Float32Array, + "%Float64Array%": "undefined" == typeof Float64Array ? o : Float64Array, + "%FinalizationRegistry%": "undefined" == typeof FinalizationRegistry ? o : FinalizationRegistry, + "%Function%": i, + "%GeneratorFunction%": d, + "%Int8Array%": "undefined" == typeof Int8Array ? o : Int8Array, + "%Int16Array%": "undefined" == typeof Int16Array ? o : Int16Array, + "%Int32Array%": "undefined" == typeof Int32Array ? o : Int32Array, + "%isFinite%": isFinite, + "%isNaN%": isNaN, + "%IteratorPrototype%": l ? s(s([][Symbol.iterator]())) : o, + "%JSON%": "object" == typeof JSON ? JSON : o, + "%Map%": "undefined" == typeof Map ? o : Map, + "%MapIteratorPrototype%": "undefined" != typeof Map && l ? s((new Map)[Symbol.iterator]()) : o, + "%Math%": Math, + "%Number%": Number, + "%Object%": Object, + "%parseFloat%": parseFloat, + "%parseInt%": parseInt, + "%Promise%": "undefined" == typeof Promise ? o : Promise, + "%Proxy%": "undefined" == typeof Proxy ? o : Proxy, + "%RangeError%": RangeError, + "%ReferenceError%": ReferenceError, + "%Reflect%": "undefined" == typeof Reflect ? o : Reflect, + "%RegExp%": RegExp, + "%Set%": "undefined" == typeof Set ? o : Set, + "%SetIteratorPrototype%": "undefined" != typeof Set && l ? s((new Set)[Symbol.iterator]()) : o, + "%SharedArrayBuffer%": "undefined" == typeof SharedArrayBuffer ? o : SharedArrayBuffer, + "%String%": String, + "%StringIteratorPrototype%": l ? s(""[Symbol.iterator]()) : o, + "%Symbol%": l ? Symbol : o, + "%SyntaxError%": n, + "%ThrowTypeError%": y, + "%TypedArray%": b, + "%TypeError%": a, + "%Uint8Array%": "undefined" == typeof Uint8Array ? o : Uint8Array, + "%Uint8ClampedArray%": "undefined" == typeof Uint8ClampedArray ? o : Uint8ClampedArray, + "%Uint16Array%": "undefined" == typeof Uint16Array ? o : Uint16Array, + "%Uint32Array%": "undefined" == typeof Uint32Array ? o : Uint32Array, + "%URIError%": URIError, + "%WeakMap%": "undefined" == typeof WeakMap ? o : WeakMap, + "%WeakRef%": "undefined" == typeof WeakRef ? o : WeakRef, + "%WeakSet%": "undefined" == typeof WeakSet ? o : WeakSet + }, h = function t(e) { + var r; + if ("%AsyncFunction%" === e) r = p("async function () {}"); + else if ("%GeneratorFunction%" === e) r = p("function* () {}"); + else if ("%AsyncGeneratorFunction%" === e) r = p("async function* () {}"); + else if ("%AsyncGenerator%" === e) { + var o = t("%AsyncGeneratorFunction%"); + o && (r = o.prototype); + } else if ("%AsyncIteratorPrototype%" === e) { + var n = t("%AsyncGenerator%"); + n && (r = s(n.prototype)); + } + return g[e] = r, r; + }, m = { + "%ArrayBufferPrototype%": [ + "ArrayBuffer", + "prototype" + ], + "%ArrayPrototype%": [ + "Array", + "prototype" + ], + "%ArrayProto_entries%": [ + "Array", + "prototype", + "entries" + ], + "%ArrayProto_forEach%": [ + "Array", + "prototype", + "forEach" + ], + "%ArrayProto_keys%": [ + "Array", + "prototype", + "keys" + ], + "%ArrayProto_values%": [ + "Array", + "prototype", + "values" + ], + "%AsyncFunctionPrototype%": [ + "AsyncFunction", + "prototype" + ], + "%AsyncGenerator%": [ + "AsyncGeneratorFunction", + "prototype" + ], + "%AsyncGeneratorPrototype%": [ + "AsyncGeneratorFunction", + "prototype", + "prototype" + ], + "%BooleanPrototype%": [ + "Boolean", + "prototype" + ], + "%DataViewPrototype%": [ + "DataView", + "prototype" + ], + "%DatePrototype%": [ + "Date", + "prototype" + ], + "%ErrorPrototype%": [ + "Error", + "prototype" + ], + "%EvalErrorPrototype%": [ + "EvalError", + "prototype" + ], + "%Float32ArrayPrototype%": [ + "Float32Array", + "prototype" + ], + "%Float64ArrayPrototype%": [ + "Float64Array", + "prototype" + ], + "%FunctionPrototype%": [ + "Function", + "prototype" + ], + "%Generator%": [ + "GeneratorFunction", + "prototype" + ], + "%GeneratorPrototype%": [ + "GeneratorFunction", + "prototype", + "prototype" + ], + "%Int8ArrayPrototype%": [ + "Int8Array", + "prototype" + ], + "%Int16ArrayPrototype%": [ + "Int16Array", + "prototype" + ], + "%Int32ArrayPrototype%": [ + "Int32Array", + "prototype" + ], + "%JSONParse%": [ + "JSON", + "parse" + ], + "%JSONStringify%": [ + "JSON", + "stringify" + ], + "%MapPrototype%": [ + "Map", + "prototype" + ], + "%NumberPrototype%": [ + "Number", + "prototype" + ], + "%ObjectPrototype%": [ + "Object", + "prototype" + ], + "%ObjProto_toString%": [ + "Object", + "prototype", + "toString" + ], + "%ObjProto_valueOf%": [ + "Object", + "prototype", + "valueOf" + ], + "%PromisePrototype%": [ + "Promise", + "prototype" + ], + "%PromiseProto_then%": [ + "Promise", + "prototype", + "then" + ], + "%Promise_all%": [ + "Promise", + "all" + ], + "%Promise_reject%": [ + "Promise", + "reject" + ], + "%Promise_resolve%": [ + "Promise", + "resolve" + ], + "%RangeErrorPrototype%": [ + "RangeError", + "prototype" + ], + "%ReferenceErrorPrototype%": [ + "ReferenceError", + "prototype" + ], + "%RegExpPrototype%": [ + "RegExp", + "prototype" + ], + "%SetPrototype%": [ + "Set", + "prototype" + ], + "%SharedArrayBufferPrototype%": [ + "SharedArrayBuffer", + "prototype" + ], + "%StringPrototype%": [ + "String", + "prototype" + ], + "%SymbolPrototype%": [ + "Symbol", + "prototype" + ], + "%SyntaxErrorPrototype%": [ + "SyntaxError", + "prototype" + ], + "%TypedArrayPrototype%": [ + "TypedArray", + "prototype" + ], + "%TypeErrorPrototype%": [ + "TypeError", + "prototype" + ], + "%Uint8ArrayPrototype%": [ + "Uint8Array", + "prototype" + ], + "%Uint8ClampedArrayPrototype%": [ + "Uint8ClampedArray", + "prototype" + ], + "%Uint16ArrayPrototype%": [ + "Uint16Array", + "prototype" + ], + "%Uint32ArrayPrototype%": [ + "Uint32Array", + "prototype" + ], + "%URIErrorPrototype%": [ + "URIError", + "prototype" + ], + "%WeakMapPrototype%": [ + "WeakMap", + "prototype" + ], + "%WeakSetPrototype%": [ + "WeakSet", + "prototype" + ] + }, v = r(612), S = r(642), A = v.call(Function.call, Array.prototype.concat), O = v.call(Function.apply, Array.prototype.splice), j = v.call(Function.call, String.prototype.replace), P = v.call(Function.call, String.prototype.slice), x = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, w = /\\(\\)?/g, E = function(t) { + var e = P(t, 0, 1), r = P(t, -1); + if ("%" === e && "%" !== r) throw new n("invalid intrinsic syntax, expected closing `%`"); + if ("%" === r && "%" !== e) throw new n("invalid intrinsic syntax, expected opening `%`"); + var o = []; + return j(t, x, function(t, e, r, n) { + o[o.length] = r ? j(n, w, "$1") : e || t; + }), o; + }, F = function(t, e) { + var r, o = t; + if (S(m, o) && (o = "%" + (r = m[o])[0] + "%"), S(g, o)) { + var i = g[o]; + if (i === d && (i = h(o)), void 0 === i && !e) throw new a("intrinsic " + t + " exists, but is not available. Please file an issue!"); + return { + alias: r, + name: o, + value: i + }; + } + throw new n("intrinsic " + t + " does not exist!"); + }; + t.exports = function(t, e) { + if ("string" != typeof t || 0 === t.length) throw new a("intrinsic name must be a non-empty string"); + if (arguments.length > 1 && "boolean" != typeof e) throw new a('"allowMissing" argument must be a boolean'); + var r = E(t), o = r.length > 0 ? r[0] : "", i = F("%" + o + "%", e), p = i.name, u = i.value, f = !1, y = i.alias; + y && (o = y[0], O(r, A([ + 0, + 1 + ], y))); + for(var l = 1, s = !0; l < r.length; l += 1){ + var d = r[l], b = P(d, 0, 1), h = P(d, -1); + if (('"' === b || "'" === b || "`" === b || '"' === h || "'" === h || "`" === h) && b !== h) throw new n("property names with quotes must have matching quotes"); + if ("constructor" !== d && s || (f = !0), S(g, p = "%" + (o += "." + d) + "%")) u = g[p]; + else if (null != u) { + if (!(d in u)) { + if (!e) throw new a("base intrinsic for " + t + " exists, but the property is not available."); + return; + } + if (c && l + 1 >= r.length) { + var m = c(u, d); + u = (s = !!m) && "get" in m && !("originalValue" in m.get) ? m.get : u[d]; + } else s = S(u, d), u = u[d]; + s && !f && (g[p] = u); + } + } + return u; + }; + }, + 405 (t, e, r) { + "use strict"; + var o = "undefined" != typeof Symbol && Symbol, n = r(419); + t.exports = function() { + return "function" == typeof o && "function" == typeof Symbol && "symbol" == typeof o("foo") && "symbol" == typeof Symbol("bar") && n(); + }; + }, + 419 (t) { + "use strict"; + t.exports = function() { + if ("function" != typeof Symbol || "function" != typeof Object.getOwnPropertySymbols) return !1; + if ("symbol" == typeof Symbol.iterator) return !0; + var t = {}, e = Symbol("test"), r = Object(e); + if ("string" == typeof e || "[object Symbol]" !== Object.prototype.toString.call(e) || "[object Symbol]" !== Object.prototype.toString.call(r)) return !1; + for(e in t[e] = 42, t)return !1; + if ("function" == typeof Object.keys && 0 !== Object.keys(t).length || "function" == typeof Object.getOwnPropertyNames && 0 !== Object.getOwnPropertyNames(t).length) return !1; + var o = Object.getOwnPropertySymbols(t); + if (1 !== o.length || o[0] !== e || !Object.prototype.propertyIsEnumerable.call(t, e)) return !1; + if ("function" == typeof Object.getOwnPropertyDescriptor) { + var n = Object.getOwnPropertyDescriptor(t, e); + if (42 !== n.value || !0 !== n.enumerable) return !1; } - t.exports = e, t.exports.default = t.exports, t.exports.__esModule = !0; - }, - 205 (t, e, r) { - var o = r(489); - t.exports = function(t, e) { - if ("function" != typeof e && null !== e) throw TypeError("Super expression must either be null or a function"); - t.prototype = Object.create(e && e.prototype, { - constructor: { - value: t, - writable: !0, - configurable: !0 - } - }), e && o(t, e); - }, t.exports.default = t.exports, t.exports.__esModule = !0; - }, - 585 (t, e, r) { - var o = r(8).default, n = r(873); - t.exports = function(t, e) { - return e && ("object" === o(e) || "function" == typeof e) ? e : n(t); - }, t.exports.default = t.exports, t.exports.__esModule = !0; - }, - 489 (t) { - function e(r, o) { - return t.exports = e = Object.setPrototypeOf || function(t, e) { - return t.__proto__ = e, t; - }, t.exports.default = t.exports, t.exports.__esModule = !0, e(r, o); + return !0; + }; + }, + 642 (t, e, r) { + "use strict"; + var o = r(612); + t.exports = o.call(Function.call, Object.prototype.hasOwnProperty); + }, + 631 (t, e, r) { + var o = "function" == typeof Map && Map.prototype, n = Object.getOwnPropertyDescriptor && o ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, i = o && n && "function" == typeof n.get ? n.get : null, a = o && Map.prototype.forEach, p = "function" == typeof Set && Set.prototype, c = Object.getOwnPropertyDescriptor && p ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, u = p && c && "function" == typeof c.get ? c.get : null, f = p && Set.prototype.forEach, y = "function" == typeof WeakMap && WeakMap.prototype ? WeakMap.prototype.has : null, l = "function" == typeof WeakSet && WeakSet.prototype ? WeakSet.prototype.has : null, s = "function" == typeof WeakRef && WeakRef.prototype ? WeakRef.prototype.deref : null, d = Boolean.prototype.valueOf, b = Object.prototype.toString, g = Function.prototype.toString, h = String.prototype.match, m = "function" == typeof BigInt ? BigInt.prototype.valueOf : null, v = Object.getOwnPropertySymbols, S = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? Symbol.prototype.toString : null, A = "function" == typeof Symbol && "object" == typeof Symbol.iterator, O = Object.prototype.propertyIsEnumerable, j = ("function" == typeof Reflect ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(t) { + return t.__proto__; + } : null), P = r(794).custom, x = P && I(P) ? P : null, w = "function" == typeof Symbol && void 0 !== Symbol.toStringTag ? Symbol.toStringTag : null; + function E(t, e, r) { + var o = "double" === (r.quoteStyle || e) ? '"' : "'"; + return o + t + o; + } + function F(t) { + return !("[object Array]" !== R(t) || w && "object" == typeof t && w in t); + } + function I(t) { + if (A) return t && "object" == typeof t && t instanceof Symbol; + if ("symbol" == typeof t) return !0; + if (!t || "object" != typeof t || !S) return !1; + try { + return S.call(t), !0; + } catch (e) {} + return !1; + } + t.exports = function t(e, r, o, n) { + var p = r || {}; + if (_(p, "quoteStyle") && "single" !== p.quoteStyle && "double" !== p.quoteStyle) throw TypeError('option "quoteStyle" must be "single" or "double"'); + if (_(p, "maxStringLength") && ("number" == typeof p.maxStringLength ? p.maxStringLength < 0 && p.maxStringLength !== 1 / 0 : null !== p.maxStringLength)) throw TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`'); + var c = !_(p, "customInspect") || p.customInspect; + if ("boolean" != typeof c && "symbol" !== c) throw TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`"); + if (_(p, "indent") && null !== p.indent && "\t" !== p.indent && !(parseInt(p.indent, 10) === p.indent && p.indent > 0)) throw TypeError('options "indent" must be "\\t", an integer > 0, or `null`'); + if (void 0 === e) return "undefined"; + if (null === e) return "null"; + if ("boolean" == typeof e) return e ? "true" : "false"; + if ("string" == typeof e) return function t(e, r) { + if (e.length > r.maxStringLength) { + var o = e.length - r.maxStringLength; + return t(e.slice(0, r.maxStringLength), r) + "... " + o + " more character" + (o > 1 ? "s" : ""); + } + return E(e.replace(/(['\\])/g, "\\$1").replace(/[\x00-\x1f]/g, U), "single", r); + }(e, p); + if ("number" == typeof e) return 0 === e ? 1 / 0 / e > 0 ? "0" : "-0" : String(e); + if ("bigint" == typeof e) return String(e) + "n"; + var b = void 0 === p.depth ? 5 : p.depth; + if (void 0 === o && (o = 0), o >= b && b > 0 && "object" == typeof e) return F(e) ? "[Array]" : "[Object]"; + var v = function(t, e) { + var r; + if ("\t" === t.indent) r = "\t"; + else { + if (!("number" == typeof t.indent && t.indent > 0)) return null; + r = Array(t.indent + 1).join(" "); + } + return { + base: r, + prev: Array(e + 1).join(r) + }; + }(p, o); + if (void 0 === n) n = []; + else if (M(n, e) >= 0) return "[Circular]"; + function O(e, r, i) { + if (r && (n = n.slice()).push(r), i) { + var a = { + depth: p.depth + }; + return _(p, "quoteStyle") && (a.quoteStyle = p.quoteStyle), t(e, a, o + 1, n); + } + return t(e, p, o + 1, n); } - t.exports = e, t.exports.default = t.exports, t.exports.__esModule = !0; - }, - 8 (t) { - function e(r) { - return "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? (t.exports = e = function(t) { - return typeof t; - }, t.exports.default = t.exports, t.exports.__esModule = !0) : (t.exports = e = function(t) { - return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t; - }, t.exports.default = t.exports, t.exports.__esModule = !0), e(r); + if ("function" == typeof e) { + var P = function(t) { + if (t.name) return t.name; + var e = h.call(g.call(t), /^function\s*([\w$]+)/); + return e ? e[1] : null; + }(e), k = C(e, O); + return "[Function" + (P ? ": " + P : " (anonymous)") + "]" + (k.length > 0 ? " { " + k.join(", ") + " }" : ""); } - t.exports = e, t.exports.default = t.exports, t.exports.__esModule = !0; - }, - 924 (t, e, r) { - "use strict"; - var o = r(210), n = r(559), i = n(o("String.prototype.indexOf")); - t.exports = function(t, e) { - var r = o(t, !!e); - return "function" == typeof r && i(t, ".prototype.") > -1 ? n(r) : r; - }; - }, - 559 (t, e, r) { - "use strict"; - var o = r(612), n = r(210), i = n("%Function.prototype.apply%"), a = n("%Function.prototype.call%"), p = n("%Reflect.apply%", !0) || o.call(a, i), c = n("%Object.getOwnPropertyDescriptor%", !0), u = n("%Object.defineProperty%", !0), f = n("%Math.max%"); - if (u) try { - u({}, "a", { - value: 1 - }); - } catch (y) { - u = null; + if (I(e)) { + var W = A ? String(e).replace(/^(Symbol\(.*\))_[^)]*$/, "$1") : S.call(e); + return "object" != typeof e || A ? W : N(W); } - t.exports = function(t) { - var e = p(o, a, arguments); - return c && u && c(e, "length").configurable && u(e, "length", { - value: 1 + f(0, t.length - (arguments.length - 1)) - }), e; - }; - var l = function() { - return p(o, i, arguments); - }; - u ? u(t.exports, "apply", { - value: l - }) : t.exports.apply = l; - }, - 729 (t) { - "use strict"; - var e = Object.prototype.hasOwnProperty, r = "~"; - function o() {} - function n(t, e, r) { - this.fn = t, this.context = e, this.once = r || !1; + if (e && "object" == typeof e && ("undefined" != typeof HTMLElement && e instanceof HTMLElement || "string" == typeof e.nodeName && "function" == typeof e.getAttribute)) { + for(var G = "<" + String(e.nodeName).toLowerCase(), z = e.attributes || [], L = 0; L < z.length; L++)G += " " + z[L].name + "=" + E(String(z[L].value).replace(/"/g, """), "double", p); + return G += ">", e.childNodes && e.childNodes.length && (G += "..."), G + ""; } - function i(t, e, o, i, a) { - if ("function" != typeof o) throw TypeError("The listener must be a function"); - var p = new n(o, i || t, a), c = r ? r + e : e; - return t._events[c] ? t._events[c].fn ? t._events[c] = [ - t._events[c], - p - ] : t._events[c].push(p) : (t._events[c] = p, t._eventsCount++), t; + if (F(e)) { + if (0 === e.length) return "[]"; + var V = C(e, O); + return v && !function(t) { + for(var e = 0; e < t.length; e++)if (M(t[e], "\n") >= 0) return !1; + return !0; + }(V) ? "[" + T(V, v) + "]" : "[ " + V.join(", ") + " ]"; } - function a(t, e) { - 0 == --t._eventsCount ? t._events = new o : delete t._events[e]; + if (!("[object Error]" !== R(e) || w && "object" == typeof e && w in e)) { + var $ = C(e, O); + return 0 === $.length ? "[" + String(e) + "]" : "{ [" + String(e) + "] " + $.join(", ") + " }"; } - function p() { - this._events = new o, this._eventsCount = 0; + if ("object" == typeof e && c) { + if (x && "function" == typeof e[x]) return e[x](); + if ("symbol" !== c && "function" == typeof e.inspect) return e.inspect(); } - Object.create && (o.prototype = Object.create(null), (new o).__proto__ || (r = !1)), p.prototype.eventNames = function() { - var t, o, n = []; - if (0 === this._eventsCount) return n; - for(o in t = this._events)e.call(t, o) && n.push(r ? o.slice(1) : o); - return Object.getOwnPropertySymbols ? n.concat(Object.getOwnPropertySymbols(t)) : n; - }, p.prototype.listeners = function(t) { - var e = r ? r + t : t, o = this._events[e]; - if (!o) return []; - if (o.fn) return [ - o.fn - ]; - for(var n = 0, i = o.length, a = Array(i); n < i; n++)a[n] = o[n].fn; - return a; - }, p.prototype.listenerCount = function(t) { - var e = r ? r + t : t, o = this._events[e]; - return o ? o.fn ? 1 : o.length : 0; - }, p.prototype.emit = function(t, e, o, n, i, a) { - var p = r ? r + t : t; - if (!this._events[p]) return !1; - var c, u, f = this._events[p], y = arguments.length; - if (f.fn) { - switch(f.once && this.removeListener(t, f.fn, void 0, !0), y){ - case 1: - return f.fn.call(f.context), !0; - case 2: - return f.fn.call(f.context, e), !0; - case 3: - return f.fn.call(f.context, e, o), !0; - case 4: - return f.fn.call(f.context, e, o, n), !0; - case 5: - return f.fn.call(f.context, e, o, n, i), !0; - case 6: - return f.fn.call(f.context, e, o, n, i, a), !0; - } - for(u = 1, c = Array(y - 1); u < y; u++)c[u - 1] = arguments[u]; - f.fn.apply(f.context, c); - } else { - var l, s = f.length; - for(u = 0; u < s; u++)switch(f[u].once && this.removeListener(t, f[u].fn, void 0, !0), y){ - case 1: - f[u].fn.call(f[u].context); - break; - case 2: - f[u].fn.call(f[u].context, e); - break; - case 3: - f[u].fn.call(f[u].context, e, o); - break; - case 4: - f[u].fn.call(f[u].context, e, o, n); - break; - default: - if (!c) for(l = 1, c = Array(y - 1); l < y; l++)c[l - 1] = arguments[l]; - f[u].fn.apply(f[u].context, c); - } - } - return !0; - }, p.prototype.on = function(t, e, r) { - return i(this, t, e, r, !1); - }, p.prototype.once = function(t, e, r) { - return i(this, t, e, r, !0); - }, p.prototype.removeListener = function(t, e, o, n) { - var i = r ? r + t : t; - if (!this._events[i]) return this; - if (!e) return a(this, i), this; - var p = this._events[i]; - if (p.fn) p.fn !== e || n && !p.once || o && p.context !== o || a(this, i); - else { - for(var c = 0, u = [], f = p.length; c < f; c++)(p[c].fn !== e || n && !p[c].once || o && p[c].context !== o) && u.push(p[c]); - u.length ? this._events[i] = 1 === u.length ? u[0] : u : a(this, i); - } - return this; - }, p.prototype.removeAllListeners = function(t) { - var e; - return t ? (e = r ? r + t : t, this._events[e] && a(this, e)) : (this._events = new o, this._eventsCount = 0), this; - }, p.prototype.off = p.prototype.removeListener, p.prototype.addListener = p.prototype.on, p.prefixed = r, p.EventEmitter = p, t.exports = p; - }, - 648 (t) { - "use strict"; - var e = Array.prototype.slice, r = Object.prototype.toString; - t.exports = function(t) { - var o = this; - if ("function" != typeof o || "[object Function]" !== r.call(o)) throw TypeError("Function.prototype.bind called on incompatible " + o); - for(var n, i = e.call(arguments, 1), a = function() { - if (this instanceof n) { - var r = o.apply(this, i.concat(e.call(arguments))); - return Object(r) === r ? r : this; + if (function(t) { + if (!i || !t || "object" != typeof t) return !1; + try { + i.call(t); + try { + u.call(t); + } catch (e) { + return !0; } - return o.apply(t, i.concat(e.call(arguments))); - }, p = Math.max(0, o.length - i.length), c = [], u = 0; u < p; u++)c.push("$" + u); - if (n = Function("binder", "return function (" + c.join(",") + "){ return binder.apply(this,arguments); }")(a), o.prototype) { - var f = function() {}; - f.prototype = o.prototype, n.prototype = new f, f.prototype = null; - } - return n; - }; - }, - 612 (t, e, r) { - "use strict"; - var o = r(648); - t.exports = Function.prototype.bind || o; - }, - 210 (t, e, r) { - "use strict"; - var o, n = SyntaxError, i = Function, a = TypeError, p = function(t) { + return t instanceof Map; + } catch (r) {} + return !1; + }(e)) { + var J = []; + return a.call(e, function(t, r) { + J.push(O(r, e, !0) + " => " + O(t, e)); + }), D("Map", i.call(e), J, v); + } + if (function(t) { + if (!u || !t || "object" != typeof t) return !1; try { - return i('"use strict"; return (' + t + ").constructor;")(); - } catch (e) {} - }, c = Object.getOwnPropertyDescriptor; - if (c) try { - c({}, ""); - } catch (u) { - c = null; + u.call(t); + try { + i.call(t); + } catch (e) { + return !0; + } + return t instanceof Set; + } catch (r) {} + return !1; + }(e)) { + var H = []; + return f.call(e, function(t) { + H.push(O(t, e)); + }), D("Set", u.call(e), H, v); } - var f = function() { - throw new a; - }, y = c ? function() { + if (function(t) { + if (!y || !t || "object" != typeof t) return !1; try { - return f; - } catch (e) { + y.call(t, y); try { - return c(arguments, "callee").get; - } catch (t) { - return f; + l.call(t, l); + } catch (e) { + return !0; } - } - }() : f, l = r(405)(), s = Object.getPrototypeOf || function(t) { - return t.__proto__; - }, d = {}, b = "undefined" == typeof Uint8Array ? o : s(Uint8Array), g = { - "%AggregateError%": "undefined" == typeof AggregateError ? o : AggregateError, - "%Array%": Array, - "%ArrayBuffer%": "undefined" == typeof ArrayBuffer ? o : ArrayBuffer, - "%ArrayIteratorPrototype%": l ? s([][Symbol.iterator]()) : o, - "%AsyncFromSyncIteratorPrototype%": o, - "%AsyncFunction%": d, - "%AsyncGenerator%": d, - "%AsyncGeneratorFunction%": d, - "%AsyncIteratorPrototype%": d, - "%Atomics%": "undefined" == typeof Atomics ? o : Atomics, - "%BigInt%": "undefined" == typeof BigInt ? o : BigInt, - "%Boolean%": Boolean, - "%DataView%": "undefined" == typeof DataView ? o : DataView, - "%Date%": Date, - "%decodeURI%": decodeURI, - "%decodeURIComponent%": decodeURIComponent, - "%encodeURI%": encodeURI, - "%encodeURIComponent%": encodeURIComponent, - "%Error%": Error, - "%eval%": eval, - "%EvalError%": EvalError, - "%Float32Array%": "undefined" == typeof Float32Array ? o : Float32Array, - "%Float64Array%": "undefined" == typeof Float64Array ? o : Float64Array, - "%FinalizationRegistry%": "undefined" == typeof FinalizationRegistry ? o : FinalizationRegistry, - "%Function%": i, - "%GeneratorFunction%": d, - "%Int8Array%": "undefined" == typeof Int8Array ? o : Int8Array, - "%Int16Array%": "undefined" == typeof Int16Array ? o : Int16Array, - "%Int32Array%": "undefined" == typeof Int32Array ? o : Int32Array, - "%isFinite%": isFinite, - "%isNaN%": isNaN, - "%IteratorPrototype%": l ? s(s([][Symbol.iterator]())) : o, - "%JSON%": "object" == typeof JSON ? JSON : o, - "%Map%": "undefined" == typeof Map ? o : Map, - "%MapIteratorPrototype%": "undefined" != typeof Map && l ? s((new Map)[Symbol.iterator]()) : o, - "%Math%": Math, - "%Number%": Number, - "%Object%": Object, - "%parseFloat%": parseFloat, - "%parseInt%": parseInt, - "%Promise%": "undefined" == typeof Promise ? o : Promise, - "%Proxy%": "undefined" == typeof Proxy ? o : Proxy, - "%RangeError%": RangeError, - "%ReferenceError%": ReferenceError, - "%Reflect%": "undefined" == typeof Reflect ? o : Reflect, - "%RegExp%": RegExp, - "%Set%": "undefined" == typeof Set ? o : Set, - "%SetIteratorPrototype%": "undefined" != typeof Set && l ? s((new Set)[Symbol.iterator]()) : o, - "%SharedArrayBuffer%": "undefined" == typeof SharedArrayBuffer ? o : SharedArrayBuffer, - "%String%": String, - "%StringIteratorPrototype%": l ? s(""[Symbol.iterator]()) : o, - "%Symbol%": l ? Symbol : o, - "%SyntaxError%": n, - "%ThrowTypeError%": y, - "%TypedArray%": b, - "%TypeError%": a, - "%Uint8Array%": "undefined" == typeof Uint8Array ? o : Uint8Array, - "%Uint8ClampedArray%": "undefined" == typeof Uint8ClampedArray ? o : Uint8ClampedArray, - "%Uint16Array%": "undefined" == typeof Uint16Array ? o : Uint16Array, - "%Uint32Array%": "undefined" == typeof Uint32Array ? o : Uint32Array, - "%URIError%": URIError, - "%WeakMap%": "undefined" == typeof WeakMap ? o : WeakMap, - "%WeakRef%": "undefined" == typeof WeakRef ? o : WeakRef, - "%WeakSet%": "undefined" == typeof WeakSet ? o : WeakSet - }, h = function t(e) { - var r; - if ("%AsyncFunction%" === e) r = p("async function () {}"); - else if ("%GeneratorFunction%" === e) r = p("function* () {}"); - else if ("%AsyncGeneratorFunction%" === e) r = p("async function* () {}"); - else if ("%AsyncGenerator%" === e) { - var o = t("%AsyncGeneratorFunction%"); - o && (r = o.prototype); - } else if ("%AsyncIteratorPrototype%" === e) { - var n = t("%AsyncGenerator%"); - n && (r = s(n.prototype)); - } - return g[e] = r, r; - }, m = { - "%ArrayBufferPrototype%": [ - "ArrayBuffer", - "prototype" - ], - "%ArrayPrototype%": [ - "Array", - "prototype" - ], - "%ArrayProto_entries%": [ - "Array", - "prototype", - "entries" - ], - "%ArrayProto_forEach%": [ - "Array", - "prototype", - "forEach" - ], - "%ArrayProto_keys%": [ - "Array", - "prototype", - "keys" - ], - "%ArrayProto_values%": [ - "Array", - "prototype", - "values" - ], - "%AsyncFunctionPrototype%": [ - "AsyncFunction", - "prototype" - ], - "%AsyncGenerator%": [ - "AsyncGeneratorFunction", - "prototype" - ], - "%AsyncGeneratorPrototype%": [ - "AsyncGeneratorFunction", - "prototype", - "prototype" - ], - "%BooleanPrototype%": [ - "Boolean", - "prototype" - ], - "%DataViewPrototype%": [ - "DataView", - "prototype" - ], - "%DatePrototype%": [ - "Date", - "prototype" - ], - "%ErrorPrototype%": [ - "Error", - "prototype" - ], - "%EvalErrorPrototype%": [ - "EvalError", - "prototype" - ], - "%Float32ArrayPrototype%": [ - "Float32Array", - "prototype" - ], - "%Float64ArrayPrototype%": [ - "Float64Array", - "prototype" - ], - "%FunctionPrototype%": [ - "Function", - "prototype" - ], - "%Generator%": [ - "GeneratorFunction", - "prototype" - ], - "%GeneratorPrototype%": [ - "GeneratorFunction", - "prototype", - "prototype" - ], - "%Int8ArrayPrototype%": [ - "Int8Array", - "prototype" - ], - "%Int16ArrayPrototype%": [ - "Int16Array", - "prototype" - ], - "%Int32ArrayPrototype%": [ - "Int32Array", - "prototype" - ], - "%JSONParse%": [ - "JSON", - "parse" - ], - "%JSONStringify%": [ - "JSON", - "stringify" - ], - "%MapPrototype%": [ - "Map", - "prototype" - ], - "%NumberPrototype%": [ - "Number", - "prototype" - ], - "%ObjectPrototype%": [ - "Object", - "prototype" - ], - "%ObjProto_toString%": [ - "Object", - "prototype", - "toString" - ], - "%ObjProto_valueOf%": [ - "Object", - "prototype", - "valueOf" - ], - "%PromisePrototype%": [ - "Promise", - "prototype" - ], - "%PromiseProto_then%": [ - "Promise", - "prototype", - "then" - ], - "%Promise_all%": [ - "Promise", - "all" - ], - "%Promise_reject%": [ - "Promise", - "reject" - ], - "%Promise_resolve%": [ - "Promise", - "resolve" - ], - "%RangeErrorPrototype%": [ - "RangeError", - "prototype" - ], - "%ReferenceErrorPrototype%": [ - "ReferenceError", - "prototype" - ], - "%RegExpPrototype%": [ - "RegExp", - "prototype" - ], - "%SetPrototype%": [ - "Set", - "prototype" - ], - "%SharedArrayBufferPrototype%": [ - "SharedArrayBuffer", - "prototype" - ], - "%StringPrototype%": [ - "String", - "prototype" - ], - "%SymbolPrototype%": [ - "Symbol", - "prototype" - ], - "%SyntaxErrorPrototype%": [ - "SyntaxError", - "prototype" - ], - "%TypedArrayPrototype%": [ - "TypedArray", - "prototype" - ], - "%TypeErrorPrototype%": [ - "TypeError", - "prototype" - ], - "%Uint8ArrayPrototype%": [ - "Uint8Array", - "prototype" - ], - "%Uint8ClampedArrayPrototype%": [ - "Uint8ClampedArray", - "prototype" - ], - "%Uint16ArrayPrototype%": [ - "Uint16Array", - "prototype" - ], - "%Uint32ArrayPrototype%": [ - "Uint32Array", - "prototype" - ], - "%URIErrorPrototype%": [ - "URIError", - "prototype" - ], - "%WeakMapPrototype%": [ - "WeakMap", - "prototype" - ], - "%WeakSetPrototype%": [ - "WeakSet", - "prototype" - ] - }, v = r(612), S = r(642), A = v.call(Function.call, Array.prototype.concat), O = v.call(Function.apply, Array.prototype.splice), j = v.call(Function.call, String.prototype.replace), P = v.call(Function.call, String.prototype.slice), x = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, w = /\\(\\)?/g, E = function(t) { - var e = P(t, 0, 1), r = P(t, -1); - if ("%" === e && "%" !== r) throw new n("invalid intrinsic syntax, expected closing `%`"); - if ("%" === r && "%" !== e) throw new n("invalid intrinsic syntax, expected opening `%`"); - var o = []; - return j(t, x, function(t, e, r, n) { - o[o.length] = r ? j(n, w, "$1") : e || t; - }), o; - }, F = function(t, e) { - var r, o = t; - if (S(m, o) && (o = "%" + (r = m[o])[0] + "%"), S(g, o)) { - var i = g[o]; - if (i === d && (i = h(o)), void 0 === i && !e) throw new a("intrinsic " + t + " exists, but is not available. Please file an issue!"); - return { - alias: r, - name: o, - value: i - }; - } - throw new n("intrinsic " + t + " does not exist!"); - }; - t.exports = function(t, e) { - if ("string" != typeof t || 0 === t.length) throw new a("intrinsic name must be a non-empty string"); - if (arguments.length > 1 && "boolean" != typeof e) throw new a('"allowMissing" argument must be a boolean'); - var r = E(t), o = r.length > 0 ? r[0] : "", i = F("%" + o + "%", e), p = i.name, u = i.value, f = !1, y = i.alias; - y && (o = y[0], O(r, A([ - 0, - 1 - ], y))); - for(var l = 1, s = !0; l < r.length; l += 1){ - var d = r[l], b = P(d, 0, 1), h = P(d, -1); - if (('"' === b || "'" === b || "`" === b || '"' === h || "'" === h || "`" === h) && b !== h) throw new n("property names with quotes must have matching quotes"); - if ("constructor" !== d && s || (f = !0), S(g, p = "%" + (o += "." + d) + "%")) u = g[p]; - else if (null != u) { - if (!(d in u)) { - if (!e) throw new a("base intrinsic for " + t + " exists, but the property is not available."); - return; - } - if (c && l + 1 >= r.length) { - var m = c(u, d); - u = (s = !!m) && "get" in m && !("originalValue" in m.get) ? m.get : u[d]; - } else s = S(u, d), u = u[d]; - s && !f && (g[p] = u); + return t instanceof WeakMap; + } catch (r) {} + return !1; + }(e)) return B("WeakMap"); + if (function(t) { + if (!l || !t || "object" != typeof t) return !1; + try { + l.call(t, l); + try { + y.call(t, y); + } catch (e) { + return !0; } - } - return u; - }; - }, - 405 (t, e, r) { - "use strict"; - var o = "undefined" != typeof Symbol && Symbol, n = r(419); - t.exports = function() { - return "function" == typeof o && "function" == typeof Symbol && "symbol" == typeof o("foo") && "symbol" == typeof Symbol("bar") && n(); - }; - }, - 419 (t) { - "use strict"; - t.exports = function() { - if ("function" != typeof Symbol || "function" != typeof Object.getOwnPropertySymbols) return !1; - if ("symbol" == typeof Symbol.iterator) return !0; - var t = {}, e = Symbol("test"), r = Object(e); - if ("string" == typeof e || "[object Symbol]" !== Object.prototype.toString.call(e) || "[object Symbol]" !== Object.prototype.toString.call(r)) return !1; - for(e in t[e] = 42, t)return !1; - if ("function" == typeof Object.keys && 0 !== Object.keys(t).length || "function" == typeof Object.getOwnPropertyNames && 0 !== Object.getOwnPropertyNames(t).length) return !1; - var o = Object.getOwnPropertySymbols(t); - if (1 !== o.length || o[0] !== e || !Object.prototype.propertyIsEnumerable.call(t, e)) return !1; - if ("function" == typeof Object.getOwnPropertyDescriptor) { - var n = Object.getOwnPropertyDescriptor(t, e); - if (42 !== n.value || !0 !== n.enumerable) return !1; - } - return !0; - }; - }, - 642 (t, e, r) { - "use strict"; - var o = r(612); - t.exports = o.call(Function.call, Object.prototype.hasOwnProperty); - }, - 631 (t, e, r) { - var o = "function" == typeof Map && Map.prototype, n = Object.getOwnPropertyDescriptor && o ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, i = o && n && "function" == typeof n.get ? n.get : null, a = o && Map.prototype.forEach, p = "function" == typeof Set && Set.prototype, c = Object.getOwnPropertyDescriptor && p ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, u = p && c && "function" == typeof c.get ? c.get : null, f = p && Set.prototype.forEach, y = "function" == typeof WeakMap && WeakMap.prototype ? WeakMap.prototype.has : null, l = "function" == typeof WeakSet && WeakSet.prototype ? WeakSet.prototype.has : null, s = "function" == typeof WeakRef && WeakRef.prototype ? WeakRef.prototype.deref : null, d = Boolean.prototype.valueOf, b = Object.prototype.toString, g = Function.prototype.toString, h = String.prototype.match, m = "function" == typeof BigInt ? BigInt.prototype.valueOf : null, v = Object.getOwnPropertySymbols, S = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? Symbol.prototype.toString : null, A = "function" == typeof Symbol && "object" == typeof Symbol.iterator, O = Object.prototype.propertyIsEnumerable, j = ("function" == typeof Reflect ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(t) { - return t.__proto__; - } : null), P = r(794).custom, x = P && I(P) ? P : null, w = "function" == typeof Symbol && void 0 !== Symbol.toStringTag ? Symbol.toStringTag : null; - function E(t, e, r) { - var o = "double" === (r.quoteStyle || e) ? '"' : "'"; - return o + t + o; - } - function F(t) { - return !("[object Array]" !== R(t) || w && "object" == typeof t && w in t); - } - function I(t) { - if (A) return t && "object" == typeof t && t instanceof Symbol; - if ("symbol" == typeof t) return !0; - if (!t || "object" != typeof t || !S) return !1; + return t instanceof WeakSet; + } catch (r) {} + return !1; + }(e)) return B("WeakSet"); + if (function(t) { + if (!s || !t || "object" != typeof t) return !1; + try { + return s.call(t), !0; + } catch (e) {} + return !1; + }(e)) return B("WeakRef"); + if (!("[object Number]" !== R(e) || w && "object" == typeof e && w in e)) return N(O(Number(e))); + if (function(t) { + if (!t || "object" != typeof t || !m) return !1; try { - return S.call(t), !0; + return m.call(t), !0; } catch (e) {} return !1; + }(e)) return N(O(m.call(e))); + if (!("[object Boolean]" !== R(e) || w && "object" == typeof e && w in e)) return N(d.call(e)); + if (!("[object String]" !== R(e) || w && "object" == typeof e && w in e)) return N(O(String(e))); + if (("[object Date]" !== R(e) || w && "object" == typeof e && w in e) && ("[object RegExp]" !== R(e) || w && "object" == typeof e && w in e)) { + var q = C(e, O), Q = j ? j(e) === Object.prototype : e instanceof Object || e.constructor === Object, Z = e instanceof Object ? "" : "null prototype", K = !Q && w && Object(e) === e && w in e ? R(e).slice(8, -1) : Z ? "Object" : "", X = (Q || "function" != typeof e.constructor ? "" : e.constructor.name ? e.constructor.name + " " : "") + (K || Z ? "[" + [].concat(K || [], Z || []).join(": ") + "] " : ""); + return 0 === q.length ? X + "{}" : v ? X + "{" + T(q, v) + "}" : X + "{ " + q.join(", ") + " }"; } - t.exports = function t(e, r, o, n) { - var p = r || {}; - if (_(p, "quoteStyle") && "single" !== p.quoteStyle && "double" !== p.quoteStyle) throw TypeError('option "quoteStyle" must be "single" or "double"'); - if (_(p, "maxStringLength") && ("number" == typeof p.maxStringLength ? p.maxStringLength < 0 && p.maxStringLength !== 1 / 0 : null !== p.maxStringLength)) throw TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`'); - var c = !_(p, "customInspect") || p.customInspect; - if ("boolean" != typeof c && "symbol" !== c) throw TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`"); - if (_(p, "indent") && null !== p.indent && "\t" !== p.indent && !(parseInt(p.indent, 10) === p.indent && p.indent > 0)) throw TypeError('options "indent" must be "\\t", an integer > 0, or `null`'); - if (void 0 === e) return "undefined"; - if (null === e) return "null"; - if ("boolean" == typeof e) return e ? "true" : "false"; - if ("string" == typeof e) return function t(e, r) { - if (e.length > r.maxStringLength) { - var o = e.length - r.maxStringLength; - return t(e.slice(0, r.maxStringLength), r) + "... " + o + " more character" + (o > 1 ? "s" : ""); - } - return E(e.replace(/(['\\])/g, "\\$1").replace(/[\x00-\x1f]/g, U), "single", r); - }(e, p); - if ("number" == typeof e) return 0 === e ? 1 / 0 / e > 0 ? "0" : "-0" : String(e); - if ("bigint" == typeof e) return String(e) + "n"; - var b = void 0 === p.depth ? 5 : p.depth; - if (void 0 === o && (o = 0), o >= b && b > 0 && "object" == typeof e) return F(e) ? "[Array]" : "[Object]"; - var v = function(t, e) { - var r; - if ("\t" === t.indent) r = "\t"; - else { - if (!("number" == typeof t.indent && t.indent > 0)) return null; - r = Array(t.indent + 1).join(" "); - } - return { - base: r, - prev: Array(e + 1).join(r) - }; - }(p, o); - if (void 0 === n) n = []; - else if (M(n, e) >= 0) return "[Circular]"; - function O(e, r, i) { - if (r && (n = n.slice()).push(r), i) { - var a = { - depth: p.depth - }; - return _(p, "quoteStyle") && (a.quoteStyle = p.quoteStyle), t(e, a, o + 1, n); - } - return t(e, p, o + 1, n); - } - if ("function" == typeof e) { - var P = function(t) { - if (t.name) return t.name; - var e = h.call(g.call(t), /^function\s*([\w$]+)/); - return e ? e[1] : null; - }(e), k = C(e, O); - return "[Function" + (P ? ": " + P : " (anonymous)") + "]" + (k.length > 0 ? " { " + k.join(", ") + " }" : ""); - } - if (I(e)) { - var W = A ? String(e).replace(/^(Symbol\(.*\))_[^)]*$/, "$1") : S.call(e); - return "object" != typeof e || A ? W : N(W); - } - if (e && "object" == typeof e && ("undefined" != typeof HTMLElement && e instanceof HTMLElement || "string" == typeof e.nodeName && "function" == typeof e.getAttribute)) { - for(var G = "<" + String(e.nodeName).toLowerCase(), z = e.attributes || [], L = 0; L < z.length; L++)G += " " + z[L].name + "=" + E(String(z[L].value).replace(/"/g, """), "double", p); - return G += ">", e.childNodes && e.childNodes.length && (G += "..."), G + ""; - } - if (F(e)) { - if (0 === e.length) return "[]"; - var V = C(e, O); - return v && !function(t) { - for(var e = 0; e < t.length; e++)if (M(t[e], "\n") >= 0) return !1; - return !0; - }(V) ? "[" + T(V, v) + "]" : "[ " + V.join(", ") + " ]"; - } - if (!("[object Error]" !== R(e) || w && "object" == typeof e && w in e)) { - var $ = C(e, O); - return 0 === $.length ? "[" + String(e) + "]" : "{ [" + String(e) + "] " + $.join(", ") + " }"; - } - if ("object" == typeof e && c) { - if (x && "function" == typeof e[x]) return e[x](); - if ("symbol" !== c && "function" == typeof e.inspect) return e.inspect(); + return String(e); + }; + var k = Object.prototype.hasOwnProperty || function(t) { + return t in this; + }; + function _(t, e) { + return k.call(t, e); + } + function R(t) { + return b.call(t); + } + function M(t, e) { + if (t.indexOf) return t.indexOf(e); + for(var r = 0, o = t.length; r < o; r++)if (t[r] === e) return r; + return -1; + } + function U(t) { + var e = t.charCodeAt(0), r = { + 8: "b", + 9: "t", + 10: "n", + 12: "f", + 13: "r" + }[e]; + return r ? "\\" + r : "\\x" + (e < 16 ? "0" : "") + e.toString(16).toUpperCase(); + } + function N(t) { + return "Object(" + t + ")"; + } + function B(t) { + return t + " { ? }"; + } + function D(t, e, r, o) { + return t + " (" + e + ") {" + (o ? T(r, o) : r.join(", ")) + "}"; + } + function T(t, e) { + if (0 === t.length) return ""; + var r = "\n" + e.prev + e.base; + return r + t.join("," + r) + "\n" + e.prev; + } + function C(t, e) { + var r = F(t), o = []; + if (r) { + o.length = t.length; + for(var n = 0; n < t.length; n++)o[n] = _(t, n) ? e(t[n], t) : ""; + } + var i, a = "function" == typeof v ? v(t) : []; + if (A) { + i = {}; + for(var p = 0; p < a.length; p++)i["$" + a[p]] = a[p]; + } + for(var c in t)_(t, c) && (r && String(Number(c)) === c && c < t.length || A && i["$" + c] instanceof Symbol || (/[^\w$]/.test(c) ? o.push(e(c, t) + ": " + e(t[c], t)) : o.push(c + ": " + e(t[c], t)))); + if ("function" == typeof v) for(var u = 0; u < a.length; u++)O.call(t, a[u]) && o.push("[" + e(a[u]) + "]: " + e(t[a[u]], t)); + return o; + } + }, + 794 (t, e, r) { + t.exports = r(669).inspect; + }, + 798 (t) { + "use strict"; + var e = String.prototype.replace, r = /%20/g, o = "RFC3986"; + t.exports = { + default: o, + formatters: { + RFC1738: function(t) { + return e.call(t, r, "+"); + }, + RFC3986: function(t) { + return String(t); } - if (function(t) { - if (!i || !t || "object" != typeof t) return !1; - try { - i.call(t); - try { - u.call(t); - } catch (e) { - return !0; - } - return t instanceof Map; - } catch (r) {} - return !1; - }(e)) { - var J = []; - return a.call(e, function(t, r) { - J.push(O(r, e, !0) + " => " + O(t, e)); - }), D("Map", i.call(e), J, v); + }, + RFC1738: "RFC1738", + RFC3986: o + }; + }, + 129 (t, e, r) { + "use strict"; + var o = r(261), n = r(235), i = r(798); + t.exports = { + formats: i, + parse: n, + stringify: o + }; + }, + 235 (t, e, r) { + "use strict"; + var o = r(769), n = Object.prototype.hasOwnProperty, i = Array.isArray, a = { + allowDots: !1, + allowPrototypes: !1, + allowSparse: !1, + arrayLimit: 20, + charset: "utf-8", + charsetSentinel: !1, + comma: !1, + decoder: o.decode, + delimiter: "&", + depth: 5, + ignoreQueryPrefix: !1, + interpretNumericEntities: !1, + parameterLimit: 1e3, + parseArrays: !0, + plainObjects: !1, + strictNullHandling: !1 + }, p = function(t, e) { + return t && "string" == typeof t && e.comma && t.indexOf(",") > -1 ? t.split(",") : t; + }, c = function(t, e, r, o) { + if (t) { + var i = r.allowDots ? t.replace(/\.([^.[]+)/g, "[$1]") : t, a = /(\[[^[\]]*])/g, c = r.depth > 0 && /(\[[^[\]]*])/.exec(i), u = c ? i.slice(0, c.index) : i, f = []; + if (u) { + if (!r.plainObjects && n.call(Object.prototype, u) && !r.allowPrototypes) return; + f.push(u); } - if (function(t) { - if (!u || !t || "object" != typeof t) return !1; - try { - u.call(t); - try { - i.call(t); - } catch (e) { - return !0; - } - return t instanceof Set; - } catch (r) {} - return !1; - }(e)) { - var H = []; - return f.call(e, function(t) { - H.push(O(t, e)); - }), D("Set", u.call(e), H, v); + for(var y = 0; r.depth > 0 && null !== (c = a.exec(i)) && y < r.depth;){ + if (y += 1, !r.plainObjects && n.call(Object.prototype, c[1].slice(1, -1)) && !r.allowPrototypes) return; + f.push(c[1]); } - if (function(t) { - if (!y || !t || "object" != typeof t) return !1; - try { - y.call(t, y); - try { - l.call(t, l); - } catch (e) { - return !0; - } - return t instanceof WeakMap; - } catch (r) {} - return !1; - }(e)) return B("WeakMap"); - if (function(t) { - if (!l || !t || "object" != typeof t) return !1; - try { - l.call(t, l); - try { - y.call(t, y); - } catch (e) { - return !0; + return c && f.push("[" + i.slice(c.index) + "]"), function(t, e, r, o) { + for(var n = o ? e : p(e, r), i = t.length - 1; i >= 0; --i){ + var a, c = t[i]; + if ("[]" === c && r.parseArrays) a = [].concat(n); + else { + a = r.plainObjects ? Object.create(null) : {}; + var u = "[" === c.charAt(0) && "]" === c.charAt(c.length - 1) ? c.slice(1, -1) : c, f = parseInt(u, 10); + r.parseArrays || "" !== u ? !isNaN(f) && c !== u && String(f) === u && f >= 0 && r.parseArrays && f <= r.arrayLimit ? (a = [])[f] = n : a[u] = n : a = { + 0: n + }; } - return t instanceof WeakSet; - } catch (r) {} - return !1; - }(e)) return B("WeakSet"); - if (function(t) { - if (!s || !t || "object" != typeof t) return !1; - try { - return s.call(t), !0; - } catch (e) {} - return !1; - }(e)) return B("WeakRef"); - if (!("[object Number]" !== R(e) || w && "object" == typeof e && w in e)) return N(O(Number(e))); - if (function(t) { - if (!t || "object" != typeof t || !m) return !1; - try { - return m.call(t), !0; - } catch (e) {} - return !1; - }(e)) return N(O(m.call(e))); - if (!("[object Boolean]" !== R(e) || w && "object" == typeof e && w in e)) return N(d.call(e)); - if (!("[object String]" !== R(e) || w && "object" == typeof e && w in e)) return N(O(String(e))); - if (("[object Date]" !== R(e) || w && "object" == typeof e && w in e) && ("[object RegExp]" !== R(e) || w && "object" == typeof e && w in e)) { - var q = C(e, O), Q = j ? j(e) === Object.prototype : e instanceof Object || e.constructor === Object, Z = e instanceof Object ? "" : "null prototype", K = !Q && w && Object(e) === e && w in e ? R(e).slice(8, -1) : Z ? "Object" : "", X = (Q || "function" != typeof e.constructor ? "" : e.constructor.name ? e.constructor.name + " " : "") + (K || Z ? "[" + [].concat(K || [], Z || []).join(": ") + "] " : ""); - return 0 === q.length ? X + "{}" : v ? X + "{" + T(q, v) + "}" : X + "{ " + q.join(", ") + " }"; - } - return String(e); - }; - var k = Object.prototype.hasOwnProperty || function(t) { - return t in this; - }; - function _(t, e) { - return k.call(t, e); - } - function R(t) { - return b.call(t); - } - function M(t, e) { - if (t.indexOf) return t.indexOf(e); - for(var r = 0, o = t.length; r < o; r++)if (t[r] === e) return r; - return -1; - } - function U(t) { - var e = t.charCodeAt(0), r = { - 8: "b", - 9: "t", - 10: "n", - 12: "f", - 13: "r" - }[e]; - return r ? "\\" + r : "\\x" + (e < 16 ? "0" : "") + e.toString(16).toUpperCase(); + n = a; + } + return n; + }(f, e, r, o); } - function N(t) { - return "Object(" + t + ")"; + }; + t.exports = function(t, e) { + var r = function(t) { + if (!t) return a; + if (null !== t.decoder && void 0 !== t.decoder && "function" != typeof t.decoder) throw TypeError("Decoder has to be a function."); + if (void 0 !== t.charset && "utf-8" !== t.charset && "iso-8859-1" !== t.charset) throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined"); + var e = void 0 === t.charset ? a.charset : t.charset; + return { + allowDots: void 0 === t.allowDots ? a.allowDots : !!t.allowDots, + allowPrototypes: "boolean" == typeof t.allowPrototypes ? t.allowPrototypes : a.allowPrototypes, + allowSparse: "boolean" == typeof t.allowSparse ? t.allowSparse : a.allowSparse, + arrayLimit: "number" == typeof t.arrayLimit ? t.arrayLimit : a.arrayLimit, + charset: e, + charsetSentinel: "boolean" == typeof t.charsetSentinel ? t.charsetSentinel : a.charsetSentinel, + comma: "boolean" == typeof t.comma ? t.comma : a.comma, + decoder: "function" == typeof t.decoder ? t.decoder : a.decoder, + delimiter: "string" == typeof t.delimiter || o.isRegExp(t.delimiter) ? t.delimiter : a.delimiter, + depth: "number" == typeof t.depth || !1 === t.depth ? +t.depth : a.depth, + ignoreQueryPrefix: !0 === t.ignoreQueryPrefix, + interpretNumericEntities: "boolean" == typeof t.interpretNumericEntities ? t.interpretNumericEntities : a.interpretNumericEntities, + parameterLimit: "number" == typeof t.parameterLimit ? t.parameterLimit : a.parameterLimit, + parseArrays: !1 !== t.parseArrays, + plainObjects: "boolean" == typeof t.plainObjects ? t.plainObjects : a.plainObjects, + strictNullHandling: "boolean" == typeof t.strictNullHandling ? t.strictNullHandling : a.strictNullHandling + }; + }(e); + if ("" === t || null == t) return r.plainObjects ? Object.create(null) : {}; + for(var u = "string" == typeof t ? function(t, e) { + var r, c = {}, u = e.ignoreQueryPrefix ? t.replace(/^\?/, "") : t, f = e.parameterLimit === 1 / 0 ? void 0 : e.parameterLimit, y = u.split(e.delimiter, f), l = -1, s = e.charset; + if (e.charsetSentinel) for(r = 0; r < y.length; ++r)0 === y[r].indexOf("utf8=") && ("utf8=%E2%9C%93" === y[r] ? s = "utf-8" : "utf8=%26%2310003%3B" === y[r] && (s = "iso-8859-1"), l = r, r = y.length); + for(r = 0; r < y.length; ++r)if (r !== l) { + var d, b, g = y[r], h = g.indexOf("]="), m = -1 === h ? g.indexOf("=") : h + 1; + -1 === m ? (d = e.decoder(g, a.decoder, s, "key"), b = e.strictNullHandling ? null : "") : (d = e.decoder(g.slice(0, m), a.decoder, s, "key"), b = o.maybeMap(p(g.slice(m + 1), e), function(t) { + return e.decoder(t, a.decoder, s, "value"); + })), b && e.interpretNumericEntities && "iso-8859-1" === s && (b = b.replace(/&#(\d+);/g, function(t, e) { + return String.fromCharCode(parseInt(e, 10)); + })), g.indexOf("[]=") > -1 && (b = i(b) ? [ + b + ] : b), n.call(c, d) ? c[d] = o.combine(c[d], b) : c[d] = b; + } + return c; + }(t, r) : t, f = r.plainObjects ? Object.create(null) : {}, y = Object.keys(u), l = 0; l < y.length; ++l){ + var s = y[l], d = c(s, u[s], r, "string" == typeof t); + f = o.merge(f, d, r); } - function B(t) { - return t + " { ? }"; + return !0 === r.allowSparse ? f : o.compact(f); + }; + }, + 261 (t, e, r) { + "use strict"; + var o = r(478), n = r(769), i = r(798), a = Object.prototype.hasOwnProperty, p = { + brackets: function(t) { + return t + "[]"; + }, + comma: "comma", + indices: function(t, e) { + return t + "[" + e + "]"; + }, + repeat: function(t) { + return t; } - function D(t, e, r, o) { - return t + " (" + e + ") {" + (o ? T(r, o) : r.join(", ")) + "}"; + }, c = Array.isArray, u = Array.prototype.push, f = function(t, e) { + u.apply(t, c(e) ? e : [ + e + ]); + }, y = Date.prototype.toISOString, l = i.default, s = { + addQueryPrefix: !1, + allowDots: !1, + charset: "utf-8", + charsetSentinel: !1, + delimiter: "&", + encode: !0, + encoder: n.encode, + encodeValuesOnly: !1, + format: l, + formatter: i.formatters[l], + indices: !1, + serializeDate: function(t) { + return y.call(t); + }, + skipNulls: !1, + strictNullHandling: !1 + }, d = function t(e, r, i, a, p, u, y, l, d, b, g, h, m, v, S) { + var A, O = e; + if (S.has(e)) throw RangeError("Cyclic object value"); + if ("function" == typeof y ? O = y(r, O) : O instanceof Date ? O = b(O) : "comma" === i && c(O) && (O = n.maybeMap(O, function(t) { + return t instanceof Date ? b(t) : t; + })), null === O) { + if (a) return u && !m ? u(r, s.encoder, v, "key", g) : r; + O = ""; } - function T(t, e) { - if (0 === t.length) return ""; - var r = "\n" + e.prev + e.base; - return r + t.join("," + r) + "\n" + e.prev; + if ("string" == typeof (A = O) || "number" == typeof A || "boolean" == typeof A || "symbol" == typeof A || "bigint" == typeof A || n.isBuffer(O)) return u ? [ + h(m ? r : u(r, s.encoder, v, "key", g)) + "=" + h(u(O, s.encoder, v, "value", g)) + ] : [ + h(r) + "=" + h(String(O)) + ]; + var j, P = []; + if (void 0 === O) return P; + if ("comma" === i && c(O)) j = [ + { + value: O.length > 0 ? O.join(",") || null : void 0 + } + ]; + else if (c(y)) j = y; + else { + var x = Object.keys(O); + j = l ? x.sort(l) : x; } - function C(t, e) { - var r = F(t), o = []; - if (r) { - o.length = t.length; - for(var n = 0; n < t.length; n++)o[n] = _(t, n) ? e(t[n], t) : ""; + for(var w = 0; w < j.length; ++w){ + var E = j[w], F = "object" == typeof E && void 0 !== E.value ? E.value : O[E]; + if (!p || null !== F) { + var I = c(O) ? "function" == typeof i ? i(r, E) : r : r + (d ? "." + E : "[" + E + "]"); + S.set(e, !0), f(P, t(F, I, i, a, p, u, y, l, d, b, g, h, m, v, o())); } - var i, a = "function" == typeof v ? v(t) : []; - if (A) { - i = {}; - for(var p = 0; p < a.length; p++)i["$" + a[p]] = a[p]; + } + return P; + }; + t.exports = function(t, e) { + var r, n = t, u = function(t) { + if (!t) return s; + if (null !== t.encoder && void 0 !== t.encoder && "function" != typeof t.encoder) throw TypeError("Encoder has to be a function."); + var e = t.charset || s.charset; + if (void 0 !== t.charset && "utf-8" !== t.charset && "iso-8859-1" !== t.charset) throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined"); + var r = i.default; + if (void 0 !== t.format) { + if (!a.call(i.formatters, t.format)) throw TypeError("Unknown format option provided."); + r = t.format; } - for(var c in t)_(t, c) && (r && String(Number(c)) === c && c < t.length || A && i["$" + c] instanceof Symbol || (/[^\w$]/.test(c) ? o.push(e(c, t) + ": " + e(t[c], t)) : o.push(c + ": " + e(t[c], t)))); - if ("function" == typeof v) for(var u = 0; u < a.length; u++)O.call(t, a[u]) && o.push("[" + e(a[u]) + "]: " + e(t[a[u]], t)); - return o; + var o = i.formatters[r], n = s.filter; + return ("function" == typeof t.filter || c(t.filter)) && (n = t.filter), { + addQueryPrefix: "boolean" == typeof t.addQueryPrefix ? t.addQueryPrefix : s.addQueryPrefix, + allowDots: void 0 === t.allowDots ? s.allowDots : !!t.allowDots, + charset: e, + charsetSentinel: "boolean" == typeof t.charsetSentinel ? t.charsetSentinel : s.charsetSentinel, + delimiter: void 0 === t.delimiter ? s.delimiter : t.delimiter, + encode: "boolean" == typeof t.encode ? t.encode : s.encode, + encoder: "function" == typeof t.encoder ? t.encoder : s.encoder, + encodeValuesOnly: "boolean" == typeof t.encodeValuesOnly ? t.encodeValuesOnly : s.encodeValuesOnly, + filter: n, + format: r, + formatter: o, + serializeDate: "function" == typeof t.serializeDate ? t.serializeDate : s.serializeDate, + skipNulls: "boolean" == typeof t.skipNulls ? t.skipNulls : s.skipNulls, + sort: "function" == typeof t.sort ? t.sort : null, + strictNullHandling: "boolean" == typeof t.strictNullHandling ? t.strictNullHandling : s.strictNullHandling + }; + }(e); + "function" == typeof u.filter ? n = (0, u.filter)("", n) : c(u.filter) && (r = u.filter); + var y = []; + if ("object" != typeof n || null === n) return ""; + var l = p[e && e.arrayFormat in p ? e.arrayFormat : e && "indices" in e ? e.indices ? "indices" : "repeat" : "indices"]; + r || (r = Object.keys(n)), u.sort && r.sort(u.sort); + for(var b = o(), g = 0; g < r.length; ++g){ + var h = r[g]; + u.skipNulls && null === n[h] || f(y, d(n[h], h, l, u.strictNullHandling, u.skipNulls, u.encode ? u.encoder : null, u.filter, u.sort, u.allowDots, u.serializeDate, u.format, u.formatter, u.encodeValuesOnly, u.charset, b)); } - }, - 794 (t, e, r) { - t.exports = r(669).inspect; - }, - 798 (t) { - "use strict"; - var e = String.prototype.replace, r = /%20/g, o = "RFC3986"; - t.exports = { - default: o, - formatters: { - RFC1738: function(t) { - return e.call(t, r, "+"); - }, - RFC3986: function(t) { - return String(t); - } - }, - RFC1738: "RFC1738", - RFC3986: o - }; - }, - 129 (t, e, r) { - "use strict"; - var o = r(261), n = r(235), i = r(798); - t.exports = { - formats: i, - parse: n, - stringify: o - }; - }, - 235 (t, e, r) { - "use strict"; - var o = r(769), n = Object.prototype.hasOwnProperty, i = Array.isArray, a = { - allowDots: !1, - allowPrototypes: !1, - allowSparse: !1, - arrayLimit: 20, - charset: "utf-8", - charsetSentinel: !1, - comma: !1, - decoder: o.decode, - delimiter: "&", - depth: 5, - ignoreQueryPrefix: !1, - interpretNumericEntities: !1, - parameterLimit: 1e3, - parseArrays: !0, - plainObjects: !1, - strictNullHandling: !1 - }, p = function(t) { - return t.replace(/&#(\d+);/g, function(t, e) { - return String.fromCharCode(parseInt(e, 10)); - }); - }, c = function(t, e) { - return t && "string" == typeof t && e.comma && t.indexOf(",") > -1 ? t.split(",") : t; - }, u = function(t, e, r, o) { - if (t) { - var i = r.allowDots ? t.replace(/\.([^.[]+)/g, "[$1]") : t, a = /(\[[^[\]]*])/g, p = r.depth > 0 && /(\[[^[\]]*])/.exec(i), u = p ? i.slice(0, p.index) : i, f = []; - if (u) { - if (!r.plainObjects && n.call(Object.prototype, u) && !r.allowPrototypes) return; - f.push(u); - } - for(var y = 0; r.depth > 0 && null !== (p = a.exec(i)) && y < r.depth;){ - if (y += 1, !r.plainObjects && n.call(Object.prototype, p[1].slice(1, -1)) && !r.allowPrototypes) return; - f.push(p[1]); + var m = y.join(u.delimiter), v = !0 === u.addQueryPrefix ? "?" : ""; + return u.charsetSentinel && ("iso-8859-1" === u.charset ? v += "utf8=%26%2310003%3B&" : v += "utf8=%E2%9C%93&"), m.length > 0 ? v + m : ""; + }; + }, + 769 (t, e, r) { + "use strict"; + var o = r(798), n = Object.prototype.hasOwnProperty, i = Array.isArray, a = function() { + for(var t = [], e = 0; e < 256; ++e)t.push("%" + ((e < 16 ? "0" : "") + e.toString(16)).toUpperCase()); + return t; + }(), p = function(t, e) { + for(var r = e && e.plainObjects ? Object.create(null) : {}, o = 0; o < t.length; ++o)void 0 !== t[o] && (r[o] = t[o]); + return r; + }; + t.exports = { + arrayToObject: p, + assign: function(t, e) { + return Object.keys(e).reduce(function(t, r) { + return t[r] = e[r], t; + }, t); + }, + combine: function(t, e) { + return [].concat(t, e); + }, + compact: function(t) { + for(var e = [ + { + obj: { + o: t + }, + prop: "o" } - return p && f.push("[" + i.slice(p.index) + "]"), function(t, e, r, o) { - for(var n = o ? e : c(e, r), i = t.length - 1; i >= 0; --i){ - var a, p = t[i]; - if ("[]" === p && r.parseArrays) a = [].concat(n); - else { - a = r.plainObjects ? Object.create(null) : {}; - var u = "[" === p.charAt(0) && "]" === p.charAt(p.length - 1) ? p.slice(1, -1) : p, f = parseInt(u, 10); - r.parseArrays || "" !== u ? !isNaN(f) && p !== u && String(f) === u && f >= 0 && r.parseArrays && f <= r.arrayLimit ? (a = [])[f] = n : a[u] = n : a = { - 0: n - }; - } - n = a; - } - return n; - }(f, e, r, o); + ], r = [], o = 0; o < e.length; ++o)for(var n = e[o], a = n.obj[n.prop], p = Object.keys(a), c = 0; c < p.length; ++c){ + var u = p[c], f = a[u]; + "object" == typeof f && null !== f && -1 === r.indexOf(f) && (e.push({ + obj: a, + prop: u + }), r.push(f)); } - }; - t.exports = function(t, e) { - var r = function(t) { - if (!t) return a; - if (null !== t.decoder && void 0 !== t.decoder && "function" != typeof t.decoder) throw TypeError("Decoder has to be a function."); - if (void 0 !== t.charset && "utf-8" !== t.charset && "iso-8859-1" !== t.charset) throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined"); - var e = void 0 === t.charset ? a.charset : t.charset; - return { - allowDots: void 0 === t.allowDots ? a.allowDots : !!t.allowDots, - allowPrototypes: "boolean" == typeof t.allowPrototypes ? t.allowPrototypes : a.allowPrototypes, - allowSparse: "boolean" == typeof t.allowSparse ? t.allowSparse : a.allowSparse, - arrayLimit: "number" == typeof t.arrayLimit ? t.arrayLimit : a.arrayLimit, - charset: e, - charsetSentinel: "boolean" == typeof t.charsetSentinel ? t.charsetSentinel : a.charsetSentinel, - comma: "boolean" == typeof t.comma ? t.comma : a.comma, - decoder: "function" == typeof t.decoder ? t.decoder : a.decoder, - delimiter: "string" == typeof t.delimiter || o.isRegExp(t.delimiter) ? t.delimiter : a.delimiter, - depth: "number" == typeof t.depth || !1 === t.depth ? +t.depth : a.depth, - ignoreQueryPrefix: !0 === t.ignoreQueryPrefix, - interpretNumericEntities: "boolean" == typeof t.interpretNumericEntities ? t.interpretNumericEntities : a.interpretNumericEntities, - parameterLimit: "number" == typeof t.parameterLimit ? t.parameterLimit : a.parameterLimit, - parseArrays: !1 !== t.parseArrays, - plainObjects: "boolean" == typeof t.plainObjects ? t.plainObjects : a.plainObjects, - strictNullHandling: "boolean" == typeof t.strictNullHandling ? t.strictNullHandling : a.strictNullHandling - }; - }(e); - if ("" === t || null == t) return r.plainObjects ? Object.create(null) : {}; - for(var f = "string" == typeof t ? function(t, e) { - var r, u = {}, f = e.ignoreQueryPrefix ? t.replace(/^\?/, "") : t, y = e.parameterLimit === 1 / 0 ? void 0 : e.parameterLimit, l = f.split(e.delimiter, y), s = -1, d = e.charset; - if (e.charsetSentinel) for(r = 0; r < l.length; ++r)0 === l[r].indexOf("utf8=") && ("utf8=%E2%9C%93" === l[r] ? d = "utf-8" : "utf8=%26%2310003%3B" === l[r] && (d = "iso-8859-1"), s = r, r = l.length); - for(r = 0; r < l.length; ++r)if (r !== s) { - var b, g, h = l[r], m = h.indexOf("]="), v = -1 === m ? h.indexOf("=") : m + 1; - -1 === v ? (b = e.decoder(h, a.decoder, d, "key"), g = e.strictNullHandling ? null : "") : (b = e.decoder(h.slice(0, v), a.decoder, d, "key"), g = o.maybeMap(c(h.slice(v + 1), e), function(t) { - return e.decoder(t, a.decoder, d, "value"); - })), g && e.interpretNumericEntities && "iso-8859-1" === d && (g = p(g)), h.indexOf("[]=") > -1 && (g = i(g) ? [ - g - ] : g), n.call(u, b) ? u[b] = o.combine(u[b], g) : u[b] = g; + return function(t) { + for(; t.length > 1;){ + var e = t.pop(), r = e.obj[e.prop]; + if (i(r)) { + for(var o = [], n = 0; n < r.length; ++n)void 0 !== r[n] && o.push(r[n]); + e.obj[e.prop] = o; + } } - return u; - }(t, r) : t, y = r.plainObjects ? Object.create(null) : {}, l = Object.keys(f), s = 0; s < l.length; ++s){ - var d = l[s], b = u(d, f[d], r, "string" == typeof t); - y = o.merge(y, b, r); - } - return !0 === r.allowSparse ? y : o.compact(y); - }; - }, - 261 (t, e, r) { - "use strict"; - var o = r(478), n = r(769), i = r(798), a = Object.prototype.hasOwnProperty, p = { - brackets: function(t) { - return t + "[]"; - }, - comma: "comma", - indices: function(t, e) { - return t + "[" + e + "]"; - }, - repeat: function(t) { - return t; - } - }, c = Array.isArray, u = Array.prototype.push, f = function(t, e) { - u.apply(t, c(e) ? e : [ - e - ]); - }, y = Date.prototype.toISOString, l = i.default, s = { - addQueryPrefix: !1, - allowDots: !1, - charset: "utf-8", - charsetSentinel: !1, - delimiter: "&", - encode: !0, - encoder: n.encode, - encodeValuesOnly: !1, - format: l, - formatter: i.formatters[l], - indices: !1, - serializeDate: function(t) { - return y.call(t); - }, - skipNulls: !1, - strictNullHandling: !1 - }, d = function t(e, r, i, a, p, u, y, l, d, b, g, h, m, v, S) { - var A, O = e; - if (S.has(e)) throw RangeError("Cyclic object value"); - if ("function" == typeof y ? O = y(r, O) : O instanceof Date ? O = b(O) : "comma" === i && c(O) && (O = n.maybeMap(O, function(t) { - return t instanceof Date ? b(t) : t; - })), null === O) { - if (a) return u && !m ? u(r, s.encoder, v, "key", g) : r; - O = ""; + }(e), t; + }, + decode: function(t, e, r) { + var o = t.replace(/\+/g, " "); + if ("iso-8859-1" === r) return o.replace(/%[0-9a-f]{2}/gi, unescape); + try { + return decodeURIComponent(o); + } catch (n) { + return o; } - if ("string" == typeof (A = O) || "number" == typeof A || "boolean" == typeof A || "symbol" == typeof A || "bigint" == typeof A || n.isBuffer(O)) return u ? [ - h(m ? r : u(r, s.encoder, v, "key", g)) + "=" + h(u(O, s.encoder, v, "value", g)) - ] : [ - h(r) + "=" + h(String(O)) - ]; - var j, P = []; - if (void 0 === O) return P; - if ("comma" === i && c(O)) j = [ - { - value: O.length > 0 ? O.join(",") || null : void 0 - } - ]; - else if (c(y)) j = y; - else { - var x = Object.keys(O); - j = l ? x.sort(l) : x; + }, + encode: function(t, e, r, n, i) { + if (0 === t.length) return t; + var p = t; + if ("symbol" == typeof t ? p = Symbol.prototype.toString.call(t) : "string" != typeof t && (p = String(t)), "iso-8859-1" === r) return escape(p).replace(/%u[0-9a-f]{4}/gi, function(t) { + return "%26%23" + parseInt(t.slice(2), 16) + "%3B"; + }); + for(var c = "", u = 0; u < p.length; ++u){ + var f = p.charCodeAt(u); + 45 === f || 46 === f || 95 === f || 126 === f || f >= 48 && f <= 57 || f >= 65 && f <= 90 || f >= 97 && f <= 122 || i === o.RFC1738 && (40 === f || 41 === f) ? c += p.charAt(u) : f < 128 ? c += a[f] : f < 2048 ? c += a[192 | f >> 6] + a[128 | 63 & f] : f < 55296 || f >= 57344 ? c += a[224 | f >> 12] + a[128 | f >> 6 & 63] + a[128 | 63 & f] : (u += 1, c += a[240 | (f = 65536 + ((1023 & f) << 10 | 1023 & p.charCodeAt(u))) >> 18] + a[128 | f >> 12 & 63] + a[128 | f >> 6 & 63] + a[128 | 63 & f]); } - for(var w = 0; w < j.length; ++w){ - var E = j[w], F = "object" == typeof E && void 0 !== E.value ? E.value : O[E]; - if (!p || null !== F) { - var I = c(O) ? "function" == typeof i ? i(r, E) : r : r + (d ? "." + E : "[" + E + "]"); - S.set(e, !0), f(P, t(F, I, i, a, p, u, y, l, d, b, g, h, m, v, o())); - } + return c; + }, + isBuffer: function(t) { + return !(!t || "object" != typeof t || !(t.constructor && t.constructor.isBuffer && t.constructor.isBuffer(t))); + }, + isRegExp: function(t) { + return "[object RegExp]" === Object.prototype.toString.call(t); + }, + maybeMap: function(t, e) { + if (i(t)) { + for(var r = [], o = 0; o < t.length; o += 1)r.push(e(t[o])); + return r; } - return P; - }; - t.exports = function(t, e) { - var r, n = t, u = function(t) { - if (!t) return s; - if (null !== t.encoder && void 0 !== t.encoder && "function" != typeof t.encoder) throw TypeError("Encoder has to be a function."); - var e = t.charset || s.charset; - if (void 0 !== t.charset && "utf-8" !== t.charset && "iso-8859-1" !== t.charset) throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined"); - var r = i.default; - if (void 0 !== t.format) { - if (!a.call(i.formatters, t.format)) throw TypeError("Unknown format option provided."); - r = t.format; + return e(t); + }, + merge: function t(e, r, o) { + if (!r) return e; + if ("object" != typeof r) { + if (i(e)) e.push(r); + else { + if (!e || "object" != typeof e) return [ + e, + r + ]; + (o && (o.plainObjects || o.allowPrototypes) || !n.call(Object.prototype, r)) && (e[r] = !0); } - var o = i.formatters[r], n = s.filter; - return ("function" == typeof t.filter || c(t.filter)) && (n = t.filter), { - addQueryPrefix: "boolean" == typeof t.addQueryPrefix ? t.addQueryPrefix : s.addQueryPrefix, - allowDots: void 0 === t.allowDots ? s.allowDots : !!t.allowDots, - charset: e, - charsetSentinel: "boolean" == typeof t.charsetSentinel ? t.charsetSentinel : s.charsetSentinel, - delimiter: void 0 === t.delimiter ? s.delimiter : t.delimiter, - encode: "boolean" == typeof t.encode ? t.encode : s.encode, - encoder: "function" == typeof t.encoder ? t.encoder : s.encoder, - encodeValuesOnly: "boolean" == typeof t.encodeValuesOnly ? t.encodeValuesOnly : s.encodeValuesOnly, - filter: n, - format: r, - formatter: o, - serializeDate: "function" == typeof t.serializeDate ? t.serializeDate : s.serializeDate, - skipNulls: "boolean" == typeof t.skipNulls ? t.skipNulls : s.skipNulls, - sort: "function" == typeof t.sort ? t.sort : null, - strictNullHandling: "boolean" == typeof t.strictNullHandling ? t.strictNullHandling : s.strictNullHandling - }; - }(e); - "function" == typeof u.filter ? n = (0, u.filter)("", n) : c(u.filter) && (r = u.filter); - var y = []; - if ("object" != typeof n || null === n) return ""; - var l = p[e && e.arrayFormat in p ? e.arrayFormat : e && "indices" in e ? e.indices ? "indices" : "repeat" : "indices"]; - r || (r = Object.keys(n)), u.sort && r.sort(u.sort); - for(var b = o(), g = 0; g < r.length; ++g){ - var h = r[g]; - u.skipNulls && null === n[h] || f(y, d(n[h], h, l, u.strictNullHandling, u.skipNulls, u.encode ? u.encoder : null, u.filter, u.sort, u.allowDots, u.serializeDate, u.format, u.formatter, u.encodeValuesOnly, u.charset, b)); + return e; } - var m = y.join(u.delimiter), v = !0 === u.addQueryPrefix ? "?" : ""; - return u.charsetSentinel && ("iso-8859-1" === u.charset ? v += "utf8=%26%2310003%3B&" : v += "utf8=%E2%9C%93&"), m.length > 0 ? v + m : ""; - }; - }, - 769 (t, e, r) { - "use strict"; - var o = r(798), n = Object.prototype.hasOwnProperty, i = Array.isArray, a = function() { - for(var t = [], e = 0; e < 256; ++e)t.push("%" + ((e < 16 ? "0" : "") + e.toString(16)).toUpperCase()); - return t; - }(), p = function(t, e) { - for(var r = e && e.plainObjects ? Object.create(null) : {}, o = 0; o < t.length; ++o)void 0 !== t[o] && (r[o] = t[o]); - return r; - }; - t.exports = { - arrayToObject: p, - assign: function(t, e) { - return Object.keys(e).reduce(function(t, r) { - return t[r] = e[r], t; - }, t); - }, - combine: function(t, e) { - return [].concat(t, e); + if (!e || "object" != typeof e) return [ + e + ].concat(r); + var a = e; + return i(e) && !i(r) && (a = p(e, o)), i(e) && i(r) ? (r.forEach(function(r, i) { + if (n.call(e, i)) { + var a = e[i]; + a && "object" == typeof a && r && "object" == typeof r ? e[i] = t(a, r, o) : e.push(r); + } else e[i] = r; + }), e) : Object.keys(r).reduce(function(e, i) { + var a = r[i]; + return n.call(e, i) ? e[i] = t(e[i], a, o) : e[i] = a, e; + }, a); + } + }; + }, + 478 (t, e, r) { + "use strict"; + var o = r(210), n = r(924), i = r(631), a = o("%TypeError%"), p = o("%WeakMap%", !0), c = o("%Map%", !0), u = n("WeakMap.prototype.get", !0), f = n("WeakMap.prototype.set", !0), y = n("WeakMap.prototype.has", !0), l = n("Map.prototype.get", !0), s = n("Map.prototype.set", !0), d = n("Map.prototype.has", !0), b = function(t, e) { + for(var r, o = t; null !== (r = o.next); o = r)if (r.key === e) return o.next = r.next, r.next = t.next, t.next = r, r; + }; + t.exports = function() { + var t, e, r, o = { + assert: function(t) { + if (!o.has(t)) throw new a("Side channel does not contain " + i(t)); }, - compact: function(t) { - for(var e = [ - { - obj: { - o: t - }, - prop: "o" - } - ], r = [], o = 0; o < e.length; ++o)for(var n = e[o], a = n.obj[n.prop], p = Object.keys(a), c = 0; c < p.length; ++c){ - var u = p[c], f = a[u]; - "object" == typeof f && null !== f && -1 === r.indexOf(f) && (e.push({ - obj: a, - prop: u - }), r.push(f)); + get: function(o) { + if (p && o && ("object" == typeof o || "function" == typeof o)) { + if (t) return u(t, o); + } else if (c) { + if (e) return l(e, o); + } else if (r) { + var n; + return (n = b(r, o)) && n.value; } - return function(t) { - for(; t.length > 1;){ - var e = t.pop(), r = e.obj[e.prop]; - if (i(r)) { - for(var o = [], n = 0; n < r.length; ++n)void 0 !== r[n] && o.push(r[n]); - e.obj[e.prop] = o; - } - } - }(e), t; }, - decode: function(t, e, r) { - var o = t.replace(/\+/g, " "); - if ("iso-8859-1" === r) return o.replace(/%[0-9a-f]{2}/gi, unescape); - try { - return decodeURIComponent(o); - } catch (n) { - return o; - } + has: function(o) { + if (p && o && ("object" == typeof o || "function" == typeof o)) { + if (t) return y(t, o); + } else if (c) { + if (e) return d(e, o); + } else if (r) return !!b(r, o); + return !1; }, - encode: function(t, e, r, n, i) { - if (0 === t.length) return t; - var p = t; - if ("symbol" == typeof t ? p = Symbol.prototype.toString.call(t) : "string" != typeof t && (p = String(t)), "iso-8859-1" === r) return escape(p).replace(/%u[0-9a-f]{4}/gi, function(t) { - return "%26%23" + parseInt(t.slice(2), 16) + "%3B"; + set: function(o, n) { + var i, a; + p && o && ("object" == typeof o || "function" == typeof o) ? (t || (t = new p), f(t, o, n)) : c ? (e || (e = new c), s(e, o, n)) : (r || (r = { + key: {}, + next: null + }), (a = b(i = r, o)) ? a.value = n : i.next = { + key: o, + next: i.next, + value: n }); - for(var c = "", u = 0; u < p.length; ++u){ - var f = p.charCodeAt(u); - 45 === f || 46 === f || 95 === f || 126 === f || f >= 48 && f <= 57 || f >= 65 && f <= 90 || f >= 97 && f <= 122 || i === o.RFC1738 && (40 === f || 41 === f) ? c += p.charAt(u) : f < 128 ? c += a[f] : f < 2048 ? c += a[192 | f >> 6] + a[128 | 63 & f] : f < 55296 || f >= 57344 ? c += a[224 | f >> 12] + a[128 | f >> 6 & 63] + a[128 | 63 & f] : (u += 1, c += a[240 | (f = 65536 + ((1023 & f) << 10 | 1023 & p.charCodeAt(u))) >> 18] + a[128 | f >> 12 & 63] + a[128 | f >> 6 & 63] + a[128 | 63 & f]); - } - return c; - }, - isBuffer: function(t) { - return !(!t || "object" != typeof t || !(t.constructor && t.constructor.isBuffer && t.constructor.isBuffer(t))); - }, - isRegExp: function(t) { - return "[object RegExp]" === Object.prototype.toString.call(t); - }, - maybeMap: function(t, e) { - if (i(t)) { - for(var r = [], o = 0; o < t.length; o += 1)r.push(e(t[o])); - return r; - } - return e(t); - }, - merge: function t(e, r, o) { - if (!r) return e; - if ("object" != typeof r) { - if (i(e)) e.push(r); - else { - if (!e || "object" != typeof e) return [ - e, - r - ]; - (o && (o.plainObjects || o.allowPrototypes) || !n.call(Object.prototype, r)) && (e[r] = !0); - } - return e; - } - if (!e || "object" != typeof e) return [ - e - ].concat(r); - var a = e; - return i(e) && !i(r) && (a = p(e, o)), i(e) && i(r) ? (r.forEach(function(r, i) { - if (n.call(e, i)) { - var a = e[i]; - a && "object" == typeof a && r && "object" == typeof r ? e[i] = t(a, r, o) : e.push(r); - } else e[i] = r; - }), e) : Object.keys(r).reduce(function(e, i) { - var a = r[i]; - return n.call(e, i) ? e[i] = t(e[i], a, o) : e[i] = a, e; - }, a); } }; - }, - 478 (t, e, r) { - "use strict"; - var o = r(210), n = r(924), i = r(631), a = o("%TypeError%"), p = o("%WeakMap%", !0), c = o("%Map%", !0), u = n("WeakMap.prototype.get", !0), f = n("WeakMap.prototype.set", !0), y = n("WeakMap.prototype.has", !0), l = n("Map.prototype.get", !0), s = n("Map.prototype.set", !0), d = n("Map.prototype.has", !0), b = function(t, e) { - for(var r, o = t; null !== (r = o.next); o = r)if (r.key === e) return o.next = r.next, r.next = t.next, t.next = r, r; - }; - t.exports = function() { - var t, e, r, o = { - assert: function(t) { - if (!o.has(t)) throw new a("Side channel does not contain " + i(t)); - }, - get: function(o) { - if (p && o && ("object" == typeof o || "function" == typeof o)) { - if (t) return u(t, o); - } else if (c) { - if (e) return l(e, o); - } else if (r) { - var n; - return (n = b(r, o)) && n.value; - } - }, - has: function(o) { - if (p && o && ("object" == typeof o || "function" == typeof o)) { - if (t) return y(t, o); - } else if (c) { - if (e) return d(e, o); - } else if (r) return !!b(r, o); - return !1; - }, - set: function(o, n) { - var i, a; - p && o && ("object" == typeof o || "function" == typeof o) ? (t || (t = new p), f(t, o, n)) : c ? (e || (e = new c), s(e, o, n)) : (r || (r = { - key: {}, - next: null - }), (a = b(i = r, o)) ? a.value = n : i.next = { - key: o, - next: i.next, - value: n - }); - } - }; - return o; - }; - }, - 669 (t) { - "use strict"; - t.exports = r(9720); - } - }, e = {}; - function o(r) { - var n = e[r]; - if (void 0 !== n) return n.exports; - var i = e[r] = { - exports: {} + return o; }; - return t[r](i, i.exports, o), i.exports; + }, + 669 (t) { + "use strict"; + t.exports = r(9720); } - o.n = (t)=>{ - var e = t && t.__esModule ? ()=>t.default : ()=>t; - return o.d(e, { - a: e - }), e; - }, o.d = (t, e)=>{ - for(var r in e)o.o(e, r) && !o.o(t, r) && Object.defineProperty(t, r, { - enumerable: !0, - get: e[r] - }); - }, o.o = (t, e)=>Object.prototype.hasOwnProperty.call(t, e), o.r = (t)=>{ - "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, { - value: "Module" - }), Object.defineProperty(t, "__esModule", { - value: !0 - }); + }, e = {}; + function o(r) { + var n = e[r]; + if (void 0 !== n) return n.exports; + var i = e[r] = { + exports: {} }; - var n = {}; - return (()=>{ - "use strict"; - o.r(n), o.d(n, { - default: ()=>d - }); - var t = o(575), e = o.n(t), r = o(205), i = o.n(r), a = o(585), p = o.n(a), c = o(754), u = o.n(c), f = o(729), y = o.n(f), l = o(129), s = o.n(l); - const d = new (function(t) { - i()(n, t); - var r, o = (r = function() { - if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; - if ("function" == typeof Proxy) return !0; - try { - return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; - } catch (t) { - return !1; - } - }(), function() { - var t, e = u()(n); - if (r) { - var o = u()(this).constructor; - t = Reflect.construct(e, arguments, o); - } else t = e.apply(this, arguments); - return p()(this, t); - }); - function n() { - var t; - return e()(this, n), (t = o.call(this)).ready = !1, console.log(s()), t; + return t[r](i, i.exports, o), i.exports; + } + o.n = (t)=>{ + var e = t && t.__esModule ? ()=>t.default : ()=>t; + return o.d(e, { + a: e + }), e; + }, o.d = (t, e)=>{ + for(var r in e)o.o(e, r) && !o.o(t, r) && Object.defineProperty(t, r, { + enumerable: !0, + get: e[r] + }); + }, o.o = (t, e)=>Object.prototype.hasOwnProperty.call(t, e), o.r = (t)=>{ + "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, { + value: "Module" + }), Object.defineProperty(t, "__esModule", { + value: !0 + }); + }; + var n = {}; + return (()=>{ + "use strict"; + o.r(n), o.d(n, { + default: ()=>d + }); + var t = o(575), e = o.n(t), r = o(205), i = o.n(r), a = o(585), p = o.n(a), c = o(754), u = o.n(c), f = o(729), y = o.n(f), l = o(129), s = o.n(l); + const d = new (function(t) { + i()(n, t); + var r, o = (r = function() { + if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; + if ("function" == typeof Proxy) return !0; + try { + return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; + } catch (t) { + return !1; } - return n; - }(y())); - })(), n; - })(); - }, t.exports = o(); + }(), function() { + var t, e = u()(n); + if (r) { + var o = u()(this).constructor; + t = Reflect.construct(e, arguments, o); + } else t = e.apply(this, arguments); + return p()(this, t); + }); + function n() { + var t; + return e()(this, n), (t = o.call(this)).ready = !1, console.log(s()), t; + } + return n; + }(y())); + })(), n; + })(); }, 9720: function(t, e, r) { var o = r(1876).Buffer, n = r(3454); @@ -1366,14 +1361,14 @@ t.exports = function(t) { var o, n = this; if ("function" != typeof n || "[object Function]" !== r.call(n)) throw TypeError("Function.prototype.bind called on incompatible " + n); - for(var i = e.call(arguments, 1), a = function() { + for(var i = e.call(arguments, 1), a = Math.max(0, n.length - i.length), p = [], c = 0; c < a; c++)p.push("$" + c); + if (o = Function("binder", "return function (" + p.join(",") + "){ return binder.apply(this,arguments); }")(function() { if (!(this instanceof o)) return n.apply(t, i.concat(e.call(arguments))); var r = n.apply(this, i.concat(e.call(arguments))); return Object(r) === r ? r : this; - }, p = Math.max(0, n.length - i.length), c = [], u = 0; u < p; u++)c.push("$" + u); - if (o = Function("binder", "return function (" + c.join(",") + "){ return binder.apply(this,arguments); }")(a), n.prototype) { - var f = function() {}; - f.prototype = n.prototype, o.prototype = new f, f.prototype = null; + }), n.prototype) { + var u = function() {}; + u.prototype = n.prototype, o.prototype = new u, u.prototype = null; } return o; }; diff --git a/crates/swc_ecma_minifier/tests/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js b/crates/swc_ecma_minifier/tests/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js index 89e4885d3336..0d0a9eb0d7b6 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js @@ -1267,12 +1267,12 @@ r.exports = function(r) { var y, i = this; if ("function" != typeof i || "[object Function]" !== o.call(i)) throw TypeError("Function.prototype.bind called on incompatible " + i); - for(var a = e.call(arguments, 1), binder = function() { + for(var a = e.call(arguments, 1), p = Math.max(0, i.length - a.length), f = [], u = 0; u < p; u++)f.push("$" + u); + if (y = Function("binder", "return function (" + f.join(",") + "){ return binder.apply(this,arguments); }")(function() { if (!(this instanceof y)) return i.apply(r, a.concat(e.call(arguments))); var t = i.apply(this, a.concat(e.call(arguments))); return Object(t) === t ? t : this; - }, p = Math.max(0, i.length - a.length), f = [], u = 0; u < p; u++)f.push("$" + u); - if (y = Function("binder", "return function (" + f.join(",") + "){ return binder.apply(this,arguments); }")(binder), i.prototype) { + }), i.prototype) { var s = function() {}; s.prototype = i.prototype, y.prototype = new s(), s.prototype = null; } diff --git a/crates/swc_ecma_minifier/tests/fixture/next/octokit/static/chunks/357-72bd409f1472b1b8/output.js b/crates/swc_ecma_minifier/tests/fixture/next/octokit/static/chunks/357-72bd409f1472b1b8/output.js index fea96c9cd085..032ce899e62f 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/octokit/static/chunks/357-72bd409f1472b1b8/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/octokit/static/chunks/357-72bd409f1472b1b8/output.js @@ -4,723 +4,715 @@ ], { 1209: function(module, __unused_webpack_exports, __webpack_require__) { - var factory; - factory = function() { - 'use strict'; - var commonjsGlobal = 'undefined' != typeof globalThis ? globalThis : 'undefined' != typeof window ? window : void 0 !== __webpack_require__.g ? __webpack_require__.g : 'undefined' != typeof self ? self : {}, parser = { - load: function(received, defaults, onto = {}) { - var k, ref, v; - for(k in defaults)v = defaults[k], onto[k] = null != (ref = received[k]) ? ref : v; - return onto; - }, - overwrite: function(received, defaults, onto = {}) { - var k, v; - for(k in received)v = received[k], void 0 !== defaults[k] && (onto[k] = v); - return onto; - } - }; - DLList = class { - constructor(incr, decr){ - this.incr = incr, this.decr = decr, this._first = null, this._last = null, this.length = 0; - } - push(value) { - var node; - this.length++, "function" == typeof this.incr && this.incr(), node = { - value, - prev: this._last, - next: null - }, null != this._last ? (this._last.next = node, this._last = node) : this._first = this._last = node; - } - shift() { - var value; - return null == this._first ? void 0 : (this.length--, "function" == typeof this.decr && this.decr(), value = this._first.value, null != (this._first = this._first.next) ? this._first.prev = null : this._last = null, value); - } - first() { - if (null != this._first) return this._first.value; - } - getArray() { - var node, ref, results; - for(node = this._first, results = []; null != node;)results.push((ref = node, node = node.next, ref.value)); + var commonjsGlobal, parser, BottleneckError_1, version, version$2, require$$2, require$$3, require$$4, require$$4$1, require$$8, DLList, Events, Queues, States, Sync, Group, Batcher, Job$1, LocalDatastore$1, splice, Bottleneck_1; + module.exports = (commonjsGlobal = 'undefined' != typeof globalThis ? globalThis : 'undefined' != typeof window ? window : void 0 !== __webpack_require__.g ? __webpack_require__.g : 'undefined' != typeof self ? self : {}, parser = { + load: function(received, defaults, onto = {}) { + var k, ref, v; + for(k in defaults)v = defaults[k], onto[k] = null != (ref = received[k]) ? ref : v; + return onto; + }, + overwrite: function(received, defaults, onto = {}) { + var k, v; + for(k in received)v = received[k], void 0 !== defaults[k] && (onto[k] = v); + return onto; + } + }, DLList = class { + constructor(incr, decr){ + this.incr = incr, this.decr = decr, this._first = null, this._last = null, this.length = 0; + } + push(value) { + var node; + this.length++, "function" == typeof this.incr && this.incr(), node = { + value, + prev: this._last, + next: null + }, null != this._last ? (this._last.next = node, this._last = node) : this._first = this._last = node; + } + shift() { + var value; + return null == this._first ? void 0 : (this.length--, "function" == typeof this.decr && this.decr(), value = this._first.value, null != (this._first = this._first.next) ? this._first.prev = null : this._last = null, value); + } + first() { + if (null != this._first) return this._first.value; + } + getArray() { + var node, ref, results; + for(node = this._first, results = []; null != node;)results.push((ref = node, node = node.next, ref.value)); + return results; + } + forEachShift(cb) { + var node; + for(node = this.shift(); null != node;)cb(node), node = this.shift(); + } + debug() { + var node, ref, ref1, ref2, results; + for(node = this._first, results = []; null != node;)results.push((ref = node, node = node.next, { + value: ref.value, + prev: null != (ref1 = ref.prev) ? ref1.value : void 0, + next: null != (ref2 = ref.next) ? ref2.value : void 0 + })); + return results; + } + }, Events = class { + constructor(instance){ + if (this.instance = instance, this._events = {}, null != this.instance.on || null != this.instance.once || null != this.instance.removeAllListeners) throw Error("An Emitter already exists for this object"); + this.instance.on = (name, cb)=>this._addListener(name, "many", cb), this.instance.once = (name, cb)=>this._addListener(name, "once", cb), this.instance.removeAllListeners = (name = null)=>null != name ? delete this._events[name] : this._events = {}; + } + _addListener(name, status, cb) { + var base; + return null == (base = this._events)[name] && (base[name] = []), this._events[name].push({ + cb, + status + }), this.instance; + } + listenerCount(name) { + return null != this._events[name] ? this._events[name].length : 0; + } + async trigger(name, ...args) { + try { + if ("debug" !== name && this.trigger("debug", `Event triggered: ${name}`, args), null == this._events[name]) return; + return this._events[name] = this._events[name].filter(function(listener) { + return "none" !== listener.status; + }), (await Promise.all(this._events[name].map(async (listener)=>{ + var returned; + if ("none" !== listener.status) { + "once" === listener.status && (listener.status = "none"); + try { + if (returned = "function" == typeof listener.cb ? listener.cb(...args) : void 0, "function" == typeof (null != returned ? returned.then : void 0)) return await returned; + return returned; + } catch (error) { + return this.trigger("error", error), null; + } + } + }))).find(function(x) { + return null != x; + }); + } catch (error) { + return this.trigger("error", error), null; + } + } + }, Queues = class { + constructor(num_priorities){ + this.Events = new Events(this), this._length = 0, this._lists = (function() { + var j, results; + for(results = [], j = 1; 1 <= num_priorities ? j <= num_priorities : j >= num_priorities; 1 <= num_priorities ? ++j : --j)results.push(new DLList(()=>this.incr(), ()=>this.decr())); return results; - } - forEachShift(cb) { - var node; - for(node = this.shift(); null != node;)cb(node), node = this.shift(); - } - debug() { - var node, ref, ref1, ref2, results; - for(node = this._first, results = []; null != node;)results.push((ref = node, node = node.next, { - value: ref.value, - prev: null != (ref1 = ref.prev) ? ref1.value : void 0, - next: null != (ref2 = ref.next) ? ref2.value : void 0 - })); + }).call(this); + } + incr() { + if (0 == this._length++) return this.Events.trigger("leftzero"); + } + decr() { + if (0 == --this._length) return this.Events.trigger("zero"); + } + push(job) { + return this._lists[job.options.priority].push(job); + } + queued(priority) { + return null != priority ? this._lists[priority].length : this._length; + } + shiftAll(fn) { + return this._lists.forEach(function(list) { + return list.forEachShift(fn); + }); + } + getFirst(arr = this._lists) { + var j, len, list; + for(j = 0, len = arr.length; j < len; j++)if ((list = arr[j]).length > 0) return list; + return []; + } + shiftLastFrom(priority) { + return this.getFirst(this._lists.slice(priority).reverse()).shift(); + } + }, BottleneckError_1 = class extends Error { + }, States = class { + constructor(status1){ + this.status = status1, this._jobs = {}, this.counts = this.status.map(function() { + return 0; + }); + } + next(id) { + var current, next; + return (next = (current = this._jobs[id]) + 1, null != current && next < this.status.length) ? (this.counts[current]--, this.counts[next]++, this._jobs[id]++) : null != current ? (this.counts[current]--, delete this._jobs[id]) : void 0; + } + start(id) { + return this._jobs[id] = 0, this.counts[0]++; + } + remove(id) { + var current; + return null != (current = this._jobs[id]) && (this.counts[current]--, delete this._jobs[id]), null != current; + } + jobStatus(id) { + var ref; + return null != (ref = this.status[this._jobs[id]]) ? ref : null; + } + statusJobs(status) { + var k, pos, ref, results; + if (null == status) return Object.keys(this._jobs); + if ((pos = this.status.indexOf(status)) < 0) throw new BottleneckError_1(`status must be one of ${this.status.join(', ')}`); + for(k in ref = this._jobs, results = [], ref)ref[k] === pos && results.push(k); + return results; + } + statusCounts() { + return this.counts.reduce((acc, v, i)=>(acc[this.status[i]] = v, acc), {}); + } + }, Sync = class { + constructor(name, Promise1){ + this.schedule = this.schedule.bind(this), this.name = name, this.Promise = Promise1, this._running = 0, this._queue = new DLList(); + } + isEmpty() { + return 0 === this._queue.length; + } + async _tryToRun() { + var args, cb, reject, resolve, returned, task; + if (this._running < 1 && this._queue.length > 0) return this._running++, { task , args , resolve , reject } = this._queue.shift(), cb = await async function() { + try { + return returned = await task(...args), function() { + return resolve(returned); + }; + } catch (error1) { + return function() { + return reject(error1); + }; + } + }(), this._running--, this._tryToRun(), cb(); + } + schedule(task, ...args) { + var promise, reject, resolve; + return resolve = reject = null, promise = new this.Promise(function(_resolve, _reject) { + return resolve = _resolve, reject = _reject; + }), this._queue.push({ + task, + args, + resolve, + reject + }), this._tryToRun(), promise; + } + }, version$2 = Object.freeze({ + version: version = "2.19.5", + default: { + version: version + } + }), require$$2 = ()=>console.log('You must import the full version of Bottleneck in order to use this feature.'), require$$3 = ()=>console.log('You must import the full version of Bottleneck in order to use this feature.'), require$$4 = ()=>console.log('You must import the full version of Bottleneck in order to use this feature.'), Group = (function() { + class Group { + constructor(limiterOptions = {}){ + this.deleteKey = this.deleteKey.bind(this), this.limiterOptions = limiterOptions, parser.load(this.limiterOptions, this.defaults, this), this.Events = new Events(this), this.instances = {}, this.Bottleneck = Bottleneck_1, this._startAutoCleanup(), this.sharedConnection = null != this.connection, null == this.connection && ("redis" === this.limiterOptions.datastore ? this.connection = new require$$2(Object.assign({}, this.limiterOptions, { + Events: this.Events + })) : "ioredis" === this.limiterOptions.datastore && (this.connection = new require$$3(Object.assign({}, this.limiterOptions, { + Events: this.Events + })))); + } + key(key = "") { + var ref; + return null != (ref = this.instances[key]) ? ref : (()=>{ + var limiter; + return limiter = this.instances[key] = new this.Bottleneck(Object.assign(this.limiterOptions, { + id: `${this.id}-${key}`, + timeout: this.timeout, + connection: this.connection + })), this.Events.trigger("created", limiter, key), limiter; + })(); + } + async deleteKey(key = "") { + var deleted, instance; + return instance = this.instances[key], this.connection && (deleted = await this.connection.__runCommand__([ + 'del', + ...require$$4.allKeys(`${this.id}-${key}`) + ])), null != instance && (delete this.instances[key], await instance.disconnect()), null != instance || deleted > 0; + } + limiters() { + var k, ref, results, v; + for(k in ref = this.instances, results = [], ref)v = ref[k], results.push({ + key: k, + limiter: v + }); return results; } - }, Events = class { - constructor(instance){ - if (this.instance = instance, this._events = {}, null != this.instance.on || null != this.instance.once || null != this.instance.removeAllListeners) throw Error("An Emitter already exists for this object"); - this.instance.on = (name, cb)=>this._addListener(name, "many", cb), this.instance.once = (name, cb)=>this._addListener(name, "once", cb), this.instance.removeAllListeners = (name = null)=>null != name ? delete this._events[name] : this._events = {}; - } - _addListener(name, status, cb) { + keys() { + return Object.keys(this.instances); + } + async clusterKeys() { + var cursor, found, i, k, keys, len, next, start; + if (null == this.connection) return this.Promise.resolve(this.keys()); + for(keys = [], cursor = null, start = `b_${this.id}-`.length; 0 !== cursor;)for(i = 0, [next, found] = await this.connection.__runCommand__([ + "scan", + null != cursor ? cursor : 0, + "match", + `b_${this.id}-*_settings`, + "count", + 10000 + ]), cursor = ~~next, len = found.length; i < len; i++)k = found[i], keys.push(k.slice(start, -9)); + return keys; + } + _startAutoCleanup() { var base; - return null == (base = this._events)[name] && (base[name] = []), this._events[name].push({ - cb, - status - }), this.instance; - } - listenerCount(name) { - return null != this._events[name] ? this._events[name].length : 0; - } - async trigger(name, ...args) { - try { - if ("debug" !== name && this.trigger("debug", `Event triggered: ${name}`, args), null == this._events[name]) return; - return this._events[name] = this._events[name].filter(function(listener) { - return "none" !== listener.status; - }), (await Promise.all(this._events[name].map(async (listener)=>{ - var returned; - if ("none" !== listener.status) { - "once" === listener.status && (listener.status = "none"); - try { - if (returned = "function" == typeof listener.cb ? listener.cb(...args) : void 0, "function" == typeof (null != returned ? returned.then : void 0)) return await returned; - return returned; - } catch (error) { - return this.trigger("error", error), null; - } + return clearInterval(this.interval), "function" == typeof (base = this.interval = setInterval(async ()=>{ + var k, ref, results, time, v; + for(k in time = Date.now(), ref = this.instances, results = [], ref){ + v = ref[k]; + try { + await v._store.__groupCheck__(time) ? results.push(this.deleteKey(k)) : results.push(void 0); + } catch (error) { + results.push(v.Events.trigger("error", error)); } - }))).find(function(x) { - return null != x; - }); - } catch (error) { - return this.trigger("error", error), null; - } - } - }, Queues = class { - constructor(num_priorities){ - this.Events = new Events(this), this._length = 0, this._lists = (function() { - var j, results; - for(results = [], j = 1; 1 <= num_priorities ? j <= num_priorities : j >= num_priorities; 1 <= num_priorities ? ++j : --j)results.push(new DLList(()=>this.incr(), ()=>this.decr())); + } return results; - }).call(this); - } - incr() { - if (0 == this._length++) return this.Events.trigger("leftzero"); - } - decr() { - if (0 == --this._length) return this.Events.trigger("zero"); - } - push(job) { - return this._lists[job.options.priority].push(job); - } - queued(priority) { - return null != priority ? this._lists[priority].length : this._length; - } - shiftAll(fn) { - return this._lists.forEach(function(list) { - return list.forEachShift(fn); - }); - } - getFirst(arr = this._lists) { - var j, len, list; - for(j = 0, len = arr.length; j < len; j++)if ((list = arr[j]).length > 0) return list; - return []; - } - shiftLastFrom(priority) { - return this.getFirst(this._lists.slice(priority).reverse()).shift(); - } - }, BottleneckError = class extends Error { - }, Job = class { - constructor(task, args, options, jobDefaults, rejectOnDrop, Events, _states, Promise1){ - this.task = task, this.args = args, this.rejectOnDrop = rejectOnDrop, this.Events = Events, this._states = _states, this.Promise = Promise1, this.options = parser.load(options, jobDefaults), this.options.priority = this._sanitizePriority(this.options.priority), this.options.id === jobDefaults.id && (this.options.id = `${this.options.id}-${this._randomIndex()}`), this.promise = new this.Promise((_resolve, _reject)=>{ - this._resolve = _resolve, this._reject = _reject; - }), this.retryCount = 0; - } - _sanitizePriority(priority) { - var sProperty; - return (sProperty = ~~priority !== priority ? 5 : priority) < 0 ? 0 : sProperty > 9 ? 9 : sProperty; - } - _randomIndex() { - return Math.random().toString(36).slice(2); - } - doDrop({ error , message ="This job has been dropped by Bottleneck" } = {}) { - return !!this._states.remove(this.options.id) && (this.rejectOnDrop && this._reject(null != error ? error : new BottleneckError(message)), this.Events.trigger("dropped", { - args: this.args, - options: this.options, - task: this.task, - promise: this.promise - }), !0); - } - _assertStatus(expected) { - var status; - if (!((status = this._states.jobStatus(this.options.id)) === expected || "DONE" === expected && null === status)) throw new BottleneckError(`Invalid job status ${status}, expected ${expected}. Please open an issue at https://github.com/SGrondin/bottleneck/issues`); - } - doReceive() { - return this._states.start(this.options.id), this.Events.trigger("received", { - args: this.args, - options: this.options - }); + }, this.timeout / 2)).unref ? base.unref() : void 0; } - doQueue(reachedHWM, blocked) { - return this._assertStatus("RECEIVED"), this._states.next(this.options.id), this.Events.trigger("queued", { - args: this.args, - options: this.options, - reachedHWM, - blocked - }); + updateSettings(options = {}) { + if (parser.overwrite(options, this.defaults, this), parser.overwrite(options, options, this.limiterOptions), null != options.timeout) return this._startAutoCleanup(); } - doRun() { - return 0 === this.retryCount ? (this._assertStatus("QUEUED"), this._states.next(this.options.id)) : this._assertStatus("EXECUTING"), this.Events.trigger("scheduled", { - args: this.args, - options: this.options + disconnect(flush = !0) { + var ref; + if (!this.sharedConnection) return null != (ref = this.connection) ? ref.disconnect(flush) : void 0; + } + } + return Group.prototype.defaults = { + timeout: 300000, + connection: null, + Promise: Promise, + id: "group-key" + }, Group; + }).call(commonjsGlobal), Batcher = (function() { + class Batcher { + constructor(options = {}){ + this.options = options, parser.load(this.options, this.defaults, this), this.Events = new Events(this), this._arr = [], this._resetPromise(), this._lastFlush = Date.now(); + } + _resetPromise() { + return this._promise = new this.Promise((res, rej)=>this._resolve = res); + } + _flush() { + return clearTimeout(this._timeout), this._lastFlush = Date.now(), this._resolve(), this.Events.trigger("batch", this._arr), this._arr = [], this._resetPromise(); + } + add(data) { + var ret; + return this._arr.push(data), ret = this._promise, this._arr.length === this.maxSize ? this._flush() : null != this.maxTime && 1 === this._arr.length && (this._timeout = setTimeout(()=>this._flush(), this.maxTime)), ret; + } + } + return Batcher.prototype.defaults = { + maxTime: null, + maxSize: null, + Promise: Promise + }, Batcher; + }).call(commonjsGlobal), require$$4$1 = ()=>console.log('You must import the full version of Bottleneck in order to use this feature.'), require$$8 = version$2 && version$2.default || version$2, splice = [].splice, Job$1 = class { + constructor(task, args, options, jobDefaults, rejectOnDrop, Events, _states, Promise1){ + this.task = task, this.args = args, this.rejectOnDrop = rejectOnDrop, this.Events = Events, this._states = _states, this.Promise = Promise1, this.options = parser.load(options, jobDefaults), this.options.priority = this._sanitizePriority(this.options.priority), this.options.id === jobDefaults.id && (this.options.id = `${this.options.id}-${this._randomIndex()}`), this.promise = new this.Promise((_resolve, _reject)=>{ + this._resolve = _resolve, this._reject = _reject; + }), this.retryCount = 0; + } + _sanitizePriority(priority) { + var sProperty; + return (sProperty = ~~priority !== priority ? 5 : priority) < 0 ? 0 : sProperty > 9 ? 9 : sProperty; + } + _randomIndex() { + return Math.random().toString(36).slice(2); + } + doDrop({ error , message ="This job has been dropped by Bottleneck" } = {}) { + return !!this._states.remove(this.options.id) && (this.rejectOnDrop && this._reject(null != error ? error : new BottleneckError_1(message)), this.Events.trigger("dropped", { + args: this.args, + options: this.options, + task: this.task, + promise: this.promise + }), !0); + } + _assertStatus(expected) { + var status; + if (!((status = this._states.jobStatus(this.options.id)) === expected || "DONE" === expected && null === status)) throw new BottleneckError_1(`Invalid job status ${status}, expected ${expected}. Please open an issue at https://github.com/SGrondin/bottleneck/issues`); + } + doReceive() { + return this._states.start(this.options.id), this.Events.trigger("received", { + args: this.args, + options: this.options + }); + } + doQueue(reachedHWM, blocked) { + return this._assertStatus("RECEIVED"), this._states.next(this.options.id), this.Events.trigger("queued", { + args: this.args, + options: this.options, + reachedHWM, + blocked + }); + } + doRun() { + return 0 === this.retryCount ? (this._assertStatus("QUEUED"), this._states.next(this.options.id)) : this._assertStatus("EXECUTING"), this.Events.trigger("scheduled", { + args: this.args, + options: this.options + }); + } + async doExecute(chained, clearGlobalState, run, free) { + var eventInfo, passed; + 0 === this.retryCount ? (this._assertStatus("RUNNING"), this._states.next(this.options.id)) : this._assertStatus("EXECUTING"), eventInfo = { + args: this.args, + options: this.options, + retryCount: this.retryCount + }, this.Events.trigger("executing", eventInfo); + try { + if (passed = await (null != chained ? chained.schedule(this.options, this.task, ...this.args) : this.task(...this.args)), clearGlobalState()) return this.doDone(eventInfo), await free(this.options, eventInfo), this._assertStatus("DONE"), this._resolve(passed); + } catch (error1) { + return this._onFailure(error1, eventInfo, clearGlobalState, run, free); + } + } + doExpire(clearGlobalState, run, free) { + var error, eventInfo; + return this._states.jobStatus("RUNNING" === this.options.id) && this._states.next(this.options.id), this._assertStatus("EXECUTING"), eventInfo = { + args: this.args, + options: this.options, + retryCount: this.retryCount + }, error = new BottleneckError_1(`This job timed out after ${this.options.expiration} ms.`), this._onFailure(error, eventInfo, clearGlobalState, run, free); + } + async _onFailure(error, eventInfo, clearGlobalState, run, free) { + var retry, retryAfter; + if (clearGlobalState()) return null != (retry = await this.Events.trigger("failed", error, eventInfo)) ? (retryAfter = ~~retry, this.Events.trigger("retry", `Retrying ${this.options.id} after ${retryAfter} ms`, eventInfo), this.retryCount++, run(retryAfter)) : (this.doDone(eventInfo), await free(this.options, eventInfo), this._assertStatus("DONE"), this._reject(error)); + } + doDone(eventInfo) { + return this._assertStatus("EXECUTING"), this._states.next(this.options.id), this.Events.trigger("done", eventInfo); + } + }, LocalDatastore$1 = class { + constructor(instance, storeOptions, storeInstanceOptions){ + this.instance = instance, this.storeOptions = storeOptions, this.clientId = this.instance._randomIndex(), parser.load(storeInstanceOptions, storeInstanceOptions, this), this._nextRequest = this._lastReservoirRefresh = this._lastReservoirIncrease = Date.now(), this._running = 0, this._done = 0, this._unblockTime = 0, this.ready = this.Promise.resolve(), this.clients = {}, this._startHeartbeat(); + } + _startHeartbeat() { + var base; + return null == this.heartbeat && (null != this.storeOptions.reservoirRefreshInterval && null != this.storeOptions.reservoirRefreshAmount || null != this.storeOptions.reservoirIncreaseInterval && null != this.storeOptions.reservoirIncreaseAmount) ? "function" == typeof (base = this.heartbeat = setInterval(()=>{ + var amount, incr, maximum, now, reservoir; + if (now = Date.now(), null != this.storeOptions.reservoirRefreshInterval && now >= this._lastReservoirRefresh + this.storeOptions.reservoirRefreshInterval && (this._lastReservoirRefresh = now, this.storeOptions.reservoir = this.storeOptions.reservoirRefreshAmount, this.instance._drainAll(this.computeCapacity())), null != this.storeOptions.reservoirIncreaseInterval && now >= this._lastReservoirIncrease + this.storeOptions.reservoirIncreaseInterval && ({ reservoirIncreaseAmount: amount , reservoirIncreaseMaximum: maximum , reservoir } = this.storeOptions, this._lastReservoirIncrease = now, (incr = null != maximum ? Math.min(amount, maximum - reservoir) : amount) > 0)) return this.storeOptions.reservoir += incr, this.instance._drainAll(this.computeCapacity()); + }, this.heartbeatInterval)).unref ? base.unref() : void 0 : clearInterval(this.heartbeat); + } + async __publish__(message) { + return await this.yieldLoop(), this.instance.Events.trigger("message", message.toString()); + } + async __disconnect__(flush) { + return await this.yieldLoop(), clearInterval(this.heartbeat), this.Promise.resolve(); + } + yieldLoop(t = 0) { + return new this.Promise(function(resolve, reject) { + return setTimeout(resolve, t); + }); + } + computePenalty() { + var ref; + return null != (ref = this.storeOptions.penalty) ? ref : 15 * this.storeOptions.minTime || 5000; + } + async __updateSettings__(options) { + return await this.yieldLoop(), parser.overwrite(options, options, this.storeOptions), this._startHeartbeat(), this.instance._drainAll(this.computeCapacity()), !0; + } + async __running__() { + return await this.yieldLoop(), this._running; + } + async __queued__() { + return await this.yieldLoop(), this.instance.queued(); + } + async __done__() { + return await this.yieldLoop(), this._done; + } + async __groupCheck__(time) { + return await this.yieldLoop(), this._nextRequest + this.timeout < time; + } + computeCapacity() { + var maxConcurrent, reservoir; + return ({ maxConcurrent , reservoir } = this.storeOptions, null != maxConcurrent && null != reservoir) ? Math.min(maxConcurrent - this._running, reservoir) : null != maxConcurrent ? maxConcurrent - this._running : null != reservoir ? reservoir : null; + } + conditionsCheck(weight) { + var capacity; + return null == (capacity = this.computeCapacity()) || weight <= capacity; + } + async __incrementReservoir__(incr) { + var reservoir; + return await this.yieldLoop(), reservoir = this.storeOptions.reservoir += incr, this.instance._drainAll(this.computeCapacity()), reservoir; + } + async __currentReservoir__() { + return await this.yieldLoop(), this.storeOptions.reservoir; + } + isBlocked(now) { + return this._unblockTime >= now; + } + check(weight, now) { + return this.conditionsCheck(weight) && this._nextRequest - now <= 0; + } + async __check__(weight) { + var now; + return await this.yieldLoop(), now = Date.now(), this.check(weight, now); + } + async __register__(index, weight, expiration) { + var now, wait; + return (await this.yieldLoop(), now = Date.now(), this.conditionsCheck(weight)) ? (this._running += weight, null != this.storeOptions.reservoir && (this.storeOptions.reservoir -= weight), wait = Math.max(this._nextRequest - now, 0), this._nextRequest = now + wait + this.storeOptions.minTime, { + success: !0, + wait, + reservoir: this.storeOptions.reservoir + }) : { + success: !1 + }; + } + strategyIsBlock() { + return 3 === this.storeOptions.strategy; + } + async __submit__(queueLength, weight) { + var blocked, now, reachedHWM; + if (await this.yieldLoop(), null != this.storeOptions.maxConcurrent && weight > this.storeOptions.maxConcurrent) throw new BottleneckError_1(`Impossible to add a job having a weight of ${weight} to a limiter having a maxConcurrent setting of ${this.storeOptions.maxConcurrent}`); + return now = Date.now(), reachedHWM = null != this.storeOptions.highWater && queueLength === this.storeOptions.highWater && !this.check(weight, now), (blocked = this.strategyIsBlock() && (reachedHWM || this.isBlocked(now))) && (this._unblockTime = now + this.computePenalty(), this._nextRequest = this._unblockTime + this.storeOptions.minTime, this.instance._dropAllQueued()), { + reachedHWM, + blocked, + strategy: this.storeOptions.strategy + }; + } + async __free__(index, weight) { + return await this.yieldLoop(), this._running -= weight, this._done += weight, this.instance._drainAll(this.computeCapacity()), { + running: this._running + }; + } + }, Bottleneck_1 = (function() { + class Bottleneck { + constructor(options = {}, ...invalid){ + var storeInstanceOptions, storeOptions; + this._addToQueue = this._addToQueue.bind(this), this._validateOptions(options, invalid), parser.load(options, this.instanceDefaults, this), this._queues = new Queues(10), this._scheduled = {}, this._states = new States([ + "RECEIVED", + "QUEUED", + "RUNNING", + "EXECUTING" + ].concat(this.trackDoneStatus ? [ + "DONE" + ] : [])), this._limiter = null, this.Events = new Events(this), this._submitLock = new Sync("submit", this.Promise), this._registerLock = new Sync("register", this.Promise), storeOptions = parser.load(options, this.storeDefaults, {}), this._store = (function() { + if ("redis" === this.datastore || "ioredis" === this.datastore || null != this.connection) return storeInstanceOptions = parser.load(options, this.redisStoreDefaults, {}), new require$$4$1(this, storeOptions, storeInstanceOptions); + if ("local" === this.datastore) return storeInstanceOptions = parser.load(options, this.localStoreDefaults, {}), new LocalDatastore$1(this, storeOptions, storeInstanceOptions); + throw new Bottleneck.prototype.BottleneckError(`Invalid datastore type: ${this.datastore}`); + }).call(this), this._queues.on("leftzero", ()=>{ + var ref; + return null != (ref = this._store.heartbeat) && "function" == typeof ref.ref ? ref.ref() : void 0; + }), this._queues.on("zero", ()=>{ + var ref; + return null != (ref = this._store.heartbeat) && "function" == typeof ref.unref ? ref.unref() : void 0; }); } - async doExecute(chained, clearGlobalState, run, free) { - var eventInfo, passed; - 0 === this.retryCount ? (this._assertStatus("RUNNING"), this._states.next(this.options.id)) : this._assertStatus("EXECUTING"), eventInfo = { - args: this.args, - options: this.options, - retryCount: this.retryCount - }, this.Events.trigger("executing", eventInfo); - try { - if (passed = await (null != chained ? chained.schedule(this.options, this.task, ...this.args) : this.task(...this.args)), clearGlobalState()) return this.doDone(eventInfo), await free(this.options, eventInfo), this._assertStatus("DONE"), this._resolve(passed); - } catch (error1) { - return this._onFailure(error1, eventInfo, clearGlobalState, run, free); - } + _validateOptions(options, invalid) { + if (!(null != options && "object" == typeof options && 0 === invalid.length)) throw new Bottleneck.prototype.BottleneckError("Bottleneck v2 takes a single object argument. Refer to https://github.com/SGrondin/bottleneck#upgrading-to-v2 if you're upgrading from Bottleneck v1."); } - doExpire(clearGlobalState, run, free) { - var error, eventInfo; - return this._states.jobStatus("RUNNING" === this.options.id) && this._states.next(this.options.id), this._assertStatus("EXECUTING"), eventInfo = { - args: this.args, - options: this.options, - retryCount: this.retryCount - }, error = new BottleneckError(`This job timed out after ${this.options.expiration} ms.`), this._onFailure(error, eventInfo, clearGlobalState, run, free); + ready() { + return this._store.ready; } - async _onFailure(error, eventInfo, clearGlobalState, run, free) { - var retry, retryAfter; - if (clearGlobalState()) return null != (retry = await this.Events.trigger("failed", error, eventInfo)) ? (retryAfter = ~~retry, this.Events.trigger("retry", `Retrying ${this.options.id} after ${retryAfter} ms`, eventInfo), this.retryCount++, run(retryAfter)) : (this.doDone(eventInfo), await free(this.options, eventInfo), this._assertStatus("DONE"), this._reject(error)); + clients() { + return this._store.clients; } - doDone(eventInfo) { - return this._assertStatus("EXECUTING"), this._states.next(this.options.id), this.Events.trigger("done", eventInfo); + channel() { + return `b_${this.id}`; } - }, LocalDatastore = class { - constructor(instance, storeOptions, storeInstanceOptions){ - this.instance = instance, this.storeOptions = storeOptions, this.clientId = this.instance._randomIndex(), parser.load(storeInstanceOptions, storeInstanceOptions, this), this._nextRequest = this._lastReservoirRefresh = this._lastReservoirIncrease = Date.now(), this._running = 0, this._done = 0, this._unblockTime = 0, this.ready = this.Promise.resolve(), this.clients = {}, this._startHeartbeat(); + channel_client() { + return `b_${this.id}_${this._store.clientId}`; } - _startHeartbeat() { - var base; - return null == this.heartbeat && (null != this.storeOptions.reservoirRefreshInterval && null != this.storeOptions.reservoirRefreshAmount || null != this.storeOptions.reservoirIncreaseInterval && null != this.storeOptions.reservoirIncreaseAmount) ? "function" == typeof (base = this.heartbeat = setInterval(()=>{ - var amount, incr, maximum, now, reservoir; - if (now = Date.now(), null != this.storeOptions.reservoirRefreshInterval && now >= this._lastReservoirRefresh + this.storeOptions.reservoirRefreshInterval && (this._lastReservoirRefresh = now, this.storeOptions.reservoir = this.storeOptions.reservoirRefreshAmount, this.instance._drainAll(this.computeCapacity())), null != this.storeOptions.reservoirIncreaseInterval && now >= this._lastReservoirIncrease + this.storeOptions.reservoirIncreaseInterval && ({ reservoirIncreaseAmount: amount , reservoirIncreaseMaximum: maximum , reservoir } = this.storeOptions, this._lastReservoirIncrease = now, (incr = null != maximum ? Math.min(amount, maximum - reservoir) : amount) > 0)) return this.storeOptions.reservoir += incr, this.instance._drainAll(this.computeCapacity()); - }, this.heartbeatInterval)).unref ? base.unref() : void 0 : clearInterval(this.heartbeat); + publish(message) { + return this._store.__publish__(message); } - async __publish__(message) { - return await this.yieldLoop(), this.instance.Events.trigger("message", message.toString()); + disconnect(flush = !0) { + return this._store.__disconnect__(flush); } - async __disconnect__(flush) { - return await this.yieldLoop(), clearInterval(this.heartbeat), this.Promise.resolve(); + chain(_limiter) { + return this._limiter = _limiter, this; } - yieldLoop(t = 0) { - return new this.Promise(function(resolve, reject) { - return setTimeout(resolve, t); - }); - } - computePenalty() { - var ref; - return null != (ref = this.storeOptions.penalty) ? ref : 15 * this.storeOptions.minTime || 5000; - } - async __updateSettings__(options) { - return await this.yieldLoop(), parser.overwrite(options, options, this.storeOptions), this._startHeartbeat(), this.instance._drainAll(this.computeCapacity()), !0; - } - async __running__() { - return await this.yieldLoop(), this._running; - } - async __queued__() { - return await this.yieldLoop(), this.instance.queued(); - } - async __done__() { - return await this.yieldLoop(), this._done; + queued(priority) { + return this._queues.queued(priority); } - async __groupCheck__(time) { - return await this.yieldLoop(), this._nextRequest + this.timeout < time; + clusterQueued() { + return this._store.__queued__(); } - computeCapacity() { - var maxConcurrent, reservoir; - return ({ maxConcurrent , reservoir } = this.storeOptions, null != maxConcurrent && null != reservoir) ? Math.min(maxConcurrent - this._running, reservoir) : null != maxConcurrent ? maxConcurrent - this._running : null != reservoir ? reservoir : null; + empty() { + return 0 === this.queued() && this._submitLock.isEmpty(); } - conditionsCheck(weight) { - var capacity; - return null == (capacity = this.computeCapacity()) || weight <= capacity; + running() { + return this._store.__running__(); } - async __incrementReservoir__(incr) { - var reservoir; - return await this.yieldLoop(), reservoir = this.storeOptions.reservoir += incr, this.instance._drainAll(this.computeCapacity()), reservoir; + done() { + return this._store.__done__(); } - async __currentReservoir__() { - return await this.yieldLoop(), this.storeOptions.reservoir; + jobStatus(id) { + return this._states.jobStatus(id); } - isBlocked(now) { - return this._unblockTime >= now; + jobs(status) { + return this._states.statusJobs(status); } - check(weight, now) { - return this.conditionsCheck(weight) && this._nextRequest - now <= 0; + counts() { + return this._states.statusCounts(); } - async __check__(weight) { - var now; - return await this.yieldLoop(), now = Date.now(), this.check(weight, now); + _randomIndex() { + return Math.random().toString(36).slice(2); } - async __register__(index, weight, expiration) { - var now, wait; - return (await this.yieldLoop(), now = Date.now(), this.conditionsCheck(weight)) ? (this._running += weight, null != this.storeOptions.reservoir && (this.storeOptions.reservoir -= weight), wait = Math.max(this._nextRequest - now, 0), this._nextRequest = now + wait + this.storeOptions.minTime, { - success: !0, - wait, - reservoir: this.storeOptions.reservoir - }) : { - success: !1 - }; + check(weight = 1) { + return this._store.__check__(weight); } - strategyIsBlock() { - return 3 === this.storeOptions.strategy; + _clearGlobalState(index) { + return null != this._scheduled[index] && (clearTimeout(this._scheduled[index].expiration), delete this._scheduled[index], !0); } - async __submit__(queueLength, weight) { - var blocked, now, reachedHWM; - if (await this.yieldLoop(), null != this.storeOptions.maxConcurrent && weight > this.storeOptions.maxConcurrent) throw new BottleneckError(`Impossible to add a job having a weight of ${weight} to a limiter having a maxConcurrent setting of ${this.storeOptions.maxConcurrent}`); - return now = Date.now(), reachedHWM = null != this.storeOptions.highWater && queueLength === this.storeOptions.highWater && !this.check(weight, now), (blocked = this.strategyIsBlock() && (reachedHWM || this.isBlocked(now))) && (this._unblockTime = now + this.computePenalty(), this._nextRequest = this._unblockTime + this.storeOptions.minTime, this.instance._dropAllQueued()), { - reachedHWM, - blocked, - strategy: this.storeOptions.strategy - }; + async _free(index, job, options, eventInfo) { + var running; + try { + if ({ running } = await this._store.__free__(index, options.weight), this.Events.trigger("debug", `Freed ${options.id}`, eventInfo), 0 === running && this.empty()) return this.Events.trigger("idle"); + } catch (error1) { + return this.Events.trigger("error", error1); + } } - async __free__(index, weight) { - return await this.yieldLoop(), this._running -= weight, this._done += weight, this.instance._drainAll(this.computeCapacity()), { - running: this._running + _run(index, job, wait) { + var clearGlobalState, free, run; + return job.doRun(), clearGlobalState = this._clearGlobalState.bind(this, index), run = this._run.bind(this, index, job), free = this._free.bind(this, index, job), this._scheduled[index] = { + timeout: setTimeout(()=>job.doExecute(this._limiter, clearGlobalState, run, free), wait), + expiration: null != job.options.expiration ? setTimeout(function() { + return job.doExpire(clearGlobalState, run, free); + }, wait + job.options.expiration) : void 0, + job: job }; } - }, States = class { - constructor(status1){ - this.status = status1, this._jobs = {}, this.counts = this.status.map(function() { - return 0; + _drainOne(capacity) { + return this._registerLock.schedule(()=>{ + var args, index, next, options, queue; + return 0 === this.queued() ? this.Promise.resolve(null) : (queue = this._queues.getFirst(), { options , args } = next = queue.first(), null != capacity && options.weight > capacity) ? this.Promise.resolve(null) : (this.Events.trigger("debug", `Draining ${options.id}`, { + args, + options + }), index = this._randomIndex(), this._store.__register__(index, options.weight, options.expiration).then(({ success , wait , reservoir })=>{ + var empty; + return (this.Events.trigger("debug", `Drained ${options.id}`, { + success, + args, + options + }), success) ? (queue.shift(), (empty = this.empty()) && this.Events.trigger("empty"), 0 === reservoir && this.Events.trigger("depleted", empty), this._run(index, next, wait), this.Promise.resolve(options.weight)) : this.Promise.resolve(null); + })); }); } - next(id) { - var current, next; - return (next = (current = this._jobs[id]) + 1, null != current && next < this.status.length) ? (this.counts[current]--, this.counts[next]++, this._jobs[id]++) : null != current ? (this.counts[current]--, delete this._jobs[id]) : void 0; - } - start(id) { - return this._jobs[id] = 0, this.counts[0]++; - } - remove(id) { - var current; - return null != (current = this._jobs[id]) && (this.counts[current]--, delete this._jobs[id]), null != current; - } - jobStatus(id) { - var ref; - return null != (ref = this.status[this._jobs[id]]) ? ref : null; - } - statusJobs(status) { - var k, pos, ref, results; - if (null == status) return Object.keys(this._jobs); - if ((pos = this.status.indexOf(status)) < 0) throw new BottleneckError(`status must be one of ${this.status.join(', ')}`); - for(k in ref = this._jobs, results = [], ref)ref[k] === pos && results.push(k); - return results; + _drainAll(capacity, total = 0) { + return this._drainOne(capacity).then((drained)=>null != drained ? this._drainAll(null != capacity ? capacity - drained : capacity, total + drained) : this.Promise.resolve(total)).catch((e)=>this.Events.trigger("error", e)); } - statusCounts() { - return this.counts.reduce((acc, v, i)=>(acc[this.status[i]] = v, acc), {}); - } - }, Sync = class { - constructor(name, Promise1){ - this.schedule = this.schedule.bind(this), this.name = name, this.Promise = Promise1, this._running = 0, this._queue = new DLList(); - } - isEmpty() { - return 0 === this._queue.length; - } - async _tryToRun() { - var args, cb, reject, resolve, returned, task; - if (this._running < 1 && this._queue.length > 0) return this._running++, { task , args , resolve , reject } = this._queue.shift(), cb = await async function() { - try { - return returned = await task(...args), function() { - return resolve(returned); - }; - } catch (error1) { - return function() { - return reject(error1); - }; - } - }(), this._running--, this._tryToRun(), cb(); - } - schedule(task, ...args) { - var promise, reject, resolve; - return resolve = reject = null, promise = new this.Promise(function(_resolve, _reject) { - return resolve = _resolve, reject = _reject; - }), this._queue.push({ - task, - args, - resolve, - reject - }), this._tryToRun(), promise; - } - }; - var version = "2.19.5", version$2 = Object.freeze({ - version: version, - default: { - version: version - } - }), require$$2 = ()=>console.log('You must import the full version of Bottleneck in order to use this feature.'), require$$3 = ()=>console.log('You must import the full version of Bottleneck in order to use this feature.'), require$$4 = ()=>console.log('You must import the full version of Bottleneck in order to use this feature.'); - Group = (function() { - class Group { - constructor(limiterOptions = {}){ - this.deleteKey = this.deleteKey.bind(this), this.limiterOptions = limiterOptions, parser.load(this.limiterOptions, this.defaults, this), this.Events = new Events(this), this.instances = {}, this.Bottleneck = Bottleneck_1, this._startAutoCleanup(), this.sharedConnection = null != this.connection, null == this.connection && ("redis" === this.limiterOptions.datastore ? this.connection = new require$$2(Object.assign({}, this.limiterOptions, { - Events: this.Events - })) : "ioredis" === this.limiterOptions.datastore && (this.connection = new require$$3(Object.assign({}, this.limiterOptions, { - Events: this.Events - })))); - } - key(key = "") { - var ref; - return null != (ref = this.instances[key]) ? ref : (()=>{ - var limiter; - return limiter = this.instances[key] = new this.Bottleneck(Object.assign(this.limiterOptions, { - id: `${this.id}-${key}`, - timeout: this.timeout, - connection: this.connection - })), this.Events.trigger("created", limiter, key), limiter; - })(); - } - async deleteKey(key = "") { - var deleted, instance; - return instance = this.instances[key], this.connection && (deleted = await this.connection.__runCommand__([ - 'del', - ...require$$4.allKeys(`${this.id}-${key}`) - ])), null != instance && (delete this.instances[key], await instance.disconnect()), null != instance || deleted > 0; - } - limiters() { - var k, ref, results, v; - for(k in ref = this.instances, results = [], ref)v = ref[k], results.push({ - key: k, - limiter: v + _dropAllQueued(message) { + return this._queues.shiftAll(function(job) { + return job.doDrop({ + message }); - return results; - } - keys() { - return Object.keys(this.instances); - } - async clusterKeys() { - var cursor, found, i, k, keys, len, next, start; - if (null == this.connection) return this.Promise.resolve(this.keys()); - for(keys = [], cursor = null, start = `b_${this.id}-`.length; 0 !== cursor;)for(i = 0, [next, found] = await this.connection.__runCommand__([ - "scan", - null != cursor ? cursor : 0, - "match", - `b_${this.id}-*_settings`, - "count", - 10000 - ]), cursor = ~~next, len = found.length; i < len; i++)k = found[i], keys.push(k.slice(start, -9)); - return keys; - } - _startAutoCleanup() { - var base; - return clearInterval(this.interval), "function" == typeof (base = this.interval = setInterval(async ()=>{ - var k, ref, results, time, v; - for(k in time = Date.now(), ref = this.instances, results = [], ref){ - v = ref[k]; - try { - await v._store.__groupCheck__(time) ? results.push(this.deleteKey(k)) : results.push(void 0); - } catch (error) { - results.push(v.Events.trigger("error", error)); - } - } - return results; - }, this.timeout / 2)).unref ? base.unref() : void 0; - } - updateSettings(options = {}) { - if (parser.overwrite(options, this.defaults, this), parser.overwrite(options, options, this.limiterOptions), null != options.timeout) return this._startAutoCleanup(); - } - disconnect(flush = !0) { - var ref; - if (!this.sharedConnection) return null != (ref = this.connection) ? ref.disconnect(flush) : void 0; - } - } - return Group.prototype.defaults = { - timeout: 300000, - connection: null, - Promise: Promise, - id: "group-key" - }, Group; - }).call(commonjsGlobal), Batcher = (function() { - class Batcher { - constructor(options = {}){ - this.options = options, parser.load(this.options, this.defaults, this), this.Events = new Events(this), this._arr = [], this._resetPromise(), this._lastFlush = Date.now(); - } - _resetPromise() { - return this._promise = new this.Promise((res, rej)=>this._resolve = res); - } - _flush() { - return clearTimeout(this._timeout), this._lastFlush = Date.now(), this._resolve(), this.Events.trigger("batch", this._arr), this._arr = [], this._resetPromise(); - } - add(data) { - var ret; - return this._arr.push(data), ret = this._promise, this._arr.length === this.maxSize ? this._flush() : null != this.maxTime && 1 === this._arr.length && (this._timeout = setTimeout(()=>this._flush(), this.maxTime)), ret; - } + }); } - return Batcher.prototype.defaults = { - maxTime: null, - maxSize: null, - Promise: Promise - }, Batcher; - }).call(commonjsGlobal); - var DLList, Events, Queues, BottleneckError, Job, LocalDatastore, States, Sync, Group, Batcher, require$$4$1 = ()=>console.log('You must import the full version of Bottleneck in order to use this feature.'), require$$8 = version$2 && version$2.default || version$2, splice = [].splice, Bottleneck_1 = (function() { - class Bottleneck { - constructor(options = {}, ...invalid){ - var storeInstanceOptions, storeOptions; - this._addToQueue = this._addToQueue.bind(this), this._validateOptions(options, invalid), parser.load(options, this.instanceDefaults, this), this._queues = new Queues(10), this._scheduled = {}, this._states = new States([ - "RECEIVED", - "QUEUED", - "RUNNING", - "EXECUTING" - ].concat(this.trackDoneStatus ? [ - "DONE" - ] : [])), this._limiter = null, this.Events = new Events(this), this._submitLock = new Sync("submit", this.Promise), this._registerLock = new Sync("register", this.Promise), storeOptions = parser.load(options, this.storeDefaults, {}), this._store = (function() { - if ("redis" === this.datastore || "ioredis" === this.datastore || null != this.connection) return storeInstanceOptions = parser.load(options, this.redisStoreDefaults, {}), new require$$4$1(this, storeOptions, storeInstanceOptions); - if ("local" === this.datastore) return storeInstanceOptions = parser.load(options, this.localStoreDefaults, {}), new LocalDatastore(this, storeOptions, storeInstanceOptions); - throw new Bottleneck.prototype.BottleneckError(`Invalid datastore type: ${this.datastore}`); - }).call(this), this._queues.on("leftzero", ()=>{ - var ref; - return null != (ref = this._store.heartbeat) && "function" == typeof ref.ref ? ref.ref() : void 0; - }), this._queues.on("zero", ()=>{ - var ref; - return null != (ref = this._store.heartbeat) && "function" == typeof ref.unref ? ref.unref() : void 0; - }); - } - _validateOptions(options, invalid) { - if (!(null != options && "object" == typeof options && 0 === invalid.length)) throw new Bottleneck.prototype.BottleneckError("Bottleneck v2 takes a single object argument. Refer to https://github.com/SGrondin/bottleneck#upgrading-to-v2 if you're upgrading from Bottleneck v1."); - } - ready() { - return this._store.ready; - } - clients() { - return this._store.clients; - } - channel() { - return `b_${this.id}`; - } - channel_client() { - return `b_${this.id}_${this._store.clientId}`; - } - publish(message) { - return this._store.__publish__(message); - } - disconnect(flush = !0) { - return this._store.__disconnect__(flush); - } - chain(_limiter) { - return this._limiter = _limiter, this; - } - queued(priority) { - return this._queues.queued(priority); - } - clusterQueued() { - return this._store.__queued__(); - } - empty() { - return 0 === this.queued() && this._submitLock.isEmpty(); - } - running() { - return this._store.__running__(); - } - done() { - return this._store.__done__(); - } - jobStatus(id) { - return this._states.jobStatus(id); - } - jobs(status) { - return this._states.statusJobs(status); - } - counts() { - return this._states.statusCounts(); - } - _randomIndex() { - return Math.random().toString(36).slice(2); - } - check(weight = 1) { - return this._store.__check__(weight); - } - _clearGlobalState(index) { - return null != this._scheduled[index] && (clearTimeout(this._scheduled[index].expiration), delete this._scheduled[index], !0); - } - async _free(index, job, options, eventInfo) { - var running; - try { - if ({ running } = await this._store.__free__(index, options.weight), this.Events.trigger("debug", `Freed ${options.id}`, eventInfo), 0 === running && this.empty()) return this.Events.trigger("idle"); - } catch (error1) { - return this.Events.trigger("error", error1); - } - } - _run(index, job, wait) { - var clearGlobalState, free, run; - return job.doRun(), clearGlobalState = this._clearGlobalState.bind(this, index), run = this._run.bind(this, index, job), free = this._free.bind(this, index, job), this._scheduled[index] = { - timeout: setTimeout(()=>job.doExecute(this._limiter, clearGlobalState, run, free), wait), - expiration: null != job.options.expiration ? setTimeout(function() { - return job.doExpire(clearGlobalState, run, free); - }, wait + job.options.expiration) : void 0, - job: job - }; - } - _drainOne(capacity) { - return this._registerLock.schedule(()=>{ - var args, index, next, options, queue; - return 0 === this.queued() ? this.Promise.resolve(null) : (queue = this._queues.getFirst(), { options , args } = next = queue.first(), null != capacity && options.weight > capacity) ? this.Promise.resolve(null) : (this.Events.trigger("debug", `Draining ${options.id}`, { - args, - options - }), index = this._randomIndex(), this._store.__register__(index, options.weight, options.expiration).then(({ success , wait , reservoir })=>{ - var empty; - return (this.Events.trigger("debug", `Drained ${options.id}`, { - success, - args, - options - }), success) ? (queue.shift(), (empty = this.empty()) && this.Events.trigger("empty"), 0 === reservoir && this.Events.trigger("depleted", empty), this._run(index, next, wait), this.Promise.resolve(options.weight)) : this.Promise.resolve(null); + stop(options = {}) { + var done, waitForExecuting; + return options = parser.load(options, this.stopDefaults), waitForExecuting = (at)=>{ + var finished; + return finished = ()=>{ + var counts; + return (counts = this._states.counts)[0] + counts[1] + counts[2] + counts[3] === at; + }, new this.Promise((resolve, reject)=>finished() ? resolve() : this.on("done", ()=>{ + if (finished()) return this.removeAllListeners("done"), resolve(); })); + }, done = options.dropWaitingJobs ? (this._run = function(index, next) { + return next.doDrop({ + message: options.dropErrorMessage }); - } - _drainAll(capacity, total = 0) { - return this._drainOne(capacity).then((drained)=>null != drained ? this._drainAll(null != capacity ? capacity - drained : capacity, total + drained) : this.Promise.resolve(total)).catch((e)=>this.Events.trigger("error", e)); - } - _dropAllQueued(message) { - return this._queues.shiftAll(function(job) { - return job.doDrop({ - message - }); - }); - } - stop(options = {}) { - var done, waitForExecuting; - return options = parser.load(options, this.stopDefaults), waitForExecuting = (at)=>{ - var finished; - return finished = ()=>{ - var counts; - return (counts = this._states.counts)[0] + counts[1] + counts[2] + counts[3] === at; - }, new this.Promise((resolve, reject)=>finished() ? resolve() : this.on("done", ()=>{ - if (finished()) return this.removeAllListeners("done"), resolve(); - })); - }, done = options.dropWaitingJobs ? (this._run = function(index, next) { - return next.doDrop({ + }, this._drainOne = ()=>this.Promise.resolve(null), this._registerLock.schedule(()=>this._submitLock.schedule(()=>{ + var k, ref, v; + for(k in ref = this._scheduled)v = ref[k], "RUNNING" === this.jobStatus(v.job.options.id) && (clearTimeout(v.timeout), clearTimeout(v.expiration), v.job.doDrop({ message: options.dropErrorMessage + })); + return this._dropAllQueued(options.dropErrorMessage), waitForExecuting(0); + }))) : this.schedule({ + priority: 9, + weight: 0 + }, ()=>waitForExecuting(1)), this._receive = function(job) { + return job._reject(new Bottleneck.prototype.BottleneckError(options.enqueueErrorMessage)); + }, this.stop = ()=>this.Promise.reject(new Bottleneck.prototype.BottleneckError("stop() has already been called")), done; + } + async _addToQueue(job) { + var args, blocked, options, reachedHWM, shifted, strategy; + ({ args , options } = job); + try { + ({ reachedHWM , blocked , strategy } = await this._store.__submit__(this.queued(), options.weight)); + } catch (error1) { + return this.Events.trigger("debug", `Could not queue ${options.id}`, { + args, + options, + error: error1 + }), job.doDrop({ + error: error1 + }), !1; + } + return blocked ? (job.doDrop(), !0) : reachedHWM && (null != (shifted = strategy === Bottleneck.prototype.strategy.LEAK ? this._queues.shiftLastFrom(options.priority) : strategy === Bottleneck.prototype.strategy.OVERFLOW_PRIORITY ? this._queues.shiftLastFrom(options.priority + 1) : strategy === Bottleneck.prototype.strategy.OVERFLOW ? job : void 0) && shifted.doDrop(), null == shifted || strategy === Bottleneck.prototype.strategy.OVERFLOW) ? (null == shifted && job.doDrop(), reachedHWM) : (job.doQueue(reachedHWM, blocked), this._queues.push(job), await this._drainAll(), reachedHWM); + } + _receive(job) { + return null != this._states.jobStatus(job.options.id) ? (job._reject(new Bottleneck.prototype.BottleneckError(`A job with the same id already exists (id=${job.options.id})`)), !1) : (job.doReceive(), this._submitLock.schedule(this._addToQueue, job)); + } + submit(...args) { + var cb, fn, job, options, ref, ref1, task; + return "function" == typeof args[0] ? (ref = args, [fn, ...args] = ref, [cb] = splice.call(args, -1), options = parser.load({}, this.jobDefaults)) : (ref1 = args, [options, fn, ...args] = ref1, [cb] = splice.call(args, -1), options = parser.load(options, this.jobDefaults)), task = (...args)=>new this.Promise(function(resolve, reject) { + return fn(...args, function(...args) { + return (null != args[0] ? reject : resolve)(args); }); - }, this._drainOne = ()=>this.Promise.resolve(null), this._registerLock.schedule(()=>this._submitLock.schedule(()=>{ - var k, ref, v; - for(k in ref = this._scheduled)v = ref[k], "RUNNING" === this.jobStatus(v.job.options.id) && (clearTimeout(v.timeout), clearTimeout(v.expiration), v.job.doDrop({ - message: options.dropErrorMessage - })); - return this._dropAllQueued(options.dropErrorMessage), waitForExecuting(0); - }))) : this.schedule({ - priority: 9, - weight: 0 - }, ()=>waitForExecuting(1)), this._receive = function(job) { - return job._reject(new Bottleneck.prototype.BottleneckError(options.enqueueErrorMessage)); - }, this.stop = ()=>this.Promise.reject(new Bottleneck.prototype.BottleneckError("stop() has already been called")), done; - } - async _addToQueue(job) { - var args, blocked, options, reachedHWM, shifted, strategy; - ({ args , options } = job); - try { - ({ reachedHWM , blocked , strategy } = await this._store.__submit__(this.queued(), options.weight)); - } catch (error1) { - return this.Events.trigger("debug", `Could not queue ${options.id}`, { - args, - options, - error: error1 - }), job.doDrop({ - error: error1 - }), !1; - } - return blocked ? (job.doDrop(), !0) : reachedHWM && (null != (shifted = strategy === Bottleneck.prototype.strategy.LEAK ? this._queues.shiftLastFrom(options.priority) : strategy === Bottleneck.prototype.strategy.OVERFLOW_PRIORITY ? this._queues.shiftLastFrom(options.priority + 1) : strategy === Bottleneck.prototype.strategy.OVERFLOW ? job : void 0) && shifted.doDrop(), null == shifted || strategy === Bottleneck.prototype.strategy.OVERFLOW) ? (null == shifted && job.doDrop(), reachedHWM) : (job.doQueue(reachedHWM, blocked), this._queues.push(job), await this._drainAll(), reachedHWM); - } - _receive(job) { - return null != this._states.jobStatus(job.options.id) ? (job._reject(new Bottleneck.prototype.BottleneckError(`A job with the same id already exists (id=${job.options.id})`)), !1) : (job.doReceive(), this._submitLock.schedule(this._addToQueue, job)); - } - submit(...args) { - var cb, fn, job, options, ref, ref1, task; - return "function" == typeof args[0] ? (ref = args, [fn, ...args] = ref, [cb] = splice.call(args, -1), options = parser.load({}, this.jobDefaults)) : (ref1 = args, [options, fn, ...args] = ref1, [cb] = splice.call(args, -1), options = parser.load(options, this.jobDefaults)), task = (...args)=>new this.Promise(function(resolve, reject) { - return fn(...args, function(...args) { - return (null != args[0] ? reject : resolve)(args); - }); - }), (job = new Job(task, args, options, this.jobDefaults, this.rejectOnDrop, this.Events, this._states, this.Promise)).promise.then(function(args) { - return "function" == typeof cb ? cb(...args) : void 0; - }).catch(function(args) { - return Array.isArray(args) ? "function" == typeof cb ? cb(...args) : void 0 : "function" == typeof cb ? cb(args) : void 0; - }), this._receive(job); - } - schedule(...args) { - var job, options, task; - return "function" == typeof args[0] ? ([task, ...args] = args, options = {}) : [options, task, ...args] = args, job = new Job(task, args, options, this.jobDefaults, this.rejectOnDrop, this.Events, this._states, this.Promise), this._receive(job), job.promise; - } - wrap(fn) { - var schedule, wrapped; - return schedule = this.schedule.bind(this), (wrapped = function(...args) { - return schedule(fn.bind(this), ...args); - }).withOptions = function(options, ...args) { - return schedule(options, fn, ...args); - }, wrapped; - } - async updateSettings(options = {}) { - return await this._store.__updateSettings__(parser.overwrite(options, this.storeDefaults)), parser.overwrite(options, this.instanceDefaults, this), this; - } - currentReservoir() { - return this._store.__currentReservoir__(); - } - incrementReservoir(incr = 0) { - return this._store.__incrementReservoir__(incr); - } - } - return Bottleneck.default = Bottleneck, Bottleneck.Events = Events, Bottleneck.version = Bottleneck.prototype.version = require$$8.version, Bottleneck.strategy = Bottleneck.prototype.strategy = { - LEAK: 1, - OVERFLOW: 2, - OVERFLOW_PRIORITY: 4, - BLOCK: 3 - }, Bottleneck.BottleneckError = Bottleneck.prototype.BottleneckError = BottleneckError, Bottleneck.Group = Bottleneck.prototype.Group = Group, Bottleneck.RedisConnection = Bottleneck.prototype.RedisConnection = require$$2, Bottleneck.IORedisConnection = Bottleneck.prototype.IORedisConnection = require$$3, Bottleneck.Batcher = Bottleneck.prototype.Batcher = Batcher, Bottleneck.prototype.jobDefaults = { - priority: 5, - weight: 1, - expiration: null, - id: "" - }, Bottleneck.prototype.storeDefaults = { - maxConcurrent: null, - minTime: 0, - highWater: null, - strategy: Bottleneck.prototype.strategy.LEAK, - penalty: null, - reservoir: null, - reservoirRefreshInterval: null, - reservoirRefreshAmount: null, - reservoirIncreaseInterval: null, - reservoirIncreaseAmount: null, - reservoirIncreaseMaximum: null - }, Bottleneck.prototype.localStoreDefaults = { - Promise: Promise, - timeout: null, - heartbeatInterval: 250 - }, Bottleneck.prototype.redisStoreDefaults = { - Promise: Promise, - timeout: null, - heartbeatInterval: 5000, - clientTimeout: 10000, - Redis: null, - clientOptions: {}, - clusterNodes: null, - clearDatastore: !1, - connection: null - }, Bottleneck.prototype.instanceDefaults = { - datastore: "local", - connection: null, - id: "", - rejectOnDrop: !0, - trackDoneStatus: !1, - Promise: Promise - }, Bottleneck.prototype.stopDefaults = { - enqueueErrorMessage: "This limiter has been stopped and cannot accept new jobs.", - dropWaitingJobs: !0, - dropErrorMessage: "This limiter has been stopped." - }, Bottleneck; - }).call(commonjsGlobal); - return Bottleneck_1; - }, module.exports = factory(); + }), (job = new Job$1(task, args, options, this.jobDefaults, this.rejectOnDrop, this.Events, this._states, this.Promise)).promise.then(function(args) { + return "function" == typeof cb ? cb(...args) : void 0; + }).catch(function(args) { + return Array.isArray(args) ? "function" == typeof cb ? cb(...args) : void 0 : "function" == typeof cb ? cb(args) : void 0; + }), this._receive(job); + } + schedule(...args) { + var job, options, task; + return "function" == typeof args[0] ? ([task, ...args] = args, options = {}) : [options, task, ...args] = args, job = new Job$1(task, args, options, this.jobDefaults, this.rejectOnDrop, this.Events, this._states, this.Promise), this._receive(job), job.promise; + } + wrap(fn) { + var schedule, wrapped; + return schedule = this.schedule.bind(this), (wrapped = function(...args) { + return schedule(fn.bind(this), ...args); + }).withOptions = function(options, ...args) { + return schedule(options, fn, ...args); + }, wrapped; + } + async updateSettings(options = {}) { + return await this._store.__updateSettings__(parser.overwrite(options, this.storeDefaults)), parser.overwrite(options, this.instanceDefaults, this), this; + } + currentReservoir() { + return this._store.__currentReservoir__(); + } + incrementReservoir(incr = 0) { + return this._store.__incrementReservoir__(incr); + } + } + return Bottleneck.default = Bottleneck, Bottleneck.Events = Events, Bottleneck.version = Bottleneck.prototype.version = require$$8.version, Bottleneck.strategy = Bottleneck.prototype.strategy = { + LEAK: 1, + OVERFLOW: 2, + OVERFLOW_PRIORITY: 4, + BLOCK: 3 + }, Bottleneck.BottleneckError = Bottleneck.prototype.BottleneckError = BottleneckError_1, Bottleneck.Group = Bottleneck.prototype.Group = Group, Bottleneck.RedisConnection = Bottleneck.prototype.RedisConnection = require$$2, Bottleneck.IORedisConnection = Bottleneck.prototype.IORedisConnection = require$$3, Bottleneck.Batcher = Bottleneck.prototype.Batcher = Batcher, Bottleneck.prototype.jobDefaults = { + priority: 5, + weight: 1, + expiration: null, + id: "" + }, Bottleneck.prototype.storeDefaults = { + maxConcurrent: null, + minTime: 0, + highWater: null, + strategy: Bottleneck.prototype.strategy.LEAK, + penalty: null, + reservoir: null, + reservoirRefreshInterval: null, + reservoirRefreshAmount: null, + reservoirIncreaseInterval: null, + reservoirIncreaseAmount: null, + reservoirIncreaseMaximum: null + }, Bottleneck.prototype.localStoreDefaults = { + Promise: Promise, + timeout: null, + heartbeatInterval: 250 + }, Bottleneck.prototype.redisStoreDefaults = { + Promise: Promise, + timeout: null, + heartbeatInterval: 5000, + clientTimeout: 10000, + Redis: null, + clientOptions: {}, + clusterNodes: null, + clearDatastore: !1, + connection: null + }, Bottleneck.prototype.instanceDefaults = { + datastore: "local", + connection: null, + id: "", + rejectOnDrop: !0, + trackDoneStatus: !1, + Promise: Promise + }, Bottleneck.prototype.stopDefaults = { + enqueueErrorMessage: "This limiter has been stopped and cannot accept new jobs.", + dropWaitingJobs: !0, + dropErrorMessage: "This limiter has been stopped." + }, Bottleneck; + }).call(commonjsGlobal)); } } ]); diff --git a/crates/swc_ecma_minifier/tests/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/output.js b/crates/swc_ecma_minifier/tests/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/output.js index 1d5739f60864..cf17b6fca85a 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/output.js @@ -544,9 +544,7 @@ "module" ], function(require, exports, module) { "use strict"; - var comparePoints = function(p1, p2) { - return p1.row - p2.row || p1.column - p2.column; - }, Range = function(startRow, startColumn, endRow, endColumn) { + var Range = function(startRow, startColumn, endRow, endColumn) { this.start = { row: startRow, column: startColumn @@ -640,7 +638,9 @@ }; }).call(Range.prototype), Range.fromPoints = function(start, end) { return new Range(start.row, start.column, end.row, end.column); - }, Range.comparePoints = comparePoints, Range.comparePoints = function(p1, p2) { + }, Range.comparePoints = function(p1, p2) { + return p1.row - p2.row || p1.column - p2.column; + }, Range.comparePoints = function(p1, p2) { return p1.row - p2.row || p1.column - p2.column; }, exports.Range = Range; }), ace.define("ace/lib/lang", [ @@ -757,7 +757,8 @@ "ace/lib/keys" ], function(require, exports, module) { "use strict"; - var event = require("../lib/event"), useragent = require("../lib/useragent"), dom = require("../lib/dom"), lang = require("../lib/lang"), clipboard = require("../clipboard"), BROKEN_SETDATA = useragent.isChrome < 18, USE_IE_MIME_TYPE = useragent.isIE, HAS_FOCUS_ARGS = useragent.isChrome > 63, KEYS = require("../lib/keys"), MODS = KEYS.KEY_MODS, isIOS = useragent.isIOS, valueResetRegex = isIOS ? /\s/ : /\n/, isMobile = useragent.isMobile, TextInput = function(parentNode, host) { + var event = require("../lib/event"), useragent = require("../lib/useragent"), dom = require("../lib/dom"), lang = require("../lib/lang"), clipboard = require("../clipboard"), BROKEN_SETDATA = useragent.isChrome < 18, USE_IE_MIME_TYPE = useragent.isIE, HAS_FOCUS_ARGS = useragent.isChrome > 63, KEYS = require("../lib/keys"), MODS = KEYS.KEY_MODS, isIOS = useragent.isIOS, valueResetRegex = isIOS ? /\s/ : /\n/, isMobile = useragent.isMobile; + exports.TextInput = function(parentNode, host) { var typingResetTimeout, typing, detectArrowKeys, closeTimeout, text = dom.createElement("textarea"); text.className = "ace_text-input", text.setAttribute("wrap", "off"), text.setAttribute("autocorrect", "off"), text.setAttribute("autocapitalize", "off"), text.setAttribute("spellcheck", !1), text.style.opacity = "0", parentNode.insertBefore(text, parentNode.firstChild); var copied = !1, pasted = !1, inComposition = !1, sendingText = !1, tempStyle = ""; @@ -837,9 +838,7 @@ } }; this.resetSelection = resetSelection, isFocused && host.onFocus(); - var onSelect = function(e) { - !inComposition && (copied ? copied = !1 : 0 === text.selectionStart && text.selectionEnd >= lastValue.length && text.value === lastValue && lastValue && text.selectionEnd !== lastSelectionEnd ? (host.selectAll(), resetSelection()) : isMobile && text.selectionStart != lastSelectionStart && resetSelection()); - }, inputHandler = null; + var inputHandler = null; this.setInputHandler = function(cb) { inputHandler = cb; }, this.getInputHandler = function() { @@ -895,7 +894,9 @@ var data = handleClipboardData(e); clipboard.pasteCancelled() || ("string" == typeof data ? (data && host.onPaste(data, e), useragent.isIE && setTimeout(resetSelection), event.preventDefault(e)) : (text.value = "", pasted = !0)); }; - event.addCommandKeyListener(text, host.onCommandKey.bind(host), host), event.addListener(text, "select", onSelect, host), event.addListener(text, "input", onInput, host), event.addListener(text, "cut", onCut, host), event.addListener(text, "copy", onCopy, host), event.addListener(text, "paste", onPaste, host), "oncut" in text && "oncopy" in text && "onpaste" in text || event.addListener(parentNode, "keydown", function(e) { + event.addCommandKeyListener(text, host.onCommandKey.bind(host), host), event.addListener(text, "select", function(e) { + !inComposition && (copied ? copied = !1 : 0 === text.selectionStart && text.selectionEnd >= lastValue.length && text.value === lastValue && lastValue && text.selectionEnd !== lastSelectionEnd ? (host.selectAll(), resetSelection()) : isMobile && text.selectionStart != lastSelectionStart && resetSelection()); + }, host), event.addListener(text, "input", onInput, host), event.addListener(text, "cut", onCut, host), event.addListener(text, "copy", onCopy, host), event.addListener(text, "paste", onPaste, host), "oncut" in text && "oncopy" in text && "onpaste" in text || event.addListener(parentNode, "keydown", function(e) { if ((!useragent.isMac || e.metaKey) && e.ctrlKey) switch(e.keyCode){ case 67: onCopy(e); @@ -907,13 +908,7 @@ onCut(e); } }, host); - var onCompositionStart = function(e) { - if (!inComposition && host.onCompositionStart && !host.$readOnly && (inComposition = {}, !commandMode)) { - e.data && (inComposition.useTextareaForIME = !1), setTimeout(onCompositionUpdate, 0), host._signal("compositionStart"), host.on("mousedown", cancelComposition); - var range = host.getSelectionRange(); - range.end.row = range.start.row, range.end.column = range.start.column, inComposition.markerRange = range, inComposition.selectionStart = lastSelectionStart, host.onCompositionStart(inComposition), inComposition.useTextareaForIME ? (lastValue = text.value = "", lastSelectionStart = 0, lastSelectionEnd = 0) : (text.msGetInputContext && (inComposition.context = text.msGetInputContext()), text.getInputContext && (inComposition.context = text.getInputContext())); - } - }, onCompositionUpdate = function() { + var onCompositionUpdate = function() { if (inComposition && host.onCompositionUpdate && !host.$readOnly) { if (commandMode) return cancelComposition(); inComposition.useTextareaForIME ? host.onCompositionUpdate(text.value) : (sendText(text.value), inComposition.markerRange && (inComposition.context && (inComposition.markerRange.start.column = inComposition.selectionStart = inComposition.context.compositionStartOffset), inComposition.markerRange.end.column = inComposition.markerRange.start.column + lastSelectionEnd - inComposition.selectionStart + lastRestoreEnd)); @@ -930,7 +925,13 @@ tempStyle && (text.style.cssText = tempStyle, tempStyle = ""), host.renderer.$isMousePressed = !1, host.renderer.$keepTextAreaAtCursor && host.renderer.$moveTextAreaToCursor(); }, 0); } - event.addListener(text, "compositionstart", onCompositionStart, host), event.addListener(text, "compositionupdate", onCompositionUpdate, host), event.addListener(text, "keyup", function(e) { + event.addListener(text, "compositionstart", function(e) { + if (!inComposition && host.onCompositionStart && !host.$readOnly && (inComposition = {}, !commandMode)) { + e.data && (inComposition.useTextareaForIME = !1), setTimeout(onCompositionUpdate, 0), host._signal("compositionStart"), host.on("mousedown", cancelComposition); + var range = host.getSelectionRange(); + range.end.row = range.start.row, range.end.column = range.start.column, inComposition.markerRange = range, inComposition.selectionStart = lastSelectionStart, host.onCompositionStart(inComposition), inComposition.useTextareaForIME ? (lastValue = text.value = "", lastSelectionStart = 0, lastSelectionEnd = 0) : (text.msGetInputContext && (inComposition.context = text.msGetInputContext()), text.getInputContext && (inComposition.context = text.getInputContext())); + } + }, host), event.addListener(text, "compositionupdate", onCompositionUpdate, host), event.addListener(text, "keyup", function(e) { 27 == e.keyCode && text.value.length < text.selectionStart && (inComposition || (lastValue = text.value), lastSelectionStart = lastSelectionEnd = -1, resetSelection()), syncComposition(); }, host), event.addListener(text, "keydown", syncComposition, host), event.addListener(text, "compositionend", onCompositionEnd, host), this.getElement = function() { return text; @@ -976,8 +977,7 @@ }, document.addEventListener("selectionchange", detectArrowKeys), host.on("destroy", function() { document.removeEventListener("selectionchange", detectArrowKeys); })); - }; - exports.TextInput = TextInput, exports.$setUserAgentForTests = function(_isMobile, _isIOS) { + }, exports.$setUserAgentForTests = function(_isMobile, _isIOS) { isMobile = _isMobile, isIOS = _isIOS; }; }), ace.define("ace/mouse/default_handlers", [ @@ -11142,8 +11142,7 @@ margin: 0 10px;\ data: q })); }; - }).call(WorkerClient.prototype); - var UIWorkerClient = function(topLevelNamespaces, mod, classname) { + }).call(WorkerClient.prototype), exports.UIWorkerClient = function(topLevelNamespaces, mod, classname) { var main = null, emitSync = !1, sender = Object.create(EventEmitter), messageBuffer = [], workerClient = new WorkerClient({ messageBuffer: messageBuffer, terminate: function() {}, @@ -11180,8 +11179,7 @@ margin: 0 10px;\ ], function(Main) { for(main = new Main[classname](sender); messageBuffer.length;)processNext(); }), workerClient; - }; - exports.UIWorkerClient = UIWorkerClient, exports.WorkerClient = WorkerClient, exports.createWorker = createWorker; + }, exports.WorkerClient = WorkerClient, exports.createWorker = createWorker; }), ace.define("ace/placeholder", [ "require", "exports", @@ -11295,9 +11293,7 @@ margin: 0 10px;\ return; } if (0 === button) { - var editor = e.editor, selection = editor.selection, isMultiSelect = editor.inMultiSelectMode, pos = e.getDocumentPosition(), cursor = selection.getCursor(), inSelection = e.inSelection() || selection.isEmpty() && isSamePoint(pos, cursor), mouseX = e.x, mouseY = e.y, onMouseSelection = function(e) { - mouseX = e.clientX, mouseY = e.clientY; - }, session = editor.session, screenAnchor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY), screenCursor = screenAnchor; + var editor = e.editor, selection = editor.selection, isMultiSelect = editor.inMultiSelectMode, pos = e.getDocumentPosition(), cursor = selection.getCursor(), inSelection = e.inSelection() || selection.isEmpty() && isSamePoint(pos, cursor), mouseX = e.x, mouseY = e.y, session = editor.session, screenAnchor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY), screenCursor = screenAnchor; if (editor.$mouseHandler.$enableJumpToDef) ctrl && alt || accel && alt ? selectionMode = shift ? "block" : "add" : alt && editor.$blockSelectEnabled && (selectionMode = "block"); else if (accel && !alt) { if (selectionMode = "add", !isMultiSelect && shift) return; @@ -11322,15 +11318,15 @@ margin: 0 10px;\ isMultiSelect && !accel ? selection.toSingleRange() : !isMultiSelect && accel && (initialRange = selection.toOrientedRange(), editor.addSelectionMarker(initialRange)), shift ? screenAnchor = session.documentToScreenPosition(selection.lead) : selection.moveToPosition(pos), screenCursor = { row: -1, column: -1 - }; - var onMouseSelectionEnd = function(e) { + }, event.capture(editor.container, function(e) { + mouseX = e.clientX, mouseY = e.clientY; + }, function(e) { blockSelect(), clearInterval(timerId), editor.removeSelectionMarkers(rectSel), rectSel.length || (rectSel = [ selection.toOrientedRange() ]), initialRange && (editor.removeSelectionMarker(initialRange), selection.toSingleRange(initialRange)); for(var i = 0; i < rectSel.length; i++)selection.addRange(rectSel[i]); editor.inVirtualSelectionMode = !1, editor.$mouseHandler.$clickSelection = null; - }; - event.capture(editor.container, onMouseSelection, onMouseSelectionEnd); + }); var timerId = setInterval(function() { blockSelect(); }, 20); diff --git a/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js b/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js index fc576b148404..6870729257f5 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js @@ -413,19 +413,18 @@ }, 9332: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e, t, r) { + t.__esModule = !0, t.default = void 0, t.default = function(e, t, r) { if (e >= 0 && e >= r.length || e < 0 && Math.abs(e) > r.length) return r; var n, i = e < 0 ? r.length + e : e; return Object.assign([], r, ((n = {})[i] = t(r[i]), n)); }; - t.default = r; }, 2354: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(7757)), o = n(r(8926)), a = n(r(4615)), u = function() { + var i = n(r(7757)), o = n(r(8926)), a = n(r(4615)); + t.default = function() { for(var e, t = arguments.length, r = Array(t), n = 0; n < t; n++)r[n] = arguments[n]; return e = (0, o.default)(i.default.mark(function e(t) { var n, o, u, l, s, c, f, d = arguments; @@ -458,33 +457,29 @@ return e.apply(this, arguments); }; }; - t.default = u; }, 4522: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { return e ? e.replace(/(^|\s)\S/g, function(e) { return e.toUpperCase(); }) : e; }; - t.default = r; }, 10: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { return Array.isArray(e) ? e : [ e ]; }; - t.default = r; }, 3624: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(4615)), o = function() { + var i = n(r(4615)); + t.default = function() { for(var e = arguments.length, t = Array(e), r = 0; r < e; r++)t[r] = arguments[r]; return function(e) { for(var r = e, n = (0, i.default)(t), o = arguments.length, a = Array(o > 1 ? o - 1 : 0), u = 1; u < o; u++)a[u - 1] = arguments[u]; @@ -494,33 +489,29 @@ return r; }; }; - t.default = o; }, 5558: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { return e.slice(0, e.length - 1); }; - t.default = r; }, 7493: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function e(t, r) { + t.__esModule = !0, t.default = void 0, t.default = function e(t, r) { for(var n = r instanceof Array ? [] : {}, i = Object.keys(r), o = 0; o < i.length; o += 1){ var a = i[o], u = t[a], l = typeof u; "function" === l ? n[a] = u(r[a]) : u && "object" === l ? n[a] = e(u, r[a]) : n[a] = r[a]; } return n; }; - t.default = r; }, 6127: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(9248)), o = n(r(10)), a = function(e, t, r) { + var i = n(r(9248)), o = n(r(10)); + t.default = function(e, t, r) { if ((0, i.default)(e)) return r; for(var n = (0, o.default)(t), a = e, u = 0; u < n.length; u += 1){ if ((0, i.default)(a)) return; @@ -528,7 +519,6 @@ } return (0, i.default)(a) ? r : a; }; - t.default = a; }, 4354: function(e, t, r) { "use strict"; @@ -569,35 +559,28 @@ }, 9248: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { return null == e; }; - t.default = r; }, 1866: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { return "" === e ? "" : e[e.length - 1]; }; - t.default = r; }, 8838: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e, t) { + t.__esModule = !0, t.default = void 0, t.default = function(e, t) { return Object.entries(e).reduce(function(e, r, n) { var i = r[0], o = r[1]; return e[i] = t(o, i, n), e; }, {}); }; - t.default = r; }, 7213: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { var t = /((-)?\d+\.?\d*)%/g.exec(e); if (t) { var r = parseFloat(t[1], 10); @@ -608,47 +591,40 @@ } return null; }; - t.default = r; }, 2036: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(10)), o = function(e, t) { + var i = n(r(10)); + t.default = function(e, t) { var r = (0, i.default)(e), n = Object.assign({}, t); return r.forEach(function(e) { delete n[e]; }), n; }; - t.default = o; }, 9346: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e, t) { + t.__esModule = !0, t.default = void 0, t.default = function(e, t) { for(var r = {}, n = 0; n < e.length; n += 1){ var i = e[n]; i in t && (r[i] = t[i]); } return r; }; - t.default = r; }, 4615: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { return Array.prototype.slice.call(e, 0).reverse(); }; - t.default = r; }, 9424: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { return e ? e.charAt(0).toUpperCase() + e.slice(1) : e; }; - t.default = r; }, 1384: function(e, t, r) { "use strict"; @@ -1000,13 +976,13 @@ }, e); })), function(e) { return a.apply(this, arguments); - }), C = function(e, t) { + }); + t.default = function(e, t) { var r, n = (void 0 === t ? {} : t).cache, i = void 0 === n || n, o = e.data ? e.data.toString() : e.uri; if (i && m.get(o)) return m.get(o); if (!(r = _(e) ? S(e) : u.isBuffer(e) ? k(e) : "object" == typeof e && e.data ? A(e) : O(e))) throw Error("Cannot resolve image"); return i && m.set(o, r), r; }; - t.default = C; }, 791: function(e, t, r) { "use strict"; @@ -1403,33 +1379,26 @@ return t.type === e; }; }, e_ = eE(T.Svg), ex = eE(T.Text), eS = eE(T.TextInstance), eA = function(e) { - return function(t) { - return a.mapValues(t, function(t, r) { - var n = a.matchPercent(t); - return n && eD.includes(r) ? n.percent * e.height : n && ew.includes(r) ? n.percent * e.width : t; - }); - }; - }, ek = function(e) { var t = a.matchPercent(e); return t ? t.percent : parseFloat(e); - }, eT = function(e) { + }, ek = function(e) { var t = Object.assign({}, e.style || {}, e.props); return Object.assign({}, e, { props: t }); - }, eO = function(e) { - var t = function(e) { + }, eT = function(e) { + var t = a.mapValues(e.props, function(e) { return "none" === e ? null : e; - }, r = a.mapValues(e.props, t); + }); return Object.assign({}, e, { - props: r + props: t }); - }, eC = function(e) { + }, eO = function(e) { var t = e.props || {}, r = Object.assign({}, a.pick(em, t), e.style || {}); return Object.assign({}, e, { style: r }); - }, eP = function(e) { + }, eC = function(e) { var t = a.evolve({ width: parseFloat, height: parseFloat, @@ -1439,9 +1408,9 @@ return Object.assign({}, e, { props: t }); - }, eF = function(e) { + }, eP = function(e) { if (!ex(e) || !e.children) return e; - var t = function(e) { + var t = e.children.map(function(e) { return eS(e) ? { type: T.Tspan, props: {}, @@ -1449,11 +1418,11 @@ e ] } : e; - }, r = e.children.map(t); + }); return Object.assign({}, e, { - children: r + children: t }); - }, eR = function(e, t) { + }, eF = function(e, t) { var r = eh(e); return a.compose(ed, function e(t) { return function(r) { @@ -1464,13 +1433,16 @@ children: n }); }; - }(t), eP, eC, ev, function e(t) { + }(t), eC, eO, ev, function e(t) { return function(r) { if (!r.children) return r; var n = a.compose(e(t), a.compose(function(e) { - var r = eA(t)(e.props); + var r, n = (r = e.props, a.mapValues(r, function(e, r) { + var n = a.matchPercent(e); + return n && eD.includes(r) ? n.percent * t.height : n && ew.includes(r) ? n.percent * t.width : e; + })); return Object.assign({}, e, { - props: r = a.evolve({ + props: n = a.evolve({ x: parseFloat, x1: parseFloat, x2: parseFloat, @@ -1484,41 +1456,27 @@ cy: parseFloat, width: parseFloat, height: parseFloat, - offset: ek, + offset: eA, fill: l.transformColor, - opacity: ek, + opacity: eA, stroke: l.transformColor, - stopOpacity: ek, + stopOpacity: eA, stopColor: l.transformColor, transform: l.processTransform - }, r) + }, n) }); - }, eF, eO, eT)), i = r.children.map(n); + }, eP, eT, ek)), i = r.children.map(n); return Object.assign({}, r, { children: i }); }; }(r))(e); - }, eI = function e(t, r) { - if (!t.children) return t; - var n = function(t) { - return e(t, r); - }, i = e_(t) ? eR(t, r) : t, o = i.children.map(n); - return Object.assign({}, i, { - children: o - }); - }, ej = function(e) { + }, eR = function(e) { return e.style.zIndex; - }, eB = function(e, t) { - var r = ej(e), n = ej(t); + }, eI = function(e, t) { + var r = eR(e), n = eR(t); return r || n ? r ? n ? n - r : -1 : 1 : 0; - }, eM = function e(t) { - if (!t.children) return t; - var r = (t.type !== T.Document && t.type !== T.Svg ? t.children.sort(eB) : t.children).map(e); - return Object.assign({}, t, { - children: r - }); - }, eN = {}, eL = z.default(), eU = function() { + }, ej = {}, eB = z.default(), eM = function() { var e; return e = W.default, function() { return e.apply(void 0, arguments).then(function(e) { @@ -1527,60 +1485,35 @@ return e; }); }; - }, ez = function(e) { + }, eN = function(e) { return "️" !== e; - }, eW = function(e, t) { + }, eL = function(e, t) { var r = t.url, n = t.format; - return "" + r + Array.from(e).filter(ez).map(function(e) { + return "" + r + Array.from(e).filter(eN).map(function(e) { return e.codePointAt(0).toString(16); }).join("-") + "." + n; - }, eG = function(e, t) { + }, eU = function(e, t) { if (!t || !t.url) return []; - for(var r, n = []; r = eL.exec(e);)!function() { + for(var r, n = []; r = eB.exec(e);)!function() { var e = r[0]; - if (!eN[e] || eN[e].loading) { - var i = eW(e, t); - eN[e] = { + if (!ej[e] || ej[e].loading) { + var i = eL(e, t); + ej[e] = { loading: !0 }; - var o = eU(); + var o = eM(); n.push(o({ uri: i }).then(function(t) { - eN[e].loading = !1, eN[e].data = t.data; + ej[e].loading = !1, ej[e].data = t.data; })); } }(); return n; - }, eq = function(e) { - for(var t = [], r = 0; r < e.length; r += 1){ - for(var n = e[r], i = void 0, o = 0; i = eL.exec(n.string);){ - var a = i.index, u = i[0], l = n.attributes.fontSize, s = n.string.slice(o, a + i[0].length); - eN[u] && eN[u].data ? t.push({ - string: s.replace(i, String.fromCharCode(0xfffc)), - attributes: U.default({}, n.attributes, { - attachment: { - width: l, - height: l, - yOffset: Math.floor(0.1 * l), - image: eN[u].data - } - }) - }) : t.push({ - string: s.replace(i, "\0"), - attributes: n.attributes - }), o = a + u.length; - } - o < n.string.length && t.push({ - string: n.string.slice(o), - attributes: n.attributes - }); - } - return t; - }, eV = function(e) { + }, ez = function(e) { var t, r, n; return (null === (t = e.props) || void 0 === t ? void 0 : t.src) || (null === (r = e.props) || void 0 === r ? void 0 : r.source) || (null === (n = e.props) || void 0 === n ? void 0 : n.href); - }, eH = (n = N.default(L.default.mark(function e(t) { + }, eW = (n = N.default(L.default.mark(function e(t) { var r; return L.default.wrap(function(e) { for(;;)switch(e.prev = e.next){ @@ -1608,18 +1541,18 @@ }, e); })), function(e) { return n.apply(this, arguments); - }), eZ = (i = N.default(L.default.mark(function e(t) { + }), eG = (i = N.default(L.default.mark(function e(t) { var r, n, i; return L.default.wrap(function(e) { for(;;)switch(e.prev = e.next){ case 0: - if (r = eV(t), n = t.props.cache, r) { + if (r = ez(t), n = t.props.cache, r) { e.next = 5; break; } return console.warn(!1, 'Image should receive either a "src" or "source" prop'), e.abrupt("return"); case 5: - return e.prev = 5, e.next = 8, eH(r); + return e.prev = 5, e.next = 8, eW(r); case 8: if (i = e.sent) { e.next = 11; @@ -1651,20 +1584,20 @@ ]); })), function(e) { return i.apply(this, arguments); - }), eX = function(e, t) { + }), eq = function(e, t) { for(var r = [], n = (null === (o = t.children) || void 0 === o ? void 0 : o.slice(0)) || [], i = e ? e.getEmojiSource() : null; n.length > 0;){ var o, a, u = n.shift(); - u.type === T.Image && r.push(eZ(u)), e && null !== (a = u.style) && void 0 !== a && a.fontFamily && r.push(e.load(u.style)), "string" == typeof u && r.push.apply(r, eG(u, i)), "string" == typeof u.value && r.push.apply(r, eG(u.value, i)), u.children && u.children.forEach(function(e) { + u.type === T.Image && r.push(eG(u)), e && null !== (a = u.style) && void 0 !== a && a.fontFamily && r.push(e.load(u.style)), "string" == typeof u && r.push.apply(r, eU(u, i)), "string" == typeof u.value && r.push.apply(r, eU(u.value, i)), u.children && u.children.forEach(function(e) { n.push(e); }); } return r; - }, eJ = (o = N.default(L.default.mark(function e(t, r) { + }, eV = (o = N.default(L.default.mark(function e(t, r) { var n; return L.default.wrap(function(e) { for(;;)switch(e.prev = e.next){ case 0: - return n = eX(r, t), e.next = 3, Promise.all(n); + return n = eq(r, t), e.next = 3, Promise.all(n); case 3: return e.abrupt("return", t); case 4: @@ -1674,19 +1607,19 @@ }, e); })), function(e, t) { return o.apply(this, arguments); - }), eY = { + }), eH = { color: "blue", textDecoration: "underline" - }, eK = function(e, t) { - var r = t.type === T.Link ? eY : {}, n = Array.isArray(t.style) ? [].concat(t.style, [ + }, eZ = function(e, t) { + var r = t.type === T.Link ? eH : {}, n = Array.isArray(t.style) ? [].concat(t.style, [ r ]) : Object.assign({}, r, t.style); return O.default(e, n); - }, eQ = function(e) { + }, eX = function(e) { var t, r = (null === (t = e.props) || void 0 === t ? void 0 : t.dpi) || 72, n = e.box || e.style; return (function e(t) { return function(r) { - var n = eK(t, r); + var n = eZ(t, r); if (!r.children) return Object.assign({}, r, { style: n }); @@ -1699,71 +1632,32 @@ })(U.default({}, n, { dpi: r }))(e); - }, e$ = function(e) { - if (!e.children) return e; - var t = e.children.map(eQ); - return Object.assign({}, e, { - children: t - }); - }, e0 = function(e) { + }, eJ = function(e) { return function(t) { var r, n; return a.isNil(null === (r = t.style) || void 0 === r ? void 0 : r[e]) ? "50%" : null === (n = t.style) || void 0 === n ? void 0 : n[e]; }; - }, e1 = function(e) { + }, eY = function(e) { if (!e.box) return {}; - var t = e.box, r = t.left, n = t.top, i = t.width, o = t.height, u = e0("transformOriginX")(e), l = e0("transformOriginY")(e), s = a.matchPercent(u), c = a.matchPercent(l); + var t = e.box, r = t.left, n = t.top, i = t.width, o = t.height, u = eJ("transformOriginX")(e), l = eJ("transformOriginY")(e), s = a.matchPercent(u), c = a.matchPercent(l); return { left: r + (s ? i * s.percent : u), top: n + (c ? o * c.percent : l) }; - }, e2 = function e(t) { - var r = e1(t), n = Object.assign({}, t, { + }, eK = function e(t) { + var r = eY(t), n = Object.assign({}, t, { origin: r }); return t.children ? Object.assign({}, n, { children: t.children.map(e) }) : n; - }, e3 = function(e) { - if (!e.children) return e; - var t = e.children.map(e2); - return Object.assign({}, e, { - children: t - }); - }, e4 = function(e) { - for(var t = 0, r = (e.children || []).slice(0).map(function(e) { - return { - value: e, - parent: null - }; - }); r.length > 0;)!function() { - var e = r.shift(), n = e.value, i = e.parent; - if (null !== (a = n.props) && void 0 !== a && a.bookmark) { - var o, a, u, l = "string" == typeof (o = n.props.bookmark) ? { - title: o, - fit: !1, - expanded: !1 - } : o, s = t++, c = U.default({ - ref: s, - parent: null === (u = i) || void 0 === u ? void 0 : u.ref - }, l); - n.props.bookmark = c, i = c; - } - n.children && n.children.forEach(function(e) { - r.push({ - value: e, - parent: i - }); - }); - }(); - return e; - }, e5 = [ + }, eQ = [ "portrait", "landscape" - ], e8 = function(e) { + ], e$ = function(e) { var t, r = (null === (t = e.props) || void 0 === t ? void 0 : t.orientation) || "portrait"; - return e5.includes(r) ? r : "portrait"; - }, e6 = { + return eQ.includes(r) ? r : "portrait"; + }, e0 = { "4A0": [ 4767.87, 6740.79 @@ -1968,41 +1862,31 @@ 153, 243 ] - }, e7 = function(e) { + }, e1 = function(e) { return { width: e[0], height: e[1] }; - }, e9 = function(e) { - return e7(e6[e.toUpperCase()]); - }, te = function(e) { - return e7([ - e - ]); - }, tt = function(e) { + }, e2 = function(e) { var t, r, n, i, o, a = (null === (i = e.props) || void 0 === i ? void 0 : i.size) || "A4", u = parseFloat((null === (o = e.props) || void 0 === o ? void 0 : o.dpi) || 72), l = typeof a, s = a; - return "string" === l ? s = e9(a) : Array.isArray(a) ? s = e7(a) : "number" === l && (s = te(a)), t = s, r = u / 72, s = { + return "string" === l ? s = e1(e0[a.toUpperCase()]) : Array.isArray(a) ? s = e1(a) : "number" === l && (s = e1([ + a + ])), t = s, r = u / 72, s = { width: t.width ? t.width * r : t.width, height: t.height ? t.height * r : t.height - }, "landscape" === e8(e) ? { + }, "landscape" === e$(e) ? { width: (n = s).height, height: n.width } : s; - }, tr = function(e) { - var t = tt(e), r = G.default(e.style || {}); + }, e3 = function(e) { + var t = e2(e), r = G.default(e.style || {}); return U.default({}, e, { style: U.default({}, r, t) }); - }, tn = function(e) { - if (!e.children) return e; - var t = e.children.map(tr); - return Object.assign({}, e, { - children: t - }); - }, ti = function(e) { + }, e4 = function(e) { var t; return (null === (t = e.props) || void 0 === t ? void 0 : t.fixed) === !0; - }, to = function(e, t) { + }, e5 = function(e, t) { var r = 0; if (!e.lines) return 0; for(var n = 0; n < e.lines.length; n += 1){ @@ -2011,7 +1895,7 @@ r += i.box.height; } return e.lines.length; - }, ta = function(e, t) { + }, e8 = function(e, t) { var r = 0; if (!e.lines) return r; for(var n = 0; n < t; n += 1){ @@ -2020,7 +1904,7 @@ r += i.box.height; } return r; - }, tu = function(e, t) { + }, e6 = function(e, t) { var r = a.get(e, [ "box", "top" @@ -2030,10 +1914,10 @@ ], 2), i = a.get(e, [ "props", "orphans" - ], 2), o = e.lines.length, u = to(e, t - r); + ], 2), o = e.lines.length, u = e5(e, t - r); return 0 === u ? 0 : o < i ? o : u < i || o < i + n ? 0 : o === i + n ? i : o - u < n ? o - n : u; - }, tl = function(e, t) { - var r = tu(e, t), n = ta(e, r), i = e.box.height - n; + }, e7 = function(e, t) { + var r = e6(e, t), n = e8(e, r), i = e.box.height - n; return [ Object.assign({}, e, { box: U.default({}, e.box, { @@ -2065,18 +1949,18 @@ lines: e.lines.slice(r) }) ]; - }, ts = function(e) { + }, e9 = function(e) { var t; return (null === (t = e.box) || void 0 === t ? void 0 : t.top) || 0; - }, tc = function(e) { + }, te = function(e) { var t; return !a.isNil(null === (t = e.style) || void 0 === t ? void 0 : t.height); - }, tf = function(e, t) { + }, tt = function(e, t) { if (!e) return [ null, null ]; - var r = ts(e), n = Object.assign({}, e, { + var r = e9(e), n = Object.assign({}, e, { box: U.default({}, e.box, { borderBottomWidth: 0 }), @@ -2089,7 +1973,7 @@ }) }); n.style.height = t - r; - var i = tc(e) ? e.box.height - (t - r) : null, o = Object.assign({}, e, { + var i = te(e) ? e.box.height - (t - r) : null, o = Object.assign({}, e, { box: U.default({}, e.box, { top: 0, borderTopWidth: 0 @@ -2106,52 +1990,52 @@ n, o ]; - }, td = [ + }, tr = [ T.Svg, T.Note, T.Image, T.Canvas - ], tp = function(e) { + ], tn = function(e) { var t; - return !td.includes(e.type) && (!!a.isNil(null === (t = e.props) || void 0 === t ? void 0 : t.wrap) || e.props.wrap); - }, th = function(e, t) { + return !tr.includes(e.type) && (!!a.isNil(null === (t = e.props) || void 0 === t ? void 0 : t.wrap) || e.props.wrap); + }, ti = function(e, t) { var r = e._yogaNode; return r ? r.getComputedPadding(t) : null; - }, ty = function(e) { + }, to = function(e) { var t = e.style, r = e.box; return { - paddingTop: th(e, q.default.EDGE_TOP) || (null == r ? void 0 : r.paddingTop) || (null == t ? void 0 : t.paddingTop) || (null == t ? void 0 : t.paddingVertical) || (null == t ? void 0 : t.padding) || 0, - paddingRight: th(e, q.default.EDGE_RIGHT) || (null == r ? void 0 : r.paddingRight) || (null == t ? void 0 : t.paddingRight) || (null == t ? void 0 : t.paddingHorizontal) || (null == t ? void 0 : t.padding) || 0, - paddingBottom: th(e, q.default.EDGE_BOTTOM) || (null == r ? void 0 : r.paddingBottom) || (null == t ? void 0 : t.paddingBottom) || (null == t ? void 0 : t.paddingVertical) || (null == t ? void 0 : t.padding) || 0, - paddingLeft: th(e, q.default.EDGE_LEFT) || (null == r ? void 0 : r.paddingLeft) || (null == t ? void 0 : t.paddingLeft) || (null == t ? void 0 : t.paddingHorizontal) || (null == t ? void 0 : t.padding) || 0 + paddingTop: ti(e, q.default.EDGE_TOP) || (null == r ? void 0 : r.paddingTop) || (null == t ? void 0 : t.paddingTop) || (null == t ? void 0 : t.paddingVertical) || (null == t ? void 0 : t.padding) || 0, + paddingRight: ti(e, q.default.EDGE_RIGHT) || (null == r ? void 0 : r.paddingRight) || (null == t ? void 0 : t.paddingRight) || (null == t ? void 0 : t.paddingHorizontal) || (null == t ? void 0 : t.padding) || 0, + paddingBottom: ti(e, q.default.EDGE_BOTTOM) || (null == r ? void 0 : r.paddingBottom) || (null == t ? void 0 : t.paddingBottom) || (null == t ? void 0 : t.paddingVertical) || (null == t ? void 0 : t.padding) || 0, + paddingLeft: ti(e, q.default.EDGE_LEFT) || (null == r ? void 0 : r.paddingLeft) || (null == t ? void 0 : t.paddingLeft) || (null == t ? void 0 : t.paddingHorizontal) || (null == t ? void 0 : t.padding) || 0 }; - }, tg = function(e) { - var t, r = ty(e).paddingBottom; + }, ta = function(e) { + var t, r = to(e).paddingBottom; return (null === (t = e.style) || void 0 === t ? void 0 : t.height) - r; - }, tv = function(e) { - var t, r = null === (t = e.style) || void 0 === t ? void 0 : t.height, n = ty(e), i = n.paddingTop; + }, tu = function(e) { + var t, r = null === (t = e.style) || void 0 === t ? void 0 : t.height, n = to(e), i = n.paddingTop; return r - n.paddingBottom - i; - }, tb = [ + }, tl = [ "style", "children" - ], tm = function(e) { + ], ts = function(e) { return "string" == typeof e; - }, tD = function e(t) { + }, tc = function e(t) { if (!t) return null; - if (tm(t) || "number" == typeof t) return { + if (ts(t) || "number" == typeof t) return { type: u.TextInstance, value: "" + t }; - if (!tm(t.type)) return e(t.type(t.props)); + if (!ts(t.type)) return e(t.type(t.props)); var r = t.type, n = t.props, i = n.style, o = n.children; return { type: r, style: void 0 === i ? {} : i, - props: V.default(n, tb), + props: V.default(n, tl), box: {}, children: a.castArray(void 0 === o ? [] : o).map(e) }; - }, tw = function(e) { + }, tf = function(e) { var t = 0, r = 1 / 0; if (!e || 0 === e.length) return 0; for(var n = 0; n < e.length; n += 1){ @@ -2159,35 +2043,35 @@ r = Math.min(r, i.box.top), t = Math.max(t, i.box.top + i.box.height); } return t - r; - }, tE = function(e) { + }, td = function(e) { var t; return (null === (t = e.props) || void 0 === t ? void 0 : t.break) || !1; - }, t_ = function(e) { + }, tp = function(e) { var t; return null === (t = e.props) || void 0 === t ? void 0 : t.minPresenceAhead; - }, tx = function(e) { + }, th = function(e) { return function(t) { return Math.min(e.box.height, t); }; - }, tS = function(e, t) { + }, ty = function(e, t) { for(var r = 0, n = 0; n < e.length; n += 1){ var i = e[n]; if (i.box) { - var o = t > i.box.top, a = i.props.presenceAhead || tx(i); + var o = t > i.box.top, a = i.props.presenceAhead || th(i); i && o && (r += a(t - i.box.top)); } } return r; - }, tA = function(e, t, r) { - var n = t_(e), i = tS(t, r), o = tw(t), a = r < e.box.top + e.box.height, u = tp(e); - return tE(e) || !u && a || n < o && i < n; - }, tk = [ + }, tg = function(e, t, r) { + var n = tp(e), i = ty(t, r), o = tf(t), a = r < e.box.top + e.box.height, u = tn(e); + return td(e) || !u && a || n < o && i < n; + }, tv = [ 8232, 8233 - ], tT = [ + ], tb = [ function(e) { return e.map(function(e) { - var t, r = RegExp((t = e.attributes.font, tk.reduce(function(e, r) { + var t, r = RegExp((t = e.attributes.font, tv.reduce(function(e, r) { return t && t.hasGlyphForCodePoint && t.hasGlyphForCodePoint(r) ? e : [].concat(e, [ String.fromCharCode(r) ]); @@ -2198,8 +2082,33 @@ }; }); }, - eq - ], tO = function e(t, r, n, i) { + function(e) { + for(var t = [], r = 0; r < e.length; r += 1){ + for(var n = e[r], i = void 0, o = 0; i = eB.exec(n.string);){ + var a = i.index, u = i[0], l = n.attributes.fontSize, s = n.string.slice(o, a + i[0].length); + ej[u] && ej[u].data ? t.push({ + string: s.replace(i, String.fromCharCode(0xfffc)), + attributes: U.default({}, n.attributes, { + attachment: { + width: l, + height: l, + yOffset: Math.floor(0.1 * l), + image: ej[u].data + } + }) + }) : t.push({ + string: s.replace(i, "\0"), + attributes: n.attributes + }), o = a + u.length; + } + o < n.string.length && t.push({ + string: n.string.slice(o), + attributes: n.attributes + }); + } + return t; + } + ], tm = function e(t, r, n, i) { if (void 0 === i && (i = 0), !r) return [ { string: "" @@ -2242,32 +2151,32 @@ attributes: S }) : P && (C = o).push.apply(C, e(t, P, S.link, i + 1)); } - for(var F = 0; F < tT.length; F += 1)o = (0, tT[F])(o); + for(var F = 0; F < tb.length; F += 1)o = (0, tb[F])(o); return o; - }, tC = function(e, t) { - var r = tO(e, t); + }, tD = function(e, t) { + var r = tm(e, t); return B.default(r); - }, tP = { + }, tw = { linebreaker: P.default, justification: F.default, textDecoration: j.default, scriptItemizer: R.default, wordHyphenation: I.default, fontSubstitution: ee - }, tF = C.default(tP), tR = function(e) { + }, tE = C.default(tw), t_ = function(e) { var t; return null === (t = e.style) || void 0 === t ? void 0 : t.maxLines; - }, tI = function(e) { + }, tx = function(e) { var t; return null === (t = e.style) || void 0 === t ? void 0 : t.textOverflow; - }, tj = function(e, t, r, n) { - return tF(tC(n, e), { + }, tS = function(e, t, r, n) { + return tE(tD(n, e), { x: 0, y: 0, width: t, - maxLines: tR(e), + maxLines: t_(e), height: r || 1 / 0, - truncateMode: tI(e) + truncateMode: tx(e) }, { hyphenationPenalty: e.props.hyphenationPenalty, shrinkWhitespaceFactor: { @@ -2278,26 +2187,26 @@ }).reduce(function(e, t) { return [].concat(e, t); }, []); - }, tB = function(e) { + }, tA = function(e) { return function(t) { return t.type === e; }; - }, tM = tB(T.Svg), tN = tB(T.Text), tL = function e(t, r) { - if (tN(t) && !t.lines) { + }, tk = tA(T.Svg), tT = tA(T.Text), tO = function e(t, r) { + if (tT(t) && !t.lines) { var n = t.box.width - (t.box.paddingRight + t.box.paddingLeft), i = t.box.height - (t.box.paddingTop + t.box.paddingBottom); - t.lines = tj(t, n, i, r); + t.lines = tS(t, n, i, r); } - if (!tM(t) && !tN(t)) { + if (!tk(t) && !tT(t)) { if (!t.children) return t; - var o = function(t) { + var o = t.children.map(function(t) { return e(t, r); - }, a = t.children.map(o); + }); return Object.assign({}, t, { - children: a + children: o }); } return t; - }, tU = [ + }, tC = [ "color", "fontFamily", "fontSize", @@ -2311,7 +2220,7 @@ "textAlign", "visibility", "wordSpacing" - ], tz = function(e, t) { + ], tP = function(e, t) { var r = U.default({}, e); return Object.entries(t).forEach(function(t) { var n, i = t[0], o = t[1]; @@ -2322,10 +2231,10 @@ return e && "none" !== e; }).join(" ") : o); }), r; - }, tW = function e(t) { + }, tF = function e(t) { if (t.type === T.Svg || !t.children) return t; - var r = a.pick(tU, t.style || {}), n = a.compose(e, function(e) { - var t = tz(r, e.style || {}); + var r = a.pick(tC, t.style || {}), n = a.compose(e, function(e) { + var t = tP(r, e.style || {}); return Object.assign({}, e, { style: t }); @@ -2333,18 +2242,18 @@ return Object.assign({}, t, { children: i }); - }, tG = function(e, t) { + }, tR = function(e, t) { var r = e._yogaNode; return r ? r.getComputedMargin(t) : null; - }, tq = function(e) { + }, tI = function(e) { var t = e.style, r = e.box; return { - marginTop: tG(e, q.default.EDGE_TOP) || (null == r ? void 0 : r.marginTop) || (null == t ? void 0 : t.marginTop) || (null == t ? void 0 : t.marginVertical) || (null == t ? void 0 : t.margin) || 0, - marginRight: tG(e, q.default.EDGE_RIGHT) || (null == r ? void 0 : r.marginRight) || (null == t ? void 0 : t.marginRight) || (null == t ? void 0 : t.marginHorizontal) || (null == t ? void 0 : t.margin) || 0, - marginBottom: tG(e, q.default.EDGE_BOTTOM) || (null == r ? void 0 : r.marginBottom) || (null == t ? void 0 : t.marginBottom) || (null == t ? void 0 : t.marginVertical) || (null == t ? void 0 : t.margin) || 0, - marginLeft: tG(e, q.default.EDGE_LEFT) || (null == r ? void 0 : r.marginLeft) || (null == t ? void 0 : t.marginLeft) || (null == t ? void 0 : t.marginHorizontal) || (null == t ? void 0 : t.margin) || 0 + marginTop: tR(e, q.default.EDGE_TOP) || (null == r ? void 0 : r.marginTop) || (null == t ? void 0 : t.marginTop) || (null == t ? void 0 : t.marginVertical) || (null == t ? void 0 : t.margin) || 0, + marginRight: tR(e, q.default.EDGE_RIGHT) || (null == r ? void 0 : r.marginRight) || (null == t ? void 0 : t.marginRight) || (null == t ? void 0 : t.marginHorizontal) || (null == t ? void 0 : t.margin) || 0, + marginBottom: tR(e, q.default.EDGE_BOTTOM) || (null == r ? void 0 : r.marginBottom) || (null == t ? void 0 : t.marginBottom) || (null == t ? void 0 : t.marginVertical) || (null == t ? void 0 : t.margin) || 0, + marginLeft: tR(e, q.default.EDGE_LEFT) || (null == r ? void 0 : r.marginLeft) || (null == t ? void 0 : t.marginLeft) || (null == t ? void 0 : t.marginHorizontal) || (null == t ? void 0 : t.margin) || 0 }; - }, tV = function(e) { + }, tj = function(e) { var t = e._yogaNode; return { top: (null == t ? void 0 : t.getComputedTop()) || 0, @@ -2352,32 +2261,32 @@ bottom: (null == t ? void 0 : t.getComputedBottom()) || 0, left: (null == t ? void 0 : t.getComputedLeft()) || 0 }; - }, tH = { + }, tB = { width: 0, height: 0 - }, tZ = function(e) { + }, tM = function(e) { var t = e._yogaNode; return t ? { width: t.getComputedWidth(), height: t.getComputedHeight() - } : tH; - }, tX = function(e, t) { + } : tB; + }, tN = function(e, t) { return e ? e.getComputedBorder(t) : 0; - }, tJ = function(e) { + }, tL = function(e) { var t = e._yogaNode; return { - borderTopWidth: tX(t, q.default.EDGE_TOP), - borderRightWidth: tX(t, q.default.EDGE_RIGHT), - borderBottomWidth: tX(t, q.default.EDGE_BOTTOM), - borderLeftWidth: tX(t, q.default.EDGE_LEFT) + borderTopWidth: tN(t, q.default.EDGE_TOP), + borderRightWidth: tN(t, q.default.EDGE_RIGHT), + borderBottomWidth: tN(t, q.default.EDGE_BOTTOM), + borderLeftWidth: tN(t, q.default.EDGE_LEFT) }; - }, tY = { + }, tU = { hidden: q.default.OVERFLOW_HIDDEN, scroll: q.default.OVERFLOW_SCROLL - }, tK = { + }, tz = { wrap: q.default.WRAP_WRAP, "wrap-reverse": q.default.WRAP_WRAP_REVERSE - }, tQ = function(e, t) { + }, tW = function(e, t) { return function(r) { return function(n) { var i = n._yogaNode; @@ -2389,7 +2298,7 @@ return n; }; }; - }, t$ = tQ("flexBasis"), t0 = { + }, tG = tW("flexBasis"), tq = { "flex-start": q.default.ALIGN_FLEX_START, center: q.default.ALIGN_CENTER, "flex-end": q.default.ALIGN_FLEX_END, @@ -2397,51 +2306,51 @@ baseline: q.default.ALIGN_BASELINE, "space-between": q.default.ALIGN_SPACE_BETWEEN, "space-around": q.default.ALIGN_SPACE_AROUND - }, t1 = function(e) { + }, tV = function(e) { return function(t) { return function(r) { var n = r._yogaNode, i = "items" === e ? q.default.ALIGN_STRETCH : q.default.ALIGN_AUTO; if (n) { - var o = t0[t] || i; + var o = tq[t] || i; n["setAlign" + a.upperFirst(e)](o); } return r; }; }; - }, t2 = t1("self"), t3 = t1("items"), t4 = t1("content"), t5 = { + }, tH = tV("self"), tZ = tV("items"), tX = tV("content"), tJ = { row: q.default.FLEX_DIRECTION_ROW, "row-reverse": q.default.FLEX_DIRECTION_ROW_REVERSE, "column-reverse": q.default.FLEX_DIRECTION_COLUMN_REVERSE - }, t8 = { + }, tY = { center: q.default.JUSTIFY_CENTER, "flex-end": q.default.JUSTIFY_FLEX_END, "space-between": q.default.JUSTIFY_SPACE_BETWEEN, "space-around": q.default.JUSTIFY_SPACE_AROUND, "space-evenly": q.default.JUSTIFY_SPACE_EVENLY - }, t6 = tQ("margin", q.default.EDGE_TOP), t7 = tQ("margin", q.default.EDGE_RIGHT), t9 = tQ("margin", q.default.EDGE_BOTTOM), re = tQ("margin", q.default.EDGE_LEFT), rt = tQ("padding", q.default.EDGE_TOP), rr = tQ("padding", q.default.EDGE_RIGHT), rn = tQ("padding", q.default.EDGE_BOTTOM), ri = tQ("padding", q.default.EDGE_LEFT), ro = tQ("border", q.default.EDGE_TOP), ra = tQ("border", q.default.EDGE_RIGHT), ru = tQ("border", q.default.EDGE_BOTTOM), rl = tQ("border", q.default.EDGE_LEFT), rs = tQ("position", q.default.EDGE_TOP), rc = tQ("position", q.default.EDGE_RIGHT), rf = tQ("position", q.default.EDGE_BOTTOM), rd = tQ("position", q.default.EDGE_LEFT), rp = tQ("width"), rh = tQ("minWidth"), ry = tQ("maxWidth"), rg = tQ("height"), rv = tQ("minHeight"), rb = tQ("maxHeight"), rm = function(e) { + }, tK = tW("margin", q.default.EDGE_TOP), tQ = tW("margin", q.default.EDGE_RIGHT), t$ = tW("margin", q.default.EDGE_BOTTOM), t0 = tW("margin", q.default.EDGE_LEFT), t1 = tW("padding", q.default.EDGE_TOP), t2 = tW("padding", q.default.EDGE_RIGHT), t3 = tW("padding", q.default.EDGE_BOTTOM), t4 = tW("padding", q.default.EDGE_LEFT), t5 = tW("border", q.default.EDGE_TOP), t8 = tW("border", q.default.EDGE_RIGHT), t6 = tW("border", q.default.EDGE_BOTTOM), t7 = tW("border", q.default.EDGE_LEFT), t9 = tW("position", q.default.EDGE_TOP), re = tW("position", q.default.EDGE_RIGHT), rt = tW("position", q.default.EDGE_BOTTOM), rr = tW("position", q.default.EDGE_LEFT), rn = tW("width"), ri = tW("minWidth"), ro = tW("maxWidth"), ra = tW("height"), ru = tW("minHeight"), rl = tW("maxHeight"), rs = function(e) { return e.lines ? Math.max.apply(Math, [ 0 ].concat(e.lines.map(function(e) { return H.default(e); }))) : 0; - }, rD = function(e) { + }, rc = function(e) { return e.lines ? e.lines.reduce(function(e, t) { return e + t.box.height; }, 0) : -1; - }, rw = { + }, rf = { center: 0.5, right: 1 - }, rE = function(e) { + }, rd = function(e) { var t; return null !== (t = e.image) && void 0 !== t && t.data ? e.image.width / e.image.height : 1; - }, r_ = function(e) { + }, rp = function(e) { var t; return a.isNil(null === (t = e.box) || void 0 === t ? void 0 : t.height); - }, rx = function(e) { + }, rh = function(e) { return Math.max.apply(Math, [ -1 / 0 ].concat(e)); - }, rS = function() { + }, ry = function() { var e = {}, t = [], r = function() { return e; }, n = function(e, r) { @@ -2455,84 +2364,84 @@ return n(t, r), n(t + i, r), n(t, r + o), n(t + i, r + o), e; }, a = function(t, r, i, o) { return o = o || i, n(t - i, r - o), n(t + i, r - o), n(t + i, r + o), n(t - i, r + o), e; - }, u = function() { - return t.push.apply(t, arguments), e; }; - return e.rect = o, e.moveTo = i, e.lineTo = i, e.circle = a, e.polygon = u, e.ellipse = a, e.roundedRect = o, e.text = r, e.path = r, e.lineWidth = r, e.bezierCurveTo = r, e.quadraticCurveTo = r, e.scale = r, e.rotate = r, e.translate = r, e.dash = r, e.clip = r, e.save = r, e.fill = r, e.font = r, e.stroke = r, e.lineCap = r, e.opacity = r, e.restore = r, e.lineJoin = r, e.fontSize = r, e.fillColor = r, e.miterLimit = r, e.strokeColor = r, e.fillOpacity = r, e.strokeOpacity = r, e.linearGradient = r, e.radialGradient = r, e.getWidth = function() { - return rx(t.map(function(e) { + return e.rect = o, e.moveTo = i, e.lineTo = i, e.circle = a, e.polygon = function() { + return t.push.apply(t, arguments), e; + }, e.ellipse = a, e.roundedRect = o, e.text = r, e.path = r, e.lineWidth = r, e.bezierCurveTo = r, e.quadraticCurveTo = r, e.scale = r, e.rotate = r, e.translate = r, e.dash = r, e.clip = r, e.save = r, e.fill = r, e.font = r, e.stroke = r, e.lineCap = r, e.opacity = r, e.restore = r, e.lineJoin = r, e.fontSize = r, e.fillColor = r, e.miterLimit = r, e.strokeColor = r, e.fillOpacity = r, e.strokeOpacity = r, e.linearGradient = r, e.radialGradient = r, e.getWidth = function() { + return rh(t.map(function(e) { return e[0]; })); }, e.getHeight = function() { - return rx(t.map(function(e) { + return rh(t.map(function(e) { return e[1]; })); }, e; - }, rA = "_yogaNode", rk = q.default.Config.create(); - rk.setPointScaleFactor(0); - var rT = function(e) { + }, rg = "_yogaNode", rv = q.default.Config.create(); + rv.setPointScaleFactor(0); + var rb = function(e) { return function(t) { return t.type === e; }; - }, rO = rT(T.Svg), rC = rT(T.Text), rP = rT(T.Note), rF = rT(T.Page), rR = rT(T.Image), rI = rT(T.Canvas), rj = rT(T.TextInstance), rB = function(e) { + }, rm = rb(T.Svg), rD = rb(T.Text), rw = rb(T.Note), rE = rb(T.Page), r_ = rb(T.Image), rx = rb(T.Canvas), rS = rb(T.TextInstance), rA = function(e) { var t, r, n, i, o, u, l, s, c; - a.compose(rg(rF(e) ? e.box.height : e.style.height), rp(e.style.width), rh(e.style.minWidth), ry(e.style.maxWidth), rv(e.style.minHeight), rb(e.style.maxHeight), t6(e.style.marginTop), t7(e.style.marginRight), t9(e.style.marginBottom), re(e.style.marginLeft), rt(e.style.paddingTop), rr(e.style.paddingRight), rn(e.style.paddingBottom), ri(e.style.paddingLeft), (t = e.style.position, function(e) { + a.compose(ra(rE(e) ? e.box.height : e.style.height), rn(e.style.width), ri(e.style.minWidth), ro(e.style.maxWidth), ru(e.style.minHeight), rl(e.style.maxHeight), tK(e.style.marginTop), tQ(e.style.marginRight), t$(e.style.marginBottom), t0(e.style.marginLeft), t1(e.style.paddingTop), t2(e.style.paddingRight), t3(e.style.paddingBottom), t4(e.style.paddingLeft), (t = e.style.position, function(e) { var r = e._yogaNode; return !a.isNil(t) && r && r.setPositionType("absolute" === t ? q.default.POSITION_TYPE_ABSOLUTE : q.default.POSITION_TYPE_RELATIVE), e; - }), rs(e.style.top), rc(e.style.right), rf(e.style.bottom), rd(e.style.left), ro(e.style.borderTopWidth), ra(e.style.borderRightWidth), ru(e.style.borderBottomWidth), rl(e.style.borderLeftWidth), (r = e.style.display, function(e) { + }), t9(e.style.top), re(e.style.right), rt(e.style.bottom), rr(e.style.left), t5(e.style.borderTopWidth), t8(e.style.borderRightWidth), t6(e.style.borderBottomWidth), t7(e.style.borderLeftWidth), (r = e.style.display, function(e) { var t = e._yogaNode; return t && t.setDisplay("none" === r ? q.default.DISPLAY_NONE : q.default.DISPLAY_FLEX), e; }), (n = e.style.flexDirection, function(e) { var t = e._yogaNode; if (t) { - var r = t5[n] || q.default.FLEX_DIRECTION_COLUMN; + var r = tJ[n] || q.default.FLEX_DIRECTION_COLUMN; t.setFlexDirection(r); } return e; - }), t2(e.style.alignSelf), t4(e.style.alignContent), t3(e.style.alignItems), (i = e.style.justifyContent, function(e) { + }), tH(e.style.alignSelf), tX(e.style.alignContent), tZ(e.style.alignItems), (i = e.style.justifyContent, function(e) { var t = e._yogaNode; if (!a.isNil(i) && t) { - var r = t8[i] || q.default.JUSTIFY_FLEX_START; + var r = tY[i] || q.default.JUSTIFY_FLEX_START; t.setJustifyContent(r); } return e; }), (o = e.style.flexWrap, function(e) { var t = e._yogaNode; if (t) { - var r = tK[o] || q.default.WRAP_NO_WRAP; + var r = tz[o] || q.default.WRAP_NO_WRAP; t.setFlexWrap(r); } return e; }), (u = e.style.overflow, function(e) { var t = e._yogaNode; if (!a.isNil(u) && t) { - var r = tY[u] || q.default.OVERFLOW_VISIBLE; + var r = tU[u] || q.default.OVERFLOW_VISIBLE; t.setOverflow(r); } return e; }), (l = e.style.aspectRatio, function(e) { var t = e._yogaNode; return !a.isNil(l) && t && t.setAspectRatio(l), e; - }), t$(e.style.flexBasis), (s = e.style.flexGrow, function(e) { - return tQ("flexGrow")(s || 0)(e); + }), tG(e.style.flexBasis), (s = e.style.flexGrow, function(e) { + return tW("flexGrow")(s || 0)(e); }), (c = e.style.flexShrink, function(e) { - return tQ("flexShrink")(c || 1)(e); + return tW("flexShrink")(c || 1)(e); }))(e); - }, rM = function(e, t, r) { - var n, i = e[rA]; - return rC(e) && i.setMeasureFunc((n = e, function(e, t, i) { - if (t === q.default.MEASURE_MODE_EXACTLY) return n.lines || (n.lines = tj(n, e, i, r)), { - height: rD(n) + }, rk = function(e, t, r) { + var n, i = e[rg]; + return rD(e) && i.setMeasureFunc((n = e, function(e, t, i) { + if (t === q.default.MEASURE_MODE_EXACTLY) return n.lines || (n.lines = tS(n, e, i, r)), { + height: rc(n) }; if (t === q.default.MEASURE_MODE_AT_MOST) { - var o, a = rw[null === (o = n.style) || void 0 === o ? void 0 : o.textAlign] || 0; - return n.lines || (n.lines = tj(n, e, i, r), n.alignOffset = (e - rm(n)) * a), { - height: rD(n), - width: Math.min(e, rm(n)) + var o, a = rf[null === (o = n.style) || void 0 === o ? void 0 : o.textAlign] || 0; + return n.lines || (n.lines = tS(n, e, i, r), n.alignOffset = (e - rs(n)) * a), { + height: rc(n), + width: Math.min(e, rs(n)) }; } return {}; - })), rR(e) && i.setMeasureFunc(function(r, n, i, o) { - var a = rE(e), u = tq(e), l = ty(t), s = r_(t) ? 1 / 0 : t.box.height - l.paddingTop - l.paddingBottom - u.marginTop - u.marginBottom - 10; + })), r_(e) && i.setMeasureFunc(function(r, n, i, o) { + var a = rd(e), u = tI(e), l = to(t), s = rp(t) ? 1 / 0 : t.box.height - l.paddingTop - l.paddingBottom - u.marginTop - u.marginBottom - 10; return e.image ? n === q.default.MEASURE_MODE_EXACTLY && o === q.default.MEASURE_MODE_UNDEFINED ? { height: Math.min(s, r / a) } : o === q.default.MEASURE_MODE_EXACTLY && (n === q.default.MEASURE_MODE_AT_MOST || n === q.default.MEASURE_MODE_UNDEFINED) ? { @@ -2552,15 +2461,15 @@ width: 0, height: 0 }; - }), rI(e) && i.setMeasureFunc(function() { - var r = tq(e), n = ty(t), i = r_(t) ? 1 / 0 : t.box.height - n.paddingTop - n.paddingBottom - r.marginTop - r.marginBottom - 10, o = rS(); + }), rx(e) && i.setMeasureFunc(function() { + var r = tI(e), n = to(t), i = rp(t) ? 1 / 0 : t.box.height - n.paddingTop - n.paddingBottom - r.marginTop - r.marginBottom - 10, o = ry(); e.props.paint(o); var a = o.getWidth(); return { height: Math.min(i, o.getHeight()), width: a }; - }), rO(e) && i.setMeasureFunc(function(t, r, n, i) { + }), rm(e) && i.setMeasureFunc(function(t, r, n, i) { var o, a = ((o = e.props.viewBox) ? (o.maxX - o.minX) / (o.maxY - o.minY) : null) || 1; return r === q.default.MEASURE_MODE_EXACTLY || r === q.default.MEASURE_MODE_AT_MOST ? { width: t, @@ -2569,62 +2478,54 @@ width: n * a } : {}; }), e; - }, rN = function(e) { - return e[rA].calculateLayout(), e; - }, rL = function e(t) { - if (rj(t)) return t; - var r = Object.assign(ty(t), tq(t), tJ(t), tV(t), tZ(t)), n = Object.assign({}, t, { + }, rT = function(e) { + return e[rg].calculateLayout(), e; + }, rO = function e(t) { + if (rS(t)) return t; + var r = Object.assign(to(t), tI(t), tL(t), tj(t), tM(t)), n = Object.assign({}, t, { box: r }); return t.children ? Object.assign({}, n, { children: t.children.map(e) }) : n; - }, rU = function e(t) { + }, rC = function e(t) { var r = Object.assign({}, t); - return (delete r[rA], t.children) ? Object.assign({}, r, { + return (delete r[rg], t.children) ? Object.assign({}, r, { children: t.children.map(e) }) : r; - }, rz = function(e) { - return e[rA] && e[rA].freeRecursive(), e; - }, rW = function(e, t) { - return a.isNil(e) ? null : a.compose(rU, rz, rL, rN, function e(t, r) { + }, rP = function(e) { + return e[rg] && e[rg].freeRecursive(), e; + }, rF = function(e, t) { + return a.isNil(e) ? null : a.compose(rC, rP, rO, rT, function e(t, r) { return function(n) { - var i = q.default.Node.createWithConfig(rk), o = Object.assign({}, n); - if (o[rA] = i, rB(o), !rC(n) && !rP(n) && !rO(n) && n.children) { + var i = q.default.Node.createWithConfig(rv), o = Object.assign({}, n); + if (o[rg] = i, rA(o), !rD(n) && !rw(n) && !rm(n) && n.children) { var u = a.compose(function(e) { - return i.insertChild(e[rA], i.getChildCount()), e; + return i.insertChild(e[rg], i.getChildCount()), e; }, e(t, r)); o.children = n.children.map(u); } - return rM(o, t, r), o; + return rk(o, t, r), o; }; }(e, t))(e); - }, rG = function(e, t) { - if (!e.children) return e; - var r = function(e) { - return rW(e, t); - }, n = e.children.map(r); - return Object.assign({}, e, { - children: n - }); - }, rq = function(e) { + }, rR = function(e) { return e.type === T.Text; - }, rV = function(e, t) { + }, rI = function(e, t) { return Object.assign({}, t, { children: e }); - }, rH = function(e) { + }, rj = function(e) { var t; return (null === (t = e.box) || void 0 === t ? void 0 : t.top) || 0; - }, rZ = function(e) { + }, rB = function(e) { var t; return !a.isNil(null === (t = e.props) || void 0 === t ? void 0 : t.render); - }, rX = a.compose(tL, tW, rW), rJ = function(e) { + }, rM = a.compose(tO, tF, rF), rN = function(e) { console.warn("Node of type " + e.type + " can't wrap between pages and it's bigger than available page height"); - }, rY = function(e, t, r) { + }, rL = function(e, t, r) { for(var n = [], i = [], o = 0; o < r.length; o += 1){ - var a = r[o], u = r.slice(o + 1), l = u.filter(ti), s = rH(a), c = a.box.height, f = e <= s, d = tA(a, u, e), p = e + 0.001 < s + c, h = tp(a), y = c <= t; - if (ti(a)) { + var a = r[o], u = r.slice(o + 1), l = u.filter(e4), s = rj(a), c = a.box.height, f = e <= s, d = tg(a, u, e), p = e + 0.001 < s + c, h = tn(a), y = c <= t; + if (e4(a)) { i.push(a), n.push(a); continue; } @@ -2638,7 +2539,7 @@ continue; } if (!y && !h) { - n.push(a), i.push.apply(i, u), rJ(a); + n.push(a), i.push.apply(i, u), rN(a); break; } if (d) { @@ -2657,7 +2558,7 @@ break; } if (p) { - var w = r$(a, e, t), E = w[0], _ = w[1]; + var w = rW(a, e, t), E = w[0], _ = w[1]; E && n.push(E), _ && i.push(_); continue; } @@ -2667,25 +2568,25 @@ n, i ]; - }, rK = function(e, t, r) { + }, rU = function(e, t, r) { var n = r.children || []; - return rY(e - rH(r), t, n); - }, rQ = function(e, t, r) { - var n = tf(e, t), i = n[0], o = n[1], a = rK(t, r, e), u = a[0], l = a[1]; + return rL(e - rj(r), t, n); + }, rz = function(e, t, r) { + var n = tt(e, t), i = n[0], o = n[1], a = rU(t, r, e), u = a[0], l = a[1]; return [ - rV(u, i), - rV(l, o) + rI(u, i), + rI(l, o) ]; - }, r$ = function(e, t, r) { - return rq(e) ? tl(e, t) : rQ(e, t, r); - }, r0 = function e(t) { + }, rW = function(e, t, r) { + return rR(e) ? e7(e, t) : rz(e, t, r); + }, rG = function e(t) { var r = t.children || []; - return rZ(t) || r.some(e); - }, r1 = function e(t, r) { - var n, i = rZ(r), o = i && rq(r) ? U.default({}, r.box, { + return rB(t) || r.some(e); + }, rq = function e(t, r) { + var n, i = rB(r), o = i && rR(r) ? U.default({}, r.box, { height: 0 }) : r.box, a = (void 0 === (n = r.children) && (n = []), i) ? [ - tD(r.props.render(t)) + tc(r.props.render(t)) ].filter(Boolean) : n.map(function(r) { return e(t, r); }), u = i ? null : r.lines; @@ -2694,20 +2595,20 @@ lines: u, children: a }); - }, r2 = function(e, t, r) { - return r0(t) ? rX(r1(e, t), r) : t; - }, r3 = function(e, t, r) { - var n = tg(e), i = tv(e), o = r2({ + }, rV = function(e, t, r) { + return rG(t) ? rM(rq(e, t), r) : t; + }, rH = function(e, t, r) { + var n = ta(e), i = tu(e), o = rV({ pageNumber: t - }, e, r), u = e.style.height, l = rY(n, i, o.children), s = l[0], c = l[1], f = function(e) { - return rX(e, r); + }, e, r), u = e.style.height, l = rL(n, i, o.children), s = l[0], c = l[1], f = function(e) { + return rM(e, r); }, d = U.default({}, e.box, { height: u }), p = f(Object.assign({}, e, { box: d, children: s })); - if (0 === c.length || c.every(ti)) return [ + if (0 === c.length || c.every(e4)) return [ p, null ]; @@ -2720,126 +2621,88 @@ children: c })) ]; - }, r4 = function(e, t, r, n) { - return r2({ + }, rZ = function(e, t, r, n) { + return rV({ totalPages: n.length, pageNumber: r + 1, subPageNumber: t.subPageNumber + 1, subPageTotalPages: t.subPageTotalPages }, t, e); - }, r5 = function(e) { + }, rX = function(e) { return e.map(function(t, r) { return U.default({}, t, { subPageNumber: r, subPageTotalPages: e.length }); }); - }, r8 = function(e, t, r) { + }, rJ = function(e, t, r) { if (!e) return []; - for(var n = r3(e, t, r), i = [ + for(var n = rH(e, t, r), i = [ n[0] - ], o = n[1]; null !== o;)i.push((n = r3(o, t + i.length, r))[0]), o = n[1]; + ], o = n[1]; null !== o;)i.push((n = rH(o, t + i.length, r))[0]), o = n[1]; return i; - }, r6 = function(e, t) { - for(var r = [], n = 1, i = 0; i < e.children.length; i += 1){ - var o = r8(e.children[i], n, t); - o = r5(o), n += o.length, r = r.concat(o); - } - return rV(r = r.map(function() { - for(var e, r = arguments.length, n = Array(r), i = 0; i < r; i++)n[i] = arguments[i]; - return e = r4.apply(void 0, [ - t - ].concat(n)), a.omit([ - "subPageNumber", - "subPageTotalPages" - ], e); - }), e); - }, r7 = function(e) { + }, rY = function(e) { return function(t) { var r = a.matchPercent(t); return r ? r.percent * e.width : t; }; - }, r9 = function(e) { + }, rK = function(e) { return function(t) { var r = a.matchPercent(t); return r ? r.percent * e.height : t; }; - }, ne = function(e) { + }, rQ = function(e) { var t = e.style, r = a.evolve({ - paddingTop: r9(t), - paddingLeft: r7(t), - paddingRight: r7(t), - paddingBottom: r9(t) + paddingTop: rK(t), + paddingLeft: rY(t), + paddingRight: rY(t), + paddingBottom: rK(t) }, e.style); return Object.assign({}, e, { style: r }); - }, nt = function(e) { - if (!e.children) return e; - var t = e.children.map(ne); - return Object.assign({}, e, { - children: t - }); - }, nr = function(e) { + }, r$ = function(e) { return function(t) { if (t) { var r = a.matchPercent(t); return r ? r.percent * Math.min(e.width, e.height) : t; } }; - }, nn = function e(t) { - var r = a.evolve({ - borderTopLeftRadius: nr(t.box), - borderTopRightRadius: nr(t.box), - borderBottomRightRadius: nr(t.box), - borderBottomLeftRadius: nr(t.box) - }, t.style || {}), n = Object.assign({}, t, { - style: r - }); - return t.children ? Object.assign({}, n, { - children: t.children.map(e) - }) : n; - }, ni = function(e, t) { + }, r0 = function(e, t) { var r = a.matchPercent(t); return r ? r.percent * e : t; - }, no = function(e) { + }, r1 = function(e) { var t, r; return e.style.height - ((null === (t = e.style) || void 0 === t ? void 0 : t.paddingTop) || 0) - ((null === (r = e.style) || void 0 === r ? void 0 : r.paddingBottom) || 0); - }, na = function(e, t) { + }, r2 = function(e, t) { if (a.isNil(null === (r = e.style) || void 0 === r ? void 0 : r.height) || a.isNil(null === (n = t.style) || void 0 === n ? void 0 : n.height)) return t; - var r, n, i = ni(no(e), t.style.height), o = Object.assign({}, t.style, { + var r, n, i = r0(r1(e), t.style.height), o = Object.assign({}, t.style, { height: i }); return Object.assign({}, t, { style: o }); - }, nu = function(e) { + }, r3 = function(e) { if (!e.children) return e; - var t = function(t) { - return na(e, t); - }, r = e.children.map(t); - return Object.assign({}, e, { - children: r + var t = e.children.map(function(t) { + return r2(e, t); }); - }, nl = function(e) { - if (!e.children) return e; - var t = e.children.map(nu); return Object.assign({}, e, { children: t }); - }, ns = function(e) { + }, r4 = function(e) { return function(t) { return t.type === e; }; - }, nc = ns(T.Link), nf = ns(T.Text), nd = ns(T.TextInstance), np = function(e) { + }, r5 = r4(T.Link), r8 = r4(T.Text), r6 = r4(T.TextInstance), r7 = function(e) { var t; return !!(null !== (t = e.props) && void 0 !== t && t.render); - }, nh = function(e) { - return nf(e) || nd(e); - }, ny = function(e) { + }, r9 = function(e) { + return r8(e) || r6(e); + }, ne = function(e) { var t = e.children || []; - return !!t.every(nd) || !t.every(nf) && t.every(nh); - }, ng = function(e) { + return !!t.every(r6) || !t.every(r8) && t.every(r9); + }, nt = function(e) { var t = { type: T.Text, props: {}, @@ -2852,18 +2715,123 @@ t ] }); - }, nv = function(e) { - return nc(e) ? np(e) ? Object.assign({}, e, { + }, nr = function(e) { + return r5(e) ? r7(e) ? Object.assign({}, e, { type: T.Text - }) : ny(e) ? ng(e) : e : e; - }, nb = function e(t) { + }) : ne(e) ? nt(e) : e : e; + }, nn = a.asyncCompose(function e(t) { if (!t.children) return t; - var r = a.compose(nv, e), n = t.children.map(r); + var r = (t.type !== T.Document && t.type !== T.Svg ? t.children.sort(eI) : t.children).map(e); + return Object.assign({}, t, { + children: r + }); + }, function(e) { + if (!e.children) return e; + var t = e.children.map(eK); + return Object.assign({}, e, { + children: t + }); + }, function(e, t) { + for(var r = [], n = 1, i = 0; i < e.children.length; i += 1){ + var o = rJ(e.children[i], n, t); + o = rX(o), n += o.length, r = r.concat(o); + } + return rI(r = r.map(function() { + for(var e, r = arguments.length, n = Array(r), i = 0; i < r; i++)n[i] = arguments[i]; + return e = rZ.apply(void 0, [ + t + ].concat(n)), a.omit([ + "subPageNumber", + "subPageTotalPages" + ], e); + }), e); + }, tO, function e(t) { + var r = a.evolve({ + borderTopLeftRadius: r$(t.box), + borderTopRightRadius: r$(t.box), + borderBottomRightRadius: r$(t.box), + borderBottomLeftRadius: r$(t.box) + }, t.style || {}), n = Object.assign({}, t, { + style: r + }); + return t.children ? Object.assign({}, n, { + children: t.children.map(e) + }) : n; + }, function(e, t) { + if (!e.children) return e; + var r = e.children.map(function(e) { + return rF(e, t); + }); + return Object.assign({}, e, { + children: r + }); + }, function e(t, r) { + if (!t.children) return t; + var n = e_(t) ? eF(t, r) : t, i = n.children.map(function(t) { + return e(t, r); + }); + return Object.assign({}, n, { + children: i + }); + }, eV, tF, function(e) { + if (!e.children) return e; + var t = e.children.map(r3); + return Object.assign({}, e, { + children: t + }); + }, function(e) { + if (!e.children) return e; + var t = e.children.map(rQ); + return Object.assign({}, e, { + children: t + }); + }, function(e) { + if (!e.children) return e; + var t = e.children.map(eX); + return Object.assign({}, e, { + children: t + }); + }, function e(t) { + if (!t.children) return t; + var r = a.compose(nr, e), n = t.children.map(r); return Object.assign({}, t, { children: n }); - }, nm = a.asyncCompose(eM, e3, r6, tL, nn, rG, eI, eJ, tW, nl, nt, e$, nb, e4, tn); - t.Z = nm; + }, function(e) { + for(var t = 0, r = (e.children || []).slice(0).map(function(e) { + return { + value: e, + parent: null + }; + }); r.length > 0;)!function() { + var e = r.shift(), n = e.value, i = e.parent; + if (null !== (a = n.props) && void 0 !== a && a.bookmark) { + var o, a, u, l = "string" == typeof (o = n.props.bookmark) ? { + title: o, + fit: !1, + expanded: !1 + } : o, s = t++, c = U.default({ + ref: s, + parent: null === (u = i) || void 0 === u ? void 0 : u.ref + }, l); + n.props.bookmark = c, i = c; + } + n.children && n.children.forEach(function(e) { + r.push({ + value: e, + parent: i + }); + }); + }(); + return e; + }, function(e) { + if (!e.children) return e; + var t = e.children.map(e3); + return Object.assign({}, e, { + children: t + }); + }); + t.Z = nn; }, 5648: function(e) { "use strict"; @@ -3224,31 +3192,10 @@ o ]; } - var j = r(7369), B = r(9406), M = r(3226), N = r(9818), L = r.n(N), U = function(e, t) { - var r; - (null === (r = t.props) || void 0 === r ? void 0 : r.d) && e.path(t.props.d); - }, z = 4.0 * ((Math.sqrt(2) - 1.0) / 3.0), W = function(e, t) { - var r, n, i, o, a, u, l = (null === (r = t.props) || void 0 === r ? void 0 : r.x) || 0, s = (null === (n = t.props) || void 0 === n ? void 0 : n.y) || 0, c = (null === (i = t.props) || void 0 === i ? void 0 : i.rx) || 0, f = (null === (o = t.props) || void 0 === o ? void 0 : o.ry) || 0, d = (null === (a = t.props) || void 0 === a ? void 0 : a.width) || 0, p = (null === (u = t.props) || void 0 === u ? void 0 : u.height) || 0; - if (d && p) { - if (c && f) { - var h = c * z, y = f * z; - e.moveTo(l + c, s), e.lineTo(l - c + d, s), e.bezierCurveTo(l - c + d + h, s, l + d, s + f - y, l + d, s + f), e.lineTo(l + d, s + p - f), e.bezierCurveTo(l + d, s + p - f + y, l - c + d + h, s + p, l - c + d, s + p), e.lineTo(l + c, s + p), e.bezierCurveTo(l + c - h, s + p, l, s + p - f + y, l, s + p - f), e.lineTo(l, s + f), e.bezierCurveTo(l, s + f - y, l + c - h, s, l + c, s); - } else e.moveTo(l, s), e.lineTo(l + d, s), e.lineTo(l + d, s + p), e.lineTo(l, s + p); - e.closePath(); - } - }, G = function(e, t) { - var r = t.props || {}, n = r.x1, i = r.x2, o = r.y1, a = r.y2; - e.moveTo(n, o), e.lineTo(i, a); - }, q = function() {}, V = 4.0 * ((Math.sqrt(2) - 1.0) / 3.0), H = function(e, t, r, n, i) { - var o = t - n, a = r - i, u = n * V, l = i * V, s = o + 2 * n, c = a + 2 * i, f = o + n, d = a + i; + var j = r(7369), B = r(9406), M = r(3226), N = r(9818), L = r.n(N), U = 4.0 * ((Math.sqrt(2) - 1.0) / 3.0), z = 4.0 * ((Math.sqrt(2) - 1.0) / 3.0), W = function(e, t, r, n, i) { + var o = t - n, a = r - i, u = n * z, l = i * z, s = o + 2 * n, c = a + 2 * i, f = o + n, d = a + i; e.moveTo(o, d), e.bezierCurveTo(o, d - l, f - u, a, f, a), e.bezierCurveTo(f + u, a, s, d - l, s, d), e.bezierCurveTo(s, d + l, f + u, c, f, c), e.bezierCurveTo(f - u, c, o, d + l, o, d), e.closePath(); - }, Z = function(e, t) { - var r = t.props || {}; - H(e, r.cx, r.cy, r.rx, r.ry); - }, X = function(e, t) { - var r, n, i, o = null === (r = t.props) || void 0 === r ? void 0 : r.cx, a = null === (n = t.props) || void 0 === n ? void 0 : n.cy, u = null === (i = t.props) || void 0 === i ? void 0 : i.r; - H(e, o, a, u, u); - }, J = function(e, t, r, n, i, o) { + }, G = function(e, t, r, n, i, o) { void 0 === o && (o = {}); var a = 1000 / e._fontSize, u = 1000 / (e._font.font.unitsPerEm || 1000), l = e._font.encodeGlyphs(t), s = r.map(function(e, r) { return { @@ -3260,7 +3207,7 @@ }; }); return e._glyphs(l, s, n, i, o); - }, Y = function(e, t) { + }, q = function(e, t) { var r = (0, D.default)(t), n = t.attributes, i = n.font, o = n.fontSize, a = n.color, u = n.opacity; if (e.fillColor(a), e.fillOpacity(u), i.sbix || i.COLR && i.CPAL) { e.save(), e.translate(0, -t.ascent); @@ -3272,13 +3219,13 @@ } else { e.font("string" == typeof i.name ? i.name : i, o); try { - J(e, t.glyphs, t.positions, 0, 0); + G(e, t.glyphs, t.positions, 0, 0); } catch (f) { console.log(f); } } e.translate(r, 0); - }, K = function(e, t, r, n) { + }, V = function(e, t, r, n) { e.save(); var i, o, a, u, l, s = (null === (i = t.box) || void 0 === i ? void 0 : i.x) || 0, c = (null === (o = t.box) || void 0 === o ? void 0 : o.y) || 0, f = null === (a = t.runs[0]) || void 0 === a ? void 0 : a.attributes.font, d = (null === (u = t.runs[0]) || void 0 === u ? void 0 : null === (l = u.attributes) || void 0 === l ? void 0 : l.scale) || 1, p = (0, w.default)(t), h = f.ascent * d, y = f.xHeight * d, g = f.descent * d, v = f.capHeight * d, b = s, m = c; switch(r){ @@ -3312,53 +3259,35 @@ m = c; } e.translate(b, m), t.runs.forEach(function(t) { - return Y(e, t); + return q(e, t); }), e.restore(); - }, Q = function(e, t) { - t.children.forEach(function(t) { - return K(e, t.lines[0], t.props.textAnchor, t.props.dominantBaseline); - }); - }, $ = function(e) { + }, H = function(e) { for(var t = [], r = 0; r < e.length; r += 2)t.push([ e[r], e[r + 1] ]); return t; - }, ee = function(e) { + }, Z = function(e) { var t = (e || "").trim().replace(/,/g, " ").replace(/(\d)-(\d)/g, "$1 -$2").split(/\s+/); - return t.length % 2 != 0 && (t = t.slice(0, -1)), $(t = t.map(parseFloat)); - }, et = function(e, t) { + return t.length % 2 != 0 && (t = t.slice(0, -1)), H(t = t.map(parseFloat)); + }, X = function(e, t) { t.length > 0 && (e.moveTo(t[0][0], t[0][1]), t.slice(1).forEach(function(t) { return e.lineTo(t[0], t[1]); })); - }, er = function(e, t) { - et(e, ee(t.props.points || "")); - }, en = function(e, t) { - er(e, t), e.closePath(); - }, ei = function(e, t) { - if (t.image.data) { - var r = t.props, n = r.x, i = r.y, o = t.style, a = o.width, u = o.height, l = o.opacity, s = t.box.paddingLeft || 0, c = t.box.paddingLeft || 0; - if (0 === a || 0 === u) { - console.warn("Image with src '" + t.props.href + "' skipped due to invalid dimensions"); - return; - } - e.save(), e.fillOpacity(l || 1).image(t.image.data, n + c, i + s, { - width: a, - height: u - }), e.restore(); - } - }, eo = 4.0 * ((Math.sqrt(2) - 1.0) / 3.0), ea = function(e, t) { + }, J = function(e, t) { + X(e, Z(t.props.points || "")); + }, Y = 4.0 * ((Math.sqrt(2) - 1.0) / 3.0), K = function(e, t) { if (t.style) { - var r = t.box, n = r.top, i = r.left, o = r.width, a = r.height, u = t.style, l = u.borderTopLeftRadius, s = u.borderTopRightRadius, c = u.borderBottomRightRadius, f = u.borderBottomLeftRadius, d = Math.min(void 0 === s ? 0 : s, 0.5 * o, 0.5 * a), p = d * (1.0 - eo); + var r = t.box, n = r.top, i = r.left, o = r.width, a = r.height, u = t.style, l = u.borderTopLeftRadius, s = u.borderTopRightRadius, c = u.borderBottomRightRadius, f = u.borderBottomLeftRadius, d = Math.min(void 0 === s ? 0 : s, 0.5 * o, 0.5 * a), p = d * (1.0 - Y); e.moveTo(i + d, n), e.lineTo(i + o - d, n), e.bezierCurveTo(i + o - p, n, i + o, n + p, i + o, n + d); - var h = Math.min(void 0 === c ? 0 : c, 0.5 * o, 0.5 * a), y = h * (1.0 - eo); + var h = Math.min(void 0 === c ? 0 : c, 0.5 * o, 0.5 * a), y = h * (1.0 - Y); e.lineTo(i + o, n + a - h), e.bezierCurveTo(i + o, n + a - y, i + o - y, n + a, i + o - h, n + a); - var g = Math.min(void 0 === f ? 0 : f, 0.5 * o, 0.5 * a), v = g * (1.0 - eo); + var g = Math.min(void 0 === f ? 0 : f, 0.5 * o, 0.5 * a), v = g * (1.0 - Y); e.lineTo(i + g, n + a), e.bezierCurveTo(i + v, n + a, i, n + a - v, i, n + a - g); - var b = Math.min(void 0 === l ? 0 : l, 0.5 * o, 0.5 * a), m = b * (1.0 - eo); + var b = Math.min(void 0 === l ? 0 : l, 0.5 * o, 0.5 * a), m = b * (1.0 - Y); e.lineTo(i, n + b), e.bezierCurveTo(i, n + m, i + m, n, i + b, n), e.closePath(), e.clip(); } - }, eu = function(e, t, r) { + }, Q = function(e, t, r) { var n = t.operation, i = t.value; switch(n){ case "scale": @@ -3385,17 +3314,53 @@ default: console.error("Transform operation: '" + n + "' doesn't supported"); } - }, el = function(e, t) { + }, $ = function(e, t) { if (t.origin) { var r, n, i = [ t.origin.left, t.origin.top ]; ((null === (r = t.style) || void 0 === r ? void 0 : r.transform) || (null === (n = t.props) || void 0 === n ? void 0 : n.transform) || []).forEach(function(t) { - eu(e, t, i); + Q(e, t, i); }); } - }, es = function(e) { + }, ee = function(e) { + return Math.max.apply(Math, [ + -1 / 0 + ].concat(e)); + }, et = function(e) { + return Math.min.apply(Math, [ + 1 / 0 + ].concat(e)); + }, er = function(e) { + var t, r = Z((null === (t = e.props) || void 0 === t ? void 0 : t.points) || []), n = r.map(function(e) { + return e[0]; + }), i = r.map(function(e) { + return e[1]; + }); + return [ + et(n), + et(i), + ee(n), + ee(i) + ]; + }, en = ((n = {})[l.Rect] = function(e) { + var t, r, n, i, o = (null === (t = e.props) || void 0 === t ? void 0 : t.x) || 0, a = (null === (r = e.props) || void 0 === r ? void 0 : r.y) || 0; + return [ + o, + a, + o + ((null === (n = e.props) || void 0 === n ? void 0 : n.width) || 0), + a + ((null === (i = e.props) || void 0 === i ? void 0 : i.height) || 0) + ]; + }, n[l.Line] = function(e) { + var t, r, n, i, o = (null === (t = e.props) || void 0 === t ? void 0 : t.x1) || 0, a = (null === (r = e.props) || void 0 === r ? void 0 : r.y1) || 0, u = (null === (n = e.props) || void 0 === n ? void 0 : n.x2) || 0, l = (null === (i = e.props) || void 0 === i ? void 0 : i.y2) || 0; + return [ + Math.min(o, u), + Math.min(a, l), + Math.max(o, u), + Math.max(a, l) + ]; + }, n[l.Path] = function(e) { var t, r = function(e) { for(var t = [], r = 0, n = 0, i = 0, o = 0, a = null, u = null, l = 0, s = 0, c = 0, f = e.length; c < f; c++){ var d = e[c], p = d[0]; @@ -3473,7 +3438,7 @@ -1 / 0 ], i = 0, o = r.length; i < o; i += 1)for(var a = r[i].slice(1), u = 0; u < a.length; u += 2)a[u + 0] < n[0] && (n[0] = a[u + 0]), a[u + 1] < n[1] && (n[1] = a[u + 1]), a[u + 0] > n[2] && (n[2] = a[u + 0]), a[u + 1] > n[3] && (n[3] = a[u + 1]); return n; - }, ec = function(e) { + }, n[l.Circle] = function(e) { var t, r, n, i = (null === (t = e.props) || void 0 === t ? void 0 : t.r) || 0, o = (null === (r = e.props) || void 0 === r ? void 0 : r.cx) || 0, a = (null === (n = e.props) || void 0 === n ? void 0 : n.cy) || 0; return [ o - i, @@ -3481,7 +3446,7 @@ o + i, a + i ]; - }, ef = function(e) { + }, n[l.Ellipse] = function(e) { var t, r, n, i, o = (null === (t = e.props) || void 0 === t ? void 0 : t.cx) || 0, a = (null === (r = e.props) || void 0 === r ? void 0 : r.cy) || 0, u = (null === (n = e.props) || void 0 === n ? void 0 : n.rx) || 0, l = (null === (i = e.props) || void 0 === i ? void 0 : i.ry) || 0; return [ o - u, @@ -3489,111 +3454,114 @@ o + u, a + l ]; - }, ed = function(e) { - var t, r, n, i, o = (null === (t = e.props) || void 0 === t ? void 0 : t.x1) || 0, a = (null === (r = e.props) || void 0 === r ? void 0 : r.y1) || 0, u = (null === (n = e.props) || void 0 === n ? void 0 : n.x2) || 0, l = (null === (i = e.props) || void 0 === i ? void 0 : i.y2) || 0; - return [ - Math.min(o, u), - Math.min(a, l), - Math.max(o, u), - Math.max(a, l) - ]; - }, ep = function(e) { - var t, r, n, i, o = (null === (t = e.props) || void 0 === t ? void 0 : t.x) || 0, a = (null === (r = e.props) || void 0 === r ? void 0 : r.y) || 0; - return [ - o, - a, - o + ((null === (n = e.props) || void 0 === n ? void 0 : n.width) || 0), - a + ((null === (i = e.props) || void 0 === i ? void 0 : i.height) || 0) - ]; - }, eh = function(e) { - return Math.max.apply(Math, [ - -1 / 0 - ].concat(e)); - }, ey = function(e) { - return Math.min.apply(Math, [ - 1 / 0 - ].concat(e)); - }, eg = function(e) { - var t, r = ee((null === (t = e.props) || void 0 === t ? void 0 : t.points) || []), n = r.map(function(e) { - return e[0]; - }), i = r.map(function(e) { - return e[1]; - }); - return [ - ey(n), - ey(i), - eh(n), - eh(i) - ]; - }, ev = ((n = {})[l.Rect] = ep, n[l.Line] = ed, n[l.Path] = es, n[l.Circle] = ec, n[l.Ellipse] = ef, n[l.Polygon] = eg, n[l.Polyline] = eg, n), eb = function(e) { - var t = ev[e.type]; + }, n[l.Polygon] = er, n[l.Polyline] = er, n), ei = function(e) { + var t = en[e.type]; return t ? t(e) : [ 0, 0, 0, 0 ]; - }, em = function(e, t) { + }, eo = function(e, t) { var r, n = (null === (r = t.props) || void 0 === r ? void 0 : r.strokeWidth) || 0; n && e.lineWidth(n); - }, eD = function(e, t) { + }, ea = function(e, t) { var r, n = (null === (r = t.props) || void 0 === r ? void 0 : r.stroke) || null; n && e.strokeColor(n); - }, ew = function(e, t) { + }, eu = function(e, t) { var r, n = (null === (r = t.props) || void 0 === r ? void 0 : r.opacity) || null; (0, m.isNil)(n) || e.opacity(n); - }, eE = function(e, t) { + }, el = function(e, t) { var r, n = (null === (r = t.props) || void 0 === r ? void 0 : r.fillOpacity) || null; (0, m.isNil)(n) || e.fillOpacity(n); - }, e_ = function(e, t) { + }, es = function(e, t) { var r, n = (null === (r = t.props) || void 0 === r ? void 0 : r.strokeOpacity) || null; (0, m.isNil)(n) || e.strokeOpacity(n); - }, ex = function(e, t) { + }, ec = function(e, t) { var r, n = (null === (r = t.props) || void 0 === r ? void 0 : r.strokeLinejoin) || null; n && e.lineJoin(n); - }, eS = function(e, t) { + }, ef = function(e, t) { var r, n = (null === (r = t.props) || void 0 === r ? void 0 : r.strokeLinecap) || null; n && e.lineCap(n); - }, eA = function(e, t) { + }, ed = function(e, t) { var r, n = (null === (r = t.props) || void 0 === r ? void 0 : r.strokeDasharray) || null; n && e.dash(n.split(",")); - }, ek = function(e) { + }, ep = function(e) { var t, r; return (null === (t = e.props) || void 0 === t ? void 0 : null === (r = t.fill) || void 0 === r ? void 0 : r.type) === l.LinearGradient; - }, eT = function(e) { + }, eh = function(e) { var t, r; return (null === (t = e.props) || void 0 === t ? void 0 : null === (r = t.fill) || void 0 === r ? void 0 : r.type) === l.RadialGradient; - }, eO = function(e, t) { - var r, n = eb(t), i = (null === (r = t.props) || void 0 === r ? void 0 : r.fill) || null, o = i.props.x1 || 0, a = i.props.y1 || 0, u = i.props.x2 || 1, l = i.props.y2 || 0, s = n[2] - n[0], c = n[3] - n[1], f = n[0], d = n[1], p = e.linearGradient(s * o + f, c * a + d, s * u + f, c * l + d); + }, ey = function(e, t) { + var r, n = ei(t), i = (null === (r = t.props) || void 0 === r ? void 0 : r.fill) || null, o = i.props.x1 || 0, a = i.props.y1 || 0, u = i.props.x2 || 1, l = i.props.y2 || 0, s = n[2] - n[0], c = n[3] - n[1], f = n[0], d = n[1], p = e.linearGradient(s * o + f, c * a + d, s * u + f, c * l + d); i.children.forEach(function(e) { p.stop(e.props.offset, e.props.stopColor, e.props.stopOpacity); }), e.fill(p); - }, eC = function(e, t) { - var r, n = eb(t), i = (null === (r = t.props) || void 0 === r ? void 0 : r.fill) || null, o = i.props.cx || 0.5, a = i.props.cy || 0.5, u = i.props.fx || o, l = i.props.fy || a, s = i.props.r || 0.5, c = n[2] - n[0], f = n[3] - n[1], d = n[0], p = n[1], h = e.radialGradient(c * u + d, f * l + p, 0, c * o + d, f * a + p, s * c); + }, eg = function(e, t) { + var r, n = ei(t), i = (null === (r = t.props) || void 0 === r ? void 0 : r.fill) || null, o = i.props.cx || 0.5, a = i.props.cy || 0.5, u = i.props.fx || o, l = i.props.fy || a, s = i.props.r || 0.5, c = n[2] - n[0], f = n[3] - n[1], d = n[0], p = n[1], h = e.radialGradient(c * u + d, f * l + p, 0, c * o + d, f * a + p, s * c); i.children.forEach(function(e) { h.stop(e.props.offset, e.props.stopColor, e.props.stopOpacity); }), e.fill(h); - }, eP = function(e, t) { + }, ev = function(e, t) { var r, n = (null === (r = t.props) || void 0 === r ? void 0 : r.fill) || null; n && e.fillColor(n); - }, eF = function(e, t) { + }, eb = function(e, t) { var r = t.props || {}; r.fill && r.stroke ? e.fillAndStroke(r.fillRule) : r.fill ? e.fill(r.fillRule) : r.stroke ? e.stroke() : (e.save(), e.opacity(0), e.fill(null), e.restore()); - }, eR = function() {}, eI = ((i = {})[l.Tspan] = eR, i[l.TextInstance] = eR, i[l.Path] = U, i[l.Rect] = W, i[l.Line] = G, i[l.G] = q, i[l.Text] = Q, i[l.Circle] = X, i[l.Image] = ei, i[l.Ellipse] = Z, i[l.Polygon] = en, i[l.Polyline] = er, i), ej = function(e, t) { - var r = eI[t.type]; - eI ? r(e, t) : console.warn("SVG node of type " + t.type + " is not currenty supported"); - }, eB = function(e, t) { - eS(e, t), eA(e, t), ex(e, t), em(e, t), eD(e, t), ek(t) ? eO(e, t) : eT(t) ? eC(e, t) : eP(e, t), e_(e, t), eE(e, t), ew(e, t), el(e, t), ej(e, t), eF(e, t); - }, eM = function(e, t) { + }, em = function() {}, eD = ((i = {})[l.Tspan] = em, i[l.TextInstance] = em, i[l.Path] = function(e, t) { + var r; + (null === (r = t.props) || void 0 === r ? void 0 : r.d) && e.path(t.props.d); + }, i[l.Rect] = function(e, t) { + var r, n, i, o, a, u, l = (null === (r = t.props) || void 0 === r ? void 0 : r.x) || 0, s = (null === (n = t.props) || void 0 === n ? void 0 : n.y) || 0, c = (null === (i = t.props) || void 0 === i ? void 0 : i.rx) || 0, f = (null === (o = t.props) || void 0 === o ? void 0 : o.ry) || 0, d = (null === (a = t.props) || void 0 === a ? void 0 : a.width) || 0, p = (null === (u = t.props) || void 0 === u ? void 0 : u.height) || 0; + if (d && p) { + if (c && f) { + var h = c * U, y = f * U; + e.moveTo(l + c, s), e.lineTo(l - c + d, s), e.bezierCurveTo(l - c + d + h, s, l + d, s + f - y, l + d, s + f), e.lineTo(l + d, s + p - f), e.bezierCurveTo(l + d, s + p - f + y, l - c + d + h, s + p, l - c + d, s + p), e.lineTo(l + c, s + p), e.bezierCurveTo(l + c - h, s + p, l, s + p - f + y, l, s + p - f), e.lineTo(l, s + f), e.bezierCurveTo(l, s + f - y, l + c - h, s, l + c, s); + } else e.moveTo(l, s), e.lineTo(l + d, s), e.lineTo(l + d, s + p), e.lineTo(l, s + p); + e.closePath(); + } + }, i[l.Line] = function(e, t) { + var r = t.props || {}, n = r.x1, i = r.x2, o = r.y1, a = r.y2; + e.moveTo(n, o), e.lineTo(i, a); + }, i[l.G] = function() {}, i[l.Text] = function(e, t) { + t.children.forEach(function(t) { + return V(e, t.lines[0], t.props.textAnchor, t.props.dominantBaseline); + }); + }, i[l.Circle] = function(e, t) { + var r, n, i, o = null === (r = t.props) || void 0 === r ? void 0 : r.cx, a = null === (n = t.props) || void 0 === n ? void 0 : n.cy, u = null === (i = t.props) || void 0 === i ? void 0 : i.r; + W(e, o, a, u, u); + }, i[l.Image] = function(e, t) { + if (t.image.data) { + var r = t.props, n = r.x, i = r.y, o = t.style, a = o.width, u = o.height, l = o.opacity, s = t.box.paddingLeft || 0, c = t.box.paddingLeft || 0; + if (0 === a || 0 === u) { + console.warn("Image with src '" + t.props.href + "' skipped due to invalid dimensions"); + return; + } + e.save(), e.fillOpacity(l || 1).image(t.image.data, n + c, i + s, { + width: a, + height: u + }), e.restore(); + } + }, i[l.Ellipse] = function(e, t) { + var r = t.props || {}; + W(e, r.cx, r.cy, r.rx, r.ry); + }, i[l.Polygon] = function(e, t) { + J(e, t), e.closePath(); + }, i[l.Polyline] = J, i), ew = function(e, t) { + var r = eD[t.type]; + eD ? r(e, t) : console.warn("SVG node of type " + t.type + " is not currenty supported"); + }, eE = function(e, t) { + ef(e, t), ed(e, t), ec(e, t), eo(e, t), ea(e, t), ep(t) ? ey(e, t) : eh(t) ? eg(e, t) : ev(e, t), es(e, t), el(e, t), eu(e, t), $(e, t), ew(e, t), eb(e, t); + }, e_ = function(e, t) { var r, n = null === (r = t.props) || void 0 === r ? void 0 : r.clipPath; n && ((n.children || []).forEach(function(t) { - return ej(e, t); + return ew(e, t); }), e.clip()); - }, eN = function e(t, r) { + }, ex = function e(t, r) { (r.children || []).forEach(function(r) { - t.save(), eM(t, r), eB(t, r), e(t, r), t.restore(); + t.save(), e_(t, r), eE(t, r), e(t, r), t.restore(); }); - }, eL = function(e, t) { + }, eS = function(e, t) { var r = t.box, n = r.width, i = r.height, o = t.props, a = o.viewBox, u = o.preserveAspectRatio, l = void 0 === u ? {} : u, s = l.meetOrSlice, c = void 0 === s ? "meet" : s, f = l.align, d = void 0 === f ? "xMidYMid" : f; if (null != a && null != n && null != i) { var p = (null == a ? void 0 : a.minX) || 0, h = (null == a ? void 0 : a.minY) || 0, y = (null == a ? void 0 : a.maxX) || n, g = (null == a ? void 0 : a.maxY) || i, v = y / g, b = n / i, m = n / y, D = i / g; @@ -3630,18 +3598,16 @@ e.translate(-p, -h - (g - i * y / n)); } } - }, eU = function(e, t) { + }, eA = function(e, t) { var r = t.box, n = r.top, i = r.left, o = t.box.paddingLeft || 0, a = t.box.paddingTop || 0; e.translate(i + o, n + a); - }, ez = function(e, t) { - e.save(), ea(e, t), eU(e, t), eL(e, t), eN(e, t), e.restore(); - }, eW = function(e) { + }, ek = function(e) { var t = L().get(e); return { value: L().to.hex(t.value.slice(0, 3)), opacity: t.value[3] }; - }, eG = /^#.+/, eq = function(e, t) { + }, eT = /^#.+/, eO = function(e, t) { var r = t.xOffset, n = t.yOffset, i = t.width, o = t.height, a = t.image; e.translate(-i + (void 0 === r ? 0 : r), -o + (void 0 === n ? 0 : n)), e.image(a, 0, 0, { fit: [ @@ -3651,16 +3617,16 @@ align: "center", valign: "bottom" }); - }, eV = function(e, t) { + }, eC = function(e, t) { e.save(); for(var r = t.attributes.font, n = r.glyphForCodePoint(0x20), i = r.glyphForCodePoint(0xfffc), o = 0, a = 0; a < t.glyphs.length; a += 1){ var u = t.positions[a], l = t.glyphs[a]; - o += u.xAdvance || 0, l.id === i.id && t.attributes.attachment && (e.translate(o, u.yOffset || 0), eq(e, t.attributes.attachment), t.glyphs[a] = n, o = 0); + o += u.xAdvance || 0, l.id === i.id && t.attributes.attachment && (e.translate(o, u.yOffset || 0), eO(e, t.attributes.attachment), t.glyphs[a] = n, o = 0); } e.restore(); - }, eH = function(e, t, r) { - var n = t.attributes, i = n.font, o = n.fontSize, a = n.link, u = eW(t.attributes.color), l = (0, m.isNil)(t.attributes.opacity) ? u.opacity : t.attributes.opacity, s = (0, j.default)(t), c = (0, B.default)(t), f = (0, D.default)(t); - if (r.outlineRuns && e.rect(0, -s, f, s).stroke(), e.fillColor(u.value), e.fillOpacity(l), a && (a.match(eG) ? e.goTo(0, -s - c, f, s, a.slice(1)) : e.link(0, -s - c, f, s, a)), eV(e, t), i.sbix || i.COLR && i.CPAL) { + }, eP = function(e, t, r) { + var n = t.attributes, i = n.font, o = n.fontSize, a = n.link, u = ek(t.attributes.color), l = (0, m.isNil)(t.attributes.opacity) ? u.opacity : t.attributes.opacity, s = (0, j.default)(t), c = (0, B.default)(t), f = (0, D.default)(t); + if (r.outlineRuns && e.rect(0, -s, f, s).stroke(), e.fillColor(u.value), e.fillOpacity(l), a && (a.match(eT) ? e.goTo(0, -s - c, f, s, a.slice(1)) : e.link(0, -s - c, f, s, a)), eC(e, t), i.sbix || i.COLR && i.CPAL) { e.save(), e.translate(0, -t.ascent); for(var d = 0; d < t.glyphs.length; d += 1){ var p = t.positions[d], h = t.glyphs[d]; @@ -3670,16 +3636,16 @@ } else { e.font("string" == typeof i.name ? i.name : i, o); try { - J(e, t.glyphs, t.positions, 0, 0); + G(e, t.glyphs, t.positions, 0, 0); } catch (y) { console.log(y); } } e.translate(f, 0); - }, eZ = function(e, t, r) { - var n = eW(r); + }, eF = function(e, t, r) { + var n = ek(r); e.save(), e.fillOpacity(n.opacity), e.rect(t.x, t.y, t.width, t.height), e.fill(n.value), e.restore(); - }, eX = function(e, t) { + }, eR = function(e, t) { if (e.save(), e.lineWidth(t.rect.height), e.strokeOpacity(t.opacity), /dashed/.test(t.style) ? e.dash(3 * t.rect.height) : /dotted/.test(t.style) && e.dash(t.rect.height), /wavy/.test(t.style)) { var r = Math.max(2, t.rect.height), n = 1.1 * r, i = Math.floor(t.rect.width / (2 * n)), o = t.rect.width - 2 * i * n; n += o / i / 2; @@ -3688,37 +3654,30 @@ for(var s = 0; s < i; s += 1)e.bezierCurveTo(l + n, a, l + n, u, l + 2 * n, t.rect.y), l += 2 * n; } else e.moveTo(t.rect.x, t.rect.y), e.lineTo(t.rect.x + t.rect.width, t.rect.y), /double/.test(t.style) && (e.moveTo(t.rect.x, t.rect.y + 2 * t.rect.height), e.lineTo(t.rect.x + t.rect.width, t.rect.y + 2 * t.rect.height)); e.stroke(t.color), e.restore(); - }, eJ = function(e, t, r) { + }, eI = function(e, t, r) { var n = (0, M.default)(t); r.outlineLines && e.rect(t.box.x, t.box.y, t.box.width, t.box.height).stroke(), e.save(), e.translate(t.box.x, t.box.y + n); for(var i = 0; i < t.runs.length; i += 1){ var o = t.runs[i], a = i === t.runs.length - 1; if (o.attributes.backgroundColor) { var u = a ? t.overflowRight : 0; - eZ(e, { + eF(e, { x: 0, y: -n, height: t.box.height, width: (0, D.default)(o) - u }, o.attributes.backgroundColor); } - eH(e, o, r); + eP(e, o, r); } e.restore(), e.save(), e.translate(t.box.x, t.box.y); - for(var l = 0; l < t.decorationLines.length; l += 1)eX(e, t.decorationLines[l]); + for(var l = 0; l < t.decorationLines.length; l += 1)eR(e, t.decorationLines[l]); e.restore(); - }, eY = function(e, t, r) { + }, ej = function(e, t, r) { t.forEach(function(t) { - eJ(e, t, r); + eI(e, t, r); }); - }, eK = function(e, t) { - var r, n, i = t.box, o = i.top, a = i.left, u = [ - t.lines - ], l = (null === (r = t.box) || void 0 === r ? void 0 : r.paddingTop) || 0, s = (null === (n = t.box) || void 0 === n ? void 0 : n.paddingLeft) || 0, c = t.lines[0] ? t.lines[0].box.y : 0, f = t.alignOffset || 0; - e.save(), e.translate(a + s - f, o + l - c), u.forEach(function(t) { - eY(e, t, {}); - }), e.restore(); - }, eQ = function(e, t) { + }, eB = function(e, t) { var r, n = t.box, i = n.width, o = n.height, a = (null === (r = t.props) || void 0 === r ? void 0 : r.dpi) || 72; e.addPage({ size: [ @@ -3728,18 +3687,12 @@ margin: 0, userUnit: a / 72 }); - }, e$ = function(e, t) { - var r, n, i, o = t.box, a = o.top, u = o.left, l = (null == t ? void 0 : null === (r = t.children) || void 0 === r ? void 0 : r[0].value) || "", s = (null === (n = t.style) || void 0 === n ? void 0 : n.backgroundColor) || null, c = (null === (i = t.style) || void 0 === i ? void 0 : i.borderWidth) || null; - e.note(u, a, 0, 0, l, { - color: s, - borderWidth: c - }); - }, e0 = function(e) { + }, eM = function(e) { return !Number.isNaN(parseFloat(e)) && Number.isFinite(e); - }, e1 = function(e, t, r, n, i, o) { + }, eN = function(e, t, r, n, i, o) { var a = r / n, u = (0, m.matchPercent)(i), l = (0, m.matchPercent)(o), s = u ? u.percent : 0.5, c = l ? l.percent : 0.5; if (e / t > a) { - var f = t * a, d = e0(o) ? o : 0, p = e0(i) ? i : (e - f) * s; + var f = t * a, d = eM(o) ? o : 0, p = eM(i) ? i : (e - f) * s; return { width: f, height: t, @@ -3747,25 +3700,25 @@ yOffset: d }; } - var h = e / a, y = e0(i) ? i : 0, g = e0(o) ? o : (t - h) * c; + var h = e / a, y = eM(i) ? i : 0, g = eM(o) ? o : (t - h) * c; return { width: e, height: h, yOffset: g, xOffset: y }; - }, e2 = function(e, t, r, n, i, o) { - var a = (0, m.matchPercent)(i), u = (0, m.matchPercent)(o), l = a ? a.percent : 0.5, s = u ? u.percent : 0.5, c = e0(i) ? i : (e - r) * l, f = e0(o) ? o : (t - n) * s; + }, eL = function(e, t, r, n, i, o) { + var a = (0, m.matchPercent)(i), u = (0, m.matchPercent)(o), l = a ? a.percent : 0.5, s = u ? u.percent : 0.5, c = eM(i) ? i : (e - r) * l, f = eM(o) ? o : (t - n) * s; return { width: r, height: n, xOffset: c, yOffset: f }; - }, e3 = function(e, t, r, n, i, o) { + }, eU = function(e, t, r, n, i, o) { var a = r / n, u = (0, m.matchPercent)(i), l = (0, m.matchPercent)(o), s = u ? u.percent : 0.5, c = l ? l.percent : 0.5; if (e / t > a) { - var f = e / a, d = e0(i) ? i : 0, p = e0(o) ? o : (t - f) * c; + var f = e / a, d = eM(i) ? i : 0, p = eM(o) ? o : (t - f) * c; return { width: e, height: f, @@ -3773,26 +3726,26 @@ xOffset: d }; } - var h = t * a, y = e0(i) ? i : (e - h) * s; + var h = t * a, y = eM(i) ? i : (e - h) * s; return { width: h, height: t, xOffset: y, - yOffset: e0(o) ? o : 0 + yOffset: eM(o) ? o : 0 }; - }, e4 = function(e, t, r, n, i, o) { - var a = e1(e, t, r, n, i, o), u = e2(e, t, r, n, i, o); + }, ez = function(e, t, r, n, i, o) { + var a = eN(e, t, r, n, i, o), u = eL(e, t, r, n, i, o); return a.width < u.width ? a : u; - }, e5 = function(e, t, r, n, i, o, a) { + }, eW = function(e, t, r, n, i, o, a) { switch(void 0 === e && (e = "fill"), e){ case "contain": - return e1(t, r, n, i, o, a); + return eN(t, r, n, i, o, a); case "cover": - return e3(t, r, n, i, o, a); + return eU(t, r, n, i, o, a); case "none": - return e2(t, r, n, i, o, a); + return eL(t, r, n, i, o, a); case "scale-down": - return e4(t, r, n, i, o, a); + return ez(t, r, n, i, o, a); default: return { width: t, @@ -3801,9 +3754,9 @@ yOffset: (0, m.matchPercent)(a) ? 0 : a || 0 }; } - }, e8 = function(e, t, r) { + }, eG = function(e, t, r) { void 0 === r && (r = {}); - var n, i, o, a, u = t.box, l = u.left, s = u.top, c = null === (n = t.style) || void 0 === n ? void 0 : n.opacity, f = null === (i = t.style) || void 0 === i ? void 0 : i.objectFit, d = null === (o = t.style) || void 0 === o ? void 0 : o.objectPositionX, p = null === (a = t.style) || void 0 === a ? void 0 : a.objectPositionY, h = t.box.paddingTop || 0, y = t.box.paddingRight || 0, g = t.box.paddingBottom || 0, v = t.box.paddingLeft || 0, b = r.imageCache || new Map(), D = e5(f, t.box.width - v - y, t.box.height - h - g, t.image.width, t.image.height, d, p), w = D.width, E = D.height, _ = D.xOffset, x = D.yOffset; + var n, i, o, a, u = t.box, l = u.left, s = u.top, c = null === (n = t.style) || void 0 === n ? void 0 : n.opacity, f = null === (i = t.style) || void 0 === i ? void 0 : i.objectFit, d = null === (o = t.style) || void 0 === o ? void 0 : o.objectPositionX, p = null === (a = t.style) || void 0 === a ? void 0 : a.objectPositionY, h = t.box.paddingTop || 0, y = t.box.paddingRight || 0, g = t.box.paddingBottom || 0, v = t.box.paddingLeft || 0, b = r.imageCache || new Map(), D = eW(f, t.box.width - v - y, t.box.height - h - g, t.image.width, t.image.height, d, p), w = D.width, E = D.height, _ = D.xOffset, x = D.yOffset; if (t.image.data) { if (0 !== w && 0 !== E) { var S = t.image.key, A = b.get(S) || e.embedImage(t.image.data); @@ -3815,33 +3768,31 @@ }); } else console.warn("Image with src '" + JSON.stringify(t.props.src) + "' skipped due to invalid dimensions"); } - }, e6 = function(e, t, r) { - e.save(), ea(e, t), e8(e, t, r), e.restore(); - }, e7 = function(e, t) { + }, eq = function(e, t) { var r = t.box, n = r.left, i = r.top, o = r.width, a = r.height, u = r.paddingLeft, l = void 0 === u ? 0 : u, s = r.paddingTop, c = void 0 === s ? 0 : s, f = r.paddingRight, d = r.paddingBottom, p = r.borderLeftWidth, h = void 0 === p ? 0 : p, y = r.borderTopWidth, g = void 0 === y ? 0 : y, v = r.borderRightWidth, b = r.borderBottomWidth; e.fillColor("#a1c6e7").opacity(0.5).rect(n + l + h, i + c + g, o - l - (void 0 === f ? 0 : f) - (void 0 === v ? 0 : v) - h, a - c - (void 0 === d ? 0 : d) - g - (void 0 === b ? 0 : b)).fill(); - }, e9 = function(e, t) { + }, eV = function(e, t) { var r = t.box, n = r.left, i = r.top, o = r.width, a = r.height, u = r.paddingLeft, l = void 0 === u ? 0 : u, s = r.paddingTop, c = r.paddingRight, f = void 0 === c ? 0 : c, d = r.paddingBottom, p = void 0 === d ? 0 : d, h = r.borderLeftWidth, y = void 0 === h ? 0 : h, g = r.borderTopWidth, v = void 0 === g ? 0 : g, b = r.borderRightWidth, m = void 0 === b ? 0 : b, D = r.borderBottomWidth, w = void 0 === D ? 0 : D; e.fillColor("#c4deb9").opacity(0.5), e.rect(n + l + y, i + v, o - f - l - y - m, void 0 === s ? 0 : s).fill(), e.rect(n + y, i + v, l, a - v - w).fill(), e.rect(n + o - f - m, i + v, f, a - v - w).fill(), e.rect(n + l + y, i + a - p - w, o - f - l - y - m, p).fill(); - }, te = function(e) { + }, eH = function(e) { return { marginLeft: "auto" === e.marginLeft ? 0 : e.marginLeft, marginTop: "auto" === e.marginTop ? 0 : e.marginTop, marginRight: "auto" === e.marginRight ? 0 : e.marginRight, marginBottom: "auto" === e.marginBottom ? 0 : e.marginBottom }; - }, tt = function(e, t) { - var r = t.box, n = r.left, i = r.top, o = r.width, a = r.height, u = te(t.box), l = u.marginLeft, s = void 0 === l ? 0 : l, c = u.marginTop, f = void 0 === c ? 0 : c, d = u.marginRight, p = u.marginBottom, h = void 0 === p ? 0 : p; + }, eZ = function(e, t) { + var r = t.box, n = r.left, i = r.top, o = r.width, a = r.height, u = eH(t.box), l = u.marginLeft, s = void 0 === l ? 0 : l, c = u.marginTop, f = void 0 === c ? 0 : c, d = u.marginRight, p = u.marginBottom, h = void 0 === p ? 0 : p; e.fillColor("#f8cca1").opacity(0.5), e.rect(n, i - f, o, f).fill(), e.rect(n - s, i - f, s, a + f + h).fill(), e.rect(n + o, i - f, void 0 === d ? 0 : d, a + f + h).fill(), e.rect(n, i + a, o, h).fill(); - }, tr = function(e, t) { - var r = t.box, n = r.left, i = r.top, o = r.width, a = r.height, u = te(t.box), l = u.marginLeft, s = void 0 === l ? 0 : l, c = u.marginTop, f = void 0 === c ? 0 : c, d = u.marginRight, p = u.marginBottom; + }, eX = function(e, t) { + var r = t.box, n = r.left, i = r.top, o = r.width, a = r.height, u = eH(t.box), l = u.marginLeft, s = void 0 === l ? 0 : l, c = u.marginTop, f = void 0 === c ? 0 : c, d = u.marginRight, p = u.marginBottom; e.fontSize(6).opacity(1).fillColor("black").text(Math.round(o + s + (void 0 === d ? 0 : d)) + " x " + Math.round(a + f + (void 0 === p ? 0 : p)), n - s, Math.max(i - f - 4, 1)); - }, tn = function(e, t) { + }, eJ = function(e, t) { t.origin && e.circle(t.origin.left, t.origin.top, 3).fill("red").circle(t.origin.left, t.origin.top, 5).stroke("red"); - }, ti = function(e, t) { + }, eY = function(e, t) { var r; - null !== (r = t.props) && void 0 !== r && r.debug && (e.save(), e7(e, t), e9(e, t), tt(e, t), tr(e, t), tn(e, t), e.restore()); - }, to = [ + null !== (r = t.props) && void 0 !== r && r.debug && (e.save(), eq(e, t), eV(e, t), eZ(e, t), eX(e, t), eJ(e, t), e.restore()); + }, eK = [ "dash", "clip", "save", @@ -3876,94 +3827,91 @@ "quadraticCurveTo", "linearGradient", "radialGradient" - ], ta = function(e) { - var t = to.reduce(function(r, n) { + ], eQ = function(e) { + var t = eK.reduce(function(r, n) { var i; return (0, u.Z)({}, r, ((i = {})[n] = function() { return e[n].apply(e, arguments), t; }, i)); }, {}); return t; - }, tu = function(e, t) { - var r = t.box, n = r.top, i = r.left, o = r.width, a = r.height, u = t.box.paddingTop || 0, l = t.box.paddingLeft || 0, s = t.box.paddingRight || 0, c = t.box.paddingBottom || 0, f = o - l - s, d = a - u - c; - f && d || console.warn("Canvas element has null width or height. Please provide valid values via the `style` prop in order to correctly render it."), e.save().translate(i + l, n + u), t.props.paint && t.props.paint(ta(e), f, d), e.restore(); - }, tl = 4.0 * ((Math.sqrt(2) - 1.0) / 3.0), ts = function(e, t, r, n, i) { + }, e$ = 4.0 * ((Math.sqrt(2) - 1.0) / 3.0), e0 = function(e, t, r, n, i) { var o = t.top, a = t.left, u = t.width, l = t.height, s = r.borderTopWidth, c = r.borderRightWidth, f = r.borderLeftWidth; e.moveTo(a + i, o), e.lineTo(a + u - n, o); - var d = n * (1.0 - tl); + var d = n * (1.0 - e$); e.bezierCurveTo(a + u - d, o, a + u, o + d, a + u, o + n); var p = o + Math.max(s, n); e.lineTo(a + u, p), e.lineTo(a + u - c, p); var h = Math.max(n - c, 0); - e.bezierCurveTo(a + u - c, o + s + Math.max(n - s, 0) * (1.0 - tl), a + u - c - h * (1.0 - tl), o + s, a + u - c - h, o + s), e.lineTo(a + Math.max(i, f), o + s); + e.bezierCurveTo(a + u - c, o + s + Math.max(n - s, 0) * (1.0 - e$), a + u - c - h * (1.0 - e$), o + s, a + u - c - h, o + s), e.lineTo(a + Math.max(i, f), o + s); var y = o + Math.max(s, i); - e.bezierCurveTo(a + f + Math.max(i - f, 0) * (1.0 - tl), o + s, a + f, o + s + Math.max(i - s, 0) * (1.0 - tl), a + f, y), e.lineTo(a, y), e.lineTo(a, o + i); - var g = i * (1.0 - tl); + e.bezierCurveTo(a + f + Math.max(i - f, 0) * (1.0 - e$), o + s, a + f, o + s + Math.max(i - s, 0) * (1.0 - e$), a + f, y), e.lineTo(a, y), e.lineTo(a, o + i); + var g = i * (1.0 - e$); e.bezierCurveTo(a, o + g, a + g, o, a + i, o), e.closePath(), e.clip(), c && (e.moveTo(a + u / 2, -s / c * (-u / 2) + o), e.lineTo(a + u, o), e.lineTo(a, o), e.lineTo(a, o + l), e.closePath(), e.clip()), f && (e.moveTo(a + u / 2, -s / f * (-u / 2) + o), e.lineTo(a, o), e.lineTo(a + u, o), e.lineTo(a + u, o + l), e.closePath(), e.clip()); - }, tc = function(e, t, r, n, i) { - var o = t.top, a = t.left, u = t.width, l = r.borderTopColor, s = r.borderTopWidth, c = r.borderTopStyle, f = r.borderRightWidth, d = r.borderLeftWidth, p = i * (1.0 - tl), h = n * (1.0 - tl); + }, e1 = function(e, t, r, n, i) { + var o = t.top, a = t.left, u = t.width, l = r.borderTopColor, s = r.borderTopWidth, c = r.borderTopStyle, f = r.borderRightWidth, d = r.borderLeftWidth, p = i * (1.0 - e$), h = n * (1.0 - e$); e.moveTo(a, o + Math.max(i, s)), e.bezierCurveTo(a, o + p, a + p, o, a + i, o), e.lineTo(a + u - n, o), e.bezierCurveTo(a + u - h, o, a + u, o + h, a + u, o + n), e.strokeColor(l), e.lineWidth(2 * Math.max(f, s, d)), "dashed" === c ? e.dash(2 * s, { space: 1.2 * s }) : "dotted" === c && e.dash(s, { space: 1.2 * s }), e.stroke(), e.undash(); - }, tf = function(e, t, r, n, i) { + }, e2 = function(e, t, r, n, i) { var o = t.top, a = t.left, u = t.width, l = t.height, s = r.borderTopWidth, c = r.borderRightWidth, f = r.borderBottomWidth; e.moveTo(a + u, o + n), e.lineTo(a + u, o + l - i); - var d = i * (1.0 - tl); + var d = i * (1.0 - e$); e.bezierCurveTo(a + u, o + l - d, a + u - d, o + l, a + u - i, o + l); var p = a + u - Math.max(c, i); - e.lineTo(p, o + l), e.lineTo(p, o + l - f), e.bezierCurveTo(a + u - c - Math.max(i - c, 0) * (1.0 - tl), o + l - f, a + u - c, o + l - f - Math.max(i - f, 0) * (1.0 - tl), a + u - c, o + l - Math.max(i, f)), e.lineTo(a + u - c, o + Math.max(n, s)); + e.lineTo(p, o + l), e.lineTo(p, o + l - f), e.bezierCurveTo(a + u - c - Math.max(i - c, 0) * (1.0 - e$), o + l - f, a + u - c, o + l - f - Math.max(i - f, 0) * (1.0 - e$), a + u - c, o + l - Math.max(i, f)), e.lineTo(a + u - c, o + Math.max(n, s)); var h = a + u - Math.max(n, c); - e.bezierCurveTo(a + u - c, o + s + Math.max(n - s, 0) * (1.0 - tl), a + u - c - Math.max(n - c, 0) * (1.0 - tl), o + s, h, o + s), e.lineTo(h, o), e.lineTo(a + u - n, o); - var y = n * (1.0 - tl); + e.bezierCurveTo(a + u - c, o + s + Math.max(n - s, 0) * (1.0 - e$), a + u - c - Math.max(n - c, 0) * (1.0 - e$), o + s, h, o + s), e.lineTo(h, o), e.lineTo(a + u - n, o); + var y = n * (1.0 - e$); e.bezierCurveTo(a + u - y, o, a + u, o + y, a + u, o + n), e.closePath(), e.clip(), s && (e.moveTo(a + u / 2, -s / c * (-u / 2) + o), e.lineTo(a + u, o), e.lineTo(a + u, o + l), e.lineTo(a, o + l), e.closePath(), e.clip()), f && (e.moveTo(a + u / 2, f / c * (-u / 2) + o + l), e.lineTo(a + u, o + l), e.lineTo(a + u, o), e.lineTo(a, o), e.closePath(), e.clip()); - }, td = function(e, t, r, n, i) { - var o = t.top, a = t.left, u = t.width, l = t.height, s = r.borderRightColor, c = r.borderRightStyle, f = r.borderRightWidth, d = r.borderTopWidth, p = r.borderBottomWidth, h = i * (1.0 - tl), y = n * (1.0 - tl); + }, e3 = function(e, t, r, n, i) { + var o = t.top, a = t.left, u = t.width, l = t.height, s = r.borderRightColor, c = r.borderRightStyle, f = r.borderRightWidth, d = r.borderTopWidth, p = r.borderBottomWidth, h = i * (1.0 - e$), y = n * (1.0 - e$); e.moveTo(a + u - n, o), e.bezierCurveTo(a + u - y, o, a + u, o + y, a + u, o + n), e.lineTo(a + u, o + l - i), e.bezierCurveTo(a + u, o + l - h, a + u - h, o + l, a + u - i, o + l), e.strokeColor(s), e.lineWidth(2 * Math.max(f, d, p)), "dashed" === c ? e.dash(2 * f, { space: 1.2 * f }) : "dotted" === c && e.dash(f, { space: 1.2 * f }), e.stroke(), e.undash(); - }, tp = function(e, t, r, n, i) { + }, e4 = function(e, t, r, n, i) { var o = t.top, a = t.left, u = t.width, l = t.height, s = r.borderBottomWidth, c = r.borderRightWidth, f = r.borderLeftWidth; e.moveTo(a + u - i, o + l), e.lineTo(a + n, o + l); - var d = n * (1.0 - tl); + var d = n * (1.0 - e$); e.bezierCurveTo(a + d, o + l, a, o + l - d, a, o + l - n); var p = o + l - Math.max(s, n); e.lineTo(a, p), e.lineTo(a + f, p); var h = Math.max(n - f, 0); - e.bezierCurveTo(a + f, o + l - s - Math.max(n - s, 0) * (1.0 - tl), a + f + h * (1.0 - tl), o + l - s, a + f + h, o + l - s), e.lineTo(a + u - Math.max(i, c), o + l - s); + e.bezierCurveTo(a + f, o + l - s - Math.max(n - s, 0) * (1.0 - e$), a + f + h * (1.0 - e$), o + l - s, a + f + h, o + l - s), e.lineTo(a + u - Math.max(i, c), o + l - s); var y = o + l - Math.max(s, i); - e.bezierCurveTo(a + u - c - Math.max(i - c, 0) * (1.0 - tl), o + l - s, a + u - c, o + l - s - Math.max(i - s, 0) * (1.0 - tl), a + u - c, y), e.lineTo(a + u, y), e.lineTo(a + u, o + l - i); - var g = i * (1.0 - tl); + e.bezierCurveTo(a + u - c - Math.max(i - c, 0) * (1.0 - e$), o + l - s, a + u - c, o + l - s - Math.max(i - s, 0) * (1.0 - e$), a + u - c, y), e.lineTo(a + u, y), e.lineTo(a + u, o + l - i); + var g = i * (1.0 - e$); e.bezierCurveTo(a + u, o + l - g, a + u - g, o + l, a + u - i, o + l), e.closePath(), e.clip(), c && (e.moveTo(a + u / 2, s / c * (-u / 2) + o + l), e.lineTo(a + u, o + l), e.lineTo(a, o + l), e.lineTo(a, o), e.closePath(), e.clip()), f && (e.moveTo(a + u / 2, -s / f * (u / 2) + o + l), e.lineTo(a, o + l), e.lineTo(a + u, o + l), e.lineTo(a + u, o), e.closePath(), e.clip()); - }, th = function(e, t, r, n, i) { - var o = t.top, a = t.left, u = t.width, l = t.height, s = r.borderBottomColor, c = r.borderBottomStyle, f = r.borderBottomWidth, d = r.borderRightWidth, p = r.borderLeftWidth, h = n * (1.0 - tl), y = i * (1.0 - tl); + }, e5 = function(e, t, r, n, i) { + var o = t.top, a = t.left, u = t.width, l = t.height, s = r.borderBottomColor, c = r.borderBottomStyle, f = r.borderBottomWidth, d = r.borderRightWidth, p = r.borderLeftWidth, h = n * (1.0 - e$), y = i * (1.0 - e$); e.moveTo(a + u, o + l - i), e.bezierCurveTo(a + u, o + l - y, a + u - y, o + l, a + u - i, o + l), e.lineTo(a + n, o + l), e.bezierCurveTo(a + h, o + l, a, o + l - h, a, o + l - n), e.strokeColor(s), e.lineWidth(2 * Math.max(f, d, p)), "dashed" === c ? e.dash(2 * f, { space: 1.2 * f }) : "dotted" === c && e.dash(f, { space: 1.2 * f }), e.stroke(), e.undash(); - }, ty = function(e, t, r, n, i) { + }, e8 = function(e, t, r, n, i) { var o = t.top, a = t.left, u = t.width, l = t.height, s = r.borderTopWidth, c = r.borderLeftWidth, f = r.borderBottomWidth; e.moveTo(a, o + l - n), e.lineTo(a, o + i); - var d = i * (1.0 - tl); + var d = i * (1.0 - e$); e.bezierCurveTo(a, o + d, a + d, o, a + i, o); var p = a + Math.max(c, i); - e.lineTo(p, o), e.lineTo(p, o + s), e.bezierCurveTo(a + c + Math.max(i - c, 0) * (1.0 - tl), o + s, a + c, o + s + Math.max(i - s, 0) * (1.0 - tl), a + c, o + Math.max(i, s)), e.lineTo(a + c, o + l - Math.max(n, f)); + e.lineTo(p, o), e.lineTo(p, o + s), e.bezierCurveTo(a + c + Math.max(i - c, 0) * (1.0 - e$), o + s, a + c, o + s + Math.max(i - s, 0) * (1.0 - e$), a + c, o + Math.max(i, s)), e.lineTo(a + c, o + l - Math.max(n, f)); var h = a + Math.max(n, c); - e.bezierCurveTo(a + c, o + l - f - Math.max(n - f, 0) * (1.0 - tl), a + c + Math.max(n - c, 0) * (1.0 - tl), o + l - f, h, o + l - f), e.lineTo(h, o + l), e.lineTo(a + n, o + l); - var y = n * (1.0 - tl); + e.bezierCurveTo(a + c, o + l - f - Math.max(n - f, 0) * (1.0 - e$), a + c + Math.max(n - c, 0) * (1.0 - e$), o + l - f, h, o + l - f), e.lineTo(h, o + l), e.lineTo(a + n, o + l); + var y = n * (1.0 - e$); e.bezierCurveTo(a + y, o + l, a, o + l - y, a, o + l - n), e.closePath(), e.clip(), f && (e.moveTo(a + u / 2, -f / c * (u / 2) + o + l), e.lineTo(a, o + l), e.lineTo(a, o), e.lineTo(a + u, o), e.closePath(), e.clip()), f && (e.moveTo(a + u / 2, -s / c * (-u / 2) + o), e.lineTo(a, o), e.lineTo(a, o + l), e.lineTo(a + u, o + l), e.closePath(), e.clip()); - }, tg = function(e, t, r, n, i) { - var o = t.top, a = t.left, u = t.height, l = r.borderLeftColor, s = r.borderLeftStyle, c = r.borderLeftWidth, f = r.borderTopWidth, d = r.borderBottomWidth, p = n * (1.0 - tl), h = i * (1.0 - tl); + }, e6 = function(e, t, r, n, i) { + var o = t.top, a = t.left, u = t.height, l = r.borderLeftColor, s = r.borderLeftStyle, c = r.borderLeftWidth, f = r.borderTopWidth, d = r.borderBottomWidth, p = n * (1.0 - e$), h = i * (1.0 - e$); e.moveTo(a + n, o + u), e.bezierCurveTo(a + p, o + u, a, o + u - p, a, o + u - n), e.lineTo(a, o + i), e.bezierCurveTo(a, o + h, a + h, o, a + i, o), e.strokeColor(l), e.lineWidth(2 * Math.max(c, f, d)), "dashed" === s ? e.dash(2 * c, { space: 1.2 * c }) : "dotted" === s && e.dash(c, { space: 1.2 * c }), e.stroke(), e.undash(); - }, tv = function(e, t) { + }, e7 = function(e, t) { if (t.box && (t.box.borderTopWidth || t.box.borderRightWidth || t.box.borderBottomWidth || t.box.borderLeftWidth)) { var r = t.box, n = r.width, i = r.height, o = r.borderTopWidth, a = r.borderLeftWidth, u = r.borderRightWidth, l = r.borderBottomWidth, s = t.style, c = s.opacity, f = s.borderTopLeftRadius, d = void 0 === f ? 0 : f, p = s.borderTopRightRadius, h = void 0 === p ? 0 : p, y = s.borderBottomLeftRadius, g = void 0 === y ? 0 : y, v = s.borderBottomRightRadius, b = void 0 === v ? 0 : v, m = s.borderTopColor, D = s.borderTopStyle, w = s.borderLeftColor, E = s.borderLeftStyle, _ = s.borderRightColor, x = s.borderRightStyle, S = s.borderBottomColor, A = s.borderBottomStyle, k = { borderTopColor: void 0 === m ? "black" : m, @@ -3983,40 +3931,58 @@ borderBottomLeftRadius: g, borderBottomRightRadius: b }, T = Math.min(h, 0.5 * n, 0.5 * i), O = Math.min(d, 0.5 * n, 0.5 * i), C = Math.min(b, 0.5 * n, 0.5 * i), P = Math.min(g, 0.5 * n, 0.5 * i); - e.save(), e.strokeOpacity(c), o && (e.save(), ts(e, t.box, k, T, O), tc(e, t.box, k, T, O), e.restore()), u && (e.save(), tf(e, t.box, k, T, C), td(e, t.box, k, T, C), e.restore()), l && (e.save(), tp(e, t.box, k, P, C), th(e, t.box, k, P, C), e.restore()), a && (e.save(), ty(e, t.box, k, P, O), tg(e, t.box, k, P, O), e.restore()), e.restore(); + e.save(), e.strokeOpacity(c), o && (e.save(), e0(e, t.box, k, T, O), e1(e, t.box, k, T, O), e.restore()), u && (e.save(), e2(e, t.box, k, T, C), e3(e, t.box, k, T, C), e.restore()), l && (e.save(), e4(e, t.box, k, P, C), e5(e, t.box, k, P, C), e.restore()), a && (e.save(), e8(e, t.box, k, P, O), e6(e, t.box, k, P, O), e.restore()), e.restore(); } - }, tb = function(e, t) { - var r, n = t.box, i = n.top, o = n.left, a = n.width, u = n.height, l = eW(t.style.backgroundColor), s = (0, m.isNil)(null === (r = t.style) || void 0 === r ? void 0 : r.opacity) ? 1 : t.style.opacity, c = Math.min(l.opacity, s); + }, e9 = function(e, t) { + var r, n = t.box, i = n.top, o = n.left, a = n.width, u = n.height, l = ek(t.style.backgroundColor), s = (0, m.isNil)(null === (r = t.style) || void 0 === r ? void 0 : r.opacity) ? 1 : t.style.opacity, c = Math.min(l.opacity, s); e.fillOpacity(c).fillColor(l.value).rect(o, i, a, u).fill(); - }, tm = function(e, t) { + }, te = function(e, t) { + var r; + t.box && null !== (r = t.style) && void 0 !== r && r.backgroundColor && (e.save(), K(e, t), e9(e, t), e.restore()); + }, tt = function(e, t) { var r; - t.box && null !== (r = t.style) && void 0 !== r && r.backgroundColor && (e.save(), ea(e, t), tb(e, t), e.restore()); - }, tD = function(e, t) { + null !== (r = t.props) && void 0 !== r && r.id && e.addNamedDestination(t.props.id, "XYZ", null, t.box.top, null); + }, tr = function(e, t, r) { + e.save(), t.box && e.translate(t.box.left, t.box.top), (t.children || []).forEach(function(t) { + return ti(e, t, r); + }), e.restore(); + }, tn = ((o = {})[l.Text] = function(e, t) { + var r, n, i = t.box, o = i.top, a = i.left, u = [ + t.lines + ], l = (null === (r = t.box) || void 0 === r ? void 0 : r.paddingTop) || 0, s = (null === (n = t.box) || void 0 === n ? void 0 : n.paddingLeft) || 0, c = t.lines[0] ? t.lines[0].box.y : 0, f = t.alignOffset || 0; + e.save(), e.translate(a + s - f, o + l - c), u.forEach(function(t) { + ej(e, t, {}); + }), e.restore(); + }, o[l.Note] = function(e, t) { + var r, n, i, o = t.box, a = o.top, u = o.left, l = (null == t ? void 0 : null === (r = t.children) || void 0 === r ? void 0 : r[0].value) || "", s = (null === (n = t.style) || void 0 === n ? void 0 : n.backgroundColor) || null, c = (null === (i = t.style) || void 0 === i ? void 0 : i.borderWidth) || null; + e.note(u, a, 0, 0, l, { + color: s, + borderWidth: c + }); + }, o[l.Image] = function(e, t, r) { + e.save(), K(e, t), eG(e, t, r), e.restore(); + }, o[l.Canvas] = function(e, t) { + var r = t.box, n = r.top, i = r.left, o = r.width, a = r.height, u = t.box.paddingTop || 0, l = t.box.paddingLeft || 0, s = t.box.paddingRight || 0, c = t.box.paddingBottom || 0, f = o - l - s, d = a - u - c; + f && d || console.warn("Canvas element has null width or height. Please provide valid values via the `style` prop in order to correctly render it."), e.save().translate(i + l, n + u), t.props.paint && t.props.paint(eQ(e), f, d), e.restore(); + }, o[l.Svg] = function(e, t) { + e.save(), K(e, t), eA(e, t), eS(e, t), ex(e, t), e.restore(); + }, o[l.Link] = function(e, t) { var r = t.props || {}, n = t.box, i = n.top, o = n.left, a = n.width, u = n.height, l = r.src || r.href; if (l) { var s = /^#.+/.test(l), c = s ? l.slice(1) : l; e[s ? "goTo" : "link"](o, i, a, u, c); } - }, tw = function(e, t) { - var r; - null !== (r = t.props) && void 0 !== r && r.id && e.addNamedDestination(t.props.id, "XYZ", null, t.box.top, null); - }, tE = function(e, t, r) { - e.save(), t.box && e.translate(t.box.left, t.box.top); - var n = t.children || [], i = function(t) { - return tx(e, t, r); - }; - n.forEach(i), e.restore(); - }, t_ = ((o = {})[l.Text] = eK, o[l.Note] = e$, o[l.Image] = e6, o[l.Canvas] = tu, o[l.Svg] = ez, o[l.Link] = tD, o), tx = function(e, t, r) { + }, o), ti = function(e, t, r) { var n, i = (null === (n = t.style) || void 0 === n ? void 0 : n.overflow) === "hidden", o = t.type !== l.Text && t.type !== l.Svg; - t.type === l.Page && eQ(e, t), e.save(), i && ea(e, t), el(e, t), tm(e, t), tv(e, t); - var a = t_[t.type]; - a && a(e, t, r), o && tE(e, t, r), tw(e, t), ti(e, t), e.restore(); - }, tS = function(e, t) { + t.type === l.Page && eB(e, t), e.save(), i && K(e, t), $(e, t), te(e, t), e7(e, t); + var a = tn[t.type]; + a && a(e, t, r), o && tr(e, t, r), tt(e, t), eY(e, t), e.restore(); + }, to = function(e, t) { var r, n = (r = e, function(e, t) { t && (r.info[e] = t); }), i = t.props || {}, o = i.title || null, a = i.author || null, u = i.subject || null, l = i.keywords || null, s = i.creator || "react-pdf", c = i.producer || "react-pdf"; n("Title", o), n("Author", a), n("Subject", u), n("Keywords", l), n("Creator", s), n("Producer", c); - }, tA = function e(t, r, n, i) { + }, ta = function e(t, r, n, i) { var o, a = null === (o = r.props) || void 0 === o ? void 0 : o.bookmark; if (a) { var u = a.title, l = a.parent, s = a.expanded, c = a.zoom, f = a.fit, d = i[l] || t.outline, p = a.top || r.box.top, h = a.left || r.box.left, y = d.addItem(u, { @@ -4032,26 +3998,26 @@ r.children && r.children.forEach(function(r) { return e(t, r, n, i); }); - }, tk = function(e, t) { + }, tu = function(e, t) { var r = {}; (t.children || []).forEach(function(t, n) { - tA(e, t, n, r); + ta(e, t, n, r); }); - }, tT = function(e, t) { + }, tl = function(e, t) { var r = t.children || [], n = { imageCache: new Map() }; - return tS(e, t), r.forEach(function(t) { - return tx(e, t, n); - }), tk(e, t), e.end(), e; - }, tO = r(6054), tC = r(791); - function tP(e, t) { + return to(e, t), r.forEach(function(t) { + return ti(e, t, n); + }), tu(e, t), e.end(), e; + }, ts = r(6054), tc = r(791); + function tf(e, t) { if (null == e) return {}; var r, n, i = {}, o = Object.keys(e); for(n = 0; n < o.length; n++)r = o[n], t.indexOf(r) >= 0 || (i[r] = e[r]); return i; } - var tF = r(8448), tR = r.n(tF), tI = r(6821), tj = function e(t, r) { + var td = r(8448), tp = r.n(td), th = r(6821), ty = function e(t, r) { var n = Object.keys(t), i = Object.keys(r); if (n.length !== i.length) return !1; for(var o = 0; o < n.length; o += 1){ @@ -4064,16 +4030,16 @@ if ("children" === a && ("string" == typeof t[a] || "string" == typeof r[a])) return t[a] === r[a]; } return !0; - }, tB = [ + }, tg = [ "style", "children" - ], tM = [ + ], tv = [ "style" - ], tN = {}, tL = function(e) { + ], tb = {}, tm = function(e) { var t = e.onChange; - return tR()({ - schedulePassiveEffects: tI.unstable_scheduleCallback, - cancelPassiveEffects: tI.unstable_cancelCallback, + return tp()({ + schedulePassiveEffects: th.unstable_scheduleCallback, + cancelPassiveEffects: th.unstable_cancelCallback, supportsMutation: !0, isPrimaryRenderer: !1, warnsIfNotActing: !1, @@ -4086,7 +4052,7 @@ type: e, box: {}, style: r || {}, - props: tP(t, tB) || {}, + props: tf(t, tg) || {}, children: [] }; }, @@ -4105,15 +4071,15 @@ prepareForCommit: function() {}, clearContainer: function() {}, prepareUpdate: function(e, t, r, n) { - return !tj(r, n); + return !ty(r, n); }, resetAfterCommit: void 0 === t ? function() {} : t, resetTextContent: function(e) {}, getRootHostContext: function() { - return tN; + return tb; }, getChildHostContext: function() { - return tN; + return tb; }, shouldSetTextContent: function(e, t) { return !1; @@ -4142,36 +4108,36 @@ e.value = r; }, commitUpdate: function(e, t, r, n, i) { - var o = i.style, a = tP(i, tM); + var o = i.style, a = tf(i, tv); e.props = a, e.style = o; } }); - }, tU = new b.Z(), tz = {}, tW = function(e) { - var t, r, n, i, o = function() { - for(var e, t = (null === (e = tz.change) || void 0 === e ? void 0 : e.slice()) || [], r = 0; r < t.length; r += 1)t[r](); - }, u = { + }, tD = new b.Z(), tw = {}, tE = function(e) { + var t, r, n, i, o = { type: "ROOT", document: null - }, l = (a = a || tL({ - onChange: o - })).createContainer(u), s = function(e) { - a.updateContainer(e, l, null); + }, u = (a = a || tm({ + onChange: function() { + for(var e, t = (null === (e = tw.change) || void 0 === e ? void 0 : e.slice()) || [], r = 0; r < t.length; r += 1)t[r](); + } + })).createContainer(o), l = function(e) { + a.updateContainer(e, u, null); }; - e && s(e); - var c = (t = p(y().mark(function e(t) { - var r, n, i, o, a; + e && l(e); + var s = (t = p(y().mark(function e(t) { + var r, n, i, a, u; return y().wrap(function(e) { for(;;)switch(e.prev = e.next){ case 0: - return void 0 === t && (t = !0), n = (r = u.document.props || {}).pdfVersion, i = r.language, o = new tO.default({ + return void 0 === t && (t = !0), n = (r = o.document.props || {}).pdfVersion, i = r.language, a = new ts.default({ compress: t, pdfVersion: n, lang: i, displayTitle: !0, autoFirstPage: !1 - }), e.next = 6, (0, tC.Z)(u.document, tU); + }), e.next = 6, (0, tc.Z)(o.document, tD); case 6: - return a = e.sent, e.abrupt("return", tT(o, a)); + return u = e.sent, e.abrupt("return", tl(a, u)); case 8: case "end": return e.stop(); @@ -4179,26 +4145,26 @@ }, e); })), function(e) { return t.apply(this, arguments); - }), f = function(e) { - void 0 === e && (e = {}), u.document.props.onRender && u.document.props.onRender(e); + }), c = function(e) { + void 0 === e && (e = {}), o.document.props.onRender && o.document.props.onRender(e); }; return { on: function(e, t) { - tz[e] || (tz[e] = []), tz[e].push(t); + tw[e] || (tw[e] = []), tw[e].push(t); }, - container: u, + container: o, toBlob: (r = p(y().mark(function e() { var t; return y().wrap(function(e) { for(;;)switch(e.prev = e.next){ case 0: - return e.next = 2, c(); + return e.next = 2, s(); case 2: return t = e.sent.pipe(v()()), e.abrupt("return", new Promise(function(e, r) { t.on("finish", function() { try { var n = t.toBlob("application/pdf"); - f({ + c({ blob: n }), e(n); } catch (i) { @@ -4218,7 +4184,7 @@ return y().wrap(function(e) { for(;;)switch(e.prev = e.next){ case 0: - return f(), e.abrupt("return", c()); + return c(), e.abrupt("return", s()); case 2: case "end": return e.stop(); @@ -4232,14 +4198,14 @@ return y().wrap(function(e) { for(;;)switch(e.prev = e.next){ case 0: - return t = "", e.next = 3, c(!1); + return t = "", e.next = 3, s(!1); case 3: return r = e.sent, e.abrupt("return", new Promise(function(e, n) { try { r.on("data", function(e) { t += e; }), r.on("end", function() { - f(), e(t); + c(), e(t); }); } catch (i) { n(i); @@ -4254,14 +4220,14 @@ return i.apply(this, arguments); }), removeListener: function(e, t) { - if (tz[e]) { - var r = tz[e].indexOf(t); - r > -1 && tz[e].splice(r, 1); + if (tw[e]) { + var r = tw[e].indexOf(t); + r > -1 && tw[e].splice(r, 1); } }, - updateContainer: s + updateContainer: l }; - }, tG = function(e) { + }, t_ = function(e) { var t = e.document, r = (0, f.useRef)(null), n = (0, f.useState)({ url: null, blob: null, @@ -4280,21 +4246,21 @@ }), e.splice(0, e.length, function() { return i.error ? Promise.resolve() : r.current.toBlob(); }); - }, a = function(e) { + }; + return r.current = tE(), r.current.on("change", n), r.current.updateContainer(t), e.on("error", function(e) { console.error(e), o(function(t) { return (0, u.Z)({}, t, { error: e }); }); - }, l = function(e) { + }), e.on("success", function(e) { o({ blob: e, error: null, loading: !1, url: URL.createObjectURL(e) }); - }; - return r.current = tW(), r.current.on("change", n), r.current.updateContainer(t), e.on("error", a), e.on("success", l), function() { + }), function() { e.end(), r.current.removeListener("change", n); }; }, []), (0, f.useEffect)(function() { @@ -4309,80 +4275,78 @@ r.current.updateContainer(t); } ]; - }, tq = [ + }, tx = [ "title", "style", "className", "children", "innerRef", "showToolbar" - ], tV = function(e) { - var t = e.title, r = e.style, n = e.className, i = e.children, o = e.innerRef, a = e.showToolbar, l = tP(e, tq), s = tG({ - document: i - }), c = s[0], d = s[1]; - (0, f.useEffect)(d, [ - i - ]); - var p = c.url ? c.url + "#toolbar=" + (void 0 === a || a ? 1 : 0) : null; - return f.createElement("iframe", (0, u.Z)({ - src: p, - title: t, - ref: o, - style: r, - className: n - }, l)); - }, tH = function(e) { - var t = e.document, r = e.children, n = tG({ - document: t - }), i = n[0], o = n[1]; - return ((0, f.useEffect)(o, [ - t - ]), t) ? r(i) : (console.warn("You should pass a valid document to BlobProvider"), null); - }, tZ = function(e) { - var t = e.style, r = e.children, n = e.className, i = e.document, o = e.fileName, a = void 0 === o ? "document.pdf" : o, u = tG({ - document: i - }), l = u[0], s = u[1]; - if ((0, f.useEffect)(s, [ - r - ]), !i) return console.warn("You should pass a valid document to PDFDownloadLink"), null; - var c = function() { - window.navigator.msSaveBlob && window.navigator.msSaveBlob(l.blob, a); - }; - return f.createElement("a", { - style: t, - href: l.url, - download: a, - className: n, - onClick: c - }, "function" == typeof r ? r(l) : r); - }, tX = function(e) { + ], tS = function(e) { throw Error(e + " is a Node specific API. You're either using this method in a browser, or your bundler is not loading react-pdf from the appropriate web build."); - }, tJ = function() { - tX("renderToStream"); - }, tY = function() { - tX("renderToString"); - }, tK = function() { - tX("renderToFile"); - }, tQ = function() { - tX("render"); }; (0, u.Z)({ - pdf: tW, - usePDF: tG, - Font: tU, + pdf: tE, + usePDF: t_, + Font: tD, version: "2.1.2", StyleSheet: { create: function(e) { return e; } }, - PDFViewer: tV, - BlobProvider: tH, - PDFDownloadLink: tZ, - renderToStream: tJ, - renderToString: tY, - renderToFile: tK, - render: tQ + PDFViewer: function(e) { + var t = e.title, r = e.style, n = e.className, i = e.children, o = e.innerRef, a = e.showToolbar, l = tf(e, tx), s = t_({ + document: i + }), c = s[0], d = s[1]; + (0, f.useEffect)(d, [ + i + ]); + var p = c.url ? c.url + "#toolbar=" + (void 0 === a || a ? 1 : 0) : null; + return f.createElement("iframe", (0, u.Z)({ + src: p, + title: t, + ref: o, + style: r, + className: n + }, l)); + }, + BlobProvider: function(e) { + var t = e.document, r = e.children, n = t_({ + document: t + }), i = n[0], o = n[1]; + return ((0, f.useEffect)(o, [ + t + ]), t) ? r(i) : (console.warn("You should pass a valid document to BlobProvider"), null); + }, + PDFDownloadLink: function(e) { + var t = e.style, r = e.children, n = e.className, i = e.document, o = e.fileName, a = void 0 === o ? "document.pdf" : o, u = t_({ + document: i + }), l = u[0], s = u[1]; + return ((0, f.useEffect)(s, [ + r + ]), i) ? f.createElement("a", { + style: t, + href: l.url, + download: a, + className: n, + onClick: function() { + window.navigator.msSaveBlob && window.navigator.msSaveBlob(l.blob, a); + } + }, "function" == typeof r ? r(l) : r) : (console.warn("You should pass a valid document to PDFDownloadLink"), null); + }, + renderToStream: function() { + tS("renderToStream"); + }, + renderToString: function() { + tS("renderToString"); + }, + renderToFile: function() { + tS("renderToFile"); + }, + render: function() { + tS("render"); + } }, l); }, 6665: function(e, t) { @@ -4618,7 +4582,8 @@ 1713: function(e, t) { "use strict"; t.__esModule = !0, t.default = void 0; - var r = /(-?\d+(\.\d+)?(px|in|mm|cm|pt|vw|vh|px)?)\s(\S+)\s(.+)/, n = function(e, t) { + var r = /(-?\d+(\.\d+)?(px|in|mm|cm|pt|vw|vh|px)?)\s(\S+)\s(.+)/; + t.default = function(e, t) { var n = ("" + t).match(r) || []; if (n) { var i, o = n[5] || t, a = n[4] || t, u = n[1] || t; @@ -4659,7 +4624,6 @@ } return t; }; - t.default = n; }, 7753: function(e, t, r) { "use strict"; @@ -4667,7 +4631,8 @@ t.__esModule = !0, t.default = void 0; var i = n(r(788)), o = n(r(3433)), a = function(e, t) { console.error("\n @react-pdf/stylesheet parsing error:\n\n " + e + ": " + t + ",\n " + " ".repeat(e.length + 2) + "^\n Unsupported " + e + " value format\n "); - }, u = function(e) { + }; + t.default = function(e) { var t = void 0 === e ? {} : e, r = t.expandsTo, n = t.maxValues, u = void 0 === n ? 1 : n, l = t.autoSupported, s = void 0 !== l && l; return function(e, t) { for(var n, l = (0, i.default)("" + t), c = [], f = 0; f < l.length; f++){ @@ -4692,12 +4657,10 @@ }) : ((n = {})[e] = h, n); }; }; - t.default = u; }, 4214: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e, t) { + t.__esModule = !0, t.default = void 0, t.default = function(e, t) { var r = ("" + t).split(" "); return { flexGrow: r[0] || 1, @@ -4705,7 +4668,6 @@ flexBasis: r[2] || 0 }; }; - t.default = r; }, 9214: function(e, t, r) { "use strict"; @@ -4741,7 +4703,8 @@ }, f = function(e, t) { var r; return c[e] ? c[e](e, t) : ((r = {})[e] = t, r); - }, d = function(e) { + }; + t.default = function(e) { if (!e) return e; for(var t = Object.keys(e), r = {}, n = 0; n < t.length; n += 1)for(var i = t[n], o = e[i], a = f(i, o), u = Object.keys(a), l = 0; l < u.length; l += 1){ var s = u[l], c = a[s]; @@ -4749,7 +4712,6 @@ } return r; }; - t.default = d; }, 9373: function(e, t, r) { "use strict"; @@ -4797,15 +4759,13 @@ }, 2594: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e, t) { + t.__esModule = !0, t.default = void 0, t.default = function(e, t) { var r = ("" + t).split(" "); return { objectPositionX: (null == r ? void 0 : r[0]) || t, objectPositionY: (null == r ? void 0 : r[1]) || t }; }; - t.default = r; }, 5571: function(e, t, r) { "use strict"; @@ -4854,7 +4814,8 @@ bottom: !0 }, n = function(e, t) { return r[e] ? 1 : r[t] ? -1 : 0; - }, i = function(e, t) { + }; + t.default = function(e, t) { var r, i = (r = ("" + t).split(" ")) && 0 !== r.length ? (1 === r.length ? [ r[0], "center" @@ -4867,22 +4828,21 @@ transformOriginY: i[1] }; }; - t.default = i; }, 4340: function(e, t, r) { "use strict"; t.__esModule = !0, t.default = void 0; - var n = r(4354), i = function(e) { - return e.filter(Boolean); - }, o = function(e) { + var n = r(4354), i = (0, n.compose)(function(e) { return e.reduce(function(e, t) { - var r = Array.isArray(t) ? a(t) : t; + var r = Array.isArray(t) ? i(t) : t; return Object.keys(r).forEach(function(t) { null !== r[t] && void 0 !== r[t] && (e[t] = r[t]); }), e; }, {}); - }, a = (0, n.compose)(o, i, n.castArray); - t.default = a; + }, function(e) { + return e.filter(Boolean); + }, n.castArray); + t.default = i; }, 6335: function(e, t, r) { "use strict"; @@ -4891,26 +4851,23 @@ var i = r(4354), o = n(r(9214)), a = n(r(4340)), u = n(r(4806)), l = n(r(4016)), s = n(r(3566)); t.transformColor = s.default; var c = n(r(6284)); - t.processTransform = c.default; - var f = function(e, t) { - var r = function(t) { + t.processTransform = c.default, t.default = function(e, t) { + return (0, i.compose)((0, u.default)(e), o.default, function(t) { return (0, l.default)(e, t); - }; - return (0, i.compose)((0, u.default)(e), o.default, r, a.default)(t); + }, a.default)(t); }; - t.default = f; }, 4016: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(7154)), o = n(r(1028)), a = function(e, t) { + var i = n(r(7154)), o = n(r(1028)); + t.default = function(e, t) { return Object.keys(t).reduce(function(r, n) { var a, u; return /@media/.test(n) ? (0, i.default)({}, r, (0, o.default)(((u = {})[n] = t[n], u), e)) : (0, i.default)({}, r, ((a = {})[n] = t[n], a)); }, {}); }; - t.default = a; }, 3566: function(e, t, r) { "use strict"; @@ -4922,10 +4879,10 @@ }, u = function(e) { var t = o.default.get.hsl(e).map(Math.round); return i.default.apply(void 0, t).toUpperCase(); - }, l = function(e) { + }; + t.default = function(e) { return /rgba?/g.test(e) ? a(e) : /hsla?/g.test(e) ? u(e) : e; }; - t.default = l; }, 2580: function(e, t) { "use strict"; @@ -4945,13 +4902,13 @@ extrabold: 800, heavy: 900, black: 900 - }, n = function(e) { + }; + t.default = function(e) { if (!e) return r.normal; if ("number" == typeof e) return e; var t = e.toLowerCase(); return r[t] ? r[t] : e; }; - t.default = n; }, 4806: function(e, t, r) { "use strict"; @@ -4967,7 +4924,8 @@ }, d = function(e, t, r) { var n = f[e] ? f[e](t) : t; return (0, o.default)((0, i.default)(r, (0, c.default)(n))); - }, p = function(e) { + }; + t.default = function(e) { return function(t) { if (!t) return t; for(var r = Object.keys(t), n = {}, i = 0; i < r.length; i += 1){ @@ -4977,16 +4935,15 @@ return n; }; }; - t.default = p; }, 4446: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(3230)), o = n(r(3668)), a = function(e) { + var i = n(r(3230)), o = n(r(3668)); + t.default = function(e) { return (0, o.default)(e) || (0, i.default)(e); }; - t.default = a; }, 6284: function(e, t) { "use strict"; @@ -5081,21 +5038,21 @@ }) }; } - }, i = function(e) { + }; + t.default = function(e) { return "string" != typeof e ? e : r(e).map(function(e) { return n(e); }); }; - t.default = i; }, 2210: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(3230)), o = n(r(3668)), a = function(e) { + var i = n(r(3230)), o = n(r(3668)); + t.default = function(e) { return (0, o.default)(e) || (0, i.default)(e); }; - t.default = a; }, 7098: function(e, t) { "use strict"; @@ -5109,7 +5066,8 @@ value: e, unit: void 0 }; - }, n = function(e, t) { + }; + t.default = function(e, t) { var n = r(t), i = e.dpi || 72; switch(n.unit){ case "in": @@ -5126,20 +5084,16 @@ return n.value; } }; - t.default = n; }, 3230: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { return "string" != typeof e ? e : "string" == typeof e && /^-?\d*\.?\d*$/.test(e) ? parseFloat(e, 10) : e; }; - t.default = r; }, 3668: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { switch(e){ case "top": case "left": @@ -5153,93 +5107,87 @@ return null; } }; - t.default = r; }, 7106: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(3689)), o = function(e) { - var t = function(e, t) { + var i = n(r(3689)); + t.default = function(e) { + return e.runs.reduce(function(e, t) { return e + (0, i.default)(t); - }; - return e.runs.reduce(t, 0); + }, 0); }; - t.default = o; }, 5090: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(7621)), o = n(r(3529)), a = function(e, t, r) { + var i = n(r(7621)), o = n(r(3529)); + t.default = function(e, t, r) { return (0, i.default)(e, t, r.runs).reduce(function(r, n) { return r + (0, o.default)(e, t, n); }, 0); }; - t.default = a; }, 9845: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = r(4354), o = n(r(6266)), a = n(r(7763)), u = n(r(511)), l = function(e, t) { + var i = r(4354), o = n(r(6266)), a = n(r(7763)), u = n(r(511)); + t.default = function(e, t) { var r = (null == e ? void 0 : e.codePoints) || [], n = (0, u.default)(r), l = t.string + n, s = t.runs.slice(0, -1), c = (0, i.last)(t.runs) || (0, o.default)(); return Object.assign({}, t, { string: l, runs: s.concat((0, a.default)(e, c)) }); }; - t.default = l; }, 3226: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(1162)), o = function(e) { - var t = function(e, t) { + var i = n(r(1162)); + t.default = function(e) { + return e.runs.reduce(function(e, t) { return Math.max(e, (0, i.default)(t)); - }; - return e.runs.reduce(t, 0); + }, 0); }; - t.default = o; }, 8208: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = r(4354), o = n(r(8848)), a = function(e) { + var i = r(4354), o = n(r(8848)); + t.default = function(e) { var t = (0, i.dropLast)(e.string), r = (0, i.adjust)(-1, o.default, e.runs); return Object.assign({}, e, { string: t, runs: r }); }; - t.default = a; }, 5579: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function() { + t.__esModule = !0, t.default = void 0, t.default = function() { return { string: "", runs: [] }; }; - t.default = r; }, 7590: function(e, t, r) { "use strict"; t.__esModule = !0, t.default = void 0; - var n = r(4354), i = function(e) { + var n = r(4354); + t.default = function(e) { var t = e.runs; return 0 === t.length ? 0 : (0, n.last)(t).end; }; - t.default = i; }, 2779: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { var t = 0, r = "", n = []; return e.forEach(function(e) { r += e.string, n.push({ @@ -5252,25 +5200,24 @@ runs: n }; }; - t.default = r; }, 9528: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(7369)), o = function(e) { - var t = function(e, t) { + var i = n(r(7369)); + t.default = function(e) { + return e.runs.reduce(function(e, t) { return Math.max(e, (0, i.default)(t)); - }; - return e.runs.reduce(t, 0); + }, 0); }; - t.default = o; }, 5821: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(9845)), o = n(r(6062)), a = n(r(7222)), u = n(r(2307)), l = n(r(511)), s = function(e, t, r) { + var i = n(r(9845)), o = n(r(6062)), a = n(r(7222)), u = n(r(2307)), l = n(r(511)); + t.default = function(e, t, r) { var n = (0, u.default)(e, r); if (-1 === n) return (0, i.default)(t, r); var s = (null == t ? void 0 : t.codePoints) || [], c = r.string.slice(0, e) + (0, l.default)(s) + r.string.slice(e), f = r.runs.map(function(r, i) { @@ -5281,41 +5228,41 @@ runs: f }); }; - t.default = s; }, 2182: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(7925)), o = function(e) { + var i = n(r(7925)); + t.default = function(e) { var t = e.runs || []; return (0, i.default)(t[0]); }; - t.default = o; }, 7698: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(1464)), o = n(r(7590)), a = function(e) { + var i = n(r(1464)), o = n(r(7590)); + t.default = function(e) { return (0, o.default)(e) - (0, i.default)(e); }; - t.default = a; }, 2307: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(9139)), o = function(e, t) { + var i = n(r(9139)); + t.default = function(e, t) { return (0, i.default)(e, t.runs); }; - t.default = o; }, 2564: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(4450)), o = n(r(7621)), a = n(r(9629)), u = function(e, t, r) { + var i = n(r(4450)), o = n(r(7621)), a = n(r(9629)); + t.default = function(e, t, r) { if (0 === r.string.length) return r; var n = r.string.slice(e, t), u = (0, o.default)(e, t, r.runs); return Object.assign({}, r, { @@ -5326,26 +5273,23 @@ }) }); }; - t.default = u; }, 1464: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { var t = e.runs; return 0 === t.length ? 0 : t[0].start; }; - t.default = r; }, 9815: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = r(4354), o = n(r(2179)), a = function(e) { + var i = r(4354), o = n(r(2179)); + t.default = function(e) { var t = e.runs || []; return (0, o.default)((0, i.last)(t)); }; - t.default = a; }, 4573: function(e, t, r) { "use strict"; @@ -5354,26 +5298,23 @@ var i = n(r(2564)), o = function(e) { var t = e.match(/\S/g); return t ? e.lastIndexOf(t[t.length - 1]) : -1; - }, a = function(e) { + }; + t.default = function(e) { var t = e.string.search(/\S/g), r = o(e.string); return (0, i.default)(t, r + 1, e); }; - t.default = a; }, 839: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { return e.reduce(function(e, t) { return e + t.box.height; }, 0); }; - t.default = r; }, 4248: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e, t) { + t.__esModule = !0, t.default = void 0, t.default = function(e, t) { for(var r = [], n = 0, i = 0; i < t.length; i += 1){ var o = t[i]; if ((n += o.box.height) < e) r.push(o); @@ -5381,13 +5322,13 @@ } return r; }; - t.default = r; }, 6314: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = r(4354), o = n(r(4573)), a = n(r(9845)), u = String.fromCharCode(8230), l = function(e) { + var i = r(4354), o = n(r(4573)), a = n(r(9845)), u = String.fromCharCode(8230); + t.default = function(e) { var t = (null === (n = (0, i.last)(e)) || void 0 === n ? void 0 : n.runs) || [], r = null === (l = (0, i.last)(t)) || void 0 === l ? void 0 : null === (s = l.attributes) || void 0 === s ? void 0 : s.font; if (r) { var n, l, s, c, f = e.length - 1, d = r.encode ? parseInt(r.encode(u)[0][0], 16) : 8230, p = r.glyphForCodePoint(d), h = (0, a.default)(p, (0, o.default)(e[f])); @@ -5395,12 +5336,10 @@ } return e; }; - t.default = l; }, 7518: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e, t) { + t.__esModule = !0, t.default = void 0, t.default = function(e, t) { for(var r, n = 0, i = [], o = [], a = 0; a <= 3; a += 1)i[a] = o[a] = 0; for(var u = 0; u < t.length; u += 1){ var l = t[u], s = l.before + l.after; @@ -5428,7 +5367,6 @@ } return y; }; - t.default = r; }, 1845: function(e, t, r) { "use strict"; @@ -5460,7 +5398,8 @@ }, c = function(e, t) { var r = t.expandWhitespaceFactor || {}, n = t.shrinkWhitespaceFactor || {}; return "GROW" === e ? Object.assign({}, o, r) : Object.assign({}, u, n); - }, f = function(e, t, r) { + }; + t.default = function(e, t, r) { var n, o = (n = e > 0 ? "GROW" : "SHRINK", function(e) { for(var t = s(n, r), o = c(n, r), a = [], u = 0; u < e.length; u += 1){ var l = void 0, f = e[u]; @@ -5472,7 +5411,6 @@ }, []); return a[0].before = 0, a[a.length - 1].after = 0, a; }; - t.default = f; }, 9186: function(e, t, r) { "use strict"; @@ -5484,7 +5422,8 @@ s.xAdvance += e[n++]; } return t; - }, s = function(e) { + }; + t.default = function(e) { return function(t) { var r = t.box.width - (0, u.default)(t); if (0 !== r) { @@ -5493,7 +5432,6 @@ } }; }; - t.default = s; }, 2195: function(e, t) { "use strict"; @@ -5518,7 +5456,8 @@ } } return o.width - o.shrink > a ? n : null; - }, n = function(e, t) { + }; + t.default = function(e, t) { for(var n = 0, i = 0, o = e, a = [ { position: 0 @@ -5531,7 +5470,6 @@ } return a; }; - t.default = n; }, 7335: function(e, t, r) { "use strict"; @@ -5571,7 +5509,8 @@ }, d = function(e) { var t, r; return (null === (t = e.runs) || void 0 === t ? void 0 : null === (r = t[0]) || void 0 === r ? void 0 : r.attributes) || {}; - }, p = function(e) { + }; + t.default = function(e) { return function(t, r) { for(var n = e.tolerance || 4, a = d(t), u = f(t, a, e), l = (0, o.default)(u, r, { tolerance: n @@ -5581,7 +5520,6 @@ return (0 === l.length || 1 === l.length && 0 === l[0].position) && (l = (0, i.default)(u, r)), c(t, u, l.slice(1)); }; }; - t.default = p; }, 26: function(e, t, r) { "use strict"; @@ -5766,7 +5704,8 @@ "Common", "Inherited", "Unknown" - ], u = function() { + ]; + t.default = function() { return function(e) { var t = e.string, r = "Unknown", n = 0, u = 0, l = []; if (!t) return (0, o.default)(); @@ -5792,13 +5731,13 @@ }; }; }; - t.default = u; }, 32: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(1162)), o = n(r(3226)), a = n(r(3689)), u = n(r(7106)), l = function() { + var i = n(r(1162)), o = n(r(3226)), a = n(r(3689)), u = n(r(7106)); + t.default = function() { return function(e) { var t = e.overflowLeft || 0, r = e.overflowRight || 0, n = (0, u.default)(e) - r; e.decorationLines = []; @@ -5837,40 +5776,34 @@ return e; }; }; - t.default = l; }, 4915: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(3202)), o = n(r(1487)), a = r(4354), u = (0, i.default)(o.default), l = {}, s = function() { + var i = n(r(3202)), o = n(r(1487)), a = r(4354), u = (0, i.default)(o.default), l = {}; + t.default = function() { return function(e) { var t = "_" + e; return (0, a.isNil)(e) ? [] : (l[t] || (l[t] = (e.includes("\xAD") ? e : u(e)).split("\xAD")), l[t]); }; }; - t.default = s; }, 6742: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e, t) { + t.__esModule = !0, t.default = void 0, t.default = function(e, t) { return t && e ? t.glyphForCodePoint(e) : null; }; - t.default = r; }, 2065: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { return ((null == e ? void 0 : e.codePoints) || []).includes(32); }; - t.default = r; }, 8389: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e, t, r, n) { + t.__esModule = !0, t.default = void 0, t.default = function(e, t, r, n) { if (!n || e === t) return []; if (0 === e && t === n.codePoints.length) return [ n @@ -5880,32 +5813,28 @@ n ]; }; - t.default = r; }, 8931: function(e, t, r) { "use strict"; t.__esModule = !0, t.default = void 0; - var n = r(4354), i = function(e, t) { + var n = r(4354); + t.default = function(e, t) { var r = (0, n.last)(t), i = (0, n.isNil)(r) ? 0 : r + 1, o = Array(e).fill(i); return t.concat(o); }; - t.default = i; }, 298: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { var t = e[0]; return e.map(function(e) { return e - t; }); }; - t.default = r; }, 4131: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { return void 0 === e && (e = []), e.reduce(function(e, t) { var r = (null == t ? void 0 : t.codePoints) || [ 123 @@ -5919,7 +5848,6 @@ })); }, []); }; - t.default = r; }, 5526: function(e, t) { "use strict"; @@ -5965,7 +5893,8 @@ return Object.assign({}, e, { attributes: r }); - }, n = function() { + }; + t.default = function() { return function(e) { return { string: e.string || "", @@ -5973,7 +5902,6 @@ }; }; }; - t.default = n; }, 2680: function(e, t, r) { "use strict"; @@ -5994,7 +5922,8 @@ overflowLeft: t, overflowRight: r }); - }, d = function(e, t) { + }; + t.default = function(e, t) { return function(r) { var n, a = (void 0 === (n = e) && (n = {}), function(e, r, a) { var u, l, d, p = r === a.length - 1, h = (null === (l = e.runs) || void 0 === l ? void 0 : null === (d = l[0]) || void 0 === d ? void 0 : d.attributes) || {}, y = p ? h.alignLastLine : h.align; @@ -6012,7 +5941,6 @@ }); }; }; - t.default = d; }, 8019: function(e, t, r) { "use strict"; @@ -6032,7 +5960,8 @@ yOffset: e.yOffset * r }); }); - }, s = function() { + }; + t.default = function() { return function(e) { var t, r = e.runs.map((t = e.string, function(e) { var r = e.start, n = e.end, o = e.attributes, u = (void 0 === o ? {} : o).font; @@ -6053,22 +5982,21 @@ }); }; }; - t.default = s; }, 4825: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = r(4354), o = n(r(7777)), a = n(r(7924)), u = n(r(8019)), l = n(r(8449)), s = n(r(1661)), c = n(r(4811)), f = n(r(2680)), d = n(r(1535)), p = n(r(5526)), h = function(e) { + var i = r(4354), o = n(r(7777)), a = n(r(7924)), u = n(r(8019)), l = n(r(8449)), s = n(r(1661)), c = n(r(4811)), f = n(r(2680)), d = n(r(1535)), p = n(r(5526)); + t.default = function(e) { return function(t, r, n) { void 0 === n && (n = {}); - var h = (0, i.compose)((0, l.default)(e, n), (0, d.default)(e, n), (0, u.default)(e, n), (0, o.default)(e, n)), y = function(e) { + var h = (0, i.compose)((0, l.default)(e, n), (0, d.default)(e, n), (0, u.default)(e, n), (0, o.default)(e, n)); + return (0, i.compose)((0, f.default)(e, n), (0, a.default)(e, n, r), function(e) { return e.map(h); - }; - return (0, i.compose)((0, f.default)(e, n), (0, a.default)(e, n, r), y, (0, c.default)(e, n), (0, s.default)(e, n), (0, p.default)(e, n))(t); + }, (0, c.default)(e, n), (0, s.default)(e, n), (0, p.default)(e, n))(t); }; }; - t.default = h; }, 9507: function(e, t, r) { "use strict"; @@ -6093,7 +6021,8 @@ height: f }, n += f, a(d); }); - }, l = function(e, t) { + }; + t.default = function(e, t) { return function(r, n) { var i, o, a, l = (null === (i = n.runs) || void 0 === i ? void 0 : null === (o = i[0]) || void 0 === o ? void 0 : null === (a = o.attributes) || void 0 === a ? void 0 : a.indent) || 0, s = [ r.width - l, @@ -6102,7 +6031,6 @@ return u(r, e.linebreaker(t)(n, s), l); }; }; - t.default = l; }, 1661: function(e, t, r) { "use strict"; @@ -6115,7 +6043,8 @@ return Object.assign({}, e, { runs: t }); - }, s = function(e, t) { + }; + t.default = function(e, t) { return function(r) { if ((0, i.isNil)(r)) return (0, u.default)(); var n = r.string, o = e.fontSubstitution, s = e.scriptItemizer, c = l(r).runs, f = o(t)(r).runs, d = s(t)(r).runs, p = f.concat(d).concat(c); @@ -6125,7 +6054,6 @@ }; }; }; - t.default = s; }, 1535: function(e, t) { "use strict"; @@ -6141,7 +6069,8 @@ return Object.assign({}, e, { positions: i }); - }, n = function() { + }; + t.default = function() { return function(e) { var t = e.runs.map(r); return Object.assign({}, e, { @@ -6149,7 +6078,6 @@ }); }; }; - t.default = n; }, 8449: function(e, t) { "use strict"; @@ -6164,7 +6092,8 @@ return Object.assign({}, e, { positions: a }); - }, n = function() { + }; + t.default = function() { return function(e) { var t = e.runs.map(r); return Object.assign({}, e, { @@ -6172,25 +6101,25 @@ }); }; }; - t.default = n; }, 4811: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(7698)), o = n(r(2564)), a = function() { + var i = n(r(7698)), o = n(r(2564)); + t.default = function() { return function(e) { for(var t = [], r = 0, n = e.string.indexOf("\n") + 1; n > 0;)t.push((0, o.default)(r, n, e)), r = n, n = e.string.indexOf("\n", n) + 1; return 0 === r ? t.push(e) : r < e.string.length && t.push((0, o.default)(r, (0, i.default)(e), e)), t; }; }; - t.default = a; }, 7924: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = r(4354), o = n(r(7711)), a = n(r(5538)), u = n(r(839)), l = n(r(6314)), s = n(r(9507)), c = n(r(4248)), f = function(e, t, r) { + var i = r(4354), o = n(r(7711)), a = n(r(5538)), u = n(r(839)), l = n(r(6314)), s = n(r(9507)), c = n(r(4248)); + t.default = function(e, t, r) { return function(n) { for(var f = [], d = [].concat(n), p = (0, s.default)(e, t), h = (0, i.isNil)(r.maxLines) ? 1 / 0 : r.maxLines, y = "ellipsis" === r.truncateMode, g = h, v = (0, o.default)(r), b = d.shift(); g > 0 && b;){ var m = p(v, b), D = m.slice(0, g), w = (0, u.default)(D), E = y && m.length !== D.length; @@ -6203,7 +6132,6 @@ return f; }; }; - t.default = f; }, 7777: function(e, t, r) { "use strict"; @@ -6213,7 +6141,8 @@ return [ e ]; - }, u = function(e, t) { + }; + t.default = function(e, t) { return void 0 === e && (e = {}), void 0 === t && (t = {}), function(r) { for(var n, u, l = [], s = [], c = t.hyphenationCallback || (null === (n = (u = e).wordHyphenation) || void 0 === n ? void 0 : n.call(u, t)) || a, f = 0; f < r.runs.length; f += 1){ for(var d = "", p = r.runs[f], h = r.string.slice(p.start, p.end).split(/([ ]+)/g).filter(Boolean), y = 0; y < h.length; y += 1){ @@ -6230,68 +6159,59 @@ }); }; }; - t.default = u; }, 6499: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { return e.reduce(function(e, t) { return e + (t.xAdvance || 0); }, 0); }; - t.default = r; }, 7711: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { return Object.assign({}, e); }; - t.default = r; }, 5538: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e, t) { + t.__esModule = !0, t.default = void 0, t.default = function(e, t) { var r = t.y + e, n = t.height - e; return Object.assign({}, t, { y: r, height: n }); }; - t.default = r; }, 6062: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e, t) { + t.__esModule = !0, t.default = void 0, t.default = function(e, t) { var r = t.start + e, n = t.end + e; return Object.assign({}, t, { start: r, end: n }); }; - t.default = r; }, 3689: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(6499)), o = function(e) { + var i = n(r(6499)); + t.default = function(e) { return (0, i.default)(e.positions || []); }; - t.default = o; }, 3529: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(7392)), o = n(r(6499)), a = function(e, t, r) { + var i = n(r(7392)), o = n(r(6499)); + t.default = function(e, t, r) { var n = r.start || 0, a = Math.max(0, (0, i.default)(e - n, r)), u = Math.max(0, (0, i.default)(t - n, r)), l = (r.positions || []).slice(a, u); return (0, o.default)(l); }; - t.default = a; }, 7763: function(e, t, r) { "use strict"; @@ -6313,28 +6233,29 @@ glyphIndices: l, positions: s }); - }, c = function(e, t) { + }; + t.default = function(e, t) { if (!e) return t; var r = (0, o.default)(t); return s((0, a.default)(e) ? (0, l.default)(e, r) : e, t); }; - t.default = c; }, 1162: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(3241)), o = function(e) { + var i = n(r(3241)); + t.default = function(e) { var t, r, n, o; return Math.max((null === (t = e.attributes) || void 0 === t ? void 0 : null === (r = t.attachment) || void 0 === r ? void 0 : r.height) || 0, ((null === (n = e.attributes) || void 0 === n ? void 0 : null === (o = n.font) || void 0 === o ? void 0 : o.ascent) || 0) * (0, i.default)(e)); }; - t.default = o; }, 8687: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = r(4354), o = n(r(1258)), a = n(r(298)), u = function(e, t) { + var i = r(4354), o = n(r(1258)), a = n(r(298)); + t.default = function(e, t) { var r = e.end + (0, o.default)(t), n = (e.glyphs || []).concat(t.glyphs || []), u = (e.positions || []).concat(t.positions || []), l = Object.assign({}, e.attributes, t.attributes), s = e.glyphIndices || [], c = (0, i.last)(s) || 0, f = (t.glyphIndices || []).map(function(e) { return e + c + 1; }); @@ -6346,31 +6267,29 @@ glyphIndices: (0, a.default)(s.concat(f)) }); }; - t.default = u; }, 9406: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(3241)), o = function(e) { + var i = n(r(3241)); + t.default = function(e) { var t, r, n = (null === (t = e.attributes) || void 0 === t ? void 0 : null === (r = t.font) || void 0 === r ? void 0 : r.descent) || 0; return (0, i.default)(e) * n; }; - t.default = o; }, 8848: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(4450)), o = function(e) { + var i = n(r(4450)); + t.default = function(e) { return (0, i.default)(0, e.end - e.start - 1, e); }; - t.default = o; }, 6266: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function() { + t.__esModule = !0, t.default = void 0, t.default = function() { return { start: 0, end: 0, @@ -6380,17 +6299,16 @@ attributes: {} }; }; - t.default = r; }, 7621: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(9139)), o = function(e, t, r) { + var i = n(r(9139)); + t.default = function(e, t, r) { var n = (0, i.default)(e, r), o = Math.max((0, i.default)(t - 1, r), n); return r.slice(n, o + 1); }; - t.default = o; }, 6990: function(e, t, r) { "use strict"; @@ -6435,7 +6353,8 @@ n = c; } return t; - }, s = function(e) { + }; + t.default = function(e) { void 0 === e && (e = []); var t = Object.values(e.filter(function(e) { return (0, o.default)(e); @@ -6446,35 +6365,32 @@ })); return (0, i.default)(t.concat(r)); }; - t.default = s; }, 4014: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { var t; return (null === (t = e.attributes) || void 0 === t ? void 0 : t.font) || null; }; - t.default = r; }, 7392: function(e, t, r) { "use strict"; t.__esModule = !0, t.default = void 0; - var n = r(4354), i = function(e, t) { + var n = r(4354); + t.default = function(e, t) { var r, i = null == t ? void 0 : null === (r = t.glyphIndices) || void 0 === r ? void 0 : r[e]; return (0, n.isNil)(i) ? e : i; }; - t.default = i; }, 7369: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(1162)), o = n(r(9406)), a = n(r(9277)), u = function(e) { + var i = n(r(1162)), o = n(r(9406)), a = n(r(9277)); + t.default = function(e) { var t; return (null === (t = e.attributes) || void 0 === t ? void 0 : t.lineHeight) || (0, a.default)(e) + (0, i.default)(e) - (0, o.default)(e); }; - t.default = u; }, 7222: function(e, t, r) { "use strict"; @@ -6484,19 +6400,17 @@ if (!t) return r; var n = (0, i.default)(0, e, r), u = (0, i.default)(e, 1 / 0, r); return (0, o.default)((0, a.default)(t, n), u); - }, f = function(e, t, r) { + }; + t.default = function(e, t, r) { var n = (0, u.default)(r); return c(e, (0, l.default)(t) ? (0, s.default)(t, n) : t, r); }; - t.default = f; }, 456: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { return e.start === e.end; }; - t.default = r; }, 7925: function(e, t, r) { "use strict"; @@ -6507,63 +6421,55 @@ return !(0, i.default)(e); }); return r.slice(0, n); - }, a = function(e) { + }; + t.default = function(e) { return o(e).reduce(function(e, t) { return e + (t.xAdvance || 0); }, 0); }; - t.default = a; }, 1258: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { return e.end - e.start; }; - t.default = r; }, 9277: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(3241)), o = function(e) { + var i = n(r(3241)); + t.default = function(e) { var t, r; return ((null === (t = e.attributes) || void 0 === t ? void 0 : null === (r = t.font) || void 0 === r ? void 0 : r.lineGap) || 0) * (0, i.default)(e); }; - t.default = o; }, 4363: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e, t) { + t.__esModule = !0, t.default = void 0, t.default = function(e, t) { if (!t) return 0; var r = t.glyphIndices || [], n = r[e]; return r.slice(0, e).filter(function(e) { return e === n; }).length; }; - t.default = r; }, 9435: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e, t) { + t.__esModule = !0, t.default = void 0, t.default = function(e, t) { var r = Object.assign({}, t.attributes); return delete r[e], Object.assign({}, t, { attributes: r }); }; - t.default = r; }, 9139: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e, t) { + t.__esModule = !0, t.default = void 0, t.default = function(e, t) { return t ? t.findIndex(function(t) { return t.start <= e && e < t.end; }) : -1; }; - t.default = r; }, 3241: function(e, t) { "use strict"; @@ -6571,17 +6477,18 @@ var r = function(e) { var t, r = e.attributes || {}, n = r.fontSize || 12, i = null === (t = r.font) || void 0 === t ? void 0 : t.unitsPerEm; return i ? n / i : 0; - }, n = function(e) { + }; + t.default = function(e) { var t; return (null === (t = e.attributes) || void 0 === t ? void 0 : t.scale) || r(e); }; - t.default = n; }, 4450: function(e, t, r) { "use strict"; var n = r(5318).default; t.__esModule = !0, t.default = void 0; - var i = n(r(3241)), o = n(r(4363)), a = n(r(4014)), u = n(r(8389)), l = n(r(7392)), s = n(r(298)), c = function(e, t, r) { + var i = n(r(3241)), o = n(r(4363)), a = n(r(4014)), u = n(r(8389)), l = n(r(7392)), s = n(r(298)); + t.default = function(e, t, r) { var n, c, f = (0, i.default)(r), d = (0, a.default)(r), p = (0, l.default)(e, r), h = (0, l.default)(t, r), y = null === (n = r.glyphs) || void 0 === n ? void 0 : n[p], g = null === (c = r.glyphs) || void 0 === c ? void 0 : c[h], v = (0, o.default)(e, r), b = v > 0 ? (0, u.default)(v, 1 / 0, d, y) : [], m = (0, o.default)(t, r), D = (0, u.default)(0, m, d, g), w = p + Math.min(1, v), E = (r.glyphs || []).slice(w, h), _ = function(e) { return { xAdvance: e.advanceWidth * f @@ -6603,29 +6510,24 @@ ].flat() }); }; - t.default = c; }, 1848: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { return e.sort(function(e, t) { return e.start - t.start || e.end - t.end; }); }; - t.default = r; }, 9629: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e, t) { + t.__esModule = !0, t.default = void 0, t.default = function(e, t) { var r = t.start - e, n = t.end - e; return Object.assign({}, t, { start: r, end: n }); }; - t.default = r; }, 2179: function(e, t, r) { "use strict"; @@ -6638,28 +6540,24 @@ return !(0, i.default)(e); }); return r.slice(0, n); - }, u = function(e) { + }; + t.default = function(e) { return a(e).reduce(function(e, t) { return e + (t.xAdvance || 0); }, 0); }; - t.default = u; }, 8366: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { return "number" == typeof e; }; - t.default = r; }, 511: function(e, t) { "use strict"; - t.__esModule = !0, t.default = void 0; - var r = function(e) { + t.__esModule = !0, t.default = void 0, t.default = function(e) { return String.fromCodePoint.apply(String, e); }; - t.default = r; }, 8537: function(e, t, r) { "use strict"; @@ -8611,222 +8509,217 @@ }, 8249: function(e, t, r) { var n; - n = function() { - var e = e || function(e, t) { - if ("undefined" != typeof window && window.crypto && (i = window.crypto), "undefined" != typeof self && self.crypto && (i = self.crypto), "undefined" != typeof globalThis && globalThis.crypto && (i = globalThis.crypto), !i && "undefined" != typeof window && window.msCrypto && (i = window.msCrypto), !i && void 0 !== r.g && r.g.crypto && (i = r.g.crypto), !i) try { - i = r(2480); - } catch (n) {} - var i, o = function() { - if (i) { - if ("function" == typeof i.getRandomValues) try { - return i.getRandomValues(new Uint32Array(1))[0]; - } catch (e) {} - if ("function" == typeof i.randomBytes) try { - return i.randomBytes(4).readInt32LE(); - } catch (t) {} - } - throw Error("Native crypto module could not be used to get secure random number."); - }, a = Object.create || function() { - function e() {} - return function(t) { - var r; - return e.prototype = t, r = new e(), e.prototype = null, r; - }; - }(), u = {}, l = u.lib = {}, s = l.Base = { - extend: function(e) { - var t = a(this); - return e && t.mixIn(e), t.hasOwnProperty("init") && this.init !== t.init || (t.init = function() { - t.$super.init.apply(this, arguments); - }), t.init.prototype = t, t.$super = this, t; - }, - create: function() { - var e = this.extend(); - return e.init.apply(e, arguments), e; - }, - init: function() {}, - mixIn: function(e) { - for(var t in e)e.hasOwnProperty(t) && (this[t] = e[t]); - e.hasOwnProperty("toString") && (this.toString = e.toString); - }, - clone: function() { - return this.init.prototype.extend(this); - } - }, c = l.WordArray = s.extend({ - init: function(e, t) { - e = this.words = e || [], void 0 != t ? this.sigBytes = t : this.sigBytes = 4 * e.length; - }, - toString: function(e) { - return (e || d).stringify(this); - }, - concat: function(e) { - var t = this.words, r = e.words, n = this.sigBytes, i = e.sigBytes; - if (this.clamp(), n % 4) for(var o = 0; o < i; o++){ - var a = r[o >>> 2] >>> 24 - o % 4 * 8 & 0xff; - t[n + o >>> 2] |= a << 24 - (n + o) % 4 * 8; - } - else for(var u = 0; u < i; u += 4)t[n + u >>> 2] = r[u >>> 2]; - return this.sigBytes += i, this; - }, - clamp: function() { - var t = this.words, r = this.sigBytes; - t[r >>> 2] &= 0xffffffff << 32 - r % 4 * 8, t.length = e.ceil(r / 4); - }, - clone: function() { - var e = s.clone.call(this); - return e.words = this.words.slice(0), e; - }, - random: function(e) { - for(var t = [], r = 0; r < e; r += 4)t.push(o()); - return new c.init(t, e); - } - }), f = u.enc = {}, d = f.Hex = { - stringify: function(e) { - for(var t = e.words, r = e.sigBytes, n = [], i = 0; i < r; i++){ - var o = t[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - n.push((o >>> 4).toString(16)), n.push((0x0f & o).toString(16)); - } - return n.join(""); - }, - parse: function(e) { - for(var t = e.length, r = [], n = 0; n < t; n += 2)r[n >>> 3] |= parseInt(e.substr(n, 2), 16) << 24 - n % 8 * 4; - return new c.init(r, t / 2); + e.exports = n = n || function(e, t) { + if ("undefined" != typeof window && window.crypto && (i = window.crypto), "undefined" != typeof self && self.crypto && (i = self.crypto), "undefined" != typeof globalThis && globalThis.crypto && (i = globalThis.crypto), !i && "undefined" != typeof window && window.msCrypto && (i = window.msCrypto), !i && void 0 !== r.g && r.g.crypto && (i = r.g.crypto), !i) try { + i = r(2480); + } catch (n) {} + var i, o = function() { + if (i) { + if ("function" == typeof i.getRandomValues) try { + return i.getRandomValues(new Uint32Array(1))[0]; + } catch (e) {} + if ("function" == typeof i.randomBytes) try { + return i.randomBytes(4).readInt32LE(); + } catch (t) {} + } + throw Error("Native crypto module could not be used to get secure random number."); + }, a = Object.create || function() { + function e() {} + return function(t) { + var r; + return e.prototype = t, r = new e(), e.prototype = null, r; + }; + }(), u = {}, l = u.lib = {}, s = l.Base = { + extend: function(e) { + var t = a(this); + return e && t.mixIn(e), t.hasOwnProperty("init") && this.init !== t.init || (t.init = function() { + t.$super.init.apply(this, arguments); + }), t.init.prototype = t, t.$super = this, t; + }, + create: function() { + var e = this.extend(); + return e.init.apply(e, arguments), e; + }, + init: function() {}, + mixIn: function(e) { + for(var t in e)e.hasOwnProperty(t) && (this[t] = e[t]); + e.hasOwnProperty("toString") && (this.toString = e.toString); + }, + clone: function() { + return this.init.prototype.extend(this); + } + }, c = l.WordArray = s.extend({ + init: function(e, t) { + e = this.words = e || [], void 0 != t ? this.sigBytes = t : this.sigBytes = 4 * e.length; + }, + toString: function(e) { + return (e || d).stringify(this); + }, + concat: function(e) { + var t = this.words, r = e.words, n = this.sigBytes, i = e.sigBytes; + if (this.clamp(), n % 4) for(var o = 0; o < i; o++){ + var a = r[o >>> 2] >>> 24 - o % 4 * 8 & 0xff; + t[n + o >>> 2] |= a << 24 - (n + o) % 4 * 8; + } + else for(var u = 0; u < i; u += 4)t[n + u >>> 2] = r[u >>> 2]; + return this.sigBytes += i, this; + }, + clamp: function() { + var t = this.words, r = this.sigBytes; + t[r >>> 2] &= 0xffffffff << 32 - r % 4 * 8, t.length = e.ceil(r / 4); + }, + clone: function() { + var e = s.clone.call(this); + return e.words = this.words.slice(0), e; + }, + random: function(e) { + for(var t = [], r = 0; r < e; r += 4)t.push(o()); + return new c.init(t, e); + } + }), f = u.enc = {}, d = f.Hex = { + stringify: function(e) { + for(var t = e.words, r = e.sigBytes, n = [], i = 0; i < r; i++){ + var o = t[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + n.push((o >>> 4).toString(16)), n.push((0x0f & o).toString(16)); } - }, p = f.Latin1 = { - stringify: function(e) { - for(var t = e.words, r = e.sigBytes, n = [], i = 0; i < r; i++){ - var o = t[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - n.push(String.fromCharCode(o)); - } - return n.join(""); - }, - parse: function(e) { - for(var t = e.length, r = [], n = 0; n < t; n++)r[n >>> 2] |= (0xff & e.charCodeAt(n)) << 24 - n % 4 * 8; - return new c.init(r, t); + return n.join(""); + }, + parse: function(e) { + for(var t = e.length, r = [], n = 0; n < t; n += 2)r[n >>> 3] |= parseInt(e.substr(n, 2), 16) << 24 - n % 8 * 4; + return new c.init(r, t / 2); + } + }, p = f.Latin1 = { + stringify: function(e) { + for(var t = e.words, r = e.sigBytes, n = [], i = 0; i < r; i++){ + var o = t[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + n.push(String.fromCharCode(o)); } - }, h = f.Utf8 = { - stringify: function(e) { - try { - return decodeURIComponent(escape(p.stringify(e))); - } catch (t) { - throw Error("Malformed UTF-8 data"); - } - }, - parse: function(e) { - return p.parse(unescape(encodeURIComponent(e))); + return n.join(""); + }, + parse: function(e) { + for(var t = e.length, r = [], n = 0; n < t; n++)r[n >>> 2] |= (0xff & e.charCodeAt(n)) << 24 - n % 4 * 8; + return new c.init(r, t); + } + }, h = f.Utf8 = { + stringify: function(e) { + try { + return decodeURIComponent(escape(p.stringify(e))); + } catch (t) { + throw Error("Malformed UTF-8 data"); } - }, y = l.BufferedBlockAlgorithm = s.extend({ - reset: function() { - this._data = new c.init(), this._nDataBytes = 0; - }, - _append: function(e) { - "string" == typeof e && (e = h.parse(e)), this._data.concat(e), this._nDataBytes += e.sigBytes; - }, - _process: function(t) { - var r, n = this._data, i = n.words, o = n.sigBytes, a = this.blockSize, u = o / (4 * a), l = (u = t ? e.ceil(u) : e.max((0 | u) - this._minBufferSize, 0)) * a, s = e.min(4 * l, o); - if (l) { - for(var f = 0; f < l; f += a)this._doProcessBlock(i, f); - r = i.splice(0, l), n.sigBytes -= s; - } - return new c.init(r, s); - }, - clone: function() { - var e = s.clone.call(this); - return e._data = this._data.clone(), e; - }, - _minBufferSize: 0 - }); - l.Hasher = y.extend({ - cfg: s.extend(), - init: function(e) { - this.cfg = this.cfg.extend(e), this.reset(); - }, - reset: function() { - y.reset.call(this), this._doReset(); - }, - update: function(e) { - return this._append(e), this._process(), this; - }, - finalize: function(e) { - return e && this._append(e), this._doFinalize(); - }, - blockSize: 16, - _createHelper: function(e) { - return function(t, r) { - return new e.init(r).finalize(t); - }; - }, - _createHmacHelper: function(e) { - return function(t, r) { - return new g.HMAC.init(e, r).finalize(t); - }; + }, + parse: function(e) { + return p.parse(unescape(encodeURIComponent(e))); + } + }, y = l.BufferedBlockAlgorithm = s.extend({ + reset: function() { + this._data = new c.init(), this._nDataBytes = 0; + }, + _append: function(e) { + "string" == typeof e && (e = h.parse(e)), this._data.concat(e), this._nDataBytes += e.sigBytes; + }, + _process: function(t) { + var r, n = this._data, i = n.words, o = n.sigBytes, a = this.blockSize, u = o / (4 * a), l = (u = t ? e.ceil(u) : e.max((0 | u) - this._minBufferSize, 0)) * a, s = e.min(4 * l, o); + if (l) { + for(var f = 0; f < l; f += a)this._doProcessBlock(i, f); + r = i.splice(0, l), n.sigBytes -= s; } - }); - var g = u.algo = {}; - return u; - }(Math); - return e; - }, e.exports = n(); + return new c.init(r, s); + }, + clone: function() { + var e = s.clone.call(this); + return e._data = this._data.clone(), e; + }, + _minBufferSize: 0 + }); + l.Hasher = y.extend({ + cfg: s.extend(), + init: function(e) { + this.cfg = this.cfg.extend(e), this.reset(); + }, + reset: function() { + y.reset.call(this), this._doReset(); + }, + update: function(e) { + return this._append(e), this._process(), this; + }, + finalize: function(e) { + return e && this._append(e), this._doFinalize(); + }, + blockSize: 16, + _createHelper: function(e) { + return function(t, r) { + return new e.init(r).finalize(t); + }; + }, + _createHmacHelper: function(e) { + return function(t, r) { + return new g.HMAC.init(e, r).finalize(t); + }; + } + }); + var g = u.algo = {}; + return u; + }(Math); }, 8214: function(e, t, r) { var n; - n = function(e) { - return function(t) { - var r = e, n = r.lib, i = n.WordArray, o = n.Hasher, a = r.algo, u = []; - !function() { - for(var e = 0; e < 64; e++)u[e] = 0x100000000 * t.abs(t.sin(e + 1)) | 0; - }(); - var l = a.MD5 = o.extend({ - _doReset: function() { - this._hash = new i.init([ - 0x67452301, - 0xefcdab89, - 0x98badcfe, - 0x10325476 - ]); - }, - _doProcessBlock: function(e, t) { - for(var r = 0; r < 16; r++){ - var n = t + r, i = e[n]; - e[n] = (i << 8 | i >>> 24) & 0x00ff00ff | (i << 24 | i >>> 8) & 0xff00ff00; - } - var o = this._hash.words, a = e[t + 0], l = e[t + 1], p = e[t + 2], h = e[t + 3], y = e[t + 4], g = e[t + 5], v = e[t + 6], b = e[t + 7], m = e[t + 8], D = e[t + 9], w = e[t + 10], E = e[t + 11], _ = e[t + 12], x = e[t + 13], S = e[t + 14], A = e[t + 15], k = o[0], T = o[1], O = o[2], C = o[3]; - k = s(k, T, O, C, a, 7, u[0]), C = s(C, k, T, O, l, 12, u[1]), O = s(O, C, k, T, p, 17, u[2]), T = s(T, O, C, k, h, 22, u[3]), k = s(k, T, O, C, y, 7, u[4]), C = s(C, k, T, O, g, 12, u[5]), O = s(O, C, k, T, v, 17, u[6]), T = s(T, O, C, k, b, 22, u[7]), k = s(k, T, O, C, m, 7, u[8]), C = s(C, k, T, O, D, 12, u[9]), O = s(O, C, k, T, w, 17, u[10]), T = s(T, O, C, k, E, 22, u[11]), k = s(k, T, O, C, _, 7, u[12]), C = s(C, k, T, O, x, 12, u[13]), O = s(O, C, k, T, S, 17, u[14]), T = s(T, O, C, k, A, 22, u[15]), k = c(k, T, O, C, l, 5, u[16]), C = c(C, k, T, O, v, 9, u[17]), O = c(O, C, k, T, E, 14, u[18]), T = c(T, O, C, k, a, 20, u[19]), k = c(k, T, O, C, g, 5, u[20]), C = c(C, k, T, O, w, 9, u[21]), O = c(O, C, k, T, A, 14, u[22]), T = c(T, O, C, k, y, 20, u[23]), k = c(k, T, O, C, D, 5, u[24]), C = c(C, k, T, O, S, 9, u[25]), O = c(O, C, k, T, h, 14, u[26]), T = c(T, O, C, k, m, 20, u[27]), k = c(k, T, O, C, x, 5, u[28]), C = c(C, k, T, O, p, 9, u[29]), O = c(O, C, k, T, b, 14, u[30]), T = c(T, O, C, k, _, 20, u[31]), k = f(k, T, O, C, g, 4, u[32]), C = f(C, k, T, O, m, 11, u[33]), O = f(O, C, k, T, E, 16, u[34]), T = f(T, O, C, k, S, 23, u[35]), k = f(k, T, O, C, l, 4, u[36]), C = f(C, k, T, O, y, 11, u[37]), O = f(O, C, k, T, b, 16, u[38]), T = f(T, O, C, k, w, 23, u[39]), k = f(k, T, O, C, x, 4, u[40]), C = f(C, k, T, O, a, 11, u[41]), O = f(O, C, k, T, h, 16, u[42]), T = f(T, O, C, k, v, 23, u[43]), k = f(k, T, O, C, D, 4, u[44]), C = f(C, k, T, O, _, 11, u[45]), O = f(O, C, k, T, A, 16, u[46]), T = f(T, O, C, k, p, 23, u[47]), k = d(k, T, O, C, a, 6, u[48]), C = d(C, k, T, O, b, 10, u[49]), O = d(O, C, k, T, S, 15, u[50]), T = d(T, O, C, k, g, 21, u[51]), k = d(k, T, O, C, _, 6, u[52]), C = d(C, k, T, O, h, 10, u[53]), O = d(O, C, k, T, w, 15, u[54]), T = d(T, O, C, k, l, 21, u[55]), k = d(k, T, O, C, m, 6, u[56]), C = d(C, k, T, O, A, 10, u[57]), O = d(O, C, k, T, v, 15, u[58]), T = d(T, O, C, k, x, 21, u[59]), k = d(k, T, O, C, y, 6, u[60]), C = d(C, k, T, O, E, 10, u[61]), O = d(O, C, k, T, p, 15, u[62]), T = d(T, O, C, k, D, 21, u[63]), o[0] = o[0] + k | 0, o[1] = o[1] + T | 0, o[2] = o[2] + O | 0, o[3] = o[3] + C | 0; - }, - _doFinalize: function() { - var e = this._data, r = e.words, n = 8 * this._nDataBytes, i = 8 * e.sigBytes; - r[i >>> 5] |= 0x80 << 24 - i % 32; - var o = t.floor(n / 0x100000000); - r[(i + 64 >>> 9 << 4) + 15] = (o << 8 | o >>> 24) & 0x00ff00ff | (o << 24 | o >>> 8) & 0xff00ff00, r[(i + 64 >>> 9 << 4) + 14] = (n << 8 | n >>> 24) & 0x00ff00ff | (n << 24 | n >>> 8) & 0xff00ff00, e.sigBytes = (r.length + 1) * 4, this._process(); - for(var a = this._hash, u = a.words, l = 0; l < 4; l++){ - var s = u[l]; - u[l] = (s << 8 | s >>> 24) & 0x00ff00ff | (s << 24 | s >>> 8) & 0xff00ff00; - } - return a; - }, - clone: function() { - var e = o.clone.call(this); - return e._hash = this._hash.clone(), e; + e.exports = (n = r(8249), function(e) { + var t = n, r = t.lib, i = r.WordArray, o = r.Hasher, a = t.algo, u = []; + !function() { + for(var t = 0; t < 64; t++)u[t] = 0x100000000 * e.abs(e.sin(t + 1)) | 0; + }(); + var l = a.MD5 = o.extend({ + _doReset: function() { + this._hash = new i.init([ + 0x67452301, + 0xefcdab89, + 0x98badcfe, + 0x10325476 + ]); + }, + _doProcessBlock: function(e, t) { + for(var r = 0; r < 16; r++){ + var n = t + r, i = e[n]; + e[n] = (i << 8 | i >>> 24) & 0x00ff00ff | (i << 24 | i >>> 8) & 0xff00ff00; } - }); - function s(e, t, r, n, i, o, a) { - var u = e + (t & r | ~t & n) + i + a; - return (u << o | u >>> 32 - o) + t; - } - function c(e, t, r, n, i, o, a) { - var u = e + (t & n | r & ~n) + i + a; - return (u << o | u >>> 32 - o) + t; - } - function f(e, t, r, n, i, o, a) { - var u = e + (t ^ r ^ n) + i + a; - return (u << o | u >>> 32 - o) + t; - } - function d(e, t, r, n, i, o, a) { - var u = e + (r ^ (t | ~n)) + i + a; - return (u << o | u >>> 32 - o) + t; + var o = this._hash.words, a = e[t + 0], l = e[t + 1], p = e[t + 2], h = e[t + 3], y = e[t + 4], g = e[t + 5], v = e[t + 6], b = e[t + 7], m = e[t + 8], D = e[t + 9], w = e[t + 10], E = e[t + 11], _ = e[t + 12], x = e[t + 13], S = e[t + 14], A = e[t + 15], k = o[0], T = o[1], O = o[2], C = o[3]; + k = s(k, T, O, C, a, 7, u[0]), C = s(C, k, T, O, l, 12, u[1]), O = s(O, C, k, T, p, 17, u[2]), T = s(T, O, C, k, h, 22, u[3]), k = s(k, T, O, C, y, 7, u[4]), C = s(C, k, T, O, g, 12, u[5]), O = s(O, C, k, T, v, 17, u[6]), T = s(T, O, C, k, b, 22, u[7]), k = s(k, T, O, C, m, 7, u[8]), C = s(C, k, T, O, D, 12, u[9]), O = s(O, C, k, T, w, 17, u[10]), T = s(T, O, C, k, E, 22, u[11]), k = s(k, T, O, C, _, 7, u[12]), C = s(C, k, T, O, x, 12, u[13]), O = s(O, C, k, T, S, 17, u[14]), T = s(T, O, C, k, A, 22, u[15]), k = c(k, T, O, C, l, 5, u[16]), C = c(C, k, T, O, v, 9, u[17]), O = c(O, C, k, T, E, 14, u[18]), T = c(T, O, C, k, a, 20, u[19]), k = c(k, T, O, C, g, 5, u[20]), C = c(C, k, T, O, w, 9, u[21]), O = c(O, C, k, T, A, 14, u[22]), T = c(T, O, C, k, y, 20, u[23]), k = c(k, T, O, C, D, 5, u[24]), C = c(C, k, T, O, S, 9, u[25]), O = c(O, C, k, T, h, 14, u[26]), T = c(T, O, C, k, m, 20, u[27]), k = c(k, T, O, C, x, 5, u[28]), C = c(C, k, T, O, p, 9, u[29]), O = c(O, C, k, T, b, 14, u[30]), T = c(T, O, C, k, _, 20, u[31]), k = f(k, T, O, C, g, 4, u[32]), C = f(C, k, T, O, m, 11, u[33]), O = f(O, C, k, T, E, 16, u[34]), T = f(T, O, C, k, S, 23, u[35]), k = f(k, T, O, C, l, 4, u[36]), C = f(C, k, T, O, y, 11, u[37]), O = f(O, C, k, T, b, 16, u[38]), T = f(T, O, C, k, w, 23, u[39]), k = f(k, T, O, C, x, 4, u[40]), C = f(C, k, T, O, a, 11, u[41]), O = f(O, C, k, T, h, 16, u[42]), T = f(T, O, C, k, v, 23, u[43]), k = f(k, T, O, C, D, 4, u[44]), C = f(C, k, T, O, _, 11, u[45]), O = f(O, C, k, T, A, 16, u[46]), T = f(T, O, C, k, p, 23, u[47]), k = d(k, T, O, C, a, 6, u[48]), C = d(C, k, T, O, b, 10, u[49]), O = d(O, C, k, T, S, 15, u[50]), T = d(T, O, C, k, g, 21, u[51]), k = d(k, T, O, C, _, 6, u[52]), C = d(C, k, T, O, h, 10, u[53]), O = d(O, C, k, T, w, 15, u[54]), T = d(T, O, C, k, l, 21, u[55]), k = d(k, T, O, C, m, 6, u[56]), C = d(C, k, T, O, A, 10, u[57]), O = d(O, C, k, T, v, 15, u[58]), T = d(T, O, C, k, x, 21, u[59]), k = d(k, T, O, C, y, 6, u[60]), C = d(C, k, T, O, E, 10, u[61]), O = d(O, C, k, T, p, 15, u[62]), T = d(T, O, C, k, D, 21, u[63]), o[0] = o[0] + k | 0, o[1] = o[1] + T | 0, o[2] = o[2] + O | 0, o[3] = o[3] + C | 0; + }, + _doFinalize: function() { + var t = this._data, r = t.words, n = 8 * this._nDataBytes, i = 8 * t.sigBytes; + r[i >>> 5] |= 0x80 << 24 - i % 32; + var o = e.floor(n / 0x100000000); + r[(i + 64 >>> 9 << 4) + 15] = (o << 8 | o >>> 24) & 0x00ff00ff | (o << 24 | o >>> 8) & 0xff00ff00, r[(i + 64 >>> 9 << 4) + 14] = (n << 8 | n >>> 24) & 0x00ff00ff | (n << 24 | n >>> 8) & 0xff00ff00, t.sigBytes = (r.length + 1) * 4, this._process(); + for(var a = this._hash, u = a.words, l = 0; l < 4; l++){ + var s = u[l]; + u[l] = (s << 8 | s >>> 24) & 0x00ff00ff | (s << 24 | s >>> 8) & 0xff00ff00; + } + return a; + }, + clone: function() { + var e = o.clone.call(this); + return e._hash = this._hash.clone(), e; } - r.MD5 = o._createHelper(l), r.HmacMD5 = o._createHmacHelper(l); - }(Math), e.MD5; - }, e.exports = n(r(8249)); + }); + function s(e, t, r, n, i, o, a) { + var u = e + (t & r | ~t & n) + i + a; + return (u << o | u >>> 32 - o) + t; + } + function c(e, t, r, n, i, o, a) { + var u = e + (t & n | r & ~n) + i + a; + return (u << o | u >>> 32 - o) + t; + } + function f(e, t, r, n, i, o, a) { + var u = e + (t ^ r ^ n) + i + a; + return (u << o | u >>> 32 - o) + t; + } + function d(e, t, r, n, i, o, a) { + var u = e + (r ^ (t | ~n)) + i + a; + return (u << o | u >>> 32 - o) + t; + } + t.MD5 = o._createHelper(l), t.HmacMD5 = o._createHmacHelper(l); + }(Math), n.MD5); }, 251: function(e, t, r) { var n = r(2215), i = r(2584), o = r(609), a = r(8420), u = r(2847), l = r(8923), s = Date.prototype.getTime; @@ -8883,14 +8776,14 @@ e.exports = function(e) { var n, i = this; if ("function" != typeof i || "[object Function]" !== r.call(i)) throw TypeError("Function.prototype.bind called on incompatible " + i); - for(var o = t.call(arguments, 1), a = function() { + for(var o = t.call(arguments, 1), a = Math.max(0, i.length - o.length), u = [], l = 0; l < a; l++)u.push("$" + l); + if (n = Function("binder", "return function (" + u.join(",") + "){ return binder.apply(this,arguments); }")(function() { if (!(this instanceof n)) return i.apply(e, o.concat(t.call(arguments))); var r = i.apply(this, o.concat(t.call(arguments))); return Object(r) === r ? r : this; - }, u = Math.max(0, i.length - o.length), l = [], s = 0; s < u; s++)l.push("$" + s); - if (n = Function("binder", "return function (" + l.join(",") + "){ return binder.apply(this,arguments); }")(a), i.prototype) { - var c = function() {}; - c.prototype = i.prototype, n.prototype = new c(), c.prototype = null; + }), i.prototype) { + var s = function() {}; + s.prototype = i.prototype, n.prototype = new s(), s.prototype = null; } return n; }; @@ -9359,7 +9252,7 @@ }; }, 7507: function(e) { - var t = function(e, t, r) { + e.exports = function(e, t, r) { if (void 0 == e) return [ 0, 0, @@ -9374,7 +9267,6 @@ Math.abs(Math.round(255 * (o += s))) ]; }; - e.exports = t; }, 4756: function(e, t, r) { var n, i; @@ -15275,10 +15167,8 @@ value: !0 }), t.useIntersection = function(e) { var t = e.rootRef, r = e.rootMargin, n = e.disabled || !u, c = o.useRef(), f = i(o.useState(!1), 2), d = f[0], p = f[1], h = i(o.useState(t ? t.current : null), 2), y = h[0], g = h[1], v = o.useCallback(function(e) { - var t, i, o, a, u; - c.current && (c.current(), c.current = void 0), !n && !d && e && e.tagName && (c.current = (t = function(e) { - return e && p(e); - }, o = (i = function(e) { + var t, i, o, a; + c.current && (c.current(), c.current = void 0), !n && !d && e && e.tagName && (c.current = (i = (t = function(e) { var t, r = { root: e.root || null, margin: e.rootMargin || "" @@ -15300,11 +15190,13 @@ }({ root: y, rootMargin: r - })).id, a = i.observer, (u = i.elements).set(e, t), a.observe(e), function() { - if (u.delete(e), a.unobserve(e), 0 === u.size) { - a.disconnect(), l.delete(o); + })).id, o = t.observer, (a = t.elements).set(e, function(e) { + return e && p(e); + }), o.observe(e), function() { + if (a.delete(e), o.unobserve(e), 0 === a.size) { + o.disconnect(), l.delete(i); var t = s.findIndex(function(e) { - return e.root === o.root && e.margin === o.margin; + return e.root === i.root && e.margin === i.margin; }); t > -1 && s.splice(t, 1); } @@ -16699,14 +16591,14 @@ e.exports = function(e) { var n, i = this; if ("function" != typeof i || "[object Function]" !== r.call(i)) throw TypeError("Function.prototype.bind called on incompatible " + i); - for(var o = t.call(arguments, 1), a = function() { + for(var o = t.call(arguments, 1), a = Math.max(0, i.length - o.length), u = [], l = 0; l < a; l++)u.push("$" + l); + if (n = Function("binder", "return function (" + u.join(",") + "){ return binder.apply(this,arguments); }")(function() { if (!(this instanceof n)) return i.apply(e, o.concat(t.call(arguments))); var r = i.apply(this, o.concat(t.call(arguments))); return Object(r) === r ? r : this; - }, u = Math.max(0, i.length - o.length), l = [], s = 0; s < u; s++)l.push("$" + s); - if (n = Function("binder", "return function (" + l.join(",") + "){ return binder.apply(this,arguments); }")(a), i.prototype) { - var c = function() {}; - c.prototype = i.prototype, n.prototype = new c(), c.prototype = null; + }), i.prototype) { + var s = function() {}; + s.prototype = i.prototype, n.prototype = new s(), s.prototype = null; } return n; }; @@ -21585,7 +21477,8 @@ t(h(void 0, !0)); }); }); - }), o), v), m = function(e) { + }), o), v); + e.exports = function(e) { var t, r = Object.create(b, (i(t = {}, p, { value: e, writable: !0 @@ -21618,7 +21511,6 @@ null !== n && (r[f] = null, r[u] = null, r[l] = null, n(h(void 0, !0))), r[c] = !0; }), e.on("readable", g.bind(null, r)), r; }; - e.exports = m; }, 914: function(e, t, r) { "use strict"; @@ -21924,24 +21816,24 @@ var d = (e = c).length && "function" == typeof e[e.length - 1] ? e.pop() : u; if (Array.isArray(c[0]) && (c = c[0]), c.length < 2) throw new o("streams"); var p = c.map(function(e, i) { - var o, u, s, f, h, y, g = i < c.length - 1; - return o = i > 0, s = u = function(e) { - t || (t = e), e && p.forEach(l), g || (p.forEach(l), d(t)); - }, f = !1, u = function() { - f || (f = !0, s.apply(void 0, arguments)); - }, h = !1, e.on("close", function() { - h = !0; + var o, u, s, f, h, y = i < c.length - 1; + return u = o = function(e) { + t || (t = e), e && p.forEach(l), y || (p.forEach(l), d(t)); + }, s = !1, o = function() { + s || (s = !0, u.apply(void 0, arguments)); + }, f = !1, e.on("close", function() { + f = !0; }), void 0 === n && (n = r(494)), n(e, { - readable: g, - writable: o + readable: y, + writable: i > 0 }, function(e) { - if (e) return u(e); - h = !0, u(); - }), y = !1, function(t) { - if (!h && !y) { - if (y = !0, e.setHeader && "function" == typeof e.abort) return e.abort(); + if (e) return o(e); + f = !0, o(); + }), h = !1, function(t) { + if (!f && !h) { + if (h = !0, e.setHeader && "function" == typeof e.abort) return e.abort(); if ("function" == typeof e.destroy) return e.destroy(); - u(t || new a("pipe")); + o(t || new a("pipe")); } }; }); @@ -22575,14 +22467,14 @@ e.exports = function(e) { var n, i = this; if ("function" != typeof i || "[object Function]" !== r.call(i)) throw TypeError("Function.prototype.bind called on incompatible " + i); - for(var o = t.call(arguments, 1), a = function() { + for(var o = t.call(arguments, 1), a = Math.max(0, i.length - o.length), u = [], l = 0; l < a; l++)u.push("$" + l); + if (n = Function("binder", "return function (" + u.join(",") + "){ return binder.apply(this,arguments); }")(function() { if (!(this instanceof n)) return i.apply(e, o.concat(t.call(arguments))); var r = i.apply(this, o.concat(t.call(arguments))); return Object(r) === r ? r : this; - }, u = Math.max(0, i.length - o.length), l = [], s = 0; s < u; s++)l.push("$" + s); - if (n = Function("binder", "return function (" + l.join(",") + "){ return binder.apply(this,arguments); }")(a), i.prototype) { - var c = function() {}; - c.prototype = i.prototype, n.prototype = new c(), c.prototype = null; + }), i.prototype) { + var s = function() {}; + s.prototype = i.prototype, n.prototype = new s(), s.prototype = null; } return n; }; @@ -28071,15 +27963,15 @@ }, 2022: function(e, t, r) { (function() { - var e, n; + var e; e = r(3660).Number, t.resolveLength = function(t, r, n) { var i; if ("number" == typeof t ? i = t : "function" == typeof t ? i = t.call(n, n) : n && "string" == typeof t ? i = n[t] : r && t instanceof e && (i = t.decode(r)), isNaN(i)) throw Error("Not a fixed size"); return i; - }, n = function(e) { + }, t.PropertyDescriptor = function(e) { var t, r; for(t in null == e && (e = {}), this.enumerable = !0, this.configurable = !0, e)r = e[t], this[t] = r; - }, t.PropertyDescriptor = n; + }; }).call(this); }, 6851: function(e, t, r) { diff --git a/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/output.js b/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/output.js index 19acee1b734f..1ef866d7c96d 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/output.js @@ -3719,7 +3719,7 @@ return _app; } }); - var fn, cache, t, styled_system_dist_index_esm_namespaceObject = {}; + var cache, t, styled_system_dist_index_esm_namespaceObject = {}; __webpack_require__.r(styled_system_dist_index_esm_namespaceObject), __webpack_require__.d(styled_system_dist_index_esm_namespaceObject, { alignContent: function() { return alignContent; @@ -4412,10 +4412,8 @@ strokeMiterlimit: 1, strokeOpacity: 1, strokeWidth: 1 - }, reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/, isPropValid = (fn = function(prop) { - return reactPropsRegex.test(prop) || 111 === prop.charCodeAt(0) && 110 === prop.charCodeAt(1) && 91 > prop.charCodeAt(2); - }, cache = Object.create(null), function(arg) { - return void 0 === cache[arg] && (cache[arg] = fn(arg)), cache[arg]; + }, reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/, isPropValid = (cache = Object.create(null), function(arg) { + return void 0 === cache[arg] && (cache[arg] = reactPropsRegex.test(arg) || 111 === arg.charCodeAt(0) && 110 === arg.charCodeAt(1) && 91 > arg.charCodeAt(2)), cache[arg]; }), hoist_non_react_statics_cjs = __webpack_require__(8679), hoist_non_react_statics_cjs_default = __webpack_require__.n(hoist_non_react_statics_cjs), process = __webpack_require__(3454); function v() { return (v = Object.assign || function(e) { @@ -5813,7 +5811,7 @@ ].reduce(function(acc, curr) { var _extends2; return _extends({}, acc, ((_extends2 = {})[curr] = positiveOrNegative, _extends2)); - }, {}), css = function css(args) { + }, {}), css_dist_index_esm = function css(args) { return function(props) { void 0 === props && (props = {}); var styles, theme = _extends({}, defaultTheme, {}, props.theme || props), result = {}, styles1 = (styles = "function" == typeof args ? args(theme) : args, function(theme) { @@ -5859,12 +5857,12 @@ return result; }; }, variant = function(_ref) { - var _config, sx, scale = _ref.scale, _ref$prop = _ref.prop, prop = void 0 === _ref$prop ? "variant" : _ref$prop, _ref$variants = _ref.variants, variants = void 0 === _ref$variants ? {} : _ref$variants, key = _ref.key; + var _config, sx, scale = _ref.scale, _ref$prop = _ref.prop, _ref$variants = _ref.variants, variants = void 0 === _ref$variants ? {} : _ref$variants, key = _ref.key; return (sx = Object.keys(variants).length ? function(value, scale, props) { - return css(get(scale, value, null))(props.theme); + return css_dist_index_esm(get(scale, value, null))(props.theme); } : function(value, scale) { return get(scale, value, null); - }).scale = scale || key, sx.defaults = variants, createParser(((_config = {})[prop] = sx, _config)); + }).scale = scale || key, sx.defaults = variants, createParser(((_config = {})[void 0 === _ref$prop ? "variant" : _ref$prop] = sx, _config)); }, buttonStyle = variant({ key: "buttons" }), textStyle = variant({ @@ -5883,7 +5881,7 @@ transform: transformValue }), alias && (config[alias] = config[prop]), createParser(config); }, cjs = __webpack_require__(9996), cjs_default = __webpack_require__.n(cjs); - const sx = (props)=>css(props.sx), Box = He.div.withConfig({ + const sx = (props)=>css_dist_index_esm(props.sx), Box = He.div.withConfig({ displayName: "Box", componentId: "sc-1gh2r6s-0" })(space, color, typography, layout, flexbox, grid, background, border, position, shadow, sx); diff --git a/crates/swc_ecma_minifier/tests/fixture/next/syncfusion/933-e9f9a6bf671b96fc/output.js b/crates/swc_ecma_minifier/tests/fixture/next/syncfusion/933-e9f9a6bf671b96fc/output.js index 4b14c892750b..69a09cebd80b 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/syncfusion/933-e9f9a6bf671b96fc/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/syncfusion/933-e9f9a6bf671b96fc/output.js @@ -224,10 +224,10 @@ function debounce(eventFunction, delay) { var out; return function() { - var _this = this, args = arguments, later = function() { + var _this = this, args = arguments; + clearTimeout(out), out = setTimeout(function() { return out = null, eventFunction.apply(_this, args); - }; - clearTimeout(out), out = setTimeout(later, delay); + }, delay); }; } function compareElementParent(child, parent) { @@ -4423,10 +4423,10 @@ }, ChildProperty.prototype.updateTimeOut = function() { if (this.parentObj.updateTimeOut) this.parentObj.finalUpdate(), this.parentObj.updateTimeOut(); else { - var changeTime_1 = setTimeout(this.parentObj.dataBind.bind(this.parentObj)), clearUpdate = function() { + var changeTime_1 = setTimeout(this.parentObj.dataBind.bind(this.parentObj)); + this.finalUpdate = function() { clearTimeout(changeTime_1); }; - this.finalUpdate = clearUpdate; } }, ChildProperty.prototype.clearChanges = function() { this.finalUpdate(), this.updateChange(!1, this.propName), this.oldProperties = {}, this.changedProperties = {}; @@ -20713,12 +20713,9 @@ clearTimeout(this.autoCloseTimer), this.targetHover(evt.originalEvent); }, Tooltip.prototype.touchEndHandler = function(e) { var _this = this; - if (!this.isSticky) { - var close = function() { - _this.close(); - }; - this.autoCloseTimer = setTimeout(close, 1500); - } + this.isSticky || (this.autoCloseTimer = setTimeout(function() { + _this.close(); + }, 1500)); }, Tooltip.prototype.targetClick = function(e) { var target; target = this.target ? (0, ej2_base.oq)(e.target, this.target) : this.element, !(0, ej2_base.le)(target) && (null === target.getAttribute('data-tooltip-id') ? this.targetHover(e) : this.isSticky || this.hideTooltip(this.animation.close, e, target)); @@ -20743,11 +20740,9 @@ event: e || null, element: this.tooltipEle, isInteracted: !(0, ej2_base.le)(e) - }; - var observeCallback = function(beforeRenderArgs) { + }, this.trigger('beforeRender', this.tooltipEventArgs, (function(beforeRenderArgs) { _this.beforeRenderCallback(beforeRenderArgs, target, e, showAnimation); - }; - this.trigger('beforeRender', this.tooltipEventArgs, observeCallback.bind(this)); + }).bind(this)); }, Tooltip.prototype.beforeRenderCallback = function(beforeRenderArgs, target, e, showAnimation) { beforeRenderArgs.cancel ? (this.isHidden = !0, this.clear(), this.mouseMoveBeforeRemove()) : (this.isHidden = !1, (0, ej2_base.le)(this.tooltipEle) ? (this.ctrlId = this.element.getAttribute('id') ? (0, ej2_base.QI)(this.element.getAttribute('id')) : (0, ej2_base.QI)('tooltip'), this.tooltipEle = this.createElement('div', { className: TOOLTIP_WRAP + ' ' + POPUP_ROOT + ' ' + POPUP_LIB, @@ -20773,24 +20768,20 @@ ctrlObj.tooltipEle ], POPUP_OPEN), ctrlObj.showTipPointer && ctrlObj.renderArrow(), ctrlObj.renderCloseIcon(), ctrlObj.renderPopup(target), ctrlObj.adjustArrow(target, ctrlObj.position, ctrlObj.tooltipPositionX, ctrlObj.tooltipPositionY), ej2_base.fw.stop(ctrlObj.tooltipEle), ctrlObj.reposition(target)); }, Tooltip.prototype.tooltipAfterRender = function(target, e, showAnimation, ctrlObj) { - if (target) { - (0, ej2_base.IV)([ - ctrlObj.tooltipEle - ], POPUP_OPEN), (0, ej2_base.cn)([ - ctrlObj.tooltipEle - ], POPUP_CLOSE), ctrlObj.tooltipEventArgs = { - type: e ? e.type : null, - cancel: !1, - target: target, - event: e || null, - element: ctrlObj.tooltipEle, - isInteracted: !(0, ej2_base.le)(e) - }, ctrlObj.needTemplateReposition() && !ctrlObj.mouseTrail && (ctrlObj.tooltipEle.style.display = 'none'); - var observeCallback = function(observedArgs) { - ctrlObj.beforeOpenCallback(observedArgs, target, showAnimation, e); - }; - ctrlObj.trigger('beforeOpen', ctrlObj.tooltipEventArgs, observeCallback.bind(ctrlObj)); - } + target && ((0, ej2_base.IV)([ + ctrlObj.tooltipEle + ], POPUP_OPEN), (0, ej2_base.cn)([ + ctrlObj.tooltipEle + ], POPUP_CLOSE), ctrlObj.tooltipEventArgs = { + type: e ? e.type : null, + cancel: !1, + target: target, + event: e || null, + element: ctrlObj.tooltipEle, + isInteracted: !(0, ej2_base.le)(e) + }, ctrlObj.needTemplateReposition() && !ctrlObj.mouseTrail && (ctrlObj.tooltipEle.style.display = 'none'), ctrlObj.trigger('beforeOpen', ctrlObj.tooltipEventArgs, (function(observedArgs) { + ctrlObj.beforeOpenCallback(observedArgs, target, showAnimation, e); + }).bind(ctrlObj))); }, Tooltip.prototype.beforeOpenCallback = function(observedArgs, target, showAnimation, e) { var _this = this; if (observedArgs.cancel) this.isHidden = !0, this.clear(), this.mouseMoveBeforeRemove(), this.restoreElement(target); @@ -20801,12 +20792,9 @@ delay: showAnimation.delay, timingFunction: 'easeOut' }; - if ('None' === showAnimation.effect && (openAnimation_1 = void 0), this.openDelay > 0) { - var show = function() { - _this.mouseTrail && ej2_base.bi.add(target, 'mousemove touchstart mouseenter', _this.onMouseMove, _this), _this.popupObj && (_this.popupObj.show(openAnimation_1, target), _this.mouseMoveEvent && _this.mouseTrail && _this.onMouseMove(_this.mouseMoveEvent)); - }; - this.showTimer = setTimeout(show, this.openDelay); - } else this.popupObj && this.popupObj.show(openAnimation_1, target); + 'None' === showAnimation.effect && (openAnimation_1 = void 0), this.openDelay > 0 ? this.showTimer = setTimeout(function() { + _this.mouseTrail && ej2_base.bi.add(target, 'mousemove touchstart mouseenter', _this.onMouseMove, _this), _this.popupObj && (_this.popupObj.show(openAnimation_1, target), _this.mouseMoveEvent && _this.mouseTrail && _this.onMouseMove(_this.mouseMoveEvent)); + }, this.openDelay) : this.popupObj && this.popupObj.show(openAnimation_1, target); } e && this.wireMouseEvents(e, target); }, Tooltip.prototype.needTemplateReposition = function() { @@ -20862,13 +20850,9 @@ return !this.windowCollision && this.target ? this.element : null; }, Tooltip.prototype.hideTooltip = function(hideAnimation, e, targetElement) { var _this = this; - if (this.closeDelay > 0) { - clearTimeout(this.hideTimer), clearTimeout(this.showTimer); - var hide = function() { - _this.closeDelay && _this.tooltipEle && _this.isTooltipOpen || _this.tooltipHide(hideAnimation, e, targetElement); - }; - this.hideTimer = setTimeout(hide, this.closeDelay); - } else this.tooltipHide(hideAnimation, e, targetElement); + this.closeDelay > 0 ? (clearTimeout(this.hideTimer), clearTimeout(this.showTimer), this.hideTimer = setTimeout(function() { + _this.closeDelay && _this.tooltipEle && _this.isTooltipOpen || _this.tooltipHide(hideAnimation, e, targetElement); + }, this.closeDelay)) : this.tooltipHide(hideAnimation, e, targetElement); }, Tooltip.prototype.tooltipHide = function(hideAnimation, e, targetElement) { var target, _this = this; target = e ? this.target ? targetElement || e.target : this.element : (0, ej2_base.Ys)('[data-tooltip-id= "' + this.ctrlId + '_content"]', document), this.tooltipEventArgs = { diff --git a/crates/swc_ecma_minifier/tests/fixture/next/target-es2015/static/chunks/main-04b5934c26266542/output.js b/crates/swc_ecma_minifier/tests/fixture/next/target-es2015/static/chunks/main-04b5934c26266542/output.js index 567434cbe859..be0f632c7ab0 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/target-es2015/static/chunks/main-04b5934c26266542/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/target-es2015/static/chunks/main-04b5934c26266542/output.js @@ -131,12 +131,10 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: !0 - }), exports.addLocale = void 0, __webpack_require__(2392); - const addLocale = function(path) { + }), exports.addLocale = void 0, __webpack_require__(2392), exports.addLocale = function(path) { for(var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)args[_key - 1] = arguments[_key]; return path; - }; - exports.addLocale = addLocale, ("function" == typeof exports.default || "object" == typeof exports.default && null !== exports.default) && void 0 === exports.default.__esModule && (Object.defineProperty(exports.default, "__esModule", { + }, ("function" == typeof exports.default || "object" == typeof exports.default && null !== exports.default) && void 0 === exports.default.__esModule && (Object.defineProperty(exports.default, "__esModule", { value: !0 }), Object.assign(exports.default, exports), module.exports = exports.default); }, @@ -144,11 +142,9 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: !0 - }), exports.detectDomainLocale = void 0; - const detectDomainLocale = function() { + }), exports.detectDomainLocale = void 0, exports.detectDomainLocale = function() { for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; - }; - exports.detectDomainLocale = detectDomainLocale, ("function" == typeof exports.default || "object" == typeof exports.default && null !== exports.default) && void 0 === exports.default.__esModule && (Object.defineProperty(exports.default, "__esModule", { + }, ("function" == typeof exports.default || "object" == typeof exports.default && null !== exports.default) && void 0 === exports.default.__esModule && (Object.defineProperty(exports.default, "__esModule", { value: !0 }), Object.assign(exports.default, exports), module.exports = exports.default); }, @@ -1385,7 +1381,7 @@ }); }); } - var _default = function(param) { + exports.default = function(param) { let { children } = param; const ampState = _react.useContext(_ampContext.AmpStateContext), headManager = _react.useContext(_headManagerContext.HeadManagerContext); return _react.default.createElement(_sideEffect.default, { @@ -1393,8 +1389,7 @@ headManager: headManager, inAmpMode: _ampMode.isInAmpMode(ampState) }, children); - }; - exports.default = _default, ("function" == typeof exports.default || "object" == typeof exports.default && null !== exports.default) && void 0 === exports.default.__esModule && (Object.defineProperty(exports.default, "__esModule", { + }, ("function" == typeof exports.default || "object" == typeof exports.default && null !== exports.default) && void 0 === exports.default.__esModule && (Object.defineProperty(exports.default, "__esModule", { value: !0 }), Object.assign(exports.default, exports), module.exports = exports.default); }, diff --git a/crates/swc_ecma_minifier/tests/fixture/simple/inline/4/output.js b/crates/swc_ecma_minifier/tests/fixture/simple/inline/4/output.js index 53e083219b29..67b35684e94b 100644 --- a/crates/swc_ecma_minifier/tests/fixture/simple/inline/4/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/simple/inline/4/output.js @@ -1,9 +1,8 @@ -var a, c, a1, c1, a2, c2; -a = module.exports, c = function() { +module.exports.A = function() { return A; -}, a.A = c, a1 = module.exports, c1 = function() { +}, module.exports.B = function() { return B; -}, a1.B = c1, a2 = module.exports, c2 = function() { +}, module.exports.C = function() { return C; -}, a2.C = c2; +}; const A = "A", B = "B", C = "C"; diff --git a/crates/swc_ecma_minifier/tests/full/feedback-mapbox/2c796e83-0724e2af5f19128a/output.js b/crates/swc_ecma_minifier/tests/full/feedback-mapbox/2c796e83-0724e2af5f19128a/output.js index 520783138a71..a8399ed602eb 100644 --- a/crates/swc_ecma_minifier/tests/full/feedback-mapbox/2c796e83-0724e2af5f19128a/output.js +++ b/crates/swc_ecma_minifier/tests/full/feedback-mapbox/2c796e83-0724e2af5f19128a/output.js @@ -1,11 +1,11 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[634],{6158:function(i,r,n){var o,s=n(3454);o=function(){"use strict";var i,r,n;function o(o,s){if(i){if(r){var a="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+i+")(sharedChunk); ("+r+")(sharedChunk); self.onerror = null;",l={};i(l),n=s(l),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(n.workerUrl=window.URL.createObjectURL(new Blob([a],{type:"text/javascript"})))}else r=s}else i=s}return o(["exports"],function(i){let r,n,o;var a,l,c="2.7.0";function h(i,r,n,o){this.cx=3*i,this.bx=3*(n-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(o-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=o,this.p2x=n,this.p2y=o}h.prototype.sampleCurveX=function(i){return((this.ax*i+this.bx)*i+this.cx)*i},h.prototype.sampleCurveY=function(i){return((this.ay*i+this.by)*i+this.cy)*i},h.prototype.sampleCurveDerivativeX=function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},h.prototype.solveCurveX=function(i,r){var n,o,s,a,l;for(void 0===r&&(r=1e-6),s=i,l=0;l<8;l++){if(Math.abs(a=this.sampleCurveX(s)-i)Math.abs(c))break;s-=a/c}if((s=i)<(n=0))return n;if(s>(o=1))return o;for(;na?n=s:o=s,s=.5*(o-n)+n;return s},h.prototype.solve=function(i,r){return this.sampleCurveY(this.solveCurveX(i,r))};var u=d;function d(i,r){this.x=i,this.y=r}d.prototype={clone:function(){return new d(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,r){return this.clone()._rotateAround(i,r)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var r=i.x-this.x,n=i.y-this.y;return r*r+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,r){return Math.atan2(this.x*r-this.y*i,this.x*i+this.y*r)},_matMult:function(i){var r=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=r,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var r=Math.cos(i),n=Math.sin(i),o=n*this.x+r*this.y;return this.x=r*this.x-n*this.y,this.y=o,this},_rotateAround:function(i,r){var n=Math.cos(i),o=Math.sin(i),s=r.y+o*(this.x-r.x)+n*(this.y-r.y);return this.x=r.x+n*(this.x-r.x)-o*(this.y-r.y),this.y=s,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},d.convert=function(i){return i instanceof d?i:Array.isArray(i)?new d(i[0],i[1]):i};var p="undefined"!=typeof self?self:{},f="undefined"!=typeof Float32Array?Float32Array:Array;function m(){var i=new f(9);return f!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,i}function _(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function g(i,r,n){var o=r[0],s=r[1],a=r[2],l=r[3],c=r[4],h=r[5],u=r[6],d=r[7],p=r[8],f=r[9],m=r[10],_=r[11],g=r[12],y=r[13],x=r[14],v=r[15],b=n[0],w=n[1],T=n[2],E=n[3];return i[0]=b*o+w*c+T*p+E*g,i[1]=b*s+w*h+T*f+E*y,i[2]=b*a+w*u+T*m+E*x,i[3]=b*l+w*d+T*_+E*v,i[4]=(b=n[4])*o+(w=n[5])*c+(T=n[6])*p+(E=n[7])*g,i[5]=b*s+w*h+T*f+E*y,i[6]=b*a+w*u+T*m+E*x,i[7]=b*l+w*d+T*_+E*v,i[8]=(b=n[8])*o+(w=n[9])*c+(T=n[10])*p+(E=n[11])*g,i[9]=b*s+w*h+T*f+E*y,i[10]=b*a+w*u+T*m+E*x,i[11]=b*l+w*d+T*_+E*v,i[12]=(b=n[12])*o+(w=n[13])*c+(T=n[14])*p+(E=n[15])*g,i[13]=b*s+w*h+T*f+E*y,i[14]=b*a+w*u+T*m+E*x,i[15]=b*l+w*d+T*_+E*v,i}function y(i,r,n){var o,s,a,l,c,h,u,d,p,f,m,_,g=n[0],y=n[1],x=n[2];return r===i?(i[12]=r[0]*g+r[4]*y+r[8]*x+r[12],i[13]=r[1]*g+r[5]*y+r[9]*x+r[13],i[14]=r[2]*g+r[6]*y+r[10]*x+r[14],i[15]=r[3]*g+r[7]*y+r[11]*x+r[15]):(s=r[1],a=r[2],l=r[3],c=r[4],h=r[5],u=r[6],d=r[7],p=r[8],f=r[9],m=r[10],_=r[11],i[0]=o=r[0],i[1]=s,i[2]=a,i[3]=l,i[4]=c,i[5]=h,i[6]=u,i[7]=d,i[8]=p,i[9]=f,i[10]=m,i[11]=_,i[12]=o*g+c*y+p*x+r[12],i[13]=s*g+h*y+f*x+r[13],i[14]=a*g+u*y+m*x+r[14],i[15]=l*g+d*y+_*x+r[15]),i}function x(i,r,n){var o=n[0],s=n[1],a=n[2];return i[0]=r[0]*o,i[1]=r[1]*o,i[2]=r[2]*o,i[3]=r[3]*o,i[4]=r[4]*s,i[5]=r[5]*s,i[6]=r[6]*s,i[7]=r[7]*s,i[8]=r[8]*a,i[9]=r[9]*a,i[10]=r[10]*a,i[11]=r[11]*a,i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15],i}function v(i,r,n){var o=Math.sin(n),s=Math.cos(n),a=r[4],l=r[5],c=r[6],h=r[7],u=r[8],d=r[9],p=r[10],f=r[11];return r!==i&&(i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[4]=a*s+u*o,i[5]=l*s+d*o,i[6]=c*s+p*o,i[7]=h*s+f*o,i[8]=u*s-a*o,i[9]=d*s-l*o,i[10]=p*s-c*o,i[11]=f*s-h*o,i}function b(i,r,n){var o=Math.sin(n),s=Math.cos(n),a=r[0],l=r[1],c=r[2],h=r[3],u=r[8],d=r[9],p=r[10],f=r[11];return r!==i&&(i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[0]=a*s-u*o,i[1]=l*s-d*o,i[2]=c*s-p*o,i[3]=h*s-f*o,i[8]=a*o+u*s,i[9]=l*o+d*s,i[10]=c*o+p*s,i[11]=h*o+f*s,i}function w(){var i=new f(3);return f!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function T(i){var r=new f(3);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r}function E(i){return Math.hypot(i[0],i[1],i[2])}function S(i,r,n){var o=new f(3);return o[0]=i,o[1]=r,o[2]=n,o}function I(i,r,n){return i[0]=r[0]+n[0],i[1]=r[1]+n[1],i[2]=r[2]+n[2],i}function M(i,r,n){return i[0]=r[0]-n[0],i[1]=r[1]-n[1],i[2]=r[2]-n[2],i}function A(i,r,n){return i[0]=r[0]*n[0],i[1]=r[1]*n[1],i[2]=r[2]*n[2],i}function C(i,r,n){return i[0]=r[0]*n,i[1]=r[1]*n,i[2]=r[2]*n,i}function z(i,r,n,o){return i[0]=r[0]+n[0]*o,i[1]=r[1]+n[1]*o,i[2]=r[2]+n[2]*o,i}function k(i,r){var n=r[0],o=r[1],s=r[2],a=n*n+o*o+s*s;return a>0&&(a=1/Math.sqrt(a)),i[0]=r[0]*a,i[1]=r[1]*a,i[2]=r[2]*a,i}function P(i,r){return i[0]*r[0]+i[1]*r[1]+i[2]*r[2]}function D(i,r,n){var o=r[0],s=r[1],a=r[2],l=n[0],c=n[1],h=n[2];return i[0]=s*h-a*c,i[1]=a*l-o*h,i[2]=o*c-s*l,i}function L(i,r,n){var o=r[0],s=r[1],a=r[2],l=n[3]*o+n[7]*s+n[11]*a+n[15];return i[0]=(n[0]*o+n[4]*s+n[8]*a+n[12])/(l=l||1),i[1]=(n[1]*o+n[5]*s+n[9]*a+n[13])/l,i[2]=(n[2]*o+n[6]*s+n[10]*a+n[14])/l,i}function B(i,r,n){var o=n[0],s=n[1],a=n[2],l=r[0],c=r[1],h=r[2],u=s*h-a*c,d=a*l-o*h,p=o*c-s*l,f=s*p-a*d,m=a*u-o*p,_=o*d-s*u,g=2*n[3];return d*=g,p*=g,m*=2,_*=2,i[0]=l+(u*=g)+(f*=2),i[1]=c+d+m,i[2]=h+p+_,i}function R(i,r,n){var o=r[0],s=r[1],a=r[2],l=r[3];return i[0]=n[0]*o+n[4]*s+n[8]*a+n[12]*l,i[1]=n[1]*o+n[5]*s+n[9]*a+n[13]*l,i[2]=n[2]*o+n[6]*s+n[10]*a+n[14]*l,i[3]=n[3]*o+n[7]*s+n[11]*a+n[15]*l,i}function F(){var i=new f(4);return f!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function O(i){return i[0]=0,i[1]=0,i[2]=0,i[3]=1,i}function U(i,r,n){n*=.5;var o=r[0],s=r[1],a=r[2],l=r[3],c=Math.sin(n),h=Math.cos(n);return i[0]=o*h+l*c,i[1]=s*h+a*c,i[2]=a*h-s*c,i[3]=l*h-o*c,i}function V(i,r){return i[0]===r[0]&&i[1]===r[1]}Math.hypot||(Math.hypot=function(){for(var i=0,r=arguments.length;r--;)i+=arguments[r]*arguments[r];return Math.sqrt(i)}),w(),a=new f(4),f!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0,a[3]=0),w(),S(1,0,0),S(0,1,0),F(),F(),m(),l=new f(2),f!=Float32Array&&(l[0]=0,l[1]=0);const N=Math.PI/180,j=180/Math.PI,G=[[0,0],[1,0],[1,1],[0,1]];function Z(i){if(i<=0)return 0;if(i>=1)return 1;const r=i*i,n=r*i;return 4*(i<.5?n:3*(i-r)+n-.75)}function $(i,r,n,o){const s=new h(i,r,n,o);return function(i){return s.solve(i)}}const q=$(.25,.1,.25,1);function X(i,r,n){return Math.min(n,Math.max(r,i))}function W(i,r,n){return(n=X((n-i)/(r-i),0,1))*n*(3-2*n)}function H(i,r,n){const o=n-r,s=((i-r)%o+o)%o+r;return s===r?n:s}function K(i,r,n){if(!i.length)return n(null,[]);let o=i.length;const s=Array(i.length);let a=null;i.forEach((i,l)=>{r(i,(i,r)=>{i&&(a=i),s[l]=r,0==--o&&n(a,s)})})}function Y(i){const r=[];for(const n in i)r.push(i[n]);return r}function J(i,...r){for(const n of r)for(const o in n)i[o]=n[o];return i}let Q=1;function ee(){return Q++}function et(){return function i(r){return r?(r^16*Math.random()>>r/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,i)}()}function ei(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function er(i){return!!i&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(i)}function en(i,r){i.forEach(i=>{r[i]&&(r[i]=r[i].bind(r))})}function eo(i,r){return -1!==i.indexOf(r,i.length-r.length)}function es(i,r,n){const o={};for(const s in i)o[s]=r.call(n||this,i[s],s,i);return o}function ea(i,r,n){const o={};for(const s in i)r.call(n||this,i[s],s,i)&&(o[s]=i[s]);return o}function el(i){return Array.isArray(i)?i.map(el):"object"==typeof i&&i?es(i,el):i}const ec={};function eh(i){ec[i]||("undefined"!=typeof console&&console.warn(i),ec[i]=!0)}function eu(i,r,n){return(n.y-i.y)*(r.x-i.x)>(r.y-i.y)*(n.x-i.x)}function ed(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function ep(i){const r={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,n,o,s)=>{const a=o||s;return r[n]=!a||a.toLowerCase(),""}),r["max-age"]){const n=parseInt(r["max-age"],10);isNaN(n)?delete r["max-age"]:r["max-age"]=n}return r}let ef,em,e_,eg=null;function ey(i){if(null==eg){const r=i.navigator?i.navigator.userAgent:null;eg=!!i.safari||!(!r||!(/\b(iPad|iPhone|iPod)\b/.test(r)||r.match("Safari")&&!r.match("Chrome")))}return eg}function ex(i){try{const r=p[i];return r.setItem("_mapbox_test_",1),r.removeItem("_mapbox_test_"),!0}catch(n){return!1}}const ev={now:()=>void 0!==e_?e_:p.performance.now(),setNow(i){e_=i},restoreNow(){e_=void 0},frame(i){const r=p.requestAnimationFrame(i);return{cancel:()=>p.cancelAnimationFrame(r)}},getImageData(i,r=0){const n=p.document.createElement("canvas"),o=n.getContext("2d");if(!o)throw Error("failed to create canvas 2d context");return n.width=i.width,n.height=i.height,o.drawImage(i,0,0,i.width,i.height),o.getImageData(-r,-r,i.width+2*r,i.height+2*r)},resolveURL:i=>(ef||(ef=p.document.createElement("a")),ef.href=i,ef.href),get devicePixelRatio(){return p.devicePixelRatio},get prefersReducedMotion(){return!!p.matchMedia&&(null==em&&(em=p.matchMedia("(prefers-reduced-motion: reduce)")),em.matches)}},eb={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==r){const ew=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{r=null!=s.env.API_URL_REGEX?RegExp(s.env.API_URL_REGEX):ew}catch(eT){r=ew}}return r},get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},eE={supported:!1,testSupport:function(i){!eM&&eI&&(eA?eC(i):eS=i)}};let eS,eI,eM=!1,eA=!1;function eC(i){const r=i.createTexture();i.bindTexture(i.TEXTURE_2D,r);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,eI),i.isContextLost())return;eE.supported=!0}catch(n){}i.deleteTexture(r),eM=!0}p.document&&((eI=p.document.createElement("img")).onload=function(){eS&&eC(eS),eS=null,eA=!0},eI.onerror=function(){eM=!0,eS=null},eI.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const ez="NO_ACCESS_TOKEN";function ek(i){return 0===i.indexOf("mapbox:")}function eP(i){return eb.API_URL_REGEX.test(i)}const eD=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function eL(i){const r=i.match(eD);if(!r)throw Error("Unable to parse URL object");return{protocol:r[1],authority:r[2],path:r[3]||"/",params:r[4]?r[4].split("&"):[]}}function eB(i){const r=i.params.length?`?${i.params.join("&")}`:"";return`${i.protocol}://${i.authority}${i.path}${r}`}function eR(i){if(!i)return null;const r=i.split(".");if(!r||3!==r.length)return null;try{return JSON.parse(decodeURIComponent(p.atob(r[1]).split("").map(i=>"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch(n){return null}}class eF{constructor(i){this.type=i,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(i){const r=eR(eb.ACCESS_TOKEN);let n="";return n=r&&r.u?p.btoa(encodeURIComponent(r.u).replace(/%([0-9A-F]{2})/g,(i,r)=>String.fromCharCode(Number("0x"+r)))):eb.ACCESS_TOKEN||"",i?`mapbox.eventData.${i}:${n}`:`mapbox.eventData:${n}`}fetchEventData(){const i=ex("localStorage"),r=this.getStorageKey(),n=this.getStorageKey("uuid");if(i)try{const o=p.localStorage.getItem(r);o&&(this.eventData=JSON.parse(o));const s=p.localStorage.getItem(n);s&&(this.anonId=s)}catch(a){eh("Unable to read from LocalStorage")}}saveEventData(){const i=ex("localStorage"),r=this.getStorageKey(),n=this.getStorageKey("uuid");if(i)try{p.localStorage.setItem(n,this.anonId),Object.keys(this.eventData).length>=1&&p.localStorage.setItem(r,JSON.stringify(this.eventData))}catch(o){eh("Unable to write to LocalStorage")}}processRequests(i){}postEvent(i,r,n,o){if(!eb.EVENTS_URL)return;const s=eL(eb.EVENTS_URL);s.params.push(`access_token=${o||eb.ACCESS_TOKEN||""}`);const a={event:this.type,created:new Date(i).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:c,skuId:"01",userId:this.anonId},l=r?J(a,r):a,h={url:eB(s),headers:{"Content-Type":"text/plain"},body:JSON.stringify([l])};this.pendingRequest=e5(h,i=>{this.pendingRequest=null,n(i),this.saveEventData(),this.processRequests(o)})}queueRequest(i,r){this.queue.push(i),this.processRequests(r)}}const eO=new class extends eF{constructor(i){super("appUserTurnstile"),this._customAccessToken=i}postTurnstileEvent(i,r){eb.EVENTS_URL&&eb.ACCESS_TOKEN&&Array.isArray(i)&&i.some(i=>ek(i)||eP(i))&&this.queueRequest(Date.now(),r)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const r=eR(eb.ACCESS_TOKEN),n=r?r.u:eb.ACCESS_TOKEN;let o=n!==this.eventData.tokenU;er(this.anonId)||(this.anonId=et(),o=!0);const s=this.queue.shift();if(this.eventData.lastSuccess){const a=new Date(this.eventData.lastSuccess),l=new Date(s),c=(s-this.eventData.lastSuccess)/864e5;o=o||c>=1||c<-1||a.getDate()!==l.getDate()}else o=!0;if(!o)return this.processRequests();this.postEvent(s,{"enabled.telemetry":!1},i=>{i||(this.eventData.lastSuccess=s,this.eventData.tokenU=n)},i)}},eU=eO.postTurnstileEvent.bind(eO),eV=new class extends eF{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(i,r,n,o){this.skuToken=r,this.errorCb=o,eb.EVENTS_URL&&(n||eb.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},n):this.errorCb(Error(ez)))}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;const{id:r,timestamp:n}=this.queue.shift();r&&this.success[r]||(this.anonId||this.fetchEventData(),er(this.anonId)||(this.anonId=et()),this.postEvent(n,{skuToken:this.skuToken},i=>{i?this.errorCb(i):r&&(this.success[r]=!0)},i))}},eN=eV.postMapLoadEvent.bind(eV),ej=new class extends eF{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(i,r,n,o){if(!eb.API_URL||!eb.SESSION_PATH)return;const s=eL(eb.API_URL+eb.SESSION_PATH);s.params.push(`sku=${r||""}`),s.params.push(`access_token=${o||eb.ACCESS_TOKEN||""}`);const a={url:eB(s),headers:{"Content-Type":"text/plain"}};this.pendingRequest=e4(a,i=>{this.pendingRequest=null,n(i),this.saveEventData(),this.processRequests(o)})}getSessionAPI(i,r,n,o){this.skuToken=r,this.errorCb=o,eb.SESSION_PATH&&eb.API_URL&&(n||eb.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},n):this.errorCb(Error(ez)))}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;const{id:r,timestamp:n}=this.queue.shift();r&&this.success[r]||this.getSession(n,this.skuToken,i=>{i?this.errorCb(i):r&&(this.success[r]=!0)},i)}},eG=ej.getSessionAPI.bind(ej),eZ=new Set,e$="mapbox-tiles";let eq,eX,eW=500,eH=50;function eK(){p.caches&&!eq&&(eq=p.caches.open(e$))}function eY(i){const r=i.indexOf("?");return r<0?i:i.slice(0,r)}let eJ=1/0;const eQ={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(eQ);class e0 extends Error{constructor(i,r,n){401===r&&eP(n)&&(i+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),super(i),this.status=r,this.url=n}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const e1=ed()?()=>self.worker&&self.worker.referrer:()=>("blob:"===p.location.protocol?p.parent:p).location.href,e2=function(i,r){var n;if(!(/^file:/.test(n=i.url)||/^file:/.test(e1())&&!/^\w+:/.test(n))){if(p.fetch&&p.Request&&p.AbortController&&p.Request.prototype.hasOwnProperty("signal"))return function(i,r){var n;const o=new p.AbortController,s=new p.Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:e1(),signal:o.signal});let a=!1,l=!1;const c=(n=s.url).indexOf("sku=")>0&&eP(n);"json"===i.type&&s.headers.set("Accept","application/json");const h=(n,o,a)=>{if(l)return;if(n&&"SecurityError"!==n.message&&eh(n),o&&a)return u(o);const h=Date.now();p.fetch(s).then(n=>{if(n.ok){const o=c?n.clone():null;return u(n,o,h)}return r(new e0(n.statusText,n.status,i.url))}).catch(i=>{20!==i.code&&r(Error(i.message))})},u=(n,o,c)=>{("arrayBuffer"===i.type?n.arrayBuffer():"json"===i.type?n.json():n.text()).then(i=>{l||(o&&c&&function(i,r,n){if(eK(),!eq)return;const o={status:r.status,statusText:r.statusText,headers:new p.Headers};r.headers.forEach((i,r)=>o.headers.set(r,i));const s=ep(r.headers.get("Cache-Control")||"");s["no-store"]||(s["max-age"]&&o.headers.set("Expires",new Date(n+1e3*s["max-age"]).toUTCString()),new Date(o.headers.get("Expires")).getTime()-n<42e4||function(i,r){if(void 0===eX)try{new Response(new ReadableStream),eX=!0}catch(n){eX=!1}eX?r(i.body):i.blob().then(r)}(r,r=>{const n=new p.Response(r,o);eK(),eq&&eq.then(r=>r.put(eY(i.url),n)).catch(i=>eh(i.message))}))}(s,o,c),a=!0,r(null,i,n.headers.get("Cache-Control"),n.headers.get("Expires")))}).catch(i=>{l||r(Error(i.message))})};return c?function(i,r){if(eK(),!eq)return r(null);const n=eY(i.url);eq.then(i=>{i.match(n).then(o=>{const s=function(i){if(!i)return!1;const r=new Date(i.headers.get("Expires")||0),n=ep(i.headers.get("Cache-Control")||"");return r>Date.now()&&!n["no-cache"]}(o);i.delete(n),s&&i.put(n,o.clone()),r(null,o,s)}).catch(r)}).catch(r)}(s,h):h(null,null),{cancel(){l=!0,a||o.abort()}}}(i,r);if(ed()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,r,void 0,!0)}return function(i,r){const n=new p.XMLHttpRequest;for(const o in n.open(i.method||"GET",i.url,!0),"arrayBuffer"===i.type&&(n.responseType="arraybuffer"),i.headers)n.setRequestHeader(o,i.headers[o]);return"json"===i.type&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===i.credentials,n.onerror=()=>{r(Error(n.statusText))},n.onload=()=>{if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let o=n.response;if("json"===i.type)try{o=JSON.parse(n.response)}catch(s){return r(s)}r(null,o,n.getResponseHeader("Cache-Control"),n.getResponseHeader("Expires"))}else r(new e0(n.statusText,n.status,i.url))},n.send(i.body),{cancel:()=>n.abort()}}(i,r)},e3=function(i,r){return e2(J(i,{type:"arrayBuffer"}),r)},e5=function(i,r){return e2(J(i,{method:"POST"}),r)},e4=function(i,r){return e2(J(i,{method:"GET"}),r)},e6="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";n=[],o=0;const e8=function(i,r){if(eE.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),o>=eb.MAX_PARALLEL_IMAGE_REQUESTS){const s={requestParameters:i,callback:r,cancelled:!1,cancel(){this.cancelled=!0}};return n.push(s),s}o++;let a=!1;const l=()=>{if(!a)for(a=!0,o--;n.length&&o{l(),i?r(i):n&&(p.createImageBitmap?function(i,r){const n=new p.Blob([new Uint8Array(i)],{type:"image/png"});p.createImageBitmap(n).then(i=>{r(null,i)}).catch(i=>{r(Error(`Could not load image because of ${i.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(n,(i,n)=>r(i,n,o,s)):function(i,r){const n=new p.Image,o=p.URL;n.onload=()=>{r(null,n),o.revokeObjectURL(n.src),n.onload=null,p.requestAnimationFrame(()=>{n.src=e6})},n.onerror=()=>r(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const s=new p.Blob([new Uint8Array(i)],{type:"image/png"});n.src=i.byteLength?o.createObjectURL(s):e6}(n,(i,n)=>r(i,n,o,s)))});return{cancel(){c.cancel(),l()}}};function e9(i,r,n){n[i]&&-1!==n[i].indexOf(r)||(n[i]=n[i]||[],n[i].push(r))}function e7(i,r,n){if(n&&n[i]){const o=n[i].indexOf(r);-1!==o&&n[i].splice(o,1)}}class te{constructor(i,r={}){J(this,r),this.type=i}}class tt extends te{constructor(i,r={}){super("error",J({error:i},r))}}class ti{on(i,r){return this._listeners=this._listeners||{},e9(i,r,this._listeners),this}off(i,r){return e7(i,r,this._listeners),e7(i,r,this._oneTimeListeners),this}once(i,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},e9(i,r,this._oneTimeListeners),this):new Promise(r=>this.once(i,r))}fire(i,r){"string"==typeof i&&(i=new te(i,r||{}));const n=i.type;if(this.listens(n)){i.target=this;const o=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const s of o)s.call(this,i);const a=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const l of a)e7(n,l,this._oneTimeListeners),l.call(this,i);const c=this._eventedParent;c&&(J(i,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),c.fire(i))}else i instanceof tt&&console.error(i.error);return this}listens(i){return!!(this._listeners&&this._listeners[i]&&this._listeners[i].length>0||this._oneTimeListeners&&this._oneTimeListeners[i]&&this._oneTimeListeners[i].length>0||this._eventedParent&&this._eventedParent.listens(i))}setEventedParent(i,r){return this._eventedParent=i,this._eventedParentData=r,this}}var tr=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":{},"mapbox":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":{},"line":{},"line-center":{}},"default":"point","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"units":"factor of the original icon size","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":{},"width":{},"height":{},"both":{}},"default":"none","requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"units":"pixels","requires":["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","units":"ems","default":0,"requires":["text-field"],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["text-field",{"!":"text-variable-anchor"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"units":"degrees","requires":["text-field",{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","units":"ems","length":2,"default":[0,0],"requires":["text-field",{"!":"text-radial-offset"}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{},"within":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":0.1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"cross-faded"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}},"property-type":{"data-driven":{"type":"property-type"},"cross-faded":{"type":"property-type"},"cross-faded-data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');class tn{constructor(i,r,n,o){this.message=(i?`${i}: `:"")+n,o&&(this.identifier=o),null!=r&&r.__line__&&(this.line=r.__line__)}}function to(i){const r=i.value;return r?[new tn(i.key,r,"constants have been deprecated as of v8")]:[]}function ts(i,...r){for(const n of r)for(const o in n)i[o]=n[o];return i}function ta(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function tl(i){if(Array.isArray(i))return i.map(tl);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const r={};for(const n in i)r[n]=tl(i[n]);return r}return ta(i)}class tc extends Error{constructor(i,r){super(r),this.message=r,this.key=i}}class th{constructor(i,r=[]){for(const[n,o]of(this.parent=i,this.bindings={},r))this.bindings[n]=o}concat(i){return new th(this,i)}get(i){if(this.bindings[i])return this.bindings[i];if(this.parent)return this.parent.get(i);throw Error(`${i} not found in scope.`)}has(i){return!!this.bindings[i]||!!this.parent&&this.parent.has(i)}}const tu={kind:"null"},td={kind:"number"},tp={kind:"string"},tf={kind:"boolean"},tm={kind:"color"},t_={kind:"object"},tg={kind:"value"},ty={kind:"collator"},tx={kind:"formatted"},tv={kind:"resolvedImage"};function tb(i,r){return{kind:"array",itemType:i,N:r}}function tw(i){if("array"===i.kind){const r=tw(i.itemType);return"number"==typeof i.N?`array<${r}, ${i.N}>`:"value"===i.itemType.kind?"array":`array<${r}>`}return i.kind}const tT=[tu,td,tp,tf,tm,tx,t_,tb(tg),tv];function tE(i,r){if("error"===r.kind)return null;if("array"===i.kind){if("array"===r.kind&&(0===r.N&&"value"===r.itemType.kind||!tE(i.itemType,r.itemType))&&("number"!=typeof i.N||i.N===r.N))return null}else{if(i.kind===r.kind)return null;if("value"===i.kind){for(const n of tT)if(!tE(n,r))return null}}return`Expected ${tw(i)} but found ${tw(r)} instead.`}function tS(i,r){return r.some(r=>r.kind===i.kind)}function tI(i,r){return r.some(r=>"null"===r?null===i:"array"===r?Array.isArray(i):"object"===r?i&&!Array.isArray(i)&&"object"==typeof i:r===typeof i)}function tM(i){var r={exports:{}};return i(r,r.exports),r.exports}var tA=tM(function(i,r){var n={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function o(i){return(i=Math.round(i))<0?0:i>255?255:i}function s(i){return o("%"===i[i.length-1]?parseFloat(i)/100*255:parseInt(i))}function a(i){var r;return(r="%"===i[i.length-1]?parseFloat(i)/100:parseFloat(i))<0?0:r>1?1:r}function l(i,r,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?i+(r-i)*n*6:2*n<1?r:3*n<2?i+(r-i)*(2/3-n)*6:i}try{r.parseCSSColor=function(i){var r,c=i.replace(/ /g,"").toLowerCase();if(c in n)return n[c].slice();if("#"===c[0])return 4===c.length?(r=parseInt(c.substr(1),16))>=0&&r<=4095?[(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,1]:null:7===c.length&&(r=parseInt(c.substr(1),16))>=0&&r<=16777215?[(16711680&r)>>16,(65280&r)>>8,255&r,1]:null;var h=c.indexOf("("),u=c.indexOf(")");if(-1!==h&&u+1===c.length){var d=c.substr(0,h),p=c.substr(h+1,u-(h+1)).split(","),f=1;switch(d){case"rgba":if(4!==p.length)break;f=a(p.pop());case"rgb":return 3!==p.length?null:[s(p[0]),s(p[1]),s(p[2]),f];case"hsla":if(4!==p.length)break;f=a(p.pop());case"hsl":if(3!==p.length)break;var m=(parseFloat(p[0])%360+360)%360/360,_=a(p[1]),g=a(p[2]),y=g<=.5?g*(_+1):g+_-g*_,x=2*g-y;return[o(255*l(x,y,m+1/3)),o(255*l(x,y,m)),o(255*l(x,y,m-1/3)),f]}}return null}}catch(c){}});class tC{constructor(i,r,n,o=1){this.r=i,this.g=r,this.b=n,this.a=o}static parse(i){if(!i)return;if(i instanceof tC)return i;if("string"!=typeof i)return;const r=tA.parseCSSColor(i);return r?new tC(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){const[i,r,n,o]=this.toArray();return`rgba(${Math.round(i)},${Math.round(r)},${Math.round(n)},${o})`}toArray(){const{r:i,g:r,b:n,a:o}=this;return 0===o?[0,0,0,0]:[255*i/o,255*r/o,255*n/o,o]}}tC.black=new tC(0,0,0,1),tC.white=new tC(1,1,1,1),tC.transparent=new tC(0,0,0,0),tC.red=new tC(1,0,0,1),tC.blue=new tC(0,0,1,1);class tz{constructor(i,r,n){this.sensitivity=i?r?"variant":"case":r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(i,r){return this.collator.compare(i,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class tk{constructor(i,r,n,o,s){this.text=i.normalize?i.normalize():i,this.image=r,this.scale=n,this.fontStack=o,this.textColor=s}}class tP{constructor(i){this.sections=i}static fromString(i){return new tP([new tk(i,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(i=>0!==i.text.length||i.image&&0!==i.image.name.length)}static factory(i){return i instanceof tP?i:tP.fromString(i)}toString(){return 0===this.sections.length?"":this.sections.map(i=>i.text).join("")}serialize(){const i=["format"];for(const r of this.sections){if(r.image){i.push(["image",r.image.name]);continue}i.push(r.text);const n={};r.fontStack&&(n["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(n["font-scale"]=r.scale),r.textColor&&(n["text-color"]=["rgba"].concat(r.textColor.toArray())),i.push(n)}return i}}class tD{constructor(i){this.name=i.name,this.available=i.available}toString(){return this.name}static fromString(i){return i?new tD({name:i,available:!1}):null}serialize(){return["image",this.name]}}function tL(i,r,n,o){return"number"==typeof i&&i>=0&&i<=255&&"number"==typeof r&&r>=0&&r<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===o||"number"==typeof o&&o>=0&&o<=1?null:`Invalid rgba value [${[i,r,n,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof o?[i,r,n,o]:[i,r,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function tB(i){if(null===i||"string"==typeof i||"boolean"==typeof i||"number"==typeof i||i instanceof tC||i instanceof tz||i instanceof tP||i instanceof tD)return!0;if(Array.isArray(i)){for(const r of i)if(!tB(r))return!1;return!0}if("object"==typeof i){for(const n in i)if(!tB(i[n]))return!1;return!0}return!1}function tR(i){if(null===i)return tu;if("string"==typeof i)return tp;if("boolean"==typeof i)return tf;if("number"==typeof i)return td;if(i instanceof tC)return tm;if(i instanceof tz)return ty;if(i instanceof tP)return tx;if(i instanceof tD)return tv;if(Array.isArray(i)){let r;const n=i.length;for(const o of i){const s=tR(o);if(r){if(r===s)continue;r=tg;break}r=s}return tb(r||tg,n)}return t_}function tF(i){const r=typeof i;return null===i?"":"string"===r||"number"===r||"boolean"===r?String(i):i instanceof tC||i instanceof tP||i instanceof tD?i.toString():JSON.stringify(i)}class tO{constructor(i,r){this.type=i,this.value=r}static parse(i,r){if(2!==i.length)return r.error(`'literal' expression requires exactly one argument, but found ${i.length-1} instead.`);if(!tB(i[1]))return r.error("invalid value");const n=i[1];let o=tR(n);const s=r.expectedType;return"array"===o.kind&&0===o.N&&s&&"array"===s.kind&&("number"!=typeof s.N||0===s.N)&&(o=s),new tO(o,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof tC?["rgba"].concat(this.value.toArray()):this.value instanceof tP?this.value.serialize():this.value}}class tU{constructor(i){this.name="ExpressionEvaluationError",this.message=i}toJSON(){return this.message}}const tV={string:tp,number:td,boolean:tf,object:t_};class tN{constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");let n,o=1;const s=i[0];if("array"===s){let a,l;if(i.length>2){const c=i[1];if("string"!=typeof c||!(c in tV)||"object"===c)return r.error('The item type argument of "array" must be one of string, number, boolean',1);a=tV[c],o++}else a=tg;if(i.length>3){if(null!==i[2]&&("number"!=typeof i[2]||i[2]<0||i[2]!==Math.floor(i[2])))return r.error('The length argument to "array" must be a positive integer literal',2);l=i[2],o++}n=tb(a,l)}else n=tV[s];const h=[];for(;oi.outputDefined())}serialize(){const i=this.type,r=[i.kind];if("array"===i.kind){const n=i.itemType;if("string"===n.kind||"number"===n.kind||"boolean"===n.kind){r.push(n.kind);const o=i.N;("number"==typeof o||this.args.length>1)&&r.push(o)}}return r.concat(this.args.map(i=>i.serialize()))}}class tj{constructor(i){this.type=tx,this.sections=i}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");const n=i[1];if(!Array.isArray(n)&&"object"==typeof n)return r.error("First argument must be an image or text section.");const o=[];let s=!1;for(let a=1;a<=i.length-1;++a){const l=i[a];if(s&&"object"==typeof l&&!Array.isArray(l)){s=!1;let c=null;if(l["font-scale"]&&!(c=r.parse(l["font-scale"],1,td)))return null;let h=null;if(l["text-font"]&&!(h=r.parse(l["text-font"],1,tb(tp))))return null;let u=null;if(l["text-color"]&&!(u=r.parse(l["text-color"],1,tm)))return null;const d=o[o.length-1];d.scale=c,d.font=h,d.textColor=u}else{const p=r.parse(i[a],1,tg);if(!p)return null;const f=p.type.kind;if("string"!==f&&"value"!==f&&"null"!==f&&"resolvedImage"!==f)return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");s=!0,o.push({content:p,scale:null,font:null,textColor:null})}}return new tj(o)}evaluate(i){return new tP(this.sections.map(r=>{const n=r.content.evaluate(i);return tR(n)===tv?new tk("",n,null,null,null):new tk(tF(n),null,r.scale?r.scale.evaluate(i):null,r.font?r.font.evaluate(i).join(","):null,r.textColor?r.textColor.evaluate(i):null)}))}eachChild(i){for(const r of this.sections)i(r.content),r.scale&&i(r.scale),r.font&&i(r.font),r.textColor&&i(r.textColor)}outputDefined(){return!1}serialize(){const i=["format"];for(const r of this.sections){i.push(r.content.serialize());const n={};r.scale&&(n["font-scale"]=r.scale.serialize()),r.font&&(n["text-font"]=r.font.serialize()),r.textColor&&(n["text-color"]=r.textColor.serialize()),i.push(n)}return i}}class tG{constructor(i){this.type=tv,this.input=i}static parse(i,r){if(2!==i.length)return r.error("Expected two arguments.");const n=r.parse(i[1],1,tp);return n?new tG(n):r.error("No image name provided.")}evaluate(i){const r=this.input.evaluate(i),n=tD.fromString(r);return n&&i.availableImages&&(n.available=i.availableImages.indexOf(r)>-1),n}eachChild(i){i(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const tZ={"to-boolean":tf,"to-color":tm,"to-number":td,"to-string":tp};class t${constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");const n=i[0];if(("to-boolean"===n||"to-string"===n)&&2!==i.length)return r.error("Expected one argument.");const o=tZ[n],s=[];for(let a=1;a4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:tL(r[0],r[1],r[2],r[3])))return new tC(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new tU(n||`Could not parse color from value '${"string"==typeof r?r:String(JSON.stringify(r))}'`)}if("number"===this.type.kind){let a=null;for(const l of this.args){if(null===(a=l.evaluate(i)))return 0;const c=Number(a);if(!isNaN(c))return c}throw new tU(`Could not convert ${JSON.stringify(a)} to number.`)}return"formatted"===this.type.kind?tP.fromString(tF(this.args[0].evaluate(i))):"resolvedImage"===this.type.kind?tD.fromString(tF(this.args[0].evaluate(i))):tF(this.args[0].evaluate(i))}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){if("formatted"===this.type.kind)return new tj([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new tG(this.args[0]).serialize();const i=[`to-${this.type.kind}`];return this.eachChild(r=>{i.push(r.serialize())}),i}}const tq=["Unknown","Point","LineString","Polygon"];class tX{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?tq[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const i=this.featureDistanceData.center,r=this.featureDistanceData.scale,{x:n,y:o}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(n*r-i[0])+this.featureDistanceData.bearing[1]*(o*r-i[1])}return 0}parseColor(i){let r=this._parseColorCache[i];return r||(r=this._parseColorCache[i]=tC.parse(i)),r}}class tW{constructor(i,r,n,o){this.name=i,this.type=r,this._evaluate=n,this.args=o}evaluate(i){return this._evaluate(i,this.args)}eachChild(i){this.args.forEach(i)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(i=>i.serialize()))}static parse(i,r){const n=i[0],o=tW.definitions[n];if(!o)return r.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const s=Array.isArray(o)?o[0]:o.type,a=Array.isArray(o)?[[o[1],o[2]]]:o.overloads,l=a.filter(([r])=>!Array.isArray(r)||r.length===i.length-1);let c=null;for(const[h,u]of l){c=new it(r.registry,r.path,null,r.scope);const d=[];let p=!1;for(let f=1;fArray.isArray(i)?`(${i.map(tw).join(", ")})`:`(${tw(i.type)}...)`).join(" | "),w=[];for(let T=1;T=r[2]||i[1]<=r[1]||i[3]>=r[3])}function tJ(i,r){var n,o;let s=!1;for(let a=0,l=r.length;ai[1]!=(o=c[h+1])[1]>i[1]&&i[0]<(o[0]-n[0])*(i[1]-n[1])/(o[1]-n[1])+n[0]&&(s=!s)}}return s}function tQ(i,r,n,o){const s=o[0]-n[0],a=o[1]-n[1],l=(i[0]-n[0])*a-s*(i[1]-n[1]),c=(r[0]-n[0])*a-s*(r[1]-n[1]);return l>0&&c<0||l<0&&c>0}function t0(i,r){for(let n=0;nn[2]){const s=.5*o;let a=i[0]-n[0]>s?-o:n[0]-i[0]>s?o:0;0===a&&(a=i[0]-n[2]>s?-o:n[2]-i[0]>s?o:0),i[0]+=a}tK(r,i)}function t5(i,r,n,o){const s=8192*Math.pow(2,o.z),a=[8192*o.x,8192*o.y],l=[];for(const c of i)for(const h of c){const u=[h.x+a[0],h.y+a[1]];t3(u,r,n,s),l.push(u)}return l}function t4(i,r,n,o){var s;const a=8192*Math.pow(2,o.z),l=[8192*o.x,8192*o.y],c=[];for(const h of i){const u=[];for(const d of h){const p=[d.x+l[0],d.y+l[1]];tK(r,p),u.push(p)}c.push(u)}if(r[2]-r[0]<=a/2)for(const f of((s=r)[0]=s[1]=1/0,s[2]=s[3]=-1/0,c))for(const m of f)t3(m,r,n,a);return c}class t6{constructor(i,r){this.type=tf,this.geojson=i,this.geometries=r}static parse(i,r){if(2!==i.length)return r.error(`'within' expression requires exactly one argument, but found ${i.length-1} instead.`);if(tB(i[1])){const n=i[1];if("FeatureCollection"===n.type)for(let o=0;o{r&&!t8(i)&&(r=!1)}),r}function t9(i){if(i instanceof tW&&"feature-state"===i.name)return!1;let r=!0;return i.eachChild(i=>{r&&!t9(i)&&(r=!1)}),r}function t7(i,r){if(i instanceof tW&&r.indexOf(i.name)>=0)return!1;let n=!0;return i.eachChild(i=>{n&&!t7(i,r)&&(n=!1)}),n}class ie{constructor(i,r){this.type=r.type,this.name=i,this.boundExpression=r}static parse(i,r){if(2!==i.length||"string"!=typeof i[1])return r.error("'var' expression requires exactly one string literal argument.");const n=i[1];return r.scope.has(n)?new ie(n,r.scope.get(n)):r.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(i){return this.boundExpression.evaluate(i)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class it{constructor(i,r=[],n,o=new th,s=[]){this.registry=i,this.path=r,this.key=r.map(i=>`[${i}]`).join(""),this.scope=o,this.errors=s,this.expectedType=n}parse(i,r,n,o,s={}){return r?this.concat(r,n,o)._parse(i,s):this._parse(i,s)}_parse(i,r){function n(i,r,n){return"assert"===n?new tN(r,[i]):"coerce"===n?new t$(r,[i]):i}if(null!==i&&"string"!=typeof i&&"boolean"!=typeof i&&"number"!=typeof i||(i=["literal",i]),Array.isArray(i)){if(0===i.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const o=i[0];if("string"!=typeof o)return this.error(`Expression name must be a string, but found ${typeof o} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const s=this.registry[o];if(s){let a=s.parse(i,this);if(!a)return null;if(this.expectedType){const l=this.expectedType,c=a.type;if("string"!==l.kind&&"number"!==l.kind&&"boolean"!==l.kind&&"object"!==l.kind&&"array"!==l.kind||"value"!==c.kind){if("color"!==l.kind&&"formatted"!==l.kind&&"resolvedImage"!==l.kind||"value"!==c.kind&&"string"!==c.kind){if(this.checkSubtype(l,c))return null}else a=n(a,l,r.typeAnnotation||"coerce")}else a=n(a,l,r.typeAnnotation||"assert")}if(!(a instanceof tO)&&"resolvedImage"!==a.type.kind&&function i(r){if(r instanceof ie)return i(r.boundExpression);if(r instanceof tW&&"error"===r.name||r instanceof tH||r instanceof t6)return!1;const n=r instanceof t$||r instanceof tN;let o=!0;return r.eachChild(r=>{o=n?o&&i(r):o&&r instanceof tO}),!!o&&t8(r)&&t7(r,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}(a)){const h=new tX;try{a=new tO(a.type,a.evaluate(h))}catch(u){return this.error(u.message),null}}return a}return this.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===i?"'undefined' value invalid. Use null instead.":"object"==typeof i?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof i} instead.`)}concat(i,r,n){const o="number"==typeof i?this.path.concat(i):this.path,s=n?this.scope.concat(n):this.scope;return new it(this.registry,o,r||null,s,this.errors)}error(i,...r){const n=`${this.key}${r.map(i=>`[${i}]`).join("")}`;this.errors.push(new tc(n,i))}checkSubtype(i,r){const n=tE(i,r);return n&&this.error(n),n}}function ii(i,r){const n=i.length-1;let o,s,a=0,l=n,c=0;for(;a<=l;)if(o=i[c=Math.floor((a+l)/2)],s=i[c+1],o<=r){if(c===n||rr))throw new tU("Input is not a number.");l=c-1}return 0}class ir{constructor(i,r,n){for(const[o,s]of(this.type=i,this.input=r,this.labels=[],this.outputs=[],n))this.labels.push(o),this.outputs.push(s)}static parse(i,r){if(i.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return r.error("Expected an even number of arguments.");const n=r.parse(i[1],1,td);if(!n)return null;const o=[];let s=null;r.expectedType&&"value"!==r.expectedType.kind&&(s=r.expectedType);for(let a=1;a=l)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',h);const d=r.parse(c,u,s);if(!d)return null;s=s||d.type,o.push([l,d])}return new ir(s,n,o)}evaluate(i){const r=this.labels,n=this.outputs;if(1===r.length)return n[0].evaluate(i);const o=this.input.evaluate(i);if(o<=r[0])return n[0].evaluate(i);const s=r.length;return o>=r[s-1]?n[s-1].evaluate(i):n[ii(r,o)].evaluate(i)}eachChild(i){for(const r of(i(this.input),this.outputs))i(r)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}serialize(){const i=["step",this.input.serialize()];for(let r=0;r0&&i.push(this.labels[r]),i.push(this.outputs[r].serialize());return i}}function io(i,r,n){return i*(1-n)+r*n}var is=Object.freeze({__proto__:null,number:io,color:function(i,r,n){return new tC(io(i.r,r.r,n),io(i.g,r.g,n),io(i.b,r.b,n),io(i.a,r.a,n))},array:function(i,r,n){return i.map((i,o)=>io(i,r[o],n))}});const ia=4/29,il=6/29,ic=3*il*il,ih=Math.PI/180,iu=180/Math.PI;function id(i){return i>.008856451679035631?Math.pow(i,1/3):i/ic+ia}function ip(i){return i>il?i*i*i:ic*(i-ia)}function im(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function i_(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function ig(i){const r=i_(i.r),n=i_(i.g),o=i_(i.b),s=id((.4124564*r+.3575761*n+.1804375*o)/.95047),a=id((.2126729*r+.7151522*n+.072175*o)/1);return{l:116*a-16,a:500*(s-a),b:200*(a-id((.0193339*r+.119192*n+.9503041*o)/1.08883)),alpha:i.a}}function iy(i){let r=(i.l+16)/116,n=isNaN(i.a)?r:r+i.a/500,o=isNaN(i.b)?r:r-i.b/200;return r=1*ip(r),n=.95047*ip(n),o=1.08883*ip(o),new tC(im(3.2404542*n-1.5371385*r-.4985314*o),im(-.969266*n+1.8760108*r+.041556*o),im(.0556434*n-.2040259*r+1.0572252*o),i.alpha)}const ix={forward:ig,reverse:iy,interpolate:function(i,r,n){return{l:io(i.l,r.l,n),a:io(i.a,r.a,n),b:io(i.b,r.b,n),alpha:io(i.alpha,r.alpha,n)}}},iv={forward:function(i){const{l:r,a:n,b:o}=ig(i),s=Math.atan2(o,n)*iu;return{h:s<0?s+360:s,c:Math.sqrt(n*n+o*o),l:r,alpha:i.a}},reverse:function(i){const r=i.h*ih,n=i.c;return iy({l:i.l,a:Math.cos(r)*n,b:Math.sin(r)*n,alpha:i.alpha})},interpolate:function(i,r,n){return{h:function(i,r,n){const o=r-i;return i+n*(o>180||o<-180?o-360*Math.round(o/360):o)}(i.h,r.h,n),c:io(i.c,r.c,n),l:io(i.l,r.l,n),alpha:io(i.alpha,r.alpha,n)}}};var ib=Object.freeze({__proto__:null,lab:ix,hcl:iv});class iw{constructor(i,r,n,o,s){for(const[a,l]of(this.type=i,this.operator=r,this.interpolation=n,this.input=o,this.labels=[],this.outputs=[],s))this.labels.push(a),this.outputs.push(l)}static interpolationFactor(i,r,n,o){let s=0;if("exponential"===i.name)s=iT(r,i.base,n,o);else if("linear"===i.name)s=iT(r,1,n,o);else if("cubic-bezier"===i.name){const a=i.controlPoints;s=new h(a[0],a[1],a[2],a[3]).solve(iT(r,1,n,o))}return s}static parse(i,r){let[n,o,s,...a]=i;if(!Array.isArray(o)||0===o.length)return r.error("Expected an interpolation type expression.",1);if("linear"===o[0])o={name:"linear"};else if("exponential"===o[0]){const l=o[1];if("number"!=typeof l)return r.error("Exponential interpolation requires a numeric base.",1,1);o={name:"exponential",base:l}}else{if("cubic-bezier"!==o[0])return r.error(`Unknown interpolation type ${String(o[0])}`,1,0);{const c=o.slice(1);if(4!==c.length||c.some(i=>"number"!=typeof i||i<0||i>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);o={name:"cubic-bezier",controlPoints:c}}}if(i.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(!(s=r.parse(s,2,td)))return null;const h=[];let u=null;"interpolate-hcl"===n||"interpolate-lab"===n?u=tm:r.expectedType&&"value"!==r.expectedType.kind&&(u=r.expectedType);for(let d=0;d=p)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',m);const g=r.parse(f,_,u);if(!g)return null;u=u||g.type,h.push([p,g])}return"number"===u.kind||"color"===u.kind||"array"===u.kind&&"number"===u.itemType.kind&&"number"==typeof u.N?new iw(u,n,o,s,h):r.error(`Type ${tw(u)} is not interpolatable.`)}evaluate(i){const r=this.labels,n=this.outputs;if(1===r.length)return n[0].evaluate(i);const o=this.input.evaluate(i);if(o<=r[0])return n[0].evaluate(i);const s=r.length;if(o>=r[s-1])return n[s-1].evaluate(i);const a=ii(r,o),l=iw.interpolationFactor(this.interpolation,o,r[a],r[a+1]),c=n[a].evaluate(i),h=n[a+1].evaluate(i);return"interpolate"===this.operator?is[this.type.kind.toLowerCase()](c,h,l):"interpolate-hcl"===this.operator?iv.reverse(iv.interpolate(iv.forward(c),iv.forward(h),l)):ix.reverse(ix.interpolate(ix.forward(c),ix.forward(h),l))}eachChild(i){for(const r of(i(this.input),this.outputs))i(r)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}serialize(){let i;i="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const r=[this.operator,i,this.input.serialize()];for(let n=0;ntE(o,i.type));return new iE(c?tg:n,s)}evaluate(i){let r,n=null,o=0;for(const s of this.args){if(o++,(n=s.evaluate(i))&&n instanceof tD&&!n.available&&(r||(r=n),n=null,o===this.args.length))return r;if(null!==n)break}return n}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){const i=["coalesce"];return this.eachChild(r=>{i.push(r.serialize())}),i}}class iS{constructor(i,r){this.type=r.type,this.bindings=[].concat(i),this.result=r}evaluate(i){return this.result.evaluate(i)}eachChild(i){for(const r of this.bindings)i(r[1]);i(this.result)}static parse(i,r){if(i.length<4)return r.error(`Expected at least 3 arguments, but found ${i.length-1} instead.`);const n=[];for(let o=1;o=n.length)throw new tU(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new tU(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(i){i(this.index),i(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class iM{constructor(i,r){this.type=tf,this.needle=i,this.haystack=r}static parse(i,r){if(3!==i.length)return r.error(`Expected 2 arguments, but found ${i.length-1} instead.`);const n=r.parse(i[1],1,tg),o=r.parse(i[2],2,tg);return n&&o?tS(n.type,[tf,tp,td,tu,tg])?new iM(n,o):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${tw(n.type)} instead`):null}evaluate(i){const r=this.needle.evaluate(i),n=this.haystack.evaluate(i);if(!n)return!1;if(!tI(r,["boolean","string","number","null"]))throw new tU(`Expected first argument to be of type boolean, string, number or null, but found ${tw(tR(r))} instead.`);if(!tI(n,["string","array"]))throw new tU(`Expected second argument to be of type array or string, but found ${tw(tR(n))} instead.`);return n.indexOf(r)>=0}eachChild(i){i(this.needle),i(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class iA{constructor(i,r,n){this.type=td,this.needle=i,this.haystack=r,this.fromIndex=n}static parse(i,r){if(i.length<=2||i.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);const n=r.parse(i[1],1,tg),o=r.parse(i[2],2,tg);if(!n||!o)return null;if(!tS(n.type,[tf,tp,td,tu,tg]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${tw(n.type)} instead`);if(4===i.length){const s=r.parse(i[3],3,td);return s?new iA(n,o,s):null}return new iA(n,o)}evaluate(i){const r=this.needle.evaluate(i),n=this.haystack.evaluate(i);if(!tI(r,["boolean","string","number","null"]))throw new tU(`Expected first argument to be of type boolean, string, number or null, but found ${tw(tR(r))} instead.`);if(!tI(n,["string","array"]))throw new tU(`Expected second argument to be of type array or string, but found ${tw(tR(n))} instead.`);if(this.fromIndex){const o=this.fromIndex.evaluate(i);return n.indexOf(r,o)}return n.indexOf(r)}eachChild(i){i(this.needle),i(this.haystack),this.fromIndex&&i(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const i=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),i]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class iC{constructor(i,r,n,o,s,a){this.inputType=i,this.type=r,this.input=n,this.cases=o,this.outputs=s,this.otherwise=a}static parse(i,r){let n,o;if(i.length<5)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if(i.length%2!=1)return r.error("Expected an even number of arguments.");r.expectedType&&"value"!==r.expectedType.kind&&(o=r.expectedType);const s={},a=[];for(let l=2;lNumber.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof d&&Math.floor(d)!==d)return u.error("Numeric branch labels must be integer values.");if(n){if(u.checkSubtype(n,tR(d)))return null}else n=tR(d);if(void 0!==s[String(d)])return u.error("Branch labels must be unique.");s[String(d)]=a.length}const p=r.parse(h,l,o);if(!p)return null;o=o||p.type,a.push(p)}const f=r.parse(i[1],1,tg);if(!f)return null;const m=r.parse(i[i.length-1],i.length-1,o);return m?"value"!==f.type.kind&&r.concat(1).checkSubtype(n,f.type)?null:new iC(n,o,f,s,a,m):null}evaluate(i){const r=this.input.evaluate(i);return(tR(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(i)}eachChild(i){i(this.input),this.outputs.forEach(i),i(this.otherwise)}outputDefined(){return this.outputs.every(i=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){const i=["match",this.input.serialize()],r=Object.keys(this.cases).sort(),n=[],o={};for(const s of r){const a=o[this.cases[s]];void 0===a?(o[this.cases[s]]=n.length,n.push([this.cases[s],[s]])):n[a][1].push(s)}const l=i=>"number"===this.inputType.kind?Number(i):i;for(const[c,h]of n)i.push(1===h.length?l(h[0]):h.map(l)),i.push(this.outputs[c].serialize());return i.push(this.otherwise.serialize()),i}}class iz{constructor(i,r,n){this.type=i,this.branches=r,this.otherwise=n}static parse(i,r){let n;if(i.length<4)return r.error(`Expected at least 3 arguments, but found only ${i.length-1}.`);if(i.length%2!=0)return r.error("Expected an odd number of arguments.");r.expectedType&&"value"!==r.expectedType.kind&&(n=r.expectedType);const o=[];for(let s=1;sr.outputDefined())&&this.otherwise.outputDefined()}serialize(){const i=["case"];return this.eachChild(r=>{i.push(r.serialize())}),i}}class ik{constructor(i,r,n,o){this.type=i,this.input=r,this.beginIndex=n,this.endIndex=o}static parse(i,r){if(i.length<=2||i.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);const n=r.parse(i[1],1,tg),o=r.parse(i[2],2,td);if(!n||!o)return null;if(!tS(n.type,[tb(tg),tp,tg]))return r.error(`Expected first argument to be of type array or string, but found ${tw(n.type)} instead`);if(4===i.length){const s=r.parse(i[3],3,td);return s?new ik(n.type,n,o,s):null}return new ik(n.type,n,o)}evaluate(i){const r=this.input.evaluate(i),n=this.beginIndex.evaluate(i);if(!tI(r,["string","array"]))throw new tU(`Expected first argument to be of type array or string, but found ${tw(tR(r))} instead.`);if(this.endIndex){const o=this.endIndex.evaluate(i);return r.slice(n,o)}return r.slice(n)}eachChild(i){i(this.input),i(this.beginIndex),this.endIndex&&i(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const i=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),i]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function iP(i,r){return"=="===i||"!="===i?"boolean"===r.kind||"string"===r.kind||"number"===r.kind||"null"===r.kind||"value"===r.kind:"string"===r.kind||"number"===r.kind||"value"===r.kind}function iD(i,r,n,o){return 0===o.compare(r,n)}function iL(i,r,n){const o="=="!==i&&"!="!==i;return class s{constructor(i,r,n){this.type=tf,this.lhs=i,this.rhs=r,this.collator=n,this.hasUntypedArgument="value"===i.type.kind||"value"===r.type.kind}static parse(i,r){if(3!==i.length&&4!==i.length)return r.error("Expected two or three arguments.");const n=i[0];let a=r.parse(i[1],1,tg);if(!a)return null;if(!iP(n,a.type))return r.concat(1).error(`"${n}" comparisons are not supported for type '${tw(a.type)}'.`);let l=r.parse(i[2],2,tg);if(!l)return null;if(!iP(n,l.type))return r.concat(2).error(`"${n}" comparisons are not supported for type '${tw(l.type)}'.`);if(a.type.kind!==l.type.kind&&"value"!==a.type.kind&&"value"!==l.type.kind)return r.error(`Cannot compare types '${tw(a.type)}' and '${tw(l.type)}'.`);o&&("value"===a.type.kind&&"value"!==l.type.kind?a=new tN(l.type,[a]):"value"!==a.type.kind&&"value"===l.type.kind&&(l=new tN(a.type,[l])));let c=null;if(4===i.length){if("string"!==a.type.kind&&"string"!==l.type.kind&&"value"!==a.type.kind&&"value"!==l.type.kind)return r.error("Cannot use collator to compare non-string types.");if(!(c=r.parse(i[3],3,ty)))return null}return new s(a,l,c)}evaluate(s){const a=this.lhs.evaluate(s),l=this.rhs.evaluate(s);if(o&&this.hasUntypedArgument){const c=tR(a),h=tR(l);if(c.kind!==h.kind||"string"!==c.kind&&"number"!==c.kind)throw new tU(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${c.kind}, ${h.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const u=tR(a),d=tR(l);if("string"!==u.kind||"string"!==d.kind)return r(s,a,l)}return this.collator?n(s,a,l,this.collator.evaluate(s)):r(s,a,l)}eachChild(i){i(this.lhs),i(this.rhs),this.collator&&i(this.collator)}outputDefined(){return!0}serialize(){const r=[i];return this.eachChild(i=>{r.push(i.serialize())}),r}}}const iB=iL("==",function(i,r,n){return r===n},iD),iR=iL("!=",function(i,r,n){return r!==n},function(i,r,n,o){return!iD(0,r,n,o)}),iF=iL("<",function(i,r,n){return ro.compare(r,n)}),iO=iL(">",function(i,r,n){return r>n},function(i,r,n,o){return o.compare(r,n)>0}),iU=iL("<=",function(i,r,n){return r<=n},function(i,r,n,o){return 0>=o.compare(r,n)}),iV=iL(">=",function(i,r,n){return r>=n},function(i,r,n,o){return o.compare(r,n)>=0});class iN{constructor(i,r,n,o,s){this.type=tp,this.number=i,this.locale=r,this.currency=n,this.minFractionDigits=o,this.maxFractionDigits=s}static parse(i,r){if(3!==i.length)return r.error("Expected two arguments.");const n=r.parse(i[1],1,td);if(!n)return null;const o=i[2];if("object"!=typeof o||Array.isArray(o))return r.error("NumberFormat options argument must be an object.");let s=null;if(o.locale&&!(s=r.parse(o.locale,1,tp)))return null;let a=null;if(o.currency&&!(a=r.parse(o.currency,1,tp)))return null;let l=null;if(o["min-fraction-digits"]&&!(l=r.parse(o["min-fraction-digits"],1,td)))return null;let c=null;return!o["max-fraction-digits"]||(c=r.parse(o["max-fraction-digits"],1,td))?new iN(n,s,a,l,c):null}evaluate(i){return new Intl.NumberFormat(this.locale?this.locale.evaluate(i):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(i):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(i):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(i):void 0}).format(this.number.evaluate(i))}eachChild(i){i(this.number),this.locale&&i(this.locale),this.currency&&i(this.currency),this.minFractionDigits&&i(this.minFractionDigits),this.maxFractionDigits&&i(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const i={};return this.locale&&(i.locale=this.locale.serialize()),this.currency&&(i.currency=this.currency.serialize()),this.minFractionDigits&&(i["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(i["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),i]}}class ij{constructor(i){this.type=td,this.input=i}static parse(i,r){if(2!==i.length)return r.error(`Expected 1 argument, but found ${i.length-1} instead.`);const n=r.parse(i[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?r.error(`Expected argument of type string or array, but found ${tw(n.type)} instead.`):new ij(n):null}evaluate(i){const r=this.input.evaluate(i);if("string"==typeof r||Array.isArray(r))return r.length;throw new tU(`Expected value to be of type string or array, but found ${tw(tR(r))} instead.`)}eachChild(i){i(this.input)}outputDefined(){return!1}serialize(){const i=["length"];return this.eachChild(r=>{i.push(r.serialize())}),i}}const iG={"==":iB,"!=":iR,">":iO,"<":iF,">=":iV,"<=":iU,array:tN,at:iI,boolean:tN,case:iz,coalesce:iE,collator:tH,format:tj,image:tG,in:iM,"index-of":iA,interpolate:iw,"interpolate-hcl":iw,"interpolate-lab":iw,length:ij,let:iS,literal:tO,match:iC,number:tN,"number-format":iN,object:tN,slice:ik,step:ir,string:tN,"to-boolean":t$,"to-color":t$,"to-number":t$,"to-string":t$,var:ie,within:t6};function iZ(i,[r,n,o,s]){r=r.evaluate(i),n=n.evaluate(i),o=o.evaluate(i);const a=s?s.evaluate(i):1,l=tL(r,n,o,a);if(l)throw new tU(l);return new tC(r/255*a,n/255*a,o/255*a,a)}function i$(i,r){const n=r[i];return void 0===n?null:n}function iq(i){return{type:i}}function iX(i){return{result:"success",value:i}}function iW(i){return{result:"error",value:i}}function iH(i){return"data-driven"===i["property-type"]||"cross-faded-data-driven"===i["property-type"]}function iK(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function iY(i){return!!i.expression&&i.expression.interpolated}function iJ(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":null===i?"null":typeof i}function iQ(i){return"object"==typeof i&&null!==i&&!Array.isArray(i)}function i0(i){return i}function i1(i,r,n){return void 0!==i?i:void 0!==r?r:void 0!==n?n:void 0}function i2(i,r,n,o,s){return i1(typeof n===s?o[n]:void 0,i.default,r.default)}function i3(i,r,n){if("number"!==iJ(n))return i1(i.default,r.default);const o=i.stops.length;if(1===o||n<=i.stops[0][0])return i.stops[0][1];if(n>=i.stops[o-1][0])return i.stops[o-1][1];const s=ii(i.stops.map(i=>i[0]),n);return i.stops[s][1]}function i5(i,r,n){const o=void 0!==i.base?i.base:1;if("number"!==iJ(n))return i1(i.default,r.default);const s=i.stops.length;if(1===s||n<=i.stops[0][0])return i.stops[0][1];if(n>=i.stops[s-1][0])return i.stops[s-1][1];const a=ii(i.stops.map(i=>i[0]),n),l=function(i,r,n,o){const s=o-n,a=i-n;return 0===s?0:1===r?a/s:(Math.pow(r,a)-1)/(Math.pow(r,s)-1)}(n,o,i.stops[a][0],i.stops[a+1][0]),c=i.stops[a][1],h=i.stops[a+1][1];let u=is[r.type]||i0;if(i.colorSpace&&"rgb"!==i.colorSpace){const d=ib[i.colorSpace];u=(i,r)=>d.reverse(d.interpolate(d.forward(i),d.forward(r),l))}return"function"==typeof c.evaluate?{evaluate(...i){const r=c.evaluate.apply(void 0,i),n=h.evaluate.apply(void 0,i);if(void 0!==r&&void 0!==n)return u(r,n,l)}}:u(c,h,l)}function i4(i,r,n){return"color"===r.type?n=tC.parse(n):"formatted"===r.type?n=tP.fromString(n.toString()):"resolvedImage"===r.type?n=tD.fromString(n.toString()):iJ(n)===r.type||"enum"===r.type&&r.values[n]||(n=void 0),i1(n,i.default,r.default)}tW.register(iG,{error:[{kind:"error"},[tp],(i,[r])=>{throw new tU(r.evaluate(i))}],typeof:[tp,[tg],(i,[r])=>tw(tR(r.evaluate(i)))],"to-rgba":[tb(td,4),[tm],(i,[r])=>r.evaluate(i).toArray()],rgb:[tm,[td,td,td],iZ],rgba:[tm,[td,td,td,td],iZ],has:{type:tf,overloads:[[[tp],(i,[r])=>r.evaluate(i) in i.properties()],[[tp,t_],(i,[r,n])=>r.evaluate(i) in n.evaluate(i)]]},get:{type:tg,overloads:[[[tp],(i,[r])=>i$(r.evaluate(i),i.properties())],[[tp,t_],(i,[r,n])=>i$(r.evaluate(i),n.evaluate(i))]]},"feature-state":[tg,[tp],(i,[r])=>i$(r.evaluate(i),i.featureState||{})],properties:[t_,[],i=>i.properties()],"geometry-type":[tp,[],i=>i.geometryType()],id:[tg,[],i=>i.id()],zoom:[td,[],i=>i.globals.zoom],pitch:[td,[],i=>i.globals.pitch||0],"distance-from-center":[td,[],i=>i.distanceFromCenter()],"heatmap-density":[td,[],i=>i.globals.heatmapDensity||0],"line-progress":[td,[],i=>i.globals.lineProgress||0],"sky-radial-progress":[td,[],i=>i.globals.skyRadialProgress||0],accumulated:[tg,[],i=>void 0===i.globals.accumulated?null:i.globals.accumulated],"+":[td,iq(td),(i,r)=>{let n=0;for(const o of r)n+=o.evaluate(i);return n}],"*":[td,iq(td),(i,r)=>{let n=1;for(const o of r)n*=o.evaluate(i);return n}],"-":{type:td,overloads:[[[td,td],(i,[r,n])=>r.evaluate(i)-n.evaluate(i)],[[td],(i,[r])=>-r.evaluate(i)]]},"/":[td,[td,td],(i,[r,n])=>r.evaluate(i)/n.evaluate(i)],"%":[td,[td,td],(i,[r,n])=>r.evaluate(i)%n.evaluate(i)],ln2:[td,[],()=>Math.LN2],pi:[td,[],()=>Math.PI],e:[td,[],()=>Math.E],"^":[td,[td,td],(i,[r,n])=>Math.pow(r.evaluate(i),n.evaluate(i))],sqrt:[td,[td],(i,[r])=>Math.sqrt(r.evaluate(i))],log10:[td,[td],(i,[r])=>Math.log(r.evaluate(i))/Math.LN10],ln:[td,[td],(i,[r])=>Math.log(r.evaluate(i))],log2:[td,[td],(i,[r])=>Math.log(r.evaluate(i))/Math.LN2],sin:[td,[td],(i,[r])=>Math.sin(r.evaluate(i))],cos:[td,[td],(i,[r])=>Math.cos(r.evaluate(i))],tan:[td,[td],(i,[r])=>Math.tan(r.evaluate(i))],asin:[td,[td],(i,[r])=>Math.asin(r.evaluate(i))],acos:[td,[td],(i,[r])=>Math.acos(r.evaluate(i))],atan:[td,[td],(i,[r])=>Math.atan(r.evaluate(i))],min:[td,iq(td),(i,r)=>Math.min(...r.map(r=>r.evaluate(i)))],max:[td,iq(td),(i,r)=>Math.max(...r.map(r=>r.evaluate(i)))],abs:[td,[td],(i,[r])=>Math.abs(r.evaluate(i))],round:[td,[td],(i,[r])=>{const n=r.evaluate(i);return n<0?-Math.round(-n):Math.round(n)}],floor:[td,[td],(i,[r])=>Math.floor(r.evaluate(i))],ceil:[td,[td],(i,[r])=>Math.ceil(r.evaluate(i))],"filter-==":[tf,[tp,tg],(i,[r,n])=>i.properties()[r.value]===n.value],"filter-id-==":[tf,[tg],(i,[r])=>i.id()===r.value],"filter-type-==":[tf,[tp],(i,[r])=>i.geometryType()===r.value],"filter-<":[tf,[tp,tg],(i,[r,n])=>{const o=i.properties()[r.value],s=n.value;return typeof o==typeof s&&o{const n=i.id(),o=r.value;return typeof n==typeof o&&n":[tf,[tp,tg],(i,[r,n])=>{const o=i.properties()[r.value],s=n.value;return typeof o==typeof s&&o>s}],"filter-id->":[tf,[tg],(i,[r])=>{const n=i.id(),o=r.value;return typeof n==typeof o&&n>o}],"filter-<=":[tf,[tp,tg],(i,[r,n])=>{const o=i.properties()[r.value],s=n.value;return typeof o==typeof s&&o<=s}],"filter-id-<=":[tf,[tg],(i,[r])=>{const n=i.id(),o=r.value;return typeof n==typeof o&&n<=o}],"filter->=":[tf,[tp,tg],(i,[r,n])=>{const o=i.properties()[r.value],s=n.value;return typeof o==typeof s&&o>=s}],"filter-id->=":[tf,[tg],(i,[r])=>{const n=i.id(),o=r.value;return typeof n==typeof o&&n>=o}],"filter-has":[tf,[tg],(i,[r])=>r.value in i.properties()],"filter-has-id":[tf,[],i=>null!==i.id()&&void 0!==i.id()],"filter-type-in":[tf,[tb(tp)],(i,[r])=>r.value.indexOf(i.geometryType())>=0],"filter-id-in":[tf,[tb(tg)],(i,[r])=>r.value.indexOf(i.id())>=0],"filter-in-small":[tf,[tp,tb(tg)],(i,[r,n])=>n.value.indexOf(i.properties()[r.value])>=0],"filter-in-large":[tf,[tp,tb(tg)],(i,[r,n])=>(function(i,r,n,o){for(;n<=o;){const s=n+o>>1;if(r[s]===i)return!0;r[s]>i?o=s-1:n=s+1}return!1})(i.properties()[r.value],n.value,0,n.value.length-1)],all:{type:tf,overloads:[[[tf,tf],(i,[r,n])=>r.evaluate(i)&&n.evaluate(i)],[iq(tf),(i,r)=>{for(const n of r)if(!n.evaluate(i))return!1;return!0}]]},any:{type:tf,overloads:[[[tf,tf],(i,[r,n])=>r.evaluate(i)||n.evaluate(i)],[iq(tf),(i,r)=>{for(const n of r)if(n.evaluate(i))return!0;return!1}]]},"!":[tf,[tf],(i,[r])=>!r.evaluate(i)],"is-supported-script":[tf,[tp],(i,[r])=>{const n=i.globals&&i.globals.isSupportedScript;return!n||n(r.evaluate(i))}],upcase:[tp,[tp],(i,[r])=>r.evaluate(i).toUpperCase()],downcase:[tp,[tp],(i,[r])=>r.evaluate(i).toLowerCase()],concat:[tp,iq(tg),(i,r)=>r.map(r=>tF(r.evaluate(i))).join("")],"resolved-locale":[tp,[ty],(i,[r])=>r.evaluate(i).resolvedLocale()]});class i6{constructor(i,r){this.expression=i,this._warningHistory={},this._evaluator=new tX,this._defaultValue=r?"color"===r.type&&iQ(r.default)?new tC(0,0,0,0):"color"===r.type?tC.parse(r.default)||null:void 0===r.default?null:r.default:null,this._enumValues=r&&"enum"===r.type?r.values:null}evaluateWithoutErrorHandling(i,r,n,o,s,a,l,c){return this._evaluator.globals=i,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=o,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=a,this._evaluator.featureTileCoord=l||null,this._evaluator.featureDistanceData=c||null,this.expression.evaluate(this._evaluator)}evaluate(i,r,n,o,s,a,l,c){this._evaluator.globals=i,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=o,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=a||null,this._evaluator.featureTileCoord=l||null,this._evaluator.featureDistanceData=c||null;try{const h=this.expression.evaluate(this._evaluator);if(null==h||"number"==typeof h&&h!=h)return this._defaultValue;if(this._enumValues&&!(h in this._enumValues))throw new tU(`Expected value to be one of ${Object.keys(this._enumValues).map(i=>JSON.stringify(i)).join(", ")}, but found ${JSON.stringify(h)} instead.`);return h}catch(u){return this._warningHistory[u.message]||(this._warningHistory[u.message]=!0,"undefined"!=typeof console&&console.warn(u.message)),this._defaultValue}}}function i8(i){return Array.isArray(i)&&i.length>0&&"string"==typeof i[0]&&i[0]in iG}function i9(i,r){const n=new it(iG,[],r?function(i){const r={color:tm,string:tp,number:td,enum:tp,boolean:tf,formatted:tx,resolvedImage:tv};return"array"===i.type?tb(r[i.value]||tg,i.length):r[i.type]}(r):void 0),o=n.parse(i,void 0,void 0,void 0,r&&"string"===r.type?{typeAnnotation:"coerce"}:void 0);return o?iX(new i6(o,r)):iW(n.errors)}class i7{constructor(i,r){this.kind=i,this._styleExpression=r,this.isStateDependent="constant"!==i&&!t9(r.expression)}evaluateWithoutErrorHandling(i,r,n,o,s,a){return this._styleExpression.evaluateWithoutErrorHandling(i,r,n,o,s,a)}evaluate(i,r,n,o,s,a){return this._styleExpression.evaluate(i,r,n,o,s,a)}}class re{constructor(i,r,n,o){this.kind=i,this.zoomStops=n,this._styleExpression=r,this.isStateDependent="camera"!==i&&!t9(r.expression),this.interpolationType=o}evaluateWithoutErrorHandling(i,r,n,o,s,a){return this._styleExpression.evaluateWithoutErrorHandling(i,r,n,o,s,a)}evaluate(i,r,n,o,s,a){return this._styleExpression.evaluate(i,r,n,o,s,a)}interpolationFactor(i,r,n){return this.interpolationType?iw.interpolationFactor(this.interpolationType,i,r,n):0}}function rt(i,r){if("error"===(i=i9(i,r)).result)return i;const n=i.value.expression,o=t8(n);if(!o&&!iH(r))return iW([new tc("","data expressions not supported")]);const s=t7(n,["zoom","pitch","distance-from-center"]);if(!s&&!iK(r))return iW([new tc("","zoom expressions not supported")]);const a=function i(r){let n=null;if(r instanceof iS)n=i(r.result);else if(r instanceof iE){for(const o of r.args)if(n=i(o))break}else(r instanceof ir||r instanceof iw)&&r.input instanceof tW&&"zoom"===r.input.name&&(n=r);return n instanceof tc||r.eachChild(r=>{const o=i(r);o instanceof tc?n=o:!n&&o?n=new tc("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&o&&n!==o&&(n=new tc("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n}(n);return a||s?a instanceof tc?iW([a]):a instanceof iw&&!iY(r)?iW([new tc("",'"interpolate" expressions cannot be used with this property')]):iX(a?new re(o?"camera":"composite",i.value,a.labels,a instanceof iw?a.interpolation:void 0):new i7(o?"constant":"source",i.value)):iW([new tc("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ri{constructor(i,r){this._parameters=i,this._specification=r,ts(this,function i(r,n){let o,s,a;const l="color"===n.type,c=r.stops&&"object"==typeof r.stops[0][0],h=c||!(c||void 0!==r.property),u=r.type||(iY(n)?"exponential":"interval");if(l&&((r=ts({},r)).stops&&(r.stops=r.stops.map(i=>[i[0],tC.parse(i[1])])),r.default=tC.parse(r.default?r.default:n.default)),r.colorSpace&&"rgb"!==r.colorSpace&&!ib[r.colorSpace])throw Error(`Unknown color space: ${r.colorSpace}`);if("exponential"===u)o=i5;else if("interval"===u)o=i3;else if("categorical"===u){for(const d of(o=i2,s=Object.create(null),r.stops))s[d[0]]=d[1];a=typeof r.stops[0][0]}else{if("identity"!==u)throw Error(`Unknown function type "${u}"`);o=i4}if(c){const p={},f=[];for(let m=0;mi[0]),evaluate:({zoom:i},o)=>i5({stops:y,base:r.base},n,i).evaluate(i,o)}}if(h){const b="exponential"===u?{name:"exponential",base:void 0!==r.base?r.base:1}:null;return{kind:"camera",interpolationType:b,interpolationFactor:iw.interpolationFactor.bind(void 0,b),zoomStops:r.stops.map(i=>i[0]),evaluate:({zoom:i})=>o(r,n,i,s,a)}}return{kind:"source",evaluate(i,l){const c=l&&l.properties?l.properties[r.property]:void 0;return void 0===c?i1(r.default,n.default):o(r,n,c,s,a)}}}(this._parameters,this._specification))}static deserialize(i){return new ri(i._parameters,i._specification)}static serialize(i){return{_parameters:i._parameters,_specification:i._specification}}}function rr(i){const r=i.key,n=i.value,o=i.valueSpec||{},s=i.objectElementValidators||{},a=i.style,l=i.styleSpec;let c=[];const h=iJ(n);if("object"!==h)return[new tn(r,n,`object expected, ${h} found`)];for(const u in n){let d;const p=u.split(".")[0],f=o[p]||o["*"];if(s[p])d=s[p];else if(o[p])d=rz;else if(s["*"])d=s["*"];else{if(!o["*"]){c.push(new tn(r,n[u],`unknown property "${u}"`));continue}d=rz}c=c.concat(d({key:(r?`${r}.`:r)+u,value:n[u],valueSpec:f,style:a,styleSpec:l,object:n,objectKey:u},n))}for(const m in o)s[m]||o[m].required&&void 0===o[m].default&&void 0===n[m]&&c.push(new tn(r,n,`missing required property "${m}"`));return c}function rn(i){const r=i.value,n=i.valueSpec,o=i.style,s=i.styleSpec,a=i.key,l=i.arrayElementValidator||rz;if("array"!==iJ(r))return[new tn(a,r,`array expected, ${iJ(r)} found`)];if(n.length&&r.length!==n.length)return[new tn(a,r,`array length ${n.length} expected, length ${r.length} found`)];if(n["min-length"]&&r.lengthl)return[new tn(r,n,`${n} is greater than the maximum value ${l}`)]}return[]}function rs(i){const r=i.valueSpec,n=ta(i.value.type);let o,s,a,l={};const c="categorical"!==n&&void 0===i.value.property,h="array"===iJ(i.value.stops)&&"array"===iJ(i.value.stops[0])&&"object"===iJ(i.value.stops[0][0]),u=rr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(i){if("identity"===n)return[new tn(i.key,i.value,'identity function may not have a "stops" property')];let r=[];const o=i.value;return r=r.concat(rn({key:i.key,value:o,valueSpec:i.valueSpec,style:i.style,styleSpec:i.styleSpec,arrayElementValidator:d})),"array"===iJ(o)&&0===o.length&&r.push(new tn(i.key,o,"array must have at least one stop")),r},default:function(i){return rz({key:i.key,value:i.value,valueSpec:r,style:i.style,styleSpec:i.styleSpec})}}});return"identity"===n&&c&&u.push(new tn(i.key,i.value,'missing required property "property"')),"identity"===n||i.value.stops||u.push(new tn(i.key,i.value,'missing required property "stops"')),"exponential"===n&&i.valueSpec.expression&&!iY(i.valueSpec)&&u.push(new tn(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(c||iH(i.valueSpec)?c&&!iK(i.valueSpec)&&u.push(new tn(i.key,i.value,"zoom functions not supported")):u.push(new tn(i.key,i.value,"property functions not supported"))),("categorical"===n||h)&&void 0===i.value.property&&u.push(new tn(i.key,i.value,'"property" property is required')),u;function d(i){let n=[];const o=i.value,c=i.key;if("array"!==iJ(o))return[new tn(c,o,`array expected, ${iJ(o)} found`)];if(2!==o.length)return[new tn(c,o,`array length 2 expected, length ${o.length} found`)];if(h){if("object"!==iJ(o[0]))return[new tn(c,o,`object expected, ${iJ(o[0])} found`)];if(void 0===o[0].zoom)return[new tn(c,o,"object stop key must have zoom")];if(void 0===o[0].value)return[new tn(c,o,"object stop key must have value")];if(a&&a>ta(o[0].zoom))return[new tn(c,o[0].zoom,"stop zoom values must appear in ascending order")];ta(o[0].zoom)!==a&&(a=ta(o[0].zoom),s=void 0,l={}),n=n.concat(rr({key:`${c}[0]`,value:o[0],valueSpec:{zoom:{}},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{zoom:ro,value:p}}))}else n=n.concat(p({key:`${c}[0]`,value:o[0],valueSpec:{},style:i.style,styleSpec:i.styleSpec},o));return i8(tl(o[1]))?n.concat([new tn(`${c}[1]`,o[1],"expressions are not allowed in function stops.")]):n.concat(rz({key:`${c}[1]`,value:o[1],valueSpec:r,style:i.style,styleSpec:i.styleSpec}))}function p(i,a){const c=iJ(i.value),h=ta(i.value),u=null!==i.value?i.value:a;if(o){if(c!==o)return[new tn(i.key,u,`${c} stop domain type must match previous stop domain type ${o}`)]}else o=c;if("number"!==c&&"string"!==c&&"boolean"!==c)return[new tn(i.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==c&&"categorical"!==n){let d=`number expected, ${c} found`;return iH(r)&&void 0===n&&(d+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new tn(i.key,u,d)]}return"categorical"!==n||"number"!==c||isFinite(h)&&Math.floor(h)===h?"categorical"!==n&&"number"===c&&void 0!==s&&hnew tn(`${i.key}${r.key}`,i.value,r.message));const n=r.value.expression||r.value._styleExpression.expression;if("property"===i.expressionContext&&"text-font"===i.propertyKey&&!n.outputDefined())return[new tn(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===i.expressionContext&&"layout"===i.propertyType&&!t9(n))return[new tn(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===i.expressionContext)return function i(r,n){const o=new Set(["zoom","feature-state","pitch","distance-from-center"]);for(const s of n.valueSpec.expression.parameters)o.delete(s);if(0===o.size)return[];const a=[];return r instanceof tW&&o.has(r.name)?[new tn(n.key,n.value,`["${r.name}"] expression is not supported in a filter for a ${n.object.type} layer with id: ${n.object.id}`)]:(r.eachChild(r=>{a.push(...i(r,n))}),a)}(n,i);if(i.expressionContext&&0===i.expressionContext.indexOf("cluster")){if(!t7(n,["zoom","feature-state"]))return[new tn(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===i.expressionContext&&!t8(n))return[new tn(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function rl(i){const r=i.key,n=i.value,o=i.valueSpec,s=[];return Array.isArray(o.values)?-1===o.values.indexOf(ta(n))&&s.push(new tn(r,n,`expected one of [${o.values.join(", ")}], ${JSON.stringify(n)} found`)):-1===Object.keys(o.values).indexOf(ta(n))&&s.push(new tn(r,n,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(n)} found`)),s}function rc(i){if(!0===i||!1===i)return!0;if(!Array.isArray(i)||0===i.length)return!1;switch(i[0]){case"has":return i.length>=2&&"$id"!==i[1]&&"$type"!==i[1];case"in":return i.length>=3&&("string"!=typeof i[1]||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==i.length||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const r of i.slice(1))if(!rc(r)&&"boolean"!=typeof r)return!1;return!0;default:return!0}}function rh(i,r="fill"){if(null==i)return{filter:()=>!0,needGeometry:!1,needFeature:!1};rc(i)||(i=function i(r){if(!r)return!0;const n=r[0];return r.length<=1?"any"!==n:"=="===n?rf(r[1],r[2],"=="):"!="===n?rg(rf(r[1],r[2],"==")):"<"===n||">"===n||"<="===n||">="===n?rf(r[1],r[2],n):"any"===n?["any"].concat(r.slice(1).map(i)):"all"===n?["all"].concat(r.slice(1).map(i)):"none"===n?["all"].concat(r.slice(1).map(i).map(rg)):"in"===n?rm(r[1],r.slice(2)):"!in"===n?rg(rm(r[1],r.slice(2))):"has"===n?r_(r[1]):"!has"===n?rg(r_(r[1])):"within"!==n||r}(i));const n=i;let o=!0;try{o=function(i){if(!ru(i))return i;let r=tl(i);return function i(r){let n=!1;const o=[];if("case"===r[0]){for(let s=1;si(r))}(r)}(n)}catch(s){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[634],{6158:function(i,r,n){var o=n(3454);i.exports=function(){"use strict";var i,r,n;function s(o,s){if(i){if(r){var a="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+i+")(sharedChunk); ("+r+")(sharedChunk); self.onerror = null;",l={};i(l),n=s(l),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(n.workerUrl=window.URL.createObjectURL(new Blob([a],{type:"text/javascript"})))}else r=s}else i=s}return s(["exports"],function(i){let r,n,s;var a,l,c="2.7.0";function h(i,r,n,o){this.cx=3*i,this.bx=3*(n-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(o-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=o,this.p2x=n,this.p2y=o}h.prototype.sampleCurveX=function(i){return((this.ax*i+this.bx)*i+this.cx)*i},h.prototype.sampleCurveY=function(i){return((this.ay*i+this.by)*i+this.cy)*i},h.prototype.sampleCurveDerivativeX=function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},h.prototype.solveCurveX=function(i,r){var n,o,s,a,l;for(void 0===r&&(r=1e-6),s=i,l=0;l<8;l++){if(Math.abs(a=this.sampleCurveX(s)-i)Math.abs(c))break;s-=a/c}if((s=i)<(n=0))return n;if(s>(o=1))return o;for(;na?n=s:o=s,s=.5*(o-n)+n;return s},h.prototype.solve=function(i,r){return this.sampleCurveY(this.solveCurveX(i,r))};var u=d;function d(i,r){this.x=i,this.y=r}d.prototype={clone:function(){return new d(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,r){return this.clone()._rotateAround(i,r)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var r=i.x-this.x,n=i.y-this.y;return r*r+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,r){return Math.atan2(this.x*r-this.y*i,this.x*i+this.y*r)},_matMult:function(i){var r=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=r,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var r=Math.cos(i),n=Math.sin(i),o=n*this.x+r*this.y;return this.x=r*this.x-n*this.y,this.y=o,this},_rotateAround:function(i,r){var n=Math.cos(i),o=Math.sin(i),s=r.y+o*(this.x-r.x)+n*(this.y-r.y);return this.x=r.x+n*(this.x-r.x)-o*(this.y-r.y),this.y=s,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},d.convert=function(i){return i instanceof d?i:Array.isArray(i)?new d(i[0],i[1]):i};var p="undefined"!=typeof self?self:{},f="undefined"!=typeof Float32Array?Float32Array:Array;function m(){var i=new f(9);return f!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,i}function _(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function g(i,r,n){var o=r[0],s=r[1],a=r[2],l=r[3],c=r[4],h=r[5],u=r[6],d=r[7],p=r[8],f=r[9],m=r[10],_=r[11],g=r[12],y=r[13],x=r[14],v=r[15],b=n[0],w=n[1],T=n[2],E=n[3];return i[0]=b*o+w*c+T*p+E*g,i[1]=b*s+w*h+T*f+E*y,i[2]=b*a+w*u+T*m+E*x,i[3]=b*l+w*d+T*_+E*v,i[4]=(b=n[4])*o+(w=n[5])*c+(T=n[6])*p+(E=n[7])*g,i[5]=b*s+w*h+T*f+E*y,i[6]=b*a+w*u+T*m+E*x,i[7]=b*l+w*d+T*_+E*v,i[8]=(b=n[8])*o+(w=n[9])*c+(T=n[10])*p+(E=n[11])*g,i[9]=b*s+w*h+T*f+E*y,i[10]=b*a+w*u+T*m+E*x,i[11]=b*l+w*d+T*_+E*v,i[12]=(b=n[12])*o+(w=n[13])*c+(T=n[14])*p+(E=n[15])*g,i[13]=b*s+w*h+T*f+E*y,i[14]=b*a+w*u+T*m+E*x,i[15]=b*l+w*d+T*_+E*v,i}function y(i,r,n){var o,s,a,l,c,h,u,d,p,f,m,_,g=n[0],y=n[1],x=n[2];return r===i?(i[12]=r[0]*g+r[4]*y+r[8]*x+r[12],i[13]=r[1]*g+r[5]*y+r[9]*x+r[13],i[14]=r[2]*g+r[6]*y+r[10]*x+r[14],i[15]=r[3]*g+r[7]*y+r[11]*x+r[15]):(s=r[1],a=r[2],l=r[3],c=r[4],h=r[5],u=r[6],d=r[7],p=r[8],f=r[9],m=r[10],_=r[11],i[0]=o=r[0],i[1]=s,i[2]=a,i[3]=l,i[4]=c,i[5]=h,i[6]=u,i[7]=d,i[8]=p,i[9]=f,i[10]=m,i[11]=_,i[12]=o*g+c*y+p*x+r[12],i[13]=s*g+h*y+f*x+r[13],i[14]=a*g+u*y+m*x+r[14],i[15]=l*g+d*y+_*x+r[15]),i}function x(i,r,n){var o=n[0],s=n[1],a=n[2];return i[0]=r[0]*o,i[1]=r[1]*o,i[2]=r[2]*o,i[3]=r[3]*o,i[4]=r[4]*s,i[5]=r[5]*s,i[6]=r[6]*s,i[7]=r[7]*s,i[8]=r[8]*a,i[9]=r[9]*a,i[10]=r[10]*a,i[11]=r[11]*a,i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15],i}function v(i,r,n){var o=Math.sin(n),s=Math.cos(n),a=r[4],l=r[5],c=r[6],h=r[7],u=r[8],d=r[9],p=r[10],f=r[11];return r!==i&&(i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[4]=a*s+u*o,i[5]=l*s+d*o,i[6]=c*s+p*o,i[7]=h*s+f*o,i[8]=u*s-a*o,i[9]=d*s-l*o,i[10]=p*s-c*o,i[11]=f*s-h*o,i}function b(i,r,n){var o=Math.sin(n),s=Math.cos(n),a=r[0],l=r[1],c=r[2],h=r[3],u=r[8],d=r[9],p=r[10],f=r[11];return r!==i&&(i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[0]=a*s-u*o,i[1]=l*s-d*o,i[2]=c*s-p*o,i[3]=h*s-f*o,i[8]=a*o+u*s,i[9]=l*o+d*s,i[10]=c*o+p*s,i[11]=h*o+f*s,i}function w(){var i=new f(3);return f!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function T(i){var r=new f(3);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r}function E(i){return Math.hypot(i[0],i[1],i[2])}function S(i,r,n){var o=new f(3);return o[0]=i,o[1]=r,o[2]=n,o}function I(i,r,n){return i[0]=r[0]+n[0],i[1]=r[1]+n[1],i[2]=r[2]+n[2],i}function M(i,r,n){return i[0]=r[0]-n[0],i[1]=r[1]-n[1],i[2]=r[2]-n[2],i}function A(i,r,n){return i[0]=r[0]*n[0],i[1]=r[1]*n[1],i[2]=r[2]*n[2],i}function C(i,r,n){return i[0]=r[0]*n,i[1]=r[1]*n,i[2]=r[2]*n,i}function z(i,r,n,o){return i[0]=r[0]+n[0]*o,i[1]=r[1]+n[1]*o,i[2]=r[2]+n[2]*o,i}function k(i,r){var n=r[0],o=r[1],s=r[2],a=n*n+o*o+s*s;return a>0&&(a=1/Math.sqrt(a)),i[0]=r[0]*a,i[1]=r[1]*a,i[2]=r[2]*a,i}function P(i,r){return i[0]*r[0]+i[1]*r[1]+i[2]*r[2]}function D(i,r,n){var o=r[0],s=r[1],a=r[2],l=n[0],c=n[1],h=n[2];return i[0]=s*h-a*c,i[1]=a*l-o*h,i[2]=o*c-s*l,i}function L(i,r,n){var o=r[0],s=r[1],a=r[2],l=n[3]*o+n[7]*s+n[11]*a+n[15];return i[0]=(n[0]*o+n[4]*s+n[8]*a+n[12])/(l=l||1),i[1]=(n[1]*o+n[5]*s+n[9]*a+n[13])/l,i[2]=(n[2]*o+n[6]*s+n[10]*a+n[14])/l,i}function B(i,r,n){var o=n[0],s=n[1],a=n[2],l=r[0],c=r[1],h=r[2],u=s*h-a*c,d=a*l-o*h,p=o*c-s*l,f=s*p-a*d,m=a*u-o*p,_=o*d-s*u,g=2*n[3];return d*=g,p*=g,m*=2,_*=2,i[0]=l+(u*=g)+(f*=2),i[1]=c+d+m,i[2]=h+p+_,i}function R(i,r,n){var o=r[0],s=r[1],a=r[2],l=r[3];return i[0]=n[0]*o+n[4]*s+n[8]*a+n[12]*l,i[1]=n[1]*o+n[5]*s+n[9]*a+n[13]*l,i[2]=n[2]*o+n[6]*s+n[10]*a+n[14]*l,i[3]=n[3]*o+n[7]*s+n[11]*a+n[15]*l,i}function F(){var i=new f(4);return f!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function O(i){return i[0]=0,i[1]=0,i[2]=0,i[3]=1,i}function U(i,r,n){n*=.5;var o=r[0],s=r[1],a=r[2],l=r[3],c=Math.sin(n),h=Math.cos(n);return i[0]=o*h+l*c,i[1]=s*h+a*c,i[2]=a*h-s*c,i[3]=l*h-o*c,i}function V(i,r){return i[0]===r[0]&&i[1]===r[1]}Math.hypot||(Math.hypot=function(){for(var i=0,r=arguments.length;r--;)i+=arguments[r]*arguments[r];return Math.sqrt(i)}),w(),a=new f(4),f!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0,a[3]=0),w(),S(1,0,0),S(0,1,0),F(),F(),m(),l=new f(2),f!=Float32Array&&(l[0]=0,l[1]=0);const N=Math.PI/180,j=180/Math.PI,G=[[0,0],[1,0],[1,1],[0,1]];function Z(i){if(i<=0)return 0;if(i>=1)return 1;const r=i*i,n=r*i;return 4*(i<.5?n:3*(i-r)+n-.75)}function $(i,r,n,o){const s=new h(i,r,n,o);return function(i){return s.solve(i)}}const q=$(.25,.1,.25,1);function X(i,r,n){return Math.min(n,Math.max(r,i))}function W(i,r,n){return(n=X((n-i)/(r-i),0,1))*n*(3-2*n)}function H(i,r,n){const o=n-r,s=((i-r)%o+o)%o+r;return s===r?n:s}function K(i,r,n){if(!i.length)return n(null,[]);let o=i.length;const s=Array(i.length);let a=null;i.forEach((i,l)=>{r(i,(i,r)=>{i&&(a=i),s[l]=r,0==--o&&n(a,s)})})}function Y(i){const r=[];for(const n in i)r.push(i[n]);return r}function J(i,...r){for(const n of r)for(const o in n)i[o]=n[o];return i}let Q=1;function ee(){return Q++}function et(){return function i(r){return r?(r^16*Math.random()>>r/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,i)}()}function ei(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function er(i){return!!i&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(i)}function en(i,r){i.forEach(i=>{r[i]&&(r[i]=r[i].bind(r))})}function eo(i,r){return -1!==i.indexOf(r,i.length-r.length)}function es(i,r,n){const o={};for(const s in i)o[s]=r.call(n||this,i[s],s,i);return o}function ea(i,r,n){const o={};for(const s in i)r.call(n||this,i[s],s,i)&&(o[s]=i[s]);return o}function el(i){return Array.isArray(i)?i.map(el):"object"==typeof i&&i?es(i,el):i}const ec={};function eh(i){ec[i]||("undefined"!=typeof console&&console.warn(i),ec[i]=!0)}function eu(i,r,n){return(n.y-i.y)*(r.x-i.x)>(r.y-i.y)*(n.x-i.x)}function ed(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function ep(i){const r={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,n,o,s)=>{const a=o||s;return r[n]=!a||a.toLowerCase(),""}),r["max-age"]){const n=parseInt(r["max-age"],10);isNaN(n)?delete r["max-age"]:r["max-age"]=n}return r}let ef,em,e_,eg=null;function ey(i){if(null==eg){const r=i.navigator?i.navigator.userAgent:null;eg=!!i.safari||!(!r||!(/\b(iPad|iPhone|iPod)\b/.test(r)||r.match("Safari")&&!r.match("Chrome")))}return eg}function ex(i){try{const r=p[i];return r.setItem("_mapbox_test_",1),r.removeItem("_mapbox_test_"),!0}catch(n){return!1}}const ev={now:()=>void 0!==e_?e_:p.performance.now(),setNow(i){e_=i},restoreNow(){e_=void 0},frame(i){const r=p.requestAnimationFrame(i);return{cancel:()=>p.cancelAnimationFrame(r)}},getImageData(i,r=0){const n=p.document.createElement("canvas"),o=n.getContext("2d");if(!o)throw Error("failed to create canvas 2d context");return n.width=i.width,n.height=i.height,o.drawImage(i,0,0,i.width,i.height),o.getImageData(-r,-r,i.width+2*r,i.height+2*r)},resolveURL:i=>(ef||(ef=p.document.createElement("a")),ef.href=i,ef.href),get devicePixelRatio(){return p.devicePixelRatio},get prefersReducedMotion(){return!!p.matchMedia&&(null==em&&(em=p.matchMedia("(prefers-reduced-motion: reduce)")),em.matches)}},eb={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==r){const ew=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{r=null!=o.env.API_URL_REGEX?RegExp(o.env.API_URL_REGEX):ew}catch(eT){r=ew}}return r},get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},eE={supported:!1,testSupport:function(i){!eM&&eI&&(eA?eC(i):eS=i)}};let eS,eI,eM=!1,eA=!1;function eC(i){const r=i.createTexture();i.bindTexture(i.TEXTURE_2D,r);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,eI),i.isContextLost())return;eE.supported=!0}catch(n){}i.deleteTexture(r),eM=!0}p.document&&((eI=p.document.createElement("img")).onload=function(){eS&&eC(eS),eS=null,eA=!0},eI.onerror=function(){eM=!0,eS=null},eI.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const ez="NO_ACCESS_TOKEN";function ek(i){return 0===i.indexOf("mapbox:")}function eP(i){return eb.API_URL_REGEX.test(i)}const eD=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function eL(i){const r=i.match(eD);if(!r)throw Error("Unable to parse URL object");return{protocol:r[1],authority:r[2],path:r[3]||"/",params:r[4]?r[4].split("&"):[]}}function eB(i){const r=i.params.length?`?${i.params.join("&")}`:"";return`${i.protocol}://${i.authority}${i.path}${r}`}function eR(i){if(!i)return null;const r=i.split(".");if(!r||3!==r.length)return null;try{return JSON.parse(decodeURIComponent(p.atob(r[1]).split("").map(i=>"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch(n){return null}}class eF{constructor(i){this.type=i,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(i){const r=eR(eb.ACCESS_TOKEN);let n="";return n=r&&r.u?p.btoa(encodeURIComponent(r.u).replace(/%([0-9A-F]{2})/g,(i,r)=>String.fromCharCode(Number("0x"+r)))):eb.ACCESS_TOKEN||"",i?`mapbox.eventData.${i}:${n}`:`mapbox.eventData:${n}`}fetchEventData(){const i=ex("localStorage"),r=this.getStorageKey(),n=this.getStorageKey("uuid");if(i)try{const o=p.localStorage.getItem(r);o&&(this.eventData=JSON.parse(o));const s=p.localStorage.getItem(n);s&&(this.anonId=s)}catch(a){eh("Unable to read from LocalStorage")}}saveEventData(){const i=ex("localStorage"),r=this.getStorageKey(),n=this.getStorageKey("uuid");if(i)try{p.localStorage.setItem(n,this.anonId),Object.keys(this.eventData).length>=1&&p.localStorage.setItem(r,JSON.stringify(this.eventData))}catch(o){eh("Unable to write to LocalStorage")}}processRequests(i){}postEvent(i,r,n,o){if(!eb.EVENTS_URL)return;const s=eL(eb.EVENTS_URL);s.params.push(`access_token=${o||eb.ACCESS_TOKEN||""}`);const a={event:this.type,created:new Date(i).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:c,skuId:"01",userId:this.anonId},l=r?J(a,r):a,h={url:eB(s),headers:{"Content-Type":"text/plain"},body:JSON.stringify([l])};this.pendingRequest=e5(h,i=>{this.pendingRequest=null,n(i),this.saveEventData(),this.processRequests(o)})}queueRequest(i,r){this.queue.push(i),this.processRequests(r)}}const eO=new class extends eF{constructor(i){super("appUserTurnstile"),this._customAccessToken=i}postTurnstileEvent(i,r){eb.EVENTS_URL&&eb.ACCESS_TOKEN&&Array.isArray(i)&&i.some(i=>ek(i)||eP(i))&&this.queueRequest(Date.now(),r)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const r=eR(eb.ACCESS_TOKEN),n=r?r.u:eb.ACCESS_TOKEN;let o=n!==this.eventData.tokenU;er(this.anonId)||(this.anonId=et(),o=!0);const s=this.queue.shift();if(this.eventData.lastSuccess){const a=new Date(this.eventData.lastSuccess),l=new Date(s),c=(s-this.eventData.lastSuccess)/864e5;o=o||c>=1||c<-1||a.getDate()!==l.getDate()}else o=!0;if(!o)return this.processRequests();this.postEvent(s,{"enabled.telemetry":!1},i=>{i||(this.eventData.lastSuccess=s,this.eventData.tokenU=n)},i)}},eU=eO.postTurnstileEvent.bind(eO),eV=new class extends eF{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(i,r,n,o){this.skuToken=r,this.errorCb=o,eb.EVENTS_URL&&(n||eb.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},n):this.errorCb(Error(ez)))}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;const{id:r,timestamp:n}=this.queue.shift();r&&this.success[r]||(this.anonId||this.fetchEventData(),er(this.anonId)||(this.anonId=et()),this.postEvent(n,{skuToken:this.skuToken},i=>{i?this.errorCb(i):r&&(this.success[r]=!0)},i))}},eN=eV.postMapLoadEvent.bind(eV),ej=new class extends eF{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(i,r,n,o){if(!eb.API_URL||!eb.SESSION_PATH)return;const s=eL(eb.API_URL+eb.SESSION_PATH);s.params.push(`sku=${r||""}`),s.params.push(`access_token=${o||eb.ACCESS_TOKEN||""}`);const a={url:eB(s),headers:{"Content-Type":"text/plain"}};this.pendingRequest=e4(a,i=>{this.pendingRequest=null,n(i),this.saveEventData(),this.processRequests(o)})}getSessionAPI(i,r,n,o){this.skuToken=r,this.errorCb=o,eb.SESSION_PATH&&eb.API_URL&&(n||eb.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},n):this.errorCb(Error(ez)))}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;const{id:r,timestamp:n}=this.queue.shift();r&&this.success[r]||this.getSession(n,this.skuToken,i=>{i?this.errorCb(i):r&&(this.success[r]=!0)},i)}},eG=ej.getSessionAPI.bind(ej),eZ=new Set,e$="mapbox-tiles";let eq,eX,eW=500,eH=50;function eK(){p.caches&&!eq&&(eq=p.caches.open(e$))}function eY(i){const r=i.indexOf("?");return r<0?i:i.slice(0,r)}let eJ=1/0;const eQ={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(eQ);class e0 extends Error{constructor(i,r,n){401===r&&eP(n)&&(i+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),super(i),this.status=r,this.url=n}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const e1=ed()?()=>self.worker&&self.worker.referrer:()=>("blob:"===p.location.protocol?p.parent:p).location.href,e2=function(i,r){var n;if(!(/^file:/.test(n=i.url)||/^file:/.test(e1())&&!/^\w+:/.test(n))){if(p.fetch&&p.Request&&p.AbortController&&p.Request.prototype.hasOwnProperty("signal"))return function(i,r){var n;const o=new p.AbortController,s=new p.Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:e1(),signal:o.signal});let a=!1,l=!1;const c=(n=s.url).indexOf("sku=")>0&&eP(n);"json"===i.type&&s.headers.set("Accept","application/json");const h=(n,o,a)=>{if(l)return;if(n&&"SecurityError"!==n.message&&eh(n),o&&a)return u(o);const h=Date.now();p.fetch(s).then(n=>{if(n.ok){const o=c?n.clone():null;return u(n,o,h)}return r(new e0(n.statusText,n.status,i.url))}).catch(i=>{20!==i.code&&r(Error(i.message))})},u=(n,o,c)=>{("arrayBuffer"===i.type?n.arrayBuffer():"json"===i.type?n.json():n.text()).then(i=>{l||(o&&c&&function(i,r,n){if(eK(),!eq)return;const o={status:r.status,statusText:r.statusText,headers:new p.Headers};r.headers.forEach((i,r)=>o.headers.set(r,i));const s=ep(r.headers.get("Cache-Control")||"");s["no-store"]||(s["max-age"]&&o.headers.set("Expires",new Date(n+1e3*s["max-age"]).toUTCString()),new Date(o.headers.get("Expires")).getTime()-n<42e4||function(i,r){if(void 0===eX)try{new Response(new ReadableStream),eX=!0}catch(n){eX=!1}eX?r(i.body):i.blob().then(r)}(r,r=>{const n=new p.Response(r,o);eK(),eq&&eq.then(r=>r.put(eY(i.url),n)).catch(i=>eh(i.message))}))}(s,o,c),a=!0,r(null,i,n.headers.get("Cache-Control"),n.headers.get("Expires")))}).catch(i=>{l||r(Error(i.message))})};return c?function(i,r){if(eK(),!eq)return r(null);const n=eY(i.url);eq.then(i=>{i.match(n).then(o=>{const s=function(i){if(!i)return!1;const r=new Date(i.headers.get("Expires")||0),n=ep(i.headers.get("Cache-Control")||"");return r>Date.now()&&!n["no-cache"]}(o);i.delete(n),s&&i.put(n,o.clone()),r(null,o,s)}).catch(r)}).catch(r)}(s,h):h(null,null),{cancel(){l=!0,a||o.abort()}}}(i,r);if(ed()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,r,void 0,!0)}return function(i,r){const n=new p.XMLHttpRequest;for(const o in n.open(i.method||"GET",i.url,!0),"arrayBuffer"===i.type&&(n.responseType="arraybuffer"),i.headers)n.setRequestHeader(o,i.headers[o]);return"json"===i.type&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===i.credentials,n.onerror=()=>{r(Error(n.statusText))},n.onload=()=>{if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let o=n.response;if("json"===i.type)try{o=JSON.parse(n.response)}catch(s){return r(s)}r(null,o,n.getResponseHeader("Cache-Control"),n.getResponseHeader("Expires"))}else r(new e0(n.statusText,n.status,i.url))},n.send(i.body),{cancel:()=>n.abort()}}(i,r)},e3=function(i,r){return e2(J(i,{type:"arrayBuffer"}),r)},e5=function(i,r){return e2(J(i,{method:"POST"}),r)},e4=function(i,r){return e2(J(i,{method:"GET"}),r)},e6="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";n=[],s=0;const e8=function(i,r){if(eE.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),s>=eb.MAX_PARALLEL_IMAGE_REQUESTS){const o={requestParameters:i,callback:r,cancelled:!1,cancel(){this.cancelled=!0}};return n.push(o),o}s++;let a=!1;const l=()=>{if(!a)for(a=!0,s--;n.length&&s{l(),i?r(i):n&&(p.createImageBitmap?function(i,r){const n=new p.Blob([new Uint8Array(i)],{type:"image/png"});p.createImageBitmap(n).then(i=>{r(null,i)}).catch(i=>{r(Error(`Could not load image because of ${i.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(n,(i,n)=>r(i,n,o,s)):function(i,r){const n=new p.Image,o=p.URL;n.onload=()=>{r(null,n),o.revokeObjectURL(n.src),n.onload=null,p.requestAnimationFrame(()=>{n.src=e6})},n.onerror=()=>r(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const s=new p.Blob([new Uint8Array(i)],{type:"image/png"});n.src=i.byteLength?o.createObjectURL(s):e6}(n,(i,n)=>r(i,n,o,s)))});return{cancel(){c.cancel(),l()}}};function e9(i,r,n){n[i]&&-1!==n[i].indexOf(r)||(n[i]=n[i]||[],n[i].push(r))}function e7(i,r,n){if(n&&n[i]){const o=n[i].indexOf(r);-1!==o&&n[i].splice(o,1)}}class te{constructor(i,r={}){J(this,r),this.type=i}}class tt extends te{constructor(i,r={}){super("error",J({error:i},r))}}class ti{on(i,r){return this._listeners=this._listeners||{},e9(i,r,this._listeners),this}off(i,r){return e7(i,r,this._listeners),e7(i,r,this._oneTimeListeners),this}once(i,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},e9(i,r,this._oneTimeListeners),this):new Promise(r=>this.once(i,r))}fire(i,r){"string"==typeof i&&(i=new te(i,r||{}));const n=i.type;if(this.listens(n)){i.target=this;const o=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const s of o)s.call(this,i);const a=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const l of a)e7(n,l,this._oneTimeListeners),l.call(this,i);const c=this._eventedParent;c&&(J(i,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),c.fire(i))}else i instanceof tt&&console.error(i.error);return this}listens(i){return!!(this._listeners&&this._listeners[i]&&this._listeners[i].length>0||this._oneTimeListeners&&this._oneTimeListeners[i]&&this._oneTimeListeners[i].length>0||this._eventedParent&&this._eventedParent.listens(i))}setEventedParent(i,r){return this._eventedParent=i,this._eventedParentData=r,this}}var tr=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":{},"mapbox":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":{},"line":{},"line-center":{}},"default":"point","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"units":"factor of the original icon size","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":{},"width":{},"height":{},"both":{}},"default":"none","requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"units":"pixels","requires":["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","units":"ems","default":0,"requires":["text-field"],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["text-field",{"!":"text-variable-anchor"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"units":"degrees","requires":["text-field",{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","units":"ems","length":2,"default":[0,0],"requires":["text-field",{"!":"text-radial-offset"}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{},"within":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":0.1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"cross-faded"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}},"property-type":{"data-driven":{"type":"property-type"},"cross-faded":{"type":"property-type"},"cross-faded-data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');class tn{constructor(i,r,n,o){this.message=(i?`${i}: `:"")+n,o&&(this.identifier=o),null!=r&&r.__line__&&(this.line=r.__line__)}}function to(i){const r=i.value;return r?[new tn(i.key,r,"constants have been deprecated as of v8")]:[]}function ts(i,...r){for(const n of r)for(const o in n)i[o]=n[o];return i}function ta(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function tl(i){if(Array.isArray(i))return i.map(tl);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const r={};for(const n in i)r[n]=tl(i[n]);return r}return ta(i)}class tc extends Error{constructor(i,r){super(r),this.message=r,this.key=i}}class th{constructor(i,r=[]){for(const[n,o]of(this.parent=i,this.bindings={},r))this.bindings[n]=o}concat(i){return new th(this,i)}get(i){if(this.bindings[i])return this.bindings[i];if(this.parent)return this.parent.get(i);throw Error(`${i} not found in scope.`)}has(i){return!!this.bindings[i]||!!this.parent&&this.parent.has(i)}}const tu={kind:"null"},td={kind:"number"},tp={kind:"string"},tf={kind:"boolean"},tm={kind:"color"},t_={kind:"object"},tg={kind:"value"},ty={kind:"collator"},tx={kind:"formatted"},tv={kind:"resolvedImage"};function tb(i,r){return{kind:"array",itemType:i,N:r}}function tw(i){if("array"===i.kind){const r=tw(i.itemType);return"number"==typeof i.N?`array<${r}, ${i.N}>`:"value"===i.itemType.kind?"array":`array<${r}>`}return i.kind}const tT=[tu,td,tp,tf,tm,tx,t_,tb(tg),tv];function tE(i,r){if("error"===r.kind)return null;if("array"===i.kind){if("array"===r.kind&&(0===r.N&&"value"===r.itemType.kind||!tE(i.itemType,r.itemType))&&("number"!=typeof i.N||i.N===r.N))return null}else{if(i.kind===r.kind)return null;if("value"===i.kind){for(const n of tT)if(!tE(n,r))return null}}return`Expected ${tw(i)} but found ${tw(r)} instead.`}function tS(i,r){return r.some(r=>r.kind===i.kind)}function tI(i,r){return r.some(r=>"null"===r?null===i:"array"===r?Array.isArray(i):"object"===r?i&&!Array.isArray(i)&&"object"==typeof i:r===typeof i)}function tM(i){var r={exports:{}};return i(r,r.exports),r.exports}var tA=tM(function(i,r){var n={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function o(i){return(i=Math.round(i))<0?0:i>255?255:i}function s(i){return o("%"===i[i.length-1]?parseFloat(i)/100*255:parseInt(i))}function a(i){var r;return(r="%"===i[i.length-1]?parseFloat(i)/100:parseFloat(i))<0?0:r>1?1:r}function l(i,r,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?i+(r-i)*n*6:2*n<1?r:3*n<2?i+(r-i)*(2/3-n)*6:i}try{r.parseCSSColor=function(i){var r,c=i.replace(/ /g,"").toLowerCase();if(c in n)return n[c].slice();if("#"===c[0])return 4===c.length?(r=parseInt(c.substr(1),16))>=0&&r<=4095?[(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,1]:null:7===c.length&&(r=parseInt(c.substr(1),16))>=0&&r<=16777215?[(16711680&r)>>16,(65280&r)>>8,255&r,1]:null;var h=c.indexOf("("),u=c.indexOf(")");if(-1!==h&&u+1===c.length){var d=c.substr(0,h),p=c.substr(h+1,u-(h+1)).split(","),f=1;switch(d){case"rgba":if(4!==p.length)break;f=a(p.pop());case"rgb":return 3!==p.length?null:[s(p[0]),s(p[1]),s(p[2]),f];case"hsla":if(4!==p.length)break;f=a(p.pop());case"hsl":if(3!==p.length)break;var m=(parseFloat(p[0])%360+360)%360/360,_=a(p[1]),g=a(p[2]),y=g<=.5?g*(_+1):g+_-g*_,x=2*g-y;return[o(255*l(x,y,m+1/3)),o(255*l(x,y,m)),o(255*l(x,y,m-1/3)),f]}}return null}}catch(c){}});class tC{constructor(i,r,n,o=1){this.r=i,this.g=r,this.b=n,this.a=o}static parse(i){if(!i)return;if(i instanceof tC)return i;if("string"!=typeof i)return;const r=tA.parseCSSColor(i);return r?new tC(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){const[i,r,n,o]=this.toArray();return`rgba(${Math.round(i)},${Math.round(r)},${Math.round(n)},${o})`}toArray(){const{r:i,g:r,b:n,a:o}=this;return 0===o?[0,0,0,0]:[255*i/o,255*r/o,255*n/o,o]}}tC.black=new tC(0,0,0,1),tC.white=new tC(1,1,1,1),tC.transparent=new tC(0,0,0,0),tC.red=new tC(1,0,0,1),tC.blue=new tC(0,0,1,1);class tz{constructor(i,r,n){this.sensitivity=i?r?"variant":"case":r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(i,r){return this.collator.compare(i,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class tk{constructor(i,r,n,o,s){this.text=i.normalize?i.normalize():i,this.image=r,this.scale=n,this.fontStack=o,this.textColor=s}}class tP{constructor(i){this.sections=i}static fromString(i){return new tP([new tk(i,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(i=>0!==i.text.length||i.image&&0!==i.image.name.length)}static factory(i){return i instanceof tP?i:tP.fromString(i)}toString(){return 0===this.sections.length?"":this.sections.map(i=>i.text).join("")}serialize(){const i=["format"];for(const r of this.sections){if(r.image){i.push(["image",r.image.name]);continue}i.push(r.text);const n={};r.fontStack&&(n["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(n["font-scale"]=r.scale),r.textColor&&(n["text-color"]=["rgba"].concat(r.textColor.toArray())),i.push(n)}return i}}class tD{constructor(i){this.name=i.name,this.available=i.available}toString(){return this.name}static fromString(i){return i?new tD({name:i,available:!1}):null}serialize(){return["image",this.name]}}function tL(i,r,n,o){return"number"==typeof i&&i>=0&&i<=255&&"number"==typeof r&&r>=0&&r<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===o||"number"==typeof o&&o>=0&&o<=1?null:`Invalid rgba value [${[i,r,n,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof o?[i,r,n,o]:[i,r,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function tB(i){if(null===i||"string"==typeof i||"boolean"==typeof i||"number"==typeof i||i instanceof tC||i instanceof tz||i instanceof tP||i instanceof tD)return!0;if(Array.isArray(i)){for(const r of i)if(!tB(r))return!1;return!0}if("object"==typeof i){for(const n in i)if(!tB(i[n]))return!1;return!0}return!1}function tR(i){if(null===i)return tu;if("string"==typeof i)return tp;if("boolean"==typeof i)return tf;if("number"==typeof i)return td;if(i instanceof tC)return tm;if(i instanceof tz)return ty;if(i instanceof tP)return tx;if(i instanceof tD)return tv;if(Array.isArray(i)){let r;const n=i.length;for(const o of i){const s=tR(o);if(r){if(r===s)continue;r=tg;break}r=s}return tb(r||tg,n)}return t_}function tF(i){const r=typeof i;return null===i?"":"string"===r||"number"===r||"boolean"===r?String(i):i instanceof tC||i instanceof tP||i instanceof tD?i.toString():JSON.stringify(i)}class tO{constructor(i,r){this.type=i,this.value=r}static parse(i,r){if(2!==i.length)return r.error(`'literal' expression requires exactly one argument, but found ${i.length-1} instead.`);if(!tB(i[1]))return r.error("invalid value");const n=i[1];let o=tR(n);const s=r.expectedType;return"array"===o.kind&&0===o.N&&s&&"array"===s.kind&&("number"!=typeof s.N||0===s.N)&&(o=s),new tO(o,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof tC?["rgba"].concat(this.value.toArray()):this.value instanceof tP?this.value.serialize():this.value}}class tU{constructor(i){this.name="ExpressionEvaluationError",this.message=i}toJSON(){return this.message}}const tV={string:tp,number:td,boolean:tf,object:t_};class tN{constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");let n,o=1;const s=i[0];if("array"===s){let a,l;if(i.length>2){const c=i[1];if("string"!=typeof c||!(c in tV)||"object"===c)return r.error('The item type argument of "array" must be one of string, number, boolean',1);a=tV[c],o++}else a=tg;if(i.length>3){if(null!==i[2]&&("number"!=typeof i[2]||i[2]<0||i[2]!==Math.floor(i[2])))return r.error('The length argument to "array" must be a positive integer literal',2);l=i[2],o++}n=tb(a,l)}else n=tV[s];const h=[];for(;oi.outputDefined())}serialize(){const i=this.type,r=[i.kind];if("array"===i.kind){const n=i.itemType;if("string"===n.kind||"number"===n.kind||"boolean"===n.kind){r.push(n.kind);const o=i.N;("number"==typeof o||this.args.length>1)&&r.push(o)}}return r.concat(this.args.map(i=>i.serialize()))}}class tj{constructor(i){this.type=tx,this.sections=i}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");const n=i[1];if(!Array.isArray(n)&&"object"==typeof n)return r.error("First argument must be an image or text section.");const o=[];let s=!1;for(let a=1;a<=i.length-1;++a){const l=i[a];if(s&&"object"==typeof l&&!Array.isArray(l)){s=!1;let c=null;if(l["font-scale"]&&!(c=r.parse(l["font-scale"],1,td)))return null;let h=null;if(l["text-font"]&&!(h=r.parse(l["text-font"],1,tb(tp))))return null;let u=null;if(l["text-color"]&&!(u=r.parse(l["text-color"],1,tm)))return null;const d=o[o.length-1];d.scale=c,d.font=h,d.textColor=u}else{const p=r.parse(i[a],1,tg);if(!p)return null;const f=p.type.kind;if("string"!==f&&"value"!==f&&"null"!==f&&"resolvedImage"!==f)return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");s=!0,o.push({content:p,scale:null,font:null,textColor:null})}}return new tj(o)}evaluate(i){return new tP(this.sections.map(r=>{const n=r.content.evaluate(i);return tR(n)===tv?new tk("",n,null,null,null):new tk(tF(n),null,r.scale?r.scale.evaluate(i):null,r.font?r.font.evaluate(i).join(","):null,r.textColor?r.textColor.evaluate(i):null)}))}eachChild(i){for(const r of this.sections)i(r.content),r.scale&&i(r.scale),r.font&&i(r.font),r.textColor&&i(r.textColor)}outputDefined(){return!1}serialize(){const i=["format"];for(const r of this.sections){i.push(r.content.serialize());const n={};r.scale&&(n["font-scale"]=r.scale.serialize()),r.font&&(n["text-font"]=r.font.serialize()),r.textColor&&(n["text-color"]=r.textColor.serialize()),i.push(n)}return i}}class tG{constructor(i){this.type=tv,this.input=i}static parse(i,r){if(2!==i.length)return r.error("Expected two arguments.");const n=r.parse(i[1],1,tp);return n?new tG(n):r.error("No image name provided.")}evaluate(i){const r=this.input.evaluate(i),n=tD.fromString(r);return n&&i.availableImages&&(n.available=i.availableImages.indexOf(r)>-1),n}eachChild(i){i(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const tZ={"to-boolean":tf,"to-color":tm,"to-number":td,"to-string":tp};class t${constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");const n=i[0];if(("to-boolean"===n||"to-string"===n)&&2!==i.length)return r.error("Expected one argument.");const o=tZ[n],s=[];for(let a=1;a4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:tL(r[0],r[1],r[2],r[3])))return new tC(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new tU(n||`Could not parse color from value '${"string"==typeof r?r:String(JSON.stringify(r))}'`)}if("number"===this.type.kind){let a=null;for(const l of this.args){if(null===(a=l.evaluate(i)))return 0;const c=Number(a);if(!isNaN(c))return c}throw new tU(`Could not convert ${JSON.stringify(a)} to number.`)}return"formatted"===this.type.kind?tP.fromString(tF(this.args[0].evaluate(i))):"resolvedImage"===this.type.kind?tD.fromString(tF(this.args[0].evaluate(i))):tF(this.args[0].evaluate(i))}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){if("formatted"===this.type.kind)return new tj([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new tG(this.args[0]).serialize();const i=[`to-${this.type.kind}`];return this.eachChild(r=>{i.push(r.serialize())}),i}}const tq=["Unknown","Point","LineString","Polygon"];class tX{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?tq[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const i=this.featureDistanceData.center,r=this.featureDistanceData.scale,{x:n,y:o}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(n*r-i[0])+this.featureDistanceData.bearing[1]*(o*r-i[1])}return 0}parseColor(i){let r=this._parseColorCache[i];return r||(r=this._parseColorCache[i]=tC.parse(i)),r}}class tW{constructor(i,r,n,o){this.name=i,this.type=r,this._evaluate=n,this.args=o}evaluate(i){return this._evaluate(i,this.args)}eachChild(i){this.args.forEach(i)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(i=>i.serialize()))}static parse(i,r){const n=i[0],o=tW.definitions[n];if(!o)return r.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const s=Array.isArray(o)?o[0]:o.type,a=Array.isArray(o)?[[o[1],o[2]]]:o.overloads,l=a.filter(([r])=>!Array.isArray(r)||r.length===i.length-1);let c=null;for(const[h,u]of l){c=new it(r.registry,r.path,null,r.scope);const d=[];let p=!1;for(let f=1;fArray.isArray(i)?`(${i.map(tw).join(", ")})`:`(${tw(i.type)}...)`).join(" | "),w=[];for(let T=1;T=r[2]||i[1]<=r[1]||i[3]>=r[3])}function tJ(i,r){var n,o;let s=!1;for(let a=0,l=r.length;ai[1]!=(o=c[h+1])[1]>i[1]&&i[0]<(o[0]-n[0])*(i[1]-n[1])/(o[1]-n[1])+n[0]&&(s=!s)}}return s}function tQ(i,r,n,o){const s=o[0]-n[0],a=o[1]-n[1],l=(i[0]-n[0])*a-s*(i[1]-n[1]),c=(r[0]-n[0])*a-s*(r[1]-n[1]);return l>0&&c<0||l<0&&c>0}function t0(i,r){for(let n=0;nn[2]){const s=.5*o;let a=i[0]-n[0]>s?-o:n[0]-i[0]>s?o:0;0===a&&(a=i[0]-n[2]>s?-o:n[2]-i[0]>s?o:0),i[0]+=a}tK(r,i)}function t5(i,r,n,o){const s=8192*Math.pow(2,o.z),a=[8192*o.x,8192*o.y],l=[];for(const c of i)for(const h of c){const u=[h.x+a[0],h.y+a[1]];t3(u,r,n,s),l.push(u)}return l}function t4(i,r,n,o){var s;const a=8192*Math.pow(2,o.z),l=[8192*o.x,8192*o.y],c=[];for(const h of i){const u=[];for(const d of h){const p=[d.x+l[0],d.y+l[1]];tK(r,p),u.push(p)}c.push(u)}if(r[2]-r[0]<=a/2)for(const f of((s=r)[0]=s[1]=1/0,s[2]=s[3]=-1/0,c))for(const m of f)t3(m,r,n,a);return c}class t6{constructor(i,r){this.type=tf,this.geojson=i,this.geometries=r}static parse(i,r){if(2!==i.length)return r.error(`'within' expression requires exactly one argument, but found ${i.length-1} instead.`);if(tB(i[1])){const n=i[1];if("FeatureCollection"===n.type)for(let o=0;o{r&&!t8(i)&&(r=!1)}),r}function t9(i){if(i instanceof tW&&"feature-state"===i.name)return!1;let r=!0;return i.eachChild(i=>{r&&!t9(i)&&(r=!1)}),r}function t7(i,r){if(i instanceof tW&&r.indexOf(i.name)>=0)return!1;let n=!0;return i.eachChild(i=>{n&&!t7(i,r)&&(n=!1)}),n}class ie{constructor(i,r){this.type=r.type,this.name=i,this.boundExpression=r}static parse(i,r){if(2!==i.length||"string"!=typeof i[1])return r.error("'var' expression requires exactly one string literal argument.");const n=i[1];return r.scope.has(n)?new ie(n,r.scope.get(n)):r.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(i){return this.boundExpression.evaluate(i)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class it{constructor(i,r=[],n,o=new th,s=[]){this.registry=i,this.path=r,this.key=r.map(i=>`[${i}]`).join(""),this.scope=o,this.errors=s,this.expectedType=n}parse(i,r,n,o,s={}){return r?this.concat(r,n,o)._parse(i,s):this._parse(i,s)}_parse(i,r){function n(i,r,n){return"assert"===n?new tN(r,[i]):"coerce"===n?new t$(r,[i]):i}if(null!==i&&"string"!=typeof i&&"boolean"!=typeof i&&"number"!=typeof i||(i=["literal",i]),Array.isArray(i)){if(0===i.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const o=i[0];if("string"!=typeof o)return this.error(`Expression name must be a string, but found ${typeof o} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const s=this.registry[o];if(s){let a=s.parse(i,this);if(!a)return null;if(this.expectedType){const l=this.expectedType,c=a.type;if("string"!==l.kind&&"number"!==l.kind&&"boolean"!==l.kind&&"object"!==l.kind&&"array"!==l.kind||"value"!==c.kind){if("color"!==l.kind&&"formatted"!==l.kind&&"resolvedImage"!==l.kind||"value"!==c.kind&&"string"!==c.kind){if(this.checkSubtype(l,c))return null}else a=n(a,l,r.typeAnnotation||"coerce")}else a=n(a,l,r.typeAnnotation||"assert")}if(!(a instanceof tO)&&"resolvedImage"!==a.type.kind&&function i(r){if(r instanceof ie)return i(r.boundExpression);if(r instanceof tW&&"error"===r.name||r instanceof tH||r instanceof t6)return!1;const n=r instanceof t$||r instanceof tN;let o=!0;return r.eachChild(r=>{o=n?o&&i(r):o&&r instanceof tO}),!!o&&t8(r)&&t7(r,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}(a)){const h=new tX;try{a=new tO(a.type,a.evaluate(h))}catch(u){return this.error(u.message),null}}return a}return this.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===i?"'undefined' value invalid. Use null instead.":"object"==typeof i?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof i} instead.`)}concat(i,r,n){const o="number"==typeof i?this.path.concat(i):this.path,s=n?this.scope.concat(n):this.scope;return new it(this.registry,o,r||null,s,this.errors)}error(i,...r){const n=`${this.key}${r.map(i=>`[${i}]`).join("")}`;this.errors.push(new tc(n,i))}checkSubtype(i,r){const n=tE(i,r);return n&&this.error(n),n}}function ii(i,r){const n=i.length-1;let o,s,a=0,l=n,c=0;for(;a<=l;)if(o=i[c=Math.floor((a+l)/2)],s=i[c+1],o<=r){if(c===n||rr))throw new tU("Input is not a number.");l=c-1}return 0}class ir{constructor(i,r,n){for(const[o,s]of(this.type=i,this.input=r,this.labels=[],this.outputs=[],n))this.labels.push(o),this.outputs.push(s)}static parse(i,r){if(i.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return r.error("Expected an even number of arguments.");const n=r.parse(i[1],1,td);if(!n)return null;const o=[];let s=null;r.expectedType&&"value"!==r.expectedType.kind&&(s=r.expectedType);for(let a=1;a=l)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',h);const d=r.parse(c,u,s);if(!d)return null;s=s||d.type,o.push([l,d])}return new ir(s,n,o)}evaluate(i){const r=this.labels,n=this.outputs;if(1===r.length)return n[0].evaluate(i);const o=this.input.evaluate(i);if(o<=r[0])return n[0].evaluate(i);const s=r.length;return o>=r[s-1]?n[s-1].evaluate(i):n[ii(r,o)].evaluate(i)}eachChild(i){for(const r of(i(this.input),this.outputs))i(r)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}serialize(){const i=["step",this.input.serialize()];for(let r=0;r0&&i.push(this.labels[r]),i.push(this.outputs[r].serialize());return i}}function io(i,r,n){return i*(1-n)+r*n}var is=Object.freeze({__proto__:null,number:io,color:function(i,r,n){return new tC(io(i.r,r.r,n),io(i.g,r.g,n),io(i.b,r.b,n),io(i.a,r.a,n))},array:function(i,r,n){return i.map((i,o)=>io(i,r[o],n))}});const ia=4/29,il=6/29,ic=3*il*il,ih=Math.PI/180,iu=180/Math.PI;function id(i){return i>.008856451679035631?Math.pow(i,1/3):i/ic+ia}function ip(i){return i>il?i*i*i:ic*(i-ia)}function im(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function i_(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function ig(i){const r=i_(i.r),n=i_(i.g),o=i_(i.b),s=id((.4124564*r+.3575761*n+.1804375*o)/.95047),a=id((.2126729*r+.7151522*n+.072175*o)/1);return{l:116*a-16,a:500*(s-a),b:200*(a-id((.0193339*r+.119192*n+.9503041*o)/1.08883)),alpha:i.a}}function iy(i){let r=(i.l+16)/116,n=isNaN(i.a)?r:r+i.a/500,o=isNaN(i.b)?r:r-i.b/200;return r=1*ip(r),n=.95047*ip(n),o=1.08883*ip(o),new tC(im(3.2404542*n-1.5371385*r-.4985314*o),im(-.969266*n+1.8760108*r+.041556*o),im(.0556434*n-.2040259*r+1.0572252*o),i.alpha)}const ix={forward:ig,reverse:iy,interpolate:function(i,r,n){return{l:io(i.l,r.l,n),a:io(i.a,r.a,n),b:io(i.b,r.b,n),alpha:io(i.alpha,r.alpha,n)}}},iv={forward:function(i){const{l:r,a:n,b:o}=ig(i),s=Math.atan2(o,n)*iu;return{h:s<0?s+360:s,c:Math.sqrt(n*n+o*o),l:r,alpha:i.a}},reverse:function(i){const r=i.h*ih,n=i.c;return iy({l:i.l,a:Math.cos(r)*n,b:Math.sin(r)*n,alpha:i.alpha})},interpolate:function(i,r,n){return{h:function(i,r,n){const o=r-i;return i+n*(o>180||o<-180?o-360*Math.round(o/360):o)}(i.h,r.h,n),c:io(i.c,r.c,n),l:io(i.l,r.l,n),alpha:io(i.alpha,r.alpha,n)}}};var ib=Object.freeze({__proto__:null,lab:ix,hcl:iv});class iw{constructor(i,r,n,o,s){for(const[a,l]of(this.type=i,this.operator=r,this.interpolation=n,this.input=o,this.labels=[],this.outputs=[],s))this.labels.push(a),this.outputs.push(l)}static interpolationFactor(i,r,n,o){let s=0;if("exponential"===i.name)s=iT(r,i.base,n,o);else if("linear"===i.name)s=iT(r,1,n,o);else if("cubic-bezier"===i.name){const a=i.controlPoints;s=new h(a[0],a[1],a[2],a[3]).solve(iT(r,1,n,o))}return s}static parse(i,r){let[n,o,s,...a]=i;if(!Array.isArray(o)||0===o.length)return r.error("Expected an interpolation type expression.",1);if("linear"===o[0])o={name:"linear"};else if("exponential"===o[0]){const l=o[1];if("number"!=typeof l)return r.error("Exponential interpolation requires a numeric base.",1,1);o={name:"exponential",base:l}}else{if("cubic-bezier"!==o[0])return r.error(`Unknown interpolation type ${String(o[0])}`,1,0);{const c=o.slice(1);if(4!==c.length||c.some(i=>"number"!=typeof i||i<0||i>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);o={name:"cubic-bezier",controlPoints:c}}}if(i.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(!(s=r.parse(s,2,td)))return null;const h=[];let u=null;"interpolate-hcl"===n||"interpolate-lab"===n?u=tm:r.expectedType&&"value"!==r.expectedType.kind&&(u=r.expectedType);for(let d=0;d=p)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',m);const g=r.parse(f,_,u);if(!g)return null;u=u||g.type,h.push([p,g])}return"number"===u.kind||"color"===u.kind||"array"===u.kind&&"number"===u.itemType.kind&&"number"==typeof u.N?new iw(u,n,o,s,h):r.error(`Type ${tw(u)} is not interpolatable.`)}evaluate(i){const r=this.labels,n=this.outputs;if(1===r.length)return n[0].evaluate(i);const o=this.input.evaluate(i);if(o<=r[0])return n[0].evaluate(i);const s=r.length;if(o>=r[s-1])return n[s-1].evaluate(i);const a=ii(r,o),l=iw.interpolationFactor(this.interpolation,o,r[a],r[a+1]),c=n[a].evaluate(i),h=n[a+1].evaluate(i);return"interpolate"===this.operator?is[this.type.kind.toLowerCase()](c,h,l):"interpolate-hcl"===this.operator?iv.reverse(iv.interpolate(iv.forward(c),iv.forward(h),l)):ix.reverse(ix.interpolate(ix.forward(c),ix.forward(h),l))}eachChild(i){for(const r of(i(this.input),this.outputs))i(r)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}serialize(){let i;i="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const r=[this.operator,i,this.input.serialize()];for(let n=0;ntE(o,i.type));return new iE(c?tg:n,s)}evaluate(i){let r,n=null,o=0;for(const s of this.args){if(o++,(n=s.evaluate(i))&&n instanceof tD&&!n.available&&(r||(r=n),n=null,o===this.args.length))return r;if(null!==n)break}return n}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){const i=["coalesce"];return this.eachChild(r=>{i.push(r.serialize())}),i}}class iS{constructor(i,r){this.type=r.type,this.bindings=[].concat(i),this.result=r}evaluate(i){return this.result.evaluate(i)}eachChild(i){for(const r of this.bindings)i(r[1]);i(this.result)}static parse(i,r){if(i.length<4)return r.error(`Expected at least 3 arguments, but found ${i.length-1} instead.`);const n=[];for(let o=1;o=n.length)throw new tU(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new tU(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(i){i(this.index),i(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class iM{constructor(i,r){this.type=tf,this.needle=i,this.haystack=r}static parse(i,r){if(3!==i.length)return r.error(`Expected 2 arguments, but found ${i.length-1} instead.`);const n=r.parse(i[1],1,tg),o=r.parse(i[2],2,tg);return n&&o?tS(n.type,[tf,tp,td,tu,tg])?new iM(n,o):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${tw(n.type)} instead`):null}evaluate(i){const r=this.needle.evaluate(i),n=this.haystack.evaluate(i);if(!n)return!1;if(!tI(r,["boolean","string","number","null"]))throw new tU(`Expected first argument to be of type boolean, string, number or null, but found ${tw(tR(r))} instead.`);if(!tI(n,["string","array"]))throw new tU(`Expected second argument to be of type array or string, but found ${tw(tR(n))} instead.`);return n.indexOf(r)>=0}eachChild(i){i(this.needle),i(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class iA{constructor(i,r,n){this.type=td,this.needle=i,this.haystack=r,this.fromIndex=n}static parse(i,r){if(i.length<=2||i.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);const n=r.parse(i[1],1,tg),o=r.parse(i[2],2,tg);if(!n||!o)return null;if(!tS(n.type,[tf,tp,td,tu,tg]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${tw(n.type)} instead`);if(4===i.length){const s=r.parse(i[3],3,td);return s?new iA(n,o,s):null}return new iA(n,o)}evaluate(i){const r=this.needle.evaluate(i),n=this.haystack.evaluate(i);if(!tI(r,["boolean","string","number","null"]))throw new tU(`Expected first argument to be of type boolean, string, number or null, but found ${tw(tR(r))} instead.`);if(!tI(n,["string","array"]))throw new tU(`Expected second argument to be of type array or string, but found ${tw(tR(n))} instead.`);if(this.fromIndex){const o=this.fromIndex.evaluate(i);return n.indexOf(r,o)}return n.indexOf(r)}eachChild(i){i(this.needle),i(this.haystack),this.fromIndex&&i(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const i=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),i]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class iC{constructor(i,r,n,o,s,a){this.inputType=i,this.type=r,this.input=n,this.cases=o,this.outputs=s,this.otherwise=a}static parse(i,r){let n,o;if(i.length<5)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if(i.length%2!=1)return r.error("Expected an even number of arguments.");r.expectedType&&"value"!==r.expectedType.kind&&(o=r.expectedType);const s={},a=[];for(let l=2;lNumber.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof d&&Math.floor(d)!==d)return u.error("Numeric branch labels must be integer values.");if(n){if(u.checkSubtype(n,tR(d)))return null}else n=tR(d);if(void 0!==s[String(d)])return u.error("Branch labels must be unique.");s[String(d)]=a.length}const p=r.parse(h,l,o);if(!p)return null;o=o||p.type,a.push(p)}const f=r.parse(i[1],1,tg);if(!f)return null;const m=r.parse(i[i.length-1],i.length-1,o);return m?"value"!==f.type.kind&&r.concat(1).checkSubtype(n,f.type)?null:new iC(n,o,f,s,a,m):null}evaluate(i){const r=this.input.evaluate(i);return(tR(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(i)}eachChild(i){i(this.input),this.outputs.forEach(i),i(this.otherwise)}outputDefined(){return this.outputs.every(i=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){const i=["match",this.input.serialize()],r=Object.keys(this.cases).sort(),n=[],o={};for(const s of r){const a=o[this.cases[s]];void 0===a?(o[this.cases[s]]=n.length,n.push([this.cases[s],[s]])):n[a][1].push(s)}const l=i=>"number"===this.inputType.kind?Number(i):i;for(const[c,h]of n)i.push(1===h.length?l(h[0]):h.map(l)),i.push(this.outputs[c].serialize());return i.push(this.otherwise.serialize()),i}}class iz{constructor(i,r,n){this.type=i,this.branches=r,this.otherwise=n}static parse(i,r){let n;if(i.length<4)return r.error(`Expected at least 3 arguments, but found only ${i.length-1}.`);if(i.length%2!=0)return r.error("Expected an odd number of arguments.");r.expectedType&&"value"!==r.expectedType.kind&&(n=r.expectedType);const o=[];for(let s=1;sr.outputDefined())&&this.otherwise.outputDefined()}serialize(){const i=["case"];return this.eachChild(r=>{i.push(r.serialize())}),i}}class ik{constructor(i,r,n,o){this.type=i,this.input=r,this.beginIndex=n,this.endIndex=o}static parse(i,r){if(i.length<=2||i.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);const n=r.parse(i[1],1,tg),o=r.parse(i[2],2,td);if(!n||!o)return null;if(!tS(n.type,[tb(tg),tp,tg]))return r.error(`Expected first argument to be of type array or string, but found ${tw(n.type)} instead`);if(4===i.length){const s=r.parse(i[3],3,td);return s?new ik(n.type,n,o,s):null}return new ik(n.type,n,o)}evaluate(i){const r=this.input.evaluate(i),n=this.beginIndex.evaluate(i);if(!tI(r,["string","array"]))throw new tU(`Expected first argument to be of type array or string, but found ${tw(tR(r))} instead.`);if(this.endIndex){const o=this.endIndex.evaluate(i);return r.slice(n,o)}return r.slice(n)}eachChild(i){i(this.input),i(this.beginIndex),this.endIndex&&i(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const i=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),i]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function iP(i,r){return"=="===i||"!="===i?"boolean"===r.kind||"string"===r.kind||"number"===r.kind||"null"===r.kind||"value"===r.kind:"string"===r.kind||"number"===r.kind||"value"===r.kind}function iD(i,r,n,o){return 0===o.compare(r,n)}function iL(i,r,n){const o="=="!==i&&"!="!==i;return class s{constructor(i,r,n){this.type=tf,this.lhs=i,this.rhs=r,this.collator=n,this.hasUntypedArgument="value"===i.type.kind||"value"===r.type.kind}static parse(i,r){if(3!==i.length&&4!==i.length)return r.error("Expected two or three arguments.");const n=i[0];let a=r.parse(i[1],1,tg);if(!a)return null;if(!iP(n,a.type))return r.concat(1).error(`"${n}" comparisons are not supported for type '${tw(a.type)}'.`);let l=r.parse(i[2],2,tg);if(!l)return null;if(!iP(n,l.type))return r.concat(2).error(`"${n}" comparisons are not supported for type '${tw(l.type)}'.`);if(a.type.kind!==l.type.kind&&"value"!==a.type.kind&&"value"!==l.type.kind)return r.error(`Cannot compare types '${tw(a.type)}' and '${tw(l.type)}'.`);o&&("value"===a.type.kind&&"value"!==l.type.kind?a=new tN(l.type,[a]):"value"!==a.type.kind&&"value"===l.type.kind&&(l=new tN(a.type,[l])));let c=null;if(4===i.length){if("string"!==a.type.kind&&"string"!==l.type.kind&&"value"!==a.type.kind&&"value"!==l.type.kind)return r.error("Cannot use collator to compare non-string types.");if(!(c=r.parse(i[3],3,ty)))return null}return new s(a,l,c)}evaluate(s){const a=this.lhs.evaluate(s),l=this.rhs.evaluate(s);if(o&&this.hasUntypedArgument){const c=tR(a),h=tR(l);if(c.kind!==h.kind||"string"!==c.kind&&"number"!==c.kind)throw new tU(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${c.kind}, ${h.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const u=tR(a),d=tR(l);if("string"!==u.kind||"string"!==d.kind)return r(s,a,l)}return this.collator?n(s,a,l,this.collator.evaluate(s)):r(s,a,l)}eachChild(i){i(this.lhs),i(this.rhs),this.collator&&i(this.collator)}outputDefined(){return!0}serialize(){const r=[i];return this.eachChild(i=>{r.push(i.serialize())}),r}}}const iB=iL("==",function(i,r,n){return r===n},iD),iR=iL("!=",function(i,r,n){return r!==n},function(i,r,n,o){return!iD(0,r,n,o)}),iF=iL("<",function(i,r,n){return ro.compare(r,n)}),iO=iL(">",function(i,r,n){return r>n},function(i,r,n,o){return o.compare(r,n)>0}),iU=iL("<=",function(i,r,n){return r<=n},function(i,r,n,o){return 0>=o.compare(r,n)}),iV=iL(">=",function(i,r,n){return r>=n},function(i,r,n,o){return o.compare(r,n)>=0});class iN{constructor(i,r,n,o,s){this.type=tp,this.number=i,this.locale=r,this.currency=n,this.minFractionDigits=o,this.maxFractionDigits=s}static parse(i,r){if(3!==i.length)return r.error("Expected two arguments.");const n=r.parse(i[1],1,td);if(!n)return null;const o=i[2];if("object"!=typeof o||Array.isArray(o))return r.error("NumberFormat options argument must be an object.");let s=null;if(o.locale&&!(s=r.parse(o.locale,1,tp)))return null;let a=null;if(o.currency&&!(a=r.parse(o.currency,1,tp)))return null;let l=null;if(o["min-fraction-digits"]&&!(l=r.parse(o["min-fraction-digits"],1,td)))return null;let c=null;return!o["max-fraction-digits"]||(c=r.parse(o["max-fraction-digits"],1,td))?new iN(n,s,a,l,c):null}evaluate(i){return new Intl.NumberFormat(this.locale?this.locale.evaluate(i):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(i):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(i):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(i):void 0}).format(this.number.evaluate(i))}eachChild(i){i(this.number),this.locale&&i(this.locale),this.currency&&i(this.currency),this.minFractionDigits&&i(this.minFractionDigits),this.maxFractionDigits&&i(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const i={};return this.locale&&(i.locale=this.locale.serialize()),this.currency&&(i.currency=this.currency.serialize()),this.minFractionDigits&&(i["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(i["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),i]}}class ij{constructor(i){this.type=td,this.input=i}static parse(i,r){if(2!==i.length)return r.error(`Expected 1 argument, but found ${i.length-1} instead.`);const n=r.parse(i[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?r.error(`Expected argument of type string or array, but found ${tw(n.type)} instead.`):new ij(n):null}evaluate(i){const r=this.input.evaluate(i);if("string"==typeof r||Array.isArray(r))return r.length;throw new tU(`Expected value to be of type string or array, but found ${tw(tR(r))} instead.`)}eachChild(i){i(this.input)}outputDefined(){return!1}serialize(){const i=["length"];return this.eachChild(r=>{i.push(r.serialize())}),i}}const iG={"==":iB,"!=":iR,">":iO,"<":iF,">=":iV,"<=":iU,array:tN,at:iI,boolean:tN,case:iz,coalesce:iE,collator:tH,format:tj,image:tG,in:iM,"index-of":iA,interpolate:iw,"interpolate-hcl":iw,"interpolate-lab":iw,length:ij,let:iS,literal:tO,match:iC,number:tN,"number-format":iN,object:tN,slice:ik,step:ir,string:tN,"to-boolean":t$,"to-color":t$,"to-number":t$,"to-string":t$,var:ie,within:t6};function iZ(i,[r,n,o,s]){r=r.evaluate(i),n=n.evaluate(i),o=o.evaluate(i);const a=s?s.evaluate(i):1,l=tL(r,n,o,a);if(l)throw new tU(l);return new tC(r/255*a,n/255*a,o/255*a,a)}function i$(i,r){const n=r[i];return void 0===n?null:n}function iq(i){return{type:i}}function iX(i){return{result:"success",value:i}}function iW(i){return{result:"error",value:i}}function iH(i){return"data-driven"===i["property-type"]||"cross-faded-data-driven"===i["property-type"]}function iK(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function iY(i){return!!i.expression&&i.expression.interpolated}function iJ(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":null===i?"null":typeof i}function iQ(i){return"object"==typeof i&&null!==i&&!Array.isArray(i)}function i0(i){return i}function i1(i,r,n){return void 0!==i?i:void 0!==r?r:void 0!==n?n:void 0}function i2(i,r,n,o,s){return i1(typeof n===s?o[n]:void 0,i.default,r.default)}function i3(i,r,n){if("number"!==iJ(n))return i1(i.default,r.default);const o=i.stops.length;if(1===o||n<=i.stops[0][0])return i.stops[0][1];if(n>=i.stops[o-1][0])return i.stops[o-1][1];const s=ii(i.stops.map(i=>i[0]),n);return i.stops[s][1]}function i5(i,r,n){const o=void 0!==i.base?i.base:1;if("number"!==iJ(n))return i1(i.default,r.default);const s=i.stops.length;if(1===s||n<=i.stops[0][0])return i.stops[0][1];if(n>=i.stops[s-1][0])return i.stops[s-1][1];const a=ii(i.stops.map(i=>i[0]),n),l=function(i,r,n,o){const s=o-n,a=i-n;return 0===s?0:1===r?a/s:(Math.pow(r,a)-1)/(Math.pow(r,s)-1)}(n,o,i.stops[a][0],i.stops[a+1][0]),c=i.stops[a][1],h=i.stops[a+1][1];let u=is[r.type]||i0;if(i.colorSpace&&"rgb"!==i.colorSpace){const d=ib[i.colorSpace];u=(i,r)=>d.reverse(d.interpolate(d.forward(i),d.forward(r),l))}return"function"==typeof c.evaluate?{evaluate(...i){const r=c.evaluate.apply(void 0,i),n=h.evaluate.apply(void 0,i);if(void 0!==r&&void 0!==n)return u(r,n,l)}}:u(c,h,l)}function i4(i,r,n){return"color"===r.type?n=tC.parse(n):"formatted"===r.type?n=tP.fromString(n.toString()):"resolvedImage"===r.type?n=tD.fromString(n.toString()):iJ(n)===r.type||"enum"===r.type&&r.values[n]||(n=void 0),i1(n,i.default,r.default)}tW.register(iG,{error:[{kind:"error"},[tp],(i,[r])=>{throw new tU(r.evaluate(i))}],typeof:[tp,[tg],(i,[r])=>tw(tR(r.evaluate(i)))],"to-rgba":[tb(td,4),[tm],(i,[r])=>r.evaluate(i).toArray()],rgb:[tm,[td,td,td],iZ],rgba:[tm,[td,td,td,td],iZ],has:{type:tf,overloads:[[[tp],(i,[r])=>r.evaluate(i) in i.properties()],[[tp,t_],(i,[r,n])=>r.evaluate(i) in n.evaluate(i)]]},get:{type:tg,overloads:[[[tp],(i,[r])=>i$(r.evaluate(i),i.properties())],[[tp,t_],(i,[r,n])=>i$(r.evaluate(i),n.evaluate(i))]]},"feature-state":[tg,[tp],(i,[r])=>i$(r.evaluate(i),i.featureState||{})],properties:[t_,[],i=>i.properties()],"geometry-type":[tp,[],i=>i.geometryType()],id:[tg,[],i=>i.id()],zoom:[td,[],i=>i.globals.zoom],pitch:[td,[],i=>i.globals.pitch||0],"distance-from-center":[td,[],i=>i.distanceFromCenter()],"heatmap-density":[td,[],i=>i.globals.heatmapDensity||0],"line-progress":[td,[],i=>i.globals.lineProgress||0],"sky-radial-progress":[td,[],i=>i.globals.skyRadialProgress||0],accumulated:[tg,[],i=>void 0===i.globals.accumulated?null:i.globals.accumulated],"+":[td,iq(td),(i,r)=>{let n=0;for(const o of r)n+=o.evaluate(i);return n}],"*":[td,iq(td),(i,r)=>{let n=1;for(const o of r)n*=o.evaluate(i);return n}],"-":{type:td,overloads:[[[td,td],(i,[r,n])=>r.evaluate(i)-n.evaluate(i)],[[td],(i,[r])=>-r.evaluate(i)]]},"/":[td,[td,td],(i,[r,n])=>r.evaluate(i)/n.evaluate(i)],"%":[td,[td,td],(i,[r,n])=>r.evaluate(i)%n.evaluate(i)],ln2:[td,[],()=>Math.LN2],pi:[td,[],()=>Math.PI],e:[td,[],()=>Math.E],"^":[td,[td,td],(i,[r,n])=>Math.pow(r.evaluate(i),n.evaluate(i))],sqrt:[td,[td],(i,[r])=>Math.sqrt(r.evaluate(i))],log10:[td,[td],(i,[r])=>Math.log(r.evaluate(i))/Math.LN10],ln:[td,[td],(i,[r])=>Math.log(r.evaluate(i))],log2:[td,[td],(i,[r])=>Math.log(r.evaluate(i))/Math.LN2],sin:[td,[td],(i,[r])=>Math.sin(r.evaluate(i))],cos:[td,[td],(i,[r])=>Math.cos(r.evaluate(i))],tan:[td,[td],(i,[r])=>Math.tan(r.evaluate(i))],asin:[td,[td],(i,[r])=>Math.asin(r.evaluate(i))],acos:[td,[td],(i,[r])=>Math.acos(r.evaluate(i))],atan:[td,[td],(i,[r])=>Math.atan(r.evaluate(i))],min:[td,iq(td),(i,r)=>Math.min(...r.map(r=>r.evaluate(i)))],max:[td,iq(td),(i,r)=>Math.max(...r.map(r=>r.evaluate(i)))],abs:[td,[td],(i,[r])=>Math.abs(r.evaluate(i))],round:[td,[td],(i,[r])=>{const n=r.evaluate(i);return n<0?-Math.round(-n):Math.round(n)}],floor:[td,[td],(i,[r])=>Math.floor(r.evaluate(i))],ceil:[td,[td],(i,[r])=>Math.ceil(r.evaluate(i))],"filter-==":[tf,[tp,tg],(i,[r,n])=>i.properties()[r.value]===n.value],"filter-id-==":[tf,[tg],(i,[r])=>i.id()===r.value],"filter-type-==":[tf,[tp],(i,[r])=>i.geometryType()===r.value],"filter-<":[tf,[tp,tg],(i,[r,n])=>{const o=i.properties()[r.value],s=n.value;return typeof o==typeof s&&o{const n=i.id(),o=r.value;return typeof n==typeof o&&n":[tf,[tp,tg],(i,[r,n])=>{const o=i.properties()[r.value],s=n.value;return typeof o==typeof s&&o>s}],"filter-id->":[tf,[tg],(i,[r])=>{const n=i.id(),o=r.value;return typeof n==typeof o&&n>o}],"filter-<=":[tf,[tp,tg],(i,[r,n])=>{const o=i.properties()[r.value],s=n.value;return typeof o==typeof s&&o<=s}],"filter-id-<=":[tf,[tg],(i,[r])=>{const n=i.id(),o=r.value;return typeof n==typeof o&&n<=o}],"filter->=":[tf,[tp,tg],(i,[r,n])=>{const o=i.properties()[r.value],s=n.value;return typeof o==typeof s&&o>=s}],"filter-id->=":[tf,[tg],(i,[r])=>{const n=i.id(),o=r.value;return typeof n==typeof o&&n>=o}],"filter-has":[tf,[tg],(i,[r])=>r.value in i.properties()],"filter-has-id":[tf,[],i=>null!==i.id()&&void 0!==i.id()],"filter-type-in":[tf,[tb(tp)],(i,[r])=>r.value.indexOf(i.geometryType())>=0],"filter-id-in":[tf,[tb(tg)],(i,[r])=>r.value.indexOf(i.id())>=0],"filter-in-small":[tf,[tp,tb(tg)],(i,[r,n])=>n.value.indexOf(i.properties()[r.value])>=0],"filter-in-large":[tf,[tp,tb(tg)],(i,[r,n])=>(function(i,r,n,o){for(;n<=o;){const s=n+o>>1;if(r[s]===i)return!0;r[s]>i?o=s-1:n=s+1}return!1})(i.properties()[r.value],n.value,0,n.value.length-1)],all:{type:tf,overloads:[[[tf,tf],(i,[r,n])=>r.evaluate(i)&&n.evaluate(i)],[iq(tf),(i,r)=>{for(const n of r)if(!n.evaluate(i))return!1;return!0}]]},any:{type:tf,overloads:[[[tf,tf],(i,[r,n])=>r.evaluate(i)||n.evaluate(i)],[iq(tf),(i,r)=>{for(const n of r)if(n.evaluate(i))return!0;return!1}]]},"!":[tf,[tf],(i,[r])=>!r.evaluate(i)],"is-supported-script":[tf,[tp],(i,[r])=>{const n=i.globals&&i.globals.isSupportedScript;return!n||n(r.evaluate(i))}],upcase:[tp,[tp],(i,[r])=>r.evaluate(i).toUpperCase()],downcase:[tp,[tp],(i,[r])=>r.evaluate(i).toLowerCase()],concat:[tp,iq(tg),(i,r)=>r.map(r=>tF(r.evaluate(i))).join("")],"resolved-locale":[tp,[ty],(i,[r])=>r.evaluate(i).resolvedLocale()]});class i6{constructor(i,r){this.expression=i,this._warningHistory={},this._evaluator=new tX,this._defaultValue=r?"color"===r.type&&iQ(r.default)?new tC(0,0,0,0):"color"===r.type?tC.parse(r.default)||null:void 0===r.default?null:r.default:null,this._enumValues=r&&"enum"===r.type?r.values:null}evaluateWithoutErrorHandling(i,r,n,o,s,a,l,c){return this._evaluator.globals=i,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=o,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=a,this._evaluator.featureTileCoord=l||null,this._evaluator.featureDistanceData=c||null,this.expression.evaluate(this._evaluator)}evaluate(i,r,n,o,s,a,l,c){this._evaluator.globals=i,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=o,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=a||null,this._evaluator.featureTileCoord=l||null,this._evaluator.featureDistanceData=c||null;try{const h=this.expression.evaluate(this._evaluator);if(null==h||"number"==typeof h&&h!=h)return this._defaultValue;if(this._enumValues&&!(h in this._enumValues))throw new tU(`Expected value to be one of ${Object.keys(this._enumValues).map(i=>JSON.stringify(i)).join(", ")}, but found ${JSON.stringify(h)} instead.`);return h}catch(u){return this._warningHistory[u.message]||(this._warningHistory[u.message]=!0,"undefined"!=typeof console&&console.warn(u.message)),this._defaultValue}}}function i8(i){return Array.isArray(i)&&i.length>0&&"string"==typeof i[0]&&i[0]in iG}function i9(i,r){const n=new it(iG,[],r?function(i){const r={color:tm,string:tp,number:td,enum:tp,boolean:tf,formatted:tx,resolvedImage:tv};return"array"===i.type?tb(r[i.value]||tg,i.length):r[i.type]}(r):void 0),o=n.parse(i,void 0,void 0,void 0,r&&"string"===r.type?{typeAnnotation:"coerce"}:void 0);return o?iX(new i6(o,r)):iW(n.errors)}class i7{constructor(i,r){this.kind=i,this._styleExpression=r,this.isStateDependent="constant"!==i&&!t9(r.expression)}evaluateWithoutErrorHandling(i,r,n,o,s,a){return this._styleExpression.evaluateWithoutErrorHandling(i,r,n,o,s,a)}evaluate(i,r,n,o,s,a){return this._styleExpression.evaluate(i,r,n,o,s,a)}}class re{constructor(i,r,n,o){this.kind=i,this.zoomStops=n,this._styleExpression=r,this.isStateDependent="camera"!==i&&!t9(r.expression),this.interpolationType=o}evaluateWithoutErrorHandling(i,r,n,o,s,a){return this._styleExpression.evaluateWithoutErrorHandling(i,r,n,o,s,a)}evaluate(i,r,n,o,s,a){return this._styleExpression.evaluate(i,r,n,o,s,a)}interpolationFactor(i,r,n){return this.interpolationType?iw.interpolationFactor(this.interpolationType,i,r,n):0}}function rt(i,r){if("error"===(i=i9(i,r)).result)return i;const n=i.value.expression,o=t8(n);if(!o&&!iH(r))return iW([new tc("","data expressions not supported")]);const s=t7(n,["zoom","pitch","distance-from-center"]);if(!s&&!iK(r))return iW([new tc("","zoom expressions not supported")]);const a=function i(r){let n=null;if(r instanceof iS)n=i(r.result);else if(r instanceof iE){for(const o of r.args)if(n=i(o))break}else(r instanceof ir||r instanceof iw)&&r.input instanceof tW&&"zoom"===r.input.name&&(n=r);return n instanceof tc||r.eachChild(r=>{const o=i(r);o instanceof tc?n=o:!n&&o?n=new tc("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&o&&n!==o&&(n=new tc("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n}(n);return a||s?a instanceof tc?iW([a]):a instanceof iw&&!iY(r)?iW([new tc("",'"interpolate" expressions cannot be used with this property')]):iX(a?new re(o?"camera":"composite",i.value,a.labels,a instanceof iw?a.interpolation:void 0):new i7(o?"constant":"source",i.value)):iW([new tc("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ri{constructor(i,r){this._parameters=i,this._specification=r,ts(this,function i(r,n){let o,s,a;const l="color"===n.type,c=r.stops&&"object"==typeof r.stops[0][0],h=c||!(c||void 0!==r.property),u=r.type||(iY(n)?"exponential":"interval");if(l&&((r=ts({},r)).stops&&(r.stops=r.stops.map(i=>[i[0],tC.parse(i[1])])),r.default=tC.parse(r.default?r.default:n.default)),r.colorSpace&&"rgb"!==r.colorSpace&&!ib[r.colorSpace])throw Error(`Unknown color space: ${r.colorSpace}`);if("exponential"===u)o=i5;else if("interval"===u)o=i3;else if("categorical"===u){for(const d of(o=i2,s=Object.create(null),r.stops))s[d[0]]=d[1];a=typeof r.stops[0][0]}else{if("identity"!==u)throw Error(`Unknown function type "${u}"`);o=i4}if(c){const p={},f=[];for(let m=0;mi[0]),evaluate:({zoom:i},o)=>i5({stops:y,base:r.base},n,i).evaluate(i,o)}}if(h){const b="exponential"===u?{name:"exponential",base:void 0!==r.base?r.base:1}:null;return{kind:"camera",interpolationType:b,interpolationFactor:iw.interpolationFactor.bind(void 0,b),zoomStops:r.stops.map(i=>i[0]),evaluate:({zoom:i})=>o(r,n,i,s,a)}}return{kind:"source",evaluate(i,l){const c=l&&l.properties?l.properties[r.property]:void 0;return void 0===c?i1(r.default,n.default):o(r,n,c,s,a)}}}(this._parameters,this._specification))}static deserialize(i){return new ri(i._parameters,i._specification)}static serialize(i){return{_parameters:i._parameters,_specification:i._specification}}}function rr(i){const r=i.key,n=i.value,o=i.valueSpec||{},s=i.objectElementValidators||{},a=i.style,l=i.styleSpec;let c=[];const h=iJ(n);if("object"!==h)return[new tn(r,n,`object expected, ${h} found`)];for(const u in n){let d;const p=u.split(".")[0],f=o[p]||o["*"];if(s[p])d=s[p];else if(o[p])d=rz;else if(s["*"])d=s["*"];else{if(!o["*"]){c.push(new tn(r,n[u],`unknown property "${u}"`));continue}d=rz}c=c.concat(d({key:(r?`${r}.`:r)+u,value:n[u],valueSpec:f,style:a,styleSpec:l,object:n,objectKey:u},n))}for(const m in o)s[m]||o[m].required&&void 0===o[m].default&&void 0===n[m]&&c.push(new tn(r,n,`missing required property "${m}"`));return c}function rn(i){const r=i.value,n=i.valueSpec,o=i.style,s=i.styleSpec,a=i.key,l=i.arrayElementValidator||rz;if("array"!==iJ(r))return[new tn(a,r,`array expected, ${iJ(r)} found`)];if(n.length&&r.length!==n.length)return[new tn(a,r,`array length ${n.length} expected, length ${r.length} found`)];if(n["min-length"]&&r.lengthl)return[new tn(r,n,`${n} is greater than the maximum value ${l}`)]}return[]}function rs(i){const r=i.valueSpec,n=ta(i.value.type);let o,s,a,l={};const c="categorical"!==n&&void 0===i.value.property,h="array"===iJ(i.value.stops)&&"array"===iJ(i.value.stops[0])&&"object"===iJ(i.value.stops[0][0]),u=rr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(i){if("identity"===n)return[new tn(i.key,i.value,'identity function may not have a "stops" property')];let r=[];const o=i.value;return r=r.concat(rn({key:i.key,value:o,valueSpec:i.valueSpec,style:i.style,styleSpec:i.styleSpec,arrayElementValidator:d})),"array"===iJ(o)&&0===o.length&&r.push(new tn(i.key,o,"array must have at least one stop")),r},default:function(i){return rz({key:i.key,value:i.value,valueSpec:r,style:i.style,styleSpec:i.styleSpec})}}});return"identity"===n&&c&&u.push(new tn(i.key,i.value,'missing required property "property"')),"identity"===n||i.value.stops||u.push(new tn(i.key,i.value,'missing required property "stops"')),"exponential"===n&&i.valueSpec.expression&&!iY(i.valueSpec)&&u.push(new tn(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(c||iH(i.valueSpec)?c&&!iK(i.valueSpec)&&u.push(new tn(i.key,i.value,"zoom functions not supported")):u.push(new tn(i.key,i.value,"property functions not supported"))),("categorical"===n||h)&&void 0===i.value.property&&u.push(new tn(i.key,i.value,'"property" property is required')),u;function d(i){let n=[];const o=i.value,c=i.key;if("array"!==iJ(o))return[new tn(c,o,`array expected, ${iJ(o)} found`)];if(2!==o.length)return[new tn(c,o,`array length 2 expected, length ${o.length} found`)];if(h){if("object"!==iJ(o[0]))return[new tn(c,o,`object expected, ${iJ(o[0])} found`)];if(void 0===o[0].zoom)return[new tn(c,o,"object stop key must have zoom")];if(void 0===o[0].value)return[new tn(c,o,"object stop key must have value")];if(a&&a>ta(o[0].zoom))return[new tn(c,o[0].zoom,"stop zoom values must appear in ascending order")];ta(o[0].zoom)!==a&&(a=ta(o[0].zoom),s=void 0,l={}),n=n.concat(rr({key:`${c}[0]`,value:o[0],valueSpec:{zoom:{}},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{zoom:ro,value:p}}))}else n=n.concat(p({key:`${c}[0]`,value:o[0],valueSpec:{},style:i.style,styleSpec:i.styleSpec},o));return i8(tl(o[1]))?n.concat([new tn(`${c}[1]`,o[1],"expressions are not allowed in function stops.")]):n.concat(rz({key:`${c}[1]`,value:o[1],valueSpec:r,style:i.style,styleSpec:i.styleSpec}))}function p(i,a){const c=iJ(i.value),h=ta(i.value),u=null!==i.value?i.value:a;if(o){if(c!==o)return[new tn(i.key,u,`${c} stop domain type must match previous stop domain type ${o}`)]}else o=c;if("number"!==c&&"string"!==c&&"boolean"!==c)return[new tn(i.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==c&&"categorical"!==n){let d=`number expected, ${c} found`;return iH(r)&&void 0===n&&(d+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new tn(i.key,u,d)]}return"categorical"!==n||"number"!==c||isFinite(h)&&Math.floor(h)===h?"categorical"!==n&&"number"===c&&void 0!==s&&hnew tn(`${i.key}${r.key}`,i.value,r.message));const n=r.value.expression||r.value._styleExpression.expression;if("property"===i.expressionContext&&"text-font"===i.propertyKey&&!n.outputDefined())return[new tn(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===i.expressionContext&&"layout"===i.propertyType&&!t9(n))return[new tn(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===i.expressionContext)return function i(r,n){const o=new Set(["zoom","feature-state","pitch","distance-from-center"]);for(const s of n.valueSpec.expression.parameters)o.delete(s);if(0===o.size)return[];const a=[];return r instanceof tW&&o.has(r.name)?[new tn(n.key,n.value,`["${r.name}"] expression is not supported in a filter for a ${n.object.type} layer with id: ${n.object.id}`)]:(r.eachChild(r=>{a.push(...i(r,n))}),a)}(n,i);if(i.expressionContext&&0===i.expressionContext.indexOf("cluster")){if(!t7(n,["zoom","feature-state"]))return[new tn(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===i.expressionContext&&!t8(n))return[new tn(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function rl(i){const r=i.key,n=i.value,o=i.valueSpec,s=[];return Array.isArray(o.values)?-1===o.values.indexOf(ta(n))&&s.push(new tn(r,n,`expected one of [${o.values.join(", ")}], ${JSON.stringify(n)} found`)):-1===Object.keys(o.values).indexOf(ta(n))&&s.push(new tn(r,n,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(n)} found`)),s}function rc(i){if(!0===i||!1===i)return!0;if(!Array.isArray(i)||0===i.length)return!1;switch(i[0]){case"has":return i.length>=2&&"$id"!==i[1]&&"$type"!==i[1];case"in":return i.length>=3&&("string"!=typeof i[1]||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==i.length||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const r of i.slice(1))if(!rc(r)&&"boolean"!=typeof r)return!1;return!0;default:return!0}}function rh(i,r="fill"){if(null==i)return{filter:()=>!0,needGeometry:!1,needFeature:!1};rc(i)||(i=function i(r){if(!r)return!0;const n=r[0];return r.length<=1?"any"!==n:"=="===n?rf(r[1],r[2],"=="):"!="===n?rg(rf(r[1],r[2],"==")):"<"===n||">"===n||"<="===n||">="===n?rf(r[1],r[2],n):"any"===n?["any"].concat(r.slice(1).map(i)):"all"===n?["all"].concat(r.slice(1).map(i)):"none"===n?["all"].concat(r.slice(1).map(i).map(rg)):"in"===n?rm(r[1],r.slice(2)):"!in"===n?rg(rm(r[1],r.slice(2))):"has"===n?r_(r[1]):"!has"===n?rg(r_(r[1])):"within"!==n||r}(i));const n=i;let o=!0;try{o=function(i){if(!ru(i))return i;let r=tl(i);return function i(r){let n=!1;const o=[];if("case"===r[0]){for(let s=1;si(r))}(r)}(n)}catch(s){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md and paste the contents of this message in the report. Thank you! Filter Expression: ${JSON.stringify(n,null,2)} `)}const a=tr[`filter_${r}`],l=i9(o,a);let c=null;if("error"===l.result)throw Error(l.value.map(i=>`${i.key}: ${i.message}`).join(", "));c=(i,r,n)=>l.value.evaluate(i,r,{},n);let h=null,u=null;if(o!==n){const d=i9(n,a);if("error"===d.result)throw Error(d.value.map(i=>`${i.key}: ${i.message}`).join(", "));h=(i,r,n,o,s)=>d.value.evaluate(i,r,{},n,void 0,void 0,o,s),u=!t8(d.value.expression)}return{filter:c,dynamicFilter:h||void 0,needGeometry:function i(r){if(!Array.isArray(r))return!1;if("within"===r[0])return!0;for(let n=1;n",">=","<","<=","to-boolean"]);function rp(i,r){return ir?1:0}function rf(i,r,n){switch(i){case"$type":return[`filter-type-${n}`,r];case"$id":return[`filter-id-${n}`,r];default:return[`filter-${n}`,i,r]}}function rm(i,r){if(0===r.length)return!1;switch(i){case"$type":return["filter-type-in",["literal",r]];case"$id":return["filter-id-in",["literal",r]];default:return r.length>200&&!r.some(i=>typeof i!=typeof r[0])?["filter-in-large",i,["literal",r.sort(rp)]]:["filter-in-small",i,["literal",r]]}}function r_(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function rg(i){return["!",i]}function ry(i){if(rc(tl(i.value))){const r=tl(i.layerType);return ra(ts({},i,{expressionContext:"filter",valueSpec:i.styleSpec[`filter_${r||"fill"}`]}))}return function i(r){const n=r.value,o=r.key;if("array"!==iJ(n))return[new tn(o,n,`array expected, ${iJ(n)} found`)];const s=r.styleSpec;let a,l=[];if(n.length<1)return[new tn(o,n,"filter array must have at least 1 element")];switch(l=l.concat(rl({key:`${o}[0]`,value:n[0],valueSpec:s.filter_operator,style:r.style,styleSpec:r.styleSpec})),ta(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&"$type"===ta(n[1])&&l.push(new tn(o,n,`"$type" cannot be use with operator "${n[0]}"`));case"==":case"!=":3!==n.length&&l.push(new tn(o,n,`filter array for operator "${n[0]}" must have 3 elements`));case"in":case"!in":n.length>=2&&"string"!==(a=iJ(n[1]))&&l.push(new tn(`${o}[1]`,n[1],`string expected, ${a} found`));for(let c=2;c{i in n&&r.push(new tn(o,n[i],`"${i}" is prohibited for ref layers`))}),s.layers.forEach(i=>{ta(i.id)===c&&(p=i)}),p?p.ref?r.push(new tn(o,n.ref,"ref cannot reference another ref layer")):l=ta(p.type):r.push(new tn(o,n.ref,`ref layer "${c}" not found`))}else if("background"!==l&&"sky"!==l){if(n.source){const f=s.sources&&s.sources[n.source],m=f&&ta(f.type);f?"vector"===m&&"raster"===l?r.push(new tn(o,n.source,`layer "${n.id}" requires a raster source`)):"raster"===m&&"raster"!==l?r.push(new tn(o,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==m||n["source-layer"]?"raster-dem"===m&&"hillshade"!==l?r.push(new tn(o,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"===l&&n.paint&&n.paint["line-gradient"]&&("geojson"!==m||!f.lineMetrics)&&r.push(new tn(o,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new tn(o,n,`layer "${n.id}" must specify a "source-layer"`)):r.push(new tn(o,n.source,`source "${n.source}" not found`))}else r.push(new tn(o,n,'missing required property "source"'))}return r=r.concat(rr({key:o,value:n,valueSpec:a.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>rz({key:`${o}.type`,value:n.type,valueSpec:a.layer.type,style:i.style,styleSpec:i.styleSpec,object:n,objectKey:"type"}),filter:i=>ry(ts({layerType:l},i)),layout:i=>rr({layer:n,key:i.key,value:i.value,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>rb(ts({layerType:l},i))}}),paint:i=>rr({layer:n,key:i.key,value:i.value,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>rv(ts({layerType:l},i))}})}}))}function rT(i){const r=i.value,n=i.key,o=iJ(r);return"string"!==o?[new tn(n,r,`string expected, ${o} found`)]:[]}const rE={promoteId:function({key:i,value:r}){if("string"===iJ(r))return rT({key:i,value:r});{const n=[];for(const o in r)n.push(...rT({key:`${i}.${o}`,value:r[o]}));return n}}};function rS(i){let r;const n=i.value,o=i.key,s=i.styleSpec,a=i.style;if(!n.type)return[new tn(o,n,'"type" is required')];const l=ta(n.type);switch(l){case"vector":case"raster":case"raster-dem":return rr({key:o,value:n,valueSpec:s[`source_${l.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:rE});case"geojson":if(r=rr({key:o,value:n,valueSpec:s.source_geojson,style:a,styleSpec:s,objectElementValidators:rE}),n.cluster)for(const c in n.clusterProperties){const[h,u]=n.clusterProperties[c],d="string"==typeof h?[h,["accumulated"],["get",c]]:h;r.push(...ra({key:`${o}.${c}.map`,value:u,expressionContext:"cluster-map"})),r.push(...ra({key:`${o}.${c}.reduce`,value:d,expressionContext:"cluster-reduce"}))}return r;case"video":return rr({key:o,value:n,valueSpec:s.source_video,style:a,styleSpec:s});case"image":return rr({key:o,value:n,valueSpec:s.source_image,style:a,styleSpec:s});case"canvas":return[new tn(o,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return rl({key:`${o}.type`,value:n.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:a,styleSpec:s})}}function rI(i){const r=i.value,n=i.styleSpec,o=n.light,s=i.style;let a=[];const l=iJ(r);if(void 0===r)return a;if("object"!==l)return a.concat([new tn("light",r,`object expected, ${l} found`)]);for(const c in r){const h=c.match(/^(.*)-transition$/);a=a.concat(h&&o[h[1]]&&o[h[1]].transition?rz({key:c,value:r[c],valueSpec:n.transition,style:s,styleSpec:n}):o[c]?rz({key:c,value:r[c],valueSpec:o[c],style:s,styleSpec:n}):[new tn(c,r[c],`unknown property "${c}"`)])}return a}function rM(i){const r=i.value,n=i.key,o=i.style,s=i.styleSpec,a=s.terrain;let l=[];const c=iJ(r);if(void 0===r)return l;if("object"!==c)return l.concat([new tn("terrain",r,`object expected, ${c} found`)]);for(const h in r){const u=h.match(/^(.*)-transition$/);l=l.concat(u&&a[u[1]]&&a[u[1]].transition?rz({key:h,value:r[h],valueSpec:s.transition,style:o,styleSpec:s}):a[h]?rz({key:h,value:r[h],valueSpec:a[h],style:o,styleSpec:s}):[new tn(h,r[h],`unknown property "${h}"`)])}if(r.source){const d=o.sources&&o.sources[r.source],p=d&&ta(d.type);d?"raster-dem"!==p&&l.push(new tn(n,r.source,`terrain cannot be used with a source of type ${p}, it only be used with a "raster-dem" source type`)):l.push(new tn(n,r.source,`source "${r.source}" not found`))}else l.push(new tn(n,r,'terrain is missing required property "source"'));return l}function rA(i){const r=i.value,n=i.style,o=i.styleSpec,s=o.fog;let a=[];const l=iJ(r);if(void 0===r)return a;if("object"!==l)return a.concat([new tn("fog",r,`object expected, ${l} found`)]);for(const c in r){const h=c.match(/^(.*)-transition$/);a=a.concat(h&&s[h[1]]&&s[h[1]].transition?rz({key:c,value:r[c],valueSpec:o.transition,style:n,styleSpec:o}):s[c]?rz({key:c,value:r[c],valueSpec:s[c],style:n,styleSpec:o}):[new tn(c,r[c],`unknown property "${c}"`)])}return a}const rC={"*":()=>[],array:rn,boolean:function(i){const r=i.value,n=i.key,o=iJ(r);return"boolean"!==o?[new tn(n,r,`boolean expected, ${o} found`)]:[]},number:ro,color:function(i){const r=i.key,n=i.value,o=iJ(n);return"string"!==o?[new tn(r,n,`color expected, ${o} found`)]:null===tA.parseCSSColor(n)?[new tn(r,n,`color expected, "${n}" found`)]:[]},constants:to,enum:rl,filter:ry,function:rs,layer:rw,object:rr,source:rS,light:rI,terrain:rM,fog:rA,string:rT,formatted:function(i){return 0===rT(i).length?[]:ra(i)},resolvedImage:function(i){return 0===rT(i).length?[]:ra(i)},projection:function(i){const r=i.value,n=i.styleSpec,o=n.projection,s=i.style;let a=[];const l=iJ(r);if("object"===l)for(const c in r)a=a.concat(rz({key:c,value:r[c],valueSpec:o[c],style:s,styleSpec:n}));else"string"!==l&&(a=a.concat([new tn("projection",r,`object or string expected, ${l} found`)]));return a}};function rz(i){const r=i.value,n=i.valueSpec,o=i.styleSpec;return n.expression&&iQ(ta(r))?rs(i):n.expression&&i8(tl(r))?ra(i):n.type&&rC[n.type]?rC[n.type](i):rr(ts({},i,{valueSpec:n.type?o[n.type]:n}))}function rk(i){const r=i.value,n=i.key,o=rT(i);return o.length||(-1===r.indexOf("{fontstack}")&&o.push(new tn(n,r,'"glyphs" url must include a "{fontstack}" token')),-1===r.indexOf("{range}")&&o.push(new tn(n,r,'"glyphs" url must include a "{range}" token'))),o}function rP(i,r=tr){let n=[];return n=n.concat(rz({key:"",value:i,valueSpec:r.$root,styleSpec:r,style:i,objectElementValidators:{glyphs:rk,"*":()=>[]}})),i.constants&&(n=n.concat(to({key:"constants",value:i.constants,style:i,styleSpec:r}))),rD(n)}function rD(i){return[].concat(i).sort((i,r)=>i.line-r.line)}function rL(i){return function(...r){return rD(i.apply(this,r))}}rP.source=rL(rS),rP.light=rL(rI),rP.terrain=rL(rM),rP.fog=rL(rA),rP.layer=rL(rw),rP.filter=rL(ry),rP.paintProperty=rL(rv),rP.layoutProperty=rL(rb);const rB=rP.light,rR=rP.fog,rF=rP.paintProperty,rO=rP.layoutProperty;function rU(i,r){let n=!1;if(r&&r.length)for(const o of r)i.fire(new tt(Error(o.message))),n=!0;return n}var rV=rN;function rN(i,r,n){var o=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var s=new Int32Array(this.arrayBuffer);i=s[0],this.d=(r=s[1])+2*(n=s[2]);for(var a=0;a=d[m+0]&&o>=d[m+1])?(l[f]=!0,a.push(u[f])):l[f]=!1}}},rN.prototype._forEachCell=function(i,r,n,o,s,a,l,c){for(var h=this._convertToCellCoord(i),u=this._convertToCellCoord(r),d=this._convertToCellCoord(n),p=this._convertToCellCoord(o),f=h;f<=d;f++)for(var m=u;m<=p;m++){var _=this.d*m+f;if((!c||c(this._convertFromCellCoord(f),this._convertFromCellCoord(m),this._convertFromCellCoord(f+1),this._convertFromCellCoord(m+1)))&&s.call(this,i,r,n,o,_,a,l,c))return}},rN.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},rN.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},rN.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,r=3+this.cells.length+1+1,n=0,o=0;o=0)continue;const h=i[c];l[c]=rZ[a].shallow.indexOf(c)>=0?h:rH(h,r)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==a&&(l.$name=a),l}throw Error("can't serialize object of type "+typeof i)}function rK(i){if(null==i||"boolean"==typeof i||"number"==typeof i||"string"==typeof i||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||rX(i)||rW(i)||ArrayBuffer.isView(i)||i instanceof rj)return i;if(Array.isArray(i))return i.map(rK);if("object"==typeof i){const r=i.$name||"Object",{klass:n}=rZ[r];if(!n)throw Error(`can't deserialize unregistered class ${r}`);if(n.deserialize)return n.deserialize(i);const o=Object.create(n.prototype);for(const s of Object.keys(i)){if("$name"===s)continue;const a=i[s];o[s]=rZ[r].shallow.indexOf(s)>=0?a:rK(a)}return o}throw Error("can't deserialize object of type "+typeof i)}class rY{constructor(){this.first=!0}update(i,r){const n=Math.floor(i);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=i,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoomi>=1536&&i<=1791,rQ=i=>i>=1872&&i<=1919,r0=i=>i>=2208&&i<=2303,r1=i=>i>=11904&&i<=12031,r2=i=>i>=12032&&i<=12255,r3=i=>i>=12272&&i<=12287,r5=i=>i>=12288&&i<=12351,r4=i=>i>=12352&&i<=12447,r6=i=>i>=12448&&i<=12543,r8=i=>i>=12544&&i<=12591,r9=i=>i>=12704&&i<=12735,r7=i=>i>=12736&&i<=12783,ne=i=>i>=12784&&i<=12799,nt=i=>i>=12800&&i<=13055,ni=i=>i>=13056&&i<=13311,nr=i=>i>=13312&&i<=19903,nn=i=>i>=19968&&i<=40959,no=i=>i>=40960&&i<=42127,ns=i=>i>=42128&&i<=42191,na=i=>i>=44032&&i<=55215,nl=i=>i>=63744&&i<=64255,nc=i=>i>=64336&&i<=65023,nh=i=>i>=65040&&i<=65055,nu=i=>i>=65072&&i<=65103,nd=i=>i>=65104&&i<=65135,np=i=>i>=65136&&i<=65279,nf=i=>i>=65280&&i<=65519;function nm(i){for(const r of i)if(n_(r.charCodeAt(0)))return!0;return!1}function n_(i){return!(746!==i&&747!==i&&(i<4352||!(r9(i)||r8(i)||nu(i)&&!(i>=65097&&i<=65103)||nl(i)||ni(i)||r1(i)||r7(i)||!(!r5(i)||i>=12296&&i<=12305||i>=12308&&i<=12319||12336===i)||nr(i)||nn(i)||nt(i)||i>=12592&&i<=12687||i>=43360&&i<=43391||i>=55216&&i<=55295||i>=4352&&i<=4607||na(i)||r4(i)||r3(i)||i>=12688&&i<=12703||r2(i)||ne(i)||r6(i)&&12540!==i||!(!nf(i)||65288===i||65289===i||65293===i||i>=65306&&i<=65310||65339===i||65341===i||65343===i||i>=65371&&i<=65503||65507===i||i>=65512&&i<=65519)||!(!nd(i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||i>=5120&&i<=5759||i>=6320&&i<=6399||nh(i)||i>=19904&&i<=19967||no(i)||ns(i))))}function ng(i){return!(n_(i)||i>=128&&i<=255&&(167===i||169===i||174===i||177===i||188===i||189===i||190===i||215===i||247===i)||i>=8192&&i<=8303&&(8214===i||8224===i||8225===i||8240===i||8241===i||8251===i||8252===i||8258===i||8263===i||8264===i||8265===i||8273===i)||i>=8448&&i<=8527||i>=8528&&i<=8591||i>=8960&&i<=9215&&(i>=8960&&i<=8967||i>=8972&&i<=8991||i>=8996&&i<=9e3||9003===i||i>=9085&&i<=9114||i>=9150&&i<=9165||9167===i||i>=9169&&i<=9179||i>=9186&&i<=9215)||i>=9216&&i<=9279&&9251!==i||i>=9280&&i<=9311||i>=9312&&i<=9471||i>=9632&&i<=9727||i>=9728&&i<=9983&&!(i>=9754&&i<=9759)||i>=11008&&i<=11263&&(i>=11026&&i<=11055||i>=11088&&i<=11097||i>=11192&&i<=11243)||r5(i)||r6(i)||i>=57344&&i<=63743||nu(i)||nd(i)||nf(i)||8734===i||8756===i||8757===i||i>=9984&&i<=10087||i>=10102&&i<=10131||65532===i||65533===i)}function ny(i){return i>=1424&&i<=2303||nc(i)||np(i)}const nx="deferred",nv="loading",nb="loaded";let nw=null,nT="unavailable",nE=null;const nS=function(i){i&&"string"==typeof i&&i.indexOf("NetworkError")>-1&&(nT="error"),nw&&nw(i)};function nI(){nM.fire(new te("pluginStateChange",{pluginStatus:nT,pluginURL:nE}))}const nM=new ti,nA=function(){return nT},nC=function(){if(nT!==nx||!nE)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");nT=nv,nI(),nE&&e3({url:nE},i=>{i?nS(i):(nT=nb,nI())})},nz={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>nT===nb||null!=nz.applyArabicShaping,isLoading:()=>nT===nv,setState(i){nT=i.pluginStatus,nE=i.pluginURL},isParsed:()=>null!=nz.applyArabicShaping&&null!=nz.processBidirectionalText&&null!=nz.processStyledBidirectionalText,getPluginURL:()=>nE};class nk{constructor(i,r){this.zoom=i,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition,this.pitch=r.pitch):(this.now=0,this.fadeDuration=0,this.zoomHistory=new rY,this.transition={},this.pitch=0)}isSupportedScript(i){return function(i,r){for(const n of i){var o;if(o=n.charCodeAt(0),!r&&ny(o)||o>=2304&&o<=3583||o>=3840&&o<=4255||o>=6016&&o<=6143)return!1}return!0}(i,nz.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const i=this.zoom,r=i-Math.floor(i),n=this.crossFadingFactor();return i>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}}class nP{constructor(i,r){this.property=i,this.value=r,this.expression=function(i,r){if(iQ(i))return new ri(i,r);if(i8(i)){const n=rt(i,r);if("error"===n.result)throw Error(n.value.map(i=>`${i.key}: ${i.message}`).join(", "));return n.value}{let o=i;return"string"==typeof i&&"color"===r.type&&(o=tC.parse(i)),{kind:"constant",evaluate:()=>o}}}(void 0===r?i.specification.default:r,i.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(i,r,n){return this.property.possiblyEvaluate(this,i,r,n)}}class nD{constructor(i){this.property=i,this.value=new nP(i,void 0)}transitioned(i,r){return new nB(this.property,this.value,r,J({},i.transition,this.transition),i.now)}untransitioned(){return new nB(this.property,this.value,null,{},0)}}class nL{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitionablePropertyValues)}getValue(i){return el(this._values[i].value.value)}setValue(i,r){this._values.hasOwnProperty(i)||(this._values[i]=new nD(this._values[i].property)),this._values[i].value=new nP(this._values[i].property,null===r?void 0:el(r))}getTransition(i){return el(this._values[i].transition)}setTransition(i,r){this._values.hasOwnProperty(i)||(this._values[i]=new nD(this._values[i].property)),this._values[i].transition=el(r)||void 0}serialize(){const i={};for(const r of Object.keys(this._values)){const n=this.getValue(r);void 0!==n&&(i[r]=n);const o=this.getTransition(r);void 0!==o&&(i[`${r}-transition`]=o)}return i}transitioned(i,r){const n=new nR(this._properties);for(const o of Object.keys(this._values))n._values[o]=this._values[o].transitioned(i,r._values[o]);return n}untransitioned(){const i=new nR(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].untransitioned();return i}}class nB{constructor(i,r,n,o,s){const a=o.delay||0,l=o.duration||0;s=s||0,this.property=i,this.value=r,this.begin=s+a,this.end=this.begin+l,i.specification.transition&&(o.delay||o.duration)&&(this.prior=n)}possiblyEvaluate(i,r,n){const o=i.now||0,s=this.value.possiblyEvaluate(i,r,n),a=this.prior;if(a){if(o>this.end||this.value.isDataDriven())return this.prior=null,s;if(oo.zoomHistory.lastIntegerZoom?{from:i,to:r,other:n}:{from:n,to:r,other:i}}interpolate(i){return i}}class nG{constructor(i){this.specification=i}possiblyEvaluate(i,r,n,o){if(void 0!==i.value){if("constant"===i.expression.kind){const s=i.expression.evaluate(r,null,{},n,o);return this._calculate(s,s,s,r)}return this._calculate(i.expression.evaluate(new nk(Math.floor(r.zoom-1),r)),i.expression.evaluate(new nk(Math.floor(r.zoom),r)),i.expression.evaluate(new nk(Math.floor(r.zoom+1),r)),r)}}_calculate(i,r,n,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:i,to:r}:{from:n,to:r}}interpolate(i){return i}}class nZ{constructor(i){this.specification=i}possiblyEvaluate(i,r,n,o){return!!i.expression.evaluate(r,null,{},n,o)}interpolate(){return!1}}class n${constructor(i){for(const r in this.properties=i,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],i){const n=i[r];n.specification.overridable&&this.overridableProperties.push(r);const o=this.defaultPropertyValues[r]=new nP(n,void 0),s=this.defaultTransitionablePropertyValues[r]=new nD(n);this.defaultTransitioningPropertyValues[r]=s.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=o.possiblyEvaluate({})}}}function nq(i,r){return 256*(i=X(Math.floor(i),0,255))+X(Math.floor(r),0,255)}r$("DataDrivenProperty",nN),r$("DataConstantProperty",nV),r$("CrossFadedDataDrivenProperty",nj),r$("CrossFadedProperty",nG),r$("ColorRampProperty",nZ);const nX={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class nW{constructor(i,r){this._structArray=i,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class nH{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(i,r){return i._trim(),r&&(i.isTransferred=!0,r.push(i.arrayBuffer)),{length:i.length,arrayBuffer:i.arrayBuffer}}static deserialize(i){const r=Object.create(this.prototype);return r.arrayBuffer=i.arrayBuffer,r.length=i.length,r.capacity=i.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(i){this.reserve(i),this.length=i}reserve(i){if(i>this.capacity){this.capacity=Math.max(i,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function nK(i,r=1){let n=0,o=0;return{members:i.map(i=>{const s=nX[i.type].BYTES_PER_ELEMENT,a=n=nY(n,Math.max(r,s)),l=i.components||1;return o=Math.max(o,s),n+=s*l,{name:i.name,type:i.type,components:l,offset:a}}),size:nY(n,Math.max(o,r)),alignment:r}}function nY(i,r){return Math.ceil(i/r)*r}class nJ extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r){const n=this.length;return this.resize(n+1),this.emplace(n,i,r)}emplace(i,r,n){const o=2*i;return this.int16[o+0]=r,this.int16[o+1]=n,i}}nJ.prototype.bytesPerElement=4,r$("StructArrayLayout2i4",nJ);class nQ extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,o)}emplace(i,r,n,o,s){const a=4*i;return this.int16[a+0]=r,this.int16[a+1]=n,this.int16[a+2]=o,this.int16[a+3]=s,i}}nQ.prototype.bytesPerElement=8,r$("StructArrayLayout4i8",nQ);class n0 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,i,r,n,o,s,a,l)}emplace(i,r,n,o,s,a,l,c){const h=6*i,u=12*i,d=3*i;return this.int16[h+0]=r,this.int16[h+1]=n,this.uint8[u+4]=o,this.uint8[u+5]=s,this.uint8[u+6]=a,this.uint8[u+7]=l,this.float32[d+2]=c,i}}n0.prototype.bytesPerElement=12,r$("StructArrayLayout2i4ub1f12",n0);class n1 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,i,r,n)}emplace(i,r,n,o){const s=3*i;return this.float32[s+0]=r,this.float32[s+1]=n,this.float32[s+2]=o,i}}n1.prototype.bytesPerElement=12,r$("StructArrayLayout3f12",n1);class n2 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l,c,h,u){const d=this.length;return this.resize(d+1),this.emplace(d,i,r,n,o,s,a,l,c,h,u)}emplace(i,r,n,o,s,a,l,c,h,u,d){const p=10*i;return this.uint16[p+0]=r,this.uint16[p+1]=n,this.uint16[p+2]=o,this.uint16[p+3]=s,this.uint16[p+4]=a,this.uint16[p+5]=l,this.uint16[p+6]=c,this.uint16[p+7]=h,this.uint16[p+8]=u,this.uint16[p+9]=d,i}}n2.prototype.bytesPerElement=20,r$("StructArrayLayout10ui20",n2);class n3 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l,c){const h=this.length;return this.resize(h+1),this.emplace(h,i,r,n,o,s,a,l,c)}emplace(i,r,n,o,s,a,l,c,h){const u=8*i;return this.uint16[u+0]=r,this.uint16[u+1]=n,this.uint16[u+2]=o,this.uint16[u+3]=s,this.uint16[u+4]=a,this.uint16[u+5]=l,this.uint16[u+6]=c,this.uint16[u+7]=h,i}}n3.prototype.bytesPerElement=16,r$("StructArrayLayout8ui16",n3);class n5 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g){const y=this.length;return this.resize(y+1),this.emplace(y,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g)}emplace(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y){const x=16*i;return this.int16[x+0]=r,this.int16[x+1]=n,this.int16[x+2]=o,this.int16[x+3]=s,this.uint16[x+4]=a,this.uint16[x+5]=l,this.uint16[x+6]=c,this.uint16[x+7]=h,this.int16[x+8]=u,this.int16[x+9]=d,this.int16[x+10]=p,this.int16[x+11]=f,this.int16[x+12]=m,this.int16[x+13]=_,this.int16[x+14]=g,this.int16[x+15]=y,i}}n5.prototype.bytesPerElement=32,r$("StructArrayLayout4i4ui4i4i32",n5);class n4 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i){const r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint32[1*i+0]=r,i}}n4.prototype.bytesPerElement=4,r$("StructArrayLayout1ul4",n4);class n6 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l,c,h,u,d,p,f){const m=this.length;return this.resize(m+1),this.emplace(m,i,r,n,o,s,a,l,c,h,u,d,p,f)}emplace(i,r,n,o,s,a,l,c,h,u,d,p,f,m){const _=20*i,g=10*i;return this.int16[_+0]=r,this.int16[_+1]=n,this.int16[_+2]=o,this.int16[_+3]=s,this.int16[_+4]=a,this.float32[g+3]=l,this.float32[g+4]=c,this.float32[g+5]=h,this.float32[g+6]=u,this.int16[_+14]=d,this.uint32[g+8]=p,this.uint16[_+18]=f,this.uint16[_+19]=m,i}}n6.prototype.bytesPerElement=40,r$("StructArrayLayout5i4f1i1ul2ui40",n6);class n8 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,i,r,n,o,s,a,l)}emplace(i,r,n,o,s,a,l,c){const h=8*i;return this.int16[h+0]=r,this.int16[h+1]=n,this.int16[h+2]=o,this.int16[h+4]=s,this.int16[h+5]=a,this.int16[h+6]=l,this.int16[h+7]=c,i}}n8.prototype.bytesPerElement=16,r$("StructArrayLayout3i2i2i16",n8);class n9 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,i,r,n,o,s)}emplace(i,r,n,o,s,a){const l=4*i,c=8*i;return this.float32[l+0]=r,this.float32[l+1]=n,this.float32[l+2]=o,this.int16[c+6]=s,this.int16[c+7]=a,i}}n9.prototype.bytesPerElement=16,r$("StructArrayLayout2f1f2i16",n9);class n7 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,o)}emplace(i,r,n,o,s){const a=12*i,l=3*i;return this.uint8[a+0]=r,this.uint8[a+1]=n,this.float32[l+1]=o,this.float32[l+2]=s,i}}n7.prototype.bytesPerElement=12,r$("StructArrayLayout2ub2f12",n7);class oe extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,i,r,n)}emplace(i,r,n,o){const s=3*i;return this.uint16[s+0]=r,this.uint16[s+1]=n,this.uint16[s+2]=o,i}}oe.prototype.bytesPerElement=6,r$("StructArrayLayout3ui6",oe);class ot extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w){const T=this.length;return this.resize(T+1),this.emplace(T,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w)}emplace(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T){const E=30*i,S=15*i,I=60*i;return this.int16[E+0]=r,this.int16[E+1]=n,this.int16[E+2]=o,this.float32[S+2]=s,this.float32[S+3]=a,this.uint16[E+8]=l,this.uint16[E+9]=c,this.uint32[S+5]=h,this.uint32[S+6]=u,this.uint32[S+7]=d,this.uint16[E+16]=p,this.uint16[E+17]=f,this.uint16[E+18]=m,this.float32[S+10]=_,this.float32[S+11]=g,this.uint8[I+48]=y,this.uint8[I+49]=x,this.uint8[I+50]=v,this.uint32[S+13]=b,this.int16[E+28]=w,this.uint8[I+58]=T,i}}ot.prototype.bytesPerElement=60,r$("StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60",ot);class oi extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T,E,S,I,M,A,C,z,k){const P=this.length;return this.resize(P+1),this.emplace(P,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T,E,S,I,M,A,C,z,k)}emplace(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T,E,S,I,M,A,C,z,k,P){const D=38*i,L=19*i;return this.int16[D+0]=r,this.int16[D+1]=n,this.int16[D+2]=o,this.float32[L+2]=s,this.float32[L+3]=a,this.int16[D+8]=l,this.int16[D+9]=c,this.int16[D+10]=h,this.int16[D+11]=u,this.int16[D+12]=d,this.int16[D+13]=p,this.uint16[D+14]=f,this.uint16[D+15]=m,this.uint16[D+16]=_,this.uint16[D+17]=g,this.uint16[D+18]=y,this.uint16[D+19]=x,this.uint16[D+20]=v,this.uint16[D+21]=b,this.uint16[D+22]=w,this.uint16[D+23]=T,this.uint16[D+24]=E,this.uint16[D+25]=S,this.uint16[D+26]=I,this.uint16[D+27]=M,this.uint16[D+28]=A,this.uint32[L+15]=C,this.float32[L+16]=z,this.float32[L+17]=k,this.float32[L+18]=P,i}}oi.prototype.bytesPerElement=76,r$("StructArrayLayout3i2f6i15ui1ul3f76",oi);class or extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i){const r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.float32[1*i+0]=r,i}}or.prototype.bytesPerElement=4,r$("StructArrayLayout1f4",or);class on extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,i,r,n)}emplace(i,r,n,o){const s=3*i;return this.int16[s+0]=r,this.int16[s+1]=n,this.int16[s+2]=o,i}}on.prototype.bytesPerElement=6,r$("StructArrayLayout3i6",on);class oo extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,i,r,n,o,s,a,l)}emplace(i,r,n,o,s,a,l,c){const h=7*i;return this.float32[h+0]=r,this.float32[h+1]=n,this.float32[h+2]=o,this.float32[h+3]=s,this.float32[h+4]=a,this.float32[h+5]=l,this.float32[h+6]=c,i}}oo.prototype.bytesPerElement=28,r$("StructArrayLayout7f28",oo);class os extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,o)}emplace(i,r,n,o,s){const a=6*i;return this.uint32[3*i+0]=r,this.uint16[a+2]=n,this.uint16[a+3]=o,this.uint16[a+4]=s,i}}os.prototype.bytesPerElement=12,r$("StructArrayLayout1ul3ui12",os);class oa extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r){const n=this.length;return this.resize(n+1),this.emplace(n,i,r)}emplace(i,r,n){const o=2*i;return this.uint16[o+0]=r,this.uint16[o+1]=n,i}}oa.prototype.bytesPerElement=4,r$("StructArrayLayout2ui4",oa);class ol extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i){const r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint16[1*i+0]=r,i}}ol.prototype.bytesPerElement=2,r$("StructArrayLayout1ui2",ol);class oc extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r){const n=this.length;return this.resize(n+1),this.emplace(n,i,r)}emplace(i,r,n){const o=2*i;return this.float32[o+0]=r,this.float32[o+1]=n,i}}oc.prototype.bytesPerElement=8,r$("StructArrayLayout2f8",oc);class oh extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,o)}emplace(i,r,n,o,s){const a=4*i;return this.float32[a+0]=r,this.float32[a+1]=n,this.float32[a+2]=o,this.float32[a+3]=s,i}}oh.prototype.bytesPerElement=16,r$("StructArrayLayout4f16",oh);class ou extends nW{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}ou.prototype.size=40;class od extends n6{get(i){return new ou(this,i)}}r$("CollisionBoxArray",od);class op extends nW{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(i){this._structArray.uint8[this._pos1+49]=i}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(i){this._structArray.uint8[this._pos1+50]=i}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(i){this._structArray.uint32[this._pos4+13]=i}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(i){this._structArray.uint8[this._pos1+58]=i}}op.prototype.size=60;class of extends ot{get(i){return new op(this,i)}}r$("PlacedSymbolArray",of);class om extends nW{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+11]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+13]}get key(){return this._structArray.uint16[this._pos2+14]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+19]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+21]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+22]}get featureIndex(){return this._structArray.uint16[this._pos2+23]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+25]}get numIconVertices(){return this._structArray.uint16[this._pos2+26]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+27]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+28]}get crossTileID(){return this._structArray.uint32[this._pos4+15]}set crossTileID(i){this._structArray.uint32[this._pos4+15]=i}get textOffset0(){return this._structArray.float32[this._pos4+16]}get textOffset1(){return this._structArray.float32[this._pos4+17]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+18]}}om.prototype.size=76;class o_ extends oi{get(i){return new om(this,i)}}r$("SymbolInstanceArray",o_);class og extends or{getoffsetX(i){return this.float32[1*i+0]}}r$("GlyphOffsetArray",og);class oy extends on{getx(i){return this.int16[3*i+0]}gety(i){return this.int16[3*i+1]}gettileUnitDistanceFromAnchor(i){return this.int16[3*i+2]}}r$("SymbolLineVertexArray",oy);class ox extends nW{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}ox.prototype.size=12;class ov extends os{get(i){return new ox(this,i)}}r$("FeatureIndexArray",ov);class ob extends nW{get a_centroid_pos0(){return this._structArray.uint16[this._pos2+0]}get a_centroid_pos1(){return this._structArray.uint16[this._pos2+1]}}ob.prototype.size=4;class ow extends oa{get(i){return new ob(this,i)}}r$("FillExtrusionCentroidArray",ow);const oT=nK([{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"}]),oE=nK([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"}]);var oS=tM(function(i){i.exports=function(i,r){var n,o,s,a,l,c;for(o=i.length-(n=3&i.length),s=r,c=0;c>>16)*3432918353&65535)<<16)&4294967295)<<15|l>>>17))*461845907+(((l>>>16)*461845907&65535)<<16)&4294967295)<<13|s>>>19))+((5*(s>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(l=0,n){case 3:l^=(255&i.charCodeAt(c+2))<<16;case 2:l^=(255&i.charCodeAt(c+1))<<8;case 1:s^=l=(65535&(l=(l=(65535&(l^=255&i.charCodeAt(c)))*3432918353+(((l>>>16)*3432918353&65535)<<16)&4294967295)<<15|l>>>17))*461845907+(((l>>>16)*461845907&65535)<<16)&4294967295}return s^=i.length,s=2246822507*(65535&(s^=s>>>16))+((2246822507*(s>>>16)&65535)<<16)&4294967295,s=3266489909*(65535&(s^=s>>>13))+((3266489909*(s>>>16)&65535)<<16)&4294967295,(s^=s>>>16)>>>0}}),oI=tM(function(i){i.exports=function(i,r){for(var n,o=i.length,s=r^o,a=0;o>=4;)n=1540483477*(65535&(n=255&i.charCodeAt(a)|(255&i.charCodeAt(++a))<<8|(255&i.charCodeAt(++a))<<16|(255&i.charCodeAt(++a))<<24))+((1540483477*(n>>>16)&65535)<<16),s=1540483477*(65535&s)+((1540483477*(s>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),o-=4,++a;switch(o){case 3:s^=(255&i.charCodeAt(a+2))<<16;case 2:s^=(255&i.charCodeAt(a+1))<<8;case 1:s=1540483477*(65535&(s^=255&i.charCodeAt(a)))+((1540483477*(s>>>16)&65535)<<16)}return s=1540483477*(65535&(s^=s>>>13))+((1540483477*(s>>>16)&65535)<<16),(s^=s>>>15)>>>0}}),oM=oS;oM.murmur3=oS,oM.murmur2=oI;class oA{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(i,r,n,o){this.ids.push(oC(i)),this.positions.push(r,n,o)}getPositions(i){const r=oC(i);let n=0,o=this.ids.length-1;for(;n>1;this.ids[s]>=r?o=s:n=s+1}const a=[];for(;this.ids[n]===r;)a.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return a}static serialize(i,r){const n=new Float64Array(i.ids),o=new Uint32Array(i.positions);return function i(r,n,o,s){for(;o>1];let l=o-1,c=s+1;for(;;){do l++;while(r[l]a)if(l>=c)break;oz(r,l,c),oz(n,3*l,3*c),oz(n,3*l+1,3*c+1),oz(n,3*l+2,3*c+2)}c-o`u_${i}`),this.type=n}setUniform(i,r,n){i.set(n.constantOr(this.value))}getBinding(i,r,n){return"color"===this.type?new oL(i,r):new oP(i,r)}}class oV{constructor(i,r){this.uniformNames=r.map(i=>`u_${i}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(i,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=i.pixelRatio,this.patternFrom=r.tl.concat(r.br),this.patternTo=i.tl.concat(i.br)}setUniform(i,r,n,o){const s="u_pattern_to"===o||"u_dash_to"===o?this.patternTo:"u_pattern_from"===o||"u_dash_from"===o?this.patternFrom:"u_pixel_ratio_to"===o?this.pixelRatioTo:"u_pixel_ratio_from"===o?this.pixelRatioFrom:null;s&&i.set(s)}getBinding(i,r,n){return"u_pattern_from"===n||"u_pattern_to"===n||"u_dash_from"===n||"u_dash_to"===n?new oD(i,r):new oP(i,r)}}class oN{constructor(i,r,n,o){this.expression=i,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(i=>({name:`a_${i}`,type:"Float32",components:"color"===n?2:1,offset:0})),this.paintVertexArray=new o}populatePaintArray(i,r,n,o,s,a){const l=this.paintVertexArray.length,c=this.expression.evaluate(new nk(0),r,{},s,o,a);this.paintVertexArray.resize(i),this._setPaintValue(l,i,c)}updatePaintArray(i,r,n,o,s){const a=this.expression.evaluate({zoom:0},n,o,void 0,s);this._setPaintValue(i,r,a)}_setPaintValue(i,r,n){if("color"===this.type){const o=oO(n);for(let s=i;s`u_${i}_t`),this.type=n,this.useIntegerZoom=o,this.zoom=s,this.maxValue=0,this.paintVertexAttributes=r.map(i=>({name:`a_${i}`,type:"Float32",components:"color"===n?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(i,r,n,o,s,a){const l=this.expression.evaluate(new nk(this.zoom),r,{},s,o,a),c=this.expression.evaluate(new nk(this.zoom+1),r,{},s,o,a),h=this.paintVertexArray.length;this.paintVertexArray.resize(i),this._setPaintValue(h,i,l,c)}updatePaintArray(i,r,n,o,s){const a=this.expression.evaluate({zoom:this.zoom},n,o,void 0,s),l=this.expression.evaluate({zoom:this.zoom+1},n,o,void 0,s);this._setPaintValue(i,r,a,l)}_setPaintValue(i,r,n,o){if("color"===this.type){const s=oO(n),a=oO(o);for(let l=i;l!0){this.binders={},this._buffers=[];const o=[];for(const s in i.paint._values){var a,l;if(!n(s))continue;const c=i.paint.get(s);if(!(c instanceof nO&&iH(c.property.specification)))continue;const h=(a=s,l=i.type,oq[a]||[a.replace(`${l}-`,"").replace(/-/g,"_")]),u=c.value,d=c.property.specification.type,p=c.property.useIntegerZoom,f=c.property.specification["property-type"],m="cross-faded"===f||"cross-faded-data-driven"===f,_="line-dasharray"===String(s)&&"constant"!==i.layout.get("line-cap").value.kind;if("constant"!==u.kind||_){if("source"===u.kind||_||m){const g=oH(s,d,"source");this.binders[s]=m?new oG(u,h,d,p,r,g,i.id):new oN(u,h,d,g),o.push(`/a_${s}`)}else{const y=oH(s,d,"composite");this.binders[s]=new oj(u,h,d,p,r,y),o.push(`/z_${s}`)}}else this.binders[s]=m?new oV(u.value,h):new oU(u.value,h,d),o.push(`/u_${s}`)}this.cacheKey=o.sort().join("")}getMaxValue(i){const r=this.binders[i];return r instanceof oN||r instanceof oj?r.maxValue:0}populatePaintArrays(i,r,n,o,s,a){for(const l in this.binders){const c=this.binders[l];(c instanceof oN||c instanceof oj||c instanceof oG)&&c.populatePaintArray(i,r,n,o,s,a)}}setConstantPatternPositions(i,r){for(const n in this.binders){const o=this.binders[n];o instanceof oV&&o.setConstantPatternPositions(i,r)}}updatePaintArrays(i,r,n,o,s,a){let l=!1;for(const c in i){const h=r.getPositions(c);for(const u of h){const d=n.feature(u.index);for(const p in this.binders){const f=this.binders[p];if((f instanceof oN||f instanceof oj||f instanceof oG)&&!0===f.expression.isStateDependent){const m=o.paint.get(p);f.expression=m.value,f.updatePaintArray(u.start,u.end,d,i[c],s,a),l=!0}}}}return l}defines(){const i=[];for(const r in this.binders){const n=this.binders[r];(n instanceof oU||n instanceof oV)&&i.push(...n.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return i}getBinderAttributes(){const i=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof oN||n instanceof oj||n instanceof oG)for(let o=0;o!0){for(const o of(this.programConfigurations={},i))this.programConfigurations[o.id]=new oZ(o,r,n);this.needsUpload=!1,this._featureMap=new oA,this._bufferOffset=0}populatePaintArrays(i,r,n,o,s,a,l){for(const c in this.programConfigurations)this.programConfigurations[c].populatePaintArrays(i,r,o,s,a,l);void 0!==r.id&&this._featureMap.add(r.id,n,this._bufferOffset,i),this._bufferOffset=i,this.needsUpload=!0}updatePaintArrays(i,r,n,o,s){for(const a of n)this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(i,this._featureMap,r,a,o,s)||this.needsUpload}get(i){return this.programConfigurations[i]}upload(i){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(i);this.needsUpload=!1}}destroy(){for(const i in this.programConfigurations)this.programConfigurations[i].destroy()}}const oq={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"line-dasharray":["dash_to","dash_from"]},oX={"line-pattern":{source:n2,composite:n2},"fill-pattern":{source:n2,composite:n2},"fill-extrusion-pattern":{source:n2,composite:n2},"line-dasharray":{source:n3,composite:n3}},oW={color:{source:oc,composite:oh},number:{source:or,composite:oc}};function oH(i,r,n){const o=oX[i];return o&&o[n]||oW[r][n]}r$("ConstantBinder",oU),r$("CrossFadedConstantBinder",oV),r$("SourceExpressionBinder",oN),r$("CrossFadedCompositeBinder",oG),r$("CompositeExpressionBinder",oj),r$("ProgramConfiguration",oZ,{omit:["_buffers"]}),r$("ProgramConfigurationSet",o$);const oK="-transition";class oY extends ti{constructor(i,r){if(super(),this.id=i.id,this.type=i.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==i.type&&(this.metadata=i.metadata,this.minzoom=i.minzoom,this.maxzoom=i.maxzoom,"background"!==i.type&&"sky"!==i.type&&(this.source=i.source,this.sourceLayer=i["source-layer"],this.filter=i.filter),r.layout&&(this._unevaluatedLayout=new nF(r.layout)),r.paint)){for(const n in this._transitionablePaint=new nL(r.paint),i.paint)this.setPaintProperty(n,i.paint[n],{validate:!1});for(const o in i.layout)this.setLayoutProperty(o,i.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new nU(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(i){return"visibility"===i?this.visibility:this._unevaluatedLayout.getValue(i)}setLayoutProperty(i,r,n={}){null!=r&&this._validate(rO,`layers.${this.id}.layout.${i}`,i,r,n)||("visibility"!==i?this._unevaluatedLayout.setValue(i,r):this.visibility=r)}getPaintProperty(i){return eo(i,oK)?this._transitionablePaint.getTransition(i.slice(0,-oK.length)):this._transitionablePaint.getValue(i)}setPaintProperty(i,r,n={}){if(null!=r&&this._validate(rF,`layers.${this.id}.paint.${i}`,i,r,n))return!1;if(eo(i,oK))return this._transitionablePaint.setTransition(i.slice(0,-oK.length),r||void 0),!1;{const o=this._transitionablePaint._values[i],s="cross-faded-data-driven"===o.property.specification["property-type"],a=o.value.isDataDriven(),l=o.value;this._transitionablePaint.setValue(i,r),this._handleSpecialPaintPropertyUpdate(i);const c=this._transitionablePaint._values[i].value;return c.isDataDriven()||a||s||this._handleOverridablePaintPropertyUpdate(i,l,c)}}_handleSpecialPaintPropertyUpdate(i){}getProgramIds(){return null}getProgramConfiguration(i){return null}_handleOverridablePaintPropertyUpdate(i,r,n){return!1}isHidden(i){return!!(this.minzoom&&i=this.maxzoom)||"none"===this.visibility}updateTransitions(i){this._transitioningPaint=this._transitionablePaint.transitioned(i,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(i,r){i.getCrossfadeParameters&&(this._crossfadeParameters=i.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(i,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(i,void 0,r)}serialize(){const i={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(i.layout=i.layout||{},i.layout.visibility=this.visibility),ea(i,(i,r)=>!(void 0===i||"layout"===r&&!Object.keys(i).length||"paint"===r&&!Object.keys(i).length))}_validate(i,r,n,o,s={}){return(!s||!1!==s.validate)&&rU(this,i.call(rP,{key:r,layerType:this.type,objectKey:n,value:o,styleSpec:tr,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const i in this.paint._values){const r=this.paint.get(i);if(r instanceof nO&&iH(r.property.specification)&&("source"===r.value.kind||"composite"===r.value.kind)&&r.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=rh(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const oJ=nK([{name:"a_pos",components:2,type:"Int16"}],4),{members:oQ}=oJ;class o0{constructor(i=[]){this.segments=i}prepareSegment(i,r,n,o){let s=this.segments[this.segments.length-1];return i>o0.MAX_VERTEX_ARRAY_LENGTH&&eh(`Max vertices per segment is ${o0.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${i}`),(!s||s.vertexLength+i>o0.MAX_VERTEX_ARRAY_LENGTH||s.sortKey!==o)&&(s={vertexOffset:r.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},void 0!==o&&(s.sortKey=o),this.segments.push(s)),s}get(){return this.segments}destroy(){for(const i of this.segments)for(const r in i.vaos)i.vaos[r].destroy()}static simpleSegment(i,r,n,o){return new o0([{vertexOffset:i,primitiveOffset:r,vertexLength:n,primitiveLength:o,vaos:{},sortKey:0}])}}o0.MAX_VERTEX_ARRAY_LENGTH=65535,r$("SegmentVector",o0);class o1{constructor(i,r){i&&(r?this.setSouthWest(i).setNorthEast(r):4===i.length?this.setSouthWest([i[0],i[1]]).setNorthEast([i[2],i[3]]):this.setSouthWest(i[0]).setNorthEast(i[1]))}setNorthEast(i){return this._ne=i instanceof o2?new o2(i.lng,i.lat):o2.convert(i),this}setSouthWest(i){return this._sw=i instanceof o2?new o2(i.lng,i.lat):o2.convert(i),this}extend(i){let r,n;const o=this._sw,s=this._ne;if(i instanceof o2)r=i,n=i;else{if(!(i instanceof o1))return Array.isArray(i)?4===i.length||i.every(Array.isArray)?this.extend(o1.convert(i)):this.extend(o2.convert(i)):this;if(r=i._sw,n=i._ne,!r||!n)return this}return o||s?(o.lng=Math.min(r.lng,o.lng),o.lat=Math.min(r.lat,o.lat),s.lng=Math.max(n.lng,s.lng),s.lat=Math.max(n.lat,s.lat)):(this._sw=new o2(r.lng,r.lat),this._ne=new o2(n.lng,n.lat)),this}getCenter(){return new o2((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new o2(this.getWest(),this.getNorth())}getSouthEast(){return new o2(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(i){const{lng:r,lat:n}=o2.convert(i);let o=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&o}static convert(i){return!i||i instanceof o1?i:new o1(i)}}class o2{constructor(i,r){if(isNaN(i)||isNaN(r))throw Error(`Invalid LngLat object: (${i}, ${r})`);if(this.lng=+i,this.lat=+r,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new o2(H(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(i){const r=Math.PI/180,n=this.lat*r,o=i.lat*r,s=Math.sin(n)*Math.sin(o)+Math.cos(n)*Math.cos(o)*Math.cos((i.lng-this.lng)*r);return 6371008.8*Math.acos(Math.min(s,1))}toBounds(i=0){const r=360*i/40075017,n=r/Math.cos(Math.PI/180*this.lat);return new o1(new o2(this.lng-n,this.lat-r),new o2(this.lng+n,this.lat+r))}static convert(i){if(i instanceof o2)return i;if(Array.isArray(i)&&(2===i.length||3===i.length))return new o2(Number(i[0]),Number(i[1]));if(!Array.isArray(i)&&"object"==typeof i&&null!==i)return new o2(Number("lng"in i?i.lng:i.lon),Number(i.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const o3=2*Math.PI*6371008.8;function o5(i){return o3*Math.cos(i*Math.PI/180)}function o4(i){return(180+i)/360}function o6(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function o8(i){return 360*i-180}function o9(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class o7{constructor(i,r,n=0){this.x=+i,this.y=+r,this.z=+n}static fromLngLat(i,r=0){const n=o2.convert(i);return new o7(o4(n.lng),o6(n.lat),r/o5(n.lat))}toLngLat(){return new o2(o8(this.x),o9(this.y))}toAltitude(){return this.z*o5(o9(this.y))}meterInMercatorCoordinateUnits(){return 1/o3*(1/Math.cos(o9(this.y)*Math.PI/180))}}const se=-16383-1;function st(i,r,n){const o=i.loadGeometry(),s=i.extent,a=8192/s;if(r&&n&&n.projection.isReprojectedInTileSpace){const l=1<{const n=o8((r.x+i.x/s)/l),o=o9((r.y+i.y/s)/l),a=p.project(n,o);i.x=(a.x*c-h)*s,i.y=(a.y*c-d)*s};for(let m=0;m=d?(i(r,n,o,p,f,l,m,h,d),i(r,p,f,s,a,m,c,h,d)):r.push(c)}(l,o,s,h,d,a,c,r,1):l.push(c),o=h,s=d,a=c}return l}(o[m],f,0);else{const _=[];for(const g of o[m])g.x<0||g.x>=s||g.y<0||g.y>=s||(f(g),_.push(g));o[m]=_}}for(const y of o)for(const x of y)!function(i,r){const n=Math.round(i.x*r),o=Math.round(i.y*r);i.x=X(n,se,16383),i.y=X(o,se,16383),(ni.x+1||oi.y+1)&&eh("Geometry exceeds allowed extent, reduce your vector tile buffer size")}(x,a);return o}function si(i,r){return{type:i.type,id:i.id,properties:i.properties,geometry:r?st(i):[]}}function sr(i,r,n,o,s){i.emplaceBack(2*r+(o+1)/2,2*n+(s+1)/2)}class sn{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.hasPattern=!1,this.layoutVertexArray=new nJ,this.indexArray=new oe,this.segments=new o0,this.programConfigurations=new o$(i.layers,i.zoom),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(i,r,n,o){const s=this.layers[0],a=[];let l=null;for(const{feature:c,id:h,index:u,sourceLayerIndex:d}of("circle"===s.type&&(l=s.layout.get("circle-sort-key")),i)){const p=this.layers[0]._featureFilter.needGeometry,f=si(c,p);if(!this.layers[0]._featureFilter.filter(new nk(this.zoom),f,n))continue;const m=l?l.evaluate(f,{},n):void 0,_={id:h,properties:c.properties,type:c.type,sourceLayerIndex:d,index:u,geometry:p?f.geometry:st(c,n,o),patterns:{},sortKey:m};a.push(_)}for(const g of(l&&a.sort((i,r)=>i.sortKey-r.sortKey),a)){const{geometry:y,index:x,sourceLayerIndex:v}=g,b=i[x].feature;this.addFeature(g,y,x,r.availableImages,n),r.featureIndex.insert(b,y,x,v,this.index)}}update(i,r,n,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,oQ),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(i,r,n,o,s){for(const a of r)for(const l of a){const c=l.x,h=l.y;if(c<0||c>=8192||h<0||h>=8192)continue;const u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,i.sortKey),d=u.vertexLength;sr(this.layoutVertexArray,c,h,-1,-1),sr(this.layoutVertexArray,c,h,1,-1),sr(this.layoutVertexArray,c,h,1,1),sr(this.layoutVertexArray,c,h,-1,1),this.indexArray.emplaceBack(d,d+1,d+2),this.indexArray.emplaceBack(d,d+3,d+2),u.vertexLength+=4,u.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,{},o,s)}}function so(i,r){for(let n=0;n1?n:n.sub(r)._mult(s)._add(r))}function sh(i,r){let n,o,s,a=!1;for(let l=0;lr.y!=s.y>r.y&&r.x<(s.x-o.x)*(r.y-o.y)/(s.y-o.y)+o.x&&(a=!a)}return a}function su(i,r){let n=!1;for(let o=0,s=i.length-1;or.y!=l.y>r.y&&r.x<(l.x-a.x)*(r.y-a.y)/(l.y-a.y)+a.x&&(n=!n)}return n}function sd(i,r,n,o,s){for(const a of i)if(r<=a.x&&n<=a.y&&o>=a.x&&s>=a.y)return!0;const l=[new u(r,n),new u(r,s),new u(o,s),new u(o,n)];if(i.length>2){for(const c of l)if(su(i,c))return!0}for(let h=0;hs.x&&r.x>s.x||i.ys.y&&r.y>s.y)return!1;const a=eu(i,r,n[0]);return a!==eu(i,r,n[1])||a!==eu(i,r,n[2])||a!==eu(i,r,n[3])}(i[h],i[h+1],l))return!0;return!1}function sp(i,r,n){const o=r.paint.get(i).value;return"constant"===o.kind?o.value:n.programConfigurations.get(r.id).getMaxValue(i)}function sf(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function sm(i,r,n,o,s){if(!r[0]&&!r[1])return i;const a=u.convert(r)._mult(s);"viewport"===n&&a._rotate(-o);const l=[];for(let c=0;c{var a,l;const c=R([],n,i),h=1/c[3]/r*s;return a=c,l=[h,h,o?1/c[3]:h,h],a[0]=c[0]*l[0],a[1]=c[1]*l[1],a[2]=c[2]*l[2],a[3]=c[3]*l[3],a}),l=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(i=>{const r=k([],D([],M([],a[i[0]],a[i[1]]),M([],a[i[2]],a[i[1]]))),n=-P(r,a[i[1]]);return r.concat(n)});return new sx(a,l)}}class sv{constructor(i,r){this.min=i,this.max=r,this.center=C([],I([],this.min,this.max),.5)}quadrant(i){const r=[i%2==0,i<2],n=T(this.min),o=T(this.max);for(let s=0;s=0;if(0===a)return 0;a!==r.length&&(n=!1)}if(n)return 2;for(let c=0;c<3;c++){let h=Number.MAX_VALUE,u=-Number.MAX_VALUE;for(let d=0;dthis.max[c]-this.min[c])return 0}return 1}}function sb(i,r,n,o,s,a,l,c,h){if(a&&i.queryGeometry.isAboveHorizon)return!1;for(const d of(a&&(h*=i.pixelToTileUnitsFactor),r))for(const p of d){var f;const m=p.add(c),_=s&&n.elevation?n.elevation.exaggeration()*s.getElevationAt(m.x,m.y,!0):0,g=a?m:function(i,r,n){const o=R([],[i.x,i.y,r,1],n);return new u(o[0]/o[3],o[1]/o[3])}(m,_,o),y=a?i.tilespaceRays.map(i=>(function(i,r){const n=w();return sw[2]=r,i.intersectsPlane(sw,sT,n),new u(n[0],n[1])})(i,_)):i.queryGeometry.screenGeometry,x=R([],[p.x,p.y,_,1],o);if(!l&&a?h*=x[3]/n.cameraToCenterDistance:l&&!a&&(h*=n.cameraToCenterDistance/x[3]),f=h,su(y,g)||sl(g,y,f))return!0}return!1}const sw=S(0,0,0),sT=S(0,0,1);class sE extends sn{}function sS(i,{width:r,height:n},o,s){if(s){if(s instanceof Uint8ClampedArray)s=new Uint8Array(s.buffer);else if(s.length!==r*n*o)throw RangeError("mismatched image size")}else s=new Uint8Array(r*n*o);return i.width=r,i.height=n,i.data=s,i}function sI(i,{width:r,height:n},o){if(r===i.width&&n===i.height)return;const s=sS({},{width:r,height:n},o);sM(i,s,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,r),height:Math.min(i.height,n)},o),i.width=r,i.height=n,i.data=s.data}function sM(i,r,n,o,s,a){if(0===s.width||0===s.height)return r;if(s.width>i.width||s.height>i.height||n.x>i.width-s.width||n.y>i.height-s.height)throw RangeError("out of range source coordinates for image copy");if(s.width>r.width||s.height>r.height||o.x>r.width-s.width||o.y>r.height-s.height)throw RangeError("out of range destination coordinates for image copy");const l=i.data,c=r.data;for(let h=0;h{r[i.evaluationKey]=a;const l=i.expression.evaluate(r);s.data[n+o+0]=Math.floor(255*l.r/l.a),s.data[n+o+1]=Math.floor(255*l.g/l.a),s.data[n+o+2]=Math.floor(255*l.b/l.a),s.data[n+o+3]=Math.floor(255*l.a)};if(i.clips)for(let l=0,c=0;l=a.next.y&&a.next.y!==a.y){var u=a.x+(c-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(u<=l&&u>h){if(h=u,u===l){if(c===a.y)return a;if(c===a.next.y)return a.next}s=a.x=a.x&&a.x>=f&&l!==a.x&&sN(cs.x||a.x===s.x&&(n=s,o=a,0>sj(n.prev,n,o.prev)&&0>sj(o.next,n,n.next))))&&(s=a,_=d)),a=a.next;while(a!==p)return s}(i,r);if(!n)return r;var o=sW(n,i),s=sO(n,n.next);return sO(o,o.next),r===n?s:r}(c[s],n),n.next);return n}(i,r,f,n)),i.length>80*n){o=a=i[0],s=l=i[1];for(var _=n;_a&&(a=c),h>l&&(l=h);u=0!==(u=Math.max(a-o,l-s))?1/u:0}return function i(r,n,o,s,a,l,c){if(r){!c&&l&&function(i,r,n,o){var s=i;do null===s.z&&(s.z=sV(s.x,s.y,r,n,o)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i)s.prevZ.nextZ=null,s.prevZ=null,function(i){var r,n,o,s,a,l,c,h,u=1;do{for(n=i,i=null,a=null,l=0;n;){for(l++,o=n,c=0,r=0;r0||h>0&&o;)0!==c&&(0===h||!o||n.z<=o.z)?(s=n,n=n.nextZ,c--):(s=o,o=o.nextZ,h--),a?a.nextZ=s:i=s,s.prevZ=a,a=s;n=o}a.nextZ=null,u*=2}while(l>1)}(s)}(r,s,a,l);for(var h,u,d=r;r.prev!==r.next;)if(h=r.prev,u=r.next,l?function(i,r,n,o){var s=i.prev,a=i.next;if(sj(s,i,a)>=0)return!1;for(var l=s.x>i.x?s.x>a.x?s.x:a.x:i.x>a.x?i.x:a.x,c=s.y>i.y?s.y>a.y?s.y:a.y:i.y>a.y?i.y:a.y,h=sV(s.x=h&&p&&p.z<=u;){if(d!==i.prev&&d!==i.next&&sN(s.x,s.y,i.x,i.y,a.x,a.y,d.x,d.y)&&sj(d.prev,d,d.next)>=0||(d=d.prevZ,p!==i.prev&&p!==i.next&&sN(s.x,s.y,i.x,i.y,a.x,a.y,p.x,p.y)&&sj(p.prev,p,p.next)>=0))return!1;p=p.nextZ}for(;d&&d.z>=h;){if(d!==i.prev&&d!==i.next&&sN(s.x,s.y,i.x,i.y,a.x,a.y,d.x,d.y)&&sj(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=u;){if(p!==i.prev&&p!==i.next&&sN(s.x,s.y,i.x,i.y,a.x,a.y,p.x,p.y)&&sj(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}(r,s,a,l):function(i){var r=i.prev,n=i.next;if(sj(r,i,n)>=0)return!1;for(var o=i.next.next;o!==i.prev;){if(sN(r.x,r.y,i.x,i.y,n.x,n.y,o.x,o.y)&&sj(o.prev,o,o.next)>=0)return!1;o=o.next}return!0}(r))n.push(h.i/o),n.push(r.i/o),n.push(u.i/o),sK(r),r=u.next,d=u.next;else if((r=u)===d){c?1===c?i(r=function(i,r,n){var o=i;do{var s=o.prev,a=o.next.next;!sG(s,a)&&sZ(s,o,o.next,a)&&sX(s,a)&&sX(a,s)&&(r.push(s.i/n),r.push(o.i/n),r.push(a.i/n),sK(o),sK(o.next),o=i=a),o=o.next}while(o!==i)return sO(o)}(sO(r),n,o),n,o,s,a,l,2):2===c&&function(r,n,o,s,a,l){var c=r;do{for(var h,u,d=c.next.next;d!==c.prev;){if(c.i!==d.i&&(h=c,u=d,h.next.i!==u.i&&h.prev.i!==u.i&&!function(i,r){var n=i;do{if(n.i!==i.i&&n.next.i!==i.i&&n.i!==r.i&&n.next.i!==r.i&&sZ(n,n.next,i,r))return!0;n=n.next}while(n!==i)return!1}(h,u)&&(sX(h,u)&&sX(u,h)&&function(i,r){var n=i,o=!1,s=(i.x+r.x)/2,a=(i.y+r.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&s<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(o=!o),n=n.next;while(n!==i)return o}(h,u)&&(sj(h.prev,h,u.prev)||sj(h,u.prev,u))||sG(h,u)&&sj(h.prev,h,h.next)>0&&sj(u.prev,u,u.next)>0))){var p=sW(c,d);return c=sO(c,c.next),p=sO(p,p.next),i(c,n,o,s,a,l),void i(p,n,o,s,a,l)}d=d.next}c=c.next}while(c!==r)}(r,n,o,s,a,l):i(sO(r),n,o,s,a,l,1);break}}}(f,m,n,o,s,u),m}function sF(i,r,n,o,s){var a,l;if(s===sJ(i,r,n,o)>0)for(a=r;a=r;a-=o)l=sH(a,i[a],i[a+1],l);return l&&sG(l,l.next)&&(sK(l),l=l.next),l}function sO(i,r){if(!i)return i;r||(r=i);var n,o=i;do if(n=!1,o.steiner||!sG(o,o.next)&&0!==sj(o.prev,o,o.next))o=o.next;else{if(sK(o),(o=r=o.prev)===o.next)break;n=!0}while(n||o!==r)return r}function sU(i,r){return i.x-r.x}function sV(i,r,n,o,s){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=32767*(i-n)*s)|i<<8))|i<<4))|i<<2))|i<<1))|(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=32767*(r-o)*s)|r<<8))|r<<4))|r<<2))|r<<1))<<1}function sN(i,r,n,o,s,a,l,c){return(s-l)*(r-c)-(i-l)*(a-c)>=0&&(i-l)*(o-c)-(n-l)*(r-c)>=0&&(n-l)*(a-c)-(s-l)*(o-c)>=0}function sj(i,r,n){return(r.y-i.y)*(n.x-r.x)-(r.x-i.x)*(n.y-r.y)}function sG(i,r){return i.x===r.x&&i.y===r.y}function sZ(i,r,n,o){var s=sq(sj(i,r,n)),a=sq(sj(i,r,o)),l=sq(sj(n,o,i)),c=sq(sj(n,o,r));return s!==a&&l!==c||!(0!==s||!s$(i,n,r))||!(0!==a||!s$(i,o,r))||!(0!==l||!s$(n,i,o))||!(0!==c||!s$(n,r,o))}function s$(i,r,n){return r.x<=Math.max(i.x,n.x)&&r.x>=Math.min(i.x,n.x)&&r.y<=Math.max(i.y,n.y)&&r.y>=Math.min(i.y,n.y)}function sq(i){return i>0?1:i<0?-1:0}function sX(i,r){return 0>sj(i.prev,i,i.next)?sj(i,r,i.next)>=0&&sj(i,i.prev,r)>=0:0>sj(i,r,i.prev)||0>sj(i,i.next,r)}function sW(i,r){var n=new sY(i.i,i.x,i.y),o=new sY(r.i,r.x,r.y),s=i.next,a=r.prev;return i.next=r,r.prev=i,n.next=s,s.prev=n,o.next=n,n.prev=o,a.next=o,o.prev=a,o}function sH(i,r,n,o){var s=new sY(i,r,n);return o?(s.next=o.next,s.prev=o,o.next.prev=s,o.next=s):(s.prev=s,s.next=s),s}function sK(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function sY(i,r,n){this.i=i,this.x=r,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function sJ(i,r,n,o){for(var s=0,a=r,l=n-o;ar?1:0}function s1(i,r){let n,o;const s=i.length;if(s<=1)return[i];const a=[];for(let l=0;l1)for(let h=0;ho;){if(s-o>600){var l=s-o+1,c=n-o+1,h=Math.log(l),u=.5*Math.exp(2*h/3),d=.5*Math.sqrt(h*u*(l-u)/l)*(c-l/2<0?-1:1);i(r,n,Math.max(o,Math.floor(n-c*u/l+d)),Math.min(s,Math.floor(n+(l-c)*u/l+d)),a)}var p=r[n],f=o,m=s;for(sQ(r,o,n),a(r[s],p)>0&&sQ(r,o,s);fa(r[f],p);)f++;for(;a(r[m],p)>0;)m--}0===a(r[o],p)?sQ(r,o,m):sQ(r,++m,s),m<=n&&(o=m+1),n<=m&&(s=m-1)}}(u,r,1,d||u.length-1,s2||s0),a[h]=a[h].slice(0,r))}return a}function s2(i,r){return r.area-i.area}function s3(i,r,n){const o=n.patternDependencies;let s=!1;for(const a of r){const l=a.paint.get(`${i}-pattern`);l.isConstant()||(s=!0);const c=l.constantOr(null);c&&(s=!0,o[c.to]=!0,o[c.from]=!0)}return s}function s5(i,r,n,o,s){const a=s.patternDependencies;for(const l of r){const c=l.paint.get(`${i}-pattern`).value;if("constant"!==c.kind){let h=c.evaluate({zoom:o-1},n,{},s.availableImages),u=c.evaluate({zoom:o},n,{},s.availableImages),d=c.evaluate({zoom:o+1},n,{},s.availableImages);h=h&&h.name?h.name:h,u=u&&u.name?u.name:u,d=d&&d.name?d.name:d,a[h]=!0,a[u]=!0,a[d]=!0,n.patterns[l.id]={min:h,mid:u,max:d}}}return n}sR.deviation=function(i,r,n,o){var s=r&&r.length,a=Math.abs(sJ(i,0,s?r[0]*n:i.length,n));if(s)for(var l=0,c=r.length;l0&&n.holes.push(o+=i[s-1].length)}return n},sB.default=sR;class s4{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new nJ,this.indexArray=new oe,this.indexArray2=new oa,this.programConfigurations=new o$(i.layers,i.zoom),this.segments=new o0,this.segments2=new o0,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(i,r,n,o){this.hasPattern=s3("fill",this.layers,r);const s=this.layers[0].layout.get("fill-sort-key"),a=[];for(const{feature:l,id:c,index:h,sourceLayerIndex:u}of i){const d=this.layers[0]._featureFilter.needGeometry,p=si(l,d);if(!this.layers[0]._featureFilter.filter(new nk(this.zoom),p,n))continue;const f=s?s.evaluate(p,{},n,r.availableImages):void 0,m={id:c,properties:l.properties,type:l.type,sourceLayerIndex:u,index:h,geometry:d?p.geometry:st(l,n,o),patterns:{},sortKey:f};a.push(m)}for(const _ of(s&&a.sort((i,r)=>i.sortKey-r.sortKey),a)){const{geometry:g,index:y,sourceLayerIndex:x}=_;if(this.hasPattern){const v=s5("fill",this.layers,_,this.zoom,r);this.patternFeatures.push(v)}else this.addFeature(_,g,y,n,{},r.availableImages);r.featureIndex.insert(i[y].feature,g,y,x,this.index)}}update(i,r,n,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,o)}addFeatures(i,r,n,o){for(const s of this.patternFeatures)this.addFeature(s,s.geometry,s.index,r,n,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,sL),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.indexBuffer2=i.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(i,r,n,o,s,a=[]){for(const l of s1(r,500)){let c=0;for(const h of l)c+=h.length;const u=this.segments.prepareSegment(c,this.layoutVertexArray,this.indexArray),d=u.vertexLength,p=[],f=[];for(const m of l){if(0===m.length)continue;m!==l[0]&&f.push(p.length/2);const _=this.segments2.prepareSegment(m.length,this.layoutVertexArray,this.indexArray2),g=_.vertexLength;this.layoutVertexArray.emplaceBack(m[0].x,m[0].y),this.indexArray2.emplaceBack(g+m.length-1,g),p.push(m[0].x),p.push(m[0].y);for(let y=1;y>3;r=1===o?i.readString():2===o?i.readFloat():3===o?i.readDouble():4===o?i.readVarint64():5===o?i.readVarint():6===o?i.readSVarint():7===o?i.readBoolean():null}return r}(n))}function ao(i,r,n){if(3===i){var o=new ar(n,n.readVarint()+n.pos);o.length&&(r[o.name]=o)}}at.types=["Unknown","Point","LineString","Polygon"],at.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var r,n=i.readVarint()+i.pos,o=1,s=0,a=0,l=0,c=[];i.pos>3}if(s--,1===o||2===o)a+=i.readSVarint(),l+=i.readSVarint(),1===o&&(r&&c.push(r),r=[]),r.push(new u(a,l));else{if(7!==o)throw Error("unknown command "+o);r&&r.push(r[0].clone())}}return r&&c.push(r),c},at.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var r=i.readVarint()+i.pos,n=1,o=0,s=0,a=0,l=1/0,c=-1/0,h=1/0,u=-1/0;i.pos>3}if(o--,1===n||2===n)(s+=i.readSVarint())c&&(c=s),(a+=i.readSVarint())u&&(u=a);else if(7!==n)throw Error("unknown command "+n)}return[l,h,c,u]},at.prototype.toGeoJSON=function(i,r,n){var o,s,a=this.extent*Math.pow(2,n),l=this.extent*i,c=this.extent*r,h=this.loadGeometry(),u=at.types[this.type];function d(i){for(var r=0;r=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[i];var r=this._pbf.readVarint()+this._pbf.pos;return new at(this._pbf,r,this.extent,this._keys,this._values)};var as={VectorTile:function(i,r){this.layers=i.readFields(ao,{},r)},VectorTileFeature:at,VectorTileLayer:ar};const aa=as.VectorTileFeature.types;function al(i,r,n,o,s,a,l,c){i.emplaceBack((r<<1)+l,(n<<1)+a,(Math.floor(8192*o)<<1)+s,Math.round(c))}class ac{constructor(){this.acc=new u(0,0),this.polyCount=[]}startRing(i){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new u(i.x,i.y),this.max=new u(i.x,i.y))}append(i,r){this.currentPolyCount.edges++,this.acc._add(i);let n=!!this.borders;const o=this.min,s=this.max;i.xs.x&&(s.x=i.x,n=!0),i.ys.y&&(s.y=i.y,n=!0),((0===i.x||8192===i.x)&&i.x===r.x)!=((0===i.y||8192===i.y)&&i.y===r.y)&&this.processBorderOverlap(i,r),n&&this.checkBorderIntersection(i,r)}checkBorderIntersection(i,r){r.x<0!=i.x<0&&this.addBorderIntersection(0,io(r.y,i.y,(0-r.x)/(i.x-r.x))),r.x>8192!=i.x>8192&&this.addBorderIntersection(1,io(r.y,i.y,(8192-r.x)/(i.x-r.x))),r.y<0!=i.y<0&&this.addBorderIntersection(2,io(r.x,i.x,(0-r.y)/(i.y-r.y))),r.y>8192!=i.y>8192&&this.addBorderIntersection(3,io(r.x,i.x,(8192-r.y)/(i.y-r.y)))}addBorderIntersection(i,r){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const n=this.borders[i];rn[1]&&(n[1]=r)}processBorderOverlap(i,r){if(i.x===r.x){if(i.y===r.y)return;const n=0===i.x?0:1;this.addBorderIntersection(n,r.y),this.addBorderIntersection(n,i.y)}else{const o=0===i.y?2:3;this.addBorderIntersection(o,r.x),this.addBorderIntersection(o,i.x)}}centroid(){const i=this.polyCount.reduce((i,r)=>i+r.edges,0);return 0!==i?this.acc.div(i)._round():new u(0,0)}span(){return new u(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce((i,r)=>i+ +(r[0]!==Number.MAX_VALUE),0)}}class ah{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.hasPattern=!1,this.layoutVertexArray=new nQ,this.centroidVertexArray=new ow,this.indexArray=new oe,this.programConfigurations=new o$(i.layers,i.zoom),this.segments=new o0,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.enableTerrain=i.enableTerrain}populate(i,r,n,o){for(const{feature:s,id:a,index:l,sourceLayerIndex:c}of(this.features=[],this.hasPattern=s3("fill-extrusion",this.layers,r),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDone=[!1,!1,!1,!1],this.tileToMeter=function(i){const r=Math.exp(Math.PI*(1-i.y/(1<i.x<=0)||l.every(i=>i.x>=8192)||l.every(i=>i.y<=0)||l.every(i=>i.y>=8192))continue;for(let p=0;p=1){const y=f[_-1];if((g.x!==y.x||!(g.x<0)&&!(g.x>8192))&&(g.y!==y.y||!(g.y<0)&&!(g.y>8192))){c&&c.append(g,y),d.vertexLength+4>o0.MAX_VERTEX_ARRAY_LENGTH&&(d=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const x=g.sub(y)._perp(),v=x.x/(Math.abs(x.x)+Math.abs(x.y)),b=x.y>0?1:0,w=y.dist(g);m+w>32768&&(m=0),al(this.layoutVertexArray,g.x,g.y,v,b,0,0,m),al(this.layoutVertexArray,g.x,g.y,v,b,0,1,m),m+=w,al(this.layoutVertexArray,y.x,y.y,v,b,0,0,m),al(this.layoutVertexArray,y.x,y.y,v,b,0,1,m);const T=d.vertexLength;this.indexArray.emplaceBack(T,T+2,T+1),this.indexArray.emplaceBack(T+1,T+2,T+3),d.vertexLength+=4,d.primitiveLength+=2}}}}if(d.vertexLength+u>o0.MAX_VERTEX_ARRAY_LENGTH&&(d=this.segments.prepareSegment(u,this.layoutVertexArray,this.indexArray)),"Polygon"!==aa[i.type])continue;const E=[],S=[],I=d.vertexLength;for(let M=0;M0){if(c.borders){c.vertexArrayOffset=this.centroidVertexArray.length;const D=c.borders,L=this.featuresOnBorder.push(c)-1;for(let B=0;B<4;B++)D[B][0]!==Number.MAX_VALUE&&this.borders[B].push(L)}this.encodeCentroid(c.borders?void 0:c.centroid(),c)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,s,a,o)}sortBorders(){for(let i=0;i<4;i++)this.borders[i].sort((r,n)=>this.featuresOnBorder[r].borders[i][0]-this.featuresOnBorder[n].borders[i][0])}encodeCentroid(i,r,n=!0){let o,s;if(i){if(0!==i.y){const a=r.span()._mult(this.tileToMeter);o=(Math.max(i.x,1)<<3)+Math.min(7,Math.round(a.x/10)),s=(Math.max(i.y,1)<<3)+Math.min(7,Math.round(a.y/10))}else o=Math.ceil(7*(i.x+450)),s=0}else o=0,s=+n;let l=n?this.centroidVertexArray.length:r.vertexArrayOffset;for(const c of r.polyCount){n&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*c.edges+c.top);for(let h=0;h<2*c.edges;h++)this.centroidVertexArray.emplace(l++,0,s),this.centroidVertexArray.emplace(l++,o,s);for(let u=0;ui.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new n0,this.layoutVertexArray2=new n1,this.indexArray=new oe,this.programConfigurations=new o$(i.layers,i.zoom),this.segments=new o0,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(i,r,n,o){this.hasPattern=s3("line",this.layers,r);const s=this.layers[0].layout.get("line-sort-key"),a=[];for(const{feature:l,id:c,index:h,sourceLayerIndex:u}of i){const d=this.layers[0]._featureFilter.needGeometry,p=si(l,d);if(!this.layers[0]._featureFilter.filter(new nk(this.zoom),p,n))continue;const f=s?s.evaluate(p,{},n):void 0,m={id:c,properties:l.properties,type:l.type,sourceLayerIndex:u,index:h,geometry:d?p.geometry:st(l,n,o),patterns:{},sortKey:f};a.push(m)}s&&a.sort((i,r)=>i.sortKey-r.sortKey);const{lineAtlas:_,featureIndex:g}=r,y=this.addConstantDashes(_);for(const x of a){const{geometry:v,index:b,sourceLayerIndex:w}=x;if(y&&this.addFeatureDashes(x,_),this.hasPattern){const T=s5("line",this.layers,x,this.zoom,r);this.patternFeatures.push(T)}else this.addFeature(x,v,b,n,_.positions,r.availableImages);g.insert(i[b].feature,v,b,w,this.index)}}addConstantDashes(i){let r=!1;for(const n of this.layers){const o=n.paint.get("line-dasharray").value,s=n.layout.get("line-cap").value;if("constant"!==o.kind||"constant"!==s.kind)r=!0;else{const a=s.value,l=o.value;if(!l)continue;i.addDash(l.from,a),i.addDash(l.to,a),l.other&&i.addDash(l.other,a)}}return r}addFeatureDashes(i,r){const n=this.zoom;for(const o of this.layers){let s,a,l,c,h,u;const d=o.paint.get("line-dasharray").value,p=o.layout.get("line-cap").value;if("constant"===d.kind&&"constant"===p.kind)continue;if("constant"===d.kind){const f=d.value;if(!f)continue;s=f.other||f.to,a=f.to,l=f.from}else s=d.evaluate({zoom:n-1},i),a=d.evaluate({zoom:n},i),l=d.evaluate({zoom:n+1},i);"constant"===p.kind?c=h=u=p.value:(c=p.evaluate({zoom:n-1},i),h=p.evaluate({zoom:n},i),u=p.evaluate({zoom:n+1},i)),r.addDash(s,c),r.addDash(a,h),r.addDash(l,u);const m=r.getKey(s,c),_=r.getKey(a,h),g=r.getKey(l,u);i.patterns[o.id]={min:m,mid:_,max:g}}}update(i,r,n,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,o)}addFeatures(i,r,n,o){for(const s of this.patternFeatures)this.addFeature(s,s.geometry,s.index,r,n,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=i.createVertexBuffer(this.layoutVertexArray2,ay)),this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,a_),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(i){if(i.properties&&i.properties.hasOwnProperty("mapbox_clip_start")&&i.properties.hasOwnProperty("mapbox_clip_end"))return{start:+i.properties.mapbox_clip_start,end:+i.properties.mapbox_clip_end}}addFeature(i,r,n,o,s,a){const l=this.layers[0].layout,c=l.get("line-join").evaluate(i,{}),h=l.get("line-cap").evaluate(i,{}),u=l.get("line-miter-limit"),d=l.get("line-round-limit");for(const p of(this.lineClips=this.lineFeatureClips(i),r))this.addLine(p,i,c,h,u,d);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,s,a,o)}addLine(i,r,n,o,s,a){let l,c,h,u,d;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let p=0;p=2&&i[m-1].equals(i[m-2]);)m--;let _=0;for(;_0;if(S&&x>_){const M=l.dist(c);if(M>2*g){const A=l.sub(l.sub(c)._mult(g/M)._round());this.updateDistance(c,A),this.addCurrentVertex(A,u,0,0,y),c=A}}const C=c&&h;let z=C?n:f?"butt":o;if(C&&"round"===z&&(Ts&&(z="bevel"),"bevel"===z&&(T>2&&(z="flipbevel"),T100)v=d.mult(-1);else{const k=T*u.add(d).mag()/u.sub(d).mag();v._perp()._mult(k*(I?-1:1))}this.addCurrentVertex(l,v,0,0,y),this.addCurrentVertex(l,v.mult(-1),0,0,y)}else if("bevel"===z||"fakeround"===z){const P=-Math.sqrt(T*T-1),D=I?P:0,L=I?0:P;if(c&&this.addCurrentVertex(l,u,D,L,y),"fakeround"===z){const B=Math.round(180*E/Math.PI/20);for(let R=1;R2*g){const j=l.add(h.sub(l)._mult(g/N)._round());this.updateDistance(l,j),this.addCurrentVertex(j,d,0,0,y),l=j}}}}addCurrentVertex(i,r,n,o,s,a=!1){const l=r.y*o-r.x,c=-r.y-r.x*o;this.addHalfVertex(i,r.x+r.y*n,r.y-r.x*n,a,!1,n,s),this.addHalfVertex(i,l,c,a,!0,-o,s)}addHalfVertex({x:i,y:r},n,o,s,a,l,c){this.layoutVertexArray.emplaceBack((i<<1)+(s?1:0),(r<<1)+(a?1:0),Math.round(63*n)+128,Math.round(63*o)+128,1+(0===l?0:l<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineSoFar);const h=c.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,h),c.primitiveLength++),a?this.e2=h:this.e1=h}updateScaledDistance(){if(this.lineClips){const i=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=i*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(i,r){this.distance+=i.dist(r),this.updateScaledDistance()}}r$("LineBucket",ab,{omit:["layers","patternFeatures"]});const aw=new n$({"line-cap":new nN(tr.layout_line["line-cap"]),"line-join":new nN(tr.layout_line["line-join"]),"line-miter-limit":new nV(tr.layout_line["line-miter-limit"]),"line-round-limit":new nV(tr.layout_line["line-round-limit"]),"line-sort-key":new nN(tr.layout_line["line-sort-key"])});var aT={paint:new n$({"line-opacity":new nN(tr.paint_line["line-opacity"]),"line-color":new nN(tr.paint_line["line-color"]),"line-translate":new nV(tr.paint_line["line-translate"]),"line-translate-anchor":new nV(tr.paint_line["line-translate-anchor"]),"line-width":new nN(tr.paint_line["line-width"]),"line-gap-width":new nN(tr.paint_line["line-gap-width"]),"line-offset":new nN(tr.paint_line["line-offset"]),"line-blur":new nN(tr.paint_line["line-blur"]),"line-dasharray":new nj(tr.paint_line["line-dasharray"]),"line-pattern":new nj(tr.paint_line["line-pattern"]),"line-gradient":new nZ(tr.paint_line["line-gradient"])}),layout:aw};const aE=new class extends nN{possiblyEvaluate(i,r){return r=new nk(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(i,r)}evaluate(i,r,n,o){return r=J({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(i,r,n,o)}}(aT.paint.properties["line-width"].specification);aE.useIntegerZoom=!0;const aS=nK([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_z_tile_anchor",components:4,type:"Int16"}],4),aI=nK([{name:"a_projected_pos",components:3,type:"Float32"}],4);nK([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const aM=nK([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),aA=nK([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);nK([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const aC=nK([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),az=nK([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function ak(i,r){const{expression:n}=r;if("constant"===n.kind)return{kind:"constant",layoutSize:n.evaluate(new nk(i+1))};if("source"===n.kind)return{kind:"source"};{const{zoomStops:o,interpolationType:s}=n;let a=0;for(;a":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","\xa2":"¢","\xa3":"£","\xa5":"¥","\xa6":"¦","\xac":"¬","\xaf":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var aR=function(i,r,n,o,s){var a,l,c=8*s-o-1,h=(1<>1,d=-7,p=n?s-1:0,f=n?-1:1,m=i[r+p];for(p+=f,a=m&(1<<-d)-1,m>>=-d,d+=c;d>0;a=256*a+i[r+p],p+=f,d-=8);for(l=a&(1<<-d)-1,a>>=-d,d+=o;d>0;l=256*l+i[r+p],p+=f,d-=8);if(0===a)a=1-u;else{if(a===h)return l?NaN:1/0*(m?-1:1);l+=Math.pow(2,o),a-=u}return(m?-1:1)*l*Math.pow(2,a-o)},aF=function(i,r,n,o,s,a){var l,c,h,u=8*a-s-1,d=(1<>1,f=23===s?5960464477539062e-23:0,m=o?0:a-1,_=o?1:-1,g=r<0||0===r&&1/r<0?1:0;for(isNaN(r=Math.abs(r))||r===1/0?(c=isNaN(r)?1:0,l=d):(l=Math.floor(Math.log(r)/Math.LN2),r*(h=Math.pow(2,-l))<1&&(l--,h*=2),(r+=l+p>=1?f/h:f*Math.pow(2,1-p))*h>=2&&(l++,h/=2),l+p>=d?(c=0,l=d):l+p>=1?(c=(r*h-1)*Math.pow(2,s),l+=p):(c=r*Math.pow(2,p-1)*Math.pow(2,s),l=0));s>=8;i[n+m]=255&c,m+=_,c/=256,s-=8);for(l=l<0;i[n+m]=255&l,m+=_,l/=256,u-=8);i[n+m-_]|=128*g};function aO(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}aO.Varint=0,aO.Fixed64=1,aO.Bytes=2,aO.Fixed32=5;var aU="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function aV(i){return i.type===aO.Bytes?i.readVarint()+i.pos:i.pos+1}function aN(i,r,n){var o=r<=16383?1:r<=2097151?2:r<=268435455?3:Math.floor(Math.log(r)/(7*Math.LN2));n.realloc(o);for(var s=n.pos-1;s>=i;s--)n.buf[s+o]=n.buf[s]}function aj(i,r){for(var n=0;n>>8,i[n+2]=r>>>16,i[n+3]=r>>>24}function aQ(i,r){return(i[r]|i[r+1]<<8|i[r+2]<<16)+(i[r+3]<<24)}function a0(i,r,n){r.glyphs=[],1===i&&n.readMessage(a1,r)}function a1(i,r,n){if(3===i){const{id:o,bitmap:s,width:a,height:l,left:c,top:h,advance:u}=n.readMessage(a2,{});r.glyphs.push({id:o,bitmap:new sA({width:a+6,height:l+6},s),metrics:{width:a,height:l,left:c,top:h,advance:u}})}else 4===i?r.ascender=n.readSVarint():5===i&&(r.descender=n.readSVarint())}function a2(i,r,n){1===i?r.id=n.readVarint():2===i?r.bitmap=n.readBytes():3===i?r.width=n.readVarint():4===i?r.height=n.readVarint():5===i?r.left=n.readSVarint():6===i?r.top=n.readSVarint():7===i&&(r.advance=n.readVarint())}function a3(i){let r=0,n=0;for(const o of i)r+=o.w*o.h,n=Math.max(n,o.w);i.sort((i,r)=>r.h-i.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(r/.95)),n),h:1/0}];let a=0,l=0;for(const c of i)for(let h=s.length-1;h>=0;h--){const u=s[h];if(!(c.w>u.w||c.h>u.h)){if(c.x=u.x,c.y=u.y,l=Math.max(l,c.y+c.h),a=Math.max(a,c.x+c.w),c.w===u.w&&c.h===u.h){const d=s.pop();h>3,a=this.pos;this.type=7&o,i(s,r,this),this.pos===a&&this.skip(o)}return r},readMessage:function(i,r){return this.readFields(i,r,this.readVarint()+this.pos)},readFixed32:function(){var i=aY(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=aQ(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=aY(this.buf,this.pos)+4294967296*aY(this.buf,this.pos+4);return this.pos+=8,i},readSFixed64:function(){var i=aY(this.buf,this.pos)+4294967296*aQ(this.buf,this.pos+4);return this.pos+=8,i},readFloat:function(){var i=aR(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=aR(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var r,n,o=this.buf;return r=127&(n=o[this.pos++]),n<128?r:(r|=(127&(n=o[this.pos++]))<<7,n<128?r:(r|=(127&(n=o[this.pos++]))<<14,n<128?r:(r|=(127&(n=o[this.pos++]))<<21,n<128?r:function(i,r,n){var o,s,a,l=n.buf;if(s=(112&(a=l[n.pos++]))>>4,a<128||(s|=(127&(a=l[n.pos++]))<<3,a<128)||(s|=(127&(a=l[n.pos++]))<<10,a<128)||(s|=(127&(a=l[n.pos++]))<<17,a<128)||(s|=(127&(a=l[n.pos++]))<<24,a<128)||(s|=(1&(a=l[n.pos++]))<<31,a<128))return o=s,r?4294967296*o+(i>>>0):4294967296*(o>>>0)+(i>>>0);throw Error("Expected varint not more than 10 bytes")}(r|=(15&(n=o[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?-((i+1)/2):i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i,r=this.readVarint()+this.pos,n=this.pos;return this.pos=r,r-n>=12&&aU?(i=this.buf,aU.decode(i.subarray(n,r))):function(i,r,n){for(var o="",s=r;s239?4:h>223?3:h>191?2:1;if(s+d>n)break;1===d?h<128&&(u=h):2===d?128==(192&(a=i[s+1]))&&(u=(31&h)<<6|63&a)<=127&&(u=null):3===d?(l=i[s+2],128==(192&(a=i[s+1]))&&128==(192&l)&&((u=(15&h)<<12|(63&a)<<6|63&l)<=2047||u>=55296&&u<=57343)&&(u=null)):4===d&&(l=i[s+2],c=i[s+3],128==(192&(a=i[s+1]))&&128==(192&l)&&128==(192&c)&&((u=(15&h)<<18|(63&a)<<12|(63&l)<<6|63&c)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,d=1):u>65535&&(u-=65536,o+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),o+=String.fromCharCode(u),s+=d}return o}(this.buf,n,r)},readBytes:function(){var i=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,i);return this.pos=i,r},readPackedVarint:function(i,r){if(this.type!==aO.Bytes)return i.push(this.readVarint(r));var n=aV(this);for(i=i||[];this.pos127;);else if(r===aO.Bytes)this.pos=this.readVarint()+this.pos;else if(r===aO.Fixed32)this.pos+=4;else{if(r!==aO.Fixed64)throw Error("Unimplemented type: "+r);this.pos+=8}},writeTag:function(i,r){this.writeVarint(i<<3|r)},realloc:function(i){for(var r=this.length||16;r268435455||i<0?function(i,r){var n,o,s,a,l,c,h;if(i>=0?(n=i%4294967296|0,o=i/4294967296|0):(o=~(-i/4294967296),4294967295^(n=~(-i%4294967296))?n=n+1|0:(n=0,o=o+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw Error("Given varint doesn't fit into 10 bytes");r.realloc(10),s=n,(a=r).buf[a.pos++]=127&s|128,s>>>=7,a.buf[a.pos++]=127&s|128,s>>>=7,a.buf[a.pos++]=127&s|128,s>>>=7,a.buf[a.pos++]=127&s|128,a.buf[a.pos]=127&(s>>>=7),l=o,c=r,h=(7&l)<<4,c.buf[c.pos++]|=h|((l>>>=3)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l)))))}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?-(2*i)-1:2*i)},writeBoolean:function(i){this.writeVarint(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var r=this.pos;this.pos=function(i,r,n){for(var o,s,a=0;a55295&&o<57344){if(!s){o>56319||a+1===r.length?(i[n++]=239,i[n++]=191,i[n++]=189):s=o;continue}if(o<56320){i[n++]=239,i[n++]=191,i[n++]=189,s=o;continue}o=s-55296<<10|o-56320|65536,s=null}else s&&(i[n++]=239,i[n++]=191,i[n++]=189,s=null);o<128?i[n++]=o:(o<2048?i[n++]=o>>6|192:(o<65536?i[n++]=o>>12|224:(i[n++]=o>>18|240,i[n++]=o>>12&63|128),i[n++]=o>>6&63|128),i[n++]=63&o|128)}return n}(this.buf,i,this.pos);var n=this.pos-r;n>=128&&aN(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeFloat:function(i){this.realloc(4),aF(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),aF(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var r=i.length;this.writeVarint(r),this.realloc(r);for(var n=0;n=128&&aN(n,o,this),this.pos=n-1,this.writeVarint(o),this.pos+=o},writeMessage:function(i,r,n){this.writeTag(i,aO.Bytes),this.writeRawMessage(r,n)},writePackedVarint:function(i,r){r.length&&this.writeMessage(i,aj,r)},writePackedSVarint:function(i,r){r.length&&this.writeMessage(i,aG,r)},writePackedBoolean:function(i,r){r.length&&this.writeMessage(i,aq,r)},writePackedFloat:function(i,r){r.length&&this.writeMessage(i,aZ,r)},writePackedDouble:function(i,r){r.length&&this.writeMessage(i,a$,r)},writePackedFixed32:function(i,r){r.length&&this.writeMessage(i,aX,r)},writePackedSFixed32:function(i,r){r.length&&this.writeMessage(i,aW,r)},writePackedFixed64:function(i,r){r.length&&this.writeMessage(i,aH,r)},writePackedSFixed64:function(i,r){r.length&&this.writeMessage(i,aK,r)},writeBytesField:function(i,r){this.writeTag(i,aO.Bytes),this.writeBytes(r)},writeFixed32Field:function(i,r){this.writeTag(i,aO.Fixed32),this.writeFixed32(r)},writeSFixed32Field:function(i,r){this.writeTag(i,aO.Fixed32),this.writeSFixed32(r)},writeFixed64Field:function(i,r){this.writeTag(i,aO.Fixed64),this.writeFixed64(r)},writeSFixed64Field:function(i,r){this.writeTag(i,aO.Fixed64),this.writeSFixed64(r)},writeVarintField:function(i,r){this.writeTag(i,aO.Varint),this.writeVarint(r)},writeSVarintField:function(i,r){this.writeTag(i,aO.Varint),this.writeSVarint(r)},writeStringField:function(i,r){this.writeTag(i,aO.Bytes),this.writeString(r)},writeFloatField:function(i,r){this.writeTag(i,aO.Fixed32),this.writeFloat(r)},writeDoubleField:function(i,r){this.writeTag(i,aO.Fixed64),this.writeDouble(r)},writeBooleanField:function(i,r){this.writeVarintField(i,Boolean(r))}};class a5{constructor(i,{pixelRatio:r,version:n,stretchX:o,stretchY:s,content:a}){this.paddedRect=i,this.pixelRatio=r,this.stretchX=o,this.stretchY=s,this.content=a,this.version=n}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class a4{constructor(i,r){const n={},o={};this.haveRenderCallbacks=[];const s=[];this.addImages(i,n,s),this.addImages(r,o,s);const{w:a,h:l}=a3(s),c=new sC({width:a||1,height:l||1});for(const h in i){const u=i[h],d=n[h].paddedRect;sC.copy(u.data,c,{x:0,y:0},{x:d.x+1,y:d.y+1},u.data)}for(const p in r){const f=r[p],m=o[p].paddedRect,_=m.x+1,g=m.y+1,y=f.data.width,x=f.data.height;sC.copy(f.data,c,{x:0,y:0},{x:_,y:g},f.data),sC.copy(f.data,c,{x:0,y:x-1},{x:_,y:g-1},{width:y,height:1}),sC.copy(f.data,c,{x:0,y:0},{x:_,y:g+x},{width:y,height:1}),sC.copy(f.data,c,{x:y-1,y:0},{x:_-1,y:g},{width:1,height:x}),sC.copy(f.data,c,{x:0,y:0},{x:_+y,y:g},{width:1,height:x})}this.image=c,this.iconPositions=n,this.patternPositions=o}addImages(i,r,n){for(const o in i){const s=i[o],a={x:0,y:0,w:s.data.width+2,h:s.data.height+2};n.push(a),r[o]=new a5(a,s),s.hasRenderCallback&&this.haveRenderCallbacks.push(o)}}patchUpdatedImages(i,r){for(const n in i.dispatchRenderCallbacks(this.haveRenderCallbacks),i.updatedImages)this.patchUpdatedImage(this.iconPositions[n],i.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],i.getImage(n),r)}patchUpdatedImage(i,r,n){if(!i||!r||i.version===r.version)return;i.version=r.version;const[o,s]=i.tl;n.update(r.data,void 0,{x:o,y:s})}}r$("ImagePosition",a5),r$("ImageAtlas",a4);const a6={horizontal:1,vertical:2,horizontalOnly:3};class a8{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(i,r){const n=new a8;return n.scale=i||1,n.fontStack=r,n}static forImage(i){const r=new a8;return r.imageName=i,r}}class a9{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(i,r){const n=new a9;for(let o=0;o=0&&o>=i&&le[this.text.charCodeAt(o)];o--)n--;this.text=this.text.substring(i,n),this.sectionIndex=this.sectionIndex.slice(i,n)}substring(i,r){const n=new a9;return n.text=this.text.substring(i,r),n.sectionIndex=this.sectionIndex.slice(i,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((i,r)=>Math.max(i,this.sections[r].scale),0)}addTextSection(i,r){this.text+=i.text,this.sections.push(a8.forText(i.scale,i.fontStack||r));const n=this.sections.length-1;for(let o=0;o=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function a7(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g){let y;const x=a9.fromFeature(i,s);p===a6.vertical&&x.verticalizePunctuation(f);const{processBidirectionalText:v,processStyledBidirectionalText:b}=nz;if(v&&1===x.sections.length){y=[];const w=v(x.toString(),lo(x,u,a,r,o,m,_));for(const T of w){const E=new a9;E.text=T,E.sections=x.sections;for(let S=0;S0&&$>C&&(C=$)}else{const q=n[D.fontStack];if(!q)continue;q[B]&&(O=q[B]);const X=r[D.fontStack];if(!X)continue;const W=X.glyphs[B];if(!W)continue;if(F=W.metrics,V=8203!==B?24:0,y){const H=void 0!==X.ascender?Math.abs(X.ascender):0,K=void 0!==X.descender?Math.abs(X.descender):0,Y=(H+K)*R;z=0;let d=0;for(let p=0;p-n/2;){if(--l<0)return!1;c-=i[l].dist(a),a=i[l]}c+=i[l].dist(i[l+1]),l++;const h=[];let u=0;for(;co;)u-=h.shift().angleDelta;if(u>s)return!1;l++,c+=d.dist(p)}return!0}function lu(i){let r=0;for(let n=0;n=o&&f.x>=o||(p.x>=o?p=new u(o,p.y+(o-p.x)/(f.x-p.x)*(f.y-p.y))._round():f.x>=o&&(f=new u(o,p.y+(o-p.x)/(f.x-p.x)*(f.y-p.y))._round()),p.y>=s&&f.y>=s||(p.y>=s?p=new u(p.x+(s-p.y)/(f.y-p.y)*(f.x-p.x),s)._round():f.y>=s&&(f=new u(p.x+(s-p.y)/(f.y-p.y)*(f.x-p.x),s)._round()),c&&p.equals(c[c.length-1])||(c=[p],a.push(c)),c.push(f)))))}}return a}function lf(i,r,n,o,s,a,l,c,h){for(let u=r;u-1)a[++h]=c,l[h]=u,l[h+1]=1e20}for(let f=0,m=0;f{let o=this.entries[i];o||(o=this.entries[i]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let s=o.glyphs[r];if(void 0!==s)return void n(null,{stack:i,id:r,glyph:s});if(s=this._tinySDF(o,i,r))return o.glyphs[r]=s,void n(null,{stack:i,id:r,glyph:s});const a=Math.floor(r/256);if(256*a>65535)return void n(Error("glyphs > 65535 not supported"));if(o.ranges[a])return void n(null,{stack:i,id:r,glyph:s});let l=o.requests[a];l||(l=o.requests[a]=[],lg.loadGlyphRange(i,a,this.url,this.requestManager,(i,r)=>{if(r){for(const n in o.ascender=r.ascender,o.descender=r.descender,r.glyphs)this._doesCharSupportLocalGlyph(+n)||(o.glyphs[+n]=r.glyphs[+n]);o.ranges[a]=!0}for(const s of l)s(i,r);delete o.requests[a]})),l.push((o,s)=>{o?n(o):s&&n(null,{stack:i,id:r,glyph:s.glyphs[r]||null})})},(i,n)=>{if(i)r(i);else if(n){const o={};for(const{stack:s,id:a,glyph:l}of n)void 0===o[s]&&(o[s]={}),void 0===o[s].glyphs&&(o[s].glyphs={}),o[s].glyphs[a]=l&&{id:l.id,bitmap:l.bitmap.clone(),metrics:l.metrics},o[s].ascender=this.entries[s].ascender,o[s].descender=this.entries[s].descender;r(null,o)}})}_doesCharSupportLocalGlyph(i){return this.localGlyphMode!==l_.none&&(this.localGlyphMode===l_.all?!!this.localFontFamily:!!this.localFontFamily&&(nn(i)||na(i)||r4(i)||r6(i))||r5(i))}_tinySDF(i,r,n){const o=this.localFontFamily;if(!o||!this._doesCharSupportLocalGlyph(n))return;let s=i.tinySDF;if(!s){let a="400";/bold/i.test(r)?a="900":/medium/i.test(r)?a="500":/light/i.test(r)&&(a="200"),(s=i.tinySDF=new lg.TinySDF({fontFamily:o,fontWeight:a,fontSize:48,buffer:6,radius:16})).fontWeight=a}if(this.localGlyphs[s.fontWeight][n])return this.localGlyphs[s.fontWeight][n];const l=String.fromCharCode(n),{data:c,width:h,height:u,glyphWidth:d,glyphHeight:p,glyphLeft:f,glyphTop:m,glyphAdvance:_}=s.draw(l);return this.localGlyphs[s.fontWeight][n]={id:n,bitmap:new sA({width:h,height:u},c),metrics:{width:d/2,height:p/2,left:f/2,top:m/2-27,advance:_/2,localGlyph:!0}}}}function ly(i,r,n,o){const s=[],a=i.image,l=a.pixelRatio,c=a.paddedRect.w-2,h=a.paddedRect.h-2,d=i.right-i.left,p=i.bottom-i.top,f=a.stretchX||[[0,c]],m=a.stretchY||[[0,h]],_=(i,r)=>i+r[1]-r[0],g=f.reduce(_,0),y=m.reduce(_,0),x=c-g,v=h-y;let b=0,w=g,T=0,E=y,S=0,I=x,M=0,A=v;if(a.content&&o){const C=a.content;b=lx(f,0,C[0]),T=lx(m,0,C[1]),w=lx(f,C[0],C[2]),E=lx(m,C[1],C[3]),S=C[0]-b,M=C[1]-T,I=C[2]-C[0]-w,A=C[3]-C[1]-E}const z=(o,s,c,h)=>{const f=(o.stretch-b)/w*d+i.left,m=o.fixed-S-I*o.stretch/g,_=(s.stretch-T)/E*p+i.top,x=s.fixed-M-A*s.stretch/y,v=(c.stretch-b)/w*d+i.left,C=c.fixed-S-I*c.stretch/g,z=(h.stretch-T)/E*p+i.top,k=h.fixed-M-A*h.stretch/y,P=new u(f,_),D=new u(v,_),L=new u(v,z),B=new u(f,z),R=new u(m/l,x/l),F=new u(C/l,k/l),O=r*Math.PI/180;if(O){const U=Math.sin(O),V=Math.cos(O),N=[V,-U,U,V];P._matMult(N),D._matMult(N),B._matMult(N),L._matMult(N)}const j=o.stretch+o.fixed,G=s.stretch+s.fixed;return{tl:P,tr:D,bl:B,br:L,tex:{x:a.paddedRect.x+1+j,y:a.paddedRect.y+1+G,w:c.stretch+c.fixed-j,h:h.stretch+h.fixed-G},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:R,pixelOffsetBR:F,minFontScaleX:I/l/d,minFontScaleY:A/l/p,isSDF:n}};if(o&&(a.stretchX||a.stretchY)){const k=lv(f,x,g),P=lv(m,v,y);for(let D=0;D{if(i)s(i);else if(r){const n={},o=new aO(r).readFields(a0,{});for(const a of o.glyphs)n[a.id]=a;s(null,{glyphs:n,ascender:o.ascender,descender:o.descender})}})},lg.TinySDF=class{constructor({fontSize:i=24,buffer:r=3,radius:n=8,cutoff:o=.25,fontFamily:s="sans-serif",fontWeight:a="normal",fontStyle:l="normal"}){this.buffer=r,this.cutoff=o,this.radius=n;const c=this.size=i+4*r,h=this._createCanvas(c),u=this.ctx=h.getContext("2d",{willReadFrequently:!0});u.font=`${l} ${a} ${i}px ${s}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(c*c),this.gridInner=new Float64Array(c*c),this.f=new Float64Array(c),this.z=new Float64Array(c+1),this.v=new Uint16Array(c)}_createCanvas(i){const r=document.createElement("canvas");return r.width=r.height=i,r}draw(i){const{width:r,actualBoundingBoxAscent:n,actualBoundingBoxDescent:o,actualBoundingBoxLeft:s,actualBoundingBoxRight:a}=this.ctx.measureText(i),l=Math.floor(n),c=Math.min(this.size-this.buffer,Math.ceil(a-s)),h=Math.min(this.size-this.buffer,Math.ceil(n)+Math.ceil(o)),u=c+2*this.buffer,d=h+2*this.buffer,p=u*d,f=new Uint8ClampedArray(p),m={data:f,width:u,height:d,glyphWidth:c,glyphHeight:h,glyphTop:l,glyphLeft:0,glyphAdvance:r};if(0===c||0===h)return m;const{ctx:_,buffer:g,gridInner:y,gridOuter:x}=this;_.clearRect(g,g,c,h),_.fillText(i,g,g+l+1);const v=_.getImageData(g,g,c,h);x.fill(1e20,0,p),y.fill(0,0,p);for(let b=0;b0?S*S:0,y[E]=S<0?S*S:0}}lf(x,0,0,u,d,u,this.f,this.v,this.z),lf(y,g,g,c,h,u,this.f,this.v,this.z);for(let I=0;I0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(i){this.data.push(i),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const i=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:r,compare:n}=this,o=r[i];for(;i>0;){const s=i-1>>1,a=r[s];if(n(o,a)>=0)break;r[i]=a,i=s}r[i]=o}_down(i){const{data:r,compare:n}=this,o=this.length>>1,s=r[i];for(;in(r[c],l)&&(a=c,l=r[c]),n(l,s)>=0)break;r[i]=l,i=a}r[i]=s}}function lw(i,r){return ir?1:0}function lT(i,r){return r.max-i.max}function lE(i,r,n,o){this.p=new u(i,r),this.h=n,this.d=function(i,r){let n=!1,o=1/0;for(let s=0;si.y!=d.y>i.y&&i.x<(d.x-u.x)*(i.y-u.y)/(d.y-u.y)+u.x&&(n=!n),o=Math.min(o,sc(i,u,d))}}return(n?1:-1)*Math.sqrt(o)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}const lS=Number.POSITIVE_INFINITY,lI=Math.sqrt(2);function lM(i,r){return r[1]!==lS?function(i,r,n){let o=0,s=0;switch(r=Math.abs(r),n=Math.abs(n),i){case"top-right":case"top-left":case"top":s=n-7;break;case"bottom-right":case"bottom-left":case"bottom":s=7-n}switch(i){case"top-right":case"bottom-right":case"right":o=-r;break;case"top-left":case"bottom-left":case"left":o=r}return[o,s]}(i,r[0],r[1]):function(i,r){let n=0,o=0;r<0&&(r=0);const s=r/lI;switch(i){case"top-right":case"top-left":o=s-7;break;case"bottom-right":case"bottom-left":o=7-s;break;case"bottom":o=7-r;break;case"top":o=r-7}switch(i){case"top-right":case"bottom-right":n=-s;break;case"top-left":case"bottom-left":n=s;break;case"left":n=r;break;case"right":n=-r}return[n,o]}(i,r[0])}function lA(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function lC(i,r,n,o,s,a,l,c,h,d,p,f,m,_,g,y,x){const v=function(i,r,n,o,s,a,l,c){const h=[];if(0===r.positionedLines.length)return h;const d=o.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,p=function(i){const r=i[0],n=i[1],o=r*n;return o>0?[r,-n]:o<0?[-r,n]:0===r?[n,r]:[n,-r]}(n);let f=Math.abs(r.top-r.bottom);for(const m of r.positionedLines)f-=m.lineOffset;const _=r.positionedLines.length,g=f/_;let y=r.top-n[1];for(let x=0;x<_;++x){const v=r.positionedLines[x];for(const b of(y=function(i,r,n,o){const s=r+i.positionedLines[o].lineOffset;return 0===o?n+s/2:n+(s+(r+i.positionedLines[o-1].lineOffset))/2}(r,g,y,x),v.positionedGlyphs)){let w,T,E,S;if(!b.rect)continue;const I=b.rect||{};let M=4,A=!0,C=1,z=0;if(b.imageName){const k=l[b.imageName];if(!k)continue;if(k.sdf){eh("SDF images are not supported in formatted text and will be ignored.");continue}A=!1,M=1/(C=k.pixelRatio)}const P=(s||c)&&b.vertical,D=b.metrics.advance*b.scale/2,L=b.metrics,B=b.rect;if(null===B)continue;c&&r.verticalizable&&(z=b.imageName?D-b.metrics.width*b.scale/2:0);const R=s?[b.x+D,b.y]:[0,0];let F=[0,0],O=[0,0],U=!1;s||(P?(O=[b.x+D+p[0],b.y+p[1]-z],U=!0):F=[b.x+D+n[0],b.y+n[1]-z]);const V=B.w*b.scale/(C*(b.localGlyph?2:1)),N=B.h*b.scale/(C*(b.localGlyph?2:1));if(P){const j=b.y-y,G=new u(-D,D-j),Z=-Math.PI/2,$=new u(...O);(w=new u(-D+F[0],F[1]))._rotateAround(Z,G)._add($),w.x+=-j+D,w.y-=(L.left-M)*b.scale;const q=b.imageName?L.advance*b.scale:24*b.scale,X=String.fromCharCode(b.glyph);"︶"===X||"﹈"===X||"︸"===X||"﹄"===X||"﹂"===X||"︾"===X||"︼"===X||"︺"===X||"︘"===X||"﹀"===X||"︐"===X||"︓"===X||"︔"===X||"`"===X||" ̄"===X||"︑"===X||"︒"===X?w.x+=(1-M)*b.scale:"︵"===X||"﹇"===X||"︷"===X||"﹃"===X||"﹁"===X||"︽"===X||"︻"===X||"︹"===X||"︗"===X||"︿"===X?w.x+=q-L.height*b.scale+(-M-1)*b.scale:w.x+=b.imageName||L.width+2*M===B.w&&L.height+2*M===B.h?(q-N)/2:(q-(L.height+2*M)*b.scale)/2,T=new u(w.x,w.y-V),E=new u(w.x+N,w.y),S=new u(w.x+N,w.y-V)}else{const W=(L.left-M)*b.scale-D+F[0],H=(-L.top-M)*b.scale+F[1],K=W+V,Y=H+N;w=new u(W,H),T=new u(K,H),E=new u(W,Y),S=new u(K,Y)}if(d){let J;J=s?new u(0,0):U?new u(p[0],p[1]):new u(n[0],n[1]),w._rotateAround(d,J),T._rotateAround(d,J),E._rotateAround(d,J),S._rotateAround(d,J)}const Q=new u(0,0),ee=new u(0,0);h.push({tl:w,tr:T,bl:E,br:S,tex:I,writingMode:r.writingMode,glyphOffset:R,sectionIndex:b.sectionIndex,isSDF:A,pixelOffsetTL:Q,pixelOffsetBR:ee,minFontScaleX:0,minFontScaleY:0})}}return h}(0,o,h,a,l,c,s,i.allowVerticalPlacement),b=i.textSizeData;let w=null;for(const T of("source"===b.kind?(w=[128*a.layout.get("text-size").evaluate(c,{},x)])[0]>32640&&eh(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===b.kind&&((w=[128*g.compositeTextSizes[0].evaluate(c,{},x),128*g.compositeTextSizes[1].evaluate(c,{},x)])[0]>32640||w[1]>32640)&&eh(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),i.addSymbols(i.text,v,w,h,l,c,p,r,n,d.lineStartIndex,d.lineLength,_,y,x),f))m[T]=i.text.placedSymbolArray.length-1;return 4*v.length}function lz(i){for(const r in i)return i[r];return null}function lk(i,r,n,o,s,a,l,c,h,d){let p=l.top,f=l.bottom,m=l.left,_=l.right;const g=l.collisionPadding;if(g&&(m-=g[0],p-=g[1],_+=g[2],f+=g[3]),h){const y=new u(m,p),x=new u(_,p),v=new u(m,f),b=new u(_,f),w=h*N;let T=new u(0,0);d&&(T=new u(d[0],d[1])),y._rotateAround(w,T),x._rotateAround(w,T),v._rotateAround(w,T),b._rotateAround(w,T),m=Math.min(y.x,x.x,v.x,b.x),_=Math.max(y.x,x.x,v.x,b.x),p=Math.min(y.y,x.y,v.y,b.y),f=Math.max(y.y,x.y,v.y,b.y)}return i.emplaceBack(r.x,r.y,r.z,n.x,n.y,m,p,_,f,c,o,s,a),i.length-1}function lP(i){i.collisionPadding&&(i.top-=i.collisionPadding[1],i.bottom+=i.collisionPadding[3]);const r=i.bottom-i.top;return r>0?Math.max(10,r):null}const lD=as.VectorTileFeature.types,lL=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function lB(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g){const y=d?Math.min(32640,Math.round(d[0])):0,x=d?Math.min(32640,Math.round(d[1])):0;i.emplaceBack(r,n,Math.round(32*l),Math.round(32*c),h,u,(y<<1)+(p?1:0),x,16*f,16*m,256*_,256*g,o,s,a,0)}function lR(i,r,n){i.emplaceBack(r.x,r.y,n),i.emplaceBack(r.x,r.y,n),i.emplaceBack(r.x,r.y,n),i.emplaceBack(r.x,r.y,n)}class lF{constructor(i){this.layoutVertexArray=new n5,this.indexArray=new oe,this.programConfigurations=i,this.segments=new o0,this.dynamicLayoutVertexArray=new n1,this.opacityVertexArray=new n4,this.placedSymbolArray=new of}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(i,r,n,o){this.isEmpty()||(n&&(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,aS.members),this.indexBuffer=i.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=i.createVertexBuffer(this.dynamicLayoutVertexArray,aI.members,!0),this.opacityVertexBuffer=i.createVertexBuffer(this.opacityVertexArray,lL,!0),this.opacityVertexBuffer.itemSize=1),(n||o)&&this.programConfigurations.upload(i))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}r$("SymbolBuffers",lF);class lO{constructor(i,r,n){this.layoutVertexArray=new i,this.layoutAttributes=r,this.indexArray=new n,this.segments=new o0,this.collisionVertexArray=new n7,this.collisionVertexArrayExt=new n1}upload(i){this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=i.createVertexBuffer(this.collisionVertexArray,aM.members,!0),this.collisionVertexBufferExt=i.createVertexBuffer(this.collisionVertexArrayExt,aA.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}r$("CollisionBuffers",lO);class lU{constructor(i){this.collisionBoxArray=i.collisionBoxArray,this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.pixelRatio=i.pixelRatio,this.sourceLayerIndex=i.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=_([]),this.placementViewportMatrix=_([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ak(this.zoom,r["text-size"]),this.iconSizeData=ak(this.zoom,r["icon-size"]);const n=this.layers[0].layout,o=n.get("symbol-sort-key"),s=n.get("symbol-z-order");this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==s&&void 0!==o.constantOr(1),this.sortFeaturesByY=("viewport-y"===s||"auto"===s&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map(i=>a6[i]),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.sourceID=i.sourceID}createArrays(){this.text=new lF(new o$(this.layers,this.zoom,i=>/^text/.test(i))),this.icon=new lF(new o$(this.layers,this.zoom,i=>/^icon/.test(i))),this.glyphOffsetArray=new og,this.lineVertexArray=new oy,this.symbolInstances=new o_}calculateGlyphDependencies(i,r,n,o,s){for(let a=0;a0)&&("constant"!==l.value.kind||l.value.value.length>0),d="constant"!==h.value.kind||!!h.value.value||Object.keys(h.parameters).length>0,p=a.get("symbol-sort-key");if(this.features=[],!u&&!d)return;const f=r.iconDependencies,m=r.glyphDependencies,_=r.availableImages,g=new nk(this.zoom);for(const{feature:y,id:x,index:v,sourceLayerIndex:b}of i){let w,T;const E=s._featureFilter.needGeometry,S=si(y,E);if(!s._featureFilter.filter(g,S,n))continue;if(E||(S.geometry=st(y,n,o)),u){const I=s.getValueAndResolveTokens("text-field",S,n,_),M=tP.factory(I);(function(i){for(const r of i.sections)if(function(i){for(const r of i)if(ny(r.charCodeAt(0)))return!0;return!1}(r.text))return!0;return!1})(M)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===nA()||this.hasRTLText&&nz.isParsed())&&(w=function(i,r,n){return i.sections.forEach(i=>{i.text=function(i,r,n){const o=r.layout.get("text-transform").evaluate(n,{});return"uppercase"===o?i=i.toLocaleUpperCase():"lowercase"===o&&(i=i.toLocaleLowerCase()),nz.applyArabicShaping&&(i=nz.applyArabicShaping(i)),i}(i.text,r,n)}),i}(M,s,S))}if(d){const A=s.getValueAndResolveTokens("icon-image",S,n,_);T=A instanceof tD?A:tD.fromString(A)}if(!w&&!T)continue;const C=this.sortFeaturesByKey?p.evaluate(S,{},n):void 0;if(this.features.push({id:x,text:w,icon:T,index:v,sourceLayerIndex:b,geometry:S.geometry,properties:y.properties,type:lD[y.type],sortKey:C}),T&&(f[T.name]=!0),w){const z=l.evaluate(S,{},n).join(","),k="map"===a.get("text-rotation-alignment")&&"point"!==a.get("symbol-placement");for(const P of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a6.vertical)>=0,w.sections))if(P.image)f[P.image.name]=!0;else{const D=nm(w.toString()),L=P.fontStack||z,B=m[L]=m[L]||{};this.calculateGlyphDependencies(P.text,B,k,this.allowVerticalPlacement,D)}}}"line"===a.get("symbol-placement")&&(this.features=function(i){const r={},n={},o=[];let s=0;function a(r){o.push(i[r]),s++}function l(i,r,s){const a=n[i];return delete n[i],n[r]=a,o[a].geometry[0].pop(),o[a].geometry[0]=o[a].geometry[0].concat(s[0]),a}function c(i,n,s){const a=r[n];return delete r[n],r[i]=a,o[a].geometry[0].shift(),o[a].geometry[0]=s[0].concat(o[a].geometry[0]),a}function h(i,r,n){const o=n?r[0][r[0].length-1]:r[0][0];return`${i}:${o.x}:${o.y}`}for(let u=0;ui.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((i,r)=>i.sortKey-r.sortKey)}update(i,r,n,o){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(i,r,this.layers,n,o),this.icon.programConfigurations.updatePaintArrays(i,r,this.layers,n,o))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(i){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(i),this.iconCollisionBox.upload(i)),this.text.upload(i,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(i,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(i,r){const n=this.lineVertexArray.length;if(void 0!==i.segment){let o=i.dist(r[i.segment+1]),s=i.dist(r[i.segment]);const a={};for(let l=i.segment+1;l=0;c--)a[c]={x:r[c].x,y:r[c].y,tileUnitDistanceFromAnchor:s},c>0&&(s+=r[c-1].dist(r[c]));for(let h=0;h=0?r.rightJustifiedTextSymbolIndex:r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.leftJustifiedTextSymbolIndex>=0?r.leftJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex>=0?r.verticalPlacedTextSymbolIndex:o),a=aP(this.textSizeData,i,s)/24;return this.tilePixelRatio*a}getSymbolInstanceIconSize(i,r,n){const o=this.icon.placedSymbolArray.get(n),s=aP(this.iconSizeData,i,o);return this.tilePixelRatio*s}_commitDebugCollisionVertexUpdate(i,r,n){i.emplaceBack(r,-n,-n),i.emplaceBack(r,n,-n),i.emplaceBack(r,n,n),i.emplaceBack(r,-n,n)}_updateTextDebugCollisionBoxes(i,r,n,o,s,a){for(let l=o;l0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(i,r){const n=i.placedSymbolArray.get(r),o=n.vertexStartIndex+4*n.numGlyphs;for(let s=n.vertexStartIndex;so[i]-o[r]||s[r]-s[i]),a}addToSortKeyRanges(i,r){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=i+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:i+1})}sortFeatures(i){if(this.sortFeaturesByY&&this.sortedAngle!==i&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){for(const r of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(i),this.sortedAngle=i,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){const n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((i,r,n)=>{i>=0&&n.indexOf(i)===r&&this.addIndicesForPlacedSymbol(this.text,i)}),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}r$("SymbolBucket",lU,{omit:["layers","collisionBoxArray","features","compareText"]}),lU.MAX_GLYPHS=65535,lU.addDynamicAttributes=lR;const lV=new n$({"symbol-placement":new nV(tr.layout_symbol["symbol-placement"]),"symbol-spacing":new nV(tr.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new nV(tr.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new nN(tr.layout_symbol["symbol-sort-key"]),"symbol-z-order":new nV(tr.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new nV(tr.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new nV(tr.layout_symbol["icon-ignore-placement"]),"icon-optional":new nV(tr.layout_symbol["icon-optional"]),"icon-rotation-alignment":new nV(tr.layout_symbol["icon-rotation-alignment"]),"icon-size":new nN(tr.layout_symbol["icon-size"]),"icon-text-fit":new nV(tr.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new nV(tr.layout_symbol["icon-text-fit-padding"]),"icon-image":new nN(tr.layout_symbol["icon-image"]),"icon-rotate":new nN(tr.layout_symbol["icon-rotate"]),"icon-padding":new nV(tr.layout_symbol["icon-padding"]),"icon-keep-upright":new nV(tr.layout_symbol["icon-keep-upright"]),"icon-offset":new nN(tr.layout_symbol["icon-offset"]),"icon-anchor":new nN(tr.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new nV(tr.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new nV(tr.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new nV(tr.layout_symbol["text-rotation-alignment"]),"text-field":new nN(tr.layout_symbol["text-field"]),"text-font":new nN(tr.layout_symbol["text-font"]),"text-size":new nN(tr.layout_symbol["text-size"]),"text-max-width":new nN(tr.layout_symbol["text-max-width"]),"text-line-height":new nN(tr.layout_symbol["text-line-height"]),"text-letter-spacing":new nN(tr.layout_symbol["text-letter-spacing"]),"text-justify":new nN(tr.layout_symbol["text-justify"]),"text-radial-offset":new nN(tr.layout_symbol["text-radial-offset"]),"text-variable-anchor":new nV(tr.layout_symbol["text-variable-anchor"]),"text-anchor":new nN(tr.layout_symbol["text-anchor"]),"text-max-angle":new nV(tr.layout_symbol["text-max-angle"]),"text-writing-mode":new nV(tr.layout_symbol["text-writing-mode"]),"text-rotate":new nN(tr.layout_symbol["text-rotate"]),"text-padding":new nV(tr.layout_symbol["text-padding"]),"text-keep-upright":new nV(tr.layout_symbol["text-keep-upright"]),"text-transform":new nN(tr.layout_symbol["text-transform"]),"text-offset":new nN(tr.layout_symbol["text-offset"]),"text-allow-overlap":new nV(tr.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new nV(tr.layout_symbol["text-ignore-placement"]),"text-optional":new nV(tr.layout_symbol["text-optional"])});var lN={paint:new n$({"icon-opacity":new nN(tr.paint_symbol["icon-opacity"]),"icon-color":new nN(tr.paint_symbol["icon-color"]),"icon-halo-color":new nN(tr.paint_symbol["icon-halo-color"]),"icon-halo-width":new nN(tr.paint_symbol["icon-halo-width"]),"icon-halo-blur":new nN(tr.paint_symbol["icon-halo-blur"]),"icon-translate":new nV(tr.paint_symbol["icon-translate"]),"icon-translate-anchor":new nV(tr.paint_symbol["icon-translate-anchor"]),"text-opacity":new nN(tr.paint_symbol["text-opacity"]),"text-color":new nN(tr.paint_symbol["text-color"],{runtimeType:tm,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new nN(tr.paint_symbol["text-halo-color"]),"text-halo-width":new nN(tr.paint_symbol["text-halo-width"]),"text-halo-blur":new nN(tr.paint_symbol["text-halo-blur"]),"text-translate":new nV(tr.paint_symbol["text-translate"]),"text-translate-anchor":new nV(tr.paint_symbol["text-translate-anchor"])}),layout:lV};class lj{constructor(i){this.type=i.property.overrides?i.property.overrides.runtimeType:tu,this.defaultValue=i}evaluate(i){if(i.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(i.formattedSection))return r.getOverride(i.formattedSection)}return i.feature&&i.featureState?this.defaultValue.evaluate(i.feature,i.featureState):this.defaultValue.property.specification.default}eachChild(i){this.defaultValue.isConstant()||i(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}r$("FormatSectionOverride",lj,{omit:["defaultValue"]});class lG extends oY{constructor(i){super(i,lN)}recalculate(i,r){super.recalculate(i,r),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const n=this.layout.get("text-writing-mode");if(n){const o=[];for(const s of n)0>o.indexOf(s)&&o.push(s);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(i,r,n,o){var s;const a=this.layout.get(i).evaluate(r,{},n,o),l=this._unevaluatedLayout._values[i];return l.isDataDriven()||i8(l.value)||!a?a:(s=r.properties,a.replace(/{([^{}]+)}/g,(i,r)=>r in s?String(s[r]):""))}createBucket(i){return new lU(i)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const i of lN.paint.overridableProperties){if(!lG.hasPaintOverride(this.layout,i))continue;const r=this.paint.get(i),n=new lj(r),o=new i6(n,r.property.specification);let s=null;s="constant"===r.value.kind||"source"===r.value.kind?new i7("source",o):new re("composite",o,r.value.zoomStops,r.value._interpolationType),this.paint._values[i]=new nO(r.property,s,r.parameters)}}_handleOverridablePaintPropertyUpdate(i,r,n){return!(!this.layout||r.isDataDriven()||n.isDataDriven())&&lG.hasPaintOverride(this.layout,i)}static hasPaintOverride(i,r){const n=i.get("text-field"),o=lN.paint.properties[r];let s=!1;const a=i=>{for(const r of i)if(o.overrides&&o.overrides.hasOverride(r))return void(s=!0)};if("constant"===n.value.kind&&n.value.value instanceof tP)a(n.value.value.sections);else if("source"===n.value.kind){const l=i=>{s||(i instanceof tO&&tR(i.value)===tx?a(i.value.sections):i instanceof tj?a(i.sections):i.eachChild(l))},c=n.value;c._styleExpression&&l(c._styleExpression.expression)}return s}getProgramConfiguration(i){return new oZ(this,i)}}var lZ={paint:new n$({"background-color":new nV(tr.paint_background["background-color"]),"background-pattern":new nG(tr.paint_background["background-pattern"]),"background-opacity":new nV(tr.paint_background["background-opacity"])})},l$={paint:new n$({"raster-opacity":new nV(tr.paint_raster["raster-opacity"]),"raster-hue-rotate":new nV(tr.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new nV(tr.paint_raster["raster-brightness-min"]),"raster-brightness-max":new nV(tr.paint_raster["raster-brightness-max"]),"raster-saturation":new nV(tr.paint_raster["raster-saturation"]),"raster-contrast":new nV(tr.paint_raster["raster-contrast"]),"raster-resampling":new nV(tr.paint_raster["raster-resampling"]),"raster-fade-duration":new nV(tr.paint_raster["raster-fade-duration"])})};class lq extends oY{constructor(i){super(i,{}),this.implementation=i}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){}serialize(){}onAdd(i){this.implementation.onAdd&&this.implementation.onAdd(i,i.painter.context.gl)}onRemove(i){this.implementation.onRemove&&this.implementation.onRemove(i,i.painter.context.gl)}}var lX={paint:new n$({"sky-type":new nV(tr.paint_sky["sky-type"]),"sky-atmosphere-sun":new nV(tr.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new nV(tr.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new nV(tr.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new nV(tr.paint_sky["sky-gradient-radius"]),"sky-gradient":new nZ(tr.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new nV(tr.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new nV(tr.paint_sky["sky-atmosphere-color"]),"sky-opacity":new nV(tr.paint_sky["sky-opacity"])})};function lW(i,r,n){var o,s,a,l,c,h,u,d;const p=S(0,0,1),f=O(F());return o=f,s=n?-(i*N)+Math.PI:i*N,s*=.5,a=f[0],l=f[1],c=f[2],h=f[3],u=Math.sin(s),d=Math.cos(s),o[0]=a*d-c*u,o[1]=l*d+h*u,o[2]=c*d+a*u,o[3]=h*d-l*u,U(f,f,-(r*N)),B(p,p,f),k(p,p)}const lH={circle:class extends oY{constructor(i){super(i,sy)}createBucket(i){return new sn(i)}queryRadius(i){return sp("circle-radius",this,i)+sp("circle-stroke-width",this,i)+sf(this.paint.get("circle-translate"))}queryIntersectsFeature(i,r,n,o,s,a,l,c){const h=s_(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,i.pixelToTileUnitsFactor),u=this.paint.get("circle-radius").evaluate(r,n)+this.paint.get("circle-stroke-width").evaluate(r,n);return sb(i,o,a,l,c,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),h,u)}getProgramIds(){return["circle"]}getProgramConfiguration(i){return new oZ(this,i)}},heatmap:class extends oY{createBucket(i){return new sE(i)}constructor(i){super(i,sz),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){"heatmap-color"===i&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=sk({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(i){return sp("heatmap-radius",this,i)}queryIntersectsFeature(i,r,n,o,s,a,l,c){const h=this.paint.get("heatmap-radius").evaluate(r,n);return sb(i,o,a,l,c,!0,!0,new u(0,0),h)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(i){return new oZ(this,i)}},hillshade:class extends oY{constructor(i){super(i,sP)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}getProgramConfiguration(i){return new oZ(this,i)}},fill:class extends oY{constructor(i){super(i,s8)}getProgramIds(){const i=this.paint.get("fill-pattern"),r=i&&i.constantOr(1),n=[r?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&n.push(r&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),n}getProgramConfiguration(i){return new oZ(this,i)}recalculate(i,r){super.recalculate(i,r);const n=this.paint._values["fill-outline-color"];"constant"===n.value.kind&&void 0===n.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new s4(i)}queryRadius(){return sf(this.paint.get("fill-translate"))}queryIntersectsFeature(i,r,n,o,s,a){return!i.queryGeometry.isAboveHorizon&&ss(sm(i.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),a.angle,i.pixelToTileUnitsFactor),o)}isTileClipped(){return!0}},"fill-extrusion":class extends oY{constructor(i){super(i,au)}createBucket(i){return new ah(i)}queryRadius(){return sf(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}getProgramConfiguration(i){return new oZ(this,i)}queryIntersectsFeature(i,r,n,o,s,a,l,c,h){var d,p;const f=s_(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,i.pixelToTileUnitsFactor),m=this.paint.get("fill-extrusion-height").evaluate(r,n),_=this.paint.get("fill-extrusion-base").evaluate(r,n),g=[0,0],y=c&&a.elevation,x=a.elevation?a.elevation.exaggeration():1;if(y){const v=i.tile.getBucket(this).centroidVertexArray,b=h+1;if(b0?n+2*r:r),s=sp("line-offset",this,i);return o/2+Math.abs(s)+sf(this.paint.get("line-translate"))}queryIntersectsFeature(i,r,n,o,s,a){var l,c;if(i.queryGeometry.isAboveHorizon)return!1;const h=sm(i.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,i.pixelToTileUnitsFactor),d=i.pixelToTileUnitsFactor/2*(l=this.paint.get("line-width").evaluate(r,n),(c=this.paint.get("line-gap-width").evaluate(r,n))>0?c+2*l:l),p=this.paint.get("line-offset").evaluate(r,n);return p&&(o=function(i,r){const n=[],o=new u(0,0);for(let s=0;s=3){for(let a=0;a1){if(sa(i,r))return!0;for(let o=0;o1&&(c=i[++l]);const d=Math.abs(h-c.left),p=Math.abs(h-c.right),f=Math.min(d,p),m=s/n*(o+1);if(c.isDash){const _=o-Math.abs(m);u=Math.sqrt(f*f+_*_)}else u=o-Math.sqrt(f*f+m*m);this.image.data[a+h]=Math.max(0,Math.min(255,u+128))}}}addRegularDash(i,r){for(let n=i.length-1;n>=0;--n){const o=i[n],s=i[n+1];o.zeroLength?i.splice(n,1):s&&s.isDash===o.isDash&&(s.left=o.left,i.splice(n,1))}const a=i[0],l=i[i.length-1];a.isDash===l.isDash&&(a.left=l.left-this.width,l.right=a.right+this.width);const c=this.width*this.nextRow;let h=0,u=i[0];for(let d=0;d1&&(u=i[++h]);const p=Math.abs(d-u.left),f=Math.abs(d-u.right),m=Math.min(p,f);this.image.data[c+d]=Math.max(0,Math.min(255,(u.isDash?m:-m)+r+128))}}addDash(i,r){const n=this.getKey(i,r);if(this.positions[n])return this.positions[n];const o="round"===r,s=o?7:0,a=2*s+1;if(this.nextRow+a>this.height)return eh("LineAtlas out of space"),null;0===i.length&&i.push(1);let l=0;for(let c=0;c{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const l5=p.performance;function l4(i){const r=i?i.url.toString():void 0;return l5.getEntriesByName(r)}class l6{constructor(){this.tasks={},this.taskQueue=[],en(["process"],this),this.invoker=new l3(this.process),this.nextId=0}add(i,r){const n=this.nextId++,o=function({type:i,isSymbolTile:r,zoom:n}){return n=n||0,"message"===i?0:"maybePrepare"!==i||r?"parseTile"!==i||r?"parseTile"===i&&r?300-n:"maybePrepare"===i&&r?400-n:500:200-n:100-n}(r);return 0===o?(ed(),i(),{cancel(){}}):(this.tasks[n]={fn:i,metadata:r,priority:o,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}})}process(){ed();{if(this.taskQueue=this.taskQueue.filter(i=>!!this.tasks[i]),!this.taskQueue.length)return;const i=this.pick();if(null===i)return;const r=this.tasks[i];if(delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),!r)return;r.fn()}}pick(){let i=null,r=1/0;for(let n=0;n0;a--)s+=(r&(o=1<this.canonical.z?new ce(i,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ce(i,this.wrap,i,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(i,r=!0){if(this.overscaledZ===i&&r)return this.key;if(i>this.canonical.z)return ct(this.wrap*+r,i,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-i;return ct(this.wrap*+r,i,i,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(i){if(i.wrap!==this.wrap)return!1;const r=this.canonical.z-i.canonical.z;return 0===i.overscaledZ||i.overscaledZ>r&&i.canonical.y===this.canonical.y>>r}children(i){if(this.overscaledZ>=i)return[new ce(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,n=2*this.canonical.x,o=2*this.canonical.y;return[new ce(r,this.wrap,r,n,o),new ce(r,this.wrap,r,n+1,o),new ce(r,this.wrap,r,n,o+1),new ce(r,this.wrap,r,n+1,o+1)]}isLessThan(i){return this.wrapi.wrap)&&(this.overscaledZi.overscaledZ)&&(this.canonical.xi.canonical.x)&&this.canonical.yMath.abs(o[l])){if(n[l]r[l])return null}else{const c=1/o[l];let h=(i[l]-n[l])*c,u=(r[l]-n[l])*c;if(h>u){const d=h;h=u,u=d}if(h>s&&(s=h),ua)return null}return s}function cu(i,r,n,o,s,a,l,c,h,u,d){const p=o-i,f=s-r,m=a-n,_=l-i,g=c-r,y=h-n,x=d[1]*y-d[2]*g,v=d[2]*_-d[0]*y,b=d[0]*g-d[1]*_,w=p*x+f*v+m*b;if(1e-15>Math.abs(w))return null;const T=1/w,E=u[0]-i,S=u[1]-r,I=u[2]-n,M=(E*x+S*v+I*b)*T;if(M<0||M>1)return null;const A=S*m-I*f,C=I*p-E*m,z=E*f-S*p,k=(d[0]*A+d[1]*C+d[2]*z)*T;return k<0||M+k>1?null:(_*A+g*C+y*z)*T}function cd(i,r,n,o,s,a,l,c,h){const u=1<{const a=o?1:0;s[0]=i*n,s[1]=r*n,s[2]=(i+1)*n-a,s[3]=(r+1)*n-a};let l=new cc(o);const c=[];for(let h=0;h=1;o/=2){const m=n[n.length-1];l=new cc(o);for(let _=0;_0;){const{idx:m,t:_,nodex:g,nodey:y,depth:x}=f.pop();if(this.leaves[m]){cd(g,y,x,i,r,n,o,d,p);const v=1<=B[2])return _}continue}let R=0;for(let F=0;F=h[u[V]]&&(u.splice(V,0,F),U=!0);U||(u[R]=F),R++}}for(let N=0;N=this.dim+1||r<-1||r>=this.dim+1)throw RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(i+1)}_unpackMapbox(i,r,n){return(256*i*256+256*r+n)/10-1e4}_unpackTerrarium(i,r,n){return 256*i+r+n/256-32768}static pack(i,r){const n=[0,0,0,0],o=cg.getUnpackVector(r);let s=Math.floor((i+o[3])/o[2]);return n[2]=s%256,s=Math.floor(s/256),n[1]=s%256,s=Math.floor(s/256),n[0]=s,n}getPixels(){return new sC({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(i,r,n){if(this.dim!==i.dim)throw Error("dem dimension mismatch");let o=r*this.dim,s=r*this.dim+this.dim,a=n*this.dim,l=n*this.dim+this.dim;switch(r){case -1:o=s-1;break;case 1:s=o+1}switch(n){case -1:a=l-1;break;case 1:l=a+1}const c=-r*this.dim,h=-n*this.dim;for(let u=a;u{this.remove(i,s)},n)),this.data[o].push(s),this.order.push(o),this.order.length>this.max){const a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}has(i){return i.wrapped().key in this.data}getAndRemove(i){return this.has(i)?this._getAndRemoveByKey(i.wrapped().key):null}_getAndRemoveByKey(i){const r=this.data[i].shift();return r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.order.splice(this.order.indexOf(i),1),r.value}getByKey(i){const r=this.data[i];return r?r[0].value:null}get(i){return this.has(i)?this.data[i.wrapped().key][0].value:null}remove(i,r){if(!this.has(i))return this;const n=i.wrapped().key,o=void 0===r?0:this.data[n].indexOf(r),s=this.data[n][o];return this.data[n].splice(o,1),s.timeout&&clearTimeout(s.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(s.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(i){for(this.max=i;this.order.length>this.max;){const r=this._getAndRemoveByKey(this.order[0]);r&&this.onRemove(r)}return this}filter(i){const r=[];for(const n in this.data)for(const o of this.data[n])i(o.value)||r.push(o);for(const s of r)this.remove(s.value.tileID,s)}}class cx extends ti{constructor(i,r,n){super(),this.id=i,this._onlySymbols=n,r.on("data",i=>{"source"===i.dataType&&"metadata"===i.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===i.dataType&&"content"===i.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),r.on("error",()=>{this._sourceErrored=!0}),this._source=r,this._tiles={},this._cache=new cy(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=null,this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new cl}onAdd(i){this.map=i,this._minTileCacheSize=i?i._minTileCacheSize:null,this._maxTileCacheSize=i?i._maxTileCacheSize:null}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const i in this._tiles){const r=this._tiles[i];if("loaded"!==r.state&&"errored"!==r.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const i=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,i&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(i,r){return i.isSymbolTile=this._onlySymbols,this._source.loadTile(i,r)}_unloadTile(i){if(this._source.unloadTile)return this._source.unloadTile(i,()=>{})}_abortTile(i){if(this._source.abortTile)return this._source.abortTile(i,()=>{})}serialize(){return this._source.serialize()}prepare(i){for(const r in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){const n=this._tiles[r];n.upload(i),n.prepare(this.map.style.imageManager)}}getIds(){return Y(this._tiles).map(i=>i.tileID).sort(cv).map(i=>i.key)}getRenderableIds(i){const r=[];for(const n in this._tiles)this._isIdRenderable(+n,i)&&r.push(this._tiles[n]);return i?r.sort((i,r)=>{const n=i.tileID,o=r.tileID,s=new u(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),a=new u(o.canonical.x,o.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-o.overscaledZ||a.y-s.y||a.x-s.x}).map(i=>i.tileID.key):r.map(i=>i.tileID).sort(cv).map(i=>i.key)}hasRenderableParent(i){const r=this.findLoadedParent(i,0);return!!r&&this._isIdRenderable(r.tileID.key)}_isIdRenderable(i,r){return this._tiles[i]&&this._tiles[i].hasData()&&!this._coveredTiles[i]&&(r||!this._tiles[i].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else for(const i in this._cache.reset(),this._tiles)"errored"!==this._tiles[i].state&&this._reloadTile(+i,"reloading")}_reloadTile(i,r){const n=this._tiles[i];n&&("loading"!==n.state&&(n.state=r),this._loadTile(n,this._tileLoaded.bind(this,n,i,r)))}_tileLoaded(i,r,n,o){if(o){if(i.state="errored",404!==o.status)this._source.fire(new tt(o,{tile:i}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const s=this.map.painter.terrain;this.update(this.transform,s.getScaledDemTileSize(),!0),s.resetTileLookupCache(this.id)}else this.update(this.transform)}else i.timeAdded=ev.now(),"expired"===n&&(i.refreshedUponExpiration=!0),this._setTileReloadTimer(r,i),"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),this._state.initializeTileState(i,this.map?this.map.painter:null),this._source.fire(new te("data",{dataType:"source",tile:i,coord:i.tileID,sourceCacheId:this.id}))}_backfillDEM(i){const r=this.getRenderableIds();for(let n=0;n1||(Math.abs(n)>1&&(1===Math.abs(n+s)?n+=s:1===Math.abs(n-s)&&(n-=s)),r.dem&&i.dem&&(i.dem.backfillBorder(r.dem,n,o),i.neighboringTiles&&i.neighboringTiles[a]&&(i.neighboringTiles[a].backfilled=!0)))}}getTile(i){return this.getTileByID(i.key)}getTileByID(i){return this._tiles[i]}_retainLoadedChildren(i,r,n,o){for(const s in this._tiles){let a=this._tiles[s];if(o[s]||!a.hasData()||a.tileID.overscaledZ<=r||a.tileID.overscaledZ>n)continue;let l=a.tileID;for(;a&&a.tileID.overscaledZ>r+1;){const c=a.tileID.scaledTo(a.tileID.overscaledZ-1);(a=this._tiles[c.key])&&a.hasData()&&(l=c)}let h=l;for(;h.overscaledZ>r;)if(i[(h=h.scaledTo(h.overscaledZ-1)).key]){o[l.key]=l;break}}}findLoadedParent(i,r){if(i.key in this._loadedParentTiles){const n=this._loadedParentTiles[i.key];return n&&n.tileID.overscaledZ>=r?n:null}for(let o=i.overscaledZ-1;o>=r;o--){const s=i.scaledTo(o),a=this._getLoadedTile(s);if(a)return a}}_getLoadedTile(i){const r=this._tiles[i.key];return r&&r.hasData()?r:this._cache.getByKey(this._source.reparseOverscaled?i.wrapped().key:i.canonical.key)}updateCacheSize(i,r){r=r||this._source.tileSize;const n=Math.ceil(i.width/r)+1,o=Math.ceil(i.height/r)+1,s=Math.floor(n*o*5),a="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,s):s,l="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(l)}handleWrapJump(i){const r=Math.round((i-(void 0===this._prevLng?i:this._prevLng))/360);if(this._prevLng=i,r){const n={};for(const o in this._tiles){const s=this._tiles[o];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+r),n[s.tileID.key]=s}for(const a in this._tiles=n,this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(const l in this._tiles)this._setTileReloadTimer(+l,this._tiles[l])}}update(i,r,n){let o;if(this.transform=i,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!n)return;this.updateCacheSize(i,r),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?o=i.getVisibleUnwrappedCoordinates(this._source.tileID).map(i=>new ce(i.canonical.z,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y)):(o=i.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(o=o.filter(i=>this._source.hasTile(i)))):o=[];const s=this._updateRetainedTiles(o);if(cb(this._source.type)&&0!==o.length){const a={},l={},c=Object.keys(s);for(const h of c){const u=s[h],d=this._tiles[h];if(!d||d.fadeEndTime&&d.fadeEndTime<=ev.now())continue;const p=this.findLoadedParent(u,Math.max(u.overscaledZ-cx.maxOverzooming,this._source.minzoom));p&&(this._addTile(p.tileID),a[p.tileID.key]=p.tileID),l[h]=u}const f=o[o.length-1].overscaledZ;for(const m in this._tiles){const _=this._tiles[m];if(s[m]||!_.hasData())continue;let g=_.tileID;for(;g.overscaledZ>f;){g=g.scaledTo(g.overscaledZ-1);const y=this._tiles[g.key];if(y&&y.hasData()&&l[g.key]){s[m]=_.tileID;break}}}for(const x in a)s[x]||(this._coveredTiles[x]=!0,s[x]=a[x])}for(const v in s)this._tiles[v].clearFadeHold();const b=function(i,r){const n=[];for(const o in i)o in r||n.push(o);return n}(this._tiles,s);for(const w of b){const T=this._tiles[w];T.hasSymbolBuckets&&!T.holdingForFade()?T.setHoldDuration(this.map._fadeDuration):T.hasSymbolBuckets&&!T.symbolFadeFinished()||this._removeTile(+w)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const i in this._tiles)this._tiles[i].holdingForFade()&&this._removeTile(+i)}_updateRetainedTiles(i){const r={};if(0===i.length)return r;const n={},o=i.reduce((i,r)=>Math.min(i,r.overscaledZ),1/0),s=i[0].overscaledZ,a=Math.max(s-cx.maxOverzooming,this._source.minzoom),l=Math.max(s+cx.maxUnderzooming,this._source.minzoom),c={};for(const h of i){const u=this._addTile(h);r[h.key]=h,u.hasData()||o=this._source.maxzoom){const f=d.children(this._source.maxzoom)[0],m=this.getTile(f);if(m&&m.hasData()){r[f.key]=f;continue}}else{const _=d.children(this._source.maxzoom);if(r[_[0].key]&&r[_[1].key]&&r[_[2].key]&&r[_[3].key])continue}let g=p.wasRequested();for(let y=d.overscaledZ-1;y>=a;--y){const x=d.scaledTo(y);if(n[x.key]||(n[x.key]=!0,(p=this.getTile(x))||!g||(p=this._addTile(x)),p&&(r[x.key]=x,g=p.wasRequested(),p.hasData())))break}}return r}_updateLoadedParentTileCache(){for(const i in this._loadedParentTiles={},this._tiles){const r=[];let n,o=this._tiles[i].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){n=this._loadedParentTiles[o.key];break}r.push(o.key);const s=o.scaledTo(o.overscaledZ-1);if(n=this._getLoadedTile(s))break;o=s}for(const a of r)this._loadedParentTiles[a]=n}}_addTile(i){let r=this._tiles[i.key];if(r)return r;(r=this._cache.getAndRemove(i))&&(this._setTileReloadTimer(i.key,r),r.tileID=i,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[i.key]&&(clearTimeout(this._cacheTimers[i.key]),delete this._cacheTimers[i.key],this._setTileReloadTimer(i.key,r)));const n=Boolean(r);if(!n){const o=this.map?this.map.painter:null,s="raster"===this._source.type||"raster-dem"===this._source.type;r=new c$(i,this._source.tileSize*i.overscaleFactor(),this.transform.tileZoom,o,s),this._loadTile(r,this._tileLoaded.bind(this,r,i.key,r.state))}return r?(r.uses++,this._tiles[i.key]=r,n||this._source.fire(new te("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null}_setTileReloadTimer(i,r){i in this._timers&&(clearTimeout(this._timers[i]),delete this._timers[i]);const n=r.getExpiryTimeout();n&&(this._timers[i]=setTimeout(()=>{this._reloadTile(i,"expired"),delete this._timers[i]},n))}_removeTile(i){const r=this._tiles[i];r&&(r.uses--,delete this._tiles[i],this._timers[i]&&(clearTimeout(this._timers[i]),delete this._timers[i]),r.uses>0||(r.hasData()&&"reloading"!==r.state?this._cache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}clearTiles(){for(const i in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+i);this._source._clear&&this._source._clear(),this._cache.reset()}tilesIn(i,r,n){const o=[],s=this.transform;if(!s)return o;for(const a in this._tiles){const l=this._tiles[a];if(n&&l.clearQueryDebugViz(),l.holdingForFade())continue;const c=i.containsTile(l,s,r);c&&o.push(c)}return o}getVisibleCoordinates(i){const r=this.getRenderableIds(i).map(i=>this._tiles[i].tileID);for(const n of r)n.projMatrix=this.transform.calculateProjMatrix(n.toUnwrapped());return r}hasTransition(){if(this._source.hasTransition())return!0;if(cb(this._source.type))for(const i in this._tiles){const r=this._tiles[i];if(void 0!==r.fadeEndTime&&r.fadeEndTime>=ev.now())return!0}return!1}setFeatureState(i,r,n){this._state.updateState(i=i||"_geojsonTileLayer",r,n)}removeFeatureState(i,r,n){this._state.removeFeatureState(i=i||"_geojsonTileLayer",r,n)}getFeatureState(i,r){return this._state.getState(i=i||"_geojsonTileLayer",r)}setDependencies(i,r,n){const o=this._tiles[i];o&&o.setDependencies(r,n)}reloadTilesForDependencies(i,r){for(const n in this._tiles)this._tiles[n].hasDependency(i,r)&&this._reloadTile(+n,"reloading");this._cache.filter(n=>!n.hasDependency(i,r))}_preloadTiles(i,r){const n=new Map,o=Array.isArray(i)?i:[i],s=this.map.painter.terrain,a=this.usedForTerrain&&s?s.getScaledDemTileSize():this._source.tileSize;for(const l of o){const c=l.coveringTiles({tileSize:a,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const h of c)n.set(h.key,h);this.usedForTerrain&&l.updateElevation(!1)}const u=Array.from(n.values()),d="raster"===this._source.type||"raster-dem"===this._source.type;K(u,(i,r)=>{const n=new c$(i,this._source.tileSize*i.overscaleFactor(),this.transform.tileZoom,this.map.painter,d);this._loadTile(n,i=>{"raster-dem"===this._source.type&&n.dem&&this._backfillDEM(n),r(i,n)})},r)}}function cv(i,r){const n=Math.abs(2*i.wrap)-+(i.wrap<0),o=Math.abs(2*r.wrap)-+(r.wrap<0);return i.overscaledZ-r.overscaledZ||o-n||r.canonical.y-i.canonical.y||r.canonical.x-i.canonical.x}function cb(i){return"raster"===i||"image"===i||"video"===i}cx.maxOverzooming=10,cx.maxUnderzooming=3;class cw{constructor(i,r,n){this._demTile=i,this._dem=this._demTile.dem,this._scale=r,this._offset=n}static create(i,r,n){const o=n||i.findDEMTileFor(r);if(!o||!o.dem)return;const s=o.dem,a=o.tileID,l=1<=0&&d[3]>=0&&c.insert(l,d[0],d[1],d[2],d[3])}}loadVTLayers(){if(!this.vtLayers)for(const i in this.vtLayers=new as.VectorTile(new aO(this.rawTileData)).layers,this.sourceLayerCoder=new cs(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[i]=[];return this.vtLayers}query(i,r,n,o){let s;this.loadVTLayers();const a=i.params||{},l=rh(a.filter),c=i.tileResult,h=i.transform,u=c.bufferedTilespaceBounds,d=this.grid.query(u.min.x,u.min.y,u.max.x,u.max.y,(i,r,n,o)=>sd(c.bufferedTilespaceGeometry,i,r,n,o));d.sort(cS);let p=null;h.elevation&&d.length>0&&(p=cw.create(h.elevation,this.tileID));const f={};for(let m=0;m(y||(y=st(r,this.tileID.canonical,i.tileTransform)),n.queryIntersectsFeature(c,r,o,y,this.z,i.transform,i.pixelPosMatrix,p,s)))}return f}loadMatchingFeature(i,r,n,o,s,a,l,c,h){const{featureIndex:u,bucketIndex:d,sourceLayerIndex:p,layoutVertexArrayOffset:f}=r,m=this.bucketLayerIDs[d];if(o&&!function(i,r){for(let n=0;n=0)return!0;return!1}(o,m))return;const _=this.sourceLayerCoder.decode(p),g=this.vtLayers[_].feature(u);if(n.needGeometry){const y=si(g,!0);if(!n.filter(new nk(this.tileID.overscaledZ),y,this.tileID.canonical))return}else if(!n.filter(new nk(this.tileID.overscaledZ),g))return;const x=this.getId(g,_);for(let v=0;vo.indexOf(b))continue;const w=a[b];if(!w)continue;let T={};void 0!==x&&c&&(T=c.getState(w.sourceLayer||"_geojsonTileLayer",x));const E=J({},l[b]);E.paint=cE(E.paint,w.paint,g,T,s),E.layout=cE(E.layout,w.layout,g,T,s);const S=!h||h(g,w,T,f);if(!S)continue;const I=new ca(g,this.z,this.x,this.y,x);I.layer=E;let M=i[b];void 0===M&&(M=i[b]=[]),M.push({featureIndex:u,feature:I,intersectionZ:S})}}lookupSymbolFeatures(i,r,n,o,s,a,l,c){const h={};this.loadVTLayers();const u=rh(s);for(const d of i)this.loadMatchingFeature(h,{bucketIndex:n,sourceLayerIndex:o,featureIndex:d,layoutVertexArrayOffset:0},u,a,l,c,r);return h}loadFeature(i){const{featureIndex:r,sourceLayerIndex:n}=i;this.loadVTLayers();const o=this.sourceLayerCoder.decode(n),s=this.vtFeatures[o];if(s[r])return s[r];const a=this.vtLayers[o].feature(r);return s[r]=a,a}hasLayer(i){for(const r of this.bucketLayerIDs)for(const n of r)if(i===n)return!0;return!1}getId(i,r){let n=i.id;return this.promoteId&&"boolean"==typeof(n=i.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[r]])&&(n=Number(n)),n}}function cE(i,r,n,o,s){return es(i,(i,a)=>{const l=r instanceof nU?r.get(a):null;return l&&l.evaluate?l.evaluate(n,o,s):l})}function cS(i,r){return r-i}r$("FeatureIndex",cT,{omit:["rawTileData","sourceLayerCoder"]});var cI=nK([{name:"a_pos",type:"Int16",components:2}]);const cM=new Uint16Array(8184);for(let cA=0;cA<2046;cA++){let cC=cA+2,cz=0,ck=0,cP=0,cD=0,cL=0,cB=0;for(1&cC?cP=cD=cL=32:cz=ck=cB=32;(cC>>=1)>1;){const cR=cz+cP>>1,cF=ck+cD>>1;1&cC?(cP=cz,cD=ck,cz=cL,ck=cB):(cz=cP,ck=cD,cP=cL,cD=cB),cL=cR,cB=cF}const cO=4*cA;cM[cO+0]=cz,cM[cO+1]=ck,cM[cO+2]=cP,cM[cO+3]=cD}const cU=new Uint16Array(2178),cV=new Uint8Array(1089),cN=new Uint16Array(1089);function cj(i){return 0===i?-.03125:32===i?.03125:0}var cG=nK([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);const cZ={type:2,extent:8192,loadGeometry:()=>[[new u(0,0),new u(8193,0),new u(8193,8193),new u(0,8193),new u(0,0)]]};class c${constructor(i,r,n,o,s){this.tileID=i,this.uid=ee(),this.uses=0,this.tileSize=r,this.tileZoom=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=s,this.expiredRequestCount=0,this.state="loading",o&&o.transform&&(this.projection=o.transform.projection)}registerFadeDuration(i){const r=i+this.timeAdded;rr.getLayer(i)).filter(Boolean);if(0!==s.length)for(const a of(o.layers=s,o.stateDependentLayerIds&&(o.stateDependentLayers=o.stateDependentLayerIds.map(i=>s.filter(r=>r.id===i)[0])),s))n[a.id]=o}return n}(i.buckets,r.style),this.hasSymbolBuckets=!1,this.buckets){const s=this.buckets[o];if(s instanceof lU){if(this.hasSymbolBuckets=!0,!n)break;s.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const a in this.buckets){const l=this.buckets[a];if(l instanceof lU&&l.hasRTLText){this.hasRTLText=!0,nz.isLoading()||nz.isLoaded()||"deferred"!==nA()||nC();break}}for(const c in this.queryPadding=0,this.buckets){const h=this.buckets[c];this.queryPadding=Math.max(this.queryPadding,r.style.getLayer(c).queryRadius(h))}i.imageAtlas&&(this.imageAtlas=i.imageAtlas),i.glyphAtlasImage&&(this.glyphAtlasImage=i.glyphAtlasImage),i.lineAtlas&&(this.lineAtlas=i.lineAtlas)}else this.collisionBoxArray=new od}unloadVectorData(){if(this.hasData()){for(const i in this.buckets)this.buckets[i].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugIndexBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this.globeGridBuffer&&(this.globeGridBuffer.destroy(),this.globeGridBuffer=null),this.globePoleBuffer&&(this.globePoleBuffer.destroy(),this.globePoleBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(i){return this.buckets[i.id]}upload(i){for(const r in this.buckets){const n=this.buckets[r];n.uploadPending()&&n.upload(i)}const o=i.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new l1(i,this.imageAtlas.image,o.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new l1(i,this.glyphAtlasImage,o.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new l1(i,this.lineAtlas.image,o.ALPHA),this.lineAtlas.uploaded=!0)}prepare(i){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(i,this.imageAtlasTexture)}queryRenderedFeatures(i,r,n,o,s,a,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:o,pixelPosMatrix:l,transform:a,params:s,tileTransform:this.tileTransform},i,r,n):{}}querySourceFeatures(i,r){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const o=n.loadVTLayers(),s=r?r.sourceLayer:"",a=o._geojsonTileLayer||o[s];if(!a)return;const l=rh(r&&r.filter),{z:c,x:h,y:u}=this.tileID.canonical,d={z:c,x:h,y:u};for(let p=0;po)s=!1;else if(r){if(this.expirationTime=0;d--){const p=4*d,f=cM[p+0],m=cM[p+1],_=cM[p+2],g=cM[p+3],y=f+_>>1,x=m+g>>1,v=y+x-m,b=x+f-y,w=33*m+f,T=33*g+_,E=33*x+y,S=Math.hypot((cU[2*w+0]+cU[2*T+0])/2-cU[2*E+0],(cU[2*w+1]+cU[2*T+1])/2-cU[2*E+1])>=16;if(cV[E]=cV[E]||(S?1:0),d<1022){const I=(m+b>>1)*33+(f+v>>1),M=(g+b>>1)*33+(_+v>>1);cV[E]=cV[E]||cV[I]||cV[M]}}const A=new nQ,C=new oe;let z=0;function k(i,r){const n=33*r+i;return 0===cN[n]&&(A.emplaceBack(cU[2*n+0],cU[2*n+1],8192*i/32,8192*r/32),cN[n]=++z),cN[n]-1}function P(i,r,n,o,s,a){const l=i+n>>1,c=r+o>>1;if(Math.abs(i-s)+Math.abs(r-a)>1&&cV[33*c+l])P(s,a,i,r,l,c),P(n,o,s,a,l,c);else{const h=k(i,r),u=k(n,o),d=k(s,a);C.emplaceBack(h,u,d)}}return P(0,0,32,32,32,0),P(32,32,0,0,0,32),{vertices:A,indices:C}}(this.tileID.canonical,r);n=a.vertices,o=a.indices}else{for(const{x:l,y:c}of(n=new nQ,o=new oe,s))n.emplaceBack(l,c,0,0);const h=sB(n.int16,void 0,4);for(let u=0;u{const o=65*n+r;i.emplaceBack(o+1,o,o+65),i.emplaceBack(o+65,o+65+1,o+1)};for(let n=0;n<64;n++)for(let o=0;o<64;o++)r(o,n);return i}getWirefameBuffer(i){if(!this.wireframeSegments){const r=this._createWireframeGrid();this.wireframeIndexBuffer=i.createIndexBuffer(r),this.wireframeSegments=o0.simpleSegment(0,0,4096,r.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}_createWireframeGrid(){const i=new oa,r=(r,n)=>{const o=65*n+r;i.emplaceBack(o,o+1),i.emplaceBack(o,o+65),i.emplaceBack(o,o+65+1)};for(let n=0;n<64;n++)for(let o=0;o<64;o++)r(o,n);return i}}function c8(i,r){if(!r.isReprojectedInTileSpace)return{scale:1<b&&(w(i,u,o,s,c,h),w(u,n,c,h,a,l))}w(p,f,o,a,s,a),w(f,m,s,a,s,l),w(m,_,s,l,o,l),w(_,p,o,l,o,a),g-=b,y-=b,x+=b,v+=b;const T=1/Math.max(x-g,v-y);return{scale:T,x:g*T,y:y*T,x2:x*T,y2:v*T,projection:r}}class c9{constructor(i){const r={},n=[];for(const o in i){const s=i[o],a=r[o]={};for(const l in s.glyphs){const c=s.glyphs[+l];if(!c||0===c.bitmap.width||0===c.bitmap.height)continue;const h=c.metrics.localGlyph?2:1,u={x:0,y:0,w:c.bitmap.width+2*h,h:c.bitmap.height+2*h};n.push(u),a[l]=u}}const{w:d,h:p}=a3(n),f=new sA({width:d||1,height:p||1});for(const m in i){const _=i[m];for(const g in _.glyphs){const y=_.glyphs[+g];if(!y||0===y.bitmap.width||0===y.bitmap.height)continue;const x=r[m][g],v=y.metrics.localGlyph?2:1;sA.copy(y.bitmap,f,{x:0,y:0},{x:x.x+v,y:x.y+v},y.bitmap)}}this.image=f,this.positions=r}}r$("GlyphAtlas",c9);class c7{constructor(i){this.tileID=new ce(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=i.showCollisionBoxes,this.collectResourceTiming=!!i.collectResourceTiming,this.returnDependencies=!!i.returnDependencies,this.promoteId=i.promoteId,this.enableTerrain=!!i.enableTerrain,this.isSymbolTile=i.isSymbolTile,this.tileTransform=c8(i.tileID.canonical,i.projection),this.projection=i.projection}parse(i,r,n,o,s){let a,l,c,h;this.status="parsing",this.data=i,this.collisionBoxArray=new od;const d=new cs(Object.keys(i.layers).sort()),p=new cT(this.tileID,this.promoteId);p.bucketLayerIDs=[];const f={},m=new l2(256,256),_={featureIndex:p,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:m,availableImages:n},g=r.familiesBySource[this.source];for(const y in g){const x=i.layers[y];if(!x)continue;let v=!1,b=!1;for(const w of g[y])"symbol"===w[0].type?v=!0:b=!0;if(!0===this.isSymbolTile&&!v||!1===this.isSymbolTile&&!b)continue;1===x.version&&eh(`Vector tile source "${this.source}" layer "${y}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const T=d.encode(y),E=[];for(let S=0;S=C.maxzoom||"none"!==C.visibility&&(he(A,this.zoom,n),(f[C.id]=C.createBucket({index:p.bucketLayerIDs.length,layers:A,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:T,sourceID:this.source,enableTerrain:this.enableTerrain,availableImages:n})).populate(E,_,this.tileID.canonical,this.tileTransform),p.bucketLayerIDs.push(A.map(i=>i.id)))}}m.trim();const z={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},k=es(_.glyphDependencies,i=>Object.keys(i).map(Number));Object.keys(k).length?o.send("getGlyphs",{uid:this.uid,stacks:k},(i,r)=>{a||(a=i,l=r,L.call(this))},void 0,!1,z):l={};const P=Object.keys(_.iconDependencies);P.length?o.send("getImages",{icons:P,source:this.source,tileID:this.tileID,type:"icons"},(i,r)=>{a||(a=i,c=r,L.call(this))},void 0,!1,z):c={};const D=Object.keys(_.patternDependencies);function L(){if(a)return s(a);if(l&&c&&h){const i=new c9(l),r=new a4(c,h);for(const o in f){const d=f[o];d instanceof lU?(he(d.layers,this.zoom,n),function(i,r,n,o,s,a,l,c,h,d){i.createArrays(),i.tilePixelRatio=8192/(512*i.overscaling),i.compareText={},i.iconsNeedLinear=!1;const p=i.layers[0].layout,f=i.layers[0]._unevaluatedLayout._values,m={};if("composite"===i.textSizeData.kind){const{minZoom:_,maxZoom:g}=i.textSizeData;m.compositeTextSizes=[f["text-size"].possiblyEvaluate(new nk(_),c),f["text-size"].possiblyEvaluate(new nk(g),c)]}if("composite"===i.iconSizeData.kind){const{minZoom:y,maxZoom:x}=i.iconSizeData;m.compositeIconSizes=[f["icon-size"].possiblyEvaluate(new nk(y),c),f["icon-size"].possiblyEvaluate(new nk(x),c)]}m.layoutTextSize=f["text-size"].possiblyEvaluate(new nk(h+1),c),m.layoutIconSize=f["icon-size"].possiblyEvaluate(new nk(h+1),c),m.textMaxSize=f["text-size"].possiblyEvaluate(new nk(18),c);const v="map"===p.get("text-rotation-alignment")&&"point"!==p.get("symbol-placement"),b=p.get("text-size");for(const w of i.features){const T=p.get("text-font").evaluate(w,{},c).join(","),E=b.evaluate(w,{},c),S=m.layoutTextSize.evaluate(w,{},c),I=(m.layoutIconSize.evaluate(w,{},c),{horizontal:{},vertical:void 0}),M=w.text;let A,C=[0,0];if(M){const z=M.toString(),k=24*p.get("text-letter-spacing").evaluate(w,{},c),P=24*p.get("text-line-height").evaluate(w,{},c),D=!function(i){for(const r of i){var n;if(rJ(n=r.charCodeAt(0))||rQ(n)||r0(n)||nc(n)||np(n))return!1}return!0}(z)?0:k,L=p.get("text-anchor").evaluate(w,{},c),B=p.get("text-variable-anchor");if(!B){const R=p.get("text-radial-offset").evaluate(w,{},c);C=R?lM(L,[24*R,lS]):p.get("text-offset").evaluate(w,{},c).map(i=>24*i)}let F=v?"center":p.get("text-justify").evaluate(w,{},c);const O=p.get("symbol-placement"),U="point"===O,V="point"===O?24*p.get("text-max-width").evaluate(w,{},c):0,j=o=>{i.allowVerticalPlacement&&nm(z)&&(I.vertical=a7(M,r,n,s,T,V,P,L,o,D,C,a6.vertical,!0,O,S,E))};if(!v&&B){const G="auto"===F?B.map(i=>lA(i)):[F];let Z=!1;for(let $=0;$=0||!nm(z)){const W=a7(M,r,n,s,T,V,P,L,F,D,C,a6.horizontal,!1,O,S,E);W&&(I.horizontal[F]=W)}j("point"===O?"left":F)}}let H=!1;if(w.icon&&w.icon.name){const K=o[w.icon.name];K&&(A=function(i,r,n){const{horizontalAlign:o,verticalAlign:s}=ls(n),a=r[0]-i.displaySize[0]*o,l=r[1]-i.displaySize[1]*s;return{image:i,top:l,bottom:l+i.displaySize[1],left:a,right:a+i.displaySize[0]}}(s[w.icon.name],p.get("icon-offset").evaluate(w,{},c),p.get("icon-anchor").evaluate(w,{},c)),H=K.sdf,void 0===i.sdfIcons?i.sdfIcons=K.sdf:i.sdfIcons!==K.sdf&&eh("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(K.pixelRatio!==i.pixelRatio||0!==p.get("icon-rotate").constantOr(1))&&(i.iconsNeedLinear=!0))}const Y=lz(I.horizontal)||I.vertical;i.iconsInText||(i.iconsInText=!!Y&&Y.iconsInText),(Y||A)&&function(i,r,n,o,s,a,l,c,h,d,p,f,m){let _,g=a.textMaxSize.evaluate(r,{},f);void 0===g&&(g=l);const y=i.layers[0].layout,x=y.get("icon-offset").evaluate(r,{},f),v=lz(n.horizontal)||n.vertical,b=l/24,w=i.tilePixelRatio*g/24,T=i.tilePixelRatio*y.get("symbol-spacing"),E=y.get("text-padding")*i.tilePixelRatio,S=y.get("icon-padding")*i.tilePixelRatio,I=y.get("text-max-angle")*N,M="map"===y.get("text-rotation-alignment")&&"point"!==y.get("symbol-placement"),A="map"===y.get("icon-rotation-alignment")&&"point"!==y.get("symbol-placement"),C=y.get("symbol-placement"),z=T/2,k=y.get("icon-text-fit");o&&"none"!==k&&(i.allowVerticalPlacement&&n.vertical&&(_=ll(o,n.vertical,k,y.get("icon-text-fit-padding"),x,b)),v&&(o=ll(o,v,k,y.get("icon-text-fit-padding"),x,b)));const P=(l,c,u)=>{if(c.x<0||c.x>=8192||c.y<0||c.y>=8192)return;const{x:g,y:y,z:v}=m.projectTilePoint(c.x,c.y,u),b=new lc(g,y,v,0,void 0);!function(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T,E,S,I){const M=i.addToLineVertexArray(r,o);let A,C,z,k,P,D,L,B=0,R=0,F=0,O=0,U=-1,V=-1;const N={};let j=oM(""),G=0,Z=0;if(void 0===h._unevaluatedLayout.getValue("text-radial-offset")?[G,Z]=h.layout.get("text-offset").evaluate(w,{},I).map(i=>24*i):(G=24*h.layout.get("text-radial-offset").evaluate(w,{},I),Z=lS),i.allowVerticalPlacement&&s.vertical){const $=s.vertical;if(_)D=lP($),c&&(L=lP(c));else{const q=h.layout.get("text-rotate").evaluate(w,{},I)+90;z=lk(u,n,r,d,p,f,$,m,q,g),c&&(k=lk(u,n,r,d,p,f,c,x,q))}}if(a){const X=h.layout.get("icon-rotate").evaluate(w,{},I),W="none"!==h.layout.get("icon-text-fit"),H=ly(a,X,E,W),K=c?ly(c,X,E,W):void 0;C=lk(u,n,r,d,p,f,a,x,X),B=4*H.length;const Y=i.iconSizeData;let J=null;"source"===Y.kind?(J=[128*h.layout.get("icon-size").evaluate(w,{},I)])[0]>32640&&eh(`${i.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===Y.kind&&((J=[128*T.compositeIconSizes[0].evaluate(w,{},I),128*T.compositeIconSizes[1].evaluate(w,{},I)])[0]>32640||J[1]>32640)&&eh(`${i.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),i.addSymbols(i.icon,H,J,b,v,w,!1,n,r,M.lineStartIndex,M.lineLength,-1,S,I),U=i.icon.placedSymbolArray.length-1,K&&(R=4*K.length,i.addSymbols(i.icon,K,J,b,v,w,a6.vertical,n,r,M.lineStartIndex,M.lineLength,-1,S,I),V=i.icon.placedSymbolArray.length-1)}for(const Q in s.horizontal){const ee=s.horizontal[Q];A||(j=oM(ee.text),_?P=lP(ee):A=lk(u,n,r,d,p,f,ee,m,h.layout.get("text-rotate").evaluate(w,{},I),g));const et=1===ee.positionedLines.length;if(F+=lC(i,n,r,ee,l,h,_,w,g,M,s.vertical?a6.horizontal:a6.horizontalOnly,et?Object.keys(s.horizontal):[Q],N,U,T,S,I),et)break}s.vertical&&(O+=lC(i,n,r,s.vertical,l,h,_,w,g,M,a6.vertical,["vertical"],N,V,T,S,I));let ei=-1;const er=(i,r)=>i?Math.max(i,r):r;ei=er(P,ei),ei=er(D,ei),ei=er(L,ei);const en=ei>-1?1:0;i.glyphOffsetArray.length>=lU.MAX_GLYPHS&&eh("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&i.addToSortKeyRanges(i.symbolInstances.length,w.sortKey),i.symbolInstances.emplaceBack(n.x,n.y,n.z,r.x,r.y,N.right>=0?N.right:-1,N.center>=0?N.center:-1,N.left>=0?N.left:-1,N.vertical>=0?N.vertical:-1,U,V,j,void 0!==A?A:i.collisionBoxArray.length,void 0!==A?A+1:i.collisionBoxArray.length,void 0!==z?z:i.collisionBoxArray.length,void 0!==z?z+1:i.collisionBoxArray.length,void 0!==C?C:i.collisionBoxArray.length,void 0!==C?C+1:i.collisionBoxArray.length,k||i.collisionBoxArray.length,k?k+1:i.collisionBoxArray.length,d,F,O,B,R,en,0,G,Z,ei)}(i,c,b,l,n,o,s,_,i.layers[0],i.collisionBoxArray,r.index,r.sourceLayerIndex,i.index,E,M,h,0,S,A,x,r,a,d,p,f)};if("line"===C)for(const D of lp(r.geometry,0,0,8192,8192)){const L=function(i,r,n,o,s,a,l,c,h){const u=o?.6*a*l:0,d=ld(o,s),p=d*l,f=0===i[0].x||i[0].x===h||0===i[0].y||i[0].y===h;return r-p=0&&T=0&&E=0&&m+d<=p){const S=new lc(T,E,0,b,g);S._round(),s&&!lh(r,S,l,s,a)||_.push(S)}}f+=v}return h||_.length||c||(_=i(r,f/2,o,s,a,l,c,!0,u)),_}(i,f?r/2*c%r:(d/2+2*a)*l*c%r,r,u,n,p,f,!1,h)}(D,T,I,n.vertical||v,o,24,w,i.overscaling,8192);for(const B of L)v&&function(i,r,n,o){const s=i.compareText;if(r in s){const a=s[r];for(let l=a.length-1;l>=0;l--)if(o.dist(a[l])1){const F=function(i,r,n,o,s,a){const l=n?.6*24*a:0,c=ld(n,o)*a;let h=0;const u=lu(i)/2;for(let d=0;du){const _=(u-h)/m,g=io(p.x,f.x,_),y=io(p.y,f.y,_),x=new lc(g,y,0,f.angleTo(p),d);return!l||lh(i,x,c,l,r)?x:void 0}h+=m}}(R,I,n.vertical||v,o,0,w);F&&P(R,F,f)}}else if("Polygon"===r.type)for(const O of s1(r.geometry,0)){const U=function(i,r=1,n=!1){let o=1/0,s=1/0,a=-1/0,l=-1/0;const c=i[0];for(let h=0;ha)&&(a=d.x),(!h||d.y>l)&&(l=d.y)}const p=Math.min(a-o,l-s);let f=p/2;const m=new lb([],lT);if(0===p)return new u(o,s);for(let _=o;_y.d||!y.d)&&(y=v,n&&console.log("found best %d after %d probes",Math.round(1e4*v.d)/1e4,x)),v.max-y.d<=r||(f=v.h/2,m.push(new lE(v.p.x-f,v.p.y-f,f,i)),m.push(new lE(v.p.x+f,v.p.y-f,f,i)),m.push(new lE(v.p.x-f,v.p.y+f,f,i)),m.push(new lE(v.p.x+f,v.p.y+f,f,i)),x+=4)}return n&&(console.log(`num probes: ${x}`),console.log(`best distance: ${y.d}`)),y.p}(O,16);P(O[0],new lc(U.x,U.y,0,0,void 0),f)}else if("LineString"===r.type)for(const V of r.geometry)P(V,new lc(V[0].x,V[0].y,0,0,void 0),f);else if("Point"===r.type)for(const j of r.geometry)for(const G of j)P([G],new lc(G.x,G.y,0,0,void 0),f)}(i,w,I,A,o,m,S,0,C,H,l,c,d)}a&&i.generateCollisionDebugBuffers(h,i.collisionBoxArray)}(d,l,i.positions,c,r.iconPositions,this.showCollisionBoxes,n,this.tileID.canonical,this.tileZoom,this.projection),d.projection=this.projection.name):d.hasPattern&&(d instanceof ab||d instanceof s4||d instanceof ah)&&(he(d.layers,this.zoom,n),d.addFeatures(_,this.tileID.canonical,r.patternPositions,n))}this.status="done",s(null,{buckets:Y(f).filter(i=>!i.isEmpty()),featureIndex:p,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:i.image,lineAtlas:m,imageAtlas:r,glyphMap:this.returnDependencies?l:null,iconMap:this.returnDependencies?c:null,glyphPositions:this.returnDependencies?i.positions:null})}}D.length?o.send("getImages",{icons:D,source:this.source,tileID:this.tileID,type:"patterns"},(i,r)=>{a||(a=i,h=r,L.call(this))},void 0,!1,z):h={},L.call(this)}}function he(i,r,n){const o=new nk(r);for(const s of i)s.recalculate(o,n)}class ht{constructor(i){this.entries={},this.scheduler=i}request(i,r,n,o){const s=this.entries[i]=this.entries[i]||{callbacks:[]};if(s.result){const[a,l]=s.result;return this.scheduler?this.scheduler.add(()=>{o(a,l)},r):o(a,l),()=>{}}return s.callbacks.push(o),s.cancel||(s.cancel=n((n,o)=>{for(const a of(s.result=[n,o],s.callbacks))this.scheduler?this.scheduler.add(()=>{a(n,o)},r):a(n,o);setTimeout(()=>delete this.entries[i],3e3)})),()=>{s.result||(s.callbacks=s.callbacks.filter(i=>i!==o),s.callbacks.length||(s.cancel(),delete this.entries[i]))}}}function hi(i,r,n){const o=JSON.stringify(i.request);return i.data&&(this.deduped.entries[o]={result:[null,i.data]}),this.deduped.request(o,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom},r=>{const o=e3(i.request,(i,o,s,a)=>{i?r(i):o&&r(null,{vectorTile:n?void 0:new as.VectorTile(new aO(o)),rawData:o,cacheControl:s,expires:a})});return()=>{o.cancel(),r()}},r)}const hr=_(new Float64Array(16));class hn{constructor(i,r){this._tr=i,this._worldSize=r}createInversionMatrix(){return hr}createTileMatrix(i){let r,n,o;const s=i.canonical,a=_(new Float64Array(16)),l=this._tr.projection;if(l.isReprojectedInTileSpace){const c=c8(s,l);r=1,n=c.x+i.wrap*c.scale,o=c.y,x(a,a,[r/c.scale,r/c.scale,this._tr.pixelsPerMeter/this._worldSize])}else r=this._worldSize/this._tr.zoomScale(s.z),n=(s.x+Math.pow(2,s.z)*i.wrap)*r,o=s.y*r;return y(a,a,[n,o,0]),x(a,a,[r/8192,r/8192,1]),a}pointCoordinate(i,r,n){const o=this._tr.horizonLineFromTop(!1),s=new u(i,Math.max(o,r));return this._tr.rayIntersectionCoordinate(this._tr.pointRayIntersection(s,n))}upVector(){return[0,0,1]}upVectorScale(){return 1}}const ho=Math.sqrt(3)/2,hs=Math.PI/2;function ha(i){return Math.tan((hs+i)/2)}const hl=85.051129*N,hc=85.051129*N,hh={albers:{name:"albers",range:[4,7],center:[-96,37.5],parallels:[29.5,45.5],zAxisUnit:"meters",conic:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],initializeConstants(){if(this.constants&&V(this.parallels,this.constants.parallels))return;const i=Math.sin(this.parallels[0]*N),r=(i+Math.sin(this.parallels[1]*N))/2,n=1+i*(2*r-i),o=Math.sqrt(n)/r;this.constants={n:r,c:n,r0:o,parallels:this.parallels}},project(i,r){this.initializeConstants();const n=(i-this.center[0])*N,{n:o,c:s,r0:a}=this.constants,l=Math.sqrt(s-2*o*Math.sin(r*N))/o;return{x:l*Math.sin(n*o),y:l*Math.cos(n*o)-a,z:0}},unproject(i,r){this.initializeConstants();const{n:n,c:o,r0:s}=this.constants,a=s+r;let l=Math.atan2(i,Math.abs(a))*Math.sign(a);a*n<0&&(l-=Math.PI*Math.sign(i)*Math.sign(a));const c=this.center[0]*N*n;l=H(l,-Math.PI-c,Math.PI-c);const h=l/n*j+this.center[0],u=Math.asin(X((o-(i*i+a*a)*n*n)/(2*n),-1,1)),d=X(u*j,-85.051129,85.051129);return new o2(h,d)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/o5(i)*r,farthestPixelDistance(i){return cH(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new hn(i,r)},equalEarth:{name:"equalEarth",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(i,r){r=r/180*Math.PI,i=i/180*Math.PI;const n=Math.asin(ho*Math.sin(r)),o=n*n,s=o*o*o;return{x:.5*(i*Math.cos(n)/(ho*(1.340264+-.24331799999999998*o+s*(.0062510000000000005+.034164*o)))/Math.PI+.5),y:1-.5*(n*(1.340264+-.081106*o+s*(893e-6+.003796*o))/Math.PI+1),z:0}},unproject(i,r){i=(2*i-.5)*Math.PI;let n=r=(2*(1-r)-1)*Math.PI,o=n*n,s=o*o*o;for(let a,l,c=0;c<12&&(l=n*(1.340264+-.081106*o+s*(893e-6+.003796*o))-r,s=(o=(n=X(n-(a=l/(1.340264+-.24331799999999998*o+s*(.0062510000000000005+.034164*o))),-Math.PI/3,Math.PI/3))*n)*o*o,!(1e-12>Math.abs(a)));++c);const h=ho*i*(1.340264+-.24331799999999998*o+s*(.0062510000000000005+.034164*o))/Math.cos(n),u=Math.asin(Math.sin(n)/ho),d=X(180*h/Math.PI,-180,180),p=X(180*u/Math.PI,-85.051129,85.051129);return new o2(d,p)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/o5(i)*r,farthestPixelDistance(i){return cH(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new hn(i,r)},equirectangular:{name:"equirectangular",supportsWorldCopies:!0,center:[0,0],range:[3.5,7],zAxisUnit:"meters",wrap:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project:(i,r)=>({x:.5+i/360,y:.5-r/360,z:0}),unproject(i,r){const n=X(360*(.5-r),-85.051129,85.051129);return new o2(360*(i-.5),n)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/o5(i)*r,farthestPixelDistance(i){return cH(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new hn(i,r)},lambertConformalConic:{name:"lambertConformalConic",range:[3.5,7],zAxisUnit:"meters",center:[0,30],parallels:[30,30],conic:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],initializeConstants(){if(this.constants&&V(this.parallels,this.constants.parallels))return;const i=this.parallels[0]*N,r=this.parallels[1]*N,n=Math.cos(i),o=i===r?Math.sin(i):Math.log(n/Math.cos(r))/Math.log(ha(r)/ha(i)),s=n*Math.pow(ha(i),o)/o;this.constants={n:o,f:s,parallels:this.parallels}},project(i,r){this.initializeConstants(),r*=N,i=(i-this.center[0])*N;const{n:n,f:o}=this.constants;o>0?r<-hs+1e-6&&(r=-hs+1e-6):r>hs-1e-6&&(r=hs-1e-6);const s=o/Math.pow(ha(r),n),a=s*Math.sin(n*i),l=o-s*Math.cos(n*i);return{x:.5*(a/Math.PI+.5),y:1-.5*(l/Math.PI+.5),z:0}},unproject(i,r){this.initializeConstants(),i=(2*i-.5)*Math.PI,r=(2*(1-r)-.5)*Math.PI;const{n:n,f:o}=this.constants,s=o-r,a=Math.sign(s),l=Math.sign(n)*Math.sqrt(i*i+s*s);let c=Math.atan2(i,Math.abs(s))*a;s*n<0&&(c-=Math.PI*Math.sign(i)*a);const h=X(c/n*j+this.center[0],-180,180),u=X((2*Math.atan(Math.pow(o/l,1/n))-hs)*j,-85.051129,85.051129);return new o2(h,u)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/o5(i)*r,farthestPixelDistance(i){return cH(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new hn(i,r)},mercator:{name:"mercator",wrap:!0,requiresDraping:!1,supportsWorldCopies:!0,supportsTerrain:!0,supportsFog:!0,supportsFreeCamera:!0,zAxisUnit:"meters",center:[0,0],project:(i,r)=>({x:o4(i),y:o6(r),z:0}),unproject(i,r){const n=o8(i),o=o9(r);return new o2(n,o)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/o5(i)*r,farthestPixelDistance(i){return cH(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new hn(i,r)},naturalEarth:{name:"naturalEarth",center:[0,0],range:[3.5,7],isReprojectedInTileSpace:!0,zAxisUnit:"meters",unsupportedLayers:["custom"],project(i,r){const n=(r*=N)*r,o=n*n;return{x:.5*((i*=N)*(.8707-.131979*n+o*(o*(.003971*n-.001529*o)-.013791))/Math.PI+.5),y:1-.5*(r*(1.007226+n*(.015085+o*(.028874*n-.044475-.005916*o)))/Math.PI+1),z:0}},unproject(i,r){i=(2*i-.5)*Math.PI;let n=r=(2*(1-r)-1)*Math.PI,o=25,s=0,a=n*n;do{a=n*n;const l=a*a;s=(n*(1.007226+a*(.015085+l*(.028874*a-.044475-.005916*l)))-r)/(1.007226+a*(.045255+l*(.259866*a-.311325-.005916*11*l))),n=X(n-s,-hl,hl)}while(Math.abs(s)>1e-6&&--o>0)a=n*n;const c=X(i/(.8707+a*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979))*j,-180,180),h=n*j;return new o2(c,h)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/o5(i)*r,farthestPixelDistance(i){return cH(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new hn(i,r)},winkelTripel:{name:"winkelTripel",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(i,r){r*=N,i*=N;const n=Math.cos(r),o=2/Math.PI,s=Math.acos(n*Math.cos(i/2)),a=Math.sin(s)/s,l=.5*(i*o+2*n*Math.sin(i/2)/a)||0,c=.5*(r+Math.sin(r)/a)||0;return{x:.5*(l/Math.PI+.5),y:1-.5*(c/Math.PI+1),z:0}},unproject(i,r){let n=i=(2*i-.5)*Math.PI,o=r=(2*(1-r)-1)*Math.PI,s=25,a=0,l=0;do{const c=Math.cos(o),h=Math.sin(o),u=2*h*c,d=h*h,p=c*c,f=Math.cos(n/2),m=Math.sin(n/2),_=2*f*m,g=m*m,y=1-p*f*f,x=y?1/y:0,v=y?Math.acos(c*f)*Math.sqrt(1/y):0,b=.5*(2*v*c*m+2*n/Math.PI)-i,w=.5*(v*h+o)-r,T=.5*x*(p*g+v*c*f*d)+1/Math.PI,E=x*(_*u/4-v*h*m),S=.125*x*(u*m-v*h*p*_),I=.5*x*(d*f+v*g*c)+.5,M=E*S-I*T;a=(w*E-b*I)/M,l=(b*S-w*T)/M,n=X(n-a,-Math.PI,Math.PI),o=X(o-l,-hc,hc)}while((Math.abs(a)>1e-6||Math.abs(l)>1e-6)&&--s>0)return new o2(n*j,o*j)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/o5(i)*r,farthestPixelDistance(i){return cH(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new hn(i,r)}};i.ARRAY_TYPE=f,i.AUTH_ERR_MSG=ez,i.Aabb=sv,i.Actor=class{constructor(i,r,n){this.target=i,this.parent=r,this.mapId=n,this.callbacks={},this.cancelCallbacks={},en(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=ed()?i:p,this.scheduler=new l6}send(i,r,n,o,s=!1,a){const l=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(n.metadata=a,this.callbacks[l]=n);const c=ey(this.globalScope)?void 0:[];return this.target.postMessage({id:l,type:i,hasCallback:!!n,targetMapId:o,mustQueue:s,sourceMapId:this.mapId,data:rH(r,c)},c),{cancel:()=>{n&&delete this.callbacks[l],this.target.postMessage({id:l,type:"",targetMapId:o,sourceMapId:this.mapId})}}}receive(i){const r=i.data,n=r.id;if(n&&(!r.targetMapId||this.mapId===r.targetMapId)){if(""===r.type){const o=this.cancelCallbacks[n];delete this.cancelCallbacks[n],o&&o.cancel()}else if(r.mustQueue||ed()){const s=this.callbacks[n];this.cancelCallbacks[n]=this.scheduler.add(()=>this.processTask(n,r),s&&s.metadata||{type:"message"})}else this.processTask(n,r)}}processTask(i,r){if(""===r.type){const n=this.callbacks[i];delete this.callbacks[i],n&&(r.error?n(rK(r.error)):n(null,rK(r.data)))}else{const o=ey(this.globalScope)?void 0:[],s=r.hasCallback?(r,n)=>{delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"",sourceMapId:this.mapId,error:r?rH(r):null,data:rH(n,o)},o)}:i=>{},a=rK(r.data);if(this.parent[r.type])this.parent[r.type](r.sourceMapId,a,s);else if(this.parent.getWorkerSource){const l=r.type.split(".");this.parent.getWorkerSource(r.sourceMapId,l[0],a.source)[l[1]](a,s)}else s(Error(`Could not find function ${r.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},i.CanonicalTileID=l9,i.Color=tC,i.ColorMode=cn,i.CullFaceMode=co,i.DEMData=cg,i.DataConstantProperty=nV,i.DedupedRequest=ht,i.DepthMode=ci,i.EXTENT=8192,i.Elevation=class{getAtPointOrZero(i,r=0){return this.getAtPoint(i,r)||0}getAtPoint(i,r,n=!0){null==r&&(r=null);const o=this._source();if(!o||i.y<0||i.y>1)return r;const s=o.getSource().maxzoom,a=1<{const o=this.getAtTileOffset(i,n.x,n.y),s=r.upVector(i.canonical,n.x,n.y);return C(s,s,o*r.upVectorScale(i.canonical)),s}}getForTilePoints(i,r,n,o){const s=cw.create(this,i,o);return!!s&&(r.forEach(i=>{i[2]=this.exaggeration()*s.getElevationAt(i[0],i[1],n)}),!0)}getMinMaxForTile(i){const r=this.findDEMTileFor(i);if(!r||!r.dem)return null;const n=r.dem.tree,o=r.tileID,s=1<Math.abs(o))return!1;const s=((i[0]-this.pos[0])*r[0]+(i[1]-this.pos[1])*r[1]+(i[2]-this.pos[2])*r[2])/o;return n[0]=this.pos[0]+this.dir[0]*s,n[1]=this.pos[1]+this.dir[1]*s,n[2]=this.pos[2]+this.dir[2]*s,!0}closestPointOnSphere(i,r,n){var o,s,a,l,c,h,u;if(s=(o=this.pos)[0],a=o[1],l=o[2],c=i[0],h=i[1],u=i[2],Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(a-h)<=1e-6*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(l-u)<=1e-6*Math.max(1,Math.abs(l),Math.abs(u))||0===r)return n[0]=n[1]=n[2]=0,!1;const[d,p,f]=this.dir,m=this.pos[0]-i[0],_=this.pos[1]-i[1],g=this.pos[2]-i[2],y=d*d+p*p+f*f,x=2*(m*d+_*p+g*f),v=x*x-4*y*(m*m+_*_+g*g-r*r);if(v<0){const b=Math.max(-x/2,0),w=m+d*b,T=_+p*b,E=g+f*b,S=Math.hypot(w,T,E);return n[0]=w*r/S,n[1]=T*r/S,n[2]=E*r/S,!1}{const I=(-x-Math.sqrt(v))/(2*y);if(I<0){const M=Math.hypot(m,_,g);return n[0]=m*r/M,n[1]=_*r/M,n[2]=g*r/M,!1}return n[0]=m+d*I,n[1]=_+p*I,n[2]=g+f*I,!0}}},i.RequestManager=class{constructor(i,r,n){this._transformRequestFn=i,this._customAccessToken=r,this._silenceAuthErrors=!!n,this._createSkuToken()}_createSkuToken(){const i=function(){let i="";for(let r=0;r<10;r++)i+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1","01",i].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=i.token,this._skuTokenExpiresAt=i.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(i,r){return this._transformRequestFn&&this._transformRequestFn(i,r)||{url:i}}normalizeStyleURL(i,r){if(!ek(i))return i;const n=eL(i);return n.path=`/styles/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||r)}normalizeGlyphsURL(i,r){if(!ek(i))return i;const n=eL(i);return n.path=`/fonts/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||r)}normalizeSourceURL(i,r){if(!ek(i))return i;const n=eL(i);return n.path=`/v4/${n.authority}.json`,n.params.push("secure"),this._makeAPIURL(n,this._customAccessToken||r)}normalizeSpriteURL(i,r,n,o){const s=eL(i);return ek(i)?(s.path=`/styles/v1${s.path}/sprite${r}${n}`,this._makeAPIURL(s,this._customAccessToken||o)):(s.path+=`${r}${n}`,eB(s))}normalizeTileURL(i,r,n){if(this._isSkuTokenExpired()&&this._createSkuToken(),i&&!ek(i))return i;const o=eL(i);o.path=o.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${r||n&&"raster"!==o.authority&&512===n?"@2x":""}${eE.supported?".webp":"$1"}`),"raster"===o.authority?o.path=`/${eb.RASTER_URL_PREFIX}${o.path}`:(o.path=o.path.replace(/^.+\/v4\//,"/"),o.path=`/${eb.TILE_URL_VERSION}${o.path}`);const s=this._customAccessToken||function(i){for(const r of i){const n=r.match(/^access_token=(.*)$/);if(n)return n[1]}return null}(o.params)||eb.ACCESS_TOKEN;return eb.REQUIRE_ACCESS_TOKEN&&s&&this._skuToken&&o.params.push(`sku=${this._skuToken}`),this._makeAPIURL(o,s)}canonicalizeTileURL(i,r){const n=eL(i);if(!n.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!n.path.match(/\.[\w]+$/))return i;let o="mapbox://";n.path.match(/^\/raster\/v1\//)?o+=`raster/${n.path.replace(`/${eb.RASTER_URL_PREFIX}/`,"")}`:o+=`tiles/${n.path.replace(`/${eb.TILE_URL_VERSION}/`,"")}`;let s=n.params;return r&&(s=s.filter(i=>!i.match(/^access_token=/))),s.length&&(o+=`?${s.join("&")}`),o}canonicalizeTileset(i,r){const n=!!r&&ek(r),o=[];for(const s of i.tiles||[])eP(s)?o.push(this.canonicalizeTileURL(s,n)):o.push(s);return o}_makeAPIURL(i,r){const n="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",o=eL(eb.API_URL);if(i.protocol=o.protocol,i.authority=o.authority,"http"===i.protocol){const s=i.params.indexOf("secure");s>=0&&i.params.splice(s,1)}if("/"!==o.path&&(i.path=`${o.path}${i.path}`),!eb.REQUIRE_ACCESS_TOKEN)return eB(i);if(r=r||eb.ACCESS_TOKEN,!this._silenceAuthErrors){if(!r)throw Error(`An API access token is required to use Mapbox GL. ${n}`);if("s"===r[0])throw Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${n}`)}return i.params=i.params.filter(i=>-1===i.indexOf("access_token")),i.params.push(`access_token=${r||""}`),eB(i)}},i.ResourceType=eQ,i.SegmentVector=o0,i.SourceCache=cx,i.StencilMode=cr,i.StructArrayLayout1ui2=ol,i.StructArrayLayout2f1f2i16=n9,i.StructArrayLayout2i4=nJ,i.StructArrayLayout2ui4=oa,i.StructArrayLayout3f12=n1,i.StructArrayLayout3ui6=oe,i.StructArrayLayout4i8=nQ,i.Texture=l1,i.Tile=c$,i.Transitionable=nL,i.Uniform1f=oP,i.Uniform1i=class extends ok{constructor(i,r){super(i,r),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},i.Uniform2f=class extends ok{constructor(i,r){super(i,r),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},i.Uniform3f=class extends ok{constructor(i,r){super(i,r),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},i.Uniform4f=oD,i.UniformColor=oL,i.UniformMatrix2f=class extends ok{constructor(i,r){super(i,r),this.current=oF}set(i){for(let r=0;r<4;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix2fv(this.location,!1,i);break}}},i.UniformMatrix3f=class extends ok{constructor(i,r){super(i,r),this.current=oR}set(i){for(let r=0;r<9;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}},i.UniformMatrix4f=class extends ok{constructor(i,r){super(i,r),this.current=oB}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let r=1;r<16;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},i.UnwrappedTileID=l7,i.ValidationError=tn,i.VectorTileWorkerSource=class extends ti{constructor(i,r,n,o,s){super(),this.actor=i,this.layerIndex=r,this.availableImages=n,this.loadVectorData=s||hi,this.loading={},this.loaded={},this.deduped=new ht(i.scheduler),this.isSpriteLoaded=o,this.scheduler=i.scheduler}loadTile(i,r){const n=i.uid,o=i&&i.request,s=o&&o.collectResourceTiming,a=this.loading[n]=new c7(i);a.abort=this.loadVectorData(i,(l,c)=>{const h=!this.loading[n];if(delete this.loading[n],h||l||!c)return a.status="done",h||(this.loaded[n]=a),r(l);const u=c.rawData,d={};c.expires&&(d.expires=c.expires),c.cacheControl&&(d.cacheControl=c.cacheControl),a.vectorTile=c.vectorTile||new as.VectorTile(new aO(u));const p=()=>{a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,(i,n)=>{if(i||!n)return r(i);const a={};if(s){const l=l4(o);l.length>0&&(a.resourceTiming=JSON.parse(JSON.stringify(l)))}r(null,J({rawTileData:u.slice(0)},n,d,a))})};this.isSpriteLoaded?p():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(p,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom}):p()}),this.loaded=this.loaded||{},this.loaded[n]=a})}reloadTile(i,r){const n=this.loaded,o=i.uid,s=this;if(n&&n[o]){const a=n[o];a.showCollisionBoxes=i.showCollisionBoxes,a.enableTerrain=!!i.enableTerrain,a.projection=i.projection;const l=(i,n)=>{const o=a.reloadCallback;o&&(delete a.reloadCallback,a.parse(a.vectorTile,s.layerIndex,this.availableImages,s.actor,o)),r(i,n)};"parsing"===a.status?a.reloadCallback=l:"done"===a.status&&(a.vectorTile?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,l):l())}}abortTile(i,r){const n=i.uid,o=this.loading[n];o&&(o.abort&&o.abort(),delete this.loading[n]),r()}removeTile(i,r){const n=this.loaded,o=i.uid;n&&n[o]&&delete n[o],r()}},i.WritingMode=a6,i.ZoomHistory=rY,i.add=I,i.addDynamicAttributes=lR,i.adjoint=function(i,r){var n=r[0],o=r[1],s=r[2],a=r[3],l=r[4],c=r[5],h=r[6],u=r[7],d=r[8];return i[0]=l*d-c*u,i[1]=s*u-o*d,i[2]=o*c-s*l,i[3]=c*h-a*d,i[4]=n*d-s*h,i[5]=s*a-n*c,i[6]=a*u-l*h,i[7]=o*h-n*u,i[8]=n*l-o*a,i},i.asyncAll=K,i.bezier=$,i.bindAll=en,i.boundsAttributes=cG,i.bufferConvexPolygon=function(i,r){const n=[];for(let o=0;oeH&&(i.getActor().send("enforceCacheSizeLimit",eW),eJ=0)},i.calculateGlobeMatrix=c4,i.calculateGlobeMercatorMatrix=function(i){const r=i.worldSize,n=X(i.center.lat,-85.051129,85.051129),o=new u(o4(i.center.lng)*r,o6(n)*r),s=1/o5(i.center.lat)*r,a=i.pixelsPerMeter,l=r/(s/i.pixelsPerMeter),c=_(new Float64Array(16));return y(c,c,[o.x,o.y,0]),x(c,c,[l,l,a]),c},i.clamp=X,i.clearTileCache=function(i){const r=p.caches.delete(e$);i&&r.catch(i).then(()=>i())},i.clipLine=lp,i.clone=function(i){var r=new f(16);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],r},i.clone$1=el,i.collisionCircleLayout=az,i.config=eb,i.conjugate=function(i,r){return i[0]=-r[0],i[1]=-r[1],i[2]=-r[2],i[3]=r[3],i},i.create=function(){var i=new f(16);return f!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},i.create$1=m,i.createExpression=i9,i.createLayout=nK,i.createStyleLayer=function(i){return"custom"===i.type?new lq(i):new lH[i.type](i)},i.cross=D,i.degToRad=function(i){return i*N},i.div=function(i,r,n){return i[0]=r[0]/n[0],i[1]=r[1]/n[1],i[2]=r[2]/n[2],i},i.dot=P,i.ease=q,i.easeCubicInOut=Z,i.emitValidationErrors=rU,i.endsWith=eo,i.enforceCacheSizeLimit=function(i){eK(),eq&&eq.then(r=>{r.keys().then(n=>{for(let o=0;oa&&(o+=(i[s]-a)*(i[s]-a)),r[s]Math.abs(r.parallels[0]+r.parallels[1])){let n=function(i){const r=Math.max(.01,Math.cos(i*N)),n=1/(2*Math.max(Math.PI*r,1/r));return{wrap:!0,supportsWorldCopies:!0,unsupportedLayers:["custom"],project(i,o){const s=Math.sin(o*N)/r;return{x:i*N*r*n+.5,y:-s*n+.5,z:0}},unproject(i,o){const s=X((i-.5)/n*j/r,-180,180),a=Math.asin(X(-(o-.5)/n*r,-1,1)),l=X(a*j,-85.051129,85.051129);return new o2(s,l)}}}(r.parallels[0]);if("lambertConformalConic"===r.name){const{project:o,unproject:s}=hh.mercator;n={wrap:!0,supportsWorldCopies:!0,project:o,unproject:s}}return J({},i,r,n)}return J({},i,r)}(r,i):r},i.getRTLTextPluginStatus=nA,i.getReferrer=e1,i.getTilePoint=function(i,{x:r,y:n},o=0){return new u(((r-o)*i.scale-i.x)*8192,(n*i.scale-i.y)*8192)},i.getTileVec3=function(i,r,n=0){return S(((r.x-n)*i.scale-i.x)*8192,(r.y*i.scale-i.y)*8192,r.z*o5(o9(r.y)))},i.getVideo=function(i,r){const n=p.document.createElement("video");n.muted=!0,n.onloadstart=function(){r(null,n)};for(let o=0;o0&&(l=1/Math.sqrt(l)),i[0]=n*l,i[1]=o*l,i[2]=s*l,i[3]=a*l,i},i.number=io,i.ortho=function(i,r,n,o,s,a,l){var c=1/(r-n),h=1/(o-s),u=1/(a-l);return i[0]=-2*c,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*h,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*u,i[11]=0,i[12]=(r+n)*c,i[13]=(s+o)*h,i[14]=(l+a)*u,i[15]=1,i},i.pbf=aO,i.perspective=function(i,r,n,o,s){var a,l=1/Math.tan(r/2);return i[0]=l/n,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=l,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,null!=s&&s!==1/0?(i[10]=(s+o)*(a=1/(o-s)),i[14]=2*s*o*a):(i[10]=-1,i[14]=-2*o),i},i.pick=function(i,r){const n={};for(let o=0;othis._layers[i.id]),h=c[0];if("none"===h.visibility)continue;const u=h.source||"";let d=this.familiesBySource[u];d||(d=this.familiesBySource[u]={});const p=h.sourceLayer||"_geojsonTileLayer";let f=d[p];f||(f=d[p]=[]),f.push(c)}}}const{ImageBitmap:n}=i.window;class o{loadTile(r,o){const{uid:s,encoding:a,rawImageData:l,padding:c,buildQuadTree:h}=r,u=n&&l instanceof n?this.getImageData(l,c):l;o(null,new i.DEMData(s,u,a,c<1,h))}getImageData(r,n){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(r.width,r.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=r.width,this.offscreenCanvas.height=r.height,this.offscreenCanvasContext.drawImage(r,0,0,r.width,r.height);const o=this.offscreenCanvasContext.getImageData(-n,-n,r.width+2*n,r.height+2*n);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new i.RGBAImage({width:o.width,height:o.height},o.data)}}var s,a=function i(r,n){var o,s=r&&r.type;if("FeatureCollection"===s)for(o=0;o=Math.abs(c)?n-h+c:c-h+n,n=h}n+o>=0!=!!r&&i.reverse()}const h=i.vectorTile.VectorTileFeature.prototype.toGeoJSON;class u{constructor(r){this._feature=r,this.extent=i.EXTENT,this.type=r.type,this.properties=r.tags,"id"in r&&!isNaN(r.id)&&(this.id=parseInt(r.id,10))}loadGeometry(){if(1===this._feature.type){const r=[];for(const n of this._feature.geometry)r.push([new i.pointGeometry(n[0],n[1])]);return r}{const o=[];for(const s of this._feature.geometry){const a=[];for(const l of s)a.push(new i.pointGeometry(l[0],l[1]));o.push(a)}return o}}toGeoJSON(i,r,n){return h.call(this,i,r,n)}}class d{constructor(r){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=i.EXTENT,this.length=r.length,this._features=r}feature(i){return new u(this._features[i])}}var p=i.vectorTile.VectorTileFeature;function f(i,r){this.options=r||{},this.features=i,this.length=i.length}function m(i,r){this.id="number"==typeof i.id?i.id:void 0,this.type=i.type,this.rawGeometry=1===i.type?[i.geometry]:i.geometry,this.properties=i.tags,this.extent=r||4096}f.prototype.feature=function(i){return new m(this.features[i],this.options.extent)},m.prototype.loadGeometry=function(){var r=this.rawGeometry;this.geometry=[];for(var n=0;n>31),r.writeVarint(m<<1^m>>31),s+=f,a+=m}3===o&&r.writeVarint(15)}}function w(i,r){var n=typeof i;"string"===n?r.writeStringField(1,i):"boolean"===n?r.writeBooleanField(7,i):"number"===n&&(i%1!=0?r.writeDoubleField(3,i):i<0?r.writeSVarintField(6,i):r.writeVarintField(5,i))}function T(i,r,n,o){E(i,n,o),E(r,2*n,2*o),E(r,2*n+1,2*o+1)}function E(i,r,n){const o=i[r];i[r]=i[n],i[n]=o}function S(i,r,n,o){const s=i-n,a=r-o;return s*s+a*a}_.fromVectorTileJs=g,_.fromGeojsonVt=function(i,r){r=r||{};var n={};for(var o in i)n[o]=new f(i[o].features,r),n[o].name=o,n[o].version=r.version,n[o].extent=r.extent;return g({layers:n})},_.GeoJSONWrapper=f;const I=i=>i[0],M=i=>i[1];class A{constructor(i,r=I,n=M,o=64,s=Float64Array){this.nodeSize=o,this.points=i;const a=i.length<65536?Uint16Array:Uint32Array,l=this.ids=new a(i.length),c=this.coords=new s(2*i.length);for(let h=0;h>1;(function i(r,n,o,s,a,l){for(;a>s;){if(a-s>600){const c=a-s+1,h=o-s+1,u=Math.log(c),d=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*d*(c-d)/c)*(h-c/2<0?-1:1);i(r,n,o,Math.max(s,Math.floor(o-h*d/c+p)),Math.min(a,Math.floor(o+(c-h)*d/c+p)),l)}const f=n[2*o+l];let m=s,_=a;for(T(r,n,s,o),n[2*a+l]>f&&T(r,n,s,a);m<_;){for(T(r,n,m,_),m++,_--;n[2*m+l]f;)_--}n[2*s+l]===f?T(r,n,s,_):T(r,n,++_,a),_<=o&&(s=_+1),o<=_&&(a=_-1)}})(r,n,c,s,a,l%2),i(r,n,o,s,c-1,l+1),i(r,n,o,c+1,a,l+1)}(l,c,o,0,l.length-1,0)}range(i,r,n,o){return function(i,r,n,o,s,a,l){let c,h;const u=[0,i.length-1,0],d=[];for(;u.length;){const p=u.pop(),f=u.pop(),m=u.pop();if(f-m<=l){for(let _=m;_<=f;_++)c=r[2*_],h=r[2*_+1],c>=n&&c<=s&&h>=o&&h<=a&&d.push(i[_]);continue}const g=Math.floor((m+f)/2);c=r[2*g],h=r[2*g+1],c>=n&&c<=s&&h>=o&&h<=a&&d.push(i[g]);const y=(p+1)%2;(0===p?n<=c:o<=h)&&(u.push(m),u.push(g-1),u.push(y)),(0===p?s>=c:a>=h)&&(u.push(g+1),u.push(f),u.push(y))}return d}(this.ids,this.coords,i,r,n,o,this.nodeSize)}within(i,r,n){return function(i,r,n,o,s,a){const l=[0,i.length-1,0],c=[],h=s*s;for(;l.length;){const u=l.pop(),d=l.pop(),p=l.pop();if(d-p<=a){for(let f=p;f<=d;f++)S(r[2*f],r[2*f+1],n,o)<=h&&c.push(i[f]);continue}const m=Math.floor((p+d)/2),_=r[2*m],g=r[2*m+1];S(_,g,n,o)<=h&&c.push(i[m]);const y=(u+1)%2;(0===u?n-s<=_:o-s<=g)&&(l.push(p),l.push(m-1),l.push(y)),(0===u?n+s>=_:o+s>=g)&&(l.push(m+1),l.push(d),l.push(y))}return c}(this.ids,this.coords,i,r,n,this.nodeSize)}}const C={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:i=>i},z=Math.fround||(s=new Float32Array(1),i=>(s[0]=+i,s[0]));class k{constructor(i){this.options=R(Object.create(C),i),this.trees=Array(this.options.maxZoom+1)}load(i){const{log:r,minZoom:n,maxZoom:o,nodeSize:s}=this.options;r&&console.time("total time");const a=`prepare ${i.length} points`;r&&console.time(a),this.points=i;let l=[];for(let c=0;c=n;h--){const u=+Date.now();l=this._cluster(l,h),this.trees[h]=new A(l,F,O,s,Float32Array),r&&console.log("z%d: %d clusters in %dms",h,l.length,+Date.now()-u)}return r&&console.timeEnd("total time"),this}getClusters(i,r){let n=((i[0]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,i[1]));let s=180===i[2]?180:((i[2]+180)%360+360)%360-180;const a=Math.max(-90,Math.min(90,i[3]));if(i[2]-i[0]>=360)n=-180,s=180;else if(n>s){const l=this.getClusters([n,o,180,a],r),c=this.getClusters([-180,o,s,a],r);return l.concat(c)}const h=this.trees[this._limitZoom(r)],u=h.range(L(n),B(a),L(s),B(o)),d=[];for(const p of u){const f=h.points[p];d.push(f.numPoints?P(f):this.points[f.index])}return d}getChildren(i){const r=this._getOriginId(i),n=this._getOriginZoom(i),o="No cluster with the specified id.",s=this.trees[n];if(!s)throw Error(o);const a=s.points[r];if(!a)throw Error(o);const l=this.options.radius/(this.options.extent*Math.pow(2,n-1)),c=s.within(a.x,a.y,l),h=[];for(const u of c){const d=s.points[u];d.parentId===i&&h.push(d.numPoints?P(d):this.points[d.index])}if(0===h.length)throw Error(o);return h}getLeaves(i,r,n){const o=[];return this._appendLeaves(o,i,r=r||10,n=n||0,0),o}getTile(i,r,n){const o=this.trees[this._limitZoom(i)],s=Math.pow(2,i),{extent:a,radius:l}=this.options,c=l/a,h=(n-c)/s,u=(n+1+c)/s,d={features:[]};return this._addTileFeatures(o.range((r-c)/s,h,(r+1+c)/s,u),o.points,r,n,s,d),0===r&&this._addTileFeatures(o.range(1-c/s,h,1,u),o.points,s,n,s,d),r===s-1&&this._addTileFeatures(o.range(0,h,c/s,u),o.points,-1,n,s,d),d.features.length?d:null}getClusterExpansionZoom(i){let r=this._getOriginZoom(i)-1;for(;r<=this.options.maxZoom;){const n=this.getChildren(i);if(r++,1!==n.length)break;i=n[0].properties.cluster_id}return r}_appendLeaves(i,r,n,o,s){const a=this.getChildren(r);for(const l of a){const c=l.properties;if(c&&c.cluster?s+c.point_count<=o?s+=c.point_count:s=this._appendLeaves(i,c.cluster_id,n,o,s):sr&&(m+=g.numPoints||1)}if(m>f&&m>=l){var y,x,v,b;let w=u.x*f,T=u.y*f,E=a&&f>1?this._map(u,!0):null;const S=(h<<5)+(r+1)+this.points.length;for(const I of p){const M=d.points[I];if(M.zoom<=r)continue;M.zoom=r;const A=M.numPoints||1;w+=M.x*A,T+=M.y*A,M.parentId=S,a&&(E||(E=this._map(u,!0)),a(E,this._map(M)))}u.parentId=S,n.push((y=w/m,x=T/m,v=m,b=E,{x:z(y),y:z(x),zoom:1/0,id:S,parentId:-1,numPoints:v,properties:b}))}else if(n.push(u),m>1)for(const C of p){const k=d.points[C];k.zoom<=r||(k.zoom=r,n.push(k))}}return n}_getOriginId(i){return i-this.points.length>>5}_getOriginZoom(i){return(i-this.points.length)%32}_map(i,r){if(i.numPoints)return r?R({},i.properties):i.properties;const n=this.points[i.index].properties,o=this.options.map(n);return r&&o===n?R({},o):o}}function P(i){return{type:"Feature",id:i.id,properties:D(i),geometry:{type:"Point",coordinates:[360*(i.x-.5),function(i){const r=(180-360*i)*Math.PI/180;return 360*Math.atan(Math.exp(r))/Math.PI-90}(i.y)]}}}function D(i){const r=i.numPoints,n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r;return R(R({},i.properties),{cluster:!0,cluster_id:i.id,point_count:r,point_count_abbreviated:n})}function L(i){return i/360+.5}function B(i){const r=Math.sin(i*Math.PI/180),n=.5-.25*Math.log((1+r)/(1-r))/Math.PI;return n<0?0:n>1?1:n}function R(i,r){for(const n in r)i[n]=r[n];return i}function F(i){return i.x}function O(i){return i.y}function U(i,r,n,o){var s={id:void 0===i?null:i,type:r,geometry:n,tags:o,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(i){var r=i.geometry,n=i.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)V(i,r);else if("Polygon"===n||"MultiLineString"===n)for(var o=0;o0&&(l+=o?(s*u-h*a)/2:Math.sqrt(Math.pow(h-s,2)+Math.pow(u-a,2))),s=h,a=u}var d=r.length-3;r[2]=1,function i(r,n,o,s){for(var a,l=s,c=o-n>>1,h=o-n,u=r[n],d=r[n+1],p=r[o],f=r[o+1],m=n+3;m1?(n=s,o=a):h>0&&(n+=l*h,o+=c*h)}return(l=i-n)*l+(c=r-o)*c}(r[m],r[m+1],u,d,p,f);if(_>l)a=m,l=_;else if(_===l){var g=Math.abs(m-c);gs&&(a-n>3&&i(r,n,a,s),r[a+2]=l,o-a>3&&i(r,a,o,s))}(r,0,d,n),r[d+2]=1,r.size=Math.abs(l),r.start=0,r.end=r.size}function Z(i,r,n,o){for(var s=0;s1?1:n}function q(i,r,n,o,s,a,l,c){if(o/=r,a>=(n/=r)&&l=o)return null;for(var h=[],u=0;u=n&&_=o)){var g=[];if("Point"===f||"MultiPoint"===f)(function(i,r,n,o,s){for(var a=0;a=n&&l<=o&&(r.push(i[a]),r.push(i[a+1]),r.push(i[a+2]))}})(p,g,n,o,s);else if("LineString"===f)X(p,g,n,o,s,!1,c.lineMetrics);else if("MultiLineString"===f)H(p,g,n,o,s,!1);else if("Polygon"===f)H(p,g,n,o,s,!0);else if("MultiPolygon"===f)for(var y=0;yn&&(h=d(u,m,_,y,x,n),l&&(u.start=p+c*h)):v>o?b=n&&(h=d(u,m,_,y,x,n),w=!0),b>o&&v<=o&&(h=d(u,m,_,y,x,o),w=!0),!a&&w&&(l&&(u.end=p+c*h),r.push(u),u=W(i)),l&&(p+=c)}var T=i.length-3;m=i[T],_=i[T+1],g=i[T+2],(v=0===s?m:_)>=n&&v<=o&&K(u,m,_,g),T=u.length-3,a&&T>=3&&(u[T]!==u[0]||u[T+1]!==u[1])&&K(u,u[0],u[1],u[2]),u.length&&r.push(u)}function W(i){var r=[];return r.size=i.size,r.start=i.start,r.end=i.end,r}function H(i,r,n,o,s,a){for(var l=0;l0&&r.size<(s?l:o))n.numPoints+=r.length/3;else{for(var c=[],h=0;hl)&&(n.numSimplified++,c.push(r[h]),c.push(r[h+1])),n.numPoints++;s&&function(i,r){for(var n=0,o=0,s=i.length,a=s-2;o0===r)for(o=0,s=i.length;o24)throw Error("maxZoom should be in the 0-24 range");if(r.promoteId&&r.generateId)throw Error("promoteId and generateId cannot be used together.");var u=function(i,r){var n=[];if("FeatureCollection"===i.type)for(var o=0;o1&&console.time("creation"),f=this.tiles[p]=function(i,r,n,o,s){for(var a=r===s.maxZoom?0:s.tolerance/((1<l.maxX&&(l.maxX=d),p>l.maxY&&(l.maxY=p)}return l}(i,r,n,o,h),this.tileCoords.push({z:r,x:n,y:o}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",r,n,o,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var m="z"+r;this.stats[m]=(this.stats[m]||0)+1,this.total++}if(f.source=i,s){if(r===h.maxZoom||r===s)continue;var _=1<1&&console.time("clipping");var g,y,x,v,b,w,T=.5*h.buffer/h.extent,E=.5-T,S=.5+T,I=1+T;g=y=x=v=null,b=q(i,d,n-T,n+S,0,f.minX,f.maxX,h),w=q(i,d,n+E,n+I,0,f.minX,f.maxX,h),i=null,b&&(g=q(b,d,o-T,o+S,1,f.minY,f.maxY,h),y=q(b,d,o+E,o+I,1,f.minY,f.maxY,h),b=null),w&&(x=q(w,d,o-T,o+S,1,f.minY,f.maxY,h),v=q(w,d,o+E,o+I,1,f.minY,f.maxY,h),w=null),u>1&&console.timeEnd("clipping"),c.push(g||[],r+1,2*n,2*o),c.push(y||[],r+1,2*n,2*o+1),c.push(x||[],r+1,2*n+1,2*o),c.push(v||[],r+1,2*n+1,2*o+1)}}},en.prototype.getTile=function(i,r,n){var o=this.options,s=o.extent,a=o.debug;if(i<0||i>24)return null;var l=1<1&&console.log("drilling down to z%d-%d-%d",i,r,n);for(var h,u=i,d=r,p=n;!h&&u>0;)u--,d=Math.floor(d/2),p=Math.floor(p/2),h=this.tiles[eo(u,d,p)];return h&&h.source?(a>1&&console.log("found parent tile z%d-%d-%d",u,d,p),a>1&&console.time("drilling down"),this.splitTile(h.source,u,d,p,i,r,n),a>1&&console.timeEnd("drilling down"),this.tiles[c]?et(this.tiles[c],s):null):null};class ea extends i.VectorTileWorkerSource{constructor(i,r,n,o,s){super(i,r,n,o,es),s&&(this.loadGeoJSON=s)}loadData(r,n){const o=r&&r.request,s=o&&o.collectResourceTiming;this.loadGeoJSON(r,(l,c)=>{if(l||!c)return n(l);if("object"!=typeof c)return n(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`));{a(c,!0);try{var h,u;if(r.filter){const d=i.createExpression(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===d.result)throw Error(d.value.map(i=>`${i.key}: ${i.message}`).join(", "));const p=c.features.filter(i=>d.value.evaluate({zoom:0},i));c={type:"FeatureCollection",features:p}}this._geoJSONIndex=r.cluster?new k(function({superclusterOptions:r,clusterProperties:n}){if(!n||!r)return r;const o={},s={},a={accumulated:null,zoom:0},l={properties:null},c=Object.keys(n);for(const h of c){const[u,d]=n[h],p=i.createExpression(d),f=i.createExpression("string"==typeof u?[u,["accumulated"],["get",h]]:u);o[h]=p.value,s[h]=f.value}return r.map=i=>{l.properties=i;const r={};for(const n of c)r[n]=o[n].evaluate(a,l);return r},r.reduce=(i,r)=>{for(const n of(l.properties=r,c))a.accumulated=i[n],i[n]=s[n].evaluate(a,l)},r}(r)).load(c.features):(h=c,u=r.geojsonVtOptions,new en(h,u))}catch(f){return n(f)}this.loaded={};const m={};if(s){const _=i.getPerformanceMeasurement(o);_&&(m.resourceTiming={},m.resourceTiming[r.source]=JSON.parse(JSON.stringify(_)))}n(null,m)}})}reloadTile(i,r){const n=this.loaded;return n&&n[i.uid]?super.reloadTile(i,r):this.loadTile(i,r)}loadGeoJSON(r,n){if(r.request)i.getJSON(r.request,n);else{if("string"!=typeof r.data)return n(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`));try{return n(null,JSON.parse(r.data))}catch(o){return n(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(i,r){try{r(null,this._geoJSONIndex.getClusterExpansionZoom(i.clusterId))}catch(n){r(n)}}getClusterChildren(i,r){try{r(null,this._geoJSONIndex.getChildren(i.clusterId))}catch(n){r(n)}}getClusterLeaves(i,r){try{r(null,this._geoJSONIndex.getLeaves(i.clusterId,i.limit,i.offset))}catch(n){r(n)}}}class el{constructor(r){this.self=r,this.actor=new i.Actor(r,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=i.getProjection({name:"mercator"}),this.workerSourceTypes={vector:i.VectorTileWorkerSource,geojson:ea},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(i,r)=>{if(this.workerSourceTypes[i])throw Error(`Worker source with name "${i}" already registered.`);this.workerSourceTypes[i]=r},this.self.registerRTLTextPlugin=r=>{if(i.plugin.isParsed())throw Error("RTL text plugin already registered.");i.plugin.applyArabicShaping=r.applyArabicShaping,i.plugin.processBidirectionalText=r.processBidirectionalText,i.plugin.processStyledBidirectionalText=r.processStyledBidirectionalText}}clearCaches(i,r,n){delete this.layerIndexes[i],delete this.availableImages[i],delete this.workerSources[i],delete this.demWorkerSources[i],n()}checkIfReady(i,r,n){n()}setReferrer(i,r){this.referrer=r}spriteLoaded(r,n){for(const o in this.isSpriteLoaded[r]=n,this.workerSources[r]){const s=this.workerSources[r][o];for(const a in s)s[a]instanceof i.VectorTileWorkerSource&&(s[a].isSpriteLoaded=n,s[a].fire(new i.Event("isSpriteLoaded")))}}setImages(i,r,n){for(const o in this.availableImages[i]=r,this.workerSources[i]){const s=this.workerSources[i][o];for(const a in s)s[a].availableImages=r}n()}enableTerrain(i,r,n){this.terrain=r,n()}setProjection(r,n){this.projections[r]=i.getProjection(n)}setLayers(i,r,n){this.getLayerIndex(i).replace(r),n()}updateLayers(i,r,n){this.getLayerIndex(i).update(r.layers,r.removedIds),n()}loadTile(r,n,o){const s=this.enableTerrain?i.extend({enableTerrain:this.terrain},n):n;s.projection=this.projections[r]||this.defaultProjection,this.getWorkerSource(r,n.type,n.source).loadTile(s,o)}loadDEMTile(r,n,o){const s=this.enableTerrain?i.extend({buildQuadTree:this.terrain},n):n;this.getDEMWorkerSource(r,n.source).loadTile(s,o)}reloadTile(r,n,o){const s=this.enableTerrain?i.extend({enableTerrain:this.terrain},n):n;s.projection=this.projections[r]||this.defaultProjection,this.getWorkerSource(r,n.type,n.source).reloadTile(s,o)}abortTile(i,r,n){this.getWorkerSource(i,r.type,r.source).abortTile(r,n)}removeTile(i,r,n){this.getWorkerSource(i,r.type,r.source).removeTile(r,n)}removeSource(i,r,n){if(!this.workerSources[i]||!this.workerSources[i][r.type]||!this.workerSources[i][r.type][r.source])return;const o=this.workerSources[i][r.type][r.source];delete this.workerSources[i][r.type][r.source],void 0!==o.removeSource?o.removeSource(r,n):n()}loadWorkerSource(i,r,n){try{this.self.importScripts(r.url),n()}catch(o){n(o.toString())}}syncRTLPluginState(r,n,o){try{i.plugin.setState(n);const s=i.plugin.getPluginURL();if(i.plugin.isLoaded()&&!i.plugin.isParsed()&&null!=s){this.self.importScripts(s);const a=i.plugin.isParsed();o(a?void 0:Error(`RTL Text Plugin failed to import scripts from ${s}`),a)}}catch(l){o(l.toString())}}getAvailableImages(i){let r=this.availableImages[i];return r||(r=[]),r}getLayerIndex(i){let n=this.layerIndexes[i];return n||(n=this.layerIndexes[i]=new r),n}getWorkerSource(i,r,n){return this.workerSources[i]||(this.workerSources[i]={}),this.workerSources[i][r]||(this.workerSources[i][r]={}),this.workerSources[i][r][n]||(this.workerSources[i][r][n]=new this.workerSourceTypes[r]({send:(r,n,o,s,a,l)=>{this.actor.send(r,n,o,i,a,l)},scheduler:this.actor.scheduler},this.getLayerIndex(i),this.getAvailableImages(i),this.isSpriteLoaded[i])),this.workerSources[i][r][n]}getDEMWorkerSource(i,r){return this.demWorkerSources[i]||(this.demWorkerSources[i]={}),this.demWorkerSources[i][r]||(this.demWorkerSources[i][r]=new o),this.demWorkerSources[i][r]}enforceCacheSizeLimit(r,n){i.enforceCacheSizeLimit(n)}getWorkerPerformanceMetrics(i,r,n){n(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new el(self)),el}),o(["./shared"],function(i){let r,n,o,s;function a(i){var r;return"undefined"!=typeof window&&"undefined"!=typeof document&&!!Array.prototype&&!!Array.prototype.every&&!!Array.prototype.filter&&!!Array.prototype.forEach&&!!Array.prototype.indexOf&&!!Array.prototype.lastIndexOf&&!!Array.prototype.map&&!!Array.prototype.some&&!!Array.prototype.reduce&&!!Array.prototype.reduceRight&&!!Array.isArray&&!!Function.prototype&&!!Function.prototype.bind&&!!Object.keys&&!!Object.create&&!!Object.getPrototypeOf&&!!Object.getOwnPropertyNames&&!!Object.isSealed&&!!Object.isFrozen&&!!Object.isExtensible&&!!Object.getOwnPropertyDescriptor&&!!Object.defineProperty&&!!Object.defineProperties&&!!Object.seal&&!!Object.freeze&&!!Object.preventExtensions&&!!("JSON"in window&&"parse"in JSON&&"stringify"in JSON)&&!!function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var i,r,n=new Blob([""],{type:"text/javascript"}),o=URL.createObjectURL(n);try{r=new Worker(o),i=!0}catch(s){i=!1}return r&&r.terminate(),URL.revokeObjectURL(o),i}()&&"Uint8ClampedArray"in window&&!!ArrayBuffer.isView&&!!function(){var i=document.createElement("canvas");i.width=i.height=1;var r=i.getContext("2d");if(!r)return!1;var n=r.getImageData(0,0,1,1);return n&&n.width===i.width}()&&(void 0===l[r=i&&i.failIfMajorPerformanceCaveat]&&(l[r]=function(i){var r,n,o,s=(r=document.createElement("canvas"),(n=Object.create(a.webGLContextAttributes)).failIfMajorPerformanceCaveat=i,r.getContext("webgl",n)||r.getContext("experimental-webgl",n));if(!s)return!1;try{o=s.createShader(s.VERTEX_SHADER)}catch(l){return!1}return!(!o||s.isContextLost())&&(s.shaderSource(o,"void main() {}"),s.compileShader(o),!0===s.getShaderParameter(o,s.COMPILE_STATUS))}(r)),!!l[r]&&!document.documentMode)}var l={};function c(i,r){var n=r[0],o=r[1],s=r[2],a=r[3],l=n*a-s*o;return l?(i[0]=a*(l=1/l),i[1]=-o*l,i[2]=-s*l,i[3]=n*l,i):null}function h(i,r){if(Array.isArray(i)){if(!Array.isArray(r)||i.length!==r.length)return!1;for(let n=0;n{i.window.removeEventListener("click",f,!0)},0)},u.mousePos=function(i,r){const n=i.getBoundingClientRect();return m(i,n,r)},u.touchPos=function(i,r){const n=i.getBoundingClientRect(),o=[];for(let s=0;s=0?0:r.button};class _ extends i.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new i.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(i){if(this.loaded!==i&&(this.loaded=i,i)){for(const{ids:r,callback:n}of this.requestors)this._notify(r,n);this.requestors=[]}}getImage(i){return this.images[i]}addImage(i,r){this._validate(i,r)&&(this.images[i]=r)}_validate(r,n){let o=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new i.ErrorEvent(Error(`Image "${r}" has invalid "stretchX" value`))),o=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new i.ErrorEvent(Error(`Image "${r}" has invalid "stretchY" value`))),o=!1),this._validateContent(n.content,n)||(this.fire(new i.ErrorEvent(Error(`Image "${r}" has invalid "content" value`))),o=!1),o}_validateStretch(i,r){if(!i)return!0;let n=0;for(const o of i){if(o[0]{this.ready=!0})}broadcast(r,n,o){i.asyncAll(this.actors,(i,o)=>{i.send(r,n,o)},o=o||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(i=>{i.remove()}),this.actors=[],this.workerPool.release(this.id)}}function C(r,n,o){return n*(i.EXTENT/(r.tileSize*Math.pow(2,o-r.tileID.overscaledZ)))}A.Actor=i.Actor;class z{constructor(i,r,n){this.context=i;const o=i.gl;this.buffer=o.createBuffer(),this.dynamicDraw=Boolean(n),this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete r.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){const r=this.context.gl;this.context.unbindVAO(),this.bind(),r.bufferSubData(r.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const k={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class P{constructor(i,r,n,o){this.length=r.length,this.attributes=n,this.itemSize=r.bytesPerElement,this.dynamicDraw=o,this.context=i;const s=i.gl;this.buffer=s.createBuffer(),i.bindVertexBuffer.set(this.buffer),s.bufferData(s.ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||delete r.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){const r=this.context.gl;this.bind(),r.bufferSubData(r.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,r){for(let n=0;no.pointCoordinate3D(i)),this.cameraGeometry=this.bufferedCameraGeometry(0)}static createFromScreenPoints(r,n){let o,s;if(r instanceof i.pointGeometry||"number"==typeof r[0]){const a=i.pointGeometry.convert(r);o=[i.pointGeometry.convert(r)],s=n.isPointAboveHorizon(a)}else{const l=i.pointGeometry.convert(r[0]),c=i.pointGeometry.convert(r[1]);o=[l,c],s=i.polygonizeBounds(l,c).every(i=>n.isPointAboveHorizon(i))}return new eg(o,n.getCameraPoint(),s,n)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(r){return i.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],r)}bufferedCameraGeometry(r){const n=this.screenBounds[0],o=1===this.screenBounds.length?this.screenBounds[0].add(new i.pointGeometry(1,1)):this.screenBounds[1],s=i.polygonizeBounds(n,o,0,!1);return this.cameraPoint.y>o.y&&(this.cameraPoint.x>n.x&&this.cameraPoint.x=o.x?s[2]=this.cameraPoint:this.cameraPoint.x<=n.x&&(s[3]=this.cameraPoint)),i.bufferConvexPolygon(s,r)}containsTile(r,n,o){var s;const a=r.queryPadding+1,l=r.tileID.wrap,c=o?this._bufferedCameraMercator(a,n).map(n=>i.getTilePoint(r.tileTransform,n,l)):this._bufferedScreenMercator(a,n).map(n=>i.getTilePoint(r.tileTransform,n,l)),h=this.screenGeometryMercator.map(n=>i.getTileVec3(r.tileTransform,n,l)),u=h.map(r=>new i.pointGeometry(r[0],r[1])),d=n.getFreeCameraOptions().position||new i.MercatorCoordinate(0,0,0),p=i.getTileVec3(r.tileTransform,d,l),f=h.map(r=>{const n=i.sub(r,r,p);return i.normalize(n,n),new i.Ray(p,n)}),m=C(r,1,n.zoom);if(i.polygonIntersectsBox(c,0,0,i.EXTENT,i.EXTENT))return{queryGeometry:this,tilespaceGeometry:u,tilespaceRays:f,bufferedTilespaceGeometry:c,bufferedTilespaceBounds:((s=i.getBounds(c)).min.x=i.clamp(s.min.x,0,i.EXTENT),s.min.y=i.clamp(s.min.y,0,i.EXTENT),s.max.x=i.clamp(s.max.x,0,i.EXTENT),s.max.y=i.clamp(s.max.y,0,i.EXTENT),s),tile:r,tileID:r.tileID,pixelToTileUnitsFactor:m}}_bufferedScreenMercator(i,r){const n=100*i|0;if(this._screenRaycastCache[n])return this._screenRaycastCache[n];{const o=this.bufferedScreenGeometry(i).map(i=>r.pointCoordinate3D(i));return this._screenRaycastCache[n]=o,o}}_bufferedCameraMercator(i,r){const n=100*i|0;if(this._cameraRaycastCache[n])return this._cameraRaycastCache[n];{const o=this.bufferedCameraGeometry(i).map(i=>r.pointCoordinate3D(i));return this._cameraRaycastCache[n]=o,o}}}function ey(r,n,o){const s=function(s,a){if(s)return o(s);if(a){const l=i.pick(i.extend(a,r),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);a.vector_layers&&(l.vectorLayers=a.vector_layers,l.vectorLayerIds=l.vectorLayers.map(i=>i.id)),l.tiles=n.canonicalizeTileset(l,r.url),o(null,l)}};return r.url?i.getJSON(n.transformRequest(n.normalizeSourceURL(r.url),i.ResourceType.Source),s):i.exported.frame(()=>s(null,r))}class ex{constructor(r,n,o){this.bounds=i.LngLatBounds.convert(this.validateBounds(r)),this.minzoom=n||0,this.maxzoom=o||24}validateBounds(i){return Array.isArray(i)&&4===i.length?[Math.max(-180,i[0]),Math.max(-90,i[1]),Math.min(180,i[2]),Math.min(90,i[3])]:[-180,-90,180,90]}contains(r){const n=Math.pow(2,r.z),o=Math.floor(i.mercatorXfromLng(this.bounds.getWest())*n),s=Math.floor(i.mercatorYfromLat(this.bounds.getNorth())*n),a=Math.ceil(i.mercatorXfromLng(this.bounds.getEast())*n),l=Math.ceil(i.mercatorYfromLat(this.bounds.getSouth())*n);return r.x>=o&&r.x=s&&r.y{this._tileJSONRequest=null,this._loaded=!0,r?this.fire(new i.ErrorEvent(r)):n&&(i.extend(this,n),n.bounds&&(this.tileBounds=new ex(n.bounds,this.minzoom,this.maxzoom)),i.postTurnstileEvent(n.tiles),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(i){this.map=i,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return i.extend({},this._options)}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}loadTile(r,n){const o=i.exported.devicePixelRatio>=2,s=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),o,this.tileSize);r.request=i.getImage(this.map._requestManager.transformRequest(s,i.ResourceType.Tile),(o,s,a,l)=>{if(delete r.request,r.aborted)r.state="unloaded",n(null);else if(o)r.state="errored",n(o);else if(s){this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:a,expires:l});const c=this.map.painter.context,h=c.gl;r.texture=this.map.painter.getTileTexture(s.width),r.texture?r.texture.update(s,{useMipmap:!0}):(r.texture=new i.Texture(c,s,h.RGBA,{useMipmap:!0}),r.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE),c.extTextureFilterAnisotropic&&h.texParameterf(h.TEXTURE_2D,c.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,c.extTextureFilterAnisotropicMax)),r.state="loaded",i.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(i,r){i.request&&(i.request.cancel(),delete i.request),r()}unloadTile(i,r){i.texture&&this.map.painter.saveTileTexture(i.texture),r()}hasTransition(){return!1}}function eb(r,n,o,s,a,l,c,h){const u=[r,o,a,n,s,l,1,1,1],d=[c,h,1],p=i.adjoint([],u),[f,m,_]=i.transformMat3(d,d,i.transpose(p,p));return i.multiply(u,[f,0,0,0,m,0,0,0,_],u)}class ew extends i.Evented{constructor(i,r,n,o){super(),this.id=i,this.dispatcher=n,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=r}load(r,n){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this.url=this.options.url,i.getImage(this.map._requestManager.transformRequest(this.url,i.ResourceType.Image),(o,s)=>{this._loaded=!0,o?this.fire(new i.ErrorEvent(o)):s&&(this.image=i.exported.getImageData(s),this.width=this.image.width,this.height=this.image.height,r&&(this.coordinates=r),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(i){return this.image&&i.url&&(this.options.url=i.url,this.load(i.coordinates,()=>{this.texture=null})),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(i){this.map=i,this.load()}setCoordinates(r){this.coordinates=r,delete this._boundsArray;const n=r.map(i.MercatorCoordinate.fromLngLat);return this.tileID=function(r){let n=1/0,o=1/0,s=-1/0,a=-1/0;for(const l of r)n=Math.min(n,l.x),o=Math.min(o,l.y),s=Math.max(s,l.x),a=Math.max(a,l.y);const c=Math.max(s-n,a-o),h=Math.max(0,Math.floor(-Math.log(c)/Math.LN2)),u=Math.pow(2,h);return new i.CanonicalTileID(h,Math.floor((n+s)/2*u),Math.floor((o+a)/2*u))}(n),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){delete this._boundsArray}_makeBoundsArray(){const r=i.tileTransform(this.tileID,this.map.transform.projection),[n,o,s,a]=this.coordinates.map(n=>{const o=r.projection.project(n[0],n[1]);return i.getTilePoint(r,o)._round()});return this.perspectiveTransform=function(r,n,o,s,a,l,c,h,u,d){const p=eb(0,0,r,0,0,n,r,n),f=eb(o,s,a,l,c,h,u,d);return i.multiply(f,i.adjoint(p,p),f),[f[6]/f[8]*r/i.EXTENT,f[7]/f[8]*n/i.EXTENT]}(this.width,this.height,n.x,n.y,o.x,o.y,a.x,a.y,s.x,s.y),this._boundsArray=new i.StructArrayLayout4i8,this._boundsArray.emplaceBack(n.x,n.y,0,0),this._boundsArray.emplaceBack(o.x,o.y,i.EXTENT,0),this._boundsArray.emplaceBack(a.x,a.y,0,i.EXTENT),this._boundsArray.emplaceBack(s.x,s.y,i.EXTENT,i.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const r=this.map.painter.context,n=r.gl;for(const o in this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,i.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new i.Texture(r,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this.tiles){const s=this.tiles[o];"loaded"!==s.state&&(s.state="loaded",s.texture=this.texture)}}loadTile(i,r){this.tileID&&this.tileID.equals(i.tileID.canonical)?(this.tiles[String(i.tileID.wrap)]=i,i.buckets={},r(null)):(i.state="errored",r(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const eT={vector:class extends i.Evented{constructor(r,n,o,s){if(super(),this.id=r,this.dispatcher=o,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,i.extend(this,i.pick(n,["url","scheme","tileSize","promoteId"])),this._options=i.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(s),this._tileWorkers={},this._deduped=new i.DedupedRequest}load(){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=ey(this._options,this.map._requestManager,(r,n)=>{this._tileJSONRequest=null,this._loaded=!0,r?this.fire(new i.ErrorEvent(r)):n&&(i.extend(this,n),n.bounds&&(this.tileBounds=new ex(n.bounds,this.minzoom,this.maxzoom)),i.postTurnstileEvent(n.tiles,this.map._requestManager._customAccessToken),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}onAdd(i){this.map=i,this.load()}setSourceProperty(i){this._tileJSONRequest&&this._tileJSONRequest.cancel(),i();const r=this.map.style._getSourceCaches(this.id);for(const n of r)n.clearTiles();this.load()}setTiles(i){return this.setSourceProperty(()=>{this._options.tiles=i}),this}setUrl(i){return this.setSourceProperty(()=>{this.url=i,this._options.url=i}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return i.extend({},this._options)}loadTile(r,n){const o=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme)),s={request:this.map._requestManager.transformRequest(o,i.ResourceType.Tile),data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:i.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:r.isSymbolTile};if(s.request.collectResourceTiming=this._collectResourceTiming,r.actor&&"expired"!==r.state)"loading"===r.state?r.reloadCallback=n:r.request=r.actor.send("reloadTile",s,l.bind(this));else if(r.actor=this._tileWorkers[o]=this._tileWorkers[o]||this.dispatcher.getActor(),this.dispatcher.ready)r.request=r.actor.send("loadTile",s,l.bind(this),void 0,!0);else{const a=i.loadVectorTile.call({deduped:this._deduped},s,(i,n)=>{i||!n?l.call(this,i):(s.data={cacheControl:n.cacheControl,expires:n.expires,rawData:n.rawData.slice(0)},r.actor&&r.actor.send("loadTile",s,l.bind(this),void 0,!0))},!0);r.request={cancel:a}}function l(o,s){return delete r.request,r.aborted?n(null):o&&404!==o.status?n(o):(s&&s.resourceTiming&&(r.resourceTiming=s.resourceTiming),this.map._refreshExpiredTiles&&s&&r.setExpiryData(s),r.loadVectorData(s,this.map.painter),i.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(r.reloadCallback&&(this.loadTile(r,r.reloadCallback),r.reloadCallback=null)))}}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.actor&&i.actor.send("abortTile",{uid:i.uid,type:this.type,source:this.id})}unloadTile(i){i.unloadVectorData(),i.actor&&i.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}},raster:ev,"raster-dem":class extends ev{constructor(r,n,o,s){super(r,n,o,s),this.type="raster-dem",this.maxzoom=22,this._options=i.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}loadTile(r,o){const s=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function a(i,n){i&&(r.state="errored",o(i)),n&&(r.dem=n,r.dem.onDeserialize(),r.needsHillshadePrepare=!0,r.needsDEMTextureUpload=!0,r.state="loaded",o(null))}r.request=i.getImage(this.map._requestManager.transformRequest(s,i.ResourceType.Tile),(function(s,l,c,h){if(delete r.request,r.aborted)r.state="unloaded",o(null);else if(s)r.state="errored",o(s);else if(l){this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:c,expires:h});const u=i.window.ImageBitmap&&l instanceof i.window.ImageBitmap&&(null==n&&(n=i.window.OffscreenCanvas&&new i.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof i.window.createImageBitmap),n),d=1-(l.width-i.prevPowerOfTwo(l.width))/2;d<1||r.neighboringTiles||(r.neighboringTiles=this._getNeighboringTiles(r.tileID));const p=u?l:i.exported.getImageData(l,d),f={uid:r.uid,coord:r.tileID,source:this.id,rawImageData:p,encoding:this.encoding,padding:d};r.actor&&"expired"!==r.state||(r.actor=this.dispatcher.getActor(),r.actor.send("loadDEMTile",f,a.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(r){const n=r.canonical,o=Math.pow(2,n.z),s=(n.x-1+o)%o,a=0===n.x?r.wrap-1:r.wrap,l=(n.x+1+o)%o,c=n.x+1===o?r.wrap+1:r.wrap,h={};return h[new i.OverscaledTileID(r.overscaledZ,a,n.z,s,n.y).key]={backfilled:!1},h[new i.OverscaledTileID(r.overscaledZ,c,n.z,l,n.y).key]={backfilled:!1},n.y>0&&(h[new i.OverscaledTileID(r.overscaledZ,a,n.z,s,n.y-1).key]={backfilled:!1},h[new i.OverscaledTileID(r.overscaledZ,r.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},h[new i.OverscaledTileID(r.overscaledZ,c,n.z,l,n.y-1).key]={backfilled:!1}),n.y+1{if(this._loaded=!0,this._pendingLoad=null,r)this.fire(new i.ErrorEvent(r));else{const o={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&n&&n.resourceTiming&&n.resourceTiming[this.id]&&(o.resourceTiming=n.resourceTiming[this.id]),this.fire(new i.Event("data",o)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(r,n){const o=r.actor?"reloadTile":"loadTile";r.actor=this.actor,r.request=this.actor.send(o,{type:this.type,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:i.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(i,s)=>(delete r.request,r.unloadVectorData(),r.aborted?n(null):i?n(i):(r.loadVectorData(s,this.map.painter,"reloadTile"===o),n(null))),void 0,"loadTile"===o)}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.aborted=!0}unloadTile(i){i.unloadVectorData(),this.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return i.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends ew{constructor(i,r,n,o){super(i,r,n,o),this.roundZoom=!0,this.type="video",this.options=r}load(){this._loaded=!1;const r=this.options;for(const n of(this.urls=[],r.urls))this.urls.push(this.map._requestManager.transformRequest(n,i.ResourceType.Source).url);i.getVideo(this.urls,(r,n)=>{this._loaded=!0,r?this.fire(new i.ErrorEvent(r)):n&&(this.video=n,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(r){if(this.video){const n=this.video.seekable;rn.end(0)?this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=r}}getVideo(){return this.video}onAdd(i){this.map||(this.map=i,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const r=this.map.painter.context,n=r.gl;for(const o in this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new i.Texture(r,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,i.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.tiles){const s=this.tiles[o];"loaded"!==s.state&&(s.state="loaded",s.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:ew,canvas:class extends ew{constructor(r,n,o,s){super(r,n,o,s),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some(i=>!Array.isArray(i)||2!==i.length||i.some(i=>"number"!=typeof i))||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof i.window.HTMLCanvasElement||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof i.window.HTMLCanvasElement?this.options.canvas:i.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new i.ErrorEvent(Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(i){this.map=i,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let r=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,r=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,r=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;const n=this.map.painter.context,o=n.gl;for(const s in this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,i.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(r||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new i.Texture(n,this.canvas,o.RGBA,{premultiply:!0}),this.tiles){const a=this.tiles[s];"loaded"!==a.state&&(a.state="loaded",a.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const i of[this.canvas.width,this.canvas.height])if(isNaN(i)||i<=0)return!0;return!1}}},eE=function(r,n,o,s){const a=new eT[n.type](r,n,o,s);if(a.id!==r)throw Error(`Expected Source id to be ${r} instead of ${a.id}`);return i.bindAll(["load","abort","unload","serialize","prepare"],a),a};function eS(i,r){const n=i.tileID,o=r.tileID;return n.overscaledZ-o.overscaledZ||n.canonical.y-o.canonical.y||n.wrap-o.wrap||n.canonical.x-o.canonical.x}function eI(){return null!=r$.workerClass?new r$.workerClass:new i.window.Worker(r$.workerUrl)}const eM="mapboxgl_preloaded_worker_pool";class eA{constructor(){this.active={}}acquire(i){if(!this.workers)for(this.workers=[];this.workers.length{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[eM]}numActive(){return Object.keys(this.active).length}}function eC(){return o||(o=new eA),o}function ez(r){r=r.slice();const n=Object.create(null);for(let o=0;o{i in n&&(o[i]=n[i])}),o}(r[s],n[r[s].ref]));return r}eA.workerCount=2;const ek={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setProjection:"setProjection"};function eP(i,r,n){n.push({command:ek.addSource,args:[i,r[i]]})}function eD(i,r,n){r.push({command:ek.removeSource,args:[i]}),n[i]=!0}function eL(i,r,n,o,s,a){let l;for(l in r=r||{},i=i||{})i.hasOwnProperty(l)&&(h(i[l],r[l])||n.push({command:a,args:[o,l,r[l],s]}));for(l in r)r.hasOwnProperty(l)&&!i.hasOwnProperty(l)&&(h(i[l],r[l])||n.push({command:a,args:[o,l,r[l],s]}))}function eB(i){return i.id}function eR(i,r){return i[r.id]=r,i}class eF{constructor(i,r){this.reset(i,r)}reset(i,r){this.points=i||[],this._distances=[0];for(let n=1;n0?(s-l)/c:0;return this.points[a].mult(1-h).add(this.points[n].mult(h))}}class eO{constructor(i,r,n){const o=this.boxCells=[],s=this.circleCells=[];this.xCellCount=Math.ceil(i/n),this.yCellCount=Math.ceil(r/n);for(let a=0;athis.width||o<0||r>this.height)return!s&&[];const l=[];if(i<=0&&r<=0&&this.width<=n&&this.height<=o){if(s)return!0;for(let c=0;c0:l}_queryCircle(i,r,n,o,s){const a=i-n,l=i+n,c=r-n,h=r+n;if(l<0||a>this.width||h<0||c>this.height)return!o&&[];const u=[];return this._forEachCell(a,c,l,h,this._queryCellCircle,u,{hitTest:o,circle:{x:i,y:r,radius:n},seenUids:{box:{},circle:{}}},s),o?u.length>0:u}query(i,r,n,o,s){return this._query(i,r,n,o,!1,s)}hitTest(i,r,n,o,s){return this._query(i,r,n,o,!0,s)}hitTestCircle(i,r,n,o){return this._queryCircle(i,r,n,!0,o)}_queryCell(i,r,n,o,s,a,l,c){const h=l.seenUids,u=this.boxCells[s];if(null!==u){const d=this.bboxes;for(const p of u)if(!h.box[p]){h.box[p]=!0;const f=4*p;if(i<=d[f+2]&&r<=d[f+3]&&n>=d[f+0]&&o>=d[f+1]&&(!c||c(this.boxKeys[p]))){if(l.hitTest)return a.push(!0),!0;a.push({key:this.boxKeys[p],x1:d[f],y1:d[f+1],x2:d[f+2],y2:d[f+3]})}}}const m=this.circleCells[s];if(null!==m){const _=this.circles;for(const g of m)if(!h.circle[g]){h.circle[g]=!0;const y=3*g;if(this._circleAndRectCollide(_[y],_[y+1],_[y+2],i,r,n,o)&&(!c||c(this.circleKeys[g]))){if(l.hitTest)return a.push(!0),!0;{const x=_[y],v=_[y+1],b=_[y+2];a.push({key:this.circleKeys[g],x1:x-b,y1:v-b,x2:x+b,y2:v+b})}}}}}_queryCellCircle(i,r,n,o,s,a,l,c){const h=l.circle,u=l.seenUids,d=this.boxCells[s];if(null!==d){const p=this.bboxes;for(const f of d)if(!u.box[f]){u.box[f]=!0;const m=4*f;if(this._circleAndRectCollide(h.x,h.y,h.radius,p[m+0],p[m+1],p[m+2],p[m+3])&&(!c||c(this.boxKeys[f])))return a.push(!0),!0}}const _=this.circleCells[s];if(null!==_){const g=this.circles;for(const y of _)if(!u.circle[y]){u.circle[y]=!0;const x=3*y;if(this._circlesCollide(g[x],g[x+1],g[x+2],h.x,h.y,h.radius)&&(!c||c(this.circleKeys[y])))return a.push(!0),!0}}}_forEachCell(i,r,n,o,s,a,l,c){const h=this._convertToXCellCoord(i),u=this._convertToYCellCoord(r),d=this._convertToXCellCoord(n),p=this._convertToYCellCoord(o);for(let f=h;f<=d;f++)for(let m=u;m<=p;m++)if(s.call(this,i,r,n,o,this.xCellCount*m+f,a,l,c))return}_convertToXCellCoord(i){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(i*this.xScale)))}_convertToYCellCoord(i){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(i*this.yScale)))}_circlesCollide(i,r,n,o,s,a){const l=o-i,c=s-r,h=n+a;return h*h>l*l+c*c}_circleAndRectCollide(i,r,n,o,s,a,l){const c=(a-o)/2,h=Math.abs(i-(o+c));if(h>c+n)return!1;const u=(l-s)/2,d=Math.abs(r-(s+u));if(d>u+n)return!1;if(h<=c||d<=u)return!0;const p=h-c,f=d-u;return p*p+f*f<=n*n}}const eU=Math.tan(85*Math.PI/180);function eV(r,n,o,s,a,l){let h=i.create();if(o){if("globe"===a.projection.name)h=i.calculateGlobeMatrix(a,a.worldSize/a._projectionScaler,[0,0]),i.multiply$1(h,h,i.globeDenormalizeECEF(i.globeTileBounds(n)));else{const u=c([],l);h[0]=u[0],h[1]=u[1],h[4]=u[2],h[5]=u[3]}s||i.rotateZ(h,h,a.angle)}else i.multiply$1(h,a.labelPlaneMatrix,r);return h}function eN(r,n,o,s,a,l){if(o){if("globe"===a.projection.name){const c=eV(r,n,o,s,a,l);return i.invert(c,c),i.multiply$1(c,r,c),c}{const h=i.clone(r),u=i.identity([]);return u[0]=l[0],u[1]=l[1],u[4]=l[2],u[5]=l[3],i.multiply$1(h,h,u),s||i.rotateZ(h,h,-a.angle),h}}return a.glCoordMatrix}function ej(r,n,o=0){const s=[r.x,r.y,o,1];o?i.transformMat4$1(s,s,n):eJ(s,s,n);const a=s[3];return{point:new i.pointGeometry(s[0]/a,s[1]/a),signedDistanceFromCamera:a}}function eG(i,r){return Math.min(.5+i/r*.5,1.5)}function eZ(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_){const g=c.glyphStartIndex+c.numGlyphs,y=c.lineStartIndex,x=c.lineStartIndex+c.lineLength,v=r.getoffsetX(c.glyphStartIndex),b=r.getoffsetX(g-1),w=eH(i*v,n,o,s,a,l,c.segment,y,x,h,u,d,p,f,!0,m,_);if(!w)return null;const T=eH(i*b,n,o,s,a,l,c.segment,y,x,h,u,d,p,f,!0,m,_);return T?{first:w,last:T}:null}function e$(r,n,o,s){return r.writingMode===i.WritingMode.horizontal&&Math.abs(o.y-n.y)>Math.abs(o.x-n.x)*s?{useVertical:!0}:r.writingMode===i.WritingMode.vertical?n.yeU}(n,o,s)?1===r.flipState?{needsFlipping:!0}:null:n.x>o.x?{needsFlipping:!0}:null}function eq(r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x){let v;const b=n/24,w=r.lineOffsetX*b,T=r.lineOffsetY*b;if(r.numGlyphs>1){const E=r.glyphStartIndex+r.numGlyphs,S=r.lineStartIndex,I=r.lineStartIndex+r.lineLength,M=eZ(b,h,w,T,o,p,f,r,u,l,m,g,!1,y,x);if(!M)return{notEnoughRoom:!0};const A=ej(M.first.point,c).point,C=ej(M.last.point,c).point;if(s&&!o){const z=e$(r,A,C,_);if(r.flipState=z&&z.needsFlipping?1:2,z)return z}v=[M.first];for(let k=r.glyphStartIndex+1;k0?B.point:eW(f,L,P,1,a,void 0,y,x.canonical),_);if(r.flipState=R&&R.needsFlipping?1:2,R)return R}const F=eH(b*h.getoffsetX(r.glyphStartIndex),w,T,o,p,f,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,u,l,m,g,!1,!1,y,x);if(!F)return{notEnoughRoom:!0};v=[F]}for(const O of v)i.addDynamicAttributes(d,O.point,O.angle);return{}}function eX(r,n,o,s,a){const l=s.projectTilePoint(r.x,r.y,n);if(!a)return ej(l,o,l.z);const c=a(r);return ej(new i.pointGeometry(l.x+c[0],l.y+c[1]),o,l.z+c[2])}function eW(i,r,n,o,s,a,l,c){const h=eX(i.add(i.sub(r)._unit()),c,s,l,a).point,u=n.sub(h);return n.add(u._mult(o/u.mag()))}function eH(r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x){const v=s?r-n:r+n;let b=v>0?1:-1,w=0;s&&(b*=-1,w=Math.PI),b<0&&(w+=Math.PI);let T=b>0?h+c:h+c+1,E=a,S=a,I=0,M=0;const A=Math.abs(v),C=[],z=[];let k=l;const P=()=>{const r=T-b;return 0===I?l:new i.pointGeometry(d.getx(r),d.gety(r))},D=()=>eW(P(),k,S,A-I+1,p,m,y,x.canonical);for(;I+M<=A;){if((T+=b)=u)return null;if(S=E,C.push(E),_&&z.push(k||P()),void 0===(E=f[T])){k=new i.pointGeometry(d.getx(T),d.gety(T));const L=eX(k,x.canonical,p,y,m);E=L.signedDistanceFromCamera>0?f[T]=L.point:D()}else k=null;I+=M,M=S.dist(E)}g&&m&&(k=k||new i.pointGeometry(d.getx(T),d.gety(T)),f[T]=E=void 0===f[T]?E:D(),M=S.dist(E));const B=(A-I)/M,R=E.sub(S),F=R.mult(B)._add(S);o&&F._add(R._unit()._perp()._mult(o*b));const O=w+Math.atan2(E.y-S.y,E.x-S.x);return C.push(F),_&&(k=k||new i.pointGeometry(d.getx(T),d.gety(T)),z.push(function(r,n,o){const s=1-o;return new i.pointGeometry(r.x*s+n.x*o,r.y*s+n.y*o)}(z.length>0?z[z.length-1]:k,k,B))),{point:F,angle:O,path:C,tilePath:z}}const eK=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function eY(i,r){for(let n=0;n[0,0,0],b=new i.pointGeometry(n.tileAnchorX,n.tileAnchorY),w=this.transform.projection.projectTilePoint(n.tileAnchorX,n.tileAnchorY,_.canonical),T=v(b),E=[w.x+T[0],w.y+T[1],w.z+T[2]],S=this.projectAndGetPerspectiveRatio(l,E[0],E[1],E[2],_),{perspectiveRatio:I}=S,M=(d?a/I:a*I)/i.ONE_EM,A=ej(new i.pointGeometry(E[0],E[1]),c,E[2]).point,C=S.signedDistanceFromCamera>0?eZ(M,s,n.lineOffsetX*M,n.lineOffsetY*M,!1,A,b,n,o,c,{},y&&!d?v:null,d&&!!y,this.transform.projection,_):null;let z=!1,k=!1,P=!0;if(C&&!S.aboveHorizon){const D=.5*f*I+m,L=new i.pointGeometry(-100,-100),B=new i.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),R=new eF,F=C.first,O=C.last;let U=[];for(let V=F.path.length-1;V>=1;V--)U.push(F.path[V]);for(let N=1;N{const n=v(rej(i,h));U=G.some(i=>i.signedDistanceFromCamera<=0)?[]:G.map(i=>i.point)}let Z=[];if(U.length>0){const $=U[0].clone(),q=U[0].clone();for(let X=1;X=L.x&&q.x<=B.x&&$.y>=L.y&&q.y<=B.y?[U]:q.xB.x||q.yB.y?[]:i.clipLine([U],L.x,L.y,B.x,B.y)}for(const W of Z){R.reset(W,.25*D);let H=0;H=R.length<=.5*D?1:Math.ceil(R.paddedLength/j)+1;for(let K=0;K0){i.transformMat4$1(l,l,r);let h=!1;this.fogState&&a&&(h=function(r,n,o,s,a,l){const c=l.calculateFogTileMatrix(a),h=[n,o,s];return i.transformMat4(h,h,c),T(r,h,l.pitch,l._fov)}(this.fogState,n,o,s||0,a.toUnwrapped(),this.transform)>.9),c=l[2]>l[3]||h}else eJ(l,l,r);return{point:new i.pointGeometry((l[0]/l[3]+1)/2*this.transform.width+100,(-l[1]/l[3]+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.cameraToCenterDistance/l[3]*.5,1.5),signedDistanceFromCamera:l[3],aboveHorizon:c}}isOffscreen(i,r,n,o){return n<100||i>=this.screenRightBoundary||o<100||r>this.screenBottomBoundary}isInsideGrid(i,r,n,o){return n>=0&&i=0&&ri.collisionGroupID===r}}return this.collisionGroups[i]}}function e6(r,n,o,s,a){const{horizontalAlign:l,verticalAlign:c}=i.getAnchorAlignment(r),h=i.evaluateVariableOffset(r,s);return new i.pointGeometry(-(l-.5)*n+h[0]*a,-(c-.5)*o+h[1]*a)}function e8(r,n,o,s,a){const l=new i.pointGeometry(r,n);return o&&l._rotate(s?a:-a),l}class e9{constructor(i,r,n,o,s){this.transform=i.clone(),this.collisionIndex=new eQ(this.transform,s),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new e4(n),this.collisionCircleArrays={},this.prevPlacement=o,o&&(o.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(r,n,o,s){const a=o.getBucket(n),l=o.latestFeatureIndex;if(!a||!l||n.id!==a.layerIds[0])return;const c=a.layers[0].layout,h=o.collisionBoxArray,u=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),d=o.tileSize/i.EXTENT,p=o.tileID.toUnwrapped(),f=this.transform.calculateProjMatrix(p),m="map"===c.get("text-pitch-alignment"),_="map"===c.get("text-rotation-alignment");n.compileFilter();const g=n.dynamicFilter(),y=n.dynamicFilterNeedsFeature(),x=this.transform.calculatePixelsToTileUnitsMatrix(o),v=eV(f,o.tileID.canonical,m,_,this.transform,x);let b=null;if(m){const w=eN(f,o.tileID.canonical,m,_,this.transform,x);b=i.multiply$1([],this.transform.labelPlaneMatrix,w)}let T=null;g&&o.latestFeatureIndex&&(T={unwrappedTileID:p,dynamicFilter:g,dynamicFilterNeedsFeature:y,featureIndex:o.latestFeatureIndex}),this.retainedQueryData[a.bucketInstanceId]=new e5(a.bucketInstanceId,l,a.sourceLayerIndex,a.index,o.tileID);const E={bucket:a,layout:c,posMatrix:f,textLabelPlaneMatrix:v,labelToScreenMatrix:b,clippingData:T,scale:u,textPixelRatio:d,holdingForFade:o.holdingForFade(),collisionBoxArray:h,partiallyEvaluatedTextSize:i.evaluateSizeForZoom(a.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:i.evaluateSizeForZoom(a.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(s)for(const S of a.sortKeyRanges){const{sortKey:I,symbolInstanceStart:M,symbolInstanceEnd:A}=S;r.push({sortKey:I,symbolInstanceStart:M,symbolInstanceEnd:A,parameters:E})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:E})}attemptAnchorPlacement(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x){const v=[p.textOffset0,p.textOffset1],b=e6(i,n,o,v,s),w=this.collisionIndex.placeCollisionBox(s,r,e8(b.x,b.y,a,l,this.transform.angle),d,c,h,u.predicate);if((!g||0!==this.collisionIndex.placeCollisionBox(m.getSymbolInstanceIconSize(x,this.transform.zoom,f),g,e8(b.x,b.y,a,l,this.transform.angle),d,c,h,u.predicate).box.length)&&w.box.length>0){let T;return this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(T=this.prevPlacement.variableOffsets[p.crossTileID].anchor),this.variableOffsets[p.crossTileID]={textOffset:v,width:n,height:o,anchor:i,textScale:s,prevAnchor:T},this.markUsedJustification(m,i,p,_),m.allowVerticalPlacement&&(this.markUsedOrientation(m,_,p),this.placedOrientations[p.crossTileID]=_),{shift:b,placedGlyphBoxes:w}}}placeLayerBucketPart(r,n,o,s){const{bucket:a,layout:l,posMatrix:c,textLabelPlaneMatrix:h,labelToScreenMatrix:u,clippingData:d,textPixelRatio:p,holdingForFade:f,collisionBoxArray:m,partiallyEvaluatedTextSize:_,partiallyEvaluatedIconSize:g,collisionGroup:y}=r.parameters,x=l.get("text-optional"),v=l.get("icon-optional"),b=l.get("text-allow-overlap"),w=l.get("icon-allow-overlap"),T="map"===l.get("text-rotation-alignment"),E="map"===l.get("text-pitch-alignment"),S="none"!==l.get("icon-text-fit"),I="viewport-y"===l.get("symbol-z-order"),M=b&&(w||!a.hasIconData()||v),A=w&&(b||!a.hasTextData()||x);!a.collisionArrays&&m&&a.deserializeCollisionBoxes(m),o&&s&&a.updateCollisionDebugBuffers(this.transform.zoom,m);const C=(r,s,m)=>{if(d){const I={zoom:this.transform.zoom,pitch:this.transform.pitch};let C=null;if(d.dynamicFilterNeedsFeature){const z=this.retainedQueryData[a.bucketInstanceId];C=d.featureIndex.loadFeature({featureIndex:r.featureIndex,bucketIndex:z.bucketIndex,sourceLayerIndex:z.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,d.dynamicFilter)(I,C,this.retainedQueryData[a.bucketInstanceId].tileID.canonical,new i.pointGeometry(r.tileAnchorX,r.tileAnchorY),this.transform.calculateDistanceTileData(d.unwrappedTileID)))return this.placements[r.crossTileID]=new e2(!1,!1,!1,!0),void(n[r.crossTileID]=!0)}if(n[r.crossTileID])return;if(f)return void(this.placements[r.crossTileID]=new e2(!1,!1,!1));let k=!1,P=!1,D=!0,L=null,B={box:null,offscreen:null},R={box:null,offscreen:null},F=null,O=null,U=null,V=0,N=0,j=0;m.textFeatureIndex?V=m.textFeatureIndex:r.useRuntimeCollisionCircles&&(V=r.featureIndex),m.verticalTextFeatureIndex&&(N=m.verticalTextFeatureIndex);const G=i=>{i.tileID=this.retainedQueryData[a.bucketInstanceId].tileID,(this.transform.elevation||i.elevation)&&(i.elevation=this.transform.elevation?this.transform.elevation.getAtTileOffset(this.retainedQueryData[a.bucketInstanceId].tileID,i.tileAnchorX,i.tileAnchorY):0)},Z=m.textBox;if(Z){G(Z);const $=n=>{let o=i.WritingMode.horizontal;if(a.allowVerticalPlacement&&!n&&this.prevPlacement){const s=this.prevPlacement.placedOrientations[r.crossTileID];s&&(this.placedOrientations[r.crossTileID]=s,o=s,this.markUsedOrientation(a,o,r))}return o},q=(n,o)=>{if(a.allowVerticalPlacement&&r.numVerticalGlyphVertices>0&&m.verticalTextBox){for(const s of a.writingModes)if(s===i.WritingMode.vertical?R=B=o():B=n(),B&&B.box&&B.box.length)break}else B=n()};if(l.get("text-variable-anchor")){let X=l.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[r.crossTileID]){const W=this.prevPlacement.variableOffsets[r.crossTileID];X.indexOf(W.anchor)>0&&(X=X.filter(i=>i!==W.anchor)).unshift(W.anchor)}const H=(i,n,o)=>{const l=a.getSymbolInstanceTextSize(_,r,this.transform.zoom,s),h=(i.x2-i.x1)*l+2*i.padding,u=(i.y2-i.y1)*l+2*i.padding,d=S&&!w?n:null;d&&G(d);let f={box:[],offscreen:!1};const m=b?2*X.length:X.length;for(let x=0;x=X.length,r,s,a,o,d,_,g);if(v&&(f=v.placedGlyphBoxes)&&f.box&&f.box.length){k=!0,L=v.shift;break}}return f};q(()=>H(Z,m.iconBox,i.WritingMode.horizontal),()=>{const n=m.verticalTextBox;return n&&G(n),a.allowVerticalPlacement&&!(B&&B.box&&B.box.length)&&r.numVerticalGlyphVertices>0&&n?H(n,m.verticalIconBox,i.WritingMode.vertical):{box:null,offscreen:null}}),B&&(k=B.box,D=B.offscreen);const K=$(B&&B.box);if(!k&&this.prevPlacement){const Y=this.prevPlacement.variableOffsets[r.crossTileID];Y&&(this.variableOffsets[r.crossTileID]=Y,this.markUsedJustification(a,Y.anchor,r,K))}}else{const J=(n,o)=>{const l=a.getSymbolInstanceTextSize(_,r,this.transform.zoom,s),h=this.collisionIndex.placeCollisionBox(l,n,new i.pointGeometry(0,0),b,p,c,y.predicate);return h&&h.box&&h.box.length&&(this.markUsedOrientation(a,o,r),this.placedOrientations[r.crossTileID]=o),h};q(()=>J(Z,i.WritingMode.horizontal),()=>{const n=m.verticalTextBox;return a.allowVerticalPlacement&&r.numVerticalGlyphVertices>0&&n?(G(n),J(n,i.WritingMode.vertical)):{box:null,offscreen:null}}),$(B&&B.box&&B.box.length)}}if(k=(F=B)&&F.box&&F.box.length>0,D=F&&F.offscreen,r.useRuntimeCollisionCircles){const Q=a.text.placedSymbolArray.get(r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex),ee=i.evaluateSizeForFeature(a.textSizeData,_,Q),et=l.get("text-padding");O=this.collisionIndex.placeCollisionCircles(b,Q,a.lineVertexArray,a.glyphOffsetArray,ee,c,h,u,o,E,y.predicate,r.collisionCircleDiameter*ee/i.ONE_EM,et,this.retainedQueryData[a.bucketInstanceId].tileID),k=b||O.circles.length>0&&!O.collisionDetected,D=D&&O.offscreen}if(m.iconFeatureIndex&&(j=m.iconFeatureIndex),m.iconBox){const ei=r=>{G(r);const n=S&&L?e8(L.x,L.y,T,E,this.transform.angle):new i.pointGeometry(0,0),o=a.getSymbolInstanceIconSize(g,this.transform.zoom,s);return this.collisionIndex.placeCollisionBox(o,r,n,w,p,c,y.predicate)};P=R&&R.box&&R.box.length&&m.verticalIconBox?(U=ei(m.verticalIconBox)).box.length>0:(U=ei(m.iconBox)).box.length>0,D=D&&U.offscreen}const er=x||0===r.numHorizontalGlyphVertices&&0===r.numVerticalGlyphVertices,en=v||0===r.numIconVertices;if(er||en?en?er||(P=P&&k):k=P&&k:P=k=P&&k,k&&F&&F.box&&this.collisionIndex.insertCollisionBox(F.box,l.get("text-ignore-placement"),a.bucketInstanceId,R&&R.box&&N?N:V,y.ID),P&&U&&this.collisionIndex.insertCollisionBox(U.box,l.get("icon-ignore-placement"),a.bucketInstanceId,j,y.ID),O&&(k&&this.collisionIndex.insertCollisionCircles(O.circles,l.get("text-ignore-placement"),a.bucketInstanceId,V,y.ID),o)){const eo=a.bucketInstanceId;let es=this.collisionCircleArrays[eo];void 0===es&&(es=this.collisionCircleArrays[eo]=new e3);for(let ea=0;ea=0;--k){const P=z[k];C(a.symbolInstances.get(P),P,a.collisionArrays[P])}}else for(let D=r.symbolInstanceStart;D=0&&(r.text.placedSymbolArray.get(c).crossTileID=a>=0&&c!==a?0:o.crossTileID)}markUsedOrientation(r,n,o){const s=n===i.WritingMode.horizontal||n===i.WritingMode.horizontalOnly?n:0,a=n===i.WritingMode.vertical?n:0,l=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex];for(const c of l)r.text.placedSymbolArray.get(c).placedOrientation=s;o.verticalPlacedTextSymbolIndex&&(r.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(i){this.commitTime=i,this.zoomAtLastRecencyCheck=this.transform.zoom;const r=this.prevPlacement;let n=!1;this.prevZoomAdjustment=r?r.zoomAdjustment(this.transform.zoom):0;const o=r?r.symbolFadeChange(i):1,s=r?r.opacities:{},a=r?r.variableOffsets:{},l=r?r.placedOrientations:{};for(const c in this.placements){const h=this.placements[c],u=s[c];u?(this.opacities[c]=new e1(u,o,h.text,h.icon,null,h.clipped),n=n||h.text!==u.text.placed||h.icon!==u.icon.placed):(this.opacities[c]=new e1(null,o,h.text,h.icon,h.skipFade,h.clipped),n=n||h.text||h.icon)}for(const d in s){const p=s[d];if(!this.opacities[d]){const f=new e1(p,o,!1,!1);f.isHidden()||(this.opacities[d]=f,n=n||p.text.placed||p.icon.placed)}}for(const m in a)this.variableOffsets[m]||!this.opacities[m]||this.opacities[m].isHidden()||(this.variableOffsets[m]=a[m]);for(const _ in l)this.placedOrientations[_]||!this.opacities[_]||this.opacities[_].isHidden()||(this.placedOrientations[_]=l[_]);n?this.lastPlacementChangeTime=i:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=r?r.lastPlacementChangeTime:i)}updateLayerOpacities(i,r){const n={};for(const o of r){const s=o.getBucket(i);s&&o.latestFeatureIndex&&i.id===s.layerIds[0]&&this.updateBucketOpacities(s,n,o.collisionBoxArray)}}updateBucketOpacities(r,n,o){r.hasTextData()&&r.text.opacityVertexArray.clear(),r.hasIconData()&&r.icon.opacityVertexArray.clear(),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();const s=r.layers[0].layout,a=!!r.layers[0].dynamicFilter(),l=new e1(null,0,!1,!1,!0),c=s.get("text-allow-overlap"),h=s.get("icon-allow-overlap"),u=s.get("text-variable-anchor"),d="map"===s.get("text-rotation-alignment"),p="map"===s.get("text-pitch-alignment"),f="none"!==s.get("icon-text-fit"),m=new e1(null,0,c&&(h||!r.hasIconData()||s.get("icon-optional")),h&&(c||!r.hasTextData()||s.get("text-optional")),!0);!r.collisionArrays&&o&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(o);const _=(i,r,n)=>{for(let o=0;o0||b>0,S=x.numIconVertices>0,I=this.placedOrientations[x.crossTileID],M=I===i.WritingMode.vertical,A=I===i.WritingMode.horizontal||I===i.WritingMode.horizontalOnly;if(!E&&!S||T.isHidden()||g++,E){const C=te(T.text);_(r.text,v,M?tt:C),_(r.text,b,A?tt:C);const z=T.text.isHidden();[x.rightJustifiedTextSymbolIndex,x.centerJustifiedTextSymbolIndex,x.leftJustifiedTextSymbolIndex].forEach(i=>{i>=0&&(r.text.placedSymbolArray.get(i).hidden=z||M?1:0)}),x.verticalPlacedTextSymbolIndex>=0&&(r.text.placedSymbolArray.get(x.verticalPlacedTextSymbolIndex).hidden=z||A?1:0);const k=this.variableOffsets[x.crossTileID];k&&this.markUsedJustification(r,k.anchor,x,I);const P=this.placedOrientations[x.crossTileID];P&&(this.markUsedJustification(r,"left",x,P),this.markUsedOrientation(r,P,x))}if(S){const D=te(T.icon);x.placedIconSymbolIndex>=0&&(_(r.icon,x.numIconVertices,M?tt:D),r.icon.placedSymbolArray.get(x.placedIconSymbolIndex).hidden=T.icon.isHidden()),x.verticalPlacedIconSymbolIndex>=0&&(_(r.icon,x.numVerticalIconVertices,A?tt:D),r.icon.placedSymbolArray.get(x.verticalPlacedIconSymbolIndex).hidden=T.icon.isHidden())}if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){const L=r.collisionArrays[y];if(L){let B=new i.pointGeometry(0,0),R=!0;if(L.textBox||L.verticalTextBox){if(u){const F=this.variableOffsets[w];F?(B=e6(F.anchor,F.width,F.height,F.textOffset,F.textScale),d&&B._rotate(p?this.transform.angle:-this.transform.angle)):R=!1}a&&(R=!T.clipped),L.textBox&&e7(r.textCollisionBox.collisionVertexArray,T.text.placed,!R||M,B.x,B.y),L.verticalTextBox&&e7(r.textCollisionBox.collisionVertexArray,T.text.placed,!R||A,B.x,B.y)}const O=R&&Boolean(!A&&L.verticalIconBox);L.iconBox&&e7(r.iconCollisionBox.collisionVertexArray,T.icon.placed,O,f?B.x:0,f?B.y:0),L.verticalIconBox&&e7(r.iconCollisionBox.collisionVertexArray,T.icon.placed,!O,f?B.x:0,f?B.y:0)}}}if(r.fullyClipped=0===g,r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.bucketInstanceId in this.collisionCircleArrays){const U=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=U.invProjMatrix,r.placementViewportMatrix=U.viewportMatrix,r.collisionCircleArray=U.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(i){return 0===this.fadeDuration?1:(i-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(i){return Math.max(0,(this.transform.zoom-i)/1.5)}hasTransitions(i){return this.stale||i-this.lastPlacementChangeTimei}setStale(){this.stale=!0}}function e7(i,r,n,o,s){i.emplaceBack(r?1:0,n?1:0,o||0,s||0),i.emplaceBack(r?1:0,n?1:0,o||0,s||0),i.emplaceBack(r?1:0,n?1:0,o||0,s||0),i.emplaceBack(r?1:0,n?1:0,o||0,s||0)}function te(i){if(0===i.opacity&&!i.placed)return 0;if(1===i.opacity&&i.placed)return 4294967295;const r=i.placed?1:0,n=Math.floor(127*i.opacity);return 33554432*n+16777216*r+131072*n+65536*r+512*n+256*r+2*n+r}const tt=0;class ti{constructor(i){this._sortAcrossTiles="viewport-y"!==i.layout.get("symbol-z-order")&&void 0!==i.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(i,r,n,o,s){const a=this._bucketParts;for(;this._currentTileIndexi.sortKey-r.sortKey));this._currentPartIndex{const r=i.exported.now()-s;return!this._forceFullPlacement&&r>2};for(;this._currentPlacementIndex>=0;){const l=n[r[this._currentPlacementIndex]],c=this.placement.collisionIndex.transform.zoom;if("symbol"===l.type&&(!l.minzoom||l.minzoom<=c)&&(!l.maxzoom||l.maxzoom>c)){if(this._inProgressLayer||(this._inProgressLayer=new ti(l)),this._inProgressLayer.continuePlacement(o[l.source],this.placement,this._showCollisionBoxes,l,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(i){return this.placement.commit(i),this.placement}}const tn=512/i.EXTENT/2;class to{constructor(i,r,n){this.tileID=i,this.indexedSymbolInstances={},this.bucketInstanceId=n;for(let o=0;oi.overscaledZ)for(const c in l){const h=l[c];h.tileID.isChildOf(i)&&h.findMatches(r.symbolInstances,i,s)}else{const u=l[i.scaledTo(Number(a)).key];u&&u.findMatches(r.symbolInstances,i,s)}}for(let d=0;d{r[i]=!0}),this.layerIndexes)r[n]||delete this.layerIndexes[n]}}const tc=(r,n)=>i.emitValidationErrors(r,n&&n.filter(i=>"source.canvas"!==i.identifier)),th=i.pick(ek,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),tu=i.pick(ek,["setCenter","setZoom","setBearing","setPitch"]),td=function(){const r={},n=i.spec.$version;for(const o in i.spec.$root){const s=i.spec.$root[o];if(s.required){let a=null;null!=(a="version"===o?n:"array"===s.type?[]:{})&&(r[o]=a)}}return r}(),tp={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class tf extends i.Evented{constructor(r,n={}){super(),this.map=r,this.dispatcher=new A(eC(),this),this.imageManager=new _,this.imageManager.setEventedParent(this),this.glyphManager=new i.GlyphManager(r._requestManager,n.localFontFamily?i.LocalGlyphMode.all:n.localIdeographFontFamily?i.LocalGlyphMode.ideographs:i.LocalGlyphMode.none,n.localFontFamily||n.localIdeographFontFamily),this.lineAtlas=new i.LineAtlas(256,512),this.crossTileSymbolIndex=new tl,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this.zoomHistory=new i.ZoomHistory,this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedUpdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",i.getReferrer());const o=this;this._rtlTextPluginCallback=tf.registerForPluginStateChange(r=>{o.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:r.pluginStatus,pluginURL:r.pluginURL},(r,n)=>{if(i.triggerPluginCompletionEvent(r),n&&n.every(i=>i))for(const s in o._sourceCaches){const a=o._sourceCaches[s],l=a.getSource().type;"vector"!==l&&"geojson"!==l||a.reload()}})}),this.on("data",i=>{if("source"!==i.dataType||"metadata"!==i.sourceDataType)return;const r=this.getSource(i.sourceId);if(r&&r.vectorLayerIds)for(const n in this._layers){const o=this._layers[n];o.source===r.id&&this._validateLayer(o)}})}loadURL(r,n={}){this.fire(new i.Event("dataloading",{dataType:"style"}));const o="boolean"==typeof n.validate?n.validate:!i.isMapboxURL(r);r=this.map._requestManager.normalizeStyleURL(r,n.accessToken);const s=this.map._requestManager.transformRequest(r,i.ResourceType.Style);this._request=i.getJSON(s,(r,n)=>{this._request=null,r?this.fire(new i.ErrorEvent(r)):n&&this._load(n,o)})}loadJSON(r,n={}){this.fire(new i.Event("dataloading",{dataType:"style"})),this._request=i.exported.frame(()=>{this._request=null,this._load(r,!1!==n.validate)})}loadEmpty(){this.fire(new i.Event("dataloading",{dataType:"style"})),this._load(td,!1)}_updateLayerCount(i,r){const n=r?1:-1;i.is3D()&&(this._num3DLayers+=n),"circle"===i.type&&(this._numCircleLayers+=n),"symbol"===i.type&&(this._numSymbolLayers+=n)}_load(r,n){if(n&&tc(this,i.validateStyle(r)))return;for(const o in this._loaded=!0,this.stylesheet=r,this.updateProjection(),r.sources)this.addSource(o,r.sources[o],{validate:!1});this._changed=!1,r.sprite?this._loadSprite(r.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(r.glyphs);const s=ez(this.stylesheet.layers);for(let a of(this._order=s.map(i=>i.id),this._layers={},this._serializedLayers={},s))(a=i.createStyleLayer(a)).setEventedParent(this,{layer:{id:a.id}}),this._layers[a.id]=a,this._serializedLayers[a.id]=a.serialize(),this._updateLayerCount(a,!0);this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new x(this.stylesheet.light),this.stylesheet.terrain&&!this.terrainSetForDrapingOnly()&&this._createTerrain(this.stylesheet.terrain,1),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),this.fire(new i.Event("data",{dataType:"style"})),this.fire(new i.Event("style.load"))}terrainSetForDrapingOnly(){return this.terrain&&0===this.terrain.drapeRenderMode}setProjection(i){i?this.stylesheet.projection=i:delete this.stylesheet.projection,this.updateProjection()}updateProjection(){const i=this.map.transform.projection,r=this.map.transform.setProjection(this.map._runtimeProjection||(this.stylesheet?this.stylesheet.projection:void 0)),n=this.map.transform.projection;if(this._loaded&&(n.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null)),this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),r){if(n.isReprojectedInTileSpace||i.isReprojectedInTileSpace)for(const o in this.map.painter.clearBackgroundTiles(),this._sourceCaches)this._sourceCaches[o].clearTiles();else this._forceSymbolLayerUpdate();this.map._update(!0)}}_loadSprite(r){this._spriteRequest=function(r,n,o){let s,a,l;const c=i.exported.devicePixelRatio>1?"@2x":"";let h=i.getJSON(n.transformRequest(n.normalizeSpriteURL(r,c,".json"),i.ResourceType.SpriteJSON),(i,r)=>{h=null,l||(l=i,s=r,d())}),u=i.getImage(n.transformRequest(n.normalizeSpriteURL(r,c,".png"),i.ResourceType.SpriteImage),(i,r)=>{u=null,l||(l=i,a=r,d())});function d(){if(l)o(l);else if(s&&a){const r=i.exported.getImageData(a),n={};for(const c in s){const{width:h,height:u,x:d,y:p,sdf:f,pixelRatio:m,stretchX:_,stretchY:g,content:y}=s[c],x=new i.RGBAImage({width:h,height:u});i.RGBAImage.copy(r,x,{x:d,y:p},{x:0,y:0},{width:h,height:u}),n[c]={data:x,pixelRatio:m,sdf:f,stretchX:_,stretchY:g,content:y}}o(null,n)}}return{cancel(){h&&(h.cancel(),h=null),u&&(u.cancel(),u=null)}}}(r,this.map._requestManager,(r,n)=>{if(this._spriteRequest=null,r)this.fire(new i.ErrorEvent(r));else if(n)for(const o in n)this.imageManager.addImage(o,n[o]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new i.Event("data",{dataType:"style"}))})}_validateLayer(r){const n=this.getSource(r.source);if(!n)return;const o=r.sourceLayer;o&&("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(o))&&this.fire(new i.ErrorEvent(Error(`Source layer "${o}" does not exist on source "${n.id}" as specified by style layer "${r.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const i in this._sourceCaches)if(!this._sourceCaches[i].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(i){const r=[];for(const n of i){const o=this._layers[n];"custom"!==o.type&&r.push(o.serialize())}return r}hasTransitions(){if(this.light&&this.light.hasTransition()||this.fog&&this.fog.hasTransition())return!0;for(const i in this._sourceCaches)if(this._sourceCaches[i].hasTransition())return!0;for(const r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(i){return!!this.terrain&&tp[i.type]}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading")}update(r){if(!this._loaded)return;const n=this._changed;if(this._changed){const o=Object.keys(this._updatedLayers),s=Object.keys(this._removedLayers);for(const a in(o.length||s.length)&&this._updateWorkerLayers(o,s),this._updatedSources){const l=this._updatedSources[a];"reload"===l?this._reloadSource(a):"clear"===l&&this._clearSource(a)}for(const c in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[c].updateTransitions(r);this.light.updateTransitions(r),this.fog&&this.fog.updateTransitions(r),this._resetUpdates()}const h={};for(const u in this._sourceCaches){const d=this._sourceCaches[u];h[u]=d.used,d.used=!1}for(const p of this._order){const f=this._layers[p];if(f.recalculate(r,this._availableImages),!f.isHidden(r.zoom)){const m=this._getLayerSourceCache(f);m&&(m.used=!0)}const _=this.map.painter;if(_){const g=f.getProgramIds();if(!g)continue;const y=f.getProgramConfiguration(r.zoom);for(const x of g)_.useProgram(x,y)}}for(const v in h){const b=this._sourceCaches[v];h[v]!==b.used&&b.getSource().fire(new i.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:b.getSource().id}))}this.light.recalculate(r),this.terrain&&this.terrain.recalculate(r),this.fog&&this.fog.recalculate(r),this.z=r.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),n&&this.fire(new i.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const i=Object.keys(this._changedImages);if(i.length){for(const r in this._sourceCaches)this._sourceCaches[r].reloadTilesForDependencies(["icons","patterns"],i);this._changedImages={}}}_updateWorkerLayers(i,r){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(i),removedIds:r})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(r){if(this._checkLoaded(),tc(this,i.validateStyle(r)))return!1;(r=i.clone$1(r)).layers=ez(r.layers);const n=(function(i,r){if(!i)return[{command:ek.setStyle,args:[r]}];let n=[];try{if(!h(i.version,r.version))return[{command:ek.setStyle,args:[r]}];h(i.center,r.center)||n.push({command:ek.setCenter,args:[r.center]}),h(i.zoom,r.zoom)||n.push({command:ek.setZoom,args:[r.zoom]}),h(i.bearing,r.bearing)||n.push({command:ek.setBearing,args:[r.bearing]}),h(i.pitch,r.pitch)||n.push({command:ek.setPitch,args:[r.pitch]}),h(i.sprite,r.sprite)||n.push({command:ek.setSprite,args:[r.sprite]}),h(i.glyphs,r.glyphs)||n.push({command:ek.setGlyphs,args:[r.glyphs]}),h(i.transition,r.transition)||n.push({command:ek.setTransition,args:[r.transition]}),h(i.light,r.light)||n.push({command:ek.setLight,args:[r.light]}),h(i.fog,r.fog)||n.push({command:ek.setFog,args:[r.fog]}),h(i.projection,r.projection)||n.push({command:ek.setProjection,args:[r.projection]});const o={},s=[];!function(i,r,n,o){let s;for(s in r=r||{},i=i||{})i.hasOwnProperty(s)&&(r.hasOwnProperty(s)||eD(s,n,o));for(s in r){var a,l;r.hasOwnProperty(s)&&(i.hasOwnProperty(s)?h(i[s],r[s])||("geojson"===i[s].type&&"geojson"===r[s].type&&function(i,r,n){let o;for(o in i[n])if(i[n].hasOwnProperty(o)&&"data"!==o&&!h(i[n][o],r[n][o]))return!1;for(o in r[n])if(r[n].hasOwnProperty(o)&&"data"!==o&&!h(i[n][o],r[n][o]))return!1;return!0}(i,r,s)?n.push({command:ek.setGeoJSONSourceData,args:[s,r[s].data]}):(a=s,l=r,eD(a,n,o),eP(a,l,n))):eP(s,r,n))}}(i.sources,r.sources,s,o);const a=[];i.layers&&i.layers.forEach(i=>{o[i.source]?n.push({command:ek.removeLayer,args:[i.id]}):a.push(i)});let l=i.terrain;l&&o[l.source]&&(n.push({command:ek.setTerrain,args:[void 0]}),l=void 0),n=n.concat(s),h(l,r.terrain)||n.push({command:ek.setTerrain,args:[r.terrain]}),function(i,r,n){let o,s,a,l,c,u,d;r=r||[];const p=(i=i||[]).map(eB),f=r.map(eB),m=i.reduce(eR,{}),_=r.reduce(eR,{}),g=p.slice(),y=Object.create(null);for(o=0,s=0;o!(i.command in tu));if(0===n.length)return!1;const o=n.filter(i=>!(i.command in th));if(o.length>0)throw Error(`Unimplemented: ${o.map(i=>i.command).join(", ")}.`);return n.forEach(i=>{"setTransition"!==i.command&&this[i.command].apply(this,i.args)}),this.stylesheet=r,this.updateProjection(),!0}addImage(r,n){if(this.getImage(r))return this.fire(new i.ErrorEvent(Error("An image with this name already exists.")));this.imageManager.addImage(r,n),this._afterImageUpdated(r)}updateImage(i,r){this.imageManager.updateImage(i,r)}getImage(i){return this.imageManager.getImage(i)}removeImage(r){if(!this.getImage(r))return this.fire(new i.ErrorEvent(Error("No image with this name exists.")));this.imageManager.removeImage(r),this._afterImageUpdated(r)}_afterImageUpdated(r){this._availableImages=this.imageManager.listImages(),this._changedImages[r]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new i.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(r,n,o={}){if(this._checkLoaded(),void 0!==this.getSource(r))throw Error("There is already a source with this ID");if(!n.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(i.validateStyle.source,`sources.${r}`,n,null,o))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const s=eE(r,n,this.dispatcher,this);s.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:s.serialize(),sourceId:r}));const a=n=>{const o=(n?"symbol:":"other:")+r,a=this._sourceCaches[o]=new i.SourceCache(o,s,n);(n?this._symbolSourceCaches:this._otherSourceCaches)[r]=a,a.style=this,a.onAdd(this.map)};a(!1),"vector"!==n.type&&"geojson"!==n.type||a(!0),s.onAdd&&s.onAdd(this.map),this._changed=!0}removeSource(r){this._checkLoaded();const n=this.getSource(r);if(void 0===n)throw Error("There is no source with this ID");for(const o in this._layers)if(this._layers[o].source===r)return this.fire(new i.ErrorEvent(Error(`Source "${r}" cannot be removed while layer "${o}" is using it.`)));if(this.terrain&&this.terrain.get().source===r)return this.fire(new i.ErrorEvent(Error(`Source "${r}" cannot be removed while terrain is using it.`)));const s=this._getSourceCaches(r);for(const a of s)delete this._sourceCaches[a.id],delete this._updatedSources[a.id],a.fire(new i.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:a.getSource().id})),a.setEventedParent(null),a.clearTiles();delete this._otherSourceCaches[r],delete this._symbolSourceCaches[r],n.setEventedParent(null),n.onRemove&&n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(i,r){this._checkLoaded(),this.getSource(i).setData(r),this._changed=!0}getSource(i){const r=this._getSourceCache(i);return r&&r.getSource()}addLayer(r,n,o={}){let s;this._checkLoaded();const a=r.id;if(this.getLayer(a))return void this.fire(new i.ErrorEvent(Error(`Layer with id "${a}" already exists on this map`)));if("custom"===r.type){if(tc(this,i.validateCustomStyleLayer(r)))return;s=i.createStyleLayer(r)}else{if("object"==typeof r.source&&(this.addSource(a,r.source),r=i.clone$1(r),r=i.extend(r,{source:a})),this._validate(i.validateStyle.layer,`layers.${a}`,r,{arrayIndex:-1},o))return;s=i.createStyleLayer(r),this._validateLayer(s),s.setEventedParent(this,{layer:{id:a}}),this._serializedLayers[s.id]=s.serialize(),this._updateLayerCount(s,!0)}const l=n?this._order.indexOf(n):this._order.length;if(n&&-1===l)return void this.fire(new i.ErrorEvent(Error(`Layer with id "${n}" does not exist on this map.`)));this._order.splice(l,0,a),this._layerOrderChanged=!0,this._layers[a]=s;const c=this._getLayerSourceCache(s);if(this._removedLayers[a]&&s.source&&c&&"custom"!==s.type){const h=this._removedLayers[a];delete this._removedLayers[a],h.type!==s.type?this._updatedSources[s.source]="clear":(this._updatedSources[s.source]="reload",c.pause())}this._updateLayer(s),s.onAdd&&s.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(r,n){if(this._checkLoaded(),this._changed=!0,!this._layers[r])return void this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be moved.`)));if(r===n)return;const o=this._order.indexOf(r);this._order.splice(o,1);const s=n?this._order.indexOf(n):this._order.length;n&&-1===s?this.fire(new i.ErrorEvent(Error(`Layer with id "${n}" does not exist on this map.`))):(this._order.splice(s,0,r),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(r){this._checkLoaded();const n=this._layers[r];if(!n)return void this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be removed.`)));n.setEventedParent(null),this._updateLayerCount(n,!1);const o=this._order.indexOf(r);this._order.splice(o,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[r]=n,delete this._layers[r],delete this._serializedLayers[r],delete this._updatedLayers[r],delete this._updatedPaintProps[r],n.onRemove&&n.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(i){return this._layers[i]}hasLayer(i){return i in this._layers}hasLayerType(i){for(const r in this._layers)if(this._layers[r].type===i)return!0;return!1}setLayerZoomRange(r,n,o){this._checkLoaded();const s=this.getLayer(r);s?s.minzoom===n&&s.maxzoom===o||(null!=n&&(s.minzoom=n),null!=o&&(s.maxzoom=o),this._updateLayer(s)):this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(r,n,o={}){this._checkLoaded();const s=this.getLayer(r);if(s){if(!h(s.filter,n))return null==n?(s.filter=void 0,void this._updateLayer(s)):void(this._validate(i.validateStyle.filter,`layers.${s.id}.filter`,n,{layerType:s.type},o)||(s.filter=i.clone$1(n),this._updateLayer(s)))}else this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be filtered.`)))}getFilter(r){return i.clone$1(this.getLayer(r).filter)}setLayoutProperty(r,n,o,s={}){this._checkLoaded();const a=this.getLayer(r);a?h(a.getLayoutProperty(n),o)||(a.setLayoutProperty(n,o,s),this._updateLayer(a)):this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(r,n){const o=this.getLayer(r);if(o)return o.getLayoutProperty(n);this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style.`)))}setPaintProperty(r,n,o,s={}){this._checkLoaded();const a=this.getLayer(r);a?h(a.getPaintProperty(n),o)||(a.setPaintProperty(n,o,s)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[r]=!0):this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(i,r){return this.getLayer(i).getPaintProperty(r)}setFeatureState(r,n){this._checkLoaded();const o=r.source,s=r.sourceLayer,a=this.getSource(o);if(void 0===a)return void this.fire(new i.ErrorEvent(Error(`The source '${o}' does not exist in the map's style.`)));const l=a.type;if("geojson"===l&&s)return void this.fire(new i.ErrorEvent(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===l&&!s)return void this.fire(new i.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")));void 0===r.id&&this.fire(new i.ErrorEvent(Error("The feature id parameter must be provided.")));const c=this._getSourceCaches(o);for(const h of c)h.setFeatureState(s,r.id,n)}removeFeatureState(r,n){this._checkLoaded();const o=r.source,s=this.getSource(o);if(void 0===s)return void this.fire(new i.ErrorEvent(Error(`The source '${o}' does not exist in the map's style.`)));const a=s.type,l="vector"===a?r.sourceLayer:void 0;if("vector"===a&&!l)return void this.fire(new i.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")));if(n&&"string"!=typeof r.id&&"number"!=typeof r.id)return void this.fire(new i.ErrorEvent(Error("A feature id is required to remove its specific state property.")));const c=this._getSourceCaches(o);for(const h of c)h.removeFeatureState(l,r.id,n)}getFeatureState(r){this._checkLoaded();const n=r.source,o=r.sourceLayer,s=this.getSource(n);if(void 0!==s){if("vector"!==s.type||o)return void 0===r.id&&this.fire(new i.ErrorEvent(Error("The feature id parameter must be provided."))),this._getSourceCaches(n)[0].getFeatureState(o,r.id);this.fire(new i.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new i.ErrorEvent(Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return i.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const r={};for(const n in this._sourceCaches){const o=this._sourceCaches[n].getSource();r[o.id]||(r[o.id]=o.serialize())}return i.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.stylesheet.terrain,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:r,layers:this._serializeLayers(this._order)},i=>void 0!==i)}_updateLayer(i){this._updatedLayers[i.id]=!0;const r=this._getLayerSourceCache(i);i.source&&!this._updatedSources[i.source]&&r&&"raster"!==r.getSource().type&&(this._updatedSources[i.source]="reload",r.pause()),this._changed=!0,i.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(i){const r={},n=[];for(let o=this._order.length-1;o>=0;o--){const s=this._order[o];if("fill-extrusion"===this._layers[s].type)for(const a of(r[s]=o,i)){const l=a[s];if(l)for(const c of l)n.push(c)}}n.sort((i,r)=>r.intersectionZ-i.intersectionZ);const h=[];for(let u=this._order.length-1;u>=0;u--){const d=this._order[u];if("fill-extrusion"===this._layers[d].type)for(let p=n.length-1;p>=0;p--){const f=n[p].feature;if(r[f.layer.id]{const r=this.getLayer(i);return r&&r.is3D()}):this.has3DLayers(),u=eg.createFromScreenPoints(r,o);for(const d in this._sourceCaches){const p=this._sourceCaches[d].getSource().id;n.layers&&!s[p]||c.push(function(r,n,o,s,a,l,c,h=!1){const u=r.tilesIn(s,c,h);u.sort(eS);const d=[];for(const p of u)d.push({wrappedTileID:p.tile.tileID.wrapped().key,queryResults:p.tile.queryRenderedFeatures(n,o,r._state,p,a,l,function(r,n){const o=i.identity([]);return i.scale(o,o,[.5*r.width,-(.5*r.height),1]),i.translate(o,o,[1,-1,0]),i.multiply$1(o,o,r.calculateProjMatrix(n.toUnwrapped()))}(r.transform,p.tile.tileID),h)});const f=function(i){const r={},n={};for(const o of i){const s=o.queryResults,a=o.wrappedTileID,l=n[a]=n[a]||{};for(const c in s){const h=s[c],u=l[c]=l[c]||{},d=r[c]=r[c]||[];for(const p of h)u[p.featureIndex]||(u[p.featureIndex]=!0,d.push(p))}}return r}(d);for(const m in f)f[m].forEach(i=>{const n=i.feature,o=r.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=o});return f}(this._sourceCaches[d],this._layers,this._serializedLayers,u,n,o,h,!!this.map._showQueryGeometry))}return this.placement&&c.push(function(i,r,n,o,s,a,l){const c={},h=a.queryRenderedSymbols(o),u=[];for(const d of Object.keys(h).map(Number))u.push(l[d]);for(const p of(u.sort(eS),u)){const f=p.featureIndex.lookupSymbolFeatures(h[p.bucketInstanceId],r,p.bucketIndex,p.sourceLayerIndex,s.filter,s.layers,s.availableImages,i);for(const m in f){const _=c[m]=c[m]||[],g=f[m];for(const y of(g.sort((i,r)=>{const n=p.featureSortOrder;if(n){const o=n.indexOf(i.featureIndex);return n.indexOf(r.featureIndex)-o}return r.featureIndex-i.featureIndex}),g))_.push(y)}}for(const x in c)c[x].forEach(r=>{const o=r.feature,s=n(i[x]).getFeatureState(o.layer["source-layer"],o.id);o.source=o.layer.source,o.layer["source-layer"]&&(o.sourceLayer=o.layer["source-layer"]),o.state=s});return c}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),u.screenGeometry,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(c)}querySourceFeatures(r,n){n&&n.filter&&this._validate(i.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const o=this._getSourceCaches(r);let s=[];for(const a of o)s=s.concat(function(i,r){const n=i.getRenderableIds().map(r=>i.getTileByID(r)),o=[],s={};for(let a=0;a{for(const i of this.map._markers)i._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(r){if(this._checkLoaded(),!r)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const n=this.fog,o=n.get();for(const s in r)if(!h(r[s],o[s])){n.set(r),this.stylesheet.fog=r;const a={now:i.exported.now(),transition:i.extend({duration:0},this.stylesheet.transition)};n.updateTransitions(a);break}}else this._createFog(r);this._markersNeedUpdate=!0}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const i=this._order.filter(i=>this.isLayerDraped(this._layers[i])),r=this._order.filter(i=>!this.isLayerDraped(this._layers[i]));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...i),this._drapedFirstOrder.push(...r)}_createTerrain(r,n){const o=this.terrain=new w(r,n);this.stylesheet.terrain=r,this.dispatcher.broadcast("enableTerrain",!0),this._force3DLayerUpdate();const s={now:i.exported.now(),transition:i.extend({duration:0},this.stylesheet.transition)};o.updateTransitions(s)}_force3DLayerUpdate(){for(const i in this._layers){const r=this._layers[i];"fill-extrusion"===r.type&&this._updateLayer(r)}}_forceSymbolLayerUpdate(){for(const i in this._layers){const r=this._layers[i];"symbol"===r.type&&this._updateLayer(r)}}_validate(r,n,o,s,a={}){return(!a||!1!==a.validate)&&tc(this,r.call(i.validateStyle,i.extend({key:n,style:this.serialize(),value:o,styleSpec:i.spec},s)))}_remove(){for(const r in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[r].setEventedParent(null);for(const n in this._sourceCaches)this._sourceCaches[n].clearTiles(),this._sourceCaches[n].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(i){const r=this._getSourceCaches(i);for(const n of r)n.clearTiles()}_reloadSource(i){const r=this._getSourceCaches(i);for(const n of r)n.resume(),n.reload()}_updateSources(i){for(const r in this._sourceCaches)this._sourceCaches[r].update(i)}_generateCollisionBoxes(){for(const i in this._sourceCaches){const r=this._sourceCaches[i];r.resume(),r.reload()}}_updatePlacement(r,n,o,s,a=!1){let l=!1,c=!1;const h={};for(const u of this._order){const d=this._layers[u];if("symbol"!==d.type)continue;if(!h[d.source]){const p=this._getLayerSourceCache(d);if(!p)continue;h[d.source]=p.getRenderableIds(!0).map(i=>p.getTileByID(i)).sort((i,r)=>r.tileID.overscaledZ-i.tileID.overscaledZ||(i.tileID.isLessThan(r.tileID)?-1:1))}const f=this.crossTileSymbolIndex.addLayer(d,h[d.source],r.center.lng,r.projection);l=l||f}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a=a||this._layerOrderChanged||0===o,this._layerOrderChanged&&this.fire(new i.Event("neworder")),(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.exported.now(),r.zoom))&&(this.pauseablePlacement=new tr(r,this._order,a,n,o,s,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,h),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.exported.now()),c=!0),l&&this.pauseablePlacement.placement.setStale()),c||l)for(const m of this._order){const _=this._layers[m];"symbol"===_.type&&this.placement.updateLayerOpacities(_,h[_.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(i.exported.now())}_releaseSymbolFadeTiles(){for(const i in this._sourceCaches)this._sourceCaches[i].releaseSymbolFadeTiles()}getImages(i,r,n){this.imageManager.getImages(r.icons,n),this._updateTilesForChangedImages();const o=i=>{i&&i.setDependencies(r.tileID.key,r.type,r.icons)};o(this._otherSourceCaches[r.source]),o(this._symbolSourceCaches[r.source])}getGlyphs(i,r,n){this.glyphManager.getGlyphs(r.stacks,n)}getResource(r,n,o){return i.makeRequest(n,o)}_getSourceCache(i){return this._otherSourceCaches[i]}_getLayerSourceCache(i){return"symbol"===i.type?this._symbolSourceCaches[i.source]:this._otherSourceCaches[i.source]}_getSourceCaches(i){const r=[];return this._otherSourceCaches[i]&&r.push(this._otherSourceCaches[i]),this._symbolSourceCaches[i]&&r.push(this._symbolSourceCaches[i]),r}has3DLayers(){return this._num3DLayers>0}hasSymbolLayers(){return this._numSymbolLayers>0}hasCircleLayers(){return this._numCircleLayers>0}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}tf.getSourceType=function(i){return eT[i]},tf.setSourceType=function(i,r){eT[i]=r},tf.registerForPluginStateChange=i.registerForPluginStateChange;var tm="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#define EXTENT 8192.0\n#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;varying vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}\n#endif",t_="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}";let tg={},ty={};tg=tb("","\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;\n#else\nuniform sampler2D u_dem;uniform sampler2D u_dem_prev;\n#endif\nuniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos));\n#ifdef TERRAIN_DEM_NEAREST_FILTER\nreturn u_exaggeration*tl;\n#endif\nfloat tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem_prev,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {return currentElevation(apos);}\n#endif\nfloat unpack_depth(vec4 rgba_depth)\n{const vec4 bit_shift=vec4(1.0/(256.0*256.0*256.0),1.0/(256.0*256.0),1.0/256.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\nunpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy))\n);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nfloat tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a;\n#else\nvec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack);\n#endif\nreturn vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;vec4 bounds=vec4(d,vec2(1.0)-d);h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\n#endif",!0),ty=tb("#ifdef FOG\nuniform float u_fog_temporal_offset;float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);return mix(color,u_fog_color.rgb,opacity);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif","#ifdef FOG\nuniform mat4 u_fog_matrix;vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",!0);const tx=tb("\nhighp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}\n#ifdef TERRAIN\nhighp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(256.0*256.0*256.0,256.0*256.0,256.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/256.0,1.0/256.0,1.0/256.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#endif","\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#if defined(PROJECTION_GLOBE_VIEW) && !defined(PROJECTED_POS_ON_VIEWPORT)\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {\n#if defined(PROJECTION_GLOBE_VIEW) && !defined(PROJECTED_POS_ON_VIEWPORT)\nreturn mix(globe,mercator,t);\n#else\nreturn globe;\n#endif\n}\n#ifdef PROJECTION_GLOBE_VIEW\nmat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered.");var tv={background:tb("uniform vec4 u_color;uniform float u_opacity;void main() {vec4 out_color=u_color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),backgroundPattern:tb("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_mix);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),circle:tb("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\ngl_FragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;attribute float a_scale;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);\n#ifdef PROJECTION_GLOBE_VIEW\nvec2 scaled_extrude=extrude*a_scale;vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=scaled_extrude.x*surface_vectors[0]+scaled_extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);vec4 world_center=vec4(pos,1);\n#else \nmat3 surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);vec4 world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\n#if defined(SCALE_WITH_MAP) && defined(PROJECTION_GLOBE_VIEW)\nview_scale*=a_scale;\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);vec4 occlusion_world_center=vec4(circle_center,cantilevered_height,1);vec4 occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nvec4 occlusion_world_center=world_center;vec4 occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}"),clippingMask:tb("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:tb("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\ngl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;attribute float a_scale;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);\n#ifdef PROJECTION_GLOBE_VIEW\nextrude*=a_scale;vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\nvec3 pos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),heatmapTexture:tb("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:tb("varying float v_placed;varying float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}","attribute vec3 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:tb("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos_2f;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:tb("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;\n#endif\nvarying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}"),fill:tb("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutline:tb("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutlinePattern:tb("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=mix(color1,color2,u_fade);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillPattern:tb("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillExtrusion:tb("varying vec4 v_color;void main() {vec4 color=v_color;\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 pos=vec3(pos_nx.xy,h);\n#else\nvec3 pos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(pos.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.rgb+=clamp(color.rgb*directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),fillExtrusionPattern:tb("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);out_color=out_color*v_lighting;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 p=vec3(pos_nx.xy,h);\n#else\nvec3 p=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:tb("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nreturn texture2D(u_image,coord).a/4.0;\n#else\nvec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;\n#endif\n}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos);float f=getElevation(v_pos+vec2(epsilon.x,0));float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float h=getElevation(v_pos+vec2(0,epsilon.y));float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:tb("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef FOG\ngl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),line:tb("uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;uniform float u_mix;uniform vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;varying highp vec2 v_uv;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash_from\n#pragma mapbox: define lowp vec4 dash_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash_from\n#pragma mapbox: initialize lowp vec4 dash_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist_a=texture2D(u_dash_image,v_tex_a).a;float sdfdist_b=texture2D(u_dash_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfwidth=min(dash_from.z*u_scale.y,dash_to.z*u_scale.z);float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/sdfwidth;alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\n#ifdef RENDER_LINE_GRADIENT\nvec4 out_color=texture2D(u_gradient_image,v_uv);\n#else\nvec4 out_color=color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef RENDER_LINE_ALPHA_DISCARD\nif (alpha < u_alpha_discard_threshold) {discard;}\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define EXTRUDE_SCALE 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;\n#ifdef RENDER_LINE_GRADIENT\nattribute vec3 a_packed;\n#else\nattribute float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform mediump vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;varying highp vec2 v_uv;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash_from\n#pragma mapbox: define lowp vec4 dash_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash_from\n#pragma mapbox: initialize lowp vec4 dash_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];float a_linesofar=a_packed[2];highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);\n#endif\n#ifdef RENDER_LINE_DASH\nfloat tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;float scaleA=dash_from.z==0.0 ? 0.0 : tileZoomRatio/(dash_from.z*fromScale);float scaleB=dash_to.z==0.0 ? 0.0 : tileZoomRatio/(dash_to.z*toScale);float heightA=dash_from.y;float heightB=dash_to.y;v_tex_a=vec2(a_linesofar*scaleA/floorwidth,(-normal.y*heightA+dash_from.x+0.5)/u_texsize.y);v_tex_b=vec2(a_linesofar*scaleB/floorwidth,(-normal.y*heightB+dash_to.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),linePattern:tb("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),raster:tb("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef FOG\nout_color=fog_dither(fog_apply(out_color,v_fog_pos));\n#endif\ngl_FragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,0,w);v_pos0=a_texture_pos/8192.0;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),symbolIcon:tb("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_z_tile_anchor;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float anchorZ=a_z_tile_anchor.x;vec2 tileAnchor=a_z_tile_anchor.yz;vec3 h=elevationVector(tileAnchor)*elevation(tileAnchor);vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tileAnchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(vec3(a_pos,anchorZ)+h,mercator_pos,u_zoom_transition);vec4 projectedPoint=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),anchorZ,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec3 proj_pos=mix_globe_mercator(vec3(a_projected_pos.xy,anchorZ),mercator_pos,u_zoom_transition);\n#ifdef PROJECTED_POS_ON_VIEWPORT\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xy,0.0,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xyz+h,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;}"),symbolSDF:tb("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_z_tile_anchor;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_tile_id;uniform float u_zoom_transition;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float anchorZ=a_z_tile_anchor.x;vec2 tileAnchor=a_z_tile_anchor.yz;vec3 h=elevationVector(tileAnchor)*elevation(tileAnchor);vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tileAnchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(vec3(a_pos,anchorZ)+h,mercator_pos,u_zoom_transition);vec4 projectedPoint=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),anchorZ,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec3 proj_pos=mix_globe_mercator(vec3(a_projected_pos.xy,anchorZ),mercator_pos,u_zoom_transition);\n#ifdef PROJECTED_POS_ON_VIEWPORT\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xy,0.0,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xyz+h,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float gamma_scale=gl_Position.w;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}"),symbolTextAndIcon:tb("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_z_tile_anchor;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float anchorZ=a_z_tile_anchor.x;vec2 tileAnchor=a_z_tile_anchor.yz;vec3 h=elevationVector(tileAnchor)*elevation(tileAnchor);vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tileAnchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(vec3(a_pos,anchorZ)+h,mercator_pos,u_zoom_transition);vec4 projectedPoint=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),anchorZ,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec3 proj_pos=mix_globe_mercator(vec3(a_projected_pos.xy,anchorZ),mercator_pos,u_zoom_transition);\n#ifdef PROJECTED_POS_ON_VIEWPORT\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xy,0.0,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xyz+h,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_sdf);}"),terrainRaster:tb("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\nvoid main() {vec4 color=texture2D(u_image0,v_pos0);\n#ifdef FOG\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\nconst float skirtOffset=24575.0;const float wireframeOffset=0.00015;void main() {v_pos0=a_texture_pos/8192.0;float skirt=float(a_pos.x >=skirtOffset);float elevation=elevation(a_texture_pos)-skirt*u_skirt_height;\n#ifdef TERRAIN_WIREFRAME\nelevation+=u_skirt_height*u_skirt_height*wireframeOffset;\n#endif\nvec2 decodedPos=a_pos-vec2(skirt*skirtOffset,0.0);gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n}"),terrainDepth:tb("#ifdef GL_ES\nprecision highp float;\n#endif\nvarying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying float v_depth;void main() {float elevation=elevation(a_texture_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:tb("\nvarying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",t_),skyboxGradient:tb("varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",t_),skyboxCapture:tb("\nvarying highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;\n#ifdef GL_ES\nprecision highp float;\n#endif\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;gl_FragColor=vec4(color,1.0);}","attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:tb("uniform sampler2D u_image0;varying vec2 v_pos0;void main() {gl_FragColor=texture2D(u_image0,v_pos0);\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_proj_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;attribute vec3 a_globe_pos;attribute vec2 a_merc_pos;attribute vec2 a_uv;varying vec2 v_pos0;const float wireframeOffset=1e3;void main() {v_pos0=a_uv;vec2 uv=a_uv*EXTENT;vec4 up_vector=vec4(elevationVector(uv),1.0);float height=elevation(uv);\n#ifdef TERRAIN_WIREFRAME\nheight+=wireframeOffset;\n#endif\nvec4 globe=u_globe_matrix*vec4(a_globe_pos+up_vector.xyz*height,1.0);vec4 mercator=vec4(0.0);if (u_zoom_transition > 0.0) {mercator=vec4(a_merc_pos,height,1.0);mercator.xy-=u_merc_center;mercator.x=wrap(mercator.x,-0.5,0.5);mercator=u_merc_matrix*mercator;}vec3 position=mix(globe.xyz,mercator.xyz,u_zoom_transition);gl_Position=u_proj_matrix*vec4(position,1.0);}"),globeAtmosphere:tb("uniform vec2 u_center;uniform float u_radius;uniform vec2 u_screen_size;uniform float u_opacity;uniform highp float u_fadeout_range;uniform vec3 u_start_color;uniform vec3 u_end_color;uniform float u_pixel_ratio;void main() {highp vec2 fragCoord=gl_FragCoord.xy/u_pixel_ratio;fragCoord.y=u_screen_size.y-fragCoord.y;float distFromCenter=length(fragCoord-u_center);float normDistFromCenter=length(fragCoord-u_center)/u_radius;if (normDistFromCenter < 1.0)\ndiscard;float t=clamp(1.0-sqrt(normDistFromCenter-1.0)/u_fadeout_range,0.0,1.0);vec3 color=mix(u_start_color,u_end_color,1.0-t);gl_FragColor=vec4(color*t*u_opacity,u_opacity);}","attribute vec3 a_pos;void main() {gl_Position=vec4(a_pos,1.0);}")};function tb(i,r,n){const o=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=/uniform (highp |mediump |lowp )?([\w]+) ([\w]+)([\s]*)([\w]*)/g,a=r.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),l=i.match(s),c=r.match(s),h=tm.match(s);let u=c?c.concat(l):l;n||(tg.staticUniforms&&(u=tg.staticUniforms.concat(u)),ty.staticUniforms&&(u=ty.staticUniforms.concat(u))),u&&(u=u.concat(h));const d={};return{fragmentSource:i=i.replace(o,(i,r,n,o,s)=>(d[s]=!0,"define"===r?` +Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(n[1])} }\`.`)];const p=[];return"symbol"===i.layerType&&("text-field"===c&&s&&!s.glyphs&&p.push(new tn(o,l,'use of "text-field" requires a style "glyphs" property')),"text-font"===c&&iQ(tl(l))&&"identity"===ta(l.type)&&p.push(new tn(o,l,'"text-font" does not support identity functions'))),p.concat(rz({key:i.key,value:l,valueSpec:d,style:s,styleSpec:a,expressionContext:"property",propertyType:r,propertyKey:c}))}function rv(i){return rx(i,"paint")}function rb(i){return rx(i,"layout")}function rw(i){let r=[];const n=i.value,o=i.key,s=i.style,a=i.styleSpec;n.type||n.ref||r.push(new tn(o,n,'either "type" or "ref" is required'));let l=ta(n.type);const c=ta(n.ref);if(n.id){const h=ta(n.id);for(let u=0;u{i in n&&r.push(new tn(o,n[i],`"${i}" is prohibited for ref layers`))}),s.layers.forEach(i=>{ta(i.id)===c&&(p=i)}),p?p.ref?r.push(new tn(o,n.ref,"ref cannot reference another ref layer")):l=ta(p.type):r.push(new tn(o,n.ref,`ref layer "${c}" not found`))}else if("background"!==l&&"sky"!==l){if(n.source){const f=s.sources&&s.sources[n.source],m=f&&ta(f.type);f?"vector"===m&&"raster"===l?r.push(new tn(o,n.source,`layer "${n.id}" requires a raster source`)):"raster"===m&&"raster"!==l?r.push(new tn(o,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==m||n["source-layer"]?"raster-dem"===m&&"hillshade"!==l?r.push(new tn(o,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"===l&&n.paint&&n.paint["line-gradient"]&&("geojson"!==m||!f.lineMetrics)&&r.push(new tn(o,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new tn(o,n,`layer "${n.id}" must specify a "source-layer"`)):r.push(new tn(o,n.source,`source "${n.source}" not found`))}else r.push(new tn(o,n,'missing required property "source"'))}return r=r.concat(rr({key:o,value:n,valueSpec:a.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>rz({key:`${o}.type`,value:n.type,valueSpec:a.layer.type,style:i.style,styleSpec:i.styleSpec,object:n,objectKey:"type"}),filter:i=>ry(ts({layerType:l},i)),layout:i=>rr({layer:n,key:i.key,value:i.value,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>rb(ts({layerType:l},i))}}),paint:i=>rr({layer:n,key:i.key,value:i.value,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>rv(ts({layerType:l},i))}})}}))}function rT(i){const r=i.value,n=i.key,o=iJ(r);return"string"!==o?[new tn(n,r,`string expected, ${o} found`)]:[]}const rE={promoteId:function({key:i,value:r}){if("string"===iJ(r))return rT({key:i,value:r});{const n=[];for(const o in r)n.push(...rT({key:`${i}.${o}`,value:r[o]}));return n}}};function rS(i){let r;const n=i.value,o=i.key,s=i.styleSpec,a=i.style;if(!n.type)return[new tn(o,n,'"type" is required')];const l=ta(n.type);switch(l){case"vector":case"raster":case"raster-dem":return rr({key:o,value:n,valueSpec:s[`source_${l.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:rE});case"geojson":if(r=rr({key:o,value:n,valueSpec:s.source_geojson,style:a,styleSpec:s,objectElementValidators:rE}),n.cluster)for(const c in n.clusterProperties){const[h,u]=n.clusterProperties[c],d="string"==typeof h?[h,["accumulated"],["get",c]]:h;r.push(...ra({key:`${o}.${c}.map`,value:u,expressionContext:"cluster-map"})),r.push(...ra({key:`${o}.${c}.reduce`,value:d,expressionContext:"cluster-reduce"}))}return r;case"video":return rr({key:o,value:n,valueSpec:s.source_video,style:a,styleSpec:s});case"image":return rr({key:o,value:n,valueSpec:s.source_image,style:a,styleSpec:s});case"canvas":return[new tn(o,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return rl({key:`${o}.type`,value:n.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:a,styleSpec:s})}}function rI(i){const r=i.value,n=i.styleSpec,o=n.light,s=i.style;let a=[];const l=iJ(r);if(void 0===r)return a;if("object"!==l)return a.concat([new tn("light",r,`object expected, ${l} found`)]);for(const c in r){const h=c.match(/^(.*)-transition$/);a=a.concat(h&&o[h[1]]&&o[h[1]].transition?rz({key:c,value:r[c],valueSpec:n.transition,style:s,styleSpec:n}):o[c]?rz({key:c,value:r[c],valueSpec:o[c],style:s,styleSpec:n}):[new tn(c,r[c],`unknown property "${c}"`)])}return a}function rM(i){const r=i.value,n=i.key,o=i.style,s=i.styleSpec,a=s.terrain;let l=[];const c=iJ(r);if(void 0===r)return l;if("object"!==c)return l.concat([new tn("terrain",r,`object expected, ${c} found`)]);for(const h in r){const u=h.match(/^(.*)-transition$/);l=l.concat(u&&a[u[1]]&&a[u[1]].transition?rz({key:h,value:r[h],valueSpec:s.transition,style:o,styleSpec:s}):a[h]?rz({key:h,value:r[h],valueSpec:a[h],style:o,styleSpec:s}):[new tn(h,r[h],`unknown property "${h}"`)])}if(r.source){const d=o.sources&&o.sources[r.source],p=d&&ta(d.type);d?"raster-dem"!==p&&l.push(new tn(n,r.source,`terrain cannot be used with a source of type ${p}, it only be used with a "raster-dem" source type`)):l.push(new tn(n,r.source,`source "${r.source}" not found`))}else l.push(new tn(n,r,'terrain is missing required property "source"'));return l}function rA(i){const r=i.value,n=i.style,o=i.styleSpec,s=o.fog;let a=[];const l=iJ(r);if(void 0===r)return a;if("object"!==l)return a.concat([new tn("fog",r,`object expected, ${l} found`)]);for(const c in r){const h=c.match(/^(.*)-transition$/);a=a.concat(h&&s[h[1]]&&s[h[1]].transition?rz({key:c,value:r[c],valueSpec:o.transition,style:n,styleSpec:o}):s[c]?rz({key:c,value:r[c],valueSpec:s[c],style:n,styleSpec:o}):[new tn(c,r[c],`unknown property "${c}"`)])}return a}const rC={"*":()=>[],array:rn,boolean:function(i){const r=i.value,n=i.key,o=iJ(r);return"boolean"!==o?[new tn(n,r,`boolean expected, ${o} found`)]:[]},number:ro,color:function(i){const r=i.key,n=i.value,o=iJ(n);return"string"!==o?[new tn(r,n,`color expected, ${o} found`)]:null===tA.parseCSSColor(n)?[new tn(r,n,`color expected, "${n}" found`)]:[]},constants:to,enum:rl,filter:ry,function:rs,layer:rw,object:rr,source:rS,light:rI,terrain:rM,fog:rA,string:rT,formatted:function(i){return 0===rT(i).length?[]:ra(i)},resolvedImage:function(i){return 0===rT(i).length?[]:ra(i)},projection:function(i){const r=i.value,n=i.styleSpec,o=n.projection,s=i.style;let a=[];const l=iJ(r);if("object"===l)for(const c in r)a=a.concat(rz({key:c,value:r[c],valueSpec:o[c],style:s,styleSpec:n}));else"string"!==l&&(a=a.concat([new tn("projection",r,`object or string expected, ${l} found`)]));return a}};function rz(i){const r=i.value,n=i.valueSpec,o=i.styleSpec;return n.expression&&iQ(ta(r))?rs(i):n.expression&&i8(tl(r))?ra(i):n.type&&rC[n.type]?rC[n.type](i):rr(ts({},i,{valueSpec:n.type?o[n.type]:n}))}function rk(i){const r=i.value,n=i.key,o=rT(i);return o.length||(-1===r.indexOf("{fontstack}")&&o.push(new tn(n,r,'"glyphs" url must include a "{fontstack}" token')),-1===r.indexOf("{range}")&&o.push(new tn(n,r,'"glyphs" url must include a "{range}" token'))),o}function rP(i,r=tr){let n=[];return n=n.concat(rz({key:"",value:i,valueSpec:r.$root,styleSpec:r,style:i,objectElementValidators:{glyphs:rk,"*":()=>[]}})),i.constants&&(n=n.concat(to({key:"constants",value:i.constants,style:i,styleSpec:r}))),rD(n)}function rD(i){return[].concat(i).sort((i,r)=>i.line-r.line)}function rL(i){return function(...r){return rD(i.apply(this,r))}}rP.source=rL(rS),rP.light=rL(rI),rP.terrain=rL(rM),rP.fog=rL(rA),rP.layer=rL(rw),rP.filter=rL(ry),rP.paintProperty=rL(rv),rP.layoutProperty=rL(rb);const rB=rP.light,rR=rP.fog,rF=rP.paintProperty,rO=rP.layoutProperty;function rU(i,r){let n=!1;if(r&&r.length)for(const o of r)i.fire(new tt(Error(o.message))),n=!0;return n}var rV=rN;function rN(i,r,n){var o=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var s=new Int32Array(this.arrayBuffer);i=s[0],this.d=(r=s[1])+2*(n=s[2]);for(var a=0;a=d[m+0]&&o>=d[m+1])?(l[f]=!0,a.push(u[f])):l[f]=!1}}},rN.prototype._forEachCell=function(i,r,n,o,s,a,l,c){for(var h=this._convertToCellCoord(i),u=this._convertToCellCoord(r),d=this._convertToCellCoord(n),p=this._convertToCellCoord(o),f=h;f<=d;f++)for(var m=u;m<=p;m++){var _=this.d*m+f;if((!c||c(this._convertFromCellCoord(f),this._convertFromCellCoord(m),this._convertFromCellCoord(f+1),this._convertFromCellCoord(m+1)))&&s.call(this,i,r,n,o,_,a,l,c))return}},rN.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},rN.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},rN.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,r=3+this.cells.length+1+1,n=0,o=0;o=0)continue;const h=i[c];l[c]=rZ[a].shallow.indexOf(c)>=0?h:rH(h,r)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==a&&(l.$name=a),l}throw Error("can't serialize object of type "+typeof i)}function rK(i){if(null==i||"boolean"==typeof i||"number"==typeof i||"string"==typeof i||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||rX(i)||rW(i)||ArrayBuffer.isView(i)||i instanceof rj)return i;if(Array.isArray(i))return i.map(rK);if("object"==typeof i){const r=i.$name||"Object",{klass:n}=rZ[r];if(!n)throw Error(`can't deserialize unregistered class ${r}`);if(n.deserialize)return n.deserialize(i);const o=Object.create(n.prototype);for(const s of Object.keys(i)){if("$name"===s)continue;const a=i[s];o[s]=rZ[r].shallow.indexOf(s)>=0?a:rK(a)}return o}throw Error("can't deserialize object of type "+typeof i)}class rY{constructor(){this.first=!0}update(i,r){const n=Math.floor(i);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=i,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoomi>=1536&&i<=1791,rQ=i=>i>=1872&&i<=1919,r0=i=>i>=2208&&i<=2303,r1=i=>i>=11904&&i<=12031,r2=i=>i>=12032&&i<=12255,r3=i=>i>=12272&&i<=12287,r5=i=>i>=12288&&i<=12351,r4=i=>i>=12352&&i<=12447,r6=i=>i>=12448&&i<=12543,r8=i=>i>=12544&&i<=12591,r9=i=>i>=12704&&i<=12735,r7=i=>i>=12736&&i<=12783,ne=i=>i>=12784&&i<=12799,nt=i=>i>=12800&&i<=13055,ni=i=>i>=13056&&i<=13311,nr=i=>i>=13312&&i<=19903,nn=i=>i>=19968&&i<=40959,no=i=>i>=40960&&i<=42127,ns=i=>i>=42128&&i<=42191,na=i=>i>=44032&&i<=55215,nl=i=>i>=63744&&i<=64255,nc=i=>i>=64336&&i<=65023,nh=i=>i>=65040&&i<=65055,nu=i=>i>=65072&&i<=65103,nd=i=>i>=65104&&i<=65135,np=i=>i>=65136&&i<=65279,nf=i=>i>=65280&&i<=65519;function nm(i){for(const r of i)if(n_(r.charCodeAt(0)))return!0;return!1}function n_(i){return!(746!==i&&747!==i&&(i<4352||!(r9(i)||r8(i)||nu(i)&&!(i>=65097&&i<=65103)||nl(i)||ni(i)||r1(i)||r7(i)||!(!r5(i)||i>=12296&&i<=12305||i>=12308&&i<=12319||12336===i)||nr(i)||nn(i)||nt(i)||i>=12592&&i<=12687||i>=43360&&i<=43391||i>=55216&&i<=55295||i>=4352&&i<=4607||na(i)||r4(i)||r3(i)||i>=12688&&i<=12703||r2(i)||ne(i)||r6(i)&&12540!==i||!(!nf(i)||65288===i||65289===i||65293===i||i>=65306&&i<=65310||65339===i||65341===i||65343===i||i>=65371&&i<=65503||65507===i||i>=65512&&i<=65519)||!(!nd(i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||i>=5120&&i<=5759||i>=6320&&i<=6399||nh(i)||i>=19904&&i<=19967||no(i)||ns(i))))}function ng(i){return!(n_(i)||i>=128&&i<=255&&(167===i||169===i||174===i||177===i||188===i||189===i||190===i||215===i||247===i)||i>=8192&&i<=8303&&(8214===i||8224===i||8225===i||8240===i||8241===i||8251===i||8252===i||8258===i||8263===i||8264===i||8265===i||8273===i)||i>=8448&&i<=8527||i>=8528&&i<=8591||i>=8960&&i<=9215&&(i>=8960&&i<=8967||i>=8972&&i<=8991||i>=8996&&i<=9e3||9003===i||i>=9085&&i<=9114||i>=9150&&i<=9165||9167===i||i>=9169&&i<=9179||i>=9186&&i<=9215)||i>=9216&&i<=9279&&9251!==i||i>=9280&&i<=9311||i>=9312&&i<=9471||i>=9632&&i<=9727||i>=9728&&i<=9983&&!(i>=9754&&i<=9759)||i>=11008&&i<=11263&&(i>=11026&&i<=11055||i>=11088&&i<=11097||i>=11192&&i<=11243)||r5(i)||r6(i)||i>=57344&&i<=63743||nu(i)||nd(i)||nf(i)||8734===i||8756===i||8757===i||i>=9984&&i<=10087||i>=10102&&i<=10131||65532===i||65533===i)}function ny(i){return i>=1424&&i<=2303||nc(i)||np(i)}const nx="deferred",nv="loading",nb="loaded";let nw=null,nT="unavailable",nE=null;const nS=function(i){i&&"string"==typeof i&&i.indexOf("NetworkError")>-1&&(nT="error"),nw&&nw(i)};function nI(){nM.fire(new te("pluginStateChange",{pluginStatus:nT,pluginURL:nE}))}const nM=new ti,nA=function(){return nT},nC=function(){if(nT!==nx||!nE)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");nT=nv,nI(),nE&&e3({url:nE},i=>{i?nS(i):(nT=nb,nI())})},nz={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>nT===nb||null!=nz.applyArabicShaping,isLoading:()=>nT===nv,setState(i){nT=i.pluginStatus,nE=i.pluginURL},isParsed:()=>null!=nz.applyArabicShaping&&null!=nz.processBidirectionalText&&null!=nz.processStyledBidirectionalText,getPluginURL:()=>nE};class nk{constructor(i,r){this.zoom=i,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition,this.pitch=r.pitch):(this.now=0,this.fadeDuration=0,this.zoomHistory=new rY,this.transition={},this.pitch=0)}isSupportedScript(i){return function(i,r){for(const n of i){var o;if(o=n.charCodeAt(0),!r&&ny(o)||o>=2304&&o<=3583||o>=3840&&o<=4255||o>=6016&&o<=6143)return!1}return!0}(i,nz.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const i=this.zoom,r=i-Math.floor(i),n=this.crossFadingFactor();return i>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}}class nP{constructor(i,r){this.property=i,this.value=r,this.expression=function(i,r){if(iQ(i))return new ri(i,r);if(i8(i)){const n=rt(i,r);if("error"===n.result)throw Error(n.value.map(i=>`${i.key}: ${i.message}`).join(", "));return n.value}{let o=i;return"string"==typeof i&&"color"===r.type&&(o=tC.parse(i)),{kind:"constant",evaluate:()=>o}}}(void 0===r?i.specification.default:r,i.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(i,r,n){return this.property.possiblyEvaluate(this,i,r,n)}}class nD{constructor(i){this.property=i,this.value=new nP(i,void 0)}transitioned(i,r){return new nB(this.property,this.value,r,J({},i.transition,this.transition),i.now)}untransitioned(){return new nB(this.property,this.value,null,{},0)}}class nL{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitionablePropertyValues)}getValue(i){return el(this._values[i].value.value)}setValue(i,r){this._values.hasOwnProperty(i)||(this._values[i]=new nD(this._values[i].property)),this._values[i].value=new nP(this._values[i].property,null===r?void 0:el(r))}getTransition(i){return el(this._values[i].transition)}setTransition(i,r){this._values.hasOwnProperty(i)||(this._values[i]=new nD(this._values[i].property)),this._values[i].transition=el(r)||void 0}serialize(){const i={};for(const r of Object.keys(this._values)){const n=this.getValue(r);void 0!==n&&(i[r]=n);const o=this.getTransition(r);void 0!==o&&(i[`${r}-transition`]=o)}return i}transitioned(i,r){const n=new nR(this._properties);for(const o of Object.keys(this._values))n._values[o]=this._values[o].transitioned(i,r._values[o]);return n}untransitioned(){const i=new nR(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].untransitioned();return i}}class nB{constructor(i,r,n,o,s){const a=o.delay||0,l=o.duration||0;s=s||0,this.property=i,this.value=r,this.begin=s+a,this.end=this.begin+l,i.specification.transition&&(o.delay||o.duration)&&(this.prior=n)}possiblyEvaluate(i,r,n){const o=i.now||0,s=this.value.possiblyEvaluate(i,r,n),a=this.prior;if(a){if(o>this.end||this.value.isDataDriven())return this.prior=null,s;if(oo.zoomHistory.lastIntegerZoom?{from:i,to:r,other:n}:{from:n,to:r,other:i}}interpolate(i){return i}}class nG{constructor(i){this.specification=i}possiblyEvaluate(i,r,n,o){if(void 0!==i.value){if("constant"===i.expression.kind){const s=i.expression.evaluate(r,null,{},n,o);return this._calculate(s,s,s,r)}return this._calculate(i.expression.evaluate(new nk(Math.floor(r.zoom-1),r)),i.expression.evaluate(new nk(Math.floor(r.zoom),r)),i.expression.evaluate(new nk(Math.floor(r.zoom+1),r)),r)}}_calculate(i,r,n,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:i,to:r}:{from:n,to:r}}interpolate(i){return i}}class nZ{constructor(i){this.specification=i}possiblyEvaluate(i,r,n,o){return!!i.expression.evaluate(r,null,{},n,o)}interpolate(){return!1}}class n${constructor(i){for(const r in this.properties=i,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],i){const n=i[r];n.specification.overridable&&this.overridableProperties.push(r);const o=this.defaultPropertyValues[r]=new nP(n,void 0),s=this.defaultTransitionablePropertyValues[r]=new nD(n);this.defaultTransitioningPropertyValues[r]=s.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=o.possiblyEvaluate({})}}}function nq(i,r){return 256*(i=X(Math.floor(i),0,255))+X(Math.floor(r),0,255)}r$("DataDrivenProperty",nN),r$("DataConstantProperty",nV),r$("CrossFadedDataDrivenProperty",nj),r$("CrossFadedProperty",nG),r$("ColorRampProperty",nZ);const nX={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class nW{constructor(i,r){this._structArray=i,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class nH{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(i,r){return i._trim(),r&&(i.isTransferred=!0,r.push(i.arrayBuffer)),{length:i.length,arrayBuffer:i.arrayBuffer}}static deserialize(i){const r=Object.create(this.prototype);return r.arrayBuffer=i.arrayBuffer,r.length=i.length,r.capacity=i.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(i){this.reserve(i),this.length=i}reserve(i){if(i>this.capacity){this.capacity=Math.max(i,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function nK(i,r=1){let n=0,o=0;return{members:i.map(i=>{const s=nX[i.type].BYTES_PER_ELEMENT,a=n=nY(n,Math.max(r,s)),l=i.components||1;return o=Math.max(o,s),n+=s*l,{name:i.name,type:i.type,components:l,offset:a}}),size:nY(n,Math.max(o,r)),alignment:r}}function nY(i,r){return Math.ceil(i/r)*r}class nJ extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r){const n=this.length;return this.resize(n+1),this.emplace(n,i,r)}emplace(i,r,n){const o=2*i;return this.int16[o+0]=r,this.int16[o+1]=n,i}}nJ.prototype.bytesPerElement=4,r$("StructArrayLayout2i4",nJ);class nQ extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,o)}emplace(i,r,n,o,s){const a=4*i;return this.int16[a+0]=r,this.int16[a+1]=n,this.int16[a+2]=o,this.int16[a+3]=s,i}}nQ.prototype.bytesPerElement=8,r$("StructArrayLayout4i8",nQ);class n0 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,i,r,n,o,s,a,l)}emplace(i,r,n,o,s,a,l,c){const h=6*i,u=12*i;return this.int16[h+0]=r,this.int16[h+1]=n,this.uint8[u+4]=o,this.uint8[u+5]=s,this.uint8[u+6]=a,this.uint8[u+7]=l,this.float32[3*i+2]=c,i}}n0.prototype.bytesPerElement=12,r$("StructArrayLayout2i4ub1f12",n0);class n1 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,i,r,n)}emplace(i,r,n,o){const s=3*i;return this.float32[s+0]=r,this.float32[s+1]=n,this.float32[s+2]=o,i}}n1.prototype.bytesPerElement=12,r$("StructArrayLayout3f12",n1);class n2 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l,c,h,u){const d=this.length;return this.resize(d+1),this.emplace(d,i,r,n,o,s,a,l,c,h,u)}emplace(i,r,n,o,s,a,l,c,h,u,d){const p=10*i;return this.uint16[p+0]=r,this.uint16[p+1]=n,this.uint16[p+2]=o,this.uint16[p+3]=s,this.uint16[p+4]=a,this.uint16[p+5]=l,this.uint16[p+6]=c,this.uint16[p+7]=h,this.uint16[p+8]=u,this.uint16[p+9]=d,i}}n2.prototype.bytesPerElement=20,r$("StructArrayLayout10ui20",n2);class n3 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l,c){const h=this.length;return this.resize(h+1),this.emplace(h,i,r,n,o,s,a,l,c)}emplace(i,r,n,o,s,a,l,c,h){const u=8*i;return this.uint16[u+0]=r,this.uint16[u+1]=n,this.uint16[u+2]=o,this.uint16[u+3]=s,this.uint16[u+4]=a,this.uint16[u+5]=l,this.uint16[u+6]=c,this.uint16[u+7]=h,i}}n3.prototype.bytesPerElement=16,r$("StructArrayLayout8ui16",n3);class n5 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g){const y=this.length;return this.resize(y+1),this.emplace(y,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g)}emplace(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y){const x=16*i;return this.int16[x+0]=r,this.int16[x+1]=n,this.int16[x+2]=o,this.int16[x+3]=s,this.uint16[x+4]=a,this.uint16[x+5]=l,this.uint16[x+6]=c,this.uint16[x+7]=h,this.int16[x+8]=u,this.int16[x+9]=d,this.int16[x+10]=p,this.int16[x+11]=f,this.int16[x+12]=m,this.int16[x+13]=_,this.int16[x+14]=g,this.int16[x+15]=y,i}}n5.prototype.bytesPerElement=32,r$("StructArrayLayout4i4ui4i4i32",n5);class n4 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i){const r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint32[1*i+0]=r,i}}n4.prototype.bytesPerElement=4,r$("StructArrayLayout1ul4",n4);class n6 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l,c,h,u,d,p,f){const m=this.length;return this.resize(m+1),this.emplace(m,i,r,n,o,s,a,l,c,h,u,d,p,f)}emplace(i,r,n,o,s,a,l,c,h,u,d,p,f,m){const _=20*i,g=10*i;return this.int16[_+0]=r,this.int16[_+1]=n,this.int16[_+2]=o,this.int16[_+3]=s,this.int16[_+4]=a,this.float32[g+3]=l,this.float32[g+4]=c,this.float32[g+5]=h,this.float32[g+6]=u,this.int16[_+14]=d,this.uint32[g+8]=p,this.uint16[_+18]=f,this.uint16[_+19]=m,i}}n6.prototype.bytesPerElement=40,r$("StructArrayLayout5i4f1i1ul2ui40",n6);class n8 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,i,r,n,o,s,a,l)}emplace(i,r,n,o,s,a,l,c){const h=8*i;return this.int16[h+0]=r,this.int16[h+1]=n,this.int16[h+2]=o,this.int16[h+4]=s,this.int16[h+5]=a,this.int16[h+6]=l,this.int16[h+7]=c,i}}n8.prototype.bytesPerElement=16,r$("StructArrayLayout3i2i2i16",n8);class n9 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,i,r,n,o,s)}emplace(i,r,n,o,s,a){const l=4*i,c=8*i;return this.float32[l+0]=r,this.float32[l+1]=n,this.float32[l+2]=o,this.int16[c+6]=s,this.int16[c+7]=a,i}}n9.prototype.bytesPerElement=16,r$("StructArrayLayout2f1f2i16",n9);class n7 extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,o)}emplace(i,r,n,o,s){const a=12*i,l=3*i;return this.uint8[a+0]=r,this.uint8[a+1]=n,this.float32[l+1]=o,this.float32[l+2]=s,i}}n7.prototype.bytesPerElement=12,r$("StructArrayLayout2ub2f12",n7);class oe extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,i,r,n)}emplace(i,r,n,o){const s=3*i;return this.uint16[s+0]=r,this.uint16[s+1]=n,this.uint16[s+2]=o,i}}oe.prototype.bytesPerElement=6,r$("StructArrayLayout3ui6",oe);class ot extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w){const T=this.length;return this.resize(T+1),this.emplace(T,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w)}emplace(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T){const E=30*i,S=15*i,I=60*i;return this.int16[E+0]=r,this.int16[E+1]=n,this.int16[E+2]=o,this.float32[S+2]=s,this.float32[S+3]=a,this.uint16[E+8]=l,this.uint16[E+9]=c,this.uint32[S+5]=h,this.uint32[S+6]=u,this.uint32[S+7]=d,this.uint16[E+16]=p,this.uint16[E+17]=f,this.uint16[E+18]=m,this.float32[S+10]=_,this.float32[S+11]=g,this.uint8[I+48]=y,this.uint8[I+49]=x,this.uint8[I+50]=v,this.uint32[S+13]=b,this.int16[E+28]=w,this.uint8[I+58]=T,i}}ot.prototype.bytesPerElement=60,r$("StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60",ot);class oi extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T,E,S,I,M,A,C,z,k){const P=this.length;return this.resize(P+1),this.emplace(P,i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T,E,S,I,M,A,C,z,k)}emplace(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T,E,S,I,M,A,C,z,k,P){const D=38*i,L=19*i;return this.int16[D+0]=r,this.int16[D+1]=n,this.int16[D+2]=o,this.float32[L+2]=s,this.float32[L+3]=a,this.int16[D+8]=l,this.int16[D+9]=c,this.int16[D+10]=h,this.int16[D+11]=u,this.int16[D+12]=d,this.int16[D+13]=p,this.uint16[D+14]=f,this.uint16[D+15]=m,this.uint16[D+16]=_,this.uint16[D+17]=g,this.uint16[D+18]=y,this.uint16[D+19]=x,this.uint16[D+20]=v,this.uint16[D+21]=b,this.uint16[D+22]=w,this.uint16[D+23]=T,this.uint16[D+24]=E,this.uint16[D+25]=S,this.uint16[D+26]=I,this.uint16[D+27]=M,this.uint16[D+28]=A,this.uint32[L+15]=C,this.float32[L+16]=z,this.float32[L+17]=k,this.float32[L+18]=P,i}}oi.prototype.bytesPerElement=76,r$("StructArrayLayout3i2f6i15ui1ul3f76",oi);class or extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i){const r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.float32[1*i+0]=r,i}}or.prototype.bytesPerElement=4,r$("StructArrayLayout1f4",or);class on extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,i,r,n)}emplace(i,r,n,o){const s=3*i;return this.int16[s+0]=r,this.int16[s+1]=n,this.int16[s+2]=o,i}}on.prototype.bytesPerElement=6,r$("StructArrayLayout3i6",on);class oo extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,i,r,n,o,s,a,l)}emplace(i,r,n,o,s,a,l,c){const h=7*i;return this.float32[h+0]=r,this.float32[h+1]=n,this.float32[h+2]=o,this.float32[h+3]=s,this.float32[h+4]=a,this.float32[h+5]=l,this.float32[h+6]=c,i}}oo.prototype.bytesPerElement=28,r$("StructArrayLayout7f28",oo);class os extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,o)}emplace(i,r,n,o,s){const a=6*i;return this.uint32[3*i+0]=r,this.uint16[a+2]=n,this.uint16[a+3]=o,this.uint16[a+4]=s,i}}os.prototype.bytesPerElement=12,r$("StructArrayLayout1ul3ui12",os);class oa extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r){const n=this.length;return this.resize(n+1),this.emplace(n,i,r)}emplace(i,r,n){const o=2*i;return this.uint16[o+0]=r,this.uint16[o+1]=n,i}}oa.prototype.bytesPerElement=4,r$("StructArrayLayout2ui4",oa);class ol extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i){const r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint16[1*i+0]=r,i}}ol.prototype.bytesPerElement=2,r$("StructArrayLayout1ui2",ol);class oc extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r){const n=this.length;return this.resize(n+1),this.emplace(n,i,r)}emplace(i,r,n){const o=2*i;return this.float32[o+0]=r,this.float32[o+1]=n,i}}oc.prototype.bytesPerElement=8,r$("StructArrayLayout2f8",oc);class oh extends nH{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,o)}emplace(i,r,n,o,s){const a=4*i;return this.float32[a+0]=r,this.float32[a+1]=n,this.float32[a+2]=o,this.float32[a+3]=s,i}}oh.prototype.bytesPerElement=16,r$("StructArrayLayout4f16",oh);class ou extends nW{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}ou.prototype.size=40;class od extends n6{get(i){return new ou(this,i)}}r$("CollisionBoxArray",od);class op extends nW{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(i){this._structArray.uint8[this._pos1+49]=i}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(i){this._structArray.uint8[this._pos1+50]=i}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(i){this._structArray.uint32[this._pos4+13]=i}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(i){this._structArray.uint8[this._pos1+58]=i}}op.prototype.size=60;class of extends ot{get(i){return new op(this,i)}}r$("PlacedSymbolArray",of);class om extends nW{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+11]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+13]}get key(){return this._structArray.uint16[this._pos2+14]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+19]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+21]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+22]}get featureIndex(){return this._structArray.uint16[this._pos2+23]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+25]}get numIconVertices(){return this._structArray.uint16[this._pos2+26]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+27]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+28]}get crossTileID(){return this._structArray.uint32[this._pos4+15]}set crossTileID(i){this._structArray.uint32[this._pos4+15]=i}get textOffset0(){return this._structArray.float32[this._pos4+16]}get textOffset1(){return this._structArray.float32[this._pos4+17]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+18]}}om.prototype.size=76;class o_ extends oi{get(i){return new om(this,i)}}r$("SymbolInstanceArray",o_);class og extends or{getoffsetX(i){return this.float32[1*i+0]}}r$("GlyphOffsetArray",og);class oy extends on{getx(i){return this.int16[3*i+0]}gety(i){return this.int16[3*i+1]}gettileUnitDistanceFromAnchor(i){return this.int16[3*i+2]}}r$("SymbolLineVertexArray",oy);class ox extends nW{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}ox.prototype.size=12;class ov extends os{get(i){return new ox(this,i)}}r$("FeatureIndexArray",ov);class ob extends nW{get a_centroid_pos0(){return this._structArray.uint16[this._pos2+0]}get a_centroid_pos1(){return this._structArray.uint16[this._pos2+1]}}ob.prototype.size=4;class ow extends oa{get(i){return new ob(this,i)}}r$("FillExtrusionCentroidArray",ow);const oT=nK([{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"}]),oE=nK([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"}]);var oS=tM(function(i){i.exports=function(i,r){var n,o,s,a,l,c;for(o=i.length-(n=3&i.length),s=r,c=0;c>>16)*3432918353&65535)<<16)&4294967295)<<15|l>>>17))*461845907+(((l>>>16)*461845907&65535)<<16)&4294967295)<<13|s>>>19))+((5*(s>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(l=0,n){case 3:l^=(255&i.charCodeAt(c+2))<<16;case 2:l^=(255&i.charCodeAt(c+1))<<8;case 1:s^=l=(65535&(l=(l=(65535&(l^=255&i.charCodeAt(c)))*3432918353+(((l>>>16)*3432918353&65535)<<16)&4294967295)<<15|l>>>17))*461845907+(((l>>>16)*461845907&65535)<<16)&4294967295}return s^=i.length,s=2246822507*(65535&(s^=s>>>16))+((2246822507*(s>>>16)&65535)<<16)&4294967295,s=3266489909*(65535&(s^=s>>>13))+((3266489909*(s>>>16)&65535)<<16)&4294967295,(s^=s>>>16)>>>0}}),oI=tM(function(i){i.exports=function(i,r){for(var n,o=i.length,s=r^o,a=0;o>=4;)n=1540483477*(65535&(n=255&i.charCodeAt(a)|(255&i.charCodeAt(++a))<<8|(255&i.charCodeAt(++a))<<16|(255&i.charCodeAt(++a))<<24))+((1540483477*(n>>>16)&65535)<<16),s=1540483477*(65535&s)+((1540483477*(s>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),o-=4,++a;switch(o){case 3:s^=(255&i.charCodeAt(a+2))<<16;case 2:s^=(255&i.charCodeAt(a+1))<<8;case 1:s=1540483477*(65535&(s^=255&i.charCodeAt(a)))+((1540483477*(s>>>16)&65535)<<16)}return s=1540483477*(65535&(s^=s>>>13))+((1540483477*(s>>>16)&65535)<<16),(s^=s>>>15)>>>0}}),oM=oS;oM.murmur3=oS,oM.murmur2=oI;class oA{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(i,r,n,o){this.ids.push(oC(i)),this.positions.push(r,n,o)}getPositions(i){const r=oC(i);let n=0,o=this.ids.length-1;for(;n>1;this.ids[s]>=r?o=s:n=s+1}const a=[];for(;this.ids[n]===r;)a.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return a}static serialize(i,r){const n=new Float64Array(i.ids),o=new Uint32Array(i.positions);return function i(r,n,o,s){for(;o>1];let l=o-1,c=s+1;for(;;){do l++;while(r[l]a)if(l>=c)break;oz(r,l,c),oz(n,3*l,3*c),oz(n,3*l+1,3*c+1),oz(n,3*l+2,3*c+2)}c-o`u_${i}`),this.type=n}setUniform(i,r,n){i.set(n.constantOr(this.value))}getBinding(i,r,n){return"color"===this.type?new oL(i,r):new oP(i,r)}}class oV{constructor(i,r){this.uniformNames=r.map(i=>`u_${i}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(i,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=i.pixelRatio,this.patternFrom=r.tl.concat(r.br),this.patternTo=i.tl.concat(i.br)}setUniform(i,r,n,o){const s="u_pattern_to"===o||"u_dash_to"===o?this.patternTo:"u_pattern_from"===o||"u_dash_from"===o?this.patternFrom:"u_pixel_ratio_to"===o?this.pixelRatioTo:"u_pixel_ratio_from"===o?this.pixelRatioFrom:null;s&&i.set(s)}getBinding(i,r,n){return"u_pattern_from"===n||"u_pattern_to"===n||"u_dash_from"===n||"u_dash_to"===n?new oD(i,r):new oP(i,r)}}class oN{constructor(i,r,n,o){this.expression=i,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(i=>({name:`a_${i}`,type:"Float32",components:"color"===n?2:1,offset:0})),this.paintVertexArray=new o}populatePaintArray(i,r,n,o,s,a){const l=this.paintVertexArray.length,c=this.expression.evaluate(new nk(0),r,{},s,o,a);this.paintVertexArray.resize(i),this._setPaintValue(l,i,c)}updatePaintArray(i,r,n,o,s){const a=this.expression.evaluate({zoom:0},n,o,void 0,s);this._setPaintValue(i,r,a)}_setPaintValue(i,r,n){if("color"===this.type){const o=oO(n);for(let s=i;s`u_${i}_t`),this.type=n,this.useIntegerZoom=o,this.zoom=s,this.maxValue=0,this.paintVertexAttributes=r.map(i=>({name:`a_${i}`,type:"Float32",components:"color"===n?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(i,r,n,o,s,a){const l=this.expression.evaluate(new nk(this.zoom),r,{},s,o,a),c=this.expression.evaluate(new nk(this.zoom+1),r,{},s,o,a),h=this.paintVertexArray.length;this.paintVertexArray.resize(i),this._setPaintValue(h,i,l,c)}updatePaintArray(i,r,n,o,s){const a=this.expression.evaluate({zoom:this.zoom},n,o,void 0,s),l=this.expression.evaluate({zoom:this.zoom+1},n,o,void 0,s);this._setPaintValue(i,r,a,l)}_setPaintValue(i,r,n,o){if("color"===this.type){const s=oO(n),a=oO(o);for(let l=i;l!0){this.binders={},this._buffers=[];const o=[];for(const s in i.paint._values){var a,l;if(!n(s))continue;const c=i.paint.get(s);if(!(c instanceof nO&&iH(c.property.specification)))continue;const h=(a=s,l=i.type,oq[a]||[a.replace(`${l}-`,"").replace(/-/g,"_")]),u=c.value,d=c.property.specification.type,p=c.property.useIntegerZoom,f=c.property.specification["property-type"],m="cross-faded"===f||"cross-faded-data-driven"===f,_="line-dasharray"===String(s)&&"constant"!==i.layout.get("line-cap").value.kind;if("constant"!==u.kind||_){if("source"===u.kind||_||m){const g=oH(s,d,"source");this.binders[s]=m?new oG(u,h,d,p,r,g,i.id):new oN(u,h,d,g),o.push(`/a_${s}`)}else{const y=oH(s,d,"composite");this.binders[s]=new oj(u,h,d,p,r,y),o.push(`/z_${s}`)}}else this.binders[s]=m?new oV(u.value,h):new oU(u.value,h,d),o.push(`/u_${s}`)}this.cacheKey=o.sort().join("")}getMaxValue(i){const r=this.binders[i];return r instanceof oN||r instanceof oj?r.maxValue:0}populatePaintArrays(i,r,n,o,s,a){for(const l in this.binders){const c=this.binders[l];(c instanceof oN||c instanceof oj||c instanceof oG)&&c.populatePaintArray(i,r,n,o,s,a)}}setConstantPatternPositions(i,r){for(const n in this.binders){const o=this.binders[n];o instanceof oV&&o.setConstantPatternPositions(i,r)}}updatePaintArrays(i,r,n,o,s,a){let l=!1;for(const c in i){const h=r.getPositions(c);for(const u of h){const d=n.feature(u.index);for(const p in this.binders){const f=this.binders[p];if((f instanceof oN||f instanceof oj||f instanceof oG)&&!0===f.expression.isStateDependent){const m=o.paint.get(p);f.expression=m.value,f.updatePaintArray(u.start,u.end,d,i[c],s,a),l=!0}}}}return l}defines(){const i=[];for(const r in this.binders){const n=this.binders[r];(n instanceof oU||n instanceof oV)&&i.push(...n.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return i}getBinderAttributes(){const i=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof oN||n instanceof oj||n instanceof oG)for(let o=0;o!0){for(const o of(this.programConfigurations={},i))this.programConfigurations[o.id]=new oZ(o,r,n);this.needsUpload=!1,this._featureMap=new oA,this._bufferOffset=0}populatePaintArrays(i,r,n,o,s,a,l){for(const c in this.programConfigurations)this.programConfigurations[c].populatePaintArrays(i,r,o,s,a,l);void 0!==r.id&&this._featureMap.add(r.id,n,this._bufferOffset,i),this._bufferOffset=i,this.needsUpload=!0}updatePaintArrays(i,r,n,o,s){for(const a of n)this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(i,this._featureMap,r,a,o,s)||this.needsUpload}get(i){return this.programConfigurations[i]}upload(i){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(i);this.needsUpload=!1}}destroy(){for(const i in this.programConfigurations)this.programConfigurations[i].destroy()}}const oq={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"line-dasharray":["dash_to","dash_from"]},oX={"line-pattern":{source:n2,composite:n2},"fill-pattern":{source:n2,composite:n2},"fill-extrusion-pattern":{source:n2,composite:n2},"line-dasharray":{source:n3,composite:n3}},oW={color:{source:oc,composite:oh},number:{source:or,composite:oc}};function oH(i,r,n){const o=oX[i];return o&&o[n]||oW[r][n]}r$("ConstantBinder",oU),r$("CrossFadedConstantBinder",oV),r$("SourceExpressionBinder",oN),r$("CrossFadedCompositeBinder",oG),r$("CompositeExpressionBinder",oj),r$("ProgramConfiguration",oZ,{omit:["_buffers"]}),r$("ProgramConfigurationSet",o$);const oK="-transition";class oY extends ti{constructor(i,r){if(super(),this.id=i.id,this.type=i.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==i.type&&(this.metadata=i.metadata,this.minzoom=i.minzoom,this.maxzoom=i.maxzoom,"background"!==i.type&&"sky"!==i.type&&(this.source=i.source,this.sourceLayer=i["source-layer"],this.filter=i.filter),r.layout&&(this._unevaluatedLayout=new nF(r.layout)),r.paint)){for(const n in this._transitionablePaint=new nL(r.paint),i.paint)this.setPaintProperty(n,i.paint[n],{validate:!1});for(const o in i.layout)this.setLayoutProperty(o,i.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new nU(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(i){return"visibility"===i?this.visibility:this._unevaluatedLayout.getValue(i)}setLayoutProperty(i,r,n={}){null!=r&&this._validate(rO,`layers.${this.id}.layout.${i}`,i,r,n)||("visibility"!==i?this._unevaluatedLayout.setValue(i,r):this.visibility=r)}getPaintProperty(i){return eo(i,oK)?this._transitionablePaint.getTransition(i.slice(0,-oK.length)):this._transitionablePaint.getValue(i)}setPaintProperty(i,r,n={}){if(null!=r&&this._validate(rF,`layers.${this.id}.paint.${i}`,i,r,n))return!1;if(eo(i,oK))return this._transitionablePaint.setTransition(i.slice(0,-oK.length),r||void 0),!1;{const o=this._transitionablePaint._values[i],s="cross-faded-data-driven"===o.property.specification["property-type"],a=o.value.isDataDriven(),l=o.value;this._transitionablePaint.setValue(i,r),this._handleSpecialPaintPropertyUpdate(i);const c=this._transitionablePaint._values[i].value;return c.isDataDriven()||a||s||this._handleOverridablePaintPropertyUpdate(i,l,c)}}_handleSpecialPaintPropertyUpdate(i){}getProgramIds(){return null}getProgramConfiguration(i){return null}_handleOverridablePaintPropertyUpdate(i,r,n){return!1}isHidden(i){return!!(this.minzoom&&i=this.maxzoom)||"none"===this.visibility}updateTransitions(i){this._transitioningPaint=this._transitionablePaint.transitioned(i,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(i,r){i.getCrossfadeParameters&&(this._crossfadeParameters=i.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(i,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(i,void 0,r)}serialize(){const i={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(i.layout=i.layout||{},i.layout.visibility=this.visibility),ea(i,(i,r)=>!(void 0===i||"layout"===r&&!Object.keys(i).length||"paint"===r&&!Object.keys(i).length))}_validate(i,r,n,o,s={}){return(!s||!1!==s.validate)&&rU(this,i.call(rP,{key:r,layerType:this.type,objectKey:n,value:o,styleSpec:tr,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const i in this.paint._values){const r=this.paint.get(i);if(r instanceof nO&&iH(r.property.specification)&&("source"===r.value.kind||"composite"===r.value.kind)&&r.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=rh(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const oJ=nK([{name:"a_pos",components:2,type:"Int16"}],4),{members:oQ}=oJ;class o0{constructor(i=[]){this.segments=i}prepareSegment(i,r,n,o){let s=this.segments[this.segments.length-1];return i>o0.MAX_VERTEX_ARRAY_LENGTH&&eh(`Max vertices per segment is ${o0.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${i}`),(!s||s.vertexLength+i>o0.MAX_VERTEX_ARRAY_LENGTH||s.sortKey!==o)&&(s={vertexOffset:r.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},void 0!==o&&(s.sortKey=o),this.segments.push(s)),s}get(){return this.segments}destroy(){for(const i of this.segments)for(const r in i.vaos)i.vaos[r].destroy()}static simpleSegment(i,r,n,o){return new o0([{vertexOffset:i,primitiveOffset:r,vertexLength:n,primitiveLength:o,vaos:{},sortKey:0}])}}o0.MAX_VERTEX_ARRAY_LENGTH=65535,r$("SegmentVector",o0);class o1{constructor(i,r){i&&(r?this.setSouthWest(i).setNorthEast(r):4===i.length?this.setSouthWest([i[0],i[1]]).setNorthEast([i[2],i[3]]):this.setSouthWest(i[0]).setNorthEast(i[1]))}setNorthEast(i){return this._ne=i instanceof o2?new o2(i.lng,i.lat):o2.convert(i),this}setSouthWest(i){return this._sw=i instanceof o2?new o2(i.lng,i.lat):o2.convert(i),this}extend(i){let r,n;const o=this._sw,s=this._ne;if(i instanceof o2)r=i,n=i;else{if(!(i instanceof o1))return Array.isArray(i)?4===i.length||i.every(Array.isArray)?this.extend(o1.convert(i)):this.extend(o2.convert(i)):this;if(r=i._sw,n=i._ne,!r||!n)return this}return o||s?(o.lng=Math.min(r.lng,o.lng),o.lat=Math.min(r.lat,o.lat),s.lng=Math.max(n.lng,s.lng),s.lat=Math.max(n.lat,s.lat)):(this._sw=new o2(r.lng,r.lat),this._ne=new o2(n.lng,n.lat)),this}getCenter(){return new o2((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new o2(this.getWest(),this.getNorth())}getSouthEast(){return new o2(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(i){const{lng:r,lat:n}=o2.convert(i);let o=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&o}static convert(i){return!i||i instanceof o1?i:new o1(i)}}class o2{constructor(i,r){if(isNaN(i)||isNaN(r))throw Error(`Invalid LngLat object: (${i}, ${r})`);if(this.lng=+i,this.lat=+r,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new o2(H(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(i){const r=Math.PI/180,n=this.lat*r,o=i.lat*r,s=Math.sin(n)*Math.sin(o)+Math.cos(n)*Math.cos(o)*Math.cos((i.lng-this.lng)*r);return 6371008.8*Math.acos(Math.min(s,1))}toBounds(i=0){const r=360*i/40075017,n=r/Math.cos(Math.PI/180*this.lat);return new o1(new o2(this.lng-n,this.lat-r),new o2(this.lng+n,this.lat+r))}static convert(i){if(i instanceof o2)return i;if(Array.isArray(i)&&(2===i.length||3===i.length))return new o2(Number(i[0]),Number(i[1]));if(!Array.isArray(i)&&"object"==typeof i&&null!==i)return new o2(Number("lng"in i?i.lng:i.lon),Number(i.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const o3=2*Math.PI*6371008.8;function o5(i){return o3*Math.cos(i*Math.PI/180)}function o4(i){return(180+i)/360}function o6(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function o8(i){return 360*i-180}function o9(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class o7{constructor(i,r,n=0){this.x=+i,this.y=+r,this.z=+n}static fromLngLat(i,r=0){const n=o2.convert(i);return new o7(o4(n.lng),o6(n.lat),r/o5(n.lat))}toLngLat(){return new o2(o8(this.x),o9(this.y))}toAltitude(){return this.z*o5(o9(this.y))}meterInMercatorCoordinateUnits(){return 1/o3*(1/Math.cos(o9(this.y)*Math.PI/180))}}const se=-16383-1;function st(i,r,n){const o=i.loadGeometry(),s=i.extent,a=8192/s;if(r&&n&&n.projection.isReprojectedInTileSpace){const l=1<{const n=o8((r.x+i.x/s)/l),o=o9((r.y+i.y/s)/l),a=p.project(n,o);i.x=(a.x*c-h)*s,i.y=(a.y*c-d)*s};for(let m=0;m=d?(i(r,n,o,p,f,l,m,h,d),i(r,p,f,s,a,m,c,h,d)):r.push(c)}(l,o,s,h,d,a,c,r,1):l.push(c),o=h,s=d,a=c}return l}(o[m],f,0);else{const _=[];for(const g of o[m])g.x<0||g.x>=s||g.y<0||g.y>=s||(f(g),_.push(g));o[m]=_}}for(const y of o)for(const x of y)!function(i,r){const n=Math.round(i.x*r),o=Math.round(i.y*r);i.x=X(n,se,16383),i.y=X(o,se,16383),(ni.x+1||oi.y+1)&&eh("Geometry exceeds allowed extent, reduce your vector tile buffer size")}(x,a);return o}function si(i,r){return{type:i.type,id:i.id,properties:i.properties,geometry:r?st(i):[]}}function sr(i,r,n,o,s){i.emplaceBack(2*r+(o+1)/2,2*n+(s+1)/2)}class sn{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.hasPattern=!1,this.layoutVertexArray=new nJ,this.indexArray=new oe,this.segments=new o0,this.programConfigurations=new o$(i.layers,i.zoom),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(i,r,n,o){const s=this.layers[0],a=[];let l=null;for(const{feature:c,id:h,index:u,sourceLayerIndex:d}of("circle"===s.type&&(l=s.layout.get("circle-sort-key")),i)){const p=this.layers[0]._featureFilter.needGeometry,f=si(c,p);if(!this.layers[0]._featureFilter.filter(new nk(this.zoom),f,n))continue;const m=l?l.evaluate(f,{},n):void 0,_={id:h,properties:c.properties,type:c.type,sourceLayerIndex:d,index:u,geometry:p?f.geometry:st(c,n,o),patterns:{},sortKey:m};a.push(_)}for(const g of(l&&a.sort((i,r)=>i.sortKey-r.sortKey),a)){const{geometry:y,index:x,sourceLayerIndex:v}=g,b=i[x].feature;this.addFeature(g,y,x,r.availableImages,n),r.featureIndex.insert(b,y,x,v,this.index)}}update(i,r,n,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,oQ),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(i,r,n,o,s){for(const a of r)for(const l of a){const c=l.x,h=l.y;if(c<0||c>=8192||h<0||h>=8192)continue;const u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,i.sortKey),d=u.vertexLength;sr(this.layoutVertexArray,c,h,-1,-1),sr(this.layoutVertexArray,c,h,1,-1),sr(this.layoutVertexArray,c,h,1,1),sr(this.layoutVertexArray,c,h,-1,1),this.indexArray.emplaceBack(d,d+1,d+2),this.indexArray.emplaceBack(d,d+3,d+2),u.vertexLength+=4,u.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,{},o,s)}}function so(i,r){for(let n=0;n1?n:n.sub(r)._mult(s)._add(r))}function sh(i,r){let n,o,s,a=!1;for(let l=0;lr.y!=s.y>r.y&&r.x<(s.x-o.x)*(r.y-o.y)/(s.y-o.y)+o.x&&(a=!a)}return a}function su(i,r){let n=!1;for(let o=0,s=i.length-1;or.y!=l.y>r.y&&r.x<(l.x-a.x)*(r.y-a.y)/(l.y-a.y)+a.x&&(n=!n)}return n}function sd(i,r,n,o,s){for(const a of i)if(r<=a.x&&n<=a.y&&o>=a.x&&s>=a.y)return!0;const l=[new u(r,n),new u(r,s),new u(o,s),new u(o,n)];if(i.length>2){for(const c of l)if(su(i,c))return!0}for(let h=0;hs.x&&r.x>s.x||i.ys.y&&r.y>s.y)return!1;const a=eu(i,r,n[0]);return a!==eu(i,r,n[1])||a!==eu(i,r,n[2])||a!==eu(i,r,n[3])}(i[h],i[h+1],l))return!0;return!1}function sp(i,r,n){const o=r.paint.get(i).value;return"constant"===o.kind?o.value:n.programConfigurations.get(r.id).getMaxValue(i)}function sf(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function sm(i,r,n,o,s){if(!r[0]&&!r[1])return i;const a=u.convert(r)._mult(s);"viewport"===n&&a._rotate(-o);const l=[];for(let c=0;c{var a,l;const c=R([],n,i),h=1/c[3]/r*s;return a=c,l=[h,h,o?1/c[3]:h,h],a[0]=c[0]*l[0],a[1]=c[1]*l[1],a[2]=c[2]*l[2],a[3]=c[3]*l[3],a}),l=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(i=>{const r=k([],D([],M([],a[i[0]],a[i[1]]),M([],a[i[2]],a[i[1]]))),n=-P(r,a[i[1]]);return r.concat(n)});return new sx(a,l)}}class sv{constructor(i,r){this.min=i,this.max=r,this.center=C([],I([],this.min,this.max),.5)}quadrant(i){const r=[i%2==0,i<2],n=T(this.min),o=T(this.max);for(let s=0;s=0;if(0===a)return 0;a!==r.length&&(n=!1)}if(n)return 2;for(let c=0;c<3;c++){let h=Number.MAX_VALUE,u=-Number.MAX_VALUE;for(let d=0;dthis.max[c]-this.min[c])return 0}return 1}}function sb(i,r,n,o,s,a,l,c,h){if(a&&i.queryGeometry.isAboveHorizon)return!1;for(const d of(a&&(h*=i.pixelToTileUnitsFactor),r))for(const p of d){var f;const m=p.add(c),_=s&&n.elevation?n.elevation.exaggeration()*s.getElevationAt(m.x,m.y,!0):0,g=a?m:function(i,r,n){const o=R([],[i.x,i.y,r,1],n);return new u(o[0]/o[3],o[1]/o[3])}(m,_,o),y=a?i.tilespaceRays.map(i=>(function(i,r){const n=w();return sw[2]=r,i.intersectsPlane(sw,sT,n),new u(n[0],n[1])})(i,_)):i.queryGeometry.screenGeometry,x=R([],[p.x,p.y,_,1],o);if(!l&&a?h*=x[3]/n.cameraToCenterDistance:l&&!a&&(h*=n.cameraToCenterDistance/x[3]),f=h,su(y,g)||sl(g,y,f))return!0}return!1}const sw=S(0,0,0),sT=S(0,0,1);class sE extends sn{}function sS(i,{width:r,height:n},o,s){if(s){if(s instanceof Uint8ClampedArray)s=new Uint8Array(s.buffer);else if(s.length!==r*n*o)throw RangeError("mismatched image size")}else s=new Uint8Array(r*n*o);return i.width=r,i.height=n,i.data=s,i}function sI(i,{width:r,height:n},o){if(r===i.width&&n===i.height)return;const s=sS({},{width:r,height:n},o);sM(i,s,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,r),height:Math.min(i.height,n)},o),i.width=r,i.height=n,i.data=s.data}function sM(i,r,n,o,s,a){if(0===s.width||0===s.height)return r;if(s.width>i.width||s.height>i.height||n.x>i.width-s.width||n.y>i.height-s.height)throw RangeError("out of range source coordinates for image copy");if(s.width>r.width||s.height>r.height||o.x>r.width-s.width||o.y>r.height-s.height)throw RangeError("out of range destination coordinates for image copy");const l=i.data,c=r.data;for(let h=0;h{r[i.evaluationKey]=a;const l=i.expression.evaluate(r);s.data[n+o+0]=Math.floor(255*l.r/l.a),s.data[n+o+1]=Math.floor(255*l.g/l.a),s.data[n+o+2]=Math.floor(255*l.b/l.a),s.data[n+o+3]=Math.floor(255*l.a)};if(i.clips)for(let l=0,c=0;l=a.next.y&&a.next.y!==a.y){var u=a.x+(c-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(u<=l&&u>h){if(h=u,u===l){if(c===a.y)return a;if(c===a.next.y)return a.next}s=a.x=a.x&&a.x>=f&&l!==a.x&&sN(cs.x||a.x===s.x&&(n=s,o=a,0>sj(n.prev,n,o.prev)&&0>sj(o.next,n,n.next))))&&(s=a,_=d)),a=a.next;while(a!==p)return s}(i,r);if(!n)return r;var o=sW(n,i),s=sO(n,n.next);return sO(o,o.next),r===n?s:r}(c[s],n),n.next);return n}(i,r,f,n)),i.length>80*n){o=a=i[0],s=l=i[1];for(var _=n;_a&&(a=c),h>l&&(l=h);u=0!==(u=Math.max(a-o,l-s))?1/u:0}return function i(r,n,o,s,a,l,c){if(r){!c&&l&&function(i,r,n,o){var s=i;do null===s.z&&(s.z=sV(s.x,s.y,r,n,o)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i)s.prevZ.nextZ=null,s.prevZ=null,function(i){var r,n,o,s,a,l,c,h,u=1;do{for(n=i,i=null,a=null,l=0;n;){for(l++,o=n,c=0,r=0;r0||h>0&&o;)0!==c&&(0===h||!o||n.z<=o.z)?(s=n,n=n.nextZ,c--):(s=o,o=o.nextZ,h--),a?a.nextZ=s:i=s,s.prevZ=a,a=s;n=o}a.nextZ=null,u*=2}while(l>1)}(s)}(r,s,a,l);for(var h,u,d=r;r.prev!==r.next;)if(h=r.prev,u=r.next,l?function(i,r,n,o){var s=i.prev,a=i.next;if(sj(s,i,a)>=0)return!1;for(var l=s.x>i.x?s.x>a.x?s.x:a.x:i.x>a.x?i.x:a.x,c=s.y>i.y?s.y>a.y?s.y:a.y:i.y>a.y?i.y:a.y,h=sV(s.x=h&&p&&p.z<=u;){if(d!==i.prev&&d!==i.next&&sN(s.x,s.y,i.x,i.y,a.x,a.y,d.x,d.y)&&sj(d.prev,d,d.next)>=0||(d=d.prevZ,p!==i.prev&&p!==i.next&&sN(s.x,s.y,i.x,i.y,a.x,a.y,p.x,p.y)&&sj(p.prev,p,p.next)>=0))return!1;p=p.nextZ}for(;d&&d.z>=h;){if(d!==i.prev&&d!==i.next&&sN(s.x,s.y,i.x,i.y,a.x,a.y,d.x,d.y)&&sj(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=u;){if(p!==i.prev&&p!==i.next&&sN(s.x,s.y,i.x,i.y,a.x,a.y,p.x,p.y)&&sj(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}(r,s,a,l):function(i){var r=i.prev,n=i.next;if(sj(r,i,n)>=0)return!1;for(var o=i.next.next;o!==i.prev;){if(sN(r.x,r.y,i.x,i.y,n.x,n.y,o.x,o.y)&&sj(o.prev,o,o.next)>=0)return!1;o=o.next}return!0}(r))n.push(h.i/o),n.push(r.i/o),n.push(u.i/o),sK(r),r=u.next,d=u.next;else if((r=u)===d){c?1===c?i(r=function(i,r,n){var o=i;do{var s=o.prev,a=o.next.next;!sG(s,a)&&sZ(s,o,o.next,a)&&sX(s,a)&&sX(a,s)&&(r.push(s.i/n),r.push(o.i/n),r.push(a.i/n),sK(o),sK(o.next),o=i=a),o=o.next}while(o!==i)return sO(o)}(sO(r),n,o),n,o,s,a,l,2):2===c&&function(r,n,o,s,a,l){var c=r;do{for(var h,u,d=c.next.next;d!==c.prev;){if(c.i!==d.i&&(h=c,u=d,h.next.i!==u.i&&h.prev.i!==u.i&&!function(i,r){var n=i;do{if(n.i!==i.i&&n.next.i!==i.i&&n.i!==r.i&&n.next.i!==r.i&&sZ(n,n.next,i,r))return!0;n=n.next}while(n!==i)return!1}(h,u)&&(sX(h,u)&&sX(u,h)&&function(i,r){var n=i,o=!1,s=(i.x+r.x)/2,a=(i.y+r.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&s<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(o=!o),n=n.next;while(n!==i)return o}(h,u)&&(sj(h.prev,h,u.prev)||sj(h,u.prev,u))||sG(h,u)&&sj(h.prev,h,h.next)>0&&sj(u.prev,u,u.next)>0))){var p=sW(c,d);return c=sO(c,c.next),p=sO(p,p.next),i(c,n,o,s,a,l),void i(p,n,o,s,a,l)}d=d.next}c=c.next}while(c!==r)}(r,n,o,s,a,l):i(sO(r),n,o,s,a,l,1);break}}}(f,m,n,o,s,u),m}function sF(i,r,n,o,s){var a,l;if(s===sJ(i,r,n,o)>0)for(a=r;a=r;a-=o)l=sH(a,i[a],i[a+1],l);return l&&sG(l,l.next)&&(sK(l),l=l.next),l}function sO(i,r){if(!i)return i;r||(r=i);var n,o=i;do if(n=!1,o.steiner||!sG(o,o.next)&&0!==sj(o.prev,o,o.next))o=o.next;else{if(sK(o),(o=r=o.prev)===o.next)break;n=!0}while(n||o!==r)return r}function sU(i,r){return i.x-r.x}function sV(i,r,n,o,s){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=32767*(i-n)*s)|i<<8))|i<<4))|i<<2))|i<<1))|(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=32767*(r-o)*s)|r<<8))|r<<4))|r<<2))|r<<1))<<1}function sN(i,r,n,o,s,a,l,c){return(s-l)*(r-c)-(i-l)*(a-c)>=0&&(i-l)*(o-c)-(n-l)*(r-c)>=0&&(n-l)*(a-c)-(s-l)*(o-c)>=0}function sj(i,r,n){return(r.y-i.y)*(n.x-r.x)-(r.x-i.x)*(n.y-r.y)}function sG(i,r){return i.x===r.x&&i.y===r.y}function sZ(i,r,n,o){var s=sq(sj(i,r,n)),a=sq(sj(i,r,o)),l=sq(sj(n,o,i)),c=sq(sj(n,o,r));return s!==a&&l!==c||!(0!==s||!s$(i,n,r))||!(0!==a||!s$(i,o,r))||!(0!==l||!s$(n,i,o))||!(0!==c||!s$(n,r,o))}function s$(i,r,n){return r.x<=Math.max(i.x,n.x)&&r.x>=Math.min(i.x,n.x)&&r.y<=Math.max(i.y,n.y)&&r.y>=Math.min(i.y,n.y)}function sq(i){return i>0?1:i<0?-1:0}function sX(i,r){return 0>sj(i.prev,i,i.next)?sj(i,r,i.next)>=0&&sj(i,i.prev,r)>=0:0>sj(i,r,i.prev)||0>sj(i,i.next,r)}function sW(i,r){var n=new sY(i.i,i.x,i.y),o=new sY(r.i,r.x,r.y),s=i.next,a=r.prev;return i.next=r,r.prev=i,n.next=s,s.prev=n,o.next=n,n.prev=o,a.next=o,o.prev=a,o}function sH(i,r,n,o){var s=new sY(i,r,n);return o?(s.next=o.next,s.prev=o,o.next.prev=s,o.next=s):(s.prev=s,s.next=s),s}function sK(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function sY(i,r,n){this.i=i,this.x=r,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function sJ(i,r,n,o){for(var s=0,a=r,l=n-o;ar?1:0}function s1(i,r){let n,o;const s=i.length;if(s<=1)return[i];const a=[];for(let l=0;l1)for(let h=0;ho;){if(s-o>600){var l=s-o+1,c=n-o+1,h=Math.log(l),u=.5*Math.exp(2*h/3),d=.5*Math.sqrt(h*u*(l-u)/l)*(c-l/2<0?-1:1);i(r,n,Math.max(o,Math.floor(n-c*u/l+d)),Math.min(s,Math.floor(n+(l-c)*u/l+d)),a)}var p=r[n],f=o,m=s;for(sQ(r,o,n),a(r[s],p)>0&&sQ(r,o,s);fa(r[f],p);)f++;for(;a(r[m],p)>0;)m--}0===a(r[o],p)?sQ(r,o,m):sQ(r,++m,s),m<=n&&(o=m+1),n<=m&&(s=m-1)}}(u,r,1,d||u.length-1,s2||s0),a[h]=a[h].slice(0,r))}return a}function s2(i,r){return r.area-i.area}function s3(i,r,n){const o=n.patternDependencies;let s=!1;for(const a of r){const l=a.paint.get(`${i}-pattern`);l.isConstant()||(s=!0);const c=l.constantOr(null);c&&(s=!0,o[c.to]=!0,o[c.from]=!0)}return s}function s5(i,r,n,o,s){const a=s.patternDependencies;for(const l of r){const c=l.paint.get(`${i}-pattern`).value;if("constant"!==c.kind){let h=c.evaluate({zoom:o-1},n,{},s.availableImages),u=c.evaluate({zoom:o},n,{},s.availableImages),d=c.evaluate({zoom:o+1},n,{},s.availableImages);h=h&&h.name?h.name:h,u=u&&u.name?u.name:u,d=d&&d.name?d.name:d,a[h]=!0,a[u]=!0,a[d]=!0,n.patterns[l.id]={min:h,mid:u,max:d}}}return n}sR.deviation=function(i,r,n,o){var s=r&&r.length,a=Math.abs(sJ(i,0,s?r[0]*n:i.length,n));if(s)for(var l=0,c=r.length;l0&&n.holes.push(o+=i[s-1].length)}return n},sB.default=sR;class s4{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new nJ,this.indexArray=new oe,this.indexArray2=new oa,this.programConfigurations=new o$(i.layers,i.zoom),this.segments=new o0,this.segments2=new o0,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(i,r,n,o){this.hasPattern=s3("fill",this.layers,r);const s=this.layers[0].layout.get("fill-sort-key"),a=[];for(const{feature:l,id:c,index:h,sourceLayerIndex:u}of i){const d=this.layers[0]._featureFilter.needGeometry,p=si(l,d);if(!this.layers[0]._featureFilter.filter(new nk(this.zoom),p,n))continue;const f=s?s.evaluate(p,{},n,r.availableImages):void 0,m={id:c,properties:l.properties,type:l.type,sourceLayerIndex:u,index:h,geometry:d?p.geometry:st(l,n,o),patterns:{},sortKey:f};a.push(m)}for(const _ of(s&&a.sort((i,r)=>i.sortKey-r.sortKey),a)){const{geometry:g,index:y,sourceLayerIndex:x}=_;if(this.hasPattern){const v=s5("fill",this.layers,_,this.zoom,r);this.patternFeatures.push(v)}else this.addFeature(_,g,y,n,{},r.availableImages);r.featureIndex.insert(i[y].feature,g,y,x,this.index)}}update(i,r,n,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,o)}addFeatures(i,r,n,o){for(const s of this.patternFeatures)this.addFeature(s,s.geometry,s.index,r,n,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,sL),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.indexBuffer2=i.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(i,r,n,o,s,a=[]){for(const l of s1(r,500)){let c=0;for(const h of l)c+=h.length;const u=this.segments.prepareSegment(c,this.layoutVertexArray,this.indexArray),d=u.vertexLength,p=[],f=[];for(const m of l){if(0===m.length)continue;m!==l[0]&&f.push(p.length/2);const _=this.segments2.prepareSegment(m.length,this.layoutVertexArray,this.indexArray2),g=_.vertexLength;this.layoutVertexArray.emplaceBack(m[0].x,m[0].y),this.indexArray2.emplaceBack(g+m.length-1,g),p.push(m[0].x),p.push(m[0].y);for(let y=1;y>3;r=1===o?i.readString():2===o?i.readFloat():3===o?i.readDouble():4===o?i.readVarint64():5===o?i.readVarint():6===o?i.readSVarint():7===o?i.readBoolean():null}return r}(n))}function ao(i,r,n){if(3===i){var o=new ar(n,n.readVarint()+n.pos);o.length&&(r[o.name]=o)}}at.types=["Unknown","Point","LineString","Polygon"],at.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var r,n=i.readVarint()+i.pos,o=1,s=0,a=0,l=0,c=[];i.pos>3}if(s--,1===o||2===o)a+=i.readSVarint(),l+=i.readSVarint(),1===o&&(r&&c.push(r),r=[]),r.push(new u(a,l));else{if(7!==o)throw Error("unknown command "+o);r&&r.push(r[0].clone())}}return r&&c.push(r),c},at.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var r=i.readVarint()+i.pos,n=1,o=0,s=0,a=0,l=1/0,c=-1/0,h=1/0,u=-1/0;i.pos>3}if(o--,1===n||2===n)(s+=i.readSVarint())c&&(c=s),(a+=i.readSVarint())u&&(u=a);else if(7!==n)throw Error("unknown command "+n)}return[l,h,c,u]},at.prototype.toGeoJSON=function(i,r,n){var o,s,a=this.extent*Math.pow(2,n),l=this.extent*i,c=this.extent*r,h=this.loadGeometry(),u=at.types[this.type];function d(i){for(var r=0;r=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[i];var r=this._pbf.readVarint()+this._pbf.pos;return new at(this._pbf,r,this.extent,this._keys,this._values)};var as={VectorTile:function(i,r){this.layers=i.readFields(ao,{},r)},VectorTileFeature:at,VectorTileLayer:ar};const aa=as.VectorTileFeature.types;function al(i,r,n,o,s,a,l,c){i.emplaceBack((r<<1)+l,(n<<1)+a,(Math.floor(8192*o)<<1)+s,Math.round(c))}class ac{constructor(){this.acc=new u(0,0),this.polyCount=[]}startRing(i){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new u(i.x,i.y),this.max=new u(i.x,i.y))}append(i,r){this.currentPolyCount.edges++,this.acc._add(i);let n=!!this.borders;const o=this.min,s=this.max;i.xs.x&&(s.x=i.x,n=!0),i.ys.y&&(s.y=i.y,n=!0),((0===i.x||8192===i.x)&&i.x===r.x)!=((0===i.y||8192===i.y)&&i.y===r.y)&&this.processBorderOverlap(i,r),n&&this.checkBorderIntersection(i,r)}checkBorderIntersection(i,r){r.x<0!=i.x<0&&this.addBorderIntersection(0,io(r.y,i.y,(0-r.x)/(i.x-r.x))),r.x>8192!=i.x>8192&&this.addBorderIntersection(1,io(r.y,i.y,(8192-r.x)/(i.x-r.x))),r.y<0!=i.y<0&&this.addBorderIntersection(2,io(r.x,i.x,(0-r.y)/(i.y-r.y))),r.y>8192!=i.y>8192&&this.addBorderIntersection(3,io(r.x,i.x,(8192-r.y)/(i.y-r.y)))}addBorderIntersection(i,r){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const n=this.borders[i];rn[1]&&(n[1]=r)}processBorderOverlap(i,r){if(i.x===r.x){if(i.y===r.y)return;const n=0===i.x?0:1;this.addBorderIntersection(n,r.y),this.addBorderIntersection(n,i.y)}else{const o=0===i.y?2:3;this.addBorderIntersection(o,r.x),this.addBorderIntersection(o,i.x)}}centroid(){const i=this.polyCount.reduce((i,r)=>i+r.edges,0);return 0!==i?this.acc.div(i)._round():new u(0,0)}span(){return new u(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce((i,r)=>i+ +(r[0]!==Number.MAX_VALUE),0)}}class ah{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.hasPattern=!1,this.layoutVertexArray=new nQ,this.centroidVertexArray=new ow,this.indexArray=new oe,this.programConfigurations=new o$(i.layers,i.zoom),this.segments=new o0,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.enableTerrain=i.enableTerrain}populate(i,r,n,o){for(const{feature:s,id:a,index:l,sourceLayerIndex:c}of(this.features=[],this.hasPattern=s3("fill-extrusion",this.layers,r),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDone=[!1,!1,!1,!1],this.tileToMeter=function(i){const r=Math.exp(Math.PI*(1-i.y/(1<i.x<=0)||l.every(i=>i.x>=8192)||l.every(i=>i.y<=0)||l.every(i=>i.y>=8192))continue;for(let p=0;p=1){const y=f[_-1];if((g.x!==y.x||!(g.x<0)&&!(g.x>8192))&&(g.y!==y.y||!(g.y<0)&&!(g.y>8192))){c&&c.append(g,y),d.vertexLength+4>o0.MAX_VERTEX_ARRAY_LENGTH&&(d=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const x=g.sub(y)._perp(),v=x.x/(Math.abs(x.x)+Math.abs(x.y)),b=x.y>0?1:0,w=y.dist(g);m+w>32768&&(m=0),al(this.layoutVertexArray,g.x,g.y,v,b,0,0,m),al(this.layoutVertexArray,g.x,g.y,v,b,0,1,m),m+=w,al(this.layoutVertexArray,y.x,y.y,v,b,0,0,m),al(this.layoutVertexArray,y.x,y.y,v,b,0,1,m);const T=d.vertexLength;this.indexArray.emplaceBack(T,T+2,T+1),this.indexArray.emplaceBack(T+1,T+2,T+3),d.vertexLength+=4,d.primitiveLength+=2}}}}if(d.vertexLength+u>o0.MAX_VERTEX_ARRAY_LENGTH&&(d=this.segments.prepareSegment(u,this.layoutVertexArray,this.indexArray)),"Polygon"!==aa[i.type])continue;const E=[],S=[],I=d.vertexLength;for(let M=0;M0){if(c.borders){c.vertexArrayOffset=this.centroidVertexArray.length;const D=c.borders,L=this.featuresOnBorder.push(c)-1;for(let B=0;B<4;B++)D[B][0]!==Number.MAX_VALUE&&this.borders[B].push(L)}this.encodeCentroid(c.borders?void 0:c.centroid(),c)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,s,a,o)}sortBorders(){for(let i=0;i<4;i++)this.borders[i].sort((r,n)=>this.featuresOnBorder[r].borders[i][0]-this.featuresOnBorder[n].borders[i][0])}encodeCentroid(i,r,n=!0){let o,s;if(i){if(0!==i.y){const a=r.span()._mult(this.tileToMeter);o=(Math.max(i.x,1)<<3)+Math.min(7,Math.round(a.x/10)),s=(Math.max(i.y,1)<<3)+Math.min(7,Math.round(a.y/10))}else o=Math.ceil(7*(i.x+450)),s=0}else o=0,s=+n;let l=n?this.centroidVertexArray.length:r.vertexArrayOffset;for(const c of r.polyCount){n&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*c.edges+c.top);for(let h=0;h<2*c.edges;h++)this.centroidVertexArray.emplace(l++,0,s),this.centroidVertexArray.emplace(l++,o,s);for(let u=0;ui.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new n0,this.layoutVertexArray2=new n1,this.indexArray=new oe,this.programConfigurations=new o$(i.layers,i.zoom),this.segments=new o0,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(i,r,n,o){this.hasPattern=s3("line",this.layers,r);const s=this.layers[0].layout.get("line-sort-key"),a=[];for(const{feature:l,id:c,index:h,sourceLayerIndex:u}of i){const d=this.layers[0]._featureFilter.needGeometry,p=si(l,d);if(!this.layers[0]._featureFilter.filter(new nk(this.zoom),p,n))continue;const f=s?s.evaluate(p,{},n):void 0,m={id:c,properties:l.properties,type:l.type,sourceLayerIndex:u,index:h,geometry:d?p.geometry:st(l,n,o),patterns:{},sortKey:f};a.push(m)}s&&a.sort((i,r)=>i.sortKey-r.sortKey);const{lineAtlas:_,featureIndex:g}=r,y=this.addConstantDashes(_);for(const x of a){const{geometry:v,index:b,sourceLayerIndex:w}=x;if(y&&this.addFeatureDashes(x,_),this.hasPattern){const T=s5("line",this.layers,x,this.zoom,r);this.patternFeatures.push(T)}else this.addFeature(x,v,b,n,_.positions,r.availableImages);g.insert(i[b].feature,v,b,w,this.index)}}addConstantDashes(i){let r=!1;for(const n of this.layers){const o=n.paint.get("line-dasharray").value,s=n.layout.get("line-cap").value;if("constant"!==o.kind||"constant"!==s.kind)r=!0;else{const a=s.value,l=o.value;if(!l)continue;i.addDash(l.from,a),i.addDash(l.to,a),l.other&&i.addDash(l.other,a)}}return r}addFeatureDashes(i,r){const n=this.zoom;for(const o of this.layers){let s,a,l,c,h,u;const d=o.paint.get("line-dasharray").value,p=o.layout.get("line-cap").value;if("constant"===d.kind&&"constant"===p.kind)continue;if("constant"===d.kind){const f=d.value;if(!f)continue;s=f.other||f.to,a=f.to,l=f.from}else s=d.evaluate({zoom:n-1},i),a=d.evaluate({zoom:n},i),l=d.evaluate({zoom:n+1},i);"constant"===p.kind?c=h=u=p.value:(c=p.evaluate({zoom:n-1},i),h=p.evaluate({zoom:n},i),u=p.evaluate({zoom:n+1},i)),r.addDash(s,c),r.addDash(a,h),r.addDash(l,u);const m=r.getKey(s,c),_=r.getKey(a,h),g=r.getKey(l,u);i.patterns[o.id]={min:m,mid:_,max:g}}}update(i,r,n,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,o)}addFeatures(i,r,n,o){for(const s of this.patternFeatures)this.addFeature(s,s.geometry,s.index,r,n,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=i.createVertexBuffer(this.layoutVertexArray2,ay)),this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,a_),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(i){if(i.properties&&i.properties.hasOwnProperty("mapbox_clip_start")&&i.properties.hasOwnProperty("mapbox_clip_end"))return{start:+i.properties.mapbox_clip_start,end:+i.properties.mapbox_clip_end}}addFeature(i,r,n,o,s,a){const l=this.layers[0].layout,c=l.get("line-join").evaluate(i,{}),h=l.get("line-cap").evaluate(i,{}),u=l.get("line-miter-limit"),d=l.get("line-round-limit");for(const p of(this.lineClips=this.lineFeatureClips(i),r))this.addLine(p,i,c,h,u,d);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,s,a,o)}addLine(i,r,n,o,s,a){let l,c,h,u,d;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let p=0;p=2&&i[m-1].equals(i[m-2]);)m--;let _=0;for(;_0;if(S&&x>_){const M=l.dist(c);if(M>2*g){const A=l.sub(l.sub(c)._mult(g/M)._round());this.updateDistance(c,A),this.addCurrentVertex(A,u,0,0,y),c=A}}const C=c&&h;let z=C?n:f?"butt":o;if(C&&"round"===z&&(Ts&&(z="bevel"),"bevel"===z&&(T>2&&(z="flipbevel"),T100)v=d.mult(-1);else{const k=T*u.add(d).mag()/u.sub(d).mag();v._perp()._mult(k*(I?-1:1))}this.addCurrentVertex(l,v,0,0,y),this.addCurrentVertex(l,v.mult(-1),0,0,y)}else if("bevel"===z||"fakeround"===z){const P=-Math.sqrt(T*T-1),D=I?P:0,L=I?0:P;if(c&&this.addCurrentVertex(l,u,D,L,y),"fakeround"===z){const B=Math.round(180*E/Math.PI/20);for(let R=1;R2*g){const j=l.add(h.sub(l)._mult(g/N)._round());this.updateDistance(l,j),this.addCurrentVertex(j,d,0,0,y),l=j}}}}addCurrentVertex(i,r,n,o,s,a=!1){const l=r.y*o-r.x,c=-r.y-r.x*o;this.addHalfVertex(i,r.x+r.y*n,r.y-r.x*n,a,!1,n,s),this.addHalfVertex(i,l,c,a,!0,-o,s)}addHalfVertex({x:i,y:r},n,o,s,a,l,c){this.layoutVertexArray.emplaceBack((i<<1)+(s?1:0),(r<<1)+(a?1:0),Math.round(63*n)+128,Math.round(63*o)+128,1+(0===l?0:l<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineSoFar);const h=c.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,h),c.primitiveLength++),a?this.e2=h:this.e1=h}updateScaledDistance(){if(this.lineClips){const i=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=i*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(i,r){this.distance+=i.dist(r),this.updateScaledDistance()}}r$("LineBucket",ab,{omit:["layers","patternFeatures"]});const aw=new n$({"line-cap":new nN(tr.layout_line["line-cap"]),"line-join":new nN(tr.layout_line["line-join"]),"line-miter-limit":new nV(tr.layout_line["line-miter-limit"]),"line-round-limit":new nV(tr.layout_line["line-round-limit"]),"line-sort-key":new nN(tr.layout_line["line-sort-key"])});var aT={paint:new n$({"line-opacity":new nN(tr.paint_line["line-opacity"]),"line-color":new nN(tr.paint_line["line-color"]),"line-translate":new nV(tr.paint_line["line-translate"]),"line-translate-anchor":new nV(tr.paint_line["line-translate-anchor"]),"line-width":new nN(tr.paint_line["line-width"]),"line-gap-width":new nN(tr.paint_line["line-gap-width"]),"line-offset":new nN(tr.paint_line["line-offset"]),"line-blur":new nN(tr.paint_line["line-blur"]),"line-dasharray":new nj(tr.paint_line["line-dasharray"]),"line-pattern":new nj(tr.paint_line["line-pattern"]),"line-gradient":new nZ(tr.paint_line["line-gradient"])}),layout:aw};const aE=new class extends nN{possiblyEvaluate(i,r){return r=new nk(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(i,r)}evaluate(i,r,n,o){return r=J({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(i,r,n,o)}}(aT.paint.properties["line-width"].specification);aE.useIntegerZoom=!0;const aS=nK([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_z_tile_anchor",components:4,type:"Int16"}],4),aI=nK([{name:"a_projected_pos",components:3,type:"Float32"}],4);nK([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const aM=nK([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),aA=nK([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);nK([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const aC=nK([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),az=nK([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function ak(i,r){const{expression:n}=r;if("constant"===n.kind)return{kind:"constant",layoutSize:n.evaluate(new nk(i+1))};if("source"===n.kind)return{kind:"source"};{const{zoomStops:o,interpolationType:s}=n;let a=0;for(;a":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","\xa2":"¢","\xa3":"£","\xa5":"¥","\xa6":"¦","\xac":"¬","\xaf":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var aR=function(i,r,n,o,s){var a,l,c=8*s-o-1,h=(1<>1,d=-7,p=n?s-1:0,f=n?-1:1,m=i[r+p];for(p+=f,a=m&(1<<-d)-1,m>>=-d,d+=c;d>0;a=256*a+i[r+p],p+=f,d-=8);for(l=a&(1<<-d)-1,a>>=-d,d+=o;d>0;l=256*l+i[r+p],p+=f,d-=8);if(0===a)a=1-u;else{if(a===h)return l?NaN:1/0*(m?-1:1);l+=Math.pow(2,o),a-=u}return(m?-1:1)*l*Math.pow(2,a-o)},aF=function(i,r,n,o,s,a){var l,c,h,u=8*a-s-1,d=(1<>1,f=23===s?5960464477539062e-23:0,m=o?0:a-1,_=o?1:-1,g=r<0||0===r&&1/r<0?1:0;for(isNaN(r=Math.abs(r))||r===1/0?(c=isNaN(r)?1:0,l=d):(l=Math.floor(Math.log(r)/Math.LN2),r*(h=Math.pow(2,-l))<1&&(l--,h*=2),(r+=l+p>=1?f/h:f*Math.pow(2,1-p))*h>=2&&(l++,h/=2),l+p>=d?(c=0,l=d):l+p>=1?(c=(r*h-1)*Math.pow(2,s),l+=p):(c=r*Math.pow(2,p-1)*Math.pow(2,s),l=0));s>=8;i[n+m]=255&c,m+=_,c/=256,s-=8);for(l=l<0;i[n+m]=255&l,m+=_,l/=256,u-=8);i[n+m-_]|=128*g};function aO(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}aO.Varint=0,aO.Fixed64=1,aO.Bytes=2,aO.Fixed32=5;var aU="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function aV(i){return i.type===aO.Bytes?i.readVarint()+i.pos:i.pos+1}function aN(i,r,n){var o=r<=16383?1:r<=2097151?2:r<=268435455?3:Math.floor(Math.log(r)/(7*Math.LN2));n.realloc(o);for(var s=n.pos-1;s>=i;s--)n.buf[s+o]=n.buf[s]}function aj(i,r){for(var n=0;n>>8,i[n+2]=r>>>16,i[n+3]=r>>>24}function aQ(i,r){return(i[r]|i[r+1]<<8|i[r+2]<<16)+(i[r+3]<<24)}function a0(i,r,n){r.glyphs=[],1===i&&n.readMessage(a1,r)}function a1(i,r,n){if(3===i){const{id:o,bitmap:s,width:a,height:l,left:c,top:h,advance:u}=n.readMessage(a2,{});r.glyphs.push({id:o,bitmap:new sA({width:a+6,height:l+6},s),metrics:{width:a,height:l,left:c,top:h,advance:u}})}else 4===i?r.ascender=n.readSVarint():5===i&&(r.descender=n.readSVarint())}function a2(i,r,n){1===i?r.id=n.readVarint():2===i?r.bitmap=n.readBytes():3===i?r.width=n.readVarint():4===i?r.height=n.readVarint():5===i?r.left=n.readSVarint():6===i?r.top=n.readSVarint():7===i&&(r.advance=n.readVarint())}function a3(i){let r=0,n=0;for(const o of i)r+=o.w*o.h,n=Math.max(n,o.w);i.sort((i,r)=>r.h-i.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(r/.95)),n),h:1/0}];let a=0,l=0;for(const c of i)for(let h=s.length-1;h>=0;h--){const u=s[h];if(!(c.w>u.w||c.h>u.h)){if(c.x=u.x,c.y=u.y,l=Math.max(l,c.y+c.h),a=Math.max(a,c.x+c.w),c.w===u.w&&c.h===u.h){const d=s.pop();h>3,a=this.pos;this.type=7&o,i(s,r,this),this.pos===a&&this.skip(o)}return r},readMessage:function(i,r){return this.readFields(i,r,this.readVarint()+this.pos)},readFixed32:function(){var i=aY(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=aQ(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=aY(this.buf,this.pos)+4294967296*aY(this.buf,this.pos+4);return this.pos+=8,i},readSFixed64:function(){var i=aY(this.buf,this.pos)+4294967296*aQ(this.buf,this.pos+4);return this.pos+=8,i},readFloat:function(){var i=aR(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=aR(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var r,n,o=this.buf;return r=127&(n=o[this.pos++]),n<128?r:(r|=(127&(n=o[this.pos++]))<<7,n<128?r:(r|=(127&(n=o[this.pos++]))<<14,n<128?r:(r|=(127&(n=o[this.pos++]))<<21,n<128?r:function(i,r,n){var o,s,a,l=n.buf;if(s=(112&(a=l[n.pos++]))>>4,a<128||(s|=(127&(a=l[n.pos++]))<<3,a<128)||(s|=(127&(a=l[n.pos++]))<<10,a<128)||(s|=(127&(a=l[n.pos++]))<<17,a<128)||(s|=(127&(a=l[n.pos++]))<<24,a<128)||(s|=(1&(a=l[n.pos++]))<<31,a<128))return o=s,r?4294967296*o+(i>>>0):4294967296*(o>>>0)+(i>>>0);throw Error("Expected varint not more than 10 bytes")}(r|=(15&(n=o[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?-((i+1)/2):i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i,r=this.readVarint()+this.pos,n=this.pos;return this.pos=r,r-n>=12&&aU?(i=this.buf,aU.decode(i.subarray(n,r))):function(i,r,n){for(var o="",s=r;s239?4:h>223?3:h>191?2:1;if(s+d>n)break;1===d?h<128&&(u=h):2===d?128==(192&(a=i[s+1]))&&(u=(31&h)<<6|63&a)<=127&&(u=null):3===d?(l=i[s+2],128==(192&(a=i[s+1]))&&128==(192&l)&&((u=(15&h)<<12|(63&a)<<6|63&l)<=2047||u>=55296&&u<=57343)&&(u=null)):4===d&&(l=i[s+2],c=i[s+3],128==(192&(a=i[s+1]))&&128==(192&l)&&128==(192&c)&&((u=(15&h)<<18|(63&a)<<12|(63&l)<<6|63&c)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,d=1):u>65535&&(u-=65536,o+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),o+=String.fromCharCode(u),s+=d}return o}(this.buf,n,r)},readBytes:function(){var i=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,i);return this.pos=i,r},readPackedVarint:function(i,r){if(this.type!==aO.Bytes)return i.push(this.readVarint(r));var n=aV(this);for(i=i||[];this.pos127;);else if(r===aO.Bytes)this.pos=this.readVarint()+this.pos;else if(r===aO.Fixed32)this.pos+=4;else{if(r!==aO.Fixed64)throw Error("Unimplemented type: "+r);this.pos+=8}},writeTag:function(i,r){this.writeVarint(i<<3|r)},realloc:function(i){for(var r=this.length||16;r268435455||i<0?function(i,r){var n,o,s,a,l,c,h;if(i>=0?(n=i%4294967296|0,o=i/4294967296|0):(o=~(-i/4294967296),4294967295^(n=~(-i%4294967296))?n=n+1|0:(n=0,o=o+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw Error("Given varint doesn't fit into 10 bytes");r.realloc(10),s=n,(a=r).buf[a.pos++]=127&s|128,s>>>=7,a.buf[a.pos++]=127&s|128,s>>>=7,a.buf[a.pos++]=127&s|128,s>>>=7,a.buf[a.pos++]=127&s|128,a.buf[a.pos]=127&(s>>>=7),l=o,c=r,h=(7&l)<<4,c.buf[c.pos++]|=h|((l>>>=3)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l)))))}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?-(2*i)-1:2*i)},writeBoolean:function(i){this.writeVarint(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var r=this.pos;this.pos=function(i,r,n){for(var o,s,a=0;a55295&&o<57344){if(!s){o>56319||a+1===r.length?(i[n++]=239,i[n++]=191,i[n++]=189):s=o;continue}if(o<56320){i[n++]=239,i[n++]=191,i[n++]=189,s=o;continue}o=s-55296<<10|o-56320|65536,s=null}else s&&(i[n++]=239,i[n++]=191,i[n++]=189,s=null);o<128?i[n++]=o:(o<2048?i[n++]=o>>6|192:(o<65536?i[n++]=o>>12|224:(i[n++]=o>>18|240,i[n++]=o>>12&63|128),i[n++]=o>>6&63|128),i[n++]=63&o|128)}return n}(this.buf,i,this.pos);var n=this.pos-r;n>=128&&aN(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeFloat:function(i){this.realloc(4),aF(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),aF(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var r=i.length;this.writeVarint(r),this.realloc(r);for(var n=0;n=128&&aN(n,o,this),this.pos=n-1,this.writeVarint(o),this.pos+=o},writeMessage:function(i,r,n){this.writeTag(i,aO.Bytes),this.writeRawMessage(r,n)},writePackedVarint:function(i,r){r.length&&this.writeMessage(i,aj,r)},writePackedSVarint:function(i,r){r.length&&this.writeMessage(i,aG,r)},writePackedBoolean:function(i,r){r.length&&this.writeMessage(i,aq,r)},writePackedFloat:function(i,r){r.length&&this.writeMessage(i,aZ,r)},writePackedDouble:function(i,r){r.length&&this.writeMessage(i,a$,r)},writePackedFixed32:function(i,r){r.length&&this.writeMessage(i,aX,r)},writePackedSFixed32:function(i,r){r.length&&this.writeMessage(i,aW,r)},writePackedFixed64:function(i,r){r.length&&this.writeMessage(i,aH,r)},writePackedSFixed64:function(i,r){r.length&&this.writeMessage(i,aK,r)},writeBytesField:function(i,r){this.writeTag(i,aO.Bytes),this.writeBytes(r)},writeFixed32Field:function(i,r){this.writeTag(i,aO.Fixed32),this.writeFixed32(r)},writeSFixed32Field:function(i,r){this.writeTag(i,aO.Fixed32),this.writeSFixed32(r)},writeFixed64Field:function(i,r){this.writeTag(i,aO.Fixed64),this.writeFixed64(r)},writeSFixed64Field:function(i,r){this.writeTag(i,aO.Fixed64),this.writeSFixed64(r)},writeVarintField:function(i,r){this.writeTag(i,aO.Varint),this.writeVarint(r)},writeSVarintField:function(i,r){this.writeTag(i,aO.Varint),this.writeSVarint(r)},writeStringField:function(i,r){this.writeTag(i,aO.Bytes),this.writeString(r)},writeFloatField:function(i,r){this.writeTag(i,aO.Fixed32),this.writeFloat(r)},writeDoubleField:function(i,r){this.writeTag(i,aO.Fixed64),this.writeDouble(r)},writeBooleanField:function(i,r){this.writeVarintField(i,Boolean(r))}};class a5{constructor(i,{pixelRatio:r,version:n,stretchX:o,stretchY:s,content:a}){this.paddedRect=i,this.pixelRatio=r,this.stretchX=o,this.stretchY=s,this.content=a,this.version=n}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class a4{constructor(i,r){const n={},o={};this.haveRenderCallbacks=[];const s=[];this.addImages(i,n,s),this.addImages(r,o,s);const{w:a,h:l}=a3(s),c=new sC({width:a||1,height:l||1});for(const h in i){const u=i[h],d=n[h].paddedRect;sC.copy(u.data,c,{x:0,y:0},{x:d.x+1,y:d.y+1},u.data)}for(const p in r){const f=r[p],m=o[p].paddedRect,_=m.x+1,g=m.y+1,y=f.data.width,x=f.data.height;sC.copy(f.data,c,{x:0,y:0},{x:_,y:g},f.data),sC.copy(f.data,c,{x:0,y:x-1},{x:_,y:g-1},{width:y,height:1}),sC.copy(f.data,c,{x:0,y:0},{x:_,y:g+x},{width:y,height:1}),sC.copy(f.data,c,{x:y-1,y:0},{x:_-1,y:g},{width:1,height:x}),sC.copy(f.data,c,{x:0,y:0},{x:_+y,y:g},{width:1,height:x})}this.image=c,this.iconPositions=n,this.patternPositions=o}addImages(i,r,n){for(const o in i){const s=i[o],a={x:0,y:0,w:s.data.width+2,h:s.data.height+2};n.push(a),r[o]=new a5(a,s),s.hasRenderCallback&&this.haveRenderCallbacks.push(o)}}patchUpdatedImages(i,r){for(const n in i.dispatchRenderCallbacks(this.haveRenderCallbacks),i.updatedImages)this.patchUpdatedImage(this.iconPositions[n],i.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],i.getImage(n),r)}patchUpdatedImage(i,r,n){if(!i||!r||i.version===r.version)return;i.version=r.version;const[o,s]=i.tl;n.update(r.data,void 0,{x:o,y:s})}}r$("ImagePosition",a5),r$("ImageAtlas",a4);const a6={horizontal:1,vertical:2,horizontalOnly:3};class a8{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(i,r){const n=new a8;return n.scale=i||1,n.fontStack=r,n}static forImage(i){const r=new a8;return r.imageName=i,r}}class a9{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(i,r){const n=new a9;for(let o=0;o=0&&o>=i&&le[this.text.charCodeAt(o)];o--)n--;this.text=this.text.substring(i,n),this.sectionIndex=this.sectionIndex.slice(i,n)}substring(i,r){const n=new a9;return n.text=this.text.substring(i,r),n.sectionIndex=this.sectionIndex.slice(i,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((i,r)=>Math.max(i,this.sections[r].scale),0)}addTextSection(i,r){this.text+=i.text,this.sections.push(a8.forText(i.scale,i.fontStack||r));const n=this.sections.length-1;for(let o=0;o=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function a7(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g){let y;const x=a9.fromFeature(i,s);p===a6.vertical&&x.verticalizePunctuation(f);const{processBidirectionalText:v,processStyledBidirectionalText:b}=nz;if(v&&1===x.sections.length){y=[];const w=v(x.toString(),lo(x,u,a,r,o,m,_));for(const T of w){const E=new a9;E.text=T,E.sections=x.sections;for(let S=0;S0&&$>C&&(C=$)}else{const q=n[D.fontStack];if(!q)continue;q[B]&&(O=q[B]);const X=r[D.fontStack];if(!X)continue;const W=X.glyphs[B];if(!W)continue;if(F=W.metrics,V=8203!==B?24:0,y){const H=void 0!==X.ascender?Math.abs(X.ascender):0,K=void 0!==X.descender?Math.abs(X.descender):0,Y=(H+K)*R;z=0;let d=0;for(let p=0;p-n/2;){if(--l<0)return!1;c-=i[l].dist(a),a=i[l]}c+=i[l].dist(i[l+1]),l++;const h=[];let u=0;for(;co;)u-=h.shift().angleDelta;if(u>s)return!1;l++,c+=d.dist(p)}return!0}function lu(i){let r=0;for(let n=0;n=o&&f.x>=o||(p.x>=o?p=new u(o,p.y+(o-p.x)/(f.x-p.x)*(f.y-p.y))._round():f.x>=o&&(f=new u(o,p.y+(o-p.x)/(f.x-p.x)*(f.y-p.y))._round()),p.y>=s&&f.y>=s||(p.y>=s?p=new u(p.x+(s-p.y)/(f.y-p.y)*(f.x-p.x),s)._round():f.y>=s&&(f=new u(p.x+(s-p.y)/(f.y-p.y)*(f.x-p.x),s)._round()),c&&p.equals(c[c.length-1])||(c=[p],a.push(c)),c.push(f)))))}}return a}function lf(i,r,n,o,s,a,l,c,h){for(let u=r;u-1)a[++h]=c,l[h]=u,l[h+1]=1e20}for(let f=0,m=0;f{let o=this.entries[i];o||(o=this.entries[i]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let s=o.glyphs[r];if(void 0!==s)return void n(null,{stack:i,id:r,glyph:s});if(s=this._tinySDF(o,i,r))return o.glyphs[r]=s,void n(null,{stack:i,id:r,glyph:s});const a=Math.floor(r/256);if(256*a>65535)return void n(Error("glyphs > 65535 not supported"));if(o.ranges[a])return void n(null,{stack:i,id:r,glyph:s});let l=o.requests[a];l||(l=o.requests[a]=[],lg.loadGlyphRange(i,a,this.url,this.requestManager,(i,r)=>{if(r){for(const n in o.ascender=r.ascender,o.descender=r.descender,r.glyphs)this._doesCharSupportLocalGlyph(+n)||(o.glyphs[+n]=r.glyphs[+n]);o.ranges[a]=!0}for(const s of l)s(i,r);delete o.requests[a]})),l.push((o,s)=>{o?n(o):s&&n(null,{stack:i,id:r,glyph:s.glyphs[r]||null})})},(i,n)=>{if(i)r(i);else if(n){const o={};for(const{stack:s,id:a,glyph:l}of n)void 0===o[s]&&(o[s]={}),void 0===o[s].glyphs&&(o[s].glyphs={}),o[s].glyphs[a]=l&&{id:l.id,bitmap:l.bitmap.clone(),metrics:l.metrics},o[s].ascender=this.entries[s].ascender,o[s].descender=this.entries[s].descender;r(null,o)}})}_doesCharSupportLocalGlyph(i){return this.localGlyphMode!==l_.none&&(this.localGlyphMode===l_.all?!!this.localFontFamily:!!this.localFontFamily&&(nn(i)||na(i)||r4(i)||r6(i))||r5(i))}_tinySDF(i,r,n){const o=this.localFontFamily;if(!o||!this._doesCharSupportLocalGlyph(n))return;let s=i.tinySDF;if(!s){let a="400";/bold/i.test(r)?a="900":/medium/i.test(r)?a="500":/light/i.test(r)&&(a="200"),(s=i.tinySDF=new lg.TinySDF({fontFamily:o,fontWeight:a,fontSize:48,buffer:6,radius:16})).fontWeight=a}if(this.localGlyphs[s.fontWeight][n])return this.localGlyphs[s.fontWeight][n];const l=String.fromCharCode(n),{data:c,width:h,height:u,glyphWidth:d,glyphHeight:p,glyphLeft:f,glyphTop:m,glyphAdvance:_}=s.draw(l);return this.localGlyphs[s.fontWeight][n]={id:n,bitmap:new sA({width:h,height:u},c),metrics:{width:d/2,height:p/2,left:f/2,top:m/2-27,advance:_/2,localGlyph:!0}}}}function ly(i,r,n,o){const s=[],a=i.image,l=a.pixelRatio,c=a.paddedRect.w-2,h=a.paddedRect.h-2,d=i.right-i.left,p=i.bottom-i.top,f=a.stretchX||[[0,c]],m=a.stretchY||[[0,h]],_=(i,r)=>i+r[1]-r[0],g=f.reduce(_,0),y=m.reduce(_,0),x=c-g,v=h-y;let b=0,w=g,T=0,E=y,S=0,I=x,M=0,A=v;if(a.content&&o){const C=a.content;b=lx(f,0,C[0]),T=lx(m,0,C[1]),w=lx(f,C[0],C[2]),E=lx(m,C[1],C[3]),S=C[0]-b,M=C[1]-T,I=C[2]-C[0]-w,A=C[3]-C[1]-E}const z=(o,s,c,h)=>{const f=(o.stretch-b)/w*d+i.left,m=o.fixed-S-I*o.stretch/g,_=(s.stretch-T)/E*p+i.top,x=s.fixed-M-A*s.stretch/y,v=(c.stretch-b)/w*d+i.left,C=c.fixed-S-I*c.stretch/g,z=(h.stretch-T)/E*p+i.top,k=h.fixed-M-A*h.stretch/y,P=new u(f,_),D=new u(v,_),L=new u(v,z),B=new u(f,z),R=new u(m/l,x/l),F=new u(C/l,k/l),O=r*Math.PI/180;if(O){const U=Math.sin(O),V=Math.cos(O),N=[V,-U,U,V];P._matMult(N),D._matMult(N),B._matMult(N),L._matMult(N)}const j=o.stretch+o.fixed,G=s.stretch+s.fixed;return{tl:P,tr:D,bl:B,br:L,tex:{x:a.paddedRect.x+1+j,y:a.paddedRect.y+1+G,w:c.stretch+c.fixed-j,h:h.stretch+h.fixed-G},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:R,pixelOffsetBR:F,minFontScaleX:I/l/d,minFontScaleY:A/l/p,isSDF:n}};if(o&&(a.stretchX||a.stretchY)){const k=lv(f,x,g),P=lv(m,v,y);for(let D=0;D{if(i)s(i);else if(r){const n={},o=new aO(r).readFields(a0,{});for(const a of o.glyphs)n[a.id]=a;s(null,{glyphs:n,ascender:o.ascender,descender:o.descender})}})},lg.TinySDF=class{constructor({fontSize:i=24,buffer:r=3,radius:n=8,cutoff:o=.25,fontFamily:s="sans-serif",fontWeight:a="normal",fontStyle:l="normal"}){this.buffer=r,this.cutoff=o,this.radius=n;const c=this.size=i+4*r,h=this._createCanvas(c),u=this.ctx=h.getContext("2d",{willReadFrequently:!0});u.font=`${l} ${a} ${i}px ${s}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(c*c),this.gridInner=new Float64Array(c*c),this.f=new Float64Array(c),this.z=new Float64Array(c+1),this.v=new Uint16Array(c)}_createCanvas(i){const r=document.createElement("canvas");return r.width=r.height=i,r}draw(i){const{width:r,actualBoundingBoxAscent:n,actualBoundingBoxDescent:o,actualBoundingBoxLeft:s,actualBoundingBoxRight:a}=this.ctx.measureText(i),l=Math.floor(n),c=Math.min(this.size-this.buffer,Math.ceil(a-s)),h=Math.min(this.size-this.buffer,Math.ceil(n)+Math.ceil(o)),u=c+2*this.buffer,d=h+2*this.buffer,p=u*d,f=new Uint8ClampedArray(p),m={data:f,width:u,height:d,glyphWidth:c,glyphHeight:h,glyphTop:l,glyphLeft:0,glyphAdvance:r};if(0===c||0===h)return m;const{ctx:_,buffer:g,gridInner:y,gridOuter:x}=this;_.clearRect(g,g,c,h),_.fillText(i,g,g+l+1);const v=_.getImageData(g,g,c,h);x.fill(1e20,0,p),y.fill(0,0,p);for(let b=0;b0?S*S:0,y[E]=S<0?S*S:0}}lf(x,0,0,u,d,u,this.f,this.v,this.z),lf(y,g,g,c,h,u,this.f,this.v,this.z);for(let I=0;I0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(i){this.data.push(i),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const i=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:r,compare:n}=this,o=r[i];for(;i>0;){const s=i-1>>1,a=r[s];if(n(o,a)>=0)break;r[i]=a,i=s}r[i]=o}_down(i){const{data:r,compare:n}=this,o=this.length>>1,s=r[i];for(;in(r[c],l)&&(a=c,l=r[c]),n(l,s)>=0)break;r[i]=l,i=a}r[i]=s}}function lw(i,r){return ir?1:0}function lT(i,r){return r.max-i.max}function lE(i,r,n,o){this.p=new u(i,r),this.h=n,this.d=function(i,r){let n=!1,o=1/0;for(let s=0;si.y!=d.y>i.y&&i.x<(d.x-u.x)*(i.y-u.y)/(d.y-u.y)+u.x&&(n=!n),o=Math.min(o,sc(i,u,d))}}return(n?1:-1)*Math.sqrt(o)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}const lS=Number.POSITIVE_INFINITY,lI=Math.sqrt(2);function lM(i,r){return r[1]!==lS?function(i,r,n){let o=0,s=0;switch(r=Math.abs(r),n=Math.abs(n),i){case"top-right":case"top-left":case"top":s=n-7;break;case"bottom-right":case"bottom-left":case"bottom":s=7-n}switch(i){case"top-right":case"bottom-right":case"right":o=-r;break;case"top-left":case"bottom-left":case"left":o=r}return[o,s]}(i,r[0],r[1]):function(i,r){let n=0,o=0;r<0&&(r=0);const s=r/lI;switch(i){case"top-right":case"top-left":o=s-7;break;case"bottom-right":case"bottom-left":o=7-s;break;case"bottom":o=7-r;break;case"top":o=r-7}switch(i){case"top-right":case"bottom-right":n=-s;break;case"top-left":case"bottom-left":n=s;break;case"left":n=r;break;case"right":n=-r}return[n,o]}(i,r[0])}function lA(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function lC(i,r,n,o,s,a,l,c,h,d,p,f,m,_,g,y,x){const v=function(i,r,n,o,s,a,l,c){const h=[];if(0===r.positionedLines.length)return h;const d=o.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,p=function(i){const r=i[0],n=i[1],o=r*n;return o>0?[r,-n]:o<0?[-r,n]:0===r?[n,r]:[n,-r]}(n);let f=Math.abs(r.top-r.bottom);for(const m of r.positionedLines)f-=m.lineOffset;const _=r.positionedLines.length,g=f/_;let y=r.top-n[1];for(let x=0;x<_;++x){const v=r.positionedLines[x];for(const b of(y=function(i,r,n,o){const s=r+i.positionedLines[o].lineOffset;return 0===o?n+s/2:n+(s+(r+i.positionedLines[o-1].lineOffset))/2}(r,g,y,x),v.positionedGlyphs)){let w,T,E,S;if(!b.rect)continue;const I=b.rect||{};let M=4,A=!0,C=1,z=0;if(b.imageName){const k=l[b.imageName];if(!k)continue;if(k.sdf){eh("SDF images are not supported in formatted text and will be ignored.");continue}A=!1,M=1/(C=k.pixelRatio)}const P=(s||c)&&b.vertical,D=b.metrics.advance*b.scale/2,L=b.metrics,B=b.rect;if(null===B)continue;c&&r.verticalizable&&(z=b.imageName?D-b.metrics.width*b.scale/2:0);const R=s?[b.x+D,b.y]:[0,0];let F=[0,0],O=[0,0],U=!1;s||(P?(O=[b.x+D+p[0],b.y+p[1]-z],U=!0):F=[b.x+D+n[0],b.y+n[1]-z]);const V=B.w*b.scale/(C*(b.localGlyph?2:1)),N=B.h*b.scale/(C*(b.localGlyph?2:1));if(P){const j=b.y-y,G=new u(-D,D-j),Z=-Math.PI/2,$=new u(...O);(w=new u(-D+F[0],F[1]))._rotateAround(Z,G)._add($),w.x+=-j+D,w.y-=(L.left-M)*b.scale;const q=b.imageName?L.advance*b.scale:24*b.scale,X=String.fromCharCode(b.glyph);"︶"===X||"﹈"===X||"︸"===X||"﹄"===X||"﹂"===X||"︾"===X||"︼"===X||"︺"===X||"︘"===X||"﹀"===X||"︐"===X||"︓"===X||"︔"===X||"`"===X||" ̄"===X||"︑"===X||"︒"===X?w.x+=(1-M)*b.scale:"︵"===X||"﹇"===X||"︷"===X||"﹃"===X||"﹁"===X||"︽"===X||"︻"===X||"︹"===X||"︗"===X||"︿"===X?w.x+=q-L.height*b.scale+(-M-1)*b.scale:w.x+=b.imageName||L.width+2*M===B.w&&L.height+2*M===B.h?(q-N)/2:(q-(L.height+2*M)*b.scale)/2,T=new u(w.x,w.y-V),E=new u(w.x+N,w.y),S=new u(w.x+N,w.y-V)}else{const W=(L.left-M)*b.scale-D+F[0],H=(-L.top-M)*b.scale+F[1],K=W+V,Y=H+N;w=new u(W,H),T=new u(K,H),E=new u(W,Y),S=new u(K,Y)}if(d){let J;J=s?new u(0,0):U?new u(p[0],p[1]):new u(n[0],n[1]),w._rotateAround(d,J),T._rotateAround(d,J),E._rotateAround(d,J),S._rotateAround(d,J)}const Q=new u(0,0),ee=new u(0,0);h.push({tl:w,tr:T,bl:E,br:S,tex:I,writingMode:r.writingMode,glyphOffset:R,sectionIndex:b.sectionIndex,isSDF:A,pixelOffsetTL:Q,pixelOffsetBR:ee,minFontScaleX:0,minFontScaleY:0})}}return h}(0,o,h,a,l,c,s,i.allowVerticalPlacement),b=i.textSizeData;let w=null;for(const T of("source"===b.kind?(w=[128*a.layout.get("text-size").evaluate(c,{},x)])[0]>32640&&eh(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===b.kind&&((w=[128*g.compositeTextSizes[0].evaluate(c,{},x),128*g.compositeTextSizes[1].evaluate(c,{},x)])[0]>32640||w[1]>32640)&&eh(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),i.addSymbols(i.text,v,w,h,l,c,p,r,n,d.lineStartIndex,d.lineLength,_,y,x),f))m[T]=i.text.placedSymbolArray.length-1;return 4*v.length}function lz(i){for(const r in i)return i[r];return null}function lk(i,r,n,o,s,a,l,c,h,d){let p=l.top,f=l.bottom,m=l.left,_=l.right;const g=l.collisionPadding;if(g&&(m-=g[0],p-=g[1],_+=g[2],f+=g[3]),h){const y=new u(m,p),x=new u(_,p),v=new u(m,f),b=new u(_,f),w=h*N;let T=new u(0,0);d&&(T=new u(d[0],d[1])),y._rotateAround(w,T),x._rotateAround(w,T),v._rotateAround(w,T),b._rotateAround(w,T),m=Math.min(y.x,x.x,v.x,b.x),_=Math.max(y.x,x.x,v.x,b.x),p=Math.min(y.y,x.y,v.y,b.y),f=Math.max(y.y,x.y,v.y,b.y)}return i.emplaceBack(r.x,r.y,r.z,n.x,n.y,m,p,_,f,c,o,s,a),i.length-1}function lP(i){i.collisionPadding&&(i.top-=i.collisionPadding[1],i.bottom+=i.collisionPadding[3]);const r=i.bottom-i.top;return r>0?Math.max(10,r):null}const lD=as.VectorTileFeature.types,lL=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function lB(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g){const y=d?Math.min(32640,Math.round(d[0])):0,x=d?Math.min(32640,Math.round(d[1])):0;i.emplaceBack(r,n,Math.round(32*l),Math.round(32*c),h,u,(y<<1)+(p?1:0),x,16*f,16*m,256*_,256*g,o,s,a,0)}function lR(i,r,n){i.emplaceBack(r.x,r.y,n),i.emplaceBack(r.x,r.y,n),i.emplaceBack(r.x,r.y,n),i.emplaceBack(r.x,r.y,n)}class lF{constructor(i){this.layoutVertexArray=new n5,this.indexArray=new oe,this.programConfigurations=i,this.segments=new o0,this.dynamicLayoutVertexArray=new n1,this.opacityVertexArray=new n4,this.placedSymbolArray=new of}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(i,r,n,o){this.isEmpty()||(n&&(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,aS.members),this.indexBuffer=i.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=i.createVertexBuffer(this.dynamicLayoutVertexArray,aI.members,!0),this.opacityVertexBuffer=i.createVertexBuffer(this.opacityVertexArray,lL,!0),this.opacityVertexBuffer.itemSize=1),(n||o)&&this.programConfigurations.upload(i))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}r$("SymbolBuffers",lF);class lO{constructor(i,r,n){this.layoutVertexArray=new i,this.layoutAttributes=r,this.indexArray=new n,this.segments=new o0,this.collisionVertexArray=new n7,this.collisionVertexArrayExt=new n1}upload(i){this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=i.createVertexBuffer(this.collisionVertexArray,aM.members,!0),this.collisionVertexBufferExt=i.createVertexBuffer(this.collisionVertexArrayExt,aA.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}r$("CollisionBuffers",lO);class lU{constructor(i){this.collisionBoxArray=i.collisionBoxArray,this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.pixelRatio=i.pixelRatio,this.sourceLayerIndex=i.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=_([]),this.placementViewportMatrix=_([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ak(this.zoom,r["text-size"]),this.iconSizeData=ak(this.zoom,r["icon-size"]);const n=this.layers[0].layout,o=n.get("symbol-sort-key"),s=n.get("symbol-z-order");this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==s&&void 0!==o.constantOr(1),this.sortFeaturesByY=("viewport-y"===s||"auto"===s&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map(i=>a6[i]),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.sourceID=i.sourceID}createArrays(){this.text=new lF(new o$(this.layers,this.zoom,i=>/^text/.test(i))),this.icon=new lF(new o$(this.layers,this.zoom,i=>/^icon/.test(i))),this.glyphOffsetArray=new og,this.lineVertexArray=new oy,this.symbolInstances=new o_}calculateGlyphDependencies(i,r,n,o,s){for(let a=0;a0)&&("constant"!==l.value.kind||l.value.value.length>0),d="constant"!==h.value.kind||!!h.value.value||Object.keys(h.parameters).length>0,p=a.get("symbol-sort-key");if(this.features=[],!u&&!d)return;const f=r.iconDependencies,m=r.glyphDependencies,_=r.availableImages,g=new nk(this.zoom);for(const{feature:y,id:x,index:v,sourceLayerIndex:b}of i){let w,T;const E=s._featureFilter.needGeometry,S=si(y,E);if(!s._featureFilter.filter(g,S,n))continue;if(E||(S.geometry=st(y,n,o)),u){const I=s.getValueAndResolveTokens("text-field",S,n,_),M=tP.factory(I);(function(i){for(const r of i.sections)if(function(i){for(const r of i)if(ny(r.charCodeAt(0)))return!0;return!1}(r.text))return!0;return!1})(M)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===nA()||this.hasRTLText&&nz.isParsed())&&(w=function(i,r,n){return i.sections.forEach(i=>{i.text=function(i,r,n){const o=r.layout.get("text-transform").evaluate(n,{});return"uppercase"===o?i=i.toLocaleUpperCase():"lowercase"===o&&(i=i.toLocaleLowerCase()),nz.applyArabicShaping&&(i=nz.applyArabicShaping(i)),i}(i.text,r,n)}),i}(M,s,S))}if(d){const A=s.getValueAndResolveTokens("icon-image",S,n,_);T=A instanceof tD?A:tD.fromString(A)}if(!w&&!T)continue;const C=this.sortFeaturesByKey?p.evaluate(S,{},n):void 0;if(this.features.push({id:x,text:w,icon:T,index:v,sourceLayerIndex:b,geometry:S.geometry,properties:y.properties,type:lD[y.type],sortKey:C}),T&&(f[T.name]=!0),w){const z=l.evaluate(S,{},n).join(","),k="map"===a.get("text-rotation-alignment")&&"point"!==a.get("symbol-placement");for(const P of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a6.vertical)>=0,w.sections))if(P.image)f[P.image.name]=!0;else{const D=nm(w.toString()),L=P.fontStack||z,B=m[L]=m[L]||{};this.calculateGlyphDependencies(P.text,B,k,this.allowVerticalPlacement,D)}}}"line"===a.get("symbol-placement")&&(this.features=function(i){const r={},n={},o=[];let s=0;function a(r){o.push(i[r]),s++}function l(i,r,s){const a=n[i];return delete n[i],n[r]=a,o[a].geometry[0].pop(),o[a].geometry[0]=o[a].geometry[0].concat(s[0]),a}function c(i,n,s){const a=r[n];return delete r[n],r[i]=a,o[a].geometry[0].shift(),o[a].geometry[0]=s[0].concat(o[a].geometry[0]),a}function h(i,r,n){const o=n?r[0][r[0].length-1]:r[0][0];return`${i}:${o.x}:${o.y}`}for(let u=0;ui.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((i,r)=>i.sortKey-r.sortKey)}update(i,r,n,o){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(i,r,this.layers,n,o),this.icon.programConfigurations.updatePaintArrays(i,r,this.layers,n,o))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(i){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(i),this.iconCollisionBox.upload(i)),this.text.upload(i,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(i,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(i,r){const n=this.lineVertexArray.length;if(void 0!==i.segment){let o=i.dist(r[i.segment+1]),s=i.dist(r[i.segment]);const a={};for(let l=i.segment+1;l=0;c--)a[c]={x:r[c].x,y:r[c].y,tileUnitDistanceFromAnchor:s},c>0&&(s+=r[c-1].dist(r[c]));for(let h=0;h=0?r.rightJustifiedTextSymbolIndex:r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.leftJustifiedTextSymbolIndex>=0?r.leftJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex>=0?r.verticalPlacedTextSymbolIndex:o),a=aP(this.textSizeData,i,s)/24;return this.tilePixelRatio*a}getSymbolInstanceIconSize(i,r,n){const o=this.icon.placedSymbolArray.get(n),s=aP(this.iconSizeData,i,o);return this.tilePixelRatio*s}_commitDebugCollisionVertexUpdate(i,r,n){i.emplaceBack(r,-n,-n),i.emplaceBack(r,n,-n),i.emplaceBack(r,n,n),i.emplaceBack(r,-n,n)}_updateTextDebugCollisionBoxes(i,r,n,o,s,a){for(let l=o;l0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(i,r){const n=i.placedSymbolArray.get(r),o=n.vertexStartIndex+4*n.numGlyphs;for(let s=n.vertexStartIndex;so[i]-o[r]||s[r]-s[i]),a}addToSortKeyRanges(i,r){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=i+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:i+1})}sortFeatures(i){if(this.sortFeaturesByY&&this.sortedAngle!==i&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){for(const r of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(i),this.sortedAngle=i,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){const n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((i,r,n)=>{i>=0&&n.indexOf(i)===r&&this.addIndicesForPlacedSymbol(this.text,i)}),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}r$("SymbolBucket",lU,{omit:["layers","collisionBoxArray","features","compareText"]}),lU.MAX_GLYPHS=65535,lU.addDynamicAttributes=lR;const lV=new n$({"symbol-placement":new nV(tr.layout_symbol["symbol-placement"]),"symbol-spacing":new nV(tr.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new nV(tr.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new nN(tr.layout_symbol["symbol-sort-key"]),"symbol-z-order":new nV(tr.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new nV(tr.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new nV(tr.layout_symbol["icon-ignore-placement"]),"icon-optional":new nV(tr.layout_symbol["icon-optional"]),"icon-rotation-alignment":new nV(tr.layout_symbol["icon-rotation-alignment"]),"icon-size":new nN(tr.layout_symbol["icon-size"]),"icon-text-fit":new nV(tr.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new nV(tr.layout_symbol["icon-text-fit-padding"]),"icon-image":new nN(tr.layout_symbol["icon-image"]),"icon-rotate":new nN(tr.layout_symbol["icon-rotate"]),"icon-padding":new nV(tr.layout_symbol["icon-padding"]),"icon-keep-upright":new nV(tr.layout_symbol["icon-keep-upright"]),"icon-offset":new nN(tr.layout_symbol["icon-offset"]),"icon-anchor":new nN(tr.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new nV(tr.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new nV(tr.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new nV(tr.layout_symbol["text-rotation-alignment"]),"text-field":new nN(tr.layout_symbol["text-field"]),"text-font":new nN(tr.layout_symbol["text-font"]),"text-size":new nN(tr.layout_symbol["text-size"]),"text-max-width":new nN(tr.layout_symbol["text-max-width"]),"text-line-height":new nN(tr.layout_symbol["text-line-height"]),"text-letter-spacing":new nN(tr.layout_symbol["text-letter-spacing"]),"text-justify":new nN(tr.layout_symbol["text-justify"]),"text-radial-offset":new nN(tr.layout_symbol["text-radial-offset"]),"text-variable-anchor":new nV(tr.layout_symbol["text-variable-anchor"]),"text-anchor":new nN(tr.layout_symbol["text-anchor"]),"text-max-angle":new nV(tr.layout_symbol["text-max-angle"]),"text-writing-mode":new nV(tr.layout_symbol["text-writing-mode"]),"text-rotate":new nN(tr.layout_symbol["text-rotate"]),"text-padding":new nV(tr.layout_symbol["text-padding"]),"text-keep-upright":new nV(tr.layout_symbol["text-keep-upright"]),"text-transform":new nN(tr.layout_symbol["text-transform"]),"text-offset":new nN(tr.layout_symbol["text-offset"]),"text-allow-overlap":new nV(tr.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new nV(tr.layout_symbol["text-ignore-placement"]),"text-optional":new nV(tr.layout_symbol["text-optional"])});var lN={paint:new n$({"icon-opacity":new nN(tr.paint_symbol["icon-opacity"]),"icon-color":new nN(tr.paint_symbol["icon-color"]),"icon-halo-color":new nN(tr.paint_symbol["icon-halo-color"]),"icon-halo-width":new nN(tr.paint_symbol["icon-halo-width"]),"icon-halo-blur":new nN(tr.paint_symbol["icon-halo-blur"]),"icon-translate":new nV(tr.paint_symbol["icon-translate"]),"icon-translate-anchor":new nV(tr.paint_symbol["icon-translate-anchor"]),"text-opacity":new nN(tr.paint_symbol["text-opacity"]),"text-color":new nN(tr.paint_symbol["text-color"],{runtimeType:tm,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new nN(tr.paint_symbol["text-halo-color"]),"text-halo-width":new nN(tr.paint_symbol["text-halo-width"]),"text-halo-blur":new nN(tr.paint_symbol["text-halo-blur"]),"text-translate":new nV(tr.paint_symbol["text-translate"]),"text-translate-anchor":new nV(tr.paint_symbol["text-translate-anchor"])}),layout:lV};class lj{constructor(i){this.type=i.property.overrides?i.property.overrides.runtimeType:tu,this.defaultValue=i}evaluate(i){if(i.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(i.formattedSection))return r.getOverride(i.formattedSection)}return i.feature&&i.featureState?this.defaultValue.evaluate(i.feature,i.featureState):this.defaultValue.property.specification.default}eachChild(i){this.defaultValue.isConstant()||i(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}r$("FormatSectionOverride",lj,{omit:["defaultValue"]});class lG extends oY{constructor(i){super(i,lN)}recalculate(i,r){super.recalculate(i,r),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const n=this.layout.get("text-writing-mode");if(n){const o=[];for(const s of n)0>o.indexOf(s)&&o.push(s);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(i,r,n,o){var s;const a=this.layout.get(i).evaluate(r,{},n,o),l=this._unevaluatedLayout._values[i];return l.isDataDriven()||i8(l.value)||!a?a:(s=r.properties,a.replace(/{([^{}]+)}/g,(i,r)=>r in s?String(s[r]):""))}createBucket(i){return new lU(i)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const i of lN.paint.overridableProperties){if(!lG.hasPaintOverride(this.layout,i))continue;const r=this.paint.get(i),n=new lj(r),o=new i6(n,r.property.specification);let s=null;s="constant"===r.value.kind||"source"===r.value.kind?new i7("source",o):new re("composite",o,r.value.zoomStops,r.value._interpolationType),this.paint._values[i]=new nO(r.property,s,r.parameters)}}_handleOverridablePaintPropertyUpdate(i,r,n){return!(!this.layout||r.isDataDriven()||n.isDataDriven())&&lG.hasPaintOverride(this.layout,i)}static hasPaintOverride(i,r){const n=i.get("text-field"),o=lN.paint.properties[r];let s=!1;const a=i=>{for(const r of i)if(o.overrides&&o.overrides.hasOverride(r))return void(s=!0)};if("constant"===n.value.kind&&n.value.value instanceof tP)a(n.value.value.sections);else if("source"===n.value.kind){const l=i=>{s||(i instanceof tO&&tR(i.value)===tx?a(i.value.sections):i instanceof tj?a(i.sections):i.eachChild(l))},c=n.value;c._styleExpression&&l(c._styleExpression.expression)}return s}getProgramConfiguration(i){return new oZ(this,i)}}var lZ={paint:new n$({"background-color":new nV(tr.paint_background["background-color"]),"background-pattern":new nG(tr.paint_background["background-pattern"]),"background-opacity":new nV(tr.paint_background["background-opacity"])})},l$={paint:new n$({"raster-opacity":new nV(tr.paint_raster["raster-opacity"]),"raster-hue-rotate":new nV(tr.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new nV(tr.paint_raster["raster-brightness-min"]),"raster-brightness-max":new nV(tr.paint_raster["raster-brightness-max"]),"raster-saturation":new nV(tr.paint_raster["raster-saturation"]),"raster-contrast":new nV(tr.paint_raster["raster-contrast"]),"raster-resampling":new nV(tr.paint_raster["raster-resampling"]),"raster-fade-duration":new nV(tr.paint_raster["raster-fade-duration"])})};class lq extends oY{constructor(i){super(i,{}),this.implementation=i}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){}serialize(){}onAdd(i){this.implementation.onAdd&&this.implementation.onAdd(i,i.painter.context.gl)}onRemove(i){this.implementation.onRemove&&this.implementation.onRemove(i,i.painter.context.gl)}}var lX={paint:new n$({"sky-type":new nV(tr.paint_sky["sky-type"]),"sky-atmosphere-sun":new nV(tr.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new nV(tr.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new nV(tr.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new nV(tr.paint_sky["sky-gradient-radius"]),"sky-gradient":new nZ(tr.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new nV(tr.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new nV(tr.paint_sky["sky-atmosphere-color"]),"sky-opacity":new nV(tr.paint_sky["sky-opacity"])})};function lW(i,r,n){var o,s,a,l,c,h,u,d;const p=S(0,0,1),f=O(F());return o=f,s=n?-(i*N)+Math.PI:i*N,s*=.5,a=f[0],l=f[1],c=f[2],h=f[3],u=Math.sin(s),d=Math.cos(s),o[0]=a*d-c*u,o[1]=l*d+h*u,o[2]=c*d+a*u,o[3]=h*d-l*u,U(f,f,-(r*N)),B(p,p,f),k(p,p)}const lH={circle:class extends oY{constructor(i){super(i,sy)}createBucket(i){return new sn(i)}queryRadius(i){return sp("circle-radius",this,i)+sp("circle-stroke-width",this,i)+sf(this.paint.get("circle-translate"))}queryIntersectsFeature(i,r,n,o,s,a,l,c){const h=s_(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,i.pixelToTileUnitsFactor),u=this.paint.get("circle-radius").evaluate(r,n)+this.paint.get("circle-stroke-width").evaluate(r,n);return sb(i,o,a,l,c,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),h,u)}getProgramIds(){return["circle"]}getProgramConfiguration(i){return new oZ(this,i)}},heatmap:class extends oY{createBucket(i){return new sE(i)}constructor(i){super(i,sz),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){"heatmap-color"===i&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=sk({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(i){return sp("heatmap-radius",this,i)}queryIntersectsFeature(i,r,n,o,s,a,l,c){const h=this.paint.get("heatmap-radius").evaluate(r,n);return sb(i,o,a,l,c,!0,!0,new u(0,0),h)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(i){return new oZ(this,i)}},hillshade:class extends oY{constructor(i){super(i,sP)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}getProgramConfiguration(i){return new oZ(this,i)}},fill:class extends oY{constructor(i){super(i,s8)}getProgramIds(){const i=this.paint.get("fill-pattern"),r=i&&i.constantOr(1),n=[r?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&n.push(r&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),n}getProgramConfiguration(i){return new oZ(this,i)}recalculate(i,r){super.recalculate(i,r);const n=this.paint._values["fill-outline-color"];"constant"===n.value.kind&&void 0===n.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new s4(i)}queryRadius(){return sf(this.paint.get("fill-translate"))}queryIntersectsFeature(i,r,n,o,s,a){return!i.queryGeometry.isAboveHorizon&&ss(sm(i.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),a.angle,i.pixelToTileUnitsFactor),o)}isTileClipped(){return!0}},"fill-extrusion":class extends oY{constructor(i){super(i,au)}createBucket(i){return new ah(i)}queryRadius(){return sf(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}getProgramConfiguration(i){return new oZ(this,i)}queryIntersectsFeature(i,r,n,o,s,a,l,c,h){var d,p;const f=s_(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,i.pixelToTileUnitsFactor),m=this.paint.get("fill-extrusion-height").evaluate(r,n),_=this.paint.get("fill-extrusion-base").evaluate(r,n),g=[0,0],y=c&&a.elevation,x=a.elevation?a.elevation.exaggeration():1;if(y){const v=i.tile.getBucket(this).centroidVertexArray,b=h+1;if(b0?n+2*r:r),s=sp("line-offset",this,i);return o/2+Math.abs(s)+sf(this.paint.get("line-translate"))}queryIntersectsFeature(i,r,n,o,s,a){var l,c;if(i.queryGeometry.isAboveHorizon)return!1;const h=sm(i.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,i.pixelToTileUnitsFactor),d=i.pixelToTileUnitsFactor/2*(l=this.paint.get("line-width").evaluate(r,n),(c=this.paint.get("line-gap-width").evaluate(r,n))>0?c+2*l:l),p=this.paint.get("line-offset").evaluate(r,n);return p&&(o=function(i,r){const n=[],o=new u(0,0);for(let s=0;s=3){for(let a=0;a1){if(sa(i,r))return!0;for(let o=0;o1&&(c=i[++l]);const d=Math.abs(h-c.left),p=Math.abs(h-c.right),f=Math.min(d,p),m=s/n*(o+1);if(c.isDash){const _=o-Math.abs(m);u=Math.sqrt(f*f+_*_)}else u=o-Math.sqrt(f*f+m*m);this.image.data[a+h]=Math.max(0,Math.min(255,u+128))}}}addRegularDash(i,r){for(let n=i.length-1;n>=0;--n){const o=i[n],s=i[n+1];o.zeroLength?i.splice(n,1):s&&s.isDash===o.isDash&&(s.left=o.left,i.splice(n,1))}const a=i[0],l=i[i.length-1];a.isDash===l.isDash&&(a.left=l.left-this.width,l.right=a.right+this.width);const c=this.width*this.nextRow;let h=0,u=i[0];for(let d=0;d1&&(u=i[++h]);const p=Math.abs(d-u.left),f=Math.abs(d-u.right),m=Math.min(p,f);this.image.data[c+d]=Math.max(0,Math.min(255,(u.isDash?m:-m)+r+128))}}addDash(i,r){const n=this.getKey(i,r);if(this.positions[n])return this.positions[n];const o="round"===r,s=o?7:0,a=2*s+1;if(this.nextRow+a>this.height)return eh("LineAtlas out of space"),null;0===i.length&&i.push(1);let l=0;for(let c=0;c{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const l5=p.performance;function l4(i){const r=i?i.url.toString():void 0;return l5.getEntriesByName(r)}class l6{constructor(){this.tasks={},this.taskQueue=[],en(["process"],this),this.invoker=new l3(this.process),this.nextId=0}add(i,r){const n=this.nextId++,o=function({type:i,isSymbolTile:r,zoom:n}){return n=n||0,"message"===i?0:"maybePrepare"!==i||r?"parseTile"!==i||r?"parseTile"===i&&r?300-n:"maybePrepare"===i&&r?400-n:500:200-n:100-n}(r);return 0===o?(ed(),i(),{cancel(){}}):(this.tasks[n]={fn:i,metadata:r,priority:o,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}})}process(){ed();{if(this.taskQueue=this.taskQueue.filter(i=>!!this.tasks[i]),!this.taskQueue.length)return;const i=this.pick();if(null===i)return;const r=this.tasks[i];if(delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),!r)return;r.fn()}}pick(){let i=null,r=1/0;for(let n=0;n0;a--)s+=(r&(o=1<this.canonical.z?new ce(i,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ce(i,this.wrap,i,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(i,r=!0){if(this.overscaledZ===i&&r)return this.key;if(i>this.canonical.z)return ct(this.wrap*+r,i,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-i;return ct(this.wrap*+r,i,i,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(i){if(i.wrap!==this.wrap)return!1;const r=this.canonical.z-i.canonical.z;return 0===i.overscaledZ||i.overscaledZ>r&&i.canonical.y===this.canonical.y>>r}children(i){if(this.overscaledZ>=i)return[new ce(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,n=2*this.canonical.x,o=2*this.canonical.y;return[new ce(r,this.wrap,r,n,o),new ce(r,this.wrap,r,n+1,o),new ce(r,this.wrap,r,n,o+1),new ce(r,this.wrap,r,n+1,o+1)]}isLessThan(i){return this.wrapi.wrap)&&(this.overscaledZi.overscaledZ)&&(this.canonical.xi.canonical.x)&&this.canonical.yMath.abs(o[l])){if(n[l]r[l])return null}else{const c=1/o[l];let h=(i[l]-n[l])*c,u=(r[l]-n[l])*c;if(h>u){const d=h;h=u,u=d}if(h>s&&(s=h),ua)return null}return s}function cu(i,r,n,o,s,a,l,c,h,u,d){const p=o-i,f=s-r,m=a-n,_=l-i,g=c-r,y=h-n,x=d[1]*y-d[2]*g,v=d[2]*_-d[0]*y,b=d[0]*g-d[1]*_,w=p*x+f*v+m*b;if(1e-15>Math.abs(w))return null;const T=1/w,E=u[0]-i,S=u[1]-r,I=u[2]-n,M=(E*x+S*v+I*b)*T;if(M<0||M>1)return null;const A=S*m-I*f,C=I*p-E*m,z=E*f-S*p,k=(d[0]*A+d[1]*C+d[2]*z)*T;return k<0||M+k>1?null:(_*A+g*C+y*z)*T}function cd(i,r,n,o,s,a,l,c,h){const u=1<{const a=o?1:0;s[0]=i*n,s[1]=r*n,s[2]=(i+1)*n-a,s[3]=(r+1)*n-a};let l=new cc(o);const c=[];for(let h=0;h=1;o/=2){const m=n[n.length-1];l=new cc(o);for(let _=0;_0;){const{idx:m,t:_,nodex:g,nodey:y,depth:x}=f.pop();if(this.leaves[m]){cd(g,y,x,i,r,n,o,d,p);const v=1<=B[2])return _}continue}let R=0;for(let F=0;F=h[u[V]]&&(u.splice(V,0,F),U=!0);U||(u[R]=F),R++}}for(let N=0;N=this.dim+1||r<-1||r>=this.dim+1)throw RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(i+1)}_unpackMapbox(i,r,n){return(256*i*256+256*r+n)/10-1e4}_unpackTerrarium(i,r,n){return 256*i+r+n/256-32768}static pack(i,r){const n=[0,0,0,0],o=cg.getUnpackVector(r);let s=Math.floor((i+o[3])/o[2]);return n[2]=s%256,s=Math.floor(s/256),n[1]=s%256,s=Math.floor(s/256),n[0]=s,n}getPixels(){return new sC({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(i,r,n){if(this.dim!==i.dim)throw Error("dem dimension mismatch");let o=r*this.dim,s=r*this.dim+this.dim,a=n*this.dim,l=n*this.dim+this.dim;switch(r){case -1:o=s-1;break;case 1:s=o+1}switch(n){case -1:a=l-1;break;case 1:l=a+1}const c=-r*this.dim,h=-n*this.dim;for(let u=a;u{this.remove(i,s)},n)),this.data[o].push(s),this.order.push(o),this.order.length>this.max){const a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}has(i){return i.wrapped().key in this.data}getAndRemove(i){return this.has(i)?this._getAndRemoveByKey(i.wrapped().key):null}_getAndRemoveByKey(i){const r=this.data[i].shift();return r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.order.splice(this.order.indexOf(i),1),r.value}getByKey(i){const r=this.data[i];return r?r[0].value:null}get(i){return this.has(i)?this.data[i.wrapped().key][0].value:null}remove(i,r){if(!this.has(i))return this;const n=i.wrapped().key,o=void 0===r?0:this.data[n].indexOf(r),s=this.data[n][o];return this.data[n].splice(o,1),s.timeout&&clearTimeout(s.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(s.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(i){for(this.max=i;this.order.length>this.max;){const r=this._getAndRemoveByKey(this.order[0]);r&&this.onRemove(r)}return this}filter(i){const r=[];for(const n in this.data)for(const o of this.data[n])i(o.value)||r.push(o);for(const s of r)this.remove(s.value.tileID,s)}}class cx extends ti{constructor(i,r,n){super(),this.id=i,this._onlySymbols=n,r.on("data",i=>{"source"===i.dataType&&"metadata"===i.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===i.dataType&&"content"===i.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),r.on("error",()=>{this._sourceErrored=!0}),this._source=r,this._tiles={},this._cache=new cy(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=null,this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new cl}onAdd(i){this.map=i,this._minTileCacheSize=i?i._minTileCacheSize:null,this._maxTileCacheSize=i?i._maxTileCacheSize:null}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const i in this._tiles){const r=this._tiles[i];if("loaded"!==r.state&&"errored"!==r.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const i=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,i&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(i,r){return i.isSymbolTile=this._onlySymbols,this._source.loadTile(i,r)}_unloadTile(i){if(this._source.unloadTile)return this._source.unloadTile(i,()=>{})}_abortTile(i){if(this._source.abortTile)return this._source.abortTile(i,()=>{})}serialize(){return this._source.serialize()}prepare(i){for(const r in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){const n=this._tiles[r];n.upload(i),n.prepare(this.map.style.imageManager)}}getIds(){return Y(this._tiles).map(i=>i.tileID).sort(cv).map(i=>i.key)}getRenderableIds(i){const r=[];for(const n in this._tiles)this._isIdRenderable(+n,i)&&r.push(this._tiles[n]);return i?r.sort((i,r)=>{const n=i.tileID,o=r.tileID,s=new u(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),a=new u(o.canonical.x,o.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-o.overscaledZ||a.y-s.y||a.x-s.x}).map(i=>i.tileID.key):r.map(i=>i.tileID).sort(cv).map(i=>i.key)}hasRenderableParent(i){const r=this.findLoadedParent(i,0);return!!r&&this._isIdRenderable(r.tileID.key)}_isIdRenderable(i,r){return this._tiles[i]&&this._tiles[i].hasData()&&!this._coveredTiles[i]&&(r||!this._tiles[i].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else for(const i in this._cache.reset(),this._tiles)"errored"!==this._tiles[i].state&&this._reloadTile(+i,"reloading")}_reloadTile(i,r){const n=this._tiles[i];n&&("loading"!==n.state&&(n.state=r),this._loadTile(n,this._tileLoaded.bind(this,n,i,r)))}_tileLoaded(i,r,n,o){if(o){if(i.state="errored",404!==o.status)this._source.fire(new tt(o,{tile:i}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const s=this.map.painter.terrain;this.update(this.transform,s.getScaledDemTileSize(),!0),s.resetTileLookupCache(this.id)}else this.update(this.transform)}else i.timeAdded=ev.now(),"expired"===n&&(i.refreshedUponExpiration=!0),this._setTileReloadTimer(r,i),"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),this._state.initializeTileState(i,this.map?this.map.painter:null),this._source.fire(new te("data",{dataType:"source",tile:i,coord:i.tileID,sourceCacheId:this.id}))}_backfillDEM(i){const r=this.getRenderableIds();for(let n=0;n1||(Math.abs(n)>1&&(1===Math.abs(n+s)?n+=s:1===Math.abs(n-s)&&(n-=s)),r.dem&&i.dem&&(i.dem.backfillBorder(r.dem,n,o),i.neighboringTiles&&i.neighboringTiles[a]&&(i.neighboringTiles[a].backfilled=!0)))}}getTile(i){return this.getTileByID(i.key)}getTileByID(i){return this._tiles[i]}_retainLoadedChildren(i,r,n,o){for(const s in this._tiles){let a=this._tiles[s];if(o[s]||!a.hasData()||a.tileID.overscaledZ<=r||a.tileID.overscaledZ>n)continue;let l=a.tileID;for(;a&&a.tileID.overscaledZ>r+1;){const c=a.tileID.scaledTo(a.tileID.overscaledZ-1);(a=this._tiles[c.key])&&a.hasData()&&(l=c)}let h=l;for(;h.overscaledZ>r;)if(i[(h=h.scaledTo(h.overscaledZ-1)).key]){o[l.key]=l;break}}}findLoadedParent(i,r){if(i.key in this._loadedParentTiles){const n=this._loadedParentTiles[i.key];return n&&n.tileID.overscaledZ>=r?n:null}for(let o=i.overscaledZ-1;o>=r;o--){const s=i.scaledTo(o),a=this._getLoadedTile(s);if(a)return a}}_getLoadedTile(i){const r=this._tiles[i.key];return r&&r.hasData()?r:this._cache.getByKey(this._source.reparseOverscaled?i.wrapped().key:i.canonical.key)}updateCacheSize(i,r){r=r||this._source.tileSize;const n=Math.ceil(i.width/r)+1,o=Math.ceil(i.height/r)+1,s=Math.floor(n*o*5),a="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,s):s,l="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(l)}handleWrapJump(i){const r=Math.round((i-(void 0===this._prevLng?i:this._prevLng))/360);if(this._prevLng=i,r){const n={};for(const o in this._tiles){const s=this._tiles[o];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+r),n[s.tileID.key]=s}for(const a in this._tiles=n,this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(const l in this._tiles)this._setTileReloadTimer(+l,this._tiles[l])}}update(i,r,n){let o;if(this.transform=i,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!n)return;this.updateCacheSize(i,r),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?o=i.getVisibleUnwrappedCoordinates(this._source.tileID).map(i=>new ce(i.canonical.z,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y)):(o=i.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(o=o.filter(i=>this._source.hasTile(i)))):o=[];const s=this._updateRetainedTiles(o);if(cb(this._source.type)&&0!==o.length){const a={},l={},c=Object.keys(s);for(const h of c){const u=s[h],d=this._tiles[h];if(!d||d.fadeEndTime&&d.fadeEndTime<=ev.now())continue;const p=this.findLoadedParent(u,Math.max(u.overscaledZ-cx.maxOverzooming,this._source.minzoom));p&&(this._addTile(p.tileID),a[p.tileID.key]=p.tileID),l[h]=u}const f=o[o.length-1].overscaledZ;for(const m in this._tiles){const _=this._tiles[m];if(s[m]||!_.hasData())continue;let g=_.tileID;for(;g.overscaledZ>f;){g=g.scaledTo(g.overscaledZ-1);const y=this._tiles[g.key];if(y&&y.hasData()&&l[g.key]){s[m]=_.tileID;break}}}for(const x in a)s[x]||(this._coveredTiles[x]=!0,s[x]=a[x])}for(const v in s)this._tiles[v].clearFadeHold();const b=function(i,r){const n=[];for(const o in i)o in r||n.push(o);return n}(this._tiles,s);for(const w of b){const T=this._tiles[w];T.hasSymbolBuckets&&!T.holdingForFade()?T.setHoldDuration(this.map._fadeDuration):T.hasSymbolBuckets&&!T.symbolFadeFinished()||this._removeTile(+w)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const i in this._tiles)this._tiles[i].holdingForFade()&&this._removeTile(+i)}_updateRetainedTiles(i){const r={};if(0===i.length)return r;const n={},o=i.reduce((i,r)=>Math.min(i,r.overscaledZ),1/0),s=i[0].overscaledZ,a=Math.max(s-cx.maxOverzooming,this._source.minzoom),l=Math.max(s+cx.maxUnderzooming,this._source.minzoom),c={};for(const h of i){const u=this._addTile(h);r[h.key]=h,u.hasData()||o=this._source.maxzoom){const f=d.children(this._source.maxzoom)[0],m=this.getTile(f);if(m&&m.hasData()){r[f.key]=f;continue}}else{const _=d.children(this._source.maxzoom);if(r[_[0].key]&&r[_[1].key]&&r[_[2].key]&&r[_[3].key])continue}let g=p.wasRequested();for(let y=d.overscaledZ-1;y>=a;--y){const x=d.scaledTo(y);if(n[x.key]||(n[x.key]=!0,(p=this.getTile(x))||!g||(p=this._addTile(x)),p&&(r[x.key]=x,g=p.wasRequested(),p.hasData())))break}}return r}_updateLoadedParentTileCache(){for(const i in this._loadedParentTiles={},this._tiles){const r=[];let n,o=this._tiles[i].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){n=this._loadedParentTiles[o.key];break}r.push(o.key);const s=o.scaledTo(o.overscaledZ-1);if(n=this._getLoadedTile(s))break;o=s}for(const a of r)this._loadedParentTiles[a]=n}}_addTile(i){let r=this._tiles[i.key];if(r)return r;(r=this._cache.getAndRemove(i))&&(this._setTileReloadTimer(i.key,r),r.tileID=i,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[i.key]&&(clearTimeout(this._cacheTimers[i.key]),delete this._cacheTimers[i.key],this._setTileReloadTimer(i.key,r)));const n=Boolean(r);if(!n){const o=this.map?this.map.painter:null,s="raster"===this._source.type||"raster-dem"===this._source.type;r=new c$(i,this._source.tileSize*i.overscaleFactor(),this.transform.tileZoom,o,s),this._loadTile(r,this._tileLoaded.bind(this,r,i.key,r.state))}return r?(r.uses++,this._tiles[i.key]=r,n||this._source.fire(new te("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null}_setTileReloadTimer(i,r){i in this._timers&&(clearTimeout(this._timers[i]),delete this._timers[i]);const n=r.getExpiryTimeout();n&&(this._timers[i]=setTimeout(()=>{this._reloadTile(i,"expired"),delete this._timers[i]},n))}_removeTile(i){const r=this._tiles[i];r&&(r.uses--,delete this._tiles[i],this._timers[i]&&(clearTimeout(this._timers[i]),delete this._timers[i]),r.uses>0||(r.hasData()&&"reloading"!==r.state?this._cache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}clearTiles(){for(const i in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+i);this._source._clear&&this._source._clear(),this._cache.reset()}tilesIn(i,r,n){const o=[],s=this.transform;if(!s)return o;for(const a in this._tiles){const l=this._tiles[a];if(n&&l.clearQueryDebugViz(),l.holdingForFade())continue;const c=i.containsTile(l,s,r);c&&o.push(c)}return o}getVisibleCoordinates(i){const r=this.getRenderableIds(i).map(i=>this._tiles[i].tileID);for(const n of r)n.projMatrix=this.transform.calculateProjMatrix(n.toUnwrapped());return r}hasTransition(){if(this._source.hasTransition())return!0;if(cb(this._source.type))for(const i in this._tiles){const r=this._tiles[i];if(void 0!==r.fadeEndTime&&r.fadeEndTime>=ev.now())return!0}return!1}setFeatureState(i,r,n){this._state.updateState(i=i||"_geojsonTileLayer",r,n)}removeFeatureState(i,r,n){this._state.removeFeatureState(i=i||"_geojsonTileLayer",r,n)}getFeatureState(i,r){return this._state.getState(i=i||"_geojsonTileLayer",r)}setDependencies(i,r,n){const o=this._tiles[i];o&&o.setDependencies(r,n)}reloadTilesForDependencies(i,r){for(const n in this._tiles)this._tiles[n].hasDependency(i,r)&&this._reloadTile(+n,"reloading");this._cache.filter(n=>!n.hasDependency(i,r))}_preloadTiles(i,r){const n=new Map,o=Array.isArray(i)?i:[i],s=this.map.painter.terrain,a=this.usedForTerrain&&s?s.getScaledDemTileSize():this._source.tileSize;for(const l of o){const c=l.coveringTiles({tileSize:a,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const h of c)n.set(h.key,h);this.usedForTerrain&&l.updateElevation(!1)}const u=Array.from(n.values()),d="raster"===this._source.type||"raster-dem"===this._source.type;K(u,(i,r)=>{const n=new c$(i,this._source.tileSize*i.overscaleFactor(),this.transform.tileZoom,this.map.painter,d);this._loadTile(n,i=>{"raster-dem"===this._source.type&&n.dem&&this._backfillDEM(n),r(i,n)})},r)}}function cv(i,r){const n=Math.abs(2*i.wrap)-+(i.wrap<0),o=Math.abs(2*r.wrap)-+(r.wrap<0);return i.overscaledZ-r.overscaledZ||o-n||r.canonical.y-i.canonical.y||r.canonical.x-i.canonical.x}function cb(i){return"raster"===i||"image"===i||"video"===i}cx.maxOverzooming=10,cx.maxUnderzooming=3;class cw{constructor(i,r,n){this._demTile=i,this._dem=this._demTile.dem,this._scale=r,this._offset=n}static create(i,r,n){const o=n||i.findDEMTileFor(r);if(!o||!o.dem)return;const s=o.dem,a=o.tileID,l=1<=0&&d[3]>=0&&c.insert(l,d[0],d[1],d[2],d[3])}}loadVTLayers(){if(!this.vtLayers)for(const i in this.vtLayers=new as.VectorTile(new aO(this.rawTileData)).layers,this.sourceLayerCoder=new cs(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[i]=[];return this.vtLayers}query(i,r,n,o){let s;this.loadVTLayers();const a=i.params||{},l=rh(a.filter),c=i.tileResult,h=i.transform,u=c.bufferedTilespaceBounds,d=this.grid.query(u.min.x,u.min.y,u.max.x,u.max.y,(i,r,n,o)=>sd(c.bufferedTilespaceGeometry,i,r,n,o));d.sort(cS);let p=null;h.elevation&&d.length>0&&(p=cw.create(h.elevation,this.tileID));const f={};for(let m=0;m(y||(y=st(r,this.tileID.canonical,i.tileTransform)),n.queryIntersectsFeature(c,r,o,y,this.z,i.transform,i.pixelPosMatrix,p,s)))}return f}loadMatchingFeature(i,r,n,o,s,a,l,c,h){const{featureIndex:u,bucketIndex:d,sourceLayerIndex:p,layoutVertexArrayOffset:f}=r,m=this.bucketLayerIDs[d];if(o&&!function(i,r){for(let n=0;n=0)return!0;return!1}(o,m))return;const _=this.sourceLayerCoder.decode(p),g=this.vtLayers[_].feature(u);if(n.needGeometry){const y=si(g,!0);if(!n.filter(new nk(this.tileID.overscaledZ),y,this.tileID.canonical))return}else if(!n.filter(new nk(this.tileID.overscaledZ),g))return;const x=this.getId(g,_);for(let v=0;vo.indexOf(b))continue;const w=a[b];if(!w)continue;let T={};void 0!==x&&c&&(T=c.getState(w.sourceLayer||"_geojsonTileLayer",x));const E=J({},l[b]);E.paint=cE(E.paint,w.paint,g,T,s),E.layout=cE(E.layout,w.layout,g,T,s);const S=!h||h(g,w,T,f);if(!S)continue;const I=new ca(g,this.z,this.x,this.y,x);I.layer=E;let M=i[b];void 0===M&&(M=i[b]=[]),M.push({featureIndex:u,feature:I,intersectionZ:S})}}lookupSymbolFeatures(i,r,n,o,s,a,l,c){const h={};this.loadVTLayers();const u=rh(s);for(const d of i)this.loadMatchingFeature(h,{bucketIndex:n,sourceLayerIndex:o,featureIndex:d,layoutVertexArrayOffset:0},u,a,l,c,r);return h}loadFeature(i){const{featureIndex:r,sourceLayerIndex:n}=i;this.loadVTLayers();const o=this.sourceLayerCoder.decode(n),s=this.vtFeatures[o];if(s[r])return s[r];const a=this.vtLayers[o].feature(r);return s[r]=a,a}hasLayer(i){for(const r of this.bucketLayerIDs)for(const n of r)if(i===n)return!0;return!1}getId(i,r){let n=i.id;return this.promoteId&&"boolean"==typeof(n=i.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[r]])&&(n=Number(n)),n}}function cE(i,r,n,o,s){return es(i,(i,a)=>{const l=r instanceof nU?r.get(a):null;return l&&l.evaluate?l.evaluate(n,o,s):l})}function cS(i,r){return r-i}r$("FeatureIndex",cT,{omit:["rawTileData","sourceLayerCoder"]});var cI=nK([{name:"a_pos",type:"Int16",components:2}]);const cM=new Uint16Array(8184);for(let cA=0;cA<2046;cA++){let cC=cA+2,cz=0,ck=0,cP=0,cD=0,cL=0,cB=0;for(1&cC?cP=cD=cL=32:cz=ck=cB=32;(cC>>=1)>1;){const cR=cz+cP>>1,cF=ck+cD>>1;1&cC?(cP=cz,cD=ck,cz=cL,ck=cB):(cz=cP,ck=cD,cP=cL,cD=cB),cL=cR,cB=cF}const cO=4*cA;cM[cO+0]=cz,cM[cO+1]=ck,cM[cO+2]=cP,cM[cO+3]=cD}const cU=new Uint16Array(2178),cV=new Uint8Array(1089),cN=new Uint16Array(1089);function cj(i){return 0===i?-.03125:32===i?.03125:0}var cG=nK([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);const cZ={type:2,extent:8192,loadGeometry:()=>[[new u(0,0),new u(8193,0),new u(8193,8193),new u(0,8193),new u(0,0)]]};class c${constructor(i,r,n,o,s){this.tileID=i,this.uid=ee(),this.uses=0,this.tileSize=r,this.tileZoom=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=s,this.expiredRequestCount=0,this.state="loading",o&&o.transform&&(this.projection=o.transform.projection)}registerFadeDuration(i){const r=i+this.timeAdded;rr.getLayer(i)).filter(Boolean);if(0!==s.length)for(const a of(o.layers=s,o.stateDependentLayerIds&&(o.stateDependentLayers=o.stateDependentLayerIds.map(i=>s.filter(r=>r.id===i)[0])),s))n[a.id]=o}return n}(i.buckets,r.style),this.hasSymbolBuckets=!1,this.buckets){const s=this.buckets[o];if(s instanceof lU){if(this.hasSymbolBuckets=!0,!n)break;s.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const a in this.buckets){const l=this.buckets[a];if(l instanceof lU&&l.hasRTLText){this.hasRTLText=!0,nz.isLoading()||nz.isLoaded()||"deferred"!==nA()||nC();break}}for(const c in this.queryPadding=0,this.buckets){const h=this.buckets[c];this.queryPadding=Math.max(this.queryPadding,r.style.getLayer(c).queryRadius(h))}i.imageAtlas&&(this.imageAtlas=i.imageAtlas),i.glyphAtlasImage&&(this.glyphAtlasImage=i.glyphAtlasImage),i.lineAtlas&&(this.lineAtlas=i.lineAtlas)}else this.collisionBoxArray=new od}unloadVectorData(){if(this.hasData()){for(const i in this.buckets)this.buckets[i].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugIndexBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this.globeGridBuffer&&(this.globeGridBuffer.destroy(),this.globeGridBuffer=null),this.globePoleBuffer&&(this.globePoleBuffer.destroy(),this.globePoleBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(i){return this.buckets[i.id]}upload(i){for(const r in this.buckets){const n=this.buckets[r];n.uploadPending()&&n.upload(i)}const o=i.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new l1(i,this.imageAtlas.image,o.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new l1(i,this.glyphAtlasImage,o.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new l1(i,this.lineAtlas.image,o.ALPHA),this.lineAtlas.uploaded=!0)}prepare(i){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(i,this.imageAtlasTexture)}queryRenderedFeatures(i,r,n,o,s,a,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:o,pixelPosMatrix:l,transform:a,params:s,tileTransform:this.tileTransform},i,r,n):{}}querySourceFeatures(i,r){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const o=n.loadVTLayers(),s=r?r.sourceLayer:"",a=o._geojsonTileLayer||o[s];if(!a)return;const l=rh(r&&r.filter),{z:c,x:h,y:u}=this.tileID.canonical,d={z:c,x:h,y:u};for(let p=0;po)s=!1;else if(r){if(this.expirationTime=0;d--){const p=4*d,f=cM[p+0],m=cM[p+1],_=cM[p+2],g=cM[p+3],y=f+_>>1,x=m+g>>1,v=y+x-m,b=x+f-y,w=33*m+f,T=33*g+_,E=33*x+y,S=Math.hypot((cU[2*w+0]+cU[2*T+0])/2-cU[2*E+0],(cU[2*w+1]+cU[2*T+1])/2-cU[2*E+1])>=16;if(cV[E]=cV[E]||(S?1:0),d<1022){const I=(m+b>>1)*33+(f+v>>1),M=(g+b>>1)*33+(_+v>>1);cV[E]=cV[E]||cV[I]||cV[M]}}const A=new nQ,C=new oe;let z=0;function k(i,r){const n=33*r+i;return 0===cN[n]&&(A.emplaceBack(cU[2*n+0],cU[2*n+1],8192*i/32,8192*r/32),cN[n]=++z),cN[n]-1}function P(i,r,n,o,s,a){const l=i+n>>1,c=r+o>>1;if(Math.abs(i-s)+Math.abs(r-a)>1&&cV[33*c+l])P(s,a,i,r,l,c),P(n,o,s,a,l,c);else{const h=k(i,r),u=k(n,o),d=k(s,a);C.emplaceBack(h,u,d)}}return P(0,0,32,32,32,0),P(32,32,0,0,0,32),{vertices:A,indices:C}}(this.tileID.canonical,r);n=a.vertices,o=a.indices}else{for(const{x:l,y:c}of(n=new nQ,o=new oe,s))n.emplaceBack(l,c,0,0);const h=sB(n.int16,void 0,4);for(let u=0;u{const o=65*n+r;i.emplaceBack(o+1,o,o+65),i.emplaceBack(o+65,o+65+1,o+1)};for(let n=0;n<64;n++)for(let o=0;o<64;o++)r(o,n);return i}getWirefameBuffer(i){if(!this.wireframeSegments){const r=this._createWireframeGrid();this.wireframeIndexBuffer=i.createIndexBuffer(r),this.wireframeSegments=o0.simpleSegment(0,0,4096,r.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}_createWireframeGrid(){const i=new oa,r=(r,n)=>{const o=65*n+r;i.emplaceBack(o,o+1),i.emplaceBack(o,o+65),i.emplaceBack(o,o+65+1)};for(let n=0;n<64;n++)for(let o=0;o<64;o++)r(o,n);return i}}function c8(i,r){if(!r.isReprojectedInTileSpace)return{scale:1<b&&(w(i,u,o,s,c,h),w(u,n,c,h,a,l))}w(p,f,o,a,s,a),w(f,m,s,a,s,l),w(m,_,s,l,o,l),w(_,p,o,l,o,a),g-=b,y-=b,x+=b,v+=b;const T=1/Math.max(x-g,v-y);return{scale:T,x:g*T,y:y*T,x2:x*T,y2:v*T,projection:r}}class c9{constructor(i){const r={},n=[];for(const o in i){const s=i[o],a=r[o]={};for(const l in s.glyphs){const c=s.glyphs[+l];if(!c||0===c.bitmap.width||0===c.bitmap.height)continue;const h=c.metrics.localGlyph?2:1,u={x:0,y:0,w:c.bitmap.width+2*h,h:c.bitmap.height+2*h};n.push(u),a[l]=u}}const{w:d,h:p}=a3(n),f=new sA({width:d||1,height:p||1});for(const m in i){const _=i[m];for(const g in _.glyphs){const y=_.glyphs[+g];if(!y||0===y.bitmap.width||0===y.bitmap.height)continue;const x=r[m][g],v=y.metrics.localGlyph?2:1;sA.copy(y.bitmap,f,{x:0,y:0},{x:x.x+v,y:x.y+v},y.bitmap)}}this.image=f,this.positions=r}}r$("GlyphAtlas",c9);class c7{constructor(i){this.tileID=new ce(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=i.showCollisionBoxes,this.collectResourceTiming=!!i.collectResourceTiming,this.returnDependencies=!!i.returnDependencies,this.promoteId=i.promoteId,this.enableTerrain=!!i.enableTerrain,this.isSymbolTile=i.isSymbolTile,this.tileTransform=c8(i.tileID.canonical,i.projection),this.projection=i.projection}parse(i,r,n,o,s){let a,l,c,h;this.status="parsing",this.data=i,this.collisionBoxArray=new od;const d=new cs(Object.keys(i.layers).sort()),p=new cT(this.tileID,this.promoteId);p.bucketLayerIDs=[];const f={},m=new l2(256,256),_={featureIndex:p,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:m,availableImages:n},g=r.familiesBySource[this.source];for(const y in g){const x=i.layers[y];if(!x)continue;let v=!1,b=!1;for(const w of g[y])"symbol"===w[0].type?v=!0:b=!0;if(!0===this.isSymbolTile&&!v||!1===this.isSymbolTile&&!b)continue;1===x.version&&eh(`Vector tile source "${this.source}" layer "${y}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const T=d.encode(y),E=[];for(let S=0;S=C.maxzoom||"none"!==C.visibility&&(he(A,this.zoom,n),(f[C.id]=C.createBucket({index:p.bucketLayerIDs.length,layers:A,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:T,sourceID:this.source,enableTerrain:this.enableTerrain,availableImages:n})).populate(E,_,this.tileID.canonical,this.tileTransform),p.bucketLayerIDs.push(A.map(i=>i.id)))}}m.trim();const z={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},k=es(_.glyphDependencies,i=>Object.keys(i).map(Number));Object.keys(k).length?o.send("getGlyphs",{uid:this.uid,stacks:k},(i,r)=>{a||(a=i,l=r,L.call(this))},void 0,!1,z):l={};const P=Object.keys(_.iconDependencies);P.length?o.send("getImages",{icons:P,source:this.source,tileID:this.tileID,type:"icons"},(i,r)=>{a||(a=i,c=r,L.call(this))},void 0,!1,z):c={};const D=Object.keys(_.patternDependencies);function L(){if(a)return s(a);if(l&&c&&h){const i=new c9(l),r=new a4(c,h);for(const o in f){const d=f[o];d instanceof lU?(he(d.layers,this.zoom,n),function(i,r,n,o,s,a,l,c,h,d){i.createArrays(),i.tilePixelRatio=8192/(512*i.overscaling),i.compareText={},i.iconsNeedLinear=!1;const p=i.layers[0].layout,f=i.layers[0]._unevaluatedLayout._values,m={};if("composite"===i.textSizeData.kind){const{minZoom:_,maxZoom:g}=i.textSizeData;m.compositeTextSizes=[f["text-size"].possiblyEvaluate(new nk(_),c),f["text-size"].possiblyEvaluate(new nk(g),c)]}if("composite"===i.iconSizeData.kind){const{minZoom:y,maxZoom:x}=i.iconSizeData;m.compositeIconSizes=[f["icon-size"].possiblyEvaluate(new nk(y),c),f["icon-size"].possiblyEvaluate(new nk(x),c)]}m.layoutTextSize=f["text-size"].possiblyEvaluate(new nk(h+1),c),m.layoutIconSize=f["icon-size"].possiblyEvaluate(new nk(h+1),c),m.textMaxSize=f["text-size"].possiblyEvaluate(new nk(18),c);const v="map"===p.get("text-rotation-alignment")&&"point"!==p.get("symbol-placement"),b=p.get("text-size");for(const w of i.features){const T=p.get("text-font").evaluate(w,{},c).join(","),E=b.evaluate(w,{},c),S=m.layoutTextSize.evaluate(w,{},c),I=(m.layoutIconSize.evaluate(w,{},c),{horizontal:{},vertical:void 0}),M=w.text;let A,C=[0,0];if(M){const z=M.toString(),k=24*p.get("text-letter-spacing").evaluate(w,{},c),P=24*p.get("text-line-height").evaluate(w,{},c),D=!function(i){for(const r of i){var n;if(rJ(n=r.charCodeAt(0))||rQ(n)||r0(n)||nc(n)||np(n))return!1}return!0}(z)?0:k,L=p.get("text-anchor").evaluate(w,{},c),B=p.get("text-variable-anchor");if(!B){const R=p.get("text-radial-offset").evaluate(w,{},c);C=R?lM(L,[24*R,lS]):p.get("text-offset").evaluate(w,{},c).map(i=>24*i)}let F=v?"center":p.get("text-justify").evaluate(w,{},c);const O=p.get("symbol-placement"),U="point"===O,V="point"===O?24*p.get("text-max-width").evaluate(w,{},c):0,j=o=>{i.allowVerticalPlacement&&nm(z)&&(I.vertical=a7(M,r,n,s,T,V,P,L,o,D,C,a6.vertical,!0,O,S,E))};if(!v&&B){const G="auto"===F?B.map(i=>lA(i)):[F];let Z=!1;for(let $=0;$=0||!nm(z)){const W=a7(M,r,n,s,T,V,P,L,F,D,C,a6.horizontal,!1,O,S,E);W&&(I.horizontal[F]=W)}j("point"===O?"left":F)}}let H=!1;if(w.icon&&w.icon.name){const K=o[w.icon.name];K&&(A=function(i,r,n){const{horizontalAlign:o,verticalAlign:s}=ls(n),a=r[0]-i.displaySize[0]*o,l=r[1]-i.displaySize[1]*s;return{image:i,top:l,bottom:l+i.displaySize[1],left:a,right:a+i.displaySize[0]}}(s[w.icon.name],p.get("icon-offset").evaluate(w,{},c),p.get("icon-anchor").evaluate(w,{},c)),H=K.sdf,void 0===i.sdfIcons?i.sdfIcons=K.sdf:i.sdfIcons!==K.sdf&&eh("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(K.pixelRatio!==i.pixelRatio||0!==p.get("icon-rotate").constantOr(1))&&(i.iconsNeedLinear=!0))}const Y=lz(I.horizontal)||I.vertical;i.iconsInText||(i.iconsInText=!!Y&&Y.iconsInText),(Y||A)&&function(i,r,n,o,s,a,l,c,h,d,p,f,m){let _,g=a.textMaxSize.evaluate(r,{},f);void 0===g&&(g=l);const y=i.layers[0].layout,x=y.get("icon-offset").evaluate(r,{},f),v=lz(n.horizontal)||n.vertical,b=l/24,w=i.tilePixelRatio*g/24,T=i.tilePixelRatio*y.get("symbol-spacing"),E=y.get("text-padding")*i.tilePixelRatio,S=y.get("icon-padding")*i.tilePixelRatio,I=y.get("text-max-angle")*N,M="map"===y.get("text-rotation-alignment")&&"point"!==y.get("symbol-placement"),A="map"===y.get("icon-rotation-alignment")&&"point"!==y.get("symbol-placement"),C=y.get("symbol-placement"),z=T/2,k=y.get("icon-text-fit");o&&"none"!==k&&(i.allowVerticalPlacement&&n.vertical&&(_=ll(o,n.vertical,k,y.get("icon-text-fit-padding"),x,b)),v&&(o=ll(o,v,k,y.get("icon-text-fit-padding"),x,b)));const P=(l,c,u)=>{if(c.x<0||c.x>=8192||c.y<0||c.y>=8192)return;const{x:g,y:y,z:v}=m.projectTilePoint(c.x,c.y,u),b=new lc(g,y,v,0,void 0);!function(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T,E,S,I){const M=i.addToLineVertexArray(r,o);let A,C,z,k,P,D,L,B=0,R=0,F=0,O=0,U=-1,V=-1;const N={};let j=oM(""),G=0,Z=0;if(void 0===h._unevaluatedLayout.getValue("text-radial-offset")?[G,Z]=h.layout.get("text-offset").evaluate(w,{},I).map(i=>24*i):(G=24*h.layout.get("text-radial-offset").evaluate(w,{},I),Z=lS),i.allowVerticalPlacement&&s.vertical){const $=s.vertical;if(_)D=lP($),c&&(L=lP(c));else{const q=h.layout.get("text-rotate").evaluate(w,{},I)+90;z=lk(u,n,r,d,p,f,$,m,q,g),c&&(k=lk(u,n,r,d,p,f,c,x,q))}}if(a){const X=h.layout.get("icon-rotate").evaluate(w,{},I),W="none"!==h.layout.get("icon-text-fit"),H=ly(a,X,E,W),K=c?ly(c,X,E,W):void 0;C=lk(u,n,r,d,p,f,a,x,X),B=4*H.length;const Y=i.iconSizeData;let J=null;"source"===Y.kind?(J=[128*h.layout.get("icon-size").evaluate(w,{},I)])[0]>32640&&eh(`${i.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===Y.kind&&((J=[128*T.compositeIconSizes[0].evaluate(w,{},I),128*T.compositeIconSizes[1].evaluate(w,{},I)])[0]>32640||J[1]>32640)&&eh(`${i.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),i.addSymbols(i.icon,H,J,b,v,w,!1,n,r,M.lineStartIndex,M.lineLength,-1,S,I),U=i.icon.placedSymbolArray.length-1,K&&(R=4*K.length,i.addSymbols(i.icon,K,J,b,v,w,a6.vertical,n,r,M.lineStartIndex,M.lineLength,-1,S,I),V=i.icon.placedSymbolArray.length-1)}for(const Q in s.horizontal){const ee=s.horizontal[Q];A||(j=oM(ee.text),_?P=lP(ee):A=lk(u,n,r,d,p,f,ee,m,h.layout.get("text-rotate").evaluate(w,{},I),g));const et=1===ee.positionedLines.length;if(F+=lC(i,n,r,ee,l,h,_,w,g,M,s.vertical?a6.horizontal:a6.horizontalOnly,et?Object.keys(s.horizontal):[Q],N,U,T,S,I),et)break}s.vertical&&(O+=lC(i,n,r,s.vertical,l,h,_,w,g,M,a6.vertical,["vertical"],N,V,T,S,I));let ei=-1;const er=(i,r)=>i?Math.max(i,r):r;ei=er(P,ei),ei=er(D,ei),ei=er(L,ei);const en=ei>-1?1:0;i.glyphOffsetArray.length>=lU.MAX_GLYPHS&&eh("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&i.addToSortKeyRanges(i.symbolInstances.length,w.sortKey),i.symbolInstances.emplaceBack(n.x,n.y,n.z,r.x,r.y,N.right>=0?N.right:-1,N.center>=0?N.center:-1,N.left>=0?N.left:-1,N.vertical>=0?N.vertical:-1,U,V,j,void 0!==A?A:i.collisionBoxArray.length,void 0!==A?A+1:i.collisionBoxArray.length,void 0!==z?z:i.collisionBoxArray.length,void 0!==z?z+1:i.collisionBoxArray.length,void 0!==C?C:i.collisionBoxArray.length,void 0!==C?C+1:i.collisionBoxArray.length,k||i.collisionBoxArray.length,k?k+1:i.collisionBoxArray.length,d,F,O,B,R,en,0,G,Z,ei)}(i,c,b,l,n,o,s,_,i.layers[0],i.collisionBoxArray,r.index,r.sourceLayerIndex,i.index,E,M,h,0,S,A,x,r,a,d,p,f)};if("line"===C)for(const D of lp(r.geometry,0,0,8192,8192)){const L=function(i,r,n,o,s,a,l,c,h){const u=o?.6*a*l:0,d=ld(o,s),p=d*l,f=0===i[0].x||i[0].x===h||0===i[0].y||i[0].y===h;return r-p=0&&T=0&&E=0&&m+d<=p){const S=new lc(T,E,0,b,g);S._round(),s&&!lh(r,S,l,s,a)||_.push(S)}}f+=v}return h||_.length||c||(_=i(r,f/2,o,s,a,l,c,!0,u)),_}(i,f?r/2*c%r:(d/2+2*a)*l*c%r,r,u,n,p,f,!1,h)}(D,T,I,n.vertical||v,o,24,w,i.overscaling,8192);for(const B of L)v&&function(i,r,n,o){const s=i.compareText;if(r in s){const a=s[r];for(let l=a.length-1;l>=0;l--)if(o.dist(a[l])1){const F=function(i,r,n,o,s,a){const l=n?.6*24*a:0,c=ld(n,o)*a;let h=0;const u=lu(i)/2;for(let d=0;du){const _=(u-h)/m,g=io(p.x,f.x,_),y=io(p.y,f.y,_),x=new lc(g,y,0,f.angleTo(p),d);return!l||lh(i,x,c,l,r)?x:void 0}h+=m}}(R,I,n.vertical||v,o,0,w);F&&P(R,F,f)}}else if("Polygon"===r.type)for(const O of s1(r.geometry,0)){const U=function(i,r=1,n=!1){let o=1/0,s=1/0,a=-1/0,l=-1/0;const c=i[0];for(let h=0;ha)&&(a=d.x),(!h||d.y>l)&&(l=d.y)}const p=Math.min(a-o,l-s);let f=p/2;const m=new lb([],lT);if(0===p)return new u(o,s);for(let _=o;_y.d||!y.d)&&(y=v,n&&console.log("found best %d after %d probes",Math.round(1e4*v.d)/1e4,x)),v.max-y.d<=r||(f=v.h/2,m.push(new lE(v.p.x-f,v.p.y-f,f,i)),m.push(new lE(v.p.x+f,v.p.y-f,f,i)),m.push(new lE(v.p.x-f,v.p.y+f,f,i)),m.push(new lE(v.p.x+f,v.p.y+f,f,i)),x+=4)}return n&&(console.log(`num probes: ${x}`),console.log(`best distance: ${y.d}`)),y.p}(O,16);P(O[0],new lc(U.x,U.y,0,0,void 0),f)}else if("LineString"===r.type)for(const V of r.geometry)P(V,new lc(V[0].x,V[0].y,0,0,void 0),f);else if("Point"===r.type)for(const j of r.geometry)for(const G of j)P([G],new lc(G.x,G.y,0,0,void 0),f)}(i,w,I,A,o,m,S,0,C,H,l,c,d)}a&&i.generateCollisionDebugBuffers(h,i.collisionBoxArray)}(d,l,i.positions,c,r.iconPositions,this.showCollisionBoxes,n,this.tileID.canonical,this.tileZoom,this.projection),d.projection=this.projection.name):d.hasPattern&&(d instanceof ab||d instanceof s4||d instanceof ah)&&(he(d.layers,this.zoom,n),d.addFeatures(_,this.tileID.canonical,r.patternPositions,n))}this.status="done",s(null,{buckets:Y(f).filter(i=>!i.isEmpty()),featureIndex:p,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:i.image,lineAtlas:m,imageAtlas:r,glyphMap:this.returnDependencies?l:null,iconMap:this.returnDependencies?c:null,glyphPositions:this.returnDependencies?i.positions:null})}}D.length?o.send("getImages",{icons:D,source:this.source,tileID:this.tileID,type:"patterns"},(i,r)=>{a||(a=i,h=r,L.call(this))},void 0,!1,z):h={},L.call(this)}}function he(i,r,n){const o=new nk(r);for(const s of i)s.recalculate(o,n)}class ht{constructor(i){this.entries={},this.scheduler=i}request(i,r,n,o){const s=this.entries[i]=this.entries[i]||{callbacks:[]};if(s.result){const[a,l]=s.result;return this.scheduler?this.scheduler.add(()=>{o(a,l)},r):o(a,l),()=>{}}return s.callbacks.push(o),s.cancel||(s.cancel=n((n,o)=>{for(const a of(s.result=[n,o],s.callbacks))this.scheduler?this.scheduler.add(()=>{a(n,o)},r):a(n,o);setTimeout(()=>delete this.entries[i],3e3)})),()=>{s.result||(s.callbacks=s.callbacks.filter(i=>i!==o),s.callbacks.length||(s.cancel(),delete this.entries[i]))}}}function hi(i,r,n){const o=JSON.stringify(i.request);return i.data&&(this.deduped.entries[o]={result:[null,i.data]}),this.deduped.request(o,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom},r=>{const o=e3(i.request,(i,o,s,a)=>{i?r(i):o&&r(null,{vectorTile:n?void 0:new as.VectorTile(new aO(o)),rawData:o,cacheControl:s,expires:a})});return()=>{o.cancel(),r()}},r)}const hr=_(new Float64Array(16));class hn{constructor(i,r){this._tr=i,this._worldSize=r}createInversionMatrix(){return hr}createTileMatrix(i){let r,n,o;const s=i.canonical,a=_(new Float64Array(16)),l=this._tr.projection;if(l.isReprojectedInTileSpace){const c=c8(s,l);r=1,n=c.x+i.wrap*c.scale,o=c.y,x(a,a,[r/c.scale,r/c.scale,this._tr.pixelsPerMeter/this._worldSize])}else r=this._worldSize/this._tr.zoomScale(s.z),n=(s.x+Math.pow(2,s.z)*i.wrap)*r,o=s.y*r;return y(a,a,[n,o,0]),x(a,a,[r/8192,r/8192,1]),a}pointCoordinate(i,r,n){const o=this._tr.horizonLineFromTop(!1),s=new u(i,Math.max(o,r));return this._tr.rayIntersectionCoordinate(this._tr.pointRayIntersection(s,n))}upVector(){return[0,0,1]}upVectorScale(){return 1}}const ho=Math.sqrt(3)/2,hs=Math.PI/2;function ha(i){return Math.tan((hs+i)/2)}const hl=85.051129*N,hc=85.051129*N,hh={albers:{name:"albers",range:[4,7],center:[-96,37.5],parallels:[29.5,45.5],zAxisUnit:"meters",conic:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],initializeConstants(){if(this.constants&&V(this.parallels,this.constants.parallels))return;const i=Math.sin(this.parallels[0]*N),r=(i+Math.sin(this.parallels[1]*N))/2,n=1+i*(2*r-i),o=Math.sqrt(n)/r;this.constants={n:r,c:n,r0:o,parallels:this.parallels}},project(i,r){this.initializeConstants();const n=(i-this.center[0])*N,{n:o,c:s,r0:a}=this.constants,l=Math.sqrt(s-2*o*Math.sin(r*N))/o;return{x:l*Math.sin(n*o),y:l*Math.cos(n*o)-a,z:0}},unproject(i,r){this.initializeConstants();const{n:n,c:o,r0:s}=this.constants,a=s+r;let l=Math.atan2(i,Math.abs(a))*Math.sign(a);a*n<0&&(l-=Math.PI*Math.sign(i)*Math.sign(a));const c=this.center[0]*N*n;l=H(l,-Math.PI-c,Math.PI-c);const h=l/n*j+this.center[0],u=Math.asin(X((o-(i*i+a*a)*n*n)/(2*n),-1,1)),d=X(u*j,-85.051129,85.051129);return new o2(h,d)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/o5(i)*r,farthestPixelDistance(i){return cH(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new hn(i,r)},equalEarth:{name:"equalEarth",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(i,r){r=r/180*Math.PI,i=i/180*Math.PI;const n=Math.asin(ho*Math.sin(r)),o=n*n,s=o*o*o;return{x:.5*(i*Math.cos(n)/(ho*(1.340264+-.24331799999999998*o+s*(.0062510000000000005+.034164*o)))/Math.PI+.5),y:1-.5*(n*(1.340264+-.081106*o+s*(893e-6+.003796*o))/Math.PI+1),z:0}},unproject(i,r){i=(2*i-.5)*Math.PI;let n=r=(2*(1-r)-1)*Math.PI,o=n*n,s=o*o*o;for(let a,l,c=0;c<12&&(l=n*(1.340264+-.081106*o+s*(893e-6+.003796*o))-r,s=(o=(n=X(n-(a=l/(1.340264+-.24331799999999998*o+s*(.0062510000000000005+.034164*o))),-Math.PI/3,Math.PI/3))*n)*o*o,!(1e-12>Math.abs(a)));++c);const h=ho*i*(1.340264+-.24331799999999998*o+s*(.0062510000000000005+.034164*o))/Math.cos(n),u=Math.asin(Math.sin(n)/ho),d=X(180*h/Math.PI,-180,180),p=X(180*u/Math.PI,-85.051129,85.051129);return new o2(d,p)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/o5(i)*r,farthestPixelDistance(i){return cH(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new hn(i,r)},equirectangular:{name:"equirectangular",supportsWorldCopies:!0,center:[0,0],range:[3.5,7],zAxisUnit:"meters",wrap:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project:(i,r)=>({x:.5+i/360,y:.5-r/360,z:0}),unproject(i,r){const n=X(360*(.5-r),-85.051129,85.051129);return new o2(360*(i-.5),n)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/o5(i)*r,farthestPixelDistance(i){return cH(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new hn(i,r)},lambertConformalConic:{name:"lambertConformalConic",range:[3.5,7],zAxisUnit:"meters",center:[0,30],parallels:[30,30],conic:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],initializeConstants(){if(this.constants&&V(this.parallels,this.constants.parallels))return;const i=this.parallels[0]*N,r=this.parallels[1]*N,n=Math.cos(i),o=i===r?Math.sin(i):Math.log(n/Math.cos(r))/Math.log(ha(r)/ha(i)),s=n*Math.pow(ha(i),o)/o;this.constants={n:o,f:s,parallels:this.parallels}},project(i,r){this.initializeConstants(),r*=N,i=(i-this.center[0])*N;const{n:n,f:o}=this.constants;o>0?r<-hs+1e-6&&(r=-hs+1e-6):r>hs-1e-6&&(r=hs-1e-6);const s=o/Math.pow(ha(r),n),a=s*Math.sin(n*i),l=o-s*Math.cos(n*i);return{x:.5*(a/Math.PI+.5),y:1-.5*(l/Math.PI+.5),z:0}},unproject(i,r){this.initializeConstants(),i=(2*i-.5)*Math.PI,r=(2*(1-r)-.5)*Math.PI;const{n:n,f:o}=this.constants,s=o-r,a=Math.sign(s),l=Math.sign(n)*Math.sqrt(i*i+s*s);let c=Math.atan2(i,Math.abs(s))*a;s*n<0&&(c-=Math.PI*Math.sign(i)*a);const h=X(c/n*j+this.center[0],-180,180),u=X((2*Math.atan(Math.pow(o/l,1/n))-hs)*j,-85.051129,85.051129);return new o2(h,u)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/o5(i)*r,farthestPixelDistance(i){return cH(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new hn(i,r)},mercator:{name:"mercator",wrap:!0,requiresDraping:!1,supportsWorldCopies:!0,supportsTerrain:!0,supportsFog:!0,supportsFreeCamera:!0,zAxisUnit:"meters",center:[0,0],project:(i,r)=>({x:o4(i),y:o6(r),z:0}),unproject(i,r){const n=o8(i),o=o9(r);return new o2(n,o)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/o5(i)*r,farthestPixelDistance(i){return cH(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new hn(i,r)},naturalEarth:{name:"naturalEarth",center:[0,0],range:[3.5,7],isReprojectedInTileSpace:!0,zAxisUnit:"meters",unsupportedLayers:["custom"],project(i,r){const n=(r*=N)*r,o=n*n;return{x:.5*((i*=N)*(.8707-.131979*n+o*(o*(.003971*n-.001529*o)-.013791))/Math.PI+.5),y:1-.5*(r*(1.007226+n*(.015085+o*(.028874*n-.044475-.005916*o)))/Math.PI+1),z:0}},unproject(i,r){i=(2*i-.5)*Math.PI;let n=r=(2*(1-r)-1)*Math.PI,o=25,s=0,a=n*n;do{a=n*n;const l=a*a;s=(n*(1.007226+a*(.015085+l*(.028874*a-.044475-.005916*l)))-r)/(1.007226+a*(.045255+l*(.259866*a-.311325-.005916*11*l))),n=X(n-s,-hl,hl)}while(Math.abs(s)>1e-6&&--o>0)a=n*n;const c=X(i/(.8707+a*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979))*j,-180,180),h=n*j;return new o2(c,h)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/o5(i)*r,farthestPixelDistance(i){return cH(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new hn(i,r)},winkelTripel:{name:"winkelTripel",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(i,r){r*=N,i*=N;const n=Math.cos(r),o=2/Math.PI,s=Math.acos(n*Math.cos(i/2)),a=Math.sin(s)/s,l=.5*(i*o+2*n*Math.sin(i/2)/a)||0,c=.5*(r+Math.sin(r)/a)||0;return{x:.5*(l/Math.PI+.5),y:1-.5*(c/Math.PI+1),z:0}},unproject(i,r){let n=i=(2*i-.5)*Math.PI,o=r=(2*(1-r)-1)*Math.PI,s=25,a=0,l=0;do{const c=Math.cos(o),h=Math.sin(o),u=2*h*c,d=h*h,p=c*c,f=Math.cos(n/2),m=Math.sin(n/2),_=2*f*m,g=m*m,y=1-p*f*f,x=y?1/y:0,v=y?Math.acos(c*f)*Math.sqrt(1/y):0,b=.5*(2*v*c*m+2*n/Math.PI)-i,w=.5*(v*h+o)-r,T=.5*x*(p*g+v*c*f*d)+1/Math.PI,E=x*(_*u/4-v*h*m),S=.125*x*(u*m-v*h*p*_),I=.5*x*(d*f+v*g*c)+.5,M=E*S-I*T;a=(w*E-b*I)/M,l=(b*S-w*T)/M,n=X(n-a,-Math.PI,Math.PI),o=X(o-l,-hc,hc)}while((Math.abs(a)>1e-6||Math.abs(l)>1e-6)&&--s>0)return new o2(n*j,o*j)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/o5(i)*r,farthestPixelDistance(i){return cH(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new hn(i,r)}};i.ARRAY_TYPE=f,i.AUTH_ERR_MSG=ez,i.Aabb=sv,i.Actor=class{constructor(i,r,n){this.target=i,this.parent=r,this.mapId=n,this.callbacks={},this.cancelCallbacks={},en(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=ed()?i:p,this.scheduler=new l6}send(i,r,n,o,s=!1,a){const l=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(n.metadata=a,this.callbacks[l]=n);const c=ey(this.globalScope)?void 0:[];return this.target.postMessage({id:l,type:i,hasCallback:!!n,targetMapId:o,mustQueue:s,sourceMapId:this.mapId,data:rH(r,c)},c),{cancel:()=>{n&&delete this.callbacks[l],this.target.postMessage({id:l,type:"",targetMapId:o,sourceMapId:this.mapId})}}}receive(i){const r=i.data,n=r.id;if(n&&(!r.targetMapId||this.mapId===r.targetMapId)){if(""===r.type){const o=this.cancelCallbacks[n];delete this.cancelCallbacks[n],o&&o.cancel()}else if(r.mustQueue||ed()){const s=this.callbacks[n];this.cancelCallbacks[n]=this.scheduler.add(()=>this.processTask(n,r),s&&s.metadata||{type:"message"})}else this.processTask(n,r)}}processTask(i,r){if(""===r.type){const n=this.callbacks[i];delete this.callbacks[i],n&&(r.error?n(rK(r.error)):n(null,rK(r.data)))}else{const o=ey(this.globalScope)?void 0:[],s=r.hasCallback?(r,n)=>{delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"",sourceMapId:this.mapId,error:r?rH(r):null,data:rH(n,o)},o)}:i=>{},a=rK(r.data);if(this.parent[r.type])this.parent[r.type](r.sourceMapId,a,s);else if(this.parent.getWorkerSource){const l=r.type.split(".");this.parent.getWorkerSource(r.sourceMapId,l[0],a.source)[l[1]](a,s)}else s(Error(`Could not find function ${r.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},i.CanonicalTileID=l9,i.Color=tC,i.ColorMode=cn,i.CullFaceMode=co,i.DEMData=cg,i.DataConstantProperty=nV,i.DedupedRequest=ht,i.DepthMode=ci,i.EXTENT=8192,i.Elevation=class{getAtPointOrZero(i,r=0){return this.getAtPoint(i,r)||0}getAtPoint(i,r,n=!0){null==r&&(r=null);const o=this._source();if(!o||i.y<0||i.y>1)return r;const s=o.getSource().maxzoom,a=1<{const o=this.getAtTileOffset(i,n.x,n.y),s=r.upVector(i.canonical,n.x,n.y);return C(s,s,o*r.upVectorScale(i.canonical)),s}}getForTilePoints(i,r,n,o){const s=cw.create(this,i,o);return!!s&&(r.forEach(i=>{i[2]=this.exaggeration()*s.getElevationAt(i[0],i[1],n)}),!0)}getMinMaxForTile(i){const r=this.findDEMTileFor(i);if(!r||!r.dem)return null;const n=r.dem.tree,o=r.tileID,s=1<Math.abs(o))return!1;const s=((i[0]-this.pos[0])*r[0]+(i[1]-this.pos[1])*r[1]+(i[2]-this.pos[2])*r[2])/o;return n[0]=this.pos[0]+this.dir[0]*s,n[1]=this.pos[1]+this.dir[1]*s,n[2]=this.pos[2]+this.dir[2]*s,!0}closestPointOnSphere(i,r,n){var o,s,a,l,c,h,u;if(s=(o=this.pos)[0],a=o[1],l=o[2],c=i[0],h=i[1],u=i[2],Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(a-h)<=1e-6*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(l-u)<=1e-6*Math.max(1,Math.abs(l),Math.abs(u))||0===r)return n[0]=n[1]=n[2]=0,!1;const[d,p,f]=this.dir,m=this.pos[0]-i[0],_=this.pos[1]-i[1],g=this.pos[2]-i[2],y=d*d+p*p+f*f,x=2*(m*d+_*p+g*f),v=x*x-4*y*(m*m+_*_+g*g-r*r);if(v<0){const b=Math.max(-x/2,0),w=m+d*b,T=_+p*b,E=g+f*b,S=Math.hypot(w,T,E);return n[0]=w*r/S,n[1]=T*r/S,n[2]=E*r/S,!1}{const I=(-x-Math.sqrt(v))/(2*y);if(I<0){const M=Math.hypot(m,_,g);return n[0]=m*r/M,n[1]=_*r/M,n[2]=g*r/M,!1}return n[0]=m+d*I,n[1]=_+p*I,n[2]=g+f*I,!0}}},i.RequestManager=class{constructor(i,r,n){this._transformRequestFn=i,this._customAccessToken=r,this._silenceAuthErrors=!!n,this._createSkuToken()}_createSkuToken(){const i=function(){let i="";for(let r=0;r<10;r++)i+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1","01",i].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=i.token,this._skuTokenExpiresAt=i.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(i,r){return this._transformRequestFn&&this._transformRequestFn(i,r)||{url:i}}normalizeStyleURL(i,r){if(!ek(i))return i;const n=eL(i);return n.path=`/styles/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||r)}normalizeGlyphsURL(i,r){if(!ek(i))return i;const n=eL(i);return n.path=`/fonts/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||r)}normalizeSourceURL(i,r){if(!ek(i))return i;const n=eL(i);return n.path=`/v4/${n.authority}.json`,n.params.push("secure"),this._makeAPIURL(n,this._customAccessToken||r)}normalizeSpriteURL(i,r,n,o){const s=eL(i);return ek(i)?(s.path=`/styles/v1${s.path}/sprite${r}${n}`,this._makeAPIURL(s,this._customAccessToken||o)):(s.path+=`${r}${n}`,eB(s))}normalizeTileURL(i,r,n){if(this._isSkuTokenExpired()&&this._createSkuToken(),i&&!ek(i))return i;const o=eL(i);o.path=o.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${r||n&&"raster"!==o.authority&&512===n?"@2x":""}${eE.supported?".webp":"$1"}`),"raster"===o.authority?o.path=`/${eb.RASTER_URL_PREFIX}${o.path}`:(o.path=o.path.replace(/^.+\/v4\//,"/"),o.path=`/${eb.TILE_URL_VERSION}${o.path}`);const s=this._customAccessToken||function(i){for(const r of i){const n=r.match(/^access_token=(.*)$/);if(n)return n[1]}return null}(o.params)||eb.ACCESS_TOKEN;return eb.REQUIRE_ACCESS_TOKEN&&s&&this._skuToken&&o.params.push(`sku=${this._skuToken}`),this._makeAPIURL(o,s)}canonicalizeTileURL(i,r){const n=eL(i);if(!n.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!n.path.match(/\.[\w]+$/))return i;let o="mapbox://";n.path.match(/^\/raster\/v1\//)?o+=`raster/${n.path.replace(`/${eb.RASTER_URL_PREFIX}/`,"")}`:o+=`tiles/${n.path.replace(`/${eb.TILE_URL_VERSION}/`,"")}`;let s=n.params;return r&&(s=s.filter(i=>!i.match(/^access_token=/))),s.length&&(o+=`?${s.join("&")}`),o}canonicalizeTileset(i,r){const n=!!r&&ek(r),o=[];for(const s of i.tiles||[])eP(s)?o.push(this.canonicalizeTileURL(s,n)):o.push(s);return o}_makeAPIURL(i,r){const n="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",o=eL(eb.API_URL);if(i.protocol=o.protocol,i.authority=o.authority,"http"===i.protocol){const s=i.params.indexOf("secure");s>=0&&i.params.splice(s,1)}if("/"!==o.path&&(i.path=`${o.path}${i.path}`),!eb.REQUIRE_ACCESS_TOKEN)return eB(i);if(r=r||eb.ACCESS_TOKEN,!this._silenceAuthErrors){if(!r)throw Error(`An API access token is required to use Mapbox GL. ${n}`);if("s"===r[0])throw Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${n}`)}return i.params=i.params.filter(i=>-1===i.indexOf("access_token")),i.params.push(`access_token=${r||""}`),eB(i)}},i.ResourceType=eQ,i.SegmentVector=o0,i.SourceCache=cx,i.StencilMode=cr,i.StructArrayLayout1ui2=ol,i.StructArrayLayout2f1f2i16=n9,i.StructArrayLayout2i4=nJ,i.StructArrayLayout2ui4=oa,i.StructArrayLayout3f12=n1,i.StructArrayLayout3ui6=oe,i.StructArrayLayout4i8=nQ,i.Texture=l1,i.Tile=c$,i.Transitionable=nL,i.Uniform1f=oP,i.Uniform1i=class extends ok{constructor(i,r){super(i,r),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},i.Uniform2f=class extends ok{constructor(i,r){super(i,r),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},i.Uniform3f=class extends ok{constructor(i,r){super(i,r),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},i.Uniform4f=oD,i.UniformColor=oL,i.UniformMatrix2f=class extends ok{constructor(i,r){super(i,r),this.current=oF}set(i){for(let r=0;r<4;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix2fv(this.location,!1,i);break}}},i.UniformMatrix3f=class extends ok{constructor(i,r){super(i,r),this.current=oR}set(i){for(let r=0;r<9;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}},i.UniformMatrix4f=class extends ok{constructor(i,r){super(i,r),this.current=oB}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let r=1;r<16;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},i.UnwrappedTileID=l7,i.ValidationError=tn,i.VectorTileWorkerSource=class extends ti{constructor(i,r,n,o,s){super(),this.actor=i,this.layerIndex=r,this.availableImages=n,this.loadVectorData=s||hi,this.loading={},this.loaded={},this.deduped=new ht(i.scheduler),this.isSpriteLoaded=o,this.scheduler=i.scheduler}loadTile(i,r){const n=i.uid,o=i&&i.request,s=o&&o.collectResourceTiming,a=this.loading[n]=new c7(i);a.abort=this.loadVectorData(i,(l,c)=>{const h=!this.loading[n];if(delete this.loading[n],h||l||!c)return a.status="done",h||(this.loaded[n]=a),r(l);const u=c.rawData,d={};c.expires&&(d.expires=c.expires),c.cacheControl&&(d.cacheControl=c.cacheControl),a.vectorTile=c.vectorTile||new as.VectorTile(new aO(u));const p=()=>{a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,(i,n)=>{if(i||!n)return r(i);const a={};if(s){const l=l4(o);l.length>0&&(a.resourceTiming=JSON.parse(JSON.stringify(l)))}r(null,J({rawTileData:u.slice(0)},n,d,a))})};this.isSpriteLoaded?p():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(p,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom}):p()}),this.loaded=this.loaded||{},this.loaded[n]=a})}reloadTile(i,r){const n=this.loaded,o=i.uid,s=this;if(n&&n[o]){const a=n[o];a.showCollisionBoxes=i.showCollisionBoxes,a.enableTerrain=!!i.enableTerrain,a.projection=i.projection;const l=(i,n)=>{const o=a.reloadCallback;o&&(delete a.reloadCallback,a.parse(a.vectorTile,s.layerIndex,this.availableImages,s.actor,o)),r(i,n)};"parsing"===a.status?a.reloadCallback=l:"done"===a.status&&(a.vectorTile?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,l):l())}}abortTile(i,r){const n=i.uid,o=this.loading[n];o&&(o.abort&&o.abort(),delete this.loading[n]),r()}removeTile(i,r){const n=this.loaded,o=i.uid;n&&n[o]&&delete n[o],r()}},i.WritingMode=a6,i.ZoomHistory=rY,i.add=I,i.addDynamicAttributes=lR,i.adjoint=function(i,r){var n=r[0],o=r[1],s=r[2],a=r[3],l=r[4],c=r[5],h=r[6],u=r[7],d=r[8];return i[0]=l*d-c*u,i[1]=s*u-o*d,i[2]=o*c-s*l,i[3]=c*h-a*d,i[4]=n*d-s*h,i[5]=s*a-n*c,i[6]=a*u-l*h,i[7]=o*h-n*u,i[8]=n*l-o*a,i},i.asyncAll=K,i.bezier=$,i.bindAll=en,i.boundsAttributes=cG,i.bufferConvexPolygon=function(i,r){const n=[];for(let o=0;oeH&&(i.getActor().send("enforceCacheSizeLimit",eW),eJ=0)},i.calculateGlobeMatrix=c4,i.calculateGlobeMercatorMatrix=function(i){const r=i.worldSize,n=X(i.center.lat,-85.051129,85.051129),o=new u(o4(i.center.lng)*r,o6(n)*r),s=1/o5(i.center.lat)*r,a=i.pixelsPerMeter,l=r/(s/i.pixelsPerMeter),c=_(new Float64Array(16));return y(c,c,[o.x,o.y,0]),x(c,c,[l,l,a]),c},i.clamp=X,i.clearTileCache=function(i){const r=p.caches.delete(e$);i&&r.catch(i).then(()=>i())},i.clipLine=lp,i.clone=function(i){var r=new f(16);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],r},i.clone$1=el,i.collisionCircleLayout=az,i.config=eb,i.conjugate=function(i,r){return i[0]=-r[0],i[1]=-r[1],i[2]=-r[2],i[3]=r[3],i},i.create=function(){var i=new f(16);return f!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},i.create$1=m,i.createExpression=i9,i.createLayout=nK,i.createStyleLayer=function(i){return"custom"===i.type?new lq(i):new lH[i.type](i)},i.cross=D,i.degToRad=function(i){return i*N},i.div=function(i,r,n){return i[0]=r[0]/n[0],i[1]=r[1]/n[1],i[2]=r[2]/n[2],i},i.dot=P,i.ease=q,i.easeCubicInOut=Z,i.emitValidationErrors=rU,i.endsWith=eo,i.enforceCacheSizeLimit=function(i){eK(),eq&&eq.then(r=>{r.keys().then(n=>{for(let o=0;oa&&(o+=(i[s]-a)*(i[s]-a)),r[s]Math.abs(r.parallels[0]+r.parallels[1])){let n=function(i){const r=Math.max(.01,Math.cos(i*N)),n=1/(2*Math.max(Math.PI*r,1/r));return{wrap:!0,supportsWorldCopies:!0,unsupportedLayers:["custom"],project(i,o){const s=Math.sin(o*N)/r;return{x:i*N*r*n+.5,y:-s*n+.5,z:0}},unproject(i,o){const s=X((i-.5)/n*j/r,-180,180),a=Math.asin(X(-(o-.5)/n*r,-1,1)),l=X(a*j,-85.051129,85.051129);return new o2(s,l)}}}(r.parallels[0]);if("lambertConformalConic"===r.name){const{project:o,unproject:s}=hh.mercator;n={wrap:!0,supportsWorldCopies:!0,project:o,unproject:s}}return J({},i,r,n)}return J({},i,r)}(r,i):r},i.getRTLTextPluginStatus=nA,i.getReferrer=e1,i.getTilePoint=function(i,{x:r,y:n},o=0){return new u(((r-o)*i.scale-i.x)*8192,(n*i.scale-i.y)*8192)},i.getTileVec3=function(i,r,n=0){return S(((r.x-n)*i.scale-i.x)*8192,(r.y*i.scale-i.y)*8192,r.z*o5(o9(r.y)))},i.getVideo=function(i,r){const n=p.document.createElement("video");n.muted=!0,n.onloadstart=function(){r(null,n)};for(let o=0;o0&&(l=1/Math.sqrt(l)),i[0]=n*l,i[1]=o*l,i[2]=s*l,i[3]=a*l,i},i.number=io,i.ortho=function(i,r,n,o,s,a,l){var c=1/(r-n),h=1/(o-s),u=1/(a-l);return i[0]=-2*c,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*h,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*u,i[11]=0,i[12]=(r+n)*c,i[13]=(s+o)*h,i[14]=(l+a)*u,i[15]=1,i},i.pbf=aO,i.perspective=function(i,r,n,o,s){var a,l=1/Math.tan(r/2);return i[0]=l/n,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=l,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,null!=s&&s!==1/0?(i[10]=(s+o)*(a=1/(o-s)),i[14]=2*s*o*a):(i[10]=-1,i[14]=-2*o),i},i.pick=function(i,r){const n={};for(let o=0;othis._layers[i.id]),h=c[0];if("none"===h.visibility)continue;const u=h.source||"";let d=this.familiesBySource[u];d||(d=this.familiesBySource[u]={});const p=h.sourceLayer||"_geojsonTileLayer";let f=d[p];f||(f=d[p]=[]),f.push(c)}}}const{ImageBitmap:n}=i.window;class o{loadTile(r,o){const{uid:s,encoding:a,rawImageData:l,padding:c,buildQuadTree:h}=r,u=n&&l instanceof n?this.getImageData(l,c):l;o(null,new i.DEMData(s,u,a,c<1,h))}getImageData(r,n){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(r.width,r.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=r.width,this.offscreenCanvas.height=r.height,this.offscreenCanvasContext.drawImage(r,0,0,r.width,r.height);const o=this.offscreenCanvasContext.getImageData(-n,-n,r.width+2*n,r.height+2*n);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new i.RGBAImage({width:o.width,height:o.height},o.data)}}var s,a=function i(r,n){var o,s=r&&r.type;if("FeatureCollection"===s)for(o=0;o=Math.abs(c)?n-h+c:c-h+n,n=h}n+o>=0!=!!r&&i.reverse()}const h=i.vectorTile.VectorTileFeature.prototype.toGeoJSON;class u{constructor(r){this._feature=r,this.extent=i.EXTENT,this.type=r.type,this.properties=r.tags,"id"in r&&!isNaN(r.id)&&(this.id=parseInt(r.id,10))}loadGeometry(){if(1===this._feature.type){const r=[];for(const n of this._feature.geometry)r.push([new i.pointGeometry(n[0],n[1])]);return r}{const o=[];for(const s of this._feature.geometry){const a=[];for(const l of s)a.push(new i.pointGeometry(l[0],l[1]));o.push(a)}return o}}toGeoJSON(i,r,n){return h.call(this,i,r,n)}}class d{constructor(r){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=i.EXTENT,this.length=r.length,this._features=r}feature(i){return new u(this._features[i])}}var p=i.vectorTile.VectorTileFeature;function f(i,r){this.options=r||{},this.features=i,this.length=i.length}function m(i,r){this.id="number"==typeof i.id?i.id:void 0,this.type=i.type,this.rawGeometry=1===i.type?[i.geometry]:i.geometry,this.properties=i.tags,this.extent=r||4096}f.prototype.feature=function(i){return new m(this.features[i],this.options.extent)},m.prototype.loadGeometry=function(){var r=this.rawGeometry;this.geometry=[];for(var n=0;n>31),r.writeVarint(m<<1^m>>31),s+=f,a+=m}3===o&&r.writeVarint(15)}}function w(i,r){var n=typeof i;"string"===n?r.writeStringField(1,i):"boolean"===n?r.writeBooleanField(7,i):"number"===n&&(i%1!=0?r.writeDoubleField(3,i):i<0?r.writeSVarintField(6,i):r.writeVarintField(5,i))}function T(i,r,n,o){E(i,n,o),E(r,2*n,2*o),E(r,2*n+1,2*o+1)}function E(i,r,n){const o=i[r];i[r]=i[n],i[n]=o}function S(i,r,n,o){const s=i-n,a=r-o;return s*s+a*a}_.fromVectorTileJs=g,_.fromGeojsonVt=function(i,r){r=r||{};var n={};for(var o in i)n[o]=new f(i[o].features,r),n[o].name=o,n[o].version=r.version,n[o].extent=r.extent;return g({layers:n})},_.GeoJSONWrapper=f;const I=i=>i[0],M=i=>i[1];class A{constructor(i,r=I,n=M,o=64,s=Float64Array){this.nodeSize=o,this.points=i;const a=i.length<65536?Uint16Array:Uint32Array,l=this.ids=new a(i.length),c=this.coords=new s(2*i.length);for(let h=0;h>1;(function i(r,n,o,s,a,l){for(;a>s;){if(a-s>600){const c=a-s+1,h=o-s+1,u=Math.log(c),d=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*d*(c-d)/c)*(h-c/2<0?-1:1);i(r,n,o,Math.max(s,Math.floor(o-h*d/c+p)),Math.min(a,Math.floor(o+(c-h)*d/c+p)),l)}const f=n[2*o+l];let m=s,_=a;for(T(r,n,s,o),n[2*a+l]>f&&T(r,n,s,a);m<_;){for(T(r,n,m,_),m++,_--;n[2*m+l]f;)_--}n[2*s+l]===f?T(r,n,s,_):T(r,n,++_,a),_<=o&&(s=_+1),o<=_&&(a=_-1)}})(r,n,c,s,a,l%2),i(r,n,o,s,c-1,l+1),i(r,n,o,c+1,a,l+1)}(l,c,o,0,l.length-1,0)}range(i,r,n,o){return function(i,r,n,o,s,a,l){let c,h;const u=[0,i.length-1,0],d=[];for(;u.length;){const p=u.pop(),f=u.pop(),m=u.pop();if(f-m<=l){for(let _=m;_<=f;_++)c=r[2*_],h=r[2*_+1],c>=n&&c<=s&&h>=o&&h<=a&&d.push(i[_]);continue}const g=Math.floor((m+f)/2);c=r[2*g],h=r[2*g+1],c>=n&&c<=s&&h>=o&&h<=a&&d.push(i[g]);const y=(p+1)%2;(0===p?n<=c:o<=h)&&(u.push(m),u.push(g-1),u.push(y)),(0===p?s>=c:a>=h)&&(u.push(g+1),u.push(f),u.push(y))}return d}(this.ids,this.coords,i,r,n,o,this.nodeSize)}within(i,r,n){return function(i,r,n,o,s,a){const l=[0,i.length-1,0],c=[],h=s*s;for(;l.length;){const u=l.pop(),d=l.pop(),p=l.pop();if(d-p<=a){for(let f=p;f<=d;f++)S(r[2*f],r[2*f+1],n,o)<=h&&c.push(i[f]);continue}const m=Math.floor((p+d)/2),_=r[2*m],g=r[2*m+1];S(_,g,n,o)<=h&&c.push(i[m]);const y=(u+1)%2;(0===u?n-s<=_:o-s<=g)&&(l.push(p),l.push(m-1),l.push(y)),(0===u?n+s>=_:o+s>=g)&&(l.push(m+1),l.push(d),l.push(y))}return c}(this.ids,this.coords,i,r,n,this.nodeSize)}}const C={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:i=>i},z=Math.fround||(s=new Float32Array(1),i=>(s[0]=+i,s[0]));class k{constructor(i){this.options=R(Object.create(C),i),this.trees=Array(this.options.maxZoom+1)}load(i){const{log:r,minZoom:n,maxZoom:o,nodeSize:s}=this.options;r&&console.time("total time");const a=`prepare ${i.length} points`;r&&console.time(a),this.points=i;let l=[];for(let c=0;c=n;h--){const u=+Date.now();l=this._cluster(l,h),this.trees[h]=new A(l,F,O,s,Float32Array),r&&console.log("z%d: %d clusters in %dms",h,l.length,+Date.now()-u)}return r&&console.timeEnd("total time"),this}getClusters(i,r){let n=((i[0]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,i[1]));let s=180===i[2]?180:((i[2]+180)%360+360)%360-180;const a=Math.max(-90,Math.min(90,i[3]));if(i[2]-i[0]>=360)n=-180,s=180;else if(n>s){const l=this.getClusters([n,o,180,a],r),c=this.getClusters([-180,o,s,a],r);return l.concat(c)}const h=this.trees[this._limitZoom(r)],u=h.range(L(n),B(a),L(s),B(o)),d=[];for(const p of u){const f=h.points[p];d.push(f.numPoints?P(f):this.points[f.index])}return d}getChildren(i){const r=this._getOriginId(i),n=this._getOriginZoom(i),o="No cluster with the specified id.",s=this.trees[n];if(!s)throw Error(o);const a=s.points[r];if(!a)throw Error(o);const l=this.options.radius/(this.options.extent*Math.pow(2,n-1)),c=s.within(a.x,a.y,l),h=[];for(const u of c){const d=s.points[u];d.parentId===i&&h.push(d.numPoints?P(d):this.points[d.index])}if(0===h.length)throw Error(o);return h}getLeaves(i,r,n){const o=[];return this._appendLeaves(o,i,r=r||10,n=n||0,0),o}getTile(i,r,n){const o=this.trees[this._limitZoom(i)],s=Math.pow(2,i),{extent:a,radius:l}=this.options,c=l/a,h=(n-c)/s,u=(n+1+c)/s,d={features:[]};return this._addTileFeatures(o.range((r-c)/s,h,(r+1+c)/s,u),o.points,r,n,s,d),0===r&&this._addTileFeatures(o.range(1-c/s,h,1,u),o.points,s,n,s,d),r===s-1&&this._addTileFeatures(o.range(0,h,c/s,u),o.points,-1,n,s,d),d.features.length?d:null}getClusterExpansionZoom(i){let r=this._getOriginZoom(i)-1;for(;r<=this.options.maxZoom;){const n=this.getChildren(i);if(r++,1!==n.length)break;i=n[0].properties.cluster_id}return r}_appendLeaves(i,r,n,o,s){const a=this.getChildren(r);for(const l of a){const c=l.properties;if(c&&c.cluster?s+c.point_count<=o?s+=c.point_count:s=this._appendLeaves(i,c.cluster_id,n,o,s):sr&&(m+=g.numPoints||1)}if(m>f&&m>=l){var y,x,v,b;let w=u.x*f,T=u.y*f,E=a&&f>1?this._map(u,!0):null;const S=(h<<5)+(r+1)+this.points.length;for(const I of p){const M=d.points[I];if(M.zoom<=r)continue;M.zoom=r;const A=M.numPoints||1;w+=M.x*A,T+=M.y*A,M.parentId=S,a&&(E||(E=this._map(u,!0)),a(E,this._map(M)))}u.parentId=S,n.push((y=w/m,x=T/m,v=m,b=E,{x:z(y),y:z(x),zoom:1/0,id:S,parentId:-1,numPoints:v,properties:b}))}else if(n.push(u),m>1)for(const C of p){const k=d.points[C];k.zoom<=r||(k.zoom=r,n.push(k))}}return n}_getOriginId(i){return i-this.points.length>>5}_getOriginZoom(i){return(i-this.points.length)%32}_map(i,r){if(i.numPoints)return r?R({},i.properties):i.properties;const n=this.points[i.index].properties,o=this.options.map(n);return r&&o===n?R({},o):o}}function P(i){return{type:"Feature",id:i.id,properties:D(i),geometry:{type:"Point",coordinates:[360*(i.x-.5),function(i){const r=(180-360*i)*Math.PI/180;return 360*Math.atan(Math.exp(r))/Math.PI-90}(i.y)]}}}function D(i){const r=i.numPoints,n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r;return R(R({},i.properties),{cluster:!0,cluster_id:i.id,point_count:r,point_count_abbreviated:n})}function L(i){return i/360+.5}function B(i){const r=Math.sin(i*Math.PI/180),n=.5-.25*Math.log((1+r)/(1-r))/Math.PI;return n<0?0:n>1?1:n}function R(i,r){for(const n in r)i[n]=r[n];return i}function F(i){return i.x}function O(i){return i.y}function U(i,r,n,o){var s={id:void 0===i?null:i,type:r,geometry:n,tags:o,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(i){var r=i.geometry,n=i.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)V(i,r);else if("Polygon"===n||"MultiLineString"===n)for(var o=0;o0&&(l+=o?(s*u-h*a)/2:Math.sqrt(Math.pow(h-s,2)+Math.pow(u-a,2))),s=h,a=u}var d=r.length-3;r[2]=1,function i(r,n,o,s){for(var a,l=s,c=o-n>>1,h=o-n,u=r[n],d=r[n+1],p=r[o],f=r[o+1],m=n+3;m1?(n=s,o=a):h>0&&(n+=l*h,o+=c*h)}return(l=i-n)*l+(c=r-o)*c}(r[m],r[m+1],u,d,p,f);if(_>l)a=m,l=_;else if(_===l){var g=Math.abs(m-c);gs&&(a-n>3&&i(r,n,a,s),r[a+2]=l,o-a>3&&i(r,a,o,s))}(r,0,d,n),r[d+2]=1,r.size=Math.abs(l),r.start=0,r.end=r.size}function Z(i,r,n,o){for(var s=0;s1?1:n}function q(i,r,n,o,s,a,l,c){if(o/=r,a>=(n/=r)&&l=o)return null;for(var h=[],u=0;u=n&&_=o)){var g=[];if("Point"===f||"MultiPoint"===f)(function(i,r,n,o,s){for(var a=0;a=n&&l<=o&&(r.push(i[a]),r.push(i[a+1]),r.push(i[a+2]))}})(p,g,n,o,s);else if("LineString"===f)X(p,g,n,o,s,!1,c.lineMetrics);else if("MultiLineString"===f)H(p,g,n,o,s,!1);else if("Polygon"===f)H(p,g,n,o,s,!0);else if("MultiPolygon"===f)for(var y=0;yn&&(h=d(u,m,_,y,x,n),l&&(u.start=p+c*h)):v>o?b=n&&(h=d(u,m,_,y,x,n),w=!0),b>o&&v<=o&&(h=d(u,m,_,y,x,o),w=!0),!a&&w&&(l&&(u.end=p+c*h),r.push(u),u=W(i)),l&&(p+=c)}var T=i.length-3;m=i[T],_=i[T+1],g=i[T+2],(v=0===s?m:_)>=n&&v<=o&&K(u,m,_,g),T=u.length-3,a&&T>=3&&(u[T]!==u[0]||u[T+1]!==u[1])&&K(u,u[0],u[1],u[2]),u.length&&r.push(u)}function W(i){var r=[];return r.size=i.size,r.start=i.start,r.end=i.end,r}function H(i,r,n,o,s,a){for(var l=0;l0&&r.size<(s?l:o))n.numPoints+=r.length/3;else{for(var c=[],h=0;hl)&&(n.numSimplified++,c.push(r[h]),c.push(r[h+1])),n.numPoints++;s&&function(i,r){for(var n=0,o=0,s=i.length,a=s-2;o0===r)for(o=0,s=i.length;o24)throw Error("maxZoom should be in the 0-24 range");if(r.promoteId&&r.generateId)throw Error("promoteId and generateId cannot be used together.");var u=function(i,r){var n=[];if("FeatureCollection"===i.type)for(var o=0;o1&&console.time("creation"),f=this.tiles[p]=function(i,r,n,o,s){for(var a=r===s.maxZoom?0:s.tolerance/((1<l.maxX&&(l.maxX=d),p>l.maxY&&(l.maxY=p)}return l}(i,r,n,o,h),this.tileCoords.push({z:r,x:n,y:o}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",r,n,o,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var m="z"+r;this.stats[m]=(this.stats[m]||0)+1,this.total++}if(f.source=i,s){if(r===h.maxZoom||r===s)continue;var _=1<1&&console.time("clipping");var g,y,x,v,b,w,T=.5*h.buffer/h.extent,E=.5-T,S=.5+T,I=1+T;g=y=x=v=null,b=q(i,d,n-T,n+S,0,f.minX,f.maxX,h),w=q(i,d,n+E,n+I,0,f.minX,f.maxX,h),i=null,b&&(g=q(b,d,o-T,o+S,1,f.minY,f.maxY,h),y=q(b,d,o+E,o+I,1,f.minY,f.maxY,h),b=null),w&&(x=q(w,d,o-T,o+S,1,f.minY,f.maxY,h),v=q(w,d,o+E,o+I,1,f.minY,f.maxY,h),w=null),u>1&&console.timeEnd("clipping"),c.push(g||[],r+1,2*n,2*o),c.push(y||[],r+1,2*n,2*o+1),c.push(x||[],r+1,2*n+1,2*o),c.push(v||[],r+1,2*n+1,2*o+1)}}},en.prototype.getTile=function(i,r,n){var o=this.options,s=o.extent,a=o.debug;if(i<0||i>24)return null;var l=1<1&&console.log("drilling down to z%d-%d-%d",i,r,n);for(var h,u=i,d=r,p=n;!h&&u>0;)u--,d=Math.floor(d/2),p=Math.floor(p/2),h=this.tiles[eo(u,d,p)];return h&&h.source?(a>1&&console.log("found parent tile z%d-%d-%d",u,d,p),a>1&&console.time("drilling down"),this.splitTile(h.source,u,d,p,i,r,n),a>1&&console.timeEnd("drilling down"),this.tiles[c]?et(this.tiles[c],s):null):null};class ea extends i.VectorTileWorkerSource{constructor(i,r,n,o,s){super(i,r,n,o,es),s&&(this.loadGeoJSON=s)}loadData(r,n){const o=r&&r.request,s=o&&o.collectResourceTiming;this.loadGeoJSON(r,(l,c)=>{if(l||!c)return n(l);if("object"!=typeof c)return n(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`));{a(c,!0);try{var h,u;if(r.filter){const d=i.createExpression(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===d.result)throw Error(d.value.map(i=>`${i.key}: ${i.message}`).join(", "));const p=c.features.filter(i=>d.value.evaluate({zoom:0},i));c={type:"FeatureCollection",features:p}}this._geoJSONIndex=r.cluster?new k(function({superclusterOptions:r,clusterProperties:n}){if(!n||!r)return r;const o={},s={},a={accumulated:null,zoom:0},l={properties:null},c=Object.keys(n);for(const h of c){const[u,d]=n[h],p=i.createExpression(d),f=i.createExpression("string"==typeof u?[u,["accumulated"],["get",h]]:u);o[h]=p.value,s[h]=f.value}return r.map=i=>{l.properties=i;const r={};for(const n of c)r[n]=o[n].evaluate(a,l);return r},r.reduce=(i,r)=>{for(const n of(l.properties=r,c))a.accumulated=i[n],i[n]=s[n].evaluate(a,l)},r}(r)).load(c.features):(h=c,u=r.geojsonVtOptions,new en(h,u))}catch(f){return n(f)}this.loaded={};const m={};if(s){const _=i.getPerformanceMeasurement(o);_&&(m.resourceTiming={},m.resourceTiming[r.source]=JSON.parse(JSON.stringify(_)))}n(null,m)}})}reloadTile(i,r){const n=this.loaded;return n&&n[i.uid]?super.reloadTile(i,r):this.loadTile(i,r)}loadGeoJSON(r,n){if(r.request)i.getJSON(r.request,n);else{if("string"!=typeof r.data)return n(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`));try{return n(null,JSON.parse(r.data))}catch(o){return n(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(i,r){try{r(null,this._geoJSONIndex.getClusterExpansionZoom(i.clusterId))}catch(n){r(n)}}getClusterChildren(i,r){try{r(null,this._geoJSONIndex.getChildren(i.clusterId))}catch(n){r(n)}}getClusterLeaves(i,r){try{r(null,this._geoJSONIndex.getLeaves(i.clusterId,i.limit,i.offset))}catch(n){r(n)}}}class el{constructor(r){this.self=r,this.actor=new i.Actor(r,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=i.getProjection({name:"mercator"}),this.workerSourceTypes={vector:i.VectorTileWorkerSource,geojson:ea},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(i,r)=>{if(this.workerSourceTypes[i])throw Error(`Worker source with name "${i}" already registered.`);this.workerSourceTypes[i]=r},this.self.registerRTLTextPlugin=r=>{if(i.plugin.isParsed())throw Error("RTL text plugin already registered.");i.plugin.applyArabicShaping=r.applyArabicShaping,i.plugin.processBidirectionalText=r.processBidirectionalText,i.plugin.processStyledBidirectionalText=r.processStyledBidirectionalText}}clearCaches(i,r,n){delete this.layerIndexes[i],delete this.availableImages[i],delete this.workerSources[i],delete this.demWorkerSources[i],n()}checkIfReady(i,r,n){n()}setReferrer(i,r){this.referrer=r}spriteLoaded(r,n){for(const o in this.isSpriteLoaded[r]=n,this.workerSources[r]){const s=this.workerSources[r][o];for(const a in s)s[a]instanceof i.VectorTileWorkerSource&&(s[a].isSpriteLoaded=n,s[a].fire(new i.Event("isSpriteLoaded")))}}setImages(i,r,n){for(const o in this.availableImages[i]=r,this.workerSources[i]){const s=this.workerSources[i][o];for(const a in s)s[a].availableImages=r}n()}enableTerrain(i,r,n){this.terrain=r,n()}setProjection(r,n){this.projections[r]=i.getProjection(n)}setLayers(i,r,n){this.getLayerIndex(i).replace(r),n()}updateLayers(i,r,n){this.getLayerIndex(i).update(r.layers,r.removedIds),n()}loadTile(r,n,o){const s=this.enableTerrain?i.extend({enableTerrain:this.terrain},n):n;s.projection=this.projections[r]||this.defaultProjection,this.getWorkerSource(r,n.type,n.source).loadTile(s,o)}loadDEMTile(r,n,o){const s=this.enableTerrain?i.extend({buildQuadTree:this.terrain},n):n;this.getDEMWorkerSource(r,n.source).loadTile(s,o)}reloadTile(r,n,o){const s=this.enableTerrain?i.extend({enableTerrain:this.terrain},n):n;s.projection=this.projections[r]||this.defaultProjection,this.getWorkerSource(r,n.type,n.source).reloadTile(s,o)}abortTile(i,r,n){this.getWorkerSource(i,r.type,r.source).abortTile(r,n)}removeTile(i,r,n){this.getWorkerSource(i,r.type,r.source).removeTile(r,n)}removeSource(i,r,n){if(!this.workerSources[i]||!this.workerSources[i][r.type]||!this.workerSources[i][r.type][r.source])return;const o=this.workerSources[i][r.type][r.source];delete this.workerSources[i][r.type][r.source],void 0!==o.removeSource?o.removeSource(r,n):n()}loadWorkerSource(i,r,n){try{this.self.importScripts(r.url),n()}catch(o){n(o.toString())}}syncRTLPluginState(r,n,o){try{i.plugin.setState(n);const s=i.plugin.getPluginURL();if(i.plugin.isLoaded()&&!i.plugin.isParsed()&&null!=s){this.self.importScripts(s);const a=i.plugin.isParsed();o(a?void 0:Error(`RTL Text Plugin failed to import scripts from ${s}`),a)}}catch(l){o(l.toString())}}getAvailableImages(i){let r=this.availableImages[i];return r||(r=[]),r}getLayerIndex(i){let n=this.layerIndexes[i];return n||(n=this.layerIndexes[i]=new r),n}getWorkerSource(i,r,n){return this.workerSources[i]||(this.workerSources[i]={}),this.workerSources[i][r]||(this.workerSources[i][r]={}),this.workerSources[i][r][n]||(this.workerSources[i][r][n]=new this.workerSourceTypes[r]({send:(r,n,o,s,a,l)=>{this.actor.send(r,n,o,i,a,l)},scheduler:this.actor.scheduler},this.getLayerIndex(i),this.getAvailableImages(i),this.isSpriteLoaded[i])),this.workerSources[i][r][n]}getDEMWorkerSource(i,r){return this.demWorkerSources[i]||(this.demWorkerSources[i]={}),this.demWorkerSources[i][r]||(this.demWorkerSources[i][r]=new o),this.demWorkerSources[i][r]}enforceCacheSizeLimit(r,n){i.enforceCacheSizeLimit(n)}getWorkerPerformanceMetrics(i,r,n){n(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new el(self)),el}),s(["./shared"],function(i){let r,n,o,s;function a(i){var r;return"undefined"!=typeof window&&"undefined"!=typeof document&&!!Array.prototype&&!!Array.prototype.every&&!!Array.prototype.filter&&!!Array.prototype.forEach&&!!Array.prototype.indexOf&&!!Array.prototype.lastIndexOf&&!!Array.prototype.map&&!!Array.prototype.some&&!!Array.prototype.reduce&&!!Array.prototype.reduceRight&&!!Array.isArray&&!!Function.prototype&&!!Function.prototype.bind&&!!Object.keys&&!!Object.create&&!!Object.getPrototypeOf&&!!Object.getOwnPropertyNames&&!!Object.isSealed&&!!Object.isFrozen&&!!Object.isExtensible&&!!Object.getOwnPropertyDescriptor&&!!Object.defineProperty&&!!Object.defineProperties&&!!Object.seal&&!!Object.freeze&&!!Object.preventExtensions&&!!("JSON"in window&&"parse"in JSON&&"stringify"in JSON)&&!!function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var i,r,n=new Blob([""],{type:"text/javascript"}),o=URL.createObjectURL(n);try{r=new Worker(o),i=!0}catch(s){i=!1}return r&&r.terminate(),URL.revokeObjectURL(o),i}()&&"Uint8ClampedArray"in window&&!!ArrayBuffer.isView&&!!function(){var i=document.createElement("canvas");i.width=i.height=1;var r=i.getContext("2d");if(!r)return!1;var n=r.getImageData(0,0,1,1);return n&&n.width===i.width}()&&(void 0===l[r=i&&i.failIfMajorPerformanceCaveat]&&(l[r]=function(i){var r,n,o,s=(r=document.createElement("canvas"),(n=Object.create(a.webGLContextAttributes)).failIfMajorPerformanceCaveat=i,r.getContext("webgl",n)||r.getContext("experimental-webgl",n));if(!s)return!1;try{o=s.createShader(s.VERTEX_SHADER)}catch(l){return!1}return!(!o||s.isContextLost())&&(s.shaderSource(o,"void main() {}"),s.compileShader(o),!0===s.getShaderParameter(o,s.COMPILE_STATUS))}(r)),!!l[r]&&!document.documentMode)}var l={};function c(i,r){var n=r[0],o=r[1],s=r[2],a=r[3],l=n*a-s*o;return l?(i[0]=a*(l=1/l),i[1]=-o*l,i[2]=-s*l,i[3]=n*l,i):null}function h(i,r){if(Array.isArray(i)){if(!Array.isArray(r)||i.length!==r.length)return!1;for(let n=0;n{i.window.removeEventListener("click",f,!0)},0)},u.mousePos=function(i,r){const n=i.getBoundingClientRect();return m(i,n,r)},u.touchPos=function(i,r){const n=i.getBoundingClientRect(),o=[];for(let s=0;s=0?0:r.button};class _ extends i.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new i.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(i){if(this.loaded!==i&&(this.loaded=i,i)){for(const{ids:r,callback:n}of this.requestors)this._notify(r,n);this.requestors=[]}}getImage(i){return this.images[i]}addImage(i,r){this._validate(i,r)&&(this.images[i]=r)}_validate(r,n){let o=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new i.ErrorEvent(Error(`Image "${r}" has invalid "stretchX" value`))),o=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new i.ErrorEvent(Error(`Image "${r}" has invalid "stretchY" value`))),o=!1),this._validateContent(n.content,n)||(this.fire(new i.ErrorEvent(Error(`Image "${r}" has invalid "content" value`))),o=!1),o}_validateStretch(i,r){if(!i)return!0;let n=0;for(const o of i){if(o[0]{this.ready=!0})}broadcast(r,n,o){i.asyncAll(this.actors,(i,o)=>{i.send(r,n,o)},o=o||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(i=>{i.remove()}),this.actors=[],this.workerPool.release(this.id)}}function C(r,n,o){return n*(i.EXTENT/(r.tileSize*Math.pow(2,o-r.tileID.overscaledZ)))}A.Actor=i.Actor;class z{constructor(i,r,n){this.context=i;const o=i.gl;this.buffer=o.createBuffer(),this.dynamicDraw=Boolean(n),this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete r.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){const r=this.context.gl;this.context.unbindVAO(),this.bind(),r.bufferSubData(r.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const k={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class P{constructor(i,r,n,o){this.length=r.length,this.attributes=n,this.itemSize=r.bytesPerElement,this.dynamicDraw=o,this.context=i;const s=i.gl;this.buffer=s.createBuffer(),i.bindVertexBuffer.set(this.buffer),s.bufferData(s.ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||delete r.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){const r=this.context.gl;this.bind(),r.bufferSubData(r.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,r){for(let n=0;no.pointCoordinate3D(i)),this.cameraGeometry=this.bufferedCameraGeometry(0)}static createFromScreenPoints(r,n){let o,s;if(r instanceof i.pointGeometry||"number"==typeof r[0]){const a=i.pointGeometry.convert(r);o=[i.pointGeometry.convert(r)],s=n.isPointAboveHorizon(a)}else{const l=i.pointGeometry.convert(r[0]),c=i.pointGeometry.convert(r[1]);o=[l,c],s=i.polygonizeBounds(l,c).every(i=>n.isPointAboveHorizon(i))}return new eg(o,n.getCameraPoint(),s,n)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(r){return i.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],r)}bufferedCameraGeometry(r){const n=this.screenBounds[0],o=1===this.screenBounds.length?this.screenBounds[0].add(new i.pointGeometry(1,1)):this.screenBounds[1],s=i.polygonizeBounds(n,o,0,!1);return this.cameraPoint.y>o.y&&(this.cameraPoint.x>n.x&&this.cameraPoint.x=o.x?s[2]=this.cameraPoint:this.cameraPoint.x<=n.x&&(s[3]=this.cameraPoint)),i.bufferConvexPolygon(s,r)}containsTile(r,n,o){var s;const a=r.queryPadding+1,l=r.tileID.wrap,c=o?this._bufferedCameraMercator(a,n).map(n=>i.getTilePoint(r.tileTransform,n,l)):this._bufferedScreenMercator(a,n).map(n=>i.getTilePoint(r.tileTransform,n,l)),h=this.screenGeometryMercator.map(n=>i.getTileVec3(r.tileTransform,n,l)),u=h.map(r=>new i.pointGeometry(r[0],r[1])),d=n.getFreeCameraOptions().position||new i.MercatorCoordinate(0,0,0),p=i.getTileVec3(r.tileTransform,d,l),f=h.map(r=>{const n=i.sub(r,r,p);return i.normalize(n,n),new i.Ray(p,n)}),m=C(r,1,n.zoom);if(i.polygonIntersectsBox(c,0,0,i.EXTENT,i.EXTENT))return{queryGeometry:this,tilespaceGeometry:u,tilespaceRays:f,bufferedTilespaceGeometry:c,bufferedTilespaceBounds:((s=i.getBounds(c)).min.x=i.clamp(s.min.x,0,i.EXTENT),s.min.y=i.clamp(s.min.y,0,i.EXTENT),s.max.x=i.clamp(s.max.x,0,i.EXTENT),s.max.y=i.clamp(s.max.y,0,i.EXTENT),s),tile:r,tileID:r.tileID,pixelToTileUnitsFactor:m}}_bufferedScreenMercator(i,r){const n=100*i|0;if(this._screenRaycastCache[n])return this._screenRaycastCache[n];{const o=this.bufferedScreenGeometry(i).map(i=>r.pointCoordinate3D(i));return this._screenRaycastCache[n]=o,o}}_bufferedCameraMercator(i,r){const n=100*i|0;if(this._cameraRaycastCache[n])return this._cameraRaycastCache[n];{const o=this.bufferedCameraGeometry(i).map(i=>r.pointCoordinate3D(i));return this._cameraRaycastCache[n]=o,o}}}function ey(r,n,o){const s=function(s,a){if(s)return o(s);if(a){const l=i.pick(i.extend(a,r),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);a.vector_layers&&(l.vectorLayers=a.vector_layers,l.vectorLayerIds=l.vectorLayers.map(i=>i.id)),l.tiles=n.canonicalizeTileset(l,r.url),o(null,l)}};return r.url?i.getJSON(n.transformRequest(n.normalizeSourceURL(r.url),i.ResourceType.Source),s):i.exported.frame(()=>s(null,r))}class ex{constructor(r,n,o){this.bounds=i.LngLatBounds.convert(this.validateBounds(r)),this.minzoom=n||0,this.maxzoom=o||24}validateBounds(i){return Array.isArray(i)&&4===i.length?[Math.max(-180,i[0]),Math.max(-90,i[1]),Math.min(180,i[2]),Math.min(90,i[3])]:[-180,-90,180,90]}contains(r){const n=Math.pow(2,r.z),o=Math.floor(i.mercatorXfromLng(this.bounds.getWest())*n),s=Math.floor(i.mercatorYfromLat(this.bounds.getNorth())*n),a=Math.ceil(i.mercatorXfromLng(this.bounds.getEast())*n),l=Math.ceil(i.mercatorYfromLat(this.bounds.getSouth())*n);return r.x>=o&&r.x=s&&r.y{this._tileJSONRequest=null,this._loaded=!0,r?this.fire(new i.ErrorEvent(r)):n&&(i.extend(this,n),n.bounds&&(this.tileBounds=new ex(n.bounds,this.minzoom,this.maxzoom)),i.postTurnstileEvent(n.tiles),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(i){this.map=i,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return i.extend({},this._options)}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}loadTile(r,n){const o=i.exported.devicePixelRatio>=2,s=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),o,this.tileSize);r.request=i.getImage(this.map._requestManager.transformRequest(s,i.ResourceType.Tile),(o,s,a,l)=>{if(delete r.request,r.aborted)r.state="unloaded",n(null);else if(o)r.state="errored",n(o);else if(s){this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:a,expires:l});const c=this.map.painter.context,h=c.gl;r.texture=this.map.painter.getTileTexture(s.width),r.texture?r.texture.update(s,{useMipmap:!0}):(r.texture=new i.Texture(c,s,h.RGBA,{useMipmap:!0}),r.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE),c.extTextureFilterAnisotropic&&h.texParameterf(h.TEXTURE_2D,c.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,c.extTextureFilterAnisotropicMax)),r.state="loaded",i.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(i,r){i.request&&(i.request.cancel(),delete i.request),r()}unloadTile(i,r){i.texture&&this.map.painter.saveTileTexture(i.texture),r()}hasTransition(){return!1}}function eb(r,n,o,s,a,l,c,h){const u=[r,o,a,n,s,l,1,1,1],d=[c,h,1],p=i.adjoint([],u),[f,m,_]=i.transformMat3(d,d,i.transpose(p,p));return i.multiply(u,[f,0,0,0,m,0,0,0,_],u)}class ew extends i.Evented{constructor(i,r,n,o){super(),this.id=i,this.dispatcher=n,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=r}load(r,n){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this.url=this.options.url,i.getImage(this.map._requestManager.transformRequest(this.url,i.ResourceType.Image),(o,s)=>{this._loaded=!0,o?this.fire(new i.ErrorEvent(o)):s&&(this.image=i.exported.getImageData(s),this.width=this.image.width,this.height=this.image.height,r&&(this.coordinates=r),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(i){return this.image&&i.url&&(this.options.url=i.url,this.load(i.coordinates,()=>{this.texture=null})),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(i){this.map=i,this.load()}setCoordinates(r){this.coordinates=r,delete this._boundsArray;const n=r.map(i.MercatorCoordinate.fromLngLat);return this.tileID=function(r){let n=1/0,o=1/0,s=-1/0,a=-1/0;for(const l of r)n=Math.min(n,l.x),o=Math.min(o,l.y),s=Math.max(s,l.x),a=Math.max(a,l.y);const c=Math.max(s-n,a-o),h=Math.max(0,Math.floor(-Math.log(c)/Math.LN2)),u=Math.pow(2,h);return new i.CanonicalTileID(h,Math.floor((n+s)/2*u),Math.floor((o+a)/2*u))}(n),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){delete this._boundsArray}_makeBoundsArray(){const r=i.tileTransform(this.tileID,this.map.transform.projection),[n,o,s,a]=this.coordinates.map(n=>{const o=r.projection.project(n[0],n[1]);return i.getTilePoint(r,o)._round()});return this.perspectiveTransform=function(r,n,o,s,a,l,c,h,u,d){const p=eb(0,0,r,0,0,n,r,n),f=eb(o,s,a,l,c,h,u,d);return i.multiply(f,i.adjoint(p,p),f),[f[6]/f[8]*r/i.EXTENT,f[7]/f[8]*n/i.EXTENT]}(this.width,this.height,n.x,n.y,o.x,o.y,a.x,a.y,s.x,s.y),this._boundsArray=new i.StructArrayLayout4i8,this._boundsArray.emplaceBack(n.x,n.y,0,0),this._boundsArray.emplaceBack(o.x,o.y,i.EXTENT,0),this._boundsArray.emplaceBack(a.x,a.y,0,i.EXTENT),this._boundsArray.emplaceBack(s.x,s.y,i.EXTENT,i.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const r=this.map.painter.context,n=r.gl;for(const o in this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,i.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new i.Texture(r,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this.tiles){const s=this.tiles[o];"loaded"!==s.state&&(s.state="loaded",s.texture=this.texture)}}loadTile(i,r){this.tileID&&this.tileID.equals(i.tileID.canonical)?(this.tiles[String(i.tileID.wrap)]=i,i.buckets={},r(null)):(i.state="errored",r(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const eT={vector:class extends i.Evented{constructor(r,n,o,s){if(super(),this.id=r,this.dispatcher=o,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,i.extend(this,i.pick(n,["url","scheme","tileSize","promoteId"])),this._options=i.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(s),this._tileWorkers={},this._deduped=new i.DedupedRequest}load(){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=ey(this._options,this.map._requestManager,(r,n)=>{this._tileJSONRequest=null,this._loaded=!0,r?this.fire(new i.ErrorEvent(r)):n&&(i.extend(this,n),n.bounds&&(this.tileBounds=new ex(n.bounds,this.minzoom,this.maxzoom)),i.postTurnstileEvent(n.tiles,this.map._requestManager._customAccessToken),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}onAdd(i){this.map=i,this.load()}setSourceProperty(i){this._tileJSONRequest&&this._tileJSONRequest.cancel(),i();const r=this.map.style._getSourceCaches(this.id);for(const n of r)n.clearTiles();this.load()}setTiles(i){return this.setSourceProperty(()=>{this._options.tiles=i}),this}setUrl(i){return this.setSourceProperty(()=>{this.url=i,this._options.url=i}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return i.extend({},this._options)}loadTile(r,n){const o=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme)),s={request:this.map._requestManager.transformRequest(o,i.ResourceType.Tile),data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:i.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:r.isSymbolTile};if(s.request.collectResourceTiming=this._collectResourceTiming,r.actor&&"expired"!==r.state)"loading"===r.state?r.reloadCallback=n:r.request=r.actor.send("reloadTile",s,l.bind(this));else if(r.actor=this._tileWorkers[o]=this._tileWorkers[o]||this.dispatcher.getActor(),this.dispatcher.ready)r.request=r.actor.send("loadTile",s,l.bind(this),void 0,!0);else{const a=i.loadVectorTile.call({deduped:this._deduped},s,(i,n)=>{i||!n?l.call(this,i):(s.data={cacheControl:n.cacheControl,expires:n.expires,rawData:n.rawData.slice(0)},r.actor&&r.actor.send("loadTile",s,l.bind(this),void 0,!0))},!0);r.request={cancel:a}}function l(o,s){return delete r.request,r.aborted?n(null):o&&404!==o.status?n(o):(s&&s.resourceTiming&&(r.resourceTiming=s.resourceTiming),this.map._refreshExpiredTiles&&s&&r.setExpiryData(s),r.loadVectorData(s,this.map.painter),i.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(r.reloadCallback&&(this.loadTile(r,r.reloadCallback),r.reloadCallback=null)))}}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.actor&&i.actor.send("abortTile",{uid:i.uid,type:this.type,source:this.id})}unloadTile(i){i.unloadVectorData(),i.actor&&i.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}},raster:ev,"raster-dem":class extends ev{constructor(r,n,o,s){super(r,n,o,s),this.type="raster-dem",this.maxzoom=22,this._options=i.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}loadTile(r,o){const s=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function a(i,n){i&&(r.state="errored",o(i)),n&&(r.dem=n,r.dem.onDeserialize(),r.needsHillshadePrepare=!0,r.needsDEMTextureUpload=!0,r.state="loaded",o(null))}r.request=i.getImage(this.map._requestManager.transformRequest(s,i.ResourceType.Tile),(function(s,l,c,h){if(delete r.request,r.aborted)r.state="unloaded",o(null);else if(s)r.state="errored",o(s);else if(l){this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:c,expires:h});const u=i.window.ImageBitmap&&l instanceof i.window.ImageBitmap&&(null==n&&(n=i.window.OffscreenCanvas&&new i.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof i.window.createImageBitmap),n),d=1-(l.width-i.prevPowerOfTwo(l.width))/2;d<1||r.neighboringTiles||(r.neighboringTiles=this._getNeighboringTiles(r.tileID));const p=u?l:i.exported.getImageData(l,d),f={uid:r.uid,coord:r.tileID,source:this.id,rawImageData:p,encoding:this.encoding,padding:d};r.actor&&"expired"!==r.state||(r.actor=this.dispatcher.getActor(),r.actor.send("loadDEMTile",f,a.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(r){const n=r.canonical,o=Math.pow(2,n.z),s=(n.x-1+o)%o,a=0===n.x?r.wrap-1:r.wrap,l=(n.x+1+o)%o,c=n.x+1===o?r.wrap+1:r.wrap,h={};return h[new i.OverscaledTileID(r.overscaledZ,a,n.z,s,n.y).key]={backfilled:!1},h[new i.OverscaledTileID(r.overscaledZ,c,n.z,l,n.y).key]={backfilled:!1},n.y>0&&(h[new i.OverscaledTileID(r.overscaledZ,a,n.z,s,n.y-1).key]={backfilled:!1},h[new i.OverscaledTileID(r.overscaledZ,r.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},h[new i.OverscaledTileID(r.overscaledZ,c,n.z,l,n.y-1).key]={backfilled:!1}),n.y+1{if(this._loaded=!0,this._pendingLoad=null,r)this.fire(new i.ErrorEvent(r));else{const o={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&n&&n.resourceTiming&&n.resourceTiming[this.id]&&(o.resourceTiming=n.resourceTiming[this.id]),this.fire(new i.Event("data",o)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(r,n){const o=r.actor?"reloadTile":"loadTile";r.actor=this.actor,r.request=this.actor.send(o,{type:this.type,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:i.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(i,s)=>(delete r.request,r.unloadVectorData(),r.aborted?n(null):i?n(i):(r.loadVectorData(s,this.map.painter,"reloadTile"===o),n(null))),void 0,"loadTile"===o)}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.aborted=!0}unloadTile(i){i.unloadVectorData(),this.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return i.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends ew{constructor(i,r,n,o){super(i,r,n,o),this.roundZoom=!0,this.type="video",this.options=r}load(){this._loaded=!1;const r=this.options;for(const n of(this.urls=[],r.urls))this.urls.push(this.map._requestManager.transformRequest(n,i.ResourceType.Source).url);i.getVideo(this.urls,(r,n)=>{this._loaded=!0,r?this.fire(new i.ErrorEvent(r)):n&&(this.video=n,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(r){if(this.video){const n=this.video.seekable;rn.end(0)?this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=r}}getVideo(){return this.video}onAdd(i){this.map||(this.map=i,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const r=this.map.painter.context,n=r.gl;for(const o in this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new i.Texture(r,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,i.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.tiles){const s=this.tiles[o];"loaded"!==s.state&&(s.state="loaded",s.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:ew,canvas:class extends ew{constructor(r,n,o,s){super(r,n,o,s),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some(i=>!Array.isArray(i)||2!==i.length||i.some(i=>"number"!=typeof i))||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof i.window.HTMLCanvasElement||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof i.window.HTMLCanvasElement?this.options.canvas:i.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new i.ErrorEvent(Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(i){this.map=i,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let r=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,r=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,r=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;const n=this.map.painter.context,o=n.gl;for(const s in this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,i.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(r||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new i.Texture(n,this.canvas,o.RGBA,{premultiply:!0}),this.tiles){const a=this.tiles[s];"loaded"!==a.state&&(a.state="loaded",a.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const i of[this.canvas.width,this.canvas.height])if(isNaN(i)||i<=0)return!0;return!1}}},eE=function(r,n,o,s){const a=new eT[n.type](r,n,o,s);if(a.id!==r)throw Error(`Expected Source id to be ${r} instead of ${a.id}`);return i.bindAll(["load","abort","unload","serialize","prepare"],a),a};function eS(i,r){const n=i.tileID,o=r.tileID;return n.overscaledZ-o.overscaledZ||n.canonical.y-o.canonical.y||n.wrap-o.wrap||n.canonical.x-o.canonical.x}function eI(){return null!=r$.workerClass?new r$.workerClass:new i.window.Worker(r$.workerUrl)}const eM="mapboxgl_preloaded_worker_pool";class eA{constructor(){this.active={}}acquire(i){if(!this.workers)for(this.workers=[];this.workers.length{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[eM]}numActive(){return Object.keys(this.active).length}}function eC(){return o||(o=new eA),o}function ez(r){r=r.slice();const n=Object.create(null);for(let o=0;o{i in n&&(o[i]=n[i])}),o}(r[s],n[r[s].ref]));return r}eA.workerCount=2;const ek={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setProjection:"setProjection"};function eP(i,r,n){n.push({command:ek.addSource,args:[i,r[i]]})}function eD(i,r,n){r.push({command:ek.removeSource,args:[i]}),n[i]=!0}function eL(i,r,n,o,s,a){let l;for(l in r=r||{},i=i||{})i.hasOwnProperty(l)&&(h(i[l],r[l])||n.push({command:a,args:[o,l,r[l],s]}));for(l in r)r.hasOwnProperty(l)&&!i.hasOwnProperty(l)&&(h(i[l],r[l])||n.push({command:a,args:[o,l,r[l],s]}))}function eB(i){return i.id}function eR(i,r){return i[r.id]=r,i}class eF{constructor(i,r){this.reset(i,r)}reset(i,r){this.points=i||[],this._distances=[0];for(let n=1;n0?(s-l)/c:0;return this.points[a].mult(1-h).add(this.points[n].mult(h))}}class eO{constructor(i,r,n){const o=this.boxCells=[],s=this.circleCells=[];this.xCellCount=Math.ceil(i/n),this.yCellCount=Math.ceil(r/n);for(let a=0;athis.width||o<0||r>this.height)return!s&&[];const l=[];if(i<=0&&r<=0&&this.width<=n&&this.height<=o){if(s)return!0;for(let c=0;c0:l}_queryCircle(i,r,n,o,s){const a=i-n,l=i+n,c=r-n,h=r+n;if(l<0||a>this.width||h<0||c>this.height)return!o&&[];const u=[];return this._forEachCell(a,c,l,h,this._queryCellCircle,u,{hitTest:o,circle:{x:i,y:r,radius:n},seenUids:{box:{},circle:{}}},s),o?u.length>0:u}query(i,r,n,o,s){return this._query(i,r,n,o,!1,s)}hitTest(i,r,n,o,s){return this._query(i,r,n,o,!0,s)}hitTestCircle(i,r,n,o){return this._queryCircle(i,r,n,!0,o)}_queryCell(i,r,n,o,s,a,l,c){const h=l.seenUids,u=this.boxCells[s];if(null!==u){const d=this.bboxes;for(const p of u)if(!h.box[p]){h.box[p]=!0;const f=4*p;if(i<=d[f+2]&&r<=d[f+3]&&n>=d[f+0]&&o>=d[f+1]&&(!c||c(this.boxKeys[p]))){if(l.hitTest)return a.push(!0),!0;a.push({key:this.boxKeys[p],x1:d[f],y1:d[f+1],x2:d[f+2],y2:d[f+3]})}}}const m=this.circleCells[s];if(null!==m){const _=this.circles;for(const g of m)if(!h.circle[g]){h.circle[g]=!0;const y=3*g;if(this._circleAndRectCollide(_[y],_[y+1],_[y+2],i,r,n,o)&&(!c||c(this.circleKeys[g]))){if(l.hitTest)return a.push(!0),!0;{const x=_[y],v=_[y+1],b=_[y+2];a.push({key:this.circleKeys[g],x1:x-b,y1:v-b,x2:x+b,y2:v+b})}}}}}_queryCellCircle(i,r,n,o,s,a,l,c){const h=l.circle,u=l.seenUids,d=this.boxCells[s];if(null!==d){const p=this.bboxes;for(const f of d)if(!u.box[f]){u.box[f]=!0;const m=4*f;if(this._circleAndRectCollide(h.x,h.y,h.radius,p[m+0],p[m+1],p[m+2],p[m+3])&&(!c||c(this.boxKeys[f])))return a.push(!0),!0}}const _=this.circleCells[s];if(null!==_){const g=this.circles;for(const y of _)if(!u.circle[y]){u.circle[y]=!0;const x=3*y;if(this._circlesCollide(g[x],g[x+1],g[x+2],h.x,h.y,h.radius)&&(!c||c(this.circleKeys[y])))return a.push(!0),!0}}}_forEachCell(i,r,n,o,s,a,l,c){const h=this._convertToXCellCoord(i),u=this._convertToYCellCoord(r),d=this._convertToXCellCoord(n),p=this._convertToYCellCoord(o);for(let f=h;f<=d;f++)for(let m=u;m<=p;m++)if(s.call(this,i,r,n,o,this.xCellCount*m+f,a,l,c))return}_convertToXCellCoord(i){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(i*this.xScale)))}_convertToYCellCoord(i){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(i*this.yScale)))}_circlesCollide(i,r,n,o,s,a){const l=o-i,c=s-r,h=n+a;return h*h>l*l+c*c}_circleAndRectCollide(i,r,n,o,s,a,l){const c=(a-o)/2,h=Math.abs(i-(o+c));if(h>c+n)return!1;const u=(l-s)/2,d=Math.abs(r-(s+u));if(d>u+n)return!1;if(h<=c||d<=u)return!0;const p=h-c,f=d-u;return p*p+f*f<=n*n}}const eU=Math.tan(85*Math.PI/180);function eV(r,n,o,s,a,l){let h=i.create();if(o){if("globe"===a.projection.name)h=i.calculateGlobeMatrix(a,a.worldSize/a._projectionScaler,[0,0]),i.multiply$1(h,h,i.globeDenormalizeECEF(i.globeTileBounds(n)));else{const u=c([],l);h[0]=u[0],h[1]=u[1],h[4]=u[2],h[5]=u[3]}s||i.rotateZ(h,h,a.angle)}else i.multiply$1(h,a.labelPlaneMatrix,r);return h}function eN(r,n,o,s,a,l){if(o){if("globe"===a.projection.name){const c=eV(r,n,o,s,a,l);return i.invert(c,c),i.multiply$1(c,r,c),c}{const h=i.clone(r),u=i.identity([]);return u[0]=l[0],u[1]=l[1],u[4]=l[2],u[5]=l[3],i.multiply$1(h,h,u),s||i.rotateZ(h,h,-a.angle),h}}return a.glCoordMatrix}function ej(r,n,o=0){const s=[r.x,r.y,o,1];o?i.transformMat4$1(s,s,n):eJ(s,s,n);const a=s[3];return{point:new i.pointGeometry(s[0]/a,s[1]/a),signedDistanceFromCamera:a}}function eG(i,r){return Math.min(.5+i/r*.5,1.5)}function eZ(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_){const g=c.glyphStartIndex+c.numGlyphs,y=c.lineStartIndex,x=c.lineStartIndex+c.lineLength,v=r.getoffsetX(c.glyphStartIndex),b=r.getoffsetX(g-1),w=eH(i*v,n,o,s,a,l,c.segment,y,x,h,u,d,p,f,!0,m,_);if(!w)return null;const T=eH(i*b,n,o,s,a,l,c.segment,y,x,h,u,d,p,f,!0,m,_);return T?{first:w,last:T}:null}function e$(r,n,o,s){return r.writingMode===i.WritingMode.horizontal&&Math.abs(o.y-n.y)>Math.abs(o.x-n.x)*s?{useVertical:!0}:r.writingMode===i.WritingMode.vertical?n.yeU}(n,o,s)?1===r.flipState?{needsFlipping:!0}:null:n.x>o.x?{needsFlipping:!0}:null}function eq(r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x){let v;const b=n/24,w=r.lineOffsetX*b,T=r.lineOffsetY*b;if(r.numGlyphs>1){const E=r.glyphStartIndex+r.numGlyphs,S=r.lineStartIndex,I=r.lineStartIndex+r.lineLength,M=eZ(b,h,w,T,o,p,f,r,u,l,m,g,!1,y,x);if(!M)return{notEnoughRoom:!0};const A=ej(M.first.point,c).point,C=ej(M.last.point,c).point;if(s&&!o){const z=e$(r,A,C,_);if(r.flipState=z&&z.needsFlipping?1:2,z)return z}v=[M.first];for(let k=r.glyphStartIndex+1;k0?B.point:eW(f,L,P,1,a,void 0,y,x.canonical),_);if(r.flipState=R&&R.needsFlipping?1:2,R)return R}const F=eH(b*h.getoffsetX(r.glyphStartIndex),w,T,o,p,f,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,u,l,m,g,!1,!1,y,x);if(!F)return{notEnoughRoom:!0};v=[F]}for(const O of v)i.addDynamicAttributes(d,O.point,O.angle);return{}}function eX(r,n,o,s,a){const l=s.projectTilePoint(r.x,r.y,n);if(!a)return ej(l,o,l.z);const c=a(r);return ej(new i.pointGeometry(l.x+c[0],l.y+c[1]),o,l.z+c[2])}function eW(i,r,n,o,s,a,l,c){const h=eX(i.add(i.sub(r)._unit()),c,s,l,a).point,u=n.sub(h);return n.add(u._mult(o/u.mag()))}function eH(r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x){const v=s?r-n:r+n;let b=v>0?1:-1,w=0;s&&(b*=-1,w=Math.PI),b<0&&(w+=Math.PI);let T=b>0?h+c:h+c+1,E=a,S=a,I=0,M=0;const A=Math.abs(v),C=[],z=[];let k=l;const P=()=>{const r=T-b;return 0===I?l:new i.pointGeometry(d.getx(r),d.gety(r))},D=()=>eW(P(),k,S,A-I+1,p,m,y,x.canonical);for(;I+M<=A;){if((T+=b)=u)return null;if(S=E,C.push(E),_&&z.push(k||P()),void 0===(E=f[T])){k=new i.pointGeometry(d.getx(T),d.gety(T));const L=eX(k,x.canonical,p,y,m);E=L.signedDistanceFromCamera>0?f[T]=L.point:D()}else k=null;I+=M,M=S.dist(E)}g&&m&&(k=k||new i.pointGeometry(d.getx(T),d.gety(T)),f[T]=E=void 0===f[T]?E:D(),M=S.dist(E));const B=(A-I)/M,R=E.sub(S),F=R.mult(B)._add(S);o&&F._add(R._unit()._perp()._mult(o*b));const O=w+Math.atan2(E.y-S.y,E.x-S.x);return C.push(F),_&&(k=k||new i.pointGeometry(d.getx(T),d.gety(T)),z.push(function(r,n,o){const s=1-o;return new i.pointGeometry(r.x*s+n.x*o,r.y*s+n.y*o)}(z.length>0?z[z.length-1]:k,k,B))),{point:F,angle:O,path:C,tilePath:z}}const eK=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function eY(i,r){for(let n=0;n[0,0,0],b=new i.pointGeometry(n.tileAnchorX,n.tileAnchorY),w=this.transform.projection.projectTilePoint(n.tileAnchorX,n.tileAnchorY,_.canonical),T=v(b),E=[w.x+T[0],w.y+T[1],w.z+T[2]],S=this.projectAndGetPerspectiveRatio(l,E[0],E[1],E[2],_),{perspectiveRatio:I}=S,M=(d?a/I:a*I)/i.ONE_EM,A=ej(new i.pointGeometry(E[0],E[1]),c,E[2]).point,C=S.signedDistanceFromCamera>0?eZ(M,s,n.lineOffsetX*M,n.lineOffsetY*M,!1,A,b,n,o,c,{},y&&!d?v:null,d&&!!y,this.transform.projection,_):null;let z=!1,k=!1,P=!0;if(C&&!S.aboveHorizon){const D=.5*f*I+m,L=new i.pointGeometry(-100,-100),B=new i.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),R=new eF,F=C.first,O=C.last;let U=[];for(let V=F.path.length-1;V>=1;V--)U.push(F.path[V]);for(let N=1;N{const n=v(rej(i,h));U=G.some(i=>i.signedDistanceFromCamera<=0)?[]:G.map(i=>i.point)}let Z=[];if(U.length>0){const $=U[0].clone(),q=U[0].clone();for(let X=1;X=L.x&&q.x<=B.x&&$.y>=L.y&&q.y<=B.y?[U]:q.xB.x||q.yB.y?[]:i.clipLine([U],L.x,L.y,B.x,B.y)}for(const W of Z){R.reset(W,.25*D);let H=0;H=R.length<=.5*D?1:Math.ceil(R.paddedLength/j)+1;for(let K=0;K0){i.transformMat4$1(l,l,r);let h=!1;this.fogState&&a&&(h=function(r,n,o,s,a,l){const c=l.calculateFogTileMatrix(a),h=[n,o,s];return i.transformMat4(h,h,c),T(r,h,l.pitch,l._fov)}(this.fogState,n,o,s||0,a.toUnwrapped(),this.transform)>.9),c=l[2]>l[3]||h}else eJ(l,l,r);return{point:new i.pointGeometry((l[0]/l[3]+1)/2*this.transform.width+100,(-l[1]/l[3]+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.cameraToCenterDistance/l[3]*.5,1.5),signedDistanceFromCamera:l[3],aboveHorizon:c}}isOffscreen(i,r,n,o){return n<100||i>=this.screenRightBoundary||o<100||r>this.screenBottomBoundary}isInsideGrid(i,r,n,o){return n>=0&&i=0&&ri.collisionGroupID===r}}return this.collisionGroups[i]}}function e6(r,n,o,s,a){const{horizontalAlign:l,verticalAlign:c}=i.getAnchorAlignment(r),h=i.evaluateVariableOffset(r,s);return new i.pointGeometry(-(l-.5)*n+h[0]*a,-(c-.5)*o+h[1]*a)}function e8(r,n,o,s,a){const l=new i.pointGeometry(r,n);return o&&l._rotate(s?a:-a),l}class e9{constructor(i,r,n,o,s){this.transform=i.clone(),this.collisionIndex=new eQ(this.transform,s),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new e4(n),this.collisionCircleArrays={},this.prevPlacement=o,o&&(o.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(r,n,o,s){const a=o.getBucket(n),l=o.latestFeatureIndex;if(!a||!l||n.id!==a.layerIds[0])return;const c=a.layers[0].layout,h=o.collisionBoxArray,u=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),d=o.tileSize/i.EXTENT,p=o.tileID.toUnwrapped(),f=this.transform.calculateProjMatrix(p),m="map"===c.get("text-pitch-alignment"),_="map"===c.get("text-rotation-alignment");n.compileFilter();const g=n.dynamicFilter(),y=n.dynamicFilterNeedsFeature(),x=this.transform.calculatePixelsToTileUnitsMatrix(o),v=eV(f,o.tileID.canonical,m,_,this.transform,x);let b=null;if(m){const w=eN(f,o.tileID.canonical,m,_,this.transform,x);b=i.multiply$1([],this.transform.labelPlaneMatrix,w)}let T=null;g&&o.latestFeatureIndex&&(T={unwrappedTileID:p,dynamicFilter:g,dynamicFilterNeedsFeature:y,featureIndex:o.latestFeatureIndex}),this.retainedQueryData[a.bucketInstanceId]=new e5(a.bucketInstanceId,l,a.sourceLayerIndex,a.index,o.tileID);const E={bucket:a,layout:c,posMatrix:f,textLabelPlaneMatrix:v,labelToScreenMatrix:b,clippingData:T,scale:u,textPixelRatio:d,holdingForFade:o.holdingForFade(),collisionBoxArray:h,partiallyEvaluatedTextSize:i.evaluateSizeForZoom(a.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:i.evaluateSizeForZoom(a.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(s)for(const S of a.sortKeyRanges){const{sortKey:I,symbolInstanceStart:M,symbolInstanceEnd:A}=S;r.push({sortKey:I,symbolInstanceStart:M,symbolInstanceEnd:A,parameters:E})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:E})}attemptAnchorPlacement(i,r,n,o,s,a,l,c,h,u,d,p,f,m,_,g,y,x){const v=[p.textOffset0,p.textOffset1],b=e6(i,n,o,v,s),w=this.collisionIndex.placeCollisionBox(s,r,e8(b.x,b.y,a,l,this.transform.angle),d,c,h,u.predicate);if((!g||0!==this.collisionIndex.placeCollisionBox(m.getSymbolInstanceIconSize(x,this.transform.zoom,f),g,e8(b.x,b.y,a,l,this.transform.angle),d,c,h,u.predicate).box.length)&&w.box.length>0){let T;return this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(T=this.prevPlacement.variableOffsets[p.crossTileID].anchor),this.variableOffsets[p.crossTileID]={textOffset:v,width:n,height:o,anchor:i,textScale:s,prevAnchor:T},this.markUsedJustification(m,i,p,_),m.allowVerticalPlacement&&(this.markUsedOrientation(m,_,p),this.placedOrientations[p.crossTileID]=_),{shift:b,placedGlyphBoxes:w}}}placeLayerBucketPart(r,n,o,s){const{bucket:a,layout:l,posMatrix:c,textLabelPlaneMatrix:h,labelToScreenMatrix:u,clippingData:d,textPixelRatio:p,holdingForFade:f,collisionBoxArray:m,partiallyEvaluatedTextSize:_,partiallyEvaluatedIconSize:g,collisionGroup:y}=r.parameters,x=l.get("text-optional"),v=l.get("icon-optional"),b=l.get("text-allow-overlap"),w=l.get("icon-allow-overlap"),T="map"===l.get("text-rotation-alignment"),E="map"===l.get("text-pitch-alignment"),S="none"!==l.get("icon-text-fit"),I="viewport-y"===l.get("symbol-z-order"),M=b&&(w||!a.hasIconData()||v),A=w&&(b||!a.hasTextData()||x);!a.collisionArrays&&m&&a.deserializeCollisionBoxes(m),o&&s&&a.updateCollisionDebugBuffers(this.transform.zoom,m);const C=(r,s,m)=>{if(d){const I={zoom:this.transform.zoom,pitch:this.transform.pitch};let C=null;if(d.dynamicFilterNeedsFeature){const z=this.retainedQueryData[a.bucketInstanceId];C=d.featureIndex.loadFeature({featureIndex:r.featureIndex,bucketIndex:z.bucketIndex,sourceLayerIndex:z.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,d.dynamicFilter)(I,C,this.retainedQueryData[a.bucketInstanceId].tileID.canonical,new i.pointGeometry(r.tileAnchorX,r.tileAnchorY),this.transform.calculateDistanceTileData(d.unwrappedTileID)))return this.placements[r.crossTileID]=new e2(!1,!1,!1,!0),void(n[r.crossTileID]=!0)}if(n[r.crossTileID])return;if(f)return void(this.placements[r.crossTileID]=new e2(!1,!1,!1));let k=!1,P=!1,D=!0,L=null,B={box:null,offscreen:null},R={box:null,offscreen:null},F=null,O=null,U=null,V=0,N=0,j=0;m.textFeatureIndex?V=m.textFeatureIndex:r.useRuntimeCollisionCircles&&(V=r.featureIndex),m.verticalTextFeatureIndex&&(N=m.verticalTextFeatureIndex);const G=i=>{i.tileID=this.retainedQueryData[a.bucketInstanceId].tileID,(this.transform.elevation||i.elevation)&&(i.elevation=this.transform.elevation?this.transform.elevation.getAtTileOffset(this.retainedQueryData[a.bucketInstanceId].tileID,i.tileAnchorX,i.tileAnchorY):0)},Z=m.textBox;if(Z){G(Z);const $=n=>{let o=i.WritingMode.horizontal;if(a.allowVerticalPlacement&&!n&&this.prevPlacement){const s=this.prevPlacement.placedOrientations[r.crossTileID];s&&(this.placedOrientations[r.crossTileID]=s,o=s,this.markUsedOrientation(a,o,r))}return o},q=(n,o)=>{if(a.allowVerticalPlacement&&r.numVerticalGlyphVertices>0&&m.verticalTextBox){for(const s of a.writingModes)if(s===i.WritingMode.vertical?R=B=o():B=n(),B&&B.box&&B.box.length)break}else B=n()};if(l.get("text-variable-anchor")){let X=l.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[r.crossTileID]){const W=this.prevPlacement.variableOffsets[r.crossTileID];X.indexOf(W.anchor)>0&&(X=X.filter(i=>i!==W.anchor)).unshift(W.anchor)}const H=(i,n,o)=>{const l=a.getSymbolInstanceTextSize(_,r,this.transform.zoom,s),h=(i.x2-i.x1)*l+2*i.padding,u=(i.y2-i.y1)*l+2*i.padding,d=S&&!w?n:null;d&&G(d);let f={box:[],offscreen:!1};const m=b?2*X.length:X.length;for(let x=0;x=X.length,r,s,a,o,d,_,g);if(v&&(f=v.placedGlyphBoxes)&&f.box&&f.box.length){k=!0,L=v.shift;break}}return f};q(()=>H(Z,m.iconBox,i.WritingMode.horizontal),()=>{const n=m.verticalTextBox;return n&&G(n),a.allowVerticalPlacement&&!(B&&B.box&&B.box.length)&&r.numVerticalGlyphVertices>0&&n?H(n,m.verticalIconBox,i.WritingMode.vertical):{box:null,offscreen:null}}),B&&(k=B.box,D=B.offscreen);const K=$(B&&B.box);if(!k&&this.prevPlacement){const Y=this.prevPlacement.variableOffsets[r.crossTileID];Y&&(this.variableOffsets[r.crossTileID]=Y,this.markUsedJustification(a,Y.anchor,r,K))}}else{const J=(n,o)=>{const l=a.getSymbolInstanceTextSize(_,r,this.transform.zoom,s),h=this.collisionIndex.placeCollisionBox(l,n,new i.pointGeometry(0,0),b,p,c,y.predicate);return h&&h.box&&h.box.length&&(this.markUsedOrientation(a,o,r),this.placedOrientations[r.crossTileID]=o),h};q(()=>J(Z,i.WritingMode.horizontal),()=>{const n=m.verticalTextBox;return a.allowVerticalPlacement&&r.numVerticalGlyphVertices>0&&n?(G(n),J(n,i.WritingMode.vertical)):{box:null,offscreen:null}}),$(B&&B.box&&B.box.length)}}if(k=(F=B)&&F.box&&F.box.length>0,D=F&&F.offscreen,r.useRuntimeCollisionCircles){const Q=a.text.placedSymbolArray.get(r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex),ee=i.evaluateSizeForFeature(a.textSizeData,_,Q),et=l.get("text-padding");O=this.collisionIndex.placeCollisionCircles(b,Q,a.lineVertexArray,a.glyphOffsetArray,ee,c,h,u,o,E,y.predicate,r.collisionCircleDiameter*ee/i.ONE_EM,et,this.retainedQueryData[a.bucketInstanceId].tileID),k=b||O.circles.length>0&&!O.collisionDetected,D=D&&O.offscreen}if(m.iconFeatureIndex&&(j=m.iconFeatureIndex),m.iconBox){const ei=r=>{G(r);const n=S&&L?e8(L.x,L.y,T,E,this.transform.angle):new i.pointGeometry(0,0),o=a.getSymbolInstanceIconSize(g,this.transform.zoom,s);return this.collisionIndex.placeCollisionBox(o,r,n,w,p,c,y.predicate)};P=R&&R.box&&R.box.length&&m.verticalIconBox?(U=ei(m.verticalIconBox)).box.length>0:(U=ei(m.iconBox)).box.length>0,D=D&&U.offscreen}const er=x||0===r.numHorizontalGlyphVertices&&0===r.numVerticalGlyphVertices,en=v||0===r.numIconVertices;if(er||en?en?er||(P=P&&k):k=P&&k:P=k=P&&k,k&&F&&F.box&&this.collisionIndex.insertCollisionBox(F.box,l.get("text-ignore-placement"),a.bucketInstanceId,R&&R.box&&N?N:V,y.ID),P&&U&&this.collisionIndex.insertCollisionBox(U.box,l.get("icon-ignore-placement"),a.bucketInstanceId,j,y.ID),O&&(k&&this.collisionIndex.insertCollisionCircles(O.circles,l.get("text-ignore-placement"),a.bucketInstanceId,V,y.ID),o)){const eo=a.bucketInstanceId;let es=this.collisionCircleArrays[eo];void 0===es&&(es=this.collisionCircleArrays[eo]=new e3);for(let ea=0;ea=0;--k){const P=z[k];C(a.symbolInstances.get(P),P,a.collisionArrays[P])}}else for(let D=r.symbolInstanceStart;D=0&&(r.text.placedSymbolArray.get(c).crossTileID=a>=0&&c!==a?0:o.crossTileID)}markUsedOrientation(r,n,o){const s=n===i.WritingMode.horizontal||n===i.WritingMode.horizontalOnly?n:0,a=n===i.WritingMode.vertical?n:0,l=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex];for(const c of l)r.text.placedSymbolArray.get(c).placedOrientation=s;o.verticalPlacedTextSymbolIndex&&(r.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(i){this.commitTime=i,this.zoomAtLastRecencyCheck=this.transform.zoom;const r=this.prevPlacement;let n=!1;this.prevZoomAdjustment=r?r.zoomAdjustment(this.transform.zoom):0;const o=r?r.symbolFadeChange(i):1,s=r?r.opacities:{},a=r?r.variableOffsets:{},l=r?r.placedOrientations:{};for(const c in this.placements){const h=this.placements[c],u=s[c];u?(this.opacities[c]=new e1(u,o,h.text,h.icon,null,h.clipped),n=n||h.text!==u.text.placed||h.icon!==u.icon.placed):(this.opacities[c]=new e1(null,o,h.text,h.icon,h.skipFade,h.clipped),n=n||h.text||h.icon)}for(const d in s){const p=s[d];if(!this.opacities[d]){const f=new e1(p,o,!1,!1);f.isHidden()||(this.opacities[d]=f,n=n||p.text.placed||p.icon.placed)}}for(const m in a)this.variableOffsets[m]||!this.opacities[m]||this.opacities[m].isHidden()||(this.variableOffsets[m]=a[m]);for(const _ in l)this.placedOrientations[_]||!this.opacities[_]||this.opacities[_].isHidden()||(this.placedOrientations[_]=l[_]);n?this.lastPlacementChangeTime=i:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=r?r.lastPlacementChangeTime:i)}updateLayerOpacities(i,r){const n={};for(const o of r){const s=o.getBucket(i);s&&o.latestFeatureIndex&&i.id===s.layerIds[0]&&this.updateBucketOpacities(s,n,o.collisionBoxArray)}}updateBucketOpacities(r,n,o){r.hasTextData()&&r.text.opacityVertexArray.clear(),r.hasIconData()&&r.icon.opacityVertexArray.clear(),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();const s=r.layers[0].layout,a=!!r.layers[0].dynamicFilter(),l=new e1(null,0,!1,!1,!0),c=s.get("text-allow-overlap"),h=s.get("icon-allow-overlap"),u=s.get("text-variable-anchor"),d="map"===s.get("text-rotation-alignment"),p="map"===s.get("text-pitch-alignment"),f="none"!==s.get("icon-text-fit"),m=new e1(null,0,c&&(h||!r.hasIconData()||s.get("icon-optional")),h&&(c||!r.hasTextData()||s.get("text-optional")),!0);!r.collisionArrays&&o&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(o);const _=(i,r,n)=>{for(let o=0;o0||b>0,S=x.numIconVertices>0,I=this.placedOrientations[x.crossTileID],M=I===i.WritingMode.vertical,A=I===i.WritingMode.horizontal||I===i.WritingMode.horizontalOnly;if(!E&&!S||T.isHidden()||g++,E){const C=te(T.text);_(r.text,v,M?tt:C),_(r.text,b,A?tt:C);const z=T.text.isHidden();[x.rightJustifiedTextSymbolIndex,x.centerJustifiedTextSymbolIndex,x.leftJustifiedTextSymbolIndex].forEach(i=>{i>=0&&(r.text.placedSymbolArray.get(i).hidden=z||M?1:0)}),x.verticalPlacedTextSymbolIndex>=0&&(r.text.placedSymbolArray.get(x.verticalPlacedTextSymbolIndex).hidden=z||A?1:0);const k=this.variableOffsets[x.crossTileID];k&&this.markUsedJustification(r,k.anchor,x,I);const P=this.placedOrientations[x.crossTileID];P&&(this.markUsedJustification(r,"left",x,P),this.markUsedOrientation(r,P,x))}if(S){const D=te(T.icon);x.placedIconSymbolIndex>=0&&(_(r.icon,x.numIconVertices,M?tt:D),r.icon.placedSymbolArray.get(x.placedIconSymbolIndex).hidden=T.icon.isHidden()),x.verticalPlacedIconSymbolIndex>=0&&(_(r.icon,x.numVerticalIconVertices,A?tt:D),r.icon.placedSymbolArray.get(x.verticalPlacedIconSymbolIndex).hidden=T.icon.isHidden())}if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){const L=r.collisionArrays[y];if(L){let B=new i.pointGeometry(0,0),R=!0;if(L.textBox||L.verticalTextBox){if(u){const F=this.variableOffsets[w];F?(B=e6(F.anchor,F.width,F.height,F.textOffset,F.textScale),d&&B._rotate(p?this.transform.angle:-this.transform.angle)):R=!1}a&&(R=!T.clipped),L.textBox&&e7(r.textCollisionBox.collisionVertexArray,T.text.placed,!R||M,B.x,B.y),L.verticalTextBox&&e7(r.textCollisionBox.collisionVertexArray,T.text.placed,!R||A,B.x,B.y)}const O=R&&Boolean(!A&&L.verticalIconBox);L.iconBox&&e7(r.iconCollisionBox.collisionVertexArray,T.icon.placed,O,f?B.x:0,f?B.y:0),L.verticalIconBox&&e7(r.iconCollisionBox.collisionVertexArray,T.icon.placed,!O,f?B.x:0,f?B.y:0)}}}if(r.fullyClipped=0===g,r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.bucketInstanceId in this.collisionCircleArrays){const U=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=U.invProjMatrix,r.placementViewportMatrix=U.viewportMatrix,r.collisionCircleArray=U.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(i){return 0===this.fadeDuration?1:(i-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(i){return Math.max(0,(this.transform.zoom-i)/1.5)}hasTransitions(i){return this.stale||i-this.lastPlacementChangeTimei}setStale(){this.stale=!0}}function e7(i,r,n,o,s){i.emplaceBack(r?1:0,n?1:0,o||0,s||0),i.emplaceBack(r?1:0,n?1:0,o||0,s||0),i.emplaceBack(r?1:0,n?1:0,o||0,s||0),i.emplaceBack(r?1:0,n?1:0,o||0,s||0)}function te(i){if(0===i.opacity&&!i.placed)return 0;if(1===i.opacity&&i.placed)return 4294967295;const r=i.placed?1:0,n=Math.floor(127*i.opacity);return 33554432*n+16777216*r+131072*n+65536*r+512*n+256*r+2*n+r}const tt=0;class ti{constructor(i){this._sortAcrossTiles="viewport-y"!==i.layout.get("symbol-z-order")&&void 0!==i.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(i,r,n,o,s){const a=this._bucketParts;for(;this._currentTileIndexi.sortKey-r.sortKey));this._currentPartIndex{const r=i.exported.now()-s;return!this._forceFullPlacement&&r>2};for(;this._currentPlacementIndex>=0;){const l=n[r[this._currentPlacementIndex]],c=this.placement.collisionIndex.transform.zoom;if("symbol"===l.type&&(!l.minzoom||l.minzoom<=c)&&(!l.maxzoom||l.maxzoom>c)){if(this._inProgressLayer||(this._inProgressLayer=new ti(l)),this._inProgressLayer.continuePlacement(o[l.source],this.placement,this._showCollisionBoxes,l,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(i){return this.placement.commit(i),this.placement}}const tn=512/i.EXTENT/2;class to{constructor(i,r,n){this.tileID=i,this.indexedSymbolInstances={},this.bucketInstanceId=n;for(let o=0;oi.overscaledZ)for(const c in l){const h=l[c];h.tileID.isChildOf(i)&&h.findMatches(r.symbolInstances,i,s)}else{const u=l[i.scaledTo(Number(a)).key];u&&u.findMatches(r.symbolInstances,i,s)}}for(let d=0;d{r[i]=!0}),this.layerIndexes)r[n]||delete this.layerIndexes[n]}}const tc=(r,n)=>i.emitValidationErrors(r,n&&n.filter(i=>"source.canvas"!==i.identifier)),th=i.pick(ek,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),tu=i.pick(ek,["setCenter","setZoom","setBearing","setPitch"]),td=function(){const r={},n=i.spec.$version;for(const o in i.spec.$root){const s=i.spec.$root[o];if(s.required){let a=null;null!=(a="version"===o?n:"array"===s.type?[]:{})&&(r[o]=a)}}return r}(),tp={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class tf extends i.Evented{constructor(r,n={}){super(),this.map=r,this.dispatcher=new A(eC(),this),this.imageManager=new _,this.imageManager.setEventedParent(this),this.glyphManager=new i.GlyphManager(r._requestManager,n.localFontFamily?i.LocalGlyphMode.all:n.localIdeographFontFamily?i.LocalGlyphMode.ideographs:i.LocalGlyphMode.none,n.localFontFamily||n.localIdeographFontFamily),this.lineAtlas=new i.LineAtlas(256,512),this.crossTileSymbolIndex=new tl,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this.zoomHistory=new i.ZoomHistory,this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedUpdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",i.getReferrer());const o=this;this._rtlTextPluginCallback=tf.registerForPluginStateChange(r=>{o.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:r.pluginStatus,pluginURL:r.pluginURL},(r,n)=>{if(i.triggerPluginCompletionEvent(r),n&&n.every(i=>i))for(const s in o._sourceCaches){const a=o._sourceCaches[s],l=a.getSource().type;"vector"!==l&&"geojson"!==l||a.reload()}})}),this.on("data",i=>{if("source"!==i.dataType||"metadata"!==i.sourceDataType)return;const r=this.getSource(i.sourceId);if(r&&r.vectorLayerIds)for(const n in this._layers){const o=this._layers[n];o.source===r.id&&this._validateLayer(o)}})}loadURL(r,n={}){this.fire(new i.Event("dataloading",{dataType:"style"}));const o="boolean"==typeof n.validate?n.validate:!i.isMapboxURL(r);r=this.map._requestManager.normalizeStyleURL(r,n.accessToken);const s=this.map._requestManager.transformRequest(r,i.ResourceType.Style);this._request=i.getJSON(s,(r,n)=>{this._request=null,r?this.fire(new i.ErrorEvent(r)):n&&this._load(n,o)})}loadJSON(r,n={}){this.fire(new i.Event("dataloading",{dataType:"style"})),this._request=i.exported.frame(()=>{this._request=null,this._load(r,!1!==n.validate)})}loadEmpty(){this.fire(new i.Event("dataloading",{dataType:"style"})),this._load(td,!1)}_updateLayerCount(i,r){const n=r?1:-1;i.is3D()&&(this._num3DLayers+=n),"circle"===i.type&&(this._numCircleLayers+=n),"symbol"===i.type&&(this._numSymbolLayers+=n)}_load(r,n){if(n&&tc(this,i.validateStyle(r)))return;for(const o in this._loaded=!0,this.stylesheet=r,this.updateProjection(),r.sources)this.addSource(o,r.sources[o],{validate:!1});this._changed=!1,r.sprite?this._loadSprite(r.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(r.glyphs);const s=ez(this.stylesheet.layers);for(let a of(this._order=s.map(i=>i.id),this._layers={},this._serializedLayers={},s))(a=i.createStyleLayer(a)).setEventedParent(this,{layer:{id:a.id}}),this._layers[a.id]=a,this._serializedLayers[a.id]=a.serialize(),this._updateLayerCount(a,!0);this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new x(this.stylesheet.light),this.stylesheet.terrain&&!this.terrainSetForDrapingOnly()&&this._createTerrain(this.stylesheet.terrain,1),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),this.fire(new i.Event("data",{dataType:"style"})),this.fire(new i.Event("style.load"))}terrainSetForDrapingOnly(){return this.terrain&&0===this.terrain.drapeRenderMode}setProjection(i){i?this.stylesheet.projection=i:delete this.stylesheet.projection,this.updateProjection()}updateProjection(){const i=this.map.transform.projection,r=this.map.transform.setProjection(this.map._runtimeProjection||(this.stylesheet?this.stylesheet.projection:void 0)),n=this.map.transform.projection;if(this._loaded&&(n.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null)),this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),r){if(n.isReprojectedInTileSpace||i.isReprojectedInTileSpace)for(const o in this.map.painter.clearBackgroundTiles(),this._sourceCaches)this._sourceCaches[o].clearTiles();else this._forceSymbolLayerUpdate();this.map._update(!0)}}_loadSprite(r){this._spriteRequest=function(r,n,o){let s,a,l;const c=i.exported.devicePixelRatio>1?"@2x":"";let h=i.getJSON(n.transformRequest(n.normalizeSpriteURL(r,c,".json"),i.ResourceType.SpriteJSON),(i,r)=>{h=null,l||(l=i,s=r,d())}),u=i.getImage(n.transformRequest(n.normalizeSpriteURL(r,c,".png"),i.ResourceType.SpriteImage),(i,r)=>{u=null,l||(l=i,a=r,d())});function d(){if(l)o(l);else if(s&&a){const r=i.exported.getImageData(a),n={};for(const c in s){const{width:h,height:u,x:d,y:p,sdf:f,pixelRatio:m,stretchX:_,stretchY:g,content:y}=s[c],x=new i.RGBAImage({width:h,height:u});i.RGBAImage.copy(r,x,{x:d,y:p},{x:0,y:0},{width:h,height:u}),n[c]={data:x,pixelRatio:m,sdf:f,stretchX:_,stretchY:g,content:y}}o(null,n)}}return{cancel(){h&&(h.cancel(),h=null),u&&(u.cancel(),u=null)}}}(r,this.map._requestManager,(r,n)=>{if(this._spriteRequest=null,r)this.fire(new i.ErrorEvent(r));else if(n)for(const o in n)this.imageManager.addImage(o,n[o]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new i.Event("data",{dataType:"style"}))})}_validateLayer(r){const n=this.getSource(r.source);if(!n)return;const o=r.sourceLayer;o&&("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(o))&&this.fire(new i.ErrorEvent(Error(`Source layer "${o}" does not exist on source "${n.id}" as specified by style layer "${r.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const i in this._sourceCaches)if(!this._sourceCaches[i].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(i){const r=[];for(const n of i){const o=this._layers[n];"custom"!==o.type&&r.push(o.serialize())}return r}hasTransitions(){if(this.light&&this.light.hasTransition()||this.fog&&this.fog.hasTransition())return!0;for(const i in this._sourceCaches)if(this._sourceCaches[i].hasTransition())return!0;for(const r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(i){return!!this.terrain&&tp[i.type]}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading")}update(r){if(!this._loaded)return;const n=this._changed;if(this._changed){const o=Object.keys(this._updatedLayers),s=Object.keys(this._removedLayers);for(const a in(o.length||s.length)&&this._updateWorkerLayers(o,s),this._updatedSources){const l=this._updatedSources[a];"reload"===l?this._reloadSource(a):"clear"===l&&this._clearSource(a)}for(const c in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[c].updateTransitions(r);this.light.updateTransitions(r),this.fog&&this.fog.updateTransitions(r),this._resetUpdates()}const h={};for(const u in this._sourceCaches){const d=this._sourceCaches[u];h[u]=d.used,d.used=!1}for(const p of this._order){const f=this._layers[p];if(f.recalculate(r,this._availableImages),!f.isHidden(r.zoom)){const m=this._getLayerSourceCache(f);m&&(m.used=!0)}const _=this.map.painter;if(_){const g=f.getProgramIds();if(!g)continue;const y=f.getProgramConfiguration(r.zoom);for(const x of g)_.useProgram(x,y)}}for(const v in h){const b=this._sourceCaches[v];h[v]!==b.used&&b.getSource().fire(new i.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:b.getSource().id}))}this.light.recalculate(r),this.terrain&&this.terrain.recalculate(r),this.fog&&this.fog.recalculate(r),this.z=r.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),n&&this.fire(new i.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const i=Object.keys(this._changedImages);if(i.length){for(const r in this._sourceCaches)this._sourceCaches[r].reloadTilesForDependencies(["icons","patterns"],i);this._changedImages={}}}_updateWorkerLayers(i,r){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(i),removedIds:r})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(r){if(this._checkLoaded(),tc(this,i.validateStyle(r)))return!1;(r=i.clone$1(r)).layers=ez(r.layers);const n=(function(i,r){if(!i)return[{command:ek.setStyle,args:[r]}];let n=[];try{if(!h(i.version,r.version))return[{command:ek.setStyle,args:[r]}];h(i.center,r.center)||n.push({command:ek.setCenter,args:[r.center]}),h(i.zoom,r.zoom)||n.push({command:ek.setZoom,args:[r.zoom]}),h(i.bearing,r.bearing)||n.push({command:ek.setBearing,args:[r.bearing]}),h(i.pitch,r.pitch)||n.push({command:ek.setPitch,args:[r.pitch]}),h(i.sprite,r.sprite)||n.push({command:ek.setSprite,args:[r.sprite]}),h(i.glyphs,r.glyphs)||n.push({command:ek.setGlyphs,args:[r.glyphs]}),h(i.transition,r.transition)||n.push({command:ek.setTransition,args:[r.transition]}),h(i.light,r.light)||n.push({command:ek.setLight,args:[r.light]}),h(i.fog,r.fog)||n.push({command:ek.setFog,args:[r.fog]}),h(i.projection,r.projection)||n.push({command:ek.setProjection,args:[r.projection]});const o={},s=[];!function(i,r,n,o){let s;for(s in r=r||{},i=i||{})i.hasOwnProperty(s)&&(r.hasOwnProperty(s)||eD(s,n,o));for(s in r){var a,l;r.hasOwnProperty(s)&&(i.hasOwnProperty(s)?h(i[s],r[s])||("geojson"===i[s].type&&"geojson"===r[s].type&&function(i,r,n){let o;for(o in i[n])if(i[n].hasOwnProperty(o)&&"data"!==o&&!h(i[n][o],r[n][o]))return!1;for(o in r[n])if(r[n].hasOwnProperty(o)&&"data"!==o&&!h(i[n][o],r[n][o]))return!1;return!0}(i,r,s)?n.push({command:ek.setGeoJSONSourceData,args:[s,r[s].data]}):(a=s,l=r,eD(a,n,o),eP(a,l,n))):eP(s,r,n))}}(i.sources,r.sources,s,o);const a=[];i.layers&&i.layers.forEach(i=>{o[i.source]?n.push({command:ek.removeLayer,args:[i.id]}):a.push(i)});let l=i.terrain;l&&o[l.source]&&(n.push({command:ek.setTerrain,args:[void 0]}),l=void 0),n=n.concat(s),h(l,r.terrain)||n.push({command:ek.setTerrain,args:[r.terrain]}),function(i,r,n){let o,s,a,l,c,u,d;r=r||[];const p=(i=i||[]).map(eB),f=r.map(eB),m=i.reduce(eR,{}),_=r.reduce(eR,{}),g=p.slice(),y=Object.create(null);for(o=0,s=0;o!(i.command in tu));if(0===n.length)return!1;const o=n.filter(i=>!(i.command in th));if(o.length>0)throw Error(`Unimplemented: ${o.map(i=>i.command).join(", ")}.`);return n.forEach(i=>{"setTransition"!==i.command&&this[i.command].apply(this,i.args)}),this.stylesheet=r,this.updateProjection(),!0}addImage(r,n){if(this.getImage(r))return this.fire(new i.ErrorEvent(Error("An image with this name already exists.")));this.imageManager.addImage(r,n),this._afterImageUpdated(r)}updateImage(i,r){this.imageManager.updateImage(i,r)}getImage(i){return this.imageManager.getImage(i)}removeImage(r){if(!this.getImage(r))return this.fire(new i.ErrorEvent(Error("No image with this name exists.")));this.imageManager.removeImage(r),this._afterImageUpdated(r)}_afterImageUpdated(r){this._availableImages=this.imageManager.listImages(),this._changedImages[r]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new i.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(r,n,o={}){if(this._checkLoaded(),void 0!==this.getSource(r))throw Error("There is already a source with this ID");if(!n.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(i.validateStyle.source,`sources.${r}`,n,null,o))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const s=eE(r,n,this.dispatcher,this);s.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:s.serialize(),sourceId:r}));const a=n=>{const o=(n?"symbol:":"other:")+r,a=this._sourceCaches[o]=new i.SourceCache(o,s,n);(n?this._symbolSourceCaches:this._otherSourceCaches)[r]=a,a.style=this,a.onAdd(this.map)};a(!1),"vector"!==n.type&&"geojson"!==n.type||a(!0),s.onAdd&&s.onAdd(this.map),this._changed=!0}removeSource(r){this._checkLoaded();const n=this.getSource(r);if(void 0===n)throw Error("There is no source with this ID");for(const o in this._layers)if(this._layers[o].source===r)return this.fire(new i.ErrorEvent(Error(`Source "${r}" cannot be removed while layer "${o}" is using it.`)));if(this.terrain&&this.terrain.get().source===r)return this.fire(new i.ErrorEvent(Error(`Source "${r}" cannot be removed while terrain is using it.`)));const s=this._getSourceCaches(r);for(const a of s)delete this._sourceCaches[a.id],delete this._updatedSources[a.id],a.fire(new i.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:a.getSource().id})),a.setEventedParent(null),a.clearTiles();delete this._otherSourceCaches[r],delete this._symbolSourceCaches[r],n.setEventedParent(null),n.onRemove&&n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(i,r){this._checkLoaded(),this.getSource(i).setData(r),this._changed=!0}getSource(i){const r=this._getSourceCache(i);return r&&r.getSource()}addLayer(r,n,o={}){let s;this._checkLoaded();const a=r.id;if(this.getLayer(a))return void this.fire(new i.ErrorEvent(Error(`Layer with id "${a}" already exists on this map`)));if("custom"===r.type){if(tc(this,i.validateCustomStyleLayer(r)))return;s=i.createStyleLayer(r)}else{if("object"==typeof r.source&&(this.addSource(a,r.source),r=i.clone$1(r),r=i.extend(r,{source:a})),this._validate(i.validateStyle.layer,`layers.${a}`,r,{arrayIndex:-1},o))return;s=i.createStyleLayer(r),this._validateLayer(s),s.setEventedParent(this,{layer:{id:a}}),this._serializedLayers[s.id]=s.serialize(),this._updateLayerCount(s,!0)}const l=n?this._order.indexOf(n):this._order.length;if(n&&-1===l)return void this.fire(new i.ErrorEvent(Error(`Layer with id "${n}" does not exist on this map.`)));this._order.splice(l,0,a),this._layerOrderChanged=!0,this._layers[a]=s;const c=this._getLayerSourceCache(s);if(this._removedLayers[a]&&s.source&&c&&"custom"!==s.type){const h=this._removedLayers[a];delete this._removedLayers[a],h.type!==s.type?this._updatedSources[s.source]="clear":(this._updatedSources[s.source]="reload",c.pause())}this._updateLayer(s),s.onAdd&&s.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(r,n){if(this._checkLoaded(),this._changed=!0,!this._layers[r])return void this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be moved.`)));if(r===n)return;const o=this._order.indexOf(r);this._order.splice(o,1);const s=n?this._order.indexOf(n):this._order.length;n&&-1===s?this.fire(new i.ErrorEvent(Error(`Layer with id "${n}" does not exist on this map.`))):(this._order.splice(s,0,r),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(r){this._checkLoaded();const n=this._layers[r];if(!n)return void this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be removed.`)));n.setEventedParent(null),this._updateLayerCount(n,!1);const o=this._order.indexOf(r);this._order.splice(o,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[r]=n,delete this._layers[r],delete this._serializedLayers[r],delete this._updatedLayers[r],delete this._updatedPaintProps[r],n.onRemove&&n.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(i){return this._layers[i]}hasLayer(i){return i in this._layers}hasLayerType(i){for(const r in this._layers)if(this._layers[r].type===i)return!0;return!1}setLayerZoomRange(r,n,o){this._checkLoaded();const s=this.getLayer(r);s?s.minzoom===n&&s.maxzoom===o||(null!=n&&(s.minzoom=n),null!=o&&(s.maxzoom=o),this._updateLayer(s)):this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(r,n,o={}){this._checkLoaded();const s=this.getLayer(r);if(s){if(!h(s.filter,n))return null==n?(s.filter=void 0,void this._updateLayer(s)):void(this._validate(i.validateStyle.filter,`layers.${s.id}.filter`,n,{layerType:s.type},o)||(s.filter=i.clone$1(n),this._updateLayer(s)))}else this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be filtered.`)))}getFilter(r){return i.clone$1(this.getLayer(r).filter)}setLayoutProperty(r,n,o,s={}){this._checkLoaded();const a=this.getLayer(r);a?h(a.getLayoutProperty(n),o)||(a.setLayoutProperty(n,o,s),this._updateLayer(a)):this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(r,n){const o=this.getLayer(r);if(o)return o.getLayoutProperty(n);this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style.`)))}setPaintProperty(r,n,o,s={}){this._checkLoaded();const a=this.getLayer(r);a?h(a.getPaintProperty(n),o)||(a.setPaintProperty(n,o,s)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[r]=!0):this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(i,r){return this.getLayer(i).getPaintProperty(r)}setFeatureState(r,n){this._checkLoaded();const o=r.source,s=r.sourceLayer,a=this.getSource(o);if(void 0===a)return void this.fire(new i.ErrorEvent(Error(`The source '${o}' does not exist in the map's style.`)));const l=a.type;if("geojson"===l&&s)return void this.fire(new i.ErrorEvent(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===l&&!s)return void this.fire(new i.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")));void 0===r.id&&this.fire(new i.ErrorEvent(Error("The feature id parameter must be provided.")));const c=this._getSourceCaches(o);for(const h of c)h.setFeatureState(s,r.id,n)}removeFeatureState(r,n){this._checkLoaded();const o=r.source,s=this.getSource(o);if(void 0===s)return void this.fire(new i.ErrorEvent(Error(`The source '${o}' does not exist in the map's style.`)));const a=s.type,l="vector"===a?r.sourceLayer:void 0;if("vector"===a&&!l)return void this.fire(new i.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")));if(n&&"string"!=typeof r.id&&"number"!=typeof r.id)return void this.fire(new i.ErrorEvent(Error("A feature id is required to remove its specific state property.")));const c=this._getSourceCaches(o);for(const h of c)h.removeFeatureState(l,r.id,n)}getFeatureState(r){this._checkLoaded();const n=r.source,o=r.sourceLayer,s=this.getSource(n);if(void 0!==s){if("vector"!==s.type||o)return void 0===r.id&&this.fire(new i.ErrorEvent(Error("The feature id parameter must be provided."))),this._getSourceCaches(n)[0].getFeatureState(o,r.id);this.fire(new i.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new i.ErrorEvent(Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return i.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const r={};for(const n in this._sourceCaches){const o=this._sourceCaches[n].getSource();r[o.id]||(r[o.id]=o.serialize())}return i.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.stylesheet.terrain,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:r,layers:this._serializeLayers(this._order)},i=>void 0!==i)}_updateLayer(i){this._updatedLayers[i.id]=!0;const r=this._getLayerSourceCache(i);i.source&&!this._updatedSources[i.source]&&r&&"raster"!==r.getSource().type&&(this._updatedSources[i.source]="reload",r.pause()),this._changed=!0,i.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(i){const r={},n=[];for(let o=this._order.length-1;o>=0;o--){const s=this._order[o];if("fill-extrusion"===this._layers[s].type)for(const a of(r[s]=o,i)){const l=a[s];if(l)for(const c of l)n.push(c)}}n.sort((i,r)=>r.intersectionZ-i.intersectionZ);const h=[];for(let u=this._order.length-1;u>=0;u--){const d=this._order[u];if("fill-extrusion"===this._layers[d].type)for(let p=n.length-1;p>=0;p--){const f=n[p].feature;if(r[f.layer.id]{const r=this.getLayer(i);return r&&r.is3D()}):this.has3DLayers(),u=eg.createFromScreenPoints(r,o);for(const d in this._sourceCaches){const p=this._sourceCaches[d].getSource().id;n.layers&&!s[p]||c.push(function(r,n,o,s,a,l,c,h=!1){const u=r.tilesIn(s,c,h);u.sort(eS);const d=[];for(const p of u)d.push({wrappedTileID:p.tile.tileID.wrapped().key,queryResults:p.tile.queryRenderedFeatures(n,o,r._state,p,a,l,function(r,n){const o=i.identity([]);return i.scale(o,o,[.5*r.width,-(.5*r.height),1]),i.translate(o,o,[1,-1,0]),i.multiply$1(o,o,r.calculateProjMatrix(n.toUnwrapped()))}(r.transform,p.tile.tileID),h)});const f=function(i){const r={},n={};for(const o of i){const s=o.queryResults,a=o.wrappedTileID,l=n[a]=n[a]||{};for(const c in s){const h=s[c],u=l[c]=l[c]||{},d=r[c]=r[c]||[];for(const p of h)u[p.featureIndex]||(u[p.featureIndex]=!0,d.push(p))}}return r}(d);for(const m in f)f[m].forEach(i=>{const n=i.feature,o=r.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=o});return f}(this._sourceCaches[d],this._layers,this._serializedLayers,u,n,o,h,!!this.map._showQueryGeometry))}return this.placement&&c.push(function(i,r,n,o,s,a,l){const c={},h=a.queryRenderedSymbols(o),u=[];for(const d of Object.keys(h).map(Number))u.push(l[d]);for(const p of(u.sort(eS),u)){const f=p.featureIndex.lookupSymbolFeatures(h[p.bucketInstanceId],r,p.bucketIndex,p.sourceLayerIndex,s.filter,s.layers,s.availableImages,i);for(const m in f){const _=c[m]=c[m]||[],g=f[m];for(const y of(g.sort((i,r)=>{const n=p.featureSortOrder;if(n){const o=n.indexOf(i.featureIndex);return n.indexOf(r.featureIndex)-o}return r.featureIndex-i.featureIndex}),g))_.push(y)}}for(const x in c)c[x].forEach(r=>{const o=r.feature,s=n(i[x]).getFeatureState(o.layer["source-layer"],o.id);o.source=o.layer.source,o.layer["source-layer"]&&(o.sourceLayer=o.layer["source-layer"]),o.state=s});return c}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),u.screenGeometry,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(c)}querySourceFeatures(r,n){n&&n.filter&&this._validate(i.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const o=this._getSourceCaches(r);let s=[];for(const a of o)s=s.concat(function(i,r){const n=i.getRenderableIds().map(r=>i.getTileByID(r)),o=[],s={};for(let a=0;a{for(const i of this.map._markers)i._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(r){if(this._checkLoaded(),!r)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const n=this.fog,o=n.get();for(const s in r)if(!h(r[s],o[s])){n.set(r),this.stylesheet.fog=r;const a={now:i.exported.now(),transition:i.extend({duration:0},this.stylesheet.transition)};n.updateTransitions(a);break}}else this._createFog(r);this._markersNeedUpdate=!0}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const i=this._order.filter(i=>this.isLayerDraped(this._layers[i])),r=this._order.filter(i=>!this.isLayerDraped(this._layers[i]));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...i),this._drapedFirstOrder.push(...r)}_createTerrain(r,n){const o=this.terrain=new w(r,n);this.stylesheet.terrain=r,this.dispatcher.broadcast("enableTerrain",!0),this._force3DLayerUpdate();const s={now:i.exported.now(),transition:i.extend({duration:0},this.stylesheet.transition)};o.updateTransitions(s)}_force3DLayerUpdate(){for(const i in this._layers){const r=this._layers[i];"fill-extrusion"===r.type&&this._updateLayer(r)}}_forceSymbolLayerUpdate(){for(const i in this._layers){const r=this._layers[i];"symbol"===r.type&&this._updateLayer(r)}}_validate(r,n,o,s,a={}){return(!a||!1!==a.validate)&&tc(this,r.call(i.validateStyle,i.extend({key:n,style:this.serialize(),value:o,styleSpec:i.spec},s)))}_remove(){for(const r in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[r].setEventedParent(null);for(const n in this._sourceCaches)this._sourceCaches[n].clearTiles(),this._sourceCaches[n].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(i){const r=this._getSourceCaches(i);for(const n of r)n.clearTiles()}_reloadSource(i){const r=this._getSourceCaches(i);for(const n of r)n.resume(),n.reload()}_updateSources(i){for(const r in this._sourceCaches)this._sourceCaches[r].update(i)}_generateCollisionBoxes(){for(const i in this._sourceCaches){const r=this._sourceCaches[i];r.resume(),r.reload()}}_updatePlacement(r,n,o,s,a=!1){let l=!1,c=!1;const h={};for(const u of this._order){const d=this._layers[u];if("symbol"!==d.type)continue;if(!h[d.source]){const p=this._getLayerSourceCache(d);if(!p)continue;h[d.source]=p.getRenderableIds(!0).map(i=>p.getTileByID(i)).sort((i,r)=>r.tileID.overscaledZ-i.tileID.overscaledZ||(i.tileID.isLessThan(r.tileID)?-1:1))}const f=this.crossTileSymbolIndex.addLayer(d,h[d.source],r.center.lng,r.projection);l=l||f}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a=a||this._layerOrderChanged||0===o,this._layerOrderChanged&&this.fire(new i.Event("neworder")),(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.exported.now(),r.zoom))&&(this.pauseablePlacement=new tr(r,this._order,a,n,o,s,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,h),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.exported.now()),c=!0),l&&this.pauseablePlacement.placement.setStale()),c||l)for(const m of this._order){const _=this._layers[m];"symbol"===_.type&&this.placement.updateLayerOpacities(_,h[_.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(i.exported.now())}_releaseSymbolFadeTiles(){for(const i in this._sourceCaches)this._sourceCaches[i].releaseSymbolFadeTiles()}getImages(i,r,n){this.imageManager.getImages(r.icons,n),this._updateTilesForChangedImages();const o=i=>{i&&i.setDependencies(r.tileID.key,r.type,r.icons)};o(this._otherSourceCaches[r.source]),o(this._symbolSourceCaches[r.source])}getGlyphs(i,r,n){this.glyphManager.getGlyphs(r.stacks,n)}getResource(r,n,o){return i.makeRequest(n,o)}_getSourceCache(i){return this._otherSourceCaches[i]}_getLayerSourceCache(i){return"symbol"===i.type?this._symbolSourceCaches[i.source]:this._otherSourceCaches[i.source]}_getSourceCaches(i){const r=[];return this._otherSourceCaches[i]&&r.push(this._otherSourceCaches[i]),this._symbolSourceCaches[i]&&r.push(this._symbolSourceCaches[i]),r}has3DLayers(){return this._num3DLayers>0}hasSymbolLayers(){return this._numSymbolLayers>0}hasCircleLayers(){return this._numCircleLayers>0}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}tf.getSourceType=function(i){return eT[i]},tf.setSourceType=function(i,r){eT[i]=r},tf.registerForPluginStateChange=i.registerForPluginStateChange;var tm="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#define EXTENT 8192.0\n#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;varying vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}\n#endif",t_="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}";let tg={},ty={};tg=tb("","\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;\n#else\nuniform sampler2D u_dem;uniform sampler2D u_dem_prev;\n#endif\nuniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos));\n#ifdef TERRAIN_DEM_NEAREST_FILTER\nreturn u_exaggeration*tl;\n#endif\nfloat tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem_prev,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {return currentElevation(apos);}\n#endif\nfloat unpack_depth(vec4 rgba_depth)\n{const vec4 bit_shift=vec4(1.0/(256.0*256.0*256.0),1.0/(256.0*256.0),1.0/256.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\nunpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy))\n);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nfloat tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a;\n#else\nvec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack);\n#endif\nreturn vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;vec4 bounds=vec4(d,vec2(1.0)-d);h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\n#endif",!0),ty=tb("#ifdef FOG\nuniform float u_fog_temporal_offset;float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);return mix(color,u_fog_color.rgb,opacity);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif","#ifdef FOG\nuniform mat4 u_fog_matrix;vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",!0);const tx=tb("\nhighp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}\n#ifdef TERRAIN\nhighp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(256.0*256.0*256.0,256.0*256.0,256.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/256.0,1.0/256.0,1.0/256.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#endif","\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#if defined(PROJECTION_GLOBE_VIEW) && !defined(PROJECTED_POS_ON_VIEWPORT)\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {\n#if defined(PROJECTION_GLOBE_VIEW) && !defined(PROJECTED_POS_ON_VIEWPORT)\nreturn mix(globe,mercator,t);\n#else\nreturn globe;\n#endif\n}\n#ifdef PROJECTION_GLOBE_VIEW\nmat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered.");var tv={background:tb("uniform vec4 u_color;uniform float u_opacity;void main() {vec4 out_color=u_color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),backgroundPattern:tb("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_mix);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),circle:tb("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\ngl_FragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;attribute float a_scale;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);\n#ifdef PROJECTION_GLOBE_VIEW\nvec2 scaled_extrude=extrude*a_scale;vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=scaled_extrude.x*surface_vectors[0]+scaled_extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);vec4 world_center=vec4(pos,1);\n#else \nmat3 surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);vec4 world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\n#if defined(SCALE_WITH_MAP) && defined(PROJECTION_GLOBE_VIEW)\nview_scale*=a_scale;\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);vec4 occlusion_world_center=vec4(circle_center,cantilevered_height,1);vec4 occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nvec4 occlusion_world_center=world_center;vec4 occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}"),clippingMask:tb("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:tb("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\ngl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;attribute float a_scale;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);\n#ifdef PROJECTION_GLOBE_VIEW\nextrude*=a_scale;vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\nvec3 pos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),heatmapTexture:tb("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:tb("varying float v_placed;varying float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}","attribute vec3 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:tb("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos_2f;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:tb("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;\n#endif\nvarying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}"),fill:tb("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutline:tb("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutlinePattern:tb("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=mix(color1,color2,u_fade);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillPattern:tb("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillExtrusion:tb("varying vec4 v_color;void main() {vec4 color=v_color;\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 pos=vec3(pos_nx.xy,h);\n#else\nvec3 pos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(pos.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.rgb+=clamp(color.rgb*directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),fillExtrusionPattern:tb("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);out_color=out_color*v_lighting;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 p=vec3(pos_nx.xy,h);\n#else\nvec3 p=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:tb("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nreturn texture2D(u_image,coord).a/4.0;\n#else\nvec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;\n#endif\n}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos);float f=getElevation(v_pos+vec2(epsilon.x,0));float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float h=getElevation(v_pos+vec2(0,epsilon.y));float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:tb("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef FOG\ngl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),line:tb("uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;uniform float u_mix;uniform vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;varying highp vec2 v_uv;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash_from\n#pragma mapbox: define lowp vec4 dash_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash_from\n#pragma mapbox: initialize lowp vec4 dash_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist_a=texture2D(u_dash_image,v_tex_a).a;float sdfdist_b=texture2D(u_dash_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfwidth=min(dash_from.z*u_scale.y,dash_to.z*u_scale.z);float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/sdfwidth;alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\n#ifdef RENDER_LINE_GRADIENT\nvec4 out_color=texture2D(u_gradient_image,v_uv);\n#else\nvec4 out_color=color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef RENDER_LINE_ALPHA_DISCARD\nif (alpha < u_alpha_discard_threshold) {discard;}\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define EXTRUDE_SCALE 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;\n#ifdef RENDER_LINE_GRADIENT\nattribute vec3 a_packed;\n#else\nattribute float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform mediump vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;varying highp vec2 v_uv;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash_from\n#pragma mapbox: define lowp vec4 dash_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash_from\n#pragma mapbox: initialize lowp vec4 dash_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];float a_linesofar=a_packed[2];highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);\n#endif\n#ifdef RENDER_LINE_DASH\nfloat tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;float scaleA=dash_from.z==0.0 ? 0.0 : tileZoomRatio/(dash_from.z*fromScale);float scaleB=dash_to.z==0.0 ? 0.0 : tileZoomRatio/(dash_to.z*toScale);float heightA=dash_from.y;float heightB=dash_to.y;v_tex_a=vec2(a_linesofar*scaleA/floorwidth,(-normal.y*heightA+dash_from.x+0.5)/u_texsize.y);v_tex_b=vec2(a_linesofar*scaleB/floorwidth,(-normal.y*heightB+dash_to.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),linePattern:tb("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),raster:tb("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef FOG\nout_color=fog_dither(fog_apply(out_color,v_fog_pos));\n#endif\ngl_FragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,0,w);v_pos0=a_texture_pos/8192.0;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),symbolIcon:tb("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_z_tile_anchor;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float anchorZ=a_z_tile_anchor.x;vec2 tileAnchor=a_z_tile_anchor.yz;vec3 h=elevationVector(tileAnchor)*elevation(tileAnchor);vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tileAnchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(vec3(a_pos,anchorZ)+h,mercator_pos,u_zoom_transition);vec4 projectedPoint=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),anchorZ,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec3 proj_pos=mix_globe_mercator(vec3(a_projected_pos.xy,anchorZ),mercator_pos,u_zoom_transition);\n#ifdef PROJECTED_POS_ON_VIEWPORT\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xy,0.0,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xyz+h,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;}"),symbolSDF:tb("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_z_tile_anchor;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_tile_id;uniform float u_zoom_transition;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float anchorZ=a_z_tile_anchor.x;vec2 tileAnchor=a_z_tile_anchor.yz;vec3 h=elevationVector(tileAnchor)*elevation(tileAnchor);vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tileAnchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(vec3(a_pos,anchorZ)+h,mercator_pos,u_zoom_transition);vec4 projectedPoint=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),anchorZ,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec3 proj_pos=mix_globe_mercator(vec3(a_projected_pos.xy,anchorZ),mercator_pos,u_zoom_transition);\n#ifdef PROJECTED_POS_ON_VIEWPORT\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xy,0.0,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xyz+h,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float gamma_scale=gl_Position.w;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}"),symbolTextAndIcon:tb("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_z_tile_anchor;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float anchorZ=a_z_tile_anchor.x;vec2 tileAnchor=a_z_tile_anchor.yz;vec3 h=elevationVector(tileAnchor)*elevation(tileAnchor);vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tileAnchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(vec3(a_pos,anchorZ)+h,mercator_pos,u_zoom_transition);vec4 projectedPoint=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),anchorZ,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec3 proj_pos=mix_globe_mercator(vec3(a_projected_pos.xy,anchorZ),mercator_pos,u_zoom_transition);\n#ifdef PROJECTED_POS_ON_VIEWPORT\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xy,0.0,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xyz+h,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_sdf);}"),terrainRaster:tb("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\nvoid main() {vec4 color=texture2D(u_image0,v_pos0);\n#ifdef FOG\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\nconst float skirtOffset=24575.0;const float wireframeOffset=0.00015;void main() {v_pos0=a_texture_pos/8192.0;float skirt=float(a_pos.x >=skirtOffset);float elevation=elevation(a_texture_pos)-skirt*u_skirt_height;\n#ifdef TERRAIN_WIREFRAME\nelevation+=u_skirt_height*u_skirt_height*wireframeOffset;\n#endif\nvec2 decodedPos=a_pos-vec2(skirt*skirtOffset,0.0);gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n}"),terrainDepth:tb("#ifdef GL_ES\nprecision highp float;\n#endif\nvarying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying float v_depth;void main() {float elevation=elevation(a_texture_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:tb("\nvarying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",t_),skyboxGradient:tb("varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",t_),skyboxCapture:tb("\nvarying highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;\n#ifdef GL_ES\nprecision highp float;\n#endif\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;gl_FragColor=vec4(color,1.0);}","attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:tb("uniform sampler2D u_image0;varying vec2 v_pos0;void main() {gl_FragColor=texture2D(u_image0,v_pos0);\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_proj_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;attribute vec3 a_globe_pos;attribute vec2 a_merc_pos;attribute vec2 a_uv;varying vec2 v_pos0;const float wireframeOffset=1e3;void main() {v_pos0=a_uv;vec2 uv=a_uv*EXTENT;vec4 up_vector=vec4(elevationVector(uv),1.0);float height=elevation(uv);\n#ifdef TERRAIN_WIREFRAME\nheight+=wireframeOffset;\n#endif\nvec4 globe=u_globe_matrix*vec4(a_globe_pos+up_vector.xyz*height,1.0);vec4 mercator=vec4(0.0);if (u_zoom_transition > 0.0) {mercator=vec4(a_merc_pos,height,1.0);mercator.xy-=u_merc_center;mercator.x=wrap(mercator.x,-0.5,0.5);mercator=u_merc_matrix*mercator;}vec3 position=mix(globe.xyz,mercator.xyz,u_zoom_transition);gl_Position=u_proj_matrix*vec4(position,1.0);}"),globeAtmosphere:tb("uniform vec2 u_center;uniform float u_radius;uniform vec2 u_screen_size;uniform float u_opacity;uniform highp float u_fadeout_range;uniform vec3 u_start_color;uniform vec3 u_end_color;uniform float u_pixel_ratio;void main() {highp vec2 fragCoord=gl_FragCoord.xy/u_pixel_ratio;fragCoord.y=u_screen_size.y-fragCoord.y;float distFromCenter=length(fragCoord-u_center);float normDistFromCenter=length(fragCoord-u_center)/u_radius;if (normDistFromCenter < 1.0)\ndiscard;float t=clamp(1.0-sqrt(normDistFromCenter-1.0)/u_fadeout_range,0.0,1.0);vec3 color=mix(u_start_color,u_end_color,1.0-t);gl_FragColor=vec4(color*t*u_opacity,u_opacity);}","attribute vec3 a_pos;void main() {gl_Position=vec4(a_pos,1.0);}")};function tb(i,r,n){const o=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=/uniform (highp |mediump |lowp )?([\w]+) ([\w]+)([\s]*)([\w]*)/g,a=r.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),l=i.match(s),c=r.match(s),h=tm.match(s);let u=c?c.concat(l):l;n||(tg.staticUniforms&&(u=tg.staticUniforms.concat(u)),ty.staticUniforms&&(u=ty.staticUniforms.concat(u))),u&&(u=u.concat(h));const d={};return{fragmentSource:i=i.replace(o,(i,r,n,o,s)=>(d[s]=!0,"define"===r?` #ifndef HAS_UNIFORM_u_${s} varying ${n} ${o} ${s}; #else @@ -57,4 +57,4 @@ uniform ${n} ${o} u_${s}; `}),staticAttributes:a,staticUniforms:u}}class tw{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(i,r,n,o,s,a,l,c){this.context=i;let h=this.boundPaintVertexBuffers.length!==o.length;for(let u=0;!h&&u({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_image0:new i.Uniform1i(r,n.u_image0),u_skirt_height:new i.Uniform1f(r,n.u_skirt_height)}),tS=(i,r)=>({u_matrix:i,u_image0:0,u_skirt_height:r}),tI=(i,r,n,o,s)=>({u_proj_matrix:Float32Array.from(i),u_globe_matrix:r,u_merc_matrix:n,u_zoom_transition:o,u_merc_center:s,u_image0:0});function tM(i,r){return null!=i&&null!=r&&!(!i.hasData()||!r.hasData())&&null!=i.demTexture&&null!=r.demTexture&&i.tileID.key!==r.tileID.key}const tA=new class{constructor(){this.operations={}}newMorphing(i,r,n,o,s){if(i in this.operations){const a=this.operations[i];a.to.tileID.key!==n.tileID.key&&(a.queued=n)}else this.operations[i]={startTime:o,phase:0,duration:s,from:r,to:n,queued:null}}getMorphValuesForProxy(i){if(!(i in this.operations))return null;const r=this.operations[i];return{from:r.from,to:r.to,phase:r.phase}}update(i){for(const r in this.operations){const n=this.operations[r];for(n.phase=(i-n.startTime)/n.duration;n.phase>=1||!this._validOp(n);)if(!this._nextOp(n,i)){delete this.operations[r];break}}}_nextOp(i,r){return!!i.queued&&(i.from=i.to,i.to=i.queued,i.queued=null,i.phase=0,i.startTime=r,!0)}_validOp(i){return i.from.hasData()&&i.to.hasData()}},tC={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"},tz=i=>({u_matrix:i});function tk(r,n,o,s,a){if(a>0){const l=i.exported.now(),c=(l-r.timeAdded)/a,h=n?(l-n.timeAdded)/a:-1,u=o.getSource(),d=s.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),p=!n||Math.abs(n.tileID.overscaledZ-d)>Math.abs(r.tileID.overscaledZ-d),f=p&&r.refreshedUponExpiration?1:i.clamp(p?c:1-h,0,1);return r.refreshedUponExpiration&&c>=1&&(r.refreshedUponExpiration=!1),n?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}class tP extends i.SourceCache{constructor(i){const r={type:"raster-dem",maxzoom:i.transform.maxZoom},n=new A(eC(),null),o=eE("mock-dem",r,n,i.style);super("mock-dem",o,!1),o.setEventedParent(this),this._sourceLoaded=!0}_loadTile(i,r){i.state="loaded",r(null)}}class tD extends i.SourceCache{constructor(i){const r=eE("proxy",{type:"geojson",maxzoom:i.transform.maxZoom},new A(eC(),null),i.style);super("proxy",r,!1),r.setEventedParent(this),this.map=this.getSource().map=i,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(r,n,o){if(r.freezeTileCoverage)return;this.transform=r;const s=r.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((n,o)=>{if(n[o.key]="",!this._tiles[o.key]){const s=new i.Tile(o,this._source.tileSize*o.overscaleFactor(),r.tileZoom);s.state="loaded",this._tiles[o.key]=s}return n},{});for(const a in this._tiles)a in s||(this.freeFBO(a),this._tiles[a].unloadVectorData(),delete this._tiles[a])}freeFBO(i){const r=this.proxyCachedFBO[i];if(void 0!==r){const n=Object.values(r);this.renderCachePool.push(...n),delete this.proxyCachedFBO[i]}}deallocRenderCache(){this.renderCache.forEach(i=>i.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class tL extends i.OverscaledTileID{constructor(i,r,n){super(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y),this.proxyTileKey=r,this.projMatrix=n}}class tB extends i.Elevation{constructor(r,n){super(),this.painter=r,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[o,s,a]=function(r){const n=new i.StructArrayLayout4i8,o=new i.StructArrayLayout3ui6;n.reserve(17161),o.reserve(33800);const s=i.EXTENT/128,a=i.EXTENT+s/2,l=a+s;for(let c=-s;ca||c<0||c>a?24575:0,d=i.clamp(Math.round(h),0,i.EXTENT),p=i.clamp(Math.round(c),0,i.EXTENT);n.emplaceBack(d+u,p,d,p)}const f=(i,r)=>{const n=131*r+i;o.emplaceBack(n+1,n,n+131),o.emplaceBack(n+131,n+131+1,n+1)};for(let m=1;m<129;m++)for(let _=1;_<129;_++)f(_,m);return[0,129].forEach(i=>{for(let r=0;r<130;r++)f(r,i),f(i,r)}),[n,o,32768]}(),l=r.context;this.gridBuffer=l.createVertexBuffer(o,i.boundsAttributes.members),this.gridIndexBuffer=l.createIndexBuffer(s),this.gridSegments=i.SegmentVector.simpleSegment(0,0,o.length,s.length),this.gridNoSkirtSegments=i.SegmentVector.simpleSegment(0,0,o.length,a),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new tD(n.map),this.orthoMatrix=i.create(),i.ortho(this.orthoMatrix,0,i.EXTENT,0,i.EXTENT,0,1);const c=l.gl;this._overlapStencilMode=new i.StencilMode({func:c.GEQUAL,mask:255},0,255,c.KEEP,c.KEEP,c.REPLACE),this._previousZoom=r.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=n,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new tP(n.map)}set style(i){i.on("data",this._onStyleDataEvent.bind(this)),i.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=i,this._checkRenderCacheEfficiency()}update(r,n,o){if(r&&r.terrain){this._style!==r&&(this.style=r),this.enabled=!0;const s=r.terrain.properties;this.sourceCache=0===r.terrain.drapeRenderMode?this._mockSourceCache:r._getSourceCache(s.get("source")),this._exaggeration=s.get("exaggeration");const a=()=>{this.sourceCache.used&&i.warnOnce(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const r=this.getScaledDemTileSize();this.sourceCache.update(n,r,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,a(),this._initializing=!0),a(),n.updateElevation(!o),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(n),this._emptyDEMTextureDirty=!0}else this._disable()}resetTileLookupCache(i){this._findCoveringTileCache[i]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_checkRenderCacheEfficiency(){const r=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||100!==r.efficiency&&i.warnOnce(`Terrain render cache efficiency is not optimal (${r.efficiency}%) and performance may be affected negatively, consider placing all background, fill and line layers before layer - with id '${r.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(i){i.coord&&"source"===i.dataType?this._clearRenderCacheForTile(i.sourceCacheId,i.coord):"style"===i.dataType&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const i in this._style._sourceCaches)this._style._sourceCaches[i].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(i=>i.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture)}_source(){return this.enabled?this.sourceCache:null}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const i=2*this.proxySourceCache.getSource().tileSize;return[i,i]}set useVertexMorphing(i){this._useVertexMorphing=i}updateTileBinding(r){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const n=this.proxySourceCache,o=this.painter.transform;this._initializing&&(this._initializing=0===o._centerAltitude&&-1===this.getAtPointOrZero(i.MercatorCoordinate.fromLngLat(o.center),-1),this._emptyDEMTextureDirty=!this._initializing);const s=this.proxyCoords=n.getIds().map(i=>{const r=n.getTileByID(i).tileID;return r.projMatrix=o.calculateProjMatrix(r.toUnwrapped()),r});(function(r,n){const o=n.transform.pointCoordinate(n.transform.getCameraPoint()),s=new i.pointGeometry(o.x,o.y);r.sort((r,n)=>{if(n.overscaledZ-r.overscaledZ)return n.overscaledZ-r.overscaledZ;const o=new i.pointGeometry(r.canonical.x+(1<{this.proxyToSource[i.key]={}}),this.terrainTileForTile={};const l=this._style._sourceCaches;for(const c in l){const h=l[c];if(!h.used||(h!==this.sourceCache&&this.resetTileLookupCache(h.id),this._setupProxiedCoordsForOrtho(h,r[c],a),h.usedForTerrain))continue;const u=r[c];h.getSource().reparseOverscaled&&this._assignTerrainTiles(u)}this.proxiedCoords[n.id]=s.map(i=>new tL(i,i.key,this.orthoMatrix)),this._assignTerrainTiles(s),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(a),this.renderingToTexture=!1,this._updateTimestamp=i.exported.now();const d={};for(const p of(this._visibleDemTiles=[],this.proxyCoords)){const f=this.terrainTileForTile[p.key];if(!f)continue;const m=f.tileID.key;m in d||(this._visibleDemTiles.push(f),d[m]=m)}}_assignTerrainTiles(i){this._initializing||i.forEach(i=>{if(this.terrainTileForTile[i.key])return;const r=this._findTileCoveringTileID(i,this.sourceCache);r&&(this.terrainTileForTile[i.key]=r)})}_prepareDEMTextures(){const i=this.painter.context,r=i.gl;for(const n in this.terrainTileForTile){const o=this.terrainTileForTile[n],s=o.dem;s&&(!o.demTexture||o.needsDEMTextureUpload)&&(i.activeTexture.set(r.TEXTURE1),tT(this.painter,o,s))}}_prepareDemTileUniforms(i,r,n,o){if(!r||null==r.demTexture)return!1;const s=i.tileID.canonical,a=Math.pow(2,r.tileID.canonical.z-s.z),l=o||"";return n[`u_dem_tl${l}`]=[s.x*a%1,s.y*a%1],n[`u_dem_scale${l}`]=a,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const r=this.painter.context,n=r.gl;if(!this._emptyDepthBufferTexture){const o={width:1,height:1,data:new Uint8Array([255,255,255,255])};this._emptyDepthBufferTexture=new i.Texture(r,o,n.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let i=0;const r=this._visibleDemTiles.reduce((r,n)=>{if(!n.dem)return r;const o=n.dem.tree.minimums[0];return o>0&&i++,r+o},0);return i?r/i:0}_updateEmptyDEMTexture(){const r=this.painter.context,n=r.gl;r.activeTexture.set(n.TEXTURE2);const o=this._getLoadedAreaMinimum(),s={width:1,height:1,data:new Uint8Array(i.DEMData.pack(o,this.sourceCache.getSource().encoding))};this._emptyDEMTextureDirty=!1;let a=this._emptyDEMTexture;return a?a.update(s,{premultiply:!1}):a=this._emptyDEMTexture=new i.Texture(r,s,n.RGBA,{premultiply:!1}),a}setupElevationDraw(r,n,o){var s;const a=this.painter.context,l=a.gl,c=(s=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:i.DEMData.getUnpackVector(s),u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0,u_tile_tl_up:[0,0,1],u_tile_tr_up:[0,0,1],u_tile_br_up:[0,0,1],u_tile_bl_up:[0,0,1],u_tile_up_scale:1});c.u_dem_size=this.sourceCache.getSource().tileSize,c.u_exaggeration=this.exaggeration();const h=this.painter.transform,u=h.projection.createTileTransform(h,h.worldSize),d=r.tileID.canonical;c.u_tile_tl_up=u.upVector(d,0,0),c.u_tile_tr_up=u.upVector(d,i.EXTENT,0),c.u_tile_br_up=u.upVector(d,i.EXTENT,i.EXTENT),c.u_tile_bl_up=u.upVector(d,0,i.EXTENT),c.u_tile_up_scale=u.upVectorScale(d);let p=null,f=null,m=1;if(o&&o.morphing&&this._useVertexMorphing){const _=o.morphing.srcDemTile,g=o.morphing.dstDemTile;m=o.morphing.phase,_&&g&&(this._prepareDemTileUniforms(r,_,c,"_prev")&&(f=_),this._prepareDemTileUniforms(r,g,c)&&(p=g))}if(f&&p?(a.activeTexture.set(l.TEXTURE2),p.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE,l.NEAREST),a.activeTexture.set(l.TEXTURE4),f.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE,l.NEAREST),c.u_dem_lerp=m):(p=this.terrainTileForTile[r.tileID.key],a.activeTexture.set(l.TEXTURE2),(this._prepareDemTileUniforms(r,p,c)?p.demTexture:this.emptyDEMTexture).bind(l.NEAREST,l.CLAMP_TO_EDGE)),a.activeTexture.set(l.TEXTURE3),o&&o.useDepthForOcclusion?(this._depthTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE),c.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height]):(this.emptyDepthBufferTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE),c.u_depth_size_inv=[1,1]),o&&o.useMeterToDem&&p){const y=(1<{if(c===i)return;const o=[];n&&o.push(tC[d]),o.push(tC[i]),o.push("PROJECTION_GLOBE_VIEW"),l=r.useProgram("globeRaster",null,o),c=i},f=r.colorModeForRenderPass(),m=new i.DepthMode(u.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D);tA.update(a);const _=r.transform,g=i.calculateGlobeMatrix(_,_.worldSize),y=i.calculateGlobeMercatorMatrix(_),x=[i.mercatorXfromLng(_.center.lng),i.mercatorYfromLat(_.center.lat)],v=r.globeSharedBuffers;(d?[!1,!0]:[!1]).forEach(d=>{c=-1;const b=d?u.LINES:u.TRIANGLES;for(const w of s){const T=o.getTile(w),E=Math.pow(2,w.canonical.z),[S,I]=i.globeBuffersForTileMesh(r,T,w,E),M=i.StencilMode.disabled,A=n.prevTerrainTileForTile[w.key],C=n.terrainTileForTile[w.key];tM(A,C)&&tA.newMorphing(w.key,A,C,a,250),h.activeTexture.set(u.TEXTURE0),T.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE);const z=tA.getMorphValuesForProxy(w.key),k=z?1:0,P={};z&&i.extend$1(P,{morphing:{srcDemTile:z.from,dstDemTile:z.to,phase:i.easeCubicInOut(z.phase)}});const D=i.globeMatrixForTile(w.canonical,g),L=tI(_.projMatrix,D,y,i.globeToMercatorTransition(_.zoom),x);if(p(k,d),n.setupElevationDraw(T,l,P),r.prepareDrawProgram(h,l,w.toUnwrapped()),v){const[B,R]=d?v.getWirefameBuffer(r.context):[v.gridIndexBuffer,v.gridSegments];l.draw(h,b,m,M,f,i.CullFaceMode.backCCW,L,"globe_raster",S,B,R)}if(!d){const F=[0===w.canonical.y?i.globePoleMatrixForTile(w.canonical,!1,_):null,w.canonical.y===E-1?i.globePoleMatrixForTile(w.canonical,!0,_):null];for(const O of F){if(!O)continue;const U=tI(_.projMatrix,O,O,0,x);v&&l.draw(h,b,m,M,f,i.CullFaceMode.disabled,U,"globe_pole_raster",I,v.poleIndexBuffer,v.poleSegments)}}}})}(r,n,o,s,a);else{let l,c;const h=r.context,u=h.gl,d=r.options.showTerrainWireframe?2:0,p=(i,n)=>{if(c===i)return;const o=[tC[i]];n&&o.push(tC[d]),l=r.useProgram("terrainRaster",null,o),c=i},f=r.colorModeForRenderPass(),m=new i.DepthMode(u.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D);tA.update(a);const _=r.transform,g=6*Math.pow(1.5,22-_.zoom)*n.exaggeration();(d?[!1,!0]:[!1]).forEach(d=>{c=-1;const y=d?u.LINES:u.TRIANGLES,[x,v]=d?n.getWirefameBuffer():[n.gridIndexBuffer,n.gridSegments];for(const b of s){let w;const T=o.getTile(b),E=i.StencilMode.disabled,S=n.prevTerrainTileForTile[b.key],I=n.terrainTileForTile[b.key];tM(S,I)&&tA.newMorphing(b.key,S,I,a,250),h.activeTexture.set(u.TEXTURE0),T.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE,u.LINEAR_MIPMAP_NEAREST);const M=tA.getMorphValuesForProxy(b.key),A=M?1:0;M&&(w={morphing:{srcDemTile:M.from,dstDemTile:M.to,phase:i.easeCubicInOut(M.phase)}});const C=tS(b.projMatrix,!function(i,r){const n=1<i.dem).forEach(r=>{i=Math.min(i,r.dem.tree.minimums[0])}),0===i?i:(i-30)*this._exaggeration}raycast(i,r,n){if(!this._visibleDemTiles)return null;const o=this._visibleDemTiles.filter(i=>i.dem).map(o=>{const s=o.tileID,a=Math.pow(2,s.overscaledZ),{x:l,y:c}=s.canonical,h=l/a,u=(l+1)/a,d=c/a,p=(c+1)/a;return{minx:h,miny:d,maxx:u,maxy:p,t:o.dem.tree.raycastRoot(h,d,u,p,i,r,n),tile:o}});for(const s of(o.sort((i,r)=>(null!==i.t?i.t:Number.MAX_VALUE)-(null!==r.t?r.t:Number.MAX_VALUE)),o)){if(null==s.t)break;const a=s.tile.dem.tree.raycast(s.minx,s.miny,s.maxx,s.maxy,i,r,n);if(null!=a)return a}return null}_createFBO(){const r=this.painter.context,n=r.gl,o=this.drapeBufferSize;r.activeTexture.set(n.TEXTURE0);const s=new i.Texture(r,{width:o[0],height:o[1],data:null},n.RGBA);s.bind(n.LINEAR,n.CLAMP_TO_EDGE);const a=r.createFramebuffer(o[0],o[1],!1);return a.colorAttachment.set(s.texture),a.depthAttachment=new ef(r,a.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=r.createRenderbuffer(r.gl.DEPTH_STENCIL,o[0],o[1]),this._stencilRef=0,a.depthAttachment.set(this._sharedDepthStencil),r.clear({stencil:0})):a.depthAttachment.set(this._sharedDepthStencil),r.extTextureFilterAnisotropic&&!r.extTextureFilterAnisotropicForceOff&&n.texParameterf(n.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.extTextureFilterAnisotropicMax),{fb:a,tex:s,dirty:!1}}_initFBOPool(){for(;this.pool.length{const r=this._style._layers[i],n=r.isHidden(this.painter.transform.zoom),o=r.getCrossfadeParameters(),s=!!o&&1!==o.t,a=r.hasTransition();return"custom"!==r.type&&!n&&(s||a)})}_clearRasterFadeFromRenderCache(){let i=!1;for(const r in this._style._sourceCaches)if(this._style._sourceCaches[r]._source instanceof ev){i=!0;break}if(i)for(let n=0;nr.renderCachePool.length){const n=Object.values(r.proxyCachedFBO);r.proxyCachedFBO={};for(let o=0;o=0;c--){const h=a[c];if(r.getTileByID(h.key),void 0!==r.proxyCachedFBO[h.key]){const u=i[h.key],d=this.proxyToSource[h.key];let p=0;for(const f in d){const m=d[f],_=u[f];if(!_||_.length!==m.length||m.some((i,r)=>i!==_[r]||l[f]&&l[f].hasOwnProperty(i.key))){p=-1;break}++p}for(const g in r.proxyCachedFBO[h.key])r.renderCache[r.proxyCachedFBO[h.key][g]].dirty=p<0||p!==Object.values(u).length}}const y=[...this._drapedRenderBatches];for(const x of(y.sort((i,r)=>r.end-r.start-(i.end-i.start)),y))for(const v of a){if(r.proxyCachedFBO[v.key])continue;let b=r.renderCachePool.pop();void 0===b&&r.renderCache.length<50&&(b=r.renderCache.length,r.renderCache.push(this._createFBO())),void 0!==b&&(r.proxyCachedFBO[v.key]={},r.proxyCachedFBO[v.key][x.start]=b,r.renderCache[b].dirty=!0)}this._tilesDirty={}}_setupStencil(i,r,n,o){let s;if(!o||!this._sourceTilesOverlap[o.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const a=this.painter.context,l=a.gl;if(r.length<=1)return void(this._overlapStencilType=!1);if(n.isTileClipped())s=r.length,this._overlapStencilMode.test={func:l.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(r[0].overscaledZ>r[r.length-1].overscaledZ))return void(this._overlapStencilType=!1);s=1,this._overlapStencilMode.test={func:l.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+s>255&&(a.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=s,this._overlapStencilMode.ref=this._stencilRef,n.isTileClipped()&&this._renderTileClippingMasks(r,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(r){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[r.key]),this._overlapStencilMode):i.StencilMode.disabled}_renderTileClippingMasks(r,n){const o=this.painter,s=this.painter.context,a=s.gl;o._tileClippingMaskIDs={},s.setColorMode(i.ColorMode.disabled),s.setDepthMode(i.DepthMode.disabled);const l=o.useProgram("clippingMask");for(const c of r){const h=o._tileClippingMaskIDs[c.key]=--n;l.draw(s,a.TRIANGLES,i.DepthMode.disabled,new i.StencilMode({func:a.ALWAYS,mask:0},h,255,a.KEEP,a.KEEP,a.REPLACE),i.ColorMode.disabled,i.CullFaceMode.disabled,tz(c.projMatrix),"$clipping",o.tileExtentBuffer,o.quadTriangleIndexBuffer,o.tileExtentSegments)}}pointCoordinate(r){const n=this.painter.transform;if(r.x<0||r.x>n.width||r.y<0||r.y>n.height)return null;const o=[r.x,r.y,1,1];i.transformMat4$1(o,o,n.pixelMatrixInverse),i.scale$1(o,o,1/o[3]),o[0]/=n.worldSize,o[1]/=n.worldSize;const s=n._camera.position,a=i.mercatorZfromAltitude(1,n.center.lat),l=[s[0],s[1],s[2]/a,0],c=i.subtract([],o.slice(0,3),l);i.normalize(c,c);const h=this.raycast(l,c,this._exaggeration);return null!==h&&h?(i.scaleAndAdd(l,l,c,h),l[3]=l[2],l[2]*=a,l):null}drawDepth(){const r=this.painter,n=r.context,o=this.proxySourceCache,s=Math.ceil(r.width),a=Math.ceil(r.height);if(this._depthFBO&&(this._depthFBO.width!==s||this._depthFBO.height!==a)&&(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture),!this._depthFBO){const l=n.gl,c=n.createFramebuffer(s,a,!0);n.activeTexture.set(l.TEXTURE0);const h=new i.Texture(n,{width:s,height:a,data:null},l.RGBA);h.bind(l.NEAREST,l.CLAMP_TO_EDGE),c.colorAttachment.set(h.texture);const u=n.createRenderbuffer(n.gl.DEPTH_COMPONENT16,s,a);c.depthAttachment.set(u),this._depthFBO=c,this._depthTexture=h}n.bindFramebuffer.set(this._depthFBO.framebuffer),n.viewport.set([0,0,s,a]),function(r,n,o,s){if("globe"===r.transform.projection.name)return;const a=r.context,l=a.gl;a.clear({depth:1});const c=r.useProgram("terrainDepth"),h=new i.DepthMode(l.LESS,i.DepthMode.ReadWrite,r.depthRangeFor3D);for(const u of s){const d=o.getTile(u),p=tS(u.projMatrix,0);n.setupElevationDraw(d,c),c.draw(a,l.TRIANGLES,h,i.StencilMode.disabled,i.ColorMode.unblended,i.CullFaceMode.backCCW,p,"terrain_depth",n.gridBuffer,n.gridIndexBuffer,n.gridNoSkirtSegments)}}(r,this,o,this.proxyCoords)}_setupProxiedCoordsForOrtho(i,r,n){if(i.getSource() instanceof ew)return this._setupProxiedCoordsForImageSource(i,r,n);this._findCoveringTileCache[i.id]=this._findCoveringTileCache[i.id]||{};const o=this.proxiedCoords[i.id]=[],s=this.proxyCoords;for(let a=0;a(i.min.x=Math.min(i.min.x,r.x-c.x),i.min.y=Math.min(i.min.y,r.y-c.y),i.max.x=Math.max(i.max.x,r.x-c.x),i.max.y=Math.max(i.max.y,r.y-c.y),i),{min:new i.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),u=(r,n)=>{const o=r.wrap+r.canonical.x/(1<l+h.max.x||s+ac+h.max.y};for(let d=0;di.key===n.tileID.key);if(a)return a}if(n.tileID.key!==r.key){let l,c,h;const u=r.canonical.z-n.tileID.canonical.z;s=i.create();const d=n.tileID.wrap-r.wrap<0?(c=(l=i.EXTENT>>u)*((n.tileID.canonical.x<=d){const p=r.canonical.z-d;n.getSource().reparseOverscaled?(c=Math.max(r.canonical.z+2,n.transform.tileZoom),l=new i.OverscaledTileID(c,r.wrap,d,r.canonical.x>>p,r.canonical.y>>p)):0!==p&&(c=d,l=new i.OverscaledTileID(c,r.wrap,d,r.canonical.x>>p,r.canonical.y>>p))}l.key!==r.key&&(u.push(l.key),o=n.getTile(l))}const f=i=>{u.forEach(r=>{s[r]=i}),u.length=0};for(c-=1;c>=h&&(!o||!o.hasData());c--){o&&f(o.tileID.key);const m=l.calculateScaledKey(c);if((o=n.getTileByID(m))&&o.hasData())break;const _=s[m];if(null===_)break;void 0===_?u.push(m):o=n.getTileByID(_)}return f(o?o.tileID.key:null),o&&o.hasData()?o:null}findDEMTileFor(i){return this.enabled?this._findTileCoveringTileID(i,this.sourceCache):null}prepareDrawTile(i){this.renderedToTile=!0}_clearRenderCacheForTile(i,r){let n=this._tilesDirty[i];n||(n=this._tilesDirty[i]={}),n[r.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const r=function(r){let n,o,s;const a=new i.StructArrayLayout2ui4;for(o=1;o<129;o++){for(n=1;n<129;n++)s=131*o+n,a.emplaceBack(s,s+1),a.emplaceBack(s,s+131),a.emplaceBack(s+1,s+131),128===o&&a.emplaceBack(s+131,s+131+1);a.emplaceBack(s+1,s+1+131)}return a}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(r),this.wireframeSegments=i.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,r.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}}function tR(i){const r=[];for(let n=0;n_.indexOf(g)&&_.push(g);let y=s?s.defines():[];y=y.concat(l.map(i=>`#define ${i}`));const x=y.concat("\n#ifdef GL_ES\nprecision mediump float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",tm,tx.fragmentSource,ty.fragmentSource,o.fragmentSource).join("\n"),v=y.concat("\n#ifdef GL_ES\nprecision highp float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",tm,tx.vertexSource,ty.vertexSource,tg.vertexSource,o.vertexSource).join("\n"),b=c.createShader(c.FRAGMENT_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);c.shaderSource(b,x),c.compileShader(b),c.attachShader(this.program,b);const w=c.createShader(c.VERTEX_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);c.shaderSource(w,v),c.compileShader(w),c.attachShader(this.program,w),this.attributes={};const T={};this.numAttributes=d.length;for(let E=0;E>16,c>>16],u_pixel_coord_lower:[65535&l,65535&c]}}const tU=(r,n,o,s)=>{const a=n.style.light,l=a.properties.get("position"),c=[l.x,l.y,l.z],h=i.create$1();"viewport"===a.properties.get("anchor")&&(i.fromRotation(h,-n.transform.angle),i.transformMat3(c,c,h));const u=a.properties.get("color");return{u_matrix:r,u_lightpos:c,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+o,u_opacity:s}},tV=(r,n,o,s,a,l,c)=>i.extend(tU(r,n,o,s),tO(l,n,c),{u_height_factor:-Math.pow(2,a.overscaledZ)/c.tileSize/8}),tN=i=>({u_matrix:i}),tj=(r,n,o,s)=>i.extend(tN(r),tO(o,n,s)),tG=(i,r)=>({u_matrix:i,u_world:r}),tZ=(r,n,o,s,a)=>i.extend(tj(r,n,o,s),{u_world:a}),t$=(r,n,o,s)=>{let a;const l=r.transform;return a="map"===s.paint.get("circle-pitch-alignment")?l.calculatePixelsToTileUnitsMatrix(o):new Float32Array([l.pixelsToGLUnits[0],0,0,l.pixelsToGLUnits[1]]),{u_camera_to_center_distance:l.cameraToCenterDistance,u_matrix:r.translatePosMatrix(n.projMatrix,o,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_device_pixel_ratio:i.exported.devicePixelRatio,u_extrude_scale:a}},tq=i=>{const r=[];return"map"===i.paint.get("circle-pitch-alignment")&&r.push("PITCH_WITH_MAP"),"map"===i.paint.get("circle-pitch-scale")&&r.push("SCALE_WITH_MAP"),r},tX=(r,n,o)=>{const s=i.EXTENT/o.tileSize;return{u_matrix:r,u_camera_to_center_distance:n.cameraToCenterDistance,u_extrude_scale:[n.pixelsToGLUnits[0]/s,n.pixelsToGLUnits[1]/s]}},tW=(i,r,n=1)=>({u_matrix:i,u_color:r,u_overlay:0,u_overlay_scale:n}),tH=(i,r,n,o)=>({u_matrix:i,u_extrude_scale:C(r,1,n),u_intensity:o}),tK=(r,n,o,s,a,l)=>{const c=r.transform,h=c.calculatePixelsToTileUnitsMatrix(n),u={u_matrix:tQ(r,n,o,a),u_pixels_to_tile_units:h,u_device_pixel_ratio:i.exported.devicePixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:l,u_texsize:[0,0],u_scale:[0,0,0],u_mix:0,u_alpha_discard_threshold:0};if(t0(o)){const d=tJ(n,r.transform);u.u_texsize=n.lineAtlasTexture.size,u.u_scale=[d,s.fromScale,s.toScale],u.u_mix=s.t}return u},tY=(r,n,o,s,a)=>{const l=r.transform,c=tJ(n,l);return{u_matrix:tQ(r,n,o,a),u_texsize:n.imageAtlasTexture.size,u_pixels_to_tile_units:l.calculatePixelsToTileUnitsMatrix(n),u_device_pixel_ratio:i.exported.devicePixelRatio,u_image:0,u_scale:[c,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]],u_alpha_discard_threshold:0}};function tJ(i,r){return 1/C(i,1,r.tileZoom)}function tQ(i,r,n,o){return i.translatePosMatrix(o||r.tileID.projMatrix,r,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}function t0(i){const r=i.paint.get("line-dasharray").value;return r.value||"constant"!==r.kind}const t1=(i,r,n,o,s,a)=>{var l,c;return{u_matrix:i,u_tl_parent:r,u_scale_parent:n,u_fade_t:o.mix,u_opacity:o.opacity*s.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:s.paint.get("raster-brightness-min"),u_brightness_high:s.paint.get("raster-brightness-max"),u_saturation_factor:(c=s.paint.get("raster-saturation"))>0?1-1/(1.001-c):-c,u_contrast_factor:(l=s.paint.get("raster-contrast"))>0?1/(1-l):1+l,u_spin_weights:function(i){i*=Math.PI/180;const r=Math.sin(i),n=Math.cos(i);return[(2*n+1)/3,(-Math.sqrt(3)*r-n+1)/3,(Math.sqrt(3)*r-n+1)/3]}(s.paint.get("raster-hue-rotate")),u_perspective_transform:a}},t2=(i,r,n,o,s,a,l,c,h,u,d,p,f,m)=>{const _=s.transform;return{u_is_size_zoom_constant:+("constant"===i||"source"===i),u_is_size_feature_constant:+("constant"===i||"camera"===i),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:_.cameraToCenterDistance,u_pitch:_.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:_.width/_.height,u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_matrix:a,u_label_plane_matrix:l,u_coord_matrix:c,u_is_text:+h,u_pitch_with_map:+o,u_texsize:u,u_tile_id:d,u_zoom_transition:p,u_inv_rot_matrix:f,u_merc_center:m,u_texture:0}},t3=(r,n,o,s,a,l,c,h,u,d,p,f,m,_,g)=>{const{cameraToCenterDistance:y,_pitch:x}=a.transform;return i.extend(t2(r,n,o,s,a,l,c,h,u,d,f,m,_,g),{u_gamma_scale:s?y*Math.cos(a.terrain?0:x):1,u_device_pixel_ratio:i.exported.devicePixelRatio,u_is_halo:+p})},t5=(r,n,o,s,a,l,c,h,u,d,p,f,m,_)=>i.extend(t3(r,n,o,s,a,l,c,h,!0,u,!0,p,f,m,_),{u_texsize_icon:d,u_texture_icon:1}),t4=(i,r,n)=>({u_matrix:i,u_opacity:r,u_color:n}),t6=(r,n,o,s,a,l)=>i.extend(function(i,r,n,o){const s=n.imageManager.getPattern(i.from.toString()),a=n.imageManager.getPattern(i.to.toString()),{width:l,height:c}=n.imageManager.getPixelSize(),h=Math.pow(2,o.tileID.overscaledZ),u=o.tileSize*Math.pow(2,n.transform.tileZoom)/h,d=u*(o.tileID.canonical.x+o.tileID.wrap*h),p=u*o.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:s.tl,u_pattern_br_a:s.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[l,c],u_mix:r.t,u_pattern_size_a:s.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:r.fromScale,u_scale_b:r.toScale,u_tile_units_to_pixels:1/C(o,1,n.transform.tileZoom),u_pixel_coord_upper:[d>>16,p>>16],u_pixel_coord_lower:[65535&d,65535&p]}}(s,l,o,a),{u_matrix:r,u_opacity:n}),t8={fillExtrusion:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_lightpos:new i.Uniform3f(r,n.u_lightpos),u_lightintensity:new i.Uniform1f(r,n.u_lightintensity),u_lightcolor:new i.Uniform3f(r,n.u_lightcolor),u_vertical_gradient:new i.Uniform1f(r,n.u_vertical_gradient),u_opacity:new i.Uniform1f(r,n.u_opacity)}),fillExtrusionPattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_lightpos:new i.Uniform3f(r,n.u_lightpos),u_lightintensity:new i.Uniform1f(r,n.u_lightintensity),u_lightcolor:new i.Uniform3f(r,n.u_lightcolor),u_vertical_gradient:new i.Uniform1f(r,n.u_vertical_gradient),u_height_factor:new i.Uniform1f(r,n.u_height_factor),u_image:new i.Uniform1i(r,n.u_image),u_texsize:new i.Uniform2f(r,n.u_texsize),u_pixel_coord_upper:new i.Uniform2f(r,n.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(r,n.u_pixel_coord_lower),u_scale:new i.Uniform3f(r,n.u_scale),u_fade:new i.Uniform1f(r,n.u_fade),u_opacity:new i.Uniform1f(r,n.u_opacity)}),fill:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix)}),fillPattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_image:new i.Uniform1i(r,n.u_image),u_texsize:new i.Uniform2f(r,n.u_texsize),u_pixel_coord_upper:new i.Uniform2f(r,n.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(r,n.u_pixel_coord_lower),u_scale:new i.Uniform3f(r,n.u_scale),u_fade:new i.Uniform1f(r,n.u_fade)}),fillOutline:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_world:new i.Uniform2f(r,n.u_world)}),fillOutlinePattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_world:new i.Uniform2f(r,n.u_world),u_image:new i.Uniform1i(r,n.u_image),u_texsize:new i.Uniform2f(r,n.u_texsize),u_pixel_coord_upper:new i.Uniform2f(r,n.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(r,n.u_pixel_coord_lower),u_scale:new i.Uniform3f(r,n.u_scale),u_fade:new i.Uniform1f(r,n.u_fade)}),circle:(r,n)=>({u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_extrude_scale:new i.UniformMatrix2f(r,n.u_extrude_scale),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_matrix:new i.UniformMatrix4f(r,n.u_matrix)}),collisionBox:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_extrude_scale:new i.Uniform2f(r,n.u_extrude_scale)}),collisionCircle:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_inv_matrix:new i.UniformMatrix4f(r,n.u_inv_matrix),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_viewport_size:new i.Uniform2f(r,n.u_viewport_size)}),debug:(r,n)=>({u_color:new i.UniformColor(r,n.u_color),u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_overlay:new i.Uniform1i(r,n.u_overlay),u_overlay_scale:new i.Uniform1f(r,n.u_overlay_scale)}),clippingMask:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix)}),heatmap:(r,n)=>({u_extrude_scale:new i.Uniform1f(r,n.u_extrude_scale),u_intensity:new i.Uniform1f(r,n.u_intensity),u_matrix:new i.UniformMatrix4f(r,n.u_matrix)}),heatmapTexture:(r,n)=>({u_image:new i.Uniform1i(r,n.u_image),u_color_ramp:new i.Uniform1i(r,n.u_color_ramp),u_opacity:new i.Uniform1f(r,n.u_opacity)}),hillshade:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_image:new i.Uniform1i(r,n.u_image),u_latrange:new i.Uniform2f(r,n.u_latrange),u_light:new i.Uniform2f(r,n.u_light),u_shadow:new i.UniformColor(r,n.u_shadow),u_highlight:new i.UniformColor(r,n.u_highlight),u_accent:new i.UniformColor(r,n.u_accent)}),hillshadePrepare:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_image:new i.Uniform1i(r,n.u_image),u_dimension:new i.Uniform2f(r,n.u_dimension),u_zoom:new i.Uniform1f(r,n.u_zoom),u_unpack:new i.Uniform4f(r,n.u_unpack)}),line:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_pixels_to_tile_units:new i.UniformMatrix2f(r,n.u_pixels_to_tile_units),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_units_to_pixels:new i.Uniform2f(r,n.u_units_to_pixels),u_dash_image:new i.Uniform1i(r,n.u_dash_image),u_gradient_image:new i.Uniform1i(r,n.u_gradient_image),u_image_height:new i.Uniform1f(r,n.u_image_height),u_texsize:new i.Uniform2f(r,n.u_texsize),u_scale:new i.Uniform3f(r,n.u_scale),u_mix:new i.Uniform1f(r,n.u_mix),u_alpha_discard_threshold:new i.Uniform1f(r,n.u_alpha_discard_threshold)}),linePattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_texsize:new i.Uniform2f(r,n.u_texsize),u_pixels_to_tile_units:new i.UniformMatrix2f(r,n.u_pixels_to_tile_units),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_image:new i.Uniform1i(r,n.u_image),u_units_to_pixels:new i.Uniform2f(r,n.u_units_to_pixels),u_scale:new i.Uniform3f(r,n.u_scale),u_fade:new i.Uniform1f(r,n.u_fade),u_alpha_discard_threshold:new i.Uniform1f(r,n.u_alpha_discard_threshold)}),raster:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_tl_parent:new i.Uniform2f(r,n.u_tl_parent),u_scale_parent:new i.Uniform1f(r,n.u_scale_parent),u_fade_t:new i.Uniform1f(r,n.u_fade_t),u_opacity:new i.Uniform1f(r,n.u_opacity),u_image0:new i.Uniform1i(r,n.u_image0),u_image1:new i.Uniform1i(r,n.u_image1),u_brightness_low:new i.Uniform1f(r,n.u_brightness_low),u_brightness_high:new i.Uniform1f(r,n.u_brightness_high),u_saturation_factor:new i.Uniform1f(r,n.u_saturation_factor),u_contrast_factor:new i.Uniform1f(r,n.u_contrast_factor),u_spin_weights:new i.Uniform3f(r,n.u_spin_weights),u_perspective_transform:new i.Uniform2f(r,n.u_perspective_transform)}),symbolIcon:(r,n)=>({u_is_size_zoom_constant:new i.Uniform1i(r,n.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(r,n.u_is_size_feature_constant),u_size_t:new i.Uniform1f(r,n.u_size_t),u_size:new i.Uniform1f(r,n.u_size),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_pitch:new i.Uniform1f(r,n.u_pitch),u_rotate_symbol:new i.Uniform1i(r,n.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(r,n.u_aspect_ratio),u_fade_change:new i.Uniform1f(r,n.u_fade_change),u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(r,n.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(r,n.u_coord_matrix),u_is_text:new i.Uniform1i(r,n.u_is_text),u_pitch_with_map:new i.Uniform1i(r,n.u_pitch_with_map),u_texsize:new i.Uniform2f(r,n.u_texsize),u_tile_id:new i.Uniform3f(r,n.u_tile_id),u_zoom_transition:new i.Uniform1f(r,n.u_zoom_transition),u_inv_rot_matrix:new i.UniformMatrix4f(r,n.u_inv_rot_matrix),u_merc_center:new i.Uniform2f(r,n.u_merc_center),u_texture:new i.Uniform1i(r,n.u_texture)}),symbolSDF:(r,n)=>({u_is_size_zoom_constant:new i.Uniform1i(r,n.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(r,n.u_is_size_feature_constant),u_size_t:new i.Uniform1f(r,n.u_size_t),u_size:new i.Uniform1f(r,n.u_size),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_pitch:new i.Uniform1f(r,n.u_pitch),u_rotate_symbol:new i.Uniform1i(r,n.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(r,n.u_aspect_ratio),u_fade_change:new i.Uniform1f(r,n.u_fade_change),u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(r,n.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(r,n.u_coord_matrix),u_is_text:new i.Uniform1i(r,n.u_is_text),u_pitch_with_map:new i.Uniform1i(r,n.u_pitch_with_map),u_texsize:new i.Uniform2f(r,n.u_texsize),u_texture:new i.Uniform1i(r,n.u_texture),u_gamma_scale:new i.Uniform1f(r,n.u_gamma_scale),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_tile_id:new i.Uniform3f(r,n.u_tile_id),u_zoom_transition:new i.Uniform1f(r,n.u_zoom_transition),u_inv_rot_matrix:new i.UniformMatrix4f(r,n.u_inv_rot_matrix),u_merc_center:new i.Uniform2f(r,n.u_merc_center),u_is_halo:new i.Uniform1i(r,n.u_is_halo)}),symbolTextAndIcon:(r,n)=>({u_is_size_zoom_constant:new i.Uniform1i(r,n.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(r,n.u_is_size_feature_constant),u_size_t:new i.Uniform1f(r,n.u_size_t),u_size:new i.Uniform1f(r,n.u_size),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_pitch:new i.Uniform1f(r,n.u_pitch),u_rotate_symbol:new i.Uniform1i(r,n.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(r,n.u_aspect_ratio),u_fade_change:new i.Uniform1f(r,n.u_fade_change),u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(r,n.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(r,n.u_coord_matrix),u_is_text:new i.Uniform1i(r,n.u_is_text),u_pitch_with_map:new i.Uniform1i(r,n.u_pitch_with_map),u_texsize:new i.Uniform2f(r,n.u_texsize),u_texsize_icon:new i.Uniform2f(r,n.u_texsize_icon),u_texture:new i.Uniform1i(r,n.u_texture),u_texture_icon:new i.Uniform1i(r,n.u_texture_icon),u_gamma_scale:new i.Uniform1f(r,n.u_gamma_scale),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_is_halo:new i.Uniform1i(r,n.u_is_halo)}),background:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_opacity:new i.Uniform1f(r,n.u_opacity),u_color:new i.UniformColor(r,n.u_color)}),backgroundPattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_opacity:new i.Uniform1f(r,n.u_opacity),u_image:new i.Uniform1i(r,n.u_image),u_pattern_tl_a:new i.Uniform2f(r,n.u_pattern_tl_a),u_pattern_br_a:new i.Uniform2f(r,n.u_pattern_br_a),u_pattern_tl_b:new i.Uniform2f(r,n.u_pattern_tl_b),u_pattern_br_b:new i.Uniform2f(r,n.u_pattern_br_b),u_texsize:new i.Uniform2f(r,n.u_texsize),u_mix:new i.Uniform1f(r,n.u_mix),u_pattern_size_a:new i.Uniform2f(r,n.u_pattern_size_a),u_pattern_size_b:new i.Uniform2f(r,n.u_pattern_size_b),u_scale_a:new i.Uniform1f(r,n.u_scale_a),u_scale_b:new i.Uniform1f(r,n.u_scale_b),u_pixel_coord_upper:new i.Uniform2f(r,n.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(r,n.u_pixel_coord_lower),u_tile_units_to_pixels:new i.Uniform1f(r,n.u_tile_units_to_pixels)}),terrainRaster:tE,terrainDepth:tE,skybox:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_sun_direction:new i.Uniform3f(r,n.u_sun_direction),u_cubemap:new i.Uniform1i(r,n.u_cubemap),u_opacity:new i.Uniform1f(r,n.u_opacity),u_temporal_offset:new i.Uniform1f(r,n.u_temporal_offset)}),skyboxGradient:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_color_ramp:new i.Uniform1i(r,n.u_color_ramp),u_center_direction:new i.Uniform3f(r,n.u_center_direction),u_radius:new i.Uniform1f(r,n.u_radius),u_opacity:new i.Uniform1f(r,n.u_opacity),u_temporal_offset:new i.Uniform1f(r,n.u_temporal_offset)}),skyboxCapture:(r,n)=>({u_matrix_3f:new i.UniformMatrix3f(r,n.u_matrix_3f),u_sun_direction:new i.Uniform3f(r,n.u_sun_direction),u_sun_intensity:new i.Uniform1f(r,n.u_sun_intensity),u_color_tint_r:new i.Uniform4f(r,n.u_color_tint_r),u_color_tint_m:new i.Uniform4f(r,n.u_color_tint_m),u_luminance:new i.Uniform1f(r,n.u_luminance)}),globeRaster:(r,n)=>({u_proj_matrix:new i.UniformMatrix4f(r,n.u_proj_matrix),u_globe_matrix:new i.UniformMatrix4f(r,n.u_globe_matrix),u_merc_matrix:new i.UniformMatrix4f(r,n.u_merc_matrix),u_zoom_transition:new i.Uniform1f(r,n.u_zoom_transition),u_merc_center:new i.Uniform2f(r,n.u_merc_center),u_image0:new i.Uniform1i(r,n.u_image0)}),globeAtmosphere:(r,n)=>({u_center:new i.Uniform2f(r,n.u_center),u_radius:new i.Uniform1f(r,n.u_radius),u_screen_size:new i.Uniform2f(r,n.u_screen_size),u_pixel_ratio:new i.Uniform1f(r,n.u_pixel_ratio),u_opacity:new i.Uniform1f(r,n.u_opacity),u_fadeout_range:new i.Uniform1f(r,n.u_fadeout_range),u_start_color:new i.Uniform3f(r,n.u_start_color),u_end_color:new i.Uniform3f(r,n.u_end_color)})};function t9(r,n,o,a,l,c,h){var u;const d=r.context,p=d.gl,f=r.useProgram("collisionBox"),m=[];let _=0,g=0;for(let y=0;y0){const S=i.create(),I=w;i.mul(S,b.placementInvProjMatrix,r.transform.glCoordMatrix),i.mul(S,S,b.placementViewportMatrix),m.push({circleArray:E,circleOffset:g,transform:I,invTransform:S}),_+=E.length/4,g=_}T&&(r.terrain&&r.terrain.setupElevationDraw(v,f),f.draw(d,p.LINES,i.DepthMode.disabled,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.disabled,tX(w,r.transform,v),o.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,null,r.transform.zoom,null,T.collisionVertexBuffer,T.collisionVertexBufferExt))}if(!h||!m.length)return;const M=r.useProgram("collisionCircle"),A=new i.StructArrayLayout2f1f2i16;A.resize(4*_),A._trim();let C=0;for(const z of m)for(let k=0;k[0,0,0];!function(r,n,o,s,a,l,c,h,u,d){const p=o.transform,f=s?r.textSizeData:r.iconSizeData,m=i.evaluateSizeForZoom(f,o.transform.zoom),_=[256/o.width*2+1,256/o.height*2+1],g=s?r.text.dynamicLayoutVertexArray:r.icon.dynamicLayoutVertexArray;g.clear();const y=r.lineVertexArray,x=s?r.text.placedSymbolArray:r.icon.placedSymbolArray,v=o.transform.width/o.transform.height;let b=!1;for(let w=0;w=-r[0]&&n<=r[0]&&o>=-r[1]&&o<=r[1]}(A,_)){eY(T.numGlyphs,g);continue}const C=eG(o.transform.cameraToCenterDistance,A[3]),z=i.evaluateSizeForFeature(f,m,T),k=c?z/C:z*C,P=ej(new i.pointGeometry(M[0],M[1]),a,M[2]);if(P.signedDistanceFromCamera<=0){eY(T.numGlyphs,g);continue}let D={};const L=c?null:u,B=eq(T,k,!1,h,n,a,l,r.glyphOffsetArray,y,g,P.point,E,D,v,L,p.projection,d);b=B.useVertical,L&&B.needsFlipping&&(D={}),(B.notEnoughRoom||b||B.needsFlipping&&eq(T,k,!0,h,n,a,l,r.glyphOffsetArray,y,g,P.point,E,D,v,L,p.projection,d).notEnoughRoom)&&eY(T.numGlyphs,g)}s?r.text.dynamicLayoutVertexBuffer.updateData(g):r.icon.dynamicLayoutVertexBuffer.updateData(g)}(B,P.projMatrix,r,a,Q,et,v,d,eo,P)}const es=r.translatePosMatrix(P.projMatrix,L,l,c),ea=b||a&&M||er?t7:Q,el=r.translatePosMatrix(et,L,l,c,!0),ec=O&&0!==o.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1),eh=y.createInversionMatrix(P.toUnwrapped());D=O?B.iconsInText?t5(U.kind,j,w,v,r,es,ea,el,Z,W,G,C,eh,I):t3(U.kind,j,w,v,r,es,ea,el,a,Z,!0,G,C,eh,I):t2(U.kind,j,w,v,r,es,ea,el,a,Z,G,C,eh,I);const eu={program:N,buffers:R,uniformValues:D,atlasTexture:$,atlasTextureIcon:H,atlasInterpolation:q,atlasInterpolationIcon:X,isSDF:O,hasHalo:ec,tile:L,labelPlaneMatrixInv:ee};if(T&&B.canOverlap){E=!0;const ed=R.segments.get();for(const ep of ed)z.push({segments:new i.SegmentVector([ep]),sortKey:ep.sortKey,state:eu})}else z.push({segments:R.segments,sortKey:0,state:eu})}for(const ef of(E&&z.sort((i,r)=>i.sortKey-r.sortKey),z)){const em=ef.state;if(r.terrain&&r.terrain.setupElevationDraw(em.tile,em.program,{useDepthForOcclusion:!A,labelPlaneMatrixInv:em.labelPlaneMatrixInv}),m.activeTexture.set(_.TEXTURE0),em.atlasTexture.bind(em.atlasInterpolation,_.CLAMP_TO_EDGE),em.atlasTextureIcon&&(m.activeTexture.set(_.TEXTURE1),em.atlasTextureIcon&&em.atlasTextureIcon.bind(em.atlasInterpolationIcon,_.CLAMP_TO_EDGE)),em.isSDF){const e_=em.uniformValues;em.hasHalo&&(e_.u_is_halo=1,it(em.buffers,ef.segments,o,r,em.program,S,p,f,e_)),e_.u_is_halo=0}it(em.buffers,ef.segments,o,r,em.program,S,p,f,em.uniformValues)}}function it(r,n,o,s,a,l,c,h,u){const d=s.context;a.draw(d,d.gl.TRIANGLES,l,c,h,i.CullFaceMode.disabled,u,o.id,r.layoutVertexBuffer,r.indexBuffer,n,o.paint,s.transform.zoom,r.programConfigurations.get(o.id),r.dynamicLayoutVertexBuffer,r.opacityVertexBuffer)}function ii(r,n,o,s,a,l,c){let h,u,d,p,f;const m=r.context.gl,_=o.paint.get("fill-pattern"),g=_&&_.constantOr(1),y=o.getCrossfadeParameters();for(const x of(c?(u=g&&!o.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",h=m.LINES):(u=g?"fillPattern":"fill",h=m.TRIANGLES),s)){const v=n.getTile(x);if(g&&!v.patternsLoaded())continue;const b=v.getBucket(o);if(!b)continue;r.prepareDrawTile(x);const w=b.programConfigurations.get(o.id),T=r.useProgram(u,w);g&&(r.context.activeTexture.set(m.TEXTURE0),v.imageAtlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE),w.updatePaintBuffers(y));const E=_.constantOr(null);if(E&&v.imageAtlas){const S=v.imageAtlas,I=S.patternPositions[E.to.toString()],M=S.patternPositions[E.from.toString()];I&&M&&w.setConstantPatternPositions(I,M)}const A=r.translatePosMatrix(x.projMatrix,v,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor"));if(c){p=b.indexBuffer2,f=b.segments2;const C=r.terrain&&r.terrain.renderingToTexture?r.terrain.drapeBufferSize:[m.drawingBufferWidth,m.drawingBufferHeight];d="fillOutlinePattern"===u&&g?tZ(A,r,y,v,C):tG(A,C)}else p=b.indexBuffer,f=b.segments,d=g?tj(A,r,y,v):tN(A);r.prepareDrawProgram(r.context,T,x.toUnwrapped()),T.draw(r.context,h,a,r.stencilModeForClipping(x),l,i.CullFaceMode.disabled,d,o.id,b.layoutVertexBuffer,p,f,o.paint,r.transform.zoom,w)}}function ir(r,n,o,s,a,l,c){const h=r.context,u=h.gl,d=o.paint.get("fill-extrusion-pattern"),p=d.constantOr(1),f=o.getCrossfadeParameters(),m=o.paint.get("fill-extrusion-opacity");for(const _ of s){const g=n.getTile(_),y=g.getBucket(o);if(!y)continue;const x=y.programConfigurations.get(o.id),v=r.useProgram(p?"fillExtrusionPattern":"fillExtrusion",x);if(r.terrain){const b=r.terrain;if(!y.enableTerrain)continue;if(b.setupElevationDraw(g,v,{useMeterToDem:!0}),function(r,n,o,s,a,l){let c,h,u;const d=[r=>{let n=r.canonical.x-1,o=r.wrap;return n<0&&(n=(1<{let n=r.canonical.x+1,o=r.wrap;return n===1<new i.OverscaledTileID(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(0===r.canonical.y?1<new i.OverscaledTileID(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<{let r,o,s;const l=n.getSource().maxzoom,c=i=>{const r=n.getTileByID(i);if(r&&r.hasData())return r.getBucket(a)};return(i.overscaledZ===i.canonical.z||i.overscaledZ>=l)&&(r=c(i.key)),i.overscaledZ>=l&&(o=c(i.calculateScaledKey(i.overscaledZ+1))),i.overscaledZ>l&&(s=c(i.calculateScaledKey(i.overscaledZ-1))),r||o||s},f=[0,0,0],m=(r,n)=>(f[0]=Math.min(r.min.y,n.min.y),f[1]=Math.max(r.max.y,n.max.y),f[2]=i.EXTENT-n.min.x>r.max.x?n.min.x-i.EXTENT:r.max.x,f),_=(r,n)=>(f[0]=Math.min(r.min.x,n.min.x),f[1]=Math.max(r.max.x,n.max.x),f[2]=i.EXTENT-n.min.y>r.max.y?n.min.y-i.EXTENT:r.max.y,f),g=[(i,r)=>m(i,r),(i,r)=>m(r,i),(i,r)=>_(i,r),(i,r)=>_(r,i)],y=new i.pointGeometry(0,0),x=(r,n,s,a,d)=>{const p=[[a?s:r,a?r:s,0],[a?s:n,a?n:s,0]],f=d<0?i.EXTENT+d:d,m=[a?f:(r+n)/2,a?(r+n)/2:f,0];return 0===s&&d<0||0!==s&&d>0?l.getForTilePoints(u,[m],!0,h):p.push(m),l.getForTilePoints(o,p,!0,c),Math.max(p[0][2],p[1][2],m[2])/l.exaggeration()};for(let v=0;v<4;v++){const b=s.borders[v];if(0===b.length&&(s.borderDone[v]=!0),s.borderDone[v])continue;const w=u=d[v](o),T=p(w);if(!T||!T.enableTerrain||!(h=l.findDEMTileFor(w))||!h.dem)continue;if(!c){const E=l.findDEMTileFor(o);if(!E||!E.dem)return;c=E}const S=(v<2?1:5)-v,I=T.borders[S];let M=0;for(let A=0;Ak[0]+3);)T.borderDone[S]||T.encodeCentroid(void 0,C,!1),M++;if(C&&Mk[1]-3)&&(D++,++M!==I.length);)C=T.featuresOnBorder[I[M]];if(C=T.featuresOnBorder[I[P]],z.intersectsCount()>1||C.intersectsCount()>1||1!==D){1!==D&&(M=P),s.encodeCentroid(void 0,z,!1),T.borderDone[S]||T.encodeCentroid(void 0,C,!1);continue}const L=g[v](z,C),B=v%2?i.EXTENT-1:0;y.x=x(L[0],Math.min(i.EXTENT-1,L[1]),B,v<2,L[2]),y.y=0,s.encodeCentroid(y,z,!1),T.borderDone[S]||T.encodeCentroid(y,C,!1)}else s.encodeCentroid(void 0,z,!1)}s.borderDone[v]=s.needsCentroidUpdate=!0,T.borderDone[S]||(T.borderDone[S]=T.needsCentroidUpdate=!0)}(s.needsCentroidUpdate||!s.centroidVertexBuffer&&0!==s.centroidVertexArray.length)&&s.uploadCentroid(r)}(h,n,_,y,o,b),!y.centroidVertexBuffer){const w=v.attributes.a_centroid_pos;void 0!==w&&u.vertexAttrib2f(w,0,0)}}p&&(r.context.activeTexture.set(u.TEXTURE0),g.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),x.updatePaintBuffers(f));const T=d.constantOr(null);if(T&&g.imageAtlas){const E=g.imageAtlas,S=E.patternPositions[T.to.toString()],I=E.patternPositions[T.from.toString()];S&&I&&x.setConstantPatternPositions(S,I)}const M=r.translatePosMatrix(_.projMatrix,g,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),A=o.paint.get("fill-extrusion-vertical-gradient"),C=p?tV(M,r,A,m,_,f,g):tU(M,r,A,m);r.prepareDrawProgram(h,v,_.toUnwrapped()),v.draw(h,h.gl.TRIANGLES,a,l,c,i.CullFaceMode.backCCW,C,o.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,o.paint,r.transform.zoom,x,r.terrain?y.centroidVertexBuffer:null)}}const io=new i.Color(1,0,0,1),is=new i.Color(0,1,0,1),ia=new i.Color(0,0,1,1),il=new i.Color(1,0,1,1),ic=new i.Color(0,1,1,1);function ih(i,r,n,o){id(i,0,r+n/2,i.transform.width,n,o)}function iu(i,r,n,o){id(i,r-n/2,0,n,i.transform.height,o)}function id(r,n,o,s,a,l){const c=r.context,h=c.gl;h.enable(h.SCISSOR_TEST),h.scissor(n*i.exported.devicePixelRatio,o*i.exported.devicePixelRatio,s*i.exported.devicePixelRatio,a*i.exported.devicePixelRatio),c.clear({color:l}),h.disable(h.SCISSOR_TEST)}const ip=i.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:im}=ip;function i_(i,r,n,o){i.emplaceBack(r,n,o)}class ig{constructor(r){this.vertexArray=new i.StructArrayLayout3f12,this.indices=new i.StructArrayLayout3ui6,i_(this.vertexArray,-1,-1,1),i_(this.vertexArray,1,-1,1),i_(this.vertexArray,-1,1,1),i_(this.vertexArray,1,1,1),i_(this.vertexArray,-1,-1,-1),i_(this.vertexArray,1,-1,-1),i_(this.vertexArray,-1,1,-1),i_(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=r.createVertexBuffer(this.vertexArray,im),this.indexBuffer=r.createIndexBuffer(this.indices),this.segment=i.SegmentVector.simpleSegment(0,0,36,12)}}function iy(r,n,o,s,a,l){const c=r.gl,h=n.paint.get("sky-atmosphere-color"),u=n.paint.get("sky-atmosphere-halo-color"),d=n.paint.get("sky-atmosphere-sun-intensity"),p={u_matrix_3f:i.fromMat4([],s),u_sun_direction:a,u_sun_intensity:d,u_color_tint_r:[h.r,h.g,h.b,h.a],u_color_tint_m:[u.r,u.g,u.b,u.a],u_luminance:5e-5};c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_CUBE_MAP_POSITIVE_X+l,n.skyboxTexture,0),o.draw(r,c.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,i.ColorMode.unblended,i.CullFaceMode.frontCW,p,"skyboxCapture",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}const ix={symbol:function(r,n,o,s,a){if("translucent"!==r.renderPass)return;const l=i.StencilMode.disabled,c=r.colorModeForRenderPass();o.layout.get("text-variable-anchor")&&function(r,n,o,s,a,l,c){const h=n.transform,u="map"===a,d="map"===l,p=h.projection.createTileTransform(h,h.worldSize);for(const f of r){const m=s.getTile(f),_=m.getBucket(o);if(!_||_.projection!==h.projection.name||!_.text||!_.text.segments.get().length)continue;const g=i.evaluateSizeForZoom(_.textSizeData,h.zoom),y=n.transform.calculatePixelsToTileUnitsMatrix(m),x=eV(f.projMatrix,m.tileID.canonical,d,u,n.transform,y),v="none"!==o.layout.get("icon-text-fit")&&_.hasIconData();if(g){const b=Math.pow(2,h.zoom-m.tileID.overscaledZ);(function(r,n,o,s,a,l,c,h,u,d,p,f){const m=r.text.placedSymbolArray,_=r.text.dynamicLayoutVertexArray,g=r.icon.dynamicLayoutVertexArray,y={},x=h.projMatrix,v=l.elevation,b=v?v.getAtTileOffsetFunc(h,f):i=>[0,0,0];_.clear();for(let w=0;w=0&&(y[T.associatedIconIndex]={shiftedAnchor:F,angle:O})}else eY(T.numGlyphs,_)}if(p){g.clear();const V=r.icon.placedSymbolArray;for(let N=0;Ni.sortKey-r.sortKey);const I={useDepthForOcclusion:"globe"!==r.transform.projection.name};for(const M of _){const{programConfiguration:A,program:C,layoutVertexBuffer:z,indexBuffer:k,uniformValues:P,tile:D}=M.state,L=M.segments;r.terrain&&r.terrain.setupElevationDraw(D,C,I),r.prepareDrawProgram(u,C,D.tileID.toUnwrapped()),C.draw(u,d.TRIANGLES,p,f,m,i.CullFaceMode.disabled,P,o.id,z,k,L,o.paint,r.transform.zoom,A)}},heatmap:function(r,n,o,s){if(0!==o.paint.get("heatmap-opacity")){if("offscreen"===r.renderPass){const a=r.context,l=a.gl,c=i.StencilMode.disabled,h=new i.ColorMode([l.ONE,l.ONE],i.Color.transparent,[!0,!0,!0,!0]);(function(i,r,n){const o=i.gl;i.activeTexture.set(o.TEXTURE1),i.viewport.set([0,0,r.width/4,r.height/4]);let s=n.heatmapFbo;if(s)o.bindTexture(o.TEXTURE_2D,s.colorAttachment.get()),i.bindFramebuffer.set(s.framebuffer);else{const a=o.createTexture();o.bindTexture(o.TEXTURE_2D,a),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),s=n.heatmapFbo=i.createFramebuffer(r.width/4,r.height/4,!1),function(i,r,n,o){const s=i.gl;s.texImage2D(s.TEXTURE_2D,0,s.RGBA,r.width/4,r.height/4,0,s.RGBA,i.extRenderToTextureHalfFloat?i.extTextureHalfFloat.HALF_FLOAT_OES:s.UNSIGNED_BYTE,null),o.colorAttachment.set(n)}(i,r,a,s)}})(a,r,o),a.clear({color:i.Color.transparent});for(let u=0;u{const r=[];t0(i)&&r.push("RENDER_LINE_DASH"),i.paint.get("line-gradient")&&r.push("RENDER_LINE_GRADIENT");const n=i.paint.get("line-pattern").constantOr(1),o=1!==i.paint.get("line-opacity").constantOr(1);return!n&&o&&r.push("RENDER_LINE_ALPHA_DISCARD"),r})(o);let w=b.includes("RENDER_LINE_ALPHA_DISCARD");for(const T of(r.terrain&&r.terrain.clipOrMaskOverlapStencilType()&&(w=!1),s)){const E=n.getTile(T);if(m&&!E.patternsLoaded())continue;const S=E.getBucket(o);if(!S)continue;r.prepareDrawTile(T);const I=S.programConfigurations.get(o.id),M=r.useProgram(y,I,b),A=f.constantOr(null);if(A&&E.imageAtlas){const C=E.imageAtlas,z=C.patternPositions[A.to.toString()],k=C.patternPositions[A.from.toString()];z&&k&&I.setConstantPatternPositions(z,k)}const P=u.constantOr(null),D=p.constantOr(null);if(!m&&P&&D&&E.lineAtlas){const L=E.lineAtlas,B=L.getDash(P.to,D),R=L.getDash(P.from,D);B&&R&&I.setConstantPatternPositions(B,R)}const F=r.terrain?T.projMatrix:null,O=m?tY(r,E,o,g,F):tK(r,E,o,g,F,S.lineClipsArray.length);if(_){const U=S.gradients[o.id];let V=U.texture;if(o.gradientVersion!==U.version){let N=256;if(o.stepInterpolant){const j=n.getSource().maxzoom,G=T.canonical.z===j?Math.ceil(1<{M.draw(x,v.TRIANGLES,c,n,h,i.CullFaceMode.disabled,O,o.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,o.paint,r.transform.zoom,I,S.layoutVertexBuffer2)};if(w){const $=r.stencilModeForClipping(T).ref;0===$&&r.terrain&&x.clear({stencil:0});const q={func:v.EQUAL,mask:255};O.u_alpha_discard_threshold=.8,Z(new i.StencilMode(q,$,255,v.KEEP,v.KEEP,v.INVERT)),O.u_alpha_discard_threshold=0,Z(new i.StencilMode(q,$,255,v.KEEP,v.KEEP,v.KEEP))}else Z(r.stencilModeForClipping(T))}w&&(r.resetStencilClippingMasks(),r.terrain&&x.clear({stencil:0}))},fill:function(r,n,o,s){const a=o.paint.get("fill-color"),l=o.paint.get("fill-opacity");if(0===l.constantOr(1))return;const c=r.colorModeForRenderPass(),h=o.paint.get("fill-pattern"),u=r.opaquePassEnabledForLayer()&&!h.constantOr(1)&&1===a.constantOr(i.Color.transparent).a&&1===l.constantOr(0)?"opaque":"translucent";if(r.renderPass===u){const d=r.depthModeForSublayer(1,"opaque"===r.renderPass?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly);ii(r,n,o,s,d,c,!1)}if("translucent"===r.renderPass&&o.paint.get("fill-antialias")){const p=r.depthModeForSublayer(o.getPaintProperty("fill-outline-color")?2:0,i.DepthMode.ReadOnly);ii(r,n,o,s,p,c,!0)}},"fill-extrusion":function(r,n,o,s){const a=o.paint.get("fill-extrusion-opacity");if(0!==a&&"translucent"===r.renderPass){const l=new i.DepthMode(r.context.gl.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D);if(1!==a||o.paint.get("fill-extrusion-pattern").constantOr(1))ir(r,n,o,s,l,i.StencilMode.disabled,i.ColorMode.disabled),ir(r,n,o,s,l,r.stencilModeFor3D(),r.colorModeForRenderPass()),r.resetStencilClippingMasks();else{const c=r.colorModeForRenderPass();ir(r,n,o,s,l,i.StencilMode.disabled,c)}}},hillshade:function(r,n,o,s){if("offscreen"!==r.renderPass&&"translucent"!==r.renderPass)return;const a=r.context,l=r.depthModeForSublayer(0,i.DepthMode.ReadOnly),c=r.colorModeForRenderPass(),h=r.terrain&&r.terrain.renderingToTexture,[u,d]="translucent"!==r.renderPass||h?[{},s]:r.stencilConfigForOverlap(s);for(const p of d){const f=n.getTile(p);if(f.needsHillshadePrepare&&"offscreen"===r.renderPass)!function(r,n,o,s,a,l){const c=r.context,h=c.gl;if(!n.dem)return;const u=n.dem;if(c.activeTexture.set(h.TEXTURE1),tT(r,n,u),!n.demTexture)return;n.demTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE);const d=u.dim;c.activeTexture.set(h.TEXTURE0);let p=n.fbo;if(!p){const f=new i.Texture(c,{width:d,height:d,data:null},h.RGBA);f.bind(h.LINEAR,h.CLAMP_TO_EDGE),(p=n.fbo=c.createFramebuffer(d,d,!0)).colorAttachment.set(f.texture)}c.bindFramebuffer.set(p.framebuffer),c.viewport.set([0,0,d,d]);const{tileBoundsBuffer:m,tileBoundsIndexBuffer:_,tileBoundsSegments:g}=r.getMercatorTileBoundsBuffers();r.useProgram("hillshadePrepare").draw(c,h.TRIANGLES,s,a,l,i.CullFaceMode.disabled,((r,n)=>{const o=n.stride,s=i.create();return i.ortho(s,0,i.EXTENT,-i.EXTENT,0,0,1),i.translate(s,s,[0,-i.EXTENT,0]),{u_matrix:s,u_image:1,u_dimension:[o,o],u_zoom:r.overscaledZ,u_unpack:n.unpackVector}})(n.tileID,u),o.id,m,_,g),n.needsHillshadePrepare=!1}(r,f,o,l,i.StencilMode.disabled,c);else if("translucent"===r.renderPass){const m=h&&r.terrain?r.terrain.stencilModeForRTTOverlap(p):u[p.overscaledZ];!function(r,n,o,s,a,l,c){const h=r.context,u=h.gl,d=o.fbo;if(!d)return;r.prepareDrawTile(n);const p=r.useProgram("hillshade");h.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,d.colorAttachment.get());const f=((r,n,o,s)=>{const a=o.paint.get("hillshade-shadow-color"),l=o.paint.get("hillshade-highlight-color"),c=o.paint.get("hillshade-accent-color");let h=o.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===o.paint.get("hillshade-illumination-anchor")&&(h-=r.transform.angle);const u=!r.options.moving;return{u_matrix:s||r.transform.calculateProjMatrix(n.tileID.toUnwrapped(),u),u_image:0,u_latrange:function(r,n){const o=Math.pow(2,n.canonical.z),s=n.canonical.y;return[new i.MercatorCoordinate(0,s/o).toLngLat().lat,new i.MercatorCoordinate(0,(s+1)/o).toLngLat().lat]}(0,n.tileID),u_light:[o.paint.get("hillshade-exaggeration"),h],u_shadow:a,u_highlight:l,u_accent:c}})(r,o,s,r.terrain?n.projMatrix:null);r.prepareDrawProgram(h,p,n.toUnwrapped());const{tileBoundsBuffer:m,tileBoundsIndexBuffer:_,tileBoundsSegments:g}=r.getTileBoundsBuffers(o);p.draw(h,u.TRIANGLES,a,l,c,i.CullFaceMode.disabled,f,s.id,m,_,g)}(r,p,f,o,l,m,c)}}a.viewport.set([0,0,r.width,r.height]),r.resetStencilClippingMasks()},raster:function(r,n,o,s,a,l){if("translucent"!==r.renderPass||0===o.paint.get("raster-opacity")||!s.length)return;const c=r.context,h=c.gl,u=n.getSource(),d=r.useProgram("raster"),p=r.colorModeForRenderPass(),f=r.terrain&&r.terrain.renderingToTexture,[m,_]=u instanceof ew||f?[{},s]:r.stencilConfigForOverlap(s),g=_[_.length-1].overscaledZ,y=!r.options.moving;for(const x of _){let v,b;const w=f?i.DepthMode.disabled:r.depthModeForSublayer(x.overscaledZ-g,1===o.paint.get("raster-opacity")?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly,h.LESS),T=x.toUnwrapped(),E=n.getTile(x);if(f&&(!E||!E.hasData()))continue;const S=f?x.projMatrix:r.transform.calculateProjMatrix(T,y),I=r.terrain&&f?r.terrain.stencilModeForRTTOverlap(x):m[x.overscaledZ],M=l?0:o.paint.get("raster-fade-duration");E.registerFadeDuration(M);const A=n.findLoadedParent(x,0),C=tk(E,A,n,r.transform,M);r.terrain&&r.terrain.prepareDrawTile(x);const z="nearest"===o.paint.get("raster-resampling")?h.NEAREST:h.LINEAR;c.activeTexture.set(h.TEXTURE0),E.texture.bind(z,h.CLAMP_TO_EDGE),c.activeTexture.set(h.TEXTURE1),A?(A.texture.bind(z,h.CLAMP_TO_EDGE),v=Math.pow(2,A.tileID.overscaledZ-E.tileID.overscaledZ),b=[E.tileID.canonical.x*v%1,E.tileID.canonical.y*v%1]):E.texture.bind(z,h.CLAMP_TO_EDGE);const k=t1(S,b||[0,0],v||1,C,o,u instanceof ew?u.perspectiveTransform:[0,0]);if(r.prepareDrawProgram(c,d,T),u instanceof ew)d.draw(c,h.TRIANGLES,w,i.StencilMode.disabled,p,i.CullFaceMode.disabled,k,o.id,u.boundsBuffer,r.quadTriangleIndexBuffer,u.boundsSegments);else{const{tileBoundsBuffer:P,tileBoundsIndexBuffer:D,tileBoundsSegments:L}=r.getTileBoundsBuffers(E);d.draw(c,h.TRIANGLES,w,I,p,i.CullFaceMode.disabled,k,o.id,P,D,L)}}r.resetStencilClippingMasks()},background:function(r,n,o,s){const a=o.paint.get("background-color"),l=o.paint.get("background-opacity");if(0===l)return;const c=r.context,h=c.gl,u=r.transform,d=u.tileSize,p=o.paint.get("background-pattern");if(r.isPatternMissing(p))return;const f=!p&&1===a.a&&1===l&&r.opaquePassEnabledForLayer()?"opaque":"translucent";if(r.renderPass!==f)return;const m=i.StencilMode.disabled,_=r.depthModeForSublayer(0,"opaque"===f?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly),g=r.colorModeForRenderPass(),y=r.useProgram(p?"backgroundPattern":"background");let x,v=s;v||(v=Object.values(x=r.getBackgroundTiles()).map(i=>i.tileID)),p&&(c.activeTexture.set(h.TEXTURE0),r.imageManager.bind(r.context));const b=o.getCrossfadeParameters();for(const w of v){const T=w.toUnwrapped(),E=s?w.projMatrix:r.transform.calculateProjMatrix(T);r.prepareDrawTile(w);const S=n?n.getTile(w):x?x[w.key]:new i.Tile(w,d,u.zoom,r),I=p?t6(E,l,r,p,{tileID:w,tileSize:d},b):t4(E,l,a);r.prepareDrawProgram(c,y,T);const{tileBoundsBuffer:M,tileBoundsIndexBuffer:A,tileBoundsSegments:C}=r.getTileBoundsBuffers(S);y.draw(c,h.TRIANGLES,_,m,g,i.CullFaceMode.disabled,I,o.id,M,A,C)}},sky:function(r,n,o){const s=r.transform,a="mercator"===s.projection.name||"globe"===s.projection.name?1:i.smoothstep(7,8,s.zoom),l=o.paint.get("sky-opacity")*a;if(0===l)return;const c=r.context,h=o.paint.get("sky-type"),u=new i.DepthMode(c.gl.LEQUAL,i.DepthMode.ReadOnly,[0,1]),d=r.frameCounter/1e3%1;"atmosphere"===h?"offscreen"===r.renderPass?o.needsSkyboxCapture(r)&&(function(r,n,o,s){const a=r.context,l=a.gl;let c=n.skyboxFbo;if(!c){c=n.skyboxFbo=a.createFramebuffer(32,32,!1),n.skyboxGeometry=new ig(a),n.skyboxTexture=a.gl.createTexture(),l.bindTexture(l.TEXTURE_CUBE_MAP,n.skyboxTexture),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MIN_FILTER,l.LINEAR),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MAG_FILTER,l.LINEAR);for(let h=0;h<6;++h)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,l.RGBA,32,32,0,l.RGBA,l.UNSIGNED_BYTE,null)}a.bindFramebuffer.set(c.framebuffer),a.viewport.set([0,0,32,32]);const u=n.getCenter(r,!0),d=r.useProgram("skyboxCapture"),p=new Float64Array(16);i.identity(p),i.rotateY(p,p,-(.5*Math.PI)),iy(a,n,d,p,u,0),i.identity(p),i.rotateY(p,p,.5*Math.PI),iy(a,n,d,p,u,1),i.identity(p),i.rotateX(p,p,-(.5*Math.PI)),iy(a,n,d,p,u,2),i.identity(p),i.rotateX(p,p,.5*Math.PI),iy(a,n,d,p,u,3),i.identity(p),iy(a,n,d,p,u,4),i.identity(p),i.rotateY(p,p,Math.PI),iy(a,n,d,p,u,5),a.viewport.set([0,0,r.width,r.height])}(r,o),o.markSkyboxValid(r)):"sky"===r.renderPass&&function(r,n,o,s,a){const l=r.context,c=l.gl,h=r.transform,u=r.useProgram("skybox");l.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_CUBE_MAP,n.skyboxTexture);const d={u_matrix:h.skyboxMatrix,u_sun_direction:n.getCenter(r,!1),u_cubemap:0,u_opacity:s,u_temporal_offset:a};r.prepareDrawProgram(l,u),u.draw(l,c.TRIANGLES,o,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.backCW,d,"skybox",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}(r,o,u,l,d):"gradient"===h&&"sky"===r.renderPass&&function(r,n,o,s,a){var l,c,h;const u=r.context,d=u.gl,p=r.transform,f=r.useProgram("skyboxGradient");n.skyboxGeometry||(n.skyboxGeometry=new ig(u)),u.activeTexture.set(d.TEXTURE0);let m=n.colorRampTexture;m||(m=n.colorRampTexture=new i.Texture(u,n.colorRamp,d.RGBA)),m.bind(d.LINEAR,d.CLAMP_TO_EDGE);const _=(l=p.skyboxMatrix,c=n.getCenter(r,!1),h=n.paint.get("sky-gradient-radius"),{u_matrix:l,u_color_ramp:0,u_center_direction:c,u_radius:i.degToRad(h),u_opacity:s,u_temporal_offset:a});r.prepareDrawProgram(u,f),f.draw(u,d.TRIANGLES,o,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.backCW,_,"skyboxGradient",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}(r,o,u,l,d)},debug:function(r,n,o){for(let s=0;s ${o.overscaledZ}`),function(i,r){i.initDebugOverlayCanvas();const n=i.debugOverlayCanvas,o=i.context.gl,s=i.debugOverlayCanvas.getContext("2d");s.clearRect(0,0,n.width,n.height),s.shadowColor="white",s.shadowBlur=2,s.lineWidth=1.5,s.strokeStyle="white",s.textBaseline="top",s.font="bold 36px Open Sans, sans-serif",s.fillText(r,5,5),s.strokeText(r,5,5),i.debugOverlayTexture.update(n),i.debugOverlayTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE)}(r,`${w} ${x}kb`),c.draw(s,a.TRIANGLES,u,d,i.ColorMode.alphaBlended,i.CullFaceMode.disabled,tW(l,i.Color.transparent,b),f,r.debugBuffer,r.quadTriangleIndexBuffer,r.debugSegments)}(r,n,o[s])},custom:function(r,n,o){const s=r.context,a=o.implementation;if(r.transform.projection.unsupportedLayers&&r.transform.projection.unsupportedLayers.includes("custom"))i.warnOnce("Custom layers are not yet supported with non-mercator projections. Use mercator to enable custom layers.");else if("offscreen"===r.renderPass){const l=a.prerender;l&&(r.setCustomLayerDefaults(),s.setColorMode(r.colorModeForRenderPass()),l.call(a,s.gl,r.transform.customLayerMatrix()),s.setDirty(),r.setBaseState())}else if("translucent"===r.renderPass){r.setCustomLayerDefaults(),s.setColorMode(r.colorModeForRenderPass()),s.setStencilMode(i.StencilMode.disabled);const c="3d"===a.renderingMode?new i.DepthMode(r.context.gl.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D):r.depthModeForSublayer(0,i.DepthMode.ReadOnly);s.setDepthMode(c),a.render(s.gl,r.transform.customLayerMatrix()),s.setDirty(),r.setBaseState(),s.bindFramebuffer.set(null)}}};class iv{constructor(r,n){this.context=new e_(r),this.transform=n,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.setup(),this.numSublayers=i.SourceCache.maxUnderzooming+i.SourceCache.maxOverzooming+1,this.depthEpsilon=1/65536,this.crossTileSymbolIndex=new tl,this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={}}updateTerrain(i,r){const n=!!i&&!!i.terrain&&this.transform.projection.supportsTerrain;if(!(n||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new tB(this,i));const o=this._terrain;this.transform.elevation=n?o:null,o.update(i,this.transform,r)}_updateFog(i){const r=i.fog;if(!r||1>r.getOpacity(this.transform.pitch)||.03>r.properties.get("horizon-blend"))return void(this.transform.fogCullDistSq=null);const[n,o]=r.getFovAdjustedRange(this.transform._fov);if(n>o)return void(this.transform.fogCullDistSq=null);const s=n+.78*(o-n);this.transform.fogCullDistSq=s*s}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(r,n){if(this.width=r*i.exported.devicePixelRatio,this.height=n*i.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const o of this.style.order)this.style._layers[o].resize()}setup(){const r=this.context,n=new i.StructArrayLayout2i4;n.emplaceBack(0,0),n.emplaceBack(i.EXTENT,0),n.emplaceBack(0,i.EXTENT),n.emplaceBack(i.EXTENT,i.EXTENT),this.tileExtentBuffer=r.createVertexBuffer(n,i.posAttributes.members),this.tileExtentSegments=i.SegmentVector.simpleSegment(0,0,4,2);const o=new i.StructArrayLayout2i4;o.emplaceBack(0,0),o.emplaceBack(i.EXTENT,0),o.emplaceBack(0,i.EXTENT),o.emplaceBack(i.EXTENT,i.EXTENT),this.debugBuffer=r.createVertexBuffer(o,i.posAttributes.members),this.debugSegments=i.SegmentVector.simpleSegment(0,0,4,5);const s=new i.StructArrayLayout2i4;s.emplaceBack(-1,-1),s.emplaceBack(1,-1),s.emplaceBack(-1,1),s.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(s,i.posAttributes.members),this.viewportSegments=i.SegmentVector.simpleSegment(0,0,4,2);const a=new i.StructArrayLayout4i8;a.emplaceBack(0,0,0,0),a.emplaceBack(i.EXTENT,0,i.EXTENT,0),a.emplaceBack(0,i.EXTENT,0,i.EXTENT),a.emplaceBack(i.EXTENT,i.EXTENT,i.EXTENT,i.EXTENT),this.mercatorBoundsBuffer=r.createVertexBuffer(a,i.boundsAttributes.members),this.mercatorBoundsSegments=i.SegmentVector.simpleSegment(0,0,4,2);const l=new i.StructArrayLayout3ui6;l.emplaceBack(0,1,2),l.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(l);const c=new i.StructArrayLayout1ui2;for(const h of[0,1,3,2,0])c.emplaceBack(h);this.debugIndexBuffer=r.createIndexBuffer(c),this.emptyTexture=new i.Texture(r,{width:1,height:1,data:new Uint8Array([0,0,0,0])},r.gl.RGBA),this.identityMat=i.create();const u=this.context.gl;this.stencilClearMode=new i.StencilMode({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.loadTimeStamps.push(i.window.performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(i){return i._makeTileBoundsBuffers(this.context,this.transform.projection),i._tileBoundsBuffer?{tileBoundsBuffer:i._tileBoundsBuffer,tileBoundsIndexBuffer:i._tileBoundsIndexBuffer,tileBoundsSegments:i._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const r=this.context,n=r.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(r,n.TRIANGLES,i.DepthMode.disabled,this.stencilClearMode,i.ColorMode.disabled,i.CullFaceMode.disabled,tz(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(r,n,o){if(!n||this.currentStencilSource===n.id||!r.isTileClipped()||!o||0===o.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let s=!1;for(const a of o)if(void 0===this._tileClippingMaskIDs[a.key]){s=!0;break}if(!s)return}this.currentStencilSource=n.id;const l=this.context,c=l.gl;this.nextStencilID+o.length>256&&this.clearStencil(),l.setColorMode(i.ColorMode.disabled),l.setDepthMode(i.DepthMode.disabled);const h=this.useProgram("clippingMask");for(const u of(this._tileClippingMaskIDs={},o)){const d=n.getTile(u),p=this._tileClippingMaskIDs[u.key]=this.nextStencilID++,{tileBoundsBuffer:f,tileBoundsIndexBuffer:m,tileBoundsSegments:_}=this.getTileBoundsBuffers(d);h.draw(l,c.TRIANGLES,i.DepthMode.disabled,new i.StencilMode({func:c.ALWAYS,mask:0},p,255,c.KEEP,c.KEEP,c.REPLACE),i.ColorMode.disabled,i.CullFaceMode.disabled,tz(u.projMatrix),"$clipping",f,m,_)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const r=this.nextStencilID++,n=this.context.gl;return new i.StencilMode({func:n.NOTEQUAL,mask:255},r,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(r){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(r);const n=this.context.gl;return new i.StencilMode({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(r){const n=this.context.gl,o=r.sort((i,r)=>r.overscaledZ-i.overscaledZ),s=o[o.length-1].overscaledZ,a=o[0].overscaledZ-s+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();const l={};for(let c=0;c=0;this.currentLayer--){const v=this.style._layers[o[this.currentLayer]],b=r._getLayerSourceCache(v);if(v.isSky())continue;const w=b?h[b.id]:void 0;this._renderTileClippingMasks(v,b,w),this.renderLayer(this,b,v,w)}if(this.renderPass="sky",(i.globeToMercatorTransition(this.transform.zoom)>0||"globe"!==this.transform.projection.name)&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer{const n=r._getLayerSourceCache(i);n&&!i.isHidden(this.transform.zoom)&&(!A||A.getSource().maxzoom0?r.pop():null}isPatternMissing(i){if(!i)return!1;if(!i.from||!i.to)return!0;const r=this.imageManager.getPattern(i.from.toString()),n=this.imageManager.getPattern(i.to.toString());return!r||!n}currentGlobalDefines(){const i=this.terrain&&this.terrain.renderingToTexture,r=this.style&&this.style.fog,n=[];return this.terrain&&!this.terrain.renderingToTexture&&n.push("TERRAIN"),r&&!i&&0!==r.getOpacity(this.transform.pitch)&&n.push("FOG"),i&&n.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&n.push("OVERDRAW_INSPECTOR"),n}useProgram(i,r,n){this.cache=this.cache||{};const o=this.currentGlobalDefines().concat(n||[]),s=tF.cacheKey(i,o,r);return this.cache[s]||(this.cache[s]=new tF(this.context,i,tv[i],r,t8[i],o)),this.cache[s]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=i.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new i.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}prepareDrawTile(i){this.terrain&&this.terrain.prepareDrawTile(i)}prepareDrawProgram(i,r,n){if(this.terrain&&this.terrain.renderingToTexture)return;const o=this.style.fog;if(o){const s=o.getOpacity(this.transform.pitch);0!==s&&r.setFogUniformValues(i,((i,r,n,o)=>{const s=r.properties.get("color"),a=i.frameCounter/1e3%1,l=[s.r/s.a,s.g/s.a,s.b/s.a,o];return{u_fog_matrix:n?i.transform.calculateFogTileMatrix(n):i.identityMat,u_fog_range:r.getFovAdjustedRange(i.transform._fov),u_fog_color:l,u_fog_horizon_blend:r.properties.get("horizon-blend"),u_fog_temporal_offset:a}})(this,o,n,s))}}setTileLoadedFlag(i){this.tileLoaded=i}saveCanvasCopy(){this.frameCopies.push(this.canvasCopy()),this.tileLoaded=!1}canvasCopy(){const i=this.context.gl,r=i.createTexture();return i.bindTexture(i.TEXTURE_2D,r),i.copyTexImage2D(i.TEXTURE_2D,0,i.RGBA,0,0,i.drawingBufferWidth,i.drawingBufferHeight,0),r}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const i=this.style&&this.style.fog;return!!i&&0!==i.getOpacity(this.transform.pitch)}getBackgroundTiles(){const r=this._backgroundTiles,n=this._backgroundTiles={},o=this.transform.coveringTiles({tileSize:512});for(const s of o)n[s.key]=r[s.key]||new i.Tile(s,512,this.transform.tileZoom,this);return n}clearBackgroundTiles(){this._backgroundTiles={}}}class ib{constructor(i=0,r=0,n=0,o=0){if(isNaN(i)||i<0||isNaN(r)||r<0||isNaN(n)||n<0||isNaN(o)||o<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=r,this.left=n,this.right=o}interpolate(r,n,o){return null!=n.top&&null!=r.top&&(this.top=i.number(r.top,n.top,o)),null!=n.bottom&&null!=r.bottom&&(this.bottom=i.number(r.bottom,n.bottom,o)),null!=n.left&&null!=r.left&&(this.left=i.number(r.left,n.left,o)),null!=n.right&&null!=r.right&&(this.right=i.number(r.right,n.right,o)),this}getCenter(r,n){const o=i.clamp((this.left+r-this.right)/2,0,r),s=i.clamp((this.top+n-this.bottom)/2,0,n);return new i.pointGeometry(o,s)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new ib(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function iw(r,n){const o=i.getColumn(r,3);i.fromQuat(r,n),i.setColumn(r,3,o)}function iT(r,n){i.setColumn(r,3,[n[0],n[1],n[2],1])}function iE(r,n){const o=i.identity$1([]);return i.rotateZ$1(o,o,-n),i.rotateX$1(o,o,-r),o}function iS(r,n){const o=[r[0],r[1],0],s=[n[0],n[1],0];if(i.length(o)>=1e-15){const a=i.normalize([],o);i.scale$2(s,a,i.dot(s,a)),n[0]=s[0],n[1]=s[1]}const l=i.cross([],n,r);if(1e-15>i.len(l))return null;const c=Math.atan2(-l[1],l[0]);return iE(Math.atan2(Math.sqrt(r[0]*r[0]+r[1]*r[1]),-r[2]),c)}class iI{constructor(i,r){this.position=i,this.orientation=r}get position(){return this._position}set position(r){this._position=this._renderWorldCopies?function(r){if(!r)return;const n=Array.isArray(r)?new i.MercatorCoordinate(r[0],r[1],r[2]):r;return n.x=i.wrap(n.x,0,1),n}(r):r}lookAtPoint(r,n){if(this.orientation=null,!this.position)return;const o=this._elevation?this._elevation.getAtPointOrZero(i.MercatorCoordinate.fromLngLat(r)):0,s=this.position,a=i.MercatorCoordinate.fromLngLat(r,o),l=[a.x-s.x,a.y-s.y,a.z-s.z];n||(n=[0,0,1]),n[2]=Math.abs(n[2]),this.orientation=iS(l,n)}setPitchBearing(r,n){this.orientation=iE(i.degToRad(r),i.degToRad(-n))}}class iM{constructor(r,n){this._transform=i.identity([]),this._orientation=i.identity$1([]),n&&(this._orientation=n,iw(this._transform,this._orientation)),r&&iT(this._transform,r)}get mercatorPosition(){const r=this.position;return new i.MercatorCoordinate(r[0],r[1],r[2])}get position(){const r=i.getColumn(this._transform,3);return[r[0],r[1],r[2]]}set position(i){iT(this._transform,i)}get orientation(){return this._orientation}set orientation(i){this._orientation=i,iw(this._transform,this._orientation)}getPitchBearing(){const i=this.forward(),r=this.right();return{bearing:Math.atan2(-r[1],r[0]),pitch:Math.atan2(Math.sqrt(i[0]*i[0]+i[1]*i[1]),-i[2])}}setPitchBearing(i,r){this._orientation=iE(i,r),iw(this._transform,this._orientation)}forward(){const r=i.getColumn(this._transform,2);return[-r[0],-r[1],-r[2]]}up(){const r=i.getColumn(this._transform,1);return[-r[0],-r[1],-r[2]]}right(){const r=i.getColumn(this._transform,0);return[r[0],r[1],r[2]]}getCameraToWorld(r,n){const o=new Float64Array(16);return i.invert(o,this.getWorldToCamera(r,n)),o}getWorldToCameraPosition(r,n,o){const s=this.position;i.scale$2(s,s,-r);const a=new Float64Array(16);return i.fromScaling(a,[o,o,o]),i.translate(a,a,s),a[10]*=n,a}getWorldToCamera(r,n){const o=new Float64Array(16),s=new Float64Array(4),a=this.position;return i.conjugate(s,this._orientation),i.scale$2(a,a,-r),i.fromQuat(o,s),i.translate(o,o,a),o[1]*=-1,o[5]*=-1,o[9]*=-1,o[13]*=-1,o[8]*=n,o[9]*=n,o[10]*=n,o[11]*=n,o}getCameraToClipPerspective(r,n,o,s){const a=new Float64Array(16);return i.perspective(a,r,n,o,s),a}getDistanceToElevation(r){const n=0===r?0:i.mercatorZfromAltitude(r,this.position[1]),o=this.forward();return(n-this.position[2])/o[2]}clone(){return new iM([...this.position],[...this.orientation])}}function iA(r,n){const o=iz(r),s=function(r,n,o,s,a){const l=new i.LngLat(o.lng-180*ik,o.lat),c=new i.LngLat(o.lng+180*ik,o.lat),h=r.project(l.lng,l.lat),u=r.project(c.lng,c.lat),d=-Math.atan2(u.y-h.y,u.x-h.x),p=i.MercatorCoordinate.fromLngLat(o);p.y=i.clamp(p.y,-.999975,.999975);const f=p.toLngLat(),m=r.project(f.lng,f.lat),_=i.MercatorCoordinate.fromLngLat(f);_.x+=ik;const g=_.toLngLat(),y=r.project(g.lng,g.lat),x=iD(y.x-m.x,y.y-m.y,d),v=i.MercatorCoordinate.fromLngLat(f);v.y+=ik;const b=v.toLngLat(),w=r.project(b.lng,b.lat),T=iD(w.x-m.x,w.y-m.y,d),E=Math.abs(x.x)/Math.abs(T.y),S=i.identity([]);i.rotateZ(S,S,-d*(1-(a?0:s)));const I=i.identity([]);return i.scale(I,I,[1,1-(1-E)*s,1]),I[4]=-T.x/T.y*s,i.rotateZ(I,I,d),i.multiply$1(I,S,I),I}(r.projection,0,r.center,o,n),a=iC(r);return i.scale(s,s,[a,a,1]),s}function iC(r){const n=r.projection,o=iz(r),s=iP(n,r.center),a=iP(n,i.LngLat.convert(n.center));return Math.pow(2,s*o+(1-o)*a)}function iz(r){const n=r.projection.range;if(!n)return 0;const o=Math.max(r.width,r.height),s=Math.log(o/1024)/Math.LN2;return i.smoothstep(n[0]+s,n[1]+s,r.zoom)}const ik=1/4e4;function iP(r,n){const o=i.clamp(n.lat,-i.MAX_MERCATOR_LATITUDE,i.MAX_MERCATOR_LATITUDE),s=new i.LngLat(n.lng-180*ik,o),a=new i.LngLat(n.lng+180*ik,o),l=r.project(s.lng,o),c=r.project(a.lng,o),h=i.MercatorCoordinate.fromLngLat(s),u=i.MercatorCoordinate.fromLngLat(a),d=c.x-l.x,p=c.y-l.y,f=u.x-h.x,m=u.y-h.y,_=Math.sqrt((f*f+m*m)/(d*d+p*p));return Math.log(_)/Math.LN2}function iD(i,r,n){const o=Math.cos(n),s=Math.sin(n);return{x:i*o-r*s,y:i*s+r*o}}class iL{constructor(r,n,o,s,a){this.tileSize=512,this._renderWorldCopies=void 0===a||a,this._minZoom=r||0,this._maxZoom=n||22,this._minPitch=null==o?0:o,this._maxPitch=null==s?60:s,this.setProjection(),this.setMaxBounds(),this.width=0,this.height=0,this._center=new i.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new ib,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new iM,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._projectionScaler=1,this._horizonShift=.1}clone(){const i=new iL(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return i.setProjection(this.getProjection()),i._elevation=this._elevation,i._centerAltitude=this._centerAltitude,i.tileSize=this.tileSize,i.setMaxBounds(this.getMaxBounds()),i.width=this.width,i.height=this.height,i.cameraElevationReference=this.cameraElevationReference,i._center=this._center,i._setZoom(this.zoom),i._cameraZoom=this._cameraZoom,i.angle=this.angle,i._fov=this._fov,i._pitch=this._pitch,i._nearZ=this._nearZ,i._farZ=this._farZ,i._averageElevation=this._averageElevation,i._unmodified=this._unmodified,i._edgeInsets=this._edgeInsets.clone(),i._camera=this._camera.clone(),i._calcMatrices(),i.freezeTileCoverage=this.freezeTileCoverage,i}get elevation(){return this._elevation}set elevation(i){this._elevation!==i&&(this._elevation=i,i?this._updateCenterElevation()&&this._updateCameraOnTerrain():(this._cameraZoom=null,this._centerAltitude=0),this._calcMatrices())}updateElevation(i){this._terrainEnabled()&&null==this._cameraZoom&&this._updateCenterElevation()&&this._updateCameraOnTerrain(),i&&this._constrainCameraAltitude(),this._calcMatrices()}getProjection(){return i.pick(this.projection,["name","center","parallels"])}setProjection(r){null==r&&(r={name:"mercator"}),this.projectionOptions=r;const n=this.projection?this.getProjection():void 0;return this.projection=i.getProjection(r),!h(n,this.getProjection())&&(this._calcMatrices(),!0)}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(i){void 0===i?i=!0:null===i&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get cameraWorldSize(){const i=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(i))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.cameraWorldSize)}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new i.pointGeometry(this.width,this.height)}get bearing(){return i.wrap(this.rotation,-180,180)}set bearing(i){this.rotation=i}get rotation(){return-this.angle/Math.PI*180}set rotation(r){var n,o,s,a,l,c,h,u,d,p;const f=-r*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=(n=new i.ARRAY_TYPE(4),i.ARRAY_TYPE!=Float32Array&&(n[1]=0,n[2]=0),n[0]=1,n[3]=1,n),o=this.rotationMatrix,s=this.rotationMatrix,a=this.angle,l=s[0],c=s[1],h=s[2],u=s[3],d=Math.sin(a),p=Math.cos(a),o[0]=l*p+h*d,o[1]=c*p+u*d,o[2]=-(l*d)+h*p,o[3]=-(c*d)+u*p)}get pitch(){return this._pitch/Math.PI*180}set pitch(r){const n=i.clamp(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=i/180*Math.PI,this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(i){this._averageElevation=i,this._calcFogMatrices()}get zoom(){return this._zoom}set zoom(i){const r=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==r&&(this._unmodified=!1,this._setZoom(r),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._constrain(),this._calcMatrices())}_setZoom(i){this._zoom=i,this.scale=this.zoomScale(i),this.tileZoom=Math.floor(i),this.zoomFraction=i-this.tileZoom}_updateCenterElevation(){if(!this._elevation)return!1;const i=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center),-1);return -1===i?(this._cameraZoom=null,!1):(this._centerAltitude=i,!0)}_updateCameraOnTerrain(){this._cameraZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize)}sampleAverageElevation(){if(!this._elevation)return 0;const r=this._elevation,n=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],o=this.horizonLineFromTop();let s=0,a=0;for(let l=0;lr.maxzoom&&(n=r.maxzoom);const l=this.locationCoordinate(this.center),c=1<{const n=1/4e4,o=new i.MercatorCoordinate(r.x+n,r.y,r.z),s=new i.MercatorCoordinate(r.x,r.y+n,r.z),a=r.toLngLat(),l=o.toLngLat(),c=s.toLngLat(),h=this.locationCoordinate(a),u=this.locationCoordinate(l),d=this.locationCoordinate(c),p=Math.hypot(u.x-h.x,u.y-h.y),f=Math.hypot(d.x-h.x,d.y-h.y);return Math.sqrt(p*f)*v/n},w=r=>({aabb:i.tileAABB(this,c,0,0,0,r,x,y,this.projection),zoom:0,x:0,y:0,minZ:x,maxZ:y,wrap:r,fullyVisible:!1}),T=[];let E=[];const S=n,I=r.reparseOverscaled?o:n,M=i=>i*i,A=M((f-this._centerAltitude)*p),C=i=>{if(!this._elevation||!i.tileID||!a)return;const r=this._elevation.getMinMaxForTile(i.tileID),n=i.aabb;r?(n.min[2]=r.min,n.max[2]=r.max,n.center[2]=(n.min[2]+n.max[2])/2):(i.shouldSplit=z(i),i.shouldSplit||(n.min[2]=n.max[2]=n.center[2]=this._centerAltitude))},z=r=>{if(r.zoom.85?1:u}const d=n*n+a*a+l;return d{if(r*M(.707)0;){const P=T.pop(),D=P.x,L=P.y;let B=P.fullyVisible;if(!B){const R=P.aabb.intersects(u);if(0===R)continue;B=2===R}if(P.zoom!==S&&z(P))for(let F=0;F<4;F++){const O=(D<<1)+F%2,U=(L<<1)+(F>>1),V={aabb:a?P.aabb.quadrant(F):i.tileAABB(this,c,P.zoom+1,O,U,P.wrap,P.minZ,P.maxZ,this.projection),zoom:P.zoom+1,x:O,y:U,wrap:P.wrap,fullyVisible:B,tileID:void 0,shouldSplit:void 0,minZ:P.minZ,maxZ:P.maxZ};s&&(V.tileID=new i.OverscaledTileID(P.zoom+1===S?I:P.zoom+1,P.wrap,P.zoom+1,O,U),C(V)),T.push(V)}else{const N=P.zoom===S?I:P.zoom;if(r.minzoom&&r.minzoom>N)continue;const j=h[0]-(.5+D+(P.wrap<{const o=[0,0,0,1],s=[i.EXTENT,i.EXTENT,0,1],a=this.calculateFogTileMatrix(n.tileID.toUnwrapped());i.transformMat4$1(o,o,a),i.transformMat4$1(s,s,a);const l=i.getAABBPointSquareDist(o,s);if(0===l)return!0;let c=!1;const h=this._elevation;if(h&&l>$&&0!==q){let u;const d=this.calculateProjMatrix(n.tileID.toUnwrapped());r.isTerrainDEM||(u=h.getMinMaxForTile(n.tileID)),u||(u={min:x,max:y});const p=i.furthestTileCorner(this.rotation),f=[p[0]*i.EXTENT,p[1]*i.EXTENT,u.max];i.transformMat4(f,f,d),c=(1-f[1])*this.height*.5i.distanceSq-r.distanceSq).map(i=>i.tileID)}resize(i,r){this.width=i,this.height=r,this.pixelsToGLUnits=[2/i,-2/r],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log(i)/Math.LN2}project(r){const n=i.clamp(r.lat,-i.MAX_MERCATOR_LATITUDE,i.MAX_MERCATOR_LATITUDE),o=this.projection.project(r.lng,n);return new i.pointGeometry(o.x*this.worldSize,o.y*this.worldSize)}unproject(i){return this.projection.unproject(i.x/this.worldSize,i.y/this.worldSize)}get point(){return this.project(this.center)}setLocationAtPoint(r,n){const o=this.pointCoordinate(n),s=this.pointCoordinate(this.centerPoint),a=this.locationCoordinate(r);this.setLocation(new i.MercatorCoordinate(a.x-(o.x-s.x),a.y-(o.y-s.y)))}setLocation(i){this.center=this.coordinateLocation(i),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(i){return this.projection.locationPoint(this,i)}locationPoint3D(i){return this._coordinatePoint(this.locationCoordinate(i),!0)}pointLocation(i){return this.coordinateLocation(this.pointCoordinate(i))}pointLocation3D(i){return this.coordinateLocation(this.pointCoordinate3D(i))}locationCoordinate(r,n){const o=n?i.mercatorZfromAltitude(n,r.lat):void 0,s=this.projection.project(r.lng,r.lat);return new i.MercatorCoordinate(s.x,s.y,o)}coordinateLocation(i){return this.projection.unproject(i.x,i.y)}pointRayIntersection(r,n){const o=null!=n?n:this._centerAltitude,s=[r.x,r.y,0,1],a=[r.x,r.y,1,1];i.transformMat4$1(s,s,this.pixelMatrixInverse),i.transformMat4$1(a,a,this.pixelMatrixInverse);const l=a[3];i.scale$1(s,s,1/s[3]),i.scale$1(a,a,1/l);const c=s[2],h=a[2];return{p0:s,p1:a,t:c===h?0:(o-c)/(h-c)}}screenPointToMercatorRay(r){const n=[r.x,r.y,0,1],o=[r.x,r.y,1,1];return i.transformMat4$1(n,n,this.pixelMatrixInverse),i.transformMat4$1(o,o,this.pixelMatrixInverse),i.scale$1(n,n,1/n[3]),i.scale$1(o,o,1/o[3]),n[2]=i.mercatorZfromAltitude(n[2],this._center.lat)*this.worldSize,o[2]=i.mercatorZfromAltitude(o[2],this._center.lat)*this.worldSize,i.scale$1(n,n,1/this.worldSize),i.scale$1(o,o,1/this.worldSize),new i.Ray([n[0],n[1],n[2]],i.normalize([],i.sub([],o,n)))}rayIntersectionCoordinate(r){const{p0:n,p1:o,t:s}=r,a=i.mercatorZfromAltitude(n[2],this._center.lat),l=i.mercatorZfromAltitude(o[2],this._center.lat);return new i.MercatorCoordinate(i.number(n[0],o[0],s)/this.worldSize,i.number(n[1],o[1],s)/this.worldSize,i.number(a,l,s))}pointCoordinate(i,r=this._centerAltitude){return this.projection.createTileTransform(this,this.worldSize).pointCoordinate(i.x,i.y,r)}pointCoordinate3D(r){if(!this.elevation)return this.pointCoordinate(r);const n=this.elevation;let o=this.elevation.pointCoordinate(r);if(o)return new i.MercatorCoordinate(o[0],o[1],o[2]);let s=0,a=this.horizonLineFromTop();if(r.y>a)return this.pointCoordinate(r);const l=.02*a,c=r.clone();for(let h=0;h<10&&a-s>l;h++){c.y=i.number(s,a,.66);const u=n.pointCoordinate(c);u?(a=c.y,o=u):s=c.y}return o?new i.MercatorCoordinate(o[0],o[1],o[2]):this.pointCoordinate(r)}isPointAboveHorizon(i){if(this.elevation)return!this.elevation.pointCoordinate(i);{const r=this.horizonLineFromTop();return i.y0?new i.pointGeometry(s[0]/s[3],s[1]/s[3]):new i.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}_getBounds(r,n){var o,s,a,l;const c=new i.pointGeometry(this._edgeInsets.left,this._edgeInsets.top),h=new i.pointGeometry(this.width-this._edgeInsets.right,this._edgeInsets.top),u=new i.pointGeometry(this.width-this._edgeInsets.right,this.height-this._edgeInsets.bottom),d=new i.pointGeometry(this._edgeInsets.left,this.height-this._edgeInsets.bottom);let p=this.pointCoordinate(c,r),f=this.pointCoordinate(h,r);const m=this.pointCoordinate(u,n),_=this.pointCoordinate(d,n);return p.y>1&&f.y>=0?p=new i.MercatorCoordinate((1-_.y)/(((o=p).y-_.y)/(o.x-_.x))+_.x,1):p.y<0&&f.y<=1&&(p=new i.MercatorCoordinate(-_.y/(((s=p).y-_.y)/(s.x-_.x))+_.x,0)),f.y>1&&p.y>=0?f=new i.MercatorCoordinate((1-m.y)/(((a=f).y-m.y)/(a.x-m.x))+m.x,1):f.y<0&&p.y<=1&&(f=new i.MercatorCoordinate(-m.y/(((l=f).y-m.y)/(l.x-m.x))+m.x,0)),new i.LngLatBounds().extend(this.coordinateLocation(p)).extend(this.coordinateLocation(f)).extend(this.coordinateLocation(_)).extend(this.coordinateLocation(m))}_getBounds3D(){const i=this.elevation;if(!i.visibleDemTiles.length)return this._getBounds(0,0);const r=i.visibleDemTiles.reduce((i,r)=>{if(r.dem){const n=r.dem.tree;i.min=Math.min(i.min,n.minimums[0]),i.max=Math.max(i.max,n.maximums[0])}return i},{min:Number.MAX_VALUE,max:0});return this._getBounds(r.min*i.exaggeration(),r.max*i.exaggeration())}getBounds(){return this._terrainEnabled()?this._getBounds3D():this._getBounds(0,0)}horizonLineFromTop(i=!0){const r=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,n=this.height/2-r*(1-this._horizonShift);return i?Math.max(0,n):n}getMaxBounds(){return this.maxBounds}setMaxBounds(r){this.maxBounds=r,this.minLat=-i.MAX_MERCATOR_LATITUDE,this.maxLat=i.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,r&&(this.minLat=r.getSouth(),this.maxLat=r.getNorth(),this.minLng=r.getWest(),this.maxLng=r.getEast(),this.maxLngp&&(c=p-u),p-dm&&(l=m-h),m-f.5?w-1:w,T>.5?T-1:T,0]),this.alignedProjMatrix=E,l=i.create(),i.scale(l,l,[this.width/2,-this.height/2,1]),i.translate(l,l,[1,-1,0]),this.labelPlaneMatrix=l,l=i.create(),i.scale(l,l,[1,-1,1]),i.translate(l,l,[-1,-1,0]),i.scale(l,l,[2/this.width,2/this.height,1]),this.glCoordMatrix=l,this.pixelMatrix=i.multiply$1(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},!(l=i.invert(new Float64Array(16),this.pixelMatrix)))throw Error("failed to invert matrix");this.pixelMatrixInverse=l,this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const r=this.cameraWorldSize,n=this.cameraPixelsPerMeter,o=this._camera.position,s=1/this.height,a=[r,r,n];i.scale$2(a,a,s),i.scale$2(o,o,-1),i.multiply$2(o,o,a);const l=i.create();i.translate(l,l,o),i.scale(l,l,a),this.mercatorFogMatrix=l,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(r,n,s)}_computeCameraPosition(i){const r=(i=i||this.pixelsPerMeter)/this.pixelsPerMeter,n=this._camera.forward(),o=this.point,s=this._mercatorZfromZoom(this._cameraZoom?this._cameraZoom:this._zoom)*r-i/this.worldSize*this._centerAltitude;return[o.x/this.worldSize-n[0]*s,o.y/this.worldSize-n[1]*s,i/this.worldSize*this._centerAltitude-n[2]*s]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(r){const n=this._maxCameraBoundsDistance()*Math.cos(this._pitch),o=r[2];let s=1;o>0&&(s=Math.min((n-this._camera.position[2])/o,1)),this._camera.position=i.scaleAndAdd([],this._camera.position,r,s),this._updateStateFromCamera()}_updateStateFromCamera(){const r=this._camera.position,n=this._camera.forward(),{pitch:o,bearing:s}=this._camera.getPitchBearing(),a=i.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._projectionScaler,l=this._mercatorZfromZoom(this._maxZoom)*Math.cos(i.degToRad(this._maxPitch)),c=Math.max((r[2]-a)/Math.cos(o),l),h=this._zoomFromMercatorZ(c);i.scaleAndAdd(r,r,n,c),this._pitch=i.clamp(o,i.degToRad(this.minPitch),i.degToRad(this.maxPitch)),this.angle=i.wrap(s,-Math.PI,Math.PI),this._setZoom(i.clamp(h,this._minZoom,this._maxZoom)),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._center=this.coordinateLocation(new i.MercatorCoordinate(r[0],r[1],r[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(i){return Math.pow(2,i)*this.tileSize}_mercatorZfromZoom(i){return this.cameraToCenterDistance/this._worldSizeFromZoom(i)}_minimumHeightOverTerrain(){const i=Math.min((null!=this._cameraZoom?this._cameraZoom:this._zoom)+2,this._maxZoom);return this._mercatorZfromZoom(i)}_zoomFromMercatorZ(i){return this.scaleZoom(this.cameraToCenterDistance/(i*this.tileSize))}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(i.warnOnce("Terrain is not yet supported with alternate projections. Use mercator to enable terrain."),1))}anyCornerOffEdge(r,n){const o=Math.min(r.x,n.x),s=Math.max(r.x,n.x),a=Math.min(r.y,n.y),l=Math.max(r.y,n.y);if(au||f.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+i.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new i.pointGeometry(0,0),new i.pointGeometry(this.width,this.height))}zoomDeltaToMovement(r,n){const o=i.length(i.sub([],this._camera.position,r)),s=this._zoomFromMercatorZ(o)+n;return o-this._mercatorZfromZoom(s)}getCameraPoint(){const r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.pointGeometry(0,r))}}function iB(i,r){let n=!1,o=null;const s=()=>{o=null,n&&(i(),o=setTimeout(s,r),n=!1)};return()=>(n=!0,o||s(),o)}class iR{constructor(r){this._hashName=r&&encodeURIComponent(r),i.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=iB(this._updateHashUnthrottled.bind(this),300)}addTo(r){return this._map=r,i.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return i.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(r){const n=this._map.getCenter(),o=Math.round(100*this._map.getZoom())/100,s=Math.ceil((o*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.pow(10,s),l=Math.round(n.lng*a)/a,c=Math.round(n.lat*a)/a,h=this._map.getBearing(),u=this._map.getPitch();let d="";if(d+=r?`/${l}/${c}/${o}`:`${o}/${c}/${l}`,(h||u)&&(d+="/"+Math.round(10*h)/10),u&&(d+=`/${Math.round(u)}`),this._hashName){const p=this._hashName;let f=!1;const m=i.window.location.hash.slice(1).split("&").map(i=>{const r=i.split("=")[0];return r===p?(f=!0,`${r}=${d}`):i}).filter(i=>i);return f||m.push(`${p}=${d}`),`#${m.join("&")}`}return`#${d}`}_getCurrentHash(){const r=i.window.location.hash.replace("#","");if(this._hashName){let n;return r.split("&").map(i=>i.split("=")).forEach(i=>{i[0]===this._hashName&&(n=i)}),(n&&n[1]||"").split("/")}return r.split("/")}_onHashChange(){const i=this._getCurrentHash();if(i.length>=3&&!i.some(i=>isNaN(i))){const r=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(i[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:r,pitch:+(i[4]||0)}),!0}return!1}_updateHashUnthrottled(){const r=i.window.location.href.replace(/(#.+)?$/,this.getHashString());i.window.history.replaceState(i.window.history.state,null,r)}}const iF={linearity:.3,easing:i.bezier(0,0,.3,1)},iO=i.extend({deceleration:2500,maxSpeed:1400},iF),iU=i.extend({deceleration:20,maxSpeed:1400},iF),iV=i.extend({deceleration:1e3,maxSpeed:360},iF),iN=i.extend({deceleration:1e3,maxSpeed:90},iF);class ij{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.exported.now(),settings:r})}_drainInertiaBuffer(){const r=this._inertiaBuffer,n=i.exported.now();for(;r.length>0&&n-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new i.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:o}of this._inertiaBuffer)n.zoom+=o.zoomDelta||0,n.bearing+=o.bearingDelta||0,n.pitch+=o.pitchDelta||0,o.panDelta&&n.pan._add(o.panDelta),o.around&&(n.around=o.around),o.pinchAround&&(n.pinchAround=o.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(n.pan.mag()){const l=iZ(n.pan.mag(),s,i.extend({},iO,r||{}));a.offset=n.pan.mult(l.amount/n.pan.mag()),a.center=this._map.transform.center,iG(a,l)}if(n.zoom){const c=iZ(n.zoom,s,iU);a.zoom=this._map.transform.zoom+c.amount,iG(a,c)}if(n.bearing){const h=iZ(n.bearing,s,iV);a.bearing=this._map.transform.bearing+i.clamp(h.amount,-179,179),iG(a,h)}if(n.pitch){const u=iZ(n.pitch,s,iN);a.pitch=this._map.transform.pitch+u.amount,iG(a,u)}if(a.zoom||a.bearing){const d=void 0===n.pinchAround?n.around:n.pinchAround;a.around=d?this._map.unproject(d):this._map.getCenter()}return this.clear(),i.extend(a,{noMoveStart:!0})}}function iG(i,r){(!i.duration||i.durationn.unproject(i)),c=a.reduce((i,r,n,o)=>i.add(r.div(o.length)),new i.pointGeometry(0,0));super(r,{points:a,point:c,lngLats:l,lngLat:n.unproject(c),originalEvent:o}),this._defaultPrevented=!1}}class iX extends i.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,n){super(i,{originalEvent:n}),this._defaultPrevented=!1}}class iW{constructor(i,r){this._map=i,this._clickTolerance=r.clickTolerance}reset(){delete this._mousedownPos}wheel(i){return this._firePreventable(new iX(i.type,this._map,i))}mousedown(i,r){return this._mousedownPos=r,this._firePreventable(new i$(i.type,this._map,i))}mouseup(i){this._map.fire(new i$(i.type,this._map,i))}preclick(r){const n=i.extend({},r);n.type="preclick",this._map.fire(new i$(n.type,this._map,n))}click(i,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||(this.preclick(i),this._map.fire(new i$(i.type,this._map,i)))}dblclick(i){return this._firePreventable(new i$(i.type,this._map,i))}mouseover(i){this._map.fire(new i$(i.type,this._map,i))}mouseout(i){this._map.fire(new i$(i.type,this._map,i))}touchstart(i){return this._firePreventable(new iq(i.type,this._map,i))}touchmove(i){this._map.fire(new iq(i.type,this._map,i))}touchend(i){this._map.fire(new iq(i.type,this._map,i))}touchcancel(i){this._map.fire(new iq(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class iH{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(i){this._map.fire(new i$(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new i$("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._map.fire(new i$(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class iK{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=r.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,r){this.isEnabled()&&i.shiftKey&&0===i.button&&(u.disableDrag(),this._startPos=this._lastPos=r,this._active=!0)}mousemoveWindow(i,r){if(!this._active||this._lastPos.equals(r)||!this._box&&r.dist(this._startPos){this._box&&(this._box.style.transform=`translate(${o}px,${a}px)`,this._box.style.width=s-o+"px",this._box.style.height=l-a+"px")})}mouseupWindow(r,n){if(!this._active||0!==r.button)return;const o=this._startPos;if(this.reset(),u.suppressClick(),o.x!==n.x||o.y!==n.y)return this._map.fire(new i.Event("boxzoomend",{originalEvent:r})),{cameraAnimation:i=>i.fitScreenCoordinates(o,n,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",r)}keydown(i){this._active&&27===i.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",i))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),u.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(r,n){return this._map.fire(new i.Event(r,{originalEvent:n}))}}function iY(i,r){const n={};for(let o=0;othis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=r.timeStamp),o.length===this.numTouches&&(this.centroid=function(r){const n=new i.pointGeometry(0,0);for(const o of r)n._add(o);return n.div(r.length)}(n),this.touches=iY(o,n)))}touchmove(i,r,n){if(this.aborted||!this.centroid)return;const o=iY(n,r);for(const s in this.touches){const a=this.touches[s],l=o[s];(!l||l.dist(a)>30)&&(this.aborted=!0)}}touchend(i,r,n){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),0===n.length){const o=!this.aborted&&this.centroid;if(this.reset(),o)return o}}}class iQ{constructor(i){this.singleTap=new iJ(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(i,r,n){this.singleTap.touchstart(i,r,n)}touchmove(i,r,n){this.singleTap.touchmove(i,r,n)}touchend(i,r,n){const o=this.singleTap.touchend(i,r,n);if(o){const s=i.timeStamp-this.lastTime<500,a=!this.lastTap||30>this.lastTap.dist(o);if(s&&a||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class i0{constructor(){this._zoomIn=new iQ({numTouches:1,numTaps:2}),this._zoomOut=new iQ({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,r,n){this._zoomIn.touchstart(i,r,n),this._zoomOut.touchstart(i,r,n)}touchmove(i,r,n){this._zoomIn.touchmove(i,r,n),this._zoomOut.touchmove(i,r,n)}touchend(i,r,n){const o=this._zoomIn.touchend(i,r,n),s=this._zoomOut.touchend(i,r,n);return o?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:r.getZoom()+1,around:r.unproject(o)},{originalEvent:i})}):s?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:r.getZoom()-1,around:r.unproject(s)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const i1={0:1,2:2};class i2{constructor(i){this.reset(),this._clickTolerance=i.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(i,r){return!1}_move(i,r){return{}}mousedown(i,r){if(this._lastPoint)return;const n=u.mouseButton(i);this._correctButton(i,n)&&(this._lastPoint=r,this._eventButton=n)}mousemoveWindow(i,r){const n=this._lastPoint;if(n){if(i.preventDefault(),function(i,r){const n=i1[r];return void 0===i.buttons||(i.buttons&n)!==n}(i,this._eventButton))this.reset();else if(this._moved||!(r.dist(n)0&&(this._active=!0);const s=iY(o,n),a=new i.pointGeometry(0,0),l=new i.pointGeometry(0,0);let c=0;for(const h in s){const u=s[h],d=this._touches[h];d&&(a._add(u),l._add(u.sub(d)),c++,s[h]=u)}if(this._touches=s,c{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show")},500)}}class i8{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(i){}_move(i,r,n){return{}}touchstart(i,r,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier],this._start([r[0],r[1]]))}touchmove(i,r,n){if(!this._firstTwoTouches)return;i.preventDefault();const[o,s]=this._firstTwoTouches,a=i9(n,r,o),l=i9(n,r,s);if(!a||!l)return;const c=this._aroundCenter?null:a.add(l).div(2);return this._move([a,l],c,i)}touchend(i,r,n){if(!this._firstTwoTouches)return;const[o,s]=this._firstTwoTouches,a=i9(n,r,o),l=i9(n,r,s);a&&l||(this._active&&u.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(i){this._enabled=!0,this._aroundCenter=!!i&&"center"===i.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function i9(i,r,n){for(let o=0;oMath.abs(i7(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:i7(this._distance,n),pinchAround:r}}}function rt(i,r){return 180*i.angleWith(r)/Math.PI}class ri extends i8{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(i){this._startVector=this._vector=i[0].sub(i[1]),this._minDiameter=i[0].dist(i[1])}_move(i,r){const n=this._vector;if(this._vector=i[0].sub(i[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:rt(this._vector,n),pinchAround:r}}_isBelowThreshold(i){this._minDiameter=Math.min(this._minDiameter,i.mag());const r=25/(Math.PI*this._minDiameter)*360,n=rt(i,this._startVector);return Math.abs(n)Math.abs(i.x)}class rn extends i8{constructor(i){super(),this._map=i}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(i){this._lastPoints=i,rr(i[0].sub(i[1]))&&(this._valid=!1)}_move(i,r,n){const o=i[0].sub(this._lastPoints[0]),s=i[1].sub(this._lastPoints[1]);if(!(this._map._cooperativeGestures&&n.touches.length<3)&&(this._valid=this.gestureBeginsVertically(o,s,n.timeStamp),this._valid))return this._lastPoints=i,this._active=!0,{pitchDelta:-((o.y+s.y)/2*.5)}}gestureBeginsVertically(i,r,n){if(void 0!==this._valid)return this._valid;const o=i.mag()>=2,s=r.mag()>=2;if(!o&&!s)return;if(!o||!s)return void 0===this._firstMove&&(this._firstMove=n),n-this._firstMove<100&&void 0;const a=i.y>0==r.y>0;return rr(i)&&rr(r)&&a}}const ro={panStep:100,bearingStep:15,pitchStep:10};class rs{constructor(){this._panStep=ro.panStep,this._bearingStep=ro.bearingStep,this._pitchStep=ro.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let r=0,n=0,o=0,s=0,a=0;switch(i.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:i.shiftKey?n=-1:(i.preventDefault(),s=-1);break;case 39:i.shiftKey?n=1:(i.preventDefault(),s=1);break;case 38:i.shiftKey?o=1:(i.preventDefault(),a=-1);break;case 40:i.shiftKey?o=-1:(i.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(n=0,o=0),{cameraAnimation:l=>{const c=l.getZoom();l.easeTo({duration:300,easeId:"keyboardHandler",easing:ra,zoom:r?Math.round(c)+r*(i.shiftKey?2:1):c,bearing:l.getBearing()+n*this._bearingStep,pitch:l.getPitch()+o*this._pitchStep,offset:[-s*this._panStep,-a*this._panStep],center:l.getCenter()},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function ra(i){return i*(2-i)}class rl{constructor(r,n){this._map=r,this._el=r.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,i.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert","_isFullscreen"],this)}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&"center"===i.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(r){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(r.ctrlKey||r.metaKey||this.isZooming()||this._isFullscreen()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let n=r.deltaMode===i.window.WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY;const o=i.exported.now(),s=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,0!==n&&n%4.000244140625==0?this._type="wheel":0!==n&&4>Math.abs(n)?this._type="trackpad":s>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,r)):this._type||(this._type=200>Math.abs(s*n)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),r.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=r,this._delta-=n,this._active||this._start(r)),r.preventDefault()}_onTimeout(i){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)}_start(i){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const r=u.mousePos(this._el,i);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:r,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const r=this._map.transform,n=()=>r._terrainEnabled()&&this._aroundCoord?r.computeZoomRelativeTo(this._aroundCoord):r.zoom;if(0!==this._delta){const o="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate;let s=2/(1+Math.exp(-Math.abs(this._delta*o)));this._delta<0&&0!==s&&(s=1/s);const a=n(),l=Math.pow(2,a),c="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):l;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(c*s))),"wheel"===this._type&&(this._startZoom=n(),this._easing=this._smoothOutEasing(200)),this._delta=0}const h="number"==typeof this._targetZoom?this._targetZoom:n(),u=this._startZoom,d=this._easing;let p,f=!1;if("wheel"===this._type&&u&&d){const m=Math.min((i.exported.now()-this._lastWheelEventTime)/200,1),_=d(m);p=i.number(u,h,_),m<1?this._frameId||(this._frameId=!0):f=!0}else p=h,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!f,zoomDelta:p-n(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let n=i.ease;if(this._prevEase){const o=this._prevEase,s=(i.exported.now()-o.start)/o.duration,a=o.easing(s+.01)-o.easing(s),l=.27/Math.sqrt(a*a+1e-4)*.01,c=Math.sqrt(.0729-l*l);n=i.bezier(l,c,.25,1)}return this._prevEase={start:i.exported.now(),duration:r,easing:n},n}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=u.create("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(i.window.navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_isFullscreen(){return!!i.window.document.fullscreenElement}_showBlockerAlert(){"hidden"===this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="visible"),this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show")},200)}}class rc{constructor(i,r){this._clickZoom=i,this._tapZoom=r}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class rh{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(i,r){return i.preventDefault(),{cameraAnimation(n){n.easeTo({duration:300,zoom:n.getZoom()+(i.shiftKey?-1:1),around:n.unproject(r)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ru{constructor(){this._tap=new iQ({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(i,r,n){this._swipePoint||(this._tapTime&&i.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?n.length>0&&(this._swipePoint=r[0],this._swipeTouch=n[0].identifier):this._tap.touchstart(i,r,n))}touchmove(i,r,n){if(this._tapTime){if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;const o=r[0],s=o.y-this._swipePoint.y;return this._swipePoint=o,i.preventDefault(),this._active=!0,{zoomDelta:s/128}}}else this._tap.touchmove(i,r,n)}touchend(i,r,n){this._tapTime?this._swipePoint&&0===n.length&&this.reset():this._tap.touchend(i,r,n)&&(this._tapTime=i.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class rd{constructor(i,r,n){this._el=i,this._mousePan=r,this._touchPan=n}enable(i){this._inertiaOptions=i||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class rp{constructor(i,r,n){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=r,this._mousePitch=n}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class rf{constructor(i,r,n,o){this._el=i,this._touchZoom=r,this._touchRotate=n,this._tapDragZoom=o,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const rm=i=>i.zoom||i.drag||i.pitch||i.rotate;class r_ extends i.Event{}class rg{constructor(){this.constants=[1,1,.01],this.radius=0}setup(r,n){const o=i.sub([],n,r);this.radius=i.length(o[2]<0?i.div([],o,this.constants):[o[0],o[1],0])}projectRay(r){i.div(r,r,this.constants),i.normalize(r,r),i.mul$1(r,r,this.constants);const n=i.scale$2([],r,this.radius);if(n[2]>0){const o=i.scale$2([],[0,0,1],i.dot(n,[0,0,1])),s=i.scale$2([],i.normalize([],[n[0],n[1],0]),this.radius),a=i.add([],n,i.scale$2([],i.sub([],i.add([],s,o),n),2));n[0]=a[0],n[1]=a[1]}return n}}function ry(i){return i.panDelta&&i.panDelta.mag()||i.zoomDelta||i.bearingDelta||i.pitchDelta}class rx{constructor(r,n){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ij(r),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new rg,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(n),i.bindAll(["handleEvent","handleWindowEvent"],this);const o=this._el;for(const[s,a,l]of(this._listeners=[[o,"touchstart",{passive:!0}],[o,"touchmove",{passive:!1}],[o,"touchend",void 0],[o,"touchcancel",void 0],[o,"mousedown",void 0],[o,"mousemove",void 0],[o,"mouseup",void 0],[i.window.document,"mousemove",{capture:!0}],[i.window.document,"mouseup",void 0],[o,"mouseover",void 0],[o,"mouseout",void 0],[o,"dblclick",void 0],[o,"click",void 0],[o,"keydown",{capture:!1}],[o,"keyup",void 0],[o,"wheel",{passive:!1}],[o,"contextmenu",void 0],[i.window,"blur",void 0]],this._listeners))s.addEventListener(a,s===i.window.document?this.handleWindowEvent:this.handleEvent,l)}destroy(){for(const[r,n,o]of this._listeners)r.removeEventListener(n,r===i.window.document?this.handleWindowEvent:this.handleEvent,o)}_addDefaultHandlers(i){const r=this._map,n=r.getCanvasContainer();this._add("mapEvent",new iW(r,i));const o=r.boxZoom=new iK(r,i);this._add("boxZoom",o);const s=new i0,a=new rh;r.doubleClickZoom=new rc(a,s),this._add("tapZoom",s),this._add("clickZoom",a);const l=new ru;this._add("tapDragZoom",l);const c=r.touchPitch=new rn(r);this._add("touchPitch",c);const h=new i5(i),u=new i4(i);r.dragRotate=new rp(i,h,u),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",u,["mouseRotate"]);const d=new i3(i),p=new i6(r,i);r.dragPan=new rd(n,d,p),this._add("mousePan",d),this._add("touchPan",p,["touchZoom","touchRotate"]);const f=new ri,m=new re;r.touchZoomRotate=new rf(n,m,f,l),this._add("touchRotate",f,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]),this._add("blockableMapEvent",new iH(r));const _=r.scrollZoom=new rl(r,this);this._add("scrollZoom",_,["mousePan"]);const g=r.keyboard=new rs;for(const y of(this._add("keyboard",g),["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"]))i.interactive&&i[y]&&r[y].enable(i[y])}_add(i,r,n){this._handlers.push({handlerName:i,handler:r,allowed:n}),this._handlersById[i]=r}stop(i){if(!this._updatingCamera){for(const{handler:r}of this._handlers)r.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[]}}isActive(){for(const{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(rm(this._eventsInProgress))||this.isZooming()}_blockedByActive(i,r,n){for(const o in i)if(o!==n&&(!r||0>r.indexOf(o)))return!0;return!1}handleWindowEvent(i){this.handleEvent(i,`${i.type}Window`)}_getMapTouches(i){const r=[];for(const n of i)this._el.contains(n.target)&&r.push(n);return r}handleEvent(i,r){this._updatingCamera=!0;const n="renderFrame"===i.type,o=n?void 0:i,s={needsRenderFrame:!1},a={},l={},c=i.touches?this._getMapTouches(i.touches):void 0,h=c?u.touchPos(this._el,c):n?void 0:u.mousePos(this._el,i);for(const{handlerName:d,handler:p,allowed:f}of this._handlers){let m;p.isEnabled()&&(this._blockedByActive(l,f,d)?p.reset():p[r||i.type]&&(m=p[r||i.type](i,h,c),this.mergeHandlerResult(s,a,m,d,o),m&&m.needsRenderFrame&&this._triggerRenderFrame()),(m||p.isActive())&&(l[d]=p))}const _={};for(const g in this._previousActiveHandlers)l[g]||(_[g]=o);this._previousActiveHandlers=l,(Object.keys(_).length||ry(s))&&(this._changes.push([s,a,_]),this._triggerRenderFrame()),(Object.keys(l).length||ry(s))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:y}=s;y&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],y(this._map))}mergeHandlerResult(r,n,o,s,a){if(!o)return;i.extend(r,o);const l={handlerName:s,originalEvent:o.originalEvent||a};void 0!==o.zoomDelta&&(n.zoom=l),void 0!==o.panDelta&&(n.drag=l),void 0!==o.pitchDelta&&(n.pitch=l),void 0!==o.bearingDelta&&(n.rotate=l)}_applyChanges(){const r={},n={},o={};for(const[s,a,l]of this._changes)s.panDelta&&(r.panDelta=(r.panDelta||new i.pointGeometry(0,0))._add(s.panDelta)),s.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+s.zoomDelta),s.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+s.bearingDelta),s.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+s.pitchDelta),void 0!==s.around&&(r.around=s.around),void 0!==s.aroundCoord&&(r.aroundCoord=s.aroundCoord),void 0!==s.pinchAround&&(r.pinchAround=s.pinchAround),s.noInertia&&(r.noInertia=s.noInertia),i.extend(n,a),i.extend(o,l);this._updateMapTransform(r,n,o),this._changes=[]}_updateMapTransform(r,n,o){const s=this._map,a=s.transform,l=i=>[i.x,i.y,i.z];if((i=>{const r=this._eventsInProgress.drag;return r&&!this._handlersById[r.handlerName].isActive()})()&&!ry(r)){const c=a.zoom;a.cameraElevationReference="sea",a.recenterOnTerrain(),a.cameraElevationReference="ground",c!==a.zoom&&this._map._update(!0)}if(!ry(r))return this._fireEvents(n,o,!0);let{panDelta:h,zoomDelta:u,bearingDelta:d,pitchDelta:p,around:f,aroundCoord:m,pinchAround:_}=r;void 0!==_&&(f=_),n.drag&&!this._eventsInProgress.drag&&f&&(this._dragOrigin=l(a.pointCoordinate3D(f)),this._trackingEllipsoid.setup(a._camera.position,this._dragOrigin)),a.cameraElevationReference="sea",s._stop(!0),f=f||s.transform.centerPoint,d&&(a.bearing+=d),p&&(a.pitch+=p),a._updateCameraState();const g=[0,0,0];if(h){const y=a.pointCoordinate(f),x=a.pointCoordinate(f.sub(h));y&&x&&(g[0]=x.x-y.x,g[1]=x.y-y.y)}const v=a.zoom,b=[0,0,0];if(u){const w=l(m||a.pointCoordinate3D(f)),T={dir:i.normalize([],i.sub([],w,a._camera.position))};if(T.dir[2]<0){const E=a.zoomDeltaToMovement(w,u);i.scale$2(b,T.dir,E)}}const S=i.add(g,g,b);a._translateCameraConstrained(S),u&&Math.abs(a.zoom-v)>1e-4&&a.recenterOnTerrain(),a.cameraElevationReference="ground",this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(n,o,!0)}_fireEvents(r,n,o){let s;const a=rm(this._eventsInProgress),l=rm(r),c={};for(const h in r){const{originalEvent:u}=r[h];this._eventsInProgress[h]||(c[`${h}start`]=u),this._eventsInProgress[h]=r[h]}for(const d in!a&&l&&this._fireEvent("movestart",l.originalEvent),c)this._fireEvent(d,c[d]);for(const p in l&&this._fireEvent("move",l.originalEvent),r){const{originalEvent:f}=r[p];this._fireEvent(p,f)}const m={};for(const _ in this._eventsInProgress){const{handlerName:g,originalEvent:y}=this._eventsInProgress[_];this._handlersById[g].isActive()||(delete this._eventsInProgress[_],s=n[g]||y,m[`${_}end`]=s)}for(const x in m)this._fireEvent(x,m[x]);const v=rm(this._eventsInProgress);if(o&&(a||l)&&!v){var b,w;this._updatingCamera=!0;const T=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions);T?(0!==(b=T.bearing||this._map.getBearing())&&-this._bearingSnap{delete this._frameId,this.handleEvent(new r_("renderFrame",{timeStamp:i})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const rv="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class rb extends i.Evented{constructor(r,n){super(),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=n.bearingSnap,i.bindAll(["_renderFrameCallback"],this)}getCenter(){return new i.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(i,r){return this.jumpTo({center:i},r)}panBy(r,n,o){return r=i.pointGeometry.convert(r).mult(-1),this.panTo(this.transform.center,i.extend({offset:r},n),o)}panTo(r,n,o){return this.easeTo(i.extend({center:r},n),o)}getZoom(){return this.transform.zoom}setZoom(i,r){return this.jumpTo({zoom:i},r),this}zoomTo(r,n,o){return this.easeTo(i.extend({zoom:r},n),o)}zoomIn(i,r){return this.zoomTo(this.getZoom()+1,i,r),this}zoomOut(i,r){return this.zoomTo(this.getZoom()-1,i,r),this}getBearing(){return this.transform.bearing}setBearing(i,r){return this.jumpTo({bearing:i},r),this}getPadding(){return this.transform.padding}setPadding(i,r){return this.jumpTo({padding:i},r),this}rotateTo(r,n,o){return this.easeTo(i.extend({bearing:r},n),o)}resetNorth(r,n){return this.rotateTo(0,i.extend({duration:1e3},r),n),this}resetNorthPitch(r,n){return this.easeTo(i.extend({bearing:0,pitch:0,duration:1e3},r),n),this}snapToNorth(i,r){return Math.abs(this.getBearing())y=>{if(T&&(a.zoom=i.number(l,d,y)),E&&(a.bearing=i.number(c,p,y)),S&&(a.pitch=i.number(h,f,y)),I&&(a.interpolatePadding(u,m,y),g=a.centerPoint.add(_)),o)a.setLocationAtPoint(o,s);else{const x=a.zoomScale(a.zoom-l),M=d>l?Math.min(2,w):Math.max(.5,w),A=Math.pow(M,1-y),C=a.unproject(v.add(b.mult(y*A)).mult(x));a.setLocationAtPoint(a.renderWorldCopies?C.wrap():C,g)}return r.preloadOnly||this._fireMoveEvents(n),a};if(r.preloadOnly){const A=this._emulate(M,r.duration,a);return this._preloadTiles(A),this}const C={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=T,this._rotating=E,this._pitching=S,this._padding=I,this._easeId=r.easeId,this._prepareEase(n,r.noMoveStart,C),this._ease(M(a),i=>{a.recenterOnTerrain(),this._afterEase(n,i)},r),this}_prepareEase(r,n,o={}){this._moving=!0,this.transform.cameraElevationReference="sea",n||o.moving||this.fire(new i.Event("movestart",r)),this._zooming&&!o.zooming&&this.fire(new i.Event("zoomstart",r)),this._rotating&&!o.rotating&&this.fire(new i.Event("rotatestart",r)),this._pitching&&!o.pitching&&this.fire(new i.Event("pitchstart",r))}_fireMoveEvents(r){this.fire(new i.Event("move",r)),this._zooming&&this.fire(new i.Event("zoom",r)),this._rotating&&this.fire(new i.Event("rotate",r)),this._pitching&&this.fire(new i.Event("pitch",r))}_afterEase(r,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId,this.transform.cameraElevationReference="ground";const o=this._zooming,s=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,o&&this.fire(new i.Event("zoomend",r)),s&&this.fire(new i.Event("rotateend",r)),a&&this.fire(new i.Event("pitchend",r)),this.fire(new i.Event("moveend",r))}flyTo(r,n){if(!r.essential&&i.exported.prefersReducedMotion){const o=i.pick(r,["center","zoom","bearing","pitch","around"]);return this.jumpTo(o,n)}this.stop(),r=i.extend({offset:[0,0],speed:1.2,curve:1.42,easing:i.ease},r);const s=this.transform,a=this.getZoom(),l=this.getBearing(),c=this.getPitch(),h=this.getPadding(),u="zoom"in r?i.clamp(+r.zoom,s.minZoom,s.maxZoom):a,d="bearing"in r?this._normalizeBearing(r.bearing,l):l,p="pitch"in r?+r.pitch:c,f="padding"in r?r.padding:s.padding,m=s.zoomScale(u-a),_=i.pointGeometry.convert(r.offset);let g=s.centerPoint.add(_);const y=s.pointLocation(g),x=i.LngLat.convert(r.center||y);this._normalizeCenter(x);const v=s.project(y),b=s.project(x).sub(v);let w=r.curve;const T=Math.max(s.width,s.height),E=T/m,S=b.mag();if("minZoom"in r){const I=i.clamp(Math.min(r.minZoom,a,u),s.minZoom,s.maxZoom),M=T/s.zoomScale(I-a);w=Math.sqrt(M/S*2)}const A=w*w;function C(i){const r=(E*E-T*T+(i?-1:1)*A*A*S*S)/(2*(i?E:T)*A*S);return Math.log(Math.sqrt(r*r+1)-r)}function z(i){return(Math.exp(i)-Math.exp(-i))/2}function k(i){return(Math.exp(i)+Math.exp(-i))/2}const P=C(0);let D=function(i){return k(P)/k(P+w*i)},L=function(i){var r;return T*((k(P)*(z(r=P+w*i)/k(r))-z(P))/A)/S},B=(C(1)-P)/w;if(1e-6>Math.abs(S)||!isFinite(B)){if(1e-6>Math.abs(T-E))return this.easeTo(r,n);const R=Er.maxDuration&&(r.duration=0);const F=l!==d,O=p!==c,U=!s.isPaddingEqual(f),V=o=>s=>{const m=s*B,y=1/D(m);o.zoom=1===s?u:a+o.scaleZoom(y),F&&(o.bearing=i.number(l,d,s)),O&&(o.pitch=i.number(c,p,s)),U&&(o.interpolatePadding(h,f,s),g=o.centerPoint.add(_));const w=1===s?x:o.unproject(v.add(b.mult(L(m))).mult(y));return o.setLocationAtPoint(o.renderWorldCopies?w.wrap():w,g),o._updateCenterElevation(),r.preloadOnly||this._fireMoveEvents(n),o};if(r.preloadOnly){const N=this._emulate(V,r.duration,s);return this._preloadTiles(N),this}return this._zooming=!0,this._rotating=F,this._pitching=O,this._padding=U,this._prepareEase(n,!1),this._ease(V(s),()=>this._afterEase(n),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(i,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const n=this._onEaseEnd;delete this._onEaseEnd,n.call(this,r)}if(!i){const o=this.handlers;o&&o.stop(!1)}return this}_ease(r,n,o){!1===o.animate||0===o.duration?(r(1),n()):(this._easeStart=i.exported.now(),this._easeOptions=o,this._onEaseFrame=r,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const r=Math.min((i.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(r)),r<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(r,n){r=i.wrap(r,-180,180);const o=Math.abs(r-n);return Math.abs(r-360-n)180?-360:n<-180?360:0}_emulate(i,r,n){const o=Math.ceil(15*r/1e3),s=[],a=i(n.clone());for(let l=0;l<=o;l++){const c=a(l/o);s.push(c.clone())}return s}}class rw{constructor(r={}){this.options=r,i.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(i){const r=this.options&&this.options.compact;return this._map=i,this._container=u.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=u.create("button","mapboxgl-ctrl-attrib-button",this._container),u.create("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden",!0),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=u.create("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),r&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===r&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_setElementTitle(i,r){const n=this._map._getUIString(`AttributionControl.${r}`);i.setAttribute("aria-label",n),i.removeAttribute("title"),i.firstElementChild&&i.firstElementChild.setAttribute("title",n)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let r=this._editLink;r||(r=this._editLink=this._container.querySelector(".mapbox-improve-map"));const n=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.config.ACCESS_TOKEN}];if(r){const o=n.reduce((i,r,o)=>(r.value&&(i+=`${r.key}=${r.value}${oi.indexOf(a.attribution)&&i.push(a.attribution)}}i.sort((i,r)=>i.length-r.length),i=i.filter((r,n)=>{for(let o=n+1;o=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=[...this.options.customAttribution,...i]:i.unshift(this.options.customAttribution));const l=i.join(" | ");l!==this._attribHTML&&(this._attribHTML=l,i.length?(this._innerContainer.innerHTML=l,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class rT{constructor(){i.bindAll(["_updateLogo"],this),i.bindAll(["_updateCompact"],this)}onAdd(i){this._map=i,this._container=u.create("div","mapboxgl-ctrl");const r=u.create("a","mapboxgl-ctrl-logo");return r.target="_blank",r.rel="noopener nofollow",r.href="https://www.mapbox.com/",r.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),r.setAttribute("rel","noopener nofollow"),this._container.appendChild(r),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(i){i&&"metadata"!==i.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const i=this._map.style._sourceCaches;if(0===Object.entries(i).length)return!0;for(const r in i){const n=i[r].getSource();if(n.hasOwnProperty("mapbox_logo")&&!n.mapbox_logo)return!1}return!0}_updateCompact(){const i=this._container.children;if(i.length){const r=i[0];this._map.getCanvasContainer().offsetWidth<250?r.classList.add("mapboxgl-compact"):r.classList.remove("mapboxgl-compact")}}}class rE{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){const r=++this._id;return this._queue.push({callback:i,id:r,cancelled:!1}),r}remove(i){const r=this._currentlyRunning,n=r?this._queue.concat(r):this._queue;for(const o of n)if(o.id===i)return void(o.cancelled=!0)}run(i=0){const r=this._currentlyRunning=this._queue;for(const n of(this._queue=[],r))if(!n.cancelled&&(n.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function rS(r,n,o){if(r=new i.LngLat(r.lng,r.lat),n){const s=new i.LngLat(r.lng-360,r.lat),a=new i.LngLat(r.lng+360,r.lat),l=360*Math.ceil(Math.abs(r.lng-o.center.lng)/360),c=o.locationPoint(r).distSqr(n),h=n.x<0||n.y<0||n.x>o.width||n.y>o.height;o.locationPoint(s).distSqr(n)180;){const u=o.locationPoint(r);if(u.x>=0&&u.y>=0&&u.x<=o.width&&u.y<=o.height)break;r.lng>o.center.lng?r.lng-=360:r.lng+=360}return r}const rI={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};class rM extends i.Evented{constructor(r,n){if(super(),(r instanceof i.window.HTMLElement||n)&&(r=i.extend({element:r},n)),i.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=r&&r.anchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=r&&r.rotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&"auto"!==r.pitchAlignment?r.pitchAlignment:this._rotationAlignment,this._updateMoving=()=>this._update(!0),r&&r.element)this._element=r.element,this._offset=i.pointGeometry.convert(r&&r.offset||[0,0]);else{this._defaultMarker=!0,this._element=u.create("div");const o=u.createSVG("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},this._element),s=u.createSVG("radialGradient",{id:"shadowGradient"},u.createSVG("defs",{},o));u.createSVG("stop",{offset:"10%","stop-opacity":.4},s),u.createSVG("stop",{offset:"100%","stop-opacity":.05},s),u.createSVG("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},o),u.createSVG("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},o),u.createSVG("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},o),u.createSVG("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},o),this._offset=i.pointGeometry.convert(r&&r.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()});const a=this._element.classList;for(const l in rI)a.remove(`mapboxgl-marker-anchor-${l}`);a.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(i){return i===this._map||(this.remove(),this._map=i,i.getCanvasContainer().appendChild(this._element),i.on("move",this._updateMoving),i.on("moveend",this._update),i.on("remove",this._clearFadeTimer),i._addMarker(this),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick)),this}remove(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._updateMoving),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._map.off("remove",this._clearFadeTimer),this._map._removeMarker(this),delete this._map),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=i.LngLat.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(i){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),i){if(!("offset"in i.options)){const r=Math.sqrt(91.125);i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[r,-1*(24.6+r)],"bottom-right":[-r,-1*(24.6+r)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=i,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(i){const r=i.code,n=i.charCode||i.keyCode;"Space"!==r&&"Enter"!==r&&32!==n&&13!==n||this.togglePopup()}_onMapClick(i){const r=i.originalEvent.target,n=this._element;this._popup&&(r===n||n.contains(r))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const i=this._popup;return i&&(i.isOpen()?(i.remove(),this._element.setAttribute("aria-expanded","false")):(i.addTo(this._map),this._element.setAttribute("aria-expanded","true"))),this}_evaluateOpacity(){const i=this._pos?this._pos.sub(this._transformedOffset()):null;if(!this._withinScreenBounds(i))return void this._clearFadeTimer();const r=this._map.unproject(i);let n=!1;if(this._map.transform._terrainEnabled()&&this._map.getTerrain()){const o=this._map.getFreeCameraOptions();if(o.position){const s=o.position.toLngLat();n=s.distanceTo(r)<.9*s.distanceTo(this._lngLat)}}const a=(1-this._map._queryFogOpacity(r))*(n?.2:1);this._element.style.opacity=`${a}`,this._popup&&this._popup._setOpacity(`${a}`),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_withinScreenBounds(i){const r=this._map.transform;return!!i&&i.x>=0&&i.x=0&&i.y{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),this._map._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(this._map.getTerrain()||this._map.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}_transformedOffset(){if(!this._defaultMarker)return this._offset;const i=this._map.transform,r=this._offset.mult(this._scale);return"map"===this._rotationAlignment&&r._rotate(i.angle),"map"===this._pitchAlignment&&(r.y*=Math.cos(i._pitch)),r}getOffset(){return this._offset}setOffset(r){return this._offset=i.pointGeometry.convert(r),this._update(),this}_onMove(r){if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=r.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=r.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new i.Event("dragstart"))),this.fire(new i.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new i.Event("dragend")),this._state="inactive"}_addDragHandler(i){this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos).add(this._transformedOffset()),this._pointerdownPos=i.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(i){return this._draggable=!!i,this._map&&(i?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i&&"auto"!==i?i:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}class rA{constructor(i){this.jumpTo(i)}getValue(r){if(r<=this._startTime)return this._start;if(r>=this._endTime)return this._end;const n=i.easeCubicInOut((r-this._startTime)/(this._endTime-this._startTime));return this._start*(1-n)+this._end*n}isEasing(i){return i>=this._startTime&&i<=this._endTime}jumpTo(i){this._startTime=-1/0,this._endTime=-1/0,this._start=i,this._end=i}easeTo(i,r,n){this._start=this.getValue(r),this._end=i,this._startTime=r,this._endTime=r+n}}const rC={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},{HTMLImageElement:rz,HTMLElement:rk,ImageBitmap:rP}=i.window,rD={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0};function rL(i){i.parentNode&&i.parentNode.removeChild(i)}const rB={showCompass:!0,showZoom:!0,visualizePitch:!1};class rR{constructor(r,n,o=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new i5({clickTolerance:r.dragRotate._mouseRotate._clickTolerance}),this.map=r,o&&(this.mousePitch=new i4({clickTolerance:r.dragRotate._mousePitch._clickTolerance})),i.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),n.addEventListener("mousedown",this.mousedown),n.addEventListener("touchstart",this.touchstart,{passive:!1}),n.addEventListener("touchmove",this.touchmove),n.addEventListener("touchend",this.touchend),n.addEventListener("touchcancel",this.reset)}down(i,r){this.mouseRotate.mousedown(i,r),this.mousePitch&&this.mousePitch.mousedown(i,r),u.disableDrag()}move(i,r){const n=this.map,o=this.mouseRotate.mousemoveWindow(i,r);if(o&&o.bearingDelta&&n.setBearing(n.getBearing()+o.bearingDelta),this.mousePitch){const s=this.mousePitch.mousemoveWindow(i,r);s&&s.pitchDelta&&n.setPitch(n.getPitch()+s.pitchDelta)}}off(){const i=this.element;i.removeEventListener("mousedown",this.mousedown),i.removeEventListener("touchstart",this.touchstart,{passive:!1}),i.removeEventListener("touchmove",this.touchmove),i.removeEventListener("touchend",this.touchend),i.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){u.enableDrag(),i.window.removeEventListener("mousemove",this.mousemove),i.window.removeEventListener("mouseup",this.mouseup)}mousedown(r){this.down(i.extend({},r,{ctrlKey:!0,preventDefault:()=>r.preventDefault()}),u.mousePos(this.element,r)),i.window.addEventListener("mousemove",this.mousemove),i.window.addEventListener("mouseup",this.mouseup)}mousemove(i){this.move(i,u.mousePos(this.element,i))}mouseup(i){this.mouseRotate.mouseupWindow(i),this.mousePitch&&this.mousePitch.mouseupWindow(i),this.offTemp()}touchstart(i){1!==i.targetTouches.length?this.reset():(this._startPos=this._lastPos=u.touchPos(this.element,i.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>i.preventDefault()},this._startPos))}touchmove(i){1!==i.targetTouches.length?this.reset():(this._lastPos=u.touchPos(this.element,i.targetTouches)[0],this.move({preventDefault:()=>i.preventDefault()},this._lastPos))}touchend(i){0===i.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)5280?rG(r,o,h/5280,i._getUIString("ScaleControl.Miles"),i):rG(r,o,h,i._getUIString("ScaleControl.Feet"),i)}else n&&"nautical"===n.unit?rG(r,o,c/1852,i._getUIString("ScaleControl.NauticalMiles"),i):c>=1e3?rG(r,o,c/1e3,i._getUIString("ScaleControl.Kilometers"),i):rG(r,o,c,i._getUIString("ScaleControl.Meters"),i)}function rG(i,r,n,o,s){const a=function(i){const r=Math.pow(10,`${Math.floor(i)}`.length-1);let n=i/r;return r*(n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:function(i){const r=Math.pow(10,Math.ceil(-Math.log(i)/Math.LN10));return Math.round(i*r)/r}(n))}(n),l=a/n;s._requestDomTask(()=>{i.style.width=r*l+"px",i.innerHTML=`${a} ${o}`})}const rZ={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},r$={version:i.version,supported:a,setRTLTextPlugin:i.setRTLTextPlugin,getRTLTextPluginStatus:i.getRTLTextPluginStatus,Map:class extends rb{constructor(r){if(null!=(r=i.extend({},rD,r)).minZoom&&null!=r.maxZoom&&r.minZoom>r.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=r.minPitch&&null!=r.maxPitch&&r.minPitch>r.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=r.minPitch&&r.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=r.maxPitch&&r.maxPitch>85)throw Error("maxPitch must be less than or equal to 85");if(super(new iL(r.minZoom,r.maxZoom,r.minPitch,r.maxPitch,r.renderWorldCopies),r),this._interactive=r.interactive,this._minTileCacheSize=r.minTileCacheSize,this._maxTileCacheSize=r.maxTileCacheSize,this._failIfMajorPerformanceCaveat=r.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=r.preserveDrawingBuffer,this._antialias=r.antialias,this._trackResize=r.trackResize,this._bearingSnap=r.bearingSnap,this._refreshExpiredTiles=r.refreshExpiredTiles,this._fadeDuration=r.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=r.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=r.collectResourceTiming,this._optimizeForTerrain=r.optimizeForTerrain,this._renderTaskQueue=new rE,this._domRenderTaskQueue=new rE,this._controls=[],this._markers=[],this._mapId=i.uniqueId(),this._locale=i.extend({},rC,r.locale),this._clickTolerance=r.clickTolerance,this._cooperativeGestures=r.cooperativeGestures,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevation=new rA(0),this._requestManager=new i.RequestManager(r.transformRequest,r.accessToken,r.testMode),this._silenceAuthErrors=!!r.testMode,"string"==typeof r.container){if(this._container=i.window.document.getElementById(r.container),!this._container)throw Error(`Container '${r.container}' not found.`)}else{if(!(r.container instanceof rk))throw Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=r.container}if(this._container.childNodes.length>0&&i.warnOnce("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),r.maxBounds&&this.setMaxBounds(r.maxBounds),i.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),void 0!==i.window&&(i.window.addEventListener("online",this._onWindowOnline,!1),i.window.addEventListener("resize",this._onWindowResize,!1),i.window.addEventListener("orientationchange",this._onWindowResize,!1),i.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1)),this.handlers=new rx(this,r),this._localFontFamily=r.localFontFamily,this._localIdeographFontFamily=r.localIdeographFontFamily,r.style&&this.setStyle(r.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),r.projection&&this.setProjection(r.projection),this._hash=r.hash&&new iR("string"==typeof r.hash&&r.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch}),r.bounds&&(this.resize(),this.fitBounds(r.bounds,i.extend({},r.fitBoundsOptions,{duration:0})))),this.resize(),r.attributionControl&&this.addControl(new rw({customAttribution:r.customAttribution})),this._logoControl=new rT,this.addControl(this._logoControl,r.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",r=>{this._update("style"===r.dataType),this.fire(new i.Event(`${r.dataType}data`,r))}),this.on("dataloading",r=>{this.fire(new i.Event(`${r.dataType}dataloading`,r))})}_getMapId(){return this._mapId}addControl(r,n){if(void 0===n&&(n=r.getDefaultPosition?r.getDefaultPosition():"top-right"),!r||!r.onAdd)return this.fire(new i.ErrorEvent(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=r.onAdd(this);this._controls.push(r);const s=this._controlPositions[n];return -1!==n.indexOf("bottom")?s.insertBefore(o,s.firstChild):s.appendChild(o),this}removeControl(r){if(!r||!r.onRemove)return this.fire(new i.ErrorEvent(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const n=this._controls.indexOf(r);return n>-1&&this._controls.splice(n,1),r.onRemove(this),this}hasControl(i){return this._controls.indexOf(i)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(r){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const n=!this._moving;return n&&this.fire(new i.Event("movestart",r)).fire(new i.Event("move",r)),this.fire(new i.Event("resize",r)),n&&this.fire(new i.Event("moveend",r)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(r){return this.transform.setMaxBounds(i.LngLatBounds.convert(r)),this._update()}setMinZoom(r){if((r=null==r?-2:r)>=-2&&r<=this.transform.maxZoom)return this.transform.minZoom=r,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=r,this._update(),this.getZoom()>r?this.setZoom(r):this.fire(new i.Event("zoomstart")).fire(new i.Event("zoom")).fire(new i.Event("zoomend")),this;throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(r){if((r=null==r?0:r)<0)throw Error("minPitch must be greater than or equal to 0");if(r>=0&&r<=this.transform.maxPitch)return this.transform.minPitch=r,this._update(),this.getPitch()85)throw Error("maxPitch must be less than or equal to 85");if(r>=this.transform.minPitch)return this.transform.maxPitch=r,this._update(),this.getPitch()>r?this.setPitch(r):this.fire(new i.Event("pitchstart")).fire(new i.Event("pitch")).fire(new i.Event("pitchend")),this;throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(i){return this.transform.renderWorldCopies=i,this._update()}getProjection(){return this.transform.getProjection()}setProjection(i){return this._lazyInitEmptyStyle(),"string"==typeof i&&(i={name:i}),this._runtimeProjection=i,this.style.updateProjection(),this._transitionFromGlobe=!1,this}project(r){return this.transform.locationPoint3D(i.LngLat.convert(r))}unproject(r){return this.transform.pointLocation3D(i.pointGeometry.convert(r))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()}_createDelegatedListener(i,r,n){if("mouseenter"===i||"mouseover"===i){let o=!1;const s=s=>{const a=r.filter(i=>this.getLayer(i)),l=a.length?this.queryRenderedFeatures(s.point,{layers:a}):[];l.length?o||(o=!0,n.call(this,new i$(i,this,s.originalEvent,{features:l}))):o=!1},a=()=>{o=!1};return{layers:new Set(r),listener:n,delegates:{mousemove:s,mouseout:a}}}if("mouseleave"===i||"mouseout"===i){let l=!1;const c=o=>{const s=r.filter(i=>this.getLayer(i));(s.length?this.queryRenderedFeatures(o.point,{layers:s}):[]).length?l=!0:l&&(l=!1,n.call(this,new i$(i,this,o.originalEvent)))},h=r=>{l&&(l=!1,n.call(this,new i$(i,this,r.originalEvent)))};return{layers:new Set(r),listener:n,delegates:{mousemove:c,mouseout:h}}}{const u=i=>{const o=r.filter(i=>this.getLayer(i)),s=o.length?this.queryRenderedFeatures(i.point,{layers:o}):[];s.length&&(i.features=s,n.call(this,i),delete i.features)};return{layers:new Set(r),listener:n,delegates:{[i]:u}}}}on(i,r,n){if(void 0===n)return super.on(i,r);Array.isArray(r)||(r=[r]);const o=this._createDelegatedListener(i,r,n);for(const s in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[i]=this._delegatedListeners[i]||[],this._delegatedListeners[i].push(o),o.delegates)this.on(s,o.delegates[s]);return this}once(i,r,n){if(void 0===n)return super.once(i,r);Array.isArray(r)||(r=[r]);const o=this._createDelegatedListener(i,r,n);for(const s in o.delegates)this.once(s,o.delegates[s]);return this}off(i,r,n){if(void 0===n)return super.off(i,r);r=new Set(Array.isArray(r)?r:[r]);const o=(i,r)=>{if(i.size!==r.size)return!1;for(const n of i)if(!r.has(n))return!1;return!0},s=this._delegatedListeners?this._delegatedListeners[i]:void 0;return s&&(i=>{for(let s=0;s{r?this.fire(new i.ErrorEvent(r)):o&&this._updateDiff(o,n)})}else"object"==typeof r&&this._updateDiff(r,n)}_updateDiff(r,n){try{this.style.setState(r)&&this._update(!0)}catch(o){i.warnOnce(`Unable to perform style diff: ${o.message||o.error||o}. Rebuilding the style from scratch.`),this._updateStyle(r,n)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():i.warnOnce("There is no style added to the map.")}addSource(i,r){return this._lazyInitEmptyStyle(),this.style.addSource(i,r),this._update(!0)}isSourceLoaded(r){const n=this.style&&this.style._getSourceCaches(r);if(0!==n.length)return n.every(i=>i.loaded());this.fire(new i.ErrorEvent(Error(`There is no source with ID '${r}'`)))}areTilesLoaded(){const i=this.style&&this.style._sourceCaches;for(const r in i){const n=i[r]._tiles;for(const o in n){const s=n[o];if("loaded"!==s.state&&"errored"!==s.state)return!1}}return!0}addSourceType(i,r,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(i,r,n)}removeSource(i){return this.style.removeSource(i),this._updateTerrain(),this._update(!0)}getSource(i){return this.style.getSource(i)}addImage(r,n,{pixelRatio:o=1,sdf:s=!1,stretchX:a,stretchY:l,content:c}={}){if(this._lazyInitEmptyStyle(),n instanceof rz||rP&&n instanceof rP){const{width:h,height:u,data:d}=i.exported.getImageData(n);this.style.addImage(r,{data:new i.RGBAImage({width:h,height:u},d),pixelRatio:o,stretchX:a,stretchY:l,content:c,sdf:s,version:0})}else{if(void 0===n.width||void 0===n.height)return this.fire(new i.ErrorEvent(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:p,height:f,data:m}=n;this.style.addImage(r,{data:new i.RGBAImage({width:p,height:f},new Uint8Array(m)),pixelRatio:o,stretchX:a,stretchY:l,content:c,sdf:s,version:0,userImage:n}),n.onAdd&&n.onAdd(this,r)}}}updateImage(r,n){const o=this.style.getImage(r);if(!o)return this.fire(new i.ErrorEvent(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=n instanceof rz||rP&&n instanceof rP?i.exported.getImageData(n):n,{width:a,height:l,data:c}=s;return void 0===a||void 0===l?this.fire(new i.ErrorEvent(Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))):a!==o.data.width||l!==o.data.height?this.fire(new i.ErrorEvent(Error("The width and height of the updated image must be that same as the previous version of the image"))):(o.data.replace(c,!(n instanceof rz||rP&&n instanceof rP)),void this.style.updateImage(r,o))}hasImage(r){return r?!!this.style.getImage(r):(this.fire(new i.ErrorEvent(Error("Missing required image id"))),!1)}removeImage(i){this.style.removeImage(i)}loadImage(r,n){i.getImage(this._requestManager.transformRequest(r,i.ResourceType.Image),(r,o)=>{n(r,o instanceof rz?i.exported.getImageData(o):o)})}listImages(){return this.style.listImages()}addLayer(i,r){return this._lazyInitEmptyStyle(),this.style.addLayer(i,r),this._update(!0)}moveLayer(i,r){return this.style.moveLayer(i,r),this._update(!0)}removeLayer(i){return this.style.removeLayer(i),this._update(!0)}getLayer(i){return this.style.getLayer(i)}setLayerZoomRange(i,r,n){return this.style.setLayerZoomRange(i,r,n),this._update(!0)}setFilter(i,r,n={}){return this.style.setFilter(i,r,n),this._update(!0)}getFilter(i){return this.style.getFilter(i)}setPaintProperty(i,r,n,o={}){return this.style.setPaintProperty(i,r,n,o),this._update(!0)}getPaintProperty(i,r){return this.style.getPaintProperty(i,r)}setLayoutProperty(i,r,n,o={}){return this.style.setLayoutProperty(i,r,n,o),this._update(!0)}getLayoutProperty(i,r){return this.style.getLayoutProperty(i,r)}setLight(i,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(i,r),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(i){return this._lazyInitEmptyStyle(),!i&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(i),this._averageElevationLastSampledAt=-1/0,this._update(!0)}_updateProjection(){"globe"===this.transform.projection.name&&this.transform.zoom>=i.GLOBE_ZOOM_THRESHOLD_MAX&&!this._transitionFromGlobe&&(this.setProjection({name:"mercator"}),this._transitionFromGlobe=!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(i){return this._lazyInitEmptyStyle(),this.style.setFog(i),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(r){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(i.LngLat.convert(r),this.transform):0}setFeatureState(i,r){return this.style.setFeatureState(i,r),this._update()}removeFeatureState(i,r){return this.style.removeFeatureState(i,r),this._update()}getFeatureState(i){return this.style.getFeatureState(i)}_updateContainerDimensions(){if(!this._container)return;const r=this._container.getBoundingClientRect().width||400,n=this._container.getBoundingClientRect().height||300;let o,s=this._container;for(;s&&!o;){const a=i.window.getComputedStyle(s).transform;a&&"none"!==a&&(o=a.match(/matrix.*\((.+)\)/)[1].split(", ")),s=s.parentElement}o?(this._containerWidth=o[0]&&"0"!==o[0]?Math.abs(r/o[0]):r,this._containerHeight=o[3]&&"0"!==o[3]?Math.abs(n/o[3]):n):(this._containerWidth=r,this._containerHeight=n)}_detectMissingCSS(){"rgb(250, 128, 114)"!==i.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&i.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const i=this._container;i.classList.add("mapboxgl-map"),(this._missingCSSCanary=u.create("div","mapboxgl-canary",i)).style.visibility="hidden",this._detectMissingCSS();const r=this._canvasContainer=u.create("div","mapboxgl-canvas-container",i);this._interactive&&r.classList.add("mapboxgl-interactive"),this._canvas=u.create("canvas","mapboxgl-canvas",r),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const n=this._controlContainer=u.create("div","mapboxgl-control-container",i),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(i=>{o[i]=u.create("div",`mapboxgl-ctrl-${i}`,n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(r,n){const o=i.exported.devicePixelRatio||1;this._canvas.width=o*Math.ceil(r),this._canvas.height=o*Math.ceil(n),this._canvas.style.width=`${r}px`,this._canvas.style.height=`${n}px`}_addMarker(i){this._markers.push(i)}_removeMarker(i){const r=this._markers.indexOf(i);-1!==r&&this._markers.splice(r,1)}_setupPainter(){const r=i.extend({},a.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),n=this._canvas.getContext("webgl",r)||this._canvas.getContext("experimental-webgl",r);n?(i.storeAuthState(n,!0),this.painter=new iv(n,this.transform),this.on("data",i=>{"source"===i.dataType&&this.painter.setTileLoadedFlag(!0)}),i.exported$1.testSupport(n)):this.fire(new i.ErrorEvent(Error("Failed to initialize WebGL")))}_contextLost(r){r.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new i.Event("webglcontextlost",{originalEvent:r}))}_contextRestored(r){this._setupPainter(),this.resize(),this._update(),this.fire(new i.Event("webglcontextrestored",{originalEvent:r}))}_onMapScroll(i){if(i.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(i){return this.style&&(this._styleDirty=this._styleDirty||i,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(i){return this._update(),this._renderTaskQueue.add(i)}_cancelRenderFrame(i){this._renderTaskQueue.remove(i)}_requestDomTask(i){!this.loaded()||this.loaded()&&!this.isMoving()?i():this._domRenderTaskQueue.add(i)}_render(r){let n;const o=this.painter.context.extTimerQuery,s=i.exported.now();this.listens("gpu-timing-frame")&&(n=o.createQueryEXT(),o.beginQueryEXT(o.TIME_ELAPSED_EXT,n));let a=this._updateAverageElevation(s);if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(r),this._domRenderTaskQueue.run(r),this._removed)return;this._updateProjection();let l=!1;const c=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const h=this.transform.zoom,u=this.transform.pitch,d=i.exported.now();this.style.zoomHistory.update(h,d);const p=new i.EvaluationParameters(h,{now:d,fadeDuration:c,pitch:u,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),f=p.crossFadingFactor();1===f&&f===this._crossFadingFactor||(l=!0,this._crossFadingFactor=f),this.style.update(p)}if(this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),this.style._updateSources(this.transform),this._forceMarkerUpdate()),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,c,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:c,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),speedIndexTiming:this.speedIndexTiming}),this.fire(new i.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new i.Event("load"))),this.style&&(this.style.hasTransitions()||l)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const m=i.exported.now()-s;o.endQueryEXT(o.TIME_ELAPSED_EXT,n),setTimeout(()=>{const r=o.getQueryObjectEXT(n,o.QUERY_RESULT_EXT)/1e6;o.deleteQueryEXT(n),this.fire(new i.Event("gpu-timing-frame",{cpuTime:m,gpuTime:r}))},50)}if(this.listens("gpu-timing-layer")){const _=this.painter.collectGpuTimers();setTimeout(()=>{const r=this.painter.queryGpuTimers(_);this.fire(new i.Event("gpu-timing-layer",{layerTimes:r}))},50)}const g=this._sourcesDirty||this._styleDirty||this._placementDirty||a;if(g||this._repaint)this.triggerRepaint();else{const y=!this.isMoving()&&this.loaded();if(y&&(a=this._updateAverageElevation(s,!0)),a)this.triggerRepaint();else if(this._triggerFrame(!1),y&&(this.fire(new i.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const x=this._calculateSpeedIndex();this.fire(new i.Event("speedindexcompleted",{speedIndex:x})),this.speedIndexTiming=!1}}return!this._loaded||this._fullyLoaded||g||(this._fullyLoaded=!0,this._authenticate()),this}_forceMarkerUpdate(){for(const i of this._markers)i._update()}_updateAverageElevation(i,r=!1){const n=i=>(this.transform.averageElevation=i,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&n(0);if((r||i-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(i)){const o=this.transform.averageElevation;let s=this.transform.sampleAverageElevation();isNaN(s)?s=0:this._averageElevationLastSampledAt=i;const a=Math.abs(o-s);if(a>1){if(this._isInitialLoad)return this._averageElevation.jumpTo(s),n(s);this._averageElevation.easeTo(s,i,300)}else if(a>1e-4)return this._averageElevation.jumpTo(s),n(s)}return!!this._averageElevation.isEasing(i)&&n(this._averageElevation.getValue(i))}_authenticate(){i.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,r=>{if(r&&(r.message===i.AUTH_ERR_MSG||401===r.status)){const n=this.painter.context.gl;i.storeAuthState(n,!1),this._logoControl instanceof rT&&this._logoControl._updateLogo(),n&&n.clear(n.DEPTH_BUFFER_BIT|n.COLOR_BUFFER_BIT|n.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new i.ErrorEvent(Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),i.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_updateTerrain(){this.painter.updateTerrain(this.style,this.isMoving()||this.isRotating()||this.isZooming())}_calculateSpeedIndex(){const i=this.painter.canvasCopy(),r=this.painter.getCanvasCopiesAndTimestamps();r.timeStamps.push(performance.now());const n=this.painter.context.gl,o=n.createFramebuffer();function s(i){n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,i,0);const r=new Uint8Array(n.drawingBufferWidth*n.drawingBufferHeight*4);return n.readPixels(0,0,n.drawingBufferWidth,n.drawingBufferHeight,n.RGBA,n.UNSIGNED_BYTE,r),r}return n.bindFramebuffer(n.FRAMEBUFFER,o),this._canvasPixelComparison(s(i),r.canvasCopies.map(s),r.timeStamps)}_canvasPixelComparison(i,r,n){let o=n[1]-n[0];const s=i.length/4;for(let a=0;a{const r=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,r&&this._render(i)}))}_preloadTiles(r){const n=this.style&&Object.values(this.style._sourceCaches)||[];return i.asyncAll(n,(i,n)=>i._preloadTiles(r,n),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(i){this._trackResize&&this.resize({originalEvent:i})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(i){this._showTileBoundaries!==i&&(this._showTileBoundaries=i,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(i){this._showTerrainWireframe!==i&&(this._showTerrainWireframe=i,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(i){this._speedIndexTiming!==i&&(this._speedIndexTiming=i,this._update())}get showPadding(){return!!this._showPadding}set showPadding(i){this._showPadding!==i&&(this._showPadding=i,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(i){this._showCollisionBoxes!==i&&(this._showCollisionBoxes=i,i?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(i){this._showOverdrawInspector!==i&&(this._showOverdrawInspector=i,this._update())}get repaint(){return!!this._repaint}set repaint(i){this._repaint!==i&&(this._repaint=i,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(i){this._vertices=i,this._update()}_setCacheLimits(r,n){i.setCacheLimits(r,n)}get version(){return i.version}},NavigationControl:class{constructor(r){this.options=i.extend({},rB,r),this._container=u.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(i.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",i=>this._map.zoomIn({},{originalEvent:i})),u.create("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",i=>this._map.zoomOut({},{originalEvent:i})),u.create("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(i.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",i=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:i}):this._map.resetNorth({},{originalEvent:i})}),this._compassIcon=u.create("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))}_updateZoomButtons(){const i=this._map.getZoom(),r=i===this._map.getMaxZoom(),n=i===this._map.getMinZoom();this._zoomInButton.disabled=r,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",r.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const i=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._map._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=i)})}onAdd(i){return this._map=i,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new rR(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(i,r){const n=u.create("button",i,this._container);return n.type="button",n.addEventListener("click",r),n}_setButtonTitle(i,r){const n=this._map._getUIString(`NavigationControl.${r}`);i.setAttribute("aria-label",n),i.firstElementChild&&i.firstElementChild.setAttribute("title",n)}},GeolocateControl:class extends i.Evented{constructor(r){super(),this.options=i.extend({},rF,r),i.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation"],this),this._onDeviceOrientationListener=this._onDeviceOrientation.bind(this),this._updateMarkerRotationThrottled=iB(this._updateMarkerRotation,20)}onAdd(r){var n;return this._map=r,this._container=u.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),n=this._setupUI,void 0!==rO?n(rO):void 0!==i.window.navigator.permissions?i.window.navigator.permissions.query({name:"geolocation"}).then(i=>{n(rO="denied"!==i.state)}):n(rO=!!i.window.navigator.geolocation),this._container}onRemove(){void 0!==this._geolocationWatchID&&(i.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,rU=0,rV=!1}_isOutOfMapMaxBounds(i){const r=this._map.getMaxBounds(),n=i.coords;return r&&(n.longituder.getEast()||n.latituder.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(r){if(this._map){if(this._isOutOfMapMaxBounds(r))return this._setErrorState(),this.fire(new i.Event("outofmaxbounds",r)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=r,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(r),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(r),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("geolocate",r)),this._finish()}}_updateCamera(r){const n=new i.LngLat(r.coords.longitude,r.coords.latitude),o=r.coords.accuracy,s=this._map.getBearing(),a=i.extend({bearing:s},this.options.fitBoundsOptions);this._map.fitBounds(n.toBounds(o),a,{geolocateSource:!0})}_updateMarker(r){if(r){const n=new i.LngLat(r.coords.longitude,r.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=r.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const i=this._map._containerHeight/2,r=this._map.unproject([0,i]),n=this._map.unproject([100,i]),o=r.distanceTo(n)/100,s=Math.ceil(2*this._accuracy/o);this._circleElement.style.width=`${s}px`,this._circleElement.style.height=`${s}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._dotElement.classList.add("mapboxgl-user-location-show-heading")):(this._dotElement.classList.remove("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(r){if(this._map){if(this.options.trackUserLocation){if(1===r.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",n),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",n),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===r.code&&rV)return;this._setErrorState()}}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("error",r)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(r){if(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=u.create("button","mapboxgl-ctrl-geolocate",this._container),u.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===r){i.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",n),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",n)}else{const o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",o),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=u.create("div","mapboxgl-user-location"),this._dotElement.appendChild(u.create("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(u.create("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new rM({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=u.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new rM({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",r=>{r.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r.originalEvent&&"resize"===r.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new i.Event("trackuserlocationend")))})}_onDeviceOrientation(i){this._userLocationDotMarker&&(i.webkitCompassHeading?this._heading=i.webkitCompassHeading:!0===i.absolute&&(this._heading=-1*i.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return i.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new i.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":rU--,rV=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new i.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new i.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let r;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++rU>1?(r={maximumAge:6e5,timeout:0},rV=!0):(r=this.options.positionOptions,rV=!1),this._geolocationWatchID=i.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,r),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else i.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const r=()=>{i.window.addEventListener("ondeviceorientationabsolute"in i.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientationListener)};void 0!==i.window.DeviceMotionEvent&&"function"==typeof i.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(i=>{"granted"===i&&r()}).catch(console.error):r()}_clearWatch(){i.window.navigator.geolocation.clearWatch(this._geolocationWatchID),i.window.removeEventListener("deviceorientation",this._onDeviceOrientationListener),i.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientationListener),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:rw,ScaleControl:class{constructor(r){this.options=i.extend({},rN,r),i.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){rj(this._map,this._container,this.options)}onAdd(i){return this._map=i,this._container=u.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",i.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}setUnit(i){this.options.unit=i,rj(this._map,this._container,this.options)}},FullscreenControl:class{constructor(r){this._fullscreen=!1,r&&r.container&&(r.container instanceof i.window.HTMLElement?this._container=r.container:i.warnOnce("Full screen control 'container' must be a DOM element.")),i.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in i.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in i.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(r){return this._map=r,this._container||(this._container=this._map.getContainer()),this._controlContainer=u.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",i.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,i.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!i.window.document.fullscreenEnabled&&!i.window.document.webkitFullscreenEnabled)}_setupUI(){const r=this._fullscreenButton=u.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);u.create("span","mapboxgl-ctrl-icon",r).setAttribute("aria-hidden",!0),r.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),i.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const i=this._getTitle();this._fullscreenButton.setAttribute("aria-label",i),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",i)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(i.window.document.fullscreenElement||i.window.document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?i.window.document.exitFullscreen?i.window.document.exitFullscreen():i.window.document.webkitCancelFullScreen&&i.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends i.Evented{constructor(r){super(),this.options=i.extend(Object.create(rZ),r),i.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this),this._classList=new Set(r&&r.className?r.className.trim().split(/\s+/):[])}addTo(r){return this._map&&this.remove(),this._map=r,this.options.closeOnClick&&this._map.on("preclick",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new i.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new i.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=i.LngLat.convert(r),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(r){return this.setDOMContent(i.window.document.createTextNode(r))}setHTML(r){let n;const o=i.window.document.createDocumentFragment(),s=i.window.document.createElement("body");for(s.innerHTML=r;n=s.firstChild;)o.appendChild(n);return this.setDOMContent(o)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(i){return this.options.maxWidth=i,this._update(),this}setDOMContent(i){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=u.create("div","mapboxgl-popup-content",this._container);return this._content.appendChild(i),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(i){return this._classList.add(i),this._container&&this._updateClassList(),this}removeClassName(i){return this._classList.delete(i),this._container&&this._updateClassList(),this}setOffset(i){return this.options.offset=i,this._update(),this}toggleClassName(i){let r;return this._classList.delete(i)?r=!1:(this._classList.add(i),r=!0),this._container&&this._updateClassList(),r}_createCloseButton(){this.options.closeButton&&(this._closeButton=u.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.setAttribute("aria-hidden","true"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(i){this._update(i.point)}_onMouseMove(i){this._update(i.point)}_onDrag(i){this._update(i.point)}_getAnchor(i){let r;if(this.options.anchor)return this.options.anchor;const n=this._pos,o=this._container.offsetWidth,s=this._container.offsetHeight;return r=n.y+i.bottom.ythis._map.transform.height-s?["bottom"]:[],n.xthis._map.transform.width-o/2&&r.push("right"),0===r.length?"bottom":r.join("-")}_updateClassList(){const i=[...this._classList];i.push("mapboxgl-popup"),this._anchor&&i.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&i.push("mapboxgl-popup-track-pointer"),this._container.className=i.join(" ")}_update(r){if(this._map&&(this._lngLat||this._trackPointer)&&this._content){if(this._container||(this._container=u.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=u.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content)),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=rS(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||r){const n=this._pos=this._trackPointer&&r?r:this._map.project(this._lngLat),o=function(r){if(r||(r=new i.pointGeometry(0,0)),"number"==typeof r){const n=Math.round(Math.sqrt(.5*Math.pow(r,2)));return{center:new i.pointGeometry(0,0),top:new i.pointGeometry(0,r),"top-left":new i.pointGeometry(n,n),"top-right":new i.pointGeometry(-n,n),bottom:new i.pointGeometry(0,-r),"bottom-left":new i.pointGeometry(n,-n),"bottom-right":new i.pointGeometry(-n,-n),left:new i.pointGeometry(r,0),right:new i.pointGeometry(-r,0)}}if(r instanceof i.pointGeometry||Array.isArray(r)){const o=i.pointGeometry.convert(r);return{center:o,top:o,"top-left":o,"top-right":o,bottom:o,"bottom-left":o,"bottom-right":o,left:o,right:o}}return{center:i.pointGeometry.convert(r.center||[0,0]),top:i.pointGeometry.convert(r.top||[0,0]),"top-left":i.pointGeometry.convert(r["top-left"]||[0,0]),"top-right":i.pointGeometry.convert(r["top-right"]||[0,0]),bottom:i.pointGeometry.convert(r.bottom||[0,0]),"bottom-left":i.pointGeometry.convert(r["bottom-left"]||[0,0]),"bottom-right":i.pointGeometry.convert(r["bottom-right"]||[0,0]),left:i.pointGeometry.convert(r.left||[0,0]),right:i.pointGeometry.convert(r.right||[0,0])}}(this.options.offset),s=this._anchor=this._getAnchor(o),a=n.add(o[s]).round();this._map._requestDomTask(()=>{this._container&&s&&(this._container.style.transform=`${rI[s]} translate(${a.x}px,${a.y}px)`)})}this._updateClassList()}}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const i=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");i&&i.focus()}_onClose(){this.remove()}_setOpacity(i){this._content&&(this._content.style.opacity=i),this._tip&&(this._tip.style.opacity=i)}},Marker:rM,Style:tf,LngLat:i.LngLat,LngLatBounds:i.LngLatBounds,Point:i.pointGeometry,MercatorCoordinate:i.MercatorCoordinate,FreeCameraOptions:iI,Evented:i.Evented,config:i.config,prewarm:function(){eC().acquire(eM)},clearPrewarmedResources:function(){const i=o;i&&(i.isPreloaded()&&1===i.numActive()?(i.release(eM),o=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return i.config.ACCESS_TOKEN},set accessToken(t){i.config.ACCESS_TOKEN=t},get baseApiUrl(){return i.config.API_URL},set baseApiUrl(t){i.config.API_URL=t},get workerCount(){return eA.workerCount},set workerCount(e){eA.workerCount=e},get maxParallelImageRequests(){return i.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){i.config.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(r){i.clearTileCache(r)},workerUrl:"",workerClass:null,setNow:i.exported.setNow,restoreNow:i.exported.restoreNow};return r$}),n},i.exports=o()}}]); + with id '${r.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(i){i.coord&&"source"===i.dataType?this._clearRenderCacheForTile(i.sourceCacheId,i.coord):"style"===i.dataType&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const i in this._style._sourceCaches)this._style._sourceCaches[i].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(i=>i.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture)}_source(){return this.enabled?this.sourceCache:null}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const i=2*this.proxySourceCache.getSource().tileSize;return[i,i]}set useVertexMorphing(i){this._useVertexMorphing=i}updateTileBinding(r){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const n=this.proxySourceCache,o=this.painter.transform;this._initializing&&(this._initializing=0===o._centerAltitude&&-1===this.getAtPointOrZero(i.MercatorCoordinate.fromLngLat(o.center),-1),this._emptyDEMTextureDirty=!this._initializing);const s=this.proxyCoords=n.getIds().map(i=>{const r=n.getTileByID(i).tileID;return r.projMatrix=o.calculateProjMatrix(r.toUnwrapped()),r});(function(r,n){const o=n.transform.pointCoordinate(n.transform.getCameraPoint()),s=new i.pointGeometry(o.x,o.y);r.sort((r,n)=>{if(n.overscaledZ-r.overscaledZ)return n.overscaledZ-r.overscaledZ;const o=new i.pointGeometry(r.canonical.x+(1<{this.proxyToSource[i.key]={}}),this.terrainTileForTile={};const l=this._style._sourceCaches;for(const c in l){const h=l[c];if(!h.used||(h!==this.sourceCache&&this.resetTileLookupCache(h.id),this._setupProxiedCoordsForOrtho(h,r[c],a),h.usedForTerrain))continue;const u=r[c];h.getSource().reparseOverscaled&&this._assignTerrainTiles(u)}this.proxiedCoords[n.id]=s.map(i=>new tL(i,i.key,this.orthoMatrix)),this._assignTerrainTiles(s),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(a),this.renderingToTexture=!1,this._updateTimestamp=i.exported.now();const d={};for(const p of(this._visibleDemTiles=[],this.proxyCoords)){const f=this.terrainTileForTile[p.key];if(!f)continue;const m=f.tileID.key;m in d||(this._visibleDemTiles.push(f),d[m]=m)}}_assignTerrainTiles(i){this._initializing||i.forEach(i=>{if(this.terrainTileForTile[i.key])return;const r=this._findTileCoveringTileID(i,this.sourceCache);r&&(this.terrainTileForTile[i.key]=r)})}_prepareDEMTextures(){const i=this.painter.context,r=i.gl;for(const n in this.terrainTileForTile){const o=this.terrainTileForTile[n],s=o.dem;s&&(!o.demTexture||o.needsDEMTextureUpload)&&(i.activeTexture.set(r.TEXTURE1),tT(this.painter,o,s))}}_prepareDemTileUniforms(i,r,n,o){if(!r||null==r.demTexture)return!1;const s=i.tileID.canonical,a=Math.pow(2,r.tileID.canonical.z-s.z),l=o||"";return n[`u_dem_tl${l}`]=[s.x*a%1,s.y*a%1],n[`u_dem_scale${l}`]=a,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const r=this.painter.context,n=r.gl;if(!this._emptyDepthBufferTexture){const o={width:1,height:1,data:new Uint8Array([255,255,255,255])};this._emptyDepthBufferTexture=new i.Texture(r,o,n.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let i=0;const r=this._visibleDemTiles.reduce((r,n)=>{if(!n.dem)return r;const o=n.dem.tree.minimums[0];return o>0&&i++,r+o},0);return i?r/i:0}_updateEmptyDEMTexture(){const r=this.painter.context,n=r.gl;r.activeTexture.set(n.TEXTURE2);const o=this._getLoadedAreaMinimum(),s={width:1,height:1,data:new Uint8Array(i.DEMData.pack(o,this.sourceCache.getSource().encoding))};this._emptyDEMTextureDirty=!1;let a=this._emptyDEMTexture;return a?a.update(s,{premultiply:!1}):a=this._emptyDEMTexture=new i.Texture(r,s,n.RGBA,{premultiply:!1}),a}setupElevationDraw(r,n,o){var s;const a=this.painter.context,l=a.gl,c=(s=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:i.DEMData.getUnpackVector(s),u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0,u_tile_tl_up:[0,0,1],u_tile_tr_up:[0,0,1],u_tile_br_up:[0,0,1],u_tile_bl_up:[0,0,1],u_tile_up_scale:1});c.u_dem_size=this.sourceCache.getSource().tileSize,c.u_exaggeration=this.exaggeration();const h=this.painter.transform,u=h.projection.createTileTransform(h,h.worldSize),d=r.tileID.canonical;c.u_tile_tl_up=u.upVector(d,0,0),c.u_tile_tr_up=u.upVector(d,i.EXTENT,0),c.u_tile_br_up=u.upVector(d,i.EXTENT,i.EXTENT),c.u_tile_bl_up=u.upVector(d,0,i.EXTENT),c.u_tile_up_scale=u.upVectorScale(d);let p=null,f=null,m=1;if(o&&o.morphing&&this._useVertexMorphing){const _=o.morphing.srcDemTile,g=o.morphing.dstDemTile;m=o.morphing.phase,_&&g&&(this._prepareDemTileUniforms(r,_,c,"_prev")&&(f=_),this._prepareDemTileUniforms(r,g,c)&&(p=g))}if(f&&p?(a.activeTexture.set(l.TEXTURE2),p.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE,l.NEAREST),a.activeTexture.set(l.TEXTURE4),f.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE,l.NEAREST),c.u_dem_lerp=m):(p=this.terrainTileForTile[r.tileID.key],a.activeTexture.set(l.TEXTURE2),(this._prepareDemTileUniforms(r,p,c)?p.demTexture:this.emptyDEMTexture).bind(l.NEAREST,l.CLAMP_TO_EDGE)),a.activeTexture.set(l.TEXTURE3),o&&o.useDepthForOcclusion?(this._depthTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE),c.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height]):(this.emptyDepthBufferTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE),c.u_depth_size_inv=[1,1]),o&&o.useMeterToDem&&p){const y=(1<{if(c===i)return;const o=[];n&&o.push(tC[d]),o.push(tC[i]),o.push("PROJECTION_GLOBE_VIEW"),l=r.useProgram("globeRaster",null,o),c=i},f=r.colorModeForRenderPass(),m=new i.DepthMode(u.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D);tA.update(a);const _=r.transform,g=i.calculateGlobeMatrix(_,_.worldSize),y=i.calculateGlobeMercatorMatrix(_),x=[i.mercatorXfromLng(_.center.lng),i.mercatorYfromLat(_.center.lat)],v=r.globeSharedBuffers;(d?[!1,!0]:[!1]).forEach(d=>{c=-1;const b=d?u.LINES:u.TRIANGLES;for(const w of s){const T=o.getTile(w),E=Math.pow(2,w.canonical.z),[S,I]=i.globeBuffersForTileMesh(r,T,w,E),M=i.StencilMode.disabled,A=n.prevTerrainTileForTile[w.key],C=n.terrainTileForTile[w.key];tM(A,C)&&tA.newMorphing(w.key,A,C,a,250),h.activeTexture.set(u.TEXTURE0),T.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE);const z=tA.getMorphValuesForProxy(w.key),k=z?1:0,P={};z&&i.extend$1(P,{morphing:{srcDemTile:z.from,dstDemTile:z.to,phase:i.easeCubicInOut(z.phase)}});const D=i.globeMatrixForTile(w.canonical,g),L=tI(_.projMatrix,D,y,i.globeToMercatorTransition(_.zoom),x);if(p(k,d),n.setupElevationDraw(T,l,P),r.prepareDrawProgram(h,l,w.toUnwrapped()),v){const[B,R]=d?v.getWirefameBuffer(r.context):[v.gridIndexBuffer,v.gridSegments];l.draw(h,b,m,M,f,i.CullFaceMode.backCCW,L,"globe_raster",S,B,R)}if(!d){const F=[0===w.canonical.y?i.globePoleMatrixForTile(w.canonical,!1,_):null,w.canonical.y===E-1?i.globePoleMatrixForTile(w.canonical,!0,_):null];for(const O of F){if(!O)continue;const U=tI(_.projMatrix,O,O,0,x);v&&l.draw(h,b,m,M,f,i.CullFaceMode.disabled,U,"globe_pole_raster",I,v.poleIndexBuffer,v.poleSegments)}}}})}(r,n,o,s,a);else{let l,c;const h=r.context,u=h.gl,d=r.options.showTerrainWireframe?2:0,p=(i,n)=>{if(c===i)return;const o=[tC[i]];n&&o.push(tC[d]),l=r.useProgram("terrainRaster",null,o),c=i},f=r.colorModeForRenderPass(),m=new i.DepthMode(u.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D);tA.update(a);const _=r.transform,g=6*Math.pow(1.5,22-_.zoom)*n.exaggeration();(d?[!1,!0]:[!1]).forEach(d=>{c=-1;const y=d?u.LINES:u.TRIANGLES,[x,v]=d?n.getWirefameBuffer():[n.gridIndexBuffer,n.gridSegments];for(const b of s){let w;const T=o.getTile(b),E=i.StencilMode.disabled,S=n.prevTerrainTileForTile[b.key],I=n.terrainTileForTile[b.key];tM(S,I)&&tA.newMorphing(b.key,S,I,a,250),h.activeTexture.set(u.TEXTURE0),T.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE,u.LINEAR_MIPMAP_NEAREST);const M=tA.getMorphValuesForProxy(b.key),A=M?1:0;M&&(w={morphing:{srcDemTile:M.from,dstDemTile:M.to,phase:i.easeCubicInOut(M.phase)}});const C=tS(b.projMatrix,!function(i,r){const n=1<i.dem).forEach(r=>{i=Math.min(i,r.dem.tree.minimums[0])}),0===i?i:(i-30)*this._exaggeration}raycast(i,r,n){if(!this._visibleDemTiles)return null;const o=this._visibleDemTiles.filter(i=>i.dem).map(o=>{const s=o.tileID,a=Math.pow(2,s.overscaledZ),{x:l,y:c}=s.canonical,h=l/a,u=(l+1)/a,d=c/a,p=(c+1)/a;return{minx:h,miny:d,maxx:u,maxy:p,t:o.dem.tree.raycastRoot(h,d,u,p,i,r,n),tile:o}});for(const s of(o.sort((i,r)=>(null!==i.t?i.t:Number.MAX_VALUE)-(null!==r.t?r.t:Number.MAX_VALUE)),o)){if(null==s.t)break;const a=s.tile.dem.tree.raycast(s.minx,s.miny,s.maxx,s.maxy,i,r,n);if(null!=a)return a}return null}_createFBO(){const r=this.painter.context,n=r.gl,o=this.drapeBufferSize;r.activeTexture.set(n.TEXTURE0);const s=new i.Texture(r,{width:o[0],height:o[1],data:null},n.RGBA);s.bind(n.LINEAR,n.CLAMP_TO_EDGE);const a=r.createFramebuffer(o[0],o[1],!1);return a.colorAttachment.set(s.texture),a.depthAttachment=new ef(r,a.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=r.createRenderbuffer(r.gl.DEPTH_STENCIL,o[0],o[1]),this._stencilRef=0,a.depthAttachment.set(this._sharedDepthStencil),r.clear({stencil:0})):a.depthAttachment.set(this._sharedDepthStencil),r.extTextureFilterAnisotropic&&!r.extTextureFilterAnisotropicForceOff&&n.texParameterf(n.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.extTextureFilterAnisotropicMax),{fb:a,tex:s,dirty:!1}}_initFBOPool(){for(;this.pool.length{const r=this._style._layers[i],n=r.isHidden(this.painter.transform.zoom),o=r.getCrossfadeParameters(),s=!!o&&1!==o.t,a=r.hasTransition();return"custom"!==r.type&&!n&&(s||a)})}_clearRasterFadeFromRenderCache(){let i=!1;for(const r in this._style._sourceCaches)if(this._style._sourceCaches[r]._source instanceof ev){i=!0;break}if(i)for(let n=0;nr.renderCachePool.length){const n=Object.values(r.proxyCachedFBO);r.proxyCachedFBO={};for(let o=0;o=0;c--){const h=a[c];if(r.getTileByID(h.key),void 0!==r.proxyCachedFBO[h.key]){const u=i[h.key],d=this.proxyToSource[h.key];let p=0;for(const f in d){const m=d[f],_=u[f];if(!_||_.length!==m.length||m.some((i,r)=>i!==_[r]||l[f]&&l[f].hasOwnProperty(i.key))){p=-1;break}++p}for(const g in r.proxyCachedFBO[h.key])r.renderCache[r.proxyCachedFBO[h.key][g]].dirty=p<0||p!==Object.values(u).length}}const y=[...this._drapedRenderBatches];for(const x of(y.sort((i,r)=>r.end-r.start-(i.end-i.start)),y))for(const v of a){if(r.proxyCachedFBO[v.key])continue;let b=r.renderCachePool.pop();void 0===b&&r.renderCache.length<50&&(b=r.renderCache.length,r.renderCache.push(this._createFBO())),void 0!==b&&(r.proxyCachedFBO[v.key]={},r.proxyCachedFBO[v.key][x.start]=b,r.renderCache[b].dirty=!0)}this._tilesDirty={}}_setupStencil(i,r,n,o){let s;if(!o||!this._sourceTilesOverlap[o.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const a=this.painter.context,l=a.gl;if(r.length<=1)return void(this._overlapStencilType=!1);if(n.isTileClipped())s=r.length,this._overlapStencilMode.test={func:l.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(r[0].overscaledZ>r[r.length-1].overscaledZ))return void(this._overlapStencilType=!1);s=1,this._overlapStencilMode.test={func:l.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+s>255&&(a.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=s,this._overlapStencilMode.ref=this._stencilRef,n.isTileClipped()&&this._renderTileClippingMasks(r,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(r){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[r.key]),this._overlapStencilMode):i.StencilMode.disabled}_renderTileClippingMasks(r,n){const o=this.painter,s=this.painter.context,a=s.gl;o._tileClippingMaskIDs={},s.setColorMode(i.ColorMode.disabled),s.setDepthMode(i.DepthMode.disabled);const l=o.useProgram("clippingMask");for(const c of r){const h=o._tileClippingMaskIDs[c.key]=--n;l.draw(s,a.TRIANGLES,i.DepthMode.disabled,new i.StencilMode({func:a.ALWAYS,mask:0},h,255,a.KEEP,a.KEEP,a.REPLACE),i.ColorMode.disabled,i.CullFaceMode.disabled,tz(c.projMatrix),"$clipping",o.tileExtentBuffer,o.quadTriangleIndexBuffer,o.tileExtentSegments)}}pointCoordinate(r){const n=this.painter.transform;if(r.x<0||r.x>n.width||r.y<0||r.y>n.height)return null;const o=[r.x,r.y,1,1];i.transformMat4$1(o,o,n.pixelMatrixInverse),i.scale$1(o,o,1/o[3]),o[0]/=n.worldSize,o[1]/=n.worldSize;const s=n._camera.position,a=i.mercatorZfromAltitude(1,n.center.lat),l=[s[0],s[1],s[2]/a,0],c=i.subtract([],o.slice(0,3),l);i.normalize(c,c);const h=this.raycast(l,c,this._exaggeration);return null!==h&&h?(i.scaleAndAdd(l,l,c,h),l[3]=l[2],l[2]*=a,l):null}drawDepth(){const r=this.painter,n=r.context,o=this.proxySourceCache,s=Math.ceil(r.width),a=Math.ceil(r.height);if(this._depthFBO&&(this._depthFBO.width!==s||this._depthFBO.height!==a)&&(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture),!this._depthFBO){const l=n.gl,c=n.createFramebuffer(s,a,!0);n.activeTexture.set(l.TEXTURE0);const h=new i.Texture(n,{width:s,height:a,data:null},l.RGBA);h.bind(l.NEAREST,l.CLAMP_TO_EDGE),c.colorAttachment.set(h.texture);const u=n.createRenderbuffer(n.gl.DEPTH_COMPONENT16,s,a);c.depthAttachment.set(u),this._depthFBO=c,this._depthTexture=h}n.bindFramebuffer.set(this._depthFBO.framebuffer),n.viewport.set([0,0,s,a]),function(r,n,o,s){if("globe"===r.transform.projection.name)return;const a=r.context,l=a.gl;a.clear({depth:1});const c=r.useProgram("terrainDepth"),h=new i.DepthMode(l.LESS,i.DepthMode.ReadWrite,r.depthRangeFor3D);for(const u of s){const d=o.getTile(u),p=tS(u.projMatrix,0);n.setupElevationDraw(d,c),c.draw(a,l.TRIANGLES,h,i.StencilMode.disabled,i.ColorMode.unblended,i.CullFaceMode.backCCW,p,"terrain_depth",n.gridBuffer,n.gridIndexBuffer,n.gridNoSkirtSegments)}}(r,this,o,this.proxyCoords)}_setupProxiedCoordsForOrtho(i,r,n){if(i.getSource() instanceof ew)return this._setupProxiedCoordsForImageSource(i,r,n);this._findCoveringTileCache[i.id]=this._findCoveringTileCache[i.id]||{};const o=this.proxiedCoords[i.id]=[],s=this.proxyCoords;for(let a=0;a(i.min.x=Math.min(i.min.x,r.x-c.x),i.min.y=Math.min(i.min.y,r.y-c.y),i.max.x=Math.max(i.max.x,r.x-c.x),i.max.y=Math.max(i.max.y,r.y-c.y),i),{min:new i.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),u=(r,n)=>{const o=r.wrap+r.canonical.x/(1<l+h.max.x||s+ac+h.max.y};for(let d=0;di.key===n.tileID.key);if(a)return a}if(n.tileID.key!==r.key){let l,c,h;const u=r.canonical.z-n.tileID.canonical.z;s=i.create();const d=n.tileID.wrap-r.wrap<0?(c=(l=i.EXTENT>>u)*((n.tileID.canonical.x<=d){const p=r.canonical.z-d;n.getSource().reparseOverscaled?(c=Math.max(r.canonical.z+2,n.transform.tileZoom),l=new i.OverscaledTileID(c,r.wrap,d,r.canonical.x>>p,r.canonical.y>>p)):0!==p&&(c=d,l=new i.OverscaledTileID(c,r.wrap,d,r.canonical.x>>p,r.canonical.y>>p))}l.key!==r.key&&(u.push(l.key),o=n.getTile(l))}const f=i=>{u.forEach(r=>{s[r]=i}),u.length=0};for(c-=1;c>=h&&(!o||!o.hasData());c--){o&&f(o.tileID.key);const m=l.calculateScaledKey(c);if((o=n.getTileByID(m))&&o.hasData())break;const _=s[m];if(null===_)break;void 0===_?u.push(m):o=n.getTileByID(_)}return f(o?o.tileID.key:null),o&&o.hasData()?o:null}findDEMTileFor(i){return this.enabled?this._findTileCoveringTileID(i,this.sourceCache):null}prepareDrawTile(i){this.renderedToTile=!0}_clearRenderCacheForTile(i,r){let n=this._tilesDirty[i];n||(n=this._tilesDirty[i]={}),n[r.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const r=function(r){let n,o,s;const a=new i.StructArrayLayout2ui4;for(o=1;o<129;o++){for(n=1;n<129;n++)s=131*o+n,a.emplaceBack(s,s+1),a.emplaceBack(s,s+131),a.emplaceBack(s+1,s+131),128===o&&a.emplaceBack(s+131,s+131+1);a.emplaceBack(s+1,s+1+131)}return a}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(r),this.wireframeSegments=i.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,r.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}}function tR(i){const r=[];for(let n=0;n_.indexOf(g)&&_.push(g);let y=s?s.defines():[];y=y.concat(l.map(i=>`#define ${i}`));const x=y.concat("\n#ifdef GL_ES\nprecision mediump float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",tm,tx.fragmentSource,ty.fragmentSource,o.fragmentSource).join("\n"),v=y.concat("\n#ifdef GL_ES\nprecision highp float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",tm,tx.vertexSource,ty.vertexSource,tg.vertexSource,o.vertexSource).join("\n"),b=c.createShader(c.FRAGMENT_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);c.shaderSource(b,x),c.compileShader(b),c.attachShader(this.program,b);const w=c.createShader(c.VERTEX_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);c.shaderSource(w,v),c.compileShader(w),c.attachShader(this.program,w),this.attributes={};const T={};this.numAttributes=d.length;for(let E=0;E>16,c>>16],u_pixel_coord_lower:[65535&l,65535&c]}}const tU=(r,n,o,s)=>{const a=n.style.light,l=a.properties.get("position"),c=[l.x,l.y,l.z],h=i.create$1();"viewport"===a.properties.get("anchor")&&(i.fromRotation(h,-n.transform.angle),i.transformMat3(c,c,h));const u=a.properties.get("color");return{u_matrix:r,u_lightpos:c,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+o,u_opacity:s}},tV=(r,n,o,s,a,l,c)=>i.extend(tU(r,n,o,s),tO(l,n,c),{u_height_factor:-Math.pow(2,a.overscaledZ)/c.tileSize/8}),tN=i=>({u_matrix:i}),tj=(r,n,o,s)=>i.extend(tN(r),tO(o,n,s)),tG=(i,r)=>({u_matrix:i,u_world:r}),tZ=(r,n,o,s,a)=>i.extend(tj(r,n,o,s),{u_world:a}),t$=(r,n,o,s)=>{let a;const l=r.transform;return a="map"===s.paint.get("circle-pitch-alignment")?l.calculatePixelsToTileUnitsMatrix(o):new Float32Array([l.pixelsToGLUnits[0],0,0,l.pixelsToGLUnits[1]]),{u_camera_to_center_distance:l.cameraToCenterDistance,u_matrix:r.translatePosMatrix(n.projMatrix,o,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_device_pixel_ratio:i.exported.devicePixelRatio,u_extrude_scale:a}},tq=i=>{const r=[];return"map"===i.paint.get("circle-pitch-alignment")&&r.push("PITCH_WITH_MAP"),"map"===i.paint.get("circle-pitch-scale")&&r.push("SCALE_WITH_MAP"),r},tX=(r,n,o)=>{const s=i.EXTENT/o.tileSize;return{u_matrix:r,u_camera_to_center_distance:n.cameraToCenterDistance,u_extrude_scale:[n.pixelsToGLUnits[0]/s,n.pixelsToGLUnits[1]/s]}},tW=(i,r,n=1)=>({u_matrix:i,u_color:r,u_overlay:0,u_overlay_scale:n}),tH=(i,r,n,o)=>({u_matrix:i,u_extrude_scale:C(r,1,n),u_intensity:o}),tK=(r,n,o,s,a,l)=>{const c=r.transform,h=c.calculatePixelsToTileUnitsMatrix(n),u={u_matrix:tQ(r,n,o,a),u_pixels_to_tile_units:h,u_device_pixel_ratio:i.exported.devicePixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:l,u_texsize:[0,0],u_scale:[0,0,0],u_mix:0,u_alpha_discard_threshold:0};if(t0(o)){const d=tJ(n,r.transform);u.u_texsize=n.lineAtlasTexture.size,u.u_scale=[d,s.fromScale,s.toScale],u.u_mix=s.t}return u},tY=(r,n,o,s,a)=>{const l=r.transform,c=tJ(n,l);return{u_matrix:tQ(r,n,o,a),u_texsize:n.imageAtlasTexture.size,u_pixels_to_tile_units:l.calculatePixelsToTileUnitsMatrix(n),u_device_pixel_ratio:i.exported.devicePixelRatio,u_image:0,u_scale:[c,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]],u_alpha_discard_threshold:0}};function tJ(i,r){return 1/C(i,1,r.tileZoom)}function tQ(i,r,n,o){return i.translatePosMatrix(o||r.tileID.projMatrix,r,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}function t0(i){const r=i.paint.get("line-dasharray").value;return r.value||"constant"!==r.kind}const t1=(i,r,n,o,s,a)=>{var l,c;return{u_matrix:i,u_tl_parent:r,u_scale_parent:n,u_fade_t:o.mix,u_opacity:o.opacity*s.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:s.paint.get("raster-brightness-min"),u_brightness_high:s.paint.get("raster-brightness-max"),u_saturation_factor:(c=s.paint.get("raster-saturation"))>0?1-1/(1.001-c):-c,u_contrast_factor:(l=s.paint.get("raster-contrast"))>0?1/(1-l):1+l,u_spin_weights:function(i){i*=Math.PI/180;const r=Math.sin(i),n=Math.cos(i);return[(2*n+1)/3,(-Math.sqrt(3)*r-n+1)/3,(Math.sqrt(3)*r-n+1)/3]}(s.paint.get("raster-hue-rotate")),u_perspective_transform:a}},t2=(i,r,n,o,s,a,l,c,h,u,d,p,f,m)=>{const _=s.transform;return{u_is_size_zoom_constant:+("constant"===i||"source"===i),u_is_size_feature_constant:+("constant"===i||"camera"===i),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:_.cameraToCenterDistance,u_pitch:_.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:_.width/_.height,u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_matrix:a,u_label_plane_matrix:l,u_coord_matrix:c,u_is_text:+h,u_pitch_with_map:+o,u_texsize:u,u_tile_id:d,u_zoom_transition:p,u_inv_rot_matrix:f,u_merc_center:m,u_texture:0}},t3=(r,n,o,s,a,l,c,h,u,d,p,f,m,_,g)=>{const{cameraToCenterDistance:y,_pitch:x}=a.transform;return i.extend(t2(r,n,o,s,a,l,c,h,u,d,f,m,_,g),{u_gamma_scale:s?y*Math.cos(a.terrain?0:x):1,u_device_pixel_ratio:i.exported.devicePixelRatio,u_is_halo:+p})},t5=(r,n,o,s,a,l,c,h,u,d,p,f,m,_)=>i.extend(t3(r,n,o,s,a,l,c,h,!0,u,!0,p,f,m,_),{u_texsize_icon:d,u_texture_icon:1}),t4=(i,r,n)=>({u_matrix:i,u_opacity:r,u_color:n}),t6=(r,n,o,s,a,l)=>i.extend(function(i,r,n,o){const s=n.imageManager.getPattern(i.from.toString()),a=n.imageManager.getPattern(i.to.toString()),{width:l,height:c}=n.imageManager.getPixelSize(),h=Math.pow(2,o.tileID.overscaledZ),u=o.tileSize*Math.pow(2,n.transform.tileZoom)/h,d=u*(o.tileID.canonical.x+o.tileID.wrap*h),p=u*o.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:s.tl,u_pattern_br_a:s.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[l,c],u_mix:r.t,u_pattern_size_a:s.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:r.fromScale,u_scale_b:r.toScale,u_tile_units_to_pixels:1/C(o,1,n.transform.tileZoom),u_pixel_coord_upper:[d>>16,p>>16],u_pixel_coord_lower:[65535&d,65535&p]}}(s,l,o,a),{u_matrix:r,u_opacity:n}),t8={fillExtrusion:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_lightpos:new i.Uniform3f(r,n.u_lightpos),u_lightintensity:new i.Uniform1f(r,n.u_lightintensity),u_lightcolor:new i.Uniform3f(r,n.u_lightcolor),u_vertical_gradient:new i.Uniform1f(r,n.u_vertical_gradient),u_opacity:new i.Uniform1f(r,n.u_opacity)}),fillExtrusionPattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_lightpos:new i.Uniform3f(r,n.u_lightpos),u_lightintensity:new i.Uniform1f(r,n.u_lightintensity),u_lightcolor:new i.Uniform3f(r,n.u_lightcolor),u_vertical_gradient:new i.Uniform1f(r,n.u_vertical_gradient),u_height_factor:new i.Uniform1f(r,n.u_height_factor),u_image:new i.Uniform1i(r,n.u_image),u_texsize:new i.Uniform2f(r,n.u_texsize),u_pixel_coord_upper:new i.Uniform2f(r,n.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(r,n.u_pixel_coord_lower),u_scale:new i.Uniform3f(r,n.u_scale),u_fade:new i.Uniform1f(r,n.u_fade),u_opacity:new i.Uniform1f(r,n.u_opacity)}),fill:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix)}),fillPattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_image:new i.Uniform1i(r,n.u_image),u_texsize:new i.Uniform2f(r,n.u_texsize),u_pixel_coord_upper:new i.Uniform2f(r,n.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(r,n.u_pixel_coord_lower),u_scale:new i.Uniform3f(r,n.u_scale),u_fade:new i.Uniform1f(r,n.u_fade)}),fillOutline:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_world:new i.Uniform2f(r,n.u_world)}),fillOutlinePattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_world:new i.Uniform2f(r,n.u_world),u_image:new i.Uniform1i(r,n.u_image),u_texsize:new i.Uniform2f(r,n.u_texsize),u_pixel_coord_upper:new i.Uniform2f(r,n.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(r,n.u_pixel_coord_lower),u_scale:new i.Uniform3f(r,n.u_scale),u_fade:new i.Uniform1f(r,n.u_fade)}),circle:(r,n)=>({u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_extrude_scale:new i.UniformMatrix2f(r,n.u_extrude_scale),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_matrix:new i.UniformMatrix4f(r,n.u_matrix)}),collisionBox:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_extrude_scale:new i.Uniform2f(r,n.u_extrude_scale)}),collisionCircle:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_inv_matrix:new i.UniformMatrix4f(r,n.u_inv_matrix),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_viewport_size:new i.Uniform2f(r,n.u_viewport_size)}),debug:(r,n)=>({u_color:new i.UniformColor(r,n.u_color),u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_overlay:new i.Uniform1i(r,n.u_overlay),u_overlay_scale:new i.Uniform1f(r,n.u_overlay_scale)}),clippingMask:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix)}),heatmap:(r,n)=>({u_extrude_scale:new i.Uniform1f(r,n.u_extrude_scale),u_intensity:new i.Uniform1f(r,n.u_intensity),u_matrix:new i.UniformMatrix4f(r,n.u_matrix)}),heatmapTexture:(r,n)=>({u_image:new i.Uniform1i(r,n.u_image),u_color_ramp:new i.Uniform1i(r,n.u_color_ramp),u_opacity:new i.Uniform1f(r,n.u_opacity)}),hillshade:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_image:new i.Uniform1i(r,n.u_image),u_latrange:new i.Uniform2f(r,n.u_latrange),u_light:new i.Uniform2f(r,n.u_light),u_shadow:new i.UniformColor(r,n.u_shadow),u_highlight:new i.UniformColor(r,n.u_highlight),u_accent:new i.UniformColor(r,n.u_accent)}),hillshadePrepare:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_image:new i.Uniform1i(r,n.u_image),u_dimension:new i.Uniform2f(r,n.u_dimension),u_zoom:new i.Uniform1f(r,n.u_zoom),u_unpack:new i.Uniform4f(r,n.u_unpack)}),line:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_pixels_to_tile_units:new i.UniformMatrix2f(r,n.u_pixels_to_tile_units),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_units_to_pixels:new i.Uniform2f(r,n.u_units_to_pixels),u_dash_image:new i.Uniform1i(r,n.u_dash_image),u_gradient_image:new i.Uniform1i(r,n.u_gradient_image),u_image_height:new i.Uniform1f(r,n.u_image_height),u_texsize:new i.Uniform2f(r,n.u_texsize),u_scale:new i.Uniform3f(r,n.u_scale),u_mix:new i.Uniform1f(r,n.u_mix),u_alpha_discard_threshold:new i.Uniform1f(r,n.u_alpha_discard_threshold)}),linePattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_texsize:new i.Uniform2f(r,n.u_texsize),u_pixels_to_tile_units:new i.UniformMatrix2f(r,n.u_pixels_to_tile_units),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_image:new i.Uniform1i(r,n.u_image),u_units_to_pixels:new i.Uniform2f(r,n.u_units_to_pixels),u_scale:new i.Uniform3f(r,n.u_scale),u_fade:new i.Uniform1f(r,n.u_fade),u_alpha_discard_threshold:new i.Uniform1f(r,n.u_alpha_discard_threshold)}),raster:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_tl_parent:new i.Uniform2f(r,n.u_tl_parent),u_scale_parent:new i.Uniform1f(r,n.u_scale_parent),u_fade_t:new i.Uniform1f(r,n.u_fade_t),u_opacity:new i.Uniform1f(r,n.u_opacity),u_image0:new i.Uniform1i(r,n.u_image0),u_image1:new i.Uniform1i(r,n.u_image1),u_brightness_low:new i.Uniform1f(r,n.u_brightness_low),u_brightness_high:new i.Uniform1f(r,n.u_brightness_high),u_saturation_factor:new i.Uniform1f(r,n.u_saturation_factor),u_contrast_factor:new i.Uniform1f(r,n.u_contrast_factor),u_spin_weights:new i.Uniform3f(r,n.u_spin_weights),u_perspective_transform:new i.Uniform2f(r,n.u_perspective_transform)}),symbolIcon:(r,n)=>({u_is_size_zoom_constant:new i.Uniform1i(r,n.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(r,n.u_is_size_feature_constant),u_size_t:new i.Uniform1f(r,n.u_size_t),u_size:new i.Uniform1f(r,n.u_size),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_pitch:new i.Uniform1f(r,n.u_pitch),u_rotate_symbol:new i.Uniform1i(r,n.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(r,n.u_aspect_ratio),u_fade_change:new i.Uniform1f(r,n.u_fade_change),u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(r,n.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(r,n.u_coord_matrix),u_is_text:new i.Uniform1i(r,n.u_is_text),u_pitch_with_map:new i.Uniform1i(r,n.u_pitch_with_map),u_texsize:new i.Uniform2f(r,n.u_texsize),u_tile_id:new i.Uniform3f(r,n.u_tile_id),u_zoom_transition:new i.Uniform1f(r,n.u_zoom_transition),u_inv_rot_matrix:new i.UniformMatrix4f(r,n.u_inv_rot_matrix),u_merc_center:new i.Uniform2f(r,n.u_merc_center),u_texture:new i.Uniform1i(r,n.u_texture)}),symbolSDF:(r,n)=>({u_is_size_zoom_constant:new i.Uniform1i(r,n.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(r,n.u_is_size_feature_constant),u_size_t:new i.Uniform1f(r,n.u_size_t),u_size:new i.Uniform1f(r,n.u_size),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_pitch:new i.Uniform1f(r,n.u_pitch),u_rotate_symbol:new i.Uniform1i(r,n.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(r,n.u_aspect_ratio),u_fade_change:new i.Uniform1f(r,n.u_fade_change),u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(r,n.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(r,n.u_coord_matrix),u_is_text:new i.Uniform1i(r,n.u_is_text),u_pitch_with_map:new i.Uniform1i(r,n.u_pitch_with_map),u_texsize:new i.Uniform2f(r,n.u_texsize),u_texture:new i.Uniform1i(r,n.u_texture),u_gamma_scale:new i.Uniform1f(r,n.u_gamma_scale),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_tile_id:new i.Uniform3f(r,n.u_tile_id),u_zoom_transition:new i.Uniform1f(r,n.u_zoom_transition),u_inv_rot_matrix:new i.UniformMatrix4f(r,n.u_inv_rot_matrix),u_merc_center:new i.Uniform2f(r,n.u_merc_center),u_is_halo:new i.Uniform1i(r,n.u_is_halo)}),symbolTextAndIcon:(r,n)=>({u_is_size_zoom_constant:new i.Uniform1i(r,n.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(r,n.u_is_size_feature_constant),u_size_t:new i.Uniform1f(r,n.u_size_t),u_size:new i.Uniform1f(r,n.u_size),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_pitch:new i.Uniform1f(r,n.u_pitch),u_rotate_symbol:new i.Uniform1i(r,n.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(r,n.u_aspect_ratio),u_fade_change:new i.Uniform1f(r,n.u_fade_change),u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(r,n.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(r,n.u_coord_matrix),u_is_text:new i.Uniform1i(r,n.u_is_text),u_pitch_with_map:new i.Uniform1i(r,n.u_pitch_with_map),u_texsize:new i.Uniform2f(r,n.u_texsize),u_texsize_icon:new i.Uniform2f(r,n.u_texsize_icon),u_texture:new i.Uniform1i(r,n.u_texture),u_texture_icon:new i.Uniform1i(r,n.u_texture_icon),u_gamma_scale:new i.Uniform1f(r,n.u_gamma_scale),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_is_halo:new i.Uniform1i(r,n.u_is_halo)}),background:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_opacity:new i.Uniform1f(r,n.u_opacity),u_color:new i.UniformColor(r,n.u_color)}),backgroundPattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_opacity:new i.Uniform1f(r,n.u_opacity),u_image:new i.Uniform1i(r,n.u_image),u_pattern_tl_a:new i.Uniform2f(r,n.u_pattern_tl_a),u_pattern_br_a:new i.Uniform2f(r,n.u_pattern_br_a),u_pattern_tl_b:new i.Uniform2f(r,n.u_pattern_tl_b),u_pattern_br_b:new i.Uniform2f(r,n.u_pattern_br_b),u_texsize:new i.Uniform2f(r,n.u_texsize),u_mix:new i.Uniform1f(r,n.u_mix),u_pattern_size_a:new i.Uniform2f(r,n.u_pattern_size_a),u_pattern_size_b:new i.Uniform2f(r,n.u_pattern_size_b),u_scale_a:new i.Uniform1f(r,n.u_scale_a),u_scale_b:new i.Uniform1f(r,n.u_scale_b),u_pixel_coord_upper:new i.Uniform2f(r,n.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(r,n.u_pixel_coord_lower),u_tile_units_to_pixels:new i.Uniform1f(r,n.u_tile_units_to_pixels)}),terrainRaster:tE,terrainDepth:tE,skybox:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_sun_direction:new i.Uniform3f(r,n.u_sun_direction),u_cubemap:new i.Uniform1i(r,n.u_cubemap),u_opacity:new i.Uniform1f(r,n.u_opacity),u_temporal_offset:new i.Uniform1f(r,n.u_temporal_offset)}),skyboxGradient:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_color_ramp:new i.Uniform1i(r,n.u_color_ramp),u_center_direction:new i.Uniform3f(r,n.u_center_direction),u_radius:new i.Uniform1f(r,n.u_radius),u_opacity:new i.Uniform1f(r,n.u_opacity),u_temporal_offset:new i.Uniform1f(r,n.u_temporal_offset)}),skyboxCapture:(r,n)=>({u_matrix_3f:new i.UniformMatrix3f(r,n.u_matrix_3f),u_sun_direction:new i.Uniform3f(r,n.u_sun_direction),u_sun_intensity:new i.Uniform1f(r,n.u_sun_intensity),u_color_tint_r:new i.Uniform4f(r,n.u_color_tint_r),u_color_tint_m:new i.Uniform4f(r,n.u_color_tint_m),u_luminance:new i.Uniform1f(r,n.u_luminance)}),globeRaster:(r,n)=>({u_proj_matrix:new i.UniformMatrix4f(r,n.u_proj_matrix),u_globe_matrix:new i.UniformMatrix4f(r,n.u_globe_matrix),u_merc_matrix:new i.UniformMatrix4f(r,n.u_merc_matrix),u_zoom_transition:new i.Uniform1f(r,n.u_zoom_transition),u_merc_center:new i.Uniform2f(r,n.u_merc_center),u_image0:new i.Uniform1i(r,n.u_image0)}),globeAtmosphere:(r,n)=>({u_center:new i.Uniform2f(r,n.u_center),u_radius:new i.Uniform1f(r,n.u_radius),u_screen_size:new i.Uniform2f(r,n.u_screen_size),u_pixel_ratio:new i.Uniform1f(r,n.u_pixel_ratio),u_opacity:new i.Uniform1f(r,n.u_opacity),u_fadeout_range:new i.Uniform1f(r,n.u_fadeout_range),u_start_color:new i.Uniform3f(r,n.u_start_color),u_end_color:new i.Uniform3f(r,n.u_end_color)})};function t9(r,n,o,a,l,c,h){var u;const d=r.context,p=d.gl,f=r.useProgram("collisionBox"),m=[];let _=0,g=0;for(let y=0;y0){const S=i.create(),I=w;i.mul(S,b.placementInvProjMatrix,r.transform.glCoordMatrix),i.mul(S,S,b.placementViewportMatrix),m.push({circleArray:E,circleOffset:g,transform:I,invTransform:S}),_+=E.length/4,g=_}T&&(r.terrain&&r.terrain.setupElevationDraw(v,f),f.draw(d,p.LINES,i.DepthMode.disabled,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.disabled,tX(w,r.transform,v),o.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,null,r.transform.zoom,null,T.collisionVertexBuffer,T.collisionVertexBufferExt))}if(!h||!m.length)return;const M=r.useProgram("collisionCircle"),A=new i.StructArrayLayout2f1f2i16;A.resize(4*_),A._trim();let C=0;for(const z of m)for(let k=0;k[0,0,0];!function(r,n,o,s,a,l,c,h,u,d){const p=o.transform,f=s?r.textSizeData:r.iconSizeData,m=i.evaluateSizeForZoom(f,o.transform.zoom),_=[256/o.width*2+1,256/o.height*2+1],g=s?r.text.dynamicLayoutVertexArray:r.icon.dynamicLayoutVertexArray;g.clear();const y=r.lineVertexArray,x=s?r.text.placedSymbolArray:r.icon.placedSymbolArray,v=o.transform.width/o.transform.height;let b=!1;for(let w=0;w=-r[0]&&n<=r[0]&&o>=-r[1]&&o<=r[1]}(A,_)){eY(T.numGlyphs,g);continue}const C=eG(o.transform.cameraToCenterDistance,A[3]),z=i.evaluateSizeForFeature(f,m,T),k=c?z/C:z*C,P=ej(new i.pointGeometry(M[0],M[1]),a,M[2]);if(P.signedDistanceFromCamera<=0){eY(T.numGlyphs,g);continue}let D={};const L=c?null:u,B=eq(T,k,!1,h,n,a,l,r.glyphOffsetArray,y,g,P.point,E,D,v,L,p.projection,d);b=B.useVertical,L&&B.needsFlipping&&(D={}),(B.notEnoughRoom||b||B.needsFlipping&&eq(T,k,!0,h,n,a,l,r.glyphOffsetArray,y,g,P.point,E,D,v,L,p.projection,d).notEnoughRoom)&&eY(T.numGlyphs,g)}s?r.text.dynamicLayoutVertexBuffer.updateData(g):r.icon.dynamicLayoutVertexBuffer.updateData(g)}(B,P.projMatrix,r,a,Q,et,v,d,eo,P)}const es=r.translatePosMatrix(P.projMatrix,L,l,c),ea=b||a&&M||er?t7:Q,el=r.translatePosMatrix(et,L,l,c,!0),ec=O&&0!==o.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1),eh=y.createInversionMatrix(P.toUnwrapped());D=O?B.iconsInText?t5(U.kind,j,w,v,r,es,ea,el,Z,W,G,C,eh,I):t3(U.kind,j,w,v,r,es,ea,el,a,Z,!0,G,C,eh,I):t2(U.kind,j,w,v,r,es,ea,el,a,Z,G,C,eh,I);const eu={program:N,buffers:R,uniformValues:D,atlasTexture:$,atlasTextureIcon:H,atlasInterpolation:q,atlasInterpolationIcon:X,isSDF:O,hasHalo:ec,tile:L,labelPlaneMatrixInv:ee};if(T&&B.canOverlap){E=!0;const ed=R.segments.get();for(const ep of ed)z.push({segments:new i.SegmentVector([ep]),sortKey:ep.sortKey,state:eu})}else z.push({segments:R.segments,sortKey:0,state:eu})}for(const ef of(E&&z.sort((i,r)=>i.sortKey-r.sortKey),z)){const em=ef.state;if(r.terrain&&r.terrain.setupElevationDraw(em.tile,em.program,{useDepthForOcclusion:!A,labelPlaneMatrixInv:em.labelPlaneMatrixInv}),m.activeTexture.set(_.TEXTURE0),em.atlasTexture.bind(em.atlasInterpolation,_.CLAMP_TO_EDGE),em.atlasTextureIcon&&(m.activeTexture.set(_.TEXTURE1),em.atlasTextureIcon&&em.atlasTextureIcon.bind(em.atlasInterpolationIcon,_.CLAMP_TO_EDGE)),em.isSDF){const e_=em.uniformValues;em.hasHalo&&(e_.u_is_halo=1,it(em.buffers,ef.segments,o,r,em.program,S,p,f,e_)),e_.u_is_halo=0}it(em.buffers,ef.segments,o,r,em.program,S,p,f,em.uniformValues)}}function it(r,n,o,s,a,l,c,h,u){const d=s.context;a.draw(d,d.gl.TRIANGLES,l,c,h,i.CullFaceMode.disabled,u,o.id,r.layoutVertexBuffer,r.indexBuffer,n,o.paint,s.transform.zoom,r.programConfigurations.get(o.id),r.dynamicLayoutVertexBuffer,r.opacityVertexBuffer)}function ii(r,n,o,s,a,l,c){let h,u,d,p,f;const m=r.context.gl,_=o.paint.get("fill-pattern"),g=_&&_.constantOr(1),y=o.getCrossfadeParameters();for(const x of(c?(u=g&&!o.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",h=m.LINES):(u=g?"fillPattern":"fill",h=m.TRIANGLES),s)){const v=n.getTile(x);if(g&&!v.patternsLoaded())continue;const b=v.getBucket(o);if(!b)continue;r.prepareDrawTile(x);const w=b.programConfigurations.get(o.id),T=r.useProgram(u,w);g&&(r.context.activeTexture.set(m.TEXTURE0),v.imageAtlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE),w.updatePaintBuffers(y));const E=_.constantOr(null);if(E&&v.imageAtlas){const S=v.imageAtlas,I=S.patternPositions[E.to.toString()],M=S.patternPositions[E.from.toString()];I&&M&&w.setConstantPatternPositions(I,M)}const A=r.translatePosMatrix(x.projMatrix,v,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor"));if(c){p=b.indexBuffer2,f=b.segments2;const C=r.terrain&&r.terrain.renderingToTexture?r.terrain.drapeBufferSize:[m.drawingBufferWidth,m.drawingBufferHeight];d="fillOutlinePattern"===u&&g?tZ(A,r,y,v,C):tG(A,C)}else p=b.indexBuffer,f=b.segments,d=g?tj(A,r,y,v):tN(A);r.prepareDrawProgram(r.context,T,x.toUnwrapped()),T.draw(r.context,h,a,r.stencilModeForClipping(x),l,i.CullFaceMode.disabled,d,o.id,b.layoutVertexBuffer,p,f,o.paint,r.transform.zoom,w)}}function ir(r,n,o,s,a,l,c){const h=r.context,u=h.gl,d=o.paint.get("fill-extrusion-pattern"),p=d.constantOr(1),f=o.getCrossfadeParameters(),m=o.paint.get("fill-extrusion-opacity");for(const _ of s){const g=n.getTile(_),y=g.getBucket(o);if(!y)continue;const x=y.programConfigurations.get(o.id),v=r.useProgram(p?"fillExtrusionPattern":"fillExtrusion",x);if(r.terrain){const b=r.terrain;if(!y.enableTerrain)continue;if(b.setupElevationDraw(g,v,{useMeterToDem:!0}),function(r,n,o,s,a,l){let c,h,u;const d=[r=>{let n=r.canonical.x-1,o=r.wrap;return n<0&&(n=(1<{let n=r.canonical.x+1,o=r.wrap;return n===1<new i.OverscaledTileID(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(0===r.canonical.y?1<new i.OverscaledTileID(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<{let r,o,s;const l=n.getSource().maxzoom,c=i=>{const r=n.getTileByID(i);if(r&&r.hasData())return r.getBucket(a)};return(i.overscaledZ===i.canonical.z||i.overscaledZ>=l)&&(r=c(i.key)),i.overscaledZ>=l&&(o=c(i.calculateScaledKey(i.overscaledZ+1))),i.overscaledZ>l&&(s=c(i.calculateScaledKey(i.overscaledZ-1))),r||o||s},f=[0,0,0],m=(r,n)=>(f[0]=Math.min(r.min.y,n.min.y),f[1]=Math.max(r.max.y,n.max.y),f[2]=i.EXTENT-n.min.x>r.max.x?n.min.x-i.EXTENT:r.max.x,f),_=(r,n)=>(f[0]=Math.min(r.min.x,n.min.x),f[1]=Math.max(r.max.x,n.max.x),f[2]=i.EXTENT-n.min.y>r.max.y?n.min.y-i.EXTENT:r.max.y,f),g=[(i,r)=>m(i,r),(i,r)=>m(r,i),(i,r)=>_(i,r),(i,r)=>_(r,i)],y=new i.pointGeometry(0,0),x=(r,n,s,a,d)=>{const p=[[a?s:r,a?r:s,0],[a?s:n,a?n:s,0]],f=d<0?i.EXTENT+d:d,m=[a?f:(r+n)/2,a?(r+n)/2:f,0];return 0===s&&d<0||0!==s&&d>0?l.getForTilePoints(u,[m],!0,h):p.push(m),l.getForTilePoints(o,p,!0,c),Math.max(p[0][2],p[1][2],m[2])/l.exaggeration()};for(let v=0;v<4;v++){const b=s.borders[v];if(0===b.length&&(s.borderDone[v]=!0),s.borderDone[v])continue;const w=u=d[v](o),T=p(w);if(!T||!T.enableTerrain||!(h=l.findDEMTileFor(w))||!h.dem)continue;if(!c){const E=l.findDEMTileFor(o);if(!E||!E.dem)return;c=E}const S=(v<2?1:5)-v,I=T.borders[S];let M=0;for(let A=0;Ak[0]+3);)T.borderDone[S]||T.encodeCentroid(void 0,C,!1),M++;if(C&&Mk[1]-3)&&(D++,++M!==I.length);)C=T.featuresOnBorder[I[M]];if(C=T.featuresOnBorder[I[P]],z.intersectsCount()>1||C.intersectsCount()>1||1!==D){1!==D&&(M=P),s.encodeCentroid(void 0,z,!1),T.borderDone[S]||T.encodeCentroid(void 0,C,!1);continue}const L=g[v](z,C),B=v%2?i.EXTENT-1:0;y.x=x(L[0],Math.min(i.EXTENT-1,L[1]),B,v<2,L[2]),y.y=0,s.encodeCentroid(y,z,!1),T.borderDone[S]||T.encodeCentroid(y,C,!1)}else s.encodeCentroid(void 0,z,!1)}s.borderDone[v]=s.needsCentroidUpdate=!0,T.borderDone[S]||(T.borderDone[S]=T.needsCentroidUpdate=!0)}(s.needsCentroidUpdate||!s.centroidVertexBuffer&&0!==s.centroidVertexArray.length)&&s.uploadCentroid(r)}(h,n,_,y,o,b),!y.centroidVertexBuffer){const w=v.attributes.a_centroid_pos;void 0!==w&&u.vertexAttrib2f(w,0,0)}}p&&(r.context.activeTexture.set(u.TEXTURE0),g.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),x.updatePaintBuffers(f));const T=d.constantOr(null);if(T&&g.imageAtlas){const E=g.imageAtlas,S=E.patternPositions[T.to.toString()],I=E.patternPositions[T.from.toString()];S&&I&&x.setConstantPatternPositions(S,I)}const M=r.translatePosMatrix(_.projMatrix,g,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),A=o.paint.get("fill-extrusion-vertical-gradient"),C=p?tV(M,r,A,m,_,f,g):tU(M,r,A,m);r.prepareDrawProgram(h,v,_.toUnwrapped()),v.draw(h,h.gl.TRIANGLES,a,l,c,i.CullFaceMode.backCCW,C,o.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,o.paint,r.transform.zoom,x,r.terrain?y.centroidVertexBuffer:null)}}const io=new i.Color(1,0,0,1),is=new i.Color(0,1,0,1),ia=new i.Color(0,0,1,1),il=new i.Color(1,0,1,1),ic=new i.Color(0,1,1,1);function ih(i,r,n,o){id(i,0,r+n/2,i.transform.width,n,o)}function iu(i,r,n,o){id(i,r-n/2,0,n,i.transform.height,o)}function id(r,n,o,s,a,l){const c=r.context,h=c.gl;h.enable(h.SCISSOR_TEST),h.scissor(n*i.exported.devicePixelRatio,o*i.exported.devicePixelRatio,s*i.exported.devicePixelRatio,a*i.exported.devicePixelRatio),c.clear({color:l}),h.disable(h.SCISSOR_TEST)}const ip=i.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:im}=ip;function i_(i,r,n,o){i.emplaceBack(r,n,o)}class ig{constructor(r){this.vertexArray=new i.StructArrayLayout3f12,this.indices=new i.StructArrayLayout3ui6,i_(this.vertexArray,-1,-1,1),i_(this.vertexArray,1,-1,1),i_(this.vertexArray,-1,1,1),i_(this.vertexArray,1,1,1),i_(this.vertexArray,-1,-1,-1),i_(this.vertexArray,1,-1,-1),i_(this.vertexArray,-1,1,-1),i_(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=r.createVertexBuffer(this.vertexArray,im),this.indexBuffer=r.createIndexBuffer(this.indices),this.segment=i.SegmentVector.simpleSegment(0,0,36,12)}}function iy(r,n,o,s,a,l){const c=r.gl,h=n.paint.get("sky-atmosphere-color"),u=n.paint.get("sky-atmosphere-halo-color"),d=n.paint.get("sky-atmosphere-sun-intensity"),p={u_matrix_3f:i.fromMat4([],s),u_sun_direction:a,u_sun_intensity:d,u_color_tint_r:[h.r,h.g,h.b,h.a],u_color_tint_m:[u.r,u.g,u.b,u.a],u_luminance:5e-5};c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_CUBE_MAP_POSITIVE_X+l,n.skyboxTexture,0),o.draw(r,c.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,i.ColorMode.unblended,i.CullFaceMode.frontCW,p,"skyboxCapture",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}const ix={symbol:function(r,n,o,s,a){if("translucent"!==r.renderPass)return;const l=i.StencilMode.disabled,c=r.colorModeForRenderPass();o.layout.get("text-variable-anchor")&&function(r,n,o,s,a,l,c){const h=n.transform,u="map"===a,d="map"===l,p=h.projection.createTileTransform(h,h.worldSize);for(const f of r){const m=s.getTile(f),_=m.getBucket(o);if(!_||_.projection!==h.projection.name||!_.text||!_.text.segments.get().length)continue;const g=i.evaluateSizeForZoom(_.textSizeData,h.zoom),y=n.transform.calculatePixelsToTileUnitsMatrix(m),x=eV(f.projMatrix,m.tileID.canonical,d,u,n.transform,y),v="none"!==o.layout.get("icon-text-fit")&&_.hasIconData();if(g){const b=Math.pow(2,h.zoom-m.tileID.overscaledZ);(function(r,n,o,s,a,l,c,h,u,d,p,f){const m=r.text.placedSymbolArray,_=r.text.dynamicLayoutVertexArray,g=r.icon.dynamicLayoutVertexArray,y={},x=h.projMatrix,v=l.elevation,b=v?v.getAtTileOffsetFunc(h,f):i=>[0,0,0];_.clear();for(let w=0;w=0&&(y[T.associatedIconIndex]={shiftedAnchor:F,angle:O})}else eY(T.numGlyphs,_)}if(p){g.clear();const V=r.icon.placedSymbolArray;for(let N=0;Ni.sortKey-r.sortKey);const I={useDepthForOcclusion:"globe"!==r.transform.projection.name};for(const M of _){const{programConfiguration:A,program:C,layoutVertexBuffer:z,indexBuffer:k,uniformValues:P,tile:D}=M.state,L=M.segments;r.terrain&&r.terrain.setupElevationDraw(D,C,I),r.prepareDrawProgram(u,C,D.tileID.toUnwrapped()),C.draw(u,d.TRIANGLES,p,f,m,i.CullFaceMode.disabled,P,o.id,z,k,L,o.paint,r.transform.zoom,A)}},heatmap:function(r,n,o,s){if(0!==o.paint.get("heatmap-opacity")){if("offscreen"===r.renderPass){const a=r.context,l=a.gl,c=i.StencilMode.disabled,h=new i.ColorMode([l.ONE,l.ONE],i.Color.transparent,[!0,!0,!0,!0]);(function(i,r,n){const o=i.gl;i.activeTexture.set(o.TEXTURE1),i.viewport.set([0,0,r.width/4,r.height/4]);let s=n.heatmapFbo;if(s)o.bindTexture(o.TEXTURE_2D,s.colorAttachment.get()),i.bindFramebuffer.set(s.framebuffer);else{const a=o.createTexture();o.bindTexture(o.TEXTURE_2D,a),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),s=n.heatmapFbo=i.createFramebuffer(r.width/4,r.height/4,!1),function(i,r,n,o){const s=i.gl;s.texImage2D(s.TEXTURE_2D,0,s.RGBA,r.width/4,r.height/4,0,s.RGBA,i.extRenderToTextureHalfFloat?i.extTextureHalfFloat.HALF_FLOAT_OES:s.UNSIGNED_BYTE,null),o.colorAttachment.set(n)}(i,r,a,s)}})(a,r,o),a.clear({color:i.Color.transparent});for(let u=0;u{const r=[];t0(i)&&r.push("RENDER_LINE_DASH"),i.paint.get("line-gradient")&&r.push("RENDER_LINE_GRADIENT");const n=i.paint.get("line-pattern").constantOr(1),o=1!==i.paint.get("line-opacity").constantOr(1);return!n&&o&&r.push("RENDER_LINE_ALPHA_DISCARD"),r})(o);let w=b.includes("RENDER_LINE_ALPHA_DISCARD");for(const T of(r.terrain&&r.terrain.clipOrMaskOverlapStencilType()&&(w=!1),s)){const E=n.getTile(T);if(m&&!E.patternsLoaded())continue;const S=E.getBucket(o);if(!S)continue;r.prepareDrawTile(T);const I=S.programConfigurations.get(o.id),M=r.useProgram(y,I,b),A=f.constantOr(null);if(A&&E.imageAtlas){const C=E.imageAtlas,z=C.patternPositions[A.to.toString()],k=C.patternPositions[A.from.toString()];z&&k&&I.setConstantPatternPositions(z,k)}const P=u.constantOr(null),D=p.constantOr(null);if(!m&&P&&D&&E.lineAtlas){const L=E.lineAtlas,B=L.getDash(P.to,D),R=L.getDash(P.from,D);B&&R&&I.setConstantPatternPositions(B,R)}const F=r.terrain?T.projMatrix:null,O=m?tY(r,E,o,g,F):tK(r,E,o,g,F,S.lineClipsArray.length);if(_){const U=S.gradients[o.id];let V=U.texture;if(o.gradientVersion!==U.version){let N=256;if(o.stepInterpolant){const j=n.getSource().maxzoom,G=T.canonical.z===j?Math.ceil(1<{M.draw(x,v.TRIANGLES,c,n,h,i.CullFaceMode.disabled,O,o.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,o.paint,r.transform.zoom,I,S.layoutVertexBuffer2)};if(w){const $=r.stencilModeForClipping(T).ref;0===$&&r.terrain&&x.clear({stencil:0});const q={func:v.EQUAL,mask:255};O.u_alpha_discard_threshold=.8,Z(new i.StencilMode(q,$,255,v.KEEP,v.KEEP,v.INVERT)),O.u_alpha_discard_threshold=0,Z(new i.StencilMode(q,$,255,v.KEEP,v.KEEP,v.KEEP))}else Z(r.stencilModeForClipping(T))}w&&(r.resetStencilClippingMasks(),r.terrain&&x.clear({stencil:0}))},fill:function(r,n,o,s){const a=o.paint.get("fill-color"),l=o.paint.get("fill-opacity");if(0===l.constantOr(1))return;const c=r.colorModeForRenderPass(),h=o.paint.get("fill-pattern"),u=r.opaquePassEnabledForLayer()&&!h.constantOr(1)&&1===a.constantOr(i.Color.transparent).a&&1===l.constantOr(0)?"opaque":"translucent";if(r.renderPass===u){const d=r.depthModeForSublayer(1,"opaque"===r.renderPass?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly);ii(r,n,o,s,d,c,!1)}if("translucent"===r.renderPass&&o.paint.get("fill-antialias")){const p=r.depthModeForSublayer(o.getPaintProperty("fill-outline-color")?2:0,i.DepthMode.ReadOnly);ii(r,n,o,s,p,c,!0)}},"fill-extrusion":function(r,n,o,s){const a=o.paint.get("fill-extrusion-opacity");if(0!==a&&"translucent"===r.renderPass){const l=new i.DepthMode(r.context.gl.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D);if(1!==a||o.paint.get("fill-extrusion-pattern").constantOr(1))ir(r,n,o,s,l,i.StencilMode.disabled,i.ColorMode.disabled),ir(r,n,o,s,l,r.stencilModeFor3D(),r.colorModeForRenderPass()),r.resetStencilClippingMasks();else{const c=r.colorModeForRenderPass();ir(r,n,o,s,l,i.StencilMode.disabled,c)}}},hillshade:function(r,n,o,s){if("offscreen"!==r.renderPass&&"translucent"!==r.renderPass)return;const a=r.context,l=r.depthModeForSublayer(0,i.DepthMode.ReadOnly),c=r.colorModeForRenderPass(),h=r.terrain&&r.terrain.renderingToTexture,[u,d]="translucent"!==r.renderPass||h?[{},s]:r.stencilConfigForOverlap(s);for(const p of d){const f=n.getTile(p);if(f.needsHillshadePrepare&&"offscreen"===r.renderPass)!function(r,n,o,s,a,l){const c=r.context,h=c.gl;if(!n.dem)return;const u=n.dem;if(c.activeTexture.set(h.TEXTURE1),tT(r,n,u),!n.demTexture)return;n.demTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE);const d=u.dim;c.activeTexture.set(h.TEXTURE0);let p=n.fbo;if(!p){const f=new i.Texture(c,{width:d,height:d,data:null},h.RGBA);f.bind(h.LINEAR,h.CLAMP_TO_EDGE),(p=n.fbo=c.createFramebuffer(d,d,!0)).colorAttachment.set(f.texture)}c.bindFramebuffer.set(p.framebuffer),c.viewport.set([0,0,d,d]);const{tileBoundsBuffer:m,tileBoundsIndexBuffer:_,tileBoundsSegments:g}=r.getMercatorTileBoundsBuffers();r.useProgram("hillshadePrepare").draw(c,h.TRIANGLES,s,a,l,i.CullFaceMode.disabled,((r,n)=>{const o=n.stride,s=i.create();return i.ortho(s,0,i.EXTENT,-i.EXTENT,0,0,1),i.translate(s,s,[0,-i.EXTENT,0]),{u_matrix:s,u_image:1,u_dimension:[o,o],u_zoom:r.overscaledZ,u_unpack:n.unpackVector}})(n.tileID,u),o.id,m,_,g),n.needsHillshadePrepare=!1}(r,f,o,l,i.StencilMode.disabled,c);else if("translucent"===r.renderPass){const m=h&&r.terrain?r.terrain.stencilModeForRTTOverlap(p):u[p.overscaledZ];!function(r,n,o,s,a,l,c){const h=r.context,u=h.gl,d=o.fbo;if(!d)return;r.prepareDrawTile(n);const p=r.useProgram("hillshade");h.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,d.colorAttachment.get());const f=((r,n,o,s)=>{const a=o.paint.get("hillshade-shadow-color"),l=o.paint.get("hillshade-highlight-color"),c=o.paint.get("hillshade-accent-color");let h=o.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===o.paint.get("hillshade-illumination-anchor")&&(h-=r.transform.angle);const u=!r.options.moving;return{u_matrix:s||r.transform.calculateProjMatrix(n.tileID.toUnwrapped(),u),u_image:0,u_latrange:function(r,n){const o=Math.pow(2,n.canonical.z),s=n.canonical.y;return[new i.MercatorCoordinate(0,s/o).toLngLat().lat,new i.MercatorCoordinate(0,(s+1)/o).toLngLat().lat]}(0,n.tileID),u_light:[o.paint.get("hillshade-exaggeration"),h],u_shadow:a,u_highlight:l,u_accent:c}})(r,o,s,r.terrain?n.projMatrix:null);r.prepareDrawProgram(h,p,n.toUnwrapped());const{tileBoundsBuffer:m,tileBoundsIndexBuffer:_,tileBoundsSegments:g}=r.getTileBoundsBuffers(o);p.draw(h,u.TRIANGLES,a,l,c,i.CullFaceMode.disabled,f,s.id,m,_,g)}(r,p,f,o,l,m,c)}}a.viewport.set([0,0,r.width,r.height]),r.resetStencilClippingMasks()},raster:function(r,n,o,s,a,l){if("translucent"!==r.renderPass||0===o.paint.get("raster-opacity")||!s.length)return;const c=r.context,h=c.gl,u=n.getSource(),d=r.useProgram("raster"),p=r.colorModeForRenderPass(),f=r.terrain&&r.terrain.renderingToTexture,[m,_]=u instanceof ew||f?[{},s]:r.stencilConfigForOverlap(s),g=_[_.length-1].overscaledZ,y=!r.options.moving;for(const x of _){let v,b;const w=f?i.DepthMode.disabled:r.depthModeForSublayer(x.overscaledZ-g,1===o.paint.get("raster-opacity")?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly,h.LESS),T=x.toUnwrapped(),E=n.getTile(x);if(f&&(!E||!E.hasData()))continue;const S=f?x.projMatrix:r.transform.calculateProjMatrix(T,y),I=r.terrain&&f?r.terrain.stencilModeForRTTOverlap(x):m[x.overscaledZ],M=l?0:o.paint.get("raster-fade-duration");E.registerFadeDuration(M);const A=n.findLoadedParent(x,0),C=tk(E,A,n,r.transform,M);r.terrain&&r.terrain.prepareDrawTile(x);const z="nearest"===o.paint.get("raster-resampling")?h.NEAREST:h.LINEAR;c.activeTexture.set(h.TEXTURE0),E.texture.bind(z,h.CLAMP_TO_EDGE),c.activeTexture.set(h.TEXTURE1),A?(A.texture.bind(z,h.CLAMP_TO_EDGE),v=Math.pow(2,A.tileID.overscaledZ-E.tileID.overscaledZ),b=[E.tileID.canonical.x*v%1,E.tileID.canonical.y*v%1]):E.texture.bind(z,h.CLAMP_TO_EDGE);const k=t1(S,b||[0,0],v||1,C,o,u instanceof ew?u.perspectiveTransform:[0,0]);if(r.prepareDrawProgram(c,d,T),u instanceof ew)d.draw(c,h.TRIANGLES,w,i.StencilMode.disabled,p,i.CullFaceMode.disabled,k,o.id,u.boundsBuffer,r.quadTriangleIndexBuffer,u.boundsSegments);else{const{tileBoundsBuffer:P,tileBoundsIndexBuffer:D,tileBoundsSegments:L}=r.getTileBoundsBuffers(E);d.draw(c,h.TRIANGLES,w,I,p,i.CullFaceMode.disabled,k,o.id,P,D,L)}}r.resetStencilClippingMasks()},background:function(r,n,o,s){const a=o.paint.get("background-color"),l=o.paint.get("background-opacity");if(0===l)return;const c=r.context,h=c.gl,u=r.transform,d=u.tileSize,p=o.paint.get("background-pattern");if(r.isPatternMissing(p))return;const f=!p&&1===a.a&&1===l&&r.opaquePassEnabledForLayer()?"opaque":"translucent";if(r.renderPass!==f)return;const m=i.StencilMode.disabled,_=r.depthModeForSublayer(0,"opaque"===f?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly),g=r.colorModeForRenderPass(),y=r.useProgram(p?"backgroundPattern":"background");let x,v=s;v||(v=Object.values(x=r.getBackgroundTiles()).map(i=>i.tileID)),p&&(c.activeTexture.set(h.TEXTURE0),r.imageManager.bind(r.context));const b=o.getCrossfadeParameters();for(const w of v){const T=w.toUnwrapped(),E=s?w.projMatrix:r.transform.calculateProjMatrix(T);r.prepareDrawTile(w);const S=n?n.getTile(w):x?x[w.key]:new i.Tile(w,d,u.zoom,r),I=p?t6(E,l,r,p,{tileID:w,tileSize:d},b):t4(E,l,a);r.prepareDrawProgram(c,y,T);const{tileBoundsBuffer:M,tileBoundsIndexBuffer:A,tileBoundsSegments:C}=r.getTileBoundsBuffers(S);y.draw(c,h.TRIANGLES,_,m,g,i.CullFaceMode.disabled,I,o.id,M,A,C)}},sky:function(r,n,o){const s=r.transform,a="mercator"===s.projection.name||"globe"===s.projection.name?1:i.smoothstep(7,8,s.zoom),l=o.paint.get("sky-opacity")*a;if(0===l)return;const c=r.context,h=o.paint.get("sky-type"),u=new i.DepthMode(c.gl.LEQUAL,i.DepthMode.ReadOnly,[0,1]),d=r.frameCounter/1e3%1;"atmosphere"===h?"offscreen"===r.renderPass?o.needsSkyboxCapture(r)&&(function(r,n,o,s){const a=r.context,l=a.gl;let c=n.skyboxFbo;if(!c){c=n.skyboxFbo=a.createFramebuffer(32,32,!1),n.skyboxGeometry=new ig(a),n.skyboxTexture=a.gl.createTexture(),l.bindTexture(l.TEXTURE_CUBE_MAP,n.skyboxTexture),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MIN_FILTER,l.LINEAR),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MAG_FILTER,l.LINEAR);for(let h=0;h<6;++h)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,l.RGBA,32,32,0,l.RGBA,l.UNSIGNED_BYTE,null)}a.bindFramebuffer.set(c.framebuffer),a.viewport.set([0,0,32,32]);const u=n.getCenter(r,!0),d=r.useProgram("skyboxCapture"),p=new Float64Array(16);i.identity(p),i.rotateY(p,p,-(.5*Math.PI)),iy(a,n,d,p,u,0),i.identity(p),i.rotateY(p,p,.5*Math.PI),iy(a,n,d,p,u,1),i.identity(p),i.rotateX(p,p,-(.5*Math.PI)),iy(a,n,d,p,u,2),i.identity(p),i.rotateX(p,p,.5*Math.PI),iy(a,n,d,p,u,3),i.identity(p),iy(a,n,d,p,u,4),i.identity(p),i.rotateY(p,p,Math.PI),iy(a,n,d,p,u,5),a.viewport.set([0,0,r.width,r.height])}(r,o),o.markSkyboxValid(r)):"sky"===r.renderPass&&function(r,n,o,s,a){const l=r.context,c=l.gl,h=r.transform,u=r.useProgram("skybox");l.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_CUBE_MAP,n.skyboxTexture);const d={u_matrix:h.skyboxMatrix,u_sun_direction:n.getCenter(r,!1),u_cubemap:0,u_opacity:s,u_temporal_offset:a};r.prepareDrawProgram(l,u),u.draw(l,c.TRIANGLES,o,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.backCW,d,"skybox",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}(r,o,u,l,d):"gradient"===h&&"sky"===r.renderPass&&function(r,n,o,s,a){var l,c,h;const u=r.context,d=u.gl,p=r.transform,f=r.useProgram("skyboxGradient");n.skyboxGeometry||(n.skyboxGeometry=new ig(u)),u.activeTexture.set(d.TEXTURE0);let m=n.colorRampTexture;m||(m=n.colorRampTexture=new i.Texture(u,n.colorRamp,d.RGBA)),m.bind(d.LINEAR,d.CLAMP_TO_EDGE);const _=(l=p.skyboxMatrix,c=n.getCenter(r,!1),h=n.paint.get("sky-gradient-radius"),{u_matrix:l,u_color_ramp:0,u_center_direction:c,u_radius:i.degToRad(h),u_opacity:s,u_temporal_offset:a});r.prepareDrawProgram(u,f),f.draw(u,d.TRIANGLES,o,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.backCW,_,"skyboxGradient",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}(r,o,u,l,d)},debug:function(r,n,o){for(let s=0;s ${o.overscaledZ}`),function(i,r){i.initDebugOverlayCanvas();const n=i.debugOverlayCanvas,o=i.context.gl,s=i.debugOverlayCanvas.getContext("2d");s.clearRect(0,0,n.width,n.height),s.shadowColor="white",s.shadowBlur=2,s.lineWidth=1.5,s.strokeStyle="white",s.textBaseline="top",s.font="bold 36px Open Sans, sans-serif",s.fillText(r,5,5),s.strokeText(r,5,5),i.debugOverlayTexture.update(n),i.debugOverlayTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE)}(r,`${w} ${x}kb`),c.draw(s,a.TRIANGLES,u,d,i.ColorMode.alphaBlended,i.CullFaceMode.disabled,tW(l,i.Color.transparent,b),f,r.debugBuffer,r.quadTriangleIndexBuffer,r.debugSegments)}(r,n,o[s])},custom:function(r,n,o){const s=r.context,a=o.implementation;if(r.transform.projection.unsupportedLayers&&r.transform.projection.unsupportedLayers.includes("custom"))i.warnOnce("Custom layers are not yet supported with non-mercator projections. Use mercator to enable custom layers.");else if("offscreen"===r.renderPass){const l=a.prerender;l&&(r.setCustomLayerDefaults(),s.setColorMode(r.colorModeForRenderPass()),l.call(a,s.gl,r.transform.customLayerMatrix()),s.setDirty(),r.setBaseState())}else if("translucent"===r.renderPass){r.setCustomLayerDefaults(),s.setColorMode(r.colorModeForRenderPass()),s.setStencilMode(i.StencilMode.disabled);const c="3d"===a.renderingMode?new i.DepthMode(r.context.gl.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D):r.depthModeForSublayer(0,i.DepthMode.ReadOnly);s.setDepthMode(c),a.render(s.gl,r.transform.customLayerMatrix()),s.setDirty(),r.setBaseState(),s.bindFramebuffer.set(null)}}};class iv{constructor(r,n){this.context=new e_(r),this.transform=n,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.setup(),this.numSublayers=i.SourceCache.maxUnderzooming+i.SourceCache.maxOverzooming+1,this.depthEpsilon=1/65536,this.crossTileSymbolIndex=new tl,this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={}}updateTerrain(i,r){const n=!!i&&!!i.terrain&&this.transform.projection.supportsTerrain;if(!(n||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new tB(this,i));const o=this._terrain;this.transform.elevation=n?o:null,o.update(i,this.transform,r)}_updateFog(i){const r=i.fog;if(!r||1>r.getOpacity(this.transform.pitch)||.03>r.properties.get("horizon-blend"))return void(this.transform.fogCullDistSq=null);const[n,o]=r.getFovAdjustedRange(this.transform._fov);if(n>o)return void(this.transform.fogCullDistSq=null);const s=n+.78*(o-n);this.transform.fogCullDistSq=s*s}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(r,n){if(this.width=r*i.exported.devicePixelRatio,this.height=n*i.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const o of this.style.order)this.style._layers[o].resize()}setup(){const r=this.context,n=new i.StructArrayLayout2i4;n.emplaceBack(0,0),n.emplaceBack(i.EXTENT,0),n.emplaceBack(0,i.EXTENT),n.emplaceBack(i.EXTENT,i.EXTENT),this.tileExtentBuffer=r.createVertexBuffer(n,i.posAttributes.members),this.tileExtentSegments=i.SegmentVector.simpleSegment(0,0,4,2);const o=new i.StructArrayLayout2i4;o.emplaceBack(0,0),o.emplaceBack(i.EXTENT,0),o.emplaceBack(0,i.EXTENT),o.emplaceBack(i.EXTENT,i.EXTENT),this.debugBuffer=r.createVertexBuffer(o,i.posAttributes.members),this.debugSegments=i.SegmentVector.simpleSegment(0,0,4,5);const s=new i.StructArrayLayout2i4;s.emplaceBack(-1,-1),s.emplaceBack(1,-1),s.emplaceBack(-1,1),s.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(s,i.posAttributes.members),this.viewportSegments=i.SegmentVector.simpleSegment(0,0,4,2);const a=new i.StructArrayLayout4i8;a.emplaceBack(0,0,0,0),a.emplaceBack(i.EXTENT,0,i.EXTENT,0),a.emplaceBack(0,i.EXTENT,0,i.EXTENT),a.emplaceBack(i.EXTENT,i.EXTENT,i.EXTENT,i.EXTENT),this.mercatorBoundsBuffer=r.createVertexBuffer(a,i.boundsAttributes.members),this.mercatorBoundsSegments=i.SegmentVector.simpleSegment(0,0,4,2);const l=new i.StructArrayLayout3ui6;l.emplaceBack(0,1,2),l.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(l);const c=new i.StructArrayLayout1ui2;for(const h of[0,1,3,2,0])c.emplaceBack(h);this.debugIndexBuffer=r.createIndexBuffer(c),this.emptyTexture=new i.Texture(r,{width:1,height:1,data:new Uint8Array([0,0,0,0])},r.gl.RGBA),this.identityMat=i.create();const u=this.context.gl;this.stencilClearMode=new i.StencilMode({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.loadTimeStamps.push(i.window.performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(i){return i._makeTileBoundsBuffers(this.context,this.transform.projection),i._tileBoundsBuffer?{tileBoundsBuffer:i._tileBoundsBuffer,tileBoundsIndexBuffer:i._tileBoundsIndexBuffer,tileBoundsSegments:i._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const r=this.context,n=r.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(r,n.TRIANGLES,i.DepthMode.disabled,this.stencilClearMode,i.ColorMode.disabled,i.CullFaceMode.disabled,tz(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(r,n,o){if(!n||this.currentStencilSource===n.id||!r.isTileClipped()||!o||0===o.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let s=!1;for(const a of o)if(void 0===this._tileClippingMaskIDs[a.key]){s=!0;break}if(!s)return}this.currentStencilSource=n.id;const l=this.context,c=l.gl;this.nextStencilID+o.length>256&&this.clearStencil(),l.setColorMode(i.ColorMode.disabled),l.setDepthMode(i.DepthMode.disabled);const h=this.useProgram("clippingMask");for(const u of(this._tileClippingMaskIDs={},o)){const d=n.getTile(u),p=this._tileClippingMaskIDs[u.key]=this.nextStencilID++,{tileBoundsBuffer:f,tileBoundsIndexBuffer:m,tileBoundsSegments:_}=this.getTileBoundsBuffers(d);h.draw(l,c.TRIANGLES,i.DepthMode.disabled,new i.StencilMode({func:c.ALWAYS,mask:0},p,255,c.KEEP,c.KEEP,c.REPLACE),i.ColorMode.disabled,i.CullFaceMode.disabled,tz(u.projMatrix),"$clipping",f,m,_)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const r=this.nextStencilID++,n=this.context.gl;return new i.StencilMode({func:n.NOTEQUAL,mask:255},r,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(r){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(r);const n=this.context.gl;return new i.StencilMode({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(r){const n=this.context.gl,o=r.sort((i,r)=>r.overscaledZ-i.overscaledZ),s=o[o.length-1].overscaledZ,a=o[0].overscaledZ-s+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();const l={};for(let c=0;c=0;this.currentLayer--){const v=this.style._layers[o[this.currentLayer]],b=r._getLayerSourceCache(v);if(v.isSky())continue;const w=b?h[b.id]:void 0;this._renderTileClippingMasks(v,b,w),this.renderLayer(this,b,v,w)}if(this.renderPass="sky",(i.globeToMercatorTransition(this.transform.zoom)>0||"globe"!==this.transform.projection.name)&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer{const n=r._getLayerSourceCache(i);n&&!i.isHidden(this.transform.zoom)&&(!A||A.getSource().maxzoom0?r.pop():null}isPatternMissing(i){if(!i)return!1;if(!i.from||!i.to)return!0;const r=this.imageManager.getPattern(i.from.toString()),n=this.imageManager.getPattern(i.to.toString());return!r||!n}currentGlobalDefines(){const i=this.terrain&&this.terrain.renderingToTexture,r=this.style&&this.style.fog,n=[];return this.terrain&&!this.terrain.renderingToTexture&&n.push("TERRAIN"),r&&!i&&0!==r.getOpacity(this.transform.pitch)&&n.push("FOG"),i&&n.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&n.push("OVERDRAW_INSPECTOR"),n}useProgram(i,r,n){this.cache=this.cache||{};const o=this.currentGlobalDefines().concat(n||[]),s=tF.cacheKey(i,o,r);return this.cache[s]||(this.cache[s]=new tF(this.context,i,tv[i],r,t8[i],o)),this.cache[s]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=i.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new i.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}prepareDrawTile(i){this.terrain&&this.terrain.prepareDrawTile(i)}prepareDrawProgram(i,r,n){if(this.terrain&&this.terrain.renderingToTexture)return;const o=this.style.fog;if(o){const s=o.getOpacity(this.transform.pitch);0!==s&&r.setFogUniformValues(i,((i,r,n,o)=>{const s=r.properties.get("color"),a=i.frameCounter/1e3%1,l=[s.r/s.a,s.g/s.a,s.b/s.a,o];return{u_fog_matrix:n?i.transform.calculateFogTileMatrix(n):i.identityMat,u_fog_range:r.getFovAdjustedRange(i.transform._fov),u_fog_color:l,u_fog_horizon_blend:r.properties.get("horizon-blend"),u_fog_temporal_offset:a}})(this,o,n,s))}}setTileLoadedFlag(i){this.tileLoaded=i}saveCanvasCopy(){this.frameCopies.push(this.canvasCopy()),this.tileLoaded=!1}canvasCopy(){const i=this.context.gl,r=i.createTexture();return i.bindTexture(i.TEXTURE_2D,r),i.copyTexImage2D(i.TEXTURE_2D,0,i.RGBA,0,0,i.drawingBufferWidth,i.drawingBufferHeight,0),r}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const i=this.style&&this.style.fog;return!!i&&0!==i.getOpacity(this.transform.pitch)}getBackgroundTiles(){const r=this._backgroundTiles,n=this._backgroundTiles={},o=this.transform.coveringTiles({tileSize:512});for(const s of o)n[s.key]=r[s.key]||new i.Tile(s,512,this.transform.tileZoom,this);return n}clearBackgroundTiles(){this._backgroundTiles={}}}class ib{constructor(i=0,r=0,n=0,o=0){if(isNaN(i)||i<0||isNaN(r)||r<0||isNaN(n)||n<0||isNaN(o)||o<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=r,this.left=n,this.right=o}interpolate(r,n,o){return null!=n.top&&null!=r.top&&(this.top=i.number(r.top,n.top,o)),null!=n.bottom&&null!=r.bottom&&(this.bottom=i.number(r.bottom,n.bottom,o)),null!=n.left&&null!=r.left&&(this.left=i.number(r.left,n.left,o)),null!=n.right&&null!=r.right&&(this.right=i.number(r.right,n.right,o)),this}getCenter(r,n){const o=i.clamp((this.left+r-this.right)/2,0,r),s=i.clamp((this.top+n-this.bottom)/2,0,n);return new i.pointGeometry(o,s)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new ib(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function iw(r,n){const o=i.getColumn(r,3);i.fromQuat(r,n),i.setColumn(r,3,o)}function iT(r,n){i.setColumn(r,3,[n[0],n[1],n[2],1])}function iE(r,n){const o=i.identity$1([]);return i.rotateZ$1(o,o,-n),i.rotateX$1(o,o,-r),o}function iS(r,n){const o=[r[0],r[1],0],s=[n[0],n[1],0];if(i.length(o)>=1e-15){const a=i.normalize([],o);i.scale$2(s,a,i.dot(s,a)),n[0]=s[0],n[1]=s[1]}const l=i.cross([],n,r);if(1e-15>i.len(l))return null;const c=Math.atan2(-l[1],l[0]);return iE(Math.atan2(Math.sqrt(r[0]*r[0]+r[1]*r[1]),-r[2]),c)}class iI{constructor(i,r){this.position=i,this.orientation=r}get position(){return this._position}set position(r){this._position=this._renderWorldCopies?function(r){if(!r)return;const n=Array.isArray(r)?new i.MercatorCoordinate(r[0],r[1],r[2]):r;return n.x=i.wrap(n.x,0,1),n}(r):r}lookAtPoint(r,n){if(this.orientation=null,!this.position)return;const o=this._elevation?this._elevation.getAtPointOrZero(i.MercatorCoordinate.fromLngLat(r)):0,s=this.position,a=i.MercatorCoordinate.fromLngLat(r,o),l=[a.x-s.x,a.y-s.y,a.z-s.z];n||(n=[0,0,1]),n[2]=Math.abs(n[2]),this.orientation=iS(l,n)}setPitchBearing(r,n){this.orientation=iE(i.degToRad(r),i.degToRad(-n))}}class iM{constructor(r,n){this._transform=i.identity([]),this._orientation=i.identity$1([]),n&&(this._orientation=n,iw(this._transform,this._orientation)),r&&iT(this._transform,r)}get mercatorPosition(){const r=this.position;return new i.MercatorCoordinate(r[0],r[1],r[2])}get position(){const r=i.getColumn(this._transform,3);return[r[0],r[1],r[2]]}set position(i){iT(this._transform,i)}get orientation(){return this._orientation}set orientation(i){this._orientation=i,iw(this._transform,this._orientation)}getPitchBearing(){const i=this.forward(),r=this.right();return{bearing:Math.atan2(-r[1],r[0]),pitch:Math.atan2(Math.sqrt(i[0]*i[0]+i[1]*i[1]),-i[2])}}setPitchBearing(i,r){this._orientation=iE(i,r),iw(this._transform,this._orientation)}forward(){const r=i.getColumn(this._transform,2);return[-r[0],-r[1],-r[2]]}up(){const r=i.getColumn(this._transform,1);return[-r[0],-r[1],-r[2]]}right(){const r=i.getColumn(this._transform,0);return[r[0],r[1],r[2]]}getCameraToWorld(r,n){const o=new Float64Array(16);return i.invert(o,this.getWorldToCamera(r,n)),o}getWorldToCameraPosition(r,n,o){const s=this.position;i.scale$2(s,s,-r);const a=new Float64Array(16);return i.fromScaling(a,[o,o,o]),i.translate(a,a,s),a[10]*=n,a}getWorldToCamera(r,n){const o=new Float64Array(16),s=new Float64Array(4),a=this.position;return i.conjugate(s,this._orientation),i.scale$2(a,a,-r),i.fromQuat(o,s),i.translate(o,o,a),o[1]*=-1,o[5]*=-1,o[9]*=-1,o[13]*=-1,o[8]*=n,o[9]*=n,o[10]*=n,o[11]*=n,o}getCameraToClipPerspective(r,n,o,s){const a=new Float64Array(16);return i.perspective(a,r,n,o,s),a}getDistanceToElevation(r){const n=0===r?0:i.mercatorZfromAltitude(r,this.position[1]),o=this.forward();return(n-this.position[2])/o[2]}clone(){return new iM([...this.position],[...this.orientation])}}function iA(r,n){const o=iz(r),s=function(r,n,o,s,a){const l=new i.LngLat(o.lng-180*ik,o.lat),c=new i.LngLat(o.lng+180*ik,o.lat),h=r.project(l.lng,l.lat),u=r.project(c.lng,c.lat),d=-Math.atan2(u.y-h.y,u.x-h.x),p=i.MercatorCoordinate.fromLngLat(o);p.y=i.clamp(p.y,-.999975,.999975);const f=p.toLngLat(),m=r.project(f.lng,f.lat),_=i.MercatorCoordinate.fromLngLat(f);_.x+=ik;const g=_.toLngLat(),y=r.project(g.lng,g.lat),x=iD(y.x-m.x,y.y-m.y,d),v=i.MercatorCoordinate.fromLngLat(f);v.y+=ik;const b=v.toLngLat(),w=r.project(b.lng,b.lat),T=iD(w.x-m.x,w.y-m.y,d),E=Math.abs(x.x)/Math.abs(T.y),S=i.identity([]);i.rotateZ(S,S,-d*(1-(a?0:s)));const I=i.identity([]);return i.scale(I,I,[1,1-(1-E)*s,1]),I[4]=-T.x/T.y*s,i.rotateZ(I,I,d),i.multiply$1(I,S,I),I}(r.projection,0,r.center,o,n),a=iC(r);return i.scale(s,s,[a,a,1]),s}function iC(r){const n=r.projection,o=iz(r),s=iP(n,r.center),a=iP(n,i.LngLat.convert(n.center));return Math.pow(2,s*o+(1-o)*a)}function iz(r){const n=r.projection.range;if(!n)return 0;const o=Math.max(r.width,r.height),s=Math.log(o/1024)/Math.LN2;return i.smoothstep(n[0]+s,n[1]+s,r.zoom)}const ik=1/4e4;function iP(r,n){const o=i.clamp(n.lat,-i.MAX_MERCATOR_LATITUDE,i.MAX_MERCATOR_LATITUDE),s=new i.LngLat(n.lng-180*ik,o),a=new i.LngLat(n.lng+180*ik,o),l=r.project(s.lng,o),c=r.project(a.lng,o),h=i.MercatorCoordinate.fromLngLat(s),u=i.MercatorCoordinate.fromLngLat(a),d=c.x-l.x,p=c.y-l.y,f=u.x-h.x,m=u.y-h.y,_=Math.sqrt((f*f+m*m)/(d*d+p*p));return Math.log(_)/Math.LN2}function iD(i,r,n){const o=Math.cos(n),s=Math.sin(n);return{x:i*o-r*s,y:i*s+r*o}}class iL{constructor(r,n,o,s,a){this.tileSize=512,this._renderWorldCopies=void 0===a||a,this._minZoom=r||0,this._maxZoom=n||22,this._minPitch=null==o?0:o,this._maxPitch=null==s?60:s,this.setProjection(),this.setMaxBounds(),this.width=0,this.height=0,this._center=new i.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new ib,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new iM,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._projectionScaler=1,this._horizonShift=.1}clone(){const i=new iL(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return i.setProjection(this.getProjection()),i._elevation=this._elevation,i._centerAltitude=this._centerAltitude,i.tileSize=this.tileSize,i.setMaxBounds(this.getMaxBounds()),i.width=this.width,i.height=this.height,i.cameraElevationReference=this.cameraElevationReference,i._center=this._center,i._setZoom(this.zoom),i._cameraZoom=this._cameraZoom,i.angle=this.angle,i._fov=this._fov,i._pitch=this._pitch,i._nearZ=this._nearZ,i._farZ=this._farZ,i._averageElevation=this._averageElevation,i._unmodified=this._unmodified,i._edgeInsets=this._edgeInsets.clone(),i._camera=this._camera.clone(),i._calcMatrices(),i.freezeTileCoverage=this.freezeTileCoverage,i}get elevation(){return this._elevation}set elevation(i){this._elevation!==i&&(this._elevation=i,i?this._updateCenterElevation()&&this._updateCameraOnTerrain():(this._cameraZoom=null,this._centerAltitude=0),this._calcMatrices())}updateElevation(i){this._terrainEnabled()&&null==this._cameraZoom&&this._updateCenterElevation()&&this._updateCameraOnTerrain(),i&&this._constrainCameraAltitude(),this._calcMatrices()}getProjection(){return i.pick(this.projection,["name","center","parallels"])}setProjection(r){null==r&&(r={name:"mercator"}),this.projectionOptions=r;const n=this.projection?this.getProjection():void 0;return this.projection=i.getProjection(r),!h(n,this.getProjection())&&(this._calcMatrices(),!0)}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(i){void 0===i?i=!0:null===i&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get cameraWorldSize(){const i=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(i))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.cameraWorldSize)}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new i.pointGeometry(this.width,this.height)}get bearing(){return i.wrap(this.rotation,-180,180)}set bearing(i){this.rotation=i}get rotation(){return-this.angle/Math.PI*180}set rotation(r){var n,o,s,a,l,c,h,u,d,p;const f=-r*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=(n=new i.ARRAY_TYPE(4),i.ARRAY_TYPE!=Float32Array&&(n[1]=0,n[2]=0),n[0]=1,n[3]=1,n),o=this.rotationMatrix,s=this.rotationMatrix,a=this.angle,l=s[0],c=s[1],h=s[2],u=s[3],d=Math.sin(a),p=Math.cos(a),o[0]=l*p+h*d,o[1]=c*p+u*d,o[2]=-(l*d)+h*p,o[3]=-(c*d)+u*p)}get pitch(){return this._pitch/Math.PI*180}set pitch(r){const n=i.clamp(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=i/180*Math.PI,this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(i){this._averageElevation=i,this._calcFogMatrices()}get zoom(){return this._zoom}set zoom(i){const r=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==r&&(this._unmodified=!1,this._setZoom(r),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._constrain(),this._calcMatrices())}_setZoom(i){this._zoom=i,this.scale=this.zoomScale(i),this.tileZoom=Math.floor(i),this.zoomFraction=i-this.tileZoom}_updateCenterElevation(){if(!this._elevation)return!1;const i=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center),-1);return -1===i?(this._cameraZoom=null,!1):(this._centerAltitude=i,!0)}_updateCameraOnTerrain(){this._cameraZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize)}sampleAverageElevation(){if(!this._elevation)return 0;const r=this._elevation,n=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],o=this.horizonLineFromTop();let s=0,a=0;for(let l=0;lr.maxzoom&&(n=r.maxzoom);const l=this.locationCoordinate(this.center),c=1<{const n=1/4e4,o=new i.MercatorCoordinate(r.x+n,r.y,r.z),s=new i.MercatorCoordinate(r.x,r.y+n,r.z),a=r.toLngLat(),l=o.toLngLat(),c=s.toLngLat(),h=this.locationCoordinate(a),u=this.locationCoordinate(l),d=this.locationCoordinate(c),p=Math.hypot(u.x-h.x,u.y-h.y),f=Math.hypot(d.x-h.x,d.y-h.y);return Math.sqrt(p*f)*v/n},w=r=>({aabb:i.tileAABB(this,c,0,0,0,r,x,y,this.projection),zoom:0,x:0,y:0,minZ:x,maxZ:y,wrap:r,fullyVisible:!1}),T=[];let E=[];const S=n,I=r.reparseOverscaled?o:n,M=i=>i*i,A=M((f-this._centerAltitude)*p),C=i=>{if(!this._elevation||!i.tileID||!a)return;const r=this._elevation.getMinMaxForTile(i.tileID),n=i.aabb;r?(n.min[2]=r.min,n.max[2]=r.max,n.center[2]=(n.min[2]+n.max[2])/2):(i.shouldSplit=z(i),i.shouldSplit||(n.min[2]=n.max[2]=n.center[2]=this._centerAltitude))},z=r=>{if(r.zoom.85?1:u}const d=n*n+a*a+l;return d{if(r*M(.707)0;){const P=T.pop(),D=P.x,L=P.y;let B=P.fullyVisible;if(!B){const R=P.aabb.intersects(u);if(0===R)continue;B=2===R}if(P.zoom!==S&&z(P))for(let F=0;F<4;F++){const O=(D<<1)+F%2,U=(L<<1)+(F>>1),V={aabb:a?P.aabb.quadrant(F):i.tileAABB(this,c,P.zoom+1,O,U,P.wrap,P.minZ,P.maxZ,this.projection),zoom:P.zoom+1,x:O,y:U,wrap:P.wrap,fullyVisible:B,tileID:void 0,shouldSplit:void 0,minZ:P.minZ,maxZ:P.maxZ};s&&(V.tileID=new i.OverscaledTileID(P.zoom+1===S?I:P.zoom+1,P.wrap,P.zoom+1,O,U),C(V)),T.push(V)}else{const N=P.zoom===S?I:P.zoom;if(r.minzoom&&r.minzoom>N)continue;const j=h[0]-(.5+D+(P.wrap<{const o=[0,0,0,1],s=[i.EXTENT,i.EXTENT,0,1],a=this.calculateFogTileMatrix(n.tileID.toUnwrapped());i.transformMat4$1(o,o,a),i.transformMat4$1(s,s,a);const l=i.getAABBPointSquareDist(o,s);if(0===l)return!0;let c=!1;const h=this._elevation;if(h&&l>$&&0!==q){let u;const d=this.calculateProjMatrix(n.tileID.toUnwrapped());r.isTerrainDEM||(u=h.getMinMaxForTile(n.tileID)),u||(u={min:x,max:y});const p=i.furthestTileCorner(this.rotation),f=[p[0]*i.EXTENT,p[1]*i.EXTENT,u.max];i.transformMat4(f,f,d),c=(1-f[1])*this.height*.5i.distanceSq-r.distanceSq).map(i=>i.tileID)}resize(i,r){this.width=i,this.height=r,this.pixelsToGLUnits=[2/i,-2/r],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log(i)/Math.LN2}project(r){const n=i.clamp(r.lat,-i.MAX_MERCATOR_LATITUDE,i.MAX_MERCATOR_LATITUDE),o=this.projection.project(r.lng,n);return new i.pointGeometry(o.x*this.worldSize,o.y*this.worldSize)}unproject(i){return this.projection.unproject(i.x/this.worldSize,i.y/this.worldSize)}get point(){return this.project(this.center)}setLocationAtPoint(r,n){const o=this.pointCoordinate(n),s=this.pointCoordinate(this.centerPoint),a=this.locationCoordinate(r);this.setLocation(new i.MercatorCoordinate(a.x-(o.x-s.x),a.y-(o.y-s.y)))}setLocation(i){this.center=this.coordinateLocation(i),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(i){return this.projection.locationPoint(this,i)}locationPoint3D(i){return this._coordinatePoint(this.locationCoordinate(i),!0)}pointLocation(i){return this.coordinateLocation(this.pointCoordinate(i))}pointLocation3D(i){return this.coordinateLocation(this.pointCoordinate3D(i))}locationCoordinate(r,n){const o=n?i.mercatorZfromAltitude(n,r.lat):void 0,s=this.projection.project(r.lng,r.lat);return new i.MercatorCoordinate(s.x,s.y,o)}coordinateLocation(i){return this.projection.unproject(i.x,i.y)}pointRayIntersection(r,n){const o=null!=n?n:this._centerAltitude,s=[r.x,r.y,0,1],a=[r.x,r.y,1,1];i.transformMat4$1(s,s,this.pixelMatrixInverse),i.transformMat4$1(a,a,this.pixelMatrixInverse);const l=a[3];i.scale$1(s,s,1/s[3]),i.scale$1(a,a,1/l);const c=s[2],h=a[2];return{p0:s,p1:a,t:c===h?0:(o-c)/(h-c)}}screenPointToMercatorRay(r){const n=[r.x,r.y,0,1],o=[r.x,r.y,1,1];return i.transformMat4$1(n,n,this.pixelMatrixInverse),i.transformMat4$1(o,o,this.pixelMatrixInverse),i.scale$1(n,n,1/n[3]),i.scale$1(o,o,1/o[3]),n[2]=i.mercatorZfromAltitude(n[2],this._center.lat)*this.worldSize,o[2]=i.mercatorZfromAltitude(o[2],this._center.lat)*this.worldSize,i.scale$1(n,n,1/this.worldSize),i.scale$1(o,o,1/this.worldSize),new i.Ray([n[0],n[1],n[2]],i.normalize([],i.sub([],o,n)))}rayIntersectionCoordinate(r){const{p0:n,p1:o,t:s}=r,a=i.mercatorZfromAltitude(n[2],this._center.lat),l=i.mercatorZfromAltitude(o[2],this._center.lat);return new i.MercatorCoordinate(i.number(n[0],o[0],s)/this.worldSize,i.number(n[1],o[1],s)/this.worldSize,i.number(a,l,s))}pointCoordinate(i,r=this._centerAltitude){return this.projection.createTileTransform(this,this.worldSize).pointCoordinate(i.x,i.y,r)}pointCoordinate3D(r){if(!this.elevation)return this.pointCoordinate(r);const n=this.elevation;let o=this.elevation.pointCoordinate(r);if(o)return new i.MercatorCoordinate(o[0],o[1],o[2]);let s=0,a=this.horizonLineFromTop();if(r.y>a)return this.pointCoordinate(r);const l=.02*a,c=r.clone();for(let h=0;h<10&&a-s>l;h++){c.y=i.number(s,a,.66);const u=n.pointCoordinate(c);u?(a=c.y,o=u):s=c.y}return o?new i.MercatorCoordinate(o[0],o[1],o[2]):this.pointCoordinate(r)}isPointAboveHorizon(i){if(this.elevation)return!this.elevation.pointCoordinate(i);{const r=this.horizonLineFromTop();return i.y0?new i.pointGeometry(s[0]/s[3],s[1]/s[3]):new i.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}_getBounds(r,n){var o,s,a,l;const c=new i.pointGeometry(this._edgeInsets.left,this._edgeInsets.top),h=new i.pointGeometry(this.width-this._edgeInsets.right,this._edgeInsets.top),u=new i.pointGeometry(this.width-this._edgeInsets.right,this.height-this._edgeInsets.bottom),d=new i.pointGeometry(this._edgeInsets.left,this.height-this._edgeInsets.bottom);let p=this.pointCoordinate(c,r),f=this.pointCoordinate(h,r);const m=this.pointCoordinate(u,n),_=this.pointCoordinate(d,n);return p.y>1&&f.y>=0?p=new i.MercatorCoordinate((1-_.y)/(((o=p).y-_.y)/(o.x-_.x))+_.x,1):p.y<0&&f.y<=1&&(p=new i.MercatorCoordinate(-_.y/(((s=p).y-_.y)/(s.x-_.x))+_.x,0)),f.y>1&&p.y>=0?f=new i.MercatorCoordinate((1-m.y)/(((a=f).y-m.y)/(a.x-m.x))+m.x,1):f.y<0&&p.y<=1&&(f=new i.MercatorCoordinate(-m.y/(((l=f).y-m.y)/(l.x-m.x))+m.x,0)),new i.LngLatBounds().extend(this.coordinateLocation(p)).extend(this.coordinateLocation(f)).extend(this.coordinateLocation(_)).extend(this.coordinateLocation(m))}_getBounds3D(){const i=this.elevation;if(!i.visibleDemTiles.length)return this._getBounds(0,0);const r=i.visibleDemTiles.reduce((i,r)=>{if(r.dem){const n=r.dem.tree;i.min=Math.min(i.min,n.minimums[0]),i.max=Math.max(i.max,n.maximums[0])}return i},{min:Number.MAX_VALUE,max:0});return this._getBounds(r.min*i.exaggeration(),r.max*i.exaggeration())}getBounds(){return this._terrainEnabled()?this._getBounds3D():this._getBounds(0,0)}horizonLineFromTop(i=!0){const r=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,n=this.height/2-r*(1-this._horizonShift);return i?Math.max(0,n):n}getMaxBounds(){return this.maxBounds}setMaxBounds(r){this.maxBounds=r,this.minLat=-i.MAX_MERCATOR_LATITUDE,this.maxLat=i.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,r&&(this.minLat=r.getSouth(),this.maxLat=r.getNorth(),this.minLng=r.getWest(),this.maxLng=r.getEast(),this.maxLngp&&(c=p-u),p-dm&&(l=m-h),m-f.5?w-1:w,T>.5?T-1:T,0]),this.alignedProjMatrix=E,l=i.create(),i.scale(l,l,[this.width/2,-this.height/2,1]),i.translate(l,l,[1,-1,0]),this.labelPlaneMatrix=l,l=i.create(),i.scale(l,l,[1,-1,1]),i.translate(l,l,[-1,-1,0]),i.scale(l,l,[2/this.width,2/this.height,1]),this.glCoordMatrix=l,this.pixelMatrix=i.multiply$1(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},!(l=i.invert(new Float64Array(16),this.pixelMatrix)))throw Error("failed to invert matrix");this.pixelMatrixInverse=l,this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const r=this.cameraWorldSize,n=this.cameraPixelsPerMeter,o=this._camera.position,s=1/this.height,a=[r,r,n];i.scale$2(a,a,s),i.scale$2(o,o,-1),i.multiply$2(o,o,a);const l=i.create();i.translate(l,l,o),i.scale(l,l,a),this.mercatorFogMatrix=l,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(r,n,s)}_computeCameraPosition(i){const r=(i=i||this.pixelsPerMeter)/this.pixelsPerMeter,n=this._camera.forward(),o=this.point,s=this._mercatorZfromZoom(this._cameraZoom?this._cameraZoom:this._zoom)*r-i/this.worldSize*this._centerAltitude;return[o.x/this.worldSize-n[0]*s,o.y/this.worldSize-n[1]*s,i/this.worldSize*this._centerAltitude-n[2]*s]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(r){const n=this._maxCameraBoundsDistance()*Math.cos(this._pitch),o=r[2];let s=1;o>0&&(s=Math.min((n-this._camera.position[2])/o,1)),this._camera.position=i.scaleAndAdd([],this._camera.position,r,s),this._updateStateFromCamera()}_updateStateFromCamera(){const r=this._camera.position,n=this._camera.forward(),{pitch:o,bearing:s}=this._camera.getPitchBearing(),a=i.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._projectionScaler,l=this._mercatorZfromZoom(this._maxZoom)*Math.cos(i.degToRad(this._maxPitch)),c=Math.max((r[2]-a)/Math.cos(o),l),h=this._zoomFromMercatorZ(c);i.scaleAndAdd(r,r,n,c),this._pitch=i.clamp(o,i.degToRad(this.minPitch),i.degToRad(this.maxPitch)),this.angle=i.wrap(s,-Math.PI,Math.PI),this._setZoom(i.clamp(h,this._minZoom,this._maxZoom)),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._center=this.coordinateLocation(new i.MercatorCoordinate(r[0],r[1],r[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(i){return Math.pow(2,i)*this.tileSize}_mercatorZfromZoom(i){return this.cameraToCenterDistance/this._worldSizeFromZoom(i)}_minimumHeightOverTerrain(){const i=Math.min((null!=this._cameraZoom?this._cameraZoom:this._zoom)+2,this._maxZoom);return this._mercatorZfromZoom(i)}_zoomFromMercatorZ(i){return this.scaleZoom(this.cameraToCenterDistance/(i*this.tileSize))}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(i.warnOnce("Terrain is not yet supported with alternate projections. Use mercator to enable terrain."),1))}anyCornerOffEdge(r,n){const o=Math.min(r.x,n.x),s=Math.max(r.x,n.x),a=Math.min(r.y,n.y),l=Math.max(r.y,n.y);if(au||f.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+i.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new i.pointGeometry(0,0),new i.pointGeometry(this.width,this.height))}zoomDeltaToMovement(r,n){const o=i.length(i.sub([],this._camera.position,r)),s=this._zoomFromMercatorZ(o)+n;return o-this._mercatorZfromZoom(s)}getCameraPoint(){const r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.pointGeometry(0,r))}}function iB(i,r){let n=!1,o=null;const s=()=>{o=null,n&&(i(),o=setTimeout(s,r),n=!1)};return()=>(n=!0,o||s(),o)}class iR{constructor(r){this._hashName=r&&encodeURIComponent(r),i.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=iB(this._updateHashUnthrottled.bind(this),300)}addTo(r){return this._map=r,i.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return i.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(r){const n=this._map.getCenter(),o=Math.round(100*this._map.getZoom())/100,s=Math.ceil((o*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.pow(10,s),l=Math.round(n.lng*a)/a,c=Math.round(n.lat*a)/a,h=this._map.getBearing(),u=this._map.getPitch();let d="";if(d+=r?`/${l}/${c}/${o}`:`${o}/${c}/${l}`,(h||u)&&(d+="/"+Math.round(10*h)/10),u&&(d+=`/${Math.round(u)}`),this._hashName){const p=this._hashName;let f=!1;const m=i.window.location.hash.slice(1).split("&").map(i=>{const r=i.split("=")[0];return r===p?(f=!0,`${r}=${d}`):i}).filter(i=>i);return f||m.push(`${p}=${d}`),`#${m.join("&")}`}return`#${d}`}_getCurrentHash(){const r=i.window.location.hash.replace("#","");if(this._hashName){let n;return r.split("&").map(i=>i.split("=")).forEach(i=>{i[0]===this._hashName&&(n=i)}),(n&&n[1]||"").split("/")}return r.split("/")}_onHashChange(){const i=this._getCurrentHash();if(i.length>=3&&!i.some(i=>isNaN(i))){const r=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(i[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:r,pitch:+(i[4]||0)}),!0}return!1}_updateHashUnthrottled(){const r=i.window.location.href.replace(/(#.+)?$/,this.getHashString());i.window.history.replaceState(i.window.history.state,null,r)}}const iF={linearity:.3,easing:i.bezier(0,0,.3,1)},iO=i.extend({deceleration:2500,maxSpeed:1400},iF),iU=i.extend({deceleration:20,maxSpeed:1400},iF),iV=i.extend({deceleration:1e3,maxSpeed:360},iF),iN=i.extend({deceleration:1e3,maxSpeed:90},iF);class ij{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.exported.now(),settings:r})}_drainInertiaBuffer(){const r=this._inertiaBuffer,n=i.exported.now();for(;r.length>0&&n-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new i.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:o}of this._inertiaBuffer)n.zoom+=o.zoomDelta||0,n.bearing+=o.bearingDelta||0,n.pitch+=o.pitchDelta||0,o.panDelta&&n.pan._add(o.panDelta),o.around&&(n.around=o.around),o.pinchAround&&(n.pinchAround=o.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(n.pan.mag()){const l=iZ(n.pan.mag(),s,i.extend({},iO,r||{}));a.offset=n.pan.mult(l.amount/n.pan.mag()),a.center=this._map.transform.center,iG(a,l)}if(n.zoom){const c=iZ(n.zoom,s,iU);a.zoom=this._map.transform.zoom+c.amount,iG(a,c)}if(n.bearing){const h=iZ(n.bearing,s,iV);a.bearing=this._map.transform.bearing+i.clamp(h.amount,-179,179),iG(a,h)}if(n.pitch){const u=iZ(n.pitch,s,iN);a.pitch=this._map.transform.pitch+u.amount,iG(a,u)}if(a.zoom||a.bearing){const d=void 0===n.pinchAround?n.around:n.pinchAround;a.around=d?this._map.unproject(d):this._map.getCenter()}return this.clear(),i.extend(a,{noMoveStart:!0})}}function iG(i,r){(!i.duration||i.durationn.unproject(i)),c=a.reduce((i,r,n,o)=>i.add(r.div(o.length)),new i.pointGeometry(0,0));super(r,{points:a,point:c,lngLats:l,lngLat:n.unproject(c),originalEvent:o}),this._defaultPrevented=!1}}class iX extends i.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,n){super(i,{originalEvent:n}),this._defaultPrevented=!1}}class iW{constructor(i,r){this._map=i,this._clickTolerance=r.clickTolerance}reset(){delete this._mousedownPos}wheel(i){return this._firePreventable(new iX(i.type,this._map,i))}mousedown(i,r){return this._mousedownPos=r,this._firePreventable(new i$(i.type,this._map,i))}mouseup(i){this._map.fire(new i$(i.type,this._map,i))}preclick(r){const n=i.extend({},r);n.type="preclick",this._map.fire(new i$(n.type,this._map,n))}click(i,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||(this.preclick(i),this._map.fire(new i$(i.type,this._map,i)))}dblclick(i){return this._firePreventable(new i$(i.type,this._map,i))}mouseover(i){this._map.fire(new i$(i.type,this._map,i))}mouseout(i){this._map.fire(new i$(i.type,this._map,i))}touchstart(i){return this._firePreventable(new iq(i.type,this._map,i))}touchmove(i){this._map.fire(new iq(i.type,this._map,i))}touchend(i){this._map.fire(new iq(i.type,this._map,i))}touchcancel(i){this._map.fire(new iq(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class iH{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(i){this._map.fire(new i$(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new i$("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._map.fire(new i$(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class iK{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=r.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,r){this.isEnabled()&&i.shiftKey&&0===i.button&&(u.disableDrag(),this._startPos=this._lastPos=r,this._active=!0)}mousemoveWindow(i,r){if(!this._active||this._lastPos.equals(r)||!this._box&&r.dist(this._startPos){this._box&&(this._box.style.transform=`translate(${o}px,${a}px)`,this._box.style.width=s-o+"px",this._box.style.height=l-a+"px")})}mouseupWindow(r,n){if(!this._active||0!==r.button)return;const o=this._startPos;if(this.reset(),u.suppressClick(),o.x!==n.x||o.y!==n.y)return this._map.fire(new i.Event("boxzoomend",{originalEvent:r})),{cameraAnimation:i=>i.fitScreenCoordinates(o,n,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",r)}keydown(i){this._active&&27===i.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",i))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),u.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(r,n){return this._map.fire(new i.Event(r,{originalEvent:n}))}}function iY(i,r){const n={};for(let o=0;othis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=r.timeStamp),o.length===this.numTouches&&(this.centroid=function(r){const n=new i.pointGeometry(0,0);for(const o of r)n._add(o);return n.div(r.length)}(n),this.touches=iY(o,n)))}touchmove(i,r,n){if(this.aborted||!this.centroid)return;const o=iY(n,r);for(const s in this.touches){const a=this.touches[s],l=o[s];(!l||l.dist(a)>30)&&(this.aborted=!0)}}touchend(i,r,n){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),0===n.length){const o=!this.aborted&&this.centroid;if(this.reset(),o)return o}}}class iQ{constructor(i){this.singleTap=new iJ(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(i,r,n){this.singleTap.touchstart(i,r,n)}touchmove(i,r,n){this.singleTap.touchmove(i,r,n)}touchend(i,r,n){const o=this.singleTap.touchend(i,r,n);if(o){const s=i.timeStamp-this.lastTime<500,a=!this.lastTap||30>this.lastTap.dist(o);if(s&&a||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class i0{constructor(){this._zoomIn=new iQ({numTouches:1,numTaps:2}),this._zoomOut=new iQ({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,r,n){this._zoomIn.touchstart(i,r,n),this._zoomOut.touchstart(i,r,n)}touchmove(i,r,n){this._zoomIn.touchmove(i,r,n),this._zoomOut.touchmove(i,r,n)}touchend(i,r,n){const o=this._zoomIn.touchend(i,r,n),s=this._zoomOut.touchend(i,r,n);return o?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:r.getZoom()+1,around:r.unproject(o)},{originalEvent:i})}):s?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:r.getZoom()-1,around:r.unproject(s)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const i1={0:1,2:2};class i2{constructor(i){this.reset(),this._clickTolerance=i.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(i,r){return!1}_move(i,r){return{}}mousedown(i,r){if(this._lastPoint)return;const n=u.mouseButton(i);this._correctButton(i,n)&&(this._lastPoint=r,this._eventButton=n)}mousemoveWindow(i,r){const n=this._lastPoint;if(n){if(i.preventDefault(),function(i,r){const n=i1[r];return void 0===i.buttons||(i.buttons&n)!==n}(i,this._eventButton))this.reset();else if(this._moved||!(r.dist(n)0&&(this._active=!0);const s=iY(o,n),a=new i.pointGeometry(0,0),l=new i.pointGeometry(0,0);let c=0;for(const h in s){const u=s[h],d=this._touches[h];d&&(a._add(u),l._add(u.sub(d)),c++,s[h]=u)}if(this._touches=s,c{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show")},500)}}class i8{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(i){}_move(i,r,n){return{}}touchstart(i,r,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier],this._start([r[0],r[1]]))}touchmove(i,r,n){if(!this._firstTwoTouches)return;i.preventDefault();const[o,s]=this._firstTwoTouches,a=i9(n,r,o),l=i9(n,r,s);if(!a||!l)return;const c=this._aroundCenter?null:a.add(l).div(2);return this._move([a,l],c,i)}touchend(i,r,n){if(!this._firstTwoTouches)return;const[o,s]=this._firstTwoTouches,a=i9(n,r,o),l=i9(n,r,s);a&&l||(this._active&&u.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(i){this._enabled=!0,this._aroundCenter=!!i&&"center"===i.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function i9(i,r,n){for(let o=0;oMath.abs(i7(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:i7(this._distance,n),pinchAround:r}}}function rt(i,r){return 180*i.angleWith(r)/Math.PI}class ri extends i8{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(i){this._startVector=this._vector=i[0].sub(i[1]),this._minDiameter=i[0].dist(i[1])}_move(i,r){const n=this._vector;if(this._vector=i[0].sub(i[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:rt(this._vector,n),pinchAround:r}}_isBelowThreshold(i){this._minDiameter=Math.min(this._minDiameter,i.mag());const r=25/(Math.PI*this._minDiameter)*360,n=rt(i,this._startVector);return Math.abs(n)Math.abs(i.x)}class rn extends i8{constructor(i){super(),this._map=i}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(i){this._lastPoints=i,rr(i[0].sub(i[1]))&&(this._valid=!1)}_move(i,r,n){const o=i[0].sub(this._lastPoints[0]),s=i[1].sub(this._lastPoints[1]);if(!(this._map._cooperativeGestures&&n.touches.length<3)&&(this._valid=this.gestureBeginsVertically(o,s,n.timeStamp),this._valid))return this._lastPoints=i,this._active=!0,{pitchDelta:-((o.y+s.y)/2*.5)}}gestureBeginsVertically(i,r,n){if(void 0!==this._valid)return this._valid;const o=i.mag()>=2,s=r.mag()>=2;if(!o&&!s)return;if(!o||!s)return void 0===this._firstMove&&(this._firstMove=n),n-this._firstMove<100&&void 0;const a=i.y>0==r.y>0;return rr(i)&&rr(r)&&a}}const ro={panStep:100,bearingStep:15,pitchStep:10};class rs{constructor(){this._panStep=ro.panStep,this._bearingStep=ro.bearingStep,this._pitchStep=ro.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let r=0,n=0,o=0,s=0,a=0;switch(i.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:i.shiftKey?n=-1:(i.preventDefault(),s=-1);break;case 39:i.shiftKey?n=1:(i.preventDefault(),s=1);break;case 38:i.shiftKey?o=1:(i.preventDefault(),a=-1);break;case 40:i.shiftKey?o=-1:(i.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(n=0,o=0),{cameraAnimation:l=>{const c=l.getZoom();l.easeTo({duration:300,easeId:"keyboardHandler",easing:ra,zoom:r?Math.round(c)+r*(i.shiftKey?2:1):c,bearing:l.getBearing()+n*this._bearingStep,pitch:l.getPitch()+o*this._pitchStep,offset:[-s*this._panStep,-a*this._panStep],center:l.getCenter()},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function ra(i){return i*(2-i)}class rl{constructor(r,n){this._map=r,this._el=r.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,i.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert","_isFullscreen"],this)}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&"center"===i.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(r){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(r.ctrlKey||r.metaKey||this.isZooming()||this._isFullscreen()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let n=r.deltaMode===i.window.WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY;const o=i.exported.now(),s=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,0!==n&&n%4.000244140625==0?this._type="wheel":0!==n&&4>Math.abs(n)?this._type="trackpad":s>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,r)):this._type||(this._type=200>Math.abs(s*n)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),r.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=r,this._delta-=n,this._active||this._start(r)),r.preventDefault()}_onTimeout(i){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)}_start(i){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const r=u.mousePos(this._el,i);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:r,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const r=this._map.transform,n=()=>r._terrainEnabled()&&this._aroundCoord?r.computeZoomRelativeTo(this._aroundCoord):r.zoom;if(0!==this._delta){const o="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate;let s=2/(1+Math.exp(-Math.abs(this._delta*o)));this._delta<0&&0!==s&&(s=1/s);const a=n(),l=Math.pow(2,a),c="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):l;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(c*s))),"wheel"===this._type&&(this._startZoom=n(),this._easing=this._smoothOutEasing(200)),this._delta=0}const h="number"==typeof this._targetZoom?this._targetZoom:n(),u=this._startZoom,d=this._easing;let p,f=!1;if("wheel"===this._type&&u&&d){const m=Math.min((i.exported.now()-this._lastWheelEventTime)/200,1),_=d(m);p=i.number(u,h,_),m<1?this._frameId||(this._frameId=!0):f=!0}else p=h,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!f,zoomDelta:p-n(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let n=i.ease;if(this._prevEase){const o=this._prevEase,s=(i.exported.now()-o.start)/o.duration,a=o.easing(s+.01)-o.easing(s),l=.27/Math.sqrt(a*a+1e-4)*.01,c=Math.sqrt(.0729-l*l);n=i.bezier(l,c,.25,1)}return this._prevEase={start:i.exported.now(),duration:r,easing:n},n}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=u.create("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(i.window.navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_isFullscreen(){return!!i.window.document.fullscreenElement}_showBlockerAlert(){"hidden"===this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="visible"),this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show")},200)}}class rc{constructor(i,r){this._clickZoom=i,this._tapZoom=r}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class rh{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(i,r){return i.preventDefault(),{cameraAnimation(n){n.easeTo({duration:300,zoom:n.getZoom()+(i.shiftKey?-1:1),around:n.unproject(r)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ru{constructor(){this._tap=new iQ({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(i,r,n){this._swipePoint||(this._tapTime&&i.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?n.length>0&&(this._swipePoint=r[0],this._swipeTouch=n[0].identifier):this._tap.touchstart(i,r,n))}touchmove(i,r,n){if(this._tapTime){if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;const o=r[0],s=o.y-this._swipePoint.y;return this._swipePoint=o,i.preventDefault(),this._active=!0,{zoomDelta:s/128}}}else this._tap.touchmove(i,r,n)}touchend(i,r,n){this._tapTime?this._swipePoint&&0===n.length&&this.reset():this._tap.touchend(i,r,n)&&(this._tapTime=i.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class rd{constructor(i,r,n){this._el=i,this._mousePan=r,this._touchPan=n}enable(i){this._inertiaOptions=i||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class rp{constructor(i,r,n){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=r,this._mousePitch=n}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class rf{constructor(i,r,n,o){this._el=i,this._touchZoom=r,this._touchRotate=n,this._tapDragZoom=o,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const rm=i=>i.zoom||i.drag||i.pitch||i.rotate;class r_ extends i.Event{}class rg{constructor(){this.constants=[1,1,.01],this.radius=0}setup(r,n){const o=i.sub([],n,r);this.radius=i.length(o[2]<0?i.div([],o,this.constants):[o[0],o[1],0])}projectRay(r){i.div(r,r,this.constants),i.normalize(r,r),i.mul$1(r,r,this.constants);const n=i.scale$2([],r,this.radius);if(n[2]>0){const o=i.scale$2([],[0,0,1],i.dot(n,[0,0,1])),s=i.scale$2([],i.normalize([],[n[0],n[1],0]),this.radius),a=i.add([],n,i.scale$2([],i.sub([],i.add([],s,o),n),2));n[0]=a[0],n[1]=a[1]}return n}}function ry(i){return i.panDelta&&i.panDelta.mag()||i.zoomDelta||i.bearingDelta||i.pitchDelta}class rx{constructor(r,n){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ij(r),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new rg,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(n),i.bindAll(["handleEvent","handleWindowEvent"],this);const o=this._el;for(const[s,a,l]of(this._listeners=[[o,"touchstart",{passive:!0}],[o,"touchmove",{passive:!1}],[o,"touchend",void 0],[o,"touchcancel",void 0],[o,"mousedown",void 0],[o,"mousemove",void 0],[o,"mouseup",void 0],[i.window.document,"mousemove",{capture:!0}],[i.window.document,"mouseup",void 0],[o,"mouseover",void 0],[o,"mouseout",void 0],[o,"dblclick",void 0],[o,"click",void 0],[o,"keydown",{capture:!1}],[o,"keyup",void 0],[o,"wheel",{passive:!1}],[o,"contextmenu",void 0],[i.window,"blur",void 0]],this._listeners))s.addEventListener(a,s===i.window.document?this.handleWindowEvent:this.handleEvent,l)}destroy(){for(const[r,n,o]of this._listeners)r.removeEventListener(n,r===i.window.document?this.handleWindowEvent:this.handleEvent,o)}_addDefaultHandlers(i){const r=this._map,n=r.getCanvasContainer();this._add("mapEvent",new iW(r,i));const o=r.boxZoom=new iK(r,i);this._add("boxZoom",o);const s=new i0,a=new rh;r.doubleClickZoom=new rc(a,s),this._add("tapZoom",s),this._add("clickZoom",a);const l=new ru;this._add("tapDragZoom",l);const c=r.touchPitch=new rn(r);this._add("touchPitch",c);const h=new i5(i),u=new i4(i);r.dragRotate=new rp(i,h,u),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",u,["mouseRotate"]);const d=new i3(i),p=new i6(r,i);r.dragPan=new rd(n,d,p),this._add("mousePan",d),this._add("touchPan",p,["touchZoom","touchRotate"]);const f=new ri,m=new re;r.touchZoomRotate=new rf(n,m,f,l),this._add("touchRotate",f,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]),this._add("blockableMapEvent",new iH(r));const _=r.scrollZoom=new rl(r,this);this._add("scrollZoom",_,["mousePan"]);const g=r.keyboard=new rs;for(const y of(this._add("keyboard",g),["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"]))i.interactive&&i[y]&&r[y].enable(i[y])}_add(i,r,n){this._handlers.push({handlerName:i,handler:r,allowed:n}),this._handlersById[i]=r}stop(i){if(!this._updatingCamera){for(const{handler:r}of this._handlers)r.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[]}}isActive(){for(const{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(rm(this._eventsInProgress))||this.isZooming()}_blockedByActive(i,r,n){for(const o in i)if(o!==n&&(!r||0>r.indexOf(o)))return!0;return!1}handleWindowEvent(i){this.handleEvent(i,`${i.type}Window`)}_getMapTouches(i){const r=[];for(const n of i)this._el.contains(n.target)&&r.push(n);return r}handleEvent(i,r){this._updatingCamera=!0;const n="renderFrame"===i.type,o=n?void 0:i,s={needsRenderFrame:!1},a={},l={},c=i.touches?this._getMapTouches(i.touches):void 0,h=c?u.touchPos(this._el,c):n?void 0:u.mousePos(this._el,i);for(const{handlerName:d,handler:p,allowed:f}of this._handlers){let m;p.isEnabled()&&(this._blockedByActive(l,f,d)?p.reset():p[r||i.type]&&(m=p[r||i.type](i,h,c),this.mergeHandlerResult(s,a,m,d,o),m&&m.needsRenderFrame&&this._triggerRenderFrame()),(m||p.isActive())&&(l[d]=p))}const _={};for(const g in this._previousActiveHandlers)l[g]||(_[g]=o);this._previousActiveHandlers=l,(Object.keys(_).length||ry(s))&&(this._changes.push([s,a,_]),this._triggerRenderFrame()),(Object.keys(l).length||ry(s))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:y}=s;y&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],y(this._map))}mergeHandlerResult(r,n,o,s,a){if(!o)return;i.extend(r,o);const l={handlerName:s,originalEvent:o.originalEvent||a};void 0!==o.zoomDelta&&(n.zoom=l),void 0!==o.panDelta&&(n.drag=l),void 0!==o.pitchDelta&&(n.pitch=l),void 0!==o.bearingDelta&&(n.rotate=l)}_applyChanges(){const r={},n={},o={};for(const[s,a,l]of this._changes)s.panDelta&&(r.panDelta=(r.panDelta||new i.pointGeometry(0,0))._add(s.panDelta)),s.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+s.zoomDelta),s.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+s.bearingDelta),s.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+s.pitchDelta),void 0!==s.around&&(r.around=s.around),void 0!==s.aroundCoord&&(r.aroundCoord=s.aroundCoord),void 0!==s.pinchAround&&(r.pinchAround=s.pinchAround),s.noInertia&&(r.noInertia=s.noInertia),i.extend(n,a),i.extend(o,l);this._updateMapTransform(r,n,o),this._changes=[]}_updateMapTransform(r,n,o){const s=this._map,a=s.transform,l=i=>[i.x,i.y,i.z];if((i=>{const r=this._eventsInProgress.drag;return r&&!this._handlersById[r.handlerName].isActive()})()&&!ry(r)){const c=a.zoom;a.cameraElevationReference="sea",a.recenterOnTerrain(),a.cameraElevationReference="ground",c!==a.zoom&&this._map._update(!0)}if(!ry(r))return this._fireEvents(n,o,!0);let{panDelta:h,zoomDelta:u,bearingDelta:d,pitchDelta:p,around:f,aroundCoord:m,pinchAround:_}=r;void 0!==_&&(f=_),n.drag&&!this._eventsInProgress.drag&&f&&(this._dragOrigin=l(a.pointCoordinate3D(f)),this._trackingEllipsoid.setup(a._camera.position,this._dragOrigin)),a.cameraElevationReference="sea",s._stop(!0),f=f||s.transform.centerPoint,d&&(a.bearing+=d),p&&(a.pitch+=p),a._updateCameraState();const g=[0,0,0];if(h){const y=a.pointCoordinate(f),x=a.pointCoordinate(f.sub(h));y&&x&&(g[0]=x.x-y.x,g[1]=x.y-y.y)}const v=a.zoom,b=[0,0,0];if(u){const w=l(m||a.pointCoordinate3D(f)),T={dir:i.normalize([],i.sub([],w,a._camera.position))};if(T.dir[2]<0){const E=a.zoomDeltaToMovement(w,u);i.scale$2(b,T.dir,E)}}const S=i.add(g,g,b);a._translateCameraConstrained(S),u&&Math.abs(a.zoom-v)>1e-4&&a.recenterOnTerrain(),a.cameraElevationReference="ground",this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(n,o,!0)}_fireEvents(r,n,o){let s;const a=rm(this._eventsInProgress),l=rm(r),c={};for(const h in r){const{originalEvent:u}=r[h];this._eventsInProgress[h]||(c[`${h}start`]=u),this._eventsInProgress[h]=r[h]}for(const d in!a&&l&&this._fireEvent("movestart",l.originalEvent),c)this._fireEvent(d,c[d]);for(const p in l&&this._fireEvent("move",l.originalEvent),r){const{originalEvent:f}=r[p];this._fireEvent(p,f)}const m={};for(const _ in this._eventsInProgress){const{handlerName:g,originalEvent:y}=this._eventsInProgress[_];this._handlersById[g].isActive()||(delete this._eventsInProgress[_],s=n[g]||y,m[`${_}end`]=s)}for(const x in m)this._fireEvent(x,m[x]);const v=rm(this._eventsInProgress);if(o&&(a||l)&&!v){var b,w;this._updatingCamera=!0;const T=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions);T?(0!==(b=T.bearing||this._map.getBearing())&&-this._bearingSnap{delete this._frameId,this.handleEvent(new r_("renderFrame",{timeStamp:i})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const rv="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class rb extends i.Evented{constructor(r,n){super(),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=n.bearingSnap,i.bindAll(["_renderFrameCallback"],this)}getCenter(){return new i.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(i,r){return this.jumpTo({center:i},r)}panBy(r,n,o){return r=i.pointGeometry.convert(r).mult(-1),this.panTo(this.transform.center,i.extend({offset:r},n),o)}panTo(r,n,o){return this.easeTo(i.extend({center:r},n),o)}getZoom(){return this.transform.zoom}setZoom(i,r){return this.jumpTo({zoom:i},r),this}zoomTo(r,n,o){return this.easeTo(i.extend({zoom:r},n),o)}zoomIn(i,r){return this.zoomTo(this.getZoom()+1,i,r),this}zoomOut(i,r){return this.zoomTo(this.getZoom()-1,i,r),this}getBearing(){return this.transform.bearing}setBearing(i,r){return this.jumpTo({bearing:i},r),this}getPadding(){return this.transform.padding}setPadding(i,r){return this.jumpTo({padding:i},r),this}rotateTo(r,n,o){return this.easeTo(i.extend({bearing:r},n),o)}resetNorth(r,n){return this.rotateTo(0,i.extend({duration:1e3},r),n),this}resetNorthPitch(r,n){return this.easeTo(i.extend({bearing:0,pitch:0,duration:1e3},r),n),this}snapToNorth(i,r){return Math.abs(this.getBearing())y=>{if(T&&(a.zoom=i.number(l,d,y)),E&&(a.bearing=i.number(c,p,y)),S&&(a.pitch=i.number(h,f,y)),I&&(a.interpolatePadding(u,m,y),g=a.centerPoint.add(_)),o)a.setLocationAtPoint(o,s);else{const x=a.zoomScale(a.zoom-l),M=d>l?Math.min(2,w):Math.max(.5,w),A=Math.pow(M,1-y),C=a.unproject(v.add(b.mult(y*A)).mult(x));a.setLocationAtPoint(a.renderWorldCopies?C.wrap():C,g)}return r.preloadOnly||this._fireMoveEvents(n),a};if(r.preloadOnly){const A=this._emulate(M,r.duration,a);return this._preloadTiles(A),this}const C={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=T,this._rotating=E,this._pitching=S,this._padding=I,this._easeId=r.easeId,this._prepareEase(n,r.noMoveStart,C),this._ease(M(a),i=>{a.recenterOnTerrain(),this._afterEase(n,i)},r),this}_prepareEase(r,n,o={}){this._moving=!0,this.transform.cameraElevationReference="sea",n||o.moving||this.fire(new i.Event("movestart",r)),this._zooming&&!o.zooming&&this.fire(new i.Event("zoomstart",r)),this._rotating&&!o.rotating&&this.fire(new i.Event("rotatestart",r)),this._pitching&&!o.pitching&&this.fire(new i.Event("pitchstart",r))}_fireMoveEvents(r){this.fire(new i.Event("move",r)),this._zooming&&this.fire(new i.Event("zoom",r)),this._rotating&&this.fire(new i.Event("rotate",r)),this._pitching&&this.fire(new i.Event("pitch",r))}_afterEase(r,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId,this.transform.cameraElevationReference="ground";const o=this._zooming,s=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,o&&this.fire(new i.Event("zoomend",r)),s&&this.fire(new i.Event("rotateend",r)),a&&this.fire(new i.Event("pitchend",r)),this.fire(new i.Event("moveend",r))}flyTo(r,n){if(!r.essential&&i.exported.prefersReducedMotion){const o=i.pick(r,["center","zoom","bearing","pitch","around"]);return this.jumpTo(o,n)}this.stop(),r=i.extend({offset:[0,0],speed:1.2,curve:1.42,easing:i.ease},r);const s=this.transform,a=this.getZoom(),l=this.getBearing(),c=this.getPitch(),h=this.getPadding(),u="zoom"in r?i.clamp(+r.zoom,s.minZoom,s.maxZoom):a,d="bearing"in r?this._normalizeBearing(r.bearing,l):l,p="pitch"in r?+r.pitch:c,f="padding"in r?r.padding:s.padding,m=s.zoomScale(u-a),_=i.pointGeometry.convert(r.offset);let g=s.centerPoint.add(_);const y=s.pointLocation(g),x=i.LngLat.convert(r.center||y);this._normalizeCenter(x);const v=s.project(y),b=s.project(x).sub(v);let w=r.curve;const T=Math.max(s.width,s.height),E=T/m,S=b.mag();if("minZoom"in r){const I=i.clamp(Math.min(r.minZoom,a,u),s.minZoom,s.maxZoom),M=T/s.zoomScale(I-a);w=Math.sqrt(M/S*2)}const A=w*w;function C(i){const r=(E*E-T*T+(i?-1:1)*A*A*S*S)/(2*(i?E:T)*A*S);return Math.log(Math.sqrt(r*r+1)-r)}function z(i){return(Math.exp(i)-Math.exp(-i))/2}function k(i){return(Math.exp(i)+Math.exp(-i))/2}const P=C(0);let D=function(i){return k(P)/k(P+w*i)},L=function(i){var r;return T*((k(P)*(z(r=P+w*i)/k(r))-z(P))/A)/S},B=(C(1)-P)/w;if(1e-6>Math.abs(S)||!isFinite(B)){if(1e-6>Math.abs(T-E))return this.easeTo(r,n);const R=Er.maxDuration&&(r.duration=0);const F=l!==d,O=p!==c,U=!s.isPaddingEqual(f),V=o=>s=>{const m=s*B,y=1/D(m);o.zoom=1===s?u:a+o.scaleZoom(y),F&&(o.bearing=i.number(l,d,s)),O&&(o.pitch=i.number(c,p,s)),U&&(o.interpolatePadding(h,f,s),g=o.centerPoint.add(_));const w=1===s?x:o.unproject(v.add(b.mult(L(m))).mult(y));return o.setLocationAtPoint(o.renderWorldCopies?w.wrap():w,g),o._updateCenterElevation(),r.preloadOnly||this._fireMoveEvents(n),o};if(r.preloadOnly){const N=this._emulate(V,r.duration,s);return this._preloadTiles(N),this}return this._zooming=!0,this._rotating=F,this._pitching=O,this._padding=U,this._prepareEase(n,!1),this._ease(V(s),()=>this._afterEase(n),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(i,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const n=this._onEaseEnd;delete this._onEaseEnd,n.call(this,r)}if(!i){const o=this.handlers;o&&o.stop(!1)}return this}_ease(r,n,o){!1===o.animate||0===o.duration?(r(1),n()):(this._easeStart=i.exported.now(),this._easeOptions=o,this._onEaseFrame=r,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const r=Math.min((i.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(r)),r<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(r,n){r=i.wrap(r,-180,180);const o=Math.abs(r-n);return Math.abs(r-360-n)180?-360:n<-180?360:0}_emulate(i,r,n){const o=Math.ceil(15*r/1e3),s=[],a=i(n.clone());for(let l=0;l<=o;l++){const c=a(l/o);s.push(c.clone())}return s}}class rw{constructor(r={}){this.options=r,i.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(i){const r=this.options&&this.options.compact;return this._map=i,this._container=u.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=u.create("button","mapboxgl-ctrl-attrib-button",this._container),u.create("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden",!0),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=u.create("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),r&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===r&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_setElementTitle(i,r){const n=this._map._getUIString(`AttributionControl.${r}`);i.setAttribute("aria-label",n),i.removeAttribute("title"),i.firstElementChild&&i.firstElementChild.setAttribute("title",n)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let r=this._editLink;r||(r=this._editLink=this._container.querySelector(".mapbox-improve-map"));const n=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.config.ACCESS_TOKEN}];if(r){const o=n.reduce((i,r,o)=>(r.value&&(i+=`${r.key}=${r.value}${oi.indexOf(a.attribution)&&i.push(a.attribution)}}i.sort((i,r)=>i.length-r.length),i=i.filter((r,n)=>{for(let o=n+1;o=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=[...this.options.customAttribution,...i]:i.unshift(this.options.customAttribution));const l=i.join(" | ");l!==this._attribHTML&&(this._attribHTML=l,i.length?(this._innerContainer.innerHTML=l,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class rT{constructor(){i.bindAll(["_updateLogo"],this),i.bindAll(["_updateCompact"],this)}onAdd(i){this._map=i,this._container=u.create("div","mapboxgl-ctrl");const r=u.create("a","mapboxgl-ctrl-logo");return r.target="_blank",r.rel="noopener nofollow",r.href="https://www.mapbox.com/",r.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),r.setAttribute("rel","noopener nofollow"),this._container.appendChild(r),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(i){i&&"metadata"!==i.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const i=this._map.style._sourceCaches;if(0===Object.entries(i).length)return!0;for(const r in i){const n=i[r].getSource();if(n.hasOwnProperty("mapbox_logo")&&!n.mapbox_logo)return!1}return!0}_updateCompact(){const i=this._container.children;if(i.length){const r=i[0];this._map.getCanvasContainer().offsetWidth<250?r.classList.add("mapboxgl-compact"):r.classList.remove("mapboxgl-compact")}}}class rE{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){const r=++this._id;return this._queue.push({callback:i,id:r,cancelled:!1}),r}remove(i){const r=this._currentlyRunning,n=r?this._queue.concat(r):this._queue;for(const o of n)if(o.id===i)return void(o.cancelled=!0)}run(i=0){const r=this._currentlyRunning=this._queue;for(const n of(this._queue=[],r))if(!n.cancelled&&(n.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function rS(r,n,o){if(r=new i.LngLat(r.lng,r.lat),n){const s=new i.LngLat(r.lng-360,r.lat),a=new i.LngLat(r.lng+360,r.lat),l=360*Math.ceil(Math.abs(r.lng-o.center.lng)/360),c=o.locationPoint(r).distSqr(n),h=n.x<0||n.y<0||n.x>o.width||n.y>o.height;o.locationPoint(s).distSqr(n)180;){const u=o.locationPoint(r);if(u.x>=0&&u.y>=0&&u.x<=o.width&&u.y<=o.height)break;r.lng>o.center.lng?r.lng-=360:r.lng+=360}return r}const rI={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};class rM extends i.Evented{constructor(r,n){if(super(),(r instanceof i.window.HTMLElement||n)&&(r=i.extend({element:r},n)),i.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=r&&r.anchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=r&&r.rotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&"auto"!==r.pitchAlignment?r.pitchAlignment:this._rotationAlignment,this._updateMoving=()=>this._update(!0),r&&r.element)this._element=r.element,this._offset=i.pointGeometry.convert(r&&r.offset||[0,0]);else{this._defaultMarker=!0,this._element=u.create("div");const o=u.createSVG("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},this._element),s=u.createSVG("radialGradient",{id:"shadowGradient"},u.createSVG("defs",{},o));u.createSVG("stop",{offset:"10%","stop-opacity":.4},s),u.createSVG("stop",{offset:"100%","stop-opacity":.05},s),u.createSVG("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},o),u.createSVG("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},o),u.createSVG("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},o),u.createSVG("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},o),this._offset=i.pointGeometry.convert(r&&r.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()});const a=this._element.classList;for(const l in rI)a.remove(`mapboxgl-marker-anchor-${l}`);a.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(i){return i===this._map||(this.remove(),this._map=i,i.getCanvasContainer().appendChild(this._element),i.on("move",this._updateMoving),i.on("moveend",this._update),i.on("remove",this._clearFadeTimer),i._addMarker(this),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick)),this}remove(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._updateMoving),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._map.off("remove",this._clearFadeTimer),this._map._removeMarker(this),delete this._map),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=i.LngLat.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(i){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),i){if(!("offset"in i.options)){const r=Math.sqrt(91.125);i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[r,-1*(24.6+r)],"bottom-right":[-r,-1*(24.6+r)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=i,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(i){const r=i.code,n=i.charCode||i.keyCode;"Space"!==r&&"Enter"!==r&&32!==n&&13!==n||this.togglePopup()}_onMapClick(i){const r=i.originalEvent.target,n=this._element;this._popup&&(r===n||n.contains(r))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const i=this._popup;return i&&(i.isOpen()?(i.remove(),this._element.setAttribute("aria-expanded","false")):(i.addTo(this._map),this._element.setAttribute("aria-expanded","true"))),this}_evaluateOpacity(){const i=this._pos?this._pos.sub(this._transformedOffset()):null;if(!this._withinScreenBounds(i))return void this._clearFadeTimer();const r=this._map.unproject(i);let n=!1;if(this._map.transform._terrainEnabled()&&this._map.getTerrain()){const o=this._map.getFreeCameraOptions();if(o.position){const s=o.position.toLngLat();n=s.distanceTo(r)<.9*s.distanceTo(this._lngLat)}}const a=(1-this._map._queryFogOpacity(r))*(n?.2:1);this._element.style.opacity=`${a}`,this._popup&&this._popup._setOpacity(`${a}`),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_withinScreenBounds(i){const r=this._map.transform;return!!i&&i.x>=0&&i.x=0&&i.y{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),this._map._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(this._map.getTerrain()||this._map.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}_transformedOffset(){if(!this._defaultMarker)return this._offset;const i=this._map.transform,r=this._offset.mult(this._scale);return"map"===this._rotationAlignment&&r._rotate(i.angle),"map"===this._pitchAlignment&&(r.y*=Math.cos(i._pitch)),r}getOffset(){return this._offset}setOffset(r){return this._offset=i.pointGeometry.convert(r),this._update(),this}_onMove(r){if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=r.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=r.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new i.Event("dragstart"))),this.fire(new i.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new i.Event("dragend")),this._state="inactive"}_addDragHandler(i){this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos).add(this._transformedOffset()),this._pointerdownPos=i.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(i){return this._draggable=!!i,this._map&&(i?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i&&"auto"!==i?i:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}class rA{constructor(i){this.jumpTo(i)}getValue(r){if(r<=this._startTime)return this._start;if(r>=this._endTime)return this._end;const n=i.easeCubicInOut((r-this._startTime)/(this._endTime-this._startTime));return this._start*(1-n)+this._end*n}isEasing(i){return i>=this._startTime&&i<=this._endTime}jumpTo(i){this._startTime=-1/0,this._endTime=-1/0,this._start=i,this._end=i}easeTo(i,r,n){this._start=this.getValue(r),this._end=i,this._startTime=r,this._endTime=r+n}}const rC={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},{HTMLImageElement:rz,HTMLElement:rk,ImageBitmap:rP}=i.window,rD={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0};function rL(i){i.parentNode&&i.parentNode.removeChild(i)}const rB={showCompass:!0,showZoom:!0,visualizePitch:!1};class rR{constructor(r,n,o=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new i5({clickTolerance:r.dragRotate._mouseRotate._clickTolerance}),this.map=r,o&&(this.mousePitch=new i4({clickTolerance:r.dragRotate._mousePitch._clickTolerance})),i.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),n.addEventListener("mousedown",this.mousedown),n.addEventListener("touchstart",this.touchstart,{passive:!1}),n.addEventListener("touchmove",this.touchmove),n.addEventListener("touchend",this.touchend),n.addEventListener("touchcancel",this.reset)}down(i,r){this.mouseRotate.mousedown(i,r),this.mousePitch&&this.mousePitch.mousedown(i,r),u.disableDrag()}move(i,r){const n=this.map,o=this.mouseRotate.mousemoveWindow(i,r);if(o&&o.bearingDelta&&n.setBearing(n.getBearing()+o.bearingDelta),this.mousePitch){const s=this.mousePitch.mousemoveWindow(i,r);s&&s.pitchDelta&&n.setPitch(n.getPitch()+s.pitchDelta)}}off(){const i=this.element;i.removeEventListener("mousedown",this.mousedown),i.removeEventListener("touchstart",this.touchstart,{passive:!1}),i.removeEventListener("touchmove",this.touchmove),i.removeEventListener("touchend",this.touchend),i.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){u.enableDrag(),i.window.removeEventListener("mousemove",this.mousemove),i.window.removeEventListener("mouseup",this.mouseup)}mousedown(r){this.down(i.extend({},r,{ctrlKey:!0,preventDefault:()=>r.preventDefault()}),u.mousePos(this.element,r)),i.window.addEventListener("mousemove",this.mousemove),i.window.addEventListener("mouseup",this.mouseup)}mousemove(i){this.move(i,u.mousePos(this.element,i))}mouseup(i){this.mouseRotate.mouseupWindow(i),this.mousePitch&&this.mousePitch.mouseupWindow(i),this.offTemp()}touchstart(i){1!==i.targetTouches.length?this.reset():(this._startPos=this._lastPos=u.touchPos(this.element,i.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>i.preventDefault()},this._startPos))}touchmove(i){1!==i.targetTouches.length?this.reset():(this._lastPos=u.touchPos(this.element,i.targetTouches)[0],this.move({preventDefault:()=>i.preventDefault()},this._lastPos))}touchend(i){0===i.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)5280?rG(r,o,h/5280,i._getUIString("ScaleControl.Miles"),i):rG(r,o,h,i._getUIString("ScaleControl.Feet"),i)}else n&&"nautical"===n.unit?rG(r,o,c/1852,i._getUIString("ScaleControl.NauticalMiles"),i):c>=1e3?rG(r,o,c/1e3,i._getUIString("ScaleControl.Kilometers"),i):rG(r,o,c,i._getUIString("ScaleControl.Meters"),i)}function rG(i,r,n,o,s){const a=function(i){const r=Math.pow(10,`${Math.floor(i)}`.length-1);let n=i/r;return r*(n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:function(i){const r=Math.pow(10,Math.ceil(-Math.log(i)/Math.LN10));return Math.round(i*r)/r}(n))}(n),l=a/n;s._requestDomTask(()=>{i.style.width=r*l+"px",i.innerHTML=`${a} ${o}`})}const rZ={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},r$={version:i.version,supported:a,setRTLTextPlugin:i.setRTLTextPlugin,getRTLTextPluginStatus:i.getRTLTextPluginStatus,Map:class extends rb{constructor(r){if(null!=(r=i.extend({},rD,r)).minZoom&&null!=r.maxZoom&&r.minZoom>r.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=r.minPitch&&null!=r.maxPitch&&r.minPitch>r.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=r.minPitch&&r.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=r.maxPitch&&r.maxPitch>85)throw Error("maxPitch must be less than or equal to 85");if(super(new iL(r.minZoom,r.maxZoom,r.minPitch,r.maxPitch,r.renderWorldCopies),r),this._interactive=r.interactive,this._minTileCacheSize=r.minTileCacheSize,this._maxTileCacheSize=r.maxTileCacheSize,this._failIfMajorPerformanceCaveat=r.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=r.preserveDrawingBuffer,this._antialias=r.antialias,this._trackResize=r.trackResize,this._bearingSnap=r.bearingSnap,this._refreshExpiredTiles=r.refreshExpiredTiles,this._fadeDuration=r.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=r.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=r.collectResourceTiming,this._optimizeForTerrain=r.optimizeForTerrain,this._renderTaskQueue=new rE,this._domRenderTaskQueue=new rE,this._controls=[],this._markers=[],this._mapId=i.uniqueId(),this._locale=i.extend({},rC,r.locale),this._clickTolerance=r.clickTolerance,this._cooperativeGestures=r.cooperativeGestures,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevation=new rA(0),this._requestManager=new i.RequestManager(r.transformRequest,r.accessToken,r.testMode),this._silenceAuthErrors=!!r.testMode,"string"==typeof r.container){if(this._container=i.window.document.getElementById(r.container),!this._container)throw Error(`Container '${r.container}' not found.`)}else{if(!(r.container instanceof rk))throw Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=r.container}if(this._container.childNodes.length>0&&i.warnOnce("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),r.maxBounds&&this.setMaxBounds(r.maxBounds),i.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),void 0!==i.window&&(i.window.addEventListener("online",this._onWindowOnline,!1),i.window.addEventListener("resize",this._onWindowResize,!1),i.window.addEventListener("orientationchange",this._onWindowResize,!1),i.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1)),this.handlers=new rx(this,r),this._localFontFamily=r.localFontFamily,this._localIdeographFontFamily=r.localIdeographFontFamily,r.style&&this.setStyle(r.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),r.projection&&this.setProjection(r.projection),this._hash=r.hash&&new iR("string"==typeof r.hash&&r.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch}),r.bounds&&(this.resize(),this.fitBounds(r.bounds,i.extend({},r.fitBoundsOptions,{duration:0})))),this.resize(),r.attributionControl&&this.addControl(new rw({customAttribution:r.customAttribution})),this._logoControl=new rT,this.addControl(this._logoControl,r.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",r=>{this._update("style"===r.dataType),this.fire(new i.Event(`${r.dataType}data`,r))}),this.on("dataloading",r=>{this.fire(new i.Event(`${r.dataType}dataloading`,r))})}_getMapId(){return this._mapId}addControl(r,n){if(void 0===n&&(n=r.getDefaultPosition?r.getDefaultPosition():"top-right"),!r||!r.onAdd)return this.fire(new i.ErrorEvent(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=r.onAdd(this);this._controls.push(r);const s=this._controlPositions[n];return -1!==n.indexOf("bottom")?s.insertBefore(o,s.firstChild):s.appendChild(o),this}removeControl(r){if(!r||!r.onRemove)return this.fire(new i.ErrorEvent(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const n=this._controls.indexOf(r);return n>-1&&this._controls.splice(n,1),r.onRemove(this),this}hasControl(i){return this._controls.indexOf(i)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(r){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const n=!this._moving;return n&&this.fire(new i.Event("movestart",r)).fire(new i.Event("move",r)),this.fire(new i.Event("resize",r)),n&&this.fire(new i.Event("moveend",r)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(r){return this.transform.setMaxBounds(i.LngLatBounds.convert(r)),this._update()}setMinZoom(r){if((r=null==r?-2:r)>=-2&&r<=this.transform.maxZoom)return this.transform.minZoom=r,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=r,this._update(),this.getZoom()>r?this.setZoom(r):this.fire(new i.Event("zoomstart")).fire(new i.Event("zoom")).fire(new i.Event("zoomend")),this;throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(r){if((r=null==r?0:r)<0)throw Error("minPitch must be greater than or equal to 0");if(r>=0&&r<=this.transform.maxPitch)return this.transform.minPitch=r,this._update(),this.getPitch()85)throw Error("maxPitch must be less than or equal to 85");if(r>=this.transform.minPitch)return this.transform.maxPitch=r,this._update(),this.getPitch()>r?this.setPitch(r):this.fire(new i.Event("pitchstart")).fire(new i.Event("pitch")).fire(new i.Event("pitchend")),this;throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(i){return this.transform.renderWorldCopies=i,this._update()}getProjection(){return this.transform.getProjection()}setProjection(i){return this._lazyInitEmptyStyle(),"string"==typeof i&&(i={name:i}),this._runtimeProjection=i,this.style.updateProjection(),this._transitionFromGlobe=!1,this}project(r){return this.transform.locationPoint3D(i.LngLat.convert(r))}unproject(r){return this.transform.pointLocation3D(i.pointGeometry.convert(r))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()}_createDelegatedListener(i,r,n){if("mouseenter"===i||"mouseover"===i){let o=!1;const s=s=>{const a=r.filter(i=>this.getLayer(i)),l=a.length?this.queryRenderedFeatures(s.point,{layers:a}):[];l.length?o||(o=!0,n.call(this,new i$(i,this,s.originalEvent,{features:l}))):o=!1},a=()=>{o=!1};return{layers:new Set(r),listener:n,delegates:{mousemove:s,mouseout:a}}}if("mouseleave"===i||"mouseout"===i){let l=!1;const c=o=>{const s=r.filter(i=>this.getLayer(i));(s.length?this.queryRenderedFeatures(o.point,{layers:s}):[]).length?l=!0:l&&(l=!1,n.call(this,new i$(i,this,o.originalEvent)))},h=r=>{l&&(l=!1,n.call(this,new i$(i,this,r.originalEvent)))};return{layers:new Set(r),listener:n,delegates:{mousemove:c,mouseout:h}}}{const u=i=>{const o=r.filter(i=>this.getLayer(i)),s=o.length?this.queryRenderedFeatures(i.point,{layers:o}):[];s.length&&(i.features=s,n.call(this,i),delete i.features)};return{layers:new Set(r),listener:n,delegates:{[i]:u}}}}on(i,r,n){if(void 0===n)return super.on(i,r);Array.isArray(r)||(r=[r]);const o=this._createDelegatedListener(i,r,n);for(const s in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[i]=this._delegatedListeners[i]||[],this._delegatedListeners[i].push(o),o.delegates)this.on(s,o.delegates[s]);return this}once(i,r,n){if(void 0===n)return super.once(i,r);Array.isArray(r)||(r=[r]);const o=this._createDelegatedListener(i,r,n);for(const s in o.delegates)this.once(s,o.delegates[s]);return this}off(i,r,n){if(void 0===n)return super.off(i,r);r=new Set(Array.isArray(r)?r:[r]);const o=(i,r)=>{if(i.size!==r.size)return!1;for(const n of i)if(!r.has(n))return!1;return!0},s=this._delegatedListeners?this._delegatedListeners[i]:void 0;return s&&(i=>{for(let s=0;s{r?this.fire(new i.ErrorEvent(r)):o&&this._updateDiff(o,n)})}else"object"==typeof r&&this._updateDiff(r,n)}_updateDiff(r,n){try{this.style.setState(r)&&this._update(!0)}catch(o){i.warnOnce(`Unable to perform style diff: ${o.message||o.error||o}. Rebuilding the style from scratch.`),this._updateStyle(r,n)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():i.warnOnce("There is no style added to the map.")}addSource(i,r){return this._lazyInitEmptyStyle(),this.style.addSource(i,r),this._update(!0)}isSourceLoaded(r){const n=this.style&&this.style._getSourceCaches(r);if(0!==n.length)return n.every(i=>i.loaded());this.fire(new i.ErrorEvent(Error(`There is no source with ID '${r}'`)))}areTilesLoaded(){const i=this.style&&this.style._sourceCaches;for(const r in i){const n=i[r]._tiles;for(const o in n){const s=n[o];if("loaded"!==s.state&&"errored"!==s.state)return!1}}return!0}addSourceType(i,r,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(i,r,n)}removeSource(i){return this.style.removeSource(i),this._updateTerrain(),this._update(!0)}getSource(i){return this.style.getSource(i)}addImage(r,n,{pixelRatio:o=1,sdf:s=!1,stretchX:a,stretchY:l,content:c}={}){if(this._lazyInitEmptyStyle(),n instanceof rz||rP&&n instanceof rP){const{width:h,height:u,data:d}=i.exported.getImageData(n);this.style.addImage(r,{data:new i.RGBAImage({width:h,height:u},d),pixelRatio:o,stretchX:a,stretchY:l,content:c,sdf:s,version:0})}else{if(void 0===n.width||void 0===n.height)return this.fire(new i.ErrorEvent(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:p,height:f,data:m}=n;this.style.addImage(r,{data:new i.RGBAImage({width:p,height:f},new Uint8Array(m)),pixelRatio:o,stretchX:a,stretchY:l,content:c,sdf:s,version:0,userImage:n}),n.onAdd&&n.onAdd(this,r)}}}updateImage(r,n){const o=this.style.getImage(r);if(!o)return this.fire(new i.ErrorEvent(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=n instanceof rz||rP&&n instanceof rP?i.exported.getImageData(n):n,{width:a,height:l,data:c}=s;return void 0===a||void 0===l?this.fire(new i.ErrorEvent(Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))):a!==o.data.width||l!==o.data.height?this.fire(new i.ErrorEvent(Error("The width and height of the updated image must be that same as the previous version of the image"))):(o.data.replace(c,!(n instanceof rz||rP&&n instanceof rP)),void this.style.updateImage(r,o))}hasImage(r){return r?!!this.style.getImage(r):(this.fire(new i.ErrorEvent(Error("Missing required image id"))),!1)}removeImage(i){this.style.removeImage(i)}loadImage(r,n){i.getImage(this._requestManager.transformRequest(r,i.ResourceType.Image),(r,o)=>{n(r,o instanceof rz?i.exported.getImageData(o):o)})}listImages(){return this.style.listImages()}addLayer(i,r){return this._lazyInitEmptyStyle(),this.style.addLayer(i,r),this._update(!0)}moveLayer(i,r){return this.style.moveLayer(i,r),this._update(!0)}removeLayer(i){return this.style.removeLayer(i),this._update(!0)}getLayer(i){return this.style.getLayer(i)}setLayerZoomRange(i,r,n){return this.style.setLayerZoomRange(i,r,n),this._update(!0)}setFilter(i,r,n={}){return this.style.setFilter(i,r,n),this._update(!0)}getFilter(i){return this.style.getFilter(i)}setPaintProperty(i,r,n,o={}){return this.style.setPaintProperty(i,r,n,o),this._update(!0)}getPaintProperty(i,r){return this.style.getPaintProperty(i,r)}setLayoutProperty(i,r,n,o={}){return this.style.setLayoutProperty(i,r,n,o),this._update(!0)}getLayoutProperty(i,r){return this.style.getLayoutProperty(i,r)}setLight(i,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(i,r),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(i){return this._lazyInitEmptyStyle(),!i&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(i),this._averageElevationLastSampledAt=-1/0,this._update(!0)}_updateProjection(){"globe"===this.transform.projection.name&&this.transform.zoom>=i.GLOBE_ZOOM_THRESHOLD_MAX&&!this._transitionFromGlobe&&(this.setProjection({name:"mercator"}),this._transitionFromGlobe=!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(i){return this._lazyInitEmptyStyle(),this.style.setFog(i),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(r){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(i.LngLat.convert(r),this.transform):0}setFeatureState(i,r){return this.style.setFeatureState(i,r),this._update()}removeFeatureState(i,r){return this.style.removeFeatureState(i,r),this._update()}getFeatureState(i){return this.style.getFeatureState(i)}_updateContainerDimensions(){if(!this._container)return;const r=this._container.getBoundingClientRect().width||400,n=this._container.getBoundingClientRect().height||300;let o,s=this._container;for(;s&&!o;){const a=i.window.getComputedStyle(s).transform;a&&"none"!==a&&(o=a.match(/matrix.*\((.+)\)/)[1].split(", ")),s=s.parentElement}o?(this._containerWidth=o[0]&&"0"!==o[0]?Math.abs(r/o[0]):r,this._containerHeight=o[3]&&"0"!==o[3]?Math.abs(n/o[3]):n):(this._containerWidth=r,this._containerHeight=n)}_detectMissingCSS(){"rgb(250, 128, 114)"!==i.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&i.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const i=this._container;i.classList.add("mapboxgl-map"),(this._missingCSSCanary=u.create("div","mapboxgl-canary",i)).style.visibility="hidden",this._detectMissingCSS();const r=this._canvasContainer=u.create("div","mapboxgl-canvas-container",i);this._interactive&&r.classList.add("mapboxgl-interactive"),this._canvas=u.create("canvas","mapboxgl-canvas",r),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const n=this._controlContainer=u.create("div","mapboxgl-control-container",i),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(i=>{o[i]=u.create("div",`mapboxgl-ctrl-${i}`,n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(r,n){const o=i.exported.devicePixelRatio||1;this._canvas.width=o*Math.ceil(r),this._canvas.height=o*Math.ceil(n),this._canvas.style.width=`${r}px`,this._canvas.style.height=`${n}px`}_addMarker(i){this._markers.push(i)}_removeMarker(i){const r=this._markers.indexOf(i);-1!==r&&this._markers.splice(r,1)}_setupPainter(){const r=i.extend({},a.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),n=this._canvas.getContext("webgl",r)||this._canvas.getContext("experimental-webgl",r);n?(i.storeAuthState(n,!0),this.painter=new iv(n,this.transform),this.on("data",i=>{"source"===i.dataType&&this.painter.setTileLoadedFlag(!0)}),i.exported$1.testSupport(n)):this.fire(new i.ErrorEvent(Error("Failed to initialize WebGL")))}_contextLost(r){r.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new i.Event("webglcontextlost",{originalEvent:r}))}_contextRestored(r){this._setupPainter(),this.resize(),this._update(),this.fire(new i.Event("webglcontextrestored",{originalEvent:r}))}_onMapScroll(i){if(i.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(i){return this.style&&(this._styleDirty=this._styleDirty||i,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(i){return this._update(),this._renderTaskQueue.add(i)}_cancelRenderFrame(i){this._renderTaskQueue.remove(i)}_requestDomTask(i){!this.loaded()||this.loaded()&&!this.isMoving()?i():this._domRenderTaskQueue.add(i)}_render(r){let n;const o=this.painter.context.extTimerQuery,s=i.exported.now();this.listens("gpu-timing-frame")&&(n=o.createQueryEXT(),o.beginQueryEXT(o.TIME_ELAPSED_EXT,n));let a=this._updateAverageElevation(s);if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(r),this._domRenderTaskQueue.run(r),this._removed)return;this._updateProjection();let l=!1;const c=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const h=this.transform.zoom,u=this.transform.pitch,d=i.exported.now();this.style.zoomHistory.update(h,d);const p=new i.EvaluationParameters(h,{now:d,fadeDuration:c,pitch:u,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),f=p.crossFadingFactor();1===f&&f===this._crossFadingFactor||(l=!0,this._crossFadingFactor=f),this.style.update(p)}if(this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),this.style._updateSources(this.transform),this._forceMarkerUpdate()),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,c,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:c,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),speedIndexTiming:this.speedIndexTiming}),this.fire(new i.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new i.Event("load"))),this.style&&(this.style.hasTransitions()||l)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const m=i.exported.now()-s;o.endQueryEXT(o.TIME_ELAPSED_EXT,n),setTimeout(()=>{const r=o.getQueryObjectEXT(n,o.QUERY_RESULT_EXT)/1e6;o.deleteQueryEXT(n),this.fire(new i.Event("gpu-timing-frame",{cpuTime:m,gpuTime:r}))},50)}if(this.listens("gpu-timing-layer")){const _=this.painter.collectGpuTimers();setTimeout(()=>{const r=this.painter.queryGpuTimers(_);this.fire(new i.Event("gpu-timing-layer",{layerTimes:r}))},50)}const g=this._sourcesDirty||this._styleDirty||this._placementDirty||a;if(g||this._repaint)this.triggerRepaint();else{const y=!this.isMoving()&&this.loaded();if(y&&(a=this._updateAverageElevation(s,!0)),a)this.triggerRepaint();else if(this._triggerFrame(!1),y&&(this.fire(new i.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const x=this._calculateSpeedIndex();this.fire(new i.Event("speedindexcompleted",{speedIndex:x})),this.speedIndexTiming=!1}}return!this._loaded||this._fullyLoaded||g||(this._fullyLoaded=!0,this._authenticate()),this}_forceMarkerUpdate(){for(const i of this._markers)i._update()}_updateAverageElevation(i,r=!1){const n=i=>(this.transform.averageElevation=i,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&n(0);if((r||i-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(i)){const o=this.transform.averageElevation;let s=this.transform.sampleAverageElevation();isNaN(s)?s=0:this._averageElevationLastSampledAt=i;const a=Math.abs(o-s);if(a>1){if(this._isInitialLoad)return this._averageElevation.jumpTo(s),n(s);this._averageElevation.easeTo(s,i,300)}else if(a>1e-4)return this._averageElevation.jumpTo(s),n(s)}return!!this._averageElevation.isEasing(i)&&n(this._averageElevation.getValue(i))}_authenticate(){i.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,r=>{if(r&&(r.message===i.AUTH_ERR_MSG||401===r.status)){const n=this.painter.context.gl;i.storeAuthState(n,!1),this._logoControl instanceof rT&&this._logoControl._updateLogo(),n&&n.clear(n.DEPTH_BUFFER_BIT|n.COLOR_BUFFER_BIT|n.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new i.ErrorEvent(Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),i.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_updateTerrain(){this.painter.updateTerrain(this.style,this.isMoving()||this.isRotating()||this.isZooming())}_calculateSpeedIndex(){const i=this.painter.canvasCopy(),r=this.painter.getCanvasCopiesAndTimestamps();r.timeStamps.push(performance.now());const n=this.painter.context.gl,o=n.createFramebuffer();function s(i){n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,i,0);const r=new Uint8Array(n.drawingBufferWidth*n.drawingBufferHeight*4);return n.readPixels(0,0,n.drawingBufferWidth,n.drawingBufferHeight,n.RGBA,n.UNSIGNED_BYTE,r),r}return n.bindFramebuffer(n.FRAMEBUFFER,o),this._canvasPixelComparison(s(i),r.canvasCopies.map(s),r.timeStamps)}_canvasPixelComparison(i,r,n){let o=n[1]-n[0];const s=i.length/4;for(let a=0;a{const r=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,r&&this._render(i)}))}_preloadTiles(r){const n=this.style&&Object.values(this.style._sourceCaches)||[];return i.asyncAll(n,(i,n)=>i._preloadTiles(r,n),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(i){this._trackResize&&this.resize({originalEvent:i})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(i){this._showTileBoundaries!==i&&(this._showTileBoundaries=i,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(i){this._showTerrainWireframe!==i&&(this._showTerrainWireframe=i,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(i){this._speedIndexTiming!==i&&(this._speedIndexTiming=i,this._update())}get showPadding(){return!!this._showPadding}set showPadding(i){this._showPadding!==i&&(this._showPadding=i,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(i){this._showCollisionBoxes!==i&&(this._showCollisionBoxes=i,i?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(i){this._showOverdrawInspector!==i&&(this._showOverdrawInspector=i,this._update())}get repaint(){return!!this._repaint}set repaint(i){this._repaint!==i&&(this._repaint=i,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(i){this._vertices=i,this._update()}_setCacheLimits(r,n){i.setCacheLimits(r,n)}get version(){return i.version}},NavigationControl:class{constructor(r){this.options=i.extend({},rB,r),this._container=u.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(i.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",i=>this._map.zoomIn({},{originalEvent:i})),u.create("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",i=>this._map.zoomOut({},{originalEvent:i})),u.create("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(i.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",i=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:i}):this._map.resetNorth({},{originalEvent:i})}),this._compassIcon=u.create("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))}_updateZoomButtons(){const i=this._map.getZoom(),r=i===this._map.getMaxZoom(),n=i===this._map.getMinZoom();this._zoomInButton.disabled=r,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",r.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const i=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._map._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=i)})}onAdd(i){return this._map=i,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new rR(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(i,r){const n=u.create("button",i,this._container);return n.type="button",n.addEventListener("click",r),n}_setButtonTitle(i,r){const n=this._map._getUIString(`NavigationControl.${r}`);i.setAttribute("aria-label",n),i.firstElementChild&&i.firstElementChild.setAttribute("title",n)}},GeolocateControl:class extends i.Evented{constructor(r){super(),this.options=i.extend({},rF,r),i.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation"],this),this._onDeviceOrientationListener=this._onDeviceOrientation.bind(this),this._updateMarkerRotationThrottled=iB(this._updateMarkerRotation,20)}onAdd(r){var n;return this._map=r,this._container=u.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),n=this._setupUI,void 0!==rO?n(rO):void 0!==i.window.navigator.permissions?i.window.navigator.permissions.query({name:"geolocation"}).then(i=>{n(rO="denied"!==i.state)}):n(rO=!!i.window.navigator.geolocation),this._container}onRemove(){void 0!==this._geolocationWatchID&&(i.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,rU=0,rV=!1}_isOutOfMapMaxBounds(i){const r=this._map.getMaxBounds(),n=i.coords;return r&&(n.longituder.getEast()||n.latituder.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(r){if(this._map){if(this._isOutOfMapMaxBounds(r))return this._setErrorState(),this.fire(new i.Event("outofmaxbounds",r)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=r,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(r),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(r),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("geolocate",r)),this._finish()}}_updateCamera(r){const n=new i.LngLat(r.coords.longitude,r.coords.latitude),o=r.coords.accuracy,s=this._map.getBearing(),a=i.extend({bearing:s},this.options.fitBoundsOptions);this._map.fitBounds(n.toBounds(o),a,{geolocateSource:!0})}_updateMarker(r){if(r){const n=new i.LngLat(r.coords.longitude,r.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=r.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const i=this._map._containerHeight/2,r=this._map.unproject([0,i]),n=this._map.unproject([100,i]),o=r.distanceTo(n)/100,s=Math.ceil(2*this._accuracy/o);this._circleElement.style.width=`${s}px`,this._circleElement.style.height=`${s}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._dotElement.classList.add("mapboxgl-user-location-show-heading")):(this._dotElement.classList.remove("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(r){if(this._map){if(this.options.trackUserLocation){if(1===r.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",n),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",n),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===r.code&&rV)return;this._setErrorState()}}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("error",r)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(r){if(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=u.create("button","mapboxgl-ctrl-geolocate",this._container),u.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===r){i.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",n),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",n)}else{const o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",o),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=u.create("div","mapboxgl-user-location"),this._dotElement.appendChild(u.create("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(u.create("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new rM({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=u.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new rM({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",r=>{r.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r.originalEvent&&"resize"===r.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new i.Event("trackuserlocationend")))})}_onDeviceOrientation(i){this._userLocationDotMarker&&(i.webkitCompassHeading?this._heading=i.webkitCompassHeading:!0===i.absolute&&(this._heading=-1*i.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return i.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new i.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":rU--,rV=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new i.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new i.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let r;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++rU>1?(r={maximumAge:6e5,timeout:0},rV=!0):(r=this.options.positionOptions,rV=!1),this._geolocationWatchID=i.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,r),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else i.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const r=()=>{i.window.addEventListener("ondeviceorientationabsolute"in i.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientationListener)};void 0!==i.window.DeviceMotionEvent&&"function"==typeof i.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(i=>{"granted"===i&&r()}).catch(console.error):r()}_clearWatch(){i.window.navigator.geolocation.clearWatch(this._geolocationWatchID),i.window.removeEventListener("deviceorientation",this._onDeviceOrientationListener),i.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientationListener),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:rw,ScaleControl:class{constructor(r){this.options=i.extend({},rN,r),i.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){rj(this._map,this._container,this.options)}onAdd(i){return this._map=i,this._container=u.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",i.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}setUnit(i){this.options.unit=i,rj(this._map,this._container,this.options)}},FullscreenControl:class{constructor(r){this._fullscreen=!1,r&&r.container&&(r.container instanceof i.window.HTMLElement?this._container=r.container:i.warnOnce("Full screen control 'container' must be a DOM element.")),i.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in i.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in i.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(r){return this._map=r,this._container||(this._container=this._map.getContainer()),this._controlContainer=u.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",i.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,i.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!i.window.document.fullscreenEnabled&&!i.window.document.webkitFullscreenEnabled)}_setupUI(){const r=this._fullscreenButton=u.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);u.create("span","mapboxgl-ctrl-icon",r).setAttribute("aria-hidden",!0),r.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),i.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const i=this._getTitle();this._fullscreenButton.setAttribute("aria-label",i),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",i)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(i.window.document.fullscreenElement||i.window.document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?i.window.document.exitFullscreen?i.window.document.exitFullscreen():i.window.document.webkitCancelFullScreen&&i.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends i.Evented{constructor(r){super(),this.options=i.extend(Object.create(rZ),r),i.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this),this._classList=new Set(r&&r.className?r.className.trim().split(/\s+/):[])}addTo(r){return this._map&&this.remove(),this._map=r,this.options.closeOnClick&&this._map.on("preclick",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new i.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new i.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=i.LngLat.convert(r),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(r){return this.setDOMContent(i.window.document.createTextNode(r))}setHTML(r){let n;const o=i.window.document.createDocumentFragment(),s=i.window.document.createElement("body");for(s.innerHTML=r;n=s.firstChild;)o.appendChild(n);return this.setDOMContent(o)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(i){return this.options.maxWidth=i,this._update(),this}setDOMContent(i){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=u.create("div","mapboxgl-popup-content",this._container);return this._content.appendChild(i),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(i){return this._classList.add(i),this._container&&this._updateClassList(),this}removeClassName(i){return this._classList.delete(i),this._container&&this._updateClassList(),this}setOffset(i){return this.options.offset=i,this._update(),this}toggleClassName(i){let r;return this._classList.delete(i)?r=!1:(this._classList.add(i),r=!0),this._container&&this._updateClassList(),r}_createCloseButton(){this.options.closeButton&&(this._closeButton=u.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.setAttribute("aria-hidden","true"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(i){this._update(i.point)}_onMouseMove(i){this._update(i.point)}_onDrag(i){this._update(i.point)}_getAnchor(i){let r;if(this.options.anchor)return this.options.anchor;const n=this._pos,o=this._container.offsetWidth,s=this._container.offsetHeight;return r=n.y+i.bottom.ythis._map.transform.height-s?["bottom"]:[],n.xthis._map.transform.width-o/2&&r.push("right"),0===r.length?"bottom":r.join("-")}_updateClassList(){const i=[...this._classList];i.push("mapboxgl-popup"),this._anchor&&i.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&i.push("mapboxgl-popup-track-pointer"),this._container.className=i.join(" ")}_update(r){if(this._map&&(this._lngLat||this._trackPointer)&&this._content){if(this._container||(this._container=u.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=u.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content)),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=rS(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||r){const n=this._pos=this._trackPointer&&r?r:this._map.project(this._lngLat),o=function(r){if(r||(r=new i.pointGeometry(0,0)),"number"==typeof r){const n=Math.round(Math.sqrt(.5*Math.pow(r,2)));return{center:new i.pointGeometry(0,0),top:new i.pointGeometry(0,r),"top-left":new i.pointGeometry(n,n),"top-right":new i.pointGeometry(-n,n),bottom:new i.pointGeometry(0,-r),"bottom-left":new i.pointGeometry(n,-n),"bottom-right":new i.pointGeometry(-n,-n),left:new i.pointGeometry(r,0),right:new i.pointGeometry(-r,0)}}if(r instanceof i.pointGeometry||Array.isArray(r)){const o=i.pointGeometry.convert(r);return{center:o,top:o,"top-left":o,"top-right":o,bottom:o,"bottom-left":o,"bottom-right":o,left:o,right:o}}return{center:i.pointGeometry.convert(r.center||[0,0]),top:i.pointGeometry.convert(r.top||[0,0]),"top-left":i.pointGeometry.convert(r["top-left"]||[0,0]),"top-right":i.pointGeometry.convert(r["top-right"]||[0,0]),bottom:i.pointGeometry.convert(r.bottom||[0,0]),"bottom-left":i.pointGeometry.convert(r["bottom-left"]||[0,0]),"bottom-right":i.pointGeometry.convert(r["bottom-right"]||[0,0]),left:i.pointGeometry.convert(r.left||[0,0]),right:i.pointGeometry.convert(r.right||[0,0])}}(this.options.offset),s=this._anchor=this._getAnchor(o),a=n.add(o[s]).round();this._map._requestDomTask(()=>{this._container&&s&&(this._container.style.transform=`${rI[s]} translate(${a.x}px,${a.y}px)`)})}this._updateClassList()}}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const i=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");i&&i.focus()}_onClose(){this.remove()}_setOpacity(i){this._content&&(this._content.style.opacity=i),this._tip&&(this._tip.style.opacity=i)}},Marker:rM,Style:tf,LngLat:i.LngLat,LngLatBounds:i.LngLatBounds,Point:i.pointGeometry,MercatorCoordinate:i.MercatorCoordinate,FreeCameraOptions:iI,Evented:i.Evented,config:i.config,prewarm:function(){eC().acquire(eM)},clearPrewarmedResources:function(){const i=o;i&&(i.isPreloaded()&&1===i.numActive()?(i.release(eM),o=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return i.config.ACCESS_TOKEN},set accessToken(t){i.config.ACCESS_TOKEN=t},get baseApiUrl(){return i.config.API_URL},set baseApiUrl(t){i.config.API_URL=t},get workerCount(){return eA.workerCount},set workerCount(e){eA.workerCount=e},get maxParallelImageRequests(){return i.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){i.config.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(r){i.clearTileCache(r)},workerUrl:"",workerClass:null,setNow:i.exported.setNow,restoreNow:i.exported.restoreNow};return r$}),n}()}}]); diff --git a/crates/swc_ecma_minifier/tests/full/feedback-mapbox/785-e1932cc99ac3bb67/output.js b/crates/swc_ecma_minifier/tests/full/feedback-mapbox/785-e1932cc99ac3bb67/output.js index aa287badd9a3..b1bad2c84e3f 100644 --- a/crates/swc_ecma_minifier/tests/full/feedback-mapbox/785-e1932cc99ac3bb67/output.js +++ b/crates/swc_ecma_minifier/tests/full/feedback-mapbox/785-e1932cc99ac3bb67/output.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[785],{840:function(t,e,n){var r;!function(i,o,a,s){"use strict";var c,u=["","webkit","Moz","MS","ms","o"],l=o.createElement("div"),h=Math.round,p=Math.abs,f=Date.now;function d(t,e,n){return setTimeout(O(t,n),e)}function v(t,e,n){return!!Array.isArray(t)&&(g(t,n[e],n),!0)}function g(t,e,n){var r;if(t){if(t.forEach)t.forEach(e,n);else if(s!==t.length)for(r=0;r\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=i.console&&(i.console.warn||i.console.log);return o&&o.call(i.console,r,n),t.apply(this,arguments)}}c="function"!=typeof Object.assign?function(t){if(null==t)throw TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n-1}function S(t){return t.trim().split(/\s+/g)}function T(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var r=0;rT(i,a)&&r.push(t[o]),i[o]=a,o++}return n&&(r=e?r.sort(function(t,n){return t[e]>n[e]}):r.sort()),r}function D(t,e){for(var n,r,i=e[0].toUpperCase()+e.slice(1),o=0;o1&&!i.firstMultiple?i.firstMultiple=U(r):1===a&&(i.firstMultiple=!1),c=i.firstInput,l=(u=i.firstMultiple)?u.center:c.center,h=r.center=q(o),r.timeStamp=f(),r.deltaTime=r.timeStamp-c.timeStamp,r.angle=X(l,h),r.distance=Y(l,h),d=i,g=(v=r).center,m=d.offsetDelta||{},b=d.prevDelta||{},y=d.prevInput||{},(1===v.eventType||4===y.eventType)&&(b=d.prevDelta={x:y.deltaX||0,y:y.deltaY||0},m=d.offsetDelta={x:g.x,y:g.y}),v.deltaX=b.x+(g.x-m.x),v.deltaY=b.y+(g.y-m.y),r.offsetDirection=W(r.deltaX,r.deltaY),w=H(r.deltaTime,r.deltaX,r.deltaY),r.overallVelocityX=w.x,r.overallVelocityY=w.y,r.overallVelocity=p(w.x)>p(w.y)?w.x:w.y,r.scale=u?(O=u.pointers,Y(o[0],o[1],V)/Y(O[0],O[1],V)):1,r.rotation=u?(E=u.pointers,X(o[1],o[0],V)+X(E[1],E[0],V)):0,r.maxPointers=i.prevInput?r.pointers.length>i.prevInput.maxPointers?r.pointers.length:i.prevInput.maxPointers:r.pointers.length,function(t,e){var n,r,i,o,a=t.lastInterval||e,c=e.timeStamp-a.timeStamp;if(8!=e.eventType&&(c>25||s===a.velocity)){var u=e.deltaX-a.deltaX,l=e.deltaY-a.deltaY,h=H(c,u,l);r=h.x,i=h.y,n=p(h.x)>p(h.y)?h.x:h.y,o=W(u,l),t.lastInterval=e}else n=a.velocity,r=a.velocityX,i=a.velocityY,o=a.direction;e.velocity=n,e.velocityX=r,e.velocityY=i,e.direction=o}(i,r),_=t.element,M(r.srcEvent.target,_)&&(_=r.srcEvent.target),r.target=_,t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function U(t){for(var e=[],n=0;n=p(e)?t<0?2:4:e<0?8:16}function Y(t,e,n){n||(n=F);var r=e[n[0]]-t[n[0]],i=e[n[1]]-t[n[1]];return Math.sqrt(r*r+i*i)}function X(t,e,n){n||(n=F);var r=e[n[0]]-t[n[0]];return 180*Math.atan2(e[n[1]]-t[n[1]],r)/Math.PI}B.prototype={handler:function(){},init:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(R(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&P(this.element,this.evEl,this.domHandler),this.evTarget&&P(this.target,this.evTarget,this.domHandler),this.evWin&&P(R(this.element),this.evWin,this.domHandler)}};var K={mousedown:1,mousemove:2,mouseup:4};function G(){this.evEl="mousedown",this.evWin="mousemove mouseup",this.pressed=!1,B.apply(this,arguments)}w(G,B,{handler:function(t){var e=K[t.type];1&e&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:z,srcEvent:t}))}});var $={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},J={2:N,3:"pen",4:z,5:"kinect"},Q="pointerdown",tt="pointermove pointerup pointercancel";function te(){this.evEl=Q,this.evWin=tt,B.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}i.MSPointerEvent&&!i.PointerEvent&&(Q="MSPointerDown",tt="MSPointerMove MSPointerUp MSPointerCancel"),w(te,B,{handler:function(t){var e=this.store,n=!1,r=$[t.type.toLowerCase().replace("ms","")],i=J[t.pointerType]||t.pointerType,o=T(e,t.pointerId,"pointerId");1&r&&(0===t.button||i==N)?o<0&&(e.push(t),o=e.length-1):12&r&&(n=!0),!(o<0)&&(e[o]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:i,srcEvent:t}),n&&e.splice(o,1))}});var tn={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function tr(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,B.apply(this,arguments)}function ti(t,e){var n=k(t.touches),r=k(t.changedTouches);return 12&e&&(n=x(n.concat(r),"identifier",!0)),[n,r]}w(tr,B,{handler:function(t){var e=tn[t.type];if(1===e&&(this.started=!0),this.started){var n=ti.call(this,t,e);12&e&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:N,srcEvent:t})}}});var to={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function ta(){this.evTarget="touchstart touchmove touchend touchcancel",this.targetIds={},B.apply(this,arguments)}function ts(t,e){var n=k(t.touches),r=this.targetIds;if(3&e&&1===n.length)return r[n[0].identifier]=!0,[n,n];var i,o,a=k(t.changedTouches),s=[],c=this.target;if(o=n.filter(function(t){return M(t.target,c)}),1===e)for(i=0;i-1&&r.splice(t,1)},2500)}}function th(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,r=0;r-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){var e=this,n=this.state;function r(n){e.manager.emit(n,t)}n<8&&r(e.options.event+t_(n)),r(e.options.event),t.additionalEvent&&r(t.additionalEvent),n>=8&&r(e.options.event+t_(n))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=32},canEmit:function(){for(var t=0;te.threshold&&i&e.direction},attrTest:function(t){return tj.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=tP(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),w(tT,tj,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[tm]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),w(tk,tE,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[tv]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,r=t.distancee.time;if(this._input=t,r&&n&&(!(12&t.eventType)||i)){if(1&t.eventType)this.reset(),this._timer=d(function(){this.state=8,this.tryEmit()},e.time,this);else if(4&t.eventType)return 8}else this.reset();return 32},reset:function(){clearTimeout(this._timer)},emit:function(t){8===this.state&&(t&&4&t.eventType?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=f(),this.manager.emit(this.options.event,this._input)))}}),w(tx,tj,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[tm]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)}}),w(tD,tj,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return tS.prototype.getTouchAction.call(this)},attrTest:function(t){var e,n=this.options.direction;return 30&n?e=t.overallVelocity:6&n?e=t.overallVelocityX:24&n&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&p(e)>this.options.velocity&&4&t.eventType},emit:function(t){var e=tP(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),w(tC,tE,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[tg]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,r=t.distance1)for(var n=1;nt.length)&&(e=t.length);for(var n=0,r=Array(e);n=-90&&e<=90,"invalid latitude");const n=512*(j+Math.log(Math.tan(S+.5*(e*T))))/(2*j);return[512*(t*T+j)/(2*j),n]}function C([t,e]){const n=2*(Math.atan(Math.exp(e/512*(2*j)-j))-S);return[(t/512*(2*j)-j)*k,n*k]}function R(t){return 2*Math.atan(.5/t)*k}function A(t){return .5/Math.tan(.5*t*T)}function I(t,e,n=0){const[r,i,o]=t;if(M(Number.isFinite(r)&&Number.isFinite(i),"invalid pixel coordinate"),Number.isFinite(o)){const a=g(e,[r,i,o,1]);return a}const s=g(e,[r,i,0,1]),c=g(e,[r,i,1,1]),u=s[2],l=c[2];return P([],s,c,u===l?0:((n||0)-u)/(l-u))}const L=Math.PI/180;function N(t,e,n){const{pixelUnprojectionMatrix:r}=t,i=g(r,[e,0,1,1]),o=g(r,[e,t.height,1,1]),a=n*t.distanceScales.unitsPerMeter[2],s=(a-i[2])/(o[2]-i[2]),c=P([],i,o,s),u=C(c);return u[2]=n,u}class z{constructor({width:t,height:e,latitude:n=0,longitude:r=0,zoom:i=0,pitch:o=0,bearing:a=0,altitude:s=null,fovy:c=null,position:u=null,nearZMultiplier:l=.02,farZMultiplier:h=1.01}={width:1,height:1}){t=t||1,e=e||1,null===c&&null===s?c=R(s=1.5):null===c?c=R(s):null===s&&(s=A(c));const p=x(i);s=Math.max(.75,s);const f=function({latitude:t,longitude:e,highPrecision:n=!1}){M(Number.isFinite(t)&&Number.isFinite(e));const r={},i=Math.cos(t*T),o=512/360,a=o/i,s=512/4003e4/i;if(r.unitsPerMeter=[s,s,s],r.metersPerUnit=[1/s,1/s,1/s],r.unitsPerDegree=[o,a,s],r.degreesPerUnit=[1/o,1/a,1/s],n){const c=T*Math.tan(t*T)/i,u=512/4003e4*c,l=u/a*s;r.unitsPerDegree2=[0,o*c/2,u],r.unitsPerMeter2=[l,0,l]}return r}({longitude:r,latitude:n}),d=D([r,n]);if(d[2]=0,u){var g,m,b;b=d,g=[],m=f.unitsPerMeter,g[0]=u[0]*m[0],g[1]=u[1]*m[1],g[2]=u[2]*m[2],b[0]=d[0]+g[0],b[1]=d[1]+g[1],b[2]=d[2]+g[2]}this.projectionMatrix=function({width:t,height:e,pitch:n,altitude:r,fovy:i,nearZMultiplier:o,farZMultiplier:a}){var s,c,u;const{fov:l,aspect:h,near:p,far:f}=function({width:t,height:e,fovy:n=R(1.5),altitude:r,pitch:i=0,nearZMultiplier:o=1,farZMultiplier:a=1}){void 0!==r&&(n=R(r));const s=.5*n*T,c=A(n),u=i*T,l=Math.sin(s)*c/Math.sin(Math.min(Math.max(Math.PI/2-u-s,.01),Math.PI-.01)),h=Math.sin(u)*l+c;return{fov:2*s,aspect:t/e,focalDistance:c,near:o,far:h*a}}({width:t,height:e,altitude:r,fovy:i,pitch:n,nearZMultiplier:o,farZMultiplier:a}),d=(s=[],u=1/Math.tan(l/2),s[0]=u/h,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=u,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=-1,s[12]=0,s[13]=0,s[15]=0,null!=f&&f!==1/0?(c=1/(p-f),s[10]=(f+p)*c,s[14]=2*f*p*c):(s[10]=-1,s[14]=-2*p),s);return d}({width:t,height:e,pitch:o,fovy:c,nearZMultiplier:l,farZMultiplier:h}),this.viewMatrix=function({height:t,pitch:e,bearing:n,altitude:r,scale:i,center:o=null}){var a,s,c,u,l,h,p,f,d,g,m,b,y,E,_,P,M,j,S,k,x,D,C,R,A;const I=v();return w(I,I,[0,0,-r]),a=I,c=Math.sin(s=-e*T),u=Math.cos(s),l=I[4],h=I[5],p=I[6],f=I[7],d=I[8],g=I[9],m=I[10],b=I[11],I!==a&&(a[0]=I[0],a[1]=I[1],a[2]=I[2],a[3]=I[3],a[12]=I[12],a[13]=I[13],a[14]=I[14],a[15]=I[15]),a[4]=l*u+d*c,a[5]=h*u+g*c,a[6]=p*u+m*c,a[7]=f*u+b*c,a[8]=d*u-l*c,a[9]=g*u-h*c,a[10]=m*u-p*c,a[11]=b*u-f*c,y=I,_=Math.sin(E=n*T),P=Math.cos(E),M=I[0],j=I[1],S=I[2],k=I[3],x=I[4],D=I[5],C=I[6],R=I[7],I!==y&&(y[8]=I[8],y[9]=I[9],y[10]=I[10],y[11]=I[11],y[12]=I[12],y[13]=I[13],y[14]=I[14],y[15]=I[15]),y[0]=M*P+x*_,y[1]=j*P+D*_,y[2]=S*P+C*_,y[3]=k*P+R*_,y[4]=x*P-M*_,y[5]=D*P-j*_,y[6]=C*P-S*_,y[7]=R*P-k*_,O(I,I,[i/=t,i,i]),o&&w(I,I,((A=[])[0]=-o[0],A[1]=-o[1],A[2]=-o[2],A)),I}({height:e,scale:p,center:d,pitch:o,bearing:a,altitude:s}),this.width=t,this.height=e,this.scale=p,this.latitude=n,this.longitude=r,this.zoom=i,this.pitch=o,this.bearing=a,this.altitude=s,this.fovy=c,this.center=d,this.meterOffset=u||[0,0,0],this.distanceScales=f,this._initMatrices(),this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),Object.freeze(this)}_initMatrices(){var t,e,n,r,i,o,a,s,c,u,l,h,p,f,d,g,m,b,E,_,P,M,j,S,T,k,x,D,C,R;const{width:A,height:I,projectionMatrix:L,viewMatrix:N}=this,z=v();y(z,z,L),y(z,z,N),this.viewProjectionMatrix=z;const F=v();O(F,F,[A/2,-I/2,1]),w(F,F,[1,-1,0]),y(F,F,z);const V=(t=v(),e=F[0],n=F[1],r=F[2],i=F[3],o=F[4],a=F[5],s=F[6],c=F[7],u=F[8],l=F[9],h=F[10],p=F[11],f=F[12],d=F[13],g=F[14],m=F[15],b=e*a-n*o,E=e*s-r*o,_=e*c-i*o,P=n*s-r*a,M=n*c-i*a,j=r*c-i*s,S=u*d-l*f,T=u*g-h*f,k=u*m-p*f,x=l*g-h*d,D=l*m-p*d,(R=b*(C=h*m-p*g)-E*D+_*x+P*k-M*T+j*S)?(R=1/R,t[0]=(a*C-s*D+c*x)*R,t[1]=(r*D-n*C-i*x)*R,t[2]=(d*j-g*M+m*P)*R,t[3]=(h*M-l*j-p*P)*R,t[4]=(s*k-o*C-c*T)*R,t[5]=(e*C-r*k+i*T)*R,t[6]=(g*_-f*j-m*E)*R,t[7]=(u*j-h*_+p*E)*R,t[8]=(o*D-a*k+c*S)*R,t[9]=(n*k-e*D-i*S)*R,t[10]=(f*M-d*_+m*b)*R,t[11]=(l*_-u*M-p*b)*R,t[12]=(a*T-o*x-s*S)*R,t[13]=(e*x-n*T+r*S)*R,t[14]=(d*E-f*P-g*b)*R,t[15]=(u*P-l*E+h*b)*R,t):null);if(!V)throw Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=F,this.pixelUnprojectionMatrix=V}equals(t){return t instanceof z&&t.width===this.width&&t.height===this.height&&E(t.projectionMatrix,this.projectionMatrix)&&E(t.viewMatrix,this.viewMatrix)}project(t,{topLeft:e=!0}={}){const n=this.projectPosition(t),r=function(t,e){const[n,r,i=0]=t;return M(Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(i)),g(e,[n,r,i,1])}(n,this.pixelProjectionMatrix),[i,o]=r,a=e?o:this.height-o;return 2===t.length?[i,a]:[i,a,r[2]]}unproject(t,{topLeft:e=!0,targetZ:n}={}){const[r,i,o]=t,a=e?i:this.height-i,s=n&&n*this.distanceScales.unitsPerMeter[2],c=I([r,a,o],this.pixelUnprojectionMatrix,s),[u,l,h]=this.unprojectPosition(c);return Number.isFinite(o)?[u,l,h]:Number.isFinite(n)?[u,l,n]:[u,l]}projectPosition(t){const[e,n]=D(t),r=(t[2]||0)*this.distanceScales.unitsPerMeter[2];return[e,n,r]}unprojectPosition(t){const[e,n]=C(t),r=(t[2]||0)*this.distanceScales.metersPerUnit[2];return[e,n,r]}projectFlat(t){return D(t)}unprojectFlat(t){return C(t)}getMapCenterByLngLatPosition({lngLat:t,pos:e}){var n;const r=I(e,this.pixelUnprojectionMatrix),i=D(t),o=_([],i,((n=[])[0]=-r[0],n[1]=-r[1],n)),a=_([],this.center,o);return C(a)}getLocationAtPoint({lngLat:t,pos:e}){return this.getMapCenterByLngLatPosition({lngLat:t,pos:e})}fitBounds(t,e={}){const{width:n,height:r}=this,{longitude:i,latitude:o,zoom:a}=function({width:t,height:e,bounds:n,minExtent:r=0,maxZoom:i=24,padding:o=0,offset:a=[0,0]}){const[[s,c],[u,l]]=n;if(Number.isFinite(o)){const h=o;o={top:h,bottom:h,left:h,right:h}}else M(Number.isFinite(o.top)&&Number.isFinite(o.bottom)&&Number.isFinite(o.left)&&Number.isFinite(o.right));const p=D([s,l<-85.051129?-85.051129:l>85.051129?85.051129:l]),f=D([u,c<-85.051129?-85.051129:c>85.051129?85.051129:c]),d=[Math.max(Math.abs(f[0]-p[0]),r),Math.max(Math.abs(f[1]-p[1]),r)],v=[t-o.left-o.right-2*Math.abs(a[0]),e-o.top-o.bottom-2*Math.abs(a[1])];M(v[0]>0&&v[1]>0);const g=v[0]/d[0],m=v[1]/d[1],y=(o.right-o.left)/2/g,w=(o.bottom-o.top)/2/m,O=[(f[0]+p[0])/2+y,(f[1]+p[1])/2+w],E=C(O),_=Math.min(i,b(Math.abs(Math.min(g,m))));return M(Number.isFinite(_)),{longitude:E[0],latitude:E[1],zoom:_}}(Object.assign({width:n,height:r,bounds:t},e));return new z({width:n,height:r,longitude:i,latitude:o,zoom:a})}getBounds(t){const e=this.getBoundingRegion(t),n=Math.min(...e.map(t=>t[0])),r=Math.max(...e.map(t=>t[0])),i=Math.min(...e.map(t=>t[1])),o=Math.max(...e.map(t=>t[1]));return[[n,i],[r,o]]}getBoundingRegion(t={}){return function(t,e=0){let n,r;const{width:i,height:o,unproject:a}=t,s={targetZ:e},c=a([0,o],s),u=a([i,o],s),l=t.fovy?.5*t.fovy*L:Math.atan(.5/t.altitude),h=(90-t.pitch)*L;return l>h-.01?(n=N(t,0,e),r=N(t,i,e)):(n=a([0,0],s),r=a([i,0],s)),[c,u,r,n]}(this,t.z||0)}}const F=["longitude","latitude","zoom"],V={curve:1.414,speed:1.2};function B(t,e,n){var r;n=Object.assign({},V,n);const i=n.curve,o=t.zoom,a=[t.longitude,t.latitude],s=x(o),c=e.zoom,u=[e.longitude,e.latitude],l=x(c-o),h=D(a),p=D(u),f=((r=[])[0]=p[0]-h[0],r[1]=p[1]-h[1],r),d=Math.max(t.width,t.height),v=d/l,g=Math.hypot(f[0],f[1])*s,m=Math.max(g,.01),b=i*i,y=(v*v-d*d+b*b*m*m)/(2*d*b*m),w=(v*v-d*d-b*b*m*m)/(2*v*b*m),O=Math.log(Math.sqrt(y*y+1)-y),E=Math.log(Math.sqrt(w*w+1)-w);return{startZoom:o,startCenterXY:h,uDelta:f,w0:d,u1:g,S:(E-O)/i,rho:i,rho2:b,r0:O,r1:E}}var Z=function(){if("undefined"!=typeof Map)return Map;function t(t,e){var n=-1;return t.some(function(t,r){return t[0]===e&&(n=r,!0)}),n}return function(){function e(){this.__entries__=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var n=t(this.__entries__,e),r=this.__entries__[n];return r&&r[1]},e.prototype.set=function(e,n){var r=t(this.__entries__,e);~r?this.__entries__[r][1]=n:this.__entries__.push([e,n])},e.prototype.delete=function(e){var n=this.__entries__,r=t(n,e);~r&&n.splice(r,1)},e.prototype.has=function(e){return!!~t(this.__entries__,e)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(t,e){void 0===e&&(e=null);for(var n=0,r=this.__entries__;n0},t.prototype.connect_=function(){U&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Y?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},t.prototype.disconnect_=function(){U&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},t.prototype.onTransitionEnd_=function(t){var e=t.propertyName,n=void 0===e?"":e;W.some(function(t){return!!~n.indexOf(t)})&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),K=function(t,e){for(var n=0,r=Object.keys(e);n0},t}(),to="undefined"!=typeof WeakMap?new WeakMap:new Z,ta=function t(e){if(!(this instanceof t))throw TypeError("Cannot call a class as a function.");if(!arguments.length)throw TypeError("1 argument required, but only 0 present.");var n=X.getInstance(),r=new ti(e,n,this);to.set(this,r)};["observe","unobserve","disconnect"].forEach(function(t){ta.prototype[t]=function(){var e;return(e=to.get(this))[t].apply(e,arguments)}});var ts=void 0!==q.ResizeObserver?q.ResizeObserver:ta;function tc(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}function tu(t,e){for(var n=0;n=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o,a=!0,s=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}function tv(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n1&&void 0!==arguments[1]?arguments[1]:"component";t.debug&&p.checkPropTypes(ty,t,"prop",e)}var tE=function(){function t(e){var n=this;if(tc(this,t),a(this,"props",tw),a(this,"width",0),a(this,"height",0),a(this,"_fireLoadEvent",function(){n.props.onLoad({type:"load",target:n._map})}),a(this,"_handleError",function(t){n.props.onError(t)}),!e.mapboxgl)throw Error("Mapbox not available");this.mapboxgl=e.mapboxgl,t.initialized||(t.initialized=!0,this._checkStyleSheet(this.mapboxgl.version)),this._initialize(e)}return tl(t,[{key:"finalize",value:function(){return this._destroy(),this}},{key:"setProps",value:function(t){return this._update(this.props,t),this}},{key:"redraw",value:function(){var t=this._map;t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}},{key:"getMap",value:function(){return this._map}},{key:"_reuse",value:function(e){this._map=t.savedMap;var n=this._map.getContainer(),r=e.container;for(r.classList.add("mapboxgl-map");n.childNodes.length>0;)r.appendChild(n.childNodes[0]);this._map._container=r,t.savedMap=null,e.mapStyle&&this._map.setStyle(tm(e.mapStyle),{diff:!1}),this._map.isStyleLoaded()?this._fireLoadEvent():this._map.once("styledata",this._fireLoadEvent)}},{key:"_create",value:function(e){if(e.reuseMaps&&t.savedMap)this._reuse(e);else{if(e.gl){var n=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(){return HTMLCanvasElement.prototype.getContext=n,e.gl}}var r={container:e.container,center:[0,0],zoom:8,pitch:0,bearing:0,maxZoom:24,style:tm(e.mapStyle),interactive:!1,trackResize:!1,attributionControl:e.attributionControl,preserveDrawingBuffer:e.preserveDrawingBuffer};e.transformRequest&&(r.transformRequest=e.transformRequest),this._map=new this.mapboxgl.Map(Object.assign({},r,e.mapOptions)),this._map.once("load",this._fireLoadEvent),this._map.on("error",this._handleError)}return this}},{key:"_destroy",value:function(){this._map&&(this.props.reuseMaps&&!t.savedMap?(t.savedMap=this._map,this._map.off("load",this._fireLoadEvent),this._map.off("error",this._handleError),this._map.off("styledata",this._fireLoadEvent)):this._map.remove(),this._map=null)}},{key:"_initialize",value:function(t){var e=this;tO(t=Object.assign({},tw,t),"Mapbox"),this.mapboxgl.accessToken=t.mapboxApiAccessToken||tw.mapboxApiAccessToken,this.mapboxgl.baseApiUrl=t.mapboxApiUrl,this._create(t);var n=t.container;Object.defineProperty(n,"offsetWidth",{configurable:!0,get:function(){return e.width}}),Object.defineProperty(n,"clientWidth",{configurable:!0,get:function(){return e.width}}),Object.defineProperty(n,"offsetHeight",{configurable:!0,get:function(){return e.height}}),Object.defineProperty(n,"clientHeight",{configurable:!0,get:function(){return e.height}});var r=this._map.getCanvas();r&&(r.style.outline="none"),this._updateMapViewport({},t),this._updateMapSize({},t),this.props=t}},{key:"_update",value:function(t,e){if(this._map){tO(e=Object.assign({},this.props,e),"Mapbox");var n=this._updateMapViewport(t,e),r=this._updateMapSize(t,e);this._updateMapStyle(t,e),!e.asyncRender&&(n||r)&&this.redraw(),this.props=e}}},{key:"_updateMapStyle",value:function(t,e){t.mapStyle!==e.mapStyle&&this._map.setStyle(tm(e.mapStyle),{diff:!e.preventStyleDiffing})}},{key:"_updateMapSize",value:function(t,e){var n=t.width!==e.width||t.height!==e.height;return n&&(this.width=e.width,this.height=e.height,this._map.resize()),n}},{key:"_updateMapViewport",value:function(t,e){var n=this._getViewState(t),r=this._getViewState(e),i=r.latitude!==n.latitude||r.longitude!==n.longitude||r.zoom!==n.zoom||r.pitch!==n.pitch||r.bearing!==n.bearing||r.altitude!==n.altitude;return i&&(this._map.jumpTo(this._viewStateToMapboxProps(r)),r.altitude!==n.altitude&&(this._map.transform.altitude=r.altitude)),i}},{key:"_getViewState",value:function(t){var e=t.viewState||t,n=e.longitude,r=e.latitude,i=e.zoom,o=e.pitch,a=e.bearing,s=e.altitude;return{longitude:n,latitude:r,zoom:i,pitch:void 0===o?0:o,bearing:void 0===a?0:a,altitude:void 0===s?1.5:s}}},{key:"_checkStyleSheet",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"0.47.0";if(void 0!==th)try{var e=th.createElement("div");if(e.className="mapboxgl-map",e.style.display="none",th.body.appendChild(e),!("static"!==window.getComputedStyle(e).position)){var n=th.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("type","text/css"),n.setAttribute("href","https://api.tiles.mapbox.com/mapbox-gl-js/v".concat(t,"/mapbox-gl.css")),th.head.appendChild(n)}}catch(r){}}},{key:"_viewStateToMapboxProps",value:function(t){return{center:[t.longitude,t.latitude],zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}}}]),t}();a(tE,"initialized",!1),a(tE,"propTypes",ty),a(tE,"defaultProps",tw),a(tE,"savedMap",null);var t_=n(6158),tP=n.n(t_);function tM(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function tj(t,e,n){return Math.max(e,Math.min(n,t))}function tS(t,e,n){return tM(t)?t.map(function(t,r){return tS(t,e[r],n)}):n*e+(1-n)*t}function tT(t,e){if(!t)throw Error(e||"react-map-gl: assertion failed.")}function tk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function tx(t){for(var e=1;e0,"`scale` must be a positive number");var i=this._state,o=i.startZoom,a=i.startZoomLngLat;Number.isFinite(o)||(o=this._viewportProps.zoom,a=this._unproject(n)||this._unproject(e)),tT(a,"`startZoomLngLat` prop is required for zoom behavior to calculate where to position the map.");var s=this._calculateNewZoom({scale:r,startZoom:o||0}),c=f(new z(Object.assign({},this._viewportProps,{zoom:s})).getMapCenterByLngLatPosition({lngLat:a,pos:e}),2),u=c[0],l=c[1];return this._getUpdatedMapState({zoom:s,longitude:u,latitude:l})}},{key:"zoomEnd",value:function(){return this._getUpdatedMapState({startZoomLngLat:null,startZoom:null})}},{key:"_getUpdatedMapState",value:function(e){return new t(Object.assign({},this._viewportProps,this._state,e))}},{key:"_applyConstraints",value:function(t){var e=t.maxZoom,n=t.minZoom,r=t.zoom;t.zoom=tj(r,n,e);var i=t.maxPitch,o=t.minPitch,a=t.pitch;return t.pitch=tj(a,o,i),Object.assign(t,function({width:t,height:e,longitude:n,latitude:r,zoom:i,pitch:o=0,bearing:a=0}){(n<-180||n>180)&&(n=m(n+180,360)-180),(a<-180||a>180)&&(a=m(a+180,360)-180);const s=b(e/512);if(i<=s)i=s,r=0;else{const c=e/2/Math.pow(2,i),u=C([0,c])[1];if(rl&&(r=l)}}return{width:t,height:e,longitude:n,latitude:r,zoom:i,pitch:o,bearing:a}}(t)),t}},{key:"_unproject",value:function(t){var e=new z(this._viewportProps);return t&&e.unproject(t)}},{key:"_calculateNewLngLat",value:function(t){var e=t.startPanLngLat,n=t.pos;return new z(this._viewportProps).getMapCenterByLngLatPosition({lngLat:e,pos:n})}},{key:"_calculateNewZoom",value:function(t){var e=t.scale,n=t.startZoom,r=this._viewportProps,i=r.maxZoom;return tj(n+Math.log2(e),r.minZoom,i)}},{key:"_calculateNewPitchAndBearing",value:function(t){var e=t.deltaScaleX,n=t.deltaScaleY,r=t.startBearing,i=t.startPitch;n=tj(n,-1,1);var o=this._viewportProps,a=o.minPitch,s=o.maxPitch,c=i;return n>0?c=i+n*(s-i):n<0&&(c=i-n*(a-i)),{pitch:c,bearing:r+180*e}}},{key:"_getRotationParams",value:function(t,e){var n=t[0]-e[0],r=t[1]-e[1],i=t[1],o=e[1],a=this._viewportProps,s=a.width,c=a.height,u=0;return r>0?Math.abs(c-o)>5&&(u=r/(o-c)*1.2):r<0&&o>5&&(u=1-i/o),{deltaScaleX:n/s,deltaScaleY:u=Math.min(1,Math.max(-1,u))}}}]),t}();function tA(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function tI(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{},n=c.current&&c.current.getMap();return n&&n.queryRenderedFeatures(t,e)}}},[]);var g=(0,h.useCallback)(function(t){var e=t.target;e===p.current&&e.scrollTo(0,0)},[]),m=v&&h.createElement(tN,{value:tB(tB({},d),{},{viewport:d.viewport||tU(tB({map:v,props:t},a)),map:v,container:d.container||l.current})},h.createElement("div",{key:"map-overlays",className:"overlays",ref:p,style:tq,onScroll:g},t.children)),b=t.className,y=t.width,w=t.height,O=t.style,E=t.visibilityConstraints,_=Object.assign({position:"relative"},O,{width:y,height:w}),P=Object.assign({},tq,{visibility:t.visible&&function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tD;for(var n in e){var r,i=n.slice(0,3),o=(r=n.slice(3))[0].toLowerCase()+r.slice(1);if("min"===i&&t[o]e[n])return!1}return!0}(t.viewState||t,E)?"inherit":"hidden"});return h.createElement("div",{key:"map-container",ref:l,style:_},h.createElement("div",{key:"map-mapbox",ref:u,style:P,className:b}),m,!r&&!t.disableTokenWarning&&h.createElement(tY,null))});function tK(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o,a=!0,s=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}(this.propNames||[]);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(!function t(e,n){if(e===n)return!0;if(tM(e)&&tM(n)){if(e.length!==n.length)return!1;for(var r=0;r=Math.abs(e-n)}(t[i],e[i]))return!1}}catch(o){r.e(o)}finally{r.f()}return!0}},{key:"initializeProps",value:function(t,e){return{start:t,end:e}}},{key:"interpolateProps",value:function(t,e,n){tT(!1,"interpolateProps is not implemented")}},{key:"getDuration",value:function(t,e){return e.transitionDuration}}]),t}();function t$(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function tJ(t,e){return(tJ=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function tQ(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&tJ(t,e)}function t0(t){return(t0="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function t1(t,e){if(e&&("object"===t0(e)||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return t$(t)}function t2(t){return(t2=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var t4={longitude:1,bearing:1};function t5(t){return Number.isFinite(t)||Array.isArray(t)}function t3(t,e,n){return t in t4&&Math.abs(n-e)>180&&(n=n<0?n+360:n-360),n}function t8(t,e){if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return t6(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t6(t,e)}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o,a=!0,s=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}function t6(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o,a=!0,s=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}function er(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n0&&void 0!==arguments[0]?arguments[0]:{};return tc(this,r),a(t$(t=n.call(this)),"propNames",t9),t.props=Object.assign({},ee,e),t}tl(r,[{key:"initializeProps",value:function(t,e){var n,r={},i={},o=t8(t7);try{for(o.s();!(n=o.n()).done;){var a=n.value,s=t[a],c=e[a];tT(t5(s)&&t5(c),"".concat(a," must be supplied for transition")),r[a]=s,i[a]=t3(a,s,c)}}catch(u){o.e(u)}finally{o.f()}var l,h=t8(et);try{for(h.s();!(l=h.n()).done;){var p=l.value,f=t[p]||0,d=e[p]||0;r[p]=f,i[p]=t3(p,f,d)}}catch(v){h.e(v)}finally{h.f()}return{start:r,end:i}}},{key:"interpolateProps",value:function(t,e,n){var r,i=function(t,e,n,r={}){var i;const o={},{startZoom:a,startCenterXY:s,uDelta:c,w0:u,u1:l,S:h,rho:p,rho2:f,r0:d}=B(t,e,r);if(l<.01){for(const v of F){const g=t[v],m=e[v];o[v]=n*m+(1-n)*g}return o}const y=n*h,w=Math.cosh(d)/Math.cosh(d+p*y),O=u*((Math.cosh(d)*Math.tanh(d+p*y)-Math.sinh(d))/f)/l,E=a+b(1/w),P=((i=[])[0]=c[0]*O,i[1]=c[1]*O,i);_(P,P,s);const M=C(P);return o.longitude=M[0],o.latitude=M[1],o.zoom=E,o}(t,e,n,this.props),o=t8(et);try{for(o.s();!(r=o.n()).done;){var a=r.value;i[a]=tS(t[a],e[a],n)}}catch(s){o.e(s)}finally{o.f()}return i}},{key:"getDuration",value:function(t,e){var n=e.transitionDuration;return"auto"===n&&(n=function(t,e,n={}){let r;n=Object.assign({},V,n);const{screenSpeed:i,speed:o,maxDuration:a}=n,{S:s,rho:c}=B(t,e,n),u=1e3*s;return r=Number.isFinite(i)?u/(i/c):u/o,Number.isFinite(a)&&r>a?0:r}(t,e,this.props)),n}}])}(tG);var ei=["longitude","latitude","zoom","bearing","pitch"],eo=function(t){tQ(r,t);var e,n=(e=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}(),function(){var t,n=t2(r);if(e){var i=t2(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return t1(this,t)});function r(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return tc(this,r),t=n.call(this),Array.isArray(e)&&(e={transitionProps:e}),t.propNames=e.transitionProps||ei,e.around&&(t.around=e.around),t}return tl(r,[{key:"initializeProps",value:function(t,e){var n={},r={};if(this.around){n.around=this.around;var i=new z(t).unproject(this.around);Object.assign(r,e,{around:new z(e).project(i),aroundLngLat:i})}var o,a=en(this.propNames);try{for(a.s();!(o=a.n()).done;){var s=o.value,c=t[s],u=e[s];tT(t5(c)&&t5(u),"".concat(s," must be supplied for transition")),n[s]=c,r[s]=t3(s,c,u)}}catch(l){a.e(l)}finally{a.f()}return{start:n,end:r}}},{key:"interpolateProps",value:function(t,e,n){var r,i={},o=en(this.propNames);try{for(o.s();!(r=o.n()).done;){var a=r.value;i[a]=tS(t[a],e[a],n)}}catch(s){o.e(s)}finally{o.f()}if(e.around){var c=f(new z(Object.assign({},e,i)).getMapCenterByLngLatPosition({lngLat:e.aroundLngLat,pos:tS(t.around,e.around,n)}),2),u=c[0],l=c[1];i.longitude=u,i.latitude=l}return i}}]),r}(tG),ea=function(){},es={BREAK:1,SNAP_TO_END:2,IGNORE:3,UPDATE:4},ec={transitionDuration:0,transitionEasing:function(t){return t},transitionInterpolator:new eo,transitionInterruption:es.BREAK,onTransitionStart:ea,onTransitionInterrupt:ea,onTransitionEnd:ea},eu=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};tc(this,t),a(this,"_animationFrame",null),a(this,"_onTransitionFrame",function(){e._animationFrame=requestAnimationFrame(e._onTransitionFrame),e._updateViewport()}),this.props=null,this.onViewportChange=n.onViewportChange||ea,this.onStateChange=n.onStateChange||ea,this.time=n.getTime||Date.now}return tl(t,[{key:"getViewportInTransition",value:function(){return this._animationFrame?this.state.propsInTransition:null}},{key:"processViewportChange",value:function(t){var e=this.props;if(this.props=t,!e||this._shouldIgnoreViewportChange(e,t))return!1;if(this._isTransitionEnabled(t)){var n=Object.assign({},e),r=Object.assign({},t);if(this._isTransitionInProgress()&&(e.onTransitionInterrupt(),this.state.interruption===es.SNAP_TO_END?Object.assign(n,this.state.endProps):Object.assign(n,this.state.propsInTransition),this.state.interruption===es.UPDATE)){var i,o,a=this.time(),s=(a-this.state.startTime)/this.state.duration;r.transitionDuration=this.state.duration-(a-this.state.startTime),r.transitionEasing=(o=(i=this.state.easing)(s),function(t){return 1/(1-o)*(i(t*(1-s)+s)-o)}),r.transitionInterpolator=n.transitionInterpolator}return r.onTransitionStart(),this._triggerTransition(n,r),!0}return this._isTransitionInProgress()&&(e.onTransitionInterrupt(),this._endTransition()),!1}},{key:"_isTransitionInProgress",value:function(){return Boolean(this._animationFrame)}},{key:"_isTransitionEnabled",value:function(t){var e=t.transitionDuration,n=t.transitionInterpolator;return(e>0||"auto"===e)&&Boolean(n)}},{key:"_isUpdateDueToCurrentTransition",value:function(t){return!!this.state.propsInTransition&&this.state.interpolator.arePropsEqual(t,this.state.propsInTransition)}},{key:"_shouldIgnoreViewportChange",value:function(t,e){return!t||(this._isTransitionInProgress()?this.state.interruption===es.IGNORE||this._isUpdateDueToCurrentTransition(e):!this._isTransitionEnabled(e)||e.transitionInterpolator.arePropsEqual(t,e))}},{key:"_triggerTransition",value:function(t,e){tT(this._isTransitionEnabled(e)),this._animationFrame&&cancelAnimationFrame(this._animationFrame);var n=e.transitionInterpolator,r=n.getDuration?n.getDuration(t,e):e.transitionDuration;if(0!==r){var i=e.transitionInterpolator.initializeProps(t,e),o={inTransition:!0,isZooming:t.zoom!==e.zoom,isPanning:t.longitude!==e.longitude||t.latitude!==e.latitude,isRotating:t.bearing!==e.bearing||t.pitch!==e.pitch};this.state={duration:r,easing:e.transitionEasing,interpolator:e.transitionInterpolator,interruption:e.transitionInterruption,startTime:this.time(),startProps:i.start,endProps:i.end,animation:null,propsInTransition:{}},this._onTransitionFrame(),this.onStateChange(o)}}},{key:"_endTransition",value:function(){this._animationFrame&&(cancelAnimationFrame(this._animationFrame),this._animationFrame=null),this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1})}},{key:"_updateViewport",value:function(){var t=this.time(),e=this.state,n=e.startTime,r=e.duration,i=e.easing,o=e.interpolator,a=e.startProps,s=e.endProps,c=!1,u=(t-n)/r;u>=1&&(u=1,c=!0),u=i(u);var l=o.interpolateProps(a,s,u),h=new tR(Object.assign({},this.props,l));this.state.propsInTransition=h.getViewportProps(),this.onViewportChange(this.state.propsInTransition,this.props),c&&(this._endTransition(),this.props.onTransitionEnd())}}]),t}();a(eu,"defaultProps",ec);var el=n(840),eh=n.n(el);const ep={mousedown:1,mousemove:2,mouseup:4};!function(t){const e=t.prototype.handler;t.prototype.handler=function(t){const n=this.store;t.button>0&&"pointerdown"===t.type&&!function(t,e){for(let n=0;ne.pointerId===t.pointerId)&&n.push(t),e.call(this,t)}}(eh().PointerEventInput),eh().MouseInput.prototype.handler=function(t){let e=ep[t.type];1&e&&t.button>=0&&(this.pressed=!0),2&e&&0===t.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:"mouse",srcEvent:t}))};const ef=eh().Manager;var ed=eh();const ev=ed?[[ed.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1}],[ed.Rotate,{enable:!1}],[ed.Pinch,{enable:!1}],[ed.Swipe,{enable:!1}],[ed.Pan,{threshold:0,enable:!1}],[ed.Press,{enable:!1}],[ed.Tap,{event:"doubletap",taps:2,enable:!1}],[ed.Tap,{event:"anytap",enable:!1}],[ed.Tap,{enable:!1}]]:null,eg={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},em={doubletap:["tap"]},eb={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},ey={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],WHEEL_EVENTS:["wheel","mousewheel"]},ew={tap:"tap",anytap:"anytap",doubletap:"doubletap",press:"press",pinch:"pinch",pinchin:"pinch",pinchout:"pinch",pinchstart:"pinch",pinchmove:"pinch",pinchend:"pinch",pinchcancel:"pinch",rotate:"rotate",rotatestart:"rotate",rotatemove:"rotate",rotateend:"rotate",rotatecancel:"rotate",tripan:"tripan",tripanstart:"tripan",tripanmove:"tripan",tripanup:"tripan",tripandown:"tripan",tripanleft:"tripan",tripanright:"tripan",tripanend:"tripan",tripancancel:"tripan",pan:"pan",panstart:"pan",panmove:"pan",panup:"pan",pandown:"pan",panleft:"pan",panright:"pan",panend:"pan",pancancel:"pan",swipe:"swipe",swipeleft:"swipe",swiperight:"swipe",swipeup:"swipe",swipedown:"swipe"},eO={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},eE="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",e_="undefined"!=typeof window?window:n.g;void 0!==n.g?n.g:window;let eP=!1;try{const eM={get passive(){return eP=!0,!0}};e_.addEventListener("test",eM,eM),e_.removeEventListener("test",eM,eM)}catch(ej){}const eS=-1!==eE.indexOf("firefox"),{WHEEL_EVENTS:eT}=ey,ek="wheel";class ex{constructor(t,e,n={}){this.element=t,this.callback=e,this.options=Object.assign({enable:!0},n),this.events=eT.concat(n.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(e=>t.addEventListener(e,this.handleEvent,!!eP&&{passive:!1}))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,e){t===ek&&(this.options.enable=e)}handleEvent(t){if(!this.options.enable)return;let e=t.deltaY;e_.WheelEvent&&(eS&&t.deltaMode===e_.WheelEvent.DOM_DELTA_PIXEL&&(e/=e_.devicePixelRatio),t.deltaMode===e_.WheelEvent.DOM_DELTA_LINE&&(e*=40));const n={x:t.clientX,y:t.clientY};0!==e&&e%4.000244140625==0&&(e=Math.floor(e/4.000244140625)),t.shiftKey&&e&&(e*=.25),this._onWheel(t,-e,n)}_onWheel(t,e,n){this.callback({type:ek,center:n,delta:e,srcEvent:t,pointerType:"mouse",target:t.target})}}const{MOUSE_EVENTS:eD}=ey,eC="pointermove",eR="pointerover",eA="pointerout",eI="pointerleave";class eL{constructor(t,e,n={}){this.element=t,this.callback=e,this.pressed=!1,this.options=Object.assign({enable:!0},n),this.enableMoveEvent=this.options.enable,this.enableLeaveEvent=this.options.enable,this.enableOutEvent=this.options.enable,this.enableOverEvent=this.options.enable,this.events=eD.concat(n.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(e=>t.addEventListener(e,this.handleEvent))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,e){t===eC&&(this.enableMoveEvent=e),t===eR&&(this.enableOverEvent=e),t===eA&&(this.enableOutEvent=e),t===eI&&(this.enableLeaveEvent=e)}handleEvent(t){this.handleOverEvent(t),this.handleOutEvent(t),this.handleLeaveEvent(t),this.handleMoveEvent(t)}handleOverEvent(t){this.enableOverEvent&&"mouseover"===t.type&&this.callback({type:eR,srcEvent:t,pointerType:"mouse",target:t.target})}handleOutEvent(t){this.enableOutEvent&&"mouseout"===t.type&&this.callback({type:eA,srcEvent:t,pointerType:"mouse",target:t.target})}handleLeaveEvent(t){this.enableLeaveEvent&&"mouseleave"===t.type&&this.callback({type:eI,srcEvent:t,pointerType:"mouse",target:t.target})}handleMoveEvent(t){if(this.enableMoveEvent)switch(t.type){case"mousedown":t.button>=0&&(this.pressed=!0);break;case"mousemove":0===t.which&&(this.pressed=!1),this.pressed||this.callback({type:eC,srcEvent:t,pointerType:"mouse",target:t.target});break;case"mouseup":this.pressed=!1}}}const{KEY_EVENTS:eN}=ey,ez="keydown",eF="keyup";class eV{constructor(t,e,n={}){this.element=t,this.callback=e,this.options=Object.assign({enable:!0},n),this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=eN.concat(n.events||[]),this.handleEvent=this.handleEvent.bind(this),t.tabIndex=n.tabIndex||0,t.style.outline="none",this.events.forEach(e=>t.addEventListener(e,this.handleEvent))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,e){t===ez&&(this.enableDownEvent=e),t===eF&&(this.enableUpEvent=e)}handleEvent(t){const e=t.target||t.srcElement;("INPUT"!==e.tagName||"text"!==e.type)&&"TEXTAREA"!==e.tagName&&(this.enableDownEvent&&"keydown"===t.type&&this.callback({type:ez,srcEvent:t,key:t.key,target:t.target}),this.enableUpEvent&&"keyup"===t.type&&this.callback({type:eF,srcEvent:t,key:t.key,target:t.target}))}}const eB="contextmenu";class eZ{constructor(t,e,n={}){this.element=t,this.callback=e,this.options=Object.assign({enable:!0},n),this.handleEvent=this.handleEvent.bind(this),t.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(t,e){t===eB&&(this.options.enable=e)}handleEvent(t){this.options.enable&&this.callback({type:eB,center:{x:t.clientX,y:t.clientY},srcEvent:t,pointerType:"mouse",target:t.target})}}const eU={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},eq={srcElement:"root",priority:0};class eH{constructor(t){this.eventManager=t,this.handlers=[],this.handlersByElement=new Map,this.handleEvent=this.handleEvent.bind(this),this._active=!1}isEmpty(){return!this._active}add(t,e,n,r=!1,i=!1){const{handlers:o,handlersByElement:a}=this;n&&("object"!=typeof n||n.addEventListener)&&(n={srcElement:n}),n=n?Object.assign({},eq,n):eq;let s=a.get(n.srcElement);s||(s=[],a.set(n.srcElement,s));const c={type:t,handler:e,srcElement:n.srcElement,priority:n.priority};r&&(c.once=!0),i&&(c.passive=!0),o.push(c),this._active=this._active||!c.passive;let u=s.length-1;for(;u>=0&&!(s[u].priority>=c.priority);)u--;s.splice(u+1,0,c)}remove(t,e){const{handlers:n,handlersByElement:r}=this;for(let i=n.length-1;i>=0;i--){const o=n[i];if(o.type===t&&o.handler===e){n.splice(i,1);const a=r.get(o.srcElement);a.splice(a.indexOf(o),1),0===a.length&&r.delete(o.srcElement)}}this._active=n.some(t=>!t.passive)}handleEvent(t){if(this.isEmpty())return;const e=this._normalizeEvent(t);let n=t.srcEvent.target;for(;n&&n!==e.rootElement;){if(this._emit(e,n),e.handled)return;n=n.parentNode}this._emit(e,"root")}_emit(t,e){const n=this.handlersByElement.get(e);if(n){let r=!1;const i=()=>{t.handled=!0},o=()=>{t.handled=!0,r=!0},a=[];for(let s=0;s{const e=this.manager.get(t);e&&eg[t].forEach(t=>{e.recognizeWith(t)})}),e.recognizerOptions){const i=this.manager.get(r);if(i){const o=e.recognizerOptions[r];delete o.enable,i.set(o)}}for(const[a,s]of(this.wheelInput=new ex(t,this._onOtherEvent,{enable:!1}),this.moveInput=new eL(t,this._onOtherEvent,{enable:!1}),this.keyInput=new eV(t,this._onOtherEvent,{enable:!1,tabIndex:e.tabIndex}),this.contextmenuInput=new eZ(t,this._onOtherEvent,{enable:!1}),this.events))s.isEmpty()||(this._toggleRecognizer(s.recognizerName,!0),this.manager.on(a,s.handleEvent))}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy(),this.wheelInput=null,this.moveInput=null,this.keyInput=null,this.contextmenuInput=null,this.manager=null,this.element=null)}on(t,e,n){this._addEventHandler(t,e,n,!1)}once(t,e,n){this._addEventHandler(t,e,n,!0)}watch(t,e,n){this._addEventHandler(t,e,n,!1,!0)}off(t,e){this._removeEventHandler(t,e)}_toggleRecognizer(t,e){const{manager:n}=this;if(!n)return;const r=n.get(t);if(r&&r.options.enable!==e){r.set({enable:e});const i=em[t];i&&!this.options.recognizers&&i.forEach(i=>{const o=n.get(i);e?(o.requireFailure(t),r.dropRequireFailure(i)):o.dropRequireFailure(t)})}this.wheelInput.enableEventType(t,e),this.moveInput.enableEventType(t,e),this.keyInput.enableEventType(t,e),this.contextmenuInput.enableEventType(t,e)}_addEventHandler(t,e,n,r,i){if("string"!=typeof t){for(const o in n=e,t)this._addEventHandler(o,t[o],n,r,i);return}const{manager:a,events:s}=this,c=eO[t]||t;let u=s.get(c);!u&&(u=new eH(this),s.set(c,u),u.recognizerName=ew[c]||c,a&&a.on(c,u.handleEvent)),u.add(t,e,n,r,i),u.isEmpty()||this._toggleRecognizer(u.recognizerName,!0)}_removeEventHandler(t,e){if("string"!=typeof t){for(const n in t)this._removeEventHandler(n,t[n]);return}const{events:r}=this,i=eO[t]||t,o=r.get(i);if(o&&(o.remove(t,e),o.isEmpty())){const{recognizerName:a}=o;let s=!1;for(const c of r.values())if(c.recognizerName===a&&!c.isEmpty()){s=!0;break}s||this._toggleRecognizer(a,!1)}}_onBasicInput(t){const{srcEvent:e}=t,n=eb[e.type];n&&this.manager.emit(n,t)}_onOtherEvent(t){this.manager.emit(t.type,t)}}function eX(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function eK(t){for(var e=1;e0),a=o&&!this.state.isHovering,s=!o&&this.state.isHovering;(r||a)&&(t.features=e,r&&r(t)),a&&e9.call(this,"onMouseEnter",t),s&&e9.call(this,"onMouseLeave",t),(a||s)&&this.setState({isHovering:o})}}function nn(t){var e=this.props,n=e.onClick,r=e.onNativeClick,i=e.onDblClick,o=e.doubleClickZoom,a=[],s=i||o;switch(t.type){case"anyclick":a.push(r),s||a.push(n);break;case"click":s&&a.push(n)}(a=a.filter(Boolean)).length&&((t=e8.call(this,t)).features=e6.call(this,t.point),a.forEach(function(e){return e(t)}))}var nr=(0,h.forwardRef)(function(t,e){var n,a,s=(0,h.useContext)(tL),c=(0,h.useMemo)(function(){return t.controller||new e0},[]),u=(0,h.useMemo)(function(){return new eY(null,{touchAction:t.touchAction,recognizerOptions:t.eventRecognizerOptions})},[]),l=(0,h.useRef)(null),p=(0,h.useRef)(null),f=(0,h.useRef)({width:0,height:0,state:{isHovering:!1,isDragging:!1}}).current;f.props=t,f.map=p.current&&p.current.getMap(),f.setState=function(e){f.state=e2(e2({},f.state),e),l.current.style.cursor=t.getCursor(f.state)};var d=!0,v=function(t,e,r){if(d){n=[t,e,r];return}var i=f.props,o=i.onViewStateChange,a=i.onViewportChange;Object.defineProperty(t,"position",{get:function(){return[0,0,tF(f.map,t)]}}),o&&o({viewState:t,interactionState:e,oldViewState:r}),a&&a(t,e,r)};(0,h.useImperativeHandle)(e,function(){return{getMap:p.current&&p.current.getMap,queryRenderedFeatures:p.current&&p.current.queryRenderedFeatures}},[]);var g=(0,h.useMemo)(function(){return e2(e2({},s),{},{eventManager:u,container:s.container||l.current})},[s,l.current]);g.onViewportChange=v,g.viewport=s.viewport||tU(f),f.viewport=g.viewport;var m=function(t){var e=t.isDragging,n=void 0!==e&&e;if(n!==f.state.isDragging&&f.setState({isDragging:n}),d){a=t;return}var r=f.props.onInteractionStateChange;r&&r(t)},b=function(){f.width&&f.height&&c.setOptions(e2(e2(e2({},f.props),f.props.viewState),{},{isInteractive:Boolean(f.props.onViewStateChange||f.props.onViewportChange),onViewportChange:v,onStateChange:m,eventManager:u,width:f.width,height:f.height}))},y=function(t){var e=t.width,n=t.height;f.width=e,f.height=n,b(),f.props.onResize({width:e,height:n})};(0,h.useEffect)(function(){return u.setElement(l.current),u.on({pointerdown:e7.bind(f),pointermove:ne.bind(f),pointerup:nt.bind(f),pointerleave:e9.bind(f,"onMouseOut"),click:nn.bind(f),anyclick:nn.bind(f),dblclick:e9.bind(f,"onDblClick"),wheel:e9.bind(f,"onWheel"),contextmenu:e9.bind(f,"onContextMenu")}),function(){u.destroy()}},[]),tz(function(){if(n){var t;v.apply(void 0,function(t){if(Array.isArray(t))return i(t)}(t=n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||o(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}a&&m(a)}),b();var w=t.width,O=t.height,E=t.style,_=t.getCursor,P=(0,h.useMemo)(function(){return e2(e2({position:"relative"},E),{},{width:w,height:O,cursor:_(f.state)})},[E,w,O,_,f.state]);return n&&f._child||(f._child=h.createElement(tN,{value:g},h.createElement("div",{key:"event-canvas",ref:l,style:P},h.createElement(tX,r({},t,{width:"100%",height:"100%",style:null,onResize:y,ref:p}))))),d=!1,f._child});nr.supported=tX.supported,nr.propTypes=e4,nr.defaultProps=e3;var ni=nr;p.string.isRequired,p.string,p.oneOf(["fill","line","symbol","circle","fill-extrusion","raster","background","heatmap","hillshade","sky"]).isRequired,p.string,p.string,p.string;var no={captureScroll:!1,captureDrag:!0,captureClick:!0,captureDoubleClick:!0,capturePointerMove:!1},na={captureScroll:p.bool,captureDrag:p.bool,captureClick:p.bool,captureDoubleClick:p.bool,capturePointerMove:p.bool};function ns(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=(0,h.useContext)(tL),n=(0,h.useRef)(null),r=(0,h.useRef)({props:t,state:{},context:e,containerRef:n}).current;return r.props=t,r.context=e,(0,h.useEffect)(function(){return function(t){var e=t.containerRef.current,n=t.context.eventManager;if(e&&n){var r={wheel:function(e){var n=t.props;n.captureScroll&&e.stopPropagation(),n.onScroll&&n.onScroll(e,t)},panstart:function(e){var n=t.props;n.captureDrag&&e.stopPropagation(),n.onDragStart&&n.onDragStart(e,t)},anyclick:function(e){var n=t.props;n.captureClick&&e.stopPropagation(),n.onNativeClick&&n.onNativeClick(e,t)},click:function(e){var n=t.props;n.captureClick&&e.stopPropagation(),n.onClick&&n.onClick(e,t)},dblclick:function(e){var n=t.props;n.captureDoubleClick&&e.stopPropagation(),n.onDoubleClick&&n.onDoubleClick(e,t)},pointermove:function(e){var n=t.props;n.capturePointerMove&&e.stopPropagation(),n.onPointerMove&&n.onPointerMove(e,t)}};return n.watch(r,e),function(){n.off(r)}}}(r)},[e.eventManager]),r}function nc(t){var e=t.instance,n=ns(t),r=n.context,i=n.containerRef;return e._context=r,e._containerRef=i,e._render()}var nu=function(t){tQ(i,t);var e,n=(e=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}(),function(){var t,n=t2(i);if(e){var r=t2(this).constructor;t=Reflect.construct(n,arguments,r)}else t=n.apply(this,arguments);return t1(this,t)});function i(){var t;tc(this,i);for(var e=arguments.length,r=Array(e),o=0;o2&&void 0!==arguments[2]?arguments[2]:"x";if(null===t)return e;var r="x"===n?t.offsetWidth:t.offsetHeight;return nb(e/100*r)/r*100};function nw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}var nO=Object.assign({},np,{className:p.string,longitude:p.number.isRequired,latitude:p.number.isRequired,style:p.object}),nE=Object.assign({},nf,{className:""});function n_(t){var e,n,r,i,o,s,c,u=(n=(e=f((0,h.useState)(null),2))[0],r=e[1],o=(i=f((0,h.useState)(null),2))[0],s=i[1],(c=ns(nh(nh({},t),{},{onDragStart:ng}))).callbacks=t,c.state.dragPos=n,c.state.setDragPos=r,c.state.dragOffset=o,c.state.setDragOffset=s,(0,h.useEffect)(function(){return function(t){var e=t.context.eventManager;if(e&&t.state.dragPos){var n={panmove:function(e){return function(t,e){var n=e.props,r=e.callbacks,i=e.state,o=e.context;t.stopPropagation();var a=nd(t);i.setDragPos(a);var s=i.dragOffset;if(r.onDrag&&s){var c=Object.assign({},t);c.lngLat=nv(a,s,n,o),r.onDrag(c)}}(e,t)},panend:function(e){return function(t,e){var n=e.props,r=e.callbacks,i=e.state,o=e.context;t.stopPropagation();var a=i.dragPos,s=i.dragOffset;if(i.setDragPos(null),i.setDragOffset(null),r.onDragEnd&&a&&s){var c=Object.assign({},t);c.lngLat=nv(a,s,n,o),r.onDragEnd(c)}}(e,t)},pancancel:function(e){var n;return n=t.state,void(e.stopPropagation(),n.setDragPos(null),n.setDragOffset(null))}};return e.watch(n),function(){e.off(n)}}}(c)},[c.context.eventManager,Boolean(n)]),c),l=u.state,p=u.containerRef,d=t.children,v=t.className,g=t.draggable,m=t.style,b=l.dragPos,y=function(t){var e=t.props,n=t.state,r=t.context,i=e.longitude,o=e.latitude,a=e.offsetLeft,s=e.offsetTop,c=n.dragPos,u=n.dragOffset,l=r.viewport,h=r.map;if(c&&u)return[c[0]+u[0],c[1]+u[1]];var p=tF(h,{longitude:i,latitude:o}),d=f(l.project([i,o,p]),2),v=d[0],g=d[1];return[v+=a,g+=s]}(u),w=f(y,2),O=w[0],E=w[1],_="translate(".concat(nb(O),"px, ").concat(nb(E),"px)"),P=g?b?"grabbing":"grab":"auto",M=(0,h.useMemo)(function(){var t=function(t){for(var e=1;e0){var g=p,m=v;for(p=0;p<=1;p+=.5)d=(f=n-p*a)+a,(v=Math.max(0,u-f)+Math.max(0,d-i+u))0){var E=h,_=O;for(h=0;h<=1;h+=b)w=(y=e-h*o)+o,(O=Math.max(0,u-y)+Math.max(0,w-r+u))<_&&(_=O,E=h);h=E}return nM.find(function(t){var e=nP[t];return e.x===h&&e.y===p})||s}({x:r,y:i,anchor:o,padding:s,width:S.width,height:S.height,selfWidth:e.clientWidth,selfHeight:e.clientHeight}):o),z=(c=M.current,l=(u=f(L,3))[0],p=u[1],d=u[2],v=t.offsetLeft,g=t.offsetTop,m=t.sortByDepth,y=ny(c,-(100*(b=nP[N]).x)),w=ny(c,-(100*b.y),"y"),O={position:"absolute",transform:"\n translate(".concat(y,"%, ").concat(w,"%)\n translate(").concat(nb(l+v),"px, ").concat(nb(p+g),"px)\n "),display:void 0,zIndex:void 0},m&&(d>1||d<-1||l<0||l>S.width||p<0||p>S.height?O.display="none":O.zIndex=Math.floor((1-d)/2*1e5)),O),F=(0,h.useCallback)(function(t){_.props.onClose();var e=_.context.eventManager;e&&e.once("click",function(t){return t.stopPropagation()},t.target)},[]);return h.createElement("div",{className:"mapboxgl-popup mapboxgl-popup-anchor-".concat(N," ").concat(k),style:z,ref:M},h.createElement("div",{key:"tip",className:"mapboxgl-popup-tip",style:{borderWidth:C}}),h.createElement("div",{key:"content",ref:E,className:"mapboxgl-popup-content"},R&&h.createElement("button",{key:"close-button",className:"mapboxgl-popup-close-button",type:"button",onClick:F},"\xd7"),A))}function nk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}nT.propTypes=nj,nT.defaultProps=nS,h.memo(nT);var nx=Object.assign({},na,{toggleLabel:p.string,className:p.string,style:p.object,compact:p.bool,customAttribution:p.oneOfType([p.string,p.arrayOf(p.string)])}),nD=Object.assign({},no,{className:"",toggleLabel:"Toggle Attribution"});function nC(t){var e=ns(t),n=e.context,r=e.containerRef,i=(0,h.useRef)(null),o=f((0,h.useState)(!1),2),s=o[0],c=o[1];(0,h.useEffect)(function(){var e,o,a,s,c,u;return n.map&&(o={customAttribution:t.customAttribution},a=n.map,s=r.current,c=i.current,(u=new(tP()).AttributionControl(o))._map=a,u._container=s,u._innerContainer=c,u._updateAttributions(),u._updateEditLink(),a.on("styledata",u._updateData),a.on("sourcedata",u._updateData),e=u),function(){return e&&void(e._map.off("styledata",e._updateData),e._map.off("sourcedata",e._updateData))}},[n.map]);var u=void 0===t.compact?n.viewport.width<=640:t.compact;(0,h.useEffect)(function(){!u&&s&&c(!1)},[u]);var l=(0,h.useCallback)(function(){return c(function(t){return!t})},[]),p=(0,h.useMemo)(function(){return function(t){for(var e=1;ea)return 1}return 0}(o.map.version,"1.6.0")>=0?2:1:2},[o.map]),n=o.viewport.bearing,r={transform:"rotate(".concat(-n,"deg)")},2===e?h.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true",style:r}):h.createElement("span",{className:"mapboxgl-ctrl-compass-arrow",style:r})))))}function nK(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}nX.propTypes=nq,nX.defaultProps=nH,h.memo(nX);var nG=Object.assign({},na,{className:p.string,style:p.object,maxWidth:p.number,unit:p.oneOf(["imperial","metric","nautical"])}),n$=Object.assign({},no,{className:"",maxWidth:100,unit:"metric"});function nJ(t){var e=ns(t),n=e.context,r=e.containerRef,i=f((0,h.useState)(null),2),o=i[0],s=i[1];(0,h.useEffect)(function(){if(n.map){var t=new(tP()).ScaleControl;t._map=n.map,t._container=r.current,s(t)}},[n.map]),o&&(o.options=t,o._onMove());var c=(0,h.useMemo)(function(){return function(t){for(var e=1;e\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=i.console&&(i.console.warn||i.console.log);return o&&o.call(i.console,r,n),t.apply(this,arguments)}}c="function"!=typeof Object.assign?function(t){if(null==t)throw TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n-1}function S(t){return t.trim().split(/\s+/g)}function T(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var r=0;rT(i,a)&&r.push(t[o]),i[o]=a,o++}return n&&(r=e?r.sort(function(t,n){return t[e]>n[e]}):r.sort()),r}function D(t,e){for(var n,r,i=e[0].toUpperCase()+e.slice(1),o=0;o1&&!i.firstMultiple?i.firstMultiple=U(r):1===a&&(i.firstMultiple=!1),c=i.firstInput,l=(u=i.firstMultiple)?u.center:c.center,h=r.center=q(o),r.timeStamp=f(),r.deltaTime=r.timeStamp-c.timeStamp,r.angle=X(l,h),r.distance=Y(l,h),d=i,g=(v=r).center,m=d.offsetDelta||{},b=d.prevDelta||{},y=d.prevInput||{},(1===v.eventType||4===y.eventType)&&(b=d.prevDelta={x:y.deltaX||0,y:y.deltaY||0},m=d.offsetDelta={x:g.x,y:g.y}),v.deltaX=b.x+(g.x-m.x),v.deltaY=b.y+(g.y-m.y),r.offsetDirection=W(r.deltaX,r.deltaY),w=H(r.deltaTime,r.deltaX,r.deltaY),r.overallVelocityX=w.x,r.overallVelocityY=w.y,r.overallVelocity=p(w.x)>p(w.y)?w.x:w.y,r.scale=u?(O=u.pointers,Y(o[0],o[1],V)/Y(O[0],O[1],V)):1,r.rotation=u?(E=u.pointers,X(o[1],o[0],V)+X(E[1],E[0],V)):0,r.maxPointers=i.prevInput?r.pointers.length>i.prevInput.maxPointers?r.pointers.length:i.prevInput.maxPointers:r.pointers.length,function(t,e){var n,r,i,o,a=t.lastInterval||e,c=e.timeStamp-a.timeStamp;if(8!=e.eventType&&(c>25||s===a.velocity)){var u=e.deltaX-a.deltaX,l=e.deltaY-a.deltaY,h=H(c,u,l);r=h.x,i=h.y,n=p(h.x)>p(h.y)?h.x:h.y,o=W(u,l),t.lastInterval=e}else n=a.velocity,r=a.velocityX,i=a.velocityY,o=a.direction;e.velocity=n,e.velocityX=r,e.velocityY=i,e.direction=o}(i,r),_=t.element,M(r.srcEvent.target,_)&&(_=r.srcEvent.target),r.target=_,t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function U(t){for(var e=[],n=0;n=p(e)?t<0?2:4:e<0?8:16}function Y(t,e,n){n||(n=F);var r=e[n[0]]-t[n[0]],i=e[n[1]]-t[n[1]];return Math.sqrt(r*r+i*i)}function X(t,e,n){n||(n=F);var r=e[n[0]]-t[n[0]];return 180*Math.atan2(e[n[1]]-t[n[1]],r)/Math.PI}B.prototype={handler:function(){},init:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(R(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&P(this.element,this.evEl,this.domHandler),this.evTarget&&P(this.target,this.evTarget,this.domHandler),this.evWin&&P(R(this.element),this.evWin,this.domHandler)}};var K={mousedown:1,mousemove:2,mouseup:4};function G(){this.evEl="mousedown",this.evWin="mousemove mouseup",this.pressed=!1,B.apply(this,arguments)}w(G,B,{handler:function(t){var e=K[t.type];1&e&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:z,srcEvent:t}))}});var $={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},J={2:N,3:"pen",4:z,5:"kinect"},Q="pointerdown",tt="pointermove pointerup pointercancel";function te(){this.evEl=Q,this.evWin=tt,B.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}i.MSPointerEvent&&!i.PointerEvent&&(Q="MSPointerDown",tt="MSPointerMove MSPointerUp MSPointerCancel"),w(te,B,{handler:function(t){var e=this.store,n=!1,r=$[t.type.toLowerCase().replace("ms","")],i=J[t.pointerType]||t.pointerType,o=T(e,t.pointerId,"pointerId");1&r&&(0===t.button||i==N)?o<0&&(e.push(t),o=e.length-1):12&r&&(n=!0),!(o<0)&&(e[o]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:i,srcEvent:t}),n&&e.splice(o,1))}});var tn={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function tr(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,B.apply(this,arguments)}function ti(t,e){var n=k(t.touches),r=k(t.changedTouches);return 12&e&&(n=x(n.concat(r),"identifier",!0)),[n,r]}w(tr,B,{handler:function(t){var e=tn[t.type];if(1===e&&(this.started=!0),this.started){var n=ti.call(this,t,e);12&e&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:N,srcEvent:t})}}});var to={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function ta(){this.evTarget="touchstart touchmove touchend touchcancel",this.targetIds={},B.apply(this,arguments)}function ts(t,e){var n=k(t.touches),r=this.targetIds;if(3&e&&1===n.length)return r[n[0].identifier]=!0,[n,n];var i,o,a=k(t.changedTouches),s=[],c=this.target;if(o=n.filter(function(t){return M(t.target,c)}),1===e)for(i=0;i-1&&r.splice(t,1)},2500)}}function th(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,r=0;r-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){var e=this,n=this.state;function r(n){e.manager.emit(n,t)}n<8&&r(e.options.event+t_(n)),r(e.options.event),t.additionalEvent&&r(t.additionalEvent),n>=8&&r(e.options.event+t_(n))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=32},canEmit:function(){for(var t=0;te.threshold&&i&e.direction},attrTest:function(t){return tj.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=tP(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),w(tT,tj,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[tm]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),w(tk,tE,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[tv]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,r=t.distancee.time;if(this._input=t,r&&n&&(!(12&t.eventType)||i)){if(1&t.eventType)this.reset(),this._timer=d(function(){this.state=8,this.tryEmit()},e.time,this);else if(4&t.eventType)return 8}else this.reset();return 32},reset:function(){clearTimeout(this._timer)},emit:function(t){8===this.state&&(t&&4&t.eventType?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=f(),this.manager.emit(this.options.event,this._input)))}}),w(tx,tj,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[tm]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)}}),w(tD,tj,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return tS.prototype.getTouchAction.call(this)},attrTest:function(t){var e,n=this.options.direction;return 30&n?e=t.overallVelocity:6&n?e=t.overallVelocityX:24&n&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&p(e)>this.options.velocity&&4&t.eventType},emit:function(t){var e=tP(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),w(tC,tE,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[tg]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,r=t.distance1)for(var n=1;nt.length)&&(e=t.length);for(var n=0,r=Array(e);n=-90&&e<=90,"invalid latitude");const n=512*(j+Math.log(Math.tan(S+.5*(e*T))))/(2*j);return[512*(t*T+j)/(2*j),n]}function C([t,e]){const n=2*(Math.atan(Math.exp(e/512*(2*j)-j))-S);return[(t/512*(2*j)-j)*k,n*k]}function R(t){return 2*Math.atan(.5/t)*k}function A(t){return .5/Math.tan(.5*t*T)}function I(t,e,n=0){const[r,i,o]=t;if(M(Number.isFinite(r)&&Number.isFinite(i),"invalid pixel coordinate"),Number.isFinite(o)){const a=g(e,[r,i,o,1]);return a}const s=g(e,[r,i,0,1]),c=g(e,[r,i,1,1]),u=s[2],l=c[2];return P([],s,c,u===l?0:((n||0)-u)/(l-u))}const L=Math.PI/180;function N(t,e,n){const{pixelUnprojectionMatrix:r}=t,i=g(r,[e,0,1,1]),o=g(r,[e,t.height,1,1]),a=n*t.distanceScales.unitsPerMeter[2],s=(a-i[2])/(o[2]-i[2]),c=P([],i,o,s),u=C(c);return u[2]=n,u}class z{constructor({width:t,height:e,latitude:n=0,longitude:r=0,zoom:i=0,pitch:o=0,bearing:a=0,altitude:s=null,fovy:c=null,position:u=null,nearZMultiplier:l=.02,farZMultiplier:h=1.01}={width:1,height:1}){t=t||1,e=e||1,null===c&&null===s?c=R(s=1.5):null===c?c=R(s):null===s&&(s=A(c));const p=x(i);s=Math.max(.75,s);const f=function({latitude:t,longitude:e,highPrecision:n=!1}){M(Number.isFinite(t)&&Number.isFinite(e));const r={},i=Math.cos(t*T),o=512/360,a=o/i,s=512/4003e4/i;if(r.unitsPerMeter=[s,s,s],r.metersPerUnit=[1/s,1/s,1/s],r.unitsPerDegree=[o,a,s],r.degreesPerUnit=[1/o,1/a,1/s],n){const c=T*Math.tan(t*T)/i,u=512/4003e4*c,l=u/a*s;r.unitsPerDegree2=[0,o*c/2,u],r.unitsPerMeter2=[l,0,l]}return r}({longitude:r,latitude:n}),d=D([r,n]);if(d[2]=0,u){var g,m,b;b=d,g=[],m=f.unitsPerMeter,g[0]=u[0]*m[0],g[1]=u[1]*m[1],g[2]=u[2]*m[2],b[0]=d[0]+g[0],b[1]=d[1]+g[1],b[2]=d[2]+g[2]}this.projectionMatrix=function({width:t,height:e,pitch:n,altitude:r,fovy:i,nearZMultiplier:o,farZMultiplier:a}){var s,c,u;const{fov:l,aspect:h,near:p,far:f}=function({width:t,height:e,fovy:n=R(1.5),altitude:r,pitch:i=0,nearZMultiplier:o=1,farZMultiplier:a=1}){void 0!==r&&(n=R(r));const s=.5*n*T,c=A(n),u=i*T,l=Math.sin(s)*c/Math.sin(Math.min(Math.max(Math.PI/2-u-s,.01),Math.PI-.01)),h=Math.sin(u)*l+c;return{fov:2*s,aspect:t/e,focalDistance:c,near:o,far:h*a}}({width:t,height:e,altitude:r,fovy:i,pitch:n,nearZMultiplier:o,farZMultiplier:a}),d=(s=[],u=1/Math.tan(l/2),s[0]=u/h,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=u,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=-1,s[12]=0,s[13]=0,s[15]=0,null!=f&&f!==1/0?(c=1/(p-f),s[10]=(f+p)*c,s[14]=2*f*p*c):(s[10]=-1,s[14]=-2*p),s);return d}({width:t,height:e,pitch:o,fovy:c,nearZMultiplier:l,farZMultiplier:h}),this.viewMatrix=function({height:t,pitch:e,bearing:n,altitude:r,scale:i,center:o=null}){var a,s,c,u,l,h,p,f,d,g,m,b,y,E,_,P,M,j,S,k,x,D,C,R,A;const I=v();return w(I,I,[0,0,-r]),a=I,c=Math.sin(s=-e*T),u=Math.cos(s),l=I[4],h=I[5],p=I[6],f=I[7],d=I[8],g=I[9],m=I[10],b=I[11],I!==a&&(a[0]=I[0],a[1]=I[1],a[2]=I[2],a[3]=I[3],a[12]=I[12],a[13]=I[13],a[14]=I[14],a[15]=I[15]),a[4]=l*u+d*c,a[5]=h*u+g*c,a[6]=p*u+m*c,a[7]=f*u+b*c,a[8]=d*u-l*c,a[9]=g*u-h*c,a[10]=m*u-p*c,a[11]=b*u-f*c,y=I,_=Math.sin(E=n*T),P=Math.cos(E),M=I[0],j=I[1],S=I[2],k=I[3],x=I[4],D=I[5],C=I[6],R=I[7],I!==y&&(y[8]=I[8],y[9]=I[9],y[10]=I[10],y[11]=I[11],y[12]=I[12],y[13]=I[13],y[14]=I[14],y[15]=I[15]),y[0]=M*P+x*_,y[1]=j*P+D*_,y[2]=S*P+C*_,y[3]=k*P+R*_,y[4]=x*P-M*_,y[5]=D*P-j*_,y[6]=C*P-S*_,y[7]=R*P-k*_,O(I,I,[i/=t,i,i]),o&&w(I,I,((A=[])[0]=-o[0],A[1]=-o[1],A[2]=-o[2],A)),I}({height:e,scale:p,center:d,pitch:o,bearing:a,altitude:s}),this.width=t,this.height=e,this.scale=p,this.latitude=n,this.longitude=r,this.zoom=i,this.pitch=o,this.bearing=a,this.altitude=s,this.fovy=c,this.center=d,this.meterOffset=u||[0,0,0],this.distanceScales=f,this._initMatrices(),this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),Object.freeze(this)}_initMatrices(){var t,e,n,r,i,o,a,s,c,u,l,h,p,f,d,g,m,b,E,_,P,M,j,S,T,k,x,D,C,R;const{width:A,height:I,projectionMatrix:L,viewMatrix:N}=this,z=v();y(z,z,L),y(z,z,N),this.viewProjectionMatrix=z;const F=v();O(F,F,[A/2,-I/2,1]),w(F,F,[1,-1,0]),y(F,F,z);const V=(t=v(),e=F[0],n=F[1],r=F[2],i=F[3],o=F[4],a=F[5],s=F[6],c=F[7],u=F[8],l=F[9],h=F[10],p=F[11],f=F[12],d=F[13],g=F[14],m=F[15],b=e*a-n*o,E=e*s-r*o,_=e*c-i*o,P=n*s-r*a,M=n*c-i*a,j=r*c-i*s,S=u*d-l*f,T=u*g-h*f,k=u*m-p*f,x=l*g-h*d,D=l*m-p*d,(R=b*(C=h*m-p*g)-E*D+_*x+P*k-M*T+j*S)?(R=1/R,t[0]=(a*C-s*D+c*x)*R,t[1]=(r*D-n*C-i*x)*R,t[2]=(d*j-g*M+m*P)*R,t[3]=(h*M-l*j-p*P)*R,t[4]=(s*k-o*C-c*T)*R,t[5]=(e*C-r*k+i*T)*R,t[6]=(g*_-f*j-m*E)*R,t[7]=(u*j-h*_+p*E)*R,t[8]=(o*D-a*k+c*S)*R,t[9]=(n*k-e*D-i*S)*R,t[10]=(f*M-d*_+m*b)*R,t[11]=(l*_-u*M-p*b)*R,t[12]=(a*T-o*x-s*S)*R,t[13]=(e*x-n*T+r*S)*R,t[14]=(d*E-f*P-g*b)*R,t[15]=(u*P-l*E+h*b)*R,t):null);if(!V)throw Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=F,this.pixelUnprojectionMatrix=V}equals(t){return t instanceof z&&t.width===this.width&&t.height===this.height&&E(t.projectionMatrix,this.projectionMatrix)&&E(t.viewMatrix,this.viewMatrix)}project(t,{topLeft:e=!0}={}){const n=this.projectPosition(t),r=function(t,e){const[n,r,i=0]=t;return M(Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(i)),g(e,[n,r,i,1])}(n,this.pixelProjectionMatrix),[i,o]=r,a=e?o:this.height-o;return 2===t.length?[i,a]:[i,a,r[2]]}unproject(t,{topLeft:e=!0,targetZ:n}={}){const[r,i,o]=t,a=e?i:this.height-i,s=n&&n*this.distanceScales.unitsPerMeter[2],c=I([r,a,o],this.pixelUnprojectionMatrix,s),[u,l,h]=this.unprojectPosition(c);return Number.isFinite(o)?[u,l,h]:Number.isFinite(n)?[u,l,n]:[u,l]}projectPosition(t){const[e,n]=D(t),r=(t[2]||0)*this.distanceScales.unitsPerMeter[2];return[e,n,r]}unprojectPosition(t){const[e,n]=C(t),r=(t[2]||0)*this.distanceScales.metersPerUnit[2];return[e,n,r]}projectFlat(t){return D(t)}unprojectFlat(t){return C(t)}getMapCenterByLngLatPosition({lngLat:t,pos:e}){var n;const r=I(e,this.pixelUnprojectionMatrix),i=D(t),o=_([],i,((n=[])[0]=-r[0],n[1]=-r[1],n)),a=_([],this.center,o);return C(a)}getLocationAtPoint({lngLat:t,pos:e}){return this.getMapCenterByLngLatPosition({lngLat:t,pos:e})}fitBounds(t,e={}){const{width:n,height:r}=this,{longitude:i,latitude:o,zoom:a}=function({width:t,height:e,bounds:n,minExtent:r=0,maxZoom:i=24,padding:o=0,offset:a=[0,0]}){const[[s,c],[u,l]]=n;if(Number.isFinite(o)){const h=o;o={top:h,bottom:h,left:h,right:h}}else M(Number.isFinite(o.top)&&Number.isFinite(o.bottom)&&Number.isFinite(o.left)&&Number.isFinite(o.right));const p=D([s,l<-85.051129?-85.051129:l>85.051129?85.051129:l]),f=D([u,c<-85.051129?-85.051129:c>85.051129?85.051129:c]),d=[Math.max(Math.abs(f[0]-p[0]),r),Math.max(Math.abs(f[1]-p[1]),r)],v=[t-o.left-o.right-2*Math.abs(a[0]),e-o.top-o.bottom-2*Math.abs(a[1])];M(v[0]>0&&v[1]>0);const g=v[0]/d[0],m=v[1]/d[1],y=(o.right-o.left)/2/g,w=(o.bottom-o.top)/2/m,O=[(f[0]+p[0])/2+y,(f[1]+p[1])/2+w],E=C(O),_=Math.min(i,b(Math.abs(Math.min(g,m))));return M(Number.isFinite(_)),{longitude:E[0],latitude:E[1],zoom:_}}(Object.assign({width:n,height:r,bounds:t},e));return new z({width:n,height:r,longitude:i,latitude:o,zoom:a})}getBounds(t){const e=this.getBoundingRegion(t),n=Math.min(...e.map(t=>t[0])),r=Math.max(...e.map(t=>t[0])),i=Math.min(...e.map(t=>t[1])),o=Math.max(...e.map(t=>t[1]));return[[n,i],[r,o]]}getBoundingRegion(t={}){return function(t,e=0){let n,r;const{width:i,height:o,unproject:a}=t,s={targetZ:e},c=a([0,o],s),u=a([i,o],s),l=t.fovy?.5*t.fovy*L:Math.atan(.5/t.altitude),h=(90-t.pitch)*L;return l>h-.01?(n=N(t,0,e),r=N(t,i,e)):(n=a([0,0],s),r=a([i,0],s)),[c,u,r,n]}(this,t.z||0)}}const F=["longitude","latitude","zoom"],V={curve:1.414,speed:1.2};function B(t,e,n){var r;n=Object.assign({},V,n);const i=n.curve,o=t.zoom,a=[t.longitude,t.latitude],s=x(o),c=e.zoom,u=[e.longitude,e.latitude],l=x(c-o),h=D(a),p=D(u),f=((r=[])[0]=p[0]-h[0],r[1]=p[1]-h[1],r),d=Math.max(t.width,t.height),v=d/l,g=Math.hypot(f[0],f[1])*s,m=Math.max(g,.01),b=i*i,y=(v*v-d*d+b*b*m*m)/(2*d*b*m),w=(v*v-d*d-b*b*m*m)/(2*v*b*m),O=Math.log(Math.sqrt(y*y+1)-y),E=Math.log(Math.sqrt(w*w+1)-w);return{startZoom:o,startCenterXY:h,uDelta:f,w0:d,u1:g,S:(E-O)/i,rho:i,rho2:b,r0:O,r1:E}}var Z=function(){if("undefined"!=typeof Map)return Map;function t(t,e){var n=-1;return t.some(function(t,r){return t[0]===e&&(n=r,!0)}),n}return function(){function e(){this.__entries__=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var n=t(this.__entries__,e),r=this.__entries__[n];return r&&r[1]},e.prototype.set=function(e,n){var r=t(this.__entries__,e);~r?this.__entries__[r][1]=n:this.__entries__.push([e,n])},e.prototype.delete=function(e){var n=this.__entries__,r=t(n,e);~r&&n.splice(r,1)},e.prototype.has=function(e){return!!~t(this.__entries__,e)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(t,e){void 0===e&&(e=null);for(var n=0,r=this.__entries__;n0},t.prototype.connect_=function(){U&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Y?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},t.prototype.disconnect_=function(){U&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},t.prototype.onTransitionEnd_=function(t){var e=t.propertyName,n=void 0===e?"":e;W.some(function(t){return!!~n.indexOf(t)})&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),K=function(t,e){for(var n=0,r=Object.keys(e);n0},t}(),to="undefined"!=typeof WeakMap?new WeakMap:new Z,ta=function t(e){if(!(this instanceof t))throw TypeError("Cannot call a class as a function.");if(!arguments.length)throw TypeError("1 argument required, but only 0 present.");var n=X.getInstance(),r=new ti(e,n,this);to.set(this,r)};["observe","unobserve","disconnect"].forEach(function(t){ta.prototype[t]=function(){var e;return(e=to.get(this))[t].apply(e,arguments)}});var ts=void 0!==q.ResizeObserver?q.ResizeObserver:ta;function tc(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}function tu(t,e){for(var n=0;n=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o,a=!0,s=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}function tv(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n1&&void 0!==arguments[1]?arguments[1]:"component";t.debug&&p.checkPropTypes(ty,t,"prop",e)}var tE=function(){function t(e){var n=this;if(tc(this,t),a(this,"props",tw),a(this,"width",0),a(this,"height",0),a(this,"_fireLoadEvent",function(){n.props.onLoad({type:"load",target:n._map})}),a(this,"_handleError",function(t){n.props.onError(t)}),!e.mapboxgl)throw Error("Mapbox not available");this.mapboxgl=e.mapboxgl,t.initialized||(t.initialized=!0,this._checkStyleSheet(this.mapboxgl.version)),this._initialize(e)}return tl(t,[{key:"finalize",value:function(){return this._destroy(),this}},{key:"setProps",value:function(t){return this._update(this.props,t),this}},{key:"redraw",value:function(){var t=this._map;t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}},{key:"getMap",value:function(){return this._map}},{key:"_reuse",value:function(e){this._map=t.savedMap;var n=this._map.getContainer(),r=e.container;for(r.classList.add("mapboxgl-map");n.childNodes.length>0;)r.appendChild(n.childNodes[0]);this._map._container=r,t.savedMap=null,e.mapStyle&&this._map.setStyle(tm(e.mapStyle),{diff:!1}),this._map.isStyleLoaded()?this._fireLoadEvent():this._map.once("styledata",this._fireLoadEvent)}},{key:"_create",value:function(e){if(e.reuseMaps&&t.savedMap)this._reuse(e);else{if(e.gl){var n=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(){return HTMLCanvasElement.prototype.getContext=n,e.gl}}var r={container:e.container,center:[0,0],zoom:8,pitch:0,bearing:0,maxZoom:24,style:tm(e.mapStyle),interactive:!1,trackResize:!1,attributionControl:e.attributionControl,preserveDrawingBuffer:e.preserveDrawingBuffer};e.transformRequest&&(r.transformRequest=e.transformRequest),this._map=new this.mapboxgl.Map(Object.assign({},r,e.mapOptions)),this._map.once("load",this._fireLoadEvent),this._map.on("error",this._handleError)}return this}},{key:"_destroy",value:function(){this._map&&(this.props.reuseMaps&&!t.savedMap?(t.savedMap=this._map,this._map.off("load",this._fireLoadEvent),this._map.off("error",this._handleError),this._map.off("styledata",this._fireLoadEvent)):this._map.remove(),this._map=null)}},{key:"_initialize",value:function(t){var e=this;tO(t=Object.assign({},tw,t),"Mapbox"),this.mapboxgl.accessToken=t.mapboxApiAccessToken||tw.mapboxApiAccessToken,this.mapboxgl.baseApiUrl=t.mapboxApiUrl,this._create(t);var n=t.container;Object.defineProperty(n,"offsetWidth",{configurable:!0,get:function(){return e.width}}),Object.defineProperty(n,"clientWidth",{configurable:!0,get:function(){return e.width}}),Object.defineProperty(n,"offsetHeight",{configurable:!0,get:function(){return e.height}}),Object.defineProperty(n,"clientHeight",{configurable:!0,get:function(){return e.height}});var r=this._map.getCanvas();r&&(r.style.outline="none"),this._updateMapViewport({},t),this._updateMapSize({},t),this.props=t}},{key:"_update",value:function(t,e){if(this._map){tO(e=Object.assign({},this.props,e),"Mapbox");var n=this._updateMapViewport(t,e),r=this._updateMapSize(t,e);this._updateMapStyle(t,e),!e.asyncRender&&(n||r)&&this.redraw(),this.props=e}}},{key:"_updateMapStyle",value:function(t,e){t.mapStyle!==e.mapStyle&&this._map.setStyle(tm(e.mapStyle),{diff:!e.preventStyleDiffing})}},{key:"_updateMapSize",value:function(t,e){var n=t.width!==e.width||t.height!==e.height;return n&&(this.width=e.width,this.height=e.height,this._map.resize()),n}},{key:"_updateMapViewport",value:function(t,e){var n=this._getViewState(t),r=this._getViewState(e),i=r.latitude!==n.latitude||r.longitude!==n.longitude||r.zoom!==n.zoom||r.pitch!==n.pitch||r.bearing!==n.bearing||r.altitude!==n.altitude;return i&&(this._map.jumpTo(this._viewStateToMapboxProps(r)),r.altitude!==n.altitude&&(this._map.transform.altitude=r.altitude)),i}},{key:"_getViewState",value:function(t){var e=t.viewState||t,n=e.longitude,r=e.latitude,i=e.zoom,o=e.pitch,a=e.bearing,s=e.altitude;return{longitude:n,latitude:r,zoom:i,pitch:void 0===o?0:o,bearing:void 0===a?0:a,altitude:void 0===s?1.5:s}}},{key:"_checkStyleSheet",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"0.47.0";if(void 0!==th)try{var e=th.createElement("div");if(e.className="mapboxgl-map",e.style.display="none",th.body.appendChild(e),!("static"!==window.getComputedStyle(e).position)){var n=th.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("type","text/css"),n.setAttribute("href","https://api.tiles.mapbox.com/mapbox-gl-js/v".concat(t,"/mapbox-gl.css")),th.head.appendChild(n)}}catch(r){}}},{key:"_viewStateToMapboxProps",value:function(t){return{center:[t.longitude,t.latitude],zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}}}]),t}();a(tE,"initialized",!1),a(tE,"propTypes",ty),a(tE,"defaultProps",tw),a(tE,"savedMap",null);var t_=n(6158),tP=n.n(t_);function tM(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function tj(t,e,n){return Math.max(e,Math.min(n,t))}function tS(t,e,n){return tM(t)?t.map(function(t,r){return tS(t,e[r],n)}):n*e+(1-n)*t}function tT(t,e){if(!t)throw Error(e||"react-map-gl: assertion failed.")}function tk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function tx(t){for(var e=1;e0,"`scale` must be a positive number");var i=this._state,o=i.startZoom,a=i.startZoomLngLat;Number.isFinite(o)||(o=this._viewportProps.zoom,a=this._unproject(n)||this._unproject(e)),tT(a,"`startZoomLngLat` prop is required for zoom behavior to calculate where to position the map.");var s=this._calculateNewZoom({scale:r,startZoom:o||0}),c=f(new z(Object.assign({},this._viewportProps,{zoom:s})).getMapCenterByLngLatPosition({lngLat:a,pos:e}),2),u=c[0],l=c[1];return this._getUpdatedMapState({zoom:s,longitude:u,latitude:l})}},{key:"zoomEnd",value:function(){return this._getUpdatedMapState({startZoomLngLat:null,startZoom:null})}},{key:"_getUpdatedMapState",value:function(e){return new t(Object.assign({},this._viewportProps,this._state,e))}},{key:"_applyConstraints",value:function(t){var e=t.maxZoom,n=t.minZoom,r=t.zoom;t.zoom=tj(r,n,e);var i=t.maxPitch,o=t.minPitch,a=t.pitch;return t.pitch=tj(a,o,i),Object.assign(t,function({width:t,height:e,longitude:n,latitude:r,zoom:i,pitch:o=0,bearing:a=0}){(n<-180||n>180)&&(n=m(n+180,360)-180),(a<-180||a>180)&&(a=m(a+180,360)-180);const s=b(e/512);if(i<=s)i=s,r=0;else{const c=e/2/Math.pow(2,i),u=C([0,c])[1];if(rl&&(r=l)}}return{width:t,height:e,longitude:n,latitude:r,zoom:i,pitch:o,bearing:a}}(t)),t}},{key:"_unproject",value:function(t){var e=new z(this._viewportProps);return t&&e.unproject(t)}},{key:"_calculateNewLngLat",value:function(t){var e=t.startPanLngLat,n=t.pos;return new z(this._viewportProps).getMapCenterByLngLatPosition({lngLat:e,pos:n})}},{key:"_calculateNewZoom",value:function(t){var e=t.scale,n=t.startZoom,r=this._viewportProps,i=r.maxZoom;return tj(n+Math.log2(e),r.minZoom,i)}},{key:"_calculateNewPitchAndBearing",value:function(t){var e=t.deltaScaleX,n=t.deltaScaleY,r=t.startBearing,i=t.startPitch;n=tj(n,-1,1);var o=this._viewportProps,a=o.minPitch,s=o.maxPitch,c=i;return n>0?c=i+n*(s-i):n<0&&(c=i-n*(a-i)),{pitch:c,bearing:r+180*e}}},{key:"_getRotationParams",value:function(t,e){var n=t[0]-e[0],r=t[1]-e[1],i=t[1],o=e[1],a=this._viewportProps,s=a.width,c=a.height,u=0;return r>0?Math.abs(c-o)>5&&(u=r/(o-c)*1.2):r<0&&o>5&&(u=1-i/o),{deltaScaleX:n/s,deltaScaleY:u=Math.min(1,Math.max(-1,u))}}}]),t}();function tA(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function tI(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{},n=c.current&&c.current.getMap();return n&&n.queryRenderedFeatures(t,e)}}},[]);var g=(0,h.useCallback)(function(t){var e=t.target;e===p.current&&e.scrollTo(0,0)},[]),m=v&&h.createElement(tN,{value:tB(tB({},d),{},{viewport:d.viewport||tU(tB({map:v,props:t},a)),map:v,container:d.container||l.current})},h.createElement("div",{key:"map-overlays",className:"overlays",ref:p,style:tq,onScroll:g},t.children)),b=t.className,y=t.width,w=t.height,O=t.style,E=t.visibilityConstraints,_=Object.assign({position:"relative"},O,{width:y,height:w}),P=Object.assign({},tq,{visibility:t.visible&&function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tD;for(var n in e){var r,i=n.slice(0,3),o=(r=n.slice(3))[0].toLowerCase()+r.slice(1);if("min"===i&&t[o]e[n])return!1}return!0}(t.viewState||t,E)?"inherit":"hidden"});return h.createElement("div",{key:"map-container",ref:l,style:_},h.createElement("div",{key:"map-mapbox",ref:u,style:P,className:b}),m,!r&&!t.disableTokenWarning&&h.createElement(tY,null))});function tK(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o,a=!0,s=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}(this.propNames||[]);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(!function t(e,n){if(e===n)return!0;if(tM(e)&&tM(n)){if(e.length!==n.length)return!1;for(var r=0;r=Math.abs(e-n)}(t[i],e[i]))return!1}}catch(o){r.e(o)}finally{r.f()}return!0}},{key:"initializeProps",value:function(t,e){return{start:t,end:e}}},{key:"interpolateProps",value:function(t,e,n){tT(!1,"interpolateProps is not implemented")}},{key:"getDuration",value:function(t,e){return e.transitionDuration}}]),t}();function t$(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function tJ(t,e){return(tJ=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function tQ(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&tJ(t,e)}function t0(t){return(t0="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function t1(t,e){if(e&&("object"===t0(e)||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return t$(t)}function t2(t){return(t2=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var t4={longitude:1,bearing:1};function t5(t){return Number.isFinite(t)||Array.isArray(t)}function t3(t,e,n){return t in t4&&Math.abs(n-e)>180&&(n=n<0?n+360:n-360),n}function t8(t,e){if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return t6(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t6(t,e)}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o,a=!0,s=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}function t6(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o,a=!0,s=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}function er(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n0&&void 0!==arguments[0]?arguments[0]:{};return tc(this,r),a(t$(t=n.call(this)),"propNames",t9),t.props=Object.assign({},ee,e),t}tl(r,[{key:"initializeProps",value:function(t,e){var n,r={},i={},o=t8(t7);try{for(o.s();!(n=o.n()).done;){var a=n.value,s=t[a],c=e[a];tT(t5(s)&&t5(c),"".concat(a," must be supplied for transition")),r[a]=s,i[a]=t3(a,s,c)}}catch(u){o.e(u)}finally{o.f()}var l,h=t8(et);try{for(h.s();!(l=h.n()).done;){var p=l.value,f=t[p]||0,d=e[p]||0;r[p]=f,i[p]=t3(p,f,d)}}catch(v){h.e(v)}finally{h.f()}return{start:r,end:i}}},{key:"interpolateProps",value:function(t,e,n){var r,i=function(t,e,n,r={}){var i;const o={},{startZoom:a,startCenterXY:s,uDelta:c,w0:u,u1:l,S:h,rho:p,rho2:f,r0:d}=B(t,e,r);if(l<.01){for(const v of F){const g=t[v],m=e[v];o[v]=n*m+(1-n)*g}return o}const y=n*h,w=Math.cosh(d)/Math.cosh(d+p*y),O=u*((Math.cosh(d)*Math.tanh(d+p*y)-Math.sinh(d))/f)/l,E=a+b(1/w),P=((i=[])[0]=c[0]*O,i[1]=c[1]*O,i);_(P,P,s);const M=C(P);return o.longitude=M[0],o.latitude=M[1],o.zoom=E,o}(t,e,n,this.props),o=t8(et);try{for(o.s();!(r=o.n()).done;){var a=r.value;i[a]=tS(t[a],e[a],n)}}catch(s){o.e(s)}finally{o.f()}return i}},{key:"getDuration",value:function(t,e){var n=e.transitionDuration;return"auto"===n&&(n=function(t,e,n={}){let r;n=Object.assign({},V,n);const{screenSpeed:i,speed:o,maxDuration:a}=n,{S:s,rho:c}=B(t,e,n),u=1e3*s;return r=Number.isFinite(i)?u/(i/c):u/o,Number.isFinite(a)&&r>a?0:r}(t,e,this.props)),n}}])}(tG);var ei=["longitude","latitude","zoom","bearing","pitch"],eo=function(t){tQ(r,t);var e,n=(e=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}(),function(){var t,n=t2(r);if(e){var i=t2(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return t1(this,t)});function r(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return tc(this,r),t=n.call(this),Array.isArray(e)&&(e={transitionProps:e}),t.propNames=e.transitionProps||ei,e.around&&(t.around=e.around),t}return tl(r,[{key:"initializeProps",value:function(t,e){var n={},r={};if(this.around){n.around=this.around;var i=new z(t).unproject(this.around);Object.assign(r,e,{around:new z(e).project(i),aroundLngLat:i})}var o,a=en(this.propNames);try{for(a.s();!(o=a.n()).done;){var s=o.value,c=t[s],u=e[s];tT(t5(c)&&t5(u),"".concat(s," must be supplied for transition")),n[s]=c,r[s]=t3(s,c,u)}}catch(l){a.e(l)}finally{a.f()}return{start:n,end:r}}},{key:"interpolateProps",value:function(t,e,n){var r,i={},o=en(this.propNames);try{for(o.s();!(r=o.n()).done;){var a=r.value;i[a]=tS(t[a],e[a],n)}}catch(s){o.e(s)}finally{o.f()}if(e.around){var c=f(new z(Object.assign({},e,i)).getMapCenterByLngLatPosition({lngLat:e.aroundLngLat,pos:tS(t.around,e.around,n)}),2),u=c[0],l=c[1];i.longitude=u,i.latitude=l}return i}}]),r}(tG),ea=function(){},es={BREAK:1,SNAP_TO_END:2,IGNORE:3,UPDATE:4},ec={transitionDuration:0,transitionEasing:function(t){return t},transitionInterpolator:new eo,transitionInterruption:es.BREAK,onTransitionStart:ea,onTransitionInterrupt:ea,onTransitionEnd:ea},eu=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};tc(this,t),a(this,"_animationFrame",null),a(this,"_onTransitionFrame",function(){e._animationFrame=requestAnimationFrame(e._onTransitionFrame),e._updateViewport()}),this.props=null,this.onViewportChange=n.onViewportChange||ea,this.onStateChange=n.onStateChange||ea,this.time=n.getTime||Date.now}return tl(t,[{key:"getViewportInTransition",value:function(){return this._animationFrame?this.state.propsInTransition:null}},{key:"processViewportChange",value:function(t){var e=this.props;if(this.props=t,!e||this._shouldIgnoreViewportChange(e,t))return!1;if(this._isTransitionEnabled(t)){var n=Object.assign({},e),r=Object.assign({},t);if(this._isTransitionInProgress()&&(e.onTransitionInterrupt(),this.state.interruption===es.SNAP_TO_END?Object.assign(n,this.state.endProps):Object.assign(n,this.state.propsInTransition),this.state.interruption===es.UPDATE)){var i,o,a=this.time(),s=(a-this.state.startTime)/this.state.duration;r.transitionDuration=this.state.duration-(a-this.state.startTime),r.transitionEasing=(o=(i=this.state.easing)(s),function(t){return 1/(1-o)*(i(t*(1-s)+s)-o)}),r.transitionInterpolator=n.transitionInterpolator}return r.onTransitionStart(),this._triggerTransition(n,r),!0}return this._isTransitionInProgress()&&(e.onTransitionInterrupt(),this._endTransition()),!1}},{key:"_isTransitionInProgress",value:function(){return Boolean(this._animationFrame)}},{key:"_isTransitionEnabled",value:function(t){var e=t.transitionDuration,n=t.transitionInterpolator;return(e>0||"auto"===e)&&Boolean(n)}},{key:"_isUpdateDueToCurrentTransition",value:function(t){return!!this.state.propsInTransition&&this.state.interpolator.arePropsEqual(t,this.state.propsInTransition)}},{key:"_shouldIgnoreViewportChange",value:function(t,e){return!t||(this._isTransitionInProgress()?this.state.interruption===es.IGNORE||this._isUpdateDueToCurrentTransition(e):!this._isTransitionEnabled(e)||e.transitionInterpolator.arePropsEqual(t,e))}},{key:"_triggerTransition",value:function(t,e){tT(this._isTransitionEnabled(e)),this._animationFrame&&cancelAnimationFrame(this._animationFrame);var n=e.transitionInterpolator,r=n.getDuration?n.getDuration(t,e):e.transitionDuration;if(0!==r){var i=e.transitionInterpolator.initializeProps(t,e),o={inTransition:!0,isZooming:t.zoom!==e.zoom,isPanning:t.longitude!==e.longitude||t.latitude!==e.latitude,isRotating:t.bearing!==e.bearing||t.pitch!==e.pitch};this.state={duration:r,easing:e.transitionEasing,interpolator:e.transitionInterpolator,interruption:e.transitionInterruption,startTime:this.time(),startProps:i.start,endProps:i.end,animation:null,propsInTransition:{}},this._onTransitionFrame(),this.onStateChange(o)}}},{key:"_endTransition",value:function(){this._animationFrame&&(cancelAnimationFrame(this._animationFrame),this._animationFrame=null),this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1})}},{key:"_updateViewport",value:function(){var t=this.time(),e=this.state,n=e.startTime,r=e.duration,i=e.easing,o=e.interpolator,a=e.startProps,s=e.endProps,c=!1,u=(t-n)/r;u>=1&&(u=1,c=!0),u=i(u);var l=o.interpolateProps(a,s,u),h=new tR(Object.assign({},this.props,l));this.state.propsInTransition=h.getViewportProps(),this.onViewportChange(this.state.propsInTransition,this.props),c&&(this._endTransition(),this.props.onTransitionEnd())}}]),t}();a(eu,"defaultProps",ec);var el=n(840),eh=n.n(el);const ep={mousedown:1,mousemove:2,mouseup:4};!function(t){const e=t.prototype.handler;t.prototype.handler=function(t){const n=this.store;t.button>0&&"pointerdown"===t.type&&!function(t,e){for(let n=0;ne.pointerId===t.pointerId)&&n.push(t),e.call(this,t)}}(eh().PointerEventInput),eh().MouseInput.prototype.handler=function(t){let e=ep[t.type];1&e&&t.button>=0&&(this.pressed=!0),2&e&&0===t.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:"mouse",srcEvent:t}))};const ef=eh().Manager;var ed=eh();const ev=ed?[[ed.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1}],[ed.Rotate,{enable:!1}],[ed.Pinch,{enable:!1}],[ed.Swipe,{enable:!1}],[ed.Pan,{threshold:0,enable:!1}],[ed.Press,{enable:!1}],[ed.Tap,{event:"doubletap",taps:2,enable:!1}],[ed.Tap,{event:"anytap",enable:!1}],[ed.Tap,{enable:!1}]]:null,eg={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},em={doubletap:["tap"]},eb={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},ey={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],WHEEL_EVENTS:["wheel","mousewheel"]},ew={tap:"tap",anytap:"anytap",doubletap:"doubletap",press:"press",pinch:"pinch",pinchin:"pinch",pinchout:"pinch",pinchstart:"pinch",pinchmove:"pinch",pinchend:"pinch",pinchcancel:"pinch",rotate:"rotate",rotatestart:"rotate",rotatemove:"rotate",rotateend:"rotate",rotatecancel:"rotate",tripan:"tripan",tripanstart:"tripan",tripanmove:"tripan",tripanup:"tripan",tripandown:"tripan",tripanleft:"tripan",tripanright:"tripan",tripanend:"tripan",tripancancel:"tripan",pan:"pan",panstart:"pan",panmove:"pan",panup:"pan",pandown:"pan",panleft:"pan",panright:"pan",panend:"pan",pancancel:"pan",swipe:"swipe",swipeleft:"swipe",swiperight:"swipe",swipeup:"swipe",swipedown:"swipe"},eO={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},eE="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",e_="undefined"!=typeof window?window:n.g;void 0!==n.g?n.g:window;let eP=!1;try{const eM={get passive(){return eP=!0,!0}};e_.addEventListener("test",eM,eM),e_.removeEventListener("test",eM,eM)}catch(ej){}const eS=-1!==eE.indexOf("firefox"),{WHEEL_EVENTS:eT}=ey,ek="wheel";class ex{constructor(t,e,n={}){this.element=t,this.callback=e,this.options=Object.assign({enable:!0},n),this.events=eT.concat(n.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(e=>t.addEventListener(e,this.handleEvent,!!eP&&{passive:!1}))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,e){t===ek&&(this.options.enable=e)}handleEvent(t){if(!this.options.enable)return;let e=t.deltaY;e_.WheelEvent&&(eS&&t.deltaMode===e_.WheelEvent.DOM_DELTA_PIXEL&&(e/=e_.devicePixelRatio),t.deltaMode===e_.WheelEvent.DOM_DELTA_LINE&&(e*=40));const n={x:t.clientX,y:t.clientY};0!==e&&e%4.000244140625==0&&(e=Math.floor(e/4.000244140625)),t.shiftKey&&e&&(e*=.25),this._onWheel(t,-e,n)}_onWheel(t,e,n){this.callback({type:ek,center:n,delta:e,srcEvent:t,pointerType:"mouse",target:t.target})}}const{MOUSE_EVENTS:eD}=ey,eC="pointermove",eR="pointerover",eA="pointerout",eI="pointerleave";class eL{constructor(t,e,n={}){this.element=t,this.callback=e,this.pressed=!1,this.options=Object.assign({enable:!0},n),this.enableMoveEvent=this.options.enable,this.enableLeaveEvent=this.options.enable,this.enableOutEvent=this.options.enable,this.enableOverEvent=this.options.enable,this.events=eD.concat(n.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(e=>t.addEventListener(e,this.handleEvent))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,e){t===eC&&(this.enableMoveEvent=e),t===eR&&(this.enableOverEvent=e),t===eA&&(this.enableOutEvent=e),t===eI&&(this.enableLeaveEvent=e)}handleEvent(t){this.handleOverEvent(t),this.handleOutEvent(t),this.handleLeaveEvent(t),this.handleMoveEvent(t)}handleOverEvent(t){this.enableOverEvent&&"mouseover"===t.type&&this.callback({type:eR,srcEvent:t,pointerType:"mouse",target:t.target})}handleOutEvent(t){this.enableOutEvent&&"mouseout"===t.type&&this.callback({type:eA,srcEvent:t,pointerType:"mouse",target:t.target})}handleLeaveEvent(t){this.enableLeaveEvent&&"mouseleave"===t.type&&this.callback({type:eI,srcEvent:t,pointerType:"mouse",target:t.target})}handleMoveEvent(t){if(this.enableMoveEvent)switch(t.type){case"mousedown":t.button>=0&&(this.pressed=!0);break;case"mousemove":0===t.which&&(this.pressed=!1),this.pressed||this.callback({type:eC,srcEvent:t,pointerType:"mouse",target:t.target});break;case"mouseup":this.pressed=!1}}}const{KEY_EVENTS:eN}=ey,ez="keydown",eF="keyup";class eV{constructor(t,e,n={}){this.element=t,this.callback=e,this.options=Object.assign({enable:!0},n),this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=eN.concat(n.events||[]),this.handleEvent=this.handleEvent.bind(this),t.tabIndex=n.tabIndex||0,t.style.outline="none",this.events.forEach(e=>t.addEventListener(e,this.handleEvent))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,e){t===ez&&(this.enableDownEvent=e),t===eF&&(this.enableUpEvent=e)}handleEvent(t){const e=t.target||t.srcElement;("INPUT"!==e.tagName||"text"!==e.type)&&"TEXTAREA"!==e.tagName&&(this.enableDownEvent&&"keydown"===t.type&&this.callback({type:ez,srcEvent:t,key:t.key,target:t.target}),this.enableUpEvent&&"keyup"===t.type&&this.callback({type:eF,srcEvent:t,key:t.key,target:t.target}))}}const eB="contextmenu";class eZ{constructor(t,e,n={}){this.element=t,this.callback=e,this.options=Object.assign({enable:!0},n),this.handleEvent=this.handleEvent.bind(this),t.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(t,e){t===eB&&(this.options.enable=e)}handleEvent(t){this.options.enable&&this.callback({type:eB,center:{x:t.clientX,y:t.clientY},srcEvent:t,pointerType:"mouse",target:t.target})}}const eU={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},eq={srcElement:"root",priority:0};class eH{constructor(t){this.eventManager=t,this.handlers=[],this.handlersByElement=new Map,this.handleEvent=this.handleEvent.bind(this),this._active=!1}isEmpty(){return!this._active}add(t,e,n,r=!1,i=!1){const{handlers:o,handlersByElement:a}=this;n&&("object"!=typeof n||n.addEventListener)&&(n={srcElement:n}),n=n?Object.assign({},eq,n):eq;let s=a.get(n.srcElement);s||(s=[],a.set(n.srcElement,s));const c={type:t,handler:e,srcElement:n.srcElement,priority:n.priority};r&&(c.once=!0),i&&(c.passive=!0),o.push(c),this._active=this._active||!c.passive;let u=s.length-1;for(;u>=0&&!(s[u].priority>=c.priority);)u--;s.splice(u+1,0,c)}remove(t,e){const{handlers:n,handlersByElement:r}=this;for(let i=n.length-1;i>=0;i--){const o=n[i];if(o.type===t&&o.handler===e){n.splice(i,1);const a=r.get(o.srcElement);a.splice(a.indexOf(o),1),0===a.length&&r.delete(o.srcElement)}}this._active=n.some(t=>!t.passive)}handleEvent(t){if(this.isEmpty())return;const e=this._normalizeEvent(t);let n=t.srcEvent.target;for(;n&&n!==e.rootElement;){if(this._emit(e,n),e.handled)return;n=n.parentNode}this._emit(e,"root")}_emit(t,e){const n=this.handlersByElement.get(e);if(n){let r=!1;const i=()=>{t.handled=!0},o=()=>{t.handled=!0,r=!0},a=[];for(let s=0;s{const e=this.manager.get(t);e&&eg[t].forEach(t=>{e.recognizeWith(t)})}),e.recognizerOptions){const i=this.manager.get(r);if(i){const o=e.recognizerOptions[r];delete o.enable,i.set(o)}}for(const[a,s]of(this.wheelInput=new ex(t,this._onOtherEvent,{enable:!1}),this.moveInput=new eL(t,this._onOtherEvent,{enable:!1}),this.keyInput=new eV(t,this._onOtherEvent,{enable:!1,tabIndex:e.tabIndex}),this.contextmenuInput=new eZ(t,this._onOtherEvent,{enable:!1}),this.events))s.isEmpty()||(this._toggleRecognizer(s.recognizerName,!0),this.manager.on(a,s.handleEvent))}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy(),this.wheelInput=null,this.moveInput=null,this.keyInput=null,this.contextmenuInput=null,this.manager=null,this.element=null)}on(t,e,n){this._addEventHandler(t,e,n,!1)}once(t,e,n){this._addEventHandler(t,e,n,!0)}watch(t,e,n){this._addEventHandler(t,e,n,!1,!0)}off(t,e){this._removeEventHandler(t,e)}_toggleRecognizer(t,e){const{manager:n}=this;if(!n)return;const r=n.get(t);if(r&&r.options.enable!==e){r.set({enable:e});const i=em[t];i&&!this.options.recognizers&&i.forEach(i=>{const o=n.get(i);e?(o.requireFailure(t),r.dropRequireFailure(i)):o.dropRequireFailure(t)})}this.wheelInput.enableEventType(t,e),this.moveInput.enableEventType(t,e),this.keyInput.enableEventType(t,e),this.contextmenuInput.enableEventType(t,e)}_addEventHandler(t,e,n,r,i){if("string"!=typeof t){for(const o in n=e,t)this._addEventHandler(o,t[o],n,r,i);return}const{manager:a,events:s}=this,c=eO[t]||t;let u=s.get(c);!u&&(u=new eH(this),s.set(c,u),u.recognizerName=ew[c]||c,a&&a.on(c,u.handleEvent)),u.add(t,e,n,r,i),u.isEmpty()||this._toggleRecognizer(u.recognizerName,!0)}_removeEventHandler(t,e){if("string"!=typeof t){for(const n in t)this._removeEventHandler(n,t[n]);return}const{events:r}=this,i=eO[t]||t,o=r.get(i);if(o&&(o.remove(t,e),o.isEmpty())){const{recognizerName:a}=o;let s=!1;for(const c of r.values())if(c.recognizerName===a&&!c.isEmpty()){s=!0;break}s||this._toggleRecognizer(a,!1)}}_onBasicInput(t){const{srcEvent:e}=t,n=eb[e.type];n&&this.manager.emit(n,t)}_onOtherEvent(t){this.manager.emit(t.type,t)}}function eX(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function eK(t){for(var e=1;e0),a=o&&!this.state.isHovering,s=!o&&this.state.isHovering;(r||a)&&(t.features=e,r&&r(t)),a&&e6.call(this,"onMouseEnter",t),s&&e6.call(this,"onMouseLeave",t),(a||s)&&this.setState({isHovering:o})}}function ne(t){var e=this.props,n=e.onClick,r=e.onNativeClick,i=e.onDblClick,o=e.doubleClickZoom,a=[],s=i||o;switch(t.type){case"anyclick":a.push(r),s||a.push(n);break;case"click":s&&a.push(n)}(a=a.filter(Boolean)).length&&((t=e3.call(this,t)).features=e8.call(this,t.point),a.forEach(function(e){return e(t)}))}var nn=(0,h.forwardRef)(function(t,e){var n,a,s=(0,h.useContext)(tL),c=(0,h.useMemo)(function(){return t.controller||new e0},[]),u=(0,h.useMemo)(function(){return new eY(null,{touchAction:t.touchAction,recognizerOptions:t.eventRecognizerOptions})},[]),l=(0,h.useRef)(null),p=(0,h.useRef)(null),f=(0,h.useRef)({width:0,height:0,state:{isHovering:!1,isDragging:!1}}).current;f.props=t,f.map=p.current&&p.current.getMap(),f.setState=function(e){f.state=e2(e2({},f.state),e),l.current.style.cursor=t.getCursor(f.state)};var d=!0,v=function(t,e,r){if(d){n=[t,e,r];return}var i=f.props,o=i.onViewStateChange,a=i.onViewportChange;Object.defineProperty(t,"position",{get:function(){return[0,0,tF(f.map,t)]}}),o&&o({viewState:t,interactionState:e,oldViewState:r}),a&&a(t,e,r)};(0,h.useImperativeHandle)(e,function(){return{getMap:p.current&&p.current.getMap,queryRenderedFeatures:p.current&&p.current.queryRenderedFeatures}},[]);var g=(0,h.useMemo)(function(){return e2(e2({},s),{},{eventManager:u,container:s.container||l.current})},[s,l.current]);g.onViewportChange=v,g.viewport=s.viewport||tU(f),f.viewport=g.viewport;var m=function(t){var e=t.isDragging,n=void 0!==e&&e;if(n!==f.state.isDragging&&f.setState({isDragging:n}),d){a=t;return}var r=f.props.onInteractionStateChange;r&&r(t)},b=function(){f.width&&f.height&&c.setOptions(e2(e2(e2({},f.props),f.props.viewState),{},{isInteractive:Boolean(f.props.onViewStateChange||f.props.onViewportChange),onViewportChange:v,onStateChange:m,eventManager:u,width:f.width,height:f.height}))};(0,h.useEffect)(function(){return u.setElement(l.current),u.on({pointerdown:e9.bind(f),pointermove:nt.bind(f),pointerup:e7.bind(f),pointerleave:e6.bind(f,"onMouseOut"),click:ne.bind(f),anyclick:ne.bind(f),dblclick:e6.bind(f,"onDblClick"),wheel:e6.bind(f,"onWheel"),contextmenu:e6.bind(f,"onContextMenu")}),function(){u.destroy()}},[]),tz(function(){if(n){var t;v.apply(void 0,function(t){if(Array.isArray(t))return i(t)}(t=n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||o(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}a&&m(a)}),b();var y=t.width,w=t.height,O=t.style,E=t.getCursor,_=(0,h.useMemo)(function(){return e2(e2({position:"relative"},O),{},{width:y,height:w,cursor:E(f.state)})},[O,y,w,E,f.state]);return n&&f._child||(f._child=h.createElement(tN,{value:g},h.createElement("div",{key:"event-canvas",ref:l,style:_},h.createElement(tX,r({},t,{width:"100%",height:"100%",style:null,onResize:function(t){var e=t.width,n=t.height;f.width=e,f.height=n,b(),f.props.onResize({width:e,height:n})},ref:p}))))),d=!1,f._child});nn.supported=tX.supported,nn.propTypes=e4,nn.defaultProps=e5;var nr=nn;p.string.isRequired,p.string,p.oneOf(["fill","line","symbol","circle","fill-extrusion","raster","background","heatmap","hillshade","sky"]).isRequired,p.string,p.string,p.string;var ni={captureScroll:!1,captureDrag:!0,captureClick:!0,captureDoubleClick:!0,capturePointerMove:!1},no={captureScroll:p.bool,captureDrag:p.bool,captureClick:p.bool,captureDoubleClick:p.bool,capturePointerMove:p.bool};function na(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=(0,h.useContext)(tL),n=(0,h.useRef)(null),r=(0,h.useRef)({props:t,state:{},context:e,containerRef:n}).current;return r.props=t,r.context=e,(0,h.useEffect)(function(){return function(t){var e=t.containerRef.current,n=t.context.eventManager;if(e&&n){var r={wheel:function(e){var n=t.props;n.captureScroll&&e.stopPropagation(),n.onScroll&&n.onScroll(e,t)},panstart:function(e){var n=t.props;n.captureDrag&&e.stopPropagation(),n.onDragStart&&n.onDragStart(e,t)},anyclick:function(e){var n=t.props;n.captureClick&&e.stopPropagation(),n.onNativeClick&&n.onNativeClick(e,t)},click:function(e){var n=t.props;n.captureClick&&e.stopPropagation(),n.onClick&&n.onClick(e,t)},dblclick:function(e){var n=t.props;n.captureDoubleClick&&e.stopPropagation(),n.onDoubleClick&&n.onDoubleClick(e,t)},pointermove:function(e){var n=t.props;n.capturePointerMove&&e.stopPropagation(),n.onPointerMove&&n.onPointerMove(e,t)}};return n.watch(r,e),function(){n.off(r)}}}(r)},[e.eventManager]),r}function ns(t){var e=t.instance,n=na(t),r=n.context,i=n.containerRef;return e._context=r,e._containerRef=i,e._render()}var nc=function(t){tQ(i,t);var e,n=(e=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}(),function(){var t,n=t2(i);if(e){var r=t2(this).constructor;t=Reflect.construct(n,arguments,r)}else t=n.apply(this,arguments);return t1(this,t)});function i(){var t;tc(this,i);for(var e=arguments.length,r=Array(e),o=0;o2&&void 0!==arguments[2]?arguments[2]:"x";if(null===t)return e;var r="x"===n?t.offsetWidth:t.offsetHeight;return nm(e/100*r)/r*100};function ny(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}var nw=Object.assign({},nh,{className:p.string,longitude:p.number.isRequired,latitude:p.number.isRequired,style:p.object}),nO=Object.assign({},np,{className:""});function nE(t){var e,n,r,i,o,s,c,u=(n=(e=f((0,h.useState)(null),2))[0],r=e[1],o=(i=f((0,h.useState)(null),2))[0],s=i[1],(c=na(nl(nl({},t),{},{onDragStart:nv}))).callbacks=t,c.state.dragPos=n,c.state.setDragPos=r,c.state.dragOffset=o,c.state.setDragOffset=s,(0,h.useEffect)(function(){return function(t){var e=t.context.eventManager;if(e&&t.state.dragPos){var n={panmove:function(e){return function(t,e){var n=e.props,r=e.callbacks,i=e.state,o=e.context;t.stopPropagation();var a=nf(t);i.setDragPos(a);var s=i.dragOffset;if(r.onDrag&&s){var c=Object.assign({},t);c.lngLat=nd(a,s,n,o),r.onDrag(c)}}(e,t)},panend:function(e){return function(t,e){var n=e.props,r=e.callbacks,i=e.state,o=e.context;t.stopPropagation();var a=i.dragPos,s=i.dragOffset;if(i.setDragPos(null),i.setDragOffset(null),r.onDragEnd&&a&&s){var c=Object.assign({},t);c.lngLat=nd(a,s,n,o),r.onDragEnd(c)}}(e,t)},pancancel:function(e){var n;return n=t.state,void(e.stopPropagation(),n.setDragPos(null),n.setDragOffset(null))}};return e.watch(n),function(){e.off(n)}}}(c)},[c.context.eventManager,Boolean(n)]),c),l=u.state,p=u.containerRef,d=t.children,v=t.className,g=t.draggable,m=t.style,b=l.dragPos,y=function(t){var e=t.props,n=t.state,r=t.context,i=e.longitude,o=e.latitude,a=e.offsetLeft,s=e.offsetTop,c=n.dragPos,u=n.dragOffset,l=r.viewport,h=r.map;if(c&&u)return[c[0]+u[0],c[1]+u[1]];var p=tF(h,{longitude:i,latitude:o}),d=f(l.project([i,o,p]),2),v=d[0],g=d[1];return[v+=a,g+=s]}(u),w=f(y,2),O=w[0],E=w[1],_="translate(".concat(nm(O),"px, ").concat(nm(E),"px)"),P=g?b?"grabbing":"grab":"auto",M=(0,h.useMemo)(function(){var t=function(t){for(var e=1;e0){var g=p,m=v;for(p=0;p<=1;p+=.5)d=(f=n-p*a)+a,(v=Math.max(0,u-f)+Math.max(0,d-i+u))0){var E=h,_=O;for(h=0;h<=1;h+=b)w=(y=e-h*o)+o,(O=Math.max(0,u-y)+Math.max(0,w-r+u))<_&&(_=O,E=h);h=E}return nP.find(function(t){var e=n_[t];return e.x===h&&e.y===p})||s}({x:r,y:i,anchor:o,padding:s,width:S.width,height:S.height,selfWidth:e.clientWidth,selfHeight:e.clientHeight}):o),z=(c=M.current,l=(u=f(L,3))[0],p=u[1],d=u[2],v=t.offsetLeft,g=t.offsetTop,m=t.sortByDepth,y=nb(c,-(100*(b=n_[N]).x)),w=nb(c,-(100*b.y),"y"),O={position:"absolute",transform:"\n translate(".concat(y,"%, ").concat(w,"%)\n translate(").concat(nm(l+v),"px, ").concat(nm(p+g),"px)\n "),display:void 0,zIndex:void 0},m&&(d>1||d<-1||l<0||l>S.width||p<0||p>S.height?O.display="none":O.zIndex=Math.floor((1-d)/2*1e5)),O),F=(0,h.useCallback)(function(t){_.props.onClose();var e=_.context.eventManager;e&&e.once("click",function(t){return t.stopPropagation()},t.target)},[]);return h.createElement("div",{className:"mapboxgl-popup mapboxgl-popup-anchor-".concat(N," ").concat(k),style:z,ref:M},h.createElement("div",{key:"tip",className:"mapboxgl-popup-tip",style:{borderWidth:C}}),h.createElement("div",{key:"content",ref:E,className:"mapboxgl-popup-content"},R&&h.createElement("button",{key:"close-button",className:"mapboxgl-popup-close-button",type:"button",onClick:F},"\xd7"),A))}function nT(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}nS.propTypes=nM,nS.defaultProps=nj,h.memo(nS);var nk=Object.assign({},no,{toggleLabel:p.string,className:p.string,style:p.object,compact:p.bool,customAttribution:p.oneOfType([p.string,p.arrayOf(p.string)])}),nx=Object.assign({},ni,{className:"",toggleLabel:"Toggle Attribution"});function nD(t){var e=na(t),n=e.context,r=e.containerRef,i=(0,h.useRef)(null),o=f((0,h.useState)(!1),2),s=o[0],c=o[1];(0,h.useEffect)(function(){var e,o,a,s,c,u;return n.map&&(o={customAttribution:t.customAttribution},a=n.map,s=r.current,c=i.current,(u=new(tP()).AttributionControl(o))._map=a,u._container=s,u._innerContainer=c,u._updateAttributions(),u._updateEditLink(),a.on("styledata",u._updateData),a.on("sourcedata",u._updateData),e=u),function(){return e&&void(e._map.off("styledata",e._updateData),e._map.off("sourcedata",e._updateData))}},[n.map]);var u=void 0===t.compact?n.viewport.width<=640:t.compact;(0,h.useEffect)(function(){!u&&s&&c(!1)},[u]);var l=(0,h.useCallback)(function(){return c(function(t){return!t})},[]),p=(0,h.useMemo)(function(){return function(t){for(var e=1;ea)return 1}return 0}(o.map.version,"1.6.0")>=0?2:1:2},[o.map]),n=o.viewport.bearing,r={transform:"rotate(".concat(-n,"deg)")},2===e?h.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true",style:r}):h.createElement("span",{className:"mapboxgl-ctrl-compass-arrow",style:r})))))}function nX(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}nY.propTypes=nU,nY.defaultProps=nq,h.memo(nY);var nK=Object.assign({},no,{className:p.string,style:p.object,maxWidth:p.number,unit:p.oneOf(["imperial","metric","nautical"])}),nG=Object.assign({},ni,{className:"",maxWidth:100,unit:"metric"});function n$(t){var e=na(t),n=e.context,r=e.containerRef,i=f((0,h.useState)(null),2),o=i[0],s=i[1];(0,h.useEffect)(function(){if(n.map){var t=new(tP()).ScaleControl;t._map=n.map,t._container=r.current,s(t)}},[n.map]),o&&(o.options=t,o._onMove());var c=(0,h.useMemo)(function(){return function(t){for(var e=1;et?n:t}function nv(n,t){return!rN(n,t)}function nm(n){this.b=new iM(n)}function ny(){this.b=(rF(),uF)}function nC(){this.b=(iA(),u4)}function nS(n,t){var e;nb(),e=o.b,n?function(n,t,e,r){var i=n.b[r];if(i)for(var o=0,u=i.length;o=t&&n.splice(0,t),n}function tw(n){return nz(n,15)?n:new n0(n)}function td(){try{null.a()}catch(n){return n}}function tp(n){var t;return(t=new I).d=iV+n,t.c=1,t}function t_(n,t){return nH(n)?n.eQ(t):n===t}function tv(n,t){return n.l==t.l&&n.m==t.m&&n.h==t.h}function tm(n,t){return n.l!=t.l||n.m!=t.m||n.h!=t.h}function ty(n,t,e){return(i$=new x).l=n,i$.m=t,i$.h=e,i$}function tC(n,t){return nj(n)===nj(t)||null!=n&&t_(n,t)}function tS(n,t){throw new nf("Index: "+n+", Size: "+t)}function tM(n,t){if(!n)throw new z;this.f=t,tO(this,n)}function tx(n,t){if(!n)throw new z;this.f=t,tO(this,n)}function tB(n,t,e,r){eJ.call(this,n,t,e),is(this,r)}function tA(n,t){eJ.call(this,n,0,n.length),is(this,t)}function tN(n,t){eJ.call(this,t5(n),0,n.length),is(this,t)}function tI(n){nr.call(this,"String index out of range: "+n)}function tE(n,t){var e,r;return e=n.b,r=String.fromCharCode(t),e.b+=r,n}function tR(n,t){rC(n.b,n.b,n.e,t.b,t.e),tZ(n),n.c=-2}function tO(n,t){n.d=t,n.b=t.ab(),n.b<54&&(n.g=ri(eN(t)))}function tD(){tD=g,ur=[],ui=[],function(n,t,e){var r,i=0;for(var o in n)(r=n[o])&&(t[i]=o,e[i]=r,++i)}(new M,ur,ui)}function tk(){uC||(uC=!0,new j,new F,function(){if(ng(oB,iV),u.bigdecimal.BigDecimal)var n=u.bigdecimal.BigDecimal;u.bigdecimal.BigDecimal=fc(function(){1==arguments.length&&null!=arguments[0]&&arguments[0].gC()==fk?this.__gwt_instance=arguments[0]:0==arguments.length&&(this.__gwt_instance=new nw,nl(this.__gwt_instance,this))});var t=u.bigdecimal.BigDecimal.prototype={};if(n)for(p in n)u.bigdecimal.BigDecimal[p]=n[p];u.bigdecimal.BigDecimal.ROUND_CEILING=2,u.bigdecimal.BigDecimal.ROUND_DOWN=1,u.bigdecimal.BigDecimal.ROUND_FLOOR=3,u.bigdecimal.BigDecimal.ROUND_HALF_DOWN=5,u.bigdecimal.BigDecimal.ROUND_HALF_EVEN=6,u.bigdecimal.BigDecimal.ROUND_HALF_UP=4,u.bigdecimal.BigDecimal.ROUND_UNNECESSARY=7,u.bigdecimal.BigDecimal.ROUND_UP=0,u.bigdecimal.BigDecimal.__init__=fc(function(n){var t=function(n){var t,e;if(iP(),(e=iE(n))==on)t=new nL(new nG(n[0].toString()));else if("BigInteger number"==e)t=new tM(new nG(n[0].toString()),n[1]);else if("BigInteger number MathContext"==e)t=new tr(new nG(n[0].toString()),n[1],new iM(n[2].toString()));else if("BigInteger MathContext"==e)t=new n3(new nG(n[0].toString()),new iM(n[1].toString()));else if(e==oM)t=new n4(t5(n[0].toString()));else if("array number number"==e)t=new eJ(t5(n[0].toString()),n[1],n[2]);else if("array number number MathContext"==e)t=new tB(t5(n[0].toString()),n[1],n[2],new iM(n[3].toString()));else if("array MathContext"==e)t=new tA(t5(n[0].toString()),new iM(n[1].toString()));else if(e==oL)t=new ef(n[0]);else if(e==oU)t=new e_(n[0],new iM(n[1].toString()));else if(e==oH)t=new X(n[0].toString());else if("string MathContext"==e)t=new tN(n[0].toString(),new iM(n[1].toString()));else throw new nr("Unknown call signature for obj = new java.math.BigDecimal: "+e);return new nU(t)}(n);return nR(t)}),t.abs_va=fc(function(n){return nR(this.__gwt_instance.s(n))}),t.add_va=fc(function(n){return nR(this.__gwt_instance.t(n))}),t.byteValueExact=fc(function(){return this.__gwt_instance.u()}),t.compareTo=fc(function(n){return this.__gwt_instance.v(n.__gwt_instance)}),t.divide_va=fc(function(n){return nR(this.__gwt_instance.y(n))}),t.divideToIntegralValue_va=fc(function(n){return nR(this.__gwt_instance.x(n))}),t.doubleValue=fc(function(){return this.__gwt_instance.z()}),t.equals=fc(function(n){return this.__gwt_instance.eQ(n)}),t.floatValue=fc(function(){return this.__gwt_instance.A()}),t.hashCode=fc(function(){return this.__gwt_instance.hC()}),t.intValue=fc(function(){return this.__gwt_instance.B()}),t.intValueExact=fc(function(){return this.__gwt_instance.C()}),t.max=fc(function(n){return nR(this.__gwt_instance.F(n.__gwt_instance))}),t.min=fc(function(n){return nR(this.__gwt_instance.G(n.__gwt_instance))}),t.movePointLeft=fc(function(n){return nR(this.__gwt_instance.H(n))}),t.movePointRight=fc(function(n){return nR(this.__gwt_instance.I(n))}),t.multiply_va=fc(function(n){return nR(this.__gwt_instance.J(n))}),t.negate_va=fc(function(n){return nR(this.__gwt_instance.K(n))}),t.plus_va=fc(function(n){return nR(this.__gwt_instance.L(n))}),t.pow_va=fc(function(n){return nR(this.__gwt_instance.M(n))}),t.precision=fc(function(){return this.__gwt_instance.q()}),t.remainder_va=fc(function(n){return nR(this.__gwt_instance.N(n))}),t.round=fc(function(n){return nR(this.__gwt_instance.O(n.__gwt_instance))}),t.scale=fc(function(){return this.__gwt_instance.P()}),t.scaleByPowerOfTen=fc(function(n){return nR(this.__gwt_instance.Q(n))}),t.setScale_va=fc(function(n){return nR(this.__gwt_instance.R(n))}),t.shortValueExact=fc(function(){return this.__gwt_instance.S()}),t.signum=fc(function(){return this.__gwt_instance.r()}),t.stripTrailingZeros=fc(function(){return nR(this.__gwt_instance.T())}),t.subtract_va=fc(function(n){return nR(this.__gwt_instance.U(n))}),t.toBigInteger=fc(function(){return nR(this.__gwt_instance.V())}),t.toBigIntegerExact=fc(function(){return nR(this.__gwt_instance.W())}),t.toEngineeringString=fc(function(){return this.__gwt_instance.X()}),t.toPlainString=fc(function(){return this.__gwt_instance.Y()}),t.toString=fc(function(){return this.__gwt_instance.tS()}),t.ulp=fc(function(){return nR(this.__gwt_instance.Z())}),t.unscaledValue=fc(function(){return nR(this.__gwt_instance.$())}),t.divideAndRemainder_va=fc(function(n){return nO(this.__gwt_instance.w(n))}),t.longValue=fc(function(){return this.__gwt_instance.E()}),t.longValueExact=fc(function(){return this.__gwt_instance.D()}),u.bigdecimal.BigDecimal.valueOf_va=fc(function(n){var t=function(n){var t,e;if(iP(),(e=iE(n))==oL)t=function(n){if(!isFinite(n)||isNaN(n))throw new nd(oa);return new X(iV+n)}(n[0]);else if(e==oL)t=tX(e6(n[0]));else if(e==oP)t=eL(e6(n[0]),n[1]);else throw new nr("Unknown call signature for bd = java.math.BigDecimal.valueOf: "+e);return new nU(t)}(n);return nR(t)}),u.bigdecimal.BigDecimal.log=fc(function(n){iP(),typeof console!==o$&&console.log&&console.log(n)}),u.bigdecimal.BigDecimal.logObj=fc(function(n){iP(),typeof console!==o$&&console.log&&typeof JSON!==o$&&JSON.stringify&&console.log("object: "+JSON.stringify(n))}),u.bigdecimal.BigDecimal.ONE=fc(function(){var n=(iP(),new nU(uw));return nR(n)}),u.bigdecimal.BigDecimal.TEN=fc(function(){var n=(iP(),new nU(ud));return nR(n)}),u.bigdecimal.BigDecimal.ZERO=fc(function(){var n=(iP(),new nU(up));return nR(n)}),nS(fk,u.bigdecimal.BigDecimal)}())}function tL(n,t,e){var r;return(r=new I).d=n+t,r.c=4,r.b=e,r}function tU(n,t,e,r,i){var o;return tK(n,t,e,o=function(n,t){var e=Array(t);if(3==n)for(var r=0;r0)for(var i=[null,0,!1][n],r=0;rn)throw new tI(e)}(n.length,t,r),t3(n,t,r)}function tQ(n,t){return il(),t=n.c.c)throw new J;return t=n.c,r=e=n.b++,i=t.c,(r<0||r>=i)&&tS(r,i),t.b[e]}function tF(n,t){return!!nz(t,1)&&String(n)==t}function tH(){nr.call(this,"Add not supported on this collection")}function t$(){this.b=[],this.f={},this.d=!1,this.c=null,this.e=0}function tV(n,t){rW(),this.f=n,this.e=1,this.b=tK(fp,{6:1},-1,[t])}function tq(n,t){var e;return e=n.c,n.c=t,!n.d&&(n.d=!0,++n.e),e}function tG(n,t){var e,r;return e=n.b,r=String.fromCharCode.apply(null,t),e.b+=r,n}function tz(n,t,e,r){var i,o;return null==t&&(t=ok),i=n.b,o=t.substr(e,r-e),i.b+=o,n}function tJ(n,t,e,r){var i;return rC(i=tU(fp,{6:1},-1,t,1),n,t,e,r),i}function tK(n,t,e,r){return tD(),function(n,t,e){tD();for(var r=0,i=t.length;r0&&0==n.b[--n.e];);0==n.b[n.e++]&&(n.f=0)}function tX(n){return rN(n,oJ)&&nv(n,oY)?us[nB(n)]:new eu(n,0)}function tY(n,t){return 0==t||0==n.f?n:t>0?e3(n,t):rY(n,-t)}function t1(n,t){return 0==t||0==n.f?n:t>0?rY(n,t):e3(n,-t)}function t0(n){var t;return 0==n.f?-1:((t=ew(n))<<5)+es(n.b[t])}function t2(n){var t;return 0!=(t=nB(n))?es(t):es(nB(rK(n,32)))+32}function t4(n,t){var e;return 0==(e=eO(n,t)).length?(new _).o(t):tg(e,1)}function t3(n,t,e){return n=n.slice(t,e),String.fromCharCode.apply(null,n)}function t6(n,t,e,r){var i;return ib(i=tU(fp,{6:1},-1,t+1,1),n,t,e,r),i}function t5(n){var t,e;return t=tU(fK,{6:1},-1,e=n.length,1),function(n,t,e,r){var i;for(i=0;it.e&&(c=t,t=e,e=c),e.e<63)?(b=t,l=e,(_=(g=b.e)+(w=l.e),v=b.f!=l.f?-1:1,2==_)?(S=nB(y=iR(ta(e6(b.b[0]),o6),ta(e6(l.b[0]),o6))),0==(C=nB(rP(y,32)))?new tV(v,S):new to(v,2,tK(fp,{6:1},-1,[S,C]))):(eG(b.b,g,l.b,w,d=tU(fp,{6:1},-1,_,1)),tZ(m=new to(v,_,d)),m)):(f=(-2&t.e)<<4,a=t.fb(f),h=e.fb(f),i=ia(t,a.eb(f)),o=ia(e,h.eb(f)),s=n(a,h),r=n(i,o),u=(u=iS(iS(u=n(ia(a,i),ia(o,h)),s),r)).eb(f),iS(iS(s=s.eb(f<<1),u),r))}(n,t))}function ee(n,t){var e;if(t.f<=0)throw new ni(or);return(e=rH(n,t)).f<0?iS(e,t):e}function er(n){var t;t=new nJ,n.d&&n5(t,new ne(n)),function(n,t){var e=n.f;for(var r in e)if(58==r.charCodeAt(0)){var i=new nA(n,r.substring(1));t.Kb(i)}}(n,t),function(n,t){var e=n.b;for(var r in e){var i=parseInt(r,10);if(r==i)for(var o=e[i],u=0,f=o.length;u0?1:0:(n.d||(n.d=eP(n.g)),n.d).r()}function ep(n){return n.b<54?new ti(-n.g,n.f):new tx((n.d||(n.d=eP(n.g)),n.d).cb(),n.f)}function e_(n,t){if(!isFinite(n)||isNaN(n))throw new nd(oa);iQ(this,n.toPrecision(20)),is(this,t)}function ev(n,t){return isNaN(n)?isNaN(t)?0:1:isNaN(t)?-1:nt?1:0}function em(n,t){return t<2||t>36||n<0||n>=t?0:n<10?48+n&65535:97+n-10&65535}function ey(n,t){var e,r;return t?((e=t[oC])||(e=new(r=t.gC(),t7(ei(n.b,r)))(t),t[oC]=e),e):null}function eC(n){var t,e;return 32==(e=r$(n.h))?32==(t=r$(n.m))?r$(n.l)+32:t+20-10:e-12}function eS(n){return ty(4194303&n,~~n>>22&4194303,n<0?1048575:0)}function eM(){eM=g,uo=ty(4194303,4194303,524287),uu=ty(0,0,524288),uf=e6(1),e6(2),uc=e6(0)}function ex(n,t){ib(n.b,n.b,n.e,t.b,t.e),n.e=np(n_(n.e,t.e)+1,n.b.length),tZ(n),n.c=-2}function eB(n,t){var e;e=~~t>>5,n.e+=e+(r$(n.b[n.e-1])-(31&t)>=0?0:1),rS(n.b,n.b,e,31&t),tZ(n),n.c=-2}function eA(n,t){var e,r;e=~~t>>5,n.e>>r:0,tZ(n))}function eN(n){var t;return t=n.e>1?th(rU(e6(n.b[1]),32),ta(e6(n.b[0]),o6)):ta(e6(n.b[0]),o6),iR(e6(n.f),t)}function eI(n,t,e){var r;for(r=e-1;r>=0&&n[r]==t[r];--r);return r<0?0:nv(ta(e6(n[r]),o6),ta(e6(t[r]),o6))?-1:1}function eE(n,t,e){var r,i,o;for(i=0,r=0;i>>31;0!=r&&(n[e]=r)}function eR(n,t,e,r){if(iH=t,n)try{fc(iy)()}catch(i){n(t)}else fc(iy)()}function eO(n,t){var e,r,i;for(e=0,r=(i=t&&t.stack?t.stack.split("\n"):[]).length;e>5==n.e-1&&n.b[n.e-1]==1<<(31&t))for(e=0;r&&e=0&&t=0?new eu(oJ,2147483647):new eu(oJ,-2147483648)}function eP(n){return(rW(),n<0)?-1!=n?new ru(-1,-n):uS:n<=10?ux[eo(n)]:new ru(1,n)}function eQ(n){var t,e,r;return t=~n.l+1&4194303,e=~n.m+(0==t?1:0)&4194303,r=~n.h+(0==t&&0==e?1:0)&1048575,ty(t,e,r)}function eT(n){var t,e,r;t=~n.l+1&4194303,e=~n.m+(0==t?1:0)&4194303,r=~n.h+(0==t&&0==e?1:0)&1048575,n.l=t,n.m=e,n.h=r}function ej(n){var t,e,r;for(r=0,e=tU(fS,{6:1},13,n.length,0),t=n.length;r=0;--r)if(n[r]!=i[r]){e=0!=n[r]&&rA(ta(e6(n[r]),o6),ta(e6(i[r]),o6));break}}return u=new to(1,o+1,n),e&&tR(u,t),tZ(u),u}(o,e)}function eV(n,t){var e;return n===t||!!nz(t,17)&&(e=tT(t,17),n.f==e.f&&n.e==e.e&&function(n,t){var e;for(e=n.e-1;e>=0&&n.b[e]==t[e];--e);return e<0}(n,e.b))}function eq(n){var t,e;return 0==n.f?0:(t=n.e<<5,e=n.b[n.e-1],n.f<0&&ew(n)==n.e-1&&(e=~~(e-1)),t-=r$(e))}function eG(n,t,e,r,i){il(),0!=t&&0!=r&&(1==t?i[r]=rc(i,e,r,n[0]):1==r?i[t]=rc(i,n,t,e[0]):function(n,t,e,r,i){var o,u,f,c;if(nj(n)===nj(t)&&r==i){iu(n,r,e);return}for(f=0;f2147483647))return eo(n);throw new ni("Underflow")}function eW(n,t){if(rF(),n<0)throw new nu("Digits < 0");if(!t)throw new nc("null RoundingMode");this.b=n,this.c=t}function eZ(n){return(rW(),nv(n,oJ))?tm(n,oz)?new ro(-1,eQ(n)):uS:rA(n,oX)?new ro(1,n):ux[nB(n)]}function eX(n){var t;return nv(n,oJ)&&(n=ty(4194303&~n.l,4194303&~n.m,1048575&~n.h)),64-(0!=(t=nB(rK(n,32)))?r$(t):r$(nB(n))+32)}function eY(n,t){var e,r,i;return e=n.l+t.l,r=n.m+t.m+(~~e>>22),i=n.h+t.h+(~~r>>22),ty(4194303&e,4194303&r,1048575&i)}function e1(n,t){var e,r,i;return e=n.l-t.l,r=n.m-t.m+(~~e>>22),i=n.h-t.h+(~~r>>22),ty(4194303&e,4194303&r,1048575&i)}function e0(n,t){var e;if(e=t-1,n.f>0){for(;!n.gb(e);)--e;return t-1-e}for(;n.gb(e);)--e;return t-1-n_(e,n.bb())}function e2(n,t){var e;return n===t||!!nz(t,16)&&(e=tT(t,16)).f==n.f&&(n.b<54?e.g==n.g:n.d.eQ(e.d))}function e4(n,t,e){var r,i,o;for(o=oJ,r=t-1;r>=0;--r)i=r2(eY(rU(o,32),ta(e6(n[r]),o6)),e),o=e6(nB(rK(i,32)));return nB(o)}function e3(n,t){var e,r,i,o;return e=~~t>>5,t&=31,rS(r=tU(fp,{6:1},-1,i=n.e+e+(0==t?0:1),1),n.b,e,t),tZ(o=new to(n.f,i,r)),o}function e6(n){var t,e;return n>-129&&n<128?(t=n+128,null==un&&(un=tU(fR,{6:1},2,256,0)),(e=un[t])||(e=un[t]=eS(n)),e):eS(n)}function e5(n){var t,e,r;return(rW(),n>5,t=31&n,(r=tU(fp,{6:1},-1,e+1,1))[e]=1<iq&&n[n.length-1]>iq?n:n.replace(/^(\s*)/,iV).replace(/\s*$/,iV)}function e8(n){return n-=~~n>>1&1431655765,n=(~~(n=(~~n>>2&858993459)+(858993459&n))>>4)+n&252645135,n+=~~n>>8,63&(n+=~~n>>16)}function rn(n,t,e){if(null!=e){var r;if(n.qI>0&&(r=n.qI,!e.cM||!e.cM[r])||n.qI<0&&(e.tM==g||n$(e,1)))throw new V}return n[t]=e}function rt(n,t){return n.f>t.f?1:n.ft.e?n.f:n.e=0;--o)u=e$(u,u,r,i),(e.b[~~o>>5]&1<<(31&o))!=0&&(u=e$(u,t,r,i));return u}(f,r,t,e,o):function(n,t,e,r,i){var o,u,f,c,s,a,h;for(s=tU(f9,{6:1},17,8,0),a=n,rn(s,0,t),h=e$(t,t,r,i),u=1;u<=7;++u)rn(s,u,e$(s[u-1],h,r,i));for(u=e.ab()-1;u>=0;--u)if((e.b[~~u>>5]&1<<(31&u))!=0){for(c=1,o=u,f=u-3>0?u-3:0;f<=u-1;++f)(e.b[~~f>>5]&1<<(31&f))!=0&&(f>1],a,r,i),u=o}else a=e$(a,a,r,i);return a}(f,r,t,e,o),e$(u,(rW(),uM),e,o)}function ra(n,t){var e,r,i,o;for(e=0,r=n.length;e36)throw new nd("Radix out of range");if(0==n.length)throw new nd("Zero length BigInteger");(function(n,t,e){var r,i,o,u,f,c,s,a,h,b,l,g,w,d;for(s=l=t.length,45==t.charCodeAt(0)?(h=-1,b=1,--l):(h=1,b=0),o=~~(l/(u=(ix(),uP)[e])),0!=(d=l%u)&&++o,c=tU(fp,{6:1},-1,o,1),r=uU[e-2],f=0,g=b+(0==d?u:d),w=b;wr)return 1;if(e=0&&n[i]==t[i];--i);return i<0?0:nv(ta(e6(n[i]),o6),ta(e6(t[i]),o6))?-1:1}function rg(n,t){var e,r,i;for(r=tU(fp,{6:1},-1,i=n.e,1),np(ew(n),ew(t)),e=0;e999999999)throw new ni(oh);return e=n.f*t,0==n.b&&-1!=n.g?eU(e):new tM((n.d||(n.d=eP(n.g)),n.d).db(t),eK(e))}function rp(n,t){return t<2||t>36?-1:n>=48&&n<48+(t<10?t:10)?n-48:n>=97&&n=65&&n=0;--n)fu[n]=e,e*=.5;for(n=24,t=1;n>=0;--n)fo[n]=t,t*=.5}function rv(){rv=g,uO=tK(fK,{6:1},-1,[48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122])}function rm(n){var t;return 0!=n.c?n.c:n.b<54?(t=r4(n.g),n.c=nB(ta(t,oz)),n.c=33*n.c+nB(ta(rK(t,32),oz)),n.c=17*n.c+eo(n.f),n.c):(n.c=17*n.d.hC()+eo(n.f),n.c)}function ry(n,t,e,r){var i,o,u,f,c;return o=(c=n/t)>0?Math.floor(c):Math.ceil(c),u=n%t,f=ev(n*t,0),0!=u&&(i=ev((u<=0?0-u:u)*2,t<=0?0-t:t),o+=it(1&eo(o),f*(5+i),r)),new ti(o,e)}function rC(n,t,e,r,i){var o,u;for(u=0,o=oJ;ue;--i)n[i]|=~~t[i-e-1]>>>o,n[i-1]=t[i-e-1]<>5,n.e-=r,!rD(n.b,n.e,n.b,r,31&t)&&i<0){for(e=0;e>19,r=~~t.h>>19,0==e?0!=r||n.h>t.h||n.h==t.h&&n.m>t.m||n.h==t.h&&n.m==t.m&&n.l>t.l:!(0==r||n.h>19,r=~~t.h>>19,0==e?0!=r||n.h>t.h||n.h==t.h&&n.m>t.m||n.h==t.h&&n.m==t.m&&n.l>=t.l:!(0==r||n.h-140737488355328&&n<0x800000000000?0==n?0:((t=n<0)&&(n=-n),e=eo(nP(Math.log(n)/.6931471805599453)),(!t||n!=Math.pow(2,e))&&++e,e):eX(r4(n))}function rR(n,t){var e,r;return(e=n._(),r=t._(),0==e.r())?r:0==r.r()?e:(1==e.e||2==e.e&&e.b[1]>0)&&(1==r.e||2==r.e&&r.b[1]>0)?eZ(rI(eN(e),eN(r))):function(n,t){var e,r,i;e=n.bb(),r=t.bb(),rB(n,e),rB(t,r),1==rt(n,t)&&(i=n,n=t,t=i);do{if(1==t.e||2==t.e&&t.b[1]>0){t=eZ(rI(eN(n),eN(t)));break}if(t.e>1.2*n.e)0!=(t=rH(t,n)).r()&&rB(t,t.bb());else do tR(t,n),rB(t,t.bb());while(rt(t,n)>=0)i=t,t=n,n=i}while(0!=i.f)return t.eb(e=r?eB(f,i):(rB(c,r-e0&&eB(f,i-r+e)),e+=i),0!=(i=e0(h,u))&&(eB(h,i),r>=e?eB(c,i):(rB(f,e-r0&&eB(c,i-e+r)),r+=i),s.r()==h.r()?e<=r?(rq(s,h),rq(f,c)):(rq(h,s),rq(c,f)):e<=r?(rV(s,h),rV(f,c)):(rV(h,s),rV(c,f)),0==h.r()||0==s.r())throw new ni(oe);return eD(h,r)&&(f=c,h.r()!=s.r()&&(s=s.cb())),s.gb(u)&&(f=0>f.r()?f.cb():ia(t,f)),0>f.r()&&(f=iS(f,t)),f}(n,t);for(o=32*t.e,h=eb(t),u=n_((b=eb(n)).e,h.e),c=new to(1,1,tU(fp,{6:1},-1,u+1,1)),(s=new to(1,1,tU(fp,{6:1},-1,u+1,1))).b[0]=1,e=0,(r=h.bb())>(i=b.bb())?(rB(h,r),rB(b,i),eB(c,i),e+=r-i):(rB(h,r),rB(b,i),eB(s,r),e+=i-r),c.f=1;b.r()>0;){for(;rt(h,b)>0;)tR(h,b),a=h.bb(),rB(h,a),ex(c,s),eB(s,a),e+=a;for(;0>=rt(h,b)&&(tR(b,h),0!=b.r());)a=b.bb(),rB(b,a),ex(s,c),eB(c,a),e+=a}if(!(1==h.e&&1==h.b[0]))throw new ni(oe);return rt(c,t)>=0&&tR(c,t),c=ia(t,c),f=rf(t),e>o&&(c=e$(c,(rW(),uM),t,f),e-=o),c=e$(c,e5(o-e),t,f)}(ee(n._(),t),t)).f)throw new ni(oe);return n.f<0?ia(t,e):e}function rD(n,t,e,r,i){var o,u,f;for(u=0,o=!0;u>>i|e[u+r+1]<>>i,++u}return o}function rk(n,t){var e;return(e=n.f+t.f,0==n.b&&-1!=n.g||0==t.b&&-1!=t.g)?eU(e):n.b+t.b<54?new ti(n.g*t.g,eK(e)):new tM(et((n.d||(n.d=eP(n.g)),n.d),(t.d||(t.d=eP(t.g)),t.d)),eK(e))}function rL(n,t){var e;if(t<0)throw new ni("Negative exponent");if(0==t)return uM;if(1==t||n.eQ(uM)||n.eQ(uA))return n;if(!n.gb(0)){for(e=1;!n.gb(e);)++e;return et(e5(e*t),n.fb(e).db(t))}return function(n,t){var e,r;for(il(),rW(),r=uM,e=n;t>1;t>>=1)(1&t)!=0&&(r=et(r,e)),e=1==e.e?et(e,e):new e9(iu(e.b,e.e,tU(fp,{6:1},-1,e.e<<1,1)));return et(r,e)}(n,t)}function rU(n,t){var e,r,i;return(t&=63)<22?(e=n.l<>22-t,i=n.h<>22-t):t<44?(e=0,r=n.l<>44-t):(e=0,r=0,i=n.l<>>t,i=~~n.m>>t|e<<22-t,r=~~n.l>>t|n.m<<22-t):t<44?(o=0,i=~~e>>>t-22,r=~~n.m>>t-22|n.h<<44-t):(o=0,i=0,r=~~e>>>t-44),ty(4194303&r,4194303&i,1048575&o)}function rQ(n){switch(iA(),n){case 2:return uX;case 1:return uY;case 3:return u1;case 5:return u0;case 6:return u2;case 4:return u4;case 7:return u3;case 0:return u6;default:throw new nu("Invalid rounding mode")}}function rT(n,t){var e,r,i;if(0==t)return(1&n.b[0])!=0;if(t<0)throw new ni(ol);if((i=~~t>>5)>=n.e)return n.f<0;if(e=n.b[i],t=1<<(31&t),n.f<0){if(i<(r=ew(n)))return!1;e=r==i?-e:~e}return(e&t)!=0}function rj(n){var t,e;return n.e>0||(t=1,e=1,n.b<54?(n.b>=1&&(e=n.g),t+=Math.log(e<=0?0-e:e)*Math.LOG10E):(t+=(n.b-1)*.3010299956639812,0!=ih((n.d||(n.d=eP(n.g)),n.d),im(t)).r()&&++t),n.e=eo(t)),n.e}function rF(){rF=g,uQ=new eW(34,(iA(),u2)),uT=new eW(7,u2),uj=new eW(16,u2),uF=new eW(0,u4),uH=tK(fK,{6:1},-1,[112,114,101,99,105,115,105,111,110,61]),u$=tK(fK,{6:1},-1,[114,111,117,110,100,105,110,103,77,111,100,101,61])}function rH(n,t){var e,r,i,o;if(0==t.f)throw new ni(ot);return((o=n.e)!=(e=t.e)?o>e?1:-1:eI(n.b,t.b,o))==-1?n:(r=tU(fp,{6:1},-1,e,1),1==e?r[0]=e4(n.b,o,t.b[0]):r=iL(null,o-e+1,n.b,o,t.b,e),tZ(i=new to(n.f,e,r)),i)}function r$(n){var t,e,r;return n<0?0:0==n?32:(e=16-(t=~~(r=-(~~n>>16))>>16&16),e+=t=~~(r=(n=~~n>>t)-256)>>16&8,n<<=t,e+=t=~~(r=n-4096)>>16&4,n<<=t,e+=t=~~(r=n-16384)>>16&2,n<<=t,e+2-(t=(r=~~n>>14)&~(~~r>>1)))}function rV(n,t){if(0==n.f)iB(t.b,0,n.b,0,t.e);else{if(0==t.f)return;n.f==t.f?ib(n.b,n.b,n.e,t.b,t.e):rl(n.b,t.b,n.e,t.e)>0?rC(n.b,n.b,n.e,t.b,t.e):(r9(n.b,n.b,n.e,t.b,t.e),n.f=-n.f)}n.e=n_(n.e,t.e)+1,tZ(n),n.c=-2}function rq(n,t){var e;e=rt(n,t),0==n.f?(iB(t.b,0,n.b,0,t.e),n.f=-t.f):n.f!=t.f?(ib(n.b,n.b,n.e,t.b,t.e),n.f=e):rl(n.b,t.b,n.e,t.e)>0?rC(n.b,n.b,n.e,t.b,t.e):(r9(n.b,n.b,n.e,t.b,t.e),n.f=-n.f),n.e=n_(n.e,t.e)+1,tZ(n),n.c=-2}function rG(n,t,e){var r,i,o,u,f,c,s,a,h,b;if(e.f<=0)throw new ni(or);return(r=n,(1==e.e&&1==e.b[0])|t.f>0&0==r.f)?uA:0==r.f&&0==t.f?uM:(t.f<0&&(r=rO(n,e),t=t.cb()),i=e.gb(0)?rs(r._(),t,e):(o=r._(),u=t,f=e.bb(),a=rs(o,u,c=e.fb(f)),h=function(n,t,e){var r,i,o,u,f;for(rW(),u=uM,i=eb(t),r=eb(n),n.gb(0)&&eA(i,e-1),eA(r,e),o=i.ab()-1;o>=0;--o)eA(f=eb(u),e),u=et(u,f),(i.b[~~o>>5]&1<<(31&o))!=0&&eA(u=et(u,r),e);return eA(u,e),u}(o,u,f),s=function(n,t){var e,r,i,o;for(e=1,(r=new e9(tU(fp,{6:1},-1,1<>5]&1<<(31&o))!=0&&(r.b[~~e>>5]|=1<<(31&e));return r}(c,f),eA(b=et(ia(h,a),s),f),b.f<0&&(b=iS(b,e5(f))),iS(a,et(c,b))),r.f<0&&t.gb(0)&&(i=ee(et(ia(e,uM),i),e)),i)}function rz(n,t){var e,r,i,o,u,f,c;if(i=ew(n),(r=ew(t))>=n.e)return rW(),uA;for(u=tU(fp,{6:1},-1,f=n.e,1),(e=i>r?i:r)==r&&(u[e]=-t.b[e]&n.b[e],++e),o=np(t.e,n.e);e=t.e)for(;e0?t:0):t>=0?n.b<54?new ti(n.g,eK(t)):new tM((n.d||(n.d=eP(n.g)),n.d),eK(t)):-t>t,o=~~n.m>>t|e<<22-t,i=~~n.l>>t|n.m<<22-t):t<44?(u=r?1048575:0,o=~~e>>t-22,i=~~n.m>>t-22|e<<44-t):(u=r?1048575:0,o=r?4194303:0,i=~~e>>t-44),ty(4194303&i,4194303&o,1048575&u)}function rW(){var n;for(n=0,rW=g,uM=new tV(1,1),uB=new tV(1,10),uA=new tV(0,0),uS=new tV(-1,1),ux=tK(f9,{6:1},17,[uA,uM,new tV(1,2),new tV(1,3),new tV(1,4),new tV(1,5),new tV(1,6),new tV(1,7),new tV(1,8),new tV(1,9),uB]),uN=tU(f9,{6:1},17,32,0);n=t.e)return t;if(r>=n.e)return n;if(o=tU(fp,{6:1},-1,u=np(n.e,t.e),1),r==i)o[i]=-(-n.b[i]|-t.b[i]),e=i;else{for(e=r;e>5,t&=31,r>=n.e)return n.f<0?(rW(),uS):(rW(),uA);if(rD(i=tU(fp,{6:1},-1,(o=n.e-r)+1,1),o,n.b,r,t),n.f<0){for(e=0;e0&&n.b[e]<<32-t!=0){for(e=0;e0?r=0)return n;return 0!=e?e>0?rM(n,t,e):rM(t,n,-e):n_(n.b,t.b)+1<54?new ti(n.g+t.g,n.f):new tx(iS((n.d||(n.d=eP(n.g)),n.d),(t.d||(t.d=eP(t.g)),t.d)),n.f)}function r2(n,t){var e,r,i,o,u;return(r=ta(e6(t),o6),rN(n,oJ))?(o=iI(n,r,!1),u=n6(n,r)):(o=iI(e=rP(n,1),i=e6(~~t>>>1),!1),u=eY(rU(u=n6(e,i),1),ta(n,oK)),(1&t)!=0&&(rA(o,u)?rA(e1(o,u),r)?(u=eY(u,e1(rU(r,1),o)),o=e1(o,oW)):(u=eY(u,e1(r,o)),o=e1(o,oK)):u=e1(u,o))),th(rU(u,32),ta(o,o6))}function r4(n){var t,e,r,i;return isNaN(n)?(eM(),uc):n<-0x8000000000000000?(eM(),uu):n>=0x7fffffffffffffff?(eM(),uo):(r=!1,n<0&&(r=!0,n=-n),e=0,n>=17592186044416&&(e=eo(n/17592186044416),n-=17592186044416*e),t=0,n>=4194304&&(t=eo(n/4194304),n-=4194304*t),i=ty(eo(n),t,e),r&&eT(i),i)}function r3(n){var t,e,r,i;if(0==n.l&&0==n.m&&0==n.h)return iW;if(524288==n.h&&0==n.m&&0==n.l)return"-9223372036854775808";if(~~n.h>>19!=0)return iJ+r3(eQ(n));for(e=n,r=iV;!(0==e.l&&0==e.m&&0==e.h);){if(e=iI(e,e6(1e9),!0),t=iV+nB(o8),!(0==e.l&&0==e.m&&0==e.h))for(i=9-t.length;i>0;--i)t=iW+t;r=t+r}return r}function r6(n,t){var e,r,i,o,u,f,c,s,a,h,b,l,g,w,d,_,v,m,y,C,S,M,x;if(0==(i=t.f))throw new ni(ot);return(r=t.e,e=t.b,1==r)?(l=e[0],(S=n.b,M=n.e,x=n.f,1==M)?(d=iI(g=ta(e6(S[0]),o6),w=ta(e6(l),o6),!1),v=n6(g,w),x!=i&&(d=eQ(d)),x<0&&(v=eQ(v)),tK(f9,{6:1},17,[eZ(d),eZ(v)])):(_=tU(fp,{6:1},-1,M,1),m=tK(fp,{6:1},-1,[ii(_,S,M,l)]),y=new to(x==i?1:-1,M,_),C=new to(x,1,m),tZ(y),tZ(C),tK(f9,{6:1},17,[y,C]))):(a=n.b,((h=n.e)!=r?h>r?1:-1:eI(a,e,h))<0)?tK(f9,{6:1},17,[uA,n]):(b=n.f,f=iL(o=tU(fp,{6:1},-1,u=h-r+1,1),u,a,h,e,r),c=new to(b==i?1:-1,u,o),s=new to(b,r,f),tZ(c),tZ(s),tK(f9,{6:1},17,[c,s]))}function r5(n){var t;if(0==n.f||0==n.b&&-1!=n.g)return n.d||(n.d=eP(n.g)),n.d;if(n.f<0)return et((n.d||(n.d=eP(n.g)),n.d),im(-n.f));if(n.f>(n.e>0?n.e:nP((n.b-1)*.3010299956639812)+1)||n.f>(n.d||(n.d=eP(n.g)),n.d).bb()||0!=(t=r6((n.d||(n.d=eP(n.g)),n.d),im(n.f)))[1].r())throw new ni(og);return t[0]}function r9(n,t,e,r,i){var o,u;if(o=oJ,e36)throw new nd("radix "+t+" out of range");for(e=(r=n.length)>0&&45==n.charCodeAt(0)?1:0;e2147483647)throw new nd(os+n+iG);return i}function r8(n){var t,e;if(0==n.f)return rW(),uS;if(eV(n,(rW(),uS)))return uA;if(e=tU(fp,{6:1},-1,n.e+1,1),n.f>0){if(-1!=n.b[n.e-1])for(t=0;-1==n.b[t];++t);else{for(t=0;t0?0==t?0:t<0?-1:1:0;break;case 3:r=(0==t?0:t<0?-1:1)<0?0==t?0:t<0?-1:1:0;break;case 4:(t<0?-t:t)>=5&&(r=0==t?0:t<0?-1:1);break;case 5:(t<0?-t:t)>5&&(r=0==t?0:t<0?-1:1);break;case 6:(t<0?-t:t)+n>5&&(r=0==t?0:t<0?-1:1)}return r}function ie(n,t){var e,r,i,o,u,f,c,s,a;if(s=0==n.f?1:n.f,u=~~t>>5,e=31&t,f=tU(fp,{6:1},-1,c=n_(u+1,n.e)+1,1),r=1<=n.e)f[u]=r;else if(u>(i=ew(n)))f[u]^=r;else if(u=0||0==s.f||1==s.e&&1==s.b[0])if(!(1==(a=rG(s,f,n)).e&&1==a.b[0]||a.eQ(u))){for(i=1;i=0;--f)rN(a=th(rU(s,32),ta(e6(t[f]),o6)),oJ)?(c=iI(a,o,!1),s=n6(a,o)):(c=iI(i=rP(a,1),u=e6(~~r>>>1),!1),s=eY(rU(s=n6(i,u),1),ta(a,oK)),(1&r)!=0&&(rA(c,s)?rA(e1(c,s),o)?(s=eY(s,e1(rU(o,1),c)),c=e1(c,oW)):(s=eY(s,e1(o,c)),c=e1(c,oK)):s=e1(s,c))),n[f]=nB(ta(c,o6));return nB(s)}function io(n,t){var e,r,i,o,u,f,c;if(u=tU(fp,{6:1},-1,f=n_(n.e,t.e),1),i=ew(n),e=r=ew(t),i==r)u[r]=-n.b[r]^-t.b[r];else{for(u[r]=-t.b[r],o=np(t.e,i),++e;et.g?1:0:(r=n.f-t.f,(e=(n.e>0?n.e:nP((n.b-1)*.3010299956639812)+1)-(t.e>0?t.e:nP((t.b-1)*.3010299956639812)+1))>r+1)?i:e0&&(u=et(u,im(r))),rt(o,u))}function is(n,t){var e,r,i,o,u,f,c,s,a,h,b,l,g;if(o=t.b,!((n.e>0?n.e:nP((n.b-1)*.3010299956639812)+1)-o<0||0==o||(r=n.q()-o)<=0)){if(n.b<54){c=n,l=r4(ul[r]),b=e1(r4(c.f),e6(r)),h=iI(g=r4(c.g),l,!1),tm(a=n6(g,l),oJ)&&(s=tv(e1(rU(nv(a,oJ)?eQ(a):a,1),l),oJ)?0:nv(e1(rU(nv(a,oJ)?eQ(a):a,1),l),oJ)?-1:1,h=eY(h,e6(it(1&nB(h),(tv(a,oJ)?0:nv(a,oJ)?-1:1)*(5+s),t.c))),tn(ri(nv(h,oJ)?eQ(h):h))>=t.b&&(h=nQ(h,oX),b=e1(b,oK))),c.f=eK(ri(b)),c.e=t.b,c.g=ri(h),c.b=eX(h),c.d=null;return}f=im(r),i=r6((n.d||(n.d=eP(n.g)),n.d),f),u=n.f-r,0!=i[1].r()&&(e=rt(eH(i[1]._()),f),0!=(e=it(i[0].gb(0)?1:0,i[1].r()*(5+e),t.c))&&rn(i,0,iS(i[0],eZ(e6(e)))),new nL(i[0]).q()>o&&(rn(i,0,ih(i[0],(rW(),uB))),--u)),n.f=eK(u),n.e=o,tO(n,i[0])}}function ia(n,t){var e,r,i,o,u,f,c,s,a,h;if(u=n.f,0==(c=t.f))return n;if(0==u)return t.cb();if((o=n.e)+(f=t.e)==2)return e=ta(e6(n.b[0]),o6),r=ta(e6(t.b[0]),o6),u<0&&(e=eQ(e)),c<0&&(r=eQ(r)),eZ(e1(e,r));if(-1==(i=o!=f?o>f?1:-1:eI(n.b,t.b,o)))h=-c,a=u==c?tJ(t.b,f,n.b,o):t6(t.b,f,n.b,o);else if(h=u,u==c){if(0==i)return rW(),uA;a=tJ(n.b,o,t.b,f)}else a=t6(n.b,o,t.b,f);return tZ(s=new to(h,a.length,a)),s}function ih(n,t){var e,r,i,o,u,f,c,s,a;if(0==t.f)throw new ni(ot);return(i=t.f,1==t.e&&1==t.b[0])?t.f>0?n:n.cb():(s=n.f,(c=n.e)+(r=t.e)==2)?(a=nQ(ta(e6(n.b[0]),o6),ta(e6(t.b[0]),o6)),s!=i&&(a=eQ(a)),eZ(a)):0==(e=c!=r?c>r?1:-1:eI(n.b,t.b,c))?s==i?uM:uS:-1==e?uA:(o=tU(fp,{6:1},-1,u=c-r+1,1),1==r?ii(o,n.b,c,t.b[0]):iL(o,u,n.b,c,t.b,r),tZ(f=new to(s==i?1:-1,u,o)),f)}function ib(n,t,e,r,i){var o,u;if(o=eY(ta(e6(t[0]),o6),ta(e6(r[0]),o6)),n[0]=nB(o),o=rK(o,32),e>=i){for(u=1;u0){if(i0?u=tQ(u,eo(i)):i<0&&(o=tQ(o,eo(-i))),id(o,u,e,r)}function iw(n,t){var e,r,i,o,u,f,c;if(r=ew(t),(i=ew(n))>=t.e)return t;if(u=tU(fp,{6:1},-1,f=t.e,1),rt.ab()?(c=eN(s),o=eN(t),i=tv(e1(rU(nv(c,oJ)?eQ(c):c,1),nv(o,oJ)?eQ(o):o),oJ)?0:nv(e1(rU(nv(c,oJ)?eQ(c):c,1),nv(o,oJ)?eQ(o):o),oJ)?-1:1,i=it(f.gb(0)?1:0,a*(5+i),r)):(i=rt(eH(s._()),t._()),i=it(f.gb(0)?1:0,a*(5+i),r)),0!=i){if(54>f.ab())return eL(eY(eN(f),e6(i)),e);f=iS(f,eZ(e6(i)))}return new tM(f,e)}function ip(n){var t,e,r,i,o,u;return null!=n.i?n.i:n.b<32?(n.i=function(n,t){var e,r,i,o,u,f,c,s,a,h,b,l,g,w,d,_,v,m;if(ix(),(u=nv(n,oJ))&&(n=eQ(n)),tv(n,oJ))switch(t){case 0:return iW;case 1:return iX;case 2:return iY;case 3:return i1;case 4:return i0;case 5:return i2;case 6:return i4;default:return s=new W,t<0?s.b.b+=i6:s.b.b+=i3,b=s.b,l=-2147483648==t?"2147483648":iV+-t,b.b+=l,s.b.b}c=tU(fK,{6:1},-1,19,1),e=18,h=n;do f=h,h=nQ(h,oX),c[--e]=65535&nB(eY(o0,e1(f,iR(h,oX))));while(tm(h,oJ))if(r=e1(e1(e1(o1,e6(e)),e6(t)),oK),0==t)return u&&(c[--e]=45),tP(c,e,18-e);if(t>0&&rN(r,oG)){if(rN(r,oJ)){for(o=17,i=e+nB(r);o>=i;--o)c[o+1]=c[o];return c[++i]=46,u&&(c[--e]=45),tP(c,e,18-e+1)}for(o=2;nv(e6(o),eY(eQ(r),oK));++o)c[--e]=48;return c[--e]=46,c[--e]=48,u&&(c[--e]=45),tP(c,e,18-e)}return(a=e+1,s=new Z,u&&(s.b.b+=iJ),18-a>=1)?(tE(s,c[e]),s.b.b+=iK,g=s.b,w=tP(c,e+1,18-e-1),g.b+=w):(d=s.b,_=tP(c,e,18-e),d.b+=_),s.b.b+=oc,rA(r,oJ)&&(s.b.b+=iz),v=s.b,m=iV+r3(r),v.b+=m,s.b.b}(r4(n.g),eo(n.f)),n.i):(i=iF((n.d||(n.d=eP(n.g)),n.d),0),0==n.f)?i:(t=0>(n.d||(n.d=eP(n.g)),n.d).r()?2:1,e=i.length,r=-n.f+e-t,u=(o=new W).b,u.b+=i,n.f>0&&r>=-6?r>=0?n7(o,e-eo(n.f),iK):(te(o.b,t-1,t-1,iZ),n7(o,t+1,tP(ua,0,-eo(r)-1))):(e-t>=1&&(te(o.b,t,t,iK),++e),te(o.b,e,e,oc),r>0&&n7(o,++e,iz),n7(o,++e,iV+r3(r4(r)))),n.i=o.b.b,n.i)}function i_(n,t){var e,r,i,o,u,f;if(i=ew(n),o=ew(t),i>=t.e)return n;if(r=o>i?o:i,0==(e=o>i?-t.b[r]&~n.b[r]:o0){i[o]=u;break}i[o]=u.substring(0,c.index),u=u.substring(c.index+c[0].length,u.length),r.lastIndex=0,f==u&&(i[o]=u.substring(0,1),u=u.substring(1)),f=u,o++}if(0==e&&n.length>0){for(var s=i.length;s>0&&i[s-1]==iV;)--s;s1e6)throw new ni("power of ten too big");if(n<=2147483647)return uV[1].db(t).eb(t);for(i=r=uV[1].db(2147483647),e=r4(n-2147483647),t=eo(n%2147483647);rA(e,o3);)i=et(i,r),e=e1(e,o3);for(i=(i=et(i,uV[1].db(t))).eb(2147483647),e=r4(n-2147483647);rA(e,o3);)i=i.eb(2147483647),e=e1(e,o3);return i.eb(t)}function iy(){var n,t;c&&rx("com.iriscouch.gwtapp.client.BigDecimalApp"),nZ(new K),nY(new j),nX(new F),tk(new H),c&&rx("com.google.gwt.user.client.UserAgentAsserter"),n=-1!=(t=r.userAgent.toLowerCase()).indexOf(oT)?oT:-1!=t.indexOf("webkit")||function(){if(-1!=t.indexOf("chromeframe"))return!0;if(typeof e.ActiveXObject!=o$)try{var n=new ActiveXObject("ChromeTab.ChromeFrame");if(n)return n.registerBhoIfNeeded(),!0}catch(r){}return!1}()?oF:-1!=t.indexOf(oD)&&f.documentMode>=9?"ie9":-1!=t.indexOf(oD)&&f.documentMode>=8?"ie8":!function(){var n=/msie ([0-9]+)\.([0-9]+)/.exec(t);if(n&&3==n.length)return 1e3*parseInt(n[1])+parseInt(n[2])>=6e3}()?-1!=t.indexOf("gecko")?"gecko1_8":"unknown":"ie6",tF(oF,n)||u.alert("ERROR: Possible problem with your *.gwt.xml module file.\nThe compile time user.agent value (safari) does not match the runtime user.agent value ("+n+"). Expect more errors.\n"),c&&rx("com.google.gwt.user.client.DocumentModeAsserter"),function(){var n,t,e;for(e=0,t=f.compatMode,n=tK(fI,{6:1},1,[oo]);e>5,this.b=tU(fp,{6:1},-1,this.e,1);u=2147483648&&(r-=4294967296),r));this.b[this.e-1]>>>=31&-n,tZ(this)}}function iS(n,t){var e,r,i,o,u,f,c,s,a,h,b,l;if(u=n.f,c=t.f,0==u)return t;if(0==c)return n;if((o=n.e)+(f=t.e)==2)return(e=ta(e6(n.b[0]),o6),r=ta(e6(t.b[0]),o6),u==c)?(l=nB(s=eY(e,r)),0==(b=nB(rP(s,32)))?new tV(u,l):new to(u,2,tK(fp,{6:1},-1,[l,b]))):eZ(u<0?e1(r,e):e1(e,r));if(u==c)h=u,a=o>=f?t6(n.b,o,t.b,f):t6(t.b,f,n.b,o);else{if(0==(i=o!=f?o>f?1:-1:eI(n.b,t.b,o)))return rW(),uA;1==i?(h=u,a=tJ(n.b,o,t.b,f)):(h=c,a=tJ(t.b,f,n.b,o))}return tZ(s=new to(h,a.length,a)),s}function iM(n){var t,e,r,i;if(rF(),null==n)throw new nc("null string");if((t=t5(n)).length<27||t.length>45)throw new nu(ox);for(r=0;rfe.length)throw new q;if(o=null,i=null,67==r[0]?(i=uX,o=u5):68==r[0]?(i=uY,o=u9):70==r[0]?(i=u1,o=u7):72==r[0]?e>6&&(68==r[5]?(i=u0,o=u8):69==r[5]?(i=u2,o=fn):85==r[5]&&(i=u4,o=ft)):85==r[0]&&(80==r[1]?(i=u6,o=fr):78==r[1]&&(i=u3,o=fe)),i&&e==o.length){for(t=1;tl||r+i>s)throw new G;if(((1&h.c)==0||(4&h.c)!=0)&&b!=c){if(a=tT(n,11),o=tT(e,11),nj(n)===nj(e)&&tr;)rn(o,f,a[--t]);else for(f=r+i;ra.r()&&(s=s.cb()),c=eK(e+(o>u?o:u)),s=(i=o-u)>0?(il(),i>19!=0&&(t=eQ(t),c=!0),u=((b=(a=t).l)&b-1)!=0||((l=a.m)&l-1)!=0||((h=a.h)&h-1)!=0||0==h&&0==l&&0==b?-1:0==h&&0==l&&0!=b?es(b):0==h&&0!=l&&0==b?es(l)+22:0!=h&&0==l&&0==b?es(h)+44:-1,o=!1,i=!1,r=!1,524288==n.h&&0==n.m&&0==n.l){if(i=!0,o=!0,-1!=u)return f=rK(n,u),c&&eT(f),e&&(o8=ty(0,0,0)),f;n=nT((eM(),uo)),r=!0,c=!c}else~~n.h>>19!=0&&(o=!0,n=eQ(n),r=!0,c=!c);return -1!=u?(g=n,w=c,d=o,_=rK(g,u),w&&eT(_),e&&(v=g,u<=22?(m=v.l&(1<=0&&((w=(b=n).h-u.h)<0||(l=b.l-u.l,(w+=~~(g=b.m-u.m+(~~l>>22))>>22)<0||(b.l=4194303&l,b.m=4194303&g,b.h=1048575&w,0))||(c<22?f.l|=1<>>1,u.m=~~a>>>1|(1&h)<<21,u.l=~~s>>>1|(1&a)<<21,--c;return e&&eT(f),o&&(r?(o8=eQ(n),i&&(o8=e1(o8,(eM(),uf)))):o8=ty(n.l,n.m,n.h)),f}(r?n:ty(n.l,n.m,n.h),t,c,o,i,e):(e&&(o8=o?eQ(n):ty(n.l,n.m,n.h)),ty(0,0,0))}function iE(n){var t=[];for(var e in n){var r=typeof n[e];r!=oQ?t[t.length]=r:n[e]instanceof Array?t[t.length]=oM:u&&u.bigdecimal&&u.bigdecimal.BigInteger&&n[e]instanceof u.bigdecimal.BigInteger?t[t.length]=on:u&&u.bigdecimal&&u.bigdecimal.BigDecimal&&n[e]instanceof u.bigdecimal.BigDecimal?t[t.length]=i9:u&&u.bigdecimal&&u.bigdecimal.RoundingMode&&n[e]instanceof u.bigdecimal.RoundingMode?t[t.length]=ow:u&&u.bigdecimal&&u.bigdecimal.MathContext&&n[e]instanceof u.bigdecimal.MathContext?t[t.length]=ob:t[t.length]=oQ}return t.join(iq)}function iR(n,t){var e,r,i,o,u,f,c,s,a,h,b,l,g,w,d,_,v,m;return e=8191&n.l,r=~~n.l>>13|(15&n.m)<<9,i=~~n.m>>4&8191,o=~~n.m>>17|(255&n.h)<<5,u=~~(1048320&n.h)>>8,f=8191&t.l,c=~~t.l>>13|(15&t.m)<<9,s=~~t.m>>4&8191,a=~~t.m>>17|(255&t.h)<<5,h=~~(1048320&t.h)>>8,w=e*f,d=r*f,_=i*f,v=o*f,m=u*f,0!=c&&(d+=e*c,_+=r*c,v+=i*c,m+=o*c),0!=s&&(_+=e*s,v+=r*s,m+=i*s),0!=a&&(v+=e*a,m+=r*a),0!=h&&(m+=e*h),b=(4194303&w)+((511&d)<<13),l=(~~w>>22)+(~~d>>9)+((262143&_)<<4)+((31&v)<<17),g=(~~_>>18)+(~~v>>5)+((4095&m)<<8),l+=~~b>>22,b&=4194303,g+=~~l>>22,ty(b,l&=4194303,g&=1048575)}function iO(n,t,e){var r,i,o,u,f,c,s,a;if(a=ri(eY(e6(e.b),oW))+(t.e>0?t.e:nP((t.b-1)*.3010299956639812)+1)-(n.e>0?n.e:nP((n.b-1)*.3010299956639812)+1),c=i=n.f-t.f,o=1,f=um.length-1,s=tK(f9,{6:1},17,[(n.d||(n.d=eP(n.g)),n.d)]),0==e.b||0==n.b&&-1!=n.g||0==t.b&&-1!=t.g)return iN(n,t);if(a>0&&(rn(s,0,et((n.d||(n.d=eP(n.g)),n.d),im(a))),c+=a),u=(s=r6(s[0],(t.d||(t.d=eP(t.g)),t.d)))[0],0!=s[1].r())r=rt(eH(s[1]),(t.d||(t.d=eP(t.g)),t.d)),u=iS(et(u,(rW(),uB)),eZ(e6(s[0].r()*(5+r)))),++c;else for(;!u.gb(0);)if(0==(s=r6(u,um[o]))[1].r()&&c-o>=i)c-=o,o=0)return n;return 0==e?n_(n.b,t.b)+1<54?new ti(n.g-t.g,n.f):new tx(ia((n.d||(n.d=eP(n.g)),n.d),(t.d||(t.d=eP(t.g)),t.d)),n.f):e>0?e0?t.e:nP((t.b-1)*.3010299956639812)+1)+o>(n.e>0?n.e:nP((n.b-1)*.3010299956639812)+1)+1||0==n.b&&-1!=n.g)rW(),r=uA;else if(0==o)r=ih((n.d||(n.d=eP(n.g)),n.d),(t.d||(t.d=eP(t.g)),t.d));else if(o>0)u=im(o),r=ih((n.d||(n.d=eP(n.g)),n.d),et((t.d||(t.d=eP(t.g)),t.d),u)),r=et(r,u);else{for(u=im(-o),r=ih(et((n.d||(n.d=eP(n.g)),n.d),u),(t.d||(t.d=eP(t.g)),t.d));!r.gb(0);)if(0==(f=r6(r,um[e]))[1].r()&&c-e>=o)c-=e,e=0;){if(w[h]==c)s=-1;else if(s=nB(m=r2(eY(rU(ta(e6(w[h]),o6),32),ta(e6(w[h-1]),o6)),c)),v=nB(rK(m,32)),0!=s){_=!1,++s;do{if(--s,_)break;l=iR(ta(e6(s),o6),ta(e6(d[o-2]),o6)),y=eY(rU(e6(v),32),ta(e6(w[h-2]),o6)),32>r$(nB(rP(g=eY(ta(e6(v),o6),ta(e6(c),o6)),32)))?_=!0:v=nB(g)}while(rA(tb(l,oV),tb(y,oV)))}if(0!=s&&0!=function(n,t,e,r,i){var o,u,f;for(f=0,o=oJ,u=oJ;f0)rn(b,0,ih((n.d||(n.d=eP(n.g)),n.d),et((t.d||(t.d=eP(t.g)),t.d),im(o)))),h=o<(a-l+1>0?a-l+1:0)?o:a-l+1>0?a-l+1:0,rn(b,0,et(b[0],im(h)));else if(u=-o<(a-i>0?a-i:0)?-o:a-i>0?a-i:0,b=r6(et((n.d||(n.d=eP(n.g)),n.d),im(u)),(t.d||(t.d=eP(t.g)),t.d)),h+=u,u=-h,0!=b[1].r()&&u>0&&(0==(r=new nL(b[1]).q()+u-t.q())&&(rn(b,1,ih(et(b[1],im(u)),(t.d||(t.d=eP(t.g)),t.d))),r=(d=b[1].r())<0?-d:d),r>0))throw new ni(of);if(0==b[0].r())return eU(o);for(w=b[0],g=(c=new nL(b[0])).q(),f=1;!w.gb(0);)if(0==(b=r6(w,um[f]))[1].r()&&(g-f>=a||h-f>=o))g-=f,h-=f,fa)throw new ni(of);return c.f=eK(h),tO(c,w),c}function ij(){var n;for(n=0,ij=g,uJ=tK(fp,{6:1},-1,[0,0,1854,1233,927,747,627,543,480,431,393,361,335,314,295,279,265,253,242,232,223,216,181,169,158,150,145,140,136,132,127,123,119,114,110,105,101,96,92,87,83,78,73,69,64,59,54,49,44,38,32,26,1]),uK=tU(f9,{6:1},17,(uW=tK(fp,{6:1},-1,[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021])).length,0);n=0;--c)w=function(n){var t,e,r;return rN(n,oJ)?(e=nQ(n,o4),r=n6(n,o4)):(e=nQ(t=rP(n,1),o2),r=eY(rU(r=n6(t,o2),1),ta(n,oK))),th(rU(r,32),ta(e,o6))}(eY(rU(y,32),ta(e6(M[c]),o6))),M[c]=nB(w),y=e6(nB(rK(w,32)));d=nB(y),g=e;do v[--e]=48+d%10&65535;while(0!=(d=~~(d/10))&&0!=e)for(f=0,r=9-g+e;f0;++f)v[--e]=48;for(a=x-1;0==M[a];--a)if(0==a)break n;x=a+1}for(;48==v[e];)++e}if(h=C<0,o=_-e-t-1,0==t)return h&&(v[--e]=45),tP(v,e,_-e);if(t>0&&o>=-6){if(o>=0){for(s=e+o,a=_-1;a>=s;--a)v[a+1]=v[a];return v[++s]=46,h&&(v[--e]=45),tP(v,e,_-e+1)}for(a=2;a<-o+1;++a)v[--e]=48;return v[--e]=46,v[--e]=48,h&&(v[--e]=45),tP(v,e,_-e)}return(S=e+1,m=new Z,h&&(m.b.b+=iJ),_-S>=1)?(tE(m,v[e]),m.b.b+=iK,I=m.b,E=tP(v,e+1,_-e-1),I.b+=E):(R=m.b,O=tP(v,e,_-e),R.b+=O),m.b.b+=oc,o>0&&(m.b.b+=iz),D=m.b,k=iV+o,D.b+=k,m.b.b}c&&c({moduleName:"gwtapp",sessionId:s,subSystem:"startup",evtGroup:"moduleStartup",millis:new Date().getTime(),type:"moduleEvalStart"});var iH,i$,iV="",iq=" ",iG='"',iz="+",iJ="-",iK=".",iW="0",iZ="0.",iX="0.0",iY="0.00",i1="0.000",i0="0.0000",i2="0.00000",i4="0.000000",i3="0E",i6="0E+",i5=":",i9="BigDecimal",i7="BigDecimal MathContext",i8="BigDecimal;",on="BigInteger",ot="BigInteger divide by zero",oe="BigInteger not invertible.",or="BigInteger: modulus not positive",oi="BigInteger;",oo="CSS1Compat",ou="Division by zero",of="Division impossible",oc="E",os='For input string: "',oa="Infinite or NaN",oh="Invalid Operation",ob="MathContext",ol="Negative bit address",og="Rounding necessary",ow="RoundingMode",od="RoundingMode;",op="String",o_="[Lcom.iriscouch.gwtapp.client.",ov="[Ljava.lang.",om="[Ljava.math.",oy="\\.",oC="__gwtex_wrap",oS="anonymous",oM="array",ox="bad string format",oB="bigdecimal",oA="com.google.gwt.core.client.",oN="com.google.gwt.core.client.impl.",oI="com.iriscouch.gwtapp.client.",oE="java.lang.",oR="java.math.",oO="java.util.",oD="msie",ok="null",oL="number",oU="number MathContext",oP="number number",oQ="object",oT="opera",oj="org.timepedia.exporter.client.",oF="safari",oH="string",o$="undefined",oV={l:0,m:0,h:524288},oq={l:0,m:4193280,h:1048575},oG={l:4194298,m:4194303,h:1048575},oz={l:4194303,m:4194303,h:1048575},oJ={l:0,m:0,h:0},oK={l:1,m:0,h:0},oW={l:2,m:0,h:0},oZ={l:5,m:0,h:0},oX={l:10,m:0,h:0},oY={l:11,m:0,h:0},o1={l:18,m:0,h:0},o0={l:48,m:0,h:0},o2={l:877824,m:119,h:0},o4={l:1755648,m:238,h:0},o3={l:4194303,m:511,h:0},o6={l:4194303,m:1023,h:0},o5={l:0,m:1024,h:0};(i$=a.prototype={}).eQ=function(n){return this===n},i$.gC=function(){return fs},i$.hC=function(){return nF(this)},i$.tS=function(){return this.gC().d+"@"+function(n){var t,e;if(t=tU(fK,{6:1},-1,8,1),rv(),e=7,n>=0)for(;n>15;)t[e--]=uO[15&n],n>>=4;else for(;e>0;)t[e--]=uO[15&n],n>>=4;return t[e]=uO[15&n],t3(t,e,8)}(this.hC())},i$.toString=function(){return this.tS()},i$.tM=g,i$.cM={},(i$=h.prototype=new a).gC=function(){return fh},i$.j=function(){return this.f},i$.tS=function(){var n,t;return n=this.gC().d,null!=(t=this.j())?n+": "+t:n},i$.cM={6:1,15:1},i$.f=null,(i$=b.prototype=new h).gC=function(){return fb},i$.cM={6:1,15:1},(i$=nr.prototype=l.prototype=new b).gC=function(){return fl},i$.cM={6:1,12:1,15:1},(i$=n0.prototype=(function(){}).prototype=new l).gC=function(){return fg},i$.j=function(){var n,t,e,r,i;return null==this.d&&(this.e=null==(e=this.c)?ok:tt(e)?null==(r=t7(e))?null:r.name:nz(e,1)?op:(nH(e)?e.gC():fw).d,this.b=tt(n=this.c)?null==(i=t7(n))?null:i.message:n+iV,this.d="("+this.e+"): "+this.b+(tt(t=this.c)?function(n){var t=iV;try{for(var e in n)if("name"!=e&&"message"!=e&&"toString"!=e)try{t+="\n "+e+": "+n[e]}catch(r){}}catch(i){}return t}(t7(t)):iV)),this.d},i$.cM={6:1,12:1,15:1},i$.b=null,i$.c=null,i$.d=null,i$.e=null,(i$=w.prototype=new a).gC=function(){return fd};var o9=0,o7=0;(i$=d.prototype=(function(){}).prototype=new w).gC=function(){return fm},i$.b=null,i$.c=null,(i$=_.prototype=v.prototype=new a).k=function(){for(var n={},t=[],e=arguments.callee.caller.caller;e;){var r,i,o=this.n(e.toString());t.push(o);var u=i5+o,f=n[u];if(f){for(r=0,i=f.length;r0?i:oS},i$.gC=function(){return fy},i$.o=function(n){return[]},(i$=m.prototype=new v).k=function(){return tg(this.o(td()),this.p())},i$.gC=function(){return fM},i$.o=function(n){return eO(this,n)},i$.p=function(){return 2},(i$=y.prototype=(function(){}).prototype=new m).k=function(){return ea(this)},i$.n=function(n){var t,e;return 0==n.length||(0==(e=e7(n)).indexOf("at ")&&(e=n8(e,3)),-1==(t=e.indexOf("["))&&(t=e.indexOf("(")),-1==t)?oS:(-1!=(t=(e=e7(e.substr(0,t-0))).indexOf("."))&&(e=n8(e,t+1)),e.length>0?e:oS)},i$.gC=function(){return fx},i$.o=function(n){return t4(this,n)},i$.p=function(){return 3},(i$=C.prototype=new a).gC=function(){return fB},(i$=S.prototype=(function(){}).prototype=new C).gC=function(){return fA},i$.b=iV,(i$=M.prototype=(function(){}).prototype=new a).gC=function(){return this.aC},i$.aC=null,i$.qI=0;var o8=null,un=null;(i$=x.prototype=(function(){}).prototype=new a).gC=function(){return fE},i$.cM={2:1},(i$=B.prototype=new a).gC=function(){return fO},i$.cM={6:1,10:1};var ut=null;(i$=eu.prototype=ti.prototype=tx.prototype=tN.prototype=X.prototype=e_.prototype=ef.prototype=tA.prototype=tB.prototype=eJ.prototype=n4.prototype=n3.prototype=tr.prototype=tM.prototype=nL.prototype=A.prototype=new B).eQ=function(n){return e2(this,n)},i$.gC=function(){return fD},i$.hC=function(){return rm(this)},i$.q=function(){return rj(this)},i$.r=function(){return ed(this)},i$.tS=function(){return ip(this)},i$.cM={6:1,8:1,10:1,16:1},i$.b=0,i$.c=0,i$.d=null,i$.e=0,i$.f=0,i$.g=0,i$.i=null;var ue,ur,ui,uo,uu,uf,uc,us,ua,uh,ub,ul,ug,uw,ud,up,u_,uv=null,um=null,uy=null;(i$=nU.prototype=nw.prototype=(function(){}).prototype=new A).s=function(n){var t,e,r;if((e=iE(n))==iV)t=0>ed(this)?ep(this):this;else if(e==ob)t=0>(r=t8(this,new iM(n[0].toString()))).r()?ep(r):r;else throw new nr("Unknown call signature for interim = super.abs: "+e);return new nU(t)},i$.t=function(n){var t,e;if((e=iE(n))==i9)t=r0(this,new X(n[0].toString()));else if(e==i7)t=function(n,t,e){var r,i,o,u,f;if(r=n.f-t.f,0==t.b&&-1!=t.g||0==n.b&&-1!=n.g||0==e.b)return t8(r0(n,t),e);if((n.e>0?n.e:nP((n.b-1)*.3010299956639812)+1)0?t.e:nP((t.b-1)*.3010299956639812)+1)<-r-1))return t8(r0(n,t),e);i=n,u=t}return e.b>=(i.e>0?i.e:nP((i.b-1)*.3010299956639812)+1)?t8(r0(n,t),e):(f=(o=i.r())==u.r()?iS(rZ((i.d||(i.d=eP(i.g)),i.d),10),eZ(e6(o))):iS(rZ(f=ia((i.d||(i.d=eP(i.g)),i.d),eZ(e6(o))),10),eZ(e6(9*o))),t8(i=new tx(f,i.f+1),e))}(this,new X(n[0].toString()),new iM(n[1].toString()));else throw new nr("Unknown call signature for interim = super.add: "+e);return new nU(t)},i$.u=function(){return~~(nB(en(this,8))<<24)>>24},i$.v=function(n){return ic(this,n)},i$.w=function(n){var t,e,r,i;if((i=iE(n))==i9)e=el(this,new X(n[0].toString()));else if(i==i7)e=eg(this,new X(n[0].toString()),new iM(n[1].toString()));else throw new nr("Unknown call signature for interim = super.divideAndRemainder: "+i);for(t=0,r=tU(fL,{6:1},3,e.length,0);t129?n*=1/0:n=t9(ip(this)),n},i$.gC=function(){return fk},i$.hC=function(){return rm(this)},i$.B=function(){var n;return this.f<=-32||this.f>(this.e>0?this.e:nP((this.b-1)*.3010299956639812)+1)?0:(n=new n2(0==this.f||0==this.b&&-1!=this.g?(this.d||(this.d=eP(this.g)),this.d):this.f<0?et((this.d||(this.d=eP(this.g)),this.d),im(-this.f)):ih((this.d||(this.d=eP(this.g)),this.d),im(this.f)))).f*n.b[0]},i$.C=function(){return nB(en(this,32))},i$.D=function(){return nB(en(this,32))},i$.E=function(){return t9(ip(this))},i$.F=function(n){return new nU(ic(this,n)>=0?this:n)},i$.G=function(n){return new nU(0>=ic(this,n)?this:n)},i$.H=function(n){return new nU(rJ(this,this.f+n))},i$.I=function(n){return new nU(rJ(this,this.f-n))},i$.J=function(n){var t,e;if((e=iE(n))==i9)t=rk(this,new X(n[0].toString()));else if(e==i7)t=tl(this,new X(n[0].toString()),new iM(n[1].toString()));else throw new nr("Unknown call signature for interim = super.multiply: "+e);return new nU(t)},i$.K=function(n){var t,e;if((e=iE(n))==iV)t=ep(this);else if(e==ob)t=ep(t8(this,new iM(n[0].toString())));else throw new nr("Unknown call signature for interim = super.negate: "+e);return new nU(t)},i$.L=function(n){var t,e;if((e=iE(n))==iV)t=this;else if(e==ob)t=t8(this,new iM(n[0].toString()));else throw new nr("Unknown call signature for interim = super.plus: "+e);return new nU(t)},i$.M=function(n){var t,e;if((e=iE(n))==oL)t=rd(this,n[0]);else if(e==oU)t=function(n,t,e){var r,i,o,u,f,c;if(o=t<0?-t:t,u=e.b,i=eo(tn(o))+1,f=e,0==t||0==n.b&&-1!=n.g&&t>0)return rd(n,t);if(o>999999999||0==u&&t<0||u>0&&i>u)throw new ni(oh);for(u>0&&(f=new eW(u+i+1,e.c)),r=t8(n,f),c=~~function(n){var t;if(n<0)return -2147483648;if(0==n)return 0;for(t=1073741824;(t&n)==0;t>>=1);return t}(o)>>1;c>0;)r=tl(r,r,f),(o&c)==c&&(r=tl(r,n,f)),c>>=1;return t<0&&(r=iO(uw,r,f)),is(r,e),r}(this,n[0],new iM(n[1].toString()));else throw new nr("Unknown call signature for interim = super.pow: "+e);return new nU(t)},i$.q=function(){return rj(this)},i$.N=function(n){var t,e;if((e=iE(n))==i9)t=el(this,new X(n[0].toString()))[1];else if(e==i7)t=eg(this,new X(n[0].toString()),new iM(n[1].toString()))[1];else throw new nr("Unknown call signature for interim = super.remainder: "+e);return new nU(t)},i$.O=function(n){return new nU(t8(this,new iM(eh(n.b))))},i$.P=function(){return eo(this.f)},i$.Q=function(n){var t,e;return new nU((t=this,(e=t.f-n,t.b<54)?0==t.g?eU(e):new ti(t.g,eK(e)):new tM((t.d||(t.d=eP(t.g)),t.d),eK(e))))},i$.R=function(n){var t,e;if((e=iE(n))==oL)t=r1(this,n[0],(iA(),u3));else if(e==oP)t=r1(this,n[0],rQ(n[1]));else if("number RoundingMode"==e)t=r1(this,n[0],ts(n[1].toString()));else throw new nr("Unknown call signature for interim = super.setScale: "+e);return new nU(t)},i$.S=function(){return~~(nB(en(this,16))<<16)>>16},i$.r=function(){return ed(this)},i$.T=function(){return new nU(function(n){var t,e,r,i,o;if(t=1,e=um.length-1,r=n.f,0==n.b&&-1!=n.g)return new X(iW);for(n.d||(n.d=eP(n.g)),o=n.d;!o.gb(0);)if(0==(i=r6(o,um[t]))[1].r())r-=t,t0?i.e:nP((i.b-1)*.3010299956639812)+1)0?r.e:nP((r.b-1)*.3010299956639812)+1)?(f=(c=ed(r))!=i.r()?iS(rZ((r.d||(r.d=eP(r.g)),r.d),10),eZ(e6(c))):iS(rZ(f=ia((r.d||(r.d=eP(r.g)),r.d),eZ(e6(c))),10),eZ(e6(9*c))),t8(new tx(f,r.f+1),o)):t8(iD(r,i),o);else throw new nr("Unknown call signature for interim = super.subtract: "+e);return new nU(t)},i$.V=function(){return new n2(0==this.f||0==this.b&&-1!=this.g?(this.d||(this.d=eP(this.g)),this.d):this.f<0?et((this.d||(this.d=eP(this.g)),this.d),im(-this.f)):ih((this.d||(this.d=eP(this.g)),this.d),im(this.f)))},i$.W=function(){return new n2(r5(this))},i$.X=function(){return function(n){var t,e,r,i,o,u,f,c;if(u=iF((n.d||(n.d=eP(n.g)),n.d),0),0==n.f)return u;if(t=0>(n.d||(n.d=eP(n.g)),n.d).r()?2:1,r=u.length,i=-n.f+r-t,c=new nq(u),n.f>0&&i>=-6)i>=0?n7(c,r-eo(n.f),iK):(te(c.b,t-1,t-1,iZ),n7(c,t+1,tP(ua,0,-eo(i)-1)));else{if(e=r-t,0!=(f=eo(i%3))&&(0==(n.d||(n.d=eP(n.g)),n.d).r()?i+=f=f<0?-f:3-f:(i-=f=f<0?f+3:f,t+=f),e<3))for(o=f-e;o>0;--o)n7(c,r++,iW);r-t>=1&&(te(c.b,t,t,iK),++r),0!=i&&(te(c.b,r,r,oc),i>0&&n7(c,++r,iz),n7(c,++r,iV+r3(r4(i))))}return c.b.b}(this)},i$.Y=function(){return function(n){var t,e,r,i,o,u;if(r=iF((n.d||(n.d=eP(n.g)),n.d),0),0==n.f||0==n.b&&-1!=n.g&&n.f<0)return r;if(t=0>ed(n)?1:0,e=n.f,i=new Z(r.length+1+((o=eo(n.f))<0?-o:o)),1==t&&(i.b.b+=iJ),n.f>0){if((e-=r.length-t)>=0){for(i.b.b+=iZ;e>ua.length;e-=ua.length)tG(i,ua);n9(i,ua,eo(e)),nE(i,n8(r,t))}else nE(i,(u=eo(e=t-e),r.substr(t,u-t))),i.b.b+=iK,nE(i,n8(r,eo(e)))}else{for(nE(i,n8(r,t));e<-ua.length;e+=ua.length)tG(i,ua);n9(i,ua,eo(-e))}return i.b.b}(this)},i$.tS=function(){return ip(this)},i$.Z=function(){return new nU(new ti(1,this.f))},i$.$=function(){return new n2((this.d||(this.d=eP(this.g)),this.d))},i$.cM={3:1,6:1,8:1,10:1,16:1,24:1},(i$=H.prototype=(function(){}).prototype=new a).gC=function(){return fU};var uC=!1;(i$=ru.prototype=ro.prototype=to.prototype=e9.prototype=tV.prototype=rh.prototype=nG.prototype=iC.prototype=N.prototype=new B)._=function(){return this.f<0?new to(1,this.e,this.b):this},i$.ab=function(){return eq(this)},i$.eQ=function(n){return eV(this,n)},i$.gC=function(){return fP},i$.bb=function(){return t0(this)},i$.hC=function(){return ek(this)},i$.cb=function(){return 0==this.f?this:new to(-this.f,this.e,this.b)},i$.db=function(n){return rL(this,n)},i$.eb=function(n){return tY(this,n)},i$.fb=function(n){return t1(this,n)},i$.r=function(){return this.f},i$.gb=function(n){return rT(this,n)},i$.tS=function(){return iF(this,0)},i$.cM={6:1,8:1,10:1,17:1},i$.b=null,i$.c=-2,i$.d=0,i$.e=0,i$.f=0;var uS,uM,ux,uB,uA,uN=null;(i$=n2.prototype=nD.prototype=nk.prototype=(function(){}).prototype=new N)._=function(){return new n2(this.f<0?new to(1,this.e,this.b):this)},i$.hb=function(n){return new n2(iS(this,n))},i$.ib=function(n){return new n2(0==n.f||0==this.f?(rW(),uA):eV(n,(rW(),uS))?this:eV(this,uS)?n:this.f>0?n.f>0?function(n,t){var e,r,i,o;if(i=np(n.e,t.e),(e=n_(ew(n),ew(t)))>=i)return rW(),uA;for(r=tU(fp,{6:1},-1,i,1);e0?rz(n,this):this.e>n.e?i_(this,n):i_(n,this))},i$.jb=function(n){return new n2(0==n.f?this:0==this.f?(rW(),uA):eV(this,(rW(),uS))?new n2(r8(n)):eV(n,uS)?uA:this.f>0?n.f>0?function(n,t){var e,r,i,o;for(i=tU(fp,{6:1},-1,n.e,1),r=np(n.e,t.e),e=ew(n);e=n.e)return n;for(o=tU(fp,{6:1},-1,u=np(n.e,t.e),1),e=i;e0?function(n,t){var e,r,i,o,u,f,c;if(i=ew(n),o=ew(t),i>=t.e)return n;if(c=n_(n.e,t.e),r=i,o>i){for(f=tU(fp,{6:1},-1,c,1),u=np(n.e,o);r=t.e)return rW(),uA;if(u=tU(fp,{6:1},-1,f=t.e,1),e=i,i0)for(;e34028234663852886e22?1/0:n<-34028234663852886e22?-1/0:n},i$.qb=function(n){return new n2(rR(this,n))},i$.gC=function(){return fQ},i$.bb=function(){return t0(this)},i$.hC=function(){return ek(this)},i$.B=function(){return this.f*this.b[0]},i$.rb=function(n){return function(n,t){var e,r;if(ij(),t<=0||1==n.e&&2==n.b[0])return!0;if(!rT(n,0))return!1;if(1==n.e&&(-1024&n.b[0])==0)return function(n,t){var e,r,i,o;for(r=0,e=n.length-1;r<=e;)if((o=n[i=r+(~~(e-r)>>1)])t))return i;e=i-1}return-r-1}(uW,n.b[0])>=0;for(r=1;r>1)?r:1+(~~(t-1)>>1))}(new n2(this.f<0?new to(1,this.e,this.b):this),n)},i$.sb=function(){return t9(iF(this,0))},i$.tb=function(n){return new n2(1==rt(this,n)?this:n)},i$.ub=function(n){return new n2(-1==rt(this,n)?this:n)},i$.vb=function(n){return new n2(ee(this,n))},i$.wb=function(n){return new n2(rO(this,n))},i$.xb=function(n,t){return new n2(rG(this,n,t))},i$.yb=function(n){return new n2(et(this,n))},i$.cb=function(){return new n2(0==this.f?this:new to(-this.f,this.e,this.b))},i$.zb=function(){return new n2(function(n){if(n.f<0)throw new ni("start < 0: "+n);return function(n){var t,e,r,i,o,u,f,c;if(ij(),o=tU(fp,{6:1},-1,uW.length,1),r=tU(fv,{6:1},-1,1024,2),1==n.e&&n.b[0]>=0&&n.b[0]=uW[e];++e);return uK[e]}for(f=new to(1,n.e,tU(fp,{6:1},-1,n.e+1,1)),iB(n.b,0,f.b,0,n.e),rT(n,0)?tW(f,2):f.b[0]|=1,i=f.ab(),t=2;i0?n.f>0?this.e>n.e?rg(this,n):rg(n,this):iw(this,n):n.f>0?iw(n,this):ew(n)>ew(this)?rX(n,this):rX(this,n))},i$.db=function(n){return new n2(rL(this,n))},i$.Cb=function(n){return new n2(rH(this,n))},i$.Db=function(n){return new n2(rT(this,n)?this:ie(this,n))},i$.eb=function(n){return new n2(tY(this,n))},i$.fb=function(n){return new n2(t1(this,n))},i$.r=function(){return this.f},i$.Eb=function(n){return new n2(ia(this,n))},i$.gb=function(n){return rT(this,n)},i$.Fb=function(n){var t,e;if((e=iE(n))==iV)t=iF(this,0);else if(e==oL)t=function(n,t){var e,r,i,o,u,f,c,s,a,h,b,l,g,w,d,_;if(ix(),g=n.f,s=n.e,u=n.b,0==g)return iW;if(1==s)return _=ta(e6(u[0]),o6),g<0&&(_=eQ(_)),function(n,t){var e,r,i;if(10==t||t<2||t>36)return iV+r3(n);if(e=tU(fK,{6:1},-1,65,1),rv(),r=64,i=e6(t),rN(n,oJ)){for(;rN(n,i);)e[r--]=uO[nB(n6(n,i))],n=iI(n,i,!1);e[r]=uO[nB(n)]}else{for(;!rA(n,eQ(i));)e[r--]=uO[nB(eQ(n6(n,i)))],n=iI(n,i,!1);e[r--]=uO[nB(eQ(n))],e[r]=45}return t3(e,r,65)}(_,t);if(10==t||t<2||t>36)return iF(n,0);if(l=tU(fK,{6:1},-1,b=eo(eq(new n2(n.f<0?new to(1,n.e,n.b):n))/(Math.log(t)/Math.log(2))+(g<0?1:0))+1,1),i=b,16!=t)for(iB(u,0,w=tU(fp,{6:1},-1,s,1),0,s),d=s,r=uP[t],e=uU[t-2];;){h=ii(w,w,d,e),a=i;do l[--i]=em(h%t,t);while(0!=(h=~~(h/t))&&0!=i)for(f=0,o=r-a+i;f0;++f)l[--i]=48;for(f=d-1;f>0&&0==w[f];--f);if(1==(d=f+1)&&0==w[0])break}else for(f=0;f0;++c)h=~~u[f]>>(c<<2)&15,l[--i]=em(h,16);for(;48==l[i];)++i;return -1==g&&(l[--i]=45),tP(l,i,b-i)}(this,n[0]);else throw new nr("Unknown call signature for result = super.toString: "+e);return t},i$.Gb=function(n){return new n2(0==n.f?this:0==this.f?n:eV(n,(rW(),uS))?new n2(r8(this)):eV(this,uS)?new n2(r8(n)):this.f>0?n.f>0?this.e>n.e?rw(this,n):rw(n,this):iU(this,n):n.f>0?iU(n,this):ew(n)>ew(this)?io(n,this):io(this,n))},i$.cM={4:1,6:1,8:1,10:1,17:1,24:1},(i$=F.prototype=(function(){}).prototype=new a).gC=function(){return fj};var uI=!1;(i$=nm.prototype=ny.prototype=(function(){}).prototype=new a).gC=function(){return fF},i$.Hb=function(){return this.b.b},i$.Ib=function(){return new nn(this.b.c)},i$.hC=function(){return nx(this.b)},i$.tS=function(){return eh(this.b)},i$.cM={24:1},i$.b=null,(i$=j.prototype=(function(){}).prototype=new a).gC=function(){return fH};var uE=!1;(i$=nn.prototype=nC.prototype=(function(){}).prototype=new a).gC=function(){return f$},i$.Jb=function(){return this.b.b},i$.tS=function(){return this.b.b},i$.cM={5:1,24:1},i$.b=null,(i$=K.prototype=(function(){}).prototype=new a).gC=function(){return fq};var uR=!1;(i$=ni.prototype=(function(){}).prototype=new l).gC=function(){return fG},i$.cM={6:1,12:1,15:1},(i$=no.prototype=V.prototype=(function(){}).prototype=new l).gC=function(){return fJ},i$.cM={6:1,12:1,15:1},(i$=I.prototype=(function(){}).prototype=new a).gC=function(){return fW},i$.tS=function(){return((2&this.c)!=0?"interface ":(1&this.c)!=0?iV:"class ")+this.d},i$.b=null,i$.c=0,i$.d=null,(i$=$.prototype=(function(){}).prototype=new l).gC=function(){return fZ},i$.cM={6:1,12:1,15:1},(i$=E.prototype=new a).eQ=function(n){return this===n},i$.gC=function(){return fa},i$.hC=function(){return nF(this)},i$.tS=function(){return this.b},i$.cM={6:1,8:1,9:1},i$.b=null,i$.c=0,(i$=nu.prototype=q.prototype=R.prototype=new l).gC=function(){return fX},i$.cM={6:1,12:1,15:1},(i$=nf.prototype=G.prototype=O.prototype=new l).gC=function(){return fz},i$.cM={6:1,12:1,15:1},(i$=nc.prototype=z.prototype=(function(){}).prototype=new l).gC=function(){return fY},i$.cM={6:1,12:1,15:1},(i$=nd.prototype=(function(){}).prototype=new R).gC=function(){return f1},i$.cM={6:1,12:1,15:1},(i$=tu.prototype=(function(){}).prototype=new a).gC=function(){return fC},i$.tS=function(){return this.b+iK+this.d+"(Unknown Source"+(this.c>=0?i5+this.c:iV)+")"},i$.cM={6:1,13:1},i$.b=null,i$.c=0,i$.d=null,(i$=String.prototype).eQ=function(n){return tF(this,n)},i$.gC=function(){return fN},i$.hC=function(){var n,t;return nK(),null!=(t=uk[n=i5+this])?t:(null==(t=uD[n])&&(t=function(n){var t,e,r,i;for(t=0,i=(r=n.length)-4,e=0;et?n:t}function n_(n,t){return!rA(n,t)}function nv(n){this.b=new iS(n)}function nm(){this.b=(rj(),uj)}function ny(){this.b=(iB(),u2)}function nC(n,e){var r;nh(),r=t.b,n?function(n,t,e,r){var i=n.b[r];if(i)for(var o=0,u=i.length;o=t&&n.splice(0,t),n}function tg(n){return nG(n,15)?n:new n1(n)}function tw(){try{null.a()}catch(n){return n}}function td(n){var t;return(t=new N).d=i$+n,t.c=1,t}function tp(n,t){return nF(n)?n.eQ(t):n===t}function t_(n,t){return n.l==t.l&&n.m==t.m&&n.h==t.h}function tv(n,t){return n.l!=t.l||n.m!=t.m||n.h!=t.h}function tm(n,t,e){return(iH=new M).l=n,iH.m=t,iH.h=e,iH}function ty(n,t){return nT(n)===nT(t)||null!=n&&tp(n,t)}function tC(n,t){throw new nu("Index: "+n+", Size: "+t)}function tS(n,t){if(!n)throw new G;this.f=t,tR(this,n)}function tM(n,t){if(!n)throw new G;this.f=t,tR(this,n)}function tx(n,t,e,r){ez.call(this,n,t,e),ic(this,r)}function tB(n,t){ez.call(this,n,0,n.length),ic(this,t)}function tA(n,t){ez.call(this,t6(n),0,n.length),ic(this,t)}function tN(n){ne.call(this,"String index out of range: "+n)}function tI(n,t){var e,r;return e=n.b,r=String.fromCharCode(t),e.b+=r,n}function tE(n,t){ry(n.b,n.b,n.e,t.b,t.e),tW(n),n.c=-2}function tR(n,t){n.d=t,n.b=t.ab(),n.b<54&&(n.g=rr(eA(t)))}function tO(){tO=l,ue=[],ur=[],function(n,t,e){var r,i=0;for(var o in n)(r=n[o])&&(t[i]=o,e[i]=r,++i)}(new S,ue,ur)}function tD(){uy||(uy=!0,new T,new j,function(){if(nl(ox,i$),o.bigdecimal.BigDecimal)var n=o.bigdecimal.BigDecimal;o.bigdecimal.BigDecimal=ff(function(){1==arguments.length&&null!=arguments[0]&&arguments[0].gC()==fD?this.__gwt_instance=arguments[0]:0==arguments.length&&(this.__gwt_instance=new ng,nb(this.__gwt_instance,this))});var t=o.bigdecimal.BigDecimal.prototype={};if(n)for(p in n)o.bigdecimal.BigDecimal[p]=n[p];o.bigdecimal.BigDecimal.ROUND_CEILING=2,o.bigdecimal.BigDecimal.ROUND_DOWN=1,o.bigdecimal.BigDecimal.ROUND_FLOOR=3,o.bigdecimal.BigDecimal.ROUND_HALF_DOWN=5,o.bigdecimal.BigDecimal.ROUND_HALF_EVEN=6,o.bigdecimal.BigDecimal.ROUND_HALF_UP=4,o.bigdecimal.BigDecimal.ROUND_UNNECESSARY=7,o.bigdecimal.BigDecimal.ROUND_UP=0,o.bigdecimal.BigDecimal.__init__=ff(function(n){var t=function(n){var t,e;if(iU(),(e=iI(n))==i8)t=new nk(new nq(n[0].toString()));else if("BigInteger number"==e)t=new tS(new nq(n[0].toString()),n[1]);else if("BigInteger number MathContext"==e)t=new te(new nq(n[0].toString()),n[1],new iS(n[2].toString()));else if("BigInteger MathContext"==e)t=new n4(new nq(n[0].toString()),new iS(n[1].toString()));else if(e==oS)t=new n2(t6(n[0].toString()));else if("array number number"==e)t=new ez(t6(n[0].toString()),n[1],n[2]);else if("array number number MathContext"==e)t=new tx(t6(n[0].toString()),n[1],n[2],new iS(n[3].toString()));else if("array MathContext"==e)t=new tB(t6(n[0].toString()),new iS(n[1].toString()));else if(e==ok)t=new eu(n[0]);else if(e==oL)t=new ep(n[0],new iS(n[1].toString()));else if(e==oF)t=new Z(n[0].toString());else if("string MathContext"==e)t=new tA(n[0].toString(),new iS(n[1].toString()));else throw new ne("Unknown call signature for obj = new java.math.BigDecimal: "+e);return new nL(t)}(n);return nE(t)}),t.abs_va=ff(function(n){return nE(this.__gwt_instance.s(n))}),t.add_va=ff(function(n){return nE(this.__gwt_instance.t(n))}),t.byteValueExact=ff(function(){return this.__gwt_instance.u()}),t.compareTo=ff(function(n){return this.__gwt_instance.v(n.__gwt_instance)}),t.divide_va=ff(function(n){return nE(this.__gwt_instance.y(n))}),t.divideToIntegralValue_va=ff(function(n){return nE(this.__gwt_instance.x(n))}),t.doubleValue=ff(function(){return this.__gwt_instance.z()}),t.equals=ff(function(n){return this.__gwt_instance.eQ(n)}),t.floatValue=ff(function(){return this.__gwt_instance.A()}),t.hashCode=ff(function(){return this.__gwt_instance.hC()}),t.intValue=ff(function(){return this.__gwt_instance.B()}),t.intValueExact=ff(function(){return this.__gwt_instance.C()}),t.max=ff(function(n){return nE(this.__gwt_instance.F(n.__gwt_instance))}),t.min=ff(function(n){return nE(this.__gwt_instance.G(n.__gwt_instance))}),t.movePointLeft=ff(function(n){return nE(this.__gwt_instance.H(n))}),t.movePointRight=ff(function(n){return nE(this.__gwt_instance.I(n))}),t.multiply_va=ff(function(n){return nE(this.__gwt_instance.J(n))}),t.negate_va=ff(function(n){return nE(this.__gwt_instance.K(n))}),t.plus_va=ff(function(n){return nE(this.__gwt_instance.L(n))}),t.pow_va=ff(function(n){return nE(this.__gwt_instance.M(n))}),t.precision=ff(function(){return this.__gwt_instance.q()}),t.remainder_va=ff(function(n){return nE(this.__gwt_instance.N(n))}),t.round=ff(function(n){return nE(this.__gwt_instance.O(n.__gwt_instance))}),t.scale=ff(function(){return this.__gwt_instance.P()}),t.scaleByPowerOfTen=ff(function(n){return nE(this.__gwt_instance.Q(n))}),t.setScale_va=ff(function(n){return nE(this.__gwt_instance.R(n))}),t.shortValueExact=ff(function(){return this.__gwt_instance.S()}),t.signum=ff(function(){return this.__gwt_instance.r()}),t.stripTrailingZeros=ff(function(){return nE(this.__gwt_instance.T())}),t.subtract_va=ff(function(n){return nE(this.__gwt_instance.U(n))}),t.toBigInteger=ff(function(){return nE(this.__gwt_instance.V())}),t.toBigIntegerExact=ff(function(){return nE(this.__gwt_instance.W())}),t.toEngineeringString=ff(function(){return this.__gwt_instance.X()}),t.toPlainString=ff(function(){return this.__gwt_instance.Y()}),t.toString=ff(function(){return this.__gwt_instance.tS()}),t.ulp=ff(function(){return nE(this.__gwt_instance.Z())}),t.unscaledValue=ff(function(){return nE(this.__gwt_instance.$())}),t.divideAndRemainder_va=ff(function(n){return nR(this.__gwt_instance.w(n))}),t.longValue=ff(function(){return this.__gwt_instance.E()}),t.longValueExact=ff(function(){return this.__gwt_instance.D()}),o.bigdecimal.BigDecimal.valueOf_va=ff(function(n){var t=function(n){var t,e;if(iU(),(e=iI(n))==ok)t=function(n){if(!isFinite(n)||isNaN(n))throw new nw(os);return new Z(i$+n)}(n[0]);else if(e==ok)t=tZ(e3(n[0]));else if(e==oU)t=ek(e3(n[0]),n[1]);else throw new ne("Unknown call signature for bd = java.math.BigDecimal.valueOf: "+e);return new nL(t)}(n);return nE(t)}),o.bigdecimal.BigDecimal.log=ff(function(n){iU(),typeof console!==oH&&console.log&&console.log(n)}),o.bigdecimal.BigDecimal.logObj=ff(function(n){iU(),typeof console!==oH&&console.log&&typeof JSON!==oH&&JSON.stringify&&console.log("object: "+JSON.stringify(n))}),o.bigdecimal.BigDecimal.ONE=ff(function(){var n=(iU(),new nL(ug));return nE(n)}),o.bigdecimal.BigDecimal.TEN=ff(function(){var n=(iU(),new nL(uw));return nE(n)}),o.bigdecimal.BigDecimal.ZERO=ff(function(){var n=(iU(),new nL(ud));return nE(n)}),nC(fD,o.bigdecimal.BigDecimal)}())}function tk(n,t,e){var r;return(r=new N).d=n+t,r.c=4,r.b=e,r}function tL(n,t,e,r,i){var o;return tJ(n,t,e,o=function(n,t){var e=Array(t);if(3==n)for(var r=0;r0)for(var i=[null,0,!1][n],r=0;rn)throw new tN(e)}(n.length,t,r),t4(n,t,r)}function tP(n,t){return ib(),t=n.c.c)throw new z;return t=n.c,r=e=n.b++,i=t.c,(r<0||r>=i)&&tC(r,i),t.b[e]}function tj(n,t){return!!nG(t,1)&&String(n)==t}function tF(){ne.call(this,"Add not supported on this collection")}function tH(){this.b=[],this.f={},this.d=!1,this.c=null,this.e=0}function t$(n,t){rK(),this.f=n,this.e=1,this.b=tJ(fd,{6:1},-1,[t])}function tV(n,t){var e;return e=n.c,n.c=t,!n.d&&(n.d=!0,++n.e),e}function tq(n,t){var e,r;return e=n.b,r=String.fromCharCode.apply(null,t),e.b+=r,n}function tG(n,t,e,r){var i,o;return null==t&&(t=oD),i=n.b,o=t.substr(e,r-e),i.b+=o,n}function tz(n,t,e,r){var i;return ry(i=tL(fd,{6:1},-1,t,1),n,t,e,r),i}function tJ(n,t,e,r){return tO(),function(n,t,e){tO();for(var r=0,i=t.length;r0&&0==n.b[--n.e];);0==n.b[n.e++]&&(n.f=0)}function tZ(n){return rA(n,oz)&&n_(n,oX)?uc[nx(n)]:new eo(n,0)}function tX(n,t){return 0==t||0==n.f?n:t>0?e4(n,t):rX(n,-t)}function tY(n,t){return 0==t||0==n.f?n:t>0?rX(n,t):e4(n,-t)}function t1(n){var t;return 0==n.f?-1:((t=eg(n))<<5)+ec(n.b[t])}function t0(n){var t;return 0!=(t=nx(n))?ec(t):ec(nx(rJ(n,32)))+32}function t2(n,t){var e;return 0==(e=eR(n,t)).length?(new d).o(t):tl(e,1)}function t4(n,t,e){return n=n.slice(t,e),String.fromCharCode.apply(null,n)}function t3(n,t,e,r){var i;return ih(i=tL(fd,{6:1},-1,t+1,1),n,t,e,r),i}function t6(n){var t,e;return t=tL(fJ,{6:1},-1,e=n.length,1),function(n,t,e,r){var i;for(i=0;it.e&&(c=t,t=e,e=c),e.e<63)?(b=t,l=e,(_=(g=b.e)+(w=l.e),v=b.f!=l.f?-1:1,2==_)?(S=nx(y=iE(ts(e3(b.b[0]),o3),ts(e3(l.b[0]),o3))),0==(C=nx(rU(y,32)))?new t$(v,S):new ti(v,2,tJ(fd,{6:1},-1,[S,C]))):(eq(b.b,g,l.b,w,d=tL(fd,{6:1},-1,_,1)),tW(m=new ti(v,_,d)),m)):(f=(-2&t.e)<<4,a=t.fb(f),h=e.fb(f),i=is(t,a.eb(f)),o=is(e,h.eb(f)),s=n(a,h),r=n(i,o),u=(u=iC(iC(u=n(is(a,i),is(o,h)),s),r)).eb(f),iC(iC(s=s.eb(f<<1),u),r))}(n,t))}function et(n,t){var e;if(t.f<=0)throw new nr(oe);return(e=rF(n,t)).f<0?iC(e,t):e}function ee(n){var t;t=new nz,n.d&&n6(t,new nt(n)),function(n,t){var e=n.f;for(var r in e)if(58==r.charCodeAt(0)){var i=new nB(n,r.substring(1));t.Kb(i)}}(n,t),function(n,t){var e=n.b;for(var r in e){var i=parseInt(r,10);if(r==i)for(var o=e[i],u=0,f=o.length;u0?1:0:(n.d||(n.d=eU(n.g)),n.d).r()}function ed(n){return n.b<54?new tr(-n.g,n.f):new tM((n.d||(n.d=eU(n.g)),n.d).cb(),n.f)}function ep(n,t){if(!isFinite(n)||isNaN(n))throw new nw(os);iP(this,n.toPrecision(20)),ic(this,t)}function e_(n,t){return isNaN(n)?isNaN(t)?0:1:isNaN(t)?-1:nt?1:0}function ev(n,t){return t<2||t>36||n<0||n>=t?0:n<10?48+n&65535:97+n-10&65535}function em(n,t){var e,r;return t?((e=t[oy])||(e=new(r=t.gC(),t9(er(n.b,r)))(t),t[oy]=e),e):null}function ey(n){var t,e;return 32==(e=rH(n.h))?32==(t=rH(n.m))?rH(n.l)+32:t+20-10:e-12}function eC(n){return tm(4194303&n,~~n>>22&4194303,n<0?1048575:0)}function eS(){eS=l,ui=tm(4194303,4194303,524287),uo=tm(0,0,524288),uu=e3(1),e3(2),uf=e3(0)}function eM(n,t){ih(n.b,n.b,n.e,t.b,t.e),n.e=nd(np(n.e,t.e)+1,n.b.length),tW(n),n.c=-2}function ex(n,t){var e;e=~~t>>5,n.e+=e+(rH(n.b[n.e-1])-(31&t)>=0?0:1),rC(n.b,n.b,e,31&t),tW(n),n.c=-2}function eB(n,t){var e,r;e=~~t>>5,n.e>>r:0,tW(n))}function eA(n){var t;return t=n.e>1?ta(rL(e3(n.b[1]),32),ts(e3(n.b[0]),o3)):ts(e3(n.b[0]),o3),iE(e3(n.f),t)}function eN(n,t,e){var r;for(r=e-1;r>=0&&n[r]==t[r];--r);return r<0?0:n_(ts(e3(n[r]),o3),ts(e3(t[r]),o3))?-1:1}function eI(n,t,e){var r,i,o;for(i=0,r=0;i>>31;0!=r&&(n[e]=r)}function eE(n,t,e,r){if(iF=t,n)try{ff(im)()}catch(i){n(t)}else ff(im)()}function eR(n,t){var e,r,i;for(e=0,r=(i=t&&t.stack?t.stack.split("\n"):[]).length;e>5==n.e-1&&n.b[n.e-1]==1<<(31&t))for(e=0;r&&e=0&&t=0?new eo(oz,2147483647):new eo(oz,-2147483648)}function eU(n){return(rK(),n<0)?-1!=n?new ro(-1,-n):uC:n<=10?uM[ei(n)]:new ro(1,n)}function eP(n){var t,e,r;return t=~n.l+1&4194303,e=~n.m+(0==t?1:0)&4194303,r=~n.h+(0==t&&0==e?1:0)&1048575,tm(t,e,r)}function eQ(n){var t,e,r;t=~n.l+1&4194303,e=~n.m+(0==t?1:0)&4194303,r=~n.h+(0==t&&0==e?1:0)&1048575,n.l=t,n.m=e,n.h=r}function eT(n){var t,e,r;for(r=0,e=tL(fC,{6:1},13,n.length,0),t=n.length;r=0;--r)if(n[r]!=i[r]){e=0!=n[r]&&rB(ts(e3(n[r]),o3),ts(e3(i[r]),o3));break}}return u=new ti(1,o+1,n),e&&tE(u,t),tW(u),u}(o,e)}function e$(n,t){var e;return n===t||!!nG(t,17)&&(e=tQ(t,17),n.f==e.f&&n.e==e.e&&function(n,t){var e;for(e=n.e-1;e>=0&&n.b[e]==t[e];--e);return e<0}(n,e.b))}function eV(n){var t,e;return 0==n.f?0:(t=n.e<<5,e=n.b[n.e-1],n.f<0&&eg(n)==n.e-1&&(e=~~(e-1)),t-=rH(e))}function eq(n,t,e,r,i){ib(),0!=t&&0!=r&&(1==t?i[r]=rf(i,e,r,n[0]):1==r?i[t]=rf(i,n,t,e[0]):function(n,t,e,r,i){var o,u,f,c;if(nT(n)===nT(t)&&r==i){io(n,r,e);return}for(f=0;f2147483647))return ei(n);throw new nr("Underflow")}function eK(n,t){if(rj(),n<0)throw new no("Digits < 0");if(!t)throw new nf("null RoundingMode");this.b=n,this.c=t}function eW(n){return(rK(),n_(n,oz))?tv(n,oG)?new ri(-1,eP(n)):uC:rB(n,oZ)?new ri(1,n):uM[nx(n)]}function eZ(n){var t;return n_(n,oz)&&(n=tm(4194303&~n.l,4194303&~n.m,1048575&~n.h)),64-(0!=(t=nx(rJ(n,32)))?rH(t):rH(nx(n))+32)}function eX(n,t){var e,r,i;return e=n.l+t.l,r=n.m+t.m+(~~e>>22),i=n.h+t.h+(~~r>>22),tm(4194303&e,4194303&r,1048575&i)}function eY(n,t){var e,r,i;return e=n.l-t.l,r=n.m-t.m+(~~e>>22),i=n.h-t.h+(~~r>>22),tm(4194303&e,4194303&r,1048575&i)}function e1(n,t){var e;if(e=t-1,n.f>0){for(;!n.gb(e);)--e;return t-1-e}for(;n.gb(e);)--e;return t-1-np(e,n.bb())}function e0(n,t){var e;return n===t||!!nG(t,16)&&(e=tQ(t,16)).f==n.f&&(n.b<54?e.g==n.g:n.d.eQ(e.d))}function e2(n,t,e){var r,i,o;for(o=oz,r=t-1;r>=0;--r)i=r0(eX(rL(o,32),ts(e3(n[r]),o3)),e),o=e3(nx(rJ(i,32)));return nx(o)}function e4(n,t){var e,r,i,o;return e=~~t>>5,t&=31,rC(r=tL(fd,{6:1},-1,i=n.e+e+(0==t?0:1),1),n.b,e,t),tW(o=new ti(n.f,i,r)),o}function e3(n){var t,e;return n>-129&&n<128?(t=n+128,null==o8&&(o8=tL(fE,{6:1},2,256,0)),(e=o8[t])||(e=o8[t]=eC(n)),e):eC(n)}function e6(n){var t,e;return(rK(),n>5)+1,1))[t]=1<<(31&n),new ti(1,t+1,e))}function e5(n){rK(),0==n.length?(this.f=0,this.e=1,this.b=tJ(fd,{6:1},-1,[0])):(this.f=1,this.e=n.length,this.b=n,tW(this))}function e9(n){return 0==n.length||n[0]>iV&&n[n.length-1]>iV?n:n.replace(/^(\s*)/,i$).replace(/\s*$/,i$)}function e7(n){return n-=~~n>>1&1431655765,n=(~~(n=(~~n>>2&858993459)+(858993459&n))>>4)+n&252645135,n+=~~n>>8,63&(n+=~~n>>16)}function e8(n,t,e){if(null!=e){var r;if(n.qI>0&&(r=n.qI,!e.cM||!e.cM[r])||n.qI<0&&(e.tM==l||nH(e,1)))throw new $}return n[t]=e}function rn(n,t){return n.f>t.f?1:n.ft.e?n.f:n.e=0;--o)u=eH(u,u,r,i),(e.b[~~o>>5]&1<<(31&o))!=0&&(u=eH(u,t,r,i));return u}(f,r,t,e,o):function(n,t,e,r,i){var o,u,f,c,s,a,h;for(s=tL(f5,{6:1},17,8,0),a=n,e8(s,0,t),h=eH(t,t,r,i),u=1;u<=7;++u)e8(s,u,eH(s[u-1],h,r,i));for(u=e.ab()-1;u>=0;--u)if((e.b[~~u>>5]&1<<(31&u))!=0){for(c=1,o=u,f=u-3>0?u-3:0;f<=u-1;++f)(e.b[~~f>>5]&1<<(31&f))!=0&&(f>1],a,r,i),u=o}else a=eH(a,a,r,i);return a}(f,r,t,e,o),eH(u,(rK(),uS),e,o)}function rs(n,t){var e,r,i,o;for(e=0,r=n.length;e36)throw new nw("Radix out of range");if(0==n.length)throw new nw("Zero length BigInteger");(function(n,t,e){var r,i,o,u,f,c,s,a,h,b,l,g,w,d;for(s=l=t.length,45==t.charCodeAt(0)?(h=-1,b=1,--l):(h=1,b=0),o=~~(l/(u=(iM(),uU)[e])),0!=(d=l%u)&&++o,c=tL(fd,{6:1},-1,o,1),r=uL[e-2],f=0,g=b+(0==d?u:d),w=b;wr)return 1;if(e=0&&n[i]==t[i];--i);return i<0?0:n_(ts(e3(n[i]),o3),ts(e3(t[i]),o3))?-1:1}function rl(n,t){var e,r,i;for(r=tL(fd,{6:1},-1,i=n.e,1),nd(eg(n),eg(t)),e=0;e999999999)throw new nr(oa);return e=n.f*t,0==n.b&&-1!=n.g?eL(e):new tS((n.d||(n.d=eU(n.g)),n.d).db(t),eJ(e))}function rd(n,t){return t<2||t>36?-1:n>=48&&n<48+(t<10?t:10)?n-48:n>=97&&n=65&&n=0;--n)fo[n]=e,e*=.5;for(n=24,t=1;n>=0;--n)fi[n]=t,t*=.5}function r_(){r_=l,uR=tJ(fJ,{6:1},-1,[48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122])}function rv(n){var t;return 0!=n.c?n.c:n.b<54?(t=r2(n.g),n.c=nx(ts(t,oG)),n.c=33*n.c+nx(ts(rJ(t,32),oG)),n.c=17*n.c+ei(n.f),n.c):(n.c=17*n.d.hC()+ei(n.f),n.c)}function rm(n,t,e,r){var i,o,u,f,c;return o=(c=n/t)>0?Math.floor(c):Math.ceil(c),u=n%t,f=e_(n*t,0),0!=u&&(i=e_((u<=0?0-u:u)*2,t<=0?0-t:t),o+=r8(1&ei(o),f*(5+i),r)),new tr(o,e)}function ry(n,t,e,r,i){var o,u;for(u=0,o=oz;ue;--i)n[i]|=~~t[i-e-1]>>>o,n[i-1]=t[i-e-1]<>5,n.e-=r,!rO(n.b,n.e,n.b,r,31&t)&&i<0){for(e=0;e>19,r=~~t.h>>19,0==e?0!=r||n.h>t.h||n.h==t.h&&n.m>t.m||n.h==t.h&&n.m==t.m&&n.l>t.l:!(0==r||n.h>19,r=~~t.h>>19,0==e?0!=r||n.h>t.h||n.h==t.h&&n.m>t.m||n.h==t.h&&n.m==t.m&&n.l>=t.l:!(0==r||n.h-140737488355328&&n<0x800000000000?0==n?0:((t=n<0)&&(n=-n),e=ei(nU(Math.log(n)/.6931471805599453)),(!t||n!=Math.pow(2,e))&&++e,e):eZ(r2(n))}function rE(n,t){var e,r;return(e=n._(),r=t._(),0==e.r())?r:0==r.r()?e:(1==e.e||2==e.e&&e.b[1]>0)&&(1==r.e||2==r.e&&r.b[1]>0)?eW(rN(eA(e),eA(r))):function(n,t){var e,r,i;e=n.bb(),r=t.bb(),rx(n,e),rx(t,r),1==rn(n,t)&&(i=n,n=t,t=i);do{if(1==t.e||2==t.e&&t.b[1]>0){t=eW(rN(eA(n),eA(t)));break}if(t.e>1.2*n.e)0!=(t=rF(t,n)).r()&&rx(t,t.bb());else do tE(t,n),rx(t,t.bb());while(rn(t,n)>=0)i=t,t=n,n=i}while(0!=i.f)return t.eb(e=r?ex(f,i):(rx(c,r-e0&&ex(f,i-r+e)),e+=i),0!=(i=e1(h,u))&&(ex(h,i),r>=e?ex(c,i):(rx(f,e-r0&&ex(c,i-e+r)),r+=i),s.r()==h.r()?e<=r?(rV(s,h),rV(f,c)):(rV(h,s),rV(c,f)):e<=r?(r$(s,h),r$(f,c)):(r$(h,s),r$(c,f)),0==h.r()||0==s.r())throw new nr(ot);return eO(h,r)&&(f=c,h.r()!=s.r()&&(s=s.cb())),s.gb(u)&&(f=0>f.r()?f.cb():is(t,f)),0>f.r()&&(f=iC(f,t)),f}(n,t);for(o=32*t.e,h=eh(t),u=np((b=eh(n)).e,h.e),c=new ti(1,1,tL(fd,{6:1},-1,u+1,1)),(s=new ti(1,1,tL(fd,{6:1},-1,u+1,1))).b[0]=1,e=0,(r=h.bb())>(i=b.bb())?(rx(h,r),rx(b,i),ex(c,i),e+=r-i):(rx(h,r),rx(b,i),ex(s,r),e+=i-r),c.f=1;b.r()>0;){for(;rn(h,b)>0;)tE(h,b),a=h.bb(),rx(h,a),eM(c,s),ex(s,a),e+=a;for(;0>=rn(h,b)&&(tE(b,h),0!=b.r());)a=b.bb(),rx(b,a),eM(s,c),ex(c,a),e+=a}if(!(1==h.e&&1==h.b[0]))throw new nr(ot);return rn(c,t)>=0&&tE(c,t),c=is(t,c),f=ru(t),e>o&&(c=eH(c,(rK(),uS),t,f),e-=o),c=eH(c,e6(o-e),t,f)}(et(n._(),t),t)).f)throw new nr(ot);return n.f<0?is(t,e):e}function rO(n,t,e,r,i){var o,u,f;for(u=0,o=!0;u>>i|e[u+r+1]<>>i,++u}return o}function rD(n,t){var e;return(e=n.f+t.f,0==n.b&&-1!=n.g||0==t.b&&-1!=t.g)?eL(e):n.b+t.b<54?new tr(n.g*t.g,eJ(e)):new tS(en((n.d||(n.d=eU(n.g)),n.d),(t.d||(t.d=eU(t.g)),t.d)),eJ(e))}function rk(n,t){var e;if(t<0)throw new nr("Negative exponent");if(0==t)return uS;if(1==t||n.eQ(uS)||n.eQ(uB))return n;if(!n.gb(0)){for(e=1;!n.gb(e);)++e;return en(e6(e*t),n.fb(e).db(t))}return function(n,t){var e,r;for(ib(),rK(),r=uS,e=n;t>1;t>>=1)(1&t)!=0&&(r=en(r,e)),e=1==e.e?en(e,e):new e5(io(e.b,e.e,tL(fd,{6:1},-1,e.e<<1,1)));return en(r,e)}(n,t)}function rL(n,t){var e,r,i;return(t&=63)<22?(e=n.l<>22-t,i=n.h<>22-t):t<44?(e=0,r=n.l<>44-t):(e=0,r=0,i=n.l<>>t,i=~~n.m>>t|e<<22-t,r=~~n.l>>t|n.m<<22-t):t<44?(o=0,i=~~e>>>t-22,r=~~n.m>>t-22|n.h<<44-t):(o=0,i=0,r=~~e>>>t-44),tm(4194303&r,4194303&i,1048575&o)}function rP(n){switch(iB(),n){case 2:return uZ;case 1:return uX;case 3:return uY;case 5:return u1;case 6:return u0;case 4:return u2;case 7:return u4;case 0:return u3;default:throw new no("Invalid rounding mode")}}function rQ(n,t){var e,r,i;if(0==t)return(1&n.b[0])!=0;if(t<0)throw new nr(ob);if((i=~~t>>5)>=n.e)return n.f<0;if(e=n.b[i],t=1<<(31&t),n.f<0){if(i<(r=eg(n)))return!1;e=r==i?-e:~e}return(e&t)!=0}function rT(n){var t,e;return n.e>0||(t=1,e=1,n.b<54?(n.b>=1&&(e=n.g),t+=Math.log(e<=0?0-e:e)*Math.LOG10E):(t+=(n.b-1)*.3010299956639812,0!=ia((n.d||(n.d=eU(n.g)),n.d),iv(t)).r()&&++t),n.e=ei(t)),n.e}function rj(){rj=l,uP=new eK(34,(iB(),u0)),uQ=new eK(7,u0),uT=new eK(16,u0),uj=new eK(0,u2),uF=tJ(fJ,{6:1},-1,[112,114,101,99,105,115,105,111,110,61]),uH=tJ(fJ,{6:1},-1,[114,111,117,110,100,105,110,103,77,111,100,101,61])}function rF(n,t){var e,r,i,o;if(0==t.f)throw new nr(on);return((o=n.e)!=(e=t.e)?o>e?1:-1:eN(n.b,t.b,o))==-1?n:(r=tL(fd,{6:1},-1,e,1),1==e?r[0]=e2(n.b,o,t.b[0]):r=ik(null,o-e+1,n.b,o,t.b,e),tW(i=new ti(n.f,e,r)),i)}function rH(n){var t,e,r;return n<0?0:0==n?32:(e=16-(t=~~(r=-(~~n>>16))>>16&16),e+=t=~~(r=(n=~~n>>t)-256)>>16&8,n<<=t,e+=t=~~(r=n-4096)>>16&4,n<<=t,e+=t=~~(r=n-16384)>>16&2,n<<=t,e+2-(t=(r=~~n>>14)&~(~~r>>1)))}function r$(n,t){if(0==n.f)ix(t.b,0,n.b,0,t.e);else{if(0==t.f)return;n.f==t.f?ih(n.b,n.b,n.e,t.b,t.e):rb(n.b,t.b,n.e,t.e)>0?ry(n.b,n.b,n.e,t.b,t.e):(r5(n.b,n.b,n.e,t.b,t.e),n.f=-n.f)}n.e=np(n.e,t.e)+1,tW(n),n.c=-2}function rV(n,t){var e;e=rn(n,t),0==n.f?(ix(t.b,0,n.b,0,t.e),n.f=-t.f):n.f!=t.f?(ih(n.b,n.b,n.e,t.b,t.e),n.f=e):rb(n.b,t.b,n.e,t.e)>0?ry(n.b,n.b,n.e,t.b,t.e):(r5(n.b,n.b,n.e,t.b,t.e),n.f=-n.f),n.e=np(n.e,t.e)+1,tW(n),n.c=-2}function rq(n,t,e){var r,i,o,u,f,c,s,a,h,b;if(e.f<=0)throw new nr(oe);return(r=n,(1==e.e&&1==e.b[0])|t.f>0&0==r.f)?uB:0==r.f&&0==t.f?uS:(t.f<0&&(r=rR(n,e),t=t.cb()),i=e.gb(0)?rc(r._(),t,e):(o=r._(),u=t,f=e.bb(),a=rc(o,u,c=e.fb(f)),h=function(n,t,e){var r,i,o,u,f;for(rK(),u=uS,i=eh(t),r=eh(n),n.gb(0)&&eB(i,e-1),eB(r,e),o=i.ab()-1;o>=0;--o)eB(f=eh(u),e),u=en(u,f),(i.b[~~o>>5]&1<<(31&o))!=0&&eB(u=en(u,r),e);return eB(u,e),u}(o,u,f),s=function(n,t){var e,r,i,o;for(e=1,(r=new e5(tL(fd,{6:1},-1,1<>5]&1<<(31&o))!=0&&(r.b[~~e>>5]|=1<<(31&e));return r}(c,f),eB(b=en(is(h,a),s),f),b.f<0&&(b=iC(b,e6(f))),iC(a,en(c,b))),r.f<0&&t.gb(0)&&(i=et(en(is(e,uS),i),e)),i)}function rG(n,t){var e,r,i,o,u,f,c;if(i=eg(n),(r=eg(t))>=n.e)return rK(),uB;for(u=tL(fd,{6:1},-1,f=n.e,1),(e=i>r?i:r)==r&&(u[e]=-t.b[e]&n.b[e],++e),o=nd(t.e,n.e);e=t.e)for(;e0?t:0):t>=0?n.b<54?new tr(n.g,eJ(t)):new tS((n.d||(n.d=eU(n.g)),n.d),eJ(t)):-t>t,o=~~n.m>>t|e<<22-t,i=~~n.l>>t|n.m<<22-t):t<44?(u=r?1048575:0,o=~~e>>t-22,i=~~n.m>>t-22|e<<44-t):(u=r?1048575:0,o=r?4194303:0,i=~~e>>t-44),tm(4194303&i,4194303&o,1048575&u)}function rK(){var n;for(n=0,rK=l,uS=new t$(1,1),ux=new t$(1,10),uB=new t$(0,0),uC=new t$(-1,1),uM=tJ(f5,{6:1},17,[uB,uS,new t$(1,2),new t$(1,3),new t$(1,4),new t$(1,5),new t$(1,6),new t$(1,7),new t$(1,8),new t$(1,9),ux]),uA=tL(f5,{6:1},17,32,0);n=t.e)return t;if(r>=n.e)return n;if(o=tL(fd,{6:1},-1,u=nd(n.e,t.e),1),r==i)o[i]=-(-n.b[i]|-t.b[i]),e=i;else{for(e=r;e>5,t&=31,r>=n.e)return n.f<0?(rK(),uC):(rK(),uB);if(rO(i=tL(fd,{6:1},-1,(o=n.e-r)+1,1),o,n.b,r,t),n.f<0){for(e=0;e0&&n.b[e]<<32-t!=0){for(e=0;e0?r=0)return n;return 0!=e?e>0?rS(n,t,e):rS(t,n,-e):np(n.b,t.b)+1<54?new tr(n.g+t.g,n.f):new tM(iC((n.d||(n.d=eU(n.g)),n.d),(t.d||(t.d=eU(t.g)),t.d)),n.f)}function r0(n,t){var e,r,i,o,u;return(r=ts(e3(t),o3),rA(n,oz))?(o=iN(n,r,!1),u=n3(n,r)):(o=iN(e=rU(n,1),i=e3(~~t>>>1),!1),u=eX(rL(u=n3(e,i),1),ts(n,oJ)),(1&t)!=0&&(rB(o,u)?rB(eY(o,u),r)?(u=eX(u,eY(rL(r,1),o)),o=eY(o,oK)):(u=eX(u,eY(r,o)),o=eY(o,oJ)):u=eY(u,o))),ta(rL(u,32),ts(o,o3))}function r2(n){var t,e,r,i;return isNaN(n)?(eS(),uf):n<-0x8000000000000000?(eS(),uo):n>=0x7fffffffffffffff?(eS(),ui):(r=!1,n<0&&(r=!0,n=-n),e=0,n>=17592186044416&&(e=ei(n/17592186044416),n-=17592186044416*e),t=0,n>=4194304&&(t=ei(n/4194304),n-=4194304*t),i=tm(ei(n),t,e),r&&eQ(i),i)}function r4(n){var t,e,r,i;if(0==n.l&&0==n.m&&0==n.h)return iK;if(524288==n.h&&0==n.m&&0==n.l)return"-9223372036854775808";if(~~n.h>>19!=0)return iz+r4(eP(n));for(e=n,r=i$;!(0==e.l&&0==e.m&&0==e.h);){if(e=iN(e,e3(1e9),!0),t=i$+nx(o7),!(0==e.l&&0==e.m&&0==e.h))for(i=9-t.length;i>0;--i)t=iK+t;r=t+r}return r}function r3(n,t){var e,r,i,o,u,f,c,s,a,h,b,l,g,w,d,_,v,m,y,C,S,M,x;if(0==(i=t.f))throw new nr(on);return(r=t.e,e=t.b,1==r)?(l=e[0],(S=n.b,M=n.e,x=n.f,1==M)?(d=iN(g=ts(e3(S[0]),o3),w=ts(e3(l),o3),!1),v=n3(g,w),x!=i&&(d=eP(d)),x<0&&(v=eP(v)),tJ(f5,{6:1},17,[eW(d),eW(v)])):(_=tL(fd,{6:1},-1,M,1),m=tJ(fd,{6:1},-1,[ir(_,S,M,l)]),y=new ti(x==i?1:-1,M,_),C=new ti(x,1,m),tW(y),tW(C),tJ(f5,{6:1},17,[y,C]))):(a=n.b,((h=n.e)!=r?h>r?1:-1:eN(a,e,h))<0)?tJ(f5,{6:1},17,[uB,n]):(b=n.f,f=ik(o=tL(fd,{6:1},-1,u=h-r+1,1),u,a,h,e,r),c=new ti(b==i?1:-1,u,o),s=new ti(b,r,f),tW(c),tW(s),tJ(f5,{6:1},17,[c,s]))}function r6(n){var t;if(0==n.f||0==n.b&&-1!=n.g)return n.d||(n.d=eU(n.g)),n.d;if(n.f<0)return en((n.d||(n.d=eU(n.g)),n.d),iv(-n.f));if(n.f>(n.e>0?n.e:nU((n.b-1)*.3010299956639812)+1)||n.f>(n.d||(n.d=eU(n.g)),n.d).bb()||0!=(t=r3((n.d||(n.d=eU(n.g)),n.d),iv(n.f)))[1].r())throw new nr(ol);return t[0]}function r5(n,t,e,r,i){var o,u;if(o=oz,e36)throw new nw("radix "+t+" out of range");for(e=(r=n.length)>0&&45==n.charCodeAt(0)?1:0;e2147483647)throw new nw(oc+n+iq);return i}function r7(n){var t,e;if(0==n.f)return rK(),uC;if(e$(n,(rK(),uC)))return uB;if(e=tL(fd,{6:1},-1,n.e+1,1),n.f>0){if(-1!=n.b[n.e-1])for(t=0;-1==n.b[t];++t);else{for(t=0;t0?0==t?0:t<0?-1:1:0;break;case 3:r=(0==t?0:t<0?-1:1)<0?0==t?0:t<0?-1:1:0;break;case 4:(t<0?-t:t)>=5&&(r=0==t?0:t<0?-1:1);break;case 5:(t<0?-t:t)>5&&(r=0==t?0:t<0?-1:1);break;case 6:(t<0?-t:t)+n>5&&(r=0==t?0:t<0?-1:1)}return r}function it(n,t){var e,r,i,o,u,f,c,s;if(c=0==n.f?1:n.f,u=tL(fd,{6:1},-1,f=np((o=~~t>>5)+1,n.e)+1,1),e=1<<(31&t),ix(n.b,0,u,0,n.e),n.f<0){if(o>=n.e)u[o]=e;else if(o>(r=eg(n)))u[o]^=e;else if(o=0||0==s.f||1==s.e&&1==s.b[0])if(!(1==(a=rq(s,f,n)).e&&1==a.b[0]||a.eQ(u))){for(i=1;i=0;--f)rA(a=ta(rL(s,32),ts(e3(t[f]),o3)),oz)?(c=iN(a,o,!1),s=n3(a,o)):(c=iN(i=rU(a,1),u=e3(~~r>>>1),!1),s=eX(rL(s=n3(i,u),1),ts(a,oJ)),(1&r)!=0&&(rB(c,s)?rB(eY(c,s),o)?(s=eX(s,eY(rL(o,1),c)),c=eY(c,oK)):(s=eX(s,eY(o,c)),c=eY(c,oJ)):s=eY(s,c))),n[f]=nx(ts(c,o3));return nx(s)}function ii(n,t){var e,r,i,o,u,f,c;if(u=tL(fd,{6:1},-1,f=np(n.e,t.e),1),i=eg(n),e=r=eg(t),i==r)u[r]=-n.b[r]^-t.b[r];else{for(u[r]=-t.b[r],o=nd(t.e,i),++e;et.g?1:0:(r=n.f-t.f,(e=(n.e>0?n.e:nU((n.b-1)*.3010299956639812)+1)-(t.e>0?t.e:nU((t.b-1)*.3010299956639812)+1))>r+1)?i:e0&&(u=en(u,iv(r))),rn(o,u))}function ic(n,t){var e,r,i,o,u,f,c,s,a,h,b,l,g;if(o=t.b,!((n.e>0?n.e:nU((n.b-1)*.3010299956639812)+1)-o<0||0==o||(r=n.q()-o)<=0)){if(n.b<54){c=n,l=r2(ub[r]),b=eY(r2(c.f),e3(r)),h=iN(g=r2(c.g),l,!1),tv(a=n3(g,l),oz)&&(s=t_(eY(rL(n_(a,oz)?eP(a):a,1),l),oz)?0:n_(eY(rL(n_(a,oz)?eP(a):a,1),l),oz)?-1:1,h=eX(h,e3(r8(1&nx(h),(t_(a,oz)?0:n_(a,oz)?-1:1)*(5+s),t.c))),n8(rr(n_(h,oz)?eP(h):h))>=t.b&&(h=nP(h,oZ),b=eY(b,oJ))),c.f=eJ(rr(b)),c.e=t.b,c.g=rr(h),c.b=eZ(h),c.d=null;return}f=iv(r),i=r3((n.d||(n.d=eU(n.g)),n.d),f),u=n.f-r,0!=i[1].r()&&(e=rn(eF(i[1]._()),f),0!=(e=r8(i[0].gb(0)?1:0,i[1].r()*(5+e),t.c))&&e8(i,0,iC(i[0],eW(e3(e)))),new nk(i[0]).q()>o&&(e8(i,0,ia(i[0],(rK(),ux))),--u)),n.f=eJ(u),n.e=o,tR(n,i[0])}}function is(n,t){var e,r,i,o,u,f,c,s,a,h;if(u=n.f,0==(c=t.f))return n;if(0==u)return t.cb();if((o=n.e)+(f=t.e)==2)return e=ts(e3(n.b[0]),o3),r=ts(e3(t.b[0]),o3),u<0&&(e=eP(e)),c<0&&(r=eP(r)),eW(eY(e,r));if(-1==(i=o!=f?o>f?1:-1:eN(n.b,t.b,o)))h=-c,a=u==c?tz(t.b,f,n.b,o):t3(t.b,f,n.b,o);else if(h=u,u==c){if(0==i)return rK(),uB;a=tz(n.b,o,t.b,f)}else a=t3(n.b,o,t.b,f);return tW(s=new ti(h,a.length,a)),s}function ia(n,t){var e,r,i,o,u,f,c,s,a;if(0==t.f)throw new nr(on);return(i=t.f,1==t.e&&1==t.b[0])?t.f>0?n:n.cb():(s=n.f,(c=n.e)+(r=t.e)==2)?(a=nP(ts(e3(n.b[0]),o3),ts(e3(t.b[0]),o3)),s!=i&&(a=eP(a)),eW(a)):0==(e=c!=r?c>r?1:-1:eN(n.b,t.b,c))?s==i?uS:uC:-1==e?uB:(o=tL(fd,{6:1},-1,u=c-r+1,1),1==r?ir(o,n.b,c,t.b[0]):ik(o,u,n.b,c,t.b,r),tW(f=new ti(s==i?1:-1,u,o)),f)}function ih(n,t,e,r,i){var o,u;if(o=eX(ts(e3(t[0]),o3),ts(e3(r[0]),o3)),n[0]=nx(o),o=rJ(o,32),e>=i){for(u=1;u0){if(i0?u=tP(u,ei(i)):i<0&&(o=tP(o,ei(-i))),iw(o,u,e,r)}function ig(n,t){var e,r,i,o,u,f,c;if(r=eg(t),(i=eg(n))>=t.e)return t;if(u=tL(fd,{6:1},-1,f=t.e,1),rt.ab()?(c=eA(s),o=eA(t),i=t_(eY(rL(n_(c,oz)?eP(c):c,1),n_(o,oz)?eP(o):o),oz)?0:n_(eY(rL(n_(c,oz)?eP(c):c,1),n_(o,oz)?eP(o):o),oz)?-1:1,i=r8(f.gb(0)?1:0,a*(5+i),r)):(i=rn(eF(s._()),t._()),i=r8(f.gb(0)?1:0,a*(5+i),r)),0!=i){if(54>f.ab())return ek(eX(eA(f),e3(i)),e);f=iC(f,eW(e3(i)))}return new tS(f,e)}function id(n){var t,e,r,i,o,u;return null!=n.i?n.i:n.b<32?(n.i=function(n,t){var e,r,i,o,u,f,c,s,a,h,b,l,g,w,d,_,v;if(iM(),(u=n_(n,oz))&&(n=eP(n)),t_(n,oz))switch(t){case 0:return iK;case 1:return iZ;case 2:return iX;case 3:return iY;case 4:return i1;case 5:return i0;case 6:return i2;default:return s=new K,t<0?s.b.b+=i3:s.b.b+=i4,b=s.b,b.b+=-2147483648==t?"2147483648":i$+-t,s.b.b}c=tL(fJ,{6:1},-1,19,1),e=18,h=n;do f=h,h=nP(h,oZ),c[--e]=65535&nx(eX(o1,eY(f,iE(h,oZ))));while(tv(h,oz))if(r=eY(eY(eY(oY,e3(e)),e3(t)),oJ),0==t)return u&&(c[--e]=45),tU(c,e,18-e);if(t>0&&rA(r,oq)){if(rA(r,oz)){for(o=17,i=e+nx(r);o>=i;--o)c[o+1]=c[o];return c[++i]=46,u&&(c[--e]=45),tU(c,e,18-e+1)}for(o=2;n_(e3(o),eX(eP(r),oJ));++o)c[--e]=48;return c[--e]=46,c[--e]=48,u&&(c[--e]=45),tU(c,e,18-e)}return(a=e+1,s=new W,u&&(s.b.b+=iz),18-a>=1)?(tI(s,c[e]),s.b.b+=iJ,l=s.b,g=tU(c,e+1,18-e-1),l.b+=g):(w=s.b,d=tU(c,e,18-e),w.b+=d),s.b.b+=of,rB(r,oz)&&(s.b.b+=iG),_=s.b,v=i$+r4(r),_.b+=v,s.b.b}(r2(n.g),ei(n.f)),n.i):(i=ij((n.d||(n.d=eU(n.g)),n.d),0),0==n.f)?i:(t=0>(n.d||(n.d=eU(n.g)),n.d).r()?2:1,e=i.length,r=-n.f+e-t,u=(o=new K).b,u.b+=i,n.f>0&&r>=-6?r>=0?n9(o,e-ei(n.f),iJ):(tt(o.b,t-1,t-1,iW),n9(o,t+1,tU(us,0,-ei(r)-1))):(e-t>=1&&(tt(o.b,t,t,iJ),++e),tt(o.b,e,e,of),r>0&&n9(o,++e,iG),n9(o,++e,i$+r4(r2(r)))),n.i=o.b.b,n.i)}function ip(n,t){var e,r,i,o,u,f;if(i=eg(n),o=eg(t),i>=t.e)return n;if(r=o>i?o:i,0==(e=o>i?-t.b[r]&~n.b[r]:o0){i[o]=u;break}i[o]=u.substring(0,c.index),u=u.substring(c.index+c[0].length,u.length),r.lastIndex=0,f==u&&(i[o]=u.substring(0,1),u=u.substring(1)),f=u,o++}if(0==e&&n.length>0){for(var s=i.length;s>0&&i[s-1]==i$;)--s;s1e6)throw new nr("power of ten too big");if(n<=2147483647)return u$[1].db(t).eb(t);for(i=r=u$[1].db(2147483647),e=r2(n-2147483647),t=ei(n%2147483647);rB(e,o4);)i=en(i,r),e=eY(e,o4);for(i=(i=en(i,u$[1].db(t))).eb(2147483647),e=r2(n-2147483647);rB(e,o4);)i=i.eb(2147483647),e=eY(e,o4);return i.eb(t)}function im(){var n,t;f&&rM("com.iriscouch.gwtapp.client.BigDecimalApp"),nW(new J),nX(new T),nZ(new j),tD(new F),f&&rM("com.google.gwt.user.client.UserAgentAsserter"),n=-1!=(t=r.userAgent.toLowerCase()).indexOf(oQ)?oQ:-1!=t.indexOf("webkit")||function(){if(-1!=t.indexOf("chromeframe"))return!0;if(typeof e.ActiveXObject!=oH)try{var n=new ActiveXObject("ChromeTab.ChromeFrame");if(n)return n.registerBhoIfNeeded(),!0}catch(r){}return!1}()?oj:-1!=t.indexOf(oO)&&u.documentMode>=9?"ie9":-1!=t.indexOf(oO)&&u.documentMode>=8?"ie8":!function(){var n=/msie ([0-9]+)\.([0-9]+)/.exec(t);if(n&&3==n.length)return 1e3*parseInt(n[1])+parseInt(n[2])>=6e3}()?-1!=t.indexOf("gecko")?"gecko1_8":"unknown":"ie6",tj(oj,n)||o.alert("ERROR: Possible problem with your *.gwt.xml module file.\nThe compile time user.agent value (safari) does not match the runtime user.agent value ("+n+"). Expect more errors.\n"),f&&rM("com.google.gwt.user.client.DocumentModeAsserter"),function(){var n,t,e;for(e=0,t=u.compatMode,n=tJ(fN,{6:1},1,[oi]);e>5,this.b=tL(fd,{6:1},-1,this.e,1);u=2147483648&&(r-=4294967296),r));this.b[this.e-1]>>>=31&-n,tW(this)}}function iC(n,t){var e,r,i,o,u,f,c,s,a,h,b,l;if(u=n.f,c=t.f,0==u)return t;if(0==c)return n;if((o=n.e)+(f=t.e)==2)return(e=ts(e3(n.b[0]),o3),r=ts(e3(t.b[0]),o3),u==c)?(l=nx(s=eX(e,r)),0==(b=nx(rU(s,32)))?new t$(u,l):new ti(u,2,tJ(fd,{6:1},-1,[l,b]))):eW(u<0?eY(r,e):eY(e,r));if(u==c)h=u,a=o>=f?t3(n.b,o,t.b,f):t3(t.b,f,n.b,o);else{if(0==(i=o!=f?o>f?1:-1:eN(n.b,t.b,o)))return rK(),uB;1==i?(h=u,a=tz(n.b,o,t.b,f)):(h=c,a=tz(t.b,f,n.b,o))}return tW(s=new ti(h,a.length,a)),s}function iS(n){var t,e,r,i;if(rj(),null==n)throw new nf("null string");if((t=t6(n)).length<27||t.length>45)throw new no(oM);for(r=0;rft.length)throw new V;if(o=null,i=null,67==r[0]?(i=uZ,o=u6):68==r[0]?(i=uX,o=u5):70==r[0]?(i=uY,o=u9):72==r[0]?e>6&&(68==r[5]?(i=u1,o=u7):69==r[5]?(i=u0,o=u8):85==r[5]&&(i=u2,o=fn)):85==r[0]&&(80==r[1]?(i=u3,o=fe):78==r[1]&&(i=u4,o=ft)),i&&e==o.length){for(t=1;tl||r+i>s)throw new q;if(((1&h.c)==0||(4&h.c)!=0)&&b!=c){if(a=tQ(n,11),o=tQ(e,11),nT(n)===nT(e)&&tr;)e8(o,f,a[--t]);else for(f=r+i;ra.r()&&(s=s.cb()),c=eJ(e+(o>u?o:u)),s=(i=o-u)>0?(ib(),i>19!=0&&(t=eP(t),c=!0),u=((b=(a=t).l)&b-1)!=0||((l=a.m)&l-1)!=0||((h=a.h)&h-1)!=0||0==h&&0==l&&0==b?-1:0==h&&0==l&&0!=b?ec(b):0==h&&0!=l&&0==b?ec(l)+22:0!=h&&0==l&&0==b?ec(h)+44:-1,o=!1,i=!1,r=!1,524288==n.h&&0==n.m&&0==n.l){if(i=!0,o=!0,-1!=u)return f=rJ(n,u),c&&eQ(f),e&&(o7=tm(0,0,0)),f;n=nQ((eS(),ui)),r=!0,c=!c}else~~n.h>>19!=0&&(o=!0,n=eP(n),r=!0,c=!c);return -1!=u?(g=n,w=c,d=o,_=rJ(g,u),w&&eQ(_),e&&(v=g,u<=22?(m=v.l&(1<=0&&((w=(b=n).h-u.h)<0||(l=b.l-u.l,(w+=~~(g=b.m-u.m+(~~l>>22))>>22)<0||(b.l=4194303&l,b.m=4194303&g,b.h=1048575&w,0))||(c<22?f.l|=1<>>1,u.m=~~a>>>1|(1&h)<<21,u.l=~~s>>>1|(1&a)<<21,--c;return e&&eQ(f),o&&(r?(o7=eP(n),i&&(o7=eY(o7,(eS(),uu)))):o7=tm(n.l,n.m,n.h)),f}(r?n:tm(n.l,n.m,n.h),t,c,o,i,e):(e&&(o7=o?eP(n):tm(n.l,n.m,n.h)),tm(0,0,0))}function iI(n){var t=[];for(var e in n){var r=typeof n[e];r!=oP?t[t.length]=r:n[e]instanceof Array?t[t.length]=oS:o&&o.bigdecimal&&o.bigdecimal.BigInteger&&n[e]instanceof o.bigdecimal.BigInteger?t[t.length]=i8:o&&o.bigdecimal&&o.bigdecimal.BigDecimal&&n[e]instanceof o.bigdecimal.BigDecimal?t[t.length]=i5:o&&o.bigdecimal&&o.bigdecimal.RoundingMode&&n[e]instanceof o.bigdecimal.RoundingMode?t[t.length]=og:o&&o.bigdecimal&&o.bigdecimal.MathContext&&n[e]instanceof o.bigdecimal.MathContext?t[t.length]=oh:t[t.length]=oP}return t.join(iV)}function iE(n,t){var e,r,i,o,u,f,c,s,a,h,b,l,g,w,d,_,v,m;return e=8191&n.l,r=~~n.l>>13|(15&n.m)<<9,i=~~n.m>>4&8191,o=~~n.m>>17|(255&n.h)<<5,u=~~(1048320&n.h)>>8,f=8191&t.l,c=~~t.l>>13|(15&t.m)<<9,s=~~t.m>>4&8191,a=~~t.m>>17|(255&t.h)<<5,h=~~(1048320&t.h)>>8,w=e*f,d=r*f,_=i*f,v=o*f,m=u*f,0!=c&&(d+=e*c,_+=r*c,v+=i*c,m+=o*c),0!=s&&(_+=e*s,v+=r*s,m+=i*s),0!=a&&(v+=e*a,m+=r*a),0!=h&&(m+=e*h),b=(4194303&w)+((511&d)<<13),l=(~~w>>22)+(~~d>>9)+((262143&_)<<4)+((31&v)<<17),g=(~~_>>18)+(~~v>>5)+((4095&m)<<8),l+=~~b>>22,b&=4194303,g+=~~l>>22,tm(b,l&=4194303,g&=1048575)}function iR(n,t,e){var r,i,o,u,f,c,s,a;if(a=rr(eX(e3(e.b),oK))+(t.e>0?t.e:nU((t.b-1)*.3010299956639812)+1)-(n.e>0?n.e:nU((n.b-1)*.3010299956639812)+1),c=i=n.f-t.f,o=1,f=uv.length-1,s=tJ(f5,{6:1},17,[(n.d||(n.d=eU(n.g)),n.d)]),0==e.b||0==n.b&&-1!=n.g||0==t.b&&-1!=t.g)return iA(n,t);if(a>0&&(e8(s,0,en((n.d||(n.d=eU(n.g)),n.d),iv(a))),c+=a),u=(s=r3(s[0],(t.d||(t.d=eU(t.g)),t.d)))[0],0!=s[1].r())r=rn(eF(s[1]),(t.d||(t.d=eU(t.g)),t.d)),u=iC(en(u,(rK(),ux)),eW(e3(s[0].r()*(5+r)))),++c;else for(;!u.gb(0);)if(0==(s=r3(u,uv[o]))[1].r()&&c-o>=i)c-=o,o=0)return n;return 0==e?np(n.b,t.b)+1<54?new tr(n.g-t.g,n.f):new tM(is((n.d||(n.d=eU(n.g)),n.d),(t.d||(t.d=eU(t.g)),t.d)),n.f):e>0?e0?t.e:nU((t.b-1)*.3010299956639812)+1)+o>(n.e>0?n.e:nU((n.b-1)*.3010299956639812)+1)+1||0==n.b&&-1!=n.g)rK(),r=uB;else if(0==o)r=ia((n.d||(n.d=eU(n.g)),n.d),(t.d||(t.d=eU(t.g)),t.d));else if(o>0)u=iv(o),r=ia((n.d||(n.d=eU(n.g)),n.d),en((t.d||(t.d=eU(t.g)),t.d),u)),r=en(r,u);else{for(u=iv(-o),r=ia(en((n.d||(n.d=eU(n.g)),n.d),u),(t.d||(t.d=eU(t.g)),t.d));!r.gb(0);)if(0==(f=r3(r,uv[e]))[1].r()&&c-e>=o)c-=e,e=0;){if(w[h]==c)s=-1;else if(s=nx(m=r0(eX(rL(ts(e3(w[h]),o3),32),ts(e3(w[h-1]),o3)),c)),v=nx(rJ(m,32)),0!=s){_=!1,++s;do{if(--s,_)break;l=iE(ts(e3(s),o3),ts(e3(d[o-2]),o3)),y=eX(rL(e3(v),32),ts(e3(w[h-2]),o3)),32>rH(nx(rU(g=eX(ts(e3(v),o3),ts(e3(c),o3)),32)))?_=!0:v=nx(g)}while(rB(th(l,o$),th(y,o$)))}if(0!=s&&0!=function(n,t,e,r,i){var o,u,f;for(f=0,o=oz,u=oz;f0)e8(b,0,ia((n.d||(n.d=eU(n.g)),n.d),en((t.d||(t.d=eU(t.g)),t.d),iv(o)))),h=o<(a-l+1>0?a-l+1:0)?o:a-l+1>0?a-l+1:0,e8(b,0,en(b[0],iv(h)));else if(u=-o<(a-i>0?a-i:0)?-o:a-i>0?a-i:0,b=r3(en((n.d||(n.d=eU(n.g)),n.d),iv(u)),(t.d||(t.d=eU(t.g)),t.d)),h+=u,u=-h,0!=b[1].r()&&u>0&&(0==(r=new nk(b[1]).q()+u-t.q())&&(e8(b,1,ia(en(b[1],iv(u)),(t.d||(t.d=eU(t.g)),t.d))),r=(d=b[1].r())<0?-d:d),r>0))throw new nr(ou);if(0==b[0].r())return eL(o);for(w=b[0],g=(c=new nk(b[0])).q(),f=1;!w.gb(0);)if(0==(b=r3(w,uv[f]))[1].r()&&(g-f>=a||h-f>=o))g-=f,h-=f,fa)throw new nr(ou);return c.f=eJ(h),tR(c,w),c}function iT(){var n;for(n=0,iT=l,uz=tJ(fd,{6:1},-1,[0,0,1854,1233,927,747,627,543,480,431,393,361,335,314,295,279,265,253,242,232,223,216,181,169,158,150,145,140,136,132,127,123,119,114,110,105,101,96,92,87,83,78,73,69,64,59,54,49,44,38,32,26,1]),uJ=tL(f5,{6:1},17,(uK=tJ(fd,{6:1},-1,[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021])).length,0);n=0;--c)w=function(n){var t,e,r;return rA(n,oz)?(e=nP(n,o2),r=n3(n,o2)):(e=nP(t=rU(n,1),o0),r=eX(rL(r=n3(t,o0),1),ts(n,oJ))),ta(rL(r,32),ts(e,o3))}(eX(rL(y,32),ts(e3(M[c]),o3))),M[c]=nx(w),y=e3(nx(rJ(w,32)));d=nx(y),g=e;do v[--e]=48+d%10&65535;while(0!=(d=~~(d/10))&&0!=e)for(f=0,r=9-g+e;f0;++f)v[--e]=48;for(a=x-1;0==M[a];--a)if(0==a)break n;x=a+1}for(;48==v[e];)++e}if(h=C<0,o=_-e-t-1,0==t)return h&&(v[--e]=45),tU(v,e,_-e);if(t>0&&o>=-6){if(o>=0){for(s=e+o,a=_-1;a>=s;--a)v[a+1]=v[a];return v[++s]=46,h&&(v[--e]=45),tU(v,e,_-e+1)}for(a=2;a<-o+1;++a)v[--e]=48;return v[--e]=46,v[--e]=48,h&&(v[--e]=45),tU(v,e,_-e)}return(S=e+1,m=new W,h&&(m.b.b+=iz),_-S>=1)?(tI(m,v[e]),m.b.b+=iJ,N=m.b,I=tU(v,e+1,_-e-1),N.b+=I):(E=m.b,R=tU(v,e,_-e),E.b+=R),m.b.b+=of,o>0&&(m.b.b+=iG),O=m.b,O.b+=i$+o,m.b.b}f&&f({moduleName:"gwtapp",sessionId:c,subSystem:"startup",evtGroup:"moduleStartup",millis:new Date().getTime(),type:"moduleEvalStart"});var iF,iH,i$="",iV=" ",iq='"',iG="+",iz="-",iJ=".",iK="0",iW="0.",iZ="0.0",iX="0.00",iY="0.000",i1="0.0000",i0="0.00000",i2="0.000000",i4="0E",i3="0E+",i6=":",i5="BigDecimal",i9="BigDecimal MathContext",i7="BigDecimal;",i8="BigInteger",on="BigInteger divide by zero",ot="BigInteger not invertible.",oe="BigInteger: modulus not positive",or="BigInteger;",oi="CSS1Compat",oo="Division by zero",ou="Division impossible",of="E",oc='For input string: "',os="Infinite or NaN",oa="Invalid Operation",oh="MathContext",ob="Negative bit address",ol="Rounding necessary",og="RoundingMode",ow="RoundingMode;",od="String",op="[Lcom.iriscouch.gwtapp.client.",o_="[Ljava.lang.",ov="[Ljava.math.",om="\\.",oy="__gwtex_wrap",oC="anonymous",oS="array",oM="bad string format",ox="bigdecimal",oB="com.google.gwt.core.client.",oA="com.google.gwt.core.client.impl.",oN="com.iriscouch.gwtapp.client.",oI="java.lang.",oE="java.math.",oR="java.util.",oO="msie",oD="null",ok="number",oL="number MathContext",oU="number number",oP="object",oQ="opera",oT="org.timepedia.exporter.client.",oj="safari",oF="string",oH="undefined",o$={l:0,m:0,h:524288},oV={l:0,m:4193280,h:1048575},oq={l:4194298,m:4194303,h:1048575},oG={l:4194303,m:4194303,h:1048575},oz={l:0,m:0,h:0},oJ={l:1,m:0,h:0},oK={l:2,m:0,h:0},oW={l:5,m:0,h:0},oZ={l:10,m:0,h:0},oX={l:11,m:0,h:0},oY={l:18,m:0,h:0},o1={l:48,m:0,h:0},o0={l:877824,m:119,h:0},o2={l:1755648,m:238,h:0},o4={l:4194303,m:511,h:0},o3={l:4194303,m:1023,h:0},o6={l:0,m:1024,h:0};(iH=s.prototype={}).eQ=function(n){return this===n},iH.gC=function(){return fc},iH.hC=function(){return nj(this)},iH.tS=function(){return this.gC().d+"@"+function(n){var t,e;if(t=tL(fJ,{6:1},-1,8,1),r_(),e=7,n>=0)for(;n>15;)t[e--]=uR[15&n],n>>=4;else for(;e>0;)t[e--]=uR[15&n],n>>=4;return t[e]=uR[15&n],t4(t,e,8)}(this.hC())},iH.toString=function(){return this.tS()},iH.tM=l,iH.cM={},(iH=a.prototype=new s).gC=function(){return fa},iH.j=function(){return this.f},iH.tS=function(){var n,t;return n=this.gC().d,null!=(t=this.j())?n+": "+t:n},iH.cM={6:1,15:1},iH.f=null,(iH=h.prototype=new a).gC=function(){return fh},iH.cM={6:1,15:1},(iH=ne.prototype=b.prototype=new h).gC=function(){return fb},iH.cM={6:1,12:1,15:1},(iH=n1.prototype=(function(){}).prototype=new b).gC=function(){return fl},iH.j=function(){var n,t,e,r,i;return null==this.d&&(this.e=null==(e=this.c)?oD:tn(e)?null==(r=t9(e))?null:r.name:nG(e,1)?od:(nF(e)?e.gC():fg).d,this.b=tn(n=this.c)?null==(i=t9(n))?null:i.message:n+i$,this.d="("+this.e+"): "+this.b+(tn(t=this.c)?function(n){var t=i$;try{for(var e in n)if("name"!=e&&"message"!=e&&"toString"!=e)try{t+="\n "+e+": "+n[e]}catch(r){}}catch(i){}return t}(t9(t)):i$)),this.d},iH.cM={6:1,12:1,15:1},iH.b=null,iH.c=null,iH.d=null,iH.e=null,(iH=g.prototype=new s).gC=function(){return fw};var o5=0,o9=0;(iH=w.prototype=(function(){}).prototype=new g).gC=function(){return fv},iH.b=null,iH.c=null,(iH=d.prototype=_.prototype=new s).k=function(){for(var n={},t=[],e=arguments.callee.caller.caller;e;){var r,i,o=this.n(e.toString());t.push(o);var u=i6+o,f=n[u];if(f){for(r=0,i=f.length;r0?i:oC},iH.gC=function(){return fm},iH.o=function(n){return[]},(iH=v.prototype=new _).k=function(){return tl(this.o(tw()),this.p())},iH.gC=function(){return fS},iH.o=function(n){return eR(this,n)},iH.p=function(){return 2},(iH=m.prototype=(function(){}).prototype=new v).k=function(){return es(this)},iH.n=function(n){var t,e;return 0==n.length||(0==(e=e9(n)).indexOf("at ")&&(e=n7(e,3)),-1==(t=e.indexOf("["))&&(t=e.indexOf("(")),-1==t)?oC:(-1!=(t=(e=e9(e.substr(0,t-0))).indexOf("."))&&(e=n7(e,t+1)),e.length>0?e:oC)},iH.gC=function(){return fM},iH.o=function(n){return t2(this,n)},iH.p=function(){return 3},(iH=y.prototype=new s).gC=function(){return fx},(iH=C.prototype=(function(){}).prototype=new y).gC=function(){return fB},iH.b=i$,(iH=S.prototype=(function(){}).prototype=new s).gC=function(){return this.aC},iH.aC=null,iH.qI=0;var o7=null,o8=null;(iH=M.prototype=(function(){}).prototype=new s).gC=function(){return fI},iH.cM={2:1},(iH=x.prototype=new s).gC=function(){return fR},iH.cM={6:1,10:1};var un=null;(iH=eo.prototype=tr.prototype=tM.prototype=tA.prototype=Z.prototype=ep.prototype=eu.prototype=tB.prototype=tx.prototype=ez.prototype=n2.prototype=n4.prototype=te.prototype=tS.prototype=nk.prototype=B.prototype=new x).eQ=function(n){return e0(this,n)},iH.gC=function(){return fO},iH.hC=function(){return rv(this)},iH.q=function(){return rT(this)},iH.r=function(){return ew(this)},iH.tS=function(){return id(this)},iH.cM={6:1,8:1,10:1,16:1},iH.b=0,iH.c=0,iH.d=null,iH.e=0,iH.f=0,iH.g=0,iH.i=null;var ut,ue,ur,ui,uo,uu,uf,uc,us,ua,uh,ub,ul,ug,uw,ud,up,u_=null,uv=null,um=null;(iH=nL.prototype=ng.prototype=(function(){}).prototype=new B).s=function(n){var t,e,r;if((e=iI(n))==i$)t=0>ew(this)?ed(this):this;else if(e==oh)t=0>(r=t7(this,new iS(n[0].toString()))).r()?ed(r):r;else throw new ne("Unknown call signature for interim = super.abs: "+e);return new nL(t)},iH.t=function(n){var t,e;if((e=iI(n))==i5)t=r1(this,new Z(n[0].toString()));else if(e==i9)t=function(n,t,e){var r,i,o,u,f;if(r=n.f-t.f,0==t.b&&-1!=t.g||0==n.b&&-1!=n.g||0==e.b)return t7(r1(n,t),e);if((n.e>0?n.e:nU((n.b-1)*.3010299956639812)+1)0?t.e:nU((t.b-1)*.3010299956639812)+1)<-r-1))return t7(r1(n,t),e);i=n,u=t}return e.b>=(i.e>0?i.e:nU((i.b-1)*.3010299956639812)+1)?t7(r1(n,t),e):(f=(o=i.r())==u.r()?iC(rW((i.d||(i.d=eU(i.g)),i.d),10),eW(e3(o))):iC(rW(f=is((i.d||(i.d=eU(i.g)),i.d),eW(e3(o))),10),eW(e3(9*o))),t7(i=new tM(f,i.f+1),e))}(this,new Z(n[0].toString()),new iS(n[1].toString()));else throw new ne("Unknown call signature for interim = super.add: "+e);return new nL(t)},iH.u=function(){return~~(nx(t8(this,8))<<24)>>24},iH.v=function(n){return iu(this,n)},iH.w=function(n){var t,e,r,i;if((i=iI(n))==i5)e=eb(this,new Z(n[0].toString()));else if(i==i9)e=el(this,new Z(n[0].toString()),new iS(n[1].toString()));else throw new ne("Unknown call signature for interim = super.divideAndRemainder: "+i);for(t=0,r=tL(fk,{6:1},3,e.length,0);t129?n*=1/0:n=t5(id(this)),n},iH.gC=function(){return fD},iH.hC=function(){return rv(this)},iH.B=function(){var n;return this.f<=-32||this.f>(this.e>0?this.e:nU((this.b-1)*.3010299956639812)+1)?0:(n=new n0(0==this.f||0==this.b&&-1!=this.g?(this.d||(this.d=eU(this.g)),this.d):this.f<0?en((this.d||(this.d=eU(this.g)),this.d),iv(-this.f)):ia((this.d||(this.d=eU(this.g)),this.d),iv(this.f)))).f*n.b[0]},iH.C=function(){return nx(t8(this,32))},iH.D=function(){return nx(t8(this,32))},iH.E=function(){return t5(id(this))},iH.F=function(n){return new nL(iu(this,n)>=0?this:n)},iH.G=function(n){return new nL(0>=iu(this,n)?this:n)},iH.H=function(n){return new nL(rz(this,this.f+n))},iH.I=function(n){return new nL(rz(this,this.f-n))},iH.J=function(n){var t,e;if((e=iI(n))==i5)t=rD(this,new Z(n[0].toString()));else if(e==i9)t=tb(this,new Z(n[0].toString()),new iS(n[1].toString()));else throw new ne("Unknown call signature for interim = super.multiply: "+e);return new nL(t)},iH.K=function(n){var t,e;if((e=iI(n))==i$)t=ed(this);else if(e==oh)t=ed(t7(this,new iS(n[0].toString())));else throw new ne("Unknown call signature for interim = super.negate: "+e);return new nL(t)},iH.L=function(n){var t,e;if((e=iI(n))==i$)t=this;else if(e==oh)t=t7(this,new iS(n[0].toString()));else throw new ne("Unknown call signature for interim = super.plus: "+e);return new nL(t)},iH.M=function(n){var t,e;if((e=iI(n))==ok)t=rw(this,n[0]);else if(e==oL)t=function(n,t,e){var r,i,o,u,f,c;if(o=t<0?-t:t,u=e.b,i=ei(n8(o))+1,f=e,0==t||0==n.b&&-1!=n.g&&t>0)return rw(n,t);if(o>999999999||0==u&&t<0||u>0&&i>u)throw new nr(oa);for(u>0&&(f=new eK(u+i+1,e.c)),r=t7(n,f),c=~~function(n){var t;if(n<0)return -2147483648;if(0==n)return 0;for(t=1073741824;(t&n)==0;t>>=1);return t}(o)>>1;c>0;)r=tb(r,r,f),(o&c)==c&&(r=tb(r,n,f)),c>>=1;return t<0&&(r=iR(ug,r,f)),ic(r,e),r}(this,n[0],new iS(n[1].toString()));else throw new ne("Unknown call signature for interim = super.pow: "+e);return new nL(t)},iH.q=function(){return rT(this)},iH.N=function(n){var t,e;if((e=iI(n))==i5)t=eb(this,new Z(n[0].toString()))[1];else if(e==i9)t=el(this,new Z(n[0].toString()),new iS(n[1].toString()))[1];else throw new ne("Unknown call signature for interim = super.remainder: "+e);return new nL(t)},iH.O=function(n){return new nL(t7(this,new iS(ea(n.b))))},iH.P=function(){return ei(this.f)},iH.Q=function(n){var t,e;return new nL((t=this,(e=t.f-n,t.b<54)?0==t.g?eL(e):new tr(t.g,eJ(e)):new tS((t.d||(t.d=eU(t.g)),t.d),eJ(e))))},iH.R=function(n){var t,e;if((e=iI(n))==ok)t=rY(this,n[0],(iB(),u4));else if(e==oU)t=rY(this,n[0],rP(n[1]));else if("number RoundingMode"==e)t=rY(this,n[0],tc(n[1].toString()));else throw new ne("Unknown call signature for interim = super.setScale: "+e);return new nL(t)},iH.S=function(){return~~(nx(t8(this,16))<<16)>>16},iH.r=function(){return ew(this)},iH.T=function(){return new nL(function(n){var t,e,r,i,o;if(t=1,e=uv.length-1,r=n.f,0==n.b&&-1!=n.g)return new Z(iK);for(n.d||(n.d=eU(n.g)),o=n.d;!o.gb(0);)if(0==(i=r3(o,uv[t]))[1].r())r-=t,t0?i.e:nU((i.b-1)*.3010299956639812)+1)0?r.e:nU((r.b-1)*.3010299956639812)+1)?(f=(c=ew(r))!=i.r()?iC(rW((r.d||(r.d=eU(r.g)),r.d),10),eW(e3(c))):iC(rW(f=is((r.d||(r.d=eU(r.g)),r.d),eW(e3(c))),10),eW(e3(9*c))),t7(new tM(f,r.f+1),o)):t7(iO(r,i),o);else throw new ne("Unknown call signature for interim = super.subtract: "+e);return new nL(t)},iH.V=function(){return new n0(0==this.f||0==this.b&&-1!=this.g?(this.d||(this.d=eU(this.g)),this.d):this.f<0?en((this.d||(this.d=eU(this.g)),this.d),iv(-this.f)):ia((this.d||(this.d=eU(this.g)),this.d),iv(this.f)))},iH.W=function(){return new n0(r6(this))},iH.X=function(){return function(n){var t,e,r,i,o,u,f,c;if(u=ij((n.d||(n.d=eU(n.g)),n.d),0),0==n.f)return u;if(t=0>(n.d||(n.d=eU(n.g)),n.d).r()?2:1,r=u.length,i=-n.f+r-t,c=new nV(u),n.f>0&&i>=-6)i>=0?n9(c,r-ei(n.f),iJ):(tt(c.b,t-1,t-1,iW),n9(c,t+1,tU(us,0,-ei(i)-1)));else{if(e=r-t,0!=(f=ei(i%3))&&(0==(n.d||(n.d=eU(n.g)),n.d).r()?i+=f=f<0?-f:3-f:(i-=f=f<0?f+3:f,t+=f),e<3))for(o=f-e;o>0;--o)n9(c,r++,iK);r-t>=1&&(tt(c.b,t,t,iJ),++r),0!=i&&(tt(c.b,r,r,of),i>0&&n9(c,++r,iG),n9(c,++r,i$+r4(r2(i))))}return c.b.b}(this)},iH.Y=function(){return function(n){var t,e,r,i,o,u;if(r=ij((n.d||(n.d=eU(n.g)),n.d),0),0==n.f||0==n.b&&-1!=n.g&&n.f<0)return r;if(t=0>ew(n)?1:0,e=n.f,i=new W(r.length+1+((o=ei(n.f))<0?-o:o)),1==t&&(i.b.b+=iz),n.f>0){if((e-=r.length-t)>=0){for(i.b.b+=iW;e>us.length;e-=us.length)tq(i,us);n5(i,us,ei(e)),nI(i,n7(r,t))}else nI(i,(u=ei(e=t-e),r.substr(t,u-t))),i.b.b+=iJ,nI(i,n7(r,ei(e)))}else{for(nI(i,n7(r,t));e<-us.length;e+=us.length)tq(i,us);n5(i,us,ei(-e))}return i.b.b}(this)},iH.tS=function(){return id(this)},iH.Z=function(){return new nL(new tr(1,this.f))},iH.$=function(){return new n0((this.d||(this.d=eU(this.g)),this.d))},iH.cM={3:1,6:1,8:1,10:1,16:1,24:1},(iH=F.prototype=(function(){}).prototype=new s).gC=function(){return fL};var uy=!1;(iH=ro.prototype=ri.prototype=ti.prototype=e5.prototype=t$.prototype=ra.prototype=nq.prototype=iy.prototype=A.prototype=new x)._=function(){return this.f<0?new ti(1,this.e,this.b):this},iH.ab=function(){return eV(this)},iH.eQ=function(n){return e$(this,n)},iH.gC=function(){return fU},iH.bb=function(){return t1(this)},iH.hC=function(){return eD(this)},iH.cb=function(){return 0==this.f?this:new ti(-this.f,this.e,this.b)},iH.db=function(n){return rk(this,n)},iH.eb=function(n){return tX(this,n)},iH.fb=function(n){return tY(this,n)},iH.r=function(){return this.f},iH.gb=function(n){return rQ(this,n)},iH.tS=function(){return ij(this,0)},iH.cM={6:1,8:1,10:1,17:1},iH.b=null,iH.c=-2,iH.d=0,iH.e=0,iH.f=0;var uC,uS,uM,ux,uB,uA=null;(iH=n0.prototype=nO.prototype=nD.prototype=(function(){}).prototype=new A)._=function(){return new n0(this.f<0?new ti(1,this.e,this.b):this)},iH.hb=function(n){return new n0(iC(this,n))},iH.ib=function(n){return new n0(0==n.f||0==this.f?(rK(),uB):e$(n,(rK(),uC))?this:e$(this,uC)?n:this.f>0?n.f>0?function(n,t){var e,r,i,o;if(i=nd(n.e,t.e),(e=np(eg(n),eg(t)))>=i)return rK(),uB;for(r=tL(fd,{6:1},-1,i,1);e0?rG(n,this):this.e>n.e?ip(this,n):ip(n,this))},iH.jb=function(n){return new n0(0==n.f?this:0==this.f?(rK(),uB):e$(this,(rK(),uC))?new n0(r7(n)):e$(n,uC)?uB:this.f>0?n.f>0?function(n,t){var e,r,i,o;for(i=tL(fd,{6:1},-1,n.e,1),r=nd(n.e,t.e),e=eg(n);e=n.e)return n;for(o=tL(fd,{6:1},-1,u=nd(n.e,t.e),1),e=i;e0?function(n,t){var e,r,i,o,u,f,c;if(i=eg(n),o=eg(t),i>=t.e)return n;if(c=np(n.e,t.e),r=i,o>i){for(f=tL(fd,{6:1},-1,c,1),u=nd(n.e,o);r=t.e)return rK(),uB;if(u=tL(fd,{6:1},-1,f=t.e,1),e=i,i0)for(;e34028234663852886e22?1/0:n<-34028234663852886e22?-1/0:n},iH.qb=function(n){return new n0(rE(this,n))},iH.gC=function(){return fP},iH.bb=function(){return t1(this)},iH.hC=function(){return eD(this)},iH.B=function(){return this.f*this.b[0]},iH.rb=function(n){return function(n,t){var e,r;if(iT(),t<=0||1==n.e&&2==n.b[0])return!0;if(!rQ(n,0))return!1;if(1==n.e&&(-1024&n.b[0])==0)return function(n,t){var e,r,i,o;for(r=0,e=n.length-1;r<=e;)if((o=n[i=r+(~~(e-r)>>1)])t))return i;e=i-1}return-r-1}(uK,n.b[0])>=0;for(r=1;r>1)?r:1+(~~(t-1)>>1))}(new n0(this.f<0?new ti(1,this.e,this.b):this),n)},iH.sb=function(){return t5(ij(this,0))},iH.tb=function(n){return new n0(1==rn(this,n)?this:n)},iH.ub=function(n){return new n0(-1==rn(this,n)?this:n)},iH.vb=function(n){return new n0(et(this,n))},iH.wb=function(n){return new n0(rR(this,n))},iH.xb=function(n,t){return new n0(rq(this,n,t))},iH.yb=function(n){return new n0(en(this,n))},iH.cb=function(){return new n0(0==this.f?this:new ti(-this.f,this.e,this.b))},iH.zb=function(){return new n0(function(n){if(n.f<0)throw new nr("start < 0: "+n);return function(n){var t,e,r,i,o,u,f,c;if(iT(),o=tL(fd,{6:1},-1,uK.length,1),r=tL(f_,{6:1},-1,1024,2),1==n.e&&n.b[0]>=0&&n.b[0]=uK[e];++e);return uJ[e]}for(f=new ti(1,n.e,tL(fd,{6:1},-1,n.e+1,1)),ix(n.b,0,f.b,0,n.e),rQ(n,0)?tK(f,2):f.b[0]|=1,i=f.ab(),t=2;i0?n.f>0?this.e>n.e?rl(this,n):rl(n,this):ig(this,n):n.f>0?ig(n,this):eg(n)>eg(this)?rZ(n,this):rZ(this,n))},iH.db=function(n){return new n0(rk(this,n))},iH.Cb=function(n){return new n0(rF(this,n))},iH.Db=function(n){return new n0(rQ(this,n)?this:it(this,n))},iH.eb=function(n){return new n0(tX(this,n))},iH.fb=function(n){return new n0(tY(this,n))},iH.r=function(){return this.f},iH.Eb=function(n){return new n0(is(this,n))},iH.gb=function(n){return rQ(this,n)},iH.Fb=function(n){var t,e;if((e=iI(n))==i$)t=ij(this,0);else if(e==ok)t=function(n,t){var e,r,i,o,u,f,c,s,a,h,b,l,g,w,d,_;if(iM(),g=n.f,s=n.e,u=n.b,0==g)return iK;if(1==s)return _=ts(e3(u[0]),o3),g<0&&(_=eP(_)),function(n,t){var e,r,i;if(10==t||t<2||t>36)return i$+r4(n);if(e=tL(fJ,{6:1},-1,65,1),r_(),r=64,i=e3(t),rA(n,oz)){for(;rA(n,i);)e[r--]=uR[nx(n3(n,i))],n=iN(n,i,!1);e[r]=uR[nx(n)]}else{for(;!rB(n,eP(i));)e[r--]=uR[nx(eP(n3(n,i)))],n=iN(n,i,!1);e[r--]=uR[nx(eP(n))],e[r]=45}return t4(e,r,65)}(_,t);if(10==t||t<2||t>36)return ij(n,0);if(l=tL(fJ,{6:1},-1,b=ei(eV(new n0(n.f<0?new ti(1,n.e,n.b):n))/(Math.log(t)/Math.log(2))+(g<0?1:0))+1,1),i=b,16!=t)for(ix(u,0,w=tL(fd,{6:1},-1,s,1),0,s),d=s,r=uU[t],e=uL[t-2];;){h=ir(w,w,d,e),a=i;do l[--i]=ev(h%t,t);while(0!=(h=~~(h/t))&&0!=i)for(f=0,o=r-a+i;f0;++f)l[--i]=48;for(f=d-1;f>0&&0==w[f];--f);if(1==(d=f+1)&&0==w[0])break}else for(f=0;f0;++c)h=~~u[f]>>(c<<2)&15,l[--i]=ev(h,16);for(;48==l[i];)++i;return -1==g&&(l[--i]=45),tU(l,i,b-i)}(this,n[0]);else throw new ne("Unknown call signature for result = super.toString: "+e);return t},iH.Gb=function(n){return new n0(0==n.f?this:0==this.f?n:e$(n,(rK(),uC))?new n0(r7(this)):e$(this,uC)?new n0(r7(n)):this.f>0?n.f>0?this.e>n.e?rg(this,n):rg(n,this):iL(this,n):n.f>0?iL(n,this):eg(n)>eg(this)?ii(n,this):ii(this,n))},iH.cM={4:1,6:1,8:1,10:1,17:1,24:1},(iH=j.prototype=(function(){}).prototype=new s).gC=function(){return fT};var uN=!1;(iH=nv.prototype=nm.prototype=(function(){}).prototype=new s).gC=function(){return fj},iH.Hb=function(){return this.b.b},iH.Ib=function(){return new Y(this.b.c)},iH.hC=function(){return nM(this.b)},iH.tS=function(){return ea(this.b)},iH.cM={24:1},iH.b=null,(iH=T.prototype=(function(){}).prototype=new s).gC=function(){return fF};var uI=!1;(iH=Y.prototype=ny.prototype=(function(){}).prototype=new s).gC=function(){return fH},iH.Jb=function(){return this.b.b},iH.tS=function(){return this.b.b},iH.cM={5:1,24:1},iH.b=null,(iH=J.prototype=(function(){}).prototype=new s).gC=function(){return fV};var uE=!1;(iH=nr.prototype=(function(){}).prototype=new b).gC=function(){return fq},iH.cM={6:1,12:1,15:1},(iH=ni.prototype=$.prototype=(function(){}).prototype=new b).gC=function(){return fz},iH.cM={6:1,12:1,15:1},(iH=N.prototype=(function(){}).prototype=new s).gC=function(){return fK},iH.tS=function(){return((2&this.c)!=0?"interface ":(1&this.c)!=0?i$:"class ")+this.d},iH.b=null,iH.c=0,iH.d=null,(iH=H.prototype=(function(){}).prototype=new b).gC=function(){return fW},iH.cM={6:1,12:1,15:1},(iH=I.prototype=new s).eQ=function(n){return this===n},iH.gC=function(){return fs},iH.hC=function(){return nj(this)},iH.tS=function(){return this.b},iH.cM={6:1,8:1,9:1},iH.b=null,iH.c=0,(iH=no.prototype=V.prototype=E.prototype=new b).gC=function(){return fZ},iH.cM={6:1,12:1,15:1},(iH=nu.prototype=q.prototype=R.prototype=new b).gC=function(){return fG},iH.cM={6:1,12:1,15:1},(iH=nf.prototype=G.prototype=(function(){}).prototype=new b).gC=function(){return fX},iH.cM={6:1,12:1,15:1},(iH=nw.prototype=(function(){}).prototype=new E).gC=function(){return fY},iH.cM={6:1,12:1,15:1},(iH=to.prototype=(function(){}).prototype=new s).gC=function(){return fy},iH.tS=function(){return this.b+iJ+this.d+"(Unknown Source"+(this.c>=0?i6+this.c:i$)+")"},iH.cM={6:1,13:1},iH.b=null,iH.c=0,iH.d=null,(iH=String.prototype).eQ=function(n){return tj(this,n)},iH.gC=function(){return fA},iH.hC=function(){var n,t;return nJ(),null!=(t=uD[n=i6+this])?t:(null==(t=uO[n])&&(t=function(n){var t,e,r,i;for(t=0,i=(r=n.length)-4,e=0;e left + width + 8) return; percent = pxStep > 1 ? (data.pageX - left) / width * 100 : Math.round((data.pageX - left) / width * 100); } else null == val && (val = isInput ? parseFloat(control.val() || 0) : control[0].selectedIndex), percent = (parseFloat(val) - min) / (max - min) * 100; - if (!isNaN(percent) && (valModStep = ((newval = percent / 100 * (max - min) + min) - min) % step, alignValue = newval - valModStep, 2 * Math.abs(valModStep) >= step && (alignValue += valModStep > 0 ? step : -step), percentPerStep = 100 / ((max - min) / step), newval = parseFloat(alignValue.toFixed(5)), void 0 === pxStep && (pxStep = width / ((max - min) / step)), pxStep > 1 && isInput && (percent = (newval - min) * percentPerStep * (1 / step)), percent < 0 && (percent = 0), percent > 100 && (percent = 100), newval < min && (newval = min), newval > max && (newval = max), this.handle.css("left", percent + "%"), this.handle[0].setAttribute("aria-valuenow", isInput ? newval : optionElements.eq(newval).attr("value")), this.handle[0].setAttribute("aria-valuetext", isInput ? newval : optionElements.eq(newval).getEncodedText()), this.handle[0].setAttribute("title", isInput ? newval : optionElements.eq(newval).getEncodedText()), this.valuebg && this.valuebg.css("width", percent + "%"), this._labels && (handlePercent = this.handle.width() / this.slider.width() * 100, aPercent = percent && handlePercent + (100 - handlePercent) * percent / 100, bPercent = 100 === percent ? 0 : Math.min(handlePercent + 100 - aPercent, 100), this._labels.each(function() { + if (!isNaN(percent) && (valModStep = ((newval = percent / 100 * (max - min) + min) - min) % step, alignValue = newval - valModStep, 2 * Math.abs(valModStep) >= step && (alignValue += valModStep > 0 ? step : -step), newval = parseFloat(alignValue.toFixed(5)), void 0 === pxStep && (pxStep = width / ((max - min) / step)), pxStep > 1 && isInput && (percent = (newval - min) * (100 / ((max - min) / step)) * (1 / step)), percent < 0 && (percent = 0), percent > 100 && (percent = 100), newval < min && (newval = min), newval > max && (newval = max), this.handle.css("left", percent + "%"), this.handle[0].setAttribute("aria-valuenow", isInput ? newval : optionElements.eq(newval).attr("value")), this.handle[0].setAttribute("aria-valuetext", isInput ? newval : optionElements.eq(newval).getEncodedText()), this.handle[0].setAttribute("title", isInput ? newval : optionElements.eq(newval).getEncodedText()), this.valuebg && this.valuebg.css("width", percent + "%"), this._labels && (handlePercent = this.handle.width() / this.slider.width() * 100, aPercent = percent && handlePercent + (100 - handlePercent) * percent / 100, bPercent = 100 === percent ? 0 : Math.min(handlePercent + 100 - aPercent, 100), this._labels.each(function() { var ab = $(this).hasClass("ui-slider-label-a"); $(this).width((ab ? aPercent : bPercent) + "%"); })), !preventInputUpdate)) { @@ -2915,12 +2915,12 @@ this._prepareHeightUpdate(this.options.keyupTimeoutBuffer); }, _updateHeight: function() { - var scrollHeight, clientHeight, height, scrollTop = this.window.scrollTop(); + var paddingTop, scrollHeight, clientHeight, borderTop, height, scrollTop = this.window.scrollTop(); this.keyupTimeout = 0, "onpage" in this.element[0] || this.element.css({ height: 0, "min-height": 0, "max-height": 0 - }), scrollHeight = this.element[0].scrollHeight, clientHeight = this.element[0].clientHeight, height = scrollHeight + (parseFloat(this.element.css("border-top-width")) + parseFloat(this.element.css("border-bottom-width"))) + 15, 0 === clientHeight && (height += parseFloat(this.element.css("padding-top")) + parseFloat(this.element.css("padding-bottom"))), this.element.css({ + }), scrollHeight = this.element[0].scrollHeight, clientHeight = this.element[0].clientHeight, borderTop = parseFloat(this.element.css("border-top-width")), height = scrollHeight + (borderTop + parseFloat(this.element.css("border-bottom-width"))) + 15, 0 === clientHeight && (paddingTop = parseFloat(this.element.css("padding-top")), height += paddingTop + parseFloat(this.element.css("padding-bottom"))), this.element.css({ height: height, "min-height": "", "max-height": "" diff --git a/crates/swc_ecma_minifier/tests/projects/output/react-17.0.1.js b/crates/swc_ecma_minifier/tests/projects/output/react-17.0.1.js index 67f8d1f24d94..23a8f42c1a78 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/react-17.0.1.js +++ b/crates/swc_ecma_minifier/tests/projects/output/react-17.0.1.js @@ -603,20 +603,6 @@ try { Object.freeze({}); } catch (e) {} - var cloneElement$1 = function(element, props, children) { - for(var newElement = cloneElement.apply(this, arguments), i = 2; i < arguments.length; i++)validateChildKeys(arguments[i], newElement.type); - return validatePropTypes(newElement), newElement; - }, createFactory = function(type) { - var validatedFactory = createElementWithValidation.bind(null, type); - return validatedFactory.type = type, didWarnAboutDeprecatedCreateFactory || (didWarnAboutDeprecatedCreateFactory = !0, warn("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")), Object.defineProperty(validatedFactory, "type", { - enumerable: !1, - get: function() { - return warn("Factory.type is deprecated. Access the class directly before passing it to createFactory."), Object.defineProperty(this, "type", { - value: type - }), type; - } - }), validatedFactory; - }; exports.Children = { map: mapChildren, forEach: function(children, forEachFunc, forEachContext) { @@ -639,7 +625,10 @@ if (!isValidElement(children)) throw Error("React.Children.only expected to receive a single React element child."); return children; } - }, exports.Component = Component, exports.PureComponent = PureComponent, exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals, exports.cloneElement = cloneElement$1, exports.createContext = function(defaultValue, calculateChangedBits) { + }, exports.Component = Component, exports.PureComponent = PureComponent, exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals, exports.cloneElement = function(element, props, children) { + for(var newElement = cloneElement.apply(this, arguments), i = 2; i < arguments.length; i++)validateChildKeys(arguments[i], newElement.type); + return validatePropTypes(newElement), newElement; + }, exports.createContext = function(defaultValue, calculateChangedBits) { void 0 === calculateChangedBits ? calculateChangedBits = null : null !== calculateChangedBits && "function" != typeof calculateChangedBits && error("createContext: Expected the optional second argument to be a function. Instead received: %s", calculateChangedBits); var context = { $$typeof: REACT_CONTEXT_TYPE, @@ -706,7 +695,17 @@ } } }), context.Consumer = Consumer, context._currentRenderer = null, context._currentRenderer2 = null, context; - }, exports.createElement = createElementWithValidation, exports.createFactory = createFactory, exports.createRef = function() { + }, exports.createElement = createElementWithValidation, exports.createFactory = function(type) { + var validatedFactory = createElementWithValidation.bind(null, type); + return validatedFactory.type = type, didWarnAboutDeprecatedCreateFactory || (didWarnAboutDeprecatedCreateFactory = !0, warn("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")), Object.defineProperty(validatedFactory, "type", { + enumerable: !1, + get: function() { + return warn("Factory.type is deprecated. Access the class directly before passing it to createFactory."), Object.defineProperty(this, "type", { + value: type + }), type; + } + }), validatedFactory; + }, exports.createRef = function() { var refObject = { current: null }; diff --git a/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js b/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js index dd3b9d8c7620..f4ddc07b43a5 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js +++ b/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js @@ -5,7 +5,7 @@ ], factory) : factory((global = global || self).ReactDOM = {}, global.React); }(this, function(exports1, React) { "use strict"; - var func, _discreteUpdatesImpl, _flushDiscreteUpdatesImpl, _batchedEventUpdatesImpl, devToolsConfig, findFiberByHostInstance, ReactCurrentDispatcher, prevLog, prevInfo, prevWarn, prevError, prevGroup, prevGroupCollapsed, prevGroupEnd, prefix, componentFrameCache, didWarnValueDefaultValue$1, reusableSVGContainer, attemptUserBlockingHydration, attemptContinuousHydration, attemptHydrationAtCurrentPriority, attemptHydrationAtPriority, lastMovementX, lastMovementY, lastMouseEvent, warnedUnknownTags, suppressHydrationWarning, validatePropertiesInDevelopment, warnForTextDifference, warnForPropDifference, warnForExtraAttributes, warnForInvalidEventListener, canDiffStyleForHydrationWarning, normalizeMarkupForTextOrAttribute, normalizeHTML, SUPPRESS_HYDRATION_WARNING$1, fiberStack, warnedAboutMissingGetChildContext, rendererSigil, didWarnUpdateInsideUpdate, currentlyProcessingQueue, didWarnAboutStateAssignmentForComponent, didWarnAboutUninitializedState, didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate, didWarnAboutLegacyLifecyclesAndDerivedState, didWarnAboutUndefinedDerivedState, warnOnUndefinedDerivedState, warnOnInvalidCallback, didWarnAboutDirectlyAssigningPropsToState, didWarnAboutContextTypeAndContextTypes, didWarnAboutInvalidateContextType, didWarnAboutMaps, didWarnAboutGenerators, didWarnAboutStringRefs, ownerHasKeyUseWarning, ownerHasFunctionTypeWarning, rendererSigil$1, didWarnAboutMismatchedHooksForComponent, didWarnAboutUseOpaqueIdentifier, didWarnAboutBadClass, didWarnAboutModulePatternComponent, didWarnAboutContextTypeOnFunctionComponent, didWarnAboutGetDerivedStateOnFunctionComponent, didWarnAboutFunctionRefs, didWarnAboutReassigningProps, didWarnAboutRevealOrder, didWarnAboutTailOptions, appendAllChildren, updateHostContainer, updateHostComponent$1, updateHostText$1, beginWork$1, didWarnAboutUpdateInRenderForAnotherComponent, hasBadMapPolyfill, didWarnAboutNestedUpdates, didWarnAboutFindNodeInStrictMode, topLevelUpdateWarnings, ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + var func, devToolsConfig, findFiberByHostInstance, ReactCurrentDispatcher, prevLog, prevInfo, prevWarn, prevError, prevGroup, prevGroupCollapsed, prevGroupEnd, prefix, componentFrameCache, didWarnValueDefaultValue$1, reusableSVGContainer, attemptUserBlockingHydration, attemptContinuousHydration, attemptHydrationAtCurrentPriority, attemptHydrationAtPriority, lastMovementX, lastMovementY, lastMouseEvent, warnedUnknownTags, suppressHydrationWarning, validatePropertiesInDevelopment, warnForTextDifference, warnForPropDifference, warnForExtraAttributes, warnForInvalidEventListener, canDiffStyleForHydrationWarning, normalizeMarkupForTextOrAttribute, normalizeHTML, SUPPRESS_HYDRATION_WARNING$1, fiberStack, warnedAboutMissingGetChildContext, rendererSigil, didWarnUpdateInsideUpdate, currentlyProcessingQueue, didWarnAboutStateAssignmentForComponent, didWarnAboutUninitializedState, didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate, didWarnAboutLegacyLifecyclesAndDerivedState, didWarnAboutUndefinedDerivedState, warnOnUndefinedDerivedState, warnOnInvalidCallback, didWarnAboutDirectlyAssigningPropsToState, didWarnAboutContextTypeAndContextTypes, didWarnAboutInvalidateContextType, didWarnAboutMaps, didWarnAboutGenerators, didWarnAboutStringRefs, ownerHasKeyUseWarning, ownerHasFunctionTypeWarning, rendererSigil$1, didWarnAboutMismatchedHooksForComponent, didWarnAboutUseOpaqueIdentifier, didWarnAboutBadClass, didWarnAboutModulePatternComponent, didWarnAboutContextTypeOnFunctionComponent, didWarnAboutGetDerivedStateOnFunctionComponent, didWarnAboutFunctionRefs, didWarnAboutReassigningProps, didWarnAboutRevealOrder, didWarnAboutTailOptions, appendAllChildren, updateHostContainer, updateHostComponent$1, updateHostText$1, beginWork$1, didWarnAboutUpdateInRenderForAnotherComponent, hasBadMapPolyfill, didWarnAboutNestedUpdates, didWarnAboutFindNodeInStrictMode, topLevelUpdateWarnings, ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function warn(format) { for(var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)args[_key - 1] = arguments[_key]; printWarning("warn", format, args); @@ -5272,7 +5272,7 @@ source, subscribe ]), dispatcher.useEffect(function() { - var handleChange = function() { + var unsubscribe = subscribe(source._source, function() { var latestGetSnapshot = refs.getSnapshot, latestSetSnapshot = refs.setSnapshot; try { latestSetSnapshot(latestGetSnapshot(source._source)); @@ -5283,7 +5283,7 @@ throw error; }); } - }, unsubscribe = subscribe(source._source, handleChange); + }); return "function" != typeof unsubscribe && error("Mutable source subscribe function must return an unsubscribe function."), unsubscribe; }, [ source, @@ -7141,14 +7141,13 @@ } function logCapturedError(boundary, errorInfo) { try { - var errorBoundaryMessage, error = errorInfo.value, source = errorInfo.source, stack = errorInfo.stack; + var error = errorInfo.value, source = errorInfo.source, stack = errorInfo.stack; if (null != error && error._suppressLogging) { if (1 === boundary.tag) return; console.error(error); } var componentName = source ? getComponentName(source.type) : null, errorBoundaryName = getComponentName(boundary.type); - errorBoundaryMessage = errorBoundaryName ? "React will try to recreate this component tree from scratch using the error boundary you provided, " + errorBoundaryName + "." : "Consider adding an error boundary to your tree to customize error handling behavior.\nVisit https://reactjs.org/link/error-boundaries to learn more about error boundaries."; - console.error((componentName ? "The above error occurred in the <" + componentName + "> component:" : "The above error occurred in one of your React components:") + "\n" + (null !== stack ? stack : "") + "\n\n" + errorBoundaryMessage); + console.error((componentName ? "The above error occurred in the <" + componentName + "> component:" : "The above error occurred in one of your React components:") + "\n" + (null !== stack ? stack : "") + "\n\n" + (errorBoundaryName ? "React will try to recreate this component tree from scratch using the error boundary you provided, " + errorBoundaryName + "." : "Consider adding an error boundary to your tree to customize error handling behavior.\nVisit https://reactjs.org/link/error-boundaries to learn more about error boundaries.")); } catch (e) { setTimeout(function() { throw e; @@ -8609,9 +8608,7 @@ function detachFiberAfterEffects(fiber) { fiber.sibling = null, fiber.stateNode = null; } - var resolveFamily = null, failedBoundaries = null, setRefreshHandler = function(handler) { - resolveFamily = handler; - }; + var resolveFamily = null, failedBoundaries = null; function resolveFunctionForHotReloading(type) { if (null === resolveFamily) return type; var family = resolveFamily(type); @@ -8664,83 +8661,6 @@ function markFailedErrorBoundaryForHotReloading(fiber) { null !== resolveFamily && "function" == typeof WeakSet && (null === failedBoundaries && (failedBoundaries = new WeakSet()), failedBoundaries.add(fiber)); } - var scheduleRefresh = function(root, update) { - if (null !== resolveFamily) { - var staleFamilies = update.staleFamilies, updatedFamilies = update.updatedFamilies; - flushPassiveEffects(), flushSync(function() { - (function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) { - var alternate = fiber.alternate, child = fiber.child, sibling = fiber.sibling, tag = fiber.tag, type = fiber.type, candidateType = null; - switch(tag){ - case 0: - case 15: - case 1: - candidateType = type; - break; - case 11: - candidateType = type.render; - } - if (null === resolveFamily) throw Error("Expected resolveFamily to be set during hot reload."); - var needsRender = !1, needsRemount = !1; - if (null !== candidateType) { - var family = resolveFamily(candidateType); - void 0 !== family && (staleFamilies.has(family) ? needsRemount = !0 : updatedFamilies.has(family) && (1 === tag ? needsRemount = !0 : needsRender = !0)); - } - null !== failedBoundaries && (failedBoundaries.has(fiber) || null !== alternate && failedBoundaries.has(alternate)) && (needsRemount = !0), needsRemount && (fiber._debugNeedsRemount = !0), (needsRemount || needsRender) && scheduleUpdateOnFiber(fiber, 1, -1), null === child || needsRemount || scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies), null !== sibling && scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies); - })(root.current, updatedFamilies, staleFamilies); - }); - } - }, scheduleRoot = function(root, element) { - root.context === emptyContextObject && (flushPassiveEffects(), flushSync(function() { - updateContainer(element, root, null, null); - })); - }, findHostInstancesForRefresh = function(root, families) { - var hostInstances = new Set(), types = new Set(families.map(function(family) { - return family.current; - })); - return function findHostInstancesForMatchingFibersRecursively(fiber, types, hostInstances) { - var child = fiber.child, sibling = fiber.sibling, tag = fiber.tag, type = fiber.type, candidateType = null; - switch(tag){ - case 0: - case 15: - case 1: - candidateType = type; - break; - case 11: - candidateType = type.render; - } - var didMatch = !1; - null !== candidateType && types.has(candidateType) && (didMatch = !0), didMatch ? function(fiber, hostInstances) { - if (!function(fiber, hostInstances) { - for(var node = fiber, foundHostInstances = !1;;){ - if (5 === node.tag) foundHostInstances = !0, hostInstances.add(node.stateNode); - else if (null !== node.child) { - node.child.return = node, node = node.child; - continue; - } - if (node === fiber) return foundHostInstances; - for(; null === node.sibling;){ - if (null === node.return || node.return === fiber) return foundHostInstances; - node = node.return; - } - node.sibling.return = node.return, node = node.sibling; - } - return !1; - }(fiber, hostInstances)) for(var node = fiber;;){ - switch(node.tag){ - case 5: - hostInstances.add(node.stateNode); - return; - case 4: - case 3: - hostInstances.add(node.stateNode.containerInfo); - return; - } - if (null === node.return) throw Error("Expected to reach root first."); - node = node.return; - } - }(fiber, hostInstances) : null !== child && findHostInstancesForMatchingFibersRecursively(child, types, hostInstances), null !== sibling && findHostInstancesForMatchingFibersRecursively(sibling, types, hostInstances); - }(root.current, types, hostInstances), hostInstances; - }; hasBadMapPolyfill = !1; try { Object.preventExtensions({}); @@ -9138,7 +9058,7 @@ null != (value = props.value) && updateOptions(domElement, !!props.multiple, value, !1); return; } - }, _discreteUpdatesImpl = function(fn, a, b, c, d) { + }, batchedUpdatesImpl = batchedUpdates$1, discreteUpdatesImpl = function(fn, a, b, c, d) { var prevExecutionContext = executionContext; executionContext |= 4; try { @@ -9146,7 +9066,7 @@ } finally{ 0 === (executionContext = prevExecutionContext) && (resetRenderTimer(), flushSyncCallbackQueue()); } - }, _flushDiscreteUpdatesImpl = function() { + }, flushDiscreteUpdatesImpl = function() { if ((49 & executionContext) != 0) { (16 & executionContext) != 0 && error("unstable_flushDiscreteUpdates: Cannot flush updates when React is already rendering."); return; @@ -9161,7 +9081,7 @@ } flushSyncCallbackQueue(); })(), flushPassiveEffects(); - }, _batchedEventUpdatesImpl = function(fn, a) { + }, batchedEventUpdatesImpl = function(fn, a) { var prevExecutionContext = executionContext; executionContext |= 2; try { @@ -9169,7 +9089,7 @@ } finally{ 0 === (executionContext = prevExecutionContext) && (resetRenderTimer(), flushSyncCallbackQueue()); } - }, batchedUpdatesImpl = batchedUpdates$1, discreteUpdatesImpl = _discreteUpdatesImpl, flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl, batchedEventUpdatesImpl = _batchedEventUpdatesImpl, findFiberByHostInstance = (devToolsConfig = { + }, findFiberByHostInstance = (devToolsConfig = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 1, version: ReactVersion, @@ -9206,10 +9126,88 @@ findFiberByHostInstance: findFiberByHostInstance || function(instance) { return null; }, - findHostInstancesForRefresh: findHostInstancesForRefresh, - scheduleRefresh: scheduleRefresh, - scheduleRoot: scheduleRoot, - setRefreshHandler: setRefreshHandler, + findHostInstancesForRefresh: function(root, families) { + var hostInstances = new Set(), types = new Set(families.map(function(family) { + return family.current; + })); + return function findHostInstancesForMatchingFibersRecursively(fiber, types, hostInstances) { + var child = fiber.child, sibling = fiber.sibling, tag = fiber.tag, type = fiber.type, candidateType = null; + switch(tag){ + case 0: + case 15: + case 1: + candidateType = type; + break; + case 11: + candidateType = type.render; + } + var didMatch = !1; + null !== candidateType && types.has(candidateType) && (didMatch = !0), didMatch ? function(fiber, hostInstances) { + if (!function(fiber, hostInstances) { + for(var node = fiber, foundHostInstances = !1;;){ + if (5 === node.tag) foundHostInstances = !0, hostInstances.add(node.stateNode); + else if (null !== node.child) { + node.child.return = node, node = node.child; + continue; + } + if (node === fiber) return foundHostInstances; + for(; null === node.sibling;){ + if (null === node.return || node.return === fiber) return foundHostInstances; + node = node.return; + } + node.sibling.return = node.return, node = node.sibling; + } + return !1; + }(fiber, hostInstances)) for(var node = fiber;;){ + switch(node.tag){ + case 5: + hostInstances.add(node.stateNode); + return; + case 4: + case 3: + hostInstances.add(node.stateNode.containerInfo); + return; + } + if (null === node.return) throw Error("Expected to reach root first."); + node = node.return; + } + }(fiber, hostInstances) : null !== child && findHostInstancesForMatchingFibersRecursively(child, types, hostInstances), null !== sibling && findHostInstancesForMatchingFibersRecursively(sibling, types, hostInstances); + }(root.current, types, hostInstances), hostInstances; + }, + scheduleRefresh: function(root, update) { + if (null !== resolveFamily) { + var staleFamilies = update.staleFamilies, updatedFamilies = update.updatedFamilies; + flushPassiveEffects(), flushSync(function() { + (function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) { + var alternate = fiber.alternate, child = fiber.child, sibling = fiber.sibling, tag = fiber.tag, type = fiber.type, candidateType = null; + switch(tag){ + case 0: + case 15: + case 1: + candidateType = type; + break; + case 11: + candidateType = type.render; + } + if (null === resolveFamily) throw Error("Expected resolveFamily to be set during hot reload."); + var needsRender = !1, needsRemount = !1; + if (null !== candidateType) { + var family = resolveFamily(candidateType); + void 0 !== family && (staleFamilies.has(family) ? needsRemount = !0 : updatedFamilies.has(family) && (1 === tag ? needsRemount = !0 : needsRender = !0)); + } + null !== failedBoundaries && (failedBoundaries.has(fiber) || null !== alternate && failedBoundaries.has(alternate)) && (needsRemount = !0), needsRemount && (fiber._debugNeedsRemount = !0), (needsRemount || needsRender) && scheduleUpdateOnFiber(fiber, 1, -1), null === child || needsRemount || scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies), null !== sibling && scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies); + })(root.current, updatedFamilies, staleFamilies); + }); + } + }, + scheduleRoot: function(root, element) { + root.context === emptyContextObject && (flushPassiveEffects(), flushSync(function() { + updateContainer(element, root, null, null); + })); + }, + setRefreshHandler: function(handler) { + resolveFamily = handler; + }, getCurrentFiber: function() { return current; }