diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithDiscriminatedUnion_es2015.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithDiscriminatedUnion_es2015.2.minified.js index 434e26e5adf..a5f9e853d43 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithDiscriminatedUnion_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithDiscriminatedUnion_es2015.2.minified.js @@ -1,4 +1,4 @@ -var Example1, Example2, Example3, Example4, Example5, GH14865, GH12052; +var Example1, Example2, Example3, Example4, Example5, GH14865, GH12052, GH39357; Example1 || (Example1 = {}), t = s, Example2 || (Example2 = {}), t = s, Example3 || (Example3 = {}), t = s, Example4 || (Example4 = {}), t = s, Example5 || (Example5 = {}), t = s, (function(GH14865) { let b; b.type, b = { @@ -14,4 +14,4 @@ Example1 || (Example1 = {}), t = s, Example2 || (Example2 = {}), t = s, Example3 type: void 0 }; good.type = getAxisType(); -})(GH12052 || (GH12052 = {})); +})(GH12052 || (GH12052 = {})), GH39357 || (GH39357 = {}), "a" === b || "b" === b; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithDiscriminatedUnion_es5.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithDiscriminatedUnion_es5.2.minified.js index 90ee5a232fe..58d83257159 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithDiscriminatedUnion_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithDiscriminatedUnion_es5.2.minified.js @@ -1,4 +1,4 @@ -var Example1, Example2, Example3, Example4, Example5, GH14865, GH12052; +var Example1, Example2, Example3, Example4, Example5, GH14865, GH12052, GH39357; Example1 || (Example1 = {}), t = s, Example2 || (Example2 = {}), t = s, Example3 || (Example3 = {}), t = s, Example4 || (Example4 = {}), t = s, Example5 || (Example5 = {}), t = s, (function(GH14865) { var b; b.type, b = { @@ -10,4 +10,4 @@ Example1 || (Example1 = {}), t = s, Example2 || (Example2 = {}), t = s, Example3 return "categorical"; }; getAxisType(), void 0 = getAxisType(); -})(GH12052 || (GH12052 = {})); +})(GH12052 || (GH12052 = {})), GH39357 || (GH39357 = {}), "a" === b || "b" === b; diff --git a/crates/swc/tests/tsc-references/asyncArrowFunction10_es2017_es2015.2.minified.js b/crates/swc/tests/tsc-references/asyncArrowFunction10_es2017_es2015.2.minified.js index e6bfb50aeca..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/asyncArrowFunction10_es2017_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/asyncArrowFunction10_es2017_es2015.2.minified.js @@ -1,24 +0,0 @@ -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { - try { - var info = gen[key](arg), value = info.value; - } catch (error) { - reject(error); - return; - } - info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw); -} -!function(fn) { - return function() { - var self = this, args = arguments; - return new Promise(function(resolve, reject) { - var gen = fn.apply(self, args); - function _next(value) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); - } - function _throw(err) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); - } - _next(void 0); - }); - }; -}(function*() {}); diff --git a/crates/swc/tests/tsc-references/asyncArrowFunction10_es5_es2015.2.minified.js b/crates/swc/tests/tsc-references/asyncArrowFunction10_es5_es2015.2.minified.js index e6bfb50aeca..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/asyncArrowFunction10_es5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/asyncArrowFunction10_es5_es2015.2.minified.js @@ -1,24 +0,0 @@ -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { - try { - var info = gen[key](arg), value = info.value; - } catch (error) { - reject(error); - return; - } - info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw); -} -!function(fn) { - return function() { - var self = this, args = arguments; - return new Promise(function(resolve, reject) { - var gen = fn.apply(self, args); - function _next(value) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); - } - function _throw(err) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); - } - _next(void 0); - }); - }; -}(function*() {}); diff --git a/crates/swc/tests/tsc-references/asyncArrowFunction10_es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/asyncArrowFunction10_es6_es2015.2.minified.js index e6bfb50aeca..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/asyncArrowFunction10_es6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/asyncArrowFunction10_es6_es2015.2.minified.js @@ -1,24 +0,0 @@ -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { - try { - var info = gen[key](arg), value = info.value; - } catch (error) { - reject(error); - return; - } - info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw); -} -!function(fn) { - return function() { - var self = this, args = arguments; - return new Promise(function(resolve, reject) { - var gen = fn.apply(self, args); - function _next(value) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); - } - function _throw(err) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); - } - _next(void 0); - }); - }; -}(function*() {}); diff --git a/crates/swc/tests/tsc-references/asyncArrowFunction1_es2017_es2015.2.minified.js b/crates/swc/tests/tsc-references/asyncArrowFunction1_es2017_es2015.2.minified.js index e6bfb50aeca..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/asyncArrowFunction1_es2017_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/asyncArrowFunction1_es2017_es2015.2.minified.js @@ -1,24 +0,0 @@ -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { - try { - var info = gen[key](arg), value = info.value; - } catch (error) { - reject(error); - return; - } - info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw); -} -!function(fn) { - return function() { - var self = this, args = arguments; - return new Promise(function(resolve, reject) { - var gen = fn.apply(self, args); - function _next(value) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); - } - function _throw(err) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); - } - _next(void 0); - }); - }; -}(function*() {}); diff --git a/crates/swc/tests/tsc-references/asyncArrowFunction1_es5_es2015.2.minified.js b/crates/swc/tests/tsc-references/asyncArrowFunction1_es5_es2015.2.minified.js index e6bfb50aeca..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/asyncArrowFunction1_es5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/asyncArrowFunction1_es5_es2015.2.minified.js @@ -1,24 +0,0 @@ -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { - try { - var info = gen[key](arg), value = info.value; - } catch (error) { - reject(error); - return; - } - info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw); -} -!function(fn) { - return function() { - var self = this, args = arguments; - return new Promise(function(resolve, reject) { - var gen = fn.apply(self, args); - function _next(value) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); - } - function _throw(err) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); - } - _next(void 0); - }); - }; -}(function*() {}); diff --git a/crates/swc/tests/tsc-references/asyncArrowFunction1_es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/asyncArrowFunction1_es6_es2015.2.minified.js index e6bfb50aeca..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/asyncArrowFunction1_es6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/asyncArrowFunction1_es6_es2015.2.minified.js @@ -1,24 +0,0 @@ -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { - try { - var info = gen[key](arg), value = info.value; - } catch (error) { - reject(error); - return; - } - info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw); -} -!function(fn) { - return function() { - var self = this, args = arguments; - return new Promise(function(resolve, reject) { - var gen = fn.apply(self, args); - function _next(value) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); - } - function _throw(err) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); - } - _next(void 0); - }); - }; -}(function*() {}); diff --git a/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference_es2015.2.minified.js b/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference_es2015.2.minified.js index 7fa7d217722..a4cb984fd5f 100644 --- a/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference_es2015.2.minified.js @@ -1,11 +1,14 @@ -var M, e1; +var x1, M, e1; function foo3() { return foo3(); } function m1() { return 1; } -foo3(), (function(x) { +x1 = 1, (function(x) { + var x1; + x1 = 1; +})(1), foo3(), (function(x) { try {} catch (e) { return []; } finally{} diff --git a/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference_es5.2.minified.js b/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference_es5.2.minified.js index 7ea9c30e0cc..310641a4c11 100644 --- a/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference_es5.2.minified.js @@ -4,7 +4,10 @@ function _classCallCheck(instance, Constructor) { function foo3() { return foo3(); } -foo3(), (function(x) { +x1 = 1, (function(x) { + var x1; + x1 = 1; +})(1), foo3(), (function(x) { try {} catch (e) { return []; } finally{} @@ -12,7 +15,7 @@ foo3(), (function(x) { var obj; void 0 === x || (obj = x) && "undefined" != typeof Symbol && obj.constructor === Symbol; })(1); -var M, e1, C = function() { +var M, e1, x1, C = function() { "use strict"; _classCallCheck(this, C); }; diff --git a/crates/swc/tests/tsc-references/classStaticBlock12_es2015.2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock12_es2015.2.minified.js index 09771c20fb9..c7112929ac7 100644 --- a/crates/swc/tests/tsc-references/classStaticBlock12_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/classStaticBlock12_es2015.2.minified.js @@ -1,14 +1,13 @@ class C { } -var _x = { +!function(receiver, classConstructor, descriptor) { + var receiver, descriptor; + return (function(receiver, classConstructor) { + if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance"); + })(receiver, classConstructor), !function(descriptor, action) { + if (void 0 === descriptor) throw new TypeError("attempted to get private static field before its declaration"); + }(descriptor, "get"), descriptor.get ? descriptor.get.call(receiver) : descriptor.value; +}(C, C, { writable: !0, value: 1 -}; -(()=>{ - var receiver, classConstructor, descriptor, receiver, descriptor; - receiver = C, classConstructor = C, descriptor = _x, (function(receiver, classConstructor) { - if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance"); - })(receiver, classConstructor), (function(descriptor, action) { - if (void 0 === descriptor) throw new TypeError("attempted to get private static field before its declaration"); - })(descriptor, "get"), (descriptor = descriptor).get ? descriptor.get.call(receiver) : descriptor.value; -})(); +}); diff --git a/crates/swc/tests/tsc-references/classStaticBlock12_es5.2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock12_es5.2.minified.js index ac58cfccc51..74ec3268b6f 100644 --- a/crates/swc/tests/tsc-references/classStaticBlock12_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/classStaticBlock12_es5.2.minified.js @@ -13,5 +13,5 @@ var C = function() { if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance"); })(receiver, classConstructor), (function(descriptor, action) { if (void 0 === descriptor) throw new TypeError("attempted to get private static field before its declaration"); - })(descriptor, "get"), (descriptor = descriptor).get ? descriptor.get.call(receiver) : descriptor.value; + })(descriptor, "get"), descriptor.get ? descriptor.get.call(receiver) : descriptor.value; }(); diff --git a/crates/swc/tests/tsc-references/destructuringEvaluationOrder_es2015.2.minified.js b/crates/swc/tests/tsc-references/destructuringEvaluationOrder_es2015.2.minified.js index 403b7e0bba4..860df09efd0 100644 --- a/crates/swc/tests/tsc-references/destructuringEvaluationOrder_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringEvaluationOrder_es2015.2.minified.js @@ -24,7 +24,7 @@ let trace = [], order = (n)=>trace.push(n) }(source, excluded); if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for(i = 0; i < sourceSymbolKeys.length; i++)key2 = sourceSymbolKeys[i], !(excluded.indexOf(key2) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key2) && (target[key2] = source[key2]); + for(i = 0; i < sourceSymbolKeys.length; i++)key2 = sourceSymbolKeys[i], excluded.indexOf(key2) >= 0 || Object.prototype.propertyIsEnumerable.call(source, key2) && (target[key2] = source[key2]); } return target; }(_ref, [ diff --git a/crates/swc/tests/tsc-references/destructuringEvaluationOrder_es5.2.minified.js b/crates/swc/tests/tsc-references/destructuringEvaluationOrder_es5.2.minified.js index e78e0f338a9..4390dcfc71c 100644 --- a/crates/swc/tests/tsc-references/destructuringEvaluationOrder_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringEvaluationOrder_es5.2.minified.js @@ -31,7 +31,7 @@ var _ref = {}, key = order(0), key1 = order(2), tmp2 = _ref[key]; }(source, excluded); if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for(i = 0; i < sourceSymbolKeys.length; i++)key2 = sourceSymbolKeys[i], !(excluded.indexOf(key2) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key2) && (target[key2] = source[key2]); + for(i = 0; i < sourceSymbolKeys.length; i++)key2 = sourceSymbolKeys[i], excluded.indexOf(key2) >= 0 || Object.prototype.propertyIsEnumerable.call(source, key2) && (target[key2] = source[key2]); } })(_ref, [ key diff --git a/crates/swc/tests/tsc-references/destructuringObjectAssignmentPatternWithNestedSpread_es2015.2.minified.js b/crates/swc/tests/tsc-references/destructuringObjectAssignmentPatternWithNestedSpread_es2015.2.minified.js index 3a40186c6e0..fa5e54e6c64 100644 --- a/crates/swc/tests/tsc-references/destructuringObjectAssignmentPatternWithNestedSpread_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringObjectAssignmentPatternWithNestedSpread_es2015.2.minified.js @@ -10,7 +10,7 @@ let a, d; }(source, excluded); if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); + for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], excluded.indexOf(key) >= 0 || Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); } })((_c = { x: { diff --git a/crates/swc/tests/tsc-references/destructuringObjectAssignmentPatternWithNestedSpread_es5.2.minified.js b/crates/swc/tests/tsc-references/destructuringObjectAssignmentPatternWithNestedSpread_es5.2.minified.js index 1c365f54f9e..5c9dd992e80 100644 --- a/crates/swc/tests/tsc-references/destructuringObjectAssignmentPatternWithNestedSpread_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringObjectAssignmentPatternWithNestedSpread_es5.2.minified.js @@ -9,7 +9,7 @@ var _c, ref, d; }(source, excluded); if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); + for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], excluded.indexOf(key) >= 0 || Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); } })((_c = { x: { diff --git a/crates/swc/tests/tsc-references/generatedContextualTyping_es2015.2.minified.js b/crates/swc/tests/tsc-references/generatedContextualTyping_es2015.2.minified.js index d397587d06a..26934d9dffb 100644 --- a/crates/swc/tests/tsc-references/generatedContextualTyping_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/generatedContextualTyping_es2015.2.minified.js @@ -1,7 +1,7 @@ class Base { } new Base(); -var x193, x194, x195, x196, x197, x198, x199, x200, x201, x202, x203, x204, d1 = new class extends Base { +var x181, x184, x191, x192, x193, x194, x195, x196, x197, x198, x199, x200, x201, x202, x203, x204, d1 = new class extends Base { }(), d2 = new class extends Base { }(); (class { @@ -184,7 +184,7 @@ var x193, x194, x195, x196, x197, x198, x199, x200, x201, x202, x203, x204, d1 = d1, d2 ] -}, (x193 || (x193 = {})).t = ()=>[ +}, x181 || (x181 = {}), x184 || (x184 = {}), x191 || (x191 = {}), x192 || (x192 = {}), (x193 || (x193 = {})).t = ()=>[ d1, d2 ] diff --git a/crates/swc/tests/tsc-references/genericCallWithOverloadedConstructorTypedArguments_es2015.2.minified.js b/crates/swc/tests/tsc-references/genericCallWithOverloadedConstructorTypedArguments_es2015.2.minified.js index 4cd18be7203..976a3514c24 100644 --- a/crates/swc/tests/tsc-references/genericCallWithOverloadedConstructorTypedArguments_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/genericCallWithOverloadedConstructorTypedArguments_es2015.2.minified.js @@ -1,9 +1,10 @@ var NonGenericParameter, GenericParameter; !function(NonGenericParameter) { + var a; function foo4(cb) { return new cb(null); } - foo4(void 0), foo4(void 0); + foo4(a), foo4(void 0); }(NonGenericParameter || (NonGenericParameter = {})), (function(GenericParameter) { var a, b, c, c2; function foo5(cb) { diff --git a/crates/swc/tests/tsc-references/genericCallWithOverloadedFunctionTypedArguments_es2015.2.minified.js b/crates/swc/tests/tsc-references/genericCallWithOverloadedFunctionTypedArguments_es2015.2.minified.js index 392d4ee8f08..0f841fb89a3 100644 --- a/crates/swc/tests/tsc-references/genericCallWithOverloadedFunctionTypedArguments_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/genericCallWithOverloadedFunctionTypedArguments_es2015.2.minified.js @@ -1,9 +1,10 @@ var NonGenericParameter, GenericParameter; !function(NonGenericParameter) { + var a; function foo4(cb) { return cb; } - foo4(void 0), foo4((x)=>x + foo4(a), foo4((x)=>x ), foo4((x)=>x ); }(NonGenericParameter || (NonGenericParameter = {})), (function(GenericParameter) { diff --git a/crates/swc/tests/tsc-references/genericSetterInClassTypeJsDoc_es2015.2.minified.js b/crates/swc/tests/tsc-references/genericSetterInClassTypeJsDoc_es2015.2.minified.js index 36bbab3309c..80341a0ef0b 100644 --- a/crates/swc/tests/tsc-references/genericSetterInClassTypeJsDoc_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/genericSetterInClassTypeJsDoc_es2015.2.minified.js @@ -16,7 +16,7 @@ var _value = new WeakMap(); new class { get value() { var receiver, privateMap, descriptor, receiver, descriptor; - return receiver = this, (descriptor = descriptor = _classExtractFieldDescriptor(receiver, privateMap = _value, "get")).get ? descriptor.get.call(receiver) : descriptor.value; + return receiver = this, (descriptor = _classExtractFieldDescriptor(receiver, privateMap = _value, "get")).get ? descriptor.get.call(receiver) : descriptor.value; } set value(value) { _classPrivateFieldSet(this, _value, value); diff --git a/crates/swc/tests/tsc-references/genericSetterInClassTypeJsDoc_es5.2.minified.js b/crates/swc/tests/tsc-references/genericSetterInClassTypeJsDoc_es5.2.minified.js index 47badba3846..1e0ee989119 100644 --- a/crates/swc/tests/tsc-references/genericSetterInClassTypeJsDoc_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/genericSetterInClassTypeJsDoc_es5.2.minified.js @@ -37,7 +37,7 @@ var _value = new WeakMap(), Box = function() { key: "value", get: function() { var receiver, privateMap, descriptor, receiver, descriptor; - return receiver = this, (descriptor = descriptor = _classExtractFieldDescriptor(receiver, privateMap = _value, "get")).get ? descriptor.get.call(receiver) : descriptor.value; + return receiver = this, (descriptor = _classExtractFieldDescriptor(receiver, privateMap = _value, "get")).get ? descriptor.get.call(receiver) : descriptor.value; }, set: function(value) { _classPrivateFieldSet(this, _value, value); diff --git a/crates/swc/tests/tsc-references/genericSetterInClassType_es2015.2.minified.js b/crates/swc/tests/tsc-references/genericSetterInClassType_es2015.2.minified.js index ec43591a8f6..0d6af3d3204 100644 --- a/crates/swc/tests/tsc-references/genericSetterInClassType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/genericSetterInClassType_es2015.2.minified.js @@ -15,7 +15,7 @@ function _classExtractFieldDescriptor(receiver, privateMap, action) { new class { get value() { var receiver, privateMap, descriptor, receiver, descriptor; - return receiver = this, (descriptor = descriptor = _classExtractFieldDescriptor(receiver, privateMap = _value, "get")).get ? descriptor.get.call(receiver) : descriptor.value; + return receiver = this, (descriptor = _classExtractFieldDescriptor(receiver, privateMap = _value, "get")).get ? descriptor.get.call(receiver) : descriptor.value; } set value(value) { var receiver, privateMap, value1, descriptor; diff --git a/crates/swc/tests/tsc-references/genericSetterInClassType_es5.2.minified.js b/crates/swc/tests/tsc-references/genericSetterInClassType_es5.2.minified.js index 89b92011da4..beb84ca773c 100644 --- a/crates/swc/tests/tsc-references/genericSetterInClassType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/genericSetterInClassType_es5.2.minified.js @@ -48,7 +48,7 @@ function _createClass(Constructor, protoProps, staticProps) { key: "value", get: function() { var receiver, privateMap, descriptor, receiver, descriptor; - return receiver = this, (descriptor = descriptor = _classExtractFieldDescriptor(receiver, privateMap = _value, "get")).get ? descriptor.get.call(receiver) : descriptor.value; + return receiver = this, (descriptor = _classExtractFieldDescriptor(receiver, privateMap = _value, "get")).get ? descriptor.get.call(receiver) : descriptor.value; }, set: function(value) { var receiver, privateMap, value1, descriptor; diff --git a/crates/swc/tests/tsc-references/heterogeneousArrayLiterals_es2015.2.minified.js b/crates/swc/tests/tsc-references/heterogeneousArrayLiterals_es2015.2.minified.js new file mode 100644 index 00000000000..c120e7cd161 --- /dev/null +++ b/crates/swc/tests/tsc-references/heterogeneousArrayLiterals_es2015.2.minified.js @@ -0,0 +1,7 @@ +var base, derived, derived2, WithContextualType; +class Base { +} +class Derived extends Base { +} +Derived || (Derived = {}), WithContextualType || (WithContextualType = {}), ()=>derived2 +; diff --git a/crates/swc/tests/tsc-references/noUncheckedIndexedAccessDestructuring_es2015.2.minified.js b/crates/swc/tests/tsc-references/noUncheckedIndexedAccessDestructuring_es2015.2.minified.js index c1ca46bcf4a..4f0cc469ae1 100644 --- a/crates/swc/tests/tsc-references/noUncheckedIndexedAccessDestructuring_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/noUncheckedIndexedAccessDestructuring_es2015.2.minified.js @@ -31,7 +31,7 @@ t2.z.toString(); }(source, excluded); if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); + for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], excluded.indexOf(key) >= 0 || Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); } return target; }(numMapPoint, [ diff --git a/crates/swc/tests/tsc-references/noUncheckedIndexedAccessDestructuring_es5.2.minified.js b/crates/swc/tests/tsc-references/noUncheckedIndexedAccessDestructuring_es5.2.minified.js index 5eea0990dfb..f54621edf87 100644 --- a/crates/swc/tests/tsc-references/noUncheckedIndexedAccessDestructuring_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/noUncheckedIndexedAccessDestructuring_es5.2.minified.js @@ -64,7 +64,7 @@ var x1 = numMapPoint.x, q = function(source, excluded) { }(source, excluded); if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); + for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], excluded.indexOf(key) >= 0 || Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); } return target; }(numMapPoint, [ diff --git a/crates/swc/tests/tsc-references/objectRestCatchES5_es2015.2.minified.js b/crates/swc/tests/tsc-references/objectRestCatchES5_es2015.2.minified.js index 5c08e00d907..ca0396d5343 100644 --- a/crates/swc/tests/tsc-references/objectRestCatchES5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/objectRestCatchES5_es2015.2.minified.js @@ -10,7 +10,7 @@ try {} catch (_param) { }(source, excluded); if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); + for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], excluded.indexOf(key) >= 0 || Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); } return target; }(_param, [ diff --git a/crates/swc/tests/tsc-references/objectRestCatchES5_es5.2.minified.js b/crates/swc/tests/tsc-references/objectRestCatchES5_es5.2.minified.js index ef4764fa093..d7f9b770726 100644 --- a/crates/swc/tests/tsc-references/objectRestCatchES5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/objectRestCatchES5_es5.2.minified.js @@ -9,7 +9,7 @@ try {} catch (_param) { }(source, excluded); if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); + for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], excluded.indexOf(key) >= 0 || Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); } })(_param, [ "a" diff --git a/crates/swc/tests/tsc-references/objectRestReadonly_es2015.2.minified.js b/crates/swc/tests/tsc-references/objectRestReadonly_es2015.2.minified.js index f6b246fb675..9b1139db8e3 100644 --- a/crates/swc/tests/tsc-references/objectRestReadonly_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/objectRestReadonly_es2015.2.minified.js @@ -12,7 +12,7 @@ const obj = { }(source, excluded); if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); + for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], excluded.indexOf(key) >= 0 || Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); } return target; }(obj, [ diff --git a/crates/swc/tests/tsc-references/objectRestReadonly_es5.2.minified.js b/crates/swc/tests/tsc-references/objectRestReadonly_es5.2.minified.js index e6bda861f4b..b538f116e7a 100644 --- a/crates/swc/tests/tsc-references/objectRestReadonly_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/objectRestReadonly_es5.2.minified.js @@ -13,7 +13,7 @@ obj.foo, delete function(source, excluded) { }(source, excluded); if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); + for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], excluded.indexOf(key) >= 0 || Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); } return target; }(obj, [ diff --git a/crates/swc/tests/tsc-references/objectSpreadNoTransform_es2015.2.minified.js b/crates/swc/tests/tsc-references/objectSpreadNoTransform_es2015.2.minified.js index c1dd3d388d0..b95325a7751 100644 --- a/crates/swc/tests/tsc-references/objectSpreadNoTransform_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/objectSpreadNoTransform_es2015.2.minified.js @@ -33,7 +33,7 @@ const o = function(target) { }(source, excluded); if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); + for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], excluded.indexOf(key) >= 0 || Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); } })(_o = o, [ "b" diff --git a/crates/swc/tests/tsc-references/objectSpreadNoTransform_es5.2.minified.js b/crates/swc/tests/tsc-references/objectSpreadNoTransform_es5.2.minified.js index b0409cf95da..438f51888c7 100644 --- a/crates/swc/tests/tsc-references/objectSpreadNoTransform_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/objectSpreadNoTransform_es5.2.minified.js @@ -17,7 +17,7 @@ function _defineProperty(obj, key, value) { }(source, excluded); if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); + for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], excluded.indexOf(key) >= 0 || Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); } })(_o = function(target) { for(var i = 1; i < arguments.length; i++){ diff --git a/crates/swc/tests/tsc-references/privateNameComputedPropertyName2_es2015.2.minified.js b/crates/swc/tests/tsc-references/privateNameComputedPropertyName2_es2015.2.minified.js index b30102fa625..2d80c97009b 100644 --- a/crates/swc/tests/tsc-references/privateNameComputedPropertyName2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameComputedPropertyName2_es2015.2.minified.js @@ -4,7 +4,7 @@ var _x = new WeakMap(), tmp = (getX = (a)=>(function(receiver, privateMap) { if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance"); return privateMap.get(receiver); }(receiver, privateMap, "get"); - return (descriptor = descriptor).get ? descriptor.get.call(receiver) : descriptor.value; + return descriptor.get ? descriptor.get.call(receiver) : descriptor.value; })(a, _x) , "_"); console.log(getX(new class { diff --git a/crates/swc/tests/tsc-references/privateNameComputedPropertyName2_es5.2.minified.js b/crates/swc/tests/tsc-references/privateNameComputedPropertyName2_es5.2.minified.js index 3800b8db771..b50909063a2 100644 --- a/crates/swc/tests/tsc-references/privateNameComputedPropertyName2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameComputedPropertyName2_es5.2.minified.js @@ -6,7 +6,7 @@ function _defineProperties(target, props) { } var getX, _x = new WeakMap(), tmp = (getX = function(a) { var receiver, privateMap, descriptor, receiver, descriptor; - return (descriptor = descriptor = (function(receiver, privateMap, action) { + return (descriptor = (function(receiver, privateMap, action) { if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance"); return privateMap.get(receiver); })(receiver = a, privateMap = _x, "get")).get ? descriptor.get.call(receiver) : descriptor.value; diff --git a/crates/swc/tests/tsc-references/privateNameEmitHelpers_es2015.2.minified.js b/crates/swc/tests/tsc-references/privateNameEmitHelpers_es2015.2.minified.js index 03ad53ef571..24e31dfaea7 100644 --- a/crates/swc/tests/tsc-references/privateNameEmitHelpers_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameEmitHelpers_es2015.2.minified.js @@ -17,7 +17,7 @@ export class C { get: void 0, set: function(v) { var receiver, privateMap, descriptor, receiver, descriptor, receiver, privateMap, value, descriptor; - receiver = this, privateMap = _a, receiver = this, value = ((descriptor = descriptor = _classExtractFieldDescriptor(receiver, privateMap = _a, "get")).get ? descriptor.get.call(receiver) : descriptor.value) + v, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"), (function(receiver, descriptor, value) { + receiver = this, privateMap = _a, receiver = this, value = ((descriptor = _classExtractFieldDescriptor(receiver, privateMap = _a, "get")).get ? descriptor.get.call(receiver) : descriptor.value) + v, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"), (function(receiver, descriptor, value) { if (descriptor.set) descriptor.set.call(receiver, value); else { if (!descriptor.writable) throw new TypeError("attempted to set read only private field"); diff --git a/crates/swc/tests/tsc-references/privateNameEmitHelpers_es5.2.minified.js b/crates/swc/tests/tsc-references/privateNameEmitHelpers_es5.2.minified.js index 61cb3998d22..abc53388bf2 100644 --- a/crates/swc/tests/tsc-references/privateNameEmitHelpers_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameEmitHelpers_es5.2.minified.js @@ -24,7 +24,7 @@ export var C = function() { }; function set_c(v) { var receiver, privateMap, descriptor, receiver, descriptor, receiver, privateMap, value, descriptor; - receiver = this, privateMap = _a, receiver = this, value = ((descriptor = descriptor = _classExtractFieldDescriptor(receiver, privateMap = _a, "get")).get ? descriptor.get.call(receiver) : descriptor.value) + v, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"), (function(receiver, descriptor, value) { + receiver = this, privateMap = _a, receiver = this, value = ((descriptor = _classExtractFieldDescriptor(receiver, privateMap = _a, "get")).get ? descriptor.get.call(receiver) : descriptor.value) + v, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"), (function(receiver, descriptor, value) { if (descriptor.set) descriptor.set.call(receiver, value); else { if (!descriptor.writable) throw new TypeError("attempted to set read only private field"); diff --git a/crates/swc/tests/tsc-references/privateNameFieldAccess_es5.2.minified.js b/crates/swc/tests/tsc-references/privateNameFieldAccess_es5.2.minified.js index a5379474552..08978715e91 100644 --- a/crates/swc/tests/tsc-references/privateNameFieldAccess_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameFieldAccess_es5.2.minified.js @@ -8,7 +8,7 @@ var _myField = new WeakMap(), A = function() { value: "hello world" }, (function(obj, privateCollection) { if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object"); - })(obj, privateMap = _myField), privateMap.set(obj, value), console.log((receiver = this, (descriptor = descriptor = function(receiver, privateMap, action) { + })(obj, privateMap = _myField), privateMap.set(obj, value), console.log((receiver = this, (descriptor = function(receiver, privateMap, action) { if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance"); return privateMap.get(receiver); }(receiver, privateMap = _myField, "get")).get ? descriptor.get.call(receiver) : descriptor.value)); diff --git a/crates/swc/tests/tsc-references/privateNameInLhsReceiverExpression_es5.2.minified.js b/crates/swc/tests/tsc-references/privateNameInLhsReceiverExpression_es5.2.minified.js index 0cdf4d97e9d..f5323bfa983 100644 --- a/crates/swc/tests/tsc-references/privateNameInLhsReceiverExpression_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameInLhsReceiverExpression_es5.2.minified.js @@ -50,7 +50,7 @@ var _y = new WeakMap(), Test = function() { writable: !0, value: 1 }), this.s = "prop"; - })).s], _y, ((descriptor = descriptor = _classExtractFieldDescriptor(receiver = _s, privateMap = _y, "get")).get ? descriptor.get.call(receiver) : descriptor.value) + 1); + })).s], _y, ((descriptor = _classExtractFieldDescriptor(receiver = _s, privateMap = _y, "get")).get ? descriptor.get.call(receiver) : descriptor.value) + 1); } } ], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Test; diff --git a/crates/swc/tests/tsc-references/privateNameSetterNoGetter_es2015.2.minified.js b/crates/swc/tests/tsc-references/privateNameSetterNoGetter_es2015.2.minified.js index 8d4f8943eb3..a536b6377f9 100644 --- a/crates/swc/tests/tsc-references/privateNameSetterNoGetter_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameSetterNoGetter_es2015.2.minified.js @@ -7,7 +7,7 @@ const C = function() { return class { m() { var receiver, privateMap, descriptor, receiver, descriptor, receiver, privateMap, value, descriptor; - receiver = this, privateMap = _x, receiver = this, value = ((descriptor = descriptor = _classExtractFieldDescriptor(receiver, privateMap = _x, "get")).get ? descriptor.get.call(receiver) : descriptor.value) + 2, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"), (function(receiver, descriptor, value) { + receiver = this, privateMap = _x, receiver = this, value = ((descriptor = _classExtractFieldDescriptor(receiver, privateMap = _x, "get")).get ? descriptor.get.call(receiver) : descriptor.value) + 2, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"), (function(receiver, descriptor, value) { if (descriptor.set) descriptor.set.call(receiver, value); else { if (!descriptor.writable) throw new TypeError("attempted to set read only private field"); diff --git a/crates/swc/tests/tsc-references/privateNameSetterNoGetter_es5.2.minified.js b/crates/swc/tests/tsc-references/privateNameSetterNoGetter_es5.2.minified.js index 4754f437d33..477cfdbdb06 100644 --- a/crates/swc/tests/tsc-references/privateNameSetterNoGetter_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameSetterNoGetter_es5.2.minified.js @@ -28,7 +28,7 @@ var C = function() { key: "m", value: function() { var receiver, privateMap, descriptor, receiver, descriptor, receiver, privateMap, value, descriptor; - receiver = this, privateMap = _x, receiver = this, value = ((descriptor = descriptor = _classExtractFieldDescriptor(receiver, privateMap = _x, "get")).get ? descriptor.get.call(receiver) : descriptor.value) + 2, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"), (function(receiver, descriptor, value) { + receiver = this, privateMap = _x, receiver = this, value = ((descriptor = _classExtractFieldDescriptor(receiver, privateMap = _x, "get")).get ? descriptor.get.call(receiver) : descriptor.value) + 2, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"), (function(receiver, descriptor, value) { if (descriptor.set) descriptor.set.call(receiver, value); else { if (!descriptor.writable) throw new TypeError("attempted to set read only private field"); diff --git a/crates/swc/tests/tsc-references/privateNamesAssertion_es5.2.minified.js b/crates/swc/tests/tsc-references/privateNamesAssertion_es5.2.minified.js index 6b8af7a5109..1320e997179 100644 --- a/crates/swc/tests/tsc-references/privateNamesAssertion_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNamesAssertion_es5.2.minified.js @@ -29,7 +29,7 @@ var _p1 = new WeakMap(), Foo = function() { key: "m1", value: function(v) { var receiver, privateMap, descriptor, receiver, descriptor; - (receiver = this, (descriptor = descriptor = (function(receiver, privateMap, action) { + (receiver = this, (descriptor = (function(receiver, privateMap, action) { if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance"); return privateMap.get(receiver); })(receiver, privateMap = _p1, "get")).get ? descriptor.get.call(receiver) : descriptor.value).call(this, v); diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-2_es2015.2.minified.js b/crates/swc/tests/tsc-references/privateNamesUnique-2_es2015.2.minified.js index 8a0a0d2b616..619bf7112c3 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-2_es2015.2.minified.js @@ -9,7 +9,7 @@ var _x = new WeakMap(); export class Foo { copy(other) { var receiver, privateMap, descriptor, receiver, descriptor; - (descriptor = descriptor = (function(receiver, privateMap, action) { + (descriptor = (function(receiver, privateMap, action) { if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance"); return privateMap.get(receiver); })(receiver = other, privateMap = _x, "get")).get ? descriptor.get.call(receiver) : descriptor.value; diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-2_es5.2.minified.js b/crates/swc/tests/tsc-references/privateNamesUnique-2_es5.2.minified.js index f1d203a6436..16ceb2f1f61 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-2_es5.2.minified.js @@ -29,7 +29,7 @@ export var Foo = function() { key: "copy", value: function(other) { var receiver, privateMap, descriptor, receiver, descriptor; - (descriptor = descriptor = (function(receiver, privateMap, action) { + (descriptor = (function(receiver, privateMap, action) { if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance"); return privateMap.get(receiver); })(receiver = other, privateMap = _x, "get")).get ? descriptor.get.call(receiver) : descriptor.value; diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-3_es2015.2.minified.js b/crates/swc/tests/tsc-references/privateNamesUnique-3_es2015.2.minified.js index d49633ef8ee..c94f4d922f1 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-3_es2015.2.minified.js @@ -6,7 +6,7 @@ class B { if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance"); })(receiver, classConstructor), (function(descriptor, action) { if (void 0 === descriptor) throw new TypeError("attempted to get private static field before its declaration"); - })(descriptor, "get"), (descriptor = descriptor).get ? descriptor.get.call(receiver) : descriptor.value; + })(descriptor, "get"), descriptor.get ? descriptor.get.call(receiver) : descriptor.value; } } var _foo = { diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-3_es5.2.minified.js b/crates/swc/tests/tsc-references/privateNamesUnique-3_es5.2.minified.js index 0f86ff97911..f771c836d8b 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-3_es5.2.minified.js @@ -34,7 +34,7 @@ var _foo = new WeakMap(), A = function() { if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance"); })(receiver, classConstructor), (function(descriptor, action) { if (void 0 === descriptor) throw new TypeError("attempted to get private static field before its declaration"); - })(descriptor, "get"), (descriptor = descriptor).get ? descriptor.get.call(receiver) : descriptor.value; + })(descriptor, "get"), descriptor.get ? descriptor.get.call(receiver) : descriptor.value; } } ], _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), B; diff --git a/crates/swc/tests/tsc-references/strictPropertyInitialization_es5.2.minified.js b/crates/swc/tests/tsc-references/strictPropertyInitialization_es5.2.minified.js index 78d696f97b4..7593c717183 100644 --- a/crates/swc/tests/tsc-references/strictPropertyInitialization_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/strictPropertyInitialization_es5.2.minified.js @@ -85,7 +85,7 @@ var _f = new WeakMap(), _g = new WeakMap(), _h = new WeakMap(), _i = new WeakMap value: void 0 }); var receiver, privateMap, descriptor, receiver, descriptor, x = this.a; - this.a = this.b, receiver = this, this.b = (descriptor = descriptor = _classExtractFieldDescriptor(receiver, privateMap = _d1, "get")).get ? descriptor.get.call(receiver) : descriptor.value, this.b = x, _classPrivateFieldSet(this, _d1, x), this.c; + this.a = this.b, receiver = this, this.b = (descriptor = _classExtractFieldDescriptor(receiver, privateMap = _d1, "get")).get ? descriptor.get.call(receiver) : descriptor.value, this.b = x, _classPrivateFieldSet(this, _d1, x), this.c; }, _b3 = new WeakMap(), C11 = function() { "use strict"; _classCallCheck(this, C11), _classPrivateFieldInit(this, _b3, { diff --git a/crates/swc_ecma_minifier/src/compress/optimize/iife.rs b/crates/swc_ecma_minifier/src/compress/optimize/iife.rs index 7a1d7525594..72f03a6525c 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/iife.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/iife.rs @@ -1,7 +1,4 @@ -use std::{ - collections::HashMap, - mem::{replace, swap}, -}; +use std::{collections::HashMap, mem::swap}; use swc_atoms::js_word; use swc_common::{collections::AHashMap, pass::Either, util::take::Take, Spanned, DUMMY_SP}; @@ -9,7 +6,7 @@ use swc_ecma_ast::*; use swc_ecma_utils::{contains_arguments, ident::IdentLike, undefined, ExprFactory, Id}; use swc_ecma_visit::VisitMutWith; -use super::Optimizer; +use super::{util::MultiReplacer, Optimizer}; use crate::{ compress::optimize::Ctx, mode::Mode, @@ -256,15 +253,16 @@ where #[cfg_attr(feature = "debug", tracing::instrument(skip(self, n, vars)))] pub(super) fn inline_vars_in_node(&mut self, n: &mut N, vars: AHashMap>) where - N: VisitMutWith, + N: VisitMutWith, { if cfg!(feature = "debug") { tracing::trace!("inline: inline_vars_in_node"); } - let orig_vars = replace(&mut self.vars_for_inlining, vars); - n.visit_mut_with(self); - self.vars_for_inlining = orig_vars; + n.visit_mut_with(&mut MultiReplacer { + vars, + changed: false, + }); } /// Fully inlines iife. diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/2257/full/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/2257/full/output.js index a353014fe39..580304bfd2b 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/2257/full/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/2257/full/output.js @@ -1582,7 +1582,7 @@ var key, i, target = _objectWithoutPropertiesLoose(source, excluded); if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); + for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], excluded.indexOf(key) >= 0 || Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); } return target; } @@ -1949,7 +1949,7 @@ } } if (request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), !0), request.timeout = config.timeout, "onloadend" in request ? request.onloadend = onloadend : request.onreadystatechange = function() { - !!request && 4 === request.readyState && (0 !== request.status || request.responseURL && 0 === request.responseURL.indexOf("file:")) && setTimeout(onloadend); + !request || 4 !== request.readyState || (0 !== request.status || request.responseURL && 0 === request.responseURL.indexOf("file:")) && setTimeout(onloadend); }, request.onabort = function() { request && (reject(createError("Request aborted", config, "ECONNABORTED", request)), request = null); }, request.onerror = function() { @@ -7178,7 +7178,7 @@ }, 8789: function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { "use strict"; - var descriptor, $ = __webpack_require__(35437), getOwnPropertyDescriptor = __webpack_require__(24722).f, toLength = __webpack_require__(31998), toString = __webpack_require__(72729), notARegExp = __webpack_require__(3974), requireObjectCoercible = __webpack_require__(79602), correctIsRegExpLogic = __webpack_require__(26234), IS_PURE = __webpack_require__(80627), $endsWith = "".endsWith, min = Math.min, CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic("endsWith"), MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!((descriptor = getOwnPropertyDescriptor(String.prototype, "endsWith")) && !descriptor.writable); + var descriptor, $ = __webpack_require__(35437), getOwnPropertyDescriptor = __webpack_require__(24722).f, toLength = __webpack_require__(31998), toString = __webpack_require__(72729), notARegExp = __webpack_require__(3974), requireObjectCoercible = __webpack_require__(79602), correctIsRegExpLogic = __webpack_require__(26234), IS_PURE = __webpack_require__(80627), $endsWith = "".endsWith, min = Math.min, CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic("endsWith"), MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!(descriptor = getOwnPropertyDescriptor(String.prototype, "endsWith")) && !descriptor.writable; $({ target: "String", proto: !0, @@ -7591,7 +7591,7 @@ }, 24467: function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { "use strict"; - var descriptor, $ = __webpack_require__(35437), getOwnPropertyDescriptor = __webpack_require__(24722).f, toLength = __webpack_require__(31998), toString = __webpack_require__(72729), notARegExp = __webpack_require__(3974), requireObjectCoercible = __webpack_require__(79602), correctIsRegExpLogic = __webpack_require__(26234), IS_PURE = __webpack_require__(80627), $startsWith = "".startsWith, min = Math.min, CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic("startsWith"), MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!((descriptor = getOwnPropertyDescriptor(String.prototype, "startsWith")) && !descriptor.writable); + var descriptor, $ = __webpack_require__(35437), getOwnPropertyDescriptor = __webpack_require__(24722).f, toLength = __webpack_require__(31998), toString = __webpack_require__(72729), notARegExp = __webpack_require__(3974), requireObjectCoercible = __webpack_require__(79602), correctIsRegExpLogic = __webpack_require__(26234), IS_PURE = __webpack_require__(80627), $startsWith = "".startsWith, min = Math.min, CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic("startsWith"), MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!(descriptor = getOwnPropertyDescriptor(String.prototype, "startsWith")) && !descriptor.writable; $({ target: "String", proto: !0, @@ -9612,7 +9612,7 @@ (0, esm_extends.Z)(history, nextState), history.length = globalHistory.length, transitionManager.notifyListeners(history.location, history.action); } function handlePopState(event) { - void 0 === event.state && -1 === navigator.userAgent.indexOf("CriOS") || handlePop(getDOMLocation(event.state)); + (void 0 !== event.state || -1 !== navigator.userAgent.indexOf("CriOS")) && handlePop(getDOMLocation(event.state)); } function handleHashChange() { handlePop(getDOMLocation(getHistoryState())); @@ -10828,7 +10828,7 @@ } function qa(a2, b2, c1, d2) { var a1, e = D.hasOwnProperty(b2) ? D[b2] : null; - (null !== e ? 0 !== e.type : d2 || (!(2 < b2.length) || "o" !== b2[0] && "O" !== b2[0] || "n" !== b2[1] && "N" !== b2[1]) && 1) && ((function(a3, b3, c2, d3) { + (null !== e ? 0 === e.type : !d2 && 2 < b2.length && ("o" === b2[0] || "O" === b2[0]) && ("n" === b2[1] || "N" === b2[1])) || ((function(a3, b3, c2, d3) { if (null == b3 || (function(a, b, c, d) { if (null !== c && 0 === c.type) return !1; switch(typeof b){ @@ -16186,7 +16186,7 @@ return this.props.children; }, Provider; }(_react_17_0_2_react.Component); - (_Provider$childContex = {})[contextProp] = _prop_types_15_7_2_prop_types_default().object.isRequired, Provider1.childContextTypes = _Provider$childContex; + Provider1.childContextTypes = ((_Provider$childContex = {})[contextProp] = _prop_types_15_7_2_prop_types_default().object.isRequired, _Provider$childContex); var Consumer1 = function(_Component2) { function Consumer() { var _this2; diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/firebase-core/1/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/firebase-core/1/output.js index 692b5949645..a709df0c144 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/firebase-core/1/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/firebase-core/1/output.js @@ -1768,7 +1768,7 @@ var key, i, target = _objectWithoutPropertiesLoose(source, excluded); if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); + for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], excluded.indexOf(key) >= 0 || Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); } return target; }(_param, [ diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/moment/1/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/moment/1/output.js index ba144f6acff..278fc2ad2d3 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/moment/1/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/moment/1/output.js @@ -751,7 +751,7 @@ } else config._isValid = !1; } function configFromRFC2822(config) { - var year, weekdayStr, parsedInput, config1, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr, result, parsedArray, match = rfc2822.exec(config._i.replace(/\([^)]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "")); + var weekdayStr, parsedInput, config1, year, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr, result, parsedArray, match = rfc2822.exec(config._i.replace(/\([^)]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "")); if (match) { if (yearStr = match[4], monthStr = match[3], dayStr = match[2], hourStr = match[5], minuteStr = match[6], secondStr = match[7], result = [ (year = parseInt(yearStr, 10)) <= 49 ? 2000 + year : year <= 999 ? 1900 + year : year, diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/react-countup/1/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/react-countup/1/output.js index d9e39313560..86ad3d53e34 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/react-countup/1/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/react-countup/1/output.js @@ -100,7 +100,7 @@ var key, i, target = _objectWithoutPropertiesLoose(source, excluded); if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); + for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], excluded.indexOf(key) >= 0 || Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); } return target; }(_param, [ diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/next/31077/static/chunks/1606726a.10299989c08cb523/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/next/31077/static/chunks/1606726a.10299989c08cb523/output.js index bb6148f5892..a2728d8bbb0 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/next/31077/static/chunks/1606726a.10299989c08cb523/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/next/31077/static/chunks/1606726a.10299989c08cb523/output.js @@ -1315,50 +1315,11 @@ function resolveSelection(view, doc, parsedSel) { return Math.max(parsedSel.anchor, parsedSel.head) > doc.content.size ? null : selectionBetween(view, doc.resolve(parsedSel.anchor), doc.resolve(parsedSel.head)); } - function isMarkChange(cur, prev) { - for(var type, mark, update, curMarks = cur.firstChild.marks, prevMarks = prev.firstChild.marks, added = curMarks, removed = prevMarks, i = 0; i < prevMarks.length; i++)added = prevMarks[i].removeFromSet(added); - for(var i$1 = 0; i$1 < curMarks.length; i$1++)removed = curMarks[i$1].removeFromSet(removed); - if (1 == added.length && 0 == removed.length) mark = added[0], type = "add", update = function(node) { - return node.mark(mark.addToSet(node.marks)); - }; - else { - if (0 != added.length || 1 != removed.length) return null; - mark = removed[0], type = "remove", update = function(node) { - return node.mark(mark.removeFromSet(node.marks)); - }; - } - for(var updated = [], i$2 = 0; i$2 < prev.childCount; i$2++)updated.push(update(prev.child(i$2))); - if (prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(updated).eq(cur)) return { - mark: mark, - type: type - }; - } - function looksLikeJoin(old, start, end, $newStart, $newEnd) { - if (!$newStart.parent.isTextblock || end - start <= $newEnd.pos - $newStart.pos || skipClosingAndOpening($newStart, !0, !1) < $newEnd.pos) return !1; - var $start = old.resolve(start); - if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock) return !1; - var $next = old.resolve(skipClosingAndOpening($start, !0, !0)); - return !(!$next.parent.isTextblock || $next.pos > end || skipClosingAndOpening($next, !0, !1) < end) && $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content); - } function skipClosingAndOpening($pos, fromEnd, mayOpen) { for(var depth = $pos.depth, end = fromEnd ? $pos.end() : $pos.pos; depth > 0 && (fromEnd || $pos.indexAfter(depth) == $pos.node(depth).childCount);)depth--, end++, fromEnd = !1; if (mayOpen) for(var next = $pos.node(depth).maybeChild($pos.indexAfter(depth)); next && !next.isLeaf;)next = next.firstChild, end++; return end; } - function findDiff(a, b, pos, preferredPos, preferredSide) { - var start = a.findDiffStart(b, pos); - if (null == start) return null; - var ref = a.findDiffEnd(b, pos + a.size, pos + b.size), endA = ref.a, endB = ref.b; - if ("end" == preferredSide) { - var adjust = Math.max(0, start - Math.min(endA, endB)); - preferredPos -= endA + adjust - start; - } - return endA < start && a.size < b.size ? (start -= preferredPos <= start && preferredPos >= endA ? start - preferredPos : 0, endB = start + (endB - endA), endA = start) : endB < start && (start -= preferredPos <= start && preferredPos >= endB ? start - preferredPos : 0, endA = start + (endA - endB), endB = start), { - start: start, - endA: endA, - endB: endB - }; - } function serializeForClipboard(view, slice) { for(var context = [], content = slice.content, openStart = slice.openStart, openEnd = slice.openEnd; openStart > 1 && openEnd > 1 && 1 == content.childCount && 1 == content.firstChild.childCount;){ openStart--, openEnd--; @@ -2330,7 +2291,7 @@ x: 0, y: 0, type: "" - }, view7.lastSelectionOrigin = null, view7.lastSelectionTime = 0, view7.lastIOSEnter = 0, view7.lastIOSEnterFallbackTimeout = null, view7.lastAndroidDelete = 0, view7.composing = !1, view7.composingTimeout = null, view7.compositionNodes = [], view7.compositionEndedAt = -200000000, view7.domObserver = new DOMObserver(view7, function(from1, to1, typeOver1, added) { + }, view7.lastSelectionOrigin = null, view7.lastSelectionTime = 0, view7.lastIOSEnter = 0, view7.lastIOSEnterFallbackTimeout = null, view7.lastAndroidDelete = 0, view7.composing = !1, view7.composingTimeout = null, view7.compositionNodes = [], view7.compositionEndedAt = -200000000, view7.domObserver = new DOMObserver(view7, function(from1, to1, typeOver1, added1) { return (function(view8, from2, to2, typeOver, addedNodes) { if (from2 < 0) { var preferredPos, preferredSide, nextSel, tr, storedMarks, markChange, $from1, origin = view8.lastSelectionTime > Date.now() - 50 ? view8.lastSelectionOrigin : null, newSel = selectionFromDOM(view8, origin); @@ -2395,7 +2356,20 @@ } var doc1 = view8.state.doc, compare = doc1.slice(parse.from, parse.to); 8 === view8.lastKeyCode && Date.now() - 100 < view8.lastKeyCodeTime ? (preferredPos = view8.state.selection.to, preferredSide = "end") : (preferredPos = view8.state.selection.from, preferredSide = "start"), view8.lastKeyCode = null; - var change = findDiff(compare.content, parse.doc.content, parse.from, preferredPos, preferredSide); + var change = function(a, b, pos, preferredPos, preferredSide) { + var start = a.findDiffStart(b, pos); + if (null == start) return null; + var ref = a.findDiffEnd(b, pos + a.size, pos + b.size), endA = ref.a, endB = ref.b; + if ("end" == preferredSide) { + var adjust = Math.max(0, start - Math.min(endA, endB)); + preferredPos -= endA + adjust - start; + } + return endA < start && a.size < b.size ? (start -= preferredPos <= start && preferredPos >= endA ? start - preferredPos : 0, endB = start + (endB - endA), endA = start) : endB < start && (start -= preferredPos <= start && preferredPos >= endB ? start - preferredPos : 0, endA = start + (endA - endB), endB = start), { + start: start, + endA: endA, + endB: endB + }; + }(compare.content, parse.doc.content, parse.from, preferredPos, preferredSide); if (!change) if (typeOver && sel2 instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection && !sel2.empty && sel2.$head.sameParent(sel2.$anchor) && !view8.composing && !(parse.sel && parse.sel.anchor != parse.sel.head)) change = { start: sel2.from, endA: sel2.to, @@ -2425,7 +2399,13 @@ view8.lastIOSEnter = 0; return; } - if (view8.state.selection.anchor > change.start && looksLikeJoin(doc1, change.start, change.endA, $from1, $to) && view8.someProp("handleKeyDown", function(f) { + if (view8.state.selection.anchor > change.start && (function(old, start, end, $newStart, $newEnd) { + if (!$newStart.parent.isTextblock || end - start <= $newEnd.pos - $newStart.pos || skipClosingAndOpening($newStart, !0, !1) < $newEnd.pos) return !1; + var $start = old.resolve(start); + if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock) return !1; + var $next = old.resolve(skipClosingAndOpening($start, !0, !0)); + return !(!$next.parent.isTextblock || $next.pos > end || skipClosingAndOpening($next, !0, !1) < end) && $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content); + })(doc1, change.start, change.endA, $from1, $to) && view8.someProp("handleKeyDown", function(f) { return f(view8, keyEvent(8, "Backspace")); })) { result1.android && result1.chrome && view8.domObserver.suppressSelectionUpdates(); @@ -2441,7 +2421,24 @@ if ($from1.pos == $to.pos) result1.ie && result1.ie_version <= 11 && 0 == $from1.parentOffset && (view8.domObserver.suppressSelectionUpdates(), setTimeout(function() { return selectionToDOM(view8); }, 20)), tr = view8.state.tr.delete(chFrom, chTo), storedMarks = doc1.resolve(change.start).marksAcross(doc1.resolve(change.endA)); - else if (change.endA == change.endB && ($from1 = doc1.resolve(change.start)) && (markChange = isMarkChange($from1.parent.content.cut($from1.parentOffset, $to.parentOffset), $from1.parent.content.cut($from1.parentOffset, change.endA - $from1.start())))) tr = view8.state.tr, "add" == markChange.type ? tr.addMark(chFrom, chTo, markChange.mark) : tr.removeMark(chFrom, chTo, markChange.mark); + else if (change.endA == change.endB && ($from1 = doc1.resolve(change.start)) && (markChange = (function(cur, prev) { + for(var type, mark, update, curMarks = cur.firstChild.marks, prevMarks = prev.firstChild.marks, added = curMarks, removed = prevMarks, i = 0; i < prevMarks.length; i++)added = prevMarks[i].removeFromSet(added); + for(var i$1 = 0; i$1 < curMarks.length; i$1++)removed = curMarks[i$1].removeFromSet(removed); + if (1 == added.length && 0 == removed.length) mark = added[0], type = "add", update = function(node) { + return node.mark(mark.addToSet(node.marks)); + }; + else { + if (0 != added.length || 1 != removed.length) return null; + mark = removed[0], type = "remove", update = function(node) { + return node.mark(mark.removeFromSet(node.marks)); + }; + } + for(var updated = [], i$2 = 0; i$2 < prev.childCount; i$2++)updated.push(update(prev.child(i$2))); + if (prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(updated).eq(cur)) return { + mark: mark, + type: type + }; + })($from1.parent.content.cut($from1.parentOffset, $to.parentOffset), $from1.parent.content.cut($from1.parentOffset, change.endA - $from1.start())))) tr = view8.state.tr, "add" == markChange.type ? tr.addMark(chFrom, chTo, markChange.mark) : tr.removeMark(chFrom, chTo, markChange.mark); else if ($from1.parent.child($from1.index()).isText && $from1.index() == $to.index() - ($to.textOffset ? 0 : 1)) { var text$1 = $from1.parent.textBetween($from1.parentOffset, $to.parentOffset); if (view8.someProp("handleTextInput", function(f) { @@ -2455,7 +2452,7 @@ sel$2 && !(result1.chrome && result1.android && view8.composing && sel$2.empty && (change.start != change.endB || view8.lastAndroidDelete < Date.now() - 100) && (sel$2.head == chFrom || sel$2.head == tr.mapping.map(chTo) - 1) || result1.ie && sel$2.empty && sel$2.head == chFrom) && tr.setSelection(sel$2); } storedMarks && tr.ensureMarks(storedMarks), view8.dispatch(tr.scrollIntoView()); - })(view7, from1, to1, typeOver1, added); + })(view7, from1, to1, typeOver1, added1); }), view7.domObserver.start(), view7.domChangeCount = 0, view7.eventHandlers = Object.create(null), handlers1)!function(event6) { var handler = handlers1[event6]; view7.dom.addEventListener(event6, view7.eventHandlers[event6] = function(event) { diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js index 6d26fbb999a..3510f75b7b4 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js @@ -6164,7 +6164,7 @@ enabled ? (this.trigger("debugon"), this.previousLogLevel_ = this.log.level, this.log.level("debug"), this.debugEnabled_ = !0) : (this.trigger("debugoff"), this.log.level(this.previousLogLevel_), this.previousLogLevel_ = void 0, this.debugEnabled_ = !1); }, _proto.playbackRates = function(newRates) { if (void 0 === newRates) return this.cache_.playbackRates; - !!Array.isArray(newRates) && newRates.every(function(rate) { + !Array.isArray(newRates) || newRates.every(function(rate) { return "number" == typeof rate; }) && (this.cache_.playbackRates = newRates, this.trigger("playbackrateschange")); }, Player; diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/next/feedback-2/codemirror/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/next/feedback-2/codemirror/output.js index d04971e3598..35c0c6e152c 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/next/feedback-2/codemirror/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/next/feedback-2/codemirror/output.js @@ -2558,8 +2558,8 @@ last && last.ranges ? (done[done.length - 1] = sel, setSelectionNoUndo(doc, sel, options)) : setSelection(doc, sel, options); } function setSelection(doc, sel, options) { - var doc4, sel1, opId, options1, hist, origin, doc5, origin1, prev, sel2, ch; - setSelectionNoUndo(doc, sel, options), doc4 = doc, sel1 = doc.sel, opId = doc.cm ? doc.cm.curOp.id : NaN, options1 = options, hist = doc4.history, origin = options1 && options1.origin, opId == hist.lastSelOp || origin && hist.lastSelOrigin == origin && (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin || (doc5 = doc4, origin1 = origin, prev = lst(hist.done), sel2 = sel1, "*" == (ch = origin1.charAt(0)) || "+" == ch && prev.ranges.length == sel2.ranges.length && prev.somethingSelected() == sel2.somethingSelected() && new Date - doc5.history.lastSelTime <= (doc5.cm ? doc5.cm.options.historyEventDelay : 500))) ? hist.done[hist.done.length - 1] = sel1 : pushSelectionToHistory(sel1, hist.done), hist.lastSelTime = +new Date, hist.lastSelOrigin = origin, hist.lastSelOp = opId, options1 && !1 !== options1.clearRedo && clearSelectionEvents(hist.undone); + var doc4, sel1, opId, options1, doc5, origin, prev, sel2, ch, hist, origin1; + setSelectionNoUndo(doc, sel, options), doc4 = doc, sel1 = doc.sel, opId = doc.cm ? doc.cm.curOp.id : NaN, options1 = options, hist = doc4.history, origin1 = options1 && options1.origin, opId == hist.lastSelOp || origin1 && hist.lastSelOrigin == origin1 && (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin1 || (doc5 = doc4, origin = origin1, prev = lst(hist.done), sel2 = sel1, "*" == (ch = origin.charAt(0)) || "+" == ch && prev.ranges.length == sel2.ranges.length && prev.somethingSelected() == sel2.somethingSelected() && new Date - doc5.history.lastSelTime <= (doc5.cm ? doc5.cm.options.historyEventDelay : 500))) ? hist.done[hist.done.length - 1] = sel1 : pushSelectionToHistory(sel1, hist.done), hist.lastSelTime = +new Date, hist.lastSelOrigin = origin1, hist.lastSelOp = opId, options1 && !1 !== options1.clearRedo && clearSelectionEvents(hist.undone); } function setSelectionNoUndo(doc, sel, options) { if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange")) { diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/projects/jquery/11/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/projects/jquery/11/output.js index c38fe878ab5..bbe0b6a22bc 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/projects/jquery/11/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/projects/jquery/11/output.js @@ -37,7 +37,7 @@ jQuery.support = (function() { })div.setAttribute(eventName = "on" + i, "t"), support[i + "Bubbles"] = eventName in window || !1 === div.attributes[eventName].expando; return div.style.backgroundClip = "content-box", div.cloneNode(!0).style.backgroundClip = "", support.clearCloneStyle = "content-box" === div.style.backgroundClip, jQuery(function() { var container, marginDiv, tds, divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", body = document.getElementsByTagName("body")[0]; - body && ((container = document.createElement("div")).style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px", body.appendChild(container).appendChild(div), div.innerHTML = "
t
", (tds = div.getElementsByTagName("td"))[0].style.cssText = "padding:0;margin:0;border:0;display:none", isSupported = 0 === tds[0].offsetHeight, tds[0].style.display = "", tds[1].style.display = "none", support.reliableHiddenOffsets = isSupported && 0 === tds[0].offsetHeight, div.innerHTML = "", div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;", support.boxSizing = 4 === div.offsetWidth, support.doesNotIncludeMarginInBodyOffset = 1 !== body.offsetTop, window.getComputedStyle && (support.pixelPosition = "1%" !== (window.getComputedStyle(div, null) || {}).top, support.boxSizingReliable = "4px" === (window.getComputedStyle(div, null) || { + !body || ((container = document.createElement("div")).style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px", body.appendChild(container).appendChild(div), div.innerHTML = "
t
", (tds = div.getElementsByTagName("td"))[0].style.cssText = "padding:0;margin:0;border:0;display:none", isSupported = 0 === tds[0].offsetHeight, tds[0].style.display = "", tds[1].style.display = "none", support.reliableHiddenOffsets = isSupported && 0 === tds[0].offsetHeight, div.innerHTML = "", div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;", support.boxSizing = 4 === div.offsetWidth, support.doesNotIncludeMarginInBodyOffset = 1 !== body.offsetTop, window.getComputedStyle && (support.pixelPosition = "1%" !== (window.getComputedStyle(div, null) || {}).top, support.boxSizingReliable = "4px" === (window.getComputedStyle(div, null) || { width: "4px" }).width, (marginDiv = div.appendChild(document.createElement("div"))).style.cssText = div.style.cssText = divReset, marginDiv.style.marginRight = marginDiv.style.width = "0", div.style.width = "1px", support.reliableMarginRight = !parseFloat((window.getComputedStyle(marginDiv, null) || {}).marginRight)), typeof div.style.zoom !== core_strundefined && (div.innerHTML = "", div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1", support.inlineBlockNeedsLayout = 3 === div.offsetWidth, div.style.display = "block", div.innerHTML = "
", div.firstChild.style.width = "5px", support.shrinkWrapBlocks = 3 !== div.offsetWidth, support.inlineBlockNeedsLayout && (body.style.zoom = 1)), body.removeChild(container), container = div = tds = marginDiv = null); }), all = select = fragment = opt = a = input = null, support; 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 048e9fea072..8323b64d505 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(a,b,c){var d;!function(g,B,Q,l){"use strict";var m,R=["","webkit","Moz","MS","ms","o"],C=B.createElement("div"),S=Math.round,T=Math.abs,U=Date.now;function V(a,b,c){return setTimeout(G(a,c),b)}function W(a,c,b){return!!Array.isArray(a)&&(D(a,b[c],b),!0)}function D(a,c,d){var b;if(a)if(a.forEach)a.forEach(c,d);else if(l!==a.length)for(b=0;b\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",b=g.console&&(g.console.warn||g.console.log);return b&&b.call(g.console,d,e),c.apply(this,arguments)}}m="function"!=typeof Object.assign?function(b){if(b===l||null===b)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(b),c=1;c -1}function _(a){return a.trim().split(/\s+/g)}function aa(a,d,c){if(a.indexOf&&!c)return a.indexOf(d);for(var b=0;baa(e,f)&&b.push(c[a]),e[a]=f,a++}return g&&(b=d?b.sort(function(a,b){return a[d]>b[d]}):b.sort()),b}function n(e,a){for(var c,d,f=a[0].toUpperCase()+a.slice(1),b=0;b1&&!b.firstMultiple?b.firstMultiple=na(a):1===h&&(b.firstMultiple=!1);var i=b.firstInput,c=b.firstMultiple,j=c?c.center:i.center,k=a.center=oa(e);a.timeStamp=U(),a.deltaTime=a.timeStamp-i.timeStamp,a.angle=sa(j,k),a.distance=ra(j,k),la(b,a),a.offsetDirection=qa(a.deltaX,a.deltaY);var d=pa(a.deltaTime,a.deltaX,a.deltaY);a.overallVelocityX=d.x,a.overallVelocityY=d.y,a.overallVelocity=T(d.x)>T(d.y)?d.x:d.y,a.scale=c?ua(c.pointers,e):1,a.rotation=c?ta(c.pointers,e):0,a.maxPointers=b.prevInput?a.pointers.length>b.prevInput.maxPointers?a.pointers.length:b.prevInput.maxPointers:a.pointers.length,ma(b,a);var f=g.element;Z(a.srcEvent.target,f)&&(f=a.srcEvent.target),a.target=f}function la(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};(1===b.eventType||4===f.eventType)&&(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function ma(h,a){var d,e,f,g,b=h.lastInterval||a,i=a.timeStamp-b.timeStamp;if(8!=a.eventType&&(i>25||l===b.velocity)){var j=a.deltaX-b.deltaX,k=a.deltaY-b.deltaY,c=pa(i,j,k);e=c.x,f=c.y,d=T(c.x)>T(c.y)?c.x:c.y,g=qa(j,k),h.lastInterval=a}else d=b.velocity,e=b.velocityX,f=b.velocityY,g=b.direction;a.velocity=d,a.velocityX=e,a.velocityY=f,a.direction=g}function na(a){for(var c=[],b=0;b=T(b)?a<0?2:4:b<0?8:16}function ra(b,c,a){a||(a=ha);var d=c[a[0]]-b[a[0]],e=c[a[1]]-b[a[1]];return Math.sqrt(d*d+e*e)}function sa(b,c,a){a||(a=ha);var d=c[a[0]]-b[a[0]],e=c[a[1]]-b[a[1]];return 180*Math.atan2(e,d)/Math.PI}function ta(a,b){return sa(b[1],b[0],ia)+sa(a[1],a[0],ia)}function ua(a,b){return ra(b[0],b[1],ia)/ra(a[0],a[1],ia)}f.prototype={handler:function(){},init:function(){this.evEl&&H(this.element,this.evEl,this.domHandler),this.evTarget&&H(this.target,this.evTarget,this.domHandler),this.evWin&&H(ea(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&I(this.element,this.evEl,this.domHandler),this.evTarget&&I(this.target,this.evTarget,this.domHandler),this.evWin&&I(ea(this.element),this.evWin,this.domHandler)}};var va={mousedown:1,mousemove:2,mouseup:4};function u(){this.evEl="mousedown",this.evWin="mousemove mouseup",this.pressed=!1,f.apply(this,arguments)}e(u,f,{handler:function(a){var b=va[a.type];1&b&&0===a.button&&(this.pressed=!0),2&b&&1!==a.which&&(b=4),this.pressed&&(4&b&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:L,srcEvent:a}))}});var wa={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},xa={2:K,3:"pen",4:L,5:"kinect"},M="pointerdown",N="pointermove pointerup pointercancel";function v(){this.evEl=M,this.evWin=N,f.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}g.MSPointerEvent&&!g.PointerEvent&&(M="MSPointerDown",N="MSPointerMove MSPointerUp MSPointerCancel"),e(v,f,{handler:function(a){var b=this.store,e=!1,d=wa[a.type.toLowerCase().replace("ms","")],f=xa[a.pointerType]||a.pointerType,c=aa(b,a.pointerId,"pointerId");1&d&&(0===a.button||f==K)?c<0&&(b.push(a),c=b.length-1):12&d&&(e=!0),!(c<0)&&(b[c]=a,this.callback(this.manager,d,{pointers:b,changedPointers:[a],pointerType:f,srcEvent:a}),e&&b.splice(c,1))}});var ya={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function w(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,f.apply(this,arguments)}function za(b,d){var a=ba(b.touches),c=ba(b.changedTouches);return 12&d&&(a=ca(a.concat(c),"identifier",!0)),[a,c]}e(w,f,{handler:function(c){var a=ya[c.type];if(1===a&&(this.started=!0),this.started){var b=za.call(this,c,a);12&a&&b[0].length-b[1].length==0&&(this.started=!1),this.callback(this.manager,a,{pointers:b[0],changedPointers:b[1],pointerType:K,srcEvent:c})}}});var Aa={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function x(){this.evTarget="touchstart touchmove touchend touchcancel",this.targetIds={},f.apply(this,arguments)}function Ba(h,g){var b=ba(h.touches),c=this.targetIds;if(3&g&&1===b.length)return c[b[0].identifier]=!0,[b,b];var a,d,e=ba(h.changedTouches),f=[],i=this.target;if(d=b.filter(function(a){return Z(a.target,i)}),1===g)for(a=0;a -1&&d.splice(a,1)},2500)}}function Ea(b){for(var d=b.srcEvent.clientX,e=b.srcEvent.clientY,a=0;a -1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(d){var c=this,a=this.state;function b(a){c.manager.emit(a,d)}a<8&&b(c.options.event+Ma(a)),b(c.options.event),d.additionalEvent&&b(d.additionalEvent),a>=8&&b(c.options.event+Ma(a))},tryEmit:function(a){if(this.canEmit())return this.emit(a);this.state=32},canEmit:function(){for(var a=0;ac.threshold&&b&c.direction},attrTest:function(a){return h.prototype.attrTest.call(this,a)&&(2&this.state|| !(2&this.state)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=Na(a.direction);b&&(a.additionalEvent=this.options.event+b),this._super.emit.call(this,a)}}),e(p,h,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Ia]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||2&this.state)},emit:function(a){if(1!==a.scale){var b=a.scale<1?"in":"out";a.additionalEvent=this.options.event+b}this._super.emit.call(this,a)}}),e(q,i,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Ga]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distanceb.time;if(this._input=a,d&&c&&(!(12&a.eventType)||e)){if(1&a.eventType)this.reset(),this._timer=V(function(){this.state=8,this.tryEmit()},b.time,this);else if(4&a.eventType)return 8}else this.reset();return 32},reset:function(){clearTimeout(this._timer)},emit:function(a){8===this.state&&(a&&4&a.eventType?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=U(),this.manager.emit(this.options.event,this._input)))}}),e(r,h,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Ia]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||2&this.state)}}),e(s,h,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return o.prototype.getTouchAction.call(this)},attrTest:function(a){var b,c=this.options.direction;return 30&c?b=a.overallVelocity:6&c?b=a.overallVelocityX:24&c&&(b=a.overallVelocityY),this._super.attrTest.call(this,a)&&c&a.offsetDirection&&a.distance>this.options.threshold&&a.maxPointers==this.options.pointers&&T(b)>this.options.velocity&&4&a.eventType},emit:function(a){var b=Na(a.offsetDirection);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),e(j,i,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Ha]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance1)for(var a=1;ac.length)&&(a=c.length);for(var b=0,d=new Array(a);bc?c:a}Math.PI,Math.hypot||(Math.hypot=function(){for(var b=0,a=arguments.length;a--;)b+=arguments[a]*arguments[a];return Math.sqrt(b)}),nb=new h(4),h!=Float32Array&&(nb[0]=0,nb[1]=0,nb[2]=0,nb[3]=0);const Ga=Math.log2||function(a){return Math.log(a)*Math.LOG2E};function Ha(e,f,g){var h=f[0],i=f[1],j=f[2],k=f[3],l=f[4],m=f[5],n=f[6],o=f[7],p=f[8],q=f[9],r=f[10],s=f[11],t=f[12],u=f[13],v=f[14],w=f[15],a=g[0],b=g[1],c=g[2],d=g[3];return e[0]=a*h+b*l+c*p+d*t,e[1]=a*i+b*m+c*q+d*u,e[2]=a*j+b*n+c*r+d*v,e[3]=a*k+b*o+c*s+d*w,a=g[4],b=g[5],c=g[6],d=g[7],e[4]=a*h+b*l+c*p+d*t,e[5]=a*i+b*m+c*q+d*u,e[6]=a*j+b*n+c*r+d*v,e[7]=a*k+b*o+c*s+d*w,a=g[8],b=g[9],c=g[10],d=g[11],e[8]=a*h+b*l+c*p+d*t,e[9]=a*i+b*m+c*q+d*u,e[10]=a*j+b*n+c*r+d*v,e[11]=a*k+b*o+c*s+d*w,a=g[12],b=g[13],c=g[14],d=g[15],e[12]=a*h+b*l+c*p+d*t,e[13]=a*i+b*m+c*q+d*u,e[14]=a*j+b*n+c*r+d*v,e[15]=a*k+b*o+c*s+d*w,e}function Ia(b,a,f){var g,h,i,j,k,l,m,n,o,p,q,r,c=f[0],d=f[1],e=f[2];return a===b?(b[12]=a[0]*c+a[4]*d+a[8]*e+a[12],b[13]=a[1]*c+a[5]*d+a[9]*e+a[13],b[14]=a[2]*c+a[6]*d+a[10]*e+a[14],b[15]=a[3]*c+a[7]*d+a[11]*e+a[15]):(g=a[0],h=a[1],i=a[2],j=a[3],k=a[4],l=a[5],m=a[6],n=a[7],o=a[8],p=a[9],q=a[10],r=a[11],b[0]=g,b[1]=h,b[2]=i,b[3]=j,b[4]=k,b[5]=l,b[6]=m,b[7]=n,b[8]=o,b[9]=p,b[10]=q,b[11]=r,b[12]=g*c+k*d+o*e+a[12],b[13]=h*c+l*d+p*e+a[13],b[14]=i*c+m*d+q*e+a[14],b[15]=j*c+n*d+r*e+a[15]),b}function Ja(a,b,f){var c=f[0],d=f[1],e=f[2];return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a[3]=b[3]*c,a[4]=b[4]*d,a[5]=b[5]*d,a[6]=b[6]*d,a[7]=b[7]*d,a[8]=b[8]*e,a[9]=b[9]*e,a[10]=b[10]*e,a[11]=b[11]*e,a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a}function Ka(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[4],h=a[5],i=a[6],j=a[7],k=a[8],l=a[9],m=a[10],n=a[11],o=a[12],p=a[13],q=a[14],r=a[15],s=b[0],t=b[1],u=b[2],v=b[3],w=b[4],x=b[5],y=b[6],z=b[7],A=b[8],B=b[9],C=b[10],D=b[11],E=b[12],F=b[13],G=b[14],H=b[15];return Math.abs(c-s)<=1e-6*Math.max(1,Math.abs(c),Math.abs(s))&&Math.abs(d-t)<=1e-6*Math.max(1,Math.abs(d),Math.abs(t))&&Math.abs(e-u)<=1e-6*Math.max(1,Math.abs(e),Math.abs(u))&&Math.abs(f-v)<=1e-6*Math.max(1,Math.abs(f),Math.abs(v))&&Math.abs(g-w)<=1e-6*Math.max(1,Math.abs(g),Math.abs(w))&&Math.abs(h-x)<=1e-6*Math.max(1,Math.abs(h),Math.abs(x))&&Math.abs(i-y)<=1e-6*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(j-z)<=1e-6*Math.max(1,Math.abs(j),Math.abs(z))&&Math.abs(k-A)<=1e-6*Math.max(1,Math.abs(k),Math.abs(A))&&Math.abs(l-B)<=1e-6*Math.max(1,Math.abs(l),Math.abs(B))&&Math.abs(m-C)<=1e-6*Math.max(1,Math.abs(m),Math.abs(C))&&Math.abs(n-D)<=1e-6*Math.max(1,Math.abs(n),Math.abs(D))&&Math.abs(o-E)<=1e-6*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(p-F)<=1e-6*Math.max(1,Math.abs(p),Math.abs(F))&&Math.abs(q-G)<=1e-6*Math.max(1,Math.abs(q),Math.abs(G))&&Math.abs(r-H)<=1e-6*Math.max(1,Math.abs(r),Math.abs(H))}function La(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a}function Ma(a,b,c,d){var e=b[0],f=b[1];return a[0]=e+d*(c[0]-e),a[1]=f+d*(c[1]-f),a}function Na(a,b){if(!a)throw new Error(b||"@math.gl/web-mercator: assertion failed.")}ob=new h(2),h!=Float32Array&&(ob[0]=0,ob[1]=0),pb=new h(3),h!=Float32Array&&(pb[0]=0,pb[1]=0,pb[2]=0);const n=Math.PI,Oa=n/4,Pa=n/180,Qa=180/n;function Ra(a){return Math.pow(2,a)}function Sa([b,a]){return Na(Number.isFinite(b)),Na(Number.isFinite(a)&&a>= -90&&a<=90,"invalid latitude"),[512*(b*Pa+n)/(2*n),512*(n+Math.log(Math.tan(Oa+.5*(a*Pa))))/(2*n)]}function Ta([a,b]){return[(a/512*(2*n)-n)*Qa,2*(Math.atan(Math.exp(b/512*(2*n)-n))-Oa)*Qa]}function Ua(a){return 2*Math.atan(.5/a)*Qa}function Va(a){return .5/Math.tan(.5*a*Pa)}function Wa(i,c,j=0){const[a,b,e]=i;if(Na(Number.isFinite(a)&&Number.isFinite(b),"invalid pixel coordinate"),Number.isFinite(e)){const k=Ca(c,[a,b,e,1]);return k}const f=Ca(c,[a,b,0,1]),g=Ca(c,[a,b,1,1]),d=f[2],h=g[2];return Ma([],f,g,d===h?0:((j||0)-d)/(h-d))}const Xa=Math.PI/180;function Ya(a,c,d){const{pixelUnprojectionMatrix:e}=a,b=Ca(e,[c,0,1,1]),f=Ca(e,[c,a.height,1,1]),h=d*a.distanceScales.unitsPerMeter[2],i=(h-b[2])/(f[2]-b[2]),j=Ma([],b,f,i),g=Ta(j);return g[2]=d,g}class Za{constructor({width:f,height:c,latitude:l=0,longitude:m=0,zoom:p=0,pitch:n=0,bearing:q=0,altitude:a=null,fovy:b=null,position:o=null,nearZMultiplier:t=.02,farZMultiplier:u=1.01}={width:1,height:1}){f=f||1,c=c||1,null===b&&null===a?b=Ua(a=1.5):null===b?b=Ua(a):null===a&&(a=Va(b));const r=Ra(p);a=Math.max(.75,a);const s=function({latitude:c,longitude:i,highPrecision:j=!1}){Na(Number.isFinite(c)&&Number.isFinite(i));const b={},d=Math.cos(c*Pa),e=1.4222222222222223/d,a=12790407194604047e-21/d;if(b.unitsPerMeter=[a,a,a],b.metersPerUnit=[1/a,1/a,1/a],b.unitsPerDegree=[1.4222222222222223,e,a],b.degreesPerUnit=[.703125,1/e,1/a],j){const f=Pa*Math.tan(c*Pa)/d,k=1.4222222222222223*f/2,g=12790407194604047e-21*f,h=g/e*a;b.unitsPerDegree2=[0,k,g],b.unitsPerMeter2=[h,0,h]}return b}({longitude:m,latitude:l}),d=Sa([m,l]);if(d[2]=0,o){var e,g,h,i,j,k;i=d,j=d,e=[],g=o,h=s.unitsPerMeter,e[0]=g[0]*h[0],e[1]=g[1]*h[1],e[2]=g[2]*h[2],k=e,i[0]=j[0]+k[0],i[1]=j[1]+k[1],i[2]=j[2]+k[2]}this.projectionMatrix=(function({width:h,height:i,pitch:j,altitude:k,fovy:l,nearZMultiplier:m,farZMultiplier:n}){var a,f,g,c,b,d,e;const{fov:o,aspect:p,near:q,far:r}=function({width:f,height:g,fovy:a=Ua(1.5),altitude:d,pitch:h=0,nearZMultiplier:i=1,farZMultiplier:j=1}){void 0!==d&&(a=Ua(d));const b=.5*a*Pa,c=Va(a),e=h*Pa;return{fov:2*b,aspect:f/g,focalDistance:c,near:i,far:(Math.sin(e)*(Math.sin(b)*c/Math.sin(Math.min(Math.max(Math.PI/2-e-b,.01),Math.PI-.01)))+c)*j}}({width:h,height:i,altitude:k,fovy:l,pitch:j,nearZMultiplier:m,farZMultiplier:n}),s=(a=[],f=o,g=p,c=q,b=r,e=1/Math.tan(f/2),a[0]=e/g,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=e,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=-1,a[12]=0,a[13]=0,a[15]=0,null!=b&&b!==1/0?(d=1/(c-b),a[10]=(b+c)*d,a[14]=2*b*c*d):(a[10]=-1,a[14]=-2*c),a);return s})({width:f,height:c,pitch:n,fovy:b,nearZMultiplier:t,farZMultiplier:u}),this.viewMatrix=(function({height:F,pitch:G,bearing:H,altitude:I,scale:l,center:E=null}){var a,b,m,f,g,n,o,p,q,r,s,t,u,c,d,v,h,i,w,x,y,z,A,B,C,D,j,k;const e=Ba();return Ia(e,e,[0,0,-I]),a=e,b=e,m=-G*Pa,f=Math.sin(m),g=Math.cos(m),n=b[4],o=b[5],p=b[6],q=b[7],r=b[8],s=b[9],t=b[10],u=b[11],b!==a&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a[4]=n*g+r*f,a[5]=o*g+s*f,a[6]=p*g+t*f,a[7]=q*g+u*f,a[8]=r*g-n*f,a[9]=s*g-o*f,a[10]=t*g-p*f,a[11]=u*g-q*f,c=e,d=e,v=H*Pa,h=Math.sin(v),i=Math.cos(v),w=d[0],x=d[1],y=d[2],z=d[3],A=d[4],B=d[5],C=d[6],D=d[7],d!==c&&(c[8]=d[8],c[9]=d[9],c[10]=d[10],c[11]=d[11],c[12]=d[12],c[13]=d[13],c[14]=d[14],c[15]=d[15]),c[0]=w*i+A*h,c[1]=x*i+B*h,c[2]=y*i+C*h,c[3]=z*i+D*h,c[4]=A*i-w*h,c[5]=B*i-x*h,c[6]=C*i-y*h,c[7]=D*i-z*h,Ja(e,e,[l/=F,l,l]),E&&Ia(e,e,(j=[],k=E,j[0]=-k[0],j[1]=-k[1],j[2]=-k[2],j)),e})({height:c,scale:r,center:d,pitch:n,bearing:q,altitude:a}),this.width=f,this.height=c,this.scale=r,this.latitude=l,this.longitude=m,this.zoom=p,this.pitch=n,this.bearing=q,this.altitude=a,this.fovy=b,this.center=d,this.meterOffset=o||[0,0,0],this.distanceScales=s,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 b,c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,a;const{width:I,height:J,projectionMatrix:K,viewMatrix:L}=this,G=Ba();Ha(G,G,K),Ha(G,G,L),this.viewProjectionMatrix=G;const d=Ba();Ja(d,d,[I/2,-J/2,1]),Ia(d,d,[1,-1,0]),Ha(d,d,G);const H=(b=Ba(),e=(c=d)[0],f=c[1],g=c[2],h=c[3],i=c[4],j=c[5],k=c[6],l=c[7],m=c[8],n=c[9],o=c[10],p=c[11],q=c[12],r=c[13],s=c[14],t=c[15],u=e*j-f*i,v=e*k-g*i,w=e*l-h*i,x=f*k-g*j,y=f*l-h*j,z=g*l-h*k,A=m*r-n*q,B=m*s-o*q,C=m*t-p*q,D=n*s-o*r,E=n*t-p*r,F=o*t-p*s,a=u*F-v*E+w*D+x*C-y*B+z*A,a?(a=1/a,b[0]=(j*F-k*E+l*D)*a,b[1]=(g*E-f*F-h*D)*a,b[2]=(r*z-s*y+t*x)*a,b[3]=(o*y-n*z-p*x)*a,b[4]=(k*C-i*F-l*B)*a,b[5]=(e*F-g*C+h*B)*a,b[6]=(s*w-q*z-t*v)*a,b[7]=(m*z-o*w+p*v)*a,b[8]=(i*E-j*C+l*A)*a,b[9]=(f*C-e*E-h*A)*a,b[10]=(q*y-r*w+t*u)*a,b[11]=(n*w-m*y-p*u)*a,b[12]=(j*B-i*D-k*A)*a,b[13]=(e*D-f*B+g*A)*a,b[14]=(r*v-q*x-s*u)*a,b[15]=(m*x-n*v+o*u)*a,b):null);if(!H)throw new Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=d,this.pixelUnprojectionMatrix=H}equals(a){return a instanceof Za&&a.width===this.width&&a.height===this.height&&Ka(a.projectionMatrix,this.projectionMatrix)&&Ka(a.viewMatrix,this.viewMatrix)}project(a,{topLeft:f=!0}={}){const g=this.projectPosition(a),b=function(d,e){const[a,b,c=0]=d;return Na(Number.isFinite(a)&&Number.isFinite(b)&&Number.isFinite(c)),Ca(e,[a,b,c,1])}(g,this.pixelProjectionMatrix),[c,d]=b,e=f?d:this.height-d;return 2===a.length?[c,e]:[c,e,b[2]]}unproject(f,{topLeft:g=!0,targetZ:a}={}){const[h,d,e]=f,i=g?d:this.height-d,j=a&&a*this.distanceScales.unitsPerMeter[2],k=Wa([h,i,e],this.pixelUnprojectionMatrix,j),[b,c,l]=this.unprojectPosition(k);return Number.isFinite(e)?[b,c,l]:Number.isFinite(a)?[b,c,a]:[b,c]}projectPosition(a){const[b,c]=Sa(a),d=(a[2]||0)*this.distanceScales.unitsPerMeter[2];return[b,c,d]}unprojectPosition(a){const[b,c]=Ta(a),d=(a[2]||0)*this.distanceScales.metersPerUnit[2];return[b,c,d]}projectFlat(a){return Sa(a)}unprojectFlat(a){return Ta(a)}getMapCenterByLngLatPosition({lngLat:c,pos:d}){var a,b;const e=Wa(d,this.pixelUnprojectionMatrix),f=Sa(c),g=La([],f,(a=[],b=e,a[0]=-b[0],a[1]=-b[1],a)),h=La([],this.center,g);return Ta(h)}getLocationAtPoint({lngLat:a,pos:b}){return this.getMapCenterByLngLatPosition({lngLat:a,pos:b})}fitBounds(c,d={}){const{width:a,height:b}=this,{longitude:e,latitude:f,zoom:g}=function({width:m,height:n,bounds:o,minExtent:f=0,maxZoom:p=24,padding:a=0,offset:g=[0,0]}){const[[q,r],[s,t]]=o;if(Number.isFinite(a)){const b=a;a={top:b,bottom:b,left:b,right:b}}else Na(Number.isFinite(a.top)&&Number.isFinite(a.bottom)&&Number.isFinite(a.left)&&Number.isFinite(a.right));const c=Sa([q,Fa(t,-85.051129,85.051129)]),d=Sa([s,Fa(r,-85.051129,85.051129)]),h=[Math.max(Math.abs(d[0]-c[0]),f),Math.max(Math.abs(d[1]-c[1]),f)],e=[m-a.left-a.right-2*Math.abs(g[0]),n-a.top-a.bottom-2*Math.abs(g[1])];Na(e[0]>0&&e[1]>0);const i=e[0]/h[0],j=e[1]/h[1],u=(a.right-a.left)/2/i,v=(a.bottom-a.top)/2/j,w=[(d[0]+c[0])/2+u,(d[1]+c[1])/2+v],k=Ta(w),l=Math.min(p,Ga(Math.abs(Math.min(i,j))));return Na(Number.isFinite(l)),{longitude:k[0],latitude:k[1],zoom:l}}(Object.assign({width:a,height:b,bounds:c},d));return new Za({width:a,height:b,longitude:e,latitude:f,zoom:g})}getBounds(b){const a=this.getBoundingRegion(b),c=Math.min(...a.map(a=>a[0])),d=Math.max(...a.map(a=>a[0])),e=Math.min(...a.map(a=>a[1])),f=Math.max(...a.map(a=>a[1]));return[[c,e],[d,f]]}getBoundingRegion(a={}){return(function(a,d=0){const{width:e,height:h,unproject:b}=a,c={targetZ:d},i=b([0,h],c),j=b([e,h],c);let f,g;const k=a.fovy?.5*a.fovy*Xa:Math.atan(.5/a.altitude),l=(90-a.pitch)*Xa;return k>l-.01?(f=Ya(a,0,d),g=Ya(a,e,d)):(f=b([0,0],c),g=b([e,0],c)),[i,j,g,f]})(this,a.z||0)}}const $a=["longitude","latitude","zoom"],_a={curve:1.414,speed:1.2};function ab(d,h,i){var f,j,k,o,p,q;i=Object.assign({},_a,i);const g=i.curve,l=d.zoom,w=[d.longitude,d.latitude],x=Ra(l),y=h.zoom,z=[h.longitude,h.latitude],A=Ra(y-l),r=Sa(w),B=Sa(z),s=(f=[],j=B,k=r,f[0]=j[0]-k[0],f[1]=j[1]-k[1],f),a=Math.max(d.width,d.height),e=a/A,t=(p=(o=s)[0],q=o[1],Math.hypot(p,q)*x),c=Math.max(t,.01),b=g*g,m=(e*e-a*a+b*b*c*c)/(2*a*b*c),n=(e*e-a*a-b*b*c*c)/(2*e*b*c),u=Math.log(Math.sqrt(m*m+1)-m),v=Math.log(Math.sqrt(n*n+1)-n);return{startZoom:l,startCenterXY:r,uDelta:s,w0:a,u1:t,S:(v-u)/g,rho:g,rho2:b,r0:u,r1:v}}var N=function(){if("undefined"!=typeof Map)return Map;function a(a,c){var b=-1;return a.some(function(a,d){return a[0]===c&&(b=d,!0)}),b}return(function(){function b(){this.__entries__=[]}return Object.defineProperty(b.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),b.prototype.get=function(c){var d=a(this.__entries__,c),b=this.__entries__[d];return b&&b[1]},b.prototype.set=function(b,c){var d=a(this.__entries__,b);~d?this.__entries__[d][1]=c:this.__entries__.push([b,c])},b.prototype.delete=function(d){var b=this.__entries__,c=a(b,d);~c&&b.splice(c,1)},b.prototype.has=function(b){return!!~a(this.__entries__,b)},b.prototype.clear=function(){this.__entries__.splice(0)},b.prototype.forEach=function(e,a){void 0===a&&(a=null);for(var b=0,c=this.__entries__;b0},a.prototype.connect_=function(){!bb||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),eb?(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)},a.prototype.disconnect_=function(){bb&&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)},a.prototype.onTransitionEnd_=function(b){var a=b.propertyName,c=void 0===a?"":a;db.some(function(a){return!!~c.indexOf(a)})&&this.refresh()},a.getInstance=function(){return this.instance_||(this.instance_=new a()),this.instance_},a.instance_=null,a}(),gb=function(b,c){for(var a=0,d=Object.keys(c);a0},a}(),tb="undefined"!=typeof WeakMap?new WeakMap():new N(),O=function(){function a(b){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var c=fb.getInstance(),d=new sb(b,c,this);tb.set(this,d)}return a}();["observe","unobserve","disconnect"].forEach(function(a){O.prototype[a]=function(){var b;return(b=tb.get(this))[a].apply(b,arguments)}});var ub=void 0!==o.ResizeObserver?o.ResizeObserver:O;function vb(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function wb(d,c){for(var b=0;b=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function(a){throw a},f:b}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}function Bb(a,c){if(a){if("string"==typeof a)return Cb(a,c);var b=Object.prototype.toString.call(a).slice(8,-1);if("Object"===b&&a.constructor&&(b=a.constructor.name),"Map"===b||"Set"===b)return Array.from(a);if("Arguments"===b||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b))return Cb(a,c)}}function Cb(c,a){(null==a||a>c.length)&&(a=c.length);for(var b=0,d=new Array(a);b1&& void 0!==arguments[1]?arguments[1]:"component";b.debug&&a.checkPropTypes(Q,b,"prop",c)}var i=function(){function a(b){var c=this;if(vb(this,a),g(this,"props",R),g(this,"width",0),g(this,"height",0),g(this,"_fireLoadEvent",function(){c.props.onLoad({type:"load",target:c._map})}),g(this,"_handleError",function(a){c.props.onError(a)}),!b.mapboxgl)throw new Error("Mapbox not available");this.mapboxgl=b.mapboxgl,a.initialized||(a.initialized=!0,this._checkStyleSheet(this.mapboxgl.version)),this._initialize(b)}return xb(a,[{key:"finalize",value:function(){return this._destroy(),this}},{key:"setProps",value:function(a){return this._update(this.props,a),this}},{key:"redraw",value:function(){var a=this._map;a.style&&(a._frame&&(a._frame.cancel(),a._frame=null),a._render())}},{key:"getMap",value:function(){return this._map}},{key:"_reuse",value:function(b){this._map=a.savedMap;var d=this._map.getContainer(),c=b.container;for(c.classList.add("mapboxgl-map");d.childNodes.length>0;)c.appendChild(d.childNodes[0]);this._map._container=c,a.savedMap=null,b.mapStyle&&this._map.setStyle(Eb(b.mapStyle),{diff:!1}),this._map.isStyleLoaded()?this._fireLoadEvent():this._map.once("styledata",this._fireLoadEvent)}},{key:"_create",value:function(b){if(b.reuseMaps&&a.savedMap)this._reuse(b);else{if(b.gl){var d=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(){return HTMLCanvasElement.prototype.getContext=d,b.gl}}var c={container:b.container,center:[0,0],zoom:8,pitch:0,bearing:0,maxZoom:24,style:Eb(b.mapStyle),interactive:!1,trackResize:!1,attributionControl:b.attributionControl,preserveDrawingBuffer:b.preserveDrawingBuffer};b.transformRequest&&(c.transformRequest=b.transformRequest),this._map=new this.mapboxgl.Map(Object.assign({},c,b.mapOptions)),this._map.once("load",this._fireLoadEvent),this._map.on("error",this._handleError)}return this}},{key:"_destroy",value:function(){this._map&&(this.props.reuseMaps&&!a.savedMap?(a.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(a){var d=this;Gb(a=Object.assign({},R,a),"Mapbox"),this.mapboxgl.accessToken=a.mapboxApiAccessToken||R.mapboxApiAccessToken,this.mapboxgl.baseApiUrl=a.mapboxApiUrl,this._create(a);var b=a.container;Object.defineProperty(b,"offsetWidth",{configurable:!0,get:function(){return d.width}}),Object.defineProperty(b,"clientWidth",{configurable:!0,get:function(){return d.width}}),Object.defineProperty(b,"offsetHeight",{configurable:!0,get:function(){return d.height}}),Object.defineProperty(b,"clientHeight",{configurable:!0,get:function(){return d.height}});var c=this._map.getCanvas();c&&(c.style.outline="none"),this._updateMapViewport({},a),this._updateMapSize({},a),this.props=a}},{key:"_update",value:function(b,a){if(this._map){Gb(a=Object.assign({},this.props,a),"Mapbox");var c=this._updateMapViewport(b,a),d=this._updateMapSize(b,a);this._updateMapStyle(b,a),!a.asyncRender&&(c||d)&&this.redraw(),this.props=a}}},{key:"_updateMapStyle",value:function(b,a){b.mapStyle!==a.mapStyle&&this._map.setStyle(Eb(a.mapStyle),{diff:!a.preventStyleDiffing})}},{key:"_updateMapSize",value:function(b,a){var c=b.width!==a.width||b.height!==a.height;return c&&(this.width=a.width,this.height=a.height,this._map.resize()),c}},{key:"_updateMapViewport",value:function(d,e){var b=this._getViewState(d),a=this._getViewState(e),c=a.latitude!==b.latitude||a.longitude!==b.longitude||a.zoom!==b.zoom||a.pitch!==b.pitch||a.bearing!==b.bearing||a.altitude!==b.altitude;return c&&(this._map.jumpTo(this._viewStateToMapboxProps(a)),a.altitude!==b.altitude&&(this._map.transform.altitude=a.altitude)),c}},{key:"_getViewState",value:function(b){var a=b.viewState||b,f=a.longitude,g=a.latitude,h=a.zoom,c=a.pitch,d=a.bearing,e=a.altitude;return{longitude:f,latitude:g,zoom:h,pitch:void 0===c?0:c,bearing:void 0===d?0:d,altitude:void 0===e?1.5:e}}},{key:"_checkStyleSheet",value:function(){var c=arguments.length>0&& void 0!==arguments[0]?arguments[0]:"0.47.0";if(void 0!==P)try{var a=P.createElement("div");if(a.className="mapboxgl-map",a.style.display="none",P.body.appendChild(a),!("static"!==window.getComputedStyle(a).position)){var b=P.createElement("link");b.setAttribute("rel","stylesheet"),b.setAttribute("type","text/css"),b.setAttribute("href","https://api.tiles.mapbox.com/mapbox-gl-js/v".concat(c,"/mapbox-gl.css")),P.head.appendChild(b)}}catch(d){}}},{key:"_viewStateToMapboxProps",value:function(a){return{center:[a.longitude,a.latitude],zoom:a.zoom,bearing:a.bearing,pitch:a.pitch}}}]),a}();g(i,"initialized",!1),g(i,"propTypes",Q),g(i,"defaultProps",R),g(i,"savedMap",null);var S=b(6158),A=b.n(S);function Hb(a){return Array.isArray(a)||ArrayBuffer.isView(a)}function Ib(a,b){if(a===b)return!0;if(Hb(a)&&Hb(b)){if(a.length!==b.length)return!1;for(var c=0;c=Math.abs(a-b)}function Jb(a,b,c){return Math.max(b,Math.min(c,a))}function Kb(a,c,b){return Hb(a)?a.map(function(a,d){return Kb(a,c[d],b)}):b*c+(1-b)*a}function Lb(a,b){if(!a)throw new Error(b||"react-map-gl: assertion failed.")}function Mb(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}function Nb(c){for(var a=1;a0,"`scale` must be a positive number");var f=this._state,b=f.startZoom,c=f.startZoomLngLat;Number.isFinite(b)||(b=this._viewportProps.zoom,c=this._unproject(i)||this._unproject(d)),Lb(c,"`startZoomLngLat` prop is required for zoom behavior to calculate where to position the map.");var g=this._calculateNewZoom({scale:e,startZoom:b||0}),j=new Za(Object.assign({},this._viewportProps,{zoom:g})),k=j.getMapCenterByLngLatPosition({lngLat:c,pos:d}),h=Aa(k,2),l=h[0],m=h[1];return this._getUpdatedMapState({zoom:g,longitude:l,latitude:m})}},{key:"zoomEnd",value:function(){return this._getUpdatedMapState({startZoomLngLat:null,startZoom:null})}},{key:"_getUpdatedMapState",value:function(b){return new a(Object.assign({},this._viewportProps,this._state,b))}},{key:"_applyConstraints",value:function(a){var b=a.maxZoom,c=a.minZoom,d=a.zoom;a.zoom=Jb(d,c,b);var e=a.maxPitch,f=a.minPitch,g=a.pitch;return a.pitch=Jb(g,f,e),Object.assign(a,function({width:j,height:e,longitude:b,latitude:a,zoom:d,pitch:k=0,bearing:c=0}){(b< -180||b>180)&&(b=Da(b+180,360)-180),(c< -180||c>180)&&(c=Da(c+180,360)-180);const f=Ga(e/512);if(d<=f)d=f,a=0;else{const g=e/2/Math.pow(2,d),h=Ta([0,g])[1];if(ai&&(a=i)}}return{width:j,height:e,longitude:b,latitude:a,zoom:d,pitch:k,bearing:c}}(a)),a}},{key:"_unproject",value:function(a){var b=new Za(this._viewportProps);return a&&b.unproject(a)}},{key:"_calculateNewLngLat",value:function(a){var b=a.startPanLngLat,c=a.pos,d=new Za(this._viewportProps);return d.getMapCenterByLngLatPosition({lngLat:b,pos:c})}},{key:"_calculateNewZoom",value:function(a){var c=a.scale,d=a.startZoom,b=this._viewportProps,e=b.maxZoom,f=b.minZoom;return Jb(d+Math.log2(c),f,e)}},{key:"_calculateNewPitchAndBearing",value:function(c){var f=c.deltaScaleX,a=c.deltaScaleY,g=c.startBearing,b=c.startPitch;a=Jb(a,-1,1);var e=this._viewportProps,h=e.minPitch,i=e.maxPitch,d=b;return a>0?d=b+a*(i-b):a<0&&(d=b-a*(h-b)),{pitch:d,bearing:g+180*f}}},{key:"_getRotationParams",value:function(c,d){var h=c[0]-d[0],e=c[1]-d[1],i=c[1],a=d[1],f=this._viewportProps,j=f.width,g=f.height,b=0;return e>0?Math.abs(g-a)>5&&(b=e/(a-g)*1.2):e<0&&a>5&&(b=1-i/a),{deltaScaleX:h/j,deltaScaleY:b=Math.min(1,Math.max(-1,b))}}}]),a}();function Qb(a){return a[0].toLowerCase()+a.slice(1)}function Rb(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}function Sb(c){for(var a=1;a1&& void 0!==arguments[1]?arguments[1]:{},b=a.current&&a.current.getMap();return b&&b.queryRenderedFeatures(c,d)}}},[]);var p=(0,c.useCallback)(function(b){var a=b.target;a===o.current&&a.scrollTo(0,0)},[]),q=d&&c.createElement(Tb,{value:Yb(Yb({},b),{},{viewport:b.viewport||$b(Yb({map:d,props:a},m)),map:d,container:b.container||h.current})},c.createElement("div",{key:"map-overlays",className:"overlays",ref:o,style:_b,onScroll:p},a.children)),r=a.className,s=a.width,t=a.height,u=a.style,v=a.visibilityConstraints,w=Object.assign({position:"relative"},u,{width:s,height:t}),x=a.visible&&function(c){var b=arguments.length>1&& void 0!==arguments[1]?arguments[1]:B;for(var a in b){var d=a.slice(0,3),e=Qb(a.slice(3));if("min"===d&&c[e]b[a])return!1}return!0}(a.viewState||a,v),y=Object.assign({},_b,{visibility:x?"inherit":"hidden"});return c.createElement("div",{key:"map-container",ref:h,style:w},c.createElement("div",{key:"map-mapbox",ref:n,style:y,className:r}),q,!l&&!a.disableTokenWarning&&c.createElement(ac,null))});j.supported=function(){return A()&&A().supported()},j.propTypes=T,j.defaultProps=U;var q=j;function bc(c,a){(null==a||a>c.length)&&(a=c.length);for(var b=0,d=new Array(a);b=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function(a){throw a},f:b}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}(this.propNames||[]);try{for(a.s();!(b=a.n()).done;){var c=b.value;if(!Ib(d[c],e[c]))return!1}}catch(f){a.e(f)}finally{a.f()}return!0}},{key:"initializeProps",value:function(a,b){return{start:a,end:b}}},{key:"interpolateProps",value:function(a,b,c){Lb(!1,"interpolateProps is not implemented")}},{key:"getDuration",value:function(b,a){return a.transitionDuration}}]),a}();function cc(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function dc(a,b){return(dc=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a})(a,b)}function ec(b,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,writable:!0,configurable:!0}}),Object.defineProperty(b,"prototype",{writable:!1}),a&&dc(b,a)}function fc(a){return(fc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function gc(b,a){if(a&&("object"===fc(a)||"function"==typeof a))return a;if(void 0!==a)throw new TypeError("Derived constructors may only return object or undefined");return cc(b)}function hc(a){return(hc=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)})(a)}var ic={longitude:1,bearing:1};function jc(a){return Number.isFinite(a)||Array.isArray(a)}function kc(b,c,a){return b in ic&&Math.abs(a-c)>180&&(a=a<0?a+360:a-360),a}function lc(a,c){if("undefined"==typeof Symbol||null==a[Symbol.iterator]){if(Array.isArray(a)||(e=mc(a))||c&&a&&"number"==typeof a.length){e&&(a=e);var d=0,b=function(){};return{s:b,n:function(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function(a){throw a},f:b}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}function mc(a,c){if(a){if("string"==typeof a)return nc(a,c);var b=Object.prototype.toString.call(a).slice(8,-1);if("Object"===b&&a.constructor&&(b=a.constructor.name),"Map"===b||"Set"===b)return Array.from(a);if("Arguments"===b||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b))return nc(a,c)}}function nc(c,a){(null==a||a>c.length)&&(a=c.length);for(var b=0,d=new Array(a);b=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function(a){throw a},f:b}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}function tc(a,c){if(a){if("string"==typeof a)return uc(a,c);var b=Object.prototype.toString.call(a).slice(8,-1);if("Object"===b&&a.constructor&&(b=a.constructor.name),"Map"===b||"Set"===b)return Array.from(a);if("Arguments"===b||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b))return uc(a,c)}}function uc(c,a){(null==a||a>c.length)&&(a=c.length);for(var b=0,d=new Array(a);b0&& void 0!==arguments[0]?arguments[0]:{};return vb(this,d),g(cc(a=e.call(this)),"propNames",oc),a.props=Object.assign({},rc,b),a}xb(d,[{key:"initializeProps",value:function(h,i){var j,e={},f={},c=lc(pc);try{for(c.s();!(j=c.n()).done;){var a=j.value,g=h[a],k=i[a];Lb(jc(g)&&jc(k),"".concat(a," must be supplied for transition")),e[a]=g,f[a]=kc(a,g,k)}}catch(n){c.e(n)}finally{c.f()}var l,d=lc(qc);try{for(d.s();!(l=d.n()).done;){var b=l.value,m=h[b]||0,o=i[b]||0;e[b]=m,f[b]=kc(b,m,o)}}catch(p){d.e(p)}finally{d.f()}return{start:e,end:f}}},{key:"interpolateProps",value:function(c,d,e){var f,g=function(h,i,j,o={}){var c,d,e;const a={},{startZoom:p,startCenterXY:q,uDelta:r,w0:s,u1:k,S:t,rho:l,rho2:u,r0:b}=ab(h,i,o);if(k<.01){for(const f of $a){const v=h[f],w=i[f];a[f]=Ea(v,w,j)}return a}const m=j*t,x=p+Ga(1/(Math.cosh(b)/Math.cosh(b+l*m))),g=(c=[],d=r,e=s*((Math.cosh(b)*Math.tanh(b+l*m)-Math.sinh(b))/u)/k,c[0]=d[0]*e,c[1]=d[1]*e,c);La(g,g,q);const n=Ta(g);return a.longitude=n[0],a.latitude=n[1],a.zoom=x,a}(c,d,e,this.props),a=lc(qc);try{for(a.s();!(f=a.n()).done;){var b=f.value;g[b]=Kb(c[b],d[b],e)}}catch(h){a.e(h)}finally{a.f()}return g}},{key:"getDuration",value:function(c,b){var a=b.transitionDuration;return"auto"===a&&(a=(function(f,g,a={}){a=Object.assign({},_a,a);const{screenSpeed:c,speed:h,maxDuration:d}=a,{S:i,rho:j}=ab(f,g,a),e=1e3*i;let b;return b=Number.isFinite(c)?e/(c/j):e/h,Number.isFinite(d)&&b>d?0:b})(c,b,this.props)),a}}])}(C);var vc=["longitude","latitude","zoom","bearing","pitch"],D=function(b){ec(a,b);var c,d,e=(c=a,d=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}(),function(){var a,b=hc(c);if(d){var e=hc(this).constructor;a=Reflect.construct(b,arguments,e)}else a=b.apply(this,arguments);return gc(this,a)});function a(){var c,b=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{};return vb(this,a),c=e.call(this),Array.isArray(b)&&(b={transitionProps:b}),c.propNames=b.transitionProps||vc,b.around&&(c.around=b.around),c}return xb(a,[{key:"initializeProps",value:function(g,c){var d={},e={};if(this.around){d.around=this.around;var h=new Za(g).unproject(this.around);Object.assign(e,c,{around:new Za(c).project(h),aroundLngLat:h})}var i,b=sc(this.propNames);try{for(b.s();!(i=b.n()).done;){var a=i.value,f=g[a],j=c[a];Lb(jc(f)&&jc(j),"".concat(a," must be supplied for transition")),d[a]=f,e[a]=kc(a,f,j)}}catch(k){b.e(k)}finally{b.f()}return{start:d,end:e}}},{key:"interpolateProps",value:function(e,a,f){var g,b={},c=sc(this.propNames);try{for(c.s();!(g=c.n()).done;){var d=g.value;b[d]=Kb(e[d],a[d],f)}}catch(i){c.e(i)}finally{c.f()}if(a.around){var h=Aa(new Za(Object.assign({},a,b)).getMapCenterByLngLatPosition({lngLat:a.aroundLngLat,pos:Kb(e.around,a.around,f)}),2),j=h[0],k=h[1];b.longitude=j,b.latitude=k}return b}}]),a}(C),r=function(){},E={BREAK:1,SNAP_TO_END:2,IGNORE:3,UPDATE:4},V={transitionDuration:0,transitionEasing:function(a){return a},transitionInterpolator:new D(),transitionInterruption:E.BREAK,onTransitionStart:r,onTransitionInterrupt:r,onTransitionEnd:r},F=function(){function a(){var c=this,b=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{};vb(this,a),g(this,"_animationFrame",null),g(this,"_onTransitionFrame",function(){c._animationFrame=requestAnimationFrame(c._onTransitionFrame),c._updateViewport()}),this.props=null,this.onViewportChange=b.onViewportChange||r,this.onStateChange=b.onStateChange||r,this.time=b.getTime||Date.now}return xb(a,[{key:"getViewportInTransition",value:function(){return this._animationFrame?this.state.propsInTransition:null}},{key:"processViewportChange",value:function(c){var a=this.props;if(this.props=c,!a||this._shouldIgnoreViewportChange(a,c))return!1;if(this._isTransitionEnabled(c)){var d=Object.assign({},a),b=Object.assign({},c);if(this._isTransitionInProgress()&&(a.onTransitionInterrupt(),this.state.interruption===E.SNAP_TO_END?Object.assign(d,this.state.endProps):Object.assign(d,this.state.propsInTransition),this.state.interruption===E.UPDATE)){var f,g,h,e=this.time(),i=(e-this.state.startTime)/this.state.duration;b.transitionDuration=this.state.duration-(e-this.state.startTime),h=(f=this.state.easing)(g=i),b.transitionEasing=function(a){return 1/(1-h)*(f(a*(1-g)+g)-h)},b.transitionInterpolator=d.transitionInterpolator}return b.onTransitionStart(),this._triggerTransition(d,b),!0}return this._isTransitionInProgress()&&(a.onTransitionInterrupt(),this._endTransition()),!1}},{key:"_isTransitionInProgress",value:function(){return Boolean(this._animationFrame)}},{key:"_isTransitionEnabled",value:function(a){var b=a.transitionDuration,c=a.transitionInterpolator;return(b>0||"auto"===b)&&Boolean(c)}},{key:"_isUpdateDueToCurrentTransition",value:function(a){return!!this.state.propsInTransition&&this.state.interpolator.arePropsEqual(a,this.state.propsInTransition)}},{key:"_shouldIgnoreViewportChange",value:function(b,a){return!b||(this._isTransitionInProgress()?this.state.interruption===E.IGNORE||this._isUpdateDueToCurrentTransition(a):!this._isTransitionEnabled(a)||a.transitionInterpolator.arePropsEqual(b,a))}},{key:"_triggerTransition",value:function(b,a){Lb(this._isTransitionEnabled(a)),this._animationFrame&&cancelAnimationFrame(this._animationFrame);var c=a.transitionInterpolator,d=c.getDuration?c.getDuration(b,a):a.transitionDuration;if(0!==d){var e=a.transitionInterpolator.initializeProps(b,a),f={inTransition:!0,isZooming:b.zoom!==a.zoom,isPanning:b.longitude!==a.longitude||b.latitude!==a.latitude,isRotating:b.bearing!==a.bearing||b.pitch!==a.pitch};this.state={duration:d,easing:a.transitionEasing,interpolator:a.transitionInterpolator,interruption:a.transitionInterruption,startTime:this.time(),startProps:e.start,endProps:e.end,animation:null,propsInTransition:{}},this._onTransitionFrame(),this.onStateChange(f)}}},{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 d=this.time(),a=this.state,e=a.startTime,f=a.duration,g=a.easing,h=a.interpolator,i=a.startProps,j=a.endProps,c=!1,b=(d-e)/f;b>=1&&(b=1,c=!0),b=g(b);var k=h.interpolateProps(i,j,b),l=new Pb(Object.assign({},this.props,k));this.state.propsInTransition=l.getViewportProps(),this.onViewportChange(this.state.propsInTransition,this.props),c&&(this._endTransition(),this.props.onTransitionEnd())}}]),a}();g(F,"defaultProps",V);var W=b(840),k=b.n(W);const wc={mousedown:1,mousemove:2,mouseup:4};!function(a){const b=a.prototype.handler;a.prototype.handler=function(a){const c=this.store;a.button>0&&"pointerdown"===a.type&& !function(b,c){for(let a=0;ab.pointerId===a.pointerId)&&c.push(a),b.call(this,a)}}(k().PointerEventInput),k().MouseInput.prototype.handler=function(a){let b=wc[a.type];1&b&&a.button>=0&&(this.pressed=!0),2&b&&0===a.which&&(b=4),this.pressed&&(4&b&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:"mouse",srcEvent:a}))};const xc=k().Manager;var e=k();const yc=e?[[e.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1}],[e.Rotate,{enable:!1}],[e.Pinch,{enable:!1}],[e.Swipe,{enable:!1}],[e.Pan,{threshold:0,enable:!1}],[e.Press,{enable:!1}],[e.Tap,{event:"doubletap",taps:2,enable:!1}],[e.Tap,{event:"anytap",enable:!1}],[e.Tap,{enable:!1}]]:null,zc={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},Ac={doubletap:["tap"]},Bc={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},s={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],WHEEL_EVENTS:["wheel","mousewheel"]},Cc={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"},Dc={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},X="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",G="undefined"!=typeof window?window:b.g;void 0!==b.g&&b.g;let Y=!1;try{const l={get passive(){return Y=!0,!0}};G.addEventListener("test",l,l),G.removeEventListener("test",l,l)}catch(Ec){}const Fc=-1!==X.indexOf("firefox"),{WHEEL_EVENTS:Gc}=s,Hc="wheel";class Ic{constructor(b,c,a={}){this.element=b,this.callback=c,this.options=Object.assign({enable:!0},a),this.events=Gc.concat(a.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(a=>b.addEventListener(a,this.handleEvent,!!Y&&{passive:!1}))}destroy(){this.events.forEach(a=>this.element.removeEventListener(a,this.handleEvent))}enableEventType(a,b){a===Hc&&(this.options.enable=b)}handleEvent(b){if(!this.options.enable)return;let a=b.deltaY;G.WheelEvent&&(Fc&&b.deltaMode===G.WheelEvent.DOM_DELTA_PIXEL&&(a/=G.devicePixelRatio),b.deltaMode===G.WheelEvent.DOM_DELTA_LINE&&(a*=40));const c={x:b.clientX,y:b.clientY};0!==a&&a%4.000244140625==0&&(a=Math.floor(a/4.000244140625)),b.shiftKey&&a&&(a*=.25),this._onWheel(b,-a,c)}_onWheel(a,b,c){this.callback({type:Hc,center:c,delta:b,srcEvent:a,pointerType:"mouse",target:a.target})}}const{MOUSE_EVENTS:Jc}=s,Kc="pointermove",Lc="pointerover",Mc="pointerout",Nc="pointerleave";class Oc{constructor(b,c,a={}){this.element=b,this.callback=c,this.pressed=!1,this.options=Object.assign({enable:!0},a),this.enableMoveEvent=this.options.enable,this.enableLeaveEvent=this.options.enable,this.enableOutEvent=this.options.enable,this.enableOverEvent=this.options.enable,this.events=Jc.concat(a.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(a=>b.addEventListener(a,this.handleEvent))}destroy(){this.events.forEach(a=>this.element.removeEventListener(a,this.handleEvent))}enableEventType(a,b){a===Kc&&(this.enableMoveEvent=b),a===Lc&&(this.enableOverEvent=b),a===Mc&&(this.enableOutEvent=b),a===Nc&&(this.enableLeaveEvent=b)}handleEvent(a){this.handleOverEvent(a),this.handleOutEvent(a),this.handleLeaveEvent(a),this.handleMoveEvent(a)}handleOverEvent(a){this.enableOverEvent&&"mouseover"===a.type&&this.callback({type:Lc,srcEvent:a,pointerType:"mouse",target:a.target})}handleOutEvent(a){this.enableOutEvent&&"mouseout"===a.type&&this.callback({type:Mc,srcEvent:a,pointerType:"mouse",target:a.target})}handleLeaveEvent(a){this.enableLeaveEvent&&"mouseleave"===a.type&&this.callback({type:Nc,srcEvent:a,pointerType:"mouse",target:a.target})}handleMoveEvent(a){if(this.enableMoveEvent)switch(a.type){case"mousedown":a.button>=0&&(this.pressed=!0);break;case"mousemove":0===a.which&&(this.pressed=!1),this.pressed||this.callback({type:Kc,srcEvent:a,pointerType:"mouse",target:a.target});break;case"mouseup":this.pressed=!1;break;default:}}}const{KEY_EVENTS:Pc}=s,Qc="keydown",Rc="keyup";class Sc{constructor(a,c,b={}){this.element=a,this.callback=c,this.options=Object.assign({enable:!0},b),this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=Pc.concat(b.events||[]),this.handleEvent=this.handleEvent.bind(this),a.tabIndex=b.tabIndex||0,a.style.outline="none",this.events.forEach(b=>a.addEventListener(b,this.handleEvent))}destroy(){this.events.forEach(a=>this.element.removeEventListener(a,this.handleEvent))}enableEventType(a,b){a===Qc&&(this.enableDownEvent=b),a===Rc&&(this.enableUpEvent=b)}handleEvent(a){const b=a.target||a.srcElement;("INPUT"!==b.tagName||"text"!==b.type)&&"TEXTAREA"!==b.tagName&&(this.enableDownEvent&&"keydown"===a.type&&this.callback({type:Qc,srcEvent:a,key:a.key,target:a.target}),this.enableUpEvent&&"keyup"===a.type&&this.callback({type:Rc,srcEvent:a,key:a.key,target:a.target}))}}const Tc="contextmenu";class Uc{constructor(a,b,c={}){this.element=a,this.callback=b,this.options=Object.assign({enable:!0},c),this.handleEvent=this.handleEvent.bind(this),a.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(a,b){a===Tc&&(this.options.enable=b)}handleEvent(a){this.options.enable&&this.callback({type:Tc,center:{x:a.clientX,y:a.clientY},srcEvent:a,pointerType:"mouse",target:a.target})}}const Vc={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},Wc={srcElement:"root",priority:0};class Xc{constructor(a){this.eventManager=a,this.handlers=[],this.handlersByElement=new Map(),this.handleEvent=this.handleEvent.bind(this),this._active=!1}isEmpty(){return!this._active}add(f,g,a,h=!1,i=!1){const{handlers:j,handlersByElement:e}=this;a&&("object"!=typeof a||a.addEventListener)&&(a={srcElement:a}),a=a?Object.assign({},Wc,a):Wc;let b=e.get(a.srcElement);b||(b=[],e.set(a.srcElement,b));const c={type:f,handler:g,srcElement:a.srcElement,priority:a.priority};h&&(c.once=!0),i&&(c.passive=!0),j.push(c),this._active=this._active||!c.passive;let d=b.length-1;for(;d>=0;){if(b[d].priority>=c.priority)break;d--}b.splice(d+1,0,c)}remove(f,g){const{handlers:b,handlersByElement:e}=this;for(let c=b.length-1;c>=0;c--){const a=b[c];if(a.type===f&&a.handler===g){b.splice(c,1);const d=e.get(a.srcElement);d.splice(d.indexOf(a),1),0===d.length&&e.delete(a.srcElement)}}this._active=b.some(a=>!a.passive)}handleEvent(c){if(this.isEmpty())return;const b=this._normalizeEvent(c);let a=c.srcEvent.target;for(;a&&a!==b.rootElement;){if(this._emit(b,a),b.handled)return;a=a.parentNode}this._emit(b,"root")}_emit(e,f){const a=this.handlersByElement.get(f);if(a){let g=!1;const h=()=>{e.handled=!0},i=()=>{e.handled=!0,g=!0},c=[];for(let b=0;b{const b=this.manager.get(a);b&&zc[a].forEach(a=>{b.recognizeWith(a)})}),b.recognizerOptions){const e=this.manager.get(d);if(e){const f=b.recognizerOptions[d];delete f.enable,e.set(f)}}for(const[h,c]of(this.wheelInput=new Ic(a,this._onOtherEvent,{enable:!1}),this.moveInput=new Oc(a,this._onOtherEvent,{enable:!1}),this.keyInput=new Sc(a,this._onOtherEvent,{enable:!1,tabIndex:b.tabIndex}),this.contextmenuInput=new Uc(a,this._onOtherEvent,{enable:!1}),this.events))c.isEmpty()||(this._toggleRecognizer(c.recognizerName,!0),this.manager.on(h,c.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(a,b,c){this._addEventHandler(a,b,c,!1)}once(a,b,c){this._addEventHandler(a,b,c,!0)}watch(a,b,c){this._addEventHandler(a,b,c,!1,!0)}off(a,b){this._removeEventHandler(a,b)}_toggleRecognizer(a,b){const{manager:d}=this;if(!d)return;const c=d.get(a);if(c&&c.options.enable!==b){c.set({enable:b});const e=Ac[a];e&&!this.options.recognizers&&e.forEach(e=>{const f=d.get(e);b?(f.requireFailure(a),c.dropRequireFailure(e)):f.dropRequireFailure(a)})}this.wheelInput.enableEventType(a,b),this.moveInput.enableEventType(a,b),this.keyInput.enableEventType(a,b),this.contextmenuInput.enableEventType(a,b)}_addEventHandler(b,e,d,f,g){if("string"!=typeof b){for(const h in d=e,b)this._addEventHandler(h,b[h],d,f,g);return}const{manager:i,events:j}=this,c=Dc[b]||b;let a=j.get(c);!a&&(a=new Xc(this),j.set(c,a),a.recognizerName=Cc[c]||c,i&&i.on(c,a.handleEvent)),a.add(b,e,d,f,g),a.isEmpty()||this._toggleRecognizer(a.recognizerName,!0)}_removeEventHandler(a,h){if("string"!=typeof a){for(const c in a)this._removeEventHandler(c,a[c]);return}const{events:d}=this,i=Dc[a]||a,b=d.get(i);if(b&&(b.remove(a,h),b.isEmpty())){const{recognizerName:e}=b;let f=!1;for(const g of d.values())if(g.recognizerName===e&&!g.isEmpty()){f=!0;break}f||this._toggleRecognizer(e,!1)}}_onBasicInput(a){const{srcEvent:c}=a,b=Bc[c.type];b&&this.manager.emit(b,a)}_onOtherEvent(a){this.manager.emit(a.type,a)}}function Zc(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}function $c(c){for(var a=1;a0),e=d&&!this.state.isHovering,h=!d&&this.state.isHovering;(c||e)&&(a.features=b,c&&c(a)),e&&hd.call(this,"onMouseEnter",a),h&&hd.call(this,"onMouseLeave",a),(e||h)&&this.setState({isHovering:d})}}function ld(b){var c=this.props,d=c.onClick,f=c.onNativeClick,g=c.onDblClick,h=c.doubleClickZoom,a=[],e=g||h;switch(b.type){case"anyclick":a.push(f),e||a.push(d);break;case"click":e&&a.push(d);break;default:}(a=a.filter(Boolean)).length&&((b=fd.call(this,b)).features=gd.call(this,b.point),a.forEach(function(a){return a(b)}))}var m=(0,c.forwardRef)(function(b,h){var i,t,f=(0,c.useContext)(Ub),u=(0,c.useMemo)(function(){return b.controller||new Z()},[]),v=(0,c.useMemo)(function(){return new Yc(null,{touchAction:b.touchAction,recognizerOptions:b.eventRecognizerOptions})},[]),g=(0,c.useRef)(null),e=(0,c.useRef)(null),a=(0,c.useRef)({width:0,height:0,state:{isHovering:!1,isDragging:!1}}).current;a.props=b,a.map=e.current&&e.current.getMap(),a.setState=function(c){a.state=ed(ed({},a.state),c),g.current.style.cursor=b.getCursor(a.state)};var j=!0,k=function(b,c,d){if(j){i=[b,c,d];return}var e=a.props,f=e.onViewStateChange,g=e.onViewportChange;Object.defineProperty(b,"position",{get:function(){return[0,0,Wb(a.map,b)]}}),f&&f({viewState:b,interactionState:c,oldViewState:d}),g&&g(b,c,d)};(0,c.useImperativeHandle)(h,function(){var a;return{getMap:(a=e).current&&a.current.getMap,queryRenderedFeatures:a.current&&a.current.queryRenderedFeatures}},[]);var d=(0,c.useMemo)(function(){return ed(ed({},f),{},{eventManager:v,container:f.container||g.current})},[f,g.current]);d.onViewportChange=k,d.viewport=f.viewport||$b(a),a.viewport=d.viewport;var w=function(b){var c=b.isDragging,d=void 0!==c&&c;if(d!==a.state.isDragging&&a.setState({isDragging:d}),j){t=b;return}var e=a.props.onInteractionStateChange;e&&e(b)},l=function(){a.width&&a.height&&u.setOptions(ed(ed(ed({},a.props),a.props.viewState),{},{isInteractive:Boolean(a.props.onViewStateChange||a.props.onViewportChange),onViewportChange:k,onStateChange:w,eventManager:v,width:a.width,height:a.height}))},m=function(b){var c=b.width,d=b.height;a.width=c,a.height=d,l(),a.props.onResize({width:c,height:d})};(0,c.useEffect)(function(){return v.setElement(g.current),v.on({pointerdown:id.bind(a),pointermove:kd.bind(a),pointerup:jd.bind(a),pointerleave:hd.bind(a,"onMouseOut"),click:ld.bind(a),anyclick:ld.bind(a),dblclick:hd.bind(a,"onDblClick"),wheel:hd.bind(a,"onWheel"),contextmenu:hd.bind(a,"onContextMenu")}),function(){v.destroy()}},[]),Vb(function(){if(i){var a;k.apply(void 0,function(a){if(Array.isArray(a))return xa(a)}(a=i)||function(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}(a)||ya(a)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}t&&w(t)}),l();var n=b.width,o=b.height,p=b.style,r=b.getCursor,s=(0,c.useMemo)(function(){return ed(ed({position:"relative"},p),{},{width:n,height:o,cursor:r(a.state)})},[p,n,o,r,a.state]);return i&&a._child||(a._child=c.createElement(Tb,{value:d},c.createElement("div",{key:"event-canvas",ref:g,style:s},c.createElement(q,wa({},b,{width:"100%",height:"100%",style:null,onResize:m,ref:e}))))),j=!1,a._child});m.supported=q.supported,m.propTypes=$,m.defaultProps=_;var md=m;function nd(b,a){if(b===a)return!0;if(!b||!a)return!1;if(Array.isArray(b)){if(!Array.isArray(a)||b.length!==a.length)return!1;for(var c=0;c prop: ".concat(e))}})(d,a,f.current):d=(function(a,c,d){if(a.style&&a.style._loaded){var b=function(c){for(var a=1;a=0||(d[a]=c[a]);return d}(a,d);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(c=0;c=0)&&Object.prototype.propertyIsEnumerable.call(a,b)&&(e[b]=a[b])}return e}(d,["layout","paint","filter","minzoom","maxzoom","beforeId"]);if(p!==a.beforeId&&b.moveLayer(c,p),e!==a.layout){var q=a.layout||{};for(var g in e)nd(e[g],q[g])||b.setLayoutProperty(c,g,e[g]);for(var r in q)e.hasOwnProperty(r)||b.setLayoutProperty(c,r,void 0)}if(f!==a.paint){var s=a.paint||{};for(var h in f)nd(f[h],s[h])||b.setPaintProperty(c,h,f[h]);for(var t in s)f.hasOwnProperty(t)||b.setPaintProperty(c,t,void 0)}for(var i in nd(m,a.filter)||b.setFilter(c,m),(n!==a.minzoom||o!==a.maxzoom)&&b.setLayerZoomRange(c,n,o),j)nd(j[i],a[i])||b.setLayerProperty(c,i,j[i])}(c,d,a,b)}catch(e){console.warn(e)}})(a,d,b,e.current):(function(a,d,b){if(a.style&&a.style._loaded){var c=rd(rd({},b),{},{id:d});delete c.beforeId,a.addLayer(c,b.beforeId)}})(a,d,b),e.current=b,null}).propTypes=ba;var f={captureScroll:!1,captureDrag:!0,captureClick:!0,captureDoubleClick:!0,capturePointerMove:!1},d={captureScroll:a.bool,captureDrag:a.bool,captureClick:a.bool,captureDoubleClick:a.bool,capturePointerMove:a.bool};function td(){var d=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{},a=(0,c.useContext)(Ub),e=(0,c.useRef)(null),f=(0,c.useRef)({props:d,state:{},context:a,containerRef:e}),b=f.current;return b.props=d,b.context=a,(0,c.useEffect)(function(){return(function(a){var b=a.containerRef.current,c=a.context.eventManager;if(b&&c){var d={wheel:function(c){var b=a.props;b.captureScroll&&c.stopPropagation(),b.onScroll&&b.onScroll(c,a)},panstart:function(c){var b=a.props;b.captureDrag&&c.stopPropagation(),b.onDragStart&&b.onDragStart(c,a)},anyclick:function(c){var b=a.props;b.captureClick&&c.stopPropagation(),b.onNativeClick&&b.onNativeClick(c,a)},click:function(c){var b=a.props;b.captureClick&&c.stopPropagation(),b.onClick&&b.onClick(c,a)},dblclick:function(c){var b=a.props;b.captureDoubleClick&&c.stopPropagation(),b.onDoubleClick&&b.onDoubleClick(c,a)},pointermove:function(c){var b=a.props;b.capturePointerMove&&c.stopPropagation(),b.onPointerMove&&b.onPointerMove(c,a)}};return c.watch(d,b),function(){c.off(d)}}})(b)},[a.eventManager]),b}function ud(b){var a=b.instance,c=td(b),d=c.context,e=c.containerRef;return a._context=d,a._containerRef=e,a._render()}var H=function(b){ec(a,b);var d,e,f=(d=a,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}(),function(){var a,b=hc(d);if(e){var c=hc(this).constructor;a=Reflect.construct(b,arguments,c)}else a=b.apply(this,arguments);return gc(this,a)});function a(){var b;vb(this,a);for(var e=arguments.length,h=new Array(e),d=0;d2&& void 0!==arguments[2]?arguments[2]:"x";if(null===a)return b;var c="x"===d?a.offsetWidth:a.offsetHeight;return Bd(b/100*c)/c*100};function Dd(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}var ea=Object.assign({},ca,{className:a.string,longitude:a.number.isRequired,latitude:a.number.isRequired,style:a.object}),fa=Object.assign({},da,{className:""});function t(b){var d,j,e,k,f,l,m,a,h=(d=b,e=(j=Aa((0,c.useState)(null),2))[0],k=j[1],f=Aa((0,c.useState)(null),2),l=f[0],m=f[1],a=td(wd(wd({},d),{},{onDragStart:zd})),a.callbacks=d,a.state.dragPos=e,a.state.setDragPos=k,a.state.dragOffset=l,a.state.setDragOffset=m,(0,c.useEffect)(function(){return(function(a){var b=a.context.eventManager;if(b&&a.state.dragPos){var c={panmove:function(b){return(function(b,a){var h=a.props,c=a.callbacks,d=a.state,i=a.context;b.stopPropagation();var e=xd(b);d.setDragPos(e);var f=d.dragOffset;if(c.onDrag&&f){var g=Object.assign({},b);g.lngLat=yd(e,f,h,i),c.onDrag(g)}})(b,a)},panend:function(b){return(function(c,a){var h=a.props,d=a.callbacks,b=a.state,i=a.context;c.stopPropagation();var e=b.dragPos,f=b.dragOffset;if(b.setDragPos(null),b.setDragOffset(null),d.onDragEnd&&e&&f){var g=Object.assign({},c);g.lngLat=yd(e,f,h,i),d.onDragEnd(g)}})(b,a)},pancancel:function(d){var c,b;return c=d,b=a.state,void(c.stopPropagation(),b.setDragPos(null),b.setDragOffset(null))}};return b.watch(c),function(){b.off(c)}}})(a)},[a.context.eventManager,Boolean(e)]),a),o=h.state,p=h.containerRef,q=b.children,r=b.className,s=b.draggable,A=b.style,t=o.dragPos,u=function(b){var a=b.props,e=b.state,f=b.context,g=a.longitude,h=a.latitude,j=a.offsetLeft,k=a.offsetTop,c=e.dragPos,d=e.dragOffset,l=f.viewport,m=f.map;if(c&&d)return[c[0]+d[0],c[1]+d[1]];var n=Wb(m,{longitude:g,latitude:h}),i=Aa(l.project([g,h,n]),2),o=i[0],p=i[1];return[o+=j,p+=k]}(h),n=Aa(u,2),v=n[0],w=n[1],x="translate(".concat(Bd(v),"px, ").concat(Bd(w),"px)"),y=s?t?"grabbing":"grab":"auto",z=(0,c.useMemo)(function(){var a=function(c){for(var a=1;a0){var t=b,u=e;for(b=0;b<=1;b+=.5)k=(i=n-b*h)+h,e=Math.max(0,d-i)+Math.max(0,k-p+d),e0){var w=a,x=f;for(a=0;a<=1;a+=v)l=(j=m-a*g)+g,f=Math.max(0,d-j)+Math.max(0,l-o+d),f1||h< -1||f<0||f>p.width||g<0||g>p.height?i.display="none":i.zIndex=Math.floor((1-h)/2*1e5)),i),S=(0,c.useCallback)(function(b){t.props.onClose();var a=t.context.eventManager;a&&a.once("click",function(a){return a.stopPropagation()},b.target)},[]);return c.createElement("div",{className:"mapboxgl-popup mapboxgl-popup-anchor-".concat(L," ").concat(N),style:R,ref:u},c.createElement("div",{key:"tip",className:"mapboxgl-popup-tip",style:{borderWidth:O}}),c.createElement("div",{key:"content",ref:j,className:"mapboxgl-popup-content"},P&&c.createElement("button",{key:"close-button",className:"mapboxgl-popup-close-button",type:"button",onClick:S},"\xd7"),Q))}function Fd(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}u.propTypes=ga,u.defaultProps=ha,c.memo(u);var ia=Object.assign({},d,{toggleLabel:a.string,className:a.string,style:a.object,compact:a.bool,customAttribution:a.oneOfType([a.string,a.arrayOf(a.string)])}),ja=Object.assign({},f,{className:"",toggleLabel:"Toggle Attribution"});function v(a){var b=td(a),d=b.context,i=b.containerRef,j=(0,c.useRef)(null),e=Aa((0,c.useState)(!1),2),f=e[0],m=e[1];(0,c.useEffect)(function(){var h,e,c,f,g,b;return d.map&&(h=(e={customAttribution:a.customAttribution},c=d.map,f=i.current,g=j.current,(b=new(A()).AttributionControl(e))._map=c,b._container=f,b._innerContainer=g,b._updateAttributions(),b._updateEditLink(),c.on("styledata",b._updateData),c.on("sourcedata",b._updateData),b)),function(){var a;return h&&void((a=h)._map.off("styledata",a._updateData),a._map.off("sourcedata",a._updateData))}},[d.map]);var h=void 0===a.compact?d.viewport.width<=640:a.compact;(0,c.useEffect)(function(){!h&&f&&m(!1)},[h]);var k=(0,c.useCallback)(function(){return m(function(a){return!a})},[]),l=(0,c.useMemo)(function(){return(function(c){for(var a=1;ac)return 1}return 0})(b.map.version,"1.6.0")>=0?2:1:2},[b.map]),f=b.viewport.bearing,d={transform:"rotate(".concat(-f,"deg)")},2===e?c.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true",style:d}):c.createElement("span",{className:"mapboxgl-ctrl-compass-arrow",style:d})))))}function Nd(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}y.propTypes=oa,y.defaultProps=pa,c.memo(y);var qa=Object.assign({},d,{className:a.string,style:a.object,maxWidth:a.number,unit:a.oneOf(["imperial","metric","nautical"])}),ra=Object.assign({},f,{className:"",maxWidth:100,unit:"metric"});function z(a){var d=td(a),f=d.context,h=d.containerRef,e=Aa((0,c.useState)(null),2),b=e[0],j=e[1];(0,c.useEffect)(function(){if(f.map){var a=new(A()).ScaleControl();a._map=f.map,a._container=h.current,j(a)}},[f.map]),b&&(b.options=a,b._onMove());var i=(0,c.useMemo)(function(){return(function(c){for(var a=1;a\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",b=g.console&&(g.console.warn||g.console.log);return b&&b.call(g.console,d,e),c.apply(this,arguments)}}m="function"!=typeof Object.assign?function(b){if(b===l||null===b)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(b),c=1;c -1}function _(a){return a.trim().split(/\s+/g)}function aa(a,d,c){if(a.indexOf&&!c)return a.indexOf(d);for(var b=0;baa(e,f)&&b.push(c[a]),e[a]=f,a++}return g&&(b=d?b.sort(function(a,b){return a[d]>b[d]}):b.sort()),b}function n(e,a){for(var c,d,f=a[0].toUpperCase()+a.slice(1),b=0;b1&&!b.firstMultiple?b.firstMultiple=na(a):1===h&&(b.firstMultiple=!1);var i=b.firstInput,c=b.firstMultiple,j=c?c.center:i.center,k=a.center=oa(e);a.timeStamp=U(),a.deltaTime=a.timeStamp-i.timeStamp,a.angle=sa(j,k),a.distance=ra(j,k),la(b,a),a.offsetDirection=qa(a.deltaX,a.deltaY);var d=pa(a.deltaTime,a.deltaX,a.deltaY);a.overallVelocityX=d.x,a.overallVelocityY=d.y,a.overallVelocity=T(d.x)>T(d.y)?d.x:d.y,a.scale=c?ua(c.pointers,e):1,a.rotation=c?ta(c.pointers,e):0,a.maxPointers=b.prevInput?a.pointers.length>b.prevInput.maxPointers?a.pointers.length:b.prevInput.maxPointers:a.pointers.length,ma(b,a);var f=g.element;Z(a.srcEvent.target,f)&&(f=a.srcEvent.target),a.target=f}function la(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};(1===b.eventType||4===f.eventType)&&(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function ma(h,a){var d,e,f,g,b=h.lastInterval||a,i=a.timeStamp-b.timeStamp;if(8!=a.eventType&&(i>25||l===b.velocity)){var j=a.deltaX-b.deltaX,k=a.deltaY-b.deltaY,c=pa(i,j,k);e=c.x,f=c.y,d=T(c.x)>T(c.y)?c.x:c.y,g=qa(j,k),h.lastInterval=a}else d=b.velocity,e=b.velocityX,f=b.velocityY,g=b.direction;a.velocity=d,a.velocityX=e,a.velocityY=f,a.direction=g}function na(a){for(var c=[],b=0;b=T(b)?a<0?2:4:b<0?8:16}function ra(b,c,a){a||(a=ha);var d=c[a[0]]-b[a[0]],e=c[a[1]]-b[a[1]];return Math.sqrt(d*d+e*e)}function sa(b,c,a){a||(a=ha);var d=c[a[0]]-b[a[0]],e=c[a[1]]-b[a[1]];return 180*Math.atan2(e,d)/Math.PI}function ta(a,b){return sa(b[1],b[0],ia)+sa(a[1],a[0],ia)}function ua(a,b){return ra(b[0],b[1],ia)/ra(a[0],a[1],ia)}f.prototype={handler:function(){},init:function(){this.evEl&&H(this.element,this.evEl,this.domHandler),this.evTarget&&H(this.target,this.evTarget,this.domHandler),this.evWin&&H(ea(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&I(this.element,this.evEl,this.domHandler),this.evTarget&&I(this.target,this.evTarget,this.domHandler),this.evWin&&I(ea(this.element),this.evWin,this.domHandler)}};var va={mousedown:1,mousemove:2,mouseup:4};function u(){this.evEl="mousedown",this.evWin="mousemove mouseup",this.pressed=!1,f.apply(this,arguments)}e(u,f,{handler:function(a){var b=va[a.type];1&b&&0===a.button&&(this.pressed=!0),2&b&&1!==a.which&&(b=4),this.pressed&&(4&b&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:L,srcEvent:a}))}});var wa={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},xa={2:K,3:"pen",4:L,5:"kinect"},M="pointerdown",N="pointermove pointerup pointercancel";function v(){this.evEl=M,this.evWin=N,f.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}g.MSPointerEvent&&!g.PointerEvent&&(M="MSPointerDown",N="MSPointerMove MSPointerUp MSPointerCancel"),e(v,f,{handler:function(a){var b=this.store,e=!1,d=wa[a.type.toLowerCase().replace("ms","")],f=xa[a.pointerType]||a.pointerType,c=aa(b,a.pointerId,"pointerId");1&d&&(0===a.button||f==K)?c<0&&(b.push(a),c=b.length-1):12&d&&(e=!0),!(c<0)&&(b[c]=a,this.callback(this.manager,d,{pointers:b,changedPointers:[a],pointerType:f,srcEvent:a}),e&&b.splice(c,1))}});var ya={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function w(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,f.apply(this,arguments)}function za(b,d){var a=ba(b.touches),c=ba(b.changedTouches);return 12&d&&(a=ca(a.concat(c),"identifier",!0)),[a,c]}e(w,f,{handler:function(c){var a=ya[c.type];if(1===a&&(this.started=!0),this.started){var b=za.call(this,c,a);12&a&&b[0].length-b[1].length==0&&(this.started=!1),this.callback(this.manager,a,{pointers:b[0],changedPointers:b[1],pointerType:K,srcEvent:c})}}});var Aa={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function x(){this.evTarget="touchstart touchmove touchend touchcancel",this.targetIds={},f.apply(this,arguments)}function Ba(h,g){var b=ba(h.touches),c=this.targetIds;if(3&g&&1===b.length)return c[b[0].identifier]=!0,[b,b];var a,d,e=ba(h.changedTouches),f=[],i=this.target;if(d=b.filter(function(a){return Z(a.target,i)}),1===g)for(a=0;a -1&&d.splice(a,1)},2500)}}function Ea(b){for(var d=b.srcEvent.clientX,e=b.srcEvent.clientY,a=0;a -1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(d){var c=this,a=this.state;function b(a){c.manager.emit(a,d)}a<8&&b(c.options.event+Ma(a)),b(c.options.event),d.additionalEvent&&b(d.additionalEvent),a>=8&&b(c.options.event+Ma(a))},tryEmit:function(a){if(this.canEmit())return this.emit(a);this.state=32},canEmit:function(){for(var a=0;ac.threshold&&b&c.direction},attrTest:function(a){return h.prototype.attrTest.call(this,a)&&(2&this.state|| !(2&this.state)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=Na(a.direction);b&&(a.additionalEvent=this.options.event+b),this._super.emit.call(this,a)}}),e(p,h,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Ia]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||2&this.state)},emit:function(a){if(1!==a.scale){var b=a.scale<1?"in":"out";a.additionalEvent=this.options.event+b}this._super.emit.call(this,a)}}),e(q,i,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Ga]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distanceb.time;if(this._input=a,d&&c&&(!(12&a.eventType)||e)){if(1&a.eventType)this.reset(),this._timer=V(function(){this.state=8,this.tryEmit()},b.time,this);else if(4&a.eventType)return 8}else this.reset();return 32},reset:function(){clearTimeout(this._timer)},emit:function(a){8===this.state&&(a&&4&a.eventType?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=U(),this.manager.emit(this.options.event,this._input)))}}),e(r,h,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Ia]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||2&this.state)}}),e(s,h,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return o.prototype.getTouchAction.call(this)},attrTest:function(a){var b,c=this.options.direction;return 30&c?b=a.overallVelocity:6&c?b=a.overallVelocityX:24&c&&(b=a.overallVelocityY),this._super.attrTest.call(this,a)&&c&a.offsetDirection&&a.distance>this.options.threshold&&a.maxPointers==this.options.pointers&&T(b)>this.options.velocity&&4&a.eventType},emit:function(a){var b=Na(a.offsetDirection);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),e(j,i,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Ha]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance1)for(var a=1;ac.length)&&(a=c.length);for(var b=0,d=new Array(a);bc?c:a}Math.PI,Math.hypot||(Math.hypot=function(){for(var b=0,a=arguments.length;a--;)b+=arguments[a]*arguments[a];return Math.sqrt(b)}),nb=new h(4),h!=Float32Array&&(nb[0]=0,nb[1]=0,nb[2]=0,nb[3]=0);const Ga=Math.log2||function(a){return Math.log(a)*Math.LOG2E};function Ha(e,f,g){var h=f[0],i=f[1],j=f[2],k=f[3],l=f[4],m=f[5],n=f[6],o=f[7],p=f[8],q=f[9],r=f[10],s=f[11],t=f[12],u=f[13],v=f[14],w=f[15],a=g[0],b=g[1],c=g[2],d=g[3];return e[0]=a*h+b*l+c*p+d*t,e[1]=a*i+b*m+c*q+d*u,e[2]=a*j+b*n+c*r+d*v,e[3]=a*k+b*o+c*s+d*w,a=g[4],b=g[5],c=g[6],d=g[7],e[4]=a*h+b*l+c*p+d*t,e[5]=a*i+b*m+c*q+d*u,e[6]=a*j+b*n+c*r+d*v,e[7]=a*k+b*o+c*s+d*w,a=g[8],b=g[9],c=g[10],d=g[11],e[8]=a*h+b*l+c*p+d*t,e[9]=a*i+b*m+c*q+d*u,e[10]=a*j+b*n+c*r+d*v,e[11]=a*k+b*o+c*s+d*w,a=g[12],b=g[13],c=g[14],d=g[15],e[12]=a*h+b*l+c*p+d*t,e[13]=a*i+b*m+c*q+d*u,e[14]=a*j+b*n+c*r+d*v,e[15]=a*k+b*o+c*s+d*w,e}function Ia(b,a,f){var g,h,i,j,k,l,m,n,o,p,q,r,c=f[0],d=f[1],e=f[2];return a===b?(b[12]=a[0]*c+a[4]*d+a[8]*e+a[12],b[13]=a[1]*c+a[5]*d+a[9]*e+a[13],b[14]=a[2]*c+a[6]*d+a[10]*e+a[14],b[15]=a[3]*c+a[7]*d+a[11]*e+a[15]):(g=a[0],h=a[1],i=a[2],j=a[3],k=a[4],l=a[5],m=a[6],n=a[7],o=a[8],p=a[9],q=a[10],r=a[11],b[0]=g,b[1]=h,b[2]=i,b[3]=j,b[4]=k,b[5]=l,b[6]=m,b[7]=n,b[8]=o,b[9]=p,b[10]=q,b[11]=r,b[12]=g*c+k*d+o*e+a[12],b[13]=h*c+l*d+p*e+a[13],b[14]=i*c+m*d+q*e+a[14],b[15]=j*c+n*d+r*e+a[15]),b}function Ja(a,b,f){var c=f[0],d=f[1],e=f[2];return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a[3]=b[3]*c,a[4]=b[4]*d,a[5]=b[5]*d,a[6]=b[6]*d,a[7]=b[7]*d,a[8]=b[8]*e,a[9]=b[9]*e,a[10]=b[10]*e,a[11]=b[11]*e,a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a}function Ka(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[4],h=a[5],i=a[6],j=a[7],k=a[8],l=a[9],m=a[10],n=a[11],o=a[12],p=a[13],q=a[14],r=a[15],s=b[0],t=b[1],u=b[2],v=b[3],w=b[4],x=b[5],y=b[6],z=b[7],A=b[8],B=b[9],C=b[10],D=b[11],E=b[12],F=b[13],G=b[14],H=b[15];return Math.abs(c-s)<=1e-6*Math.max(1,Math.abs(c),Math.abs(s))&&Math.abs(d-t)<=1e-6*Math.max(1,Math.abs(d),Math.abs(t))&&Math.abs(e-u)<=1e-6*Math.max(1,Math.abs(e),Math.abs(u))&&Math.abs(f-v)<=1e-6*Math.max(1,Math.abs(f),Math.abs(v))&&Math.abs(g-w)<=1e-6*Math.max(1,Math.abs(g),Math.abs(w))&&Math.abs(h-x)<=1e-6*Math.max(1,Math.abs(h),Math.abs(x))&&Math.abs(i-y)<=1e-6*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(j-z)<=1e-6*Math.max(1,Math.abs(j),Math.abs(z))&&Math.abs(k-A)<=1e-6*Math.max(1,Math.abs(k),Math.abs(A))&&Math.abs(l-B)<=1e-6*Math.max(1,Math.abs(l),Math.abs(B))&&Math.abs(m-C)<=1e-6*Math.max(1,Math.abs(m),Math.abs(C))&&Math.abs(n-D)<=1e-6*Math.max(1,Math.abs(n),Math.abs(D))&&Math.abs(o-E)<=1e-6*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(p-F)<=1e-6*Math.max(1,Math.abs(p),Math.abs(F))&&Math.abs(q-G)<=1e-6*Math.max(1,Math.abs(q),Math.abs(G))&&Math.abs(r-H)<=1e-6*Math.max(1,Math.abs(r),Math.abs(H))}function La(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a}function Ma(a,b,c,d){var e=b[0],f=b[1];return a[0]=e+d*(c[0]-e),a[1]=f+d*(c[1]-f),a}function Na(a,b){if(!a)throw new Error(b||"@math.gl/web-mercator: assertion failed.")}ob=new h(2),h!=Float32Array&&(ob[0]=0,ob[1]=0),pb=new h(3),h!=Float32Array&&(pb[0]=0,pb[1]=0,pb[2]=0);const n=Math.PI,Oa=n/4,Pa=n/180,Qa=180/n;function Ra(a){return Math.pow(2,a)}function Sa([b,a]){return Na(Number.isFinite(b)),Na(Number.isFinite(a)&&a>= -90&&a<=90,"invalid latitude"),[512*(b*Pa+n)/(2*n),512*(n+Math.log(Math.tan(Oa+.5*(a*Pa))))/(2*n)]}function Ta([a,b]){return[(a/512*(2*n)-n)*Qa,2*(Math.atan(Math.exp(b/512*(2*n)-n))-Oa)*Qa]}function Ua(a){return 2*Math.atan(.5/a)*Qa}function Va(a){return .5/Math.tan(.5*a*Pa)}function Wa(i,c,j=0){const[a,b,e]=i;if(Na(Number.isFinite(a)&&Number.isFinite(b),"invalid pixel coordinate"),Number.isFinite(e)){const k=Ca(c,[a,b,e,1]);return k}const f=Ca(c,[a,b,0,1]),g=Ca(c,[a,b,1,1]),d=f[2],h=g[2];return Ma([],f,g,d===h?0:((j||0)-d)/(h-d))}const Xa=Math.PI/180;function Ya(a,c,d){const{pixelUnprojectionMatrix:e}=a,b=Ca(e,[c,0,1,1]),f=Ca(e,[c,a.height,1,1]),h=d*a.distanceScales.unitsPerMeter[2],i=(h-b[2])/(f[2]-b[2]),j=Ma([],b,f,i),g=Ta(j);return g[2]=d,g}class Za{constructor({width:f,height:c,latitude:l=0,longitude:m=0,zoom:p=0,pitch:n=0,bearing:q=0,altitude:a=null,fovy:b=null,position:o=null,nearZMultiplier:t=.02,farZMultiplier:u=1.01}={width:1,height:1}){f=f||1,c=c||1,null===b&&null===a?b=Ua(a=1.5):null===b?b=Ua(a):null===a&&(a=Va(b));const r=Ra(p);a=Math.max(.75,a);const s=function({latitude:c,longitude:i,highPrecision:j=!1}){Na(Number.isFinite(c)&&Number.isFinite(i));const b={},d=Math.cos(c*Pa),e=1.4222222222222223/d,a=12790407194604047e-21/d;if(b.unitsPerMeter=[a,a,a],b.metersPerUnit=[1/a,1/a,1/a],b.unitsPerDegree=[1.4222222222222223,e,a],b.degreesPerUnit=[.703125,1/e,1/a],j){const f=Pa*Math.tan(c*Pa)/d,k=1.4222222222222223*f/2,g=12790407194604047e-21*f,h=g/e*a;b.unitsPerDegree2=[0,k,g],b.unitsPerMeter2=[h,0,h]}return b}({longitude:m,latitude:l}),d=Sa([m,l]);if(d[2]=0,o){var e,g,h,i,j,k;i=d,j=d,e=[],g=o,h=s.unitsPerMeter,e[0]=g[0]*h[0],e[1]=g[1]*h[1],e[2]=g[2]*h[2],k=e,i[0]=j[0]+k[0],i[1]=j[1]+k[1],i[2]=j[2]+k[2]}this.projectionMatrix=(function({width:h,height:i,pitch:j,altitude:k,fovy:l,nearZMultiplier:m,farZMultiplier:n}){var a,f,g,c,b,d,e;const{fov:o,aspect:p,near:q,far:r}=function({width:f,height:g,fovy:a=Ua(1.5),altitude:d,pitch:h=0,nearZMultiplier:i=1,farZMultiplier:j=1}){void 0!==d&&(a=Ua(d));const b=.5*a*Pa,c=Va(a),e=h*Pa;return{fov:2*b,aspect:f/g,focalDistance:c,near:i,far:(Math.sin(e)*(Math.sin(b)*c/Math.sin(Math.min(Math.max(Math.PI/2-e-b,.01),Math.PI-.01)))+c)*j}}({width:h,height:i,altitude:k,fovy:l,pitch:j,nearZMultiplier:m,farZMultiplier:n}),s=(a=[],f=o,g=p,c=q,b=r,e=1/Math.tan(f/2),a[0]=e/g,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=e,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=-1,a[12]=0,a[13]=0,a[15]=0,null!=b&&b!==1/0?(d=1/(c-b),a[10]=(b+c)*d,a[14]=2*b*c*d):(a[10]=-1,a[14]=-2*c),a);return s})({width:f,height:c,pitch:n,fovy:b,nearZMultiplier:t,farZMultiplier:u}),this.viewMatrix=(function({height:F,pitch:G,bearing:H,altitude:I,scale:l,center:E=null}){var a,b,m,f,g,n,o,p,q,r,s,t,u,c,d,v,h,i,w,x,y,z,A,B,C,D,j,k;const e=Ba();return Ia(e,e,[0,0,-I]),a=e,b=e,m=-G*Pa,f=Math.sin(m),g=Math.cos(m),n=b[4],o=b[5],p=b[6],q=b[7],r=b[8],s=b[9],t=b[10],u=b[11],b!==a&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a[4]=n*g+r*f,a[5]=o*g+s*f,a[6]=p*g+t*f,a[7]=q*g+u*f,a[8]=r*g-n*f,a[9]=s*g-o*f,a[10]=t*g-p*f,a[11]=u*g-q*f,c=e,d=e,v=H*Pa,h=Math.sin(v),i=Math.cos(v),w=d[0],x=d[1],y=d[2],z=d[3],A=d[4],B=d[5],C=d[6],D=d[7],d!==c&&(c[8]=d[8],c[9]=d[9],c[10]=d[10],c[11]=d[11],c[12]=d[12],c[13]=d[13],c[14]=d[14],c[15]=d[15]),c[0]=w*i+A*h,c[1]=x*i+B*h,c[2]=y*i+C*h,c[3]=z*i+D*h,c[4]=A*i-w*h,c[5]=B*i-x*h,c[6]=C*i-y*h,c[7]=D*i-z*h,Ja(e,e,[l/=F,l,l]),E&&Ia(e,e,(j=[],k=E,j[0]=-k[0],j[1]=-k[1],j[2]=-k[2],j)),e})({height:c,scale:r,center:d,pitch:n,bearing:q,altitude:a}),this.width=f,this.height=c,this.scale=r,this.latitude=l,this.longitude=m,this.zoom=p,this.pitch=n,this.bearing=q,this.altitude=a,this.fovy=b,this.center=d,this.meterOffset=o||[0,0,0],this.distanceScales=s,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 b,c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,a;const{width:I,height:J,projectionMatrix:K,viewMatrix:L}=this,G=Ba();Ha(G,G,K),Ha(G,G,L),this.viewProjectionMatrix=G;const d=Ba();Ja(d,d,[I/2,-J/2,1]),Ia(d,d,[1,-1,0]),Ha(d,d,G);const H=(b=Ba(),e=(c=d)[0],f=c[1],g=c[2],h=c[3],i=c[4],j=c[5],k=c[6],l=c[7],m=c[8],n=c[9],o=c[10],p=c[11],q=c[12],r=c[13],s=c[14],t=c[15],u=e*j-f*i,v=e*k-g*i,w=e*l-h*i,x=f*k-g*j,y=f*l-h*j,z=g*l-h*k,A=m*r-n*q,B=m*s-o*q,C=m*t-p*q,D=n*s-o*r,E=n*t-p*r,F=o*t-p*s,a=u*F-v*E+w*D+x*C-y*B+z*A,a?(a=1/a,b[0]=(j*F-k*E+l*D)*a,b[1]=(g*E-f*F-h*D)*a,b[2]=(r*z-s*y+t*x)*a,b[3]=(o*y-n*z-p*x)*a,b[4]=(k*C-i*F-l*B)*a,b[5]=(e*F-g*C+h*B)*a,b[6]=(s*w-q*z-t*v)*a,b[7]=(m*z-o*w+p*v)*a,b[8]=(i*E-j*C+l*A)*a,b[9]=(f*C-e*E-h*A)*a,b[10]=(q*y-r*w+t*u)*a,b[11]=(n*w-m*y-p*u)*a,b[12]=(j*B-i*D-k*A)*a,b[13]=(e*D-f*B+g*A)*a,b[14]=(r*v-q*x-s*u)*a,b[15]=(m*x-n*v+o*u)*a,b):null);if(!H)throw new Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=d,this.pixelUnprojectionMatrix=H}equals(a){return a instanceof Za&&a.width===this.width&&a.height===this.height&&Ka(a.projectionMatrix,this.projectionMatrix)&&Ka(a.viewMatrix,this.viewMatrix)}project(a,{topLeft:f=!0}={}){const g=this.projectPosition(a),b=function(d,e){const[a,b,c=0]=d;return Na(Number.isFinite(a)&&Number.isFinite(b)&&Number.isFinite(c)),Ca(e,[a,b,c,1])}(g,this.pixelProjectionMatrix),[c,d]=b,e=f?d:this.height-d;return 2===a.length?[c,e]:[c,e,b[2]]}unproject(f,{topLeft:g=!0,targetZ:a}={}){const[h,d,e]=f,i=g?d:this.height-d,j=a&&a*this.distanceScales.unitsPerMeter[2],k=Wa([h,i,e],this.pixelUnprojectionMatrix,j),[b,c,l]=this.unprojectPosition(k);return Number.isFinite(e)?[b,c,l]:Number.isFinite(a)?[b,c,a]:[b,c]}projectPosition(a){const[b,c]=Sa(a),d=(a[2]||0)*this.distanceScales.unitsPerMeter[2];return[b,c,d]}unprojectPosition(a){const[b,c]=Ta(a),d=(a[2]||0)*this.distanceScales.metersPerUnit[2];return[b,c,d]}projectFlat(a){return Sa(a)}unprojectFlat(a){return Ta(a)}getMapCenterByLngLatPosition({lngLat:c,pos:d}){var a,b;const e=Wa(d,this.pixelUnprojectionMatrix),f=Sa(c),g=La([],f,(a=[],b=e,a[0]=-b[0],a[1]=-b[1],a)),h=La([],this.center,g);return Ta(h)}getLocationAtPoint({lngLat:a,pos:b}){return this.getMapCenterByLngLatPosition({lngLat:a,pos:b})}fitBounds(c,d={}){const{width:a,height:b}=this,{longitude:e,latitude:f,zoom:g}=function({width:m,height:n,bounds:o,minExtent:f=0,maxZoom:p=24,padding:a=0,offset:g=[0,0]}){const[[q,r],[s,t]]=o;if(Number.isFinite(a)){const b=a;a={top:b,bottom:b,left:b,right:b}}else Na(Number.isFinite(a.top)&&Number.isFinite(a.bottom)&&Number.isFinite(a.left)&&Number.isFinite(a.right));const c=Sa([q,Fa(t,-85.051129,85.051129)]),d=Sa([s,Fa(r,-85.051129,85.051129)]),h=[Math.max(Math.abs(d[0]-c[0]),f),Math.max(Math.abs(d[1]-c[1]),f)],e=[m-a.left-a.right-2*Math.abs(g[0]),n-a.top-a.bottom-2*Math.abs(g[1])];Na(e[0]>0&&e[1]>0);const i=e[0]/h[0],j=e[1]/h[1],u=(a.right-a.left)/2/i,v=(a.bottom-a.top)/2/j,w=[(d[0]+c[0])/2+u,(d[1]+c[1])/2+v],k=Ta(w),l=Math.min(p,Ga(Math.abs(Math.min(i,j))));return Na(Number.isFinite(l)),{longitude:k[0],latitude:k[1],zoom:l}}(Object.assign({width:a,height:b,bounds:c},d));return new Za({width:a,height:b,longitude:e,latitude:f,zoom:g})}getBounds(b){const a=this.getBoundingRegion(b),c=Math.min(...a.map(a=>a[0])),d=Math.max(...a.map(a=>a[0])),e=Math.min(...a.map(a=>a[1])),f=Math.max(...a.map(a=>a[1]));return[[c,e],[d,f]]}getBoundingRegion(a={}){return(function(a,d=0){const{width:e,height:h,unproject:b}=a,c={targetZ:d},i=b([0,h],c),j=b([e,h],c);let f,g;const k=a.fovy?.5*a.fovy*Xa:Math.atan(.5/a.altitude),l=(90-a.pitch)*Xa;return k>l-.01?(f=Ya(a,0,d),g=Ya(a,e,d)):(f=b([0,0],c),g=b([e,0],c)),[i,j,g,f]})(this,a.z||0)}}const $a=["longitude","latitude","zoom"],_a={curve:1.414,speed:1.2};function ab(d,h,i){var f,j,k,o,p,q;i=Object.assign({},_a,i);const g=i.curve,l=d.zoom,w=[d.longitude,d.latitude],x=Ra(l),y=h.zoom,z=[h.longitude,h.latitude],A=Ra(y-l),r=Sa(w),B=Sa(z),s=(f=[],j=B,k=r,f[0]=j[0]-k[0],f[1]=j[1]-k[1],f),a=Math.max(d.width,d.height),e=a/A,t=(p=(o=s)[0],q=o[1],Math.hypot(p,q)*x),c=Math.max(t,.01),b=g*g,m=(e*e-a*a+b*b*c*c)/(2*a*b*c),n=(e*e-a*a-b*b*c*c)/(2*e*b*c),u=Math.log(Math.sqrt(m*m+1)-m),v=Math.log(Math.sqrt(n*n+1)-n);return{startZoom:l,startCenterXY:r,uDelta:s,w0:a,u1:t,S:(v-u)/g,rho:g,rho2:b,r0:u,r1:v}}var N=function(){if("undefined"!=typeof Map)return Map;function a(a,c){var b=-1;return a.some(function(a,d){return a[0]===c&&(b=d,!0)}),b}return(function(){function b(){this.__entries__=[]}return Object.defineProperty(b.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),b.prototype.get=function(c){var d=a(this.__entries__,c),b=this.__entries__[d];return b&&b[1]},b.prototype.set=function(b,c){var d=a(this.__entries__,b);~d?this.__entries__[d][1]=c:this.__entries__.push([b,c])},b.prototype.delete=function(d){var b=this.__entries__,c=a(b,d);~c&&b.splice(c,1)},b.prototype.has=function(b){return!!~a(this.__entries__,b)},b.prototype.clear=function(){this.__entries__.splice(0)},b.prototype.forEach=function(e,a){void 0===a&&(a=null);for(var b=0,c=this.__entries__;b0},a.prototype.connect_=function(){!bb||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),eb?(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)},a.prototype.disconnect_=function(){bb&&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)},a.prototype.onTransitionEnd_=function(b){var a=b.propertyName,c=void 0===a?"":a;db.some(function(a){return!!~c.indexOf(a)})&&this.refresh()},a.getInstance=function(){return this.instance_||(this.instance_=new a()),this.instance_},a.instance_=null,a}(),gb=function(b,c){for(var a=0,d=Object.keys(c);a0},a}(),tb="undefined"!=typeof WeakMap?new WeakMap():new N(),O=function(){function a(b){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var c=fb.getInstance(),d=new sb(b,c,this);tb.set(this,d)}return a}();["observe","unobserve","disconnect"].forEach(function(a){O.prototype[a]=function(){var b;return(b=tb.get(this))[a].apply(b,arguments)}});var ub=void 0!==o.ResizeObserver?o.ResizeObserver:O;function vb(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function wb(d,c){for(var b=0;b=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function(a){throw a},f:b}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}function Bb(a,c){if(a){if("string"==typeof a)return Cb(a,c);var b=Object.prototype.toString.call(a).slice(8,-1);if("Object"===b&&a.constructor&&(b=a.constructor.name),"Map"===b||"Set"===b)return Array.from(a);if("Arguments"===b||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b))return Cb(a,c)}}function Cb(c,a){(null==a||a>c.length)&&(a=c.length);for(var b=0,d=new Array(a);b1&& void 0!==arguments[1]?arguments[1]:"component";b.debug&&a.checkPropTypes(Q,b,"prop",c)}var i=function(){function a(b){var c=this;if(vb(this,a),g(this,"props",R),g(this,"width",0),g(this,"height",0),g(this,"_fireLoadEvent",function(){c.props.onLoad({type:"load",target:c._map})}),g(this,"_handleError",function(a){c.props.onError(a)}),!b.mapboxgl)throw new Error("Mapbox not available");this.mapboxgl=b.mapboxgl,a.initialized||(a.initialized=!0,this._checkStyleSheet(this.mapboxgl.version)),this._initialize(b)}return xb(a,[{key:"finalize",value:function(){return this._destroy(),this}},{key:"setProps",value:function(a){return this._update(this.props,a),this}},{key:"redraw",value:function(){var a=this._map;a.style&&(a._frame&&(a._frame.cancel(),a._frame=null),a._render())}},{key:"getMap",value:function(){return this._map}},{key:"_reuse",value:function(b){this._map=a.savedMap;var d=this._map.getContainer(),c=b.container;for(c.classList.add("mapboxgl-map");d.childNodes.length>0;)c.appendChild(d.childNodes[0]);this._map._container=c,a.savedMap=null,b.mapStyle&&this._map.setStyle(Eb(b.mapStyle),{diff:!1}),this._map.isStyleLoaded()?this._fireLoadEvent():this._map.once("styledata",this._fireLoadEvent)}},{key:"_create",value:function(b){if(b.reuseMaps&&a.savedMap)this._reuse(b);else{if(b.gl){var d=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(){return HTMLCanvasElement.prototype.getContext=d,b.gl}}var c={container:b.container,center:[0,0],zoom:8,pitch:0,bearing:0,maxZoom:24,style:Eb(b.mapStyle),interactive:!1,trackResize:!1,attributionControl:b.attributionControl,preserveDrawingBuffer:b.preserveDrawingBuffer};b.transformRequest&&(c.transformRequest=b.transformRequest),this._map=new this.mapboxgl.Map(Object.assign({},c,b.mapOptions)),this._map.once("load",this._fireLoadEvent),this._map.on("error",this._handleError)}return this}},{key:"_destroy",value:function(){this._map&&(this.props.reuseMaps&&!a.savedMap?(a.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(a){var d=this;Gb(a=Object.assign({},R,a),"Mapbox"),this.mapboxgl.accessToken=a.mapboxApiAccessToken||R.mapboxApiAccessToken,this.mapboxgl.baseApiUrl=a.mapboxApiUrl,this._create(a);var b=a.container;Object.defineProperty(b,"offsetWidth",{configurable:!0,get:function(){return d.width}}),Object.defineProperty(b,"clientWidth",{configurable:!0,get:function(){return d.width}}),Object.defineProperty(b,"offsetHeight",{configurable:!0,get:function(){return d.height}}),Object.defineProperty(b,"clientHeight",{configurable:!0,get:function(){return d.height}});var c=this._map.getCanvas();c&&(c.style.outline="none"),this._updateMapViewport({},a),this._updateMapSize({},a),this.props=a}},{key:"_update",value:function(b,a){if(this._map){Gb(a=Object.assign({},this.props,a),"Mapbox");var c=this._updateMapViewport(b,a),d=this._updateMapSize(b,a);this._updateMapStyle(b,a),!a.asyncRender&&(c||d)&&this.redraw(),this.props=a}}},{key:"_updateMapStyle",value:function(b,a){b.mapStyle!==a.mapStyle&&this._map.setStyle(Eb(a.mapStyle),{diff:!a.preventStyleDiffing})}},{key:"_updateMapSize",value:function(b,a){var c=b.width!==a.width||b.height!==a.height;return c&&(this.width=a.width,this.height=a.height,this._map.resize()),c}},{key:"_updateMapViewport",value:function(d,e){var b=this._getViewState(d),a=this._getViewState(e),c=a.latitude!==b.latitude||a.longitude!==b.longitude||a.zoom!==b.zoom||a.pitch!==b.pitch||a.bearing!==b.bearing||a.altitude!==b.altitude;return c&&(this._map.jumpTo(this._viewStateToMapboxProps(a)),a.altitude!==b.altitude&&(this._map.transform.altitude=a.altitude)),c}},{key:"_getViewState",value:function(b){var a=b.viewState||b,f=a.longitude,g=a.latitude,h=a.zoom,c=a.pitch,d=a.bearing,e=a.altitude;return{longitude:f,latitude:g,zoom:h,pitch:void 0===c?0:c,bearing:void 0===d?0:d,altitude:void 0===e?1.5:e}}},{key:"_checkStyleSheet",value:function(){var c=arguments.length>0&& void 0!==arguments[0]?arguments[0]:"0.47.0";if(void 0!==P)try{var a=P.createElement("div");if(a.className="mapboxgl-map",a.style.display="none",P.body.appendChild(a),!("static"!==window.getComputedStyle(a).position)){var b=P.createElement("link");b.setAttribute("rel","stylesheet"),b.setAttribute("type","text/css"),b.setAttribute("href","https://api.tiles.mapbox.com/mapbox-gl-js/v".concat(c,"/mapbox-gl.css")),P.head.appendChild(b)}}catch(d){}}},{key:"_viewStateToMapboxProps",value:function(a){return{center:[a.longitude,a.latitude],zoom:a.zoom,bearing:a.bearing,pitch:a.pitch}}}]),a}();g(i,"initialized",!1),g(i,"propTypes",Q),g(i,"defaultProps",R),g(i,"savedMap",null);var S=b(6158),A=b.n(S);function Hb(a){return Array.isArray(a)||ArrayBuffer.isView(a)}function Ib(a,b){if(a===b)return!0;if(Hb(a)&&Hb(b)){if(a.length!==b.length)return!1;for(var c=0;c=Math.abs(a-b)}function Jb(a,b,c){return Math.max(b,Math.min(c,a))}function Kb(a,c,b){return Hb(a)?a.map(function(a,d){return Kb(a,c[d],b)}):b*c+(1-b)*a}function Lb(a,b){if(!a)throw new Error(b||"react-map-gl: assertion failed.")}function Mb(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}function Nb(c){for(var a=1;a0,"`scale` must be a positive number");var f=this._state,b=f.startZoom,c=f.startZoomLngLat;Number.isFinite(b)||(b=this._viewportProps.zoom,c=this._unproject(i)||this._unproject(d)),Lb(c,"`startZoomLngLat` prop is required for zoom behavior to calculate where to position the map.");var g=this._calculateNewZoom({scale:e,startZoom:b||0}),j=new Za(Object.assign({},this._viewportProps,{zoom:g})),k=j.getMapCenterByLngLatPosition({lngLat:c,pos:d}),h=Aa(k,2),l=h[0],m=h[1];return this._getUpdatedMapState({zoom:g,longitude:l,latitude:m})}},{key:"zoomEnd",value:function(){return this._getUpdatedMapState({startZoomLngLat:null,startZoom:null})}},{key:"_getUpdatedMapState",value:function(b){return new a(Object.assign({},this._viewportProps,this._state,b))}},{key:"_applyConstraints",value:function(a){var b=a.maxZoom,c=a.minZoom,d=a.zoom;a.zoom=Jb(d,c,b);var e=a.maxPitch,f=a.minPitch,g=a.pitch;return a.pitch=Jb(g,f,e),Object.assign(a,function({width:j,height:e,longitude:b,latitude:a,zoom:d,pitch:k=0,bearing:c=0}){(b< -180||b>180)&&(b=Da(b+180,360)-180),(c< -180||c>180)&&(c=Da(c+180,360)-180);const f=Ga(e/512);if(d<=f)d=f,a=0;else{const g=e/2/Math.pow(2,d),h=Ta([0,g])[1];if(ai&&(a=i)}}return{width:j,height:e,longitude:b,latitude:a,zoom:d,pitch:k,bearing:c}}(a)),a}},{key:"_unproject",value:function(a){var b=new Za(this._viewportProps);return a&&b.unproject(a)}},{key:"_calculateNewLngLat",value:function(a){var b=a.startPanLngLat,c=a.pos,d=new Za(this._viewportProps);return d.getMapCenterByLngLatPosition({lngLat:b,pos:c})}},{key:"_calculateNewZoom",value:function(a){var c=a.scale,d=a.startZoom,b=this._viewportProps,e=b.maxZoom,f=b.minZoom;return Jb(d+Math.log2(c),f,e)}},{key:"_calculateNewPitchAndBearing",value:function(c){var f=c.deltaScaleX,a=c.deltaScaleY,g=c.startBearing,b=c.startPitch;a=Jb(a,-1,1);var e=this._viewportProps,h=e.minPitch,i=e.maxPitch,d=b;return a>0?d=b+a*(i-b):a<0&&(d=b-a*(h-b)),{pitch:d,bearing:g+180*f}}},{key:"_getRotationParams",value:function(c,d){var h=c[0]-d[0],e=c[1]-d[1],i=c[1],a=d[1],f=this._viewportProps,j=f.width,g=f.height,b=0;return e>0?Math.abs(g-a)>5&&(b=e/(a-g)*1.2):e<0&&a>5&&(b=1-i/a),{deltaScaleX:h/j,deltaScaleY:b=Math.min(1,Math.max(-1,b))}}}]),a}();function Qb(a){return a[0].toLowerCase()+a.slice(1)}function Rb(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}function Sb(c){for(var a=1;a1&& void 0!==arguments[1]?arguments[1]:{},b=a.current&&a.current.getMap();return b&&b.queryRenderedFeatures(c,d)}}},[]);var p=(0,c.useCallback)(function(b){var a=b.target;a===o.current&&a.scrollTo(0,0)},[]),q=d&&c.createElement(Tb,{value:Yb(Yb({},b),{},{viewport:b.viewport||$b(Yb({map:d,props:a},m)),map:d,container:b.container||h.current})},c.createElement("div",{key:"map-overlays",className:"overlays",ref:o,style:_b,onScroll:p},a.children)),r=a.className,s=a.width,t=a.height,u=a.style,v=a.visibilityConstraints,w=Object.assign({position:"relative"},u,{width:s,height:t}),x=a.visible&&function(c){var b=arguments.length>1&& void 0!==arguments[1]?arguments[1]:B;for(var a in b){var d=a.slice(0,3),e=Qb(a.slice(3));if("min"===d&&c[e]b[a])return!1}return!0}(a.viewState||a,v),y=Object.assign({},_b,{visibility:x?"inherit":"hidden"});return c.createElement("div",{key:"map-container",ref:h,style:w},c.createElement("div",{key:"map-mapbox",ref:n,style:y,className:r}),q,!l&&!a.disableTokenWarning&&c.createElement(ac,null))});j.supported=function(){return A()&&A().supported()},j.propTypes=T,j.defaultProps=U;var q=j;function bc(c,a){(null==a||a>c.length)&&(a=c.length);for(var b=0,d=new Array(a);b=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function(a){throw a},f:b}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}(this.propNames||[]);try{for(a.s();!(b=a.n()).done;){var c=b.value;if(!Ib(d[c],e[c]))return!1}}catch(f){a.e(f)}finally{a.f()}return!0}},{key:"initializeProps",value:function(a,b){return{start:a,end:b}}},{key:"interpolateProps",value:function(a,b,c){Lb(!1,"interpolateProps is not implemented")}},{key:"getDuration",value:function(b,a){return a.transitionDuration}}]),a}();function cc(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function dc(a,b){return(dc=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a})(a,b)}function ec(b,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,writable:!0,configurable:!0}}),Object.defineProperty(b,"prototype",{writable:!1}),a&&dc(b,a)}function fc(a){return(fc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function gc(b,a){if(a&&("object"===fc(a)||"function"==typeof a))return a;if(void 0!==a)throw new TypeError("Derived constructors may only return object or undefined");return cc(b)}function hc(a){return(hc=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)})(a)}var ic={longitude:1,bearing:1};function jc(a){return Number.isFinite(a)||Array.isArray(a)}function kc(b,c,a){return b in ic&&Math.abs(a-c)>180&&(a=a<0?a+360:a-360),a}function lc(a,c){if("undefined"==typeof Symbol||null==a[Symbol.iterator]){if(Array.isArray(a)||(e=mc(a))||c&&a&&"number"==typeof a.length){e&&(a=e);var d=0,b=function(){};return{s:b,n:function(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function(a){throw a},f:b}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}function mc(a,c){if(a){if("string"==typeof a)return nc(a,c);var b=Object.prototype.toString.call(a).slice(8,-1);if("Object"===b&&a.constructor&&(b=a.constructor.name),"Map"===b||"Set"===b)return Array.from(a);if("Arguments"===b||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b))return nc(a,c)}}function nc(c,a){(null==a||a>c.length)&&(a=c.length);for(var b=0,d=new Array(a);b=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function(a){throw a},f:b}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}function tc(a,c){if(a){if("string"==typeof a)return uc(a,c);var b=Object.prototype.toString.call(a).slice(8,-1);if("Object"===b&&a.constructor&&(b=a.constructor.name),"Map"===b||"Set"===b)return Array.from(a);if("Arguments"===b||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b))return uc(a,c)}}function uc(c,a){(null==a||a>c.length)&&(a=c.length);for(var b=0,d=new Array(a);b0&& void 0!==arguments[0]?arguments[0]:{};return vb(this,d),g(cc(a=e.call(this)),"propNames",oc),a.props=Object.assign({},rc,b),a}xb(d,[{key:"initializeProps",value:function(h,i){var j,e={},f={},c=lc(pc);try{for(c.s();!(j=c.n()).done;){var a=j.value,g=h[a],k=i[a];Lb(jc(g)&&jc(k),"".concat(a," must be supplied for transition")),e[a]=g,f[a]=kc(a,g,k)}}catch(n){c.e(n)}finally{c.f()}var l,d=lc(qc);try{for(d.s();!(l=d.n()).done;){var b=l.value,m=h[b]||0,o=i[b]||0;e[b]=m,f[b]=kc(b,m,o)}}catch(p){d.e(p)}finally{d.f()}return{start:e,end:f}}},{key:"interpolateProps",value:function(c,d,e){var f,g=function(h,i,j,o={}){var c,d,e;const a={},{startZoom:p,startCenterXY:q,uDelta:r,w0:s,u1:k,S:t,rho:l,rho2:u,r0:b}=ab(h,i,o);if(k<.01){for(const f of $a){const v=h[f],w=i[f];a[f]=Ea(v,w,j)}return a}const m=j*t,x=p+Ga(1/(Math.cosh(b)/Math.cosh(b+l*m))),g=(c=[],d=r,e=s*((Math.cosh(b)*Math.tanh(b+l*m)-Math.sinh(b))/u)/k,c[0]=d[0]*e,c[1]=d[1]*e,c);La(g,g,q);const n=Ta(g);return a.longitude=n[0],a.latitude=n[1],a.zoom=x,a}(c,d,e,this.props),a=lc(qc);try{for(a.s();!(f=a.n()).done;){var b=f.value;g[b]=Kb(c[b],d[b],e)}}catch(h){a.e(h)}finally{a.f()}return g}},{key:"getDuration",value:function(c,b){var a=b.transitionDuration;return"auto"===a&&(a=(function(f,g,a={}){a=Object.assign({},_a,a);const{screenSpeed:c,speed:h,maxDuration:d}=a,{S:i,rho:j}=ab(f,g,a),e=1e3*i;let b;return b=Number.isFinite(c)?e/(c/j):e/h,Number.isFinite(d)&&b>d?0:b})(c,b,this.props)),a}}])}(C);var vc=["longitude","latitude","zoom","bearing","pitch"],D=function(b){ec(a,b);var c,d,e=(c=a,d=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}(),function(){var a,b=hc(c);if(d){var e=hc(this).constructor;a=Reflect.construct(b,arguments,e)}else a=b.apply(this,arguments);return gc(this,a)});function a(){var c,b=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{};return vb(this,a),c=e.call(this),Array.isArray(b)&&(b={transitionProps:b}),c.propNames=b.transitionProps||vc,b.around&&(c.around=b.around),c}return xb(a,[{key:"initializeProps",value:function(g,c){var d={},e={};if(this.around){d.around=this.around;var h=new Za(g).unproject(this.around);Object.assign(e,c,{around:new Za(c).project(h),aroundLngLat:h})}var i,b=sc(this.propNames);try{for(b.s();!(i=b.n()).done;){var a=i.value,f=g[a],j=c[a];Lb(jc(f)&&jc(j),"".concat(a," must be supplied for transition")),d[a]=f,e[a]=kc(a,f,j)}}catch(k){b.e(k)}finally{b.f()}return{start:d,end:e}}},{key:"interpolateProps",value:function(e,a,f){var g,b={},c=sc(this.propNames);try{for(c.s();!(g=c.n()).done;){var d=g.value;b[d]=Kb(e[d],a[d],f)}}catch(i){c.e(i)}finally{c.f()}if(a.around){var h=Aa(new Za(Object.assign({},a,b)).getMapCenterByLngLatPosition({lngLat:a.aroundLngLat,pos:Kb(e.around,a.around,f)}),2),j=h[0],k=h[1];b.longitude=j,b.latitude=k}return b}}]),a}(C),r=function(){},E={BREAK:1,SNAP_TO_END:2,IGNORE:3,UPDATE:4},V={transitionDuration:0,transitionEasing:function(a){return a},transitionInterpolator:new D(),transitionInterruption:E.BREAK,onTransitionStart:r,onTransitionInterrupt:r,onTransitionEnd:r},F=function(){function a(){var c=this,b=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{};vb(this,a),g(this,"_animationFrame",null),g(this,"_onTransitionFrame",function(){c._animationFrame=requestAnimationFrame(c._onTransitionFrame),c._updateViewport()}),this.props=null,this.onViewportChange=b.onViewportChange||r,this.onStateChange=b.onStateChange||r,this.time=b.getTime||Date.now}return xb(a,[{key:"getViewportInTransition",value:function(){return this._animationFrame?this.state.propsInTransition:null}},{key:"processViewportChange",value:function(c){var a=this.props;if(this.props=c,!a||this._shouldIgnoreViewportChange(a,c))return!1;if(this._isTransitionEnabled(c)){var d=Object.assign({},a),b=Object.assign({},c);if(this._isTransitionInProgress()&&(a.onTransitionInterrupt(),this.state.interruption===E.SNAP_TO_END?Object.assign(d,this.state.endProps):Object.assign(d,this.state.propsInTransition),this.state.interruption===E.UPDATE)){var f,g,h,e=this.time(),i=(e-this.state.startTime)/this.state.duration;b.transitionDuration=this.state.duration-(e-this.state.startTime),h=(f=this.state.easing)(g=i),b.transitionEasing=function(a){return 1/(1-h)*(f(a*(1-g)+g)-h)},b.transitionInterpolator=d.transitionInterpolator}return b.onTransitionStart(),this._triggerTransition(d,b),!0}return this._isTransitionInProgress()&&(a.onTransitionInterrupt(),this._endTransition()),!1}},{key:"_isTransitionInProgress",value:function(){return Boolean(this._animationFrame)}},{key:"_isTransitionEnabled",value:function(a){var b=a.transitionDuration,c=a.transitionInterpolator;return(b>0||"auto"===b)&&Boolean(c)}},{key:"_isUpdateDueToCurrentTransition",value:function(a){return!!this.state.propsInTransition&&this.state.interpolator.arePropsEqual(a,this.state.propsInTransition)}},{key:"_shouldIgnoreViewportChange",value:function(b,a){return!b||(this._isTransitionInProgress()?this.state.interruption===E.IGNORE||this._isUpdateDueToCurrentTransition(a):!this._isTransitionEnabled(a)||a.transitionInterpolator.arePropsEqual(b,a))}},{key:"_triggerTransition",value:function(b,a){Lb(this._isTransitionEnabled(a)),this._animationFrame&&cancelAnimationFrame(this._animationFrame);var c=a.transitionInterpolator,d=c.getDuration?c.getDuration(b,a):a.transitionDuration;if(0!==d){var e=a.transitionInterpolator.initializeProps(b,a),f={inTransition:!0,isZooming:b.zoom!==a.zoom,isPanning:b.longitude!==a.longitude||b.latitude!==a.latitude,isRotating:b.bearing!==a.bearing||b.pitch!==a.pitch};this.state={duration:d,easing:a.transitionEasing,interpolator:a.transitionInterpolator,interruption:a.transitionInterruption,startTime:this.time(),startProps:e.start,endProps:e.end,animation:null,propsInTransition:{}},this._onTransitionFrame(),this.onStateChange(f)}}},{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 d=this.time(),a=this.state,e=a.startTime,f=a.duration,g=a.easing,h=a.interpolator,i=a.startProps,j=a.endProps,c=!1,b=(d-e)/f;b>=1&&(b=1,c=!0),b=g(b);var k=h.interpolateProps(i,j,b),l=new Pb(Object.assign({},this.props,k));this.state.propsInTransition=l.getViewportProps(),this.onViewportChange(this.state.propsInTransition,this.props),c&&(this._endTransition(),this.props.onTransitionEnd())}}]),a}();g(F,"defaultProps",V);var W=b(840),k=b.n(W);const wc={mousedown:1,mousemove:2,mouseup:4};!function(a){const b=a.prototype.handler;a.prototype.handler=function(a){const c=this.store;a.button>0&&"pointerdown"===a.type&& !function(b,c){for(let a=0;ab.pointerId===a.pointerId)&&c.push(a),b.call(this,a)}}(k().PointerEventInput),k().MouseInput.prototype.handler=function(a){let b=wc[a.type];1&b&&a.button>=0&&(this.pressed=!0),2&b&&0===a.which&&(b=4),this.pressed&&(4&b&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:"mouse",srcEvent:a}))};const xc=k().Manager;var e=k();const yc=e?[[e.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1}],[e.Rotate,{enable:!1}],[e.Pinch,{enable:!1}],[e.Swipe,{enable:!1}],[e.Pan,{threshold:0,enable:!1}],[e.Press,{enable:!1}],[e.Tap,{event:"doubletap",taps:2,enable:!1}],[e.Tap,{event:"anytap",enable:!1}],[e.Tap,{enable:!1}]]:null,zc={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},Ac={doubletap:["tap"]},Bc={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},s={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],WHEEL_EVENTS:["wheel","mousewheel"]},Cc={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"},Dc={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},X="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",G="undefined"!=typeof window?window:b.g;void 0!==b.g&&b.g;let Y=!1;try{const l={get passive(){return Y=!0,!0}};G.addEventListener("test",l,l),G.removeEventListener("test",l,l)}catch(Ec){}const Fc=-1!==X.indexOf("firefox"),{WHEEL_EVENTS:Gc}=s,Hc="wheel";class Ic{constructor(b,c,a={}){this.element=b,this.callback=c,this.options=Object.assign({enable:!0},a),this.events=Gc.concat(a.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(a=>b.addEventListener(a,this.handleEvent,!!Y&&{passive:!1}))}destroy(){this.events.forEach(a=>this.element.removeEventListener(a,this.handleEvent))}enableEventType(a,b){a===Hc&&(this.options.enable=b)}handleEvent(b){if(!this.options.enable)return;let a=b.deltaY;G.WheelEvent&&(Fc&&b.deltaMode===G.WheelEvent.DOM_DELTA_PIXEL&&(a/=G.devicePixelRatio),b.deltaMode===G.WheelEvent.DOM_DELTA_LINE&&(a*=40));const c={x:b.clientX,y:b.clientY};0!==a&&a%4.000244140625==0&&(a=Math.floor(a/4.000244140625)),b.shiftKey&&a&&(a*=.25),this._onWheel(b,-a,c)}_onWheel(a,b,c){this.callback({type:Hc,center:c,delta:b,srcEvent:a,pointerType:"mouse",target:a.target})}}const{MOUSE_EVENTS:Jc}=s,Kc="pointermove",Lc="pointerover",Mc="pointerout",Nc="pointerleave";class Oc{constructor(b,c,a={}){this.element=b,this.callback=c,this.pressed=!1,this.options=Object.assign({enable:!0},a),this.enableMoveEvent=this.options.enable,this.enableLeaveEvent=this.options.enable,this.enableOutEvent=this.options.enable,this.enableOverEvent=this.options.enable,this.events=Jc.concat(a.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(a=>b.addEventListener(a,this.handleEvent))}destroy(){this.events.forEach(a=>this.element.removeEventListener(a,this.handleEvent))}enableEventType(a,b){a===Kc&&(this.enableMoveEvent=b),a===Lc&&(this.enableOverEvent=b),a===Mc&&(this.enableOutEvent=b),a===Nc&&(this.enableLeaveEvent=b)}handleEvent(a){this.handleOverEvent(a),this.handleOutEvent(a),this.handleLeaveEvent(a),this.handleMoveEvent(a)}handleOverEvent(a){this.enableOverEvent&&"mouseover"===a.type&&this.callback({type:Lc,srcEvent:a,pointerType:"mouse",target:a.target})}handleOutEvent(a){this.enableOutEvent&&"mouseout"===a.type&&this.callback({type:Mc,srcEvent:a,pointerType:"mouse",target:a.target})}handleLeaveEvent(a){this.enableLeaveEvent&&"mouseleave"===a.type&&this.callback({type:Nc,srcEvent:a,pointerType:"mouse",target:a.target})}handleMoveEvent(a){if(this.enableMoveEvent)switch(a.type){case"mousedown":a.button>=0&&(this.pressed=!0);break;case"mousemove":0===a.which&&(this.pressed=!1),this.pressed||this.callback({type:Kc,srcEvent:a,pointerType:"mouse",target:a.target});break;case"mouseup":this.pressed=!1;break;default:}}}const{KEY_EVENTS:Pc}=s,Qc="keydown",Rc="keyup";class Sc{constructor(a,c,b={}){this.element=a,this.callback=c,this.options=Object.assign({enable:!0},b),this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=Pc.concat(b.events||[]),this.handleEvent=this.handleEvent.bind(this),a.tabIndex=b.tabIndex||0,a.style.outline="none",this.events.forEach(b=>a.addEventListener(b,this.handleEvent))}destroy(){this.events.forEach(a=>this.element.removeEventListener(a,this.handleEvent))}enableEventType(a,b){a===Qc&&(this.enableDownEvent=b),a===Rc&&(this.enableUpEvent=b)}handleEvent(a){const b=a.target||a.srcElement;("INPUT"!==b.tagName||"text"!==b.type)&&"TEXTAREA"!==b.tagName&&(this.enableDownEvent&&"keydown"===a.type&&this.callback({type:Qc,srcEvent:a,key:a.key,target:a.target}),this.enableUpEvent&&"keyup"===a.type&&this.callback({type:Rc,srcEvent:a,key:a.key,target:a.target}))}}const Tc="contextmenu";class Uc{constructor(a,b,c={}){this.element=a,this.callback=b,this.options=Object.assign({enable:!0},c),this.handleEvent=this.handleEvent.bind(this),a.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(a,b){a===Tc&&(this.options.enable=b)}handleEvent(a){this.options.enable&&this.callback({type:Tc,center:{x:a.clientX,y:a.clientY},srcEvent:a,pointerType:"mouse",target:a.target})}}const Vc={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},Wc={srcElement:"root",priority:0};class Xc{constructor(a){this.eventManager=a,this.handlers=[],this.handlersByElement=new Map(),this.handleEvent=this.handleEvent.bind(this),this._active=!1}isEmpty(){return!this._active}add(f,g,a,h=!1,i=!1){const{handlers:j,handlersByElement:e}=this;a&&("object"!=typeof a||a.addEventListener)&&(a={srcElement:a}),a=a?Object.assign({},Wc,a):Wc;let b=e.get(a.srcElement);b||(b=[],e.set(a.srcElement,b));const c={type:f,handler:g,srcElement:a.srcElement,priority:a.priority};h&&(c.once=!0),i&&(c.passive=!0),j.push(c),this._active=this._active||!c.passive;let d=b.length-1;for(;d>=0;){if(b[d].priority>=c.priority)break;d--}b.splice(d+1,0,c)}remove(f,g){const{handlers:b,handlersByElement:e}=this;for(let c=b.length-1;c>=0;c--){const a=b[c];if(a.type===f&&a.handler===g){b.splice(c,1);const d=e.get(a.srcElement);d.splice(d.indexOf(a),1),0===d.length&&e.delete(a.srcElement)}}this._active=b.some(a=>!a.passive)}handleEvent(c){if(this.isEmpty())return;const b=this._normalizeEvent(c);let a=c.srcEvent.target;for(;a&&a!==b.rootElement;){if(this._emit(b,a),b.handled)return;a=a.parentNode}this._emit(b,"root")}_emit(e,f){const a=this.handlersByElement.get(f);if(a){let g=!1;const h=()=>{e.handled=!0},i=()=>{e.handled=!0,g=!0},c=[];for(let b=0;b{const b=this.manager.get(a);b&&zc[a].forEach(a=>{b.recognizeWith(a)})}),b.recognizerOptions){const e=this.manager.get(d);if(e){const f=b.recognizerOptions[d];delete f.enable,e.set(f)}}for(const[h,c]of(this.wheelInput=new Ic(a,this._onOtherEvent,{enable:!1}),this.moveInput=new Oc(a,this._onOtherEvent,{enable:!1}),this.keyInput=new Sc(a,this._onOtherEvent,{enable:!1,tabIndex:b.tabIndex}),this.contextmenuInput=new Uc(a,this._onOtherEvent,{enable:!1}),this.events))c.isEmpty()||(this._toggleRecognizer(c.recognizerName,!0),this.manager.on(h,c.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(a,b,c){this._addEventHandler(a,b,c,!1)}once(a,b,c){this._addEventHandler(a,b,c,!0)}watch(a,b,c){this._addEventHandler(a,b,c,!1,!0)}off(a,b){this._removeEventHandler(a,b)}_toggleRecognizer(a,b){const{manager:d}=this;if(!d)return;const c=d.get(a);if(c&&c.options.enable!==b){c.set({enable:b});const e=Ac[a];e&&!this.options.recognizers&&e.forEach(e=>{const f=d.get(e);b?(f.requireFailure(a),c.dropRequireFailure(e)):f.dropRequireFailure(a)})}this.wheelInput.enableEventType(a,b),this.moveInput.enableEventType(a,b),this.keyInput.enableEventType(a,b),this.contextmenuInput.enableEventType(a,b)}_addEventHandler(b,e,d,f,g){if("string"!=typeof b){for(const h in d=e,b)this._addEventHandler(h,b[h],d,f,g);return}const{manager:i,events:j}=this,c=Dc[b]||b;let a=j.get(c);!a&&(a=new Xc(this),j.set(c,a),a.recognizerName=Cc[c]||c,i&&i.on(c,a.handleEvent)),a.add(b,e,d,f,g),a.isEmpty()||this._toggleRecognizer(a.recognizerName,!0)}_removeEventHandler(a,h){if("string"!=typeof a){for(const c in a)this._removeEventHandler(c,a[c]);return}const{events:d}=this,i=Dc[a]||a,b=d.get(i);if(b&&(b.remove(a,h),b.isEmpty())){const{recognizerName:e}=b;let f=!1;for(const g of d.values())if(g.recognizerName===e&&!g.isEmpty()){f=!0;break}f||this._toggleRecognizer(e,!1)}}_onBasicInput(a){const{srcEvent:c}=a,b=Bc[c.type];b&&this.manager.emit(b,a)}_onOtherEvent(a){this.manager.emit(a.type,a)}}function Zc(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}function $c(c){for(var a=1;a0),e=d&&!this.state.isHovering,h=!d&&this.state.isHovering;(c||e)&&(a.features=b,c&&c(a)),e&&hd.call(this,"onMouseEnter",a),h&&hd.call(this,"onMouseLeave",a),(e||h)&&this.setState({isHovering:d})}}function ld(b){var c=this.props,d=c.onClick,f=c.onNativeClick,g=c.onDblClick,h=c.doubleClickZoom,a=[],e=g||h;switch(b.type){case"anyclick":a.push(f),e||a.push(d);break;case"click":e&&a.push(d);break;default:}(a=a.filter(Boolean)).length&&((b=fd.call(this,b)).features=gd.call(this,b.point),a.forEach(function(a){return a(b)}))}var m=(0,c.forwardRef)(function(b,h){var i,t,f=(0,c.useContext)(Ub),u=(0,c.useMemo)(function(){return b.controller||new Z()},[]),v=(0,c.useMemo)(function(){return new Yc(null,{touchAction:b.touchAction,recognizerOptions:b.eventRecognizerOptions})},[]),g=(0,c.useRef)(null),e=(0,c.useRef)(null),a=(0,c.useRef)({width:0,height:0,state:{isHovering:!1,isDragging:!1}}).current;a.props=b,a.map=e.current&&e.current.getMap(),a.setState=function(c){a.state=ed(ed({},a.state),c),g.current.style.cursor=b.getCursor(a.state)};var j=!0,k=function(b,c,d){if(j){i=[b,c,d];return}var e=a.props,f=e.onViewStateChange,g=e.onViewportChange;Object.defineProperty(b,"position",{get:function(){return[0,0,Wb(a.map,b)]}}),f&&f({viewState:b,interactionState:c,oldViewState:d}),g&&g(b,c,d)};(0,c.useImperativeHandle)(h,function(){var a;return{getMap:(a=e).current&&a.current.getMap,queryRenderedFeatures:a.current&&a.current.queryRenderedFeatures}},[]);var d=(0,c.useMemo)(function(){return ed(ed({},f),{},{eventManager:v,container:f.container||g.current})},[f,g.current]);d.onViewportChange=k,d.viewport=f.viewport||$b(a),a.viewport=d.viewport;var w=function(b){var c=b.isDragging,d=void 0!==c&&c;if(d!==a.state.isDragging&&a.setState({isDragging:d}),j){t=b;return}var e=a.props.onInteractionStateChange;e&&e(b)},l=function(){a.width&&a.height&&u.setOptions(ed(ed(ed({},a.props),a.props.viewState),{},{isInteractive:Boolean(a.props.onViewStateChange||a.props.onViewportChange),onViewportChange:k,onStateChange:w,eventManager:v,width:a.width,height:a.height}))},m=function(b){var c=b.width,d=b.height;a.width=c,a.height=d,l(),a.props.onResize({width:c,height:d})};(0,c.useEffect)(function(){return v.setElement(g.current),v.on({pointerdown:id.bind(a),pointermove:kd.bind(a),pointerup:jd.bind(a),pointerleave:hd.bind(a,"onMouseOut"),click:ld.bind(a),anyclick:ld.bind(a),dblclick:hd.bind(a,"onDblClick"),wheel:hd.bind(a,"onWheel"),contextmenu:hd.bind(a,"onContextMenu")}),function(){v.destroy()}},[]),Vb(function(){if(i){var a;k.apply(void 0,function(a){if(Array.isArray(a))return xa(a)}(a=i)||function(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}(a)||ya(a)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}t&&w(t)}),l();var n=b.width,o=b.height,p=b.style,r=b.getCursor,s=(0,c.useMemo)(function(){return ed(ed({position:"relative"},p),{},{width:n,height:o,cursor:r(a.state)})},[p,n,o,r,a.state]);return i&&a._child||(a._child=c.createElement(Tb,{value:d},c.createElement("div",{key:"event-canvas",ref:g,style:s},c.createElement(q,wa({},b,{width:"100%",height:"100%",style:null,onResize:m,ref:e}))))),j=!1,a._child});m.supported=q.supported,m.propTypes=$,m.defaultProps=_;var md=m;function nd(b,a){if(b===a)return!0;if(!b||!a)return!1;if(Array.isArray(b)){if(!Array.isArray(a)||b.length!==a.length)return!1;for(var c=0;c prop: ".concat(e))}})(d,a,f.current):d=(function(a,c,d){if(a.style&&a.style._loaded){var b=function(c){for(var a=1;a=0||(d[a]=c[a]);return d}(a,d);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(c=0;c=0||Object.prototype.propertyIsEnumerable.call(a,b)&&(e[b]=a[b])}return e}(d,["layout","paint","filter","minzoom","maxzoom","beforeId"]);if(p!==a.beforeId&&b.moveLayer(c,p),e!==a.layout){var q=a.layout||{};for(var g in e)nd(e[g],q[g])||b.setLayoutProperty(c,g,e[g]);for(var r in q)e.hasOwnProperty(r)||b.setLayoutProperty(c,r,void 0)}if(f!==a.paint){var s=a.paint||{};for(var h in f)nd(f[h],s[h])||b.setPaintProperty(c,h,f[h]);for(var t in s)f.hasOwnProperty(t)||b.setPaintProperty(c,t,void 0)}for(var i in nd(m,a.filter)||b.setFilter(c,m),(n!==a.minzoom||o!==a.maxzoom)&&b.setLayerZoomRange(c,n,o),j)nd(j[i],a[i])||b.setLayerProperty(c,i,j[i])}(c,d,a,b)}catch(e){console.warn(e)}})(a,d,b,e.current):(function(a,d,b){if(a.style&&a.style._loaded){var c=rd(rd({},b),{},{id:d});delete c.beforeId,a.addLayer(c,b.beforeId)}})(a,d,b),e.current=b,null}).propTypes=ba;var f={captureScroll:!1,captureDrag:!0,captureClick:!0,captureDoubleClick:!0,capturePointerMove:!1},d={captureScroll:a.bool,captureDrag:a.bool,captureClick:a.bool,captureDoubleClick:a.bool,capturePointerMove:a.bool};function td(){var d=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{},a=(0,c.useContext)(Ub),e=(0,c.useRef)(null),f=(0,c.useRef)({props:d,state:{},context:a,containerRef:e}),b=f.current;return b.props=d,b.context=a,(0,c.useEffect)(function(){return(function(a){var b=a.containerRef.current,c=a.context.eventManager;if(b&&c){var d={wheel:function(c){var b=a.props;b.captureScroll&&c.stopPropagation(),b.onScroll&&b.onScroll(c,a)},panstart:function(c){var b=a.props;b.captureDrag&&c.stopPropagation(),b.onDragStart&&b.onDragStart(c,a)},anyclick:function(c){var b=a.props;b.captureClick&&c.stopPropagation(),b.onNativeClick&&b.onNativeClick(c,a)},click:function(c){var b=a.props;b.captureClick&&c.stopPropagation(),b.onClick&&b.onClick(c,a)},dblclick:function(c){var b=a.props;b.captureDoubleClick&&c.stopPropagation(),b.onDoubleClick&&b.onDoubleClick(c,a)},pointermove:function(c){var b=a.props;b.capturePointerMove&&c.stopPropagation(),b.onPointerMove&&b.onPointerMove(c,a)}};return c.watch(d,b),function(){c.off(d)}}})(b)},[a.eventManager]),b}function ud(b){var a=b.instance,c=td(b),d=c.context,e=c.containerRef;return a._context=d,a._containerRef=e,a._render()}var H=function(b){ec(a,b);var d,e,f=(d=a,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}(),function(){var a,b=hc(d);if(e){var c=hc(this).constructor;a=Reflect.construct(b,arguments,c)}else a=b.apply(this,arguments);return gc(this,a)});function a(){var b;vb(this,a);for(var e=arguments.length,h=new Array(e),d=0;d2&& void 0!==arguments[2]?arguments[2]:"x";if(null===a)return b;var c="x"===d?a.offsetWidth:a.offsetHeight;return Bd(b/100*c)/c*100};function Dd(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}var ea=Object.assign({},ca,{className:a.string,longitude:a.number.isRequired,latitude:a.number.isRequired,style:a.object}),fa=Object.assign({},da,{className:""});function t(b){var d,j,e,k,f,l,m,a,h=(d=b,e=(j=Aa((0,c.useState)(null),2))[0],k=j[1],f=Aa((0,c.useState)(null),2),l=f[0],m=f[1],a=td(wd(wd({},d),{},{onDragStart:zd})),a.callbacks=d,a.state.dragPos=e,a.state.setDragPos=k,a.state.dragOffset=l,a.state.setDragOffset=m,(0,c.useEffect)(function(){return(function(a){var b=a.context.eventManager;if(b&&a.state.dragPos){var c={panmove:function(b){return(function(b,a){var h=a.props,c=a.callbacks,d=a.state,i=a.context;b.stopPropagation();var e=xd(b);d.setDragPos(e);var f=d.dragOffset;if(c.onDrag&&f){var g=Object.assign({},b);g.lngLat=yd(e,f,h,i),c.onDrag(g)}})(b,a)},panend:function(b){return(function(c,a){var h=a.props,d=a.callbacks,b=a.state,i=a.context;c.stopPropagation();var e=b.dragPos,f=b.dragOffset;if(b.setDragPos(null),b.setDragOffset(null),d.onDragEnd&&e&&f){var g=Object.assign({},c);g.lngLat=yd(e,f,h,i),d.onDragEnd(g)}})(b,a)},pancancel:function(d){var c,b;return c=d,b=a.state,void(c.stopPropagation(),b.setDragPos(null),b.setDragOffset(null))}};return b.watch(c),function(){b.off(c)}}})(a)},[a.context.eventManager,Boolean(e)]),a),o=h.state,p=h.containerRef,q=b.children,r=b.className,s=b.draggable,A=b.style,t=o.dragPos,u=function(b){var a=b.props,e=b.state,f=b.context,g=a.longitude,h=a.latitude,j=a.offsetLeft,k=a.offsetTop,c=e.dragPos,d=e.dragOffset,l=f.viewport,m=f.map;if(c&&d)return[c[0]+d[0],c[1]+d[1]];var n=Wb(m,{longitude:g,latitude:h}),i=Aa(l.project([g,h,n]),2),o=i[0],p=i[1];return[o+=j,p+=k]}(h),n=Aa(u,2),v=n[0],w=n[1],x="translate(".concat(Bd(v),"px, ").concat(Bd(w),"px)"),y=s?t?"grabbing":"grab":"auto",z=(0,c.useMemo)(function(){var a=function(c){for(var a=1;a0){var t=b,u=e;for(b=0;b<=1;b+=.5)k=(i=n-b*h)+h,e=Math.max(0,d-i)+Math.max(0,k-p+d),e0){var w=a,x=f;for(a=0;a<=1;a+=v)l=(j=m-a*g)+g,f=Math.max(0,d-j)+Math.max(0,l-o+d),f1||h< -1||f<0||f>p.width||g<0||g>p.height?i.display="none":i.zIndex=Math.floor((1-h)/2*1e5)),i),S=(0,c.useCallback)(function(b){t.props.onClose();var a=t.context.eventManager;a&&a.once("click",function(a){return a.stopPropagation()},b.target)},[]);return c.createElement("div",{className:"mapboxgl-popup mapboxgl-popup-anchor-".concat(L," ").concat(N),style:R,ref:u},c.createElement("div",{key:"tip",className:"mapboxgl-popup-tip",style:{borderWidth:O}}),c.createElement("div",{key:"content",ref:j,className:"mapboxgl-popup-content"},P&&c.createElement("button",{key:"close-button",className:"mapboxgl-popup-close-button",type:"button",onClick:S},"\xd7"),Q))}function Fd(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}u.propTypes=ga,u.defaultProps=ha,c.memo(u);var ia=Object.assign({},d,{toggleLabel:a.string,className:a.string,style:a.object,compact:a.bool,customAttribution:a.oneOfType([a.string,a.arrayOf(a.string)])}),ja=Object.assign({},f,{className:"",toggleLabel:"Toggle Attribution"});function v(a){var b=td(a),d=b.context,i=b.containerRef,j=(0,c.useRef)(null),e=Aa((0,c.useState)(!1),2),f=e[0],m=e[1];(0,c.useEffect)(function(){var h,e,c,f,g,b;return d.map&&(h=(e={customAttribution:a.customAttribution},c=d.map,f=i.current,g=j.current,(b=new(A()).AttributionControl(e))._map=c,b._container=f,b._innerContainer=g,b._updateAttributions(),b._updateEditLink(),c.on("styledata",b._updateData),c.on("sourcedata",b._updateData),b)),function(){var a;return h&&void((a=h)._map.off("styledata",a._updateData),a._map.off("sourcedata",a._updateData))}},[d.map]);var h=void 0===a.compact?d.viewport.width<=640:a.compact;(0,c.useEffect)(function(){!h&&f&&m(!1)},[h]);var k=(0,c.useCallback)(function(){return m(function(a){return!a})},[]),l=(0,c.useMemo)(function(){return(function(c){for(var a=1;ac)return 1}return 0})(b.map.version,"1.6.0")>=0?2:1:2},[b.map]),f=b.viewport.bearing,d={transform:"rotate(".concat(-f,"deg)")},2===e?c.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true",style:d}):c.createElement("span",{className:"mapboxgl-ctrl-compass-arrow",style:d})))))}function Nd(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),a.push.apply(a,b)}return a}y.propTypes=oa,y.defaultProps=pa,c.memo(y);var qa=Object.assign({},d,{className:a.string,style:a.object,maxWidth:a.number,unit:a.oneOf(["imperial","metric","nautical"])}),ra=Object.assign({},f,{className:"",maxWidth:100,unit:"metric"});function z(a){var d=td(a),f=d.context,h=d.containerRef,e=Aa((0,c.useState)(null),2),b=e[0],j=e[1];(0,c.useEffect)(function(){if(f.map){var a=new(A()).ScaleControl();a._map=f.map,a._container=h.current,j(a)}},[f.map]),b&&(b.options=a,b._onMove());var i=(0,c.useMemo)(function(){return(function(c){for(var a=1;a -1 && (selector = selector.replace(jqmDataRE, "[data-" + ($27.mobile.ns || "") + "$1]")), oldFind.call(this, selector, context, ret, extra); - }, $27.extend($27.find, oldFind), (function($, undefined) { + return void 0 !== prop && (result = $28.data(elem, prop ? $28.mobile.nsNormalize(prop) : prop, value)), result; + }, $28.fn.jqmRemoveData = function(prop) { + return this.removeData($28.mobile.nsNormalize(prop)); + }, $28.jqmRemoveData = function(elem, prop) { + return $28.removeData(elem, $28.mobile.nsNormalize(prop)); + }, $28.find = function(selector, context, ret, extra) { + return selector.indexOf(":jqmData") > -1 && (selector = selector.replace(jqmDataRE, "[data-" + ($28.mobile.ns || "") + "$1]")), oldFind.call(this, selector, context, ret, extra); + }, $28.extend($28.find, oldFind), (function($, undefined) { var removeData, orig2, uuid = 0, runiqueId = /^ui-id-\d+$/; function focusable(element, isTabIndexNotNaN) { var map, mapName, img, nodeName = element.nodeName.toLowerCase(); @@ -525,6 +525,7 @@ } }); })(jQuery, this), (function($, window, undefined) { + "$:nomunge"; var fake_onhashchange, str_hashchange = "hashchange", doc = document1, special = $.event.special, doc_mode = doc.documentMode, supports_onhashchange = "on" + str_hashchange in window && (doc_mode === undefined || doc_mode > 7); function get_fragment(url) { return "#" + (url = url || location.href).replace(/^[^#]*#?(.*)$/, "$1"); @@ -585,7 +586,7 @@ var v, uc_prop = prop.charAt(0).toUpperCase() + prop.substr(1), props = (prop + " " + vendors.join(uc_prop + " ") + uc_prop).split(" "); for(v in props)if (undefined !== fbCSS[props[v]]) return !0; } - var nokiaLTE7_3, w1, ua, platform, wkmatch, wkversion, ffmatch, ffversion, operammobilematch, omversion, rebase, fauxBase, base, fauxEle, href, supports, element, documentElement, getComputedStyle, ua1, fakeBody = $("").prependTo("html"), fbCSS = fakeBody[0].style, vendors = [ + var w1, ua, platform, wkmatch, wkversion, ffmatch, ffversion, operammobilematch, omversion, rebase, fauxBase, base, fauxEle, href, supports, element, documentElement, getComputedStyle, ua1, nokiaLTE7_3, fakeBody = $("").prependTo("html"), fbCSS = fakeBody[0].style, vendors = [ "Webkit", "Moz", "O" @@ -914,15 +915,11 @@ }); } } - }), (function($, undefined) { - $.mobile.navigate = function(url, data, noEvents) { - $.mobile.navigate.navigator.go(url, data, noEvents); - }, $.mobile.navigate.history = new $.mobile.History(), $.mobile.navigate.navigator = new $.mobile.Navigator($.mobile.navigate.history); - var loc = $.mobile.path.parseLocation(); - $.mobile.navigate.history.add(loc.href, { - hash: loc.hash - }); - })(jQuery), $10 = jQuery, props1 = { + }), ($10 = jQuery).mobile.navigate = function(url, data, noEvents) { + $10.mobile.navigate.navigator.go(url, data, noEvents); + }, $10.mobile.navigate.history = new $10.mobile.History(), $10.mobile.navigate.navigator = new $10.mobile.Navigator($10.mobile.navigate.history), loc1 = $10.mobile.path.parseLocation(), $10.mobile.navigate.history.add(loc1.href, { + hash: loc1.hash + }), $11 = jQuery, props1 = { animation: {}, transition: {} }, testElement = document1.createElement("a"), vendorPrefixes = [ @@ -930,22 +927,22 @@ "webkit-", "moz-", "o-" - ], $10.each([ + ], $11.each([ "animation", "transition" ], function(i, test) { var testName = 0 === i ? test + "-name" : test; - $10.each(vendorPrefixes, function(j, prefix) { - if (undefined4 !== testElement.style[$10.camelCase(prefix + testName)]) return props1[test].prefix = prefix, !1; - }), props1[test].duration = $10.camelCase(props1[test].prefix + test + "-duration"), props1[test].event = $10.camelCase(props1[test].prefix + test + "-end"), "" === props1[test].prefix && (props1[test].event = props1[test].event.toLowerCase()); - }), $10.support.cssTransitions = undefined4 !== props1.transition.prefix, $10.support.cssAnimations = undefined4 !== props1.animation.prefix, $10(testElement).remove(), $10.fn.animationComplete = function(callback, type, fallbackTime) { + $11.each(vendorPrefixes, function(j, prefix) { + if (undefined4 !== testElement.style[$11.camelCase(prefix + testName)]) return props1[test].prefix = prefix, !1; + }), props1[test].duration = $11.camelCase(props1[test].prefix + test + "-duration"), props1[test].event = $11.camelCase(props1[test].prefix + test + "-end"), "" === props1[test].prefix && (props1[test].event = props1[test].event.toLowerCase()); + }), $11.support.cssTransitions = undefined4 !== props1.transition.prefix, $11.support.cssAnimations = undefined4 !== props1.animation.prefix, $11(testElement).remove(), $11.fn.animationComplete = function(callback, type, fallbackTime) { var timer, duration, that = this, animationType = type && "animation" !== type ? "transition" : "animation"; - return $10.support.cssTransitions && "transition" === animationType || $10.support.cssAnimations && "animation" === animationType ? (fallbackTime === undefined4 && ($10(this).context !== document1 && (duration = 3000 * parseFloat($10(this).css(props1[animationType].duration))), (0 === duration || duration === undefined4 || isNaN(duration)) && (duration = $10.fn.animationComplete.defaultDuration)), timer = setTimeout(function() { - $10(that).off(props1[animationType].event), callback.apply(that); - }, duration), $10(this).one(props1[animationType].event, function() { + return $11.support.cssTransitions && "transition" === animationType || $11.support.cssAnimations && "animation" === animationType ? (fallbackTime === undefined4 && ($11(this).context !== document1 && (duration = 3000 * parseFloat($11(this).css(props1[animationType].duration))), (0 === duration || duration === undefined4 || isNaN(duration)) && (duration = $11.fn.animationComplete.defaultDuration)), timer = setTimeout(function() { + $11(that).off(props1[animationType].event), callback.apply(that); + }, duration), $11(this).one(props1[animationType].event, function() { clearTimeout(timer), callback.call(this, arguments); - })) : (setTimeout($10.proxy(callback, this), 0), $10(this)); - }, $10.fn.animationComplete.defaultDuration = 1000, (function($, window, document, undefined) { + })) : (setTimeout($11.proxy(callback, this), 0), $11(this)); + }, $11.fn.animationComplete.defaultDuration = 1000, (function($, window, document, undefined) { var threshold, i1, dataPropertyName = "virtualMouseBindings", touchTargetPropertyName = "virtualTouchID", virtualEventNames = "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "), touchEventProps = "clientX clientY pageX pageY screenX screenY".split(" "), mouseHookProps = $.event.mouseHooks ? $.event.mouseHooks.props : [], mouseEventProps = $.event.props.concat(mouseHookProps), activeDocHandlers = {}, resetTimerID = 0, startX = 0, startY = 0, didScroll = !1, clickBlockList = [], blockMouseTriggers = !1, blockTouchTriggers = !1, eventCaptureSupported = "addEventListener" in document, $document = $(document), nextTouchID = 1, lastTouchID = 0; function getNativeEvent(event) { for(; event && void 0 !== event.originalEvent;)event = event.originalEvent; @@ -1185,15 +1182,15 @@ } }; }); - })(jQuery, this), ($11 = jQuery).event.special.throttledresize = { + })(jQuery, this), ($12 = jQuery).event.special.throttledresize = { setup: function() { - $11(this).bind("resize", handler1); + $12(this).bind("resize", handler1); }, teardown: function() { - $11(this).unbind("resize", handler1); + $12(this).unbind("resize", handler1); } }, handler1 = function() { - (diff1 = (curr = new Date().getTime()) - lastCall) >= 250 ? (lastCall = curr, $11(this).trigger("throttledresize")) : (heldCall && clearTimeout(heldCall), heldCall = setTimeout(handler1, 250 - diff1)); + (diff1 = (curr = new Date().getTime()) - lastCall) >= 250 ? (lastCall = curr, $12(this).trigger("throttledresize")) : (heldCall && clearTimeout(heldCall), heldCall = setTimeout(handler1, 250 - diff1)); }, lastCall = 0, (function($, window) { var get_orientation, last_orientation, initial_orientation_is_landscape, initial_orientation_is_default, ww, wh, landscape_threshold, win = $(window), event_name = "orientationchange", portrait_map = { "0": !0, @@ -1228,50 +1225,50 @@ return fn ? this.bind(event_name, fn) : this.trigger(event_name); }, $.attrFn && ($.attrFn[event_name] = !0); })(jQuery, this), base1 = { - element: (baseElement = ($12 = jQuery)("head").children("base")).length ? baseElement : $12("", { - href: $12.mobile.path.documentBase.hrefNoHash - }).prependTo($12("head")), + element: (baseElement = ($13 = jQuery)("head").children("base")).length ? baseElement : $13("", { + href: $13.mobile.path.documentBase.hrefNoHash + }).prependTo($13("head")), linkSelector: "[src], link[href], a[rel='external'], :jqmData(ajax='false'), a[target]", set: function(href) { - !!$12.mobile.dynamicBaseEnabled && $12.support.dynamicBaseTag && base1.element.attr("href", $12.mobile.path.makeUrlAbsolute(href, $12.mobile.path.documentBase)); + !!$13.mobile.dynamicBaseEnabled && $13.support.dynamicBaseTag && base1.element.attr("href", $13.mobile.path.makeUrlAbsolute(href, $13.mobile.path.documentBase)); }, rewrite: function(href, page) { - var newPath = $12.mobile.path.get(href); + var newPath = $13.mobile.path.get(href); page.find(base1.linkSelector).each(function(i, link) { - var thisAttr = $12(link).is("[href]") ? "href" : $12(link).is("[src]") ? "src" : "action", thisUrl = $12(link).attr(thisAttr); - thisUrl = thisUrl.replace(location.protocol + "//" + location.host + location.pathname, ""), /^(\w+:|#|\/)/.test(thisUrl) || $12(link).attr(thisAttr, newPath + thisUrl); + var thisAttr = $13(link).is("[href]") ? "href" : $13(link).is("[src]") ? "src" : "action", thisUrl = $13(link).attr(thisAttr); + thisUrl = thisUrl.replace(location.protocol + "//" + location.host + location.pathname, ""), /^(\w+:|#|\/)/.test(thisUrl) || $13(link).attr(thisAttr, newPath + thisUrl); }); }, reset: function() { - base1.element.attr("href", $12.mobile.path.documentBase.hrefNoSearch); + base1.element.attr("href", $13.mobile.path.documentBase.hrefNoSearch); } - }, $12.mobile.base = base1, ($13 = jQuery).mobile.widgets = {}, originalWidget = $13.widget, keepNativeFactoryDefault = $13.mobile.keepNative, orig1 = $13.widget, $13.widget = function() { + }, $13.mobile.base = base1, ($14 = jQuery).mobile.widgets = {}, originalWidget = $14.widget, keepNativeFactoryDefault = $14.mobile.keepNative, orig1 = $14.widget, $14.widget = function() { var constructor = orig1.apply(this, arguments), name = constructor.prototype.widgetName; - return constructor.initSelector = undefined5 !== constructor.prototype.initSelector ? constructor.prototype.initSelector : ":jqmData(role='" + name + "')", $13.mobile.widgets[name] = constructor, constructor; - }, $13.extend($13.widget, originalWidget), $13.mobile.document.on("create", function(event) { - $13(event.target).enhanceWithin(); - }), $13.widget("mobile.page", { + return constructor.initSelector = undefined5 !== constructor.prototype.initSelector ? constructor.prototype.initSelector : ":jqmData(role='" + name + "')", $14.mobile.widgets[name] = constructor, constructor; + }, $14.extend($14.widget, originalWidget), $14.mobile.document.on("create", function(event) { + $14(event.target).enhanceWithin(); + }), $14.widget("mobile.page", { options: { theme: "a", domCache: !1, - keepNativeDefault: $13.mobile.keepNative, + keepNativeDefault: $14.mobile.keepNative, contentTheme: null, enhanced: !1 }, _createWidget: function() { - $13.Widget.prototype._createWidget.apply(this, arguments), this._trigger("init"); + $14.Widget.prototype._createWidget.apply(this, arguments), this._trigger("init"); }, _create: function() { if (!1 === this._trigger("beforecreate")) return !1; this.options.enhanced || this._enhance(), this._on(this.element, { pagebeforehide: "removeContainerBackground", pagebeforeshow: "_handlePageBeforeShow" - }), this.element.enhanceWithin(), "dialog" === $13.mobile.getAttribute(this.element[0], "role") && $13.mobile.dialog && this.element.dialog(); + }), this.element.enhanceWithin(), "dialog" === $14.mobile.getAttribute(this.element[0], "role") && $14.mobile.dialog && this.element.dialog(); }, _enhance: function() { - var attrPrefix = "data-" + $13.mobile.ns, self = this; - this.options.role && this.element.attr("data-" + $13.mobile.ns + "role", this.options.role), this.element.attr("tabindex", "0").addClass("ui-page ui-page-theme-" + this.options.theme), this.element.find("[" + attrPrefix + "role='content']").each(function() { - var $this = $13(this), theme = this.getAttribute(attrPrefix + "theme") || undefined5; + var attrPrefix = "data-" + $14.mobile.ns, self = this; + this.options.role && this.element.attr("data-" + $14.mobile.ns + "role", this.options.role), this.element.attr("tabindex", "0").addClass("ui-page ui-page-theme-" + this.options.theme), this.element.find("[" + attrPrefix + "role='content']").each(function() { + var $this = $14(this), theme = this.getAttribute(attrPrefix + "theme") || undefined5; self.options.contentTheme = theme || self.options.contentTheme || self.options.dialog && self.options.theme || "dialog" === self.element.jqmData("role") && self.options.theme, $this.addClass("ui-content"), self.options.contentTheme && $this.addClass("ui-body-" + self.options.contentTheme), $this.attr("role", "main").addClass("ui-content"); }); }, @@ -1279,13 +1276,13 @@ var page = this.element; !page.data("mobile-page").options.domCache && page.is(":jqmData(external-page='true')") && page.bind("pagehide.remove", callback || function(e, data) { if (!data.samePage) { - var $this = $13(this), prEvent = new $13.Event("pageremove"); + var $this = $14(this), prEvent = new $14.Event("pageremove"); $this.trigger(prEvent), prEvent.isDefaultPrevented() || $this.removeWithDependents(); } }); }, _setOptions: function(o) { - undefined5 !== o.theme && this.element.removeClass("ui-page-theme-" + this.options.theme).addClass("ui-page-theme-" + o.theme), undefined5 !== o.contentTheme && this.element.find("[data-" + $13.mobile.ns + "='content']").removeClass("ui-body-" + this.options.contentTheme).addClass("ui-body-" + o.contentTheme); + undefined5 !== o.theme && this.element.removeClass("ui-page-theme-" + this.options.theme).addClass("ui-page-theme-" + o.theme), undefined5 !== o.contentTheme && this.element.find("[data-" + $14.mobile.ns + "='content']").removeClass("ui-body-" + this.options.contentTheme).addClass("ui-body-" + o.contentTheme); }, _handlePageBeforeShow: function() { this.setContainerBackground(); @@ -1301,7 +1298,7 @@ }); }, keepNativeSelector: function() { - var options = this.options, keepNative = $13.trim(options.keepNative || ""), globalValue = $13.trim($13.mobile.keepNative), optionValue = $13.trim(options.keepNativeDefault), newDefault = keepNativeFactoryDefault === globalValue ? "" : globalValue, oldDefault = "" === newDefault ? optionValue : ""; + var options = this.options, keepNative = $14.trim(options.keepNative || ""), globalValue = $14.trim($14.mobile.keepNative), optionValue = $14.trim(options.keepNativeDefault), newDefault = keepNativeFactoryDefault === globalValue ? "" : globalValue, oldDefault = "" === newDefault ? optionValue : ""; return (keepNative ? [ keepNative ] : []).concat(newDefault ? [ @@ -1310,7 +1307,7 @@ oldDefault ] : []).join(", "); } - }), ($14 = jQuery).widget("mobile.pagecontainer", { + }), ($15 = jQuery).widget("mobile.pagecontainer", { options: { theme: "a" }, @@ -1323,7 +1320,7 @@ navigate: "_filterNavigateEvents" }), this._on({ pagechange: "_afterContentChange" - }), this.window.one("navigate", $14.proxy(function() { + }), this.window.one("navigate", $15.proxy(function() { this.setLastScrollEnabled = !0; }, this)); }, @@ -1348,38 +1345,38 @@ } }, _delayedRecordScroll: function() { - setTimeout($14.proxy(this, "_recordScroll"), 100); + setTimeout($15.proxy(this, "_recordScroll"), 100); }, _getScroll: function() { return this.window.scrollTop(); }, _getMinScroll: function() { - return $14.mobile.minScrollBack; + return $15.mobile.minScrollBack; }, _getDefaultScroll: function() { - return $14.mobile.defaultHomeScroll; + return $15.mobile.defaultHomeScroll; }, _filterNavigateEvents: function(e, data) { var url; - e.originalEvent && e.originalEvent.isDefaultPrevented() || ((url = e.originalEvent.type.indexOf("hashchange") > -1 ? data.state.hash : data.state.url) || (url = this._getHash()), url && "#" !== url && 0 !== url.indexOf("#" + $14.mobile.path.uiStateKey) || (url = location.href), this._handleNavigate(url, data.state)); + e.originalEvent && e.originalEvent.isDefaultPrevented() || ((url = e.originalEvent.type.indexOf("hashchange") > -1 ? data.state.hash : data.state.url) || (url = this._getHash()), url && "#" !== url && 0 !== url.indexOf("#" + $15.mobile.path.uiStateKey) || (url = location.href), this._handleNavigate(url, data.state)); }, _getHash: function() { - return $14.mobile.path.parseLocation().hash; + return $15.mobile.path.parseLocation().hash; }, getActivePage: function() { return this.activePage; }, _getInitialContent: function() { - return $14.mobile.firstPage; + return $15.mobile.firstPage; }, _getHistory: function() { - return $14.mobile.navigate.history; + return $15.mobile.navigate.history; }, _getActiveHistory: function() { - return $14.mobile.navigate.history.getActive(); + return $15.mobile.navigate.history.getActive(); }, _getDocumentBase: function() { - return $14.mobile.path.documentBase; + return $15.mobile.path.documentBase; }, back: function() { this.go(-1); @@ -1388,10 +1385,10 @@ this.go(1); }, go: function(steps) { - if ($14.mobile.hashListeningEnabled) window3.history.go(steps); + if ($15.mobile.hashListeningEnabled) window3.history.go(steps); else { - var activeIndex = $14.mobile.navigate.history.activeIndex, index = activeIndex + parseInt(steps, 10), url = $14.mobile.navigate.history.stack[index].url, direction = steps >= 1 ? "forward" : "back"; - $14.mobile.navigate.history.activeIndex = index, $14.mobile.navigate.history.previousIndex = activeIndex, this.change(url, { + var activeIndex = $15.mobile.navigate.history.activeIndex, index = activeIndex + parseInt(steps, 10), url = $15.mobile.navigate.history.stack[index].url, direction = steps >= 1 ? "forward" : "back"; + $15.mobile.navigate.history.activeIndex = index, $15.mobile.navigate.history.previousIndex = activeIndex, this.change(url, { direction: direction, changeHash: !1, fromHashChange: !0 @@ -1400,34 +1397,34 @@ }, _handleDestination: function(to) { var history; - return "string" === $14.type(to) && (to = $14.mobile.path.stripHash(to)), to && (history = this._getHistory(), (to = $14.mobile.path.isPath(to) ? to : $14.mobile.path.makeUrlAbsolute("#" + to, this._getDocumentBase())) === $14.mobile.path.makeUrlAbsolute("#" + history.initialDst, this._getDocumentBase()) && history.stack.length && history.stack[0].url !== history.initialDst.replace($14.mobile.dialogHashKey, "") && (to = this._getInitialContent())), to || this._getInitialContent(); + return "string" === $15.type(to) && (to = $15.mobile.path.stripHash(to)), to && (history = this._getHistory(), (to = $15.mobile.path.isPath(to) ? to : $15.mobile.path.makeUrlAbsolute("#" + to, this._getDocumentBase())) === $15.mobile.path.makeUrlAbsolute("#" + history.initialDst, this._getDocumentBase()) && history.stack.length && history.stack[0].url !== history.initialDst.replace($15.mobile.dialogHashKey, "") && (to = this._getInitialContent())), to || this._getInitialContent(); }, _handleDialog: function(changePageOptions, data) { var to, active, activeContent = this.getActivePage(); - return activeContent && !activeContent.hasClass("ui-dialog") ? ("back" === data.direction ? this.back() : this.forward(), !1) : (to = data.pageUrl, active = this._getActiveHistory(), $14.extend(changePageOptions, { + return activeContent && !activeContent.hasClass("ui-dialog") ? ("back" === data.direction ? this.back() : this.forward(), !1) : (to = data.pageUrl, active = this._getActiveHistory(), $15.extend(changePageOptions, { role: active.role, transition: active.transition, reverse: "back" === data.direction }), to); }, _handleNavigate: function(url, data) { - var to = $14.mobile.path.stripHash(url), history = this._getHistory(), transition = 0 === history.stack.length ? "none" : undefined6, changePageOptions = { + var to = $15.mobile.path.stripHash(url), history = this._getHistory(), transition = 0 === history.stack.length ? "none" : undefined6, changePageOptions = { changeHash: !1, fromHashChange: !0, reverse: "back" === data.direction }; - $14.extend(changePageOptions, data, { + $15.extend(changePageOptions, data, { transition: (history.getLast() || {}).transition || transition - }), history.activeIndex > 0 && to.indexOf($14.mobile.dialogHashKey) > -1 && history.initialDst !== to && !1 === (to = this._handleDialog(changePageOptions, data)) || this._changeContent(this._handleDestination(to), changePageOptions); + }), history.activeIndex > 0 && to.indexOf($15.mobile.dialogHashKey) > -1 && history.initialDst !== to && !1 === (to = this._handleDialog(changePageOptions, data)) || this._changeContent(this._handleDestination(to), changePageOptions); }, _changeContent: function(to, opts) { - $14.mobile.changePage(to, opts); + $15.mobile.changePage(to, opts); }, _getBase: function() { - return $14.mobile.base; + return $15.mobile.base; }, _getNs: function() { - return $14.mobile.ns; + return $15.mobile.ns; }, _enhance: function(content, role) { return content.page({ @@ -1439,13 +1436,13 @@ }, _find: function(absUrl) { var page, fileUrl = this._createFileUrl(absUrl), dataUrl = this._createDataUrl(absUrl), initialContent = this._getInitialContent(); - return 0 === (page = this.element.children("[data-" + this._getNs() + "url='" + dataUrl + "']")).length && dataUrl && !$14.mobile.path.isPath(dataUrl) && (page = this.element.children($14.mobile.path.hashToSelector("#" + dataUrl)).attr("data-" + this._getNs() + "url", dataUrl).jqmData("url", dataUrl)), 0 === page.length && $14.mobile.path.isFirstPageUrl(fileUrl) && initialContent && initialContent.parent().length && (page = $14(initialContent)), page; + return 0 === (page = this.element.children("[data-" + this._getNs() + "url='" + dataUrl + "']")).length && dataUrl && !$15.mobile.path.isPath(dataUrl) && (page = this.element.children($15.mobile.path.hashToSelector("#" + dataUrl)).attr("data-" + this._getNs() + "url", dataUrl).jqmData("url", dataUrl)), 0 === page.length && $15.mobile.path.isFirstPageUrl(fileUrl) && initialContent && initialContent.parent().length && (page = $15(initialContent)), page; }, _getLoader: function() { - return $14.mobile.loading(); + return $15.mobile.loading(); }, _showLoading: function(delay, theme, msg, textonly) { - this._loadMsg || (this._loadMsg = setTimeout($14.proxy(function() { + this._loadMsg || (this._loadMsg = setTimeout($15.proxy(function() { this._getLoader().loader("show", theme, msg, textonly), this._loadMsg = 0; }, this), delay)); }, @@ -1453,27 +1450,27 @@ clearTimeout(this._loadMsg), this._loadMsg = 0, this._getLoader().loader("hide"); }, _showError: function() { - this._hideLoading(), this._showLoading(0, $14.mobile.pageLoadErrorMessageTheme, $14.mobile.pageLoadErrorMessage, !0), setTimeout($14.proxy(this, "_hideLoading"), 1500); + this._hideLoading(), this._showLoading(0, $15.mobile.pageLoadErrorMessageTheme, $15.mobile.pageLoadErrorMessage, !0), setTimeout($15.proxy(this, "_hideLoading"), 1500); }, _parse: function(html, fileUrl) { - var page, all = $14("
"); - return all.get(0).innerHTML = html, (page = all.find(":jqmData(role='page'), :jqmData(role='dialog')").first()).length || (page = $14("
" + (html.split(/<\/?body[^>]*>/gmi)[1] || "") + "
")), page.attr("data-" + this._getNs() + "url", $14.mobile.path.convertUrlToDataUrl(fileUrl)).attr("data-" + this._getNs() + "external-page", !0), page; + var page, all = $15("
"); + return all.get(0).innerHTML = html, (page = all.find(":jqmData(role='page'), :jqmData(role='dialog')").first()).length || (page = $15("
" + (html.split(/<\/?body[^>]*>/gmi)[1] || "") + "
")), page.attr("data-" + this._getNs() + "url", $15.mobile.path.convertUrlToDataUrl(fileUrl)).attr("data-" + this._getNs() + "external-page", !0), page; }, _setLoadedTitle: function(page, html) { var newPageTitle = html.match(/]*>([^<]*)/) && RegExp.$1; - newPageTitle && !page.jqmData("title") && (newPageTitle = $14("
" + newPageTitle + "
").text(), page.jqmData("title", newPageTitle)); + newPageTitle && !page.jqmData("title") && (newPageTitle = $15("
" + newPageTitle + "
").text(), page.jqmData("title", newPageTitle)); }, _isRewritableBaseTag: function() { - return $14.mobile.dynamicBaseEnabled && !$14.support.dynamicBaseTag; + return $15.mobile.dynamicBaseEnabled && !$15.support.dynamicBaseTag; }, _createDataUrl: function(absoluteUrl) { - return $14.mobile.path.convertUrlToDataUrl(absoluteUrl); + return $15.mobile.path.convertUrlToDataUrl(absoluteUrl); }, _createFileUrl: function(absoluteUrl) { - return $14.mobile.path.getFilePath(absoluteUrl); + return $15.mobile.path.getFilePath(absoluteUrl); }, _triggerWithDeprecated: function(name, data, page) { - var deprecatedEvent = $14.Event("page" + name), newEvent = $14.Event(this.widgetName + name); + var deprecatedEvent = $15.Event("page" + name), newEvent = $15.Event(this.widgetName + name); return (page || this.element).trigger(deprecatedEvent, data), this.element.trigger(newEvent, data), { deprecatedEvent: deprecatedEvent, event: newEvent @@ -1481,9 +1478,9 @@ }, _loadSuccess: function(absUrl, triggerData, settings, deferred) { var fileUrl = this._createFileUrl(absUrl), dataUrl = this._createDataUrl(absUrl); - return $14.proxy(function(html, textStatus, xhr) { + return $15.proxy(function(html, textStatus, xhr) { var content, pageElemRegex = new RegExp("(<[^>]+\\bdata-" + this._getNs() + "role=[\"']?page[\"']?[^>]*>)"), dataUrlRegex = new RegExp("\\bdata-" + this._getNs() + "url=[\"']?([^\"'>]*)[\"']?"); - pageElemRegex.test(html) && RegExp.$1 && dataUrlRegex.test(RegExp.$1) && RegExp.$1 && (fileUrl = $14.mobile.path.getFilePath($14("
" + RegExp.$1 + "
").text())), undefined6 === settings.prefetch && this._getBase().set(fileUrl), content = this._parse(html, fileUrl), this._setLoadedTitle(content, html), triggerData.xhr = xhr, triggerData.textStatus = textStatus, triggerData.page = content, triggerData.content = content, this._trigger("load", undefined6, triggerData) && (this._isRewritableBaseTag() && content && this._getBase().rewrite(fileUrl, content), this._include(content, settings), absUrl.indexOf("&" + $14.mobile.subPageUrlKey) > -1 && (content = this.element.children("[data-" + this._getNs() + "url='" + dataUrl + "']")), settings.showLoadMsg && this._hideLoading(), this.element.trigger("pageload"), deferred.resolve(absUrl, settings, content)); + pageElemRegex.test(html) && RegExp.$1 && dataUrlRegex.test(RegExp.$1) && RegExp.$1 && (fileUrl = $15.mobile.path.getFilePath($15("
" + RegExp.$1 + "
").text())), undefined6 === settings.prefetch && this._getBase().set(fileUrl), content = this._parse(html, fileUrl), this._setLoadedTitle(content, html), triggerData.xhr = xhr, triggerData.textStatus = textStatus, triggerData.page = content, triggerData.content = content, this._trigger("load", undefined6, triggerData) && (this._isRewritableBaseTag() && content && this._getBase().rewrite(fileUrl, content), this._include(content, settings), absUrl.indexOf("&" + $15.mobile.subPageUrlKey) > -1 && (content = this.element.children("[data-" + this._getNs() + "url='" + dataUrl + "']")), settings.showLoadMsg && this._hideLoading(), this.element.trigger("pageload"), deferred.resolve(absUrl, settings, content)); }, this); }, _loadDefaults: { @@ -1496,8 +1493,8 @@ loadMsgDelay: 50 }, load: function(url, options) { - var fileUrl, dataUrl, pblEvent, triggerData, deferred = options && options.deferred || $14.Deferred(), settings = $14.extend({}, this._loadDefaults, options), content = null, absUrl = $14.mobile.path.makeUrlAbsolute(url, this._findBaseWithDefault()); - if (settings.reload = settings.reloadPage, settings.data && "get" === settings.type && (absUrl = $14.mobile.path.addSearchParams(absUrl, settings.data), settings.data = undefined6), settings.data && "post" === settings.type && (settings.reload = !0), fileUrl = this._createFileUrl(absUrl), dataUrl = this._createDataUrl(absUrl), 0 === (content = this._find(absUrl)).length && $14.mobile.path.isEmbeddedPage(fileUrl) && !$14.mobile.path.isFirstPageUrl(fileUrl)) { + var fileUrl, dataUrl, pblEvent, triggerData, deferred = options && options.deferred || $15.Deferred(), settings = $15.extend({}, this._loadDefaults, options), content = null, absUrl = $15.mobile.path.makeUrlAbsolute(url, this._findBaseWithDefault()); + if (settings.reload = settings.reloadPage, settings.data && "get" === settings.type && (absUrl = $15.mobile.path.addSearchParams(absUrl, settings.data), settings.data = undefined6), settings.data && "post" === settings.type && (settings.reload = !0), fileUrl = this._createFileUrl(absUrl), dataUrl = this._createDataUrl(absUrl), 0 === (content = this._find(absUrl)).length && $15.mobile.path.isEmbeddedPage(fileUrl) && !$15.mobile.path.isFirstPageUrl(fileUrl)) { deferred.reject(absUrl, settings); return; } @@ -1512,11 +1509,11 @@ deferred: deferred, options: settings }, !((pblEvent = this._triggerWithDeprecated("beforeload", triggerData)).deprecatedEvent.isDefaultPrevented() || pblEvent.event.isDefaultPrevented())) { - if (settings.showLoadMsg && this._showLoading(settings.loadMsgDelay), undefined6 === settings.prefetch && this._getBase().reset(), !($14.mobile.allowCrossDomainPages || $14.mobile.path.isSameDomain($14.mobile.path.documentUrl, absUrl))) { + if (settings.showLoadMsg && this._showLoading(settings.loadMsgDelay), undefined6 === settings.prefetch && this._getBase().reset(), !($15.mobile.allowCrossDomainPages || $15.mobile.path.isSameDomain($15.mobile.path.documentUrl, absUrl))) { deferred.reject(absUrl, settings); return; } - $14.ajax({ + $15.ajax({ url: fileUrl, type: settings.type, data: settings.data, @@ -1528,14 +1525,14 @@ } }, _loadError: function(absUrl, triggerData, settings, deferred) { - return $14.proxy(function(xhr, textStatus, errorThrown) { - this._getBase().set($14.mobile.path.get()), triggerData.xhr = xhr, triggerData.textStatus = textStatus, triggerData.errorThrown = errorThrown; + return $15.proxy(function(xhr, textStatus, errorThrown) { + this._getBase().set($15.mobile.path.get()), triggerData.xhr = xhr, triggerData.textStatus = textStatus, triggerData.errorThrown = errorThrown; var plfEvent = this._triggerWithDeprecated("loadfailed", triggerData); plfEvent.deprecatedEvent.isDefaultPrevented() || plfEvent.event.isDefaultPrevented() || (settings.showLoadMsg && this._showError(), deferred.reject(absUrl, settings)); }, this); }, _getTransitionHandler: function(transition) { - return transition = $14.mobile._maybeDegradeTransition(transition), $14.mobile.transitionHandlers[transition] || $14.mobile.defaultTransitionHandler; + return transition = $15.mobile._maybeDegradeTransition(transition), $15.mobile.transitionHandlers[transition] || $15.mobile.defaultTransitionHandler; }, _triggerCssTransitionEvents: function(to, from, prefix) { var samePage = !1; @@ -1543,44 +1540,44 @@ nextPage: to, samePage: samePage }, from)), this._triggerWithDeprecated(prefix + "show", { - prevPage: from || $14("") + prevPage: from || $15("") }, to); }, _cssTransition: function(to, from, options) { var promise, transition = options.transition, reverse = options.reverse, deferred = options.deferred; this._triggerCssTransitionEvents(to, from, "before"), this._hideLoading(), (promise = new (this._getTransitionHandler(transition))(transition, reverse, to, from).transition()).done(function() { deferred.resolve.apply(deferred, arguments); - }), promise.done($14.proxy(function() { + }), promise.done($15.proxy(function() { this._triggerCssTransitionEvents(to, from); }, this)); }, _releaseTransitionLock: function() { - isPageTransitioning = !1, pageTransitionQueue.length > 0 && $14.mobile.changePage.apply(null, pageTransitionQueue.pop()); + isPageTransitioning = !1, pageTransitionQueue.length > 0 && $15.mobile.changePage.apply(null, pageTransitionQueue.pop()); }, _removeActiveLinkClass: function(force) { - $14.mobile.removeActiveLinkClass(force); + $15.mobile.removeActiveLinkClass(force); }, _loadUrl: function(to, triggerData, settings) { - settings.target = to, settings.deferred = $14.Deferred(), this.load(to, settings), settings.deferred.done($14.proxy(function(url, options, content) { + settings.target = to, settings.deferred = $15.Deferred(), this.load(to, settings), settings.deferred.done($15.proxy(function(url, options, content) { isPageTransitioning = !1, options.absUrl = triggerData.absUrl, this.transition(content, triggerData, options); - }, this)), settings.deferred.fail($14.proxy(function() { + }, this)), settings.deferred.fail($15.proxy(function() { this._removeActiveLinkClass(!0), this._releaseTransitionLock(), this._triggerWithDeprecated("changefailed", triggerData); }, this)); }, _triggerPageBeforeChange: function(to, triggerData, settings) { - var pbcEvent = new $14.Event("pagebeforechange"); - return $14.extend(triggerData, { + var pbcEvent = new $15.Event("pagebeforechange"); + return $15.extend(triggerData, { toPage: to, options: settings - }), "string" === $14.type(to) ? triggerData.absUrl = $14.mobile.path.makeUrlAbsolute(to, this._findBaseWithDefault()) : triggerData.absUrl = settings.absUrl, this.element.trigger(pbcEvent, triggerData), !pbcEvent.isDefaultPrevented(); + }), "string" === $15.type(to) ? triggerData.absUrl = $15.mobile.path.makeUrlAbsolute(to, this._findBaseWithDefault()) : triggerData.absUrl = settings.absUrl, this.element.trigger(pbcEvent, triggerData), !pbcEvent.isDefaultPrevented(); }, change: function(to, options) { if (isPageTransitioning) { pageTransitionQueue.unshift(arguments); return; } - var settings = $14.extend({}, $14.mobile.changePage.defaults, options), triggerData = {}; - settings.fromPage = settings.fromPage || this.activePage, this._triggerPageBeforeChange(to, triggerData, settings) && (to = triggerData.toPage, "string" === $14.type(to) ? (isPageTransitioning = !0, this._loadUrl(to, triggerData, settings)) : this.transition(to, triggerData, settings)); + var settings = $15.extend({}, $15.mobile.changePage.defaults, options), triggerData = {}; + settings.fromPage = settings.fromPage || this.activePage, this._triggerPageBeforeChange(to, triggerData, settings) && (to = triggerData.toPage, "string" === $15.type(to) ? (isPageTransitioning = !0, this._loadUrl(to, triggerData, settings)) : this.transition(to, triggerData, settings)); }, transition: function(toPage, triggerData, settings) { var fromPage, url, pageUrl, active, activeIsInitialPage, historyDir, pageTitle, isDialog, alreadyThere, newPageTitle, params, cssTransitionDeferred, beforeTransition; @@ -1592,8 +1589,8 @@ return; } if (this._triggerPageBeforeChange(toPage, triggerData, settings) && !((beforeTransition = this._triggerWithDeprecated("beforetransition", triggerData)).deprecatedEvent.isDefaultPrevented() || beforeTransition.event.isDefaultPrevented())) { - if (isPageTransitioning = !0, toPage[0] !== $14.mobile.firstPage[0] || settings.dataUrl || (settings.dataUrl = $14.mobile.path.documentUrl.hrefNoHash), fromPage = settings.fromPage, url = settings.dataUrl && $14.mobile.path.convertUrlToDataUrl(settings.dataUrl) || toPage.jqmData("url"), pageUrl = url, $14.mobile.path.getFilePath(url), active = $14.mobile.navigate.history.getActive(), activeIsInitialPage = 0 === $14.mobile.navigate.history.activeIndex, historyDir = 0, pageTitle = document1.title, isDialog = ("dialog" === settings.role || "dialog" === toPage.jqmData("role")) && !0 !== toPage.jqmData("dialog"), fromPage && fromPage[0] === toPage[0] && !settings.allowSamePageTransition) { - isPageTransitioning = !1, this._triggerWithDeprecated("transition", triggerData), this.element.trigger("pagechange", triggerData), settings.fromHashChange && $14.mobile.navigate.history.direct({ + if (isPageTransitioning = !0, toPage[0] !== $15.mobile.firstPage[0] || settings.dataUrl || (settings.dataUrl = $15.mobile.path.documentUrl.hrefNoHash), fromPage = settings.fromPage, url = settings.dataUrl && $15.mobile.path.convertUrlToDataUrl(settings.dataUrl) || toPage.jqmData("url"), pageUrl = url, $15.mobile.path.getFilePath(url), active = $15.mobile.navigate.history.getActive(), activeIsInitialPage = 0 === $15.mobile.navigate.history.activeIndex, historyDir = 0, pageTitle = document1.title, isDialog = ("dialog" === settings.role || "dialog" === toPage.jqmData("role")) && !0 !== toPage.jqmData("dialog"), fromPage && fromPage[0] === toPage[0] && !settings.allowSamePageTransition) { + isPageTransitioning = !1, this._triggerWithDeprecated("transition", triggerData), this.element.trigger("pagechange", triggerData), settings.fromHashChange && $15.mobile.navigate.history.direct({ url: url }); return; @@ -1602,26 +1599,26 @@ role: settings.role }), settings.fromHashChange && (historyDir = "back" === settings.direction ? -1 : 1); try { - document1.activeElement && "body" !== document1.activeElement.nodeName.toLowerCase() ? $14(document1.activeElement).blur() : $14("input:focus, textarea:focus, select:focus").blur(); + document1.activeElement && "body" !== document1.activeElement.nodeName.toLowerCase() ? $15(document1.activeElement).blur() : $15("input:focus, textarea:focus, select:focus").blur(); } catch (e) {} - alreadyThere = !1, isDialog && active && (active.url && active.url.indexOf($14.mobile.dialogHashKey) > -1 && this.activePage && !this.activePage.hasClass("ui-dialog") && $14.mobile.navigate.history.activeIndex > 0 && (settings.changeHash = !1, alreadyThere = !0), url = active.url || "", !alreadyThere && url.indexOf("#") > -1 ? url += $14.mobile.dialogHashKey : url += "#" + $14.mobile.dialogHashKey, 0 === $14.mobile.navigate.history.activeIndex && url === $14.mobile.navigate.history.initialDst && (url += $14.mobile.dialogHashKey)), (newPageTitle = active ? toPage.jqmData("title") || toPage.children(":jqmData(role='header')").find(".ui-title").text() : pageTitle) && pageTitle === document1.title && (pageTitle = newPageTitle), toPage.jqmData("title") || toPage.jqmData("title", pageTitle), settings.transition = settings.transition || (historyDir && !activeIsInitialPage ? active.transition : undefined6) || (isDialog ? $14.mobile.defaultDialogTransition : $14.mobile.defaultPageTransition), !historyDir && alreadyThere && ($14.mobile.navigate.history.getActive().pageUrl = pageUrl), url && !settings.fromHashChange && (!$14.mobile.path.isPath(url) && 0 > url.indexOf("#") && (url = "#" + url), params = { + alreadyThere = !1, isDialog && active && (active.url && active.url.indexOf($15.mobile.dialogHashKey) > -1 && this.activePage && !this.activePage.hasClass("ui-dialog") && $15.mobile.navigate.history.activeIndex > 0 && (settings.changeHash = !1, alreadyThere = !0), url = active.url || "", !alreadyThere && url.indexOf("#") > -1 ? url += $15.mobile.dialogHashKey : url += "#" + $15.mobile.dialogHashKey, 0 === $15.mobile.navigate.history.activeIndex && url === $15.mobile.navigate.history.initialDst && (url += $15.mobile.dialogHashKey)), (newPageTitle = active ? toPage.jqmData("title") || toPage.children(":jqmData(role='header')").find(".ui-title").text() : pageTitle) && pageTitle === document1.title && (pageTitle = newPageTitle), toPage.jqmData("title") || toPage.jqmData("title", pageTitle), settings.transition = settings.transition || (historyDir && !activeIsInitialPage ? active.transition : undefined6) || (isDialog ? $15.mobile.defaultDialogTransition : $15.mobile.defaultPageTransition), !historyDir && alreadyThere && ($15.mobile.navigate.history.getActive().pageUrl = pageUrl), url && !settings.fromHashChange && (!$15.mobile.path.isPath(url) && 0 > url.indexOf("#") && (url = "#" + url), params = { transition: settings.transition, title: pageTitle, pageUrl: pageUrl, role: settings.role - }, !1 !== settings.changeHash && $14.mobile.hashListeningEnabled ? $14.mobile.navigate(url, params, !0) : toPage[0] !== $14.mobile.firstPage[0] && $14.mobile.navigate.history.add(url, params)), document1.title = pageTitle, $14.mobile.activePage = toPage, this.activePage = toPage, settings.reverse = settings.reverse || historyDir < 0, cssTransitionDeferred = $14.Deferred(), this._cssTransition(toPage, fromPage, { + }, !1 !== settings.changeHash && $15.mobile.hashListeningEnabled ? $15.mobile.navigate(url, params, !0) : toPage[0] !== $15.mobile.firstPage[0] && $15.mobile.navigate.history.add(url, params)), document1.title = pageTitle, $15.mobile.activePage = toPage, this.activePage = toPage, settings.reverse = settings.reverse || historyDir < 0, cssTransitionDeferred = $15.Deferred(), this._cssTransition(toPage, fromPage, { transition: settings.transition, reverse: settings.reverse, deferred: cssTransitionDeferred - }), cssTransitionDeferred.done($14.proxy(function(name, reverse, $to, $from, alreadyFocused) { - $14.mobile.removeActiveLinkClass(), settings.duplicateCachedPage && settings.duplicateCachedPage.remove(), alreadyFocused || $14.mobile.focusPage(toPage), this._releaseTransitionLock(), this.element.trigger("pagechange", triggerData), this._triggerWithDeprecated("transition", triggerData); + }), cssTransitionDeferred.done($15.proxy(function(name, reverse, $to, $from, alreadyFocused) { + $15.mobile.removeActiveLinkClass(), settings.duplicateCachedPage && settings.duplicateCachedPage.remove(), alreadyFocused || $15.mobile.focusPage(toPage), this._releaseTransitionLock(), this.element.trigger("pagechange", triggerData), this._triggerWithDeprecated("transition", triggerData); }, this)); } }, _findBaseWithDefault: function() { - return this.activePage && $14.mobile.getClosestBaseUrl(this.activePage) || $14.mobile.path.documentBase.hrefNoHash; + return this.activePage && $15.mobile.getClosestBaseUrl(this.activePage) || $15.mobile.path.documentBase.hrefNoHash; } - }), $14.mobile.navreadyDeferred = $14.Deferred(), pageTransitionQueue = [], isPageTransitioning = !1, (function($, undefined) { + }), $15.mobile.navreadyDeferred = $15.Deferred(), pageTransitionQueue = [], isPageTransitioning = !1, (function($, undefined) { var domreadyDeferred = $.Deferred(), loadDeferred = $.Deferred(), documentUrl = $.mobile.path.documentUrl, $lastVClicked = null; function findClosestLink(ele) { for(; ele;){ @@ -1742,27 +1739,27 @@ }), $.when(domreadyDeferred, $.mobile.navreadyDeferred).done(function() { $.mobile._registerInternalEvents(); }); - })(jQuery), $15 = jQuery, window2 = this, $15.mobile.Transition = function() { + })(jQuery), $16 = jQuery, window2 = this, $16.mobile.Transition = function() { this.init.apply(this, arguments); - }, $15.extend($15.mobile.Transition.prototype, { + }, $16.extend($16.mobile.Transition.prototype, { toPreClass: " ui-page-pre-in", init: function(name, reverse, $to, $from) { - $15.extend(this, { + $16.extend(this, { name: name, reverse: reverse, $to: $to, $from: $from, - deferred: new $15.Deferred() + deferred: new $16.Deferred() }); }, cleanFrom: function() { - this.$from.removeClass($15.mobile.activePageClass + " out in reverse " + this.name).height(""); + this.$from.removeClass($16.mobile.activePageClass + " out in reverse " + this.name).height(""); }, beforeDoneIn: function() {}, beforeDoneOut: function() {}, beforeStartOut: function() {}, doneIn: function() { - this.beforeDoneIn(), this.$to.removeClass("out in reverse " + this.name).height(""), this.toggleViewportClass(), $15.mobile.window.scrollTop() !== this.toScroll && this.scrollPage(), this.sequential || this.$to.addClass($15.mobile.activePageClass), this.deferred.resolve(this.name, this.reverse, this.$to, this.$from, !0); + this.beforeDoneIn(), this.$to.removeClass("out in reverse " + this.name).height(""), this.toggleViewportClass(), $16.mobile.window.scrollTop() !== this.toScroll && this.scrollPage(), this.sequential || this.$to.addClass($16.mobile.activePageClass), this.deferred.resolve(this.name, this.reverse, this.$to, this.$from, !0); }, doneOut: function(screenHeight, reverseClass, none, preventFocus) { this.beforeDoneOut(), this.startIn(screenHeight, reverseClass, none, preventFocus); @@ -1771,42 +1768,42 @@ this.$to.css("z-index", -10), callback.call(this), this.$to.css("z-index", ""); }, scrollPage: function() { - $15.event.special.scrollstart.enabled = !1, ($15.mobile.hideUrlBar || this.toScroll !== $15.mobile.defaultHomeScroll) && window2.scrollTo(0, this.toScroll), setTimeout(function() { - $15.event.special.scrollstart.enabled = !0; + $16.event.special.scrollstart.enabled = !1, ($16.mobile.hideUrlBar || this.toScroll !== $16.mobile.defaultHomeScroll) && window2.scrollTo(0, this.toScroll), setTimeout(function() { + $16.event.special.scrollstart.enabled = !0; }, 150); }, startIn: function(screenHeight, reverseClass, none, preventFocus) { this.hideIn(function() { - this.$to.addClass($15.mobile.activePageClass + this.toPreClass), preventFocus || $15.mobile.focusPage(this.$to), this.$to.height(screenHeight + this.toScroll), none || this.scrollPage(); - }), this.$to.removeClass(this.toPreClass).addClass(this.name + " in " + reverseClass), none ? this.doneIn() : this.$to.animationComplete($15.proxy(function() { + this.$to.addClass($16.mobile.activePageClass + this.toPreClass), preventFocus || $16.mobile.focusPage(this.$to), this.$to.height(screenHeight + this.toScroll), none || this.scrollPage(); + }), this.$to.removeClass(this.toPreClass).addClass(this.name + " in " + reverseClass), none ? this.doneIn() : this.$to.animationComplete($16.proxy(function() { this.doneIn(); }, this)); }, startOut: function(screenHeight, reverseClass, none) { - this.beforeStartOut(screenHeight, reverseClass, none), this.$from.height(screenHeight + $15.mobile.window.scrollTop()).addClass(this.name + " out" + reverseClass); + this.beforeStartOut(screenHeight, reverseClass, none), this.$from.height(screenHeight + $16.mobile.window.scrollTop()).addClass(this.name + " out" + reverseClass); }, toggleViewportClass: function() { - $15.mobile.pageContainer.toggleClass("ui-mobile-viewport-transitioning viewport-" + this.name); + $16.mobile.pageContainer.toggleClass("ui-mobile-viewport-transitioning viewport-" + this.name); }, transition: function() { - var none, reverseClass = this.reverse ? " reverse" : "", screenHeight = $15.mobile.getScreenHeight(), maxTransitionOverride = !1 !== $15.mobile.maxTransitionWidth && $15.mobile.window.width() > $15.mobile.maxTransitionWidth; - return this.toScroll = $15.mobile.navigate.history.getActive().lastScroll || $15.mobile.defaultHomeScroll, none = !$15.support.cssTransitions || !$15.support.cssAnimations || maxTransitionOverride || !this.name || "none" === this.name || Math.max($15.mobile.window.scrollTop(), this.toScroll) > $15.mobile.getMaxScrollForTransition(), this.toggleViewportClass(), this.$from && !none ? this.startOut(screenHeight, reverseClass, none) : this.doneOut(screenHeight, reverseClass, none, !0), this.deferred.promise(); + var none, reverseClass = this.reverse ? " reverse" : "", screenHeight = $16.mobile.getScreenHeight(), maxTransitionOverride = !1 !== $16.mobile.maxTransitionWidth && $16.mobile.window.width() > $16.mobile.maxTransitionWidth; + return this.toScroll = $16.mobile.navigate.history.getActive().lastScroll || $16.mobile.defaultHomeScroll, none = !$16.support.cssTransitions || !$16.support.cssAnimations || maxTransitionOverride || !this.name || "none" === this.name || Math.max($16.mobile.window.scrollTop(), this.toScroll) > $16.mobile.getMaxScrollForTransition(), this.toggleViewportClass(), this.$from && !none ? this.startOut(screenHeight, reverseClass, none) : this.doneOut(screenHeight, reverseClass, none, !0), this.deferred.promise(); } - }), ($16 = jQuery).mobile.SerialTransition = function() { + }), ($17 = jQuery).mobile.SerialTransition = function() { this.init.apply(this, arguments); - }, $16.extend($16.mobile.SerialTransition.prototype, $16.mobile.Transition.prototype, { + }, $17.extend($17.mobile.SerialTransition.prototype, $17.mobile.Transition.prototype, { sequential: !0, beforeDoneOut: function() { this.$from && this.cleanFrom(); }, beforeStartOut: function(screenHeight, reverseClass, none) { - this.$from.animationComplete($16.proxy(function() { + this.$from.animationComplete($17.proxy(function() { this.doneOut(screenHeight, reverseClass, none); }, this)); } - }), ($17 = jQuery).mobile.ConcurrentTransition = function() { + }), ($18 = jQuery).mobile.ConcurrentTransition = function() { this.init.apply(this, arguments); - }, $17.extend($17.mobile.ConcurrentTransition.prototype, $17.mobile.Transition.prototype, { + }, $18.extend($18.mobile.ConcurrentTransition.prototype, $18.mobile.Transition.prototype, { sequential: !1, beforeDoneIn: function() { this.$from && this.cleanFrom(); @@ -1814,14 +1811,14 @@ beforeStartOut: function(screenHeight, reverseClass, none) { this.doneOut(screenHeight, reverseClass, none); } - }), ($18 = jQuery).mobile.transitionHandlers = { - sequential: $18.mobile.SerialTransition, - simultaneous: $18.mobile.ConcurrentTransition - }, $18.mobile.defaultTransitionHandler = $18.mobile.transitionHandlers.sequential, $18.mobile.transitionFallbacks = {}, $18.mobile._maybeDegradeTransition = function(transition) { - return transition && !$18.support.cssTransform3d && $18.mobile.transitionFallbacks[transition] && (transition = $18.mobile.transitionFallbacks[transition]), transition; - }, $18.mobile.getMaxScrollForTransition = $18.mobile.getMaxScrollForTransition || function() { - return 3 * $18.mobile.getScreenHeight(); - }, jQuery.mobile.transitionFallbacks.flip = "fade", jQuery.mobile.transitionFallbacks.flow = "fade", jQuery.mobile.transitionFallbacks.pop = "fade", ($19 = jQuery).mobile.transitionHandlers.slide = $19.mobile.transitionHandlers.simultaneous, $19.mobile.transitionFallbacks.slide = "fade", jQuery.mobile.transitionFallbacks.slidedown = "fade", jQuery.mobile.transitionFallbacks.slidefade = "fade", jQuery.mobile.transitionFallbacks.slideup = "fade", jQuery.mobile.transitionFallbacks.turn = "fade", ($20 = jQuery).mobile.degradeInputs = { + }), ($19 = jQuery).mobile.transitionHandlers = { + sequential: $19.mobile.SerialTransition, + simultaneous: $19.mobile.ConcurrentTransition + }, $19.mobile.defaultTransitionHandler = $19.mobile.transitionHandlers.sequential, $19.mobile.transitionFallbacks = {}, $19.mobile._maybeDegradeTransition = function(transition) { + return transition && !$19.support.cssTransform3d && $19.mobile.transitionFallbacks[transition] && (transition = $19.mobile.transitionFallbacks[transition]), transition; + }, $19.mobile.getMaxScrollForTransition = $19.mobile.getMaxScrollForTransition || function() { + return 3 * $19.mobile.getScreenHeight(); + }, jQuery.mobile.transitionFallbacks.flip = "fade", jQuery.mobile.transitionFallbacks.flow = "fade", jQuery.mobile.transitionFallbacks.pop = "fade", ($20 = jQuery).mobile.transitionHandlers.slide = $20.mobile.transitionHandlers.simultaneous, $20.mobile.transitionFallbacks.slide = "fade", jQuery.mobile.transitionFallbacks.slidedown = "fade", jQuery.mobile.transitionFallbacks.slidefade = "fade", jQuery.mobile.transitionFallbacks.slideup = "fade", jQuery.mobile.transitionFallbacks.turn = "fade", ($21 = jQuery).mobile.degradeInputs = { color: !1, date: !1, datetime: !1, @@ -1835,10 +1832,10 @@ time: !1, url: !1, week: !1 - }, $20.mobile.page.prototype.options.degradeInputs = $20.mobile.degradeInputs, $20.mobile.degradeInputsWithin = function(target) { - (target = $20(target)).find("input").not($20.mobile.page.prototype.keepNativeSelector()).each(function() { - var html, hasType, findstr, repstr, element = $20(this), type = this.getAttribute("type"), optType = $20.mobile.degradeInputs[type] || "text"; - $20.mobile.degradeInputs[type] && (findstr = (hasType = (html = $20("
").html(element.clone()).html()).indexOf(" type=") > -1) ? /\s+type=["']?\w+['"]?/ : /\/?>/, repstr = " type=\"" + optType + "\" data-" + $20.mobile.ns + "type=\"" + type + "\"" + (hasType ? "" : ">"), element.replaceWith(html.replace(findstr, repstr))); + }, $21.mobile.page.prototype.options.degradeInputs = $21.mobile.degradeInputs, $21.mobile.degradeInputsWithin = function(target) { + (target = $21(target)).find("input").not($21.mobile.page.prototype.keepNativeSelector()).each(function() { + var html, hasType, findstr, repstr, element = $21(this), type = this.getAttribute("type"), optType = $21.mobile.degradeInputs[type] || "text"; + $21.mobile.degradeInputs[type] && (findstr = (hasType = (html = $21("
").html(element.clone()).html()).indexOf(" type=") > -1) ? /\s+type=["']?\w+['"]?/ : /\/?>/, repstr = " type=\"" + optType + "\" data-" + $21.mobile.ns + "type=\"" + type + "\"" + (hasType ? "" : ">"), element.replaceWith(html.replace(findstr, repstr))); }); }, (function($, window, undefined) { $.widget("mobile.page", $.mobile.page, { @@ -1929,9 +1926,9 @@ this._isCloseable && (this._isCloseable = !1, $.mobile.hashListeningEnabled && hist.activeIndex > 0 ? $.mobile.back() : $.mobile.pageContainer.pagecontainer("back")); } }); - })(jQuery, this), $21 = jQuery, rInitialLetter = /([A-Z])/g, iconposClass1 = function(iconpos) { + })(jQuery, this), $22 = jQuery, rInitialLetter = /([A-Z])/g, iconposClass1 = function(iconpos) { return "ui-btn-icon-" + (null === iconpos ? "left" : iconpos); - }, $21.widget("mobile.collapsible", { + }, $22.widget("mobile.collapsible", { options: { enhanced: !1, expandCueText: null, @@ -1949,11 +1946,11 @@ }, _create: function() { var elem = this.element, ui = { - accordion: elem.closest(":jqmData(role='collapsible-set'),:jqmData(role='collapsibleset')" + ($21.mobile.collapsibleset ? ", :mobile-collapsibleset" : "")).addClass("ui-collapsible-set") + accordion: elem.closest(":jqmData(role='collapsible-set'),:jqmData(role='collapsibleset')" + ($22.mobile.collapsibleset ? ", :mobile-collapsibleset" : "")).addClass("ui-collapsible-set") }; - this._ui = ui, this._renderedOptions = this._getOptions(this.options), this.options.enhanced ? (ui.heading = $21(".ui-collapsible-heading", this.element[0]), ui.content = ui.heading.next(), ui.anchor = $21("a", ui.heading[0]).first(), ui.status = ui.anchor.children(".ui-collapsible-heading-status")) : this._enhance(elem, ui), this._on(ui.heading, { + this._ui = ui, this._renderedOptions = this._getOptions(this.options), this.options.enhanced ? (ui.heading = $22(".ui-collapsible-heading", this.element[0]), ui.content = ui.heading.next(), ui.anchor = $22("a", ui.heading[0]).first(), ui.status = ui.anchor.children(".ui-collapsible-heading-status")) : this._enhance(elem, ui), this._on(ui.heading, { tap: function() { - ui.heading.find("a").first().addClass($21.mobile.activeBtnClass); + ui.heading.find("a").first().addClass($22.mobile.activeBtnClass); }, click: function(event) { this._handleExpandCollapse(!ui.heading.hasClass("ui-collapsible-heading-collapsed")), event.preventDefault(), event.stopPropagation(); @@ -1962,7 +1959,7 @@ }, _getOptions: function(options) { var key, accordion = this._ui.accordion, accordionWidget = this._ui.accordionWidget; - for(key in options = $21.extend({}, options), accordion.length && !accordionWidget && (this._ui.accordionWidget = accordionWidget = accordion.data("mobile-collapsibleset")), options)options[key] = null != options[key] ? options[key] : accordionWidget ? accordionWidget.options[key] : accordion.length ? $21.mobile.getAttribute(accordion[0], key.replace(rInitialLetter, "-$1").toLowerCase()) : null, null == options[key] && (options[key] = $21.mobile.collapsible.defaults[key]); + for(key in options = $22.extend({}, options), accordion.length && !accordionWidget && (this._ui.accordionWidget = accordionWidget = accordion.data("mobile-collapsibleset")), options)options[key] = null != options[key] ? options[key] : accordionWidget ? accordionWidget.options[key] : accordion.length ? $22.mobile.getAttribute(accordion[0], key.replace(rInitialLetter, "-$1").toLowerCase()) : null, null == options[key] && (options[key] = $22.mobile.collapsible.defaults[key]); return options; }, _themeClassFromOption: function(prefix, value) { @@ -1970,7 +1967,7 @@ }, _enhance: function(elem, ui) { var iconclass, opts = this._renderedOptions, contentThemeClass = this._themeClassFromOption("ui-body-", opts.contentTheme); - return elem.addClass("ui-collapsible " + (opts.inset ? "ui-collapsible-inset " : "") + (opts.inset && opts.corners ? "ui-corner-all " : "") + (contentThemeClass ? "ui-collapsible-themed-content " : "")), ui.originalHeading = elem.children(this.options.heading).first(), ui.content = elem.wrapInner("
").children(".ui-collapsible-content"), ui.heading = ui.originalHeading, ui.heading.is("legend") && (ui.heading = $21("
" + ui.heading.html() + "
"), ui.placeholder = $21("
").insertBefore(ui.originalHeading), ui.originalHeading.remove()), iconclass = opts.collapsed ? opts.collapsedIcon ? "ui-icon-" + opts.collapsedIcon : "" : opts.expandedIcon ? "ui-icon-" + opts.expandedIcon : "", ui.status = $21(""), ui.anchor = ui.heading.detach().addClass("ui-collapsible-heading").append(ui.status).wrapInner("").find("a").first().addClass("ui-btn " + (iconclass ? iconclass + " " : "") + (iconclass ? iconposClass1(opts.iconpos) + " " : "") + this._themeClassFromOption("ui-btn-", opts.theme) + " " + (opts.mini ? "ui-mini " : "")), ui.heading.insertBefore(ui.content), this._handleExpandCollapse(this.options.collapsed), ui; + return elem.addClass("ui-collapsible " + (opts.inset ? "ui-collapsible-inset " : "") + (opts.inset && opts.corners ? "ui-corner-all " : "") + (contentThemeClass ? "ui-collapsible-themed-content " : "")), ui.originalHeading = elem.children(this.options.heading).first(), ui.content = elem.wrapInner("
").children(".ui-collapsible-content"), ui.heading = ui.originalHeading, ui.heading.is("legend") && (ui.heading = $22("
" + ui.heading.html() + "
"), ui.placeholder = $22("
").insertBefore(ui.originalHeading), ui.originalHeading.remove()), iconclass = opts.collapsed ? opts.collapsedIcon ? "ui-icon-" + opts.collapsedIcon : "" : opts.expandedIcon ? "ui-icon-" + opts.expandedIcon : "", ui.status = $22(""), ui.anchor = ui.heading.detach().addClass("ui-collapsible-heading").append(ui.status).wrapInner("").find("a").first().addClass("ui-btn " + (iconclass ? iconclass + " " : "") + (iconclass ? iconposClass1(opts.iconpos) + " " : "") + this._themeClassFromOption("ui-btn-", opts.theme) + " " + (opts.mini ? "ui-mini " : "")), ui.heading.insertBefore(ui.content), this._handleExpandCollapse(this.options.collapsed), ui; }, refresh: function() { this._applyOptions(this.options), this._renderedOptions = this._getOptions(this.options); @@ -1996,7 +1993,7 @@ }, _handleExpandCollapse: function(isCollapse) { var opts = this._renderedOptions, ui = this._ui; - ui.status.text(isCollapse ? opts.expandCueText : opts.collapseCueText), ui.heading.toggleClass("ui-collapsible-heading-collapsed", isCollapse).find("a").first().toggleClass("ui-icon-" + opts.expandedIcon, !isCollapse).toggleClass("ui-icon-" + opts.collapsedIcon, isCollapse || opts.expandedIcon === opts.collapsedIcon).removeClass($21.mobile.activeBtnClass), this.element.toggleClass("ui-collapsible-collapsed", isCollapse), ui.content.toggleClass("ui-collapsible-content-collapsed", isCollapse).attr("aria-hidden", isCollapse).trigger("updatelayout"), this.options.collapsed = isCollapse, this._trigger(isCollapse ? "collapse" : "expand"); + ui.status.text(isCollapse ? opts.expandCueText : opts.collapseCueText), ui.heading.toggleClass("ui-collapsible-heading-collapsed", isCollapse).find("a").first().toggleClass("ui-icon-" + opts.expandedIcon, !isCollapse).toggleClass("ui-icon-" + opts.collapsedIcon, isCollapse || opts.expandedIcon === opts.collapsedIcon).removeClass($22.mobile.activeBtnClass), this.element.toggleClass("ui-collapsible-collapsed", isCollapse), ui.content.toggleClass("ui-collapsible-content-collapsed", isCollapse).attr("aria-hidden", isCollapse).trigger("updatelayout"), this.options.collapsed = isCollapse, this._trigger(isCollapse ? "collapse" : "expand"); }, expand: function() { this._handleExpandCollapse(!1); @@ -2008,7 +2005,7 @@ var ui = this._ui; this.options.enhanced || (ui.placeholder ? (ui.originalHeading.insertBefore(ui.placeholder), ui.placeholder.remove(), ui.heading.remove()) : (ui.status.remove(), ui.heading.removeClass("ui-collapsible-heading ui-collapsible-heading-collapsed").children().contents().unwrap()), ui.anchor.contents().unwrap(), ui.content.contents().unwrap(), this.element.removeClass("ui-collapsible ui-collapsible-collapsed ui-collapsible-themed-content ui-collapsible-inset ui-corner-all")); } - }), $21.mobile.collapsible.defaults = { + }), $22.mobile.collapsible.defaults = { expandCueText: " click to expand contents", collapseCueText: " click to collapse contents", collapsedIcon: "plus", @@ -2073,9 +2070,9 @@ }, $.mobile.behaviors.addFirstLastClasses)); })(jQuery), jQuery.fn.fieldcontain = function() { return this.addClass("ui-field-contain"); - }, ($22 = jQuery).fn.grid = function(options) { + }, ($23 = jQuery).fn.grid = function(options) { return this.each(function() { - var iterator, letter, $this = $22(this), o = $22.extend({ + var iterator, letter, $this = $23(this), o = $23.extend({ grid: null }, options), $kids = $this.children(), gridCols = { solo: 1, @@ -2185,8 +2182,8 @@ if (this._superApply(arguments), this.options.hideDividers) for(idx = (items = this._getChildrenByTagName(this.element[0], "li", "LI")).length - 1; idx > -1; idx--)(item = items[idx]).className.match(rdivider) ? (hideDivider && (item.className = item.className + " ui-screen-hidden"), hideDivider = !0) : item.className.match(rhidden) || (hideDivider = !1); } }); - })(jQuery), ($23 = jQuery).mobile.nojs = function(target) { - $23(":jqmData(role='nojs')", target).addClass("ui-nojs"); + })(jQuery), ($24 = jQuery).mobile.nojs = function(target) { + $24(":jqmData(role='nojs')", target).addClass("ui-nojs"); }, jQuery.mobile.behaviors.formReset = { _handleFormReset: function() { this._on(this.element.closest("form"), { @@ -2350,17 +2347,17 @@ }); } }); - })(jQuery), disabledZoom = (initialContent1 = (meta = ($24 = jQuery)("meta[name=viewport]")).attr("content")) + ",maximum-scale=1, user-scalable=no", enabledZoom = initialContent1 + ",maximum-scale=10, user-scalable=yes", disabledInitially = /(user-scalable[\s]*=[\s]*no)|(maximum-scale[\s]*=[\s]*1)[$,\s]/.test(initialContent1), $24.mobile.zoom = $24.extend({}, { + })(jQuery), disabledZoom = (initialContent1 = (meta = ($25 = jQuery)("meta[name=viewport]")).attr("content")) + ",maximum-scale=1, user-scalable=no", enabledZoom = initialContent1 + ",maximum-scale=10, user-scalable=yes", disabledInitially = /(user-scalable[\s]*=[\s]*no)|(maximum-scale[\s]*=[\s]*1)[$,\s]/.test(initialContent1), $25.mobile.zoom = $25.extend({}, { enabled: !disabledInitially, locked: !1, disable: function(lock) { - disabledInitially || $24.mobile.zoom.locked || (meta.attr("content", disabledZoom), $24.mobile.zoom.enabled = !1, $24.mobile.zoom.locked = lock || !1); + disabledInitially || $25.mobile.zoom.locked || (meta.attr("content", disabledZoom), $25.mobile.zoom.enabled = !1, $25.mobile.zoom.locked = lock || !1); }, enable: function(unlock) { - disabledInitially || $24.mobile.zoom.locked && !0 !== unlock || (meta.attr("content", enabledZoom), $24.mobile.zoom.enabled = !0, $24.mobile.zoom.locked = !1); + disabledInitially || $25.mobile.zoom.locked && !0 !== unlock || (meta.attr("content", enabledZoom), $25.mobile.zoom.enabled = !0, $25.mobile.zoom.locked = !1); }, restore: function() { - disabledInitially || (meta.attr("content", initialContent1), $24.mobile.zoom.enabled = !0); + disabledInitially || (meta.attr("content", initialContent1), $25.mobile.zoom.enabled = !0); } }), (function($, undefined) { $.widget("mobile.textinput", { @@ -2547,7 +2544,7 @@ this._keySliding && (this._keySliding = !1, this.handle.removeClass("ui-state-active")); }, _sliderVMouseDown: function(event) { - return this.options.disabled || !(1 === event.which || 0 === event.which || undefined === event.which) || !1 === this._trigger("beforestart", event) || (this.dragging = !0, this.userModified = !1, this.mouseMoved = !1, this.isToggleSwitch && (this.beforeStart = this.element[0].selectedIndex), this.refresh(event), this._trigger("start")), !1; + return !this.options.disabled && !!(1 === event.which || 0 === event.which || undefined === event.which) && !1 !== this._trigger("beforestart", event) && (this.dragging = !0, this.userModified = !1, this.mouseMoved = !1, this.isToggleSwitch && (this.beforeStart = this.element[0].selectedIndex), this.refresh(event), this._trigger("start"), !1); }, _sliderVMouseUp: function() { if (this.dragging) return this.dragging = !1, this.isToggleSwitch && (this.handle.addClass("ui-slider-handle-snapping"), this.mouseMoved ? this.userModified ? this.refresh(0 === this.beforeStart ? 1 : 0) : this.refresh(this.beforeStart) : this.refresh(0 === this.beforeStart ? 1 : 0)), this.mouseMoved = !1, this._trigger("stop"), !1; @@ -3060,8 +3057,8 @@ this._setDisabled(!1), this.button.removeClass("ui-state-disabled"); } }, $.mobile.behaviors.formReset)); - })(jQuery), ($25 = jQuery).mobile.links = function(target) { - $25(target).find("a").jqmEnhanceable().filter(":jqmData(rel='popup')[href][href!='']").each(function() { + })(jQuery), ($26 = jQuery).mobile.links = function(target) { + $26(target).find("a").jqmEnhanceable().filter(":jqmData(rel='popup')[href][href!='']").each(function() { var idref = this.getAttribute("href").substring(1); idref && (this.setAttribute("aria-haspopup", !0), this.setAttribute("aria-owns", idref), this.setAttribute("aria-expanded", !1)); }).end().not(".ui-btn, :jqmData(role='none'), :jqmData(role='nojs')").addClass("ui-link"); @@ -4359,9 +4356,9 @@ this._timer && (window3.clearTimeout(this._timer), this._timer = 0), this._filterItems((this._search && this._search.val() || "").toLowerCase()); } }); - })(jQuery), rDividerListItem = /(^|\s)ui-li-divider(\s|$)/, origDefaultFilterCallback = ($26 = jQuery).mobile.filterable.prototype.options.filterCallback, $26.mobile.filterable.prototype.options.filterCallback = function(index, searchValue) { + })(jQuery), rDividerListItem = /(^|\s)ui-li-divider(\s|$)/, origDefaultFilterCallback = ($27 = jQuery).mobile.filterable.prototype.options.filterCallback, $27.mobile.filterable.prototype.options.filterCallback = function(index, searchValue) { return !this.className.match(rDividerListItem) && origDefaultFilterCallback.call(this, index, searchValue); - }, $26.widget("mobile.filterable", $26.mobile.filterable, { + }, $27.widget("mobile.filterable", $27.mobile.filterable, { options: { filterPlaceholder: "Filter items...", filterTheme: null @@ -4373,9 +4370,9 @@ "controlgroup", "listview" ], createHandlers = {}; - for(this._super(), $26.extend(this, { + for(this._super(), $27.extend(this, { _widget: null - }), idx = recognizedWidgets.length - 1; idx > -1; idx--)if (widgetName = recognizedWidgets[idx], $26.mobile[widgetName]) { + }), idx = recognizedWidgets.length - 1; idx > -1; idx--)if (widgetName = recognizedWidgets[idx], $27.mobile[widgetName]) { if (this._setWidget(elem.data("mobile-" + widgetName))) break; createHandlers[widgetName + "create"] = "_handleCreate"; } @@ -4403,23 +4400,23 @@ var opts = this.options, updatePlaceholder = !0, textinputOpts = {}; if (!selector) { if (this._isSearchInternal()) return; - updatePlaceholder = !1, selector = $26("").jqmData("ui-filterable-" + this.uuid + "-internal", !0), $26("
").append(selector).submit(function(evt) { + updatePlaceholder = !1, selector = $27("").jqmData("ui-filterable-" + this.uuid + "-internal", !0), $27("
").append(selector).submit(function(evt) { evt.preventDefault(), selector.blur(); - }).insertBefore(this.element), $26.mobile.textinput && (null != this.options.filterTheme && (textinputOpts.theme = opts.filterTheme), selector.textinput(textinputOpts)); + }).insertBefore(this.element), $27.mobile.textinput && (null != this.options.filterTheme && (textinputOpts.theme = opts.filterTheme), selector.textinput(textinputOpts)); } this._super(selector), this._isSearchInternal() && updatePlaceholder && this._search.attr("placeholder", this.options.filterPlaceholder); }, _setOptions: function(options) { var ret = this._super(options); - return undefined8 !== options.filterPlaceholder && this._isSearchInternal() && this._search.attr("placeholder", options.filterPlaceholder), undefined8 !== options.filterTheme && this._search && $26.mobile.textinput && this._search.textinput("option", "theme", options.filterTheme), ret; + return undefined8 !== options.filterPlaceholder && this._isSearchInternal() && this._search.attr("placeholder", options.filterPlaceholder), undefined8 !== options.filterTheme && this._search && $27.mobile.textinput && this._search.textinput("option", "theme", options.filterTheme), ret; }, _destroy: function() { this._isSearchInternal() && this._search.remove(), this._super(); }, _syncTextInputOptions: function(options) { var idx, textinputOptions = {}; - if (this._isSearchInternal() && $26.mobile.textinput) { - for(idx in $26.mobile.textinput.prototype.options)undefined8 !== options[idx] && ("theme" === idx && null != this.options.filterTheme ? textinputOptions[idx] = this.options.filterTheme : textinputOptions[idx] = options[idx]); + if (this._isSearchInternal() && $27.mobile.textinput) { + for(idx in $27.mobile.textinput.prototype.options)undefined8 !== options[idx] && ("theme" === idx && null != this.options.filterTheme ? textinputOptions[idx] = this.options.filterTheme : textinputOptions[idx] = options[idx]); this._search.textinput("option", textinputOptions); } } 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 c5368080d2a..e0675ad6960 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 @@ -3528,13 +3528,18 @@ return null; } }(domEventName10, nativeEvent8) : function(domEventName, nativeEvent) { - var nativeEvent9; - if (isComposing) return "compositionend" === domEventName || !canUseCompositionEvent && isFallbackCompositionEnd(domEventName, nativeEvent) ? (root1 = null, startText = null, fallbackText = null, isComposing = !1, getData()) : null; + if (isComposing) { + if ("compositionend" === domEventName || !canUseCompositionEvent && isFallbackCompositionEnd(domEventName, nativeEvent)) { + var nativeEvent9; + return root1 = null, startText = null, fallbackText = null, isComposing = !1, getData(); + } + return null; + } switch(domEventName){ case "paste": return null; case "keypress": - if (!(((nativeEvent9 = nativeEvent).ctrlKey || nativeEvent9.altKey || nativeEvent9.metaKey) && !(nativeEvent9.ctrlKey && nativeEvent9.altKey))) { + if (!(nativeEvent9 = nativeEvent).ctrlKey && !nativeEvent9.altKey && !nativeEvent9.metaKey || nativeEvent9.ctrlKey && nativeEvent9.altKey) { if (nativeEvent.char && nativeEvent.char.length > 1) return nativeEvent.char; if (nativeEvent.which) return String.fromCharCode(nativeEvent.which); } @@ -7122,7 +7127,7 @@ break; } return updatePayload; - })(instance, type9, props7, hostContext2.namespace), fiber.updateQueue = updatePayload1, null !== updatePayload1 && markUpdate(workInProgress); + })(instance, type9, props7, hostContext2.namespace), fiber.updateQueue = updatePayload1, (null !== updatePayload1 || 0) && markUpdate(workInProgress); else { var type8, props9, rootContainerInstance1, hostContext, internalInstanceHandle, hostContextDev, domElement1, fiber, hostContext1, instance, type9, props7, hostContext2, internalInstanceHandle1, updatePayload1, type10, props8, instance7 = (type8 = type11, props9 = newProps, rootContainerInstance1 = rootContainerInstance, hostContext = currentHostContext, internalInstanceHandle = workInProgress, validateDOMNesting(type8, null, (hostContextDev = hostContext).ancestorInfo), ("string" == typeof props9.children || "number" == typeof props9.children) && validateDOMNesting(null, "" + props9.children, updatedAncestorInfo(hostContextDev.ancestorInfo, type8)), precacheFiberNode(internalInstanceHandle, domElement1 = function(type, props, rootContainerElement, parentNamespace) { var isCustomComponentTag, domElement, ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement), namespaceURI = parentNamespace; @@ -9219,7 +9224,7 @@ var lane = requestUpdateLane(current$1), context = function(parentComponent) { if (!parentComponent) return emptyContextObject; var fiber4 = get1(parentComponent), parentContext = function(fiber) { - if (!(getNearestMountedFiber(fiber2 = fiber) === fiber2 && 1 === fiber.tag)) throw Error("Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue."); + if (getNearestMountedFiber(fiber2 = fiber) !== fiber2 || 1 !== fiber.tag) throw Error("Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue."); var fiber2, node = fiber; do { switch(node.tag){ diff --git a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_2916/config.json b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_2916/config.json index 79547b996f1..758cfce1448 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_2916/config.json +++ b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_2916/config.json @@ -2,7 +2,7 @@ "collapse_vars": true, "evaluate": true, "inline": true, - "passes": 3, + "passes": 4, "reduce_vars": true, "side_effects": true, "unsafe": true,