Created
May 26, 2017 21:29
-
-
Save davidascher/da5ec954598cfa1a43c61d429bc4726d to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******/ (function(modules) { // webpackBootstrap | |
/******/ // The module cache | |
/******/ var installedModules = {}; | |
/******/ | |
/******/ // The require function | |
/******/ function __webpack_require__(moduleId) { | |
/******/ | |
/******/ // Check if module is in cache | |
/******/ if(installedModules[moduleId]) { | |
/******/ return installedModules[moduleId].exports; | |
/******/ } | |
/******/ // Create a new module (and put it into the cache) | |
/******/ var module = installedModules[moduleId] = { | |
/******/ i: moduleId, | |
/******/ l: false, | |
/******/ exports: {} | |
/******/ }; | |
/******/ | |
/******/ // Execute the module function | |
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | |
/******/ | |
/******/ // Flag the module as loaded | |
/******/ module.l = true; | |
/******/ | |
/******/ // Return the exports of the module | |
/******/ return module.exports; | |
/******/ } | |
/******/ | |
/******/ | |
/******/ // expose the modules object (__webpack_modules__) | |
/******/ __webpack_require__.m = modules; | |
/******/ | |
/******/ // expose the module cache | |
/******/ __webpack_require__.c = installedModules; | |
/******/ | |
/******/ // identity function for calling harmony imports with the correct context | |
/******/ __webpack_require__.i = function(value) { return value; }; | |
/******/ | |
/******/ // define getter function for harmony exports | |
/******/ __webpack_require__.d = function(exports, name, getter) { | |
/******/ if(!__webpack_require__.o(exports, name)) { | |
/******/ Object.defineProperty(exports, name, { | |
/******/ configurable: false, | |
/******/ enumerable: true, | |
/******/ get: getter | |
/******/ }); | |
/******/ } | |
/******/ }; | |
/******/ | |
/******/ // getDefaultExport function for compatibility with non-harmony modules | |
/******/ __webpack_require__.n = function(module) { | |
/******/ var getter = module && module.__esModule ? | |
/******/ function getDefault() { return module['default']; } : | |
/******/ function getModuleExports() { return module; }; | |
/******/ __webpack_require__.d(getter, 'a', getter); | |
/******/ return getter; | |
/******/ }; | |
/******/ | |
/******/ // Object.prototype.hasOwnProperty.call | |
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | |
/******/ | |
/******/ // __webpack_public_path__ | |
/******/ __webpack_require__.p = "/"; | |
/******/ | |
/******/ // Load entry module and return exports | |
/******/ return __webpack_require__(__webpack_require__.s = 211); | |
/******/ }) | |
/************************************************************************/ | |
/******/ ([ | |
/* 0 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/** | |
* Use invariant() to assert state which your program assumes to be true. | |
* | |
* Provide sprintf-style format (only %s is supported) and arguments | |
* to provide information about what broke and what you were | |
* expecting. | |
* | |
* The invariant message will be stripped in production, but the invariant | |
* will remain to ensure logic does not differ in production. | |
*/ | |
var validateFormat = function validateFormat(format) {}; | |
if (false) { | |
validateFormat = function validateFormat(format) { | |
if (format === undefined) { | |
throw new Error('invariant requires an error message argument'); | |
} | |
}; | |
} | |
function invariant(condition, format, a, b, c, d, e, f) { | |
validateFormat(format); | |
if (!condition) { | |
var error; | |
if (format === undefined) { | |
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); | |
} else { | |
var args = [a, b, c, d, e, f]; | |
var argIndex = 0; | |
error = new Error(format.replace(/%s/g, function () { | |
return args[argIndex++]; | |
})); | |
error.name = 'Invariant Violation'; | |
} | |
error.framesToPop = 1; // we don't care about invariant's own frame | |
throw error; | |
} | |
} | |
module.exports = invariant; | |
/***/ }), | |
/* 1 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2014-2015, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var emptyFunction = __webpack_require__(7); | |
/** | |
* Similar to invariant but only logs a warning if the condition is not met. | |
* This can be used to log issues in development environments in critical | |
* paths. Removing the logging code for production environments will keep the | |
* same logic and follow the same code paths. | |
*/ | |
var warning = emptyFunction; | |
if (false) { | |
(function () { | |
var printWarning = function printWarning(format) { | |
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | |
args[_key - 1] = arguments[_key]; | |
} | |
var argIndex = 0; | |
var message = 'Warning: ' + format.replace(/%s/g, function () { | |
return args[argIndex++]; | |
}); | |
if (typeof console !== 'undefined') { | |
console.error(message); | |
} | |
try { | |
// --- Welcome to debugging React --- | |
// This error was thrown as a convenience so that you can use this stack | |
// to find the callsite that caused this warning to fire. | |
throw new Error(message); | |
} catch (x) {} | |
}; | |
warning = function warning(condition, format) { | |
if (format === undefined) { | |
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); | |
} | |
if (format.indexOf('Failed Composite propType: ') === 0) { | |
return; // Ignore CompositeComponent proptype check. | |
} | |
if (!condition) { | |
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { | |
args[_key2 - 2] = arguments[_key2]; | |
} | |
printWarning.apply(undefined, [format].concat(args)); | |
} | |
}; | |
})(); | |
} | |
module.exports = warning; | |
/***/ }), | |
/* 2 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
/** | |
* WARNING: DO NOT manually require this module. | |
* This is a replacement for `invariant(...)` used by the error code system | |
* and will _only_ be required by the corresponding babel pass. | |
* It always throws. | |
*/ | |
function reactProdInvariant(code) { | |
var argCount = arguments.length - 1; | |
var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code; | |
for (var argIdx = 0; argIdx < argCount; argIdx++) { | |
message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]); | |
} | |
message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.'; | |
var error = new Error(message); | |
error.name = 'Invariant Violation'; | |
error.framesToPop = 1; // we don't care about reactProdInvariant's own frame | |
throw error; | |
} | |
module.exports = reactProdInvariant; | |
/***/ }), | |
/* 3 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* | |
object-assign | |
(c) Sindre Sorhus | |
@license MIT | |
*/ | |
/* eslint-disable no-unused-vars */ | |
var getOwnPropertySymbols = Object.getOwnPropertySymbols; | |
var hasOwnProperty = Object.prototype.hasOwnProperty; | |
var propIsEnumerable = Object.prototype.propertyIsEnumerable; | |
function toObject(val) { | |
if (val === null || val === undefined) { | |
throw new TypeError('Object.assign cannot be called with null or undefined'); | |
} | |
return Object(val); | |
} | |
function shouldUseNative() { | |
try { | |
if (!Object.assign) { | |
return false; | |
} | |
// Detect buggy property enumeration order in older V8 versions. | |
// https://bugs.chromium.org/p/v8/issues/detail?id=4118 | |
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers | |
test1[5] = 'de'; | |
if (Object.getOwnPropertyNames(test1)[0] === '5') { | |
return false; | |
} | |
// https://bugs.chromium.org/p/v8/issues/detail?id=3056 | |
var test2 = {}; | |
for (var i = 0; i < 10; i++) { | |
test2['_' + String.fromCharCode(i)] = i; | |
} | |
var order2 = Object.getOwnPropertyNames(test2).map(function (n) { | |
return test2[n]; | |
}); | |
if (order2.join('') !== '0123456789') { | |
return false; | |
} | |
// https://bugs.chromium.org/p/v8/issues/detail?id=3056 | |
var test3 = {}; | |
'abcdefghijklmnopqrst'.split('').forEach(function (letter) { | |
test3[letter] = letter; | |
}); | |
if (Object.keys(Object.assign({}, test3)).join('') !== | |
'abcdefghijklmnopqrst') { | |
return false; | |
} | |
return true; | |
} catch (err) { | |
// We don't expect any of the above to throw, but better to be safe. | |
return false; | |
} | |
} | |
module.exports = shouldUseNative() ? Object.assign : function (target, source) { | |
var from; | |
var to = toObject(target); | |
var symbols; | |
for (var s = 1; s < arguments.length; s++) { | |
from = Object(arguments[s]); | |
for (var key in from) { | |
if (hasOwnProperty.call(from, key)) { | |
to[key] = from[key]; | |
} | |
} | |
if (getOwnPropertySymbols) { | |
symbols = getOwnPropertySymbols(from); | |
for (var i = 0; i < symbols.length; i++) { | |
if (propIsEnumerable.call(from, symbols[i])) { | |
to[symbols[i]] = from[symbols[i]]; | |
} | |
} | |
} | |
} | |
return to; | |
}; | |
/***/ }), | |
/* 4 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(2); | |
var DOMProperty = __webpack_require__(15); | |
var ReactDOMComponentFlags = __webpack_require__(61); | |
var invariant = __webpack_require__(0); | |
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; | |
var Flags = ReactDOMComponentFlags; | |
var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2); | |
/** | |
* Check if a given node should be cached. | |
*/ | |
function shouldPrecacheNode(node, nodeID) { | |
return node.nodeType === 1 && node.getAttribute(ATTR_NAME) === String(nodeID) || node.nodeType === 8 && node.nodeValue === ' react-text: ' + nodeID + ' ' || node.nodeType === 8 && node.nodeValue === ' react-empty: ' + nodeID + ' '; | |
} | |
/** | |
* Drill down (through composites and empty components) until we get a host or | |
* host text component. | |
* | |
* This is pretty polymorphic but unavoidable with the current structure we have | |
* for `_renderedChildren`. | |
*/ | |
function getRenderedHostOrTextFromComponent(component) { | |
var rendered; | |
while (rendered = component._renderedComponent) { | |
component = rendered; | |
} | |
return component; | |
} | |
/** | |
* Populate `_hostNode` on the rendered host/text component with the given | |
* DOM node. The passed `inst` can be a composite. | |
*/ | |
function precacheNode(inst, node) { | |
var hostInst = getRenderedHostOrTextFromComponent(inst); | |
hostInst._hostNode = node; | |
node[internalInstanceKey] = hostInst; | |
} | |
function uncacheNode(inst) { | |
var node = inst._hostNode; | |
if (node) { | |
delete node[internalInstanceKey]; | |
inst._hostNode = null; | |
} | |
} | |
/** | |
* Populate `_hostNode` on each child of `inst`, assuming that the children | |
* match up with the DOM (element) children of `node`. | |
* | |
* We cache entire levels at once to avoid an n^2 problem where we access the | |
* children of a node sequentially and have to walk from the start to our target | |
* node every time. | |
* | |
* Since we update `_renderedChildren` and the actual DOM at (slightly) | |
* different times, we could race here and see a newer `_renderedChildren` than | |
* the DOM nodes we see. To avoid this, ReactMultiChild calls | |
* `prepareToManageChildren` before we change `_renderedChildren`, at which | |
* time the container's child nodes are always cached (until it unmounts). | |
*/ | |
function precacheChildNodes(inst, node) { | |
if (inst._flags & Flags.hasCachedChildNodes) { | |
return; | |
} | |
var children = inst._renderedChildren; | |
var childNode = node.firstChild; | |
outer: for (var name in children) { | |
if (!children.hasOwnProperty(name)) { | |
continue; | |
} | |
var childInst = children[name]; | |
var childID = getRenderedHostOrTextFromComponent(childInst)._domID; | |
if (childID === 0) { | |
// We're currently unmounting this child in ReactMultiChild; skip it. | |
continue; | |
} | |
// We assume the child nodes are in the same order as the child instances. | |
for (; childNode !== null; childNode = childNode.nextSibling) { | |
if (shouldPrecacheNode(childNode, childID)) { | |
precacheNode(childInst, childNode); | |
continue outer; | |
} | |
} | |
// We reached the end of the DOM children without finding an ID match. | |
true ? false ? invariant(false, 'Unable to find element with ID %s.', childID) : _prodInvariant('32', childID) : void 0; | |
} | |
inst._flags |= Flags.hasCachedChildNodes; | |
} | |
/** | |
* Given a DOM node, return the closest ReactDOMComponent or | |
* ReactDOMTextComponent instance ancestor. | |
*/ | |
function getClosestInstanceFromNode(node) { | |
if (node[internalInstanceKey]) { | |
return node[internalInstanceKey]; | |
} | |
// Walk up the tree until we find an ancestor whose instance we have cached. | |
var parents = []; | |
while (!node[internalInstanceKey]) { | |
parents.push(node); | |
if (node.parentNode) { | |
node = node.parentNode; | |
} else { | |
// Top of the tree. This node must not be part of a React tree (or is | |
// unmounted, potentially). | |
return null; | |
} | |
} | |
var closest; | |
var inst; | |
for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) { | |
closest = inst; | |
if (parents.length) { | |
precacheChildNodes(inst, node); | |
} | |
} | |
return closest; | |
} | |
/** | |
* Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent | |
* instance, or null if the node was not rendered by this React. | |
*/ | |
function getInstanceFromNode(node) { | |
var inst = getClosestInstanceFromNode(node); | |
if (inst != null && inst._hostNode === node) { | |
return inst; | |
} else { | |
return null; | |
} | |
} | |
/** | |
* Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding | |
* DOM node. | |
*/ | |
function getNodeFromInstance(inst) { | |
// Without this first invariant, passing a non-DOM-component triggers the next | |
// invariant for a missing parent, which is super confusing. | |
!(inst._hostNode !== undefined) ? false ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0; | |
if (inst._hostNode) { | |
return inst._hostNode; | |
} | |
// Walk up the tree until we find an ancestor whose DOM node we have cached. | |
var parents = []; | |
while (!inst._hostNode) { | |
parents.push(inst); | |
!inst._hostParent ? false ? invariant(false, 'React DOM tree root should always have a node reference.') : _prodInvariant('34') : void 0; | |
inst = inst._hostParent; | |
} | |
// Now parents contains each ancestor that does *not* have a cached native | |
// node, and `inst` is the deepest ancestor that does. | |
for (; parents.length; inst = parents.pop()) { | |
precacheChildNodes(inst, inst._hostNode); | |
} | |
return inst._hostNode; | |
} | |
var ReactDOMComponentTree = { | |
getClosestInstanceFromNode: getClosestInstanceFromNode, | |
getInstanceFromNode: getInstanceFromNode, | |
getNodeFromInstance: getNodeFromInstance, | |
precacheChildNodes: precacheChildNodes, | |
precacheNode: precacheNode, | |
uncacheNode: uncacheNode | |
}; | |
module.exports = ReactDOMComponentTree; | |
/***/ }), | |
/* 5 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); | |
/** | |
* Simple, lightweight module assisting with the detection and context of | |
* Worker. Helps avoid circular dependencies and allows code to reason about | |
* whether or not they are in a Worker, even if they never include the main | |
* `ReactWorker` dependency. | |
*/ | |
var ExecutionEnvironment = { | |
canUseDOM: canUseDOM, | |
canUseWorkers: typeof Worker !== 'undefined', | |
canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), | |
canUseViewport: canUseDOM && !!window.screen, | |
isInWorker: !canUseDOM // For now, this is true - might change in the future. | |
}; | |
module.exports = ExecutionEnvironment; | |
/***/ }), | |
/* 6 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
module.exports = __webpack_require__(17); | |
/***/ }), | |
/* 7 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
function makeEmptyFunction(arg) { | |
return function () { | |
return arg; | |
}; | |
} | |
/** | |
* This function accepts and discards inputs; it has no side effects. This is | |
* primarily useful idiomatically for overridable function endpoints which | |
* always need to be callable, since JS lacks a null-call idiom ala Cocoa. | |
*/ | |
var emptyFunction = function emptyFunction() {}; | |
emptyFunction.thatReturns = makeEmptyFunction; | |
emptyFunction.thatReturnsFalse = makeEmptyFunction(false); | |
emptyFunction.thatReturnsTrue = makeEmptyFunction(true); | |
emptyFunction.thatReturnsNull = makeEmptyFunction(null); | |
emptyFunction.thatReturnsThis = function () { | |
return this; | |
}; | |
emptyFunction.thatReturnsArgument = function (arg) { | |
return arg; | |
}; | |
module.exports = emptyFunction; | |
/***/ }), | |
/* 8 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2016-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
// Trust the developer to only use ReactInstrumentation with a __DEV__ check | |
var debugTool = null; | |
if (false) { | |
var ReactDebugTool = require('./ReactDebugTool'); | |
debugTool = ReactDebugTool; | |
} | |
module.exports = { debugTool: debugTool }; | |
/***/ }), | |
/* 9 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(2), | |
_assign = __webpack_require__(3); | |
var CallbackQueue = __webpack_require__(59); | |
var PooledClass = __webpack_require__(13); | |
var ReactFeatureFlags = __webpack_require__(64); | |
var ReactReconciler = __webpack_require__(16); | |
var Transaction = __webpack_require__(27); | |
var invariant = __webpack_require__(0); | |
var dirtyComponents = []; | |
var updateBatchNumber = 0; | |
var asapCallbackQueue = CallbackQueue.getPooled(); | |
var asapEnqueued = false; | |
var batchingStrategy = null; | |
function ensureInjected() { | |
!(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? false ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching strategy') : _prodInvariant('123') : void 0; | |
} | |
var NESTED_UPDATES = { | |
initialize: function () { | |
this.dirtyComponentsLength = dirtyComponents.length; | |
}, | |
close: function () { | |
if (this.dirtyComponentsLength !== dirtyComponents.length) { | |
// Additional updates were enqueued by componentDidUpdate handlers or | |
// similar; before our own UPDATE_QUEUEING wrapper closes, we want to run | |
// these new updates so that if A's componentDidUpdate calls setState on | |
// B, B will update before the callback A's updater provided when calling | |
// setState. | |
dirtyComponents.splice(0, this.dirtyComponentsLength); | |
flushBatchedUpdates(); | |
} else { | |
dirtyComponents.length = 0; | |
} | |
} | |
}; | |
var UPDATE_QUEUEING = { | |
initialize: function () { | |
this.callbackQueue.reset(); | |
}, | |
close: function () { | |
this.callbackQueue.notifyAll(); | |
} | |
}; | |
var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING]; | |
function ReactUpdatesFlushTransaction() { | |
this.reinitializeTransaction(); | |
this.dirtyComponentsLength = null; | |
this.callbackQueue = CallbackQueue.getPooled(); | |
this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( | |
/* useCreateElement */true); | |
} | |
_assign(ReactUpdatesFlushTransaction.prototype, Transaction, { | |
getTransactionWrappers: function () { | |
return TRANSACTION_WRAPPERS; | |
}, | |
destructor: function () { | |
this.dirtyComponentsLength = null; | |
CallbackQueue.release(this.callbackQueue); | |
this.callbackQueue = null; | |
ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction); | |
this.reconcileTransaction = null; | |
}, | |
perform: function (method, scope, a) { | |
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)` | |
// with this transaction's wrappers around it. | |
return Transaction.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a); | |
} | |
}); | |
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction); | |
function batchedUpdates(callback, a, b, c, d, e) { | |
ensureInjected(); | |
return batchingStrategy.batchedUpdates(callback, a, b, c, d, e); | |
} | |
/** | |
* Array comparator for ReactComponents by mount ordering. | |
* | |
* @param {ReactComponent} c1 first component you're comparing | |
* @param {ReactComponent} c2 second component you're comparing | |
* @return {number} Return value usable by Array.prototype.sort(). | |
*/ | |
function mountOrderComparator(c1, c2) { | |
return c1._mountOrder - c2._mountOrder; | |
} | |
function runBatchedUpdates(transaction) { | |
var len = transaction.dirtyComponentsLength; | |
!(len === dirtyComponents.length) ? false ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to match dirty-components array length (%s).', len, dirtyComponents.length) : _prodInvariant('124', len, dirtyComponents.length) : void 0; | |
// Since reconciling a component higher in the owner hierarchy usually (not | |
// always -- see shouldComponentUpdate()) will reconcile children, reconcile | |
// them before their children by sorting the array. | |
dirtyComponents.sort(mountOrderComparator); | |
// Any updates enqueued while reconciling must be performed after this entire | |
// batch. Otherwise, if dirtyComponents is [A, B] where A has children B and | |
// C, B could update twice in a single batch if C's render enqueues an update | |
// to B (since B would have already updated, we should skip it, and the only | |
// way we can know to do so is by checking the batch counter). | |
updateBatchNumber++; | |
for (var i = 0; i < len; i++) { | |
// If a component is unmounted before pending changes apply, it will still | |
// be here, but we assume that it has cleared its _pendingCallbacks and | |
// that performUpdateIfNecessary is a noop. | |
var component = dirtyComponents[i]; | |
// If performUpdateIfNecessary happens to enqueue any new updates, we | |
// shouldn't execute the callbacks until the next render happens, so | |
// stash the callbacks first | |
var callbacks = component._pendingCallbacks; | |
component._pendingCallbacks = null; | |
var markerName; | |
if (ReactFeatureFlags.logTopLevelRenders) { | |
var namedComponent = component; | |
// Duck type TopLevelWrapper. This is probably always true. | |
if (component._currentElement.type.isReactTopLevelWrapper) { | |
namedComponent = component._renderedComponent; | |
} | |
markerName = 'React update: ' + namedComponent.getName(); | |
console.time(markerName); | |
} | |
ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber); | |
if (markerName) { | |
console.timeEnd(markerName); | |
} | |
if (callbacks) { | |
for (var j = 0; j < callbacks.length; j++) { | |
transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance()); | |
} | |
} | |
} | |
} | |
var flushBatchedUpdates = function () { | |
// ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents | |
// array and perform any updates enqueued by mount-ready handlers (i.e., | |
// componentDidUpdate) but we need to check here too in order to catch | |
// updates enqueued by setState callbacks and asap calls. | |
while (dirtyComponents.length || asapEnqueued) { | |
if (dirtyComponents.length) { | |
var transaction = ReactUpdatesFlushTransaction.getPooled(); | |
transaction.perform(runBatchedUpdates, null, transaction); | |
ReactUpdatesFlushTransaction.release(transaction); | |
} | |
if (asapEnqueued) { | |
asapEnqueued = false; | |
var queue = asapCallbackQueue; | |
asapCallbackQueue = CallbackQueue.getPooled(); | |
queue.notifyAll(); | |
CallbackQueue.release(queue); | |
} | |
} | |
}; | |
/** | |
* Mark a component as needing a rerender, adding an optional callback to a | |
* list of functions which will be executed once the rerender occurs. | |
*/ | |
function enqueueUpdate(component) { | |
ensureInjected(); | |
// Various parts of our code (such as ReactCompositeComponent's | |
// _renderValidatedComponent) assume that calls to render aren't nested; | |
// verify that that's the case. (This is called by each top-level update | |
// function, like setState, forceUpdate, etc.; creation and | |
// destruction of top-level components is guarded in ReactMount.) | |
if (!batchingStrategy.isBatchingUpdates) { | |
batchingStrategy.batchedUpdates(enqueueUpdate, component); | |
return; | |
} | |
dirtyComponents.push(component); | |
if (component._updateBatchNumber == null) { | |
component._updateBatchNumber = updateBatchNumber + 1; | |
} | |
} | |
/** | |
* Enqueue a callback to be run at the end of the current batching cycle. Throws | |
* if no updates are currently being performed. | |
*/ | |
function asap(callback, context) { | |
!batchingStrategy.isBatchingUpdates ? false ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context whereupdates are not being batched.') : _prodInvariant('125') : void 0; | |
asapCallbackQueue.enqueue(callback, context); | |
asapEnqueued = true; | |
} | |
var ReactUpdatesInjection = { | |
injectReconcileTransaction: function (ReconcileTransaction) { | |
!ReconcileTransaction ? false ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : _prodInvariant('126') : void 0; | |
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction; | |
}, | |
injectBatchingStrategy: function (_batchingStrategy) { | |
!_batchingStrategy ? false ? invariant(false, 'ReactUpdates: must provide a batching strategy') : _prodInvariant('127') : void 0; | |
!(typeof _batchingStrategy.batchedUpdates === 'function') ? false ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : _prodInvariant('128') : void 0; | |
!(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? false ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : _prodInvariant('129') : void 0; | |
batchingStrategy = _batchingStrategy; | |
} | |
}; | |
var ReactUpdates = { | |
/** | |
* React references `ReactReconcileTransaction` using this property in order | |
* to allow dependency injection. | |
* | |
* @internal | |
*/ | |
ReactReconcileTransaction: null, | |
batchedUpdates: batchedUpdates, | |
enqueueUpdate: enqueueUpdate, | |
flushBatchedUpdates: flushBatchedUpdates, | |
injection: ReactUpdatesInjection, | |
asap: asap | |
}; | |
module.exports = ReactUpdates; | |
/***/ }), | |
/* 10 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _assign = __webpack_require__(3); | |
var PooledClass = __webpack_require__(13); | |
var emptyFunction = __webpack_require__(7); | |
var warning = __webpack_require__(1); | |
var didWarnForAddedNewProperty = false; | |
var isProxySupported = typeof Proxy === 'function'; | |
var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances']; | |
/** | |
* @interface Event | |
* @see http://www.w3.org/TR/DOM-Level-3-Events/ | |
*/ | |
var EventInterface = { | |
type: null, | |
target: null, | |
// currentTarget is set when dispatching; no use in copying it here | |
currentTarget: emptyFunction.thatReturnsNull, | |
eventPhase: null, | |
bubbles: null, | |
cancelable: null, | |
timeStamp: function (event) { | |
return event.timeStamp || Date.now(); | |
}, | |
defaultPrevented: null, | |
isTrusted: null | |
}; | |
/** | |
* Synthetic events are dispatched by event plugins, typically in response to a | |
* top-level event delegation handler. | |
* | |
* These systems should generally use pooling to reduce the frequency of garbage | |
* collection. The system should check `isPersistent` to determine whether the | |
* event should be released into the pool after being dispatched. Users that | |
* need a persisted event should invoke `persist`. | |
* | |
* Synthetic events (and subclasses) implement the DOM Level 3 Events API by | |
* normalizing browser quirks. Subclasses do not necessarily have to implement a | |
* DOM interface; custom application-specific events can also subclass this. | |
* | |
* @param {object} dispatchConfig Configuration used to dispatch this event. | |
* @param {*} targetInst Marker identifying the event target. | |
* @param {object} nativeEvent Native browser event. | |
* @param {DOMEventTarget} nativeEventTarget Target node. | |
*/ | |
function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) { | |
if (false) { | |
// these have a getter/setter for warnings | |
delete this.nativeEvent; | |
delete this.preventDefault; | |
delete this.stopPropagation; | |
} | |
this.dispatchConfig = dispatchConfig; | |
this._targetInst = targetInst; | |
this.nativeEvent = nativeEvent; | |
var Interface = this.constructor.Interface; | |
for (var propName in Interface) { | |
if (!Interface.hasOwnProperty(propName)) { | |
continue; | |
} | |
if (false) { | |
delete this[propName]; // this has a getter/setter for warnings | |
} | |
var normalize = Interface[propName]; | |
if (normalize) { | |
this[propName] = normalize(nativeEvent); | |
} else { | |
if (propName === 'target') { | |
this.target = nativeEventTarget; | |
} else { | |
this[propName] = nativeEvent[propName]; | |
} | |
} | |
} | |
var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; | |
if (defaultPrevented) { | |
this.isDefaultPrevented = emptyFunction.thatReturnsTrue; | |
} else { | |
this.isDefaultPrevented = emptyFunction.thatReturnsFalse; | |
} | |
this.isPropagationStopped = emptyFunction.thatReturnsFalse; | |
return this; | |
} | |
_assign(SyntheticEvent.prototype, { | |
preventDefault: function () { | |
this.defaultPrevented = true; | |
var event = this.nativeEvent; | |
if (!event) { | |
return; | |
} | |
if (event.preventDefault) { | |
event.preventDefault(); | |
} else if (typeof event.returnValue !== 'unknown') { | |
// eslint-disable-line valid-typeof | |
event.returnValue = false; | |
} | |
this.isDefaultPrevented = emptyFunction.thatReturnsTrue; | |
}, | |
stopPropagation: function () { | |
var event = this.nativeEvent; | |
if (!event) { | |
return; | |
} | |
if (event.stopPropagation) { | |
event.stopPropagation(); | |
} else if (typeof event.cancelBubble !== 'unknown') { | |
// eslint-disable-line valid-typeof | |
// The ChangeEventPlugin registers a "propertychange" event for | |
// IE. This event does not support bubbling or cancelling, and | |
// any references to cancelBubble throw "Member not found". A | |
// typeof check of "unknown" circumvents this issue (and is also | |
// IE specific). | |
event.cancelBubble = true; | |
} | |
this.isPropagationStopped = emptyFunction.thatReturnsTrue; | |
}, | |
/** | |
* We release all dispatched `SyntheticEvent`s after each event loop, adding | |
* them back into the pool. This allows a way to hold onto a reference that | |
* won't be added back into the pool. | |
*/ | |
persist: function () { | |
this.isPersistent = emptyFunction.thatReturnsTrue; | |
}, | |
/** | |
* Checks if this event should be released back into the pool. | |
* | |
* @return {boolean} True if this should not be released, false otherwise. | |
*/ | |
isPersistent: emptyFunction.thatReturnsFalse, | |
/** | |
* `PooledClass` looks for `destructor` on each instance it releases. | |
*/ | |
destructor: function () { | |
var Interface = this.constructor.Interface; | |
for (var propName in Interface) { | |
if (false) { | |
Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName])); | |
} else { | |
this[propName] = null; | |
} | |
} | |
for (var i = 0; i < shouldBeReleasedProperties.length; i++) { | |
this[shouldBeReleasedProperties[i]] = null; | |
} | |
if (false) { | |
Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null)); | |
Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction)); | |
Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction)); | |
} | |
} | |
}); | |
SyntheticEvent.Interface = EventInterface; | |
if (false) { | |
if (isProxySupported) { | |
/*eslint-disable no-func-assign */ | |
SyntheticEvent = new Proxy(SyntheticEvent, { | |
construct: function (target, args) { | |
return this.apply(target, Object.create(target.prototype), args); | |
}, | |
apply: function (constructor, that, args) { | |
return new Proxy(constructor.apply(that, args), { | |
set: function (target, prop, value) { | |
if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) { | |
process.env.NODE_ENV !== 'production' ? warning(didWarnForAddedNewProperty || target.isPersistent(), 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re adding a new property in the synthetic event object. ' + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.') : void 0; | |
didWarnForAddedNewProperty = true; | |
} | |
target[prop] = value; | |
return true; | |
} | |
}); | |
} | |
}); | |
/*eslint-enable no-func-assign */ | |
} | |
} | |
/** | |
* Helper to reduce boilerplate when creating subclasses. | |
* | |
* @param {function} Class | |
* @param {?object} Interface | |
*/ | |
SyntheticEvent.augmentClass = function (Class, Interface) { | |
var Super = this; | |
var E = function () {}; | |
E.prototype = Super.prototype; | |
var prototype = new E(); | |
_assign(prototype, Class.prototype); | |
Class.prototype = prototype; | |
Class.prototype.constructor = Class; | |
Class.Interface = _assign({}, Super.Interface, Interface); | |
Class.augmentClass = Super.augmentClass; | |
PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler); | |
}; | |
PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler); | |
module.exports = SyntheticEvent; | |
/** | |
* Helper to nullify syntheticEvent instance properties when destructing | |
* | |
* @param {object} SyntheticEvent | |
* @param {String} propName | |
* @return {object} defineProperty object | |
*/ | |
function getPooledWarningPropertyDefinition(propName, getVal) { | |
var isFunction = typeof getVal === 'function'; | |
return { | |
configurable: true, | |
set: set, | |
get: get | |
}; | |
function set(val) { | |
var action = isFunction ? 'setting the method' : 'setting the property'; | |
warn(action, 'This is effectively a no-op'); | |
return val; | |
} | |
function get() { | |
var action = isFunction ? 'accessing the method' : 'accessing the property'; | |
var result = isFunction ? 'This is a no-op function' : 'This is set to null'; | |
warn(action, result); | |
return getVal; | |
} | |
function warn(action, result) { | |
var warningCondition = false; | |
false ? warning(warningCondition, 'This synthetic event is reused for performance reasons. If you\'re seeing this, ' + 'you\'re %s `%s` on a released/nullified synthetic event. %s. ' + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0; | |
} | |
} | |
/***/ }), | |
/* 11 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
/** | |
* Keeps track of the current owner. | |
* | |
* The current owner is the component who should own any components that are | |
* currently being constructed. | |
*/ | |
var ReactCurrentOwner = { | |
/** | |
* @internal | |
* @type {ReactComponent} | |
*/ | |
current: null | |
}; | |
module.exports = ReactCurrentOwner; | |
/***/ }), | |
/* 12 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
*/ | |
if (false) { | |
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && | |
Symbol.for && | |
Symbol.for('react.element')) || | |
0xeac7; | |
var isValidElement = function(object) { | |
return typeof object === 'object' && | |
object !== null && | |
object.$$typeof === REACT_ELEMENT_TYPE; | |
}; | |
// By explicitly using `prop-types` you are opting into new development behavior. | |
// http://fb.me/prop-types-in-prod | |
var throwOnDirectAccess = true; | |
module.exports = require('./factoryWithTypeCheckers')(isValidElement, throwOnDirectAccess); | |
} else { | |
// By explicitly using `prop-types` you are opting into new production behavior. | |
// http://fb.me/prop-types-in-prod | |
module.exports = __webpack_require__(116)(); | |
} | |
/***/ }), | |
/* 13 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(2); | |
var invariant = __webpack_require__(0); | |
/** | |
* Static poolers. Several custom versions for each potential number of | |
* arguments. A completely generic pooler is easy to implement, but would | |
* require accessing the `arguments` object. In each of these, `this` refers to | |
* the Class itself, not an instance. If any others are needed, simply add them | |
* here, or in their own files. | |
*/ | |
var oneArgumentPooler = function (copyFieldsFrom) { | |
var Klass = this; | |
if (Klass.instancePool.length) { | |
var instance = Klass.instancePool.pop(); | |
Klass.call(instance, copyFieldsFrom); | |
return instance; | |
} else { | |
return new Klass(copyFieldsFrom); | |
} | |
}; | |
var twoArgumentPooler = function (a1, a2) { | |
var Klass = this; | |
if (Klass.instancePool.length) { | |
var instance = Klass.instancePool.pop(); | |
Klass.call(instance, a1, a2); | |
return instance; | |
} else { | |
return new Klass(a1, a2); | |
} | |
}; | |
var threeArgumentPooler = function (a1, a2, a3) { | |
var Klass = this; | |
if (Klass.instancePool.length) { | |
var instance = Klass.instancePool.pop(); | |
Klass.call(instance, a1, a2, a3); | |
return instance; | |
} else { | |
return new Klass(a1, a2, a3); | |
} | |
}; | |
var fourArgumentPooler = function (a1, a2, a3, a4) { | |
var Klass = this; | |
if (Klass.instancePool.length) { | |
var instance = Klass.instancePool.pop(); | |
Klass.call(instance, a1, a2, a3, a4); | |
return instance; | |
} else { | |
return new Klass(a1, a2, a3, a4); | |
} | |
}; | |
var standardReleaser = function (instance) { | |
var Klass = this; | |
!(instance instanceof Klass) ? false ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0; | |
instance.destructor(); | |
if (Klass.instancePool.length < Klass.poolSize) { | |
Klass.instancePool.push(instance); | |
} | |
}; | |
var DEFAULT_POOL_SIZE = 10; | |
var DEFAULT_POOLER = oneArgumentPooler; | |
/** | |
* Augments `CopyConstructor` to be a poolable class, augmenting only the class | |
* itself (statically) not adding any prototypical fields. Any CopyConstructor | |
* you give this may have a `poolSize` property, and will look for a | |
* prototypical `destructor` on instances. | |
* | |
* @param {Function} CopyConstructor Constructor that can be used to reset. | |
* @param {Function} pooler Customizable pooler. | |
*/ | |
var addPoolingTo = function (CopyConstructor, pooler) { | |
// Casting as any so that flow ignores the actual implementation and trusts | |
// it to match the type we declared | |
var NewKlass = CopyConstructor; | |
NewKlass.instancePool = []; | |
NewKlass.getPooled = pooler || DEFAULT_POOLER; | |
if (!NewKlass.poolSize) { | |
NewKlass.poolSize = DEFAULT_POOL_SIZE; | |
} | |
NewKlass.release = standardReleaser; | |
return NewKlass; | |
}; | |
var PooledClass = { | |
addPoolingTo: addPoolingTo, | |
oneArgumentPooler: oneArgumentPooler, | |
twoArgumentPooler: twoArgumentPooler, | |
threeArgumentPooler: threeArgumentPooler, | |
fourArgumentPooler: fourArgumentPooler | |
}; | |
module.exports = PooledClass; | |
/***/ }), | |
/* 14 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2015-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var DOMNamespaces = __webpack_require__(33); | |
var setInnerHTML = __webpack_require__(29); | |
var createMicrosoftUnsafeLocalFunction = __webpack_require__(41); | |
var setTextContent = __webpack_require__(76); | |
var ELEMENT_NODE_TYPE = 1; | |
var DOCUMENT_FRAGMENT_NODE_TYPE = 11; | |
/** | |
* In IE (8-11) and Edge, appending nodes with no children is dramatically | |
* faster than appending a full subtree, so we essentially queue up the | |
* .appendChild calls here and apply them so each node is added to its parent | |
* before any children are added. | |
* | |
* In other browsers, doing so is slower or neutral compared to the other order | |
* (in Firefox, twice as slow) so we only do this inversion in IE. | |
* | |
* See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode. | |
*/ | |
var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent); | |
function insertTreeChildren(tree) { | |
if (!enableLazy) { | |
return; | |
} | |
var node = tree.node; | |
var children = tree.children; | |
if (children.length) { | |
for (var i = 0; i < children.length; i++) { | |
insertTreeBefore(node, children[i], null); | |
} | |
} else if (tree.html != null) { | |
setInnerHTML(node, tree.html); | |
} else if (tree.text != null) { | |
setTextContent(node, tree.text); | |
} | |
} | |
var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) { | |
// DocumentFragments aren't actually part of the DOM after insertion so | |
// appending children won't update the DOM. We need to ensure the fragment | |
// is properly populated first, breaking out of our lazy approach for just | |
// this level. Also, some <object> plugins (like Flash Player) will read | |
// <param> nodes immediately upon insertion into the DOM, so <object> | |
// must also be populated prior to insertion into the DOM. | |
if (tree.node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE || tree.node.nodeType === ELEMENT_NODE_TYPE && tree.node.nodeName.toLowerCase() === 'object' && (tree.node.namespaceURI == null || tree.node.namespaceURI === DOMNamespaces.html)) { | |
insertTreeChildren(tree); | |
parentNode.insertBefore(tree.node, referenceNode); | |
} else { | |
parentNode.insertBefore(tree.node, referenceNode); | |
insertTreeChildren(tree); | |
} | |
}); | |
function replaceChildWithTree(oldNode, newTree) { | |
oldNode.parentNode.replaceChild(newTree.node, oldNode); | |
insertTreeChildren(newTree); | |
} | |
function queueChild(parentTree, childTree) { | |
if (enableLazy) { | |
parentTree.children.push(childTree); | |
} else { | |
parentTree.node.appendChild(childTree.node); | |
} | |
} | |
function queueHTML(tree, html) { | |
if (enableLazy) { | |
tree.html = html; | |
} else { | |
setInnerHTML(tree.node, html); | |
} | |
} | |
function queueText(tree, text) { | |
if (enableLazy) { | |
tree.text = text; | |
} else { | |
setTextContent(tree.node, text); | |
} | |
} | |
function toString() { | |
return this.node.nodeName; | |
} | |
function DOMLazyTree(node) { | |
return { | |
node: node, | |
children: [], | |
html: null, | |
text: null, | |
toString: toString | |
}; | |
} | |
DOMLazyTree.insertTreeBefore = insertTreeBefore; | |
DOMLazyTree.replaceChildWithTree = replaceChildWithTree; | |
DOMLazyTree.queueChild = queueChild; | |
DOMLazyTree.queueHTML = queueHTML; | |
DOMLazyTree.queueText = queueText; | |
module.exports = DOMLazyTree; | |
/***/ }), | |
/* 15 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(2); | |
var invariant = __webpack_require__(0); | |
function checkMask(value, bitmask) { | |
return (value & bitmask) === bitmask; | |
} | |
var DOMPropertyInjection = { | |
/** | |
* Mapping from normalized, camelcased property names to a configuration that | |
* specifies how the associated DOM property should be accessed or rendered. | |
*/ | |
MUST_USE_PROPERTY: 0x1, | |
HAS_BOOLEAN_VALUE: 0x4, | |
HAS_NUMERIC_VALUE: 0x8, | |
HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8, | |
HAS_OVERLOADED_BOOLEAN_VALUE: 0x20, | |
/** | |
* Inject some specialized knowledge about the DOM. This takes a config object | |
* with the following properties: | |
* | |
* isCustomAttribute: function that given an attribute name will return true | |
* if it can be inserted into the DOM verbatim. Useful for data-* or aria-* | |
* attributes where it's impossible to enumerate all of the possible | |
* attribute names, | |
* | |
* Properties: object mapping DOM property name to one of the | |
* DOMPropertyInjection constants or null. If your attribute isn't in here, | |
* it won't get written to the DOM. | |
* | |
* DOMAttributeNames: object mapping React attribute name to the DOM | |
* attribute name. Attribute names not specified use the **lowercase** | |
* normalized name. | |
* | |
* DOMAttributeNamespaces: object mapping React attribute name to the DOM | |
* attribute namespace URL. (Attribute names not specified use no namespace.) | |
* | |
* DOMPropertyNames: similar to DOMAttributeNames but for DOM properties. | |
* Property names not specified use the normalized name. | |
* | |
* DOMMutationMethods: Properties that require special mutation methods. If | |
* `value` is undefined, the mutation method should unset the property. | |
* | |
* @param {object} domPropertyConfig the config as described above. | |
*/ | |
injectDOMPropertyConfig: function (domPropertyConfig) { | |
var Injection = DOMPropertyInjection; | |
var Properties = domPropertyConfig.Properties || {}; | |
var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {}; | |
var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {}; | |
var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {}; | |
var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {}; | |
if (domPropertyConfig.isCustomAttribute) { | |
DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute); | |
} | |
for (var propName in Properties) { | |
!!DOMProperty.properties.hasOwnProperty(propName) ? false ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property \'%s\' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.', propName) : _prodInvariant('48', propName) : void 0; | |
var lowerCased = propName.toLowerCase(); | |
var propConfig = Properties[propName]; | |
var propertyInfo = { | |
attributeName: lowerCased, | |
attributeNamespace: null, | |
propertyName: propName, | |
mutationMethod: null, | |
mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY), | |
hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE), | |
hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE), | |
hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE), | |
hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE) | |
}; | |
!(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? false ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s', propName) : _prodInvariant('50', propName) : void 0; | |
if (false) { | |
DOMProperty.getPossibleStandardName[lowerCased] = propName; | |
} | |
if (DOMAttributeNames.hasOwnProperty(propName)) { | |
var attributeName = DOMAttributeNames[propName]; | |
propertyInfo.attributeName = attributeName; | |
if (false) { | |
DOMProperty.getPossibleStandardName[attributeName] = propName; | |
} | |
} | |
if (DOMAttributeNamespaces.hasOwnProperty(propName)) { | |
propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName]; | |
} | |
if (DOMPropertyNames.hasOwnProperty(propName)) { | |
propertyInfo.propertyName = DOMPropertyNames[propName]; | |
} | |
if (DOMMutationMethods.hasOwnProperty(propName)) { | |
propertyInfo.mutationMethod = DOMMutationMethods[propName]; | |
} | |
DOMProperty.properties[propName] = propertyInfo; | |
} | |
} | |
}; | |
/* eslint-disable max-len */ | |
var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD'; | |
/* eslint-enable max-len */ | |
/** | |
* DOMProperty exports lookup objects that can be used like functions: | |
* | |
* > DOMProperty.isValid['id'] | |
* true | |
* > DOMProperty.isValid['foobar'] | |
* undefined | |
* | |
* Although this may be confusing, it performs better in general. | |
* | |
* @see http://jsperf.com/key-exists | |
* @see http://jsperf.com/key-missing | |
*/ | |
var DOMProperty = { | |
ID_ATTRIBUTE_NAME: 'data-reactid', | |
ROOT_ATTRIBUTE_NAME: 'data-reactroot', | |
ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR, | |
ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040', | |
/** | |
* Map from property "standard name" to an object with info about how to set | |
* the property in the DOM. Each object contains: | |
* | |
* attributeName: | |
* Used when rendering markup or with `*Attribute()`. | |
* attributeNamespace | |
* propertyName: | |
* Used on DOM node instances. (This includes properties that mutate due to | |
* external factors.) | |
* mutationMethod: | |
* If non-null, used instead of the property or `setAttribute()` after | |
* initial render. | |
* mustUseProperty: | |
* Whether the property must be accessed and mutated as an object property. | |
* hasBooleanValue: | |
* Whether the property should be removed when set to a falsey value. | |
* hasNumericValue: | |
* Whether the property must be numeric or parse as a numeric and should be | |
* removed when set to a falsey value. | |
* hasPositiveNumericValue: | |
* Whether the property must be positive numeric or parse as a positive | |
* numeric and should be removed when set to a falsey value. | |
* hasOverloadedBooleanValue: | |
* Whether the property can be used as a flag as well as with a value. | |
* Removed when strictly equal to false; present without a value when | |
* strictly equal to true; present with a value otherwise. | |
*/ | |
properties: {}, | |
/** | |
* Mapping from lowercase property names to the properly cased version, used | |
* to warn in the case of missing properties. Available only in __DEV__. | |
* | |
* autofocus is predefined, because adding it to the property whitelist | |
* causes unintended side effects. | |
* | |
* @type {Object} | |
*/ | |
getPossibleStandardName: false ? { autofocus: 'autoFocus' } : null, | |
/** | |
* All of the isCustomAttribute() functions that have been injected. | |
*/ | |
_isCustomAttributeFunctions: [], | |
/** | |
* Checks whether a property name is a custom attribute. | |
* @method | |
*/ | |
isCustomAttribute: function (attributeName) { | |
for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) { | |
var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i]; | |
if (isCustomAttributeFn(attributeName)) { | |
return true; | |
} | |
} | |
return false; | |
}, | |
injection: DOMPropertyInjection | |
}; | |
module.exports = DOMProperty; | |
/***/ }), | |
/* 16 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ReactRef = __webpack_require__(155); | |
var ReactInstrumentation = __webpack_require__(8); | |
var warning = __webpack_require__(1); | |
/** | |
* Helper to call ReactRef.attachRefs with this composite component, split out | |
* to avoid allocations in the transaction mount-ready queue. | |
*/ | |
function attachRefs() { | |
ReactRef.attachRefs(this, this._currentElement); | |
} | |
var ReactReconciler = { | |
/** | |
* Initializes the component, renders markup, and registers event listeners. | |
* | |
* @param {ReactComponent} internalInstance | |
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | |
* @param {?object} the containing host component instance | |
* @param {?object} info about the host container | |
* @return {?string} Rendered markup to be inserted into the DOM. | |
* @final | |
* @internal | |
*/ | |
mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID // 0 in production and for roots | |
) { | |
if (false) { | |
if (internalInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement, parentDebugID); | |
} | |
} | |
var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context, parentDebugID); | |
if (internalInstance._currentElement && internalInstance._currentElement.ref != null) { | |
transaction.getReactMountReady().enqueue(attachRefs, internalInstance); | |
} | |
if (false) { | |
if (internalInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID); | |
} | |
} | |
return markup; | |
}, | |
/** | |
* Returns a value that can be passed to | |
* ReactComponentEnvironment.replaceNodeWithMarkup. | |
*/ | |
getHostNode: function (internalInstance) { | |
return internalInstance.getHostNode(); | |
}, | |
/** | |
* Releases any resources allocated by `mountComponent`. | |
* | |
* @final | |
* @internal | |
*/ | |
unmountComponent: function (internalInstance, safely) { | |
if (false) { | |
if (internalInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onBeforeUnmountComponent(internalInstance._debugID); | |
} | |
} | |
ReactRef.detachRefs(internalInstance, internalInstance._currentElement); | |
internalInstance.unmountComponent(safely); | |
if (false) { | |
if (internalInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID); | |
} | |
} | |
}, | |
/** | |
* Update a component using a new element. | |
* | |
* @param {ReactComponent} internalInstance | |
* @param {ReactElement} nextElement | |
* @param {ReactReconcileTransaction} transaction | |
* @param {object} context | |
* @internal | |
*/ | |
receiveComponent: function (internalInstance, nextElement, transaction, context) { | |
var prevElement = internalInstance._currentElement; | |
if (nextElement === prevElement && context === internalInstance._context) { | |
// Since elements are immutable after the owner is rendered, | |
// we can do a cheap identity compare here to determine if this is a | |
// superfluous reconcile. It's possible for state to be mutable but such | |
// change should trigger an update of the owner which would recreate | |
// the element. We explicitly check for the existence of an owner since | |
// it's possible for an element created outside a composite to be | |
// deeply mutated and reused. | |
// TODO: Bailing out early is just a perf optimization right? | |
// TODO: Removing the return statement should affect correctness? | |
return; | |
} | |
if (false) { | |
if (internalInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement); | |
} | |
} | |
var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement); | |
if (refsChanged) { | |
ReactRef.detachRefs(internalInstance, prevElement); | |
} | |
internalInstance.receiveComponent(nextElement, transaction, context); | |
if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) { | |
transaction.getReactMountReady().enqueue(attachRefs, internalInstance); | |
} | |
if (false) { | |
if (internalInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); | |
} | |
} | |
}, | |
/** | |
* Flush any dirty changes in a component. | |
* | |
* @param {ReactComponent} internalInstance | |
* @param {ReactReconcileTransaction} transaction | |
* @internal | |
*/ | |
performUpdateIfNecessary: function (internalInstance, transaction, updateBatchNumber) { | |
if (internalInstance._updateBatchNumber !== updateBatchNumber) { | |
// The component's enqueued batch number should always be the current | |
// batch or the following one. | |
false ? warning(internalInstance._updateBatchNumber == null || internalInstance._updateBatchNumber === updateBatchNumber + 1, 'performUpdateIfNecessary: Unexpected batch number (current %s, ' + 'pending %s)', updateBatchNumber, internalInstance._updateBatchNumber) : void 0; | |
return; | |
} | |
if (false) { | |
if (internalInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement); | |
} | |
} | |
internalInstance.performUpdateIfNecessary(transaction); | |
if (false) { | |
if (internalInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); | |
} | |
} | |
} | |
}; | |
module.exports = ReactReconciler; | |
/***/ }), | |
/* 17 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _assign = __webpack_require__(3); | |
var ReactChildren = __webpack_require__(197); | |
var ReactComponent = __webpack_require__(48); | |
var ReactPureComponent = __webpack_require__(202); | |
var ReactClass = __webpack_require__(198); | |
var ReactDOMFactories = __webpack_require__(199); | |
var ReactElement = __webpack_require__(18); | |
var ReactPropTypes = __webpack_require__(201); | |
var ReactVersion = __webpack_require__(203); | |
var onlyChild = __webpack_require__(206); | |
var warning = __webpack_require__(1); | |
var createElement = ReactElement.createElement; | |
var createFactory = ReactElement.createFactory; | |
var cloneElement = ReactElement.cloneElement; | |
if (false) { | |
var canDefineProperty = require('./canDefineProperty'); | |
var ReactElementValidator = require('./ReactElementValidator'); | |
var didWarnPropTypesDeprecated = false; | |
createElement = ReactElementValidator.createElement; | |
createFactory = ReactElementValidator.createFactory; | |
cloneElement = ReactElementValidator.cloneElement; | |
} | |
var __spread = _assign; | |
if (false) { | |
var warned = false; | |
__spread = function () { | |
process.env.NODE_ENV !== 'production' ? warning(warned, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.') : void 0; | |
warned = true; | |
return _assign.apply(null, arguments); | |
}; | |
} | |
var React = { | |
// Modern | |
Children: { | |
map: ReactChildren.map, | |
forEach: ReactChildren.forEach, | |
count: ReactChildren.count, | |
toArray: ReactChildren.toArray, | |
only: onlyChild | |
}, | |
Component: ReactComponent, | |
PureComponent: ReactPureComponent, | |
createElement: createElement, | |
cloneElement: cloneElement, | |
isValidElement: ReactElement.isValidElement, | |
// Classic | |
PropTypes: ReactPropTypes, | |
createClass: ReactClass.createClass, | |
createFactory: createFactory, | |
createMixin: function (mixin) { | |
// Currently a noop. Will be used to validate and trace mixins. | |
return mixin; | |
}, | |
// This looks DOM specific but these are actually isomorphic helpers | |
// since they are just generating DOM strings. | |
DOM: ReactDOMFactories, | |
version: ReactVersion, | |
// Deprecated hook for JSX spread, don't use this for anything. | |
__spread: __spread | |
}; | |
// TODO: Fix tests so that this deprecation warning doesn't cause failures. | |
if (false) { | |
if (canDefineProperty) { | |
Object.defineProperty(React, 'PropTypes', { | |
get: function () { | |
process.env.NODE_ENV !== 'production' ? warning(didWarnPropTypesDeprecated, 'Accessing PropTypes via the main React package is deprecated. Use ' + 'the prop-types package from npm instead.') : void 0; | |
didWarnPropTypesDeprecated = true; | |
return ReactPropTypes; | |
} | |
}); | |
} | |
} | |
module.exports = React; | |
/***/ }), | |
/* 18 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2014-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _assign = __webpack_require__(3); | |
var ReactCurrentOwner = __webpack_require__(11); | |
var warning = __webpack_require__(1); | |
var canDefineProperty = __webpack_require__(85); | |
var hasOwnProperty = Object.prototype.hasOwnProperty; | |
var REACT_ELEMENT_TYPE = __webpack_require__(84); | |
var RESERVED_PROPS = { | |
key: true, | |
ref: true, | |
__self: true, | |
__source: true | |
}; | |
var specialPropKeyWarningShown, specialPropRefWarningShown; | |
function hasValidRef(config) { | |
if (false) { | |
if (hasOwnProperty.call(config, 'ref')) { | |
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; | |
if (getter && getter.isReactWarning) { | |
return false; | |
} | |
} | |
} | |
return config.ref !== undefined; | |
} | |
function hasValidKey(config) { | |
if (false) { | |
if (hasOwnProperty.call(config, 'key')) { | |
var getter = Object.getOwnPropertyDescriptor(config, 'key').get; | |
if (getter && getter.isReactWarning) { | |
return false; | |
} | |
} | |
} | |
return config.key !== undefined; | |
} | |
function defineKeyPropWarningGetter(props, displayName) { | |
var warnAboutAccessingKey = function () { | |
if (!specialPropKeyWarningShown) { | |
specialPropKeyWarningShown = true; | |
false ? warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0; | |
} | |
}; | |
warnAboutAccessingKey.isReactWarning = true; | |
Object.defineProperty(props, 'key', { | |
get: warnAboutAccessingKey, | |
configurable: true | |
}); | |
} | |
function defineRefPropWarningGetter(props, displayName) { | |
var warnAboutAccessingRef = function () { | |
if (!specialPropRefWarningShown) { | |
specialPropRefWarningShown = true; | |
false ? warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0; | |
} | |
}; | |
warnAboutAccessingRef.isReactWarning = true; | |
Object.defineProperty(props, 'ref', { | |
get: warnAboutAccessingRef, | |
configurable: true | |
}); | |
} | |
/** | |
* Factory method to create a new React element. This no longer adheres to | |
* the class pattern, so do not use new to call it. Also, no instanceof check | |
* will work. Instead test $$typeof field against Symbol.for('react.element') to check | |
* if something is a React Element. | |
* | |
* @param {*} type | |
* @param {*} key | |
* @param {string|object} ref | |
* @param {*} self A *temporary* helper to detect places where `this` is | |
* different from the `owner` when React.createElement is called, so that we | |
* can warn. We want to get rid of owner and replace string `ref`s with arrow | |
* functions, and as long as `this` and owner are the same, there will be no | |
* change in behavior. | |
* @param {*} source An annotation object (added by a transpiler or otherwise) | |
* indicating filename, line number, and/or other information. | |
* @param {*} owner | |
* @param {*} props | |
* @internal | |
*/ | |
var ReactElement = function (type, key, ref, self, source, owner, props) { | |
var element = { | |
// This tag allow us to uniquely identify this as a React Element | |
$$typeof: REACT_ELEMENT_TYPE, | |
// Built-in properties that belong on the element | |
type: type, | |
key: key, | |
ref: ref, | |
props: props, | |
// Record the component responsible for creating this element. | |
_owner: owner | |
}; | |
if (false) { | |
// The validation flag is currently mutative. We put it on | |
// an external backing store so that we can freeze the whole object. | |
// This can be replaced with a WeakMap once they are implemented in | |
// commonly used development environments. | |
element._store = {}; | |
// To make comparing ReactElements easier for testing purposes, we make | |
// the validation flag non-enumerable (where possible, which should | |
// include every environment we run tests in), so the test framework | |
// ignores it. | |
if (canDefineProperty) { | |
Object.defineProperty(element._store, 'validated', { | |
configurable: false, | |
enumerable: false, | |
writable: true, | |
value: false | |
}); | |
// self and source are DEV only properties. | |
Object.defineProperty(element, '_self', { | |
configurable: false, | |
enumerable: false, | |
writable: false, | |
value: self | |
}); | |
// Two elements created in two different places should be considered | |
// equal for testing purposes and therefore we hide it from enumeration. | |
Object.defineProperty(element, '_source', { | |
configurable: false, | |
enumerable: false, | |
writable: false, | |
value: source | |
}); | |
} else { | |
element._store.validated = false; | |
element._self = self; | |
element._source = source; | |
} | |
if (Object.freeze) { | |
Object.freeze(element.props); | |
Object.freeze(element); | |
} | |
} | |
return element; | |
}; | |
/** | |
* Create and return a new ReactElement of the given type. | |
* See https://facebook.github.io/react/docs/top-level-api.html#react.createelement | |
*/ | |
ReactElement.createElement = function (type, config, children) { | |
var propName; | |
// Reserved names are extracted | |
var props = {}; | |
var key = null; | |
var ref = null; | |
var self = null; | |
var source = null; | |
if (config != null) { | |
if (hasValidRef(config)) { | |
ref = config.ref; | |
} | |
if (hasValidKey(config)) { | |
key = '' + config.key; | |
} | |
self = config.__self === undefined ? null : config.__self; | |
source = config.__source === undefined ? null : config.__source; | |
// Remaining properties are added to a new props object | |
for (propName in config) { | |
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { | |
props[propName] = config[propName]; | |
} | |
} | |
} | |
// Children can be more than one argument, and those are transferred onto | |
// the newly allocated props object. | |
var childrenLength = arguments.length - 2; | |
if (childrenLength === 1) { | |
props.children = children; | |
} else if (childrenLength > 1) { | |
var childArray = Array(childrenLength); | |
for (var i = 0; i < childrenLength; i++) { | |
childArray[i] = arguments[i + 2]; | |
} | |
if (false) { | |
if (Object.freeze) { | |
Object.freeze(childArray); | |
} | |
} | |
props.children = childArray; | |
} | |
// Resolve default props | |
if (type && type.defaultProps) { | |
var defaultProps = type.defaultProps; | |
for (propName in defaultProps) { | |
if (props[propName] === undefined) { | |
props[propName] = defaultProps[propName]; | |
} | |
} | |
} | |
if (false) { | |
if (key || ref) { | |
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) { | |
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; | |
if (key) { | |
defineKeyPropWarningGetter(props, displayName); | |
} | |
if (ref) { | |
defineRefPropWarningGetter(props, displayName); | |
} | |
} | |
} | |
} | |
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); | |
}; | |
/** | |
* Return a function that produces ReactElements of a given type. | |
* See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory | |
*/ | |
ReactElement.createFactory = function (type) { | |
var factory = ReactElement.createElement.bind(null, type); | |
// Expose the type on the factory and the prototype so that it can be | |
// easily accessed on elements. E.g. `<Foo />.type === Foo`. | |
// This should not be named `constructor` since this may not be the function | |
// that created the element, and it may not even be a constructor. | |
// Legacy hook TODO: Warn if this is accessed | |
factory.type = type; | |
return factory; | |
}; | |
ReactElement.cloneAndReplaceKey = function (oldElement, newKey) { | |
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); | |
return newElement; | |
}; | |
/** | |
* Clone and return a new ReactElement using element as the starting point. | |
* See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement | |
*/ | |
ReactElement.cloneElement = function (element, config, children) { | |
var propName; | |
// Original props are copied | |
var props = _assign({}, element.props); | |
// Reserved names are extracted | |
var key = element.key; | |
var ref = element.ref; | |
// Self is preserved since the owner is preserved. | |
var self = element._self; | |
// Source is preserved since cloneElement is unlikely to be targeted by a | |
// transpiler, and the original source is probably a better indicator of the | |
// true owner. | |
var source = element._source; | |
// Owner will be preserved, unless ref is overridden | |
var owner = element._owner; | |
if (config != null) { | |
if (hasValidRef(config)) { | |
// Silently steal the ref from the parent. | |
ref = config.ref; | |
owner = ReactCurrentOwner.current; | |
} | |
if (hasValidKey(config)) { | |
key = '' + config.key; | |
} | |
// Remaining properties override existing props | |
var defaultProps; | |
if (element.type && element.type.defaultProps) { | |
defaultProps = element.type.defaultProps; | |
} | |
for (propName in config) { | |
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { | |
if (config[propName] === undefined && defaultProps !== undefined) { | |
// Resolve default props | |
props[propName] = defaultProps[propName]; | |
} else { | |
props[propName] = config[propName]; | |
} | |
} | |
} | |
} | |
// Children can be more than one argument, and those are transferred onto | |
// the newly allocated props object. | |
var childrenLength = arguments.length - 2; | |
if (childrenLength === 1) { | |
props.children = children; | |
} else if (childrenLength > 1) { | |
var childArray = Array(childrenLength); | |
for (var i = 0; i < childrenLength; i++) { | |
childArray[i] = arguments[i + 2]; | |
} | |
props.children = childArray; | |
} | |
return ReactElement(element.type, key, ref, self, source, owner, props); | |
}; | |
/** | |
* Verifies the object is a ReactElement. | |
* See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement | |
* @param {?object} object | |
* @return {boolean} True if `object` is a valid component. | |
* @final | |
*/ | |
ReactElement.isValidElement = function (object) { | |
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; | |
}; | |
module.exports = ReactElement; | |
/***/ }), | |
/* 19 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
/** | |
* WARNING: DO NOT manually require this module. | |
* This is a replacement for `invariant(...)` used by the error code system | |
* and will _only_ be required by the corresponding babel pass. | |
* It always throws. | |
*/ | |
function reactProdInvariant(code) { | |
var argCount = arguments.length - 1; | |
var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code; | |
for (var argIdx = 0; argIdx < argCount; argIdx++) { | |
message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]); | |
} | |
message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.'; | |
var error = new Error(message); | |
error.name = 'Invariant Violation'; | |
error.framesToPop = 1; // we don't care about reactProdInvariant's own frame | |
throw error; | |
} | |
module.exports = reactProdInvariant; | |
/***/ }), | |
/* 20 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var emptyObject = {}; | |
if (false) { | |
Object.freeze(emptyObject); | |
} | |
module.exports = emptyObject; | |
/***/ }), | |
/* 21 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(2); | |
var EventPluginRegistry = __webpack_require__(34); | |
var EventPluginUtils = __webpack_require__(35); | |
var ReactErrorUtils = __webpack_require__(39); | |
var accumulateInto = __webpack_require__(70); | |
var forEachAccumulated = __webpack_require__(71); | |
var invariant = __webpack_require__(0); | |
/** | |
* Internal store for event listeners | |
*/ | |
var listenerBank = {}; | |
/** | |
* Internal queue of events that have accumulated their dispatches and are | |
* waiting to have their dispatches executed. | |
*/ | |
var eventQueue = null; | |
/** | |
* Dispatches an event and releases it back into the pool, unless persistent. | |
* | |
* @param {?object} event Synthetic event to be dispatched. | |
* @param {boolean} simulated If the event is simulated (changes exn behavior) | |
* @private | |
*/ | |
var executeDispatchesAndRelease = function (event, simulated) { | |
if (event) { | |
EventPluginUtils.executeDispatchesInOrder(event, simulated); | |
if (!event.isPersistent()) { | |
event.constructor.release(event); | |
} | |
} | |
}; | |
var executeDispatchesAndReleaseSimulated = function (e) { | |
return executeDispatchesAndRelease(e, true); | |
}; | |
var executeDispatchesAndReleaseTopLevel = function (e) { | |
return executeDispatchesAndRelease(e, false); | |
}; | |
var getDictionaryKey = function (inst) { | |
// Prevents V8 performance issue: | |
// https://github.com/facebook/react/pull/7232 | |
return '.' + inst._rootNodeID; | |
}; | |
function isInteractive(tag) { | |
return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; | |
} | |
function shouldPreventMouseEvent(name, type, props) { | |
switch (name) { | |
case 'onClick': | |
case 'onClickCapture': | |
case 'onDoubleClick': | |
case 'onDoubleClickCapture': | |
case 'onMouseDown': | |
case 'onMouseDownCapture': | |
case 'onMouseMove': | |
case 'onMouseMoveCapture': | |
case 'onMouseUp': | |
case 'onMouseUpCapture': | |
return !!(props.disabled && isInteractive(type)); | |
default: | |
return false; | |
} | |
} | |
/** | |
* This is a unified interface for event plugins to be installed and configured. | |
* | |
* Event plugins can implement the following properties: | |
* | |
* `extractEvents` {function(string, DOMEventTarget, string, object): *} | |
* Required. When a top-level event is fired, this method is expected to | |
* extract synthetic events that will in turn be queued and dispatched. | |
* | |
* `eventTypes` {object} | |
* Optional, plugins that fire events must publish a mapping of registration | |
* names that are used to register listeners. Values of this mapping must | |
* be objects that contain `registrationName` or `phasedRegistrationNames`. | |
* | |
* `executeDispatch` {function(object, function, string)} | |
* Optional, allows plugins to override how an event gets dispatched. By | |
* default, the listener is simply invoked. | |
* | |
* Each plugin that is injected into `EventsPluginHub` is immediately operable. | |
* | |
* @public | |
*/ | |
var EventPluginHub = { | |
/** | |
* Methods for injecting dependencies. | |
*/ | |
injection: { | |
/** | |
* @param {array} InjectedEventPluginOrder | |
* @public | |
*/ | |
injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder, | |
/** | |
* @param {object} injectedNamesToPlugins Map from names to plugin modules. | |
*/ | |
injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName | |
}, | |
/** | |
* Stores `listener` at `listenerBank[registrationName][key]`. Is idempotent. | |
* | |
* @param {object} inst The instance, which is the source of events. | |
* @param {string} registrationName Name of listener (e.g. `onClick`). | |
* @param {function} listener The callback to store. | |
*/ | |
putListener: function (inst, registrationName, listener) { | |
!(typeof listener === 'function') ? false ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : _prodInvariant('94', registrationName, typeof listener) : void 0; | |
var key = getDictionaryKey(inst); | |
var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {}); | |
bankForRegistrationName[key] = listener; | |
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; | |
if (PluginModule && PluginModule.didPutListener) { | |
PluginModule.didPutListener(inst, registrationName, listener); | |
} | |
}, | |
/** | |
* @param {object} inst The instance, which is the source of events. | |
* @param {string} registrationName Name of listener (e.g. `onClick`). | |
* @return {?function} The stored callback. | |
*/ | |
getListener: function (inst, registrationName) { | |
// TODO: shouldPreventMouseEvent is DOM-specific and definitely should not | |
// live here; needs to be moved to a better place soon | |
var bankForRegistrationName = listenerBank[registrationName]; | |
if (shouldPreventMouseEvent(registrationName, inst._currentElement.type, inst._currentElement.props)) { | |
return null; | |
} | |
var key = getDictionaryKey(inst); | |
return bankForRegistrationName && bankForRegistrationName[key]; | |
}, | |
/** | |
* Deletes a listener from the registration bank. | |
* | |
* @param {object} inst The instance, which is the source of events. | |
* @param {string} registrationName Name of listener (e.g. `onClick`). | |
*/ | |
deleteListener: function (inst, registrationName) { | |
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; | |
if (PluginModule && PluginModule.willDeleteListener) { | |
PluginModule.willDeleteListener(inst, registrationName); | |
} | |
var bankForRegistrationName = listenerBank[registrationName]; | |
// TODO: This should never be null -- when is it? | |
if (bankForRegistrationName) { | |
var key = getDictionaryKey(inst); | |
delete bankForRegistrationName[key]; | |
} | |
}, | |
/** | |
* Deletes all listeners for the DOM element with the supplied ID. | |
* | |
* @param {object} inst The instance, which is the source of events. | |
*/ | |
deleteAllListeners: function (inst) { | |
var key = getDictionaryKey(inst); | |
for (var registrationName in listenerBank) { | |
if (!listenerBank.hasOwnProperty(registrationName)) { | |
continue; | |
} | |
if (!listenerBank[registrationName][key]) { | |
continue; | |
} | |
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; | |
if (PluginModule && PluginModule.willDeleteListener) { | |
PluginModule.willDeleteListener(inst, registrationName); | |
} | |
delete listenerBank[registrationName][key]; | |
} | |
}, | |
/** | |
* Allows registered plugins an opportunity to extract events from top-level | |
* native browser events. | |
* | |
* @return {*} An accumulation of synthetic events. | |
* @internal | |
*/ | |
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { | |
var events; | |
var plugins = EventPluginRegistry.plugins; | |
for (var i = 0; i < plugins.length; i++) { | |
// Not every plugin in the ordering may be loaded at runtime. | |
var possiblePlugin = plugins[i]; | |
if (possiblePlugin) { | |
var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); | |
if (extractedEvents) { | |
events = accumulateInto(events, extractedEvents); | |
} | |
} | |
} | |
return events; | |
}, | |
/** | |
* Enqueues a synthetic event that should be dispatched when | |
* `processEventQueue` is invoked. | |
* | |
* @param {*} events An accumulation of synthetic events. | |
* @internal | |
*/ | |
enqueueEvents: function (events) { | |
if (events) { | |
eventQueue = accumulateInto(eventQueue, events); | |
} | |
}, | |
/** | |
* Dispatches all synthetic events on the event queue. | |
* | |
* @internal | |
*/ | |
processEventQueue: function (simulated) { | |
// Set `eventQueue` to null before processing it so that we can tell if more | |
// events get enqueued while processing. | |
var processingEventQueue = eventQueue; | |
eventQueue = null; | |
if (simulated) { | |
forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated); | |
} else { | |
forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); | |
} | |
!!eventQueue ? false ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : _prodInvariant('95') : void 0; | |
// This would be a good time to rethrow if any of the event handlers threw. | |
ReactErrorUtils.rethrowCaughtError(); | |
}, | |
/** | |
* These are needed for tests only. Do not use! | |
*/ | |
__purge: function () { | |
listenerBank = {}; | |
}, | |
__getListenerBank: function () { | |
return listenerBank; | |
} | |
}; | |
module.exports = EventPluginHub; | |
/***/ }), | |
/* 22 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var EventPluginHub = __webpack_require__(21); | |
var EventPluginUtils = __webpack_require__(35); | |
var accumulateInto = __webpack_require__(70); | |
var forEachAccumulated = __webpack_require__(71); | |
var warning = __webpack_require__(1); | |
var getListener = EventPluginHub.getListener; | |
/** | |
* Some event types have a notion of different registration names for different | |
* "phases" of propagation. This finds listeners by a given phase. | |
*/ | |
function listenerAtPhase(inst, event, propagationPhase) { | |
var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; | |
return getListener(inst, registrationName); | |
} | |
/** | |
* Tags a `SyntheticEvent` with dispatched listeners. Creating this function | |
* here, allows us to not have to bind or create functions for each event. | |
* Mutating the event's members allows us to not have to create a wrapping | |
* "dispatch" object that pairs the event with the listener. | |
*/ | |
function accumulateDirectionalDispatches(inst, phase, event) { | |
if (false) { | |
process.env.NODE_ENV !== 'production' ? warning(inst, 'Dispatching inst must not be null') : void 0; | |
} | |
var listener = listenerAtPhase(inst, event, phase); | |
if (listener) { | |
event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); | |
event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); | |
} | |
} | |
/** | |
* Collect dispatches (must be entirely collected before dispatching - see unit | |
* tests). Lazily allocate the array to conserve memory. We must loop through | |
* each event and perform the traversal for each one. We cannot perform a | |
* single traversal for the entire collection of events because each event may | |
* have a different target. | |
*/ | |
function accumulateTwoPhaseDispatchesSingle(event) { | |
if (event && event.dispatchConfig.phasedRegistrationNames) { | |
EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); | |
} | |
} | |
/** | |
* Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID. | |
*/ | |
function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { | |
if (event && event.dispatchConfig.phasedRegistrationNames) { | |
var targetInst = event._targetInst; | |
var parentInst = targetInst ? EventPluginUtils.getParentInstance(targetInst) : null; | |
EventPluginUtils.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event); | |
} | |
} | |
/** | |
* Accumulates without regard to direction, does not look for phased | |
* registration names. Same as `accumulateDirectDispatchesSingle` but without | |
* requiring that the `dispatchMarker` be the same as the dispatched ID. | |
*/ | |
function accumulateDispatches(inst, ignoredDirection, event) { | |
if (event && event.dispatchConfig.registrationName) { | |
var registrationName = event.dispatchConfig.registrationName; | |
var listener = getListener(inst, registrationName); | |
if (listener) { | |
event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); | |
event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); | |
} | |
} | |
} | |
/** | |
* Accumulates dispatches on an `SyntheticEvent`, but only for the | |
* `dispatchMarker`. | |
* @param {SyntheticEvent} event | |
*/ | |
function accumulateDirectDispatchesSingle(event) { | |
if (event && event.dispatchConfig.registrationName) { | |
accumulateDispatches(event._targetInst, null, event); | |
} | |
} | |
function accumulateTwoPhaseDispatches(events) { | |
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); | |
} | |
function accumulateTwoPhaseDispatchesSkipTarget(events) { | |
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget); | |
} | |
function accumulateEnterLeaveDispatches(leave, enter, from, to) { | |
EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter); | |
} | |
function accumulateDirectDispatches(events) { | |
forEachAccumulated(events, accumulateDirectDispatchesSingle); | |
} | |
/** | |
* A small set of propagation patterns, each of which will accept a small amount | |
* of information, and generate a set of "dispatch ready event objects" - which | |
* are sets of events that have already been annotated with a set of dispatched | |
* listener functions/ids. The API is designed this way to discourage these | |
* propagation strategies from actually executing the dispatches, since we | |
* always want to collect the entire set of dispatches before executing event a | |
* single one. | |
* | |
* @constructor EventPropagators | |
*/ | |
var EventPropagators = { | |
accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches, | |
accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget, | |
accumulateDirectDispatches: accumulateDirectDispatches, | |
accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches | |
}; | |
module.exports = EventPropagators; | |
/***/ }), | |
/* 23 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/** | |
* `ReactInstanceMap` maintains a mapping from a public facing stateful | |
* instance (key) and the internal representation (value). This allows public | |
* methods to accept the user facing instance as an argument and map them back | |
* to internal methods. | |
*/ | |
// TODO: Replace this with ES6: var ReactInstanceMap = new Map(); | |
var ReactInstanceMap = { | |
/** | |
* This API should be called `delete` but we'd have to make sure to always | |
* transform these to strings for IE support. When this transform is fully | |
* supported we can rename it. | |
*/ | |
remove: function (key) { | |
key._reactInternalInstance = undefined; | |
}, | |
get: function (key) { | |
return key._reactInternalInstance; | |
}, | |
has: function (key) { | |
return key._reactInternalInstance !== undefined; | |
}, | |
set: function (key, value) { | |
key._reactInternalInstance = value; | |
} | |
}; | |
module.exports = ReactInstanceMap; | |
/***/ }), | |
/* 24 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var SyntheticEvent = __webpack_require__(10); | |
var getEventTarget = __webpack_require__(44); | |
/** | |
* @interface UIEvent | |
* @see http://www.w3.org/TR/DOM-Level-3-Events/ | |
*/ | |
var UIEventInterface = { | |
view: function (event) { | |
if (event.view) { | |
return event.view; | |
} | |
var target = getEventTarget(event); | |
if (target.window === target) { | |
// target is a window object | |
return target; | |
} | |
var doc = target.ownerDocument; | |
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. | |
if (doc) { | |
return doc.defaultView || doc.parentWindow; | |
} else { | |
return window; | |
} | |
}, | |
detail: function (event) { | |
return event.detail || 0; | |
} | |
}; | |
/** | |
* @param {object} dispatchConfig Configuration used to dispatch this event. | |
* @param {string} dispatchMarker Marker identifying the event target. | |
* @param {object} nativeEvent Native browser event. | |
* @extends {SyntheticEvent} | |
*/ | |
function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | |
return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | |
} | |
SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface); | |
module.exports = SyntheticUIEvent; | |
/***/ }), | |
/* 25 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _assign = __webpack_require__(3); | |
var EventPluginRegistry = __webpack_require__(34); | |
var ReactEventEmitterMixin = __webpack_require__(147); | |
var ViewportMetrics = __webpack_require__(69); | |
var getVendorPrefixedEventName = __webpack_require__(179); | |
var isEventSupported = __webpack_require__(45); | |
/** | |
* Summary of `ReactBrowserEventEmitter` event handling: | |
* | |
* - Top-level delegation is used to trap most native browser events. This | |
* may only occur in the main thread and is the responsibility of | |
* ReactEventListener, which is injected and can therefore support pluggable | |
* event sources. This is the only work that occurs in the main thread. | |
* | |
* - We normalize and de-duplicate events to account for browser quirks. This | |
* may be done in the worker thread. | |
* | |
* - Forward these native events (with the associated top-level type used to | |
* trap it) to `EventPluginHub`, which in turn will ask plugins if they want | |
* to extract any synthetic events. | |
* | |
* - The `EventPluginHub` will then process each event by annotating them with | |
* "dispatches", a sequence of listeners and IDs that care about that event. | |
* | |
* - The `EventPluginHub` then dispatches the events. | |
* | |
* Overview of React and the event system: | |
* | |
* +------------+ . | |
* | DOM | . | |
* +------------+ . | |
* | . | |
* v . | |
* +------------+ . | |
* | ReactEvent | . | |
* | Listener | . | |
* +------------+ . +-----------+ | |
* | . +--------+|SimpleEvent| | |
* | . | |Plugin | | |
* +-----|------+ . v +-----------+ | |
* | | | . +--------------+ +------------+ | |
* | +-----------.--->|EventPluginHub| | Event | | |
* | | . | | +-----------+ | Propagators| | |
* | ReactEvent | . | | |TapEvent | |------------| | |
* | Emitter | . | |<---+|Plugin | |other plugin| | |
* | | . | | +-----------+ | utilities | | |
* | +-----------.--->| | +------------+ | |
* | | | . +--------------+ | |
* +-----|------+ . ^ +-----------+ | |
* | . | |Enter/Leave| | |
* + . +-------+|Plugin | | |
* +-------------+ . +-----------+ | |
* | application | . | |
* |-------------| . | |
* | | . | |
* | | . | |
* +-------------+ . | |
* . | |
* React Core . General Purpose Event Plugin System | |
*/ | |
var hasEventPageXY; | |
var alreadyListeningTo = {}; | |
var isMonitoringScrollValue = false; | |
var reactTopListenersCounter = 0; | |
// For events like 'submit' which don't consistently bubble (which we trap at a | |
// lower node than `document`), binding at `document` would cause duplicate | |
// events so we don't include them here | |
var topEventMapping = { | |
topAbort: 'abort', | |
topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend', | |
topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration', | |
topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart', | |
topBlur: 'blur', | |
topCanPlay: 'canplay', | |
topCanPlayThrough: 'canplaythrough', | |
topChange: 'change', | |
topClick: 'click', | |
topCompositionEnd: 'compositionend', | |
topCompositionStart: 'compositionstart', | |
topCompositionUpdate: 'compositionupdate', | |
topContextMenu: 'contextmenu', | |
topCopy: 'copy', | |
topCut: 'cut', | |
topDoubleClick: 'dblclick', | |
topDrag: 'drag', | |
topDragEnd: 'dragend', | |
topDragEnter: 'dragenter', | |
topDragExit: 'dragexit', | |
topDragLeave: 'dragleave', | |
topDragOver: 'dragover', | |
topDragStart: 'dragstart', | |
topDrop: 'drop', | |
topDurationChange: 'durationchange', | |
topEmptied: 'emptied', | |
topEncrypted: 'encrypted', | |
topEnded: 'ended', | |
topError: 'error', | |
topFocus: 'focus', | |
topInput: 'input', | |
topKeyDown: 'keydown', | |
topKeyPress: 'keypress', | |
topKeyUp: 'keyup', | |
topLoadedData: 'loadeddata', | |
topLoadedMetadata: 'loadedmetadata', | |
topLoadStart: 'loadstart', | |
topMouseDown: 'mousedown', | |
topMouseMove: 'mousemove', | |
topMouseOut: 'mouseout', | |
topMouseOver: 'mouseover', | |
topMouseUp: 'mouseup', | |
topPaste: 'paste', | |
topPause: 'pause', | |
topPlay: 'play', | |
topPlaying: 'playing', | |
topProgress: 'progress', | |
topRateChange: 'ratechange', | |
topScroll: 'scroll', | |
topSeeked: 'seeked', | |
topSeeking: 'seeking', | |
topSelectionChange: 'selectionchange', | |
topStalled: 'stalled', | |
topSuspend: 'suspend', | |
topTextInput: 'textInput', | |
topTimeUpdate: 'timeupdate', | |
topTouchCancel: 'touchcancel', | |
topTouchEnd: 'touchend', | |
topTouchMove: 'touchmove', | |
topTouchStart: 'touchstart', | |
topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend', | |
topVolumeChange: 'volumechange', | |
topWaiting: 'waiting', | |
topWheel: 'wheel' | |
}; | |
/** | |
* To ensure no conflicts with other potential React instances on the page | |
*/ | |
var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2); | |
function getListeningForDocument(mountAt) { | |
// In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` | |
// directly. | |
if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { | |
mountAt[topListenersIDKey] = reactTopListenersCounter++; | |
alreadyListeningTo[mountAt[topListenersIDKey]] = {}; | |
} | |
return alreadyListeningTo[mountAt[topListenersIDKey]]; | |
} | |
/** | |
* `ReactBrowserEventEmitter` is used to attach top-level event listeners. For | |
* example: | |
* | |
* EventPluginHub.putListener('myID', 'onClick', myFunction); | |
* | |
* This would allocate a "registration" of `('onClick', myFunction)` on 'myID'. | |
* | |
* @internal | |
*/ | |
var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, { | |
/** | |
* Injectable event backend | |
*/ | |
ReactEventListener: null, | |
injection: { | |
/** | |
* @param {object} ReactEventListener | |
*/ | |
injectReactEventListener: function (ReactEventListener) { | |
ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel); | |
ReactBrowserEventEmitter.ReactEventListener = ReactEventListener; | |
} | |
}, | |
/** | |
* Sets whether or not any created callbacks should be enabled. | |
* | |
* @param {boolean} enabled True if callbacks should be enabled. | |
*/ | |
setEnabled: function (enabled) { | |
if (ReactBrowserEventEmitter.ReactEventListener) { | |
ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled); | |
} | |
}, | |
/** | |
* @return {boolean} True if callbacks are enabled. | |
*/ | |
isEnabled: function () { | |
return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled()); | |
}, | |
/** | |
* We listen for bubbled touch events on the document object. | |
* | |
* Firefox v8.01 (and possibly others) exhibited strange behavior when | |
* mounting `onmousemove` events at some node that was not the document | |
* element. The symptoms were that if your mouse is not moving over something | |
* contained within that mount point (for example on the background) the | |
* top-level listeners for `onmousemove` won't be called. However, if you | |
* register the `mousemove` on the document object, then it will of course | |
* catch all `mousemove`s. This along with iOS quirks, justifies restricting | |
* top-level listeners to the document object only, at least for these | |
* movement types of events and possibly all events. | |
* | |
* @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html | |
* | |
* Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but | |
* they bubble to document. | |
* | |
* @param {string} registrationName Name of listener (e.g. `onClick`). | |
* @param {object} contentDocumentHandle Document which owns the container | |
*/ | |
listenTo: function (registrationName, contentDocumentHandle) { | |
var mountAt = contentDocumentHandle; | |
var isListening = getListeningForDocument(mountAt); | |
var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName]; | |
for (var i = 0; i < dependencies.length; i++) { | |
var dependency = dependencies[i]; | |
if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { | |
if (dependency === 'topWheel') { | |
if (isEventSupported('wheel')) { | |
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'wheel', mountAt); | |
} else if (isEventSupported('mousewheel')) { | |
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'mousewheel', mountAt); | |
} else { | |
// Firefox needs to capture a different mouse scroll event. | |
// @see http://www.quirksmode.org/dom/events/tests/scroll.html | |
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'DOMMouseScroll', mountAt); | |
} | |
} else if (dependency === 'topScroll') { | |
if (isEventSupported('scroll', true)) { | |
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topScroll', 'scroll', mountAt); | |
} else { | |
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topScroll', 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE); | |
} | |
} else if (dependency === 'topFocus' || dependency === 'topBlur') { | |
if (isEventSupported('focus', true)) { | |
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topFocus', 'focus', mountAt); | |
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topBlur', 'blur', mountAt); | |
} else if (isEventSupported('focusin')) { | |
// IE has `focusin` and `focusout` events which bubble. | |
// @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html | |
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topFocus', 'focusin', mountAt); | |
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topBlur', 'focusout', mountAt); | |
} | |
// to make sure blur and focus event listeners are only attached once | |
isListening.topBlur = true; | |
isListening.topFocus = true; | |
} else if (topEventMapping.hasOwnProperty(dependency)) { | |
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt); | |
} | |
isListening[dependency] = true; | |
} | |
} | |
}, | |
trapBubbledEvent: function (topLevelType, handlerBaseName, handle) { | |
return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle); | |
}, | |
trapCapturedEvent: function (topLevelType, handlerBaseName, handle) { | |
return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle); | |
}, | |
/** | |
* Protect against document.createEvent() returning null | |
* Some popup blocker extensions appear to do this: | |
* https://github.com/facebook/react/issues/6887 | |
*/ | |
supportsEventPageXY: function () { | |
if (!document.createEvent) { | |
return false; | |
} | |
var ev = document.createEvent('MouseEvent'); | |
return ev != null && 'pageX' in ev; | |
}, | |
/** | |
* Listens to window scroll and resize events. We cache scroll values so that | |
* application code can access them without triggering reflows. | |
* | |
* ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when | |
* pageX/pageY isn't supported (legacy browsers). | |
* | |
* NOTE: Scroll events do not bubble. | |
* | |
* @see http://www.quirksmode.org/dom/events/scroll.html | |
*/ | |
ensureScrollValueMonitoring: function () { | |
if (hasEventPageXY === undefined) { | |
hasEventPageXY = ReactBrowserEventEmitter.supportsEventPageXY(); | |
} | |
if (!hasEventPageXY && !isMonitoringScrollValue) { | |
var refresh = ViewportMetrics.refreshScrollValues; | |
ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh); | |
isMonitoringScrollValue = true; | |
} | |
} | |
}); | |
module.exports = ReactBrowserEventEmitter; | |
/***/ }), | |
/* 26 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var SyntheticUIEvent = __webpack_require__(24); | |
var ViewportMetrics = __webpack_require__(69); | |
var getEventModifierState = __webpack_require__(43); | |
/** | |
* @interface MouseEvent | |
* @see http://www.w3.org/TR/DOM-Level-3-Events/ | |
*/ | |
var MouseEventInterface = { | |
screenX: null, | |
screenY: null, | |
clientX: null, | |
clientY: null, | |
ctrlKey: null, | |
shiftKey: null, | |
altKey: null, | |
metaKey: null, | |
getModifierState: getEventModifierState, | |
button: function (event) { | |
// Webkit, Firefox, IE9+ | |
// which: 1 2 3 | |
// button: 0 1 2 (standard) | |
var button = event.button; | |
if ('which' in event) { | |
return button; | |
} | |
// IE<9 | |
// which: undefined | |
// button: 0 0 0 | |
// button: 1 4 2 (onmouseup) | |
return button === 2 ? 2 : button === 4 ? 1 : 0; | |
}, | |
buttons: null, | |
relatedTarget: function (event) { | |
return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement); | |
}, | |
// "Proprietary" Interface. | |
pageX: function (event) { | |
return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft; | |
}, | |
pageY: function (event) { | |
return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop; | |
} | |
}; | |
/** | |
* @param {object} dispatchConfig Configuration used to dispatch this event. | |
* @param {string} dispatchMarker Marker identifying the event target. | |
* @param {object} nativeEvent Native browser event. | |
* @extends {SyntheticUIEvent} | |
*/ | |
function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | |
return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | |
} | |
SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface); | |
module.exports = SyntheticMouseEvent; | |
/***/ }), | |
/* 27 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(2); | |
var invariant = __webpack_require__(0); | |
var OBSERVED_ERROR = {}; | |
/** | |
* `Transaction` creates a black box that is able to wrap any method such that | |
* certain invariants are maintained before and after the method is invoked | |
* (Even if an exception is thrown while invoking the wrapped method). Whoever | |
* instantiates a transaction can provide enforcers of the invariants at | |
* creation time. The `Transaction` class itself will supply one additional | |
* automatic invariant for you - the invariant that any transaction instance | |
* should not be run while it is already being run. You would typically create a | |
* single instance of a `Transaction` for reuse multiple times, that potentially | |
* is used to wrap several different methods. Wrappers are extremely simple - | |
* they only require implementing two methods. | |
* | |
* <pre> | |
* wrappers (injected at creation time) | |
* + + | |
* | | | |
* +-----------------|--------|--------------+ | |
* | v | | | |
* | +---------------+ | | | |
* | +--| wrapper1 |---|----+ | | |
* | | +---------------+ v | | | |
* | | +-------------+ | | | |
* | | +----| wrapper2 |--------+ | | |
* | | | +-------------+ | | | | |
* | | | | | | | |
* | v v v v | wrapper | |
* | +---+ +---+ +---------+ +---+ +---+ | invariants | |
* perform(anyMethod) | | | | | | | | | | | | maintained | |
* +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|--------> | |
* | | | | | | | | | | | | | |
* | | | | | | | | | | | | | |
* | | | | | | | | | | | | | |
* | +---+ +---+ +---------+ +---+ +---+ | | |
* | initialize close | | |
* +-----------------------------------------+ | |
* </pre> | |
* | |
* Use cases: | |
* - Preserving the input selection ranges before/after reconciliation. | |
* Restoring selection even in the event of an unexpected error. | |
* - Deactivating events while rearranging the DOM, preventing blurs/focuses, | |
* while guaranteeing that afterwards, the event system is reactivated. | |
* - Flushing a queue of collected DOM mutations to the main UI thread after a | |
* reconciliation takes place in a worker thread. | |
* - Invoking any collected `componentDidUpdate` callbacks after rendering new | |
* content. | |
* - (Future use case): Wrapping particular flushes of the `ReactWorker` queue | |
* to preserve the `scrollTop` (an automatic scroll aware DOM). | |
* - (Future use case): Layout calculations before and after DOM updates. | |
* | |
* Transactional plugin API: | |
* - A module that has an `initialize` method that returns any precomputation. | |
* - and a `close` method that accepts the precomputation. `close` is invoked | |
* when the wrapped process is completed, or has failed. | |
* | |
* @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules | |
* that implement `initialize` and `close`. | |
* @return {Transaction} Single transaction for reuse in thread. | |
* | |
* @class Transaction | |
*/ | |
var TransactionImpl = { | |
/** | |
* Sets up this instance so that it is prepared for collecting metrics. Does | |
* so such that this setup method may be used on an instance that is already | |
* initialized, in a way that does not consume additional memory upon reuse. | |
* That can be useful if you decide to make your subclass of this mixin a | |
* "PooledClass". | |
*/ | |
reinitializeTransaction: function () { | |
this.transactionWrappers = this.getTransactionWrappers(); | |
if (this.wrapperInitData) { | |
this.wrapperInitData.length = 0; | |
} else { | |
this.wrapperInitData = []; | |
} | |
this._isInTransaction = false; | |
}, | |
_isInTransaction: false, | |
/** | |
* @abstract | |
* @return {Array<TransactionWrapper>} Array of transaction wrappers. | |
*/ | |
getTransactionWrappers: null, | |
isInTransaction: function () { | |
return !!this._isInTransaction; | |
}, | |
/** | |
* Executes the function within a safety window. Use this for the top level | |
* methods that result in large amounts of computation/mutations that would | |
* need to be safety checked. The optional arguments helps prevent the need | |
* to bind in many cases. | |
* | |
* @param {function} method Member of scope to call. | |
* @param {Object} scope Scope to invoke from. | |
* @param {Object?=} a Argument to pass to the method. | |
* @param {Object?=} b Argument to pass to the method. | |
* @param {Object?=} c Argument to pass to the method. | |
* @param {Object?=} d Argument to pass to the method. | |
* @param {Object?=} e Argument to pass to the method. | |
* @param {Object?=} f Argument to pass to the method. | |
* | |
* @return {*} Return value from `method`. | |
*/ | |
perform: function (method, scope, a, b, c, d, e, f) { | |
!!this.isInTransaction() ? false ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there is already an outstanding transaction.') : _prodInvariant('27') : void 0; | |
var errorThrown; | |
var ret; | |
try { | |
this._isInTransaction = true; | |
// Catching errors makes debugging more difficult, so we start with | |
// errorThrown set to true before setting it to false after calling | |
// close -- if it's still set to true in the finally block, it means | |
// one of these calls threw. | |
errorThrown = true; | |
this.initializeAll(0); | |
ret = method.call(scope, a, b, c, d, e, f); | |
errorThrown = false; | |
} finally { | |
try { | |
if (errorThrown) { | |
// If `method` throws, prefer to show that stack trace over any thrown | |
// by invoking `closeAll`. | |
try { | |
this.closeAll(0); | |
} catch (err) {} | |
} else { | |
// Since `method` didn't throw, we don't want to silence the exception | |
// here. | |
this.closeAll(0); | |
} | |
} finally { | |
this._isInTransaction = false; | |
} | |
} | |
return ret; | |
}, | |
initializeAll: function (startIndex) { | |
var transactionWrappers = this.transactionWrappers; | |
for (var i = startIndex; i < transactionWrappers.length; i++) { | |
var wrapper = transactionWrappers[i]; | |
try { | |
// Catching errors makes debugging more difficult, so we start with the | |
// OBSERVED_ERROR state before overwriting it with the real return value | |
// of initialize -- if it's still set to OBSERVED_ERROR in the finally | |
// block, it means wrapper.initialize threw. | |
this.wrapperInitData[i] = OBSERVED_ERROR; | |
this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null; | |
} finally { | |
if (this.wrapperInitData[i] === OBSERVED_ERROR) { | |
// The initializer for wrapper i threw an error; initialize the | |
// remaining wrappers but silence any exceptions from them to ensure | |
// that the first error is the one to bubble up. | |
try { | |
this.initializeAll(i + 1); | |
} catch (err) {} | |
} | |
} | |
} | |
}, | |
/** | |
* Invokes each of `this.transactionWrappers.close[i]` functions, passing into | |
* them the respective return values of `this.transactionWrappers.init[i]` | |
* (`close`rs that correspond to initializers that failed will not be | |
* invoked). | |
*/ | |
closeAll: function (startIndex) { | |
!this.isInTransaction() ? false ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : _prodInvariant('28') : void 0; | |
var transactionWrappers = this.transactionWrappers; | |
for (var i = startIndex; i < transactionWrappers.length; i++) { | |
var wrapper = transactionWrappers[i]; | |
var initData = this.wrapperInitData[i]; | |
var errorThrown; | |
try { | |
// Catching errors makes debugging more difficult, so we start with | |
// errorThrown set to true before setting it to false after calling | |
// close -- if it's still set to true in the finally block, it means | |
// wrapper.close threw. | |
errorThrown = true; | |
if (initData !== OBSERVED_ERROR && wrapper.close) { | |
wrapper.close.call(this, initData); | |
} | |
errorThrown = false; | |
} finally { | |
if (errorThrown) { | |
// The closer for wrapper i threw an error; close the remaining | |
// wrappers but silence any exceptions from them to ensure that the | |
// first error is the one to bubble up. | |
try { | |
this.closeAll(i + 1); | |
} catch (e) {} | |
} | |
} | |
} | |
this.wrapperInitData.length = 0; | |
} | |
}; | |
module.exports = TransactionImpl; | |
/***/ }), | |
/* 28 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2016-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* Based on the escape-html library, which is used under the MIT License below: | |
* | |
* Copyright (c) 2012-2013 TJ Holowaychuk | |
* Copyright (c) 2015 Andreas Lubbe | |
* Copyright (c) 2015 Tiancheng "Timothy" Gu | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining | |
* a copy of this software and associated documentation files (the | |
* 'Software'), to deal in the Software without restriction, including | |
* without limitation the rights to use, copy, modify, merge, publish, | |
* distribute, sublicense, and/or sell copies of the Software, and to | |
* permit persons to whom the Software is furnished to do so, subject to | |
* the following conditions: | |
* | |
* The above copyright notice and this permission notice shall be | |
* included in all copies or substantial portions of the Software. | |
* | |
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, | |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | |
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
* | |
*/ | |
// code copied and modified from escape-html | |
/** | |
* Module variables. | |
* @private | |
*/ | |
var matchHtmlRegExp = /["'&<>]/; | |
/** | |
* Escape special characters in the given string of html. | |
* | |
* @param {string} string The string to escape for inserting into HTML | |
* @return {string} | |
* @public | |
*/ | |
function escapeHtml(string) { | |
var str = '' + string; | |
var match = matchHtmlRegExp.exec(str); | |
if (!match) { | |
return str; | |
} | |
var escape; | |
var html = ''; | |
var index = 0; | |
var lastIndex = 0; | |
for (index = match.index; index < str.length; index++) { | |
switch (str.charCodeAt(index)) { | |
case 34: | |
// " | |
escape = '"'; | |
break; | |
case 38: | |
// & | |
escape = '&'; | |
break; | |
case 39: | |
// ' | |
escape = '''; // modified from escape-html; used to be ''' | |
break; | |
case 60: | |
// < | |
escape = '<'; | |
break; | |
case 62: | |
// > | |
escape = '>'; | |
break; | |
default: | |
continue; | |
} | |
if (lastIndex !== index) { | |
html += str.substring(lastIndex, index); | |
} | |
lastIndex = index + 1; | |
html += escape; | |
} | |
return lastIndex !== index ? html + str.substring(lastIndex, index) : html; | |
} | |
// end code copied and modified from escape-html | |
/** | |
* Escapes text to prevent scripting attacks. | |
* | |
* @param {*} text Text value to escape. | |
* @return {string} An escaped string. | |
*/ | |
function escapeTextContentForBrowser(text) { | |
if (typeof text === 'boolean' || typeof text === 'number') { | |
// this shortcircuit helps perf for types that we know will never have | |
// special characters, especially given that this function is used often | |
// for numeric dom ids. | |
return '' + text; | |
} | |
return escapeHtml(text); | |
} | |
module.exports = escapeTextContentForBrowser; | |
/***/ }), | |
/* 29 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ExecutionEnvironment = __webpack_require__(5); | |
var DOMNamespaces = __webpack_require__(33); | |
var WHITESPACE_TEST = /^[ \r\n\t\f]/; | |
var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/; | |
var createMicrosoftUnsafeLocalFunction = __webpack_require__(41); | |
// SVG temp container for IE lacking innerHTML | |
var reusableSVGContainer; | |
/** | |
* Set the innerHTML property of a node, ensuring that whitespace is preserved | |
* even in IE8. | |
* | |
* @param {DOMElement} node | |
* @param {string} html | |
* @internal | |
*/ | |
var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) { | |
// IE does not have innerHTML for SVG nodes, so instead we inject the | |
// new markup in a temp node and then move the child nodes across into | |
// the target node | |
if (node.namespaceURI === DOMNamespaces.svg && !('innerHTML' in node)) { | |
reusableSVGContainer = reusableSVGContainer || document.createElement('div'); | |
reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>'; | |
var svgNode = reusableSVGContainer.firstChild; | |
while (svgNode.firstChild) { | |
node.appendChild(svgNode.firstChild); | |
} | |
} else { | |
node.innerHTML = html; | |
} | |
}); | |
if (ExecutionEnvironment.canUseDOM) { | |
// IE8: When updating a just created node with innerHTML only leading | |
// whitespace is removed. When updating an existing node with innerHTML | |
// whitespace in root TextNodes is also collapsed. | |
// @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html | |
// Feature detection; only IE8 is known to behave improperly like this. | |
var testElement = document.createElement('div'); | |
testElement.innerHTML = ' '; | |
if (testElement.innerHTML === '') { | |
setInnerHTML = function (node, html) { | |
// Magic theory: IE8 supposedly differentiates between added and updated | |
// nodes when processing innerHTML, innerHTML on updated nodes suffers | |
// from worse whitespace behavior. Re-adding a node like this triggers | |
// the initial and more favorable whitespace behavior. | |
// TODO: What to do on a detached node? | |
if (node.parentNode) { | |
node.parentNode.replaceChild(node, node); | |
} | |
// We also implement a workaround for non-visible tags disappearing into | |
// thin air on IE8, this only happens if there is no visible text | |
// in-front of the non-visible tags. Piggyback on the whitespace fix | |
// and simply check if any non-visible tags appear in the source. | |
if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) { | |
// Recover leading whitespace by temporarily prepending any character. | |
// \uFEFF has the potential advantage of being zero-width/invisible. | |
// UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode | |
// in hopes that this is preserved even if "\uFEFF" is transformed to | |
// the actual Unicode character (by Babel, for example). | |
// https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216 | |
node.innerHTML = String.fromCharCode(0xFEFF) + html; | |
// deleteData leaves an empty `TextNode` which offsets the index of all | |
// children. Definitely want to avoid this. | |
var textNode = node.firstChild; | |
if (textNode.data.length === 1) { | |
node.removeChild(textNode); | |
} else { | |
textNode.deleteData(0, 1); | |
} | |
} else { | |
node.innerHTML = html; | |
} | |
}; | |
} | |
testElement = null; | |
} | |
module.exports = setInnerHTML; | |
/***/ }), | |
/* 30 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var pSlice = Array.prototype.slice; | |
var objectKeys = __webpack_require__(93); | |
var isArguments = __webpack_require__(92); | |
var deepEqual = module.exports = function (actual, expected, opts) { | |
if (!opts) opts = {}; | |
// 7.1. All identical values are equivalent, as determined by ===. | |
if (actual === expected) { | |
return true; | |
} else if (actual instanceof Date && expected instanceof Date) { | |
return actual.getTime() === expected.getTime(); | |
// 7.3. Other pairs that do not both pass typeof value == 'object', | |
// equivalence is determined by ==. | |
} else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') { | |
return opts.strict ? actual === expected : actual == expected; | |
// 7.4. For all other Object pairs, including Array objects, equivalence is | |
// determined by having the same number of owned properties (as verified | |
// with Object.prototype.hasOwnProperty.call), the same set of keys | |
// (although not necessarily the same order), equivalent values for every | |
// corresponding key, and an identical 'prototype' property. Note: this | |
// accounts for both named and indexed properties on Arrays. | |
} else { | |
return objEquiv(actual, expected, opts); | |
} | |
} | |
function isUndefinedOrNull(value) { | |
return value === null || value === undefined; | |
} | |
function isBuffer (x) { | |
if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false; | |
if (typeof x.copy !== 'function' || typeof x.slice !== 'function') { | |
return false; | |
} | |
if (x.length > 0 && typeof x[0] !== 'number') return false; | |
return true; | |
} | |
function objEquiv(a, b, opts) { | |
var i, key; | |
if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) | |
return false; | |
// an identical 'prototype' property. | |
if (a.prototype !== b.prototype) return false; | |
//~~~I've managed to break Object.keys through screwy arguments passing. | |
// Converting to array solves the problem. | |
if (isArguments(a)) { | |
if (!isArguments(b)) { | |
return false; | |
} | |
a = pSlice.call(a); | |
b = pSlice.call(b); | |
return deepEqual(a, b, opts); | |
} | |
if (isBuffer(a)) { | |
if (!isBuffer(b)) { | |
return false; | |
} | |
if (a.length !== b.length) return false; | |
for (i = 0; i < a.length; i++) { | |
if (a[i] !== b[i]) return false; | |
} | |
return true; | |
} | |
try { | |
var ka = objectKeys(a), | |
kb = objectKeys(b); | |
} catch (e) {//happens when one is a string literal and the other isn't | |
return false; | |
} | |
// having the same number of owned properties (keys incorporates | |
// hasOwnProperty) | |
if (ka.length != kb.length) | |
return false; | |
//the same set of keys (although not necessarily the same order), | |
ka.sort(); | |
kb.sort(); | |
//~~~cheap key test | |
for (i = ka.length - 1; i >= 0; i--) { | |
if (ka[i] != kb[i]) | |
return false; | |
} | |
//equivalent values for every corresponding key, and | |
//~~~possibly expensive deep test | |
for (i = ka.length - 1; i >= 0; i--) { | |
key = ka[i]; | |
if (!deepEqual(a[key], b[key], opts)) return false; | |
} | |
return typeof a === typeof b; | |
} | |
/***/ }), | |
/* 31 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
* | |
*/ | |
/*eslint-disable no-self-compare */ | |
var hasOwnProperty = Object.prototype.hasOwnProperty; | |
/** | |
* inlined Object.is polyfill to avoid requiring consumers ship their own | |
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is | |
*/ | |
function is(x, y) { | |
// SameValue algorithm | |
if (x === y) { | |
// Steps 1-5, 7-10 | |
// Steps 6.b-6.e: +0 != -0 | |
// Added the nonzero y check to make Flow happy, but it is redundant | |
return x !== 0 || y !== 0 || 1 / x === 1 / y; | |
} else { | |
// Step 6.a: NaN == NaN | |
return x !== x && y !== y; | |
} | |
} | |
/** | |
* Performs equality by iterating through keys on an object and returning false | |
* when any key has values which are not strictly equal between the arguments. | |
* Returns true when the values of all keys are strictly equal. | |
*/ | |
function shallowEqual(objA, objB) { | |
if (is(objA, objB)) { | |
return true; | |
} | |
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { | |
return false; | |
} | |
var keysA = Object.keys(objA); | |
var keysB = Object.keys(objB); | |
if (keysA.length !== keysB.length) { | |
return false; | |
} | |
// Test for A's keys different from B. | |
for (var i = 0; i < keysA.length; i++) { | |
if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { | |
return false; | |
} | |
} | |
return true; | |
} | |
module.exports = shallowEqual; | |
/***/ }), | |
/* 32 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var DOMLazyTree = __webpack_require__(14); | |
var Danger = __webpack_require__(124); | |
var ReactDOMComponentTree = __webpack_require__(4); | |
var ReactInstrumentation = __webpack_require__(8); | |
var createMicrosoftUnsafeLocalFunction = __webpack_require__(41); | |
var setInnerHTML = __webpack_require__(29); | |
var setTextContent = __webpack_require__(76); | |
function getNodeAfter(parentNode, node) { | |
// Special case for text components, which return [open, close] comments | |
// from getHostNode. | |
if (Array.isArray(node)) { | |
node = node[1]; | |
} | |
return node ? node.nextSibling : parentNode.firstChild; | |
} | |
/** | |
* Inserts `childNode` as a child of `parentNode` at the `index`. | |
* | |
* @param {DOMElement} parentNode Parent node in which to insert. | |
* @param {DOMElement} childNode Child node to insert. | |
* @param {number} index Index at which to insert the child. | |
* @internal | |
*/ | |
var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) { | |
// We rely exclusively on `insertBefore(node, null)` instead of also using | |
// `appendChild(node)`. (Using `undefined` is not allowed by all browsers so | |
// we are careful to use `null`.) | |
parentNode.insertBefore(childNode, referenceNode); | |
}); | |
function insertLazyTreeChildAt(parentNode, childTree, referenceNode) { | |
DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode); | |
} | |
function moveChild(parentNode, childNode, referenceNode) { | |
if (Array.isArray(childNode)) { | |
moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode); | |
} else { | |
insertChildAt(parentNode, childNode, referenceNode); | |
} | |
} | |
function removeChild(parentNode, childNode) { | |
if (Array.isArray(childNode)) { | |
var closingComment = childNode[1]; | |
childNode = childNode[0]; | |
removeDelimitedText(parentNode, childNode, closingComment); | |
parentNode.removeChild(closingComment); | |
} | |
parentNode.removeChild(childNode); | |
} | |
function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) { | |
var node = openingComment; | |
while (true) { | |
var nextNode = node.nextSibling; | |
insertChildAt(parentNode, node, referenceNode); | |
if (node === closingComment) { | |
break; | |
} | |
node = nextNode; | |
} | |
} | |
function removeDelimitedText(parentNode, startNode, closingComment) { | |
while (true) { | |
var node = startNode.nextSibling; | |
if (node === closingComment) { | |
// The closing comment is removed by ReactMultiChild. | |
break; | |
} else { | |
parentNode.removeChild(node); | |
} | |
} | |
} | |
function replaceDelimitedText(openingComment, closingComment, stringText) { | |
var parentNode = openingComment.parentNode; | |
var nodeAfterComment = openingComment.nextSibling; | |
if (nodeAfterComment === closingComment) { | |
// There are no text nodes between the opening and closing comments; insert | |
// a new one if stringText isn't empty. | |
if (stringText) { | |
insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment); | |
} | |
} else { | |
if (stringText) { | |
// Set the text content of the first node after the opening comment, and | |
// remove all following nodes up until the closing comment. | |
setTextContent(nodeAfterComment, stringText); | |
removeDelimitedText(parentNode, nodeAfterComment, closingComment); | |
} else { | |
removeDelimitedText(parentNode, openingComment, closingComment); | |
} | |
} | |
if (false) { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID, | |
type: 'replace text', | |
payload: stringText | |
}); | |
} | |
} | |
var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup; | |
if (false) { | |
dangerouslyReplaceNodeWithMarkup = function (oldChild, markup, prevInstance) { | |
Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup); | |
if (prevInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: prevInstance._debugID, | |
type: 'replace with', | |
payload: markup.toString() | |
}); | |
} else { | |
var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node); | |
if (nextInstance._debugID !== 0) { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: nextInstance._debugID, | |
type: 'mount', | |
payload: markup.toString() | |
}); | |
} | |
} | |
}; | |
} | |
/** | |
* Operations for updating with DOM children. | |
*/ | |
var DOMChildrenOperations = { | |
dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup, | |
replaceDelimitedText: replaceDelimitedText, | |
/** | |
* Updates a component's children by processing a series of updates. The | |
* update configurations are each expected to have a `parentNode` property. | |
* | |
* @param {array<object>} updates List of update configurations. | |
* @internal | |
*/ | |
processUpdates: function (parentNode, updates) { | |
if (false) { | |
var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID; | |
} | |
for (var k = 0; k < updates.length; k++) { | |
var update = updates[k]; | |
switch (update.type) { | |
case 'INSERT_MARKUP': | |
insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode)); | |
if (false) { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: parentNodeDebugID, | |
type: 'insert child', | |
payload: { toIndex: update.toIndex, content: update.content.toString() } | |
}); | |
} | |
break; | |
case 'MOVE_EXISTING': | |
moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode)); | |
if (false) { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: parentNodeDebugID, | |
type: 'move child', | |
payload: { fromIndex: update.fromIndex, toIndex: update.toIndex } | |
}); | |
} | |
break; | |
case 'SET_MARKUP': | |
setInnerHTML(parentNode, update.content); | |
if (false) { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: parentNodeDebugID, | |
type: 'replace children', | |
payload: update.content.toString() | |
}); | |
} | |
break; | |
case 'TEXT_CONTENT': | |
setTextContent(parentNode, update.content); | |
if (false) { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: parentNodeDebugID, | |
type: 'replace text', | |
payload: update.content.toString() | |
}); | |
} | |
break; | |
case 'REMOVE_NODE': | |
removeChild(parentNode, update.fromNode); | |
if (false) { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: parentNodeDebugID, | |
type: 'remove child', | |
payload: { fromIndex: update.fromIndex } | |
}); | |
} | |
break; | |
} | |
} | |
} | |
}; | |
module.exports = DOMChildrenOperations; | |
/***/ }), | |
/* 33 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var DOMNamespaces = { | |
html: 'http://www.w3.org/1999/xhtml', | |
mathml: 'http://www.w3.org/1998/Math/MathML', | |
svg: 'http://www.w3.org/2000/svg' | |
}; | |
module.exports = DOMNamespaces; | |
/***/ }), | |
/* 34 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(2); | |
var invariant = __webpack_require__(0); | |
/** | |
* Injectable ordering of event plugins. | |
*/ | |
var eventPluginOrder = null; | |
/** | |
* Injectable mapping from names to event plugin modules. | |
*/ | |
var namesToPlugins = {}; | |
/** | |
* Recomputes the plugin list using the injected plugins and plugin ordering. | |
* | |
* @private | |
*/ | |
function recomputePluginOrdering() { | |
if (!eventPluginOrder) { | |
// Wait until an `eventPluginOrder` is injected. | |
return; | |
} | |
for (var pluginName in namesToPlugins) { | |
var pluginModule = namesToPlugins[pluginName]; | |
var pluginIndex = eventPluginOrder.indexOf(pluginName); | |
!(pluginIndex > -1) ? false ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : _prodInvariant('96', pluginName) : void 0; | |
if (EventPluginRegistry.plugins[pluginIndex]) { | |
continue; | |
} | |
!pluginModule.extractEvents ? false ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : _prodInvariant('97', pluginName) : void 0; | |
EventPluginRegistry.plugins[pluginIndex] = pluginModule; | |
var publishedEvents = pluginModule.eventTypes; | |
for (var eventName in publishedEvents) { | |
!publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? false ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : _prodInvariant('98', eventName, pluginName) : void 0; | |
} | |
} | |
} | |
/** | |
* Publishes an event so that it can be dispatched by the supplied plugin. | |
* | |
* @param {object} dispatchConfig Dispatch configuration for the event. | |
* @param {object} PluginModule Plugin publishing the event. | |
* @return {boolean} True if the event was successfully published. | |
* @private | |
*/ | |
function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { | |
!!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? false ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : _prodInvariant('99', eventName) : void 0; | |
EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig; | |
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; | |
if (phasedRegistrationNames) { | |
for (var phaseName in phasedRegistrationNames) { | |
if (phasedRegistrationNames.hasOwnProperty(phaseName)) { | |
var phasedRegistrationName = phasedRegistrationNames[phaseName]; | |
publishRegistrationName(phasedRegistrationName, pluginModule, eventName); | |
} | |
} | |
return true; | |
} else if (dispatchConfig.registrationName) { | |
publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); | |
return true; | |
} | |
return false; | |
} | |
/** | |
* Publishes a registration name that is used to identify dispatched events and | |
* can be used with `EventPluginHub.putListener` to register listeners. | |
* | |
* @param {string} registrationName Registration name to add. | |
* @param {object} PluginModule Plugin publishing the event. | |
* @private | |
*/ | |
function publishRegistrationName(registrationName, pluginModule, eventName) { | |
!!EventPluginRegistry.registrationNameModules[registrationName] ? false ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : _prodInvariant('100', registrationName) : void 0; | |
EventPluginRegistry.registrationNameModules[registrationName] = pluginModule; | |
EventPluginRegistry.registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies; | |
if (false) { | |
var lowerCasedName = registrationName.toLowerCase(); | |
EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName; | |
if (registrationName === 'onDoubleClick') { | |
EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName; | |
} | |
} | |
} | |
/** | |
* Registers plugins so that they can extract and dispatch events. | |
* | |
* @see {EventPluginHub} | |
*/ | |
var EventPluginRegistry = { | |
/** | |
* Ordered list of injected plugins. | |
*/ | |
plugins: [], | |
/** | |
* Mapping from event name to dispatch config | |
*/ | |
eventNameDispatchConfigs: {}, | |
/** | |
* Mapping from registration name to plugin module | |
*/ | |
registrationNameModules: {}, | |
/** | |
* Mapping from registration name to event name | |
*/ | |
registrationNameDependencies: {}, | |
/** | |
* Mapping from lowercase registration names to the properly cased version, | |
* used to warn in the case of missing event handlers. Available | |
* only in __DEV__. | |
* @type {Object} | |
*/ | |
possibleRegistrationNames: false ? {} : null, | |
// Trust the developer to only use possibleRegistrationNames in __DEV__ | |
/** | |
* Injects an ordering of plugins (by plugin name). This allows the ordering | |
* to be decoupled from injection of the actual plugins so that ordering is | |
* always deterministic regardless of packaging, on-the-fly injection, etc. | |
* | |
* @param {array} InjectedEventPluginOrder | |
* @internal | |
* @see {EventPluginHub.injection.injectEventPluginOrder} | |
*/ | |
injectEventPluginOrder: function (injectedEventPluginOrder) { | |
!!eventPluginOrder ? false ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : _prodInvariant('101') : void 0; | |
// Clone the ordering so it cannot be dynamically mutated. | |
eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); | |
recomputePluginOrdering(); | |
}, | |
/** | |
* Injects plugins to be used by `EventPluginHub`. The plugin names must be | |
* in the ordering injected by `injectEventPluginOrder`. | |
* | |
* Plugins can be injected as part of page initialization or on-the-fly. | |
* | |
* @param {object} injectedNamesToPlugins Map from names to plugin modules. | |
* @internal | |
* @see {EventPluginHub.injection.injectEventPluginsByName} | |
*/ | |
injectEventPluginsByName: function (injectedNamesToPlugins) { | |
var isOrderingDirty = false; | |
for (var pluginName in injectedNamesToPlugins) { | |
if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { | |
continue; | |
} | |
var pluginModule = injectedNamesToPlugins[pluginName]; | |
if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { | |
!!namesToPlugins[pluginName] ? false ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : _prodInvariant('102', pluginName) : void 0; | |
namesToPlugins[pluginName] = pluginModule; | |
isOrderingDirty = true; | |
} | |
} | |
if (isOrderingDirty) { | |
recomputePluginOrdering(); | |
} | |
}, | |
/** | |
* Looks up the plugin for the supplied event. | |
* | |
* @param {object} event A synthetic event. | |
* @return {?object} The plugin that created the supplied event. | |
* @internal | |
*/ | |
getPluginModuleForEvent: function (event) { | |
var dispatchConfig = event.dispatchConfig; | |
if (dispatchConfig.registrationName) { | |
return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null; | |
} | |
if (dispatchConfig.phasedRegistrationNames !== undefined) { | |
// pulling phasedRegistrationNames out of dispatchConfig helps Flow see | |
// that it is not undefined. | |
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; | |
for (var phase in phasedRegistrationNames) { | |
if (!phasedRegistrationNames.hasOwnProperty(phase)) { | |
continue; | |
} | |
var pluginModule = EventPluginRegistry.registrationNameModules[phasedRegistrationNames[phase]]; | |
if (pluginModule) { | |
return pluginModule; | |
} | |
} | |
} | |
return null; | |
}, | |
/** | |
* Exposed for unit testing. | |
* @private | |
*/ | |
_resetEventPlugins: function () { | |
eventPluginOrder = null; | |
for (var pluginName in namesToPlugins) { | |
if (namesToPlugins.hasOwnProperty(pluginName)) { | |
delete namesToPlugins[pluginName]; | |
} | |
} | |
EventPluginRegistry.plugins.length = 0; | |
var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs; | |
for (var eventName in eventNameDispatchConfigs) { | |
if (eventNameDispatchConfigs.hasOwnProperty(eventName)) { | |
delete eventNameDispatchConfigs[eventName]; | |
} | |
} | |
var registrationNameModules = EventPluginRegistry.registrationNameModules; | |
for (var registrationName in registrationNameModules) { | |
if (registrationNameModules.hasOwnProperty(registrationName)) { | |
delete registrationNameModules[registrationName]; | |
} | |
} | |
if (false) { | |
var possibleRegistrationNames = EventPluginRegistry.possibleRegistrationNames; | |
for (var lowerCasedName in possibleRegistrationNames) { | |
if (possibleRegistrationNames.hasOwnProperty(lowerCasedName)) { | |
delete possibleRegistrationNames[lowerCasedName]; | |
} | |
} | |
} | |
} | |
}; | |
module.exports = EventPluginRegistry; | |
/***/ }), | |
/* 35 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(2); | |
var ReactErrorUtils = __webpack_require__(39); | |
var invariant = __webpack_require__(0); | |
var warning = __webpack_require__(1); | |
/** | |
* Injected dependencies: | |
*/ | |
/** | |
* - `ComponentTree`: [required] Module that can convert between React instances | |
* and actual node references. | |
*/ | |
var ComponentTree; | |
var TreeTraversal; | |
var injection = { | |
injectComponentTree: function (Injected) { | |
ComponentTree = Injected; | |
if (false) { | |
process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0; | |
} | |
}, | |
injectTreeTraversal: function (Injected) { | |
TreeTraversal = Injected; | |
if (false) { | |
process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.isAncestor && Injected.getLowestCommonAncestor, 'EventPluginUtils.injection.injectTreeTraversal(...): Injected ' + 'module is missing isAncestor or getLowestCommonAncestor.') : void 0; | |
} | |
} | |
}; | |
function isEndish(topLevelType) { | |
return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel'; | |
} | |
function isMoveish(topLevelType) { | |
return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove'; | |
} | |
function isStartish(topLevelType) { | |
return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart'; | |
} | |
var validateEventDispatches; | |
if (false) { | |
validateEventDispatches = function (event) { | |
var dispatchListeners = event._dispatchListeners; | |
var dispatchInstances = event._dispatchInstances; | |
var listenersIsArr = Array.isArray(dispatchListeners); | |
var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; | |
var instancesIsArr = Array.isArray(dispatchInstances); | |
var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; | |
process.env.NODE_ENV !== 'production' ? warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : void 0; | |
}; | |
} | |
/** | |
* Dispatch the event to the listener. | |
* @param {SyntheticEvent} event SyntheticEvent to handle | |
* @param {boolean} simulated If the event is simulated (changes exn behavior) | |
* @param {function} listener Application-level callback | |
* @param {*} inst Internal component instance | |
*/ | |
function executeDispatch(event, simulated, listener, inst) { | |
var type = event.type || 'unknown-event'; | |
event.currentTarget = EventPluginUtils.getNodeFromInstance(inst); | |
if (simulated) { | |
ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event); | |
} else { | |
ReactErrorUtils.invokeGuardedCallback(type, listener, event); | |
} | |
event.currentTarget = null; | |
} | |
/** | |
* Standard/simple iteration through an event's collected dispatches. | |
*/ | |
function executeDispatchesInOrder(event, simulated) { | |
var dispatchListeners = event._dispatchListeners; | |
var dispatchInstances = event._dispatchInstances; | |
if (false) { | |
validateEventDispatches(event); | |
} | |
if (Array.isArray(dispatchListeners)) { | |
for (var i = 0; i < dispatchListeners.length; i++) { | |
if (event.isPropagationStopped()) { | |
break; | |
} | |
// Listeners and Instances are two parallel arrays that are always in sync. | |
executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]); | |
} | |
} else if (dispatchListeners) { | |
executeDispatch(event, simulated, dispatchListeners, dispatchInstances); | |
} | |
event._dispatchListeners = null; | |
event._dispatchInstances = null; | |
} | |
/** | |
* Standard/simple iteration through an event's collected dispatches, but stops | |
* at the first dispatch execution returning true, and returns that id. | |
* | |
* @return {?string} id of the first dispatch execution who's listener returns | |
* true, or null if no listener returned true. | |
*/ | |
function executeDispatchesInOrderStopAtTrueImpl(event) { | |
var dispatchListeners = event._dispatchListeners; | |
var dispatchInstances = event._dispatchInstances; | |
if (false) { | |
validateEventDispatches(event); | |
} | |
if (Array.isArray(dispatchListeners)) { | |
for (var i = 0; i < dispatchListeners.length; i++) { | |
if (event.isPropagationStopped()) { | |
break; | |
} | |
// Listeners and Instances are two parallel arrays that are always in sync. | |
if (dispatchListeners[i](event, dispatchInstances[i])) { | |
return dispatchInstances[i]; | |
} | |
} | |
} else if (dispatchListeners) { | |
if (dispatchListeners(event, dispatchInstances)) { | |
return dispatchInstances; | |
} | |
} | |
return null; | |
} | |
/** | |
* @see executeDispatchesInOrderStopAtTrueImpl | |
*/ | |
function executeDispatchesInOrderStopAtTrue(event) { | |
var ret = executeDispatchesInOrderStopAtTrueImpl(event); | |
event._dispatchInstances = null; | |
event._dispatchListeners = null; | |
return ret; | |
} | |
/** | |
* Execution of a "direct" dispatch - there must be at most one dispatch | |
* accumulated on the event or it is considered an error. It doesn't really make | |
* sense for an event with multiple dispatches (bubbled) to keep track of the | |
* return values at each dispatch execution, but it does tend to make sense when | |
* dealing with "direct" dispatches. | |
* | |
* @return {*} The return value of executing the single dispatch. | |
*/ | |
function executeDirectDispatch(event) { | |
if (false) { | |
validateEventDispatches(event); | |
} | |
var dispatchListener = event._dispatchListeners; | |
var dispatchInstance = event._dispatchInstances; | |
!!Array.isArray(dispatchListener) ? false ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : _prodInvariant('103') : void 0; | |
event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null; | |
var res = dispatchListener ? dispatchListener(event) : null; | |
event.currentTarget = null; | |
event._dispatchListeners = null; | |
event._dispatchInstances = null; | |
return res; | |
} | |
/** | |
* @param {SyntheticEvent} event | |
* @return {boolean} True iff number of dispatches accumulated is greater than 0. | |
*/ | |
function hasDispatches(event) { | |
return !!event._dispatchListeners; | |
} | |
/** | |
* General utilities that are useful in creating custom Event Plugins. | |
*/ | |
var EventPluginUtils = { | |
isEndish: isEndish, | |
isMoveish: isMoveish, | |
isStartish: isStartish, | |
executeDirectDispatch: executeDirectDispatch, | |
executeDispatchesInOrder: executeDispatchesInOrder, | |
executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue, | |
hasDispatches: hasDispatches, | |
getInstanceFromNode: function (node) { | |
return ComponentTree.getInstanceFromNode(node); | |
}, | |
getNodeFromInstance: function (node) { | |
return ComponentTree.getNodeFromInstance(node); | |
}, | |
isAncestor: function (a, b) { | |
return TreeTraversal.isAncestor(a, b); | |
}, | |
getLowestCommonAncestor: function (a, b) { | |
return TreeTraversal.getLowestCommonAncestor(a, b); | |
}, | |
getParentInstance: function (inst) { | |
return TreeTraversal.getParentInstance(inst); | |
}, | |
traverseTwoPhase: function (target, fn, arg) { | |
return TreeTraversal.traverseTwoPhase(target, fn, arg); | |
}, | |
traverseEnterLeave: function (from, to, fn, argFrom, argTo) { | |
return TreeTraversal.traverseEnterLeave(from, to, fn, argFrom, argTo); | |
}, | |
injection: injection | |
}; | |
module.exports = EventPluginUtils; | |
/***/ }), | |
/* 36 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
/** | |
* Escape and wrap key so it is safe to use as a reactid | |
* | |
* @param {string} key to be escaped. | |
* @return {string} the escaped key. | |
*/ | |
function escape(key) { | |
var escapeRegex = /[=:]/g; | |
var escaperLookup = { | |
'=': '=0', | |
':': '=2' | |
}; | |
var escapedString = ('' + key).replace(escapeRegex, function (match) { | |
return escaperLookup[match]; | |
}); | |
return '$' + escapedString; | |
} | |
/** | |
* Unescape and unwrap key for human-readable display | |
* | |
* @param {string} key to unescape. | |
* @return {string} the unescaped key. | |
*/ | |
function unescape(key) { | |
var unescapeRegex = /(=0|=2)/g; | |
var unescaperLookup = { | |
'=0': '=', | |
'=2': ':' | |
}; | |
var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1); | |
return ('' + keySubstring).replace(unescapeRegex, function (match) { | |
return unescaperLookup[match]; | |
}); | |
} | |
var KeyEscapeUtils = { | |
escape: escape, | |
unescape: unescape | |
}; | |
module.exports = KeyEscapeUtils; | |
/***/ }), | |
/* 37 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(2); | |
var ReactPropTypesSecret = __webpack_require__(153); | |
var propTypesFactory = __webpack_require__(56); | |
var React = __webpack_require__(17); | |
var PropTypes = propTypesFactory(React.isValidElement); | |
var invariant = __webpack_require__(0); | |
var warning = __webpack_require__(1); | |
var hasReadOnlyValue = { | |
'button': true, | |
'checkbox': true, | |
'image': true, | |
'hidden': true, | |
'radio': true, | |
'reset': true, | |
'submit': true | |
}; | |
function _assertSingleLink(inputProps) { | |
!(inputProps.checkedLink == null || inputProps.valueLink == null) ? false ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use checkedLink, you probably don\'t want to use valueLink and vice versa.') : _prodInvariant('87') : void 0; | |
} | |
function _assertValueLink(inputProps) { | |
_assertSingleLink(inputProps); | |
!(inputProps.value == null && inputProps.onChange == null) ? false ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want to use value or onChange, you probably don\'t want to use valueLink.') : _prodInvariant('88') : void 0; | |
} | |
function _assertCheckedLink(inputProps) { | |
_assertSingleLink(inputProps); | |
!(inputProps.checked == null && inputProps.onChange == null) ? false ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. If you want to use checked or onChange, you probably don\'t want to use checkedLink') : _prodInvariant('89') : void 0; | |
} | |
var propTypes = { | |
value: function (props, propName, componentName) { | |
if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) { | |
return null; | |
} | |
return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); | |
}, | |
checked: function (props, propName, componentName) { | |
if (!props[propName] || props.onChange || props.readOnly || props.disabled) { | |
return null; | |
} | |
return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); | |
}, | |
onChange: PropTypes.func | |
}; | |
var loggedTypeFailures = {}; | |
function getDeclarationErrorAddendum(owner) { | |
if (owner) { | |
var name = owner.getName(); | |
if (name) { | |
return ' Check the render method of `' + name + '`.'; | |
} | |
} | |
return ''; | |
} | |
/** | |
* Provide a linked `value` attribute for controlled forms. You should not use | |
* this outside of the ReactDOM controlled form components. | |
*/ | |
var LinkedValueUtils = { | |
checkPropTypes: function (tagName, props, owner) { | |
for (var propName in propTypes) { | |
if (propTypes.hasOwnProperty(propName)) { | |
var error = propTypes[propName](props, propName, tagName, 'prop', null, ReactPropTypesSecret); | |
} | |
if (error instanceof Error && !(error.message in loggedTypeFailures)) { | |
// Only monitor this failure once because there tends to be a lot of the | |
// same error. | |
loggedTypeFailures[error.message] = true; | |
var addendum = getDeclarationErrorAddendum(owner); | |
false ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : void 0; | |
} | |
} | |
}, | |
/** | |
* @param {object} inputProps Props for form component | |
* @return {*} current value of the input either from value prop or link. | |
*/ | |
getValue: function (inputProps) { | |
if (inputProps.valueLink) { | |
_assertValueLink(inputProps); | |
return inputProps.valueLink.value; | |
} | |
return inputProps.value; | |
}, | |
/** | |
* @param {object} inputProps Props for form component | |
* @return {*} current checked status of the input either from checked prop | |
* or link. | |
*/ | |
getChecked: function (inputProps) { | |
if (inputProps.checkedLink) { | |
_assertCheckedLink(inputProps); | |
return inputProps.checkedLink.value; | |
} | |
return inputProps.checked; | |
}, | |
/** | |
* @param {object} inputProps Props for form component | |
* @param {SyntheticEvent} event change event to handle | |
*/ | |
executeOnChange: function (inputProps, event) { | |
if (inputProps.valueLink) { | |
_assertValueLink(inputProps); | |
return inputProps.valueLink.requestChange(event.target.value); | |
} else if (inputProps.checkedLink) { | |
_assertCheckedLink(inputProps); | |
return inputProps.checkedLink.requestChange(event.target.checked); | |
} else if (inputProps.onChange) { | |
return inputProps.onChange.call(undefined, event); | |
} | |
} | |
}; | |
module.exports = LinkedValueUtils; | |
/***/ }), | |
/* 38 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2014-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(2); | |
var invariant = __webpack_require__(0); | |
var injected = false; | |
var ReactComponentEnvironment = { | |
/** | |
* Optionally injectable hook for swapping out mount images in the middle of | |
* the tree. | |
*/ | |
replaceNodeWithMarkup: null, | |
/** | |
* Optionally injectable hook for processing a queue of child updates. Will | |
* later move into MultiChildComponents. | |
*/ | |
processChildrenUpdates: null, | |
injection: { | |
injectEnvironment: function (environment) { | |
!!injected ? false ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : _prodInvariant('104') : void 0; | |
ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup; | |
ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates; | |
injected = true; | |
} | |
} | |
}; | |
module.exports = ReactComponentEnvironment; | |
/***/ }), | |
/* 39 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var caughtError = null; | |
/** | |
* Call a function while guarding against errors that happens within it. | |
* | |
* @param {String} name of the guard to use for logging or debugging | |
* @param {Function} func The function to invoke | |
* @param {*} a First argument | |
* @param {*} b Second argument | |
*/ | |
function invokeGuardedCallback(name, func, a) { | |
try { | |
func(a); | |
} catch (x) { | |
if (caughtError === null) { | |
caughtError = x; | |
} | |
} | |
} | |
var ReactErrorUtils = { | |
invokeGuardedCallback: invokeGuardedCallback, | |
/** | |
* Invoked by ReactTestUtils.Simulate so that any errors thrown by the event | |
* handler are sure to be rethrown by rethrowCaughtError. | |
*/ | |
invokeGuardedCallbackWithCatch: invokeGuardedCallback, | |
/** | |
* During execution of guarded functions we will capture the first error which | |
* we will rethrow to be handled by the top level error handler. | |
*/ | |
rethrowCaughtError: function () { | |
if (caughtError) { | |
var error = caughtError; | |
caughtError = null; | |
throw error; | |
} | |
} | |
}; | |
if (false) { | |
/** | |
* To help development we can get better devtools integration by simulating a | |
* real browser event. | |
*/ | |
if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { | |
var fakeNode = document.createElement('react'); | |
ReactErrorUtils.invokeGuardedCallback = function (name, func, a) { | |
var boundFunc = func.bind(null, a); | |
var evtType = 'react-' + name; | |
fakeNode.addEventListener(evtType, boundFunc, false); | |
var evt = document.createEvent('Event'); | |
evt.initEvent(evtType, false, false); | |
fakeNode.dispatchEvent(evt); | |
fakeNode.removeEventListener(evtType, boundFunc, false); | |
}; | |
} | |
} | |
module.exports = ReactErrorUtils; | |
/***/ }), | |
/* 40 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2015-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(2); | |
var ReactCurrentOwner = __webpack_require__(11); | |
var ReactInstanceMap = __webpack_require__(23); | |
var ReactInstrumentation = __webpack_require__(8); | |
var ReactUpdates = __webpack_require__(9); | |
var invariant = __webpack_require__(0); | |
var warning = __webpack_require__(1); | |
function enqueueUpdate(internalInstance) { | |
ReactUpdates.enqueueUpdate(internalInstance); | |
} | |
function formatUnexpectedArgument(arg) { | |
var type = typeof arg; | |
if (type !== 'object') { | |
return type; | |
} | |
var displayName = arg.constructor && arg.constructor.name || type; | |
var keys = Object.keys(arg); | |
if (keys.length > 0 && keys.length < 20) { | |
return displayName + ' (keys: ' + keys.join(', ') + ')'; | |
} | |
return displayName; | |
} | |
function getInternalInstanceReadyForUpdate(publicInstance, callerName) { | |
var internalInstance = ReactInstanceMap.get(publicInstance); | |
if (!internalInstance) { | |
if (false) { | |
var ctor = publicInstance.constructor; | |
// Only warn when we have a callerName. Otherwise we should be silent. | |
// We're probably calling from enqueueCallback. We don't want to warn | |
// there because we already warned for the corresponding lifecycle method. | |
process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, ctor && (ctor.displayName || ctor.name) || 'ReactClass') : void 0; | |
} | |
return null; | |
} | |
if (false) { | |
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition (such as ' + 'within `render` or another component\'s constructor). Render methods ' + 'should be a pure function of props and state; constructor ' + 'side-effects are an anti-pattern, but can be moved to ' + '`componentWillMount`.', callerName) : void 0; | |
} | |
return internalInstance; | |
} | |
/** | |
* ReactUpdateQueue allows for state updates to be scheduled into a later | |
* reconciliation step. | |
*/ | |
var ReactUpdateQueue = { | |
/** | |
* Checks whether or not this composite component is mounted. | |
* @param {ReactClass} publicInstance The instance we want to test. | |
* @return {boolean} True if mounted, false otherwise. | |
* @protected | |
* @final | |
*/ | |
isMounted: function (publicInstance) { | |
if (false) { | |
var owner = ReactCurrentOwner.current; | |
if (owner !== null) { | |
process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0; | |
owner._warnedAboutRefsInRender = true; | |
} | |
} | |
var internalInstance = ReactInstanceMap.get(publicInstance); | |
if (internalInstance) { | |
// During componentWillMount and render this will still be null but after | |
// that will always render to something. At least for now. So we can use | |
// this hack. | |
return !!internalInstance._renderedComponent; | |
} else { | |
return false; | |
} | |
}, | |
/** | |
* Enqueue a callback that will be executed after all the pending updates | |
* have processed. | |
* | |
* @param {ReactClass} publicInstance The instance to use as `this` context. | |
* @param {?function} callback Called after state is updated. | |
* @param {string} callerName Name of the calling function in the public API. | |
* @internal | |
*/ | |
enqueueCallback: function (publicInstance, callback, callerName) { | |
ReactUpdateQueue.validateCallback(callback, callerName); | |
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance); | |
// Previously we would throw an error if we didn't have an internal | |
// instance. Since we want to make it a no-op instead, we mirror the same | |
// behavior we have in other enqueue* methods. | |
// We also need to ignore callbacks in componentWillMount. See | |
// enqueueUpdates. | |
if (!internalInstance) { | |
return null; | |
} | |
if (internalInstance._pendingCallbacks) { | |
internalInstance._pendingCallbacks.push(callback); | |
} else { | |
internalInstance._pendingCallbacks = [callback]; | |
} | |
// TODO: The callback here is ignored when setState is called from | |
// componentWillMount. Either fix it or disallow doing so completely in | |
// favor of getInitialState. Alternatively, we can disallow | |
// componentWillMount during server-side rendering. | |
enqueueUpdate(internalInstance); | |
}, | |
enqueueCallbackInternal: function (internalInstance, callback) { | |
if (internalInstance._pendingCallbacks) { | |
internalInstance._pendingCallbacks.push(callback); | |
} else { | |
internalInstance._pendingCallbacks = [callback]; | |
} | |
enqueueUpdate(internalInstance); | |
}, | |
/** | |
* Forces an update. This should only be invoked when it is known with | |
* certainty that we are **not** in a DOM transaction. | |
* | |
* You may want to call this when you know that some deeper aspect of the | |
* component's state has changed but `setState` was not called. | |
* | |
* This will not invoke `shouldComponentUpdate`, but it will invoke | |
* `componentWillUpdate` and `componentDidUpdate`. | |
* | |
* @param {ReactClass} publicInstance The instance that should rerender. | |
* @internal | |
*/ | |
enqueueForceUpdate: function (publicInstance) { | |
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate'); | |
if (!internalInstance) { | |
return; | |
} | |
internalInstance._pendingForceUpdate = true; | |
enqueueUpdate(internalInstance); | |
}, | |
/** | |
* Replaces all of the state. Always use this or `setState` to mutate state. | |
* You should treat `this.state` as immutable. | |
* | |
* There is no guarantee that `this.state` will be immediately updated, so | |
* accessing `this.state` after calling this method may return the old value. | |
* | |
* @param {ReactClass} publicInstance The instance that should rerender. | |
* @param {object} completeState Next state. | |
* @internal | |
*/ | |
enqueueReplaceState: function (publicInstance, completeState, callback) { | |
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState'); | |
if (!internalInstance) { | |
return; | |
} | |
internalInstance._pendingStateQueue = [completeState]; | |
internalInstance._pendingReplaceState = true; | |
// Future-proof 15.5 | |
if (callback !== undefined && callback !== null) { | |
ReactUpdateQueue.validateCallback(callback, 'replaceState'); | |
if (internalInstance._pendingCallbacks) { | |
internalInstance._pendingCallbacks.push(callback); | |
} else { | |
internalInstance._pendingCallbacks = [callback]; | |
} | |
} | |
enqueueUpdate(internalInstance); | |
}, | |
/** | |
* Sets a subset of the state. This only exists because _pendingState is | |
* internal. This provides a merging strategy that is not available to deep | |
* properties which is confusing. TODO: Expose pendingState or don't use it | |
* during the merge. | |
* | |
* @param {ReactClass} publicInstance The instance that should rerender. | |
* @param {object} partialState Next partial state to be merged with state. | |
* @internal | |
*/ | |
enqueueSetState: function (publicInstance, partialState) { | |
if (false) { | |
ReactInstrumentation.debugTool.onSetState(); | |
process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0; | |
} | |
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState'); | |
if (!internalInstance) { | |
return; | |
} | |
var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []); | |
queue.push(partialState); | |
enqueueUpdate(internalInstance); | |
}, | |
enqueueElementInternal: function (internalInstance, nextElement, nextContext) { | |
internalInstance._pendingElement = nextElement; | |
// TODO: introduce _pendingContext instead of setting it directly. | |
internalInstance._context = nextContext; | |
enqueueUpdate(internalInstance); | |
}, | |
validateCallback: function (callback, callerName) { | |
!(!callback || typeof callback === 'function') ? false ? invariant(false, '%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.', callerName, formatUnexpectedArgument(callback)) : _prodInvariant('122', callerName, formatUnexpectedArgument(callback)) : void 0; | |
} | |
}; | |
module.exports = ReactUpdateQueue; | |
/***/ }), | |
/* 41 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/* globals MSApp */ | |
/** | |
* Create a function which has 'unsafe' privileges (required by windows8 apps) | |
*/ | |
var createMicrosoftUnsafeLocalFunction = function (func) { | |
if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { | |
return function (arg0, arg1, arg2, arg3) { | |
MSApp.execUnsafeLocalFunction(function () { | |
return func(arg0, arg1, arg2, arg3); | |
}); | |
}; | |
} else { | |
return func; | |
} | |
}; | |
module.exports = createMicrosoftUnsafeLocalFunction; | |
/***/ }), | |
/* 42 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/** | |
* `charCode` represents the actual "character code" and is safe to use with | |
* `String.fromCharCode`. As such, only keys that correspond to printable | |
* characters produce a valid `charCode`, the only exception to this is Enter. | |
* The Tab-key is considered non-printable and does not have a `charCode`, | |
* presumably because it does not produce a tab-character in browsers. | |
* | |
* @param {object} nativeEvent Native browser event. | |
* @return {number} Normalized `charCode` property. | |
*/ | |
function getEventCharCode(nativeEvent) { | |
var charCode; | |
var keyCode = nativeEvent.keyCode; | |
if ('charCode' in nativeEvent) { | |
charCode = nativeEvent.charCode; | |
// FF does not set `charCode` for the Enter-key, check against `keyCode`. | |
if (charCode === 0 && keyCode === 13) { | |
charCode = 13; | |
} | |
} else { | |
// IE8 does not implement `charCode`, but `keyCode` has the correct value. | |
charCode = keyCode; | |
} | |
// Some non-printable keys are reported in `charCode`/`keyCode`, discard them. | |
// Must not discard the (non-)printable Enter-key. | |
if (charCode >= 32 || charCode === 13) { | |
return charCode; | |
} | |
return 0; | |
} | |
module.exports = getEventCharCode; | |
/***/ }), | |
/* 43 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/** | |
* Translation from modifier key to the associated property in the event. | |
* @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers | |
*/ | |
var modifierKeyToProp = { | |
'Alt': 'altKey', | |
'Control': 'ctrlKey', | |
'Meta': 'metaKey', | |
'Shift': 'shiftKey' | |
}; | |
// IE8 does not implement getModifierState so we simply map it to the only | |
// modifier keys exposed by the event itself, does not support Lock-keys. | |
// Currently, all major browsers except Chrome seems to support Lock-keys. | |
function modifierStateGetter(keyArg) { | |
var syntheticEvent = this; | |
var nativeEvent = syntheticEvent.nativeEvent; | |
if (nativeEvent.getModifierState) { | |
return nativeEvent.getModifierState(keyArg); | |
} | |
var keyProp = modifierKeyToProp[keyArg]; | |
return keyProp ? !!nativeEvent[keyProp] : false; | |
} | |
function getEventModifierState(nativeEvent) { | |
return modifierStateGetter; | |
} | |
module.exports = getEventModifierState; | |
/***/ }), | |
/* 44 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/** | |
* Gets the target node from a native browser event by accounting for | |
* inconsistencies in browser DOM APIs. | |
* | |
* @param {object} nativeEvent Native browser event. | |
* @return {DOMEventTarget} Target node. | |
*/ | |
function getEventTarget(nativeEvent) { | |
var target = nativeEvent.target || nativeEvent.srcElement || window; | |
// Normalize SVG <use> element events #4963 | |
if (target.correspondingUseElement) { | |
target = target.correspondingUseElement; | |
} | |
// Safari may fire events on text nodes (Node.TEXT_NODE is 3). | |
// @see http://www.quirksmode.org/js/events_properties.html | |
return target.nodeType === 3 ? target.parentNode : target; | |
} | |
module.exports = getEventTarget; | |
/***/ }), | |
/* 45 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ExecutionEnvironment = __webpack_require__(5); | |
var useHasFeature; | |
if (ExecutionEnvironment.canUseDOM) { | |
useHasFeature = document.implementation && document.implementation.hasFeature && | |
// always returns true in newer browsers as per the standard. | |
// @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature | |
document.implementation.hasFeature('', '') !== true; | |
} | |
/** | |
* Checks if an event is supported in the current execution environment. | |
* | |
* NOTE: This will not work correctly for non-generic events such as `change`, | |
* `reset`, `load`, `error`, and `select`. | |
* | |
* Borrows from Modernizr. | |
* | |
* @param {string} eventNameSuffix Event name, e.g. "click". | |
* @param {?boolean} capture Check if the capture phase is supported. | |
* @return {boolean} True if the event is supported. | |
* @internal | |
* @license Modernizr 3.0.0pre (Custom Build) | MIT | |
*/ | |
function isEventSupported(eventNameSuffix, capture) { | |
if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) { | |
return false; | |
} | |
var eventName = 'on' + eventNameSuffix; | |
var isSupported = eventName in document; | |
if (!isSupported) { | |
var element = document.createElement('div'); | |
element.setAttribute(eventName, 'return;'); | |
isSupported = typeof element[eventName] === 'function'; | |
} | |
if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { | |
// This is the only way to test support for the `wheel` event in IE9+. | |
isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); | |
} | |
return isSupported; | |
} | |
module.exports = isEventSupported; | |
/***/ }), | |
/* 46 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/** | |
* Given a `prevElement` and `nextElement`, determines if the existing | |
* instance should be updated as opposed to being destroyed or replaced by a new | |
* instance. Both arguments are elements. This ensures that this logic can | |
* operate on stateless trees without any backing instance. | |
* | |
* @param {?object} prevElement | |
* @param {?object} nextElement | |
* @return {boolean} True if the existing instance should be updated. | |
* @protected | |
*/ | |
function shouldUpdateReactComponent(prevElement, nextElement) { | |
var prevEmpty = prevElement === null || prevElement === false; | |
var nextEmpty = nextElement === null || nextElement === false; | |
if (prevEmpty || nextEmpty) { | |
return prevEmpty === nextEmpty; | |
} | |
var prevType = typeof prevElement; | |
var nextType = typeof nextElement; | |
if (prevType === 'string' || prevType === 'number') { | |
return nextType === 'string' || nextType === 'number'; | |
} else { | |
return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key; | |
} | |
} | |
module.exports = shouldUpdateReactComponent; | |
/***/ }), | |
/* 47 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2015-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _assign = __webpack_require__(3); | |
var emptyFunction = __webpack_require__(7); | |
var warning = __webpack_require__(1); | |
var validateDOMNesting = emptyFunction; | |
if (false) { | |
// This validation code was written based on the HTML5 parsing spec: | |
// https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope | |
// | |
// Note: this does not catch all invalid nesting, nor does it try to (as it's | |
// not clear what practical benefit doing so provides); instead, we warn only | |
// for cases where the parser will give a parse tree differing from what React | |
// intended. For example, <b><div></div></b> is invalid but we don't warn | |
// because it still parses correctly; we do warn for other cases like nested | |
// <p> tags where the beginning of the second element implicitly closes the | |
// first, causing a confusing mess. | |
// https://html.spec.whatwg.org/multipage/syntax.html#special | |
var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp']; | |
// https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope | |
var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template', | |
// https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point | |
// TODO: Distinguish by namespace here -- for <title>, including it here | |
// errs on the side of fewer warnings | |
'foreignObject', 'desc', 'title']; | |
// https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope | |
var buttonScopeTags = inScopeTags.concat(['button']); | |
// https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags | |
var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt']; | |
var emptyAncestorInfo = { | |
current: null, | |
formTag: null, | |
aTagInScope: null, | |
buttonTagInScope: null, | |
nobrTagInScope: null, | |
pTagInButtonScope: null, | |
listItemTagAutoclosing: null, | |
dlItemTagAutoclosing: null | |
}; | |
var updatedAncestorInfo = function (oldInfo, tag, instance) { | |
var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo); | |
var info = { tag: tag, instance: instance }; | |
if (inScopeTags.indexOf(tag) !== -1) { | |
ancestorInfo.aTagInScope = null; | |
ancestorInfo.buttonTagInScope = null; | |
ancestorInfo.nobrTagInScope = null; | |
} | |
if (buttonScopeTags.indexOf(tag) !== -1) { | |
ancestorInfo.pTagInButtonScope = null; | |
} | |
// See rules for 'li', 'dd', 'dt' start tags in | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody | |
if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') { | |
ancestorInfo.listItemTagAutoclosing = null; | |
ancestorInfo.dlItemTagAutoclosing = null; | |
} | |
ancestorInfo.current = info; | |
if (tag === 'form') { | |
ancestorInfo.formTag = info; | |
} | |
if (tag === 'a') { | |
ancestorInfo.aTagInScope = info; | |
} | |
if (tag === 'button') { | |
ancestorInfo.buttonTagInScope = info; | |
} | |
if (tag === 'nobr') { | |
ancestorInfo.nobrTagInScope = info; | |
} | |
if (tag === 'p') { | |
ancestorInfo.pTagInButtonScope = info; | |
} | |
if (tag === 'li') { | |
ancestorInfo.listItemTagAutoclosing = info; | |
} | |
if (tag === 'dd' || tag === 'dt') { | |
ancestorInfo.dlItemTagAutoclosing = info; | |
} | |
return ancestorInfo; | |
}; | |
/** | |
* Returns whether | |
*/ | |
var isTagValidWithParent = function (tag, parentTag) { | |
// First, let's check if we're in an unusual parsing mode... | |
switch (parentTag) { | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect | |
case 'select': | |
return tag === 'option' || tag === 'optgroup' || tag === '#text'; | |
case 'optgroup': | |
return tag === 'option' || tag === '#text'; | |
// Strictly speaking, seeing an <option> doesn't mean we're in a <select> | |
// but | |
case 'option': | |
return tag === '#text'; | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption | |
// No special behavior since these rules fall back to "in body" mode for | |
// all except special table nodes which cause bad parsing behavior anyway. | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr | |
case 'tr': | |
return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template'; | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody | |
case 'tbody': | |
case 'thead': | |
case 'tfoot': | |
return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template'; | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup | |
case 'colgroup': | |
return tag === 'col' || tag === 'template'; | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable | |
case 'table': | |
return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template'; | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead | |
case 'head': | |
return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template'; | |
// https://html.spec.whatwg.org/multipage/semantics.html#the-html-element | |
case 'html': | |
return tag === 'head' || tag === 'body'; | |
case '#document': | |
return tag === 'html'; | |
} | |
// Probably in the "in body" parsing mode, so we outlaw only tag combos | |
// where the parsing rules cause implicit opens or closes to be added. | |
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody | |
switch (tag) { | |
case 'h1': | |
case 'h2': | |
case 'h3': | |
case 'h4': | |
case 'h5': | |
case 'h6': | |
return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6'; | |
case 'rp': | |
case 'rt': | |
return impliedEndTags.indexOf(parentTag) === -1; | |
case 'body': | |
case 'caption': | |
case 'col': | |
case 'colgroup': | |
case 'frame': | |
case 'head': | |
case 'html': | |
case 'tbody': | |
case 'td': | |
case 'tfoot': | |
case 'th': | |
case 'thead': | |
case 'tr': | |
// These tags are only valid with a few parents that have special child | |
// parsing rules -- if we're down here, then none of those matched and | |
// so we allow it only if we don't know what the parent is, as all other | |
// cases are invalid. | |
return parentTag == null; | |
} | |
return true; | |
}; | |
/** | |
* Returns whether | |
*/ | |
var findInvalidAncestorForTag = function (tag, ancestorInfo) { | |
switch (tag) { | |
case 'address': | |
case 'article': | |
case 'aside': | |
case 'blockquote': | |
case 'center': | |
case 'details': | |
case 'dialog': | |
case 'dir': | |
case 'div': | |
case 'dl': | |
case 'fieldset': | |
case 'figcaption': | |
case 'figure': | |
case 'footer': | |
case 'header': | |
case 'hgroup': | |
case 'main': | |
case 'menu': | |
case 'nav': | |
case 'ol': | |
case 'p': | |
case 'section': | |
case 'summary': | |
case 'ul': | |
case 'pre': | |
case 'listing': | |
case 'table': | |
case 'hr': | |
case 'xmp': | |
case 'h1': | |
case 'h2': | |
case 'h3': | |
case 'h4': | |
case 'h5': | |
case 'h6': | |
return ancestorInfo.pTagInButtonScope; | |
case 'form': | |
return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope; | |
case 'li': | |
return ancestorInfo.listItemTagAutoclosing; | |
case 'dd': | |
case 'dt': | |
return ancestorInfo.dlItemTagAutoclosing; | |
case 'button': | |
return ancestorInfo.buttonTagInScope; | |
case 'a': | |
// Spec says something about storing a list of markers, but it sounds | |
// equivalent to this check. | |
return ancestorInfo.aTagInScope; | |
case 'nobr': | |
return ancestorInfo.nobrTagInScope; | |
} | |
return null; | |
}; | |
/** | |
* Given a ReactCompositeComponent instance, return a list of its recursive | |
* owners, starting at the root and ending with the instance itself. | |
*/ | |
var findOwnerStack = function (instance) { | |
if (!instance) { | |
return []; | |
} | |
var stack = []; | |
do { | |
stack.push(instance); | |
} while (instance = instance._currentElement._owner); | |
stack.reverse(); | |
return stack; | |
}; | |
var didWarn = {}; | |
validateDOMNesting = function (childTag, childText, childInstance, ancestorInfo) { | |
ancestorInfo = ancestorInfo || emptyAncestorInfo; | |
var parentInfo = ancestorInfo.current; | |
var parentTag = parentInfo && parentInfo.tag; | |
if (childText != null) { | |
process.env.NODE_ENV !== 'production' ? warning(childTag == null, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0; | |
childTag = '#text'; | |
} | |
var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo; | |
var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo); | |
var problematic = invalidParent || invalidAncestor; | |
if (problematic) { | |
var ancestorTag = problematic.tag; | |
var ancestorInstance = problematic.instance; | |
var childOwner = childInstance && childInstance._currentElement._owner; | |
var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner; | |
var childOwners = findOwnerStack(childOwner); | |
var ancestorOwners = findOwnerStack(ancestorOwner); | |
var minStackLen = Math.min(childOwners.length, ancestorOwners.length); | |
var i; | |
var deepestCommon = -1; | |
for (i = 0; i < minStackLen; i++) { | |
if (childOwners[i] === ancestorOwners[i]) { | |
deepestCommon = i; | |
} else { | |
break; | |
} | |
} | |
var UNKNOWN = '(unknown)'; | |
var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) { | |
return inst.getName() || UNKNOWN; | |
}); | |
var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) { | |
return inst.getName() || UNKNOWN; | |
}); | |
var ownerInfo = [].concat( | |
// If the parent and child instances have a common owner ancestor, start | |
// with that -- otherwise we just start with the parent's owners. | |
deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag, | |
// If we're warning about an invalid (non-parent) ancestry, add '...' | |
invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > '); | |
var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo; | |
if (didWarn[warnKey]) { | |
return; | |
} | |
didWarn[warnKey] = true; | |
var tagDisplayName = childTag; | |
var whitespaceInfo = ''; | |
if (childTag === '#text') { | |
if (/\S/.test(childText)) { | |
tagDisplayName = 'Text nodes'; | |
} else { | |
tagDisplayName = 'Whitespace text nodes'; | |
whitespaceInfo = ' Make sure you don\'t have any extra whitespace between tags on ' + 'each line of your source code.'; | |
} | |
} else { | |
tagDisplayName = '<' + childTag + '>'; | |
} | |
if (invalidParent) { | |
var info = ''; | |
if (ancestorTag === 'table' && childTag === 'tr') { | |
info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.'; | |
} | |
process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>.%s ' + 'See %s.%s', tagDisplayName, ancestorTag, whitespaceInfo, ownerInfo, info) : void 0; | |
} else { | |
process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>. See %s.', tagDisplayName, ancestorTag, ownerInfo) : void 0; | |
} | |
} | |
}; | |
validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo; | |
// For testing | |
validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) { | |
ancestorInfo = ancestorInfo || emptyAncestorInfo; | |
var parentInfo = ancestorInfo.current; | |
var parentTag = parentInfo && parentInfo.tag; | |
return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo); | |
}; | |
} | |
module.exports = validateDOMNesting; | |
/***/ }), | |
/* 48 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(19); | |
var ReactNoopUpdateQueue = __webpack_require__(49); | |
var canDefineProperty = __webpack_require__(85); | |
var emptyObject = __webpack_require__(20); | |
var invariant = __webpack_require__(0); | |
var warning = __webpack_require__(1); | |
/** | |
* Base class helpers for the updating state of a component. | |
*/ | |
function ReactComponent(props, context, updater) { | |
this.props = props; | |
this.context = context; | |
this.refs = emptyObject; | |
// We initialize the default updater but the real one gets injected by the | |
// renderer. | |
this.updater = updater || ReactNoopUpdateQueue; | |
} | |
ReactComponent.prototype.isReactComponent = {}; | |
/** | |
* Sets a subset of the state. Always use this to mutate | |
* state. You should treat `this.state` as immutable. | |
* | |
* There is no guarantee that `this.state` will be immediately updated, so | |
* accessing `this.state` after calling this method may return the old value. | |
* | |
* There is no guarantee that calls to `setState` will run synchronously, | |
* as they may eventually be batched together. You can provide an optional | |
* callback that will be executed when the call to setState is actually | |
* completed. | |
* | |
* When a function is provided to setState, it will be called at some point in | |
* the future (not synchronously). It will be called with the up to date | |
* component arguments (state, props, context). These values can be different | |
* from this.* because your function may be called after receiveProps but before | |
* shouldComponentUpdate, and this new state, props, and context will not yet be | |
* assigned to this. | |
* | |
* @param {object|function} partialState Next partial state or function to | |
* produce next partial state to be merged with current state. | |
* @param {?function} callback Called after state is updated. | |
* @final | |
* @protected | |
*/ | |
ReactComponent.prototype.setState = function (partialState, callback) { | |
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? false ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0; | |
this.updater.enqueueSetState(this, partialState); | |
if (callback) { | |
this.updater.enqueueCallback(this, callback, 'setState'); | |
} | |
}; | |
/** | |
* Forces an update. This should only be invoked when it is known with | |
* certainty that we are **not** in a DOM transaction. | |
* | |
* You may want to call this when you know that some deeper aspect of the | |
* component's state has changed but `setState` was not called. | |
* | |
* This will not invoke `shouldComponentUpdate`, but it will invoke | |
* `componentWillUpdate` and `componentDidUpdate`. | |
* | |
* @param {?function} callback Called after update is complete. | |
* @final | |
* @protected | |
*/ | |
ReactComponent.prototype.forceUpdate = function (callback) { | |
this.updater.enqueueForceUpdate(this); | |
if (callback) { | |
this.updater.enqueueCallback(this, callback, 'forceUpdate'); | |
} | |
}; | |
/** | |
* Deprecated APIs. These APIs used to exist on classic React classes but since | |
* we would like to deprecate them, we're not going to move them over to this | |
* modern base class. Instead, we define a getter that warns if it's accessed. | |
*/ | |
if (false) { | |
var deprecatedAPIs = { | |
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], | |
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] | |
}; | |
var defineDeprecationWarning = function (methodName, info) { | |
if (canDefineProperty) { | |
Object.defineProperty(ReactComponent.prototype, methodName, { | |
get: function () { | |
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0; | |
return undefined; | |
} | |
}); | |
} | |
}; | |
for (var fnName in deprecatedAPIs) { | |
if (deprecatedAPIs.hasOwnProperty(fnName)) { | |
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); | |
} | |
} | |
} | |
module.exports = ReactComponent; | |
/***/ }), | |
/* 49 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2015-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var warning = __webpack_require__(1); | |
function warnNoop(publicInstance, callerName) { | |
if (false) { | |
var constructor = publicInstance.constructor; | |
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0; | |
} | |
} | |
/** | |
* This is the abstract API for an update queue. | |
*/ | |
var ReactNoopUpdateQueue = { | |
/** | |
* Checks whether or not this composite component is mounted. | |
* @param {ReactClass} publicInstance The instance we want to test. | |
* @return {boolean} True if mounted, false otherwise. | |
* @protected | |
* @final | |
*/ | |
isMounted: function (publicInstance) { | |
return false; | |
}, | |
/** | |
* Enqueue a callback that will be executed after all the pending updates | |
* have processed. | |
* | |
* @param {ReactClass} publicInstance The instance to use as `this` context. | |
* @param {?function} callback Called after state is updated. | |
* @internal | |
*/ | |
enqueueCallback: function (publicInstance, callback) {}, | |
/** | |
* Forces an update. This should only be invoked when it is known with | |
* certainty that we are **not** in a DOM transaction. | |
* | |
* You may want to call this when you know that some deeper aspect of the | |
* component's state has changed but `setState` was not called. | |
* | |
* This will not invoke `shouldComponentUpdate`, but it will invoke | |
* `componentWillUpdate` and `componentDidUpdate`. | |
* | |
* @param {ReactClass} publicInstance The instance that should rerender. | |
* @internal | |
*/ | |
enqueueForceUpdate: function (publicInstance) { | |
warnNoop(publicInstance, 'forceUpdate'); | |
}, | |
/** | |
* Replaces all of the state. Always use this or `setState` to mutate state. | |
* You should treat `this.state` as immutable. | |
* | |
* There is no guarantee that `this.state` will be immediately updated, so | |
* accessing `this.state` after calling this method may return the old value. | |
* | |
* @param {ReactClass} publicInstance The instance that should rerender. | |
* @param {object} completeState Next state. | |
* @internal | |
*/ | |
enqueueReplaceState: function (publicInstance, completeState) { | |
warnNoop(publicInstance, 'replaceState'); | |
}, | |
/** | |
* Sets a subset of the state. This only exists because _pendingState is | |
* internal. This provides a merging strategy that is not available to deep | |
* properties which is confusing. TODO: Expose pendingState or don't use it | |
* during the merge. | |
* | |
* @param {ReactClass} publicInstance The instance that should rerender. | |
* @param {object} partialState Next partial state to be merged with state. | |
* @internal | |
*/ | |
enqueueSetState: function (publicInstance, partialState) { | |
warnNoop(publicInstance, 'setState'); | |
} | |
}; | |
module.exports = ReactNoopUpdateQueue; | |
/***/ }), | |
/* 50 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, | |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
* See the License for the specific language governing permissions and | |
* limitations under the License. | |
* | |
* @typechecks | |
*/ | |
var emptyFunction = __webpack_require__(7); | |
/** | |
* Upstream version of event listener. Does not take into account specific | |
* nature of platform. | |
*/ | |
var EventListener = { | |
/** | |
* Listen to DOM events during the bubble phase. | |
* | |
* @param {DOMEventTarget} target DOM element to register listener on. | |
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'. | |
* @param {function} callback Callback function. | |
* @return {object} Object with a `remove` method. | |
*/ | |
listen: function listen(target, eventType, callback) { | |
if (target.addEventListener) { | |
target.addEventListener(eventType, callback, false); | |
return { | |
remove: function remove() { | |
target.removeEventListener(eventType, callback, false); | |
} | |
}; | |
} else if (target.attachEvent) { | |
target.attachEvent('on' + eventType, callback); | |
return { | |
remove: function remove() { | |
target.detachEvent('on' + eventType, callback); | |
} | |
}; | |
} | |
}, | |
/** | |
* Listen to DOM events during the capture phase. | |
* | |
* @param {DOMEventTarget} target DOM element to register listener on. | |
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'. | |
* @param {function} callback Callback function. | |
* @return {object} Object with a `remove` method. | |
*/ | |
capture: function capture(target, eventType, callback) { | |
if (target.addEventListener) { | |
target.addEventListener(eventType, callback, true); | |
return { | |
remove: function remove() { | |
target.removeEventListener(eventType, callback, true); | |
} | |
}; | |
} else { | |
if (false) { | |
console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.'); | |
} | |
return { | |
remove: emptyFunction | |
}; | |
} | |
}, | |
registerDefault: function registerDefault() {} | |
}; | |
module.exports = EventListener; | |
/***/ }), | |
/* 51 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/** | |
* @param {DOMElement} node input/textarea to focus | |
*/ | |
function focusNode(node) { | |
// IE8 can throw "Can't move focus to the control because it is invisible, | |
// not enabled, or of a type that does not accept the focus." for all kinds of | |
// reasons that are too expensive and fragile to test. | |
try { | |
node.focus(); | |
} catch (e) {} | |
} | |
module.exports = focusNode; | |
/***/ }), | |
/* 52 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
/* eslint-disable fb-www/typeof-undefined */ | |
/** | |
* Same as document.activeElement but wraps in a try-catch block. In IE it is | |
* not safe to call document.activeElement if there is nothing focused. | |
* | |
* The activeElement will be null only if the document or document body is not | |
* yet defined. | |
* | |
* @param {?DOMDocument} doc Defaults to current document. | |
* @return {?DOMElement} | |
*/ | |
function getActiveElement(doc) /*?DOMElement*/{ | |
doc = doc || (typeof document !== 'undefined' ? document : undefined); | |
if (typeof doc === 'undefined') { | |
return null; | |
} | |
try { | |
return doc.activeElement || doc.body; | |
} catch (e) { | |
return doc.body; | |
} | |
} | |
module.exports = getActiveElement; | |
/***/ }), | |
/* 53 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(global) {var require;var require;(function(f){if(true){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mapboxgl = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return require(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ | |
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):t.glMatrix=r()}(this,function(){"use strict";function t(){var t=new Float32Array(3);return t[0]=0,t[1]=0,t[2]=0,t}function r(t,r,n){var e=r[0],a=r[1],o=r[2];return t[0]=e*n[0]+a*n[3]+o*n[6],t[1]=e*n[1]+a*n[4]+o*n[7],t[2]=e*n[2]+a*n[5]+o*n[8],t}function n(){var t=new Float32Array(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function e(t,r,n){var e=r[0],a=r[1],o=r[2],u=r[3];return t[0]=n[0]*e+n[4]*a+n[8]*o+n[12]*u,t[1]=n[1]*e+n[5]*a+n[9]*o+n[13]*u,t[2]=n[2]*e+n[6]*a+n[10]*o+n[14]*u,t[3]=n[3]*e+n[7]*a+n[11]*o+n[15]*u,t}function a(){var t=new Float32Array(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t}function o(t,r,n){var e=r[0],a=r[1],o=r[2],u=r[3],i=Math.sin(n),c=Math.cos(n);return t[0]=e*c+o*i,t[1]=a*c+u*i,t[2]=e*-i+o*c,t[3]=a*-i+u*c,t}function u(t,r,n){var e=r[0],a=r[1],o=r[2],u=r[3],i=n[0],c=n[1];return t[0]=e*i,t[1]=a*i,t[2]=o*c,t[3]=u*c,t}function i(){var t=new Float32Array(9);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function c(t,r){var n=Math.sin(r),e=Math.cos(r);return t[0]=e,t[1]=n,t[2]=0,t[3]=-n,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function f(){var t=new Float32Array(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function v(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function s(t,r){var n=r[0],e=r[1],a=r[2],o=r[3],u=r[4],i=r[5],c=r[6],f=r[7],v=r[8],s=r[9],l=r[10],M=r[11],h=r[12],m=r[13],y=r[14],d=r[15],p=n*i-e*u,w=n*c-a*u,A=n*f-o*u,F=e*c-a*i,x=e*f-o*i,b=a*f-o*c,g=v*m-s*h,j=v*y-l*h,R=v*d-M*h,X=s*y-l*m,Z=s*d-M*m,k=l*d-M*y,q=p*k-w*Z+A*X+F*R-x*j+b*g;return q?(q=1/q,t[0]=(i*k-c*Z+f*X)*q,t[1]=(a*Z-e*k-o*X)*q,t[2]=(m*b-y*x+d*F)*q,t[3]=(l*x-s*b-M*F)*q,t[4]=(c*R-u*k-f*j)*q,t[5]=(n*k-a*R+o*j)*q,t[6]=(y*A-h*b-d*w)*q,t[7]=(v*b-l*A+M*w)*q,t[8]=(u*Z-i*R+f*g)*q,t[9]=(e*R-n*Z-o*g)*q,t[10]=(h*x-m*A+d*p)*q,t[11]=(s*A-v*x-M*p)*q,t[12]=(i*j-u*X-c*g)*q,t[13]=(n*X-e*j+a*g)*q,t[14]=(m*w-h*F-y*p)*q,t[15]=(v*F-s*w+l*p)*q,t):null}function l(t,r,n){var e=r[0],a=r[1],o=r[2],u=r[3],i=r[4],c=r[5],f=r[6],v=r[7],s=r[8],l=r[9],M=r[10],h=r[11],m=r[12],y=r[13],d=r[14],p=r[15],w=n[0],A=n[1],F=n[2],x=n[3];return t[0]=w*e+A*i+F*s+x*m,t[1]=w*a+A*c+F*l+x*y,t[2]=w*o+A*f+F*M+x*d,t[3]=w*u+A*v+F*h+x*p,w=n[4],A=n[5],F=n[6],x=n[7],t[4]=w*e+A*i+F*s+x*m,t[5]=w*a+A*c+F*l+x*y,t[6]=w*o+A*f+F*M+x*d,t[7]=w*u+A*v+F*h+x*p,w=n[8],A=n[9],F=n[10],x=n[11],t[8]=w*e+A*i+F*s+x*m,t[9]=w*a+A*c+F*l+x*y,t[10]=w*o+A*f+F*M+x*d,t[11]=w*u+A*v+F*h+x*p,w=n[12],A=n[13],F=n[14],x=n[15],t[12]=w*e+A*i+F*s+x*m,t[13]=w*a+A*c+F*l+x*y,t[14]=w*o+A*f+F*M+x*d,t[15]=w*u+A*v+F*h+x*p,t}function M(t,r,n){var e,a,o,u,i,c,f,v,s,l,M,h,m=n[0],y=n[1],d=n[2];return r===t?(t[12]=r[0]*m+r[4]*y+r[8]*d+r[12],t[13]=r[1]*m+r[5]*y+r[9]*d+r[13],t[14]=r[2]*m+r[6]*y+r[10]*d+r[14],t[15]=r[3]*m+r[7]*y+r[11]*d+r[15]):(e=r[0],a=r[1],o=r[2],u=r[3],i=r[4],c=r[5],f=r[6],v=r[7],s=r[8],l=r[9],M=r[10],h=r[11],t[0]=e,t[1]=a,t[2]=o,t[3]=u,t[4]=i,t[5]=c,t[6]=f,t[7]=v,t[8]=s,t[9]=l,t[10]=M,t[11]=h,t[12]=e*m+i*y+s*d+r[12],t[13]=a*m+c*y+l*d+r[13],t[14]=o*m+f*y+M*d+r[14],t[15]=u*m+v*y+h*d+r[15]),t}function h(t,r,n){var e=n[0],a=n[1],o=n[2];return t[0]=r[0]*e,t[1]=r[1]*e,t[2]=r[2]*e,t[3]=r[3]*e,t[4]=r[4]*a,t[5]=r[5]*a,t[6]=r[6]*a,t[7]=r[7]*a,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=r[11]*o,t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t}function m(t,r,n){var e=Math.sin(n),a=Math.cos(n),o=r[4],u=r[5],i=r[6],c=r[7],f=r[8],v=r[9],s=r[10],l=r[11];return r!==t&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[4]=o*a+f*e,t[5]=u*a+v*e,t[6]=i*a+s*e,t[7]=c*a+l*e,t[8]=f*a-o*e,t[9]=v*a-u*e,t[10]=s*a-i*e,t[11]=l*a-c*e,t}function y(t,r,n){var e=Math.sin(n),a=Math.cos(n),o=r[0],u=r[1],i=r[2],c=r[3],f=r[4],v=r[5],s=r[6],l=r[7];return r!==t&&(t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*a+f*e,t[1]=u*a+v*e,t[2]=i*a+s*e,t[3]=c*a+l*e,t[4]=f*a-o*e,t[5]=v*a-u*e,t[6]=s*a-i*e,t[7]=l*a-c*e,t}function d(t,r,n,e,a){var o=1/Math.tan(r/2),u=1/(e-a);return t[0]=o/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(a+e)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*a*e*u,t[15]=0,t}function p(t,r,n,e,a,o,u){var i=1/(r-n),c=1/(e-a),f=1/(o-u);return t[0]=-2*i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*f,t[11]=0,t[12]=(r+n)*i,t[13]=(a+e)*c,t[14]=(u+o)*f,t[15]=1,t}var w=(t(),n(),{vec3:{transformMat3:r},vec4:{transformMat4:e},mat2:{create:a,rotate:o,scale:u},mat3:{create:i,fromRotation:c},mat4:{create:f,identity:v,translate:M,scale:h,multiply:l,perspective:d,rotateX:m,rotateZ:y,invert:s,ortho:p}});return w}); | |
},{}],2:[function(_dereq_,module,exports){ | |
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ShelfPack=e()}(this,function(){function t(t,e,i){i=i||{},this.w=t||64,this.h=e||64,this.autoResize=!!i.autoResize,this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0}function e(t,e,i){this.x=0,this.y=t,this.w=this.free=e,this.h=i}function i(t,e,i,s,h,n,r){this.id=t,this.x=e,this.y=i,this.w=s,this.h=h,this.maxw=n||s,this.maxh=r||h,this.refcount=0}return t.prototype.pack=function(t,e){t=[].concat(t),e=e||{};for(var i,s,h,n,r=[],f=0;f<t.length;f++)if(i=t[f].w||t[f].width,s=t[f].h||t[f].height,h=t[f].id,i&&s){if(n=this.packOne(i,s,h),!n)continue;e.inPlace&&(t[f].x=n.x,t[f].y=n.y,t[f].id=n.id),r.push(n)}if(this.shelves.length>0){for(var o=0,a=0,u=0;u<this.shelves.length;u++){var l=this.shelves[u];a+=l.h,o=Math.max(l.w-l.free,o)}this.resize(o,a)}return r},t.prototype.packOne=function(t,i,s){var h,n,r,f,o={freebin:-1,shelf:-1,waste:1/0},a=0;if("string"==typeof s||"number"==typeof s){if(h=this.getBin(s))return this.ref(h),h;"number"==typeof s&&(this.maxId=Math.max(s,this.maxId))}else s=++this.maxId;for(f=0;f<this.freebins.length;f++){if(h=this.freebins[f],i===h.maxh&&t===h.maxw)return this.allocFreebin(f,t,i,s);i>h.maxh||t>h.maxw||i<=h.maxh&&t<=h.maxw&&(r=h.maxw*h.maxh-t*i,r<o.waste&&(o.waste=r,o.freebin=f))}for(f=0;f<this.shelves.length;f++)if(n=this.shelves[f],a+=n.h,!(t>n.free)){if(i===n.h)return this.allocShelf(f,t,i,s);i>n.h||i<n.h&&(r=(n.h-i)*t,r<o.waste&&(o.freebin=-1,o.waste=r,o.shelf=f))}if(o.freebin!==-1)return this.allocFreebin(o.freebin,t,i,s);if(o.shelf!==-1)return this.allocShelf(o.shelf,t,i,s);if(i<=this.h-a&&t<=this.w)return n=new e(a,this.w,i),this.allocShelf(this.shelves.push(n)-1,t,i,s);if(this.autoResize){var u,l,c,p;return u=l=this.h,c=p=this.w,(c<=u||t>c)&&(p=2*Math.max(t,c)),(u<c||i>u)&&(l=2*Math.max(i,u)),this.resize(p,l),this.packOne(t,i,s)}return null},t.prototype.allocFreebin=function(t,e,i,s){var h=this.freebins.splice(t,1)[0];return h.id=s,h.w=e,h.h=i,h.refcount=0,this.bins[s]=h,this.ref(h),h},t.prototype.allocShelf=function(t,e,i,s){var h=this.shelves[t],n=h.alloc(e,i,s);return this.bins[s]=n,this.ref(n),n},t.prototype.getBin=function(t){return this.bins[t]},t.prototype.ref=function(t){if(1===++t.refcount){var e=t.h;this.stats[e]=(0|this.stats[e])+1}return t.refcount},t.prototype.unref=function(t){return 0===t.refcount?0:(0===--t.refcount&&(this.stats[t.h]--,delete this.bins[t.id],this.freebins.push(t)),t.refcount)},t.prototype.clear=function(){this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0},t.prototype.resize=function(t,e){this.w=t,this.h=e;for(var i=0;i<this.shelves.length;i++)this.shelves[i].resize(t);return!0},e.prototype.alloc=function(t,e,s){if(t>this.free||e>this.h)return null;var h=this.x;return this.x+=t,this.free-=t,new i(s,h,this.y,t,e,t,this.h)},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t}); | |
},{}],3:[function(_dereq_,module,exports){ | |
function UnitBezier(t,i,e,r){this.cx=3*t,this.bx=3*(e-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(r-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=e,this.p2y=r}module.exports=UnitBezier,UnitBezier.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},UnitBezier.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},UnitBezier.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},UnitBezier.prototype.solveCurveX=function(t,i){"undefined"==typeof i&&(i=1e-6);var e,r,s,h,n;for(s=t,n=0;n<8;n++){if(h=this.sampleCurveX(s)-t,Math.abs(h)<i)return s;var u=this.sampleCurveDerivativeX(s);if(Math.abs(u)<1e-6)break;s-=h/u}if(e=0,r=1,s=t,s<e)return e;if(s>r)return r;for(;e<r;){if(h=this.sampleCurveX(s),Math.abs(h-t)<i)return s;t>h?e=s:r=s,s=.5*(r-e)+e}return s},UnitBezier.prototype.solve=function(t,i){return this.sampleCurveY(this.solveCurveX(t,i))}; | |
},{}],4:[function(_dereq_,module,exports){ | |
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.WhooTS=e.WhooTS||{})}(this,function(e){function t(e,t,r,n,i,s){s=s||{};var f=e+"?"+["bbox="+o(r,n,i),"format="+(s.format||"image/png"),"service="+(s.service||"WMS"),"version="+(s.version||"1.1.1"),"request="+(s.request||"GetMap"),"srs="+(s.srs||"EPSG:3857"),"width="+(s.width||256),"height="+(s.height||256),"layers="+t].join("&");return f}function o(e,t,o){t=Math.pow(2,o)-t-1;var n=r(256*e,256*t,o),i=r(256*(e+1),256*(t+1),o);return n[0]+","+n[1]+","+i[0]+","+i[1]}function r(e,t,o){var r=2*Math.PI*6378137/256/Math.pow(2,o),n=e*r-2*Math.PI*6378137/2,i=t*r-2*Math.PI*6378137/2;return[n,i]}e.getURL=t,e.getTileBBox=o,e.getMercCoords=r,Object.defineProperty(e,"__esModule",{value:!0})}); | |
},{}],5:[function(_dereq_,module,exports){ | |
"use strict";function earcut(e,n,r){r=r||2;var t=n&&n.length,i=t?n[0]*r:e.length,x=linkedList(e,0,i,r,!0),a=[];if(!x)return a;var o,l,u,s,v,f,y;if(t&&(x=eliminateHoles(e,n,x,r)),e.length>80*r){o=u=e[0],l=s=e[1];for(var d=r;d<i;d+=r)v=e[d],f=e[d+1],v<o&&(o=v),f<l&&(l=f),v>u&&(u=v),f>s&&(s=f);y=Math.max(u-o,s-l)}return earcutLinked(x,a,r,o,l,y),a}function linkedList(e,n,r,t,i){var x,a;if(i===signedArea(e,n,r,t)>0)for(x=n;x<r;x+=t)a=insertNode(x,e[x],e[x+1],a);else for(x=r-t;x>=n;x-=t)a=insertNode(x,e[x],e[x+1],a);return a&&equals(a,a.next)&&(removeNode(a),a=a.next),a}function filterPoints(e,n){if(!e)return e;n||(n=e);var r,t=e;do if(r=!1,t.steiner||!equals(t,t.next)&&0!==area(t.prev,t,t.next))t=t.next;else{if(removeNode(t),t=n=t.prev,t===t.next)return null;r=!0}while(r||t!==n);return n}function earcutLinked(e,n,r,t,i,x,a){if(e){!a&&x&&indexCurve(e,t,i,x);for(var o,l,u=e;e.prev!==e.next;)if(o=e.prev,l=e.next,x?isEarHashed(e,t,i,x):isEar(e))n.push(o.i/r),n.push(e.i/r),n.push(l.i/r),removeNode(e),e=l.next,u=l.next;else if(e=l,e===u){a?1===a?(e=cureLocalIntersections(e,n,r),earcutLinked(e,n,r,t,i,x,2)):2===a&&splitEarcut(e,n,r,t,i,x):earcutLinked(filterPoints(e),n,r,t,i,x,1);break}}}function isEar(e){var n=e.prev,r=e,t=e.next;if(area(n,r,t)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(pointInTriangle(n.x,n.y,r.x,r.y,t.x,t.y,i.x,i.y)&&area(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function isEarHashed(e,n,r,t){var i=e.prev,x=e,a=e.next;if(area(i,x,a)>=0)return!1;for(var o=i.x<x.x?i.x<a.x?i.x:a.x:x.x<a.x?x.x:a.x,l=i.y<x.y?i.y<a.y?i.y:a.y:x.y<a.y?x.y:a.y,u=i.x>x.x?i.x>a.x?i.x:a.x:x.x>a.x?x.x:a.x,s=i.y>x.y?i.y>a.y?i.y:a.y:x.y>a.y?x.y:a.y,v=zOrder(o,l,n,r,t),f=zOrder(u,s,n,r,t),y=e.nextZ;y&&y.z<=f;){if(y!==e.prev&&y!==e.next&&pointInTriangle(i.x,i.y,x.x,x.y,a.x,a.y,y.x,y.y)&&area(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(y=e.prevZ;y&&y.z>=v;){if(y!==e.prev&&y!==e.next&&pointInTriangle(i.x,i.y,x.x,x.y,a.x,a.y,y.x,y.y)&&area(y.prev,y,y.next)>=0)return!1;y=y.prevZ}return!0}function cureLocalIntersections(e,n,r){var t=e;do{var i=t.prev,x=t.next.next;!equals(i,x)&&intersects(i,t,t.next,x)&&locallyInside(i,x)&&locallyInside(x,i)&&(n.push(i.i/r),n.push(t.i/r),n.push(x.i/r),removeNode(t),removeNode(t.next),t=e=x),t=t.next}while(t!==e);return t}function splitEarcut(e,n,r,t,i,x){var a=e;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&isValidDiagonal(a,o)){var l=splitPolygon(a,o);return a=filterPoints(a,a.next),l=filterPoints(l,l.next),earcutLinked(a,n,r,t,i,x),void earcutLinked(l,n,r,t,i,x)}o=o.next}a=a.next}while(a!==e)}function eliminateHoles(e,n,r,t){var i,x,a,o,l,u=[];for(i=0,x=n.length;i<x;i++)a=n[i]*t,o=i<x-1?n[i+1]*t:e.length,l=linkedList(e,a,o,t,!1),l===l.next&&(l.steiner=!0),u.push(getLeftmost(l));for(u.sort(compareX),i=0;i<u.length;i++)eliminateHole(u[i],r),r=filterPoints(r,r.next);return r}function compareX(e,n){return e.x-n.x}function eliminateHole(e,n){if(n=findHoleBridge(e,n)){var r=splitPolygon(n,e);filterPoints(r,r.next)}}function findHoleBridge(e,n){var r,t=n,i=e.x,x=e.y,a=-(1/0);do{if(x<=t.y&&x>=t.next.y){var o=t.x+(x-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(o<=i&&o>a){if(a=o,o===i){if(x===t.y)return t;if(x===t.next.y)return t.next}r=t.x<t.next.x?t:t.next}}t=t.next}while(t!==n);if(!r)return null;if(i===a)return r.prev;var l,u=r,s=r.x,v=r.y,f=1/0;for(t=r.next;t!==u;)i>=t.x&&t.x>=s&&pointInTriangle(x<v?i:a,x,s,v,x<v?a:i,x,t.x,t.y)&&(l=Math.abs(x-t.y)/(i-t.x),(l<f||l===f&&t.x>r.x)&&locallyInside(t,e)&&(r=t,f=l)),t=t.next;return r}function indexCurve(e,n,r,t){var i=e;do null===i.z&&(i.z=zOrder(i.x,i.y,n,r,t)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,sortLinked(i)}function sortLinked(e){var n,r,t,i,x,a,o,l,u=1;do{for(r=e,e=null,x=null,a=0;r;){for(a++,t=r,o=0,n=0;n<u&&(o++,t=t.nextZ,t);n++);for(l=u;o>0||l>0&&t;)0===o?(i=t,t=t.nextZ,l--):0!==l&&t?r.z<=t.z?(i=r,r=r.nextZ,o--):(i=t,t=t.nextZ,l--):(i=r,r=r.nextZ,o--),x?x.nextZ=i:e=i,i.prevZ=x,x=i;r=t}x.nextZ=null,u*=2}while(a>1);return e}function zOrder(e,n,r,t,i){return e=32767*(e-r)/i,n=32767*(n-t)/i,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),n=16711935&(n|n<<8),n=252645135&(n|n<<4),n=858993459&(n|n<<2),n=1431655765&(n|n<<1),e|n<<1}function getLeftmost(e){var n=e,r=e;do n.x<r.x&&(r=n),n=n.next;while(n!==e);return r}function pointInTriangle(e,n,r,t,i,x,a,o){return(i-a)*(n-o)-(e-a)*(x-o)>=0&&(e-a)*(t-o)-(r-a)*(n-o)>=0&&(r-a)*(x-o)-(i-a)*(t-o)>=0}function isValidDiagonal(e,n){return e.next.i!==n.i&&e.prev.i!==n.i&&!intersectsPolygon(e,n)&&locallyInside(e,n)&&locallyInside(n,e)&&middleInside(e,n)}function area(e,n,r){return(n.y-e.y)*(r.x-n.x)-(n.x-e.x)*(r.y-n.y)}function equals(e,n){return e.x===n.x&&e.y===n.y}function intersects(e,n,r,t){return!!(equals(e,n)&&equals(r,t)||equals(e,t)&&equals(r,n))||area(e,n,r)>0!=area(e,n,t)>0&&area(r,t,e)>0!=area(r,t,n)>0}function intersectsPolygon(e,n){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==n.i&&r.next.i!==n.i&&intersects(r,r.next,e,n))return!0;r=r.next}while(r!==e);return!1}function locallyInside(e,n){return area(e.prev,e,e.next)<0?area(e,n,e.next)>=0&&area(e,e.prev,n)>=0:area(e,n,e.prev)<0||area(e,e.next,n)<0}function middleInside(e,n){var r=e,t=!1,i=(e.x+n.x)/2,x=(e.y+n.y)/2;do r.y>x!=r.next.y>x&&i<(r.next.x-r.x)*(x-r.y)/(r.next.y-r.y)+r.x&&(t=!t),r=r.next;while(r!==e);return t}function splitPolygon(e,n){var r=new Node(e.i,e.x,e.y),t=new Node(n.i,n.x,n.y),i=e.next,x=n.prev;return e.next=n,n.prev=e,r.next=i,i.prev=r,t.next=r,r.prev=t,x.next=t,t.prev=x,t}function insertNode(e,n,r,t){var i=new Node(e,n,r);return t?(i.next=t.next,i.prev=t,t.next.prev=i,t.next=i):(i.prev=i,i.next=i),i}function removeNode(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Node(e,n,r){this.i=e,this.x=n,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function signedArea(e,n,r,t){for(var i=0,x=n,a=r-t;x<r;x+=t)i+=(e[a]-e[x])*(e[x+1]+e[a+1]),a=x;return i}module.exports=earcut,earcut.deviation=function(e,n,r,t){var i=n&&n.length,x=i?n[0]*r:e.length,a=Math.abs(signedArea(e,0,x,r));if(i)for(var o=0,l=n.length;o<l;o++){var u=n[o]*r,s=o<l-1?n[o+1]*r:e.length;a-=Math.abs(signedArea(e,u,s,r))}var v=0;for(o=0;o<t.length;o+=3){var f=t[o]*r,y=t[o+1]*r,d=t[o+2]*r;v+=Math.abs((e[f]-e[d])*(e[y+1]-e[f+1])-(e[f]-e[y])*(e[d+1]-e[f+1]))}return 0===a&&0===v?0:Math.abs((v-a)/a)},earcut.flatten=function(e){for(var n=e[0][0].length,r={vertices:[],holes:[],dimensions:n},t=0,i=0;i<e.length;i++){for(var x=0;x<e[i].length;x++)for(var a=0;a<n;a++)r.vertices.push(e[i][x][a]);i>0&&(t+=e[i-1].length,r.holes.push(t))}return r}; | |
},{}],6:[function(_dereq_,module,exports){ | |
function geometry(r){if("Polygon"===r.type)return polygonArea(r.coordinates);if("MultiPolygon"===r.type){for(var e=0,n=0;n<r.coordinates.length;n++)e+=polygonArea(r.coordinates[n]);return e}return null}function polygonArea(r){var e=0;if(r&&r.length>0){e+=Math.abs(ringArea(r[0]));for(var n=1;n<r.length;n++)e-=Math.abs(ringArea(r[n]))}return e}function ringArea(r){var e=0;if(r.length>2){for(var n,t,o=0;o<r.length-1;o++)n=r[o],t=r[o+1],e+=rad(t[0]-n[0])*(2+Math.sin(rad(n[1]))+Math.sin(rad(t[1])));e=e*wgs84.RADIUS*wgs84.RADIUS/2}return e}function rad(r){return r*Math.PI/180}var wgs84=_dereq_("wgs84");module.exports.geometry=geometry,module.exports.ring=ringArea; | |
},{"wgs84":42}],7:[function(_dereq_,module,exports){ | |
function rewind(r,e){switch(r&&r.type||null){case"FeatureCollection":return r.features=r.features.map(curryOuter(rewind,e)),r;case"Feature":return r.geometry=rewind(r.geometry,e),r;case"Polygon":case"MultiPolygon":return correct(r,e);default:return r}}function curryOuter(r,e){return function(n){return r(n,e)}}function correct(r,e){return"Polygon"===r.type?r.coordinates=correctRings(r.coordinates,e):"MultiPolygon"===r.type&&(r.coordinates=r.coordinates.map(curryOuter(correctRings,e))),r}function correctRings(r,e){e=!!e,r[0]=wind(r[0],!e);for(var n=1;n<r.length;n++)r[n]=wind(r[n],e);return r}function wind(r,e){return cw(r)===e?r:r.reverse()}function cw(r){return geojsonArea.ring(r)>=0}var geojsonArea=_dereq_("geojson-area");module.exports=rewind; | |
},{"geojson-area":6}],8:[function(_dereq_,module,exports){ | |
"use strict";function clip(e,r,t,n,u,i,l,s){if(t/=r,n/=r,l>=t&&s<=n)return e;if(l>n||s<t)return null;for(var h=[],p=0;p<e.length;p++){var a,c,o=e[p],f=o.geometry,g=o.type;if(a=o.min[u],c=o.max[u],a>=t&&c<=n)h.push(o);else if(!(a>n||c<t)){var v=1===g?clipPoints(f,t,n,u):clipGeometry(f,t,n,u,i,3===g);v.length&&h.push(createFeature(o.tags,g,v,o.id))}}return h.length?h:null}function clipPoints(e,r,t,n){for(var u=[],i=0;i<e.length;i++){var l=e[i],s=l[n];s>=r&&s<=t&&u.push(l)}return u}function clipGeometry(e,r,t,n,u,i){for(var l=[],s=0;s<e.length;s++){var h,p,a,c=0,o=0,f=null,g=e[s],v=g.area,m=g.dist,w=g.outer,S=g.length,d=[];for(p=0;p<S-1;p++)h=f||g[p],f=g[p+1],c=o||h[n],o=f[n],c<r?o>t?(d.push(u(h,f,r),u(h,f,t)),i||(d=newSlice(l,d,v,m,w))):o>=r&&d.push(u(h,f,r)):c>t?o<r?(d.push(u(h,f,t),u(h,f,r)),i||(d=newSlice(l,d,v,m,w))):o<=t&&d.push(u(h,f,t)):(d.push(h),o<r?(d.push(u(h,f,r)),i||(d=newSlice(l,d,v,m,w))):o>t&&(d.push(u(h,f,t)),i||(d=newSlice(l,d,v,m,w))));h=g[S-1],c=h[n],c>=r&&c<=t&&d.push(h),a=d[d.length-1],i&&a&&(d[0][0]!==a[0]||d[0][1]!==a[1])&&d.push(d[0]),newSlice(l,d,v,m,w)}return l}function newSlice(e,r,t,n,u){return r.length&&(r.area=t,r.dist=n,void 0!==u&&(r.outer=u),e.push(r)),[]}module.exports=clip;var createFeature=_dereq_("./feature"); | |
},{"./feature":10}],9:[function(_dereq_,module,exports){ | |
"use strict";function convert(e,t){var r=[];if("FeatureCollection"===e.type)for(var o=0;o<e.features.length;o++)convertFeature(r,e.features[o],t);else"Feature"===e.type?convertFeature(r,e,t):convertFeature(r,{geometry:e},t);return r}function convertFeature(e,t,r){if(null!==t.geometry){var o,a,i,n,u=t.geometry,c=u.type,l=u.coordinates,s=t.properties,p=t.id;if("Point"===c)e.push(createFeature(s,1,[projectPoint(l)],p));else if("MultiPoint"===c)e.push(createFeature(s,1,project(l),p));else if("LineString"===c)e.push(createFeature(s,2,[project(l,r)],p));else if("MultiLineString"===c||"Polygon"===c){for(i=[],o=0;o<l.length;o++)n=project(l[o],r),"Polygon"===c&&(n.outer=0===o),i.push(n);e.push(createFeature(s,"Polygon"===c?3:2,i,p))}else if("MultiPolygon"===c){for(i=[],o=0;o<l.length;o++)for(a=0;a<l[o].length;a++)n=project(l[o][a],r),n.outer=0===a,i.push(n);e.push(createFeature(s,3,i,p))}else{if("GeometryCollection"!==c)throw new Error("Input data is not a valid GeoJSON object.");for(o=0;o<u.geometries.length;o++)convertFeature(e,{geometry:u.geometries[o],properties:s},r)}}}function project(e,t){for(var r=[],o=0;o<e.length;o++)r.push(projectPoint(e[o]));return t&&(simplify(r,t),calcSize(r)),r}function projectPoint(e){var t=Math.sin(e[1]*Math.PI/180),r=e[0]/360+.5,o=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return o=o<0?0:o>1?1:o,[r,o,0]}function calcSize(e){for(var t,r,o=0,a=0,i=0;i<e.length-1;i++)t=r||e[i],r=e[i+1],o+=t[0]*r[1]-r[0]*t[1],a+=Math.abs(r[0]-t[0])+Math.abs(r[1]-t[1]);e.area=Math.abs(o/2),e.dist=a}module.exports=convert;var simplify=_dereq_("./simplify"),createFeature=_dereq_("./feature"); | |
},{"./feature":10,"./simplify":12}],10:[function(_dereq_,module,exports){ | |
"use strict";function createFeature(e,t,a,n){var r={id:n||null,type:t,geometry:a,tags:e||null,min:[1/0,1/0],max:[-(1/0),-(1/0)]};return calcBBox(r),r}function calcBBox(e){var t=e.geometry,a=e.min,n=e.max;if(1===e.type)calcRingBBox(a,n,t);else for(var r=0;r<t.length;r++)calcRingBBox(a,n,t[r]);return e}function calcRingBBox(e,t,a){for(var n,r=0;r<a.length;r++)n=a[r],e[0]=Math.min(n[0],e[0]),t[0]=Math.max(n[0],t[0]),e[1]=Math.min(n[1],e[1]),t[1]=Math.max(n[1],t[1])}module.exports=createFeature; | |
},{}],11:[function(_dereq_,module,exports){ | |
"use strict";function geojsonvt(e,t){return new GeoJSONVT(e,t)}function GeoJSONVT(e,t){t=this.options=extend(Object.create(this.options),t);var i=t.debug;i&&console.time("preprocess data");var o=1<<t.maxZoom,n=convert(e,t.tolerance/(o*t.extent));this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=wrap(n,t.buffer/t.extent,intersectX),n.length&&this.splitTile(n,0,0,0),i&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function toID(e,t,i){return 32*((1<<e)*i+t)+e}function intersectX(e,t,i){return[i,(i-e[0])*(t[1]-e[1])/(t[0]-e[0])+e[1],1]}function intersectY(e,t,i){return[(i-e[1])*(t[0]-e[0])/(t[1]-e[1])+e[0],i,1]}function extend(e,t){for(var i in t)e[i]=t[i];return e}function isClippedSquare(e,t,i){var o=e.source;if(1!==o.length)return!1;var n=o[0];if(3!==n.type||n.geometry.length>1)return!1;var r=n.geometry[0].length;if(5!==r)return!1;for(var s=0;s<r;s++){var l=transform.point(n.geometry[0][s],t,e.z2,e.x,e.y);if(l[0]!==-i&&l[0]!==t+i||l[1]!==-i&&l[1]!==t+i)return!1}return!0}module.exports=geojsonvt;var convert=_dereq_("./convert"),transform=_dereq_("./transform"),clip=_dereq_("./clip"),wrap=_dereq_("./wrap"),createTile=_dereq_("./tile");GeoJSONVT.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,solidChildren:!1,tolerance:3,extent:4096,buffer:64,debug:0},GeoJSONVT.prototype.splitTile=function(e,t,i,o,n,r,s){for(var l=[e,t,i,o],a=this.options,u=a.debug,c=null;l.length;){o=l.pop(),i=l.pop(),t=l.pop(),e=l.pop();var p=1<<t,d=toID(t,i,o),m=this.tiles[d],f=t===a.maxZoom?0:a.tolerance/(p*a.extent);if(!m&&(u>1&&console.time("creation"),m=this.tiles[d]=createTile(e,p,i,o,f,t===a.maxZoom),this.tileCoords.push({z:t,x:i,y:o}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,o,m.numFeatures,m.numPoints,m.numSimplified),console.timeEnd("creation"));var h="z"+t;this.stats[h]=(this.stats[h]||0)+1,this.total++}if(m.source=e,n){if(t===a.maxZoom||t===n)continue;var x=1<<n-t;if(i!==Math.floor(r/x)||o!==Math.floor(s/x))continue}else if(t===a.indexMaxZoom||m.numPoints<=a.indexMaxPoints)continue;if(a.solidChildren||!isClippedSquare(m,a.extent,a.buffer)){m.source=null,u>1&&console.time("clipping");var g,v,M,T,b,y,S=.5*a.buffer/a.extent,Z=.5-S,q=.5+S,w=1+S;g=v=M=T=null,b=clip(e,p,i-S,i+q,0,intersectX,m.min[0],m.max[0]),y=clip(e,p,i+Z,i+w,0,intersectX,m.min[0],m.max[0]),b&&(g=clip(b,p,o-S,o+q,1,intersectY,m.min[1],m.max[1]),v=clip(b,p,o+Z,o+w,1,intersectY,m.min[1],m.max[1])),y&&(M=clip(y,p,o-S,o+q,1,intersectY,m.min[1],m.max[1]),T=clip(y,p,o+Z,o+w,1,intersectY,m.min[1],m.max[1])),u>1&&console.timeEnd("clipping"),e.length&&(l.push(g||[],t+1,2*i,2*o),l.push(v||[],t+1,2*i,2*o+1),l.push(M||[],t+1,2*i+1,2*o),l.push(T||[],t+1,2*i+1,2*o+1))}else n&&(c=t)}return c},GeoJSONVT.prototype.getTile=function(e,t,i){var o=this.options,n=o.extent,r=o.debug,s=1<<e;t=(t%s+s)%s;var l=toID(e,t,i);if(this.tiles[l])return transform.tile(this.tiles[l],n);r>1&&console.log("drilling down to z%d-%d-%d",e,t,i);for(var a,u=e,c=t,p=i;!a&&u>0;)u--,c=Math.floor(c/2),p=Math.floor(p/2),a=this.tiles[toID(u,c,p)];if(!a||!a.source)return null;if(r>1&&console.log("found parent tile z%d-%d-%d",u,c,p),isClippedSquare(a,n,o.buffer))return transform.tile(a,n);r>1&&console.time("drilling down");var d=this.splitTile(a.source,u,c,p,e,t,i);if(r>1&&console.timeEnd("drilling down"),null!==d){var m=1<<e-d;l=toID(d,Math.floor(t/m),Math.floor(i/m))}return this.tiles[l]?transform.tile(this.tiles[l],n):null}; | |
},{"./clip":8,"./convert":9,"./tile":13,"./transform":14,"./wrap":15}],12:[function(_dereq_,module,exports){ | |
"use strict";function simplify(t,i){var e,p,r,s,o=i*i,f=t.length,u=0,n=f-1,g=[];for(t[u][2]=1,t[n][2]=1;n;){for(p=0,e=u+1;e<n;e++)r=getSqSegDist(t[e],t[u],t[n]),r>p&&(s=e,p=r);p>o?(t[s][2]=p,g.push(u),g.push(s),u=s):(n=g.pop(),u=g.pop())}}function getSqSegDist(t,i,e){var p=i[0],r=i[1],s=e[0],o=e[1],f=t[0],u=t[1],n=s-p,g=o-r;if(0!==n||0!==g){var l=((f-p)*n+(u-r)*g)/(n*n+g*g);l>1?(p=s,r=o):l>0&&(p+=n*l,r+=g*l)}return n=f-p,g=u-r,n*n+g*g}module.exports=simplify; | |
},{}],13:[function(_dereq_,module,exports){ | |
"use strict";function createTile(e,n,r,i,t,u){for(var a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:i,z2:n,transformed:!1,min:[2,1],max:[-1,0]},m=0;m<e.length;m++){a.numFeatures++,addFeature(a,e[m],t,u);var s=e[m].min,l=e[m].max;s[0]<a.min[0]&&(a.min[0]=s[0]),s[1]<a.min[1]&&(a.min[1]=s[1]),l[0]>a.max[0]&&(a.max[0]=l[0]),l[1]>a.max[1]&&(a.max[1]=l[1])}return a}function addFeature(e,n,r,i){var t,u,a,m,s=n.geometry,l=n.type,o=[],f=r*r;if(1===l)for(t=0;t<s.length;t++)o.push(s[t]),e.numPoints++,e.numSimplified++;else for(t=0;t<s.length;t++)if(a=s[t],i||!(2===l&&a.dist<r||3===l&&a.area<f)){var d=[];for(u=0;u<a.length;u++)m=a[u],(i||m[2]>f)&&(d.push(m),e.numSimplified++),e.numPoints++;3===l&&rewind(d,a.outer),o.push(d)}else e.numPoints+=a.length;if(o.length){var g={geometry:o,type:l,tags:n.tags||null};null!==n.id&&(g.id=n.id),e.features.push(g)}}function rewind(e,n){var r=signedArea(e);r<0===n&&e.reverse()}function signedArea(e){for(var n,r,i=0,t=0,u=e.length,a=u-1;t<u;a=t++)n=e[t],r=e[a],i+=(r[0]-n[0])*(n[1]+r[1]);return i}module.exports=createTile; | |
},{}],14:[function(_dereq_,module,exports){ | |
"use strict";function transformTile(r,t){if(r.transformed)return r;var n,e,o,f=r.z2,a=r.x,s=r.y;for(n=0;n<r.features.length;n++){var i=r.features[n],u=i.geometry,m=i.type;if(1===m)for(e=0;e<u.length;e++)u[e]=transformPoint(u[e],t,f,a,s);else for(e=0;e<u.length;e++){var l=u[e];for(o=0;o<l.length;o++)l[o]=transformPoint(l[o],t,f,a,s)}}return r.transformed=!0,r}function transformPoint(r,t,n,e,o){var f=Math.round(t*(r[0]*n-e)),a=Math.round(t*(r[1]*n-o));return[f,a]}exports.tile=transformTile,exports.point=transformPoint; | |
},{}],15:[function(_dereq_,module,exports){ | |
"use strict";function wrap(r,e,t){var o=r,a=clip(r,1,-1-e,e,0,t,-1,2),s=clip(r,1,1-e,2+e,0,t,-1,2);return(a||s)&&(o=clip(r,1,-e,1+e,0,t,-1,2)||[],a&&(o=shiftFeatureCoords(a,1).concat(o)),s&&(o=o.concat(shiftFeatureCoords(s,-1)))),o}function shiftFeatureCoords(r,e){for(var t=[],o=0;o<r.length;o++){var a,s=r[o],i=s.type;if(1===i)a=shiftCoords(s.geometry,e);else{a=[];for(var u=0;u<s.geometry.length;u++)a.push(shiftCoords(s.geometry[u],e))}t.push(createFeature(s.tags,i,a,s.id))}return t}function shiftCoords(r,e){var t=[];t.area=r.area,t.dist=r.dist;for(var o=0;o<r.length;o++)t.push([r[o][0]+e,r[o][1],r[o][2]]);return t}var clip=_dereq_("./clip"),createFeature=_dereq_("./feature");module.exports=wrap; | |
},{"./clip":8,"./feature":10}],16:[function(_dereq_,module,exports){ | |
"use strict";function GridIndex(t,r,e){var s=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var i=new Int32Array(this.arrayBuffer);t=i[0],r=i[1],e=i[2],this.d=r+2*e;for(var h=0;h<this.d*this.d;h++){var n=i[NUM_PARAMS+h],o=i[NUM_PARAMS+h+1];s.push(n===o?null:i.subarray(n,o))}var l=i[NUM_PARAMS+s.length],a=i[NUM_PARAMS+s.length+1];this.keys=i.subarray(l,a),this.bboxes=i.subarray(a),this.insert=this._insertReadonly}else{this.d=r+2*e;for(var d=0;d<this.d*this.d;d++)s.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=e,this.scale=r/t,this.uid=0;var f=e/r*t;this.min=-f,this.max=t+f}module.exports=GridIndex;var NUM_PARAMS=3;GridIndex.prototype.insert=function(t,r,e,s,i){this._forEachCell(r,e,s,i,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(e),this.bboxes.push(s),this.bboxes.push(i)},GridIndex.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},GridIndex.prototype._insertCell=function(t,r,e,s,i,h){this.cells[i].push(h)},GridIndex.prototype.query=function(t,r,e,s){var i=this.min,h=this.max;if(t<=i&&r<=i&&h<=e&&h<=s)return Array.prototype.slice.call(this.keys);var n=[],o={};return this._forEachCell(t,r,e,s,this._queryCell,n,o),n},GridIndex.prototype._queryCell=function(t,r,e,s,i,h,n){var o=this.cells[i];if(null!==o)for(var l=this.keys,a=this.bboxes,d=0;d<o.length;d++){var f=o[d];if(void 0===n[f]){var u=4*f;t<=a[u+2]&&r<=a[u+3]&&e>=a[u+0]&&s>=a[u+1]?(n[f]=!0,h.push(l[f])):n[f]=!1}}},GridIndex.prototype._forEachCell=function(t,r,e,s,i,h,n){for(var o=this._convertToCellCoord(t),l=this._convertToCellCoord(r),a=this._convertToCellCoord(e),d=this._convertToCellCoord(s),f=o;f<=a;f++)for(var u=l;u<=d;u++){var y=this.d*u+f;if(i.call(this,t,r,e,s,y,h,n))return}},GridIndex.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},GridIndex.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,r=NUM_PARAMS+this.cells.length+1+1,e=0,s=0;s<this.cells.length;s++)e+=this.cells[s].length;var i=new Int32Array(r+e+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;for(var h=r,n=0;n<t.length;n++){var o=t[n];i[NUM_PARAMS+n]=h,i.set(o,h),h+=o.length}return i[NUM_PARAMS+t.length]=h,i.set(this.keys,h),h+=this.keys.length,i[NUM_PARAMS+t.length+1]=h,i.set(this.bboxes,h),h+=this.bboxes.length,i.buffer}; | |
},{}],17:[function(_dereq_,module,exports){ | |
exports.read=function(a,o,t,r,h){var M,p,w=8*h-r-1,f=(1<<w)-1,e=f>>1,i=-7,N=t?h-1:0,n=t?-1:1,s=a[o+N];for(N+=n,M=s&(1<<-i)-1,s>>=-i,i+=w;i>0;M=256*M+a[o+N],N+=n,i-=8);for(p=M&(1<<-i)-1,M>>=-i,i+=r;i>0;p=256*p+a[o+N],N+=n,i-=8);if(0===M)M=1-e;else{if(M===f)return p?NaN:(s?-1:1)*(1/0);p+=Math.pow(2,r),M-=e}return(s?-1:1)*p*Math.pow(2,M-r)},exports.write=function(a,o,t,r,h,M){var p,w,f,e=8*M-h-1,i=(1<<e)-1,N=i>>1,n=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,s=r?0:M-1,u=r?1:-1,l=o<0||0===o&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(w=isNaN(o)?1:0,p=i):(p=Math.floor(Math.log(o)/Math.LN2),o*(f=Math.pow(2,-p))<1&&(p--,f*=2),o+=p+N>=1?n/f:n*Math.pow(2,1-N),o*f>=2&&(p++,f/=2),p+N>=i?(w=0,p=i):p+N>=1?(w=(o*f-1)*Math.pow(2,h),p+=N):(w=o*Math.pow(2,N-1)*Math.pow(2,h),p=0));h>=8;a[t+s]=255&w,s+=u,w/=256,h-=8);for(p=p<<h|w,e+=h;e>0;a[t+s]=255&p,s+=u,p/=256,e-=8);a[t+s-u]|=128*l}; | |
},{}],18:[function(_dereq_,module,exports){ | |
"use strict";function kdbush(t,i,e,s,n){return new KDBush(t,i,e,s,n)}function KDBush(t,i,e,s,n){i=i||defaultGetX,e=e||defaultGetY,n=n||Array,this.nodeSize=s||64,this.points=t,this.ids=new n(t.length),this.coords=new n(2*t.length);for(var r=0;r<t.length;r++)this.ids[r]=r,this.coords[2*r]=i(t[r]),this.coords[2*r+1]=e(t[r]);sort(this.ids,this.coords,this.nodeSize,0,this.ids.length-1,0)}function defaultGetX(t){return t[0]}function defaultGetY(t){return t[1]}var sort=_dereq_("./sort"),range=_dereq_("./range"),within=_dereq_("./within");module.exports=kdbush,KDBush.prototype={range:function(t,i,e,s){return range(this.ids,this.coords,t,i,e,s,this.nodeSize)},within:function(t,i,e){return within(this.ids,this.coords,t,i,e,this.nodeSize)}}; | |
},{"./range":19,"./sort":20,"./within":21}],19:[function(_dereq_,module,exports){ | |
"use strict";function range(p,r,s,u,h,e,o){for(var a,t,n=[0,p.length-1,0],f=[];n.length;){var l=n.pop(),v=n.pop(),g=n.pop();if(v-g<=o)for(var i=g;i<=v;i++)a=r[2*i],t=r[2*i+1],a>=s&&a<=h&&t>=u&&t<=e&&f.push(p[i]);else{var c=Math.floor((g+v)/2);a=r[2*c],t=r[2*c+1],a>=s&&a<=h&&t>=u&&t<=e&&f.push(p[c]);var d=(l+1)%2;(0===l?s<=a:u<=t)&&(n.push(g),n.push(c-1),n.push(d)),(0===l?h>=a:e>=t)&&(n.push(c+1),n.push(v),n.push(d))}}return f}module.exports=range; | |
},{}],20:[function(_dereq_,module,exports){ | |
"use strict";function sortKD(t,a,o,s,r,e){if(!(r-s<=o)){var f=Math.floor((s+r)/2);select(t,a,f,s,r,e%2),sortKD(t,a,o,s,f-1,e+1),sortKD(t,a,o,f+1,r,e+1)}}function select(t,a,o,s,r,e){for(;r>s;){if(r-s>600){var f=r-s+1,p=o-s+1,w=Math.log(f),m=.5*Math.exp(2*w/3),n=.5*Math.sqrt(w*m*(f-m)/f)*(p-f/2<0?-1:1),c=Math.max(s,Math.floor(o-p*m/f+n)),h=Math.min(r,Math.floor(o+(f-p)*m/f+n));select(t,a,o,c,h,e)}var i=a[2*o+e],l=s,M=r;for(swapItem(t,a,s,o),a[2*r+e]>i&&swapItem(t,a,s,r);l<M;){for(swapItem(t,a,l,M),l++,M--;a[2*l+e]<i;)l++;for(;a[2*M+e]>i;)M--}a[2*s+e]===i?swapItem(t,a,s,M):(M++,swapItem(t,a,M,r)),M<=o&&(s=M+1),o<=M&&(r=M-1)}}function swapItem(t,a,o,s){swap(t,o,s),swap(a,2*o,2*s),swap(a,2*o+1,2*s+1)}function swap(t,a,o){var s=t[a];t[a]=t[o],t[o]=s}module.exports=sortKD; | |
},{}],21:[function(_dereq_,module,exports){ | |
"use strict";function within(s,p,r,t,u,h){for(var i=[0,s.length-1,0],o=[],n=u*u;i.length;){var e=i.pop(),a=i.pop(),f=i.pop();if(a-f<=h)for(var v=f;v<=a;v++)sqDist(p[2*v],p[2*v+1],r,t)<=n&&o.push(s[v]);else{var l=Math.floor((f+a)/2),c=p[2*l],q=p[2*l+1];sqDist(c,q,r,t)<=n&&o.push(s[l]);var D=(e+1)%2;(0===e?r-u<=c:t-u<=q)&&(i.push(f),i.push(l-1),i.push(D)),(0===e?r+u>=c:t+u>=q)&&(i.push(l+1),i.push(a),i.push(D))}}return o}function sqDist(s,p,r,t){var u=s-r,h=p-t;return u*u+h*h}module.exports=within; | |
},{}],22:[function(_dereq_,module,exports){ | |
"use strict";function isSupported(e){return!!(isBrowser()&&isArraySupported()&&isFunctionSupported()&&isObjectSupported()&&isJSONSupported()&&isWorkerSupported()&&isUint8ClampedArraySupported()&&isWebGLSupportedCached(e&&e.failIfMajorPerformanceCaveat))}function isBrowser(){return"undefined"!=typeof window&&"undefined"!=typeof document}function isArraySupported(){return Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray}function isFunctionSupported(){return Function.prototype&&Function.prototype.bind}function isObjectSupported(){return Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions}function isJSONSupported(){return"JSON"in window&&"parse"in JSON&&"stringify"in JSON}function isWorkerSupported(){return"Worker"in window}function isUint8ClampedArraySupported(){return"Uint8ClampedArray"in window}function isWebGLSupportedCached(e){return void 0===isWebGLSupportedCache[e]&&(isWebGLSupportedCache[e]=isWebGLSupported(e)),isWebGLSupportedCache[e]}function isWebGLSupported(e){var t=document.createElement("canvas"),r=Object.create(isSupported.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=e,t.probablySupportsContext?t.probablySupportsContext("webgl",r)||t.probablySupportsContext("experimental-webgl",r):t.supportsContext?t.supportsContext("webgl",r)||t.supportsContext("experimental-webgl",r):t.getContext("webgl",r)||t.getContext("experimental-webgl",r)}"undefined"!=typeof module&&module.exports?module.exports=isSupported:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=isSupported);var isWebGLSupportedCache={};isSupported.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}; | |
},{}],23:[function(_dereq_,module,exports){ | |
(function (process){ | |
function normalizeArray(r,t){for(var e=0,n=r.length-1;n>=0;n--){var s=r[n];"."===s?r.splice(n,1):".."===s?(r.splice(n,1),e++):e&&(r.splice(n,1),e--)}if(t)for(;e--;e)r.unshift("..");return r}function filter(r,t){if(r.filter)return r.filter(t);for(var e=[],n=0;n<r.length;n++)t(r[n],n,r)&&e.push(r[n]);return e}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,splitPath=function(r){return splitPathRe.exec(r).slice(1)};exports.resolve=function(){for(var r="",t=!1,e=arguments.length-1;e>=-1&&!t;e--){var n=e>=0?arguments[e]:process.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");n&&(r=n+"/"+r,t="/"===n.charAt(0))}return r=normalizeArray(filter(r.split("/"),function(r){return!!r}),!t).join("/"),(t?"/":"")+r||"."},exports.normalize=function(r){var t=exports.isAbsolute(r),e="/"===substr(r,-1);return r=normalizeArray(filter(r.split("/"),function(r){return!!r}),!t).join("/"),r||t||(r="."),r&&e&&(r+="/"),(t?"/":"")+r},exports.isAbsolute=function(r){return"/"===r.charAt(0)},exports.join=function(){var r=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(r,function(r,t){if("string"!=typeof r)throw new TypeError("Arguments to path.join must be strings");return r}).join("/"))},exports.relative=function(r,t){function e(r){for(var t=0;t<r.length&&""===r[t];t++);for(var e=r.length-1;e>=0&&""===r[e];e--);return t>e?[]:r.slice(t,e-t+1)}r=exports.resolve(r).substr(1),t=exports.resolve(t).substr(1);for(var n=e(r.split("/")),s=e(t.split("/")),i=Math.min(n.length,s.length),o=i,u=0;u<i;u++)if(n[u]!==s[u]){o=u;break}for(var l=[],u=o;u<n.length;u++)l.push("..");return l=l.concat(s.slice(o)),l.join("/")},exports.sep="/",exports.delimiter=":",exports.dirname=function(r){var t=splitPath(r),e=t[0],n=t[1];return e||n?(n&&(n=n.substr(0,n.length-1)),e+n):"."},exports.basename=function(r,t){var e=splitPath(r)[2];return t&&e.substr(-1*t.length)===t&&(e=e.substr(0,e.length-t.length)),e},exports.extname=function(r){return splitPath(r)[3]};var substr="b"==="ab".substr(-1)?function(r,t,e){return r.substr(t,e)}:function(r,t,e){return t<0&&(t=r.length+t),r.substr(t,e)}; | |
}).call(this,_dereq_('_process')) | |
},{"_process":27}],24:[function(_dereq_,module,exports){ | |
"use strict";function Buffer(t){var e;t&&t.length&&(e=t,t=e.length);var r=new Uint8Array(t||0);return e&&r.set(e),r.readUInt32LE=BufferMethods.readUInt32LE,r.writeUInt32LE=BufferMethods.writeUInt32LE,r.readInt32LE=BufferMethods.readInt32LE,r.writeInt32LE=BufferMethods.writeInt32LE,r.readFloatLE=BufferMethods.readFloatLE,r.writeFloatLE=BufferMethods.writeFloatLE,r.readDoubleLE=BufferMethods.readDoubleLE,r.writeDoubleLE=BufferMethods.writeDoubleLE,r.toString=BufferMethods.toString,r.write=BufferMethods.write,r.slice=BufferMethods.slice,r.copy=BufferMethods.copy,r._isBuffer=!0,r}function encodeString(t){for(var e,r,n=t.length,i=[],o=0;o<n;o++){if(e=t.charCodeAt(o),e>55295&&e<57344){if(!r){e>56319||o+1===n?i.push(239,191,189):r=e;continue}if(e<56320){i.push(239,191,189),r=e;continue}e=r-55296<<10|e-56320|65536,r=null}else r&&(i.push(239,191,189),r=null);e<128?i.push(e):e<2048?i.push(e>>6|192,63&e|128):e<65536?i.push(e>>12|224,e>>6&63|128,63&e|128):i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}return i}module.exports=Buffer;var ieee754=_dereq_("ieee754"),BufferMethods,lastStr,lastStrEncoded;BufferMethods={readUInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},writeUInt32LE:function(t,e){this[e]=t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24},readInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+(this[t+3]<<24)},readFloatLE:function(t){return ieee754.read(this,t,!0,23,4)},readDoubleLE:function(t){return ieee754.read(this,t,!0,52,8)},writeFloatLE:function(t,e){return ieee754.write(this,t,e,!0,23,4)},writeDoubleLE:function(t,e){return ieee754.write(this,t,e,!0,52,8)},toString:function(t,e,r){var n="",i="";e=e||0,r=Math.min(this.length,r||this.length);for(var o=e;o<r;o++){var u=this[o];u<=127?(n+=decodeURIComponent(i)+String.fromCharCode(u),i=""):i+="%"+u.toString(16)}return n+=decodeURIComponent(i)},write:function(t,e){for(var r=t===lastStr?lastStrEncoded:encodeString(t),n=0;n<r.length;n++)this[e+n]=r[n]},slice:function(t,e){return this.subarray(t,e)},copy:function(t,e){e=e||0;for(var r=0;r<this.length;r++)t[e+r]=this[r]}},BufferMethods.writeInt32LE=BufferMethods.writeUInt32LE,Buffer.byteLength=function(t){return lastStr=t,lastStrEncoded=encodeString(t),lastStrEncoded.length},Buffer.isBuffer=function(t){return!(!t||!t._isBuffer)}; | |
},{"ieee754":17}],25:[function(_dereq_,module,exports){ | |
(function (global){ | |
"use strict";function Pbf(t){this.buf=Buffer.isBuffer(t)?t:new Buffer(t||0),this.pos=0,this.length=this.buf.length}function readVarintRemainder(t,i){var e,r=i.buf;if(e=r[i.pos++],t+=268435456*(127&e),e<128)return t;if(e=r[i.pos++],t+=34359738368*(127&e),e<128)return t;if(e=r[i.pos++],t+=4398046511104*(127&e),e<128)return t;if(e=r[i.pos++],t+=562949953421312*(127&e),e<128)return t;if(e=r[i.pos++],t+=72057594037927940*(127&e),e<128)return t;if(e=r[i.pos++],t+=0x8000000000000000*(127&e),e<128)return t;throw new Error("Expected varint not more than 10 bytes")}function writeBigVarint(t,i){i.realloc(10);for(var e=i.pos+10;t>=1;){if(i.pos>=e)throw new Error("Given varint doesn't fit into 10 bytes");var r=255&t;i.buf[i.pos++]=r|(t>=128?128:0),t/=128}}function reallocForRawMessage(t,i,e){var r=i<=16383?1:i<=2097151?2:i<=268435455?3:Math.ceil(Math.log(i)/(7*Math.LN2));e.realloc(r);for(var s=e.pos-1;s>=t;s--)e.buf[s+r]=e.buf[s]}function writePackedVarint(t,i){for(var e=0;e<t.length;e++)i.writeVarint(t[e])}function writePackedSVarint(t,i){for(var e=0;e<t.length;e++)i.writeSVarint(t[e])}function writePackedFloat(t,i){for(var e=0;e<t.length;e++)i.writeFloat(t[e])}function writePackedDouble(t,i){for(var e=0;e<t.length;e++)i.writeDouble(t[e])}function writePackedBoolean(t,i){for(var e=0;e<t.length;e++)i.writeBoolean(t[e])}function writePackedFixed32(t,i){for(var e=0;e<t.length;e++)i.writeFixed32(t[e])}function writePackedSFixed32(t,i){for(var e=0;e<t.length;e++)i.writeSFixed32(t[e])}function writePackedFixed64(t,i){for(var e=0;e<t.length;e++)i.writeFixed64(t[e])}function writePackedSFixed64(t,i){for(var e=0;e<t.length;e++)i.writeSFixed64(t[e])}module.exports=Pbf;var Buffer=global.Buffer||_dereq_("./buffer");Pbf.Varint=0,Pbf.Fixed64=1,Pbf.Bytes=2,Pbf.Fixed32=5;var SHIFT_LEFT_32=4294967296,SHIFT_RIGHT_32=1/SHIFT_LEFT_32,POW_2_63=Math.pow(2,63);Pbf.prototype={destroy:function(){this.buf=null},readFields:function(t,i,e){for(e=e||this.length;this.pos<e;){var r=this.readVarint(),s=r>>3,n=this.pos;t(s,i,this),this.pos===n&&this.skip(r)}return i},readMessage:function(t,i){return this.readFields(t,i,this.readVarint()+this.pos)},readFixed32:function(){var t=this.buf.readUInt32LE(this.pos);return this.pos+=4,t},readSFixed32:function(){var t=this.buf.readInt32LE(this.pos);return this.pos+=4,t},readFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readUInt32LE(this.pos+4)*SHIFT_LEFT_32;return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readInt32LE(this.pos+4)*SHIFT_LEFT_32;return this.pos+=8,t},readFloat:function(){var t=this.buf.readFloatLE(this.pos);return this.pos+=4,t},readDouble:function(){var t=this.buf.readDoubleLE(this.pos);return this.pos+=8,t},readVarint:function(){var t,i,e=this.buf;return i=e[this.pos++],t=127&i,i<128?t:(i=e[this.pos++],t|=(127&i)<<7,i<128?t:(i=e[this.pos++],t|=(127&i)<<14,i<128?t:(i=e[this.pos++],t|=(127&i)<<21,i<128?t:readVarintRemainder(t,this))))},readVarint64:function(){var t=this.pos,i=this.readVarint();if(i<POW_2_63)return i;for(var e=this.pos-2;255===this.buf[e];)e--;e<t&&(e=t),i=0;for(var r=0;r<e-t+1;r++){var s=127&~this.buf[t+r];i+=r<4?s<<7*r:s*Math.pow(2,7*r)}return-i-1},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,i=this.buf.toString("utf8",this.pos,t);return this.pos=t,i},readBytes:function(){var t=this.readVarint()+this.pos,i=this.buf.slice(this.pos,t);return this.pos=t,i},readPackedVarint:function(){for(var t=this.readVarint()+this.pos,i=[];this.pos<t;)i.push(this.readVarint());return i},readPackedSVarint:function(){for(var t=this.readVarint()+this.pos,i=[];this.pos<t;)i.push(this.readSVarint());return i},readPackedBoolean:function(){for(var t=this.readVarint()+this.pos,i=[];this.pos<t;)i.push(this.readBoolean());return i},readPackedFloat:function(){for(var t=this.readVarint()+this.pos,i=[];this.pos<t;)i.push(this.readFloat());return i},readPackedDouble:function(){for(var t=this.readVarint()+this.pos,i=[];this.pos<t;)i.push(this.readDouble());return i},readPackedFixed32:function(){for(var t=this.readVarint()+this.pos,i=[];this.pos<t;)i.push(this.readFixed32());return i},readPackedSFixed32:function(){for(var t=this.readVarint()+this.pos,i=[];this.pos<t;)i.push(this.readSFixed32());return i},readPackedFixed64:function(){for(var t=this.readVarint()+this.pos,i=[];this.pos<t;)i.push(this.readFixed64());return i},readPackedSFixed64:function(){for(var t=this.readVarint()+this.pos,i=[];this.pos<t;)i.push(this.readSFixed64());return i},skip:function(t){var i=7&t;if(i===Pbf.Varint)for(;this.buf[this.pos++]>127;);else if(i===Pbf.Bytes)this.pos=this.readVarint()+this.pos;else if(i===Pbf.Fixed32)this.pos+=4;else{if(i!==Pbf.Fixed64)throw new Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(t,i){this.writeVarint(t<<3|i)},realloc:function(t){for(var i=this.length||16;i<this.pos+t;)i*=2;if(i!==this.length){var e=new Buffer(i);this.buf.copy(e),this.buf=e,this.length=i}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.slice(0,this.length)},writeFixed32:function(t){this.realloc(4),this.buf.writeUInt32LE(t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),this.buf.writeInt32LE(t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),this.buf.writeInt32LE(t&-1,this.pos),this.buf.writeUInt32LE(Math.floor(t*SHIFT_RIGHT_32),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),this.buf.writeInt32LE(t&-1,this.pos),this.buf.writeInt32LE(Math.floor(t*SHIFT_RIGHT_32),this.pos+4),this.pos+=8},writeVarint:function(t){return t=+t,t>268435455?void writeBigVarint(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),void(t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127)))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t);var i=Buffer.byteLength(t);this.writeVarint(i),this.realloc(i),this.buf.write(t,this.pos),this.pos+=i},writeFloat:function(t){this.realloc(4),this.buf.writeFloatLE(t,this.pos),this.pos+=4},writeDouble:function(t){this.realloc(8),this.buf.writeDoubleLE(t,this.pos),this.pos+=8},writeBytes:function(t){var i=t.length;this.writeVarint(i),this.realloc(i);for(var e=0;e<i;e++)this.buf[this.pos++]=t[e]},writeRawMessage:function(t,i){this.pos++;var e=this.pos;t(i,this);var r=this.pos-e;r>=128&&reallocForRawMessage(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,i,e){this.writeTag(t,Pbf.Bytes),this.writeRawMessage(i,e)},writePackedVarint:function(t,i){this.writeMessage(t,writePackedVarint,i)},writePackedSVarint:function(t,i){this.writeMessage(t,writePackedSVarint,i)},writePackedBoolean:function(t,i){this.writeMessage(t,writePackedBoolean,i)},writePackedFloat:function(t,i){this.writeMessage(t,writePackedFloat,i)},writePackedDouble:function(t,i){this.writeMessage(t,writePackedDouble,i)},writePackedFixed32:function(t,i){this.writeMessage(t,writePackedFixed32,i)},writePackedSFixed32:function(t,i){this.writeMessage(t,writePackedSFixed32,i)},writePackedFixed64:function(t,i){this.writeMessage(t,writePackedFixed64,i)},writePackedSFixed64:function(t,i){this.writeMessage(t,writePackedSFixed64,i)},writeBytesField:function(t,i){this.writeTag(t,Pbf.Bytes),this.writeBytes(i)},writeFixed32Field:function(t,i){this.writeTag(t,Pbf.Fixed32),this.writeFixed32(i)},writeSFixed32Field:function(t,i){this.writeTag(t,Pbf.Fixed32),this.writeSFixed32(i)},writeFixed64Field:function(t,i){this.writeTag(t,Pbf.Fixed64),this.writeFixed64(i)},writeSFixed64Field:function(t,i){this.writeTag(t,Pbf.Fixed64),this.writeSFixed64(i)},writeVarintField:function(t,i){this.writeTag(t,Pbf.Varint),this.writeVarint(i)},writeSVarintField:function(t,i){this.writeTag(t,Pbf.Varint),this.writeSVarint(i)},writeStringField:function(t,i){this.writeTag(t,Pbf.Bytes),this.writeString(i)},writeFloatField:function(t,i){this.writeTag(t,Pbf.Fixed32),this.writeFloat(i)},writeDoubleField:function(t,i){this.writeTag(t,Pbf.Fixed64),this.writeDouble(i)},writeBooleanField:function(t,i){this.writeVarintField(t,Boolean(i))}}; | |
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | |
},{"./buffer":24}],26:[function(_dereq_,module,exports){ | |
"use strict";function Point(t,n){this.x=t,this.y=n}module.exports=Point,Point.prototype={clone:function(){return new Point(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var n=t.x-this.x,i=t.y-this.y;return n*n+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},_matMult:function(t){var n=t[0]*this.x+t[1]*this.y,i=t[2]*this.x+t[3]*this.y;return this.x=n,this.y=i,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var n=Math.cos(t),i=Math.sin(t),s=n*this.x-i*this.y,r=i*this.x+n*this.y;return this.x=s,this.y=r,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Point.convert=function(t){return t instanceof Point?t:Array.isArray(t)?new Point(t[0],t[1]):t}; | |
},{}],27:[function(_dereq_,module,exports){ | |
function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(t){try{return cachedSetTimeout.call(null,e,0)}catch(t){return cachedSetTimeout.call(this,e,0)}}}function runClearTimeout(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(e);try{return cachedClearTimeout(e)}catch(t){try{return cachedClearTimeout.call(null,e)}catch(t){return cachedClearTimeout.call(this,e)}}}function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex<t;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,t=queue.length}currentQueue=null,draining=!1,runClearTimeout(e)}}function Item(e,t){this.fun=e,this.array=t}function noop(){}var process=module.exports={},cachedSetTimeout,cachedClearTimeout;!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var queue=[],draining=!1,currentQueue,queueIndex=-1;process.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var u=1;u<arguments.length;u++)t[u-1]=arguments[u];queue.push(new Item(e,t)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.binding=function(e){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(e){throw new Error("process.chdir is not supported")},process.umask=function(){return 0}; | |
},{}],28:[function(_dereq_,module,exports){ | |
"use strict";function partialSort(a,t,r,o,p){for(r=r||0,o=o||a.length-1,p=p||defaultCompare;o>r;){if(o-r>600){var f=o-r+1,e=t-r+1,l=Math.log(f),s=.5*Math.exp(2*l/3),i=.5*Math.sqrt(l*s*(f-s)/f)*(e-f/2<0?-1:1),n=Math.max(r,Math.floor(t-e*s/f+i)),h=Math.min(o,Math.floor(t+(f-e)*s/f+i));partialSort(a,t,n,h,p)}var u=a[t],M=r,w=o;for(swap(a,r,t),p(a[o],u)>0&&swap(a,r,o);M<w;){for(swap(a,M,w),M++,w--;p(a[M],u)<0;)M++;for(;p(a[w],u)>0;)w--}0===p(a[r],u)?swap(a,r,w):(w++,swap(a,w,o)),w<=t&&(r=w+1),t<=w&&(o=w-1)}}function swap(a,t,r){var o=a[t];a[t]=a[r],a[r]=o}function defaultCompare(a,t){return a<t?-1:a>t?1:0}module.exports=partialSort; | |
},{}],29:[function(_dereq_,module,exports){ | |
"use strict";function supercluster(t){return new SuperCluster(t)}function SuperCluster(t){this.options=extend(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function createCluster(t,e,o,n){return{x:t,y:e,zoom:1/0,id:n,numPoints:o}}function createPointCluster(t,e){var o=t.geometry.coordinates;return createCluster(lngX(o[0]),latY(o[1]),1,e)}function getClusterJSON(t){return{type:"Feature",properties:getClusterProperties(t),geometry:{type:"Point",coordinates:[xLng(t.x),yLat(t.y)]}}}function getClusterProperties(t){var e=t.numPoints,o=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return{cluster:!0,point_count:e,point_count_abbreviated:o}}function lngX(t){return t/360+.5}function latY(t){var e=Math.sin(t*Math.PI/180),o=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return o<0?0:o>1?1:o}function xLng(t){return 360*(t-.5)}function yLat(t){var e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function extend(t,e){for(var o in e)t[o]=e[o];return t}function getX(t){return t.x}function getY(t){return t.y}var kdbush=_dereq_("kdbush");module.exports=supercluster,SuperCluster.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1},load:function(t){var e=this.options.log;e&&console.time("total time");var o="prepare "+t.length+" points";e&&console.time(o),this.points=t;var n=t.map(createPointCluster);e&&console.timeEnd(o);for(var r=this.options.maxZoom;r>=this.options.minZoom;r--){var i=+Date.now();this.trees[r+1]=kdbush(n,getX,getY,this.options.nodeSize,Float32Array),n=this._cluster(n,r),e&&console.log("z%d: %d clusters in %dms",r,n.length,+Date.now()-i)}return this.trees[this.options.minZoom]=kdbush(n,getX,getY,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var o=this.trees[this._limitZoom(e)],n=o.range(lngX(t[0]),latY(t[3]),lngX(t[2]),latY(t[1])),r=[],i=0;i<n.length;i++){var s=o.points[n[i]];r.push(s.id!==-1?this.points[s.id]:getClusterJSON(s))}return r},getTile:function(t,e,o){var n=this.trees[this._limitZoom(t)],r=Math.pow(2,t),i=this.options.extent,s=this.options.radius,u=s/i,a=(o-u)/r,h=(o+1+u)/r,l={features:[]};return this._addTileFeatures(n.range((e-u)/r,a,(e+1+u)/r,h),n.points,e,o,r,l),0===e&&this._addTileFeatures(n.range(1-u/r,a,1,h),n.points,r,o,r,l),e===r-1&&this._addTileFeatures(n.range(0,a,u/r,h),n.points,-1,o,r,l),l.features.length?l:null},_addTileFeatures:function(t,e,o,n,r,i){for(var s=0;s<t.length;s++){var u=e[t[s]];i.features.push({type:1,geometry:[[Math.round(this.options.extent*(u.x*r-o)),Math.round(this.options.extent*(u.y*r-n))]],tags:u.id!==-1?this.points[u.id].properties:getClusterProperties(u)})}},_limitZoom:function(t){return Math.max(this.options.minZoom,Math.min(t,this.options.maxZoom+1))},_cluster:function(t,e){for(var o=[],n=this.options.radius/(this.options.extent*Math.pow(2,e)),r=0;r<t.length;r++){var i=t[r];if(!(i.zoom<=e)){i.zoom=e;for(var s=this.trees[e+1],u=s.within(i.x,i.y,n),a=!1,h=i.numPoints,l=i.x*h,p=i.y*h,m=0;m<u.length;m++){var c=s.points[u[m]];e<c.zoom&&(a=!0,c.zoom=e,l+=c.x*c.numPoints,p+=c.y*c.numPoints,h+=c.numPoints)}o.push(a?createCluster(l/h,p/h,h,-1):i)}}return o}}; | |
},{"kdbush":18}],30:[function(_dereq_,module,exports){ | |
"use strict";function TinyQueue(t,i){if(!(this instanceof TinyQueue))return new TinyQueue(t,i);if(this.data=t||[],this.length=this.data.length,this.compare=i||defaultCompare,t)for(var a=Math.floor(this.length/2);a>=0;a--)this._down(a)}function defaultCompare(t,i){return t<i?-1:t>i?1:0}function swap(t,i,a){var n=t[i];t[i]=t[a],t[a]=n}module.exports=TinyQueue,TinyQueue.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){var t=this.data[0];return this.data[0]=this.data[this.length-1],this.length--,this.data.pop(),this._down(0),t},peek:function(){return this.data[0]},_up:function(t){for(var i=this.data,a=this.compare;t>0;){var n=Math.floor((t-1)/2);if(!(a(i[t],i[n])<0))break;swap(i,n,t),t=n}},_down:function(t){for(var i=this.data,a=this.compare,n=this.length;;){var e=2*t+1,h=e+1,s=t;if(e<n&&a(i[e],i[s])<0&&(s=e),h<n&&a(i[h],i[s])<0&&(s=h),s===t)return;swap(i,s,t),t=s}}}; | |
},{}],31:[function(_dereq_,module,exports){ | |
"function"==typeof Object.create?module.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(t,e){t.super_=e;var o=function(){};o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t}; | |
},{}],32:[function(_dereq_,module,exports){ | |
module.exports=function(o){return o&&"object"==typeof o&&"function"==typeof o.copy&&"function"==typeof o.fill&&"function"==typeof o.readUInt8}; | |
},{}],33:[function(_dereq_,module,exports){ | |
(function (process,global){ | |
function inspect(e,r){var t={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(t.depth=arguments[2]),arguments.length>=4&&(t.colors=arguments[3]),isBoolean(r)?t.showHidden=r:r&&exports._extend(t,r),isUndefined(t.showHidden)&&(t.showHidden=!1),isUndefined(t.depth)&&(t.depth=2),isUndefined(t.colors)&&(t.colors=!1),isUndefined(t.customInspect)&&(t.customInspect=!0),t.colors&&(t.stylize=stylizeWithColor),formatValue(t,e,t.depth)}function stylizeWithColor(e,r){var t=inspect.styles[r];return t?"["+inspect.colors[t][0]+"m"+e+"["+inspect.colors[t][1]+"m":e}function stylizeNoColor(e,r){return e}function arrayToHash(e){var r={};return e.forEach(function(e,t){r[e]=!0}),r}function formatValue(e,r,t){if(e.customInspect&&r&&isFunction(r.inspect)&&r.inspect!==exports.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(t,e);return isString(n)||(n=formatValue(e,n,t)),n}var i=formatPrimitive(e,r);if(i)return i;var o=Object.keys(r),s=arrayToHash(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(r)),isError(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return formatError(r);if(0===o.length){if(isFunction(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(isRegExp(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(isDate(r))return e.stylize(Date.prototype.toString.call(r),"date");if(isError(r))return formatError(r)}var c="",a=!1,l=["{","}"];if(isArray(r)&&(a=!0,l=["[","]"]),isFunction(r)){var p=r.name?": "+r.name:"";c=" [Function"+p+"]"}if(isRegExp(r)&&(c=" "+RegExp.prototype.toString.call(r)),isDate(r)&&(c=" "+Date.prototype.toUTCString.call(r)),isError(r)&&(c=" "+formatError(r)),0===o.length&&(!a||0==r.length))return l[0]+c+l[1];if(t<0)return isRegExp(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special");e.seen.push(r);var f;return f=a?formatArray(e,r,t,s,o):o.map(function(n){return formatProperty(e,r,t,s,n,a)}),e.seen.pop(),reduceToSingleString(f,c,l)}function formatPrimitive(e,r){if(isUndefined(r))return e.stylize("undefined","undefined");if(isString(r)){var t="'"+JSON.stringify(r).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(t,"string")}return isNumber(r)?e.stylize(""+r,"number"):isBoolean(r)?e.stylize(""+r,"boolean"):isNull(r)?e.stylize("null","null"):void 0}function formatError(e){return"["+Error.prototype.toString.call(e)+"]"}function formatArray(e,r,t,n,i){for(var o=[],s=0,u=r.length;s<u;++s)hasOwnProperty(r,String(s))?o.push(formatProperty(e,r,t,n,String(s),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(formatProperty(e,r,t,n,i,!0))}),o}function formatProperty(e,r,t,n,i,o){var s,u,c;if(c=Object.getOwnPropertyDescriptor(r,i)||{value:r[i]},c.get?u=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(u=e.stylize("[Setter]","special")),hasOwnProperty(n,i)||(s="["+i+"]"),u||(e.seen.indexOf(c.value)<0?(u=isNull(t)?formatValue(e,c.value,null):formatValue(e,c.value,t-1),u.indexOf("\n")>-1&&(u=o?u.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+u.split("\n").map(function(e){return" "+e}).join("\n"))):u=e.stylize("[Circular]","special")),isUndefined(s)){if(o&&i.match(/^\d+$/))return u;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+u}function reduceToSingleString(e,r,t){var n=0,i=e.reduce(function(e,r){return n++,r.indexOf("\n")>=0&&n++,e+r.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?t[0]+(""===r?"":r+"\n ")+" "+e.join(",\n ")+" "+t[1]:t[0]+r+" "+e.join(", ")+" "+t[1]}function isArray(e){return Array.isArray(e)}function isBoolean(e){return"boolean"==typeof e}function isNull(e){return null===e}function isNullOrUndefined(e){return null==e}function isNumber(e){return"number"==typeof e}function isString(e){return"string"==typeof e}function isSymbol(e){return"symbol"==typeof e}function isUndefined(e){return void 0===e}function isRegExp(e){return isObject(e)&&"[object RegExp]"===objectToString(e)}function isObject(e){return"object"==typeof e&&null!==e}function isDate(e){return isObject(e)&&"[object Date]"===objectToString(e)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(e){return"function"==typeof e}function isPrimitive(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function objectToString(e){return Object.prototype.toString.call(e)}function pad(e){return e<10?"0"+e.toString(10):e.toString(10)}function timestamp(){var e=new Date,r=[pad(e.getHours()),pad(e.getMinutes()),pad(e.getSeconds())].join(":");return[e.getDate(),months[e.getMonth()],r].join(" ")}function hasOwnProperty(e,r){return Object.prototype.hasOwnProperty.call(e,r)}var formatRegExp=/%[sdj%]/g;exports.format=function(e){if(!isString(e)){for(var r=[],t=0;t<arguments.length;t++)r.push(inspect(arguments[t]));return r.join(" ")}for(var t=1,n=arguments,i=n.length,o=String(e).replace(formatRegExp,function(e){if("%%"===e)return"%";if(t>=i)return e;switch(e){case"%s":return String(n[t++]);case"%d":return Number(n[t++]);case"%j":try{return JSON.stringify(n[t++])}catch(e){return"[Circular]"}default:return e}}),s=n[t];t<i;s=n[++t])o+=isNull(s)||!isObject(s)?" "+s:" "+inspect(s);return o},exports.deprecate=function(e,r){function t(){if(!n){if(process.throwDeprecation)throw new Error(r);process.traceDeprecation?console.trace(r):console.error(r),n=!0}return e.apply(this,arguments)}if(isUndefined(global.process))return function(){return exports.deprecate(e,r).apply(this,arguments)};if(process.noDeprecation===!0)return e;var n=!1;return t};var debugs={},debugEnviron;exports.debuglog=function(e){if(isUndefined(debugEnviron)&&(debugEnviron=process.env.NODE_DEBUG||""),e=e.toUpperCase(),!debugs[e])if(new RegExp("\\b"+e+"\\b","i").test(debugEnviron)){var r=process.pid;debugs[e]=function(){var t=exports.format.apply(exports,arguments);console.error("%s %d: %s",e,r,t)}}else debugs[e]=function(){};return debugs[e]},exports.inspect=inspect,inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},exports.isArray=isArray,exports.isBoolean=isBoolean,exports.isNull=isNull,exports.isNullOrUndefined=isNullOrUndefined,exports.isNumber=isNumber,exports.isString=isString,exports.isSymbol=isSymbol,exports.isUndefined=isUndefined,exports.isRegExp=isRegExp,exports.isObject=isObject,exports.isDate=isDate,exports.isError=isError,exports.isFunction=isFunction,exports.isPrimitive=isPrimitive,exports.isBuffer=_dereq_("./support/isBuffer");var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))},exports.inherits=_dereq_("inherits"),exports._extend=function(e,r){if(!r||!isObject(r))return e;for(var t=Object.keys(r),n=t.length;n--;)e[t[n]]=r[t[n]];return e}; | |
}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | |
},{"./support/isBuffer":32,"_process":27,"inherits":31}],34:[function(_dereq_,module,exports){ | |
module.exports.VectorTile=_dereq_("./lib/vectortile.js"),module.exports.VectorTileFeature=_dereq_("./lib/vectortilefeature.js"),module.exports.VectorTileLayer=_dereq_("./lib/vectortilelayer.js"); | |
},{"./lib/vectortile.js":35,"./lib/vectortilefeature.js":36,"./lib/vectortilelayer.js":37}],35:[function(_dereq_,module,exports){ | |
"use strict";function VectorTile(e,r){this.layers=e.readFields(readTile,{},r)}function readTile(e,r,i){if(3===e){var t=new VectorTileLayer(i,i.readVarint()+i.pos);t.length&&(r[t.name]=t)}}var VectorTileLayer=_dereq_("./vectortilelayer");module.exports=VectorTile; | |
},{"./vectortilelayer":37}],36:[function(_dereq_,module,exports){ | |
"use strict";function VectorTileFeature(e,t,r,i,a){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=a,e.readFields(readFeature,this,t)}function readFeature(e,t,r){1==e?t.id=r.readVarint():2==e?readTag(r,t):3==e?t.type=r.readVarint():4==e&&(t._geometry=r.pos)}function readTag(e,t){for(var r=e.readVarint()+e.pos;e.pos<r;){var i=t._keys[e.readVarint()],a=t._values[e.readVarint()];t.properties[i]=a}}function classifyRings(e){var t=e.length;if(t<=1)return[e];for(var r,i,a=[],o=0;o<t;o++){var n=signedArea(e[o]);0!==n&&(void 0===i&&(i=n<0),i===n<0?(r&&a.push(r),r=[e[o]]):r.push(e[o]))}return r&&a.push(r),a}function signedArea(e){for(var t,r,i=0,a=0,o=e.length,n=o-1;a<o;n=a++)t=e[a],r=e[n],i+=(r.x-t.x)*(t.y+r.y);return i}var Point=_dereq_("point-geometry");module.exports=VectorTileFeature,VectorTileFeature.types=["Unknown","Point","LineString","Polygon"],VectorTileFeature.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t,r=e.readVarint()+e.pos,i=1,a=0,o=0,n=0,s=[];e.pos<r;){if(!a){var p=e.readVarint();i=7&p,a=p>>3}if(a--,1===i||2===i)o+=e.readSVarint(),n+=e.readSVarint(),1===i&&(t&&s.push(t),t=[]),t.push(new Point(o,n));else{if(7!==i)throw new Error("unknown command "+i);t&&t.push(t[0].clone())}}return t&&s.push(t),s},VectorTileFeature.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,i=0,a=0,o=0,n=1/0,s=-(1/0),p=1/0,h=-(1/0);e.pos<t;){if(!i){var u=e.readVarint();r=7&u,i=u>>3}if(i--,1===r||2===r)a+=e.readSVarint(),o+=e.readSVarint(),a<n&&(n=a),a>s&&(s=a),o<p&&(p=o),o>h&&(h=o);else if(7!==r)throw new Error("unknown command "+r)}return[n,p,s,h]},VectorTileFeature.prototype.toGeoJSON=function(e,t,r){function i(e){for(var t=0;t<e.length;t++){var r=e[t],i=180-360*(r.y+p)/n;e[t]=[360*(r.x+s)/n-180,360/Math.PI*Math.atan(Math.exp(i*Math.PI/180))-90]}}var a,o,n=this.extent*Math.pow(2,r),s=this.extent*e,p=this.extent*t,h=this.loadGeometry(),u=VectorTileFeature.types[this.type];switch(this.type){case 1:var d=[];for(a=0;a<h.length;a++)d[a]=h[a][0];h=d,i(h);break;case 2:for(a=0;a<h.length;a++)i(h[a]);break;case 3:for(h=classifyRings(h),a=0;a<h.length;a++)for(o=0;o<h[a].length;o++)i(h[a][o])}1===h.length?h=h[0]:u="Multi"+u;var f={type:"Feature",geometry:{type:u,coordinates:h},properties:this.properties};return"id"in this&&(f.id=this.id),f}; | |
},{"point-geometry":26}],37:[function(_dereq_,module,exports){ | |
"use strict";function VectorTileLayer(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(readLayer,this,t),this.length=this._features.length}function readLayer(e,t,r){15===e?t.version=r.readVarint():1===e?t.name=r.readString():5===e?t.extent=r.readVarint():2===e?t._features.push(r.pos):3===e?t._keys.push(r.readString()):4===e&&t._values.push(readValueMessage(r))}function readValueMessage(e){for(var t=null,r=e.readVarint()+e.pos;e.pos<r;){var a=e.readVarint()>>3;t=1===a?e.readString():2===a?e.readFloat():3===a?e.readDouble():4===a?e.readVarint64():5===a?e.readVarint():6===a?e.readSVarint():7===a?e.readBoolean():null}return t}var VectorTileFeature=_dereq_("./vectortilefeature.js");module.exports=VectorTileLayer,VectorTileLayer.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new VectorTileFeature(this._pbf,t,this.extent,this._keys,this._values)}; | |
},{"./vectortilefeature.js":36}],38:[function(_dereq_,module,exports){ | |
function fromVectorTileJs(e){var r=[];for(var o in e.layers)r.push(prepareLayer(e.layers[o]));var t=new Pbf;return vtpb.tile.write({layers:r},t),t.finish()}function fromGeojsonVt(e){var r={};for(var o in e)r[o]=new GeoJSONWrapper(e[o].features),r[o].name=o;return fromVectorTileJs({layers:r})}function prepareLayer(e){for(var r={name:e.name||"",version:e.version||1,extent:e.extent||4096,keys:[],values:[],features:[]},o={},t={},n=0;n<e.length;n++){var a=e.feature(n);a.geometry=encodeGeometry(a.loadGeometry());var u=[];for(var s in a.properties){var i=o[s];"undefined"==typeof i&&(r.keys.push(s),i=r.keys.length-1,o[s]=i);var p=wrapValue(a.properties[s]),l=t[p.key];"undefined"==typeof l&&(r.values.push(p),l=r.values.length-1,t[p.key]=l),u.push(i),u.push(l)}a.tags=u,r.features.push(a)}return r}function command(e,r){return(r<<3)+(7&e)}function zigzag(e){return e<<1^e>>31}function encodeGeometry(e){for(var r=[],o=0,t=0,n=e.length,a=0;a<n;a++){var u=e[a];r.push(command(1,1));for(var s=0;s<u.length;s++){1===s&&r.push(command(2,u.length-1));var i=u[s].x-o,p=u[s].y-t;r.push(zigzag(i),zigzag(p)),o+=i,t+=p}}return r}function wrapValue(e){var r,o=typeof e;return"string"===o?r={string_value:e}:"boolean"===o?r={bool_value:e}:"number"===o?r=e%1!==0?{double_value:e}:e<0?{sint_value:e}:{uint_value:e}:(e=JSON.stringify(e),r={string_value:e}),r.key=o+":"+e,r}var Pbf=_dereq_("pbf"),vtpb=_dereq_("./vector-tile-pb"),GeoJSONWrapper=_dereq_("./lib/geojson_wrapper");module.exports=fromVectorTileJs,module.exports.fromVectorTileJs=fromVectorTileJs,module.exports.fromGeojsonVt=fromGeojsonVt,module.exports.GeoJSONWrapper=GeoJSONWrapper; | |
},{"./lib/geojson_wrapper":39,"./vector-tile-pb":40,"pbf":25}],39:[function(_dereq_,module,exports){ | |
"use strict";function GeoJSONWrapper(e){this.features=e,this.length=e.length}function FeatureWrapper(e){this.id="number"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=4096}var Point=_dereq_("point-geometry"),VectorTileFeature=_dereq_("vector-tile").VectorTileFeature;module.exports=GeoJSONWrapper,GeoJSONWrapper.prototype.feature=function(e){return new FeatureWrapper(this.features[e])},FeatureWrapper.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t<e.length;t++){for(var r=e[t],o=[],a=0;a<r.length;a++)o.push(new Point(r[a][0],r[a][1]));this.geometry.push(o)}return this.geometry},FeatureWrapper.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,r=-(1/0),o=1/0,a=-(1/0),i=0;i<e.length;i++)for(var p=e[i],n=0;n<p.length;n++){var h=p[n];t=Math.min(t,h.x),r=Math.max(r,h.x),o=Math.min(o,h.y),a=Math.max(a,h.y)}return[t,o,r,a]},FeatureWrapper.prototype.toGeoJSON=VectorTileFeature.prototype.toGeoJSON; | |
},{"point-geometry":26,"vector-tile":34}],40:[function(_dereq_,module,exports){ | |
"use strict";function readTile(e,r){return e.readFields(readTileField,{layers:[]},r)}function readTileField(e,r,i){3===e&&r.layers.push(readLayer(i,i.readVarint()+i.pos))}function writeTile(e,r){var i;if(void 0!==e.layers)for(i=0;i<e.layers.length;i++)r.writeMessage(3,writeLayer,e.layers[i])}function readValue(e,r){return e.readFields(readValueField,{},r)}function readValueField(e,r,i){1===e?r.string_value=i.readString():2===e?r.float_value=i.readFloat():3===e?r.double_value=i.readDouble():4===e?r.int_value=i.readVarint():5===e?r.uint_value=i.readVarint():6===e?r.sint_value=i.readSVarint():7===e&&(r.bool_value=i.readBoolean())}function writeValue(e,r){void 0!==e.string_value&&r.writeStringField(1,e.string_value),void 0!==e.float_value&&r.writeFloatField(2,e.float_value),void 0!==e.double_value&&r.writeDoubleField(3,e.double_value),void 0!==e.int_value&&r.writeVarintField(4,e.int_value),void 0!==e.uint_value&&r.writeVarintField(5,e.uint_value),void 0!==e.sint_value&&r.writeSVarintField(6,e.sint_value),void 0!==e.bool_value&&r.writeBooleanField(7,e.bool_value)}function readFeature(e,r){var i=e.readFields(readFeatureField,{},r);return void 0===i.type&&(i.type="Unknown"),i}function readFeatureField(e,r,i){1===e?r.id=i.readVarint():2===e?r.tags=i.readPackedVarint():3===e?r.type=i.readVarint():4===e&&(r.geometry=i.readPackedVarint())}function writeFeature(e,r){void 0!==e.id&&r.writeVarintField(1,e.id),void 0!==e.tags&&r.writePackedVarint(2,e.tags),void 0!==e.type&&r.writeVarintField(3,e.type),void 0!==e.geometry&&r.writePackedVarint(4,e.geometry)}function readLayer(e,r){return e.readFields(readLayerField,{features:[],keys:[],values:[]},r)}function readLayerField(e,r,i){15===e?r.version=i.readVarint():1===e?r.name=i.readString():2===e?r.features.push(readFeature(i,i.readVarint()+i.pos)):3===e?r.keys.push(i.readString()):4===e?r.values.push(readValue(i,i.readVarint()+i.pos)):5===e&&(r.extent=i.readVarint())}function writeLayer(e,r){void 0!==e.version&&r.writeVarintField(15,e.version),void 0!==e.name&&r.writeStringField(1,e.name);var i;if(void 0!==e.features)for(i=0;i<e.features.length;i++)r.writeMessage(2,writeFeature,e.features[i]);if(void 0!==e.keys)for(i=0;i<e.keys.length;i++)r.writeStringField(3,e.keys[i]);if(void 0!==e.values)for(i=0;i<e.values.length;i++)r.writeMessage(4,writeValue,e.values[i]);void 0!==e.extent&&r.writeVarintField(5,e.extent)}var tile=exports.tile={read:readTile,write:writeTile};tile.GeomType={Unknown:0,Point:1,LineString:2,Polygon:3},tile.value={read:readValue,write:writeValue},tile.feature={read:readFeature,write:writeFeature},tile.layer={read:readLayer,write:writeLayer}; | |
},{}],41:[function(_dereq_,module,exports){ | |
var bundleFn=arguments[3],sources=arguments[4],cache=arguments[5],stringify=JSON.stringify;module.exports=function(r,e){function t(r){d[r]=!0;for(var e in sources[r][1]){var n=sources[r][1][e];d[n]||t(n)}}for(var n,o=Object.keys(cache),a=0,i=o.length;a<i;a++){var s=o[a],u=cache[s].exports;if(u===r||u&&u.default===r){n=s;break}}if(!n){n=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var f={},a=0,i=o.length;a<i;a++){var s=o[a];f[s]=s}sources[n]=[Function(["require","module","exports"],"("+r+")(self)"),f]}var c=Math.floor(Math.pow(16,8)*Math.random()).toString(16),l={};l[n]=n,sources[c]=[Function(["require"],"var f = require("+stringify(n)+");(f.default ? f.default : f)(self);"),l];var d={};t(c);var g="("+bundleFn+")({"+Object.keys(d).map(function(r){return stringify(r)+":["+sources[r][0]+","+stringify(sources[r][1])+"]"}).join(",")+"},{},["+stringify(c)+"])",v=window.URL||window.webkitURL||window.mozURL||window.msURL,w=new Blob([g],{type:"text/javascript"});if(e&&e.bare)return w;var h=v.createObjectURL(w),b=new Worker(h);return b.objectURL=h,b}; | |
},{}],42:[function(_dereq_,module,exports){ | |
module.exports.RADIUS=6378137,module.exports.FLATTENING=1/298.257223563,module.exports.POLAR_RADIUS=6356752.3142; | |
},{}],43:[function(_dereq_,module,exports){ | |
module.exports={"version":"0.37.0"} | |
},{}],44:[function(_dereq_,module,exports){ | |
"use strict";function serializePaintVertexArrays(r,e){var t={};for(var a in r){var i=r[a].paintVertexArray;if(0!==i.length){var n=i.serialize(e),s=i.constructor.serialize();t[a]={array:n,type:s}}}return t}var ProgramConfiguration=_dereq_("./program_configuration"),createVertexArrayType=_dereq_("./vertex_array_type"),Segment=function(r,e){this.vertexOffset=r,this.primitiveOffset=e,this.vertexLength=0,this.primitiveLength=0},ArrayGroup=function(r,e,t){var a=this;this.globalProperties={zoom:t};var i=createVertexArrayType(r.layoutAttributes);this.layoutVertexArray=new i;var n=r.elementArrayType;n&&(this.elementArray=new n);var s=r.elementArrayType2;s&&(this.elementArray2=new s),this.layerData={};for(var y=0,o=e;y<o.length;y+=1){var p=o[y],l=ProgramConfiguration.createDynamic(r.paintAttributes||[],p,t);a.layerData[p.id]={layer:p,programConfiguration:l,paintVertexArray:new l.PaintVertexArray,paintPropertyStatistics:l.createPaintPropertyStatistics()}}this.segments=[],this.segments2=[]};ArrayGroup.prototype.prepareSegment=function(r){var e=this.segments[this.segments.length-1];return(!e||e.vertexLength+r>ArrayGroup.MAX_VERTEX_ARRAY_LENGTH)&&(e=new Segment(this.layoutVertexArray.length,this.elementArray.length),this.segments.push(e)),e},ArrayGroup.prototype.prepareSegment2=function(r){var e=this.segments2[this.segments2.length-1];return(!e||e.vertexLength+r>ArrayGroup.MAX_VERTEX_ARRAY_LENGTH)&&(e=new Segment(this.layoutVertexArray.length,this.elementArray2.length),this.segments2.push(e)),e},ArrayGroup.prototype.populatePaintArrays=function(r){var e=this;for(var t in e.layerData){var a=e.layerData[t];0!==a.paintVertexArray.bytesPerElement&&a.programConfiguration.populatePaintArray(a.layer,a.paintVertexArray,a.paintPropertyStatistics,e.layoutVertexArray.length,e.globalProperties,r)}},ArrayGroup.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},ArrayGroup.prototype.serialize=function(r){return{layoutVertexArray:this.layoutVertexArray.serialize(r),elementArray:this.elementArray&&this.elementArray.serialize(r),elementArray2:this.elementArray2&&this.elementArray2.serialize(r),paintVertexArrays:serializePaintVertexArrays(this.layerData,r),segments:this.segments,segments2:this.segments2}},ArrayGroup.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,module.exports=ArrayGroup; | |
},{"./program_configuration":58,"./vertex_array_type":60}],45:[function(_dereq_,module,exports){ | |
"use strict";var ArrayGroup=_dereq_("./array_group"),BufferGroup=_dereq_("./buffer_group"),util=_dereq_("../util/util"),Bucket=function(r,t){this.zoom=r.zoom,this.overscaling=r.overscaling,this.layers=r.layers,this.index=r.index,r.arrays?this.buffers=new BufferGroup(t,r.layers,r.zoom,r.arrays):this.arrays=new ArrayGroup(t,r.layers,r.zoom)};Bucket.prototype.populate=function(r,t){for(var e=this,i=0,a=r;i<a.length;i+=1){var u=a[i];e.layers[0].filter(u)&&(e.addFeature(u),t.featureIndex.insert(u,e.index))}},Bucket.prototype.getPaintPropertyStatistics=function(){return util.mapObject(this.arrays.layerData,function(r){return r.paintPropertyStatistics})},Bucket.prototype.isEmpty=function(){return this.arrays.isEmpty()},Bucket.prototype.serialize=function(r){return{zoom:this.zoom,layerIds:this.layers.map(function(r){return r.id}),arrays:this.arrays.serialize(r)}},Bucket.prototype.destroy=function(){this.buffers&&(this.buffers.destroy(),this.buffers=null)},module.exports=Bucket,Bucket.deserialize=function(r,t){if(t){for(var e={},i=0,a=r;i<a.length;i+=1){var u=a[i],o=u.layerIds.map(function(r){return t.getLayer(r)}).filter(Boolean);if(0!==o.length)for(var s=o[0].createBucket(util.extend({layers:o},u)),n=0,f=o;n<f.length;n+=1){var y=f[n];e[y.id]=s}}return e}}; | |
},{"../util/util":215,"./array_group":44,"./buffer_group":52}],46:[function(_dereq_,module,exports){ | |
"use strict";function addCircleVertex(e,r,t,c,i){e.emplaceBack(2*r+(c+1)/2,2*t+(i+1)/2)}var Bucket=_dereq_("../bucket"),createElementArrayType=_dereq_("../element_array_type"),loadGeometry=_dereq_("../load_geometry"),EXTENT=_dereq_("../extent"),circleInterface={layoutAttributes:[{name:"a_pos",components:2,type:"Int16"}],elementArrayType:createElementArrayType(),paintAttributes:[{property:"circle-color",type:"Uint8"},{property:"circle-radius",type:"Uint16",multiplier:10},{property:"circle-blur",type:"Uint16",multiplier:10},{property:"circle-opacity",type:"Uint8",multiplier:255},{property:"circle-stroke-color",type:"Uint8"},{property:"circle-stroke-width",type:"Uint16",multiplier:10},{property:"circle-stroke-opacity",type:"Uint8",multiplier:255}]},CircleBucket=function(e){function r(r){e.call(this,r,circleInterface)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.addFeature=function(e){for(var r=this.arrays,t=0,c=loadGeometry(e);t<c.length;t+=1)for(var i=c[t],a=0,p=i;a<p.length;a+=1){var l=p[a],o=l.x,y=l.y;if(!(o<0||o>=EXTENT||y<0||y>=EXTENT)){var n=r.prepareSegment(4),u=n.vertexLength;addCircleVertex(r.layoutVertexArray,o,y,-1,-1),addCircleVertex(r.layoutVertexArray,o,y,1,-1),addCircleVertex(r.layoutVertexArray,o,y,1,1),addCircleVertex(r.layoutVertexArray,o,y,-1,1),r.elementArray.emplaceBack(u,u+1,u+2),r.elementArray.emplaceBack(u,u+3,u+2),n.vertexLength+=4,n.primitiveLength+=2}}r.populatePaintArrays(e.properties)},r}(Bucket);CircleBucket.programInterface=circleInterface,module.exports=CircleBucket; | |
},{"../bucket":45,"../element_array_type":53,"../extent":54,"../load_geometry":56}],47:[function(_dereq_,module,exports){ | |
"use strict";var Bucket=_dereq_("../bucket"),createElementArrayType=_dereq_("../element_array_type"),loadGeometry=_dereq_("../load_geometry"),earcut=_dereq_("earcut"),classifyRings=_dereq_("../../util/classify_rings"),EARCUT_MAX_RINGS=500,fillInterface={layoutAttributes:[{name:"a_pos",components:2,type:"Int16"}],elementArrayType:createElementArrayType(3),elementArrayType2:createElementArrayType(2),paintAttributes:[{property:"fill-color",type:"Uint8"},{property:"fill-outline-color",type:"Uint8"},{property:"fill-opacity",type:"Uint8",multiplier:255}]},FillBucket=function(e){function t(t){e.call(this,t,fillInterface)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.addFeature=function(e){for(var t=this.arrays,r=0,a=classifyRings(loadGeometry(e),EARCUT_MAX_RINGS);r<a.length;r+=1){for(var l=a[r],n=0,p=0,i=l;p<i.length;p+=1){var o=i[p];n+=o.length}for(var y=t.prepareSegment(n),c=y.vertexLength,u=[],s=[],g=0,h=l;g<h.length;g+=1){var m=h[g];if(0!==m.length){m!==l[0]&&s.push(u.length/2);var f=t.prepareSegment2(m.length),A=f.vertexLength;t.layoutVertexArray.emplaceBack(m[0].x,m[0].y),t.elementArray2.emplaceBack(A+m.length-1,A),u.push(m[0].x),u.push(m[0].y);for(var v=1;v<m.length;v++)t.layoutVertexArray.emplaceBack(m[v].x,m[v].y),t.elementArray2.emplaceBack(A+v-1,A+v),u.push(m[v].x),u.push(m[v].y);f.vertexLength+=m.length,f.primitiveLength+=m.length}}for(var _=earcut(u,s),k=0;k<_.length;k+=3)t.elementArray.emplaceBack(c+_[k],c+_[k+1],c+_[k+2]);y.vertexLength+=n,y.primitiveLength+=_.length/3}t.populatePaintArrays(e.properties)},t}(Bucket);FillBucket.programInterface=fillInterface,module.exports=FillBucket; | |
},{"../../util/classify_rings":198,"../bucket":45,"../element_array_type":53,"../load_geometry":56,"earcut":5}],48:[function(_dereq_,module,exports){ | |
"use strict";function addVertex(e,t,r,a,n,o,i,y){e.emplaceBack(t,r,2*Math.floor(a*FACTOR)+i,n*FACTOR*2,o*FACTOR*2,Math.round(y))}function isBoundaryEdge(e,t){return e.x===t.x&&(e.x<0||e.x>EXTENT)||e.y===t.y&&(e.y<0||e.y>EXTENT)}var Bucket=_dereq_("../bucket"),createElementArrayType=_dereq_("../element_array_type"),loadGeometry=_dereq_("../load_geometry"),EXTENT=_dereq_("../extent"),earcut=_dereq_("earcut"),classifyRings=_dereq_("../../util/classify_rings"),EARCUT_MAX_RINGS=500,fillExtrusionInterface={layoutAttributes:[{name:"a_pos",components:2,type:"Int16"},{name:"a_normal",components:3,type:"Int16"},{name:"a_edgedistance",components:1,type:"Int16"}],elementArrayType:createElementArrayType(3),paintAttributes:[{property:"fill-extrusion-base",type:"Uint16"},{property:"fill-extrusion-height",type:"Uint16"},{property:"fill-extrusion-color",type:"Uint8"}]},FACTOR=Math.pow(2,13),FillExtrusionBucket=function(e){function t(t){e.call(this,t,fillExtrusionInterface)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.addFeature=function(e){for(var t=this.arrays,r=0,a=classifyRings(loadGeometry(e),EARCUT_MAX_RINGS);r<a.length;r+=1){for(var n=a[r],o=0,i=0,y=n;i<y.length;i+=1){var l=y[i];o+=l.length}for(var u=t.prepareSegment(5*o),p=[],s=[],c=[],x=0,f=n;x<f.length;x+=1){var d=f[x];if(0!==d.length){d!==n[0]&&s.push(p.length/2);for(var m=0,h=0;h<d.length;h++){var g=d[h];if(addVertex(t.layoutVertexArray,g.x,g.y,0,0,1,1,0),c.push(u.vertexLength++),h>=1){var A=d[h-1];if(!isBoundaryEdge(g,A)){var E=g.sub(A)._perp()._unit();addVertex(t.layoutVertexArray,g.x,g.y,E.x,E.y,0,0,m),addVertex(t.layoutVertexArray,g.x,g.y,E.x,E.y,0,1,m),m+=A.dist(g),addVertex(t.layoutVertexArray,A.x,A.y,E.x,E.y,0,0,m),addVertex(t.layoutVertexArray,A.x,A.y,E.x,E.y,0,1,m);var v=u.vertexLength;t.elementArray.emplaceBack(v,v+1,v+2),t.elementArray.emplaceBack(v+1,v+2,v+3),u.vertexLength+=4,u.primitiveLength+=2}}p.push(g.x),p.push(g.y)}}}for(var _=earcut(p,s),T=0;T<_.length;T+=3)t.elementArray.emplaceBack(c[_[T]],c[_[T+1]],c[_[T+2]]);u.primitiveLength+=_.length/3}t.populatePaintArrays(e.properties)},t}(Bucket);FillExtrusionBucket.programInterface=fillExtrusionInterface,module.exports=FillExtrusionBucket; | |
},{"../../util/classify_rings":198,"../bucket":45,"../element_array_type":53,"../extent":54,"../load_geometry":56,"earcut":5}],49:[function(_dereq_,module,exports){ | |
"use strict";function addLineVertex(e,t,r,i,a,n,d){e.emplaceBack(t.x<<1|i,t.y<<1|a,Math.round(EXTRUDE_SCALE*r.x)+128,Math.round(EXTRUDE_SCALE*r.y)+128,(0===n?0:n<0?-1:1)+1|(d*LINE_DISTANCE_SCALE&63)<<2,d*LINE_DISTANCE_SCALE>>6)}var Bucket=_dereq_("../bucket"),createElementArrayType=_dereq_("../element_array_type"),loadGeometry=_dereq_("../load_geometry"),EXTENT=_dereq_("../extent"),VectorTileFeature=_dereq_("vector-tile").VectorTileFeature,EXTRUDE_SCALE=63,COS_HALF_SHARP_CORNER=Math.cos(37.5*(Math.PI/180)),SHARP_CORNER_OFFSET=15,LINE_DISTANCE_BUFFER_BITS=15,LINE_DISTANCE_SCALE=.5,MAX_LINE_DISTANCE=Math.pow(2,LINE_DISTANCE_BUFFER_BITS-1)/LINE_DISTANCE_SCALE,lineInterface={layoutAttributes:[{name:"a_pos",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],paintAttributes:[{property:"line-color",type:"Uint8"},{property:"line-blur",multiplier:10,type:"Uint8"},{property:"line-opacity",multiplier:10,type:"Uint8"},{property:"line-gap-width",multiplier:10,type:"Uint8",name:"a_gapwidth"},{property:"line-offset",multiplier:1,type:"Int8"}],elementArrayType:createElementArrayType()},LineBucket=function(e){function t(t){e.call(this,t,lineInterface)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.addFeature=function(e){for(var t=this,r=this.layers[0].layout,i=r["line-join"],a=r["line-cap"],n=r["line-miter-limit"],d=r["line-round-limit"],s=0,u=loadGeometry(e,LINE_DISTANCE_BUFFER_BITS);s<u.length;s+=1){var l=u[s];t.addLine(l,e,i,a,n,d)}},t.prototype.addLine=function(e,t,r,i,a,n){for(var d=this,s=t.properties,u="Polygon"===VectorTileFeature.types[t.type],l=e.length;l>=2&&e[l-1].equals(e[l-2]);)l--;for(var o=0;o<l-1&&e[o].equals(e[o+1]);)o++;if(!(l<(u?3:2))){"bevel"===r&&(a=1.05);var p=SHARP_CORNER_OFFSET*(EXTENT/(512*this.overscaling)),c=e[o],_=this.arrays,h=_.prepareSegment(10*l);this.distance=0;var y,m,E,x,C,v,f,A=i,L=u?"butt":i,S=!0;this.e1=this.e2=this.e3=-1,u&&(y=e[l-2],C=c.sub(y)._unit()._perp());for(var V=o;V<l;V++)if(E=u&&V===l-1?e[o+1]:e[V+1],!E||!e[V].equals(E)){C&&(x=C),y&&(m=y),y=e[V],C=E?E.sub(y)._unit()._perp():x,x=x||C;var I=x.add(C);0===I.x&&0===I.y||I._unit();var T=I.x*C.x+I.y*C.y,N=0!==T?1/T:1/0,b=T<COS_HALF_SHARP_CORNER&&m&&E;if(b&&V>o){var R=y.dist(m);if(R>2*p){var g=y.sub(y.sub(m)._mult(p/R)._round());d.distance+=g.dist(m),d.addCurrentVertex(g,d.distance,x.mult(1),0,0,!1,h),m=g}}var F=m&&E,B=F?r:E?A:L;if(F&&"round"===B&&(N<n?B="miter":N<=2&&(B="fakeround")),"miter"===B&&N>a&&(B="bevel"),"bevel"===B&&(N>2&&(B="flipbevel"),N<a&&(B="miter")),m&&(d.distance+=y.dist(m)),"miter"===B)I._mult(N),d.addCurrentVertex(y,d.distance,I,0,0,!1,h);else if("flipbevel"===B){if(N>100)I=C.clone().mult(-1);else{var k=x.x*C.y-x.y*C.x>0?-1:1,D=N*x.add(C).mag()/x.sub(C).mag();I._perp()._mult(D*k)}d.addCurrentVertex(y,d.distance,I,0,0,!1,h),d.addCurrentVertex(y,d.distance,I.mult(-1),0,0,!1,h)}else if("bevel"===B||"fakeround"===B){var P=x.x*C.y-x.y*C.x>0,U=-Math.sqrt(N*N-1);if(P?(f=0,v=U):(v=0,f=U),S||d.addCurrentVertex(y,d.distance,x,v,f,!1,h),"fakeround"===B){for(var q=Math.floor(8*(.5-(T-.5))),M=void 0,O=0;O<q;O++)M=C.mult((O+1)/(q+1))._add(x)._unit(),d.addPieSliceVertex(y,d.distance,M,P,h);d.addPieSliceVertex(y,d.distance,I,P,h);for(var X=q-1;X>=0;X--)M=x.mult((X+1)/(q+1))._add(C)._unit(),d.addPieSliceVertex(y,d.distance,M,P,h)}E&&d.addCurrentVertex(y,d.distance,C,-v,-f,!1,h)}else"butt"===B?(S||d.addCurrentVertex(y,d.distance,x,0,0,!1,h),E&&d.addCurrentVertex(y,d.distance,C,0,0,!1,h)):"square"===B?(S||(d.addCurrentVertex(y,d.distance,x,1,1,!1,h),d.e1=d.e2=-1),E&&d.addCurrentVertex(y,d.distance,C,-1,-1,!1,h)):"round"===B&&(S||(d.addCurrentVertex(y,d.distance,x,0,0,!1,h),d.addCurrentVertex(y,d.distance,x,1,1,!0,h),d.e1=d.e2=-1),E&&(d.addCurrentVertex(y,d.distance,C,-1,-1,!0,h),d.addCurrentVertex(y,d.distance,C,0,0,!1,h)));if(b&&V<l-1){var H=y.dist(E);if(H>2*p){var w=y.add(E.sub(y)._mult(p/H)._round());d.distance+=w.dist(y),d.addCurrentVertex(w,d.distance,C.mult(1),0,0,!1,h),y=w}}S=!1}_.populatePaintArrays(s)}},t.prototype.addCurrentVertex=function(e,t,r,i,a,n,d){var s,u=n?1:0,l=this.arrays,o=l.layoutVertexArray,p=l.elementArray;s=r.clone(),i&&s._sub(r.perp()._mult(i)),addLineVertex(o,e,s,u,0,i,t),this.e3=d.vertexLength++,this.e1>=0&&this.e2>=0&&(p.emplaceBack(this.e1,this.e2,this.e3),d.primitiveLength++),this.e1=this.e2,this.e2=this.e3,s=r.mult(-1),a&&s._sub(r.perp()._mult(a)),addLineVertex(o,e,s,u,1,-a,t),this.e3=d.vertexLength++,this.e1>=0&&this.e2>=0&&(p.emplaceBack(this.e1,this.e2,this.e3),d.primitiveLength++),this.e1=this.e2,this.e2=this.e3,t>MAX_LINE_DISTANCE/2&&(this.distance=0,this.addCurrentVertex(e,this.distance,r,i,a,n,d))},t.prototype.addPieSliceVertex=function(e,t,r,i,a){var n=i?1:0;r=r.mult(i?-1:1);var d=this.arrays,s=d.layoutVertexArray,u=d.elementArray;addLineVertex(s,e,r,0,n,0,t),this.e3=a.vertexLength++,this.e1>=0&&this.e2>=0&&(u.emplaceBack(this.e1,this.e2,this.e3),a.primitiveLength++),i?this.e2=this.e3:this.e1=this.e3},t}(Bucket);LineBucket.programInterface=lineInterface,module.exports=LineBucket; | |
},{"../bucket":45,"../element_array_type":53,"../extent":54,"../load_geometry":56,"vector-tile":34}],50:[function(_dereq_,module,exports){ | |
"use strict";function addVertex(e,t,o,a,i,r,n,s,l,c,u,y){e.emplaceBack(t,o,Math.round(64*a),Math.round(64*i),r/4,n/4,packUint8ToFloat(10*(u||0),y%256),packUint8ToFloat(10*(l||0),10*Math.min(c||25,25)),s?s[0]:void 0,s?s[1]:void 0,s?s[2]:void 0)}function addCollisionBoxVertex(e,t,o,a,i){return e.emplaceBack(t.x,t.y,Math.round(o.x),Math.round(o.y),10*a,10*i)}function getSizeData(e,t,o){var a={isFeatureConstant:t.isLayoutValueFeatureConstant(o),isZoomConstant:t.isLayoutValueZoomConstant(o)};if(a.isFeatureConstant&&(a.layoutSize=t.getLayoutValue(o,{zoom:e+1})),!a.isZoomConstant){for(var i=t.getLayoutValueStopZoomLevels(o),r=0;r<i.length&&i[r]<=e;)r++;r=Math.max(0,r-1);for(var n=r;n<i.length&&i[n]<e+1;)n++;n=Math.min(i.length-1,n),a.coveringZoomRange=[i[r],i[n]],t.isLayoutValueFeatureConstant(o)&&(a.coveringStopValues=[t.getLayoutValue(o,{zoom:i[r]}),t.getLayoutValue(o,{zoom:i[n]})]),a.functionBase=t.getLayoutProperty(o).base,"undefined"==typeof a.functionBase&&(a.functionBase=1),a.functionType=t.getLayoutProperty(o).type||"exponential"}return a}function getSizeAttributeDeclarations(e,t){return e.isLayoutValueZoomConstant(t)&&!e.isLayoutValueFeatureConstant(t)?[{name:"a_size",components:1,type:"Uint16"}]:e.isLayoutValueZoomConstant(t)||e.isLayoutValueFeatureConstant(t)?[]:[{name:"a_size",components:3,type:"Uint16"}]}function getSizeVertexData(e,t,o,a,i){return e.isLayoutValueZoomConstant(a)&&!e.isLayoutValueFeatureConstant(a)?[10*e.getLayoutValue(a,{},i)]:e.isLayoutValueZoomConstant(a)||e.isLayoutValueFeatureConstant(a)?null:[10*e.getLayoutValue(a,{zoom:o[0]},i),10*e.getLayoutValue(a,{zoom:o[1]},i),10*e.getLayoutValue(a,{zoom:1+t},i)]}var Point=_dereq_("point-geometry"),ArrayGroup=_dereq_("../array_group"),BufferGroup=_dereq_("../buffer_group"),createElementArrayType=_dereq_("../element_array_type"),EXTENT=_dereq_("../extent"),packUint8ToFloat=_dereq_("../../shaders/encode_attribute").packUint8ToFloat,Anchor=_dereq_("../../symbol/anchor"),getAnchors=_dereq_("../../symbol/get_anchors"),resolveTokens=_dereq_("../../util/token"),Quads=_dereq_("../../symbol/quads"),Shaping=_dereq_("../../symbol/shaping"),transformText=_dereq_("../../symbol/transform_text"),mergeLines=_dereq_("../../symbol/mergelines"),clipLine=_dereq_("../../symbol/clip_line"),util=_dereq_("../../util/util"),scriptDetection=_dereq_("../../util/script_detection"),loadGeometry=_dereq_("../load_geometry"),CollisionFeature=_dereq_("../../symbol/collision_feature"),findPoleOfInaccessibility=_dereq_("../../util/find_pole_of_inaccessibility"),classifyRings=_dereq_("../../util/classify_rings"),VectorTileFeature=_dereq_("vector-tile").VectorTileFeature,shapeText=Shaping.shapeText,shapeIcon=Shaping.shapeIcon,WritingMode=Shaping.WritingMode,getGlyphQuads=Quads.getGlyphQuads,getIconQuads=Quads.getIconQuads,elementArrayType=createElementArrayType(),layoutAttributes=[{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"}],symbolInterfaces={glyph:{layoutAttributes:layoutAttributes,elementArrayType:elementArrayType,paintAttributes:[{name:"a_fill_color",property:"text-color",type:"Uint8"},{name:"a_halo_color",property:"text-halo-color",type:"Uint8"},{name:"a_halo_width",property:"text-halo-width",type:"Uint16",multiplier:10},{name:"a_halo_blur",property:"text-halo-blur",type:"Uint16",multiplier:10},{name:"a_opacity",property:"text-opacity",type:"Uint8",multiplier:255}]},icon:{layoutAttributes:layoutAttributes,elementArrayType:elementArrayType,paintAttributes:[{name:"a_fill_color",property:"icon-color",type:"Uint8"},{name:"a_halo_color",property:"icon-halo-color",type:"Uint8"},{name:"a_halo_width",property:"icon-halo-width",type:"Uint16",multiplier:10},{name:"a_halo_blur",property:"icon-halo-blur",type:"Uint16",multiplier:10},{name:"a_opacity",property:"icon-opacity",type:"Uint8",multiplier:255}]},collisionBox:{layoutAttributes:[{name:"a_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},{name:"a_data",components:2,type:"Uint8"}],elementArrayType:createElementArrayType(2)}},SymbolBucket=function(e){var t=this;this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.index=e.index,this.sdfIcons=e.sdfIcons,this.iconsNeedLinear=e.iconsNeedLinear,this.fontstack=e.fontstack;var o=this.layers[0];if(this.symbolInterfaces={glyph:util.extend({},symbolInterfaces.glyph,{layoutAttributes:[].concat(symbolInterfaces.glyph.layoutAttributes,getSizeAttributeDeclarations(o,"text-size"))}),icon:util.extend({},symbolInterfaces.icon,{layoutAttributes:[].concat(symbolInterfaces.icon.layoutAttributes,getSizeAttributeDeclarations(o,"icon-size"))}),collisionBox:util.extend({},symbolInterfaces.collisionBox,{layoutAttributes:[].concat(symbolInterfaces.collisionBox.layoutAttributes)})},e.arrays){this.buffers={};for(var a in e.arrays)e.arrays[a]&&(t.buffers[a]=new BufferGroup(t.symbolInterfaces[a],e.layers,e.zoom,e.arrays[a]));this.textSizeData=e.textSizeData,this.iconSizeData=e.iconSizeData}else this.textSizeData=getSizeData(this.zoom,o,"text-size"),this.iconSizeData=getSizeData(this.zoom,o,"icon-size")};SymbolBucket.prototype.populate=function(e,t){var o=this,a=this.layers[0],i=a.layout,r=i["text-font"],n=(!a.isLayoutValueFeatureConstant("text-field")||i["text-field"])&&r,s=!a.isLayoutValueFeatureConstant("icon-image")||i["icon-image"];if(this.features=[],n||s){for(var l=t.iconDependencies,c=t.glyphDependencies,u=c[r]=c[r]||{},y={zoom:this.zoom},p=0;p<e.length;p++){var m=e[p];if(a.filter(m)){var h=void 0;n&&(h=a.getLayoutValue("text-field",y,m.properties),a.isLayoutValueFeatureConstant("text-field")&&(h=resolveTokens(m.properties,h)),h=transformText(h,a,y,m.properties));var x=void 0;if(s&&(x=a.getLayoutValue("icon-image",y,m.properties),a.isLayoutValueFeatureConstant("icon-image")&&(x=resolveTokens(m.properties,x))),(h||x)&&(o.features.push({text:h,icon:x,index:p,sourceLayerIndex:m.sourceLayerIndex,geometry:loadGeometry(m),properties:m.properties,type:VectorTileFeature.types[m.type]}),x&&(l[x]=!0),h))for(var d=0;d<h.length;d++)u[h.charCodeAt(d)]=!0}}"line"===i["symbol-placement"]&&(this.features=mergeLines(this.features))}},SymbolBucket.prototype.isEmpty=function(){return this.arrays.icon.isEmpty()&&this.arrays.glyph.isEmpty()&&this.arrays.collisionBox.isEmpty()},SymbolBucket.prototype.getPaintPropertyStatistics=function(){for(var e=this,t={},o=0,a=e.layers;o<a.length;o+=1){var i=a[o];t[i.id]=util.extend({},e.arrays.icon.layerData[i.id].paintPropertyStatistics,e.arrays.glyph.layerData[i.id].paintPropertyStatistics)}return t},SymbolBucket.prototype.serialize=function(e){return{zoom:this.zoom,layerIds:this.layers.map(function(e){return e.id}),sdfIcons:this.sdfIcons,iconsNeedLinear:this.iconsNeedLinear,textSizeData:this.textSizeData,iconSizeData:this.iconSizeData,fontstack:this.fontstack,arrays:util.mapObject(this.arrays,function(t){return t.isEmpty()?null:t.serialize(e)})}},SymbolBucket.prototype.destroy=function(){this.buffers&&(this.buffers.icon&&this.buffers.icon.destroy(),this.buffers.glyph&&this.buffers.glyph.destroy(),this.buffers.collisionBox&&this.buffers.collisionBox.destroy(),this.buffers=null)},SymbolBucket.prototype.createArrays=function(){var e=this;this.arrays=util.mapObject(this.symbolInterfaces,function(t){return new ArrayGroup(t,e.layers,e.zoom)})},SymbolBucket.prototype.prepare=function(e,t){var o=this;this.symbolInstances=[];var a=512*this.overscaling;this.tilePixelRatio=EXTENT/a,this.compareText={},this.iconsNeedLinear=!1;var i=this.layers[0].layout,r=.5,n=.5;switch(i["text-anchor"]){case"right":case"top-right":case"bottom-right":r=1;break;case"left":case"top-left":case"bottom-left":r=0}switch(i["text-anchor"]){case"bottom":case"bottom-right":case"bottom-left":n=1;break;case"top":case"top-right":case"top-left":n=0}for(var s="right"===i["text-justify"]?1:"left"===i["text-justify"]?0:.5,l=24,c=i["text-line-height"]*l,u="line"!==i["symbol-placement"]?i["text-max-width"]*l:0,y=i["text-letter-spacing"]*l,p=this.fontstack=i["text-font"].join(","),m="map"===i["text-rotation-alignment"]&&"line"===i["symbol-placement"],h=0,x=o.features;h<x.length;h+=1){var d=x[h],g=void 0;if(d.text){var f=scriptDetection.allowsVerticalWritingMode(d.text),b=o.layers[0].getLayoutValue("text-offset",{zoom:o.zoom},d.properties).map(function(e){return e*l});g={},g[WritingMode.horizontal]=shapeText(d.text,e[p],u,c,r,n,s,y,b,l,WritingMode.horizontal),g[WritingMode.vertical]=f&&m&&shapeText(d.text,e[p],u,c,r,n,s,y,b,l,WritingMode.vertical)}else g={};var v=void 0;if(d.icon){var S=t[d.icon],I=o.layers[0].getLayoutValue("icon-offset",{zoom:o.zoom},d.properties);v=shapeIcon(S,I),S&&(void 0===o.sdfIcons?o.sdfIcons=S.sdf:o.sdfIcons!==S.sdf&&util.warnOnce("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),1!==S.pixelRatio?o.iconsNeedLinear=!0:0===i["icon-rotate"]&&o.layers[0].isLayoutValueFeatureConstant("icon-rotate")||(o.iconsNeedLinear=!0))}(g[WritingMode.horizontal]||v)&&o.addFeature(d,g,v)}},SymbolBucket.prototype.addFeature=function(e,t,o){var a=this,i=this.layers[0].getLayoutValue("text-size",{zoom:this.zoom+1},e.properties),r=this.layers[0].getLayoutValue("icon-size",{zoom:this.zoom+1},e.properties),n=this.layers[0].getLayoutValue("text-size",{zoom:18},e.properties);void 0===n&&(n=i);var s=this.layers[0].layout,l=24,c=i/l,u=this.tilePixelRatio*c,y=this.tilePixelRatio*n/l,p=this.tilePixelRatio*r,m=this.tilePixelRatio*s["symbol-spacing"],h=s["symbol-avoid-edges"],x=s["text-padding"]*this.tilePixelRatio,d=s["icon-padding"]*this.tilePixelRatio,g=s["text-max-angle"]/180*Math.PI,f="map"===s["text-rotation-alignment"]&&"line"===s["symbol-placement"],b="map"===s["icon-rotation-alignment"]&&"line"===s["symbol-placement"],v=s["text-allow-overlap"]||s["icon-allow-overlap"]||s["text-ignore-placement"]||s["icon-ignore-placement"],S=s["symbol-placement"],I=m/2,z=function(i,r){var n=!(r.x<0||r.x>EXTENT||r.y<0||r.y>EXTENT);if(!h||n){var s=n||v;a.addSymbolInstance(r,i,t,o,a.layers[0],s,a.collisionBoxArray,e.index,e.sourceLayerIndex,a.index,u,x,f,p,d,b,{zoom:a.zoom},e.properties)}};if("line"===S)for(var B=0,M=clipLine(e.geometry,0,0,EXTENT,EXTENT);B<M.length;B+=1)for(var L=M[B],A=getAnchors(L,m,g,t[WritingMode.vertical]||t[WritingMode.horizontal],o,l,y,a.overscaling,EXTENT),T=0,V=A;T<V.length;T+=1){var _=V[T],k=t[WritingMode.horizontal];k&&a.anchorIsTooClose(k.text,I,_)||z(L,_)}else if("Polygon"===e.type)for(var C=0,E=classifyRings(e.geometry,0);C<E.length;C+=1){var P=E[C],F=findPoleOfInaccessibility(P,16);z(P[0],new Anchor(F.x,F.y,0))}else if("LineString"===e.type)for(var w=0,D=e.geometry;w<D.length;w+=1){var N=D[w];z(N,new Anchor(N[0].x,N[0].y,0))}else if("Point"===e.type)for(var q=0,U=e.geometry;q<U.length;q+=1)for(var W=U[q],Q=0,R=W;Q<R.length;Q+=1){var Z=R[Q];z([Z],new Anchor(Z.x,Z.y,0))}},SymbolBucket.prototype.anchorIsTooClose=function(e,t,o){var a=this.compareText;if(e in a){for(var i=a[e],r=i.length-1;r>=0;r--)if(o.dist(i[r])<t)return!0}else a[e]=[];return a[e].push(o),!1},SymbolBucket.prototype.place=function(e,t){var o=this;this.createArrays();var a=this.layers[0],i=a.layout,r=e.maxScale,n="map"===i["text-rotation-alignment"]&&"line"===i["symbol-placement"],s="map"===i["icon-rotation-alignment"]&&"line"===i["symbol-placement"],l=i["text-allow-overlap"]||i["icon-allow-overlap"]||i["text-ignore-placement"]||i["icon-ignore-placement"];if(l){var c=e.angle,u=Math.sin(c),y=Math.cos(c);this.symbolInstances.sort(function(e,t){var o=u*e.anchor.x+y*e.anchor.y|0,a=u*t.anchor.x+y*t.anchor.y|0;return o-a||t.featureIndex-e.featureIndex})}for(var p=0,m=o.symbolInstances;p<m.length;p+=1){var h=m[p],x={boxStartIndex:h.textBoxStartIndex,boxEndIndex:h.textBoxEndIndex},d={boxStartIndex:h.iconBoxStartIndex,boxEndIndex:h.iconBoxEndIndex},g=!(h.textBoxStartIndex===h.textBoxEndIndex),f=!(h.iconBoxStartIndex===h.iconBoxEndIndex),b=i["text-optional"]||!g,v=i["icon-optional"]||!f,S=g?e.placeCollisionFeature(x,i["text-allow-overlap"],i["symbol-avoid-edges"]):e.minScale,I=f?e.placeCollisionFeature(d,i["icon-allow-overlap"],i["symbol-avoid-edges"]):e.minScale;if(b||v?!v&&S?S=Math.max(I,S):!b&&I&&(I=Math.max(I,S)):I=S=Math.max(I,S),g&&(e.insertCollisionFeature(x,S,i["text-ignore-placement"]),S<=r)){var z=getSizeVertexData(a,o.zoom,o.textSizeData.coveringZoomRange,"text-size",h.featureProperties);o.addSymbols(o.arrays.glyph,h.glyphQuads,S,z,i["text-keep-upright"],n,e.angle,h.featureProperties,h.writingModes)}if(f&&(e.insertCollisionFeature(d,I,i["icon-ignore-placement"]),I<=r)){var B=getSizeVertexData(a,o.zoom,o.iconSizeData.coveringZoomRange,"icon-size",h.featureProperties);o.addSymbols(o.arrays.icon,h.iconQuads,I,B,i["icon-keep-upright"],s,e.angle,h.featureProperties)}}t&&this.addToDebugBuffers(e)},SymbolBucket.prototype.addSymbols=function(e,t,o,a,i,r,n,s,l){for(var c=e.elementArray,u=e.layoutVertexArray,y=this.zoom,p=Math.max(Math.log(o)/Math.LN2+y,0),m=0,h=t;m<h.length;m+=1){var x=h[m],d=(x.anchorAngle+n+Math.PI)%(2*Math.PI);if(l&WritingMode.vertical){if(r&&x.writingMode===WritingMode.vertical){if(i&&r&&d<=5*Math.PI/4||d>7*Math.PI/4)continue}else if(i&&r&&d<=3*Math.PI/4||d>5*Math.PI/4)continue}else if(i&&r&&(d<=Math.PI/2||d>3*Math.PI/2))continue;var g=x.tl,f=x.tr,b=x.bl,v=x.br,S=x.tex,I=x.anchorPoint,z=Math.max(y+Math.log(x.minScale)/Math.LN2,p),B=Math.min(y+Math.log(x.maxScale)/Math.LN2,25);if(!(B<=z)){z===p&&(z=0);var M=Math.round(x.glyphAngle/(2*Math.PI)*256),L=e.prepareSegment(4),A=L.vertexLength;addVertex(u,I.x,I.y,g.x,g.y,S.x,S.y,a,z,B,p,M),addVertex(u,I.x,I.y,f.x,f.y,S.x+S.w,S.y,a,z,B,p,M),addVertex(u,I.x,I.y,b.x,b.y,S.x,S.y+S.h,a,z,B,p,M),addVertex(u,I.x,I.y,v.x,v.y,S.x+S.w,S.y+S.h,a,z,B,p,M),c.emplaceBack(A,A+1,A+2),c.emplaceBack(A+1,A+2,A+3),L.vertexLength+=4,L.primitiveLength+=2}}e.populatePaintArrays(s)},SymbolBucket.prototype.addToDebugBuffers=function(e){for(var t=this,o=this.arrays.collisionBox,a=o.layoutVertexArray,i=o.elementArray,r=-e.angle,n=e.yStretch,s=0,l=t.symbolInstances;s<l.length;s+=1){var c=l[s];c.textCollisionFeature={boxStartIndex:c.textBoxStartIndex,boxEndIndex:c.textBoxEndIndex},c.iconCollisionFeature={boxStartIndex:c.iconBoxStartIndex,boxEndIndex:c.iconBoxEndIndex};for(var u=0;u<2;u++){var y=c[0===u?"textCollisionFeature":"iconCollisionFeature"];if(y)for(var p=y.boxStartIndex;p<y.boxEndIndex;p++){var m=t.collisionBoxArray.get(p),h=m.anchorPoint,x=new Point(m.x1,m.y1*n)._rotate(r),d=new Point(m.x2,m.y1*n)._rotate(r),g=new Point(m.x1,m.y2*n)._rotate(r),f=new Point(m.x2,m.y2*n)._rotate(r),b=Math.max(0,Math.min(25,t.zoom+Math.log(m.maxScale)/Math.LN2)),v=Math.max(0,Math.min(25,t.zoom+Math.log(m.placementScale)/Math.LN2)),S=o.prepareSegment(4),I=S.vertexLength;addCollisionBoxVertex(a,h,x,b,v),addCollisionBoxVertex(a,h,d,b,v),addCollisionBoxVertex(a,h,f,b,v),addCollisionBoxVertex(a,h,g,b,v),i.emplaceBack(I,I+1),i.emplaceBack(I+1,I+2),i.emplaceBack(I+2,I+3),i.emplaceBack(I+3,I),S.vertexLength+=4,S.primitiveLength+=4}}}},SymbolBucket.prototype.addSymbolInstance=function(e,t,o,a,i,r,n,s,l,c,u,y,p,m,h,x,d,g){var f,b,v=[],S=[];for(var I in o){var z=parseInt(I,10);o[z]&&(S=S.concat(r?getGlyphQuads(e,o[z],u,t,i,p,d,g):[]),f=new CollisionFeature(n,t,e,s,l,c,o[z],u,y,p,!1))}var B=f?f.boxStartIndex:this.collisionBoxArray.length,M=f?f.boxEndIndex:this.collisionBoxArray.length;a&&(v=r?getIconQuads(e,a,m,t,i,x,o[WritingMode.horizontal],d,g):[],b=new CollisionFeature(n,t,e,s,l,c,a,m,h,x,!0));var L=b?b.boxStartIndex:this.collisionBoxArray.length,A=b?b.boxEndIndex:this.collisionBoxArray.length;M>SymbolBucket.MAX_INSTANCES&&util.warnOnce("Too many symbols being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),A>SymbolBucket.MAX_INSTANCES&&util.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907");var T=(o[WritingMode.vertical]?WritingMode.vertical:0)|(o[WritingMode.horizontal]?WritingMode.horizontal:0);this.symbolInstances.push({textBoxStartIndex:B,textBoxEndIndex:M,iconBoxStartIndex:L,iconBoxEndIndex:A,glyphQuads:S,iconQuads:v,anchor:e,featureIndex:s,featureProperties:g,writingModes:T})},SymbolBucket.programInterfaces=symbolInterfaces,SymbolBucket.MAX_INSTANCES=65535,module.exports=SymbolBucket; | |
},{"../../shaders/encode_attribute":81,"../../symbol/anchor":160,"../../symbol/clip_line":162,"../../symbol/collision_feature":164,"../../symbol/get_anchors":166,"../../symbol/mergelines":169,"../../symbol/quads":170,"../../symbol/shaping":171,"../../symbol/transform_text":173,"../../util/classify_rings":198,"../../util/find_pole_of_inaccessibility":204,"../../util/script_detection":211,"../../util/token":214,"../../util/util":215,"../array_group":44,"../buffer_group":52,"../element_array_type":53,"../extent":54,"../load_geometry":56,"point-geometry":26,"vector-tile":34}],51:[function(_dereq_,module,exports){ | |
"use strict";var AttributeType={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT"},Buffer=function(t,e,r){this.arrayBuffer=t.arrayBuffer,this.length=t.length,this.attributes=e.members,this.itemSize=e.bytesPerElement,this.type=r,this.arrayType=e};Buffer.fromStructArray=function(t,e){return new Buffer(t.serialize(),t.constructor.serialize(),e)},Buffer.prototype.bind=function(t){var e=t[this.type];this.buffer?t.bindBuffer(e,this.buffer):(this.gl=t,this.buffer=t.createBuffer(),t.bindBuffer(e,this.buffer),t.bufferData(e,this.arrayBuffer,t.STATIC_DRAW),this.arrayBuffer=null)},Buffer.prototype.enableAttributes=function(t,e){for(var r=this,f=0;f<this.attributes.length;f++){var i=r.attributes[f],u=e[i.name];void 0!==u&&t.enableVertexAttribArray(u)}},Buffer.prototype.setVertexAttribPointers=function(t,e,r){for(var f=this,i=0;i<this.attributes.length;i++){var u=f.attributes[i],s=e[u.name];void 0!==s&&t.vertexAttribPointer(s,u.components,t[AttributeType[u.type]],!1,f.arrayType.bytesPerElement,u.offset+(f.arrayType.bytesPerElement*r||0))}},Buffer.prototype.destroy=function(){this.buffer&&this.gl.deleteBuffer(this.buffer)},Buffer.BufferType={VERTEX:"ARRAY_BUFFER",ELEMENT:"ELEMENT_ARRAY_BUFFER"},module.exports=Buffer; | |
},{}],52:[function(_dereq_,module,exports){ | |
"use strict";var util=_dereq_("../util/util"),Buffer=_dereq_("./buffer"),ProgramConfiguration=_dereq_("./program_configuration"),createVertexArrayType=_dereq_("./vertex_array_type"),VertexArrayObject=_dereq_("../render/vertex_array_object"),BufferGroup=function(e,r,t,a){var f=this,u=createVertexArrayType(e.layoutAttributes);this.layoutVertexBuffer=new Buffer(a.layoutVertexArray,u.serialize(),Buffer.BufferType.VERTEX),a.elementArray&&(this.elementBuffer=new Buffer(a.elementArray,e.elementArrayType.serialize(),Buffer.BufferType.ELEMENT)),a.elementArray2&&(this.elementBuffer2=new Buffer(a.elementArray2,e.elementArrayType2.serialize(),Buffer.BufferType.ELEMENT)),this.layerData={};for(var n=0,i=r;n<i.length;n+=1){var s=i[n],o=a.paintVertexArrays&&a.paintVertexArrays[s.id],y=ProgramConfiguration.createDynamic(e.paintAttributes||[],s,t),l=o?new Buffer(o.array,o.type,Buffer.BufferType.VERTEX):null;f.layerData[s.id]={programConfiguration:y,paintVertexBuffer:l}}this.segments=a.segments,this.segments2=a.segments2;for(var m=0,B=[f.segments,f.segments2];m<B.length;m+=1)for(var p=B[m],g=0,v=p||[];g<v.length;g+=1){var h=v[g];h.vaos=util.mapObject(f.layerData,function(){return new VertexArrayObject})}};BufferGroup.prototype.destroy=function(){var e=this;this.layoutVertexBuffer.destroy(),this.elementBuffer&&this.elementBuffer.destroy(),this.elementBuffer2&&this.elementBuffer2.destroy();for(var r in e.layerData){var t=e.layerData[r].paintVertexBuffer;t&&t.destroy()}for(var a=0,f=[e.segments,e.segments2];a<f.length;a+=1)for(var u=f[a],n=0,i=u||[];n<i.length;n+=1){var s=i[n];for(var o in s.vaos)s.vaos[o].destroy()}},module.exports=BufferGroup; | |
},{"../render/vertex_array_object":80,"../util/util":215,"./buffer":51,"./program_configuration":58,"./vertex_array_type":60}],53:[function(_dereq_,module,exports){ | |
"use strict";function createElementArrayType(e){return createStructArrayType({members:[{type:"Uint16",name:"vertices",components:e||3}]})}var createStructArrayType=_dereq_("../util/struct_array");module.exports=createElementArrayType; | |
},{"../util/struct_array":213}],54:[function(_dereq_,module,exports){ | |
"use strict";module.exports=8192; | |
},{}],55:[function(_dereq_,module,exports){ | |
"use strict";function translateDistance(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function topDownFeatureComparator(e,t){return t-e}function getLineWidth(e,t){return t>0?t+2*e:e}function translate(e,t,r,i,a){if(!t[0]&&!t[1])return e;t=Point.convert(t),"viewport"===r&&t._rotate(-i);for(var n=[],s=0;s<e.length;s++){for(var o=e[s],l=[],u=0;u<o.length;u++)l.push(o[u].sub(t._mult(a)));n.push(l)}return n}function offsetLine(e,t){for(var r=[],i=new Point(0,0),a=0;a<e.length;a++){for(var n=e[a],s=[],o=0;o<n.length;o++){var l=n[o-1],u=n[o],c=n[o+1],y=0===o?i:u.sub(l)._unit()._perp(),f=o===n.length-1?i:c.sub(u)._unit()._perp(),h=y._add(f)._unit(),d=h.x*f.x+h.y*f.y;h._mult(1/d),s.push(h._mult(t)._add(u))}r.push(s)}return r}var Point=_dereq_("point-geometry"),loadGeometry=_dereq_("./load_geometry"),EXTENT=_dereq_("./extent"),featureFilter=_dereq_("../style-spec/feature_filter"),createStructArrayType=_dereq_("../util/struct_array"),Grid=_dereq_("grid-index"),DictionaryCoder=_dereq_("../util/dictionary_coder"),vt=_dereq_("vector-tile"),Protobuf=_dereq_("pbf"),GeoJSONFeature=_dereq_("../util/vectortile_to_geojson"),arraysIntersect=_dereq_("../util/util").arraysIntersect,intersection=_dereq_("../util/intersection_tests"),multiPolygonIntersectsBufferedMultiPoint=intersection.multiPolygonIntersectsBufferedMultiPoint,multiPolygonIntersectsMultiPolygon=intersection.multiPolygonIntersectsMultiPolygon,multiPolygonIntersectsBufferedMultiLine=intersection.multiPolygonIntersectsBufferedMultiLine,FeatureIndexArray=createStructArrayType({members:[{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]}),FeatureIndex=function(e,t,r){if(e.grid){var i=e,a=t;e=i.coord,t=i.overscaling,this.grid=new Grid(i.grid),this.featureIndexArray=new FeatureIndexArray(i.featureIndexArray),this.rawTileData=a,this.bucketLayerIDs=i.bucketLayerIDs,this.paintPropertyStatistics=i.paintPropertyStatistics}else this.grid=new Grid(EXTENT,16,0),this.featureIndexArray=new FeatureIndexArray;this.coord=e,this.overscaling=t,this.x=e.x,this.y=e.y,this.z=e.z-Math.log(t)/Math.LN2,this.setCollisionTile(r)};FeatureIndex.prototype.insert=function(e,t){var r=this,i=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(e.index,e.sourceLayerIndex,t);for(var a=loadGeometry(e),n=0;n<a.length;n++){for(var s=a[n],o=[1/0,1/0,-(1/0),-(1/0)],l=0;l<s.length;l++){var u=s[l];o[0]=Math.min(o[0],u.x),o[1]=Math.min(o[1],u.y),o[2]=Math.max(o[2],u.x),o[3]=Math.max(o[3],u.y)}r.grid.insert(i,o[0],o[1],o[2],o[3])}},FeatureIndex.prototype.setCollisionTile=function(e){this.collisionTile=e},FeatureIndex.prototype.serialize=function(e){var t=this.grid.toArrayBuffer();return e&&e.push(t),{coord:this.coord,overscaling:this.overscaling,grid:t,featureIndexArray:this.featureIndexArray.serialize(e),bucketLayerIDs:this.bucketLayerIDs,paintPropertyStatistics:this.paintPropertyStatistics}},FeatureIndex.prototype.query=function(e,t){var r=this;this.vtLayers||(this.vtLayers=new vt.VectorTile(new Protobuf(this.rawTileData)).layers,this.sourceLayerCoder=new DictionaryCoder(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]));var i={},a=e.params||{},n=EXTENT/e.tileSize/e.scale,s=featureFilter(a.filter),o=0;for(var l in t)if(r.hasLayer(l)){var u=t[l],c=0;if("line"===u.type){var y=getLineWidth(r.getPaintValue("line-width",u),r.getPaintValue("line-gap-width",u)),f=r.getPaintValue("line-offset",u),h=r.getPaintValue("line-translate",u);c=y/2+Math.abs(f)+translateDistance(h)}else"fill"===u.type?c=translateDistance(r.getPaintValue("fill-translate",u)):"fill-extrusion"===u.type?c=translateDistance(r.getPaintValue("fill-extrusion-translate",u)):"circle"===u.type&&(c=r.getPaintValue("circle-radius",u)+translateDistance(r.getPaintValue("circle-translate",u)));o=Math.max(o,c*n)}for(var d=e.queryGeometry.map(function(e){return e.map(function(e){return new Point(e.x,e.y)})}),g=1/0,p=1/0,v=-(1/0),x=-(1/0),P=0;P<d.length;P++)for(var I=d[P],m=0;m<I.length;m++){var L=I[m];g=Math.min(g,L.x),p=Math.min(p,L.y),v=Math.max(v,L.x),x=Math.max(x,L.y)}var M=this.grid.query(g-o,p-o,v+o,x+o);M.sort(topDownFeatureComparator),this.filterMatching(i,M,this.featureIndexArray,d,s,a.layers,t,e.bearing,n);var b=this.collisionTile.queryRenderedSymbols(d,e.scale);return b.sort(),this.filterMatching(i,b,this.collisionTile.collisionBoxArray,d,s,a.layers,t,e.bearing,n),i},FeatureIndex.prototype.filterMatching=function(e,t,r,i,a,n,s,o,l){for(var u,c=this,y=0;y<t.length;y++){var f=t[y];if(f!==u){u=f;var h=r.get(f),d=c.bucketLayerIDs[h.bucketIndex];if(!n||arraysIntersect(n,d)){var g=c.sourceLayerCoder.decode(h.sourceLayerIndex),p=c.vtLayers[g],v=p.feature(h.featureIndex);if(a(v))for(var x=null,P=0;P<d.length;P++){var I=d[P];if(!(n&&n.indexOf(I)<0)){var m=s[I];if(m){var L=void 0;if("symbol"!==m.type)if(x||(x=loadGeometry(v)),"line"===m.type){L=translate(i,c.getPaintValue("line-translate",m,v),c.getPaintValue("line-translate-anchor",m,v),o,l);var M=l/2*getLineWidth(c.getPaintValue("line-width",m,v),c.getPaintValue("line-gap-width",m,v)),b=c.getPaintValue("line-offset",m,v);if(b&&(x=offsetLine(x,b*l)),!multiPolygonIntersectsBufferedMultiLine(L,x,M))continue}else if("fill"===m.type||"fill-extrusion"===m.type){var V=m.type;if(L=translate(i,c.getPaintValue(V+"-translate",m,v),c.getPaintValue(V+"-translate-anchor",m,v),o,l),!multiPolygonIntersectsMultiPolygon(L,x))continue}else if("circle"===m.type){L=translate(i,c.getPaintValue("circle-translate",m,v),c.getPaintValue("circle-translate-anchor",m,v),o,l);var w=c.getPaintValue("circle-radius",m,v)*l;if(!multiPolygonIntersectsBufferedMultiPoint(L,x,w))continue}var F=new GeoJSONFeature(v,c.z,c.x,c.y);F.layer=m.serialize();var _=e[I];void 0===_&&(_=e[I]=[]),_.push(F)}}}}}}},FeatureIndex.prototype.hasLayer=function(e){var t=this;for(var r in t.bucketLayerIDs)for(var i=0,a=t.bucketLayerIDs[r];i<a.length;i+=1){var n=a[i];if(e===n)return!0}return!1},FeatureIndex.prototype.getPaintValue=function(e,t,r){var i=t.isPaintValueFeatureConstant(e);if(i||r){var a=r?r.properties:{};return t.getPaintValue(e,{zoom:this.z},a)}return this.paintPropertyStatistics[t.id][e].max},module.exports=FeatureIndex; | |
},{"../style-spec/feature_filter":105,"../util/dictionary_coder":200,"../util/intersection_tests":207,"../util/struct_array":213,"../util/util":215,"../util/vectortile_to_geojson":216,"./extent":54,"./load_geometry":56,"grid-index":16,"pbf":25,"point-geometry":26,"vector-tile":34}],56:[function(_dereq_,module,exports){ | |
"use strict";function createBounds(e){return{min:-1*Math.pow(2,e-1),max:Math.pow(2,e-1)-1}}var util=_dereq_("../util/util"),EXTENT=_dereq_("./extent"),boundsLookup={15:createBounds(15),16:createBounds(16)};module.exports=function(e,t){for(var r=boundsLookup[t||16],o=EXTENT/e.extent,u=e.loadGeometry(),n=0;n<u.length;n++)for(var a=u[n],i=0;i<a.length;i++){var d=a[i];d.x=Math.round(d.x*o),d.y=Math.round(d.y*o),(d.x<r.min||d.x>r.max||d.y<r.min||d.y>r.max)&&util.warnOnce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return u}; | |
},{"../util/util":215,"./extent":54}],57:[function(_dereq_,module,exports){ | |
"use strict";var createStructArrayType=_dereq_("../util/struct_array"),PosArray=createStructArrayType({members:[{name:"a_pos",type:"Int16",components:2}]});module.exports=PosArray; | |
},{"../util/struct_array":213}],58:[function(_dereq_,module,exports){ | |
"use strict";function getPaintAttributeValue(t,r,e,i){if(!t.zoomStops)return r.getPaintValue(t.property,e,i);var a=t.zoomStops.map(function(a){return r.getPaintValue(t.property,util.extend({},e,{zoom:a}),i)});return 1===a.length?a[0]:a}function normalizePaintAttribute(t,r){var e=t.name;e||(e=t.property.replace(r.type+"-","").replace(/-/g,"_"));var i="color"===r._paintSpecifications[t.property].type;return util.extend({name:"a_"+e,components:i?4:1,multiplier:i?255:1,dimensions:i?4:1},t)}var createVertexArrayType=_dereq_("./vertex_array_type"),util=_dereq_("../util/util"),ProgramConfiguration=function(){this.attributes=[],this.uniforms=[],this.interpolationUniforms=[],this.pragmas={vertex:{},fragment:{}},this.cacheKey=""};ProgramConfiguration.createDynamic=function(t,r,e){for(var i=new ProgramConfiguration,a=0,n=t;a<n.length;a+=1){var o=n[a],p=normalizePaintAttribute(o,r),u=p.name.slice(2);r.isPaintValueFeatureConstant(p.property)?i.addZoomAttribute(u,p):r.isPaintValueZoomConstant(p.property)?i.addPropertyAttribute(u,p):i.addZoomAndPropertyAttribute(u,p,r,e)}return i.PaintVertexArray=createVertexArrayType(i.attributes),i},ProgramConfiguration.createStatic=function(t){for(var r=new ProgramConfiguration,e=0,i=t;e<i.length;e+=1){var a=i[e];r.addUniform(a,"u_"+a)}return r},ProgramConfiguration.prototype.addUniform=function(t,r){var e=this.getPragmas(t);e.define.push("uniform {precision} {type} "+r+";"),e.initialize.push("{precision} {type} "+t+" = "+r+";"),this.cacheKey+="/u_"+t},ProgramConfiguration.prototype.addZoomAttribute=function(t,r){this.uniforms.push(r),this.addUniform(t,r.name)},ProgramConfiguration.prototype.addPropertyAttribute=function(t,r){var e=this.getPragmas(t);this.attributes.push(r),e.define.push("varying {precision} {type} "+t+";"),e.vertex.define.push("attribute {precision} {type} "+r.name+";"),e.vertex.initialize.push(t+" = "+r.name+" / "+r.multiplier+".0;"),this.cacheKey+="/a_"+t},ProgramConfiguration.prototype.addZoomAndPropertyAttribute=function(t,r,e,i){var a=this,n=this.getPragmas(t);n.define.push("varying {precision} {type} "+t+";");var o=e.getPaintValueStopZoomLevels(r.property),p=0;if(o.length>4)for(;p<o.length-2&&o[p]<i;)p++;var u="u_"+t+"_t";n.vertex.define.push("uniform lowp float "+u+";"),this.interpolationUniforms.push({name:u,property:r.property,stopOffset:p});for(var s=[],m=0;m<4;m++)s.push(o[Math.min(p+m,o.length-1)]);var f=[];if(1===r.components)this.attributes.push(util.extend({},r,{components:4,zoomStops:s})),n.vertex.define.push("attribute {precision} vec4 "+r.name+";"),f.push(r.name);else for(var g=0;g<4;g++){var h=r.name+g;f.push(h),a.attributes.push(util.extend({},r,{name:h,zoomStops:[s[g]]})),n.vertex.define.push("attribute {precision} {type} "+h+";")}n.vertex.initialize.push(t+" = evaluate_zoom_function_"+r.components+"( "+f.join(", ")+", "+u+") / "+r.multiplier+".0;"),this.cacheKey+="/z_"+t},ProgramConfiguration.prototype.getPragmas=function(t){return this.pragmas[t]||(this.pragmas[t]={define:[],initialize:[]},this.pragmas[t].fragment={define:[],initialize:[]},this.pragmas[t].vertex={define:[],initialize:[]}),this.pragmas[t]},ProgramConfiguration.prototype.applyPragmas=function(t,r){var e=this;return t.replace(/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,function(t,i,a,n,o){return e.pragmas[o][i].concat(e.pragmas[o][r][i]).join("\n").replace(/{type}/g,n).replace(/{precision}/g,a)})},ProgramConfiguration.prototype.createPaintPropertyStatistics=function(){for(var t=this,r={},e=0,i=t.attributes;e<i.length;e+=1){var a=i[e];1===a.dimensions&&(r[a.property]={max:-(1/0)})}return r},ProgramConfiguration.prototype.populatePaintArray=function(t,r,e,i,a,n){var o=this,p=r.length;r.resize(i);for(var u=0,s=o.attributes;u<s.length;u+=1)for(var m=s[u],f=getPaintAttributeValue(m,t,a,n),g=p;g<i;g++){var h=r.get(g);if(4===m.components)for(var l=0;l<4;l++)h[m.name+l]=f[l]*m.multiplier;else h[m.name]=f*m.multiplier;if(1===m.dimensions){var c=e[m.property];c.max=Math.max(c.max,1===m.components?f:Math.max.apply(Math,f))}}},ProgramConfiguration.prototype.setUniforms=function(t,r,e,i){for(var a=this,n=0,o=a.uniforms;n<o.length;n+=1){var p=o[n],u=e.getPaintValue(p.property,i);4===p.components?t.uniform4fv(r[p.name],u):t.uniform1f(r[p.name],u)}for(var s=0,m=a.interpolationUniforms;s<m.length;s+=1){var f=m[s],g=e.getPaintInterpolationT(f.property,i);t.uniform1f(r[f.name],Math.max(0,Math.min(3,g-f.stopOffset)))}},module.exports=ProgramConfiguration; | |
},{"../util/util":215,"./vertex_array_type":60}],59:[function(_dereq_,module,exports){ | |
"use strict";var createStructArrayType=_dereq_("../util/struct_array"),RasterBoundsArray=createStructArrayType({members:[{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]});module.exports=RasterBoundsArray; | |
},{"../util/struct_array":213}],60:[function(_dereq_,module,exports){ | |
"use strict";function createVertexArrayType(r){return createStructArrayType({members:r,alignment:4})}var createStructArrayType=_dereq_("../util/struct_array");module.exports=createVertexArrayType; | |
},{"../util/struct_array":213}],61:[function(_dereq_,module,exports){ | |
"use strict";var Coordinate=function(o,t,n){this.column=o,this.row=t,this.zoom=n};Coordinate.prototype.clone=function(){return new Coordinate(this.column,this.row,this.zoom)},Coordinate.prototype.zoomTo=function(o){return this.clone()._zoomTo(o)},Coordinate.prototype.sub=function(o){return this.clone()._sub(o)},Coordinate.prototype._zoomTo=function(o){var t=Math.pow(2,o-this.zoom);return this.column*=t,this.row*=t,this.zoom=o,this},Coordinate.prototype._sub=function(o){return o=o.zoomTo(this.zoom),this.column-=o.column,this.row-=o.row,this},module.exports=Coordinate; | |
},{}],62:[function(_dereq_,module,exports){ | |
"use strict";var wrap=_dereq_("../util/util").wrap,LngLat=function(t,n){if(isNaN(t)||isNaN(n))throw new Error("Invalid LngLat object: ("+t+", "+n+")");if(this.lng=+t,this.lat=+n,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};LngLat.prototype.wrap=function(){return new LngLat(wrap(this.lng,-180,180),this.lat)},LngLat.prototype.toArray=function(){return[this.lng,this.lat]},LngLat.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},LngLat.convert=function(t){if(t instanceof LngLat)return t;if(Array.isArray(t)&&2===t.length)return new LngLat(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new LngLat(Number(t.lng),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")},module.exports=LngLat; | |
},{"../util/util":215}],63:[function(_dereq_,module,exports){ | |
"use strict";var LngLat=_dereq_("./lng_lat"),LngLatBounds=function(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};LngLatBounds.prototype.setNorthEast=function(t){return this._ne=LngLat.convert(t),this},LngLatBounds.prototype.setSouthWest=function(t){return this._sw=LngLat.convert(t),this},LngLatBounds.prototype.extend=function(t){var n,e,s=this._sw,o=this._ne;if(t instanceof LngLat)n=t,e=t;else{if(!(t instanceof LngLatBounds))return Array.isArray(t)?t.every(Array.isArray)?this.extend(LngLatBounds.convert(t)):this.extend(LngLat.convert(t)):this;if(n=t._sw,e=t._ne,!n||!e)return this}return s||o?(s.lng=Math.min(n.lng,s.lng),s.lat=Math.min(n.lat,s.lat),o.lng=Math.max(e.lng,o.lng),o.lat=Math.max(e.lat,o.lat)):(this._sw=new LngLat(n.lng,n.lat),this._ne=new LngLat(e.lng,e.lat)),this},LngLatBounds.prototype.getCenter=function(){return new LngLat((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},LngLatBounds.prototype.getSouthWest=function(){return this._sw},LngLatBounds.prototype.getNorthEast=function(){return this._ne},LngLatBounds.prototype.getNorthWest=function(){return new LngLat(this.getWest(),this.getNorth())},LngLatBounds.prototype.getSouthEast=function(){return new LngLat(this.getEast(),this.getSouth())},LngLatBounds.prototype.getWest=function(){return this._sw.lng},LngLatBounds.prototype.getSouth=function(){return this._sw.lat},LngLatBounds.prototype.getEast=function(){return this._ne.lng},LngLatBounds.prototype.getNorth=function(){return this._ne.lat},LngLatBounds.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},LngLatBounds.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},LngLatBounds.convert=function(t){return!t||t instanceof LngLatBounds?t:new LngLatBounds(t)},module.exports=LngLatBounds; | |
},{"./lng_lat":62}],64:[function(_dereq_,module,exports){ | |
"use strict";var LngLat=_dereq_("./lng_lat"),Point=_dereq_("point-geometry"),Coordinate=_dereq_("./coordinate"),util=_dereq_("../util/util"),interp=_dereq_("../style-spec/util/interpolate"),TileCoord=_dereq_("../source/tile_coord"),EXTENT=_dereq_("../data/extent"),glmatrix=_dereq_("@mapbox/gl-matrix"),vec4=glmatrix.vec4,mat4=glmatrix.mat4,mat2=glmatrix.mat2,Transform=function(t,i,o){this.tileSize=512,this._renderWorldCopies=void 0===o||o,this._minZoom=t||0,this._maxZoom=i||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0},prototypeAccessors={minZoom:{},maxZoom:{},renderWorldCopies:{},worldSize:{},centerPoint:{},size:{},bearing:{},pitch:{},fov:{},zoom:{},center:{},unmodified:{},x:{},y:{},point:{}};prototypeAccessors.minZoom.get=function(){return this._minZoom},prototypeAccessors.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},prototypeAccessors.maxZoom.get=function(){return this._maxZoom},prototypeAccessors.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},prototypeAccessors.renderWorldCopies.get=function(){return this._renderWorldCopies},prototypeAccessors.worldSize.get=function(){return this.tileSize*this.scale},prototypeAccessors.centerPoint.get=function(){return this.size._div(2)},prototypeAccessors.size.get=function(){return new Point(this.width,this.height)},prototypeAccessors.bearing.get=function(){return-this.angle/Math.PI*180},prototypeAccessors.bearing.set=function(t){var i=-util.wrap(t,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=mat2.create(),mat2.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},prototypeAccessors.pitch.get=function(){return this._pitch/Math.PI*180},prototypeAccessors.pitch.set=function(t){var i=util.clamp(t,0,60)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())},prototypeAccessors.fov.get=function(){return this._fov/Math.PI*180},prototypeAccessors.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())},prototypeAccessors.zoom.get=function(){return this._zoom},prototypeAccessors.zoom.set=function(t){var i=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this.scale=this.zoomScale(i),this.tileZoom=Math.floor(i),this.zoomFraction=i-this.tileZoom,this._constrain(),this._calcMatrices())},prototypeAccessors.center.get=function(){return this._center},prototypeAccessors.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},Transform.prototype.coveringZoomLevel=function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},Transform.prototype.getVisibleWrappedCoordinates=function(t){for(var i=this.pointCoordinate(new Point(0,0),0),o=this.pointCoordinate(new Point(this.width,0),0),e=Math.floor(i.column),r=Math.floor(o.column),n=[t],s=e;s<=r;s++)0!==s&&n.push(new TileCoord(t.z,t.x,t.y,s));return n},Transform.prototype.coveringTiles=function(t){var i=this.coveringZoomLevel(t),o=i;if(i<t.minzoom)return[];i>t.maxzoom&&(i=t.maxzoom);var e=this.pointCoordinate(this.centerPoint,i),r=new Point(e.column-.5,e.row-.5),n=[this.pointCoordinate(new Point(0,0),i),this.pointCoordinate(new Point(this.width,0),i),this.pointCoordinate(new Point(this.width,this.height),i),this.pointCoordinate(new Point(0,this.height),i)];return TileCoord.cover(i,n,t.reparseOverscaled?o:i,this._renderWorldCopies).sort(function(t,i){return r.dist(t)-r.dist(i)})},Transform.prototype.resize=function(t,i){this.width=t,this.height=i,this.pixelsToGLUnits=[2/t,-2/i],this._constrain(),this._calcMatrices()},prototypeAccessors.unmodified.get=function(){return this._unmodified},Transform.prototype.zoomScale=function(t){return Math.pow(2,t)},Transform.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},Transform.prototype.project=function(t){return new Point(this.lngX(t.lng),this.latY(t.lat))},Transform.prototype.unproject=function(t){return new LngLat(this.xLng(t.x),this.yLat(t.y))},prototypeAccessors.x.get=function(){return this.lngX(this.center.lng)},prototypeAccessors.y.get=function(){return this.latY(this.center.lat)},prototypeAccessors.point.get=function(){return new Point(this.x,this.y)},Transform.prototype.lngX=function(t){return(180+t)*this.worldSize/360},Transform.prototype.latY=function(t){var i=180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360));return(180-i)*this.worldSize/360},Transform.prototype.xLng=function(t){return 360*t/this.worldSize-180},Transform.prototype.yLat=function(t){var i=180-360*t/this.worldSize;return 360/Math.PI*Math.atan(Math.exp(i*Math.PI/180))-90},Transform.prototype.setLocationAtPoint=function(t,i){var o=this.pointCoordinate(i)._sub(this.pointCoordinate(this.centerPoint));this.center=this.coordinateLocation(this.locationCoordinate(t)._sub(o)),this._renderWorldCopies&&(this.center=this.center.wrap())},Transform.prototype.locationPoint=function(t){return this.coordinatePoint(this.locationCoordinate(t))},Transform.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},Transform.prototype.locationCoordinate=function(t){return new Coordinate(this.lngX(t.lng)/this.tileSize,this.latY(t.lat)/this.tileSize,this.zoom).zoomTo(this.tileZoom)},Transform.prototype.coordinateLocation=function(t){var i=t.zoomTo(this.zoom);return new LngLat(this.xLng(i.column*this.tileSize),this.yLat(i.row*this.tileSize))},Transform.prototype.pointCoordinate=function(t,i){void 0===i&&(i=this.tileZoom);var o=0,e=[t.x,t.y,0,1],r=[t.x,t.y,1,1];vec4.transformMat4(e,e,this.pixelMatrixInverse),vec4.transformMat4(r,r,this.pixelMatrixInverse);var n=e[3],s=r[3],a=e[0]/n,h=r[0]/s,c=e[1]/n,m=r[1]/s,p=e[2]/n,l=r[2]/s,u=p===l?0:(o-p)/(l-p);return new Coordinate(interp(a,h,u)/this.tileSize,interp(c,m,u)/this.tileSize,this.zoom)._zoomTo(i)},Transform.prototype.coordinatePoint=function(t){var i=t.zoomTo(this.zoom),o=[i.column*this.tileSize,i.row*this.tileSize,0,1];return vec4.transformMat4(o,o,this.pixelMatrix),new Point(o[0]/o[3],o[1]/o[3])},Transform.prototype.calculatePosMatrix=function(t,i){var o=t.toCoordinate(i),e=this.worldSize/this.zoomScale(o.zoom),r=mat4.identity(new Float64Array(16));return mat4.translate(r,r,[o.column*e,o.row*e,0]),mat4.scale(r,r,[e/EXTENT,e/EXTENT,1]),mat4.multiply(r,this.projMatrix,r),new Float32Array(r)},Transform.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t,i,o,e,r=-90,n=90,s=-180,a=180,h=this.size,c=this._unmodified;if(this.latRange){var m=this.latRange;r=this.latY(m[1]),n=this.latY(m[0]),t=n-r<h.y?h.y/(n-r):0}if(this.lngRange){var p=this.lngRange;s=this.lngX(p[0]),a=this.lngX(p[1]),i=a-s<h.x?h.x/(a-s):0}var l=Math.max(i||0,t||0);if(l)return this.center=this.unproject(new Point(i?(a+s)/2:this.x,t?(n+r)/2:this.y)),this.zoom+=this.scaleZoom(l),this._unmodified=c,void(this._constraining=!1);if(this.latRange){var u=this.y,f=h.y/2;u-f<r&&(e=r+f),u+f>n&&(e=n-f)}if(this.lngRange){var d=this.x,g=h.x/2;d-g<s&&(o=s+g),d+g>a&&(o=a-g)}void 0===o&&void 0===e||(this.center=this.unproject(new Point(void 0!==o?o:this.x,void 0!==e?e:this.y))),this._unmodified=c,this._constraining=!1}},Transform.prototype._calcMatrices=function(){if(this.height){this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var t=this._fov/2,i=Math.PI/2+this._pitch,o=Math.sin(t)*this.cameraToCenterDistance/Math.sin(Math.PI-i-t),e=Math.cos(Math.PI/2-this._pitch)*o+this.cameraToCenterDistance,r=1.01*e,n=new Float64Array(16);mat4.perspective(n,this._fov,this.width/this.height,1,r),mat4.scale(n,n,[1,-1,1]),mat4.translate(n,n,[0,0,-this.cameraToCenterDistance]),mat4.rotateX(n,n,this._pitch),mat4.rotateZ(n,n,this.angle),mat4.translate(n,n,[-this.x,-this.y,0]);var s=this.worldSize/(2*Math.PI*6378137*Math.abs(Math.cos(this.center.lat*(Math.PI/180))));if(mat4.scale(n,n,[1,1,s,1]),this.projMatrix=n,n=mat4.create(),mat4.scale(n,n,[this.width/2,-this.height/2,1]),mat4.translate(n,n,[1,-1,0]),this.pixelMatrix=mat4.multiply(new Float64Array(16),n,this.projMatrix),n=mat4.invert(new Float64Array(16),this.pixelMatrix),!n)throw new Error("failed to invert matrix");this.pixelMatrixInverse=n}},Object.defineProperties(Transform.prototype,prototypeAccessors),module.exports=Transform; | |
},{"../data/extent":54,"../source/tile_coord":96,"../style-spec/util/interpolate":123,"../util/util":215,"./coordinate":61,"./lng_lat":62,"@mapbox/gl-matrix":1,"point-geometry":26}],65:[function(_dereq_,module,exports){ | |
"use strict";var browser=_dereq_("./util/browser"),mapboxgl=module.exports={};mapboxgl.version=_dereq_("../package.json").version,mapboxgl.workerCount=Math.max(Math.floor(browser.hardwareConcurrency/2),1),mapboxgl.Map=_dereq_("./ui/map"),mapboxgl.NavigationControl=_dereq_("./ui/control/navigation_control"),mapboxgl.GeolocateControl=_dereq_("./ui/control/geolocate_control"),mapboxgl.AttributionControl=_dereq_("./ui/control/attribution_control"),mapboxgl.ScaleControl=_dereq_("./ui/control/scale_control"),mapboxgl.FullscreenControl=_dereq_("./ui/control/fullscreen_control"),mapboxgl.Popup=_dereq_("./ui/popup"),mapboxgl.Marker=_dereq_("./ui/marker"),mapboxgl.Style=_dereq_("./style/style"),mapboxgl.LngLat=_dereq_("./geo/lng_lat"),mapboxgl.LngLatBounds=_dereq_("./geo/lng_lat_bounds"),mapboxgl.Point=_dereq_("point-geometry"),mapboxgl.Evented=_dereq_("./util/evented"),mapboxgl.supported=_dereq_("./util/browser").supported;var config=_dereq_("./util/config");mapboxgl.config=config;var rtlTextPlugin=_dereq_("./source/rtl_text_plugin");mapboxgl.setRTLTextPlugin=rtlTextPlugin.setRTLTextPlugin,Object.defineProperty(mapboxgl,"accessToken",{get:function(){return config.ACCESS_TOKEN},set:function(o){config.ACCESS_TOKEN=o}}); | |
},{"../package.json":43,"./geo/lng_lat":62,"./geo/lng_lat_bounds":63,"./source/rtl_text_plugin":91,"./style/style":149,"./ui/control/attribution_control":176,"./ui/control/fullscreen_control":177,"./ui/control/geolocate_control":178,"./ui/control/navigation_control":180,"./ui/control/scale_control":181,"./ui/map":190,"./ui/marker":191,"./ui/popup":192,"./util/browser":195,"./util/config":199,"./util/evented":203,"point-geometry":26}],66:[function(_dereq_,module,exports){ | |
"use strict";function drawBackground(r,t,e){var a=r.gl,i=r.transform,n=i.tileSize,o=e.paint["background-color"],l=e.paint["background-pattern"],u=e.paint["background-opacity"],f=!l&&1===o[3]&&1===u;if(r.isOpaquePass===f){a.disable(a.STENCIL_TEST),r.setDepthSublayer(0);var s;l?(s=r.useProgram("fillPattern",r.basicFillProgramConfiguration),pattern.prepare(l,r,s),r.tileExtentPatternVAO.bind(a,s,r.tileExtentBuffer)):(s=r.useProgram("fill",r.basicFillProgramConfiguration),a.uniform4fv(s.u_color,o),r.tileExtentVAO.bind(a,s,r.tileExtentBuffer)),a.uniform1f(s.u_opacity,u);for(var c=i.coveringTiles({tileSize:n}),g=0,p=c;g<p.length;g+=1){var d=p[g];l&&pattern.setTile({coord:d,tileSize:n},r,s),a.uniformMatrix4fv(s.u_matrix,!1,r.transform.calculatePosMatrix(d)),a.drawArrays(a.TRIANGLE_STRIP,0,r.tileExtentBuffer.length)}}}var pattern=_dereq_("./pattern");module.exports=drawBackground; | |
},{"./pattern":78}],67:[function(_dereq_,module,exports){ | |
"use strict";function drawCircles(e,r,t,a){if(!e.isOpaquePass){var i=e.gl;e.setDepthSublayer(0),e.depthMask(!1),i.disable(i.STENCIL_TEST);for(var s=0;s<a.length;s++){var o=a[s],n=r.getTile(o),f=n.getBucket(t);if(f){var l=f.buffers,m=l.layerData[t.id],u=m.programConfiguration,c=e.useProgram("circle",u);u.setUniforms(i,c,t,{zoom:e.transform.zoom}),"map"===t.paint["circle-pitch-scale"]?(i.uniform1i(c.u_scale_with_map,!0),i.uniform2f(c.u_extrude_scale,e.transform.pixelsToGLUnits[0]*e.transform.cameraToCenterDistance,e.transform.pixelsToGLUnits[1]*e.transform.cameraToCenterDistance)):(i.uniform1i(c.u_scale_with_map,!1),i.uniform2fv(c.u_extrude_scale,e.transform.pixelsToGLUnits)),i.uniform1f(c.u_devicepixelratio,browser.devicePixelRatio),i.uniformMatrix4fv(c.u_matrix,!1,e.translatePosMatrix(o.posMatrix,n,t.paint["circle-translate"],t.paint["circle-translate-anchor"]));for(var p=0,v=l.segments;p<v.length;p+=1){var x=v[p];x.vaos[t.id].bind(i,c,l.layoutVertexBuffer,l.elementBuffer,m.paintVertexBuffer,x.vertexOffset),i.drawElements(i.TRIANGLES,3*x.primitiveLength,i.UNSIGNED_SHORT,3*x.primitiveOffset*2)}}}}}var browser=_dereq_("../util/browser");module.exports=drawCircles; | |
},{"../util/browser":195}],68:[function(_dereq_,module,exports){ | |
"use strict";function drawCollisionDebug(e,o,r,i){var t=e.gl;t.enable(t.STENCIL_TEST);for(var f=e.useProgram("collisionBox"),l=0;l<i.length;l++){var n=i[l],a=o.getTile(n),s=a.getBucket(r);if(s){var u=s.buffers.collisionBox;if(u){t.uniformMatrix4fv(f.u_matrix,!1,n.posMatrix),e.enableTileClippingMask(n),e.lineWidth(1),t.uniform1f(f.u_scale,Math.pow(2,e.transform.zoom-a.coord.z)),t.uniform1f(f.u_zoom,10*e.transform.zoom),t.uniform1f(f.u_maxzoom,10*(a.coord.z+1));for(var m=0,g=u.segments;m<g.length;m+=1){var v=g[m];v.vaos[r.id].bind(t,f,u.layoutVertexBuffer,u.elementBuffer,null,v.vertexOffset),t.drawElements(t.LINES,2*v.primitiveLength,t.UNSIGNED_SHORT,2*v.primitiveOffset*2)}}}}}module.exports=drawCollisionDebug; | |
},{}],69:[function(_dereq_,module,exports){ | |
"use strict";function drawDebug(r,e,a){for(var t=0;t<a.length;t++)drawDebugTile(r,e,a[t])}function drawDebugTile(r,e,a){var t=r.gl;t.disable(t.STENCIL_TEST),r.lineWidth(1*browser.devicePixelRatio);var i=a.posMatrix,u=r.useProgram("debug");t.uniformMatrix4fv(u.u_matrix,!1,i),t.uniform4f(u.u_color,1,0,0,1),r.debugVAO.bind(t,u,r.debugBuffer),t.drawArrays(t.LINE_STRIP,0,r.debugBuffer.length);for(var o=createTextVerticies(a.toString(),50,200,5),f=new PosArray,n=0;n<o.length;n+=2)f.emplaceBack(o[n],o[n+1]);var l=Buffer.fromStructArray(f,Buffer.BufferType.VERTEX),m=new VertexArrayObject;m.bind(t,u,l),t.uniform4f(u.u_color,1,1,1,1);for(var s=e.getTile(a).tileSize,g=EXTENT/(Math.pow(2,r.transform.zoom-a.z)*s),x=[[-1,-1],[-1,1],[1,-1],[1,1]],d=0;d<x.length;d++){var b=x[d];t.uniformMatrix4fv(u.u_matrix,!1,mat4.translate([],i,[g*b[0],g*b[1],0])),t.drawArrays(t.LINES,0,l.length)}t.uniform4f(u.u_color,0,0,0,1),t.uniformMatrix4fv(u.u_matrix,!1,i),t.drawArrays(t.LINES,0,l.length)}function createTextVerticies(r,e,a,t){t=t||1;var i,u,o,f,n,l,m,s,g=[];for(i=0,u=r.length;i<u;i++)if(n=simplexFont[r[i]]){for(s=null,o=0,f=n[1].length;o<f;o+=2)n[1][o]===-1&&n[1][o+1]===-1?s=null:(l=e+n[1][o]*t,m=a-n[1][o+1]*t,s&&g.push(s.x,s.y,l,m),s={x:l,y:m});e+=n[0]*t}return g}var browser=_dereq_("../util/browser"),mat4=_dereq_("@mapbox/gl-matrix").mat4,EXTENT=_dereq_("../data/extent"),Buffer=_dereq_("../data/buffer"),VertexArrayObject=_dereq_("./vertex_array_object"),PosArray=_dereq_("../data/pos_array");module.exports=drawDebug;var simplexFont={" ":[16,[]],"!":[10,[5,21,5,7,-1,-1,5,2,4,1,5,0,6,1,5,2]],'"':[16,[4,21,4,14,-1,-1,12,21,12,14]],"#":[21,[11,25,4,-7,-1,-1,17,25,10,-7,-1,-1,4,12,18,12,-1,-1,3,6,17,6]],$:[20,[8,25,8,-4,-1,-1,12,25,12,-4,-1,-1,17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],"%":[24,[21,21,3,0,-1,-1,8,21,10,19,10,17,9,15,7,14,5,14,3,16,3,18,4,20,6,21,8,21,10,20,13,19,16,19,19,20,21,21,-1,-1,17,7,15,6,14,4,14,2,16,0,18,0,20,1,21,3,21,5,19,7,17,7]],"&":[26,[23,12,23,13,22,14,21,14,20,13,19,11,17,6,15,3,13,1,11,0,7,0,5,1,4,2,3,4,3,6,4,8,5,9,12,13,13,14,14,16,14,18,13,20,11,21,9,20,8,18,8,16,9,13,11,10,16,3,18,1,20,0,22,0,23,1,23,2]],"'":[10,[5,19,4,20,5,21,6,20,6,18,5,16,4,15]],"(":[14,[11,25,9,23,7,20,5,16,4,11,4,7,5,2,7,-2,9,-5,11,-7]],")":[14,[3,25,5,23,7,20,9,16,10,11,10,7,9,2,7,-2,5,-5,3,-7]],"*":[16,[8,21,8,9,-1,-1,3,18,13,12,-1,-1,13,18,3,12]],"+":[26,[13,18,13,0,-1,-1,4,9,22,9]],",":[10,[6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"-":[26,[4,9,22,9]],".":[10,[5,2,4,1,5,0,6,1,5,2]],"/":[22,[20,25,2,-7]],0:[20,[9,21,6,20,4,17,3,12,3,9,4,4,6,1,9,0,11,0,14,1,16,4,17,9,17,12,16,17,14,20,11,21,9,21]],1:[20,[6,17,8,18,11,21,11,0]],2:[20,[4,16,4,17,5,19,6,20,8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,10,3,0,17,0]],3:[20,[5,21,16,21,10,13,13,13,15,12,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],4:[20,[13,21,3,7,18,7,-1,-1,13,21,13,0]],5:[20,[15,21,5,21,4,12,5,13,8,14,11,14,14,13,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],6:[20,[16,18,15,20,12,21,10,21,7,20,5,17,4,12,4,7,5,3,7,1,10,0,11,0,14,1,16,3,17,6,17,7,16,10,14,12,11,13,10,13,7,12,5,10,4,7]],7:[20,[17,21,7,0,-1,-1,3,21,17,21]],8:[20,[8,21,5,20,4,18,4,16,5,14,7,13,11,12,14,11,16,9,17,7,17,4,16,2,15,1,12,0,8,0,5,1,4,2,3,4,3,7,4,9,6,11,9,12,13,13,15,14,16,16,16,18,15,20,12,21,8,21]],9:[20,[16,14,15,11,13,9,10,8,9,8,6,9,4,11,3,14,3,15,4,18,6,20,9,21,10,21,13,20,15,18,16,14,16,9,15,4,13,1,10,0,8,0,5,1,4,3]],":":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,5,2,4,1,5,0,6,1,5,2]],";":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"<":[24,[20,18,4,9,20,0]],"=":[26,[4,12,22,12,-1,-1,4,6,22,6]],">":[24,[4,18,20,9,4,0]],"?":[18,[3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,-1,-1,9,2,8,1,9,0,10,1,9,2]],"@":[27,[18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,-1,-1,12,16,10,14,9,11,9,8,10,6,11,5,-1,-1,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,-1,-1,19,16,18,8,18,6,19,5]],A:[18,[9,21,1,0,-1,-1,9,21,17,0,-1,-1,4,7,14,7]],B:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,-1,-1,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0]],C:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5]],D:[21,[4,21,4,0,-1,-1,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0]],E:[19,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11,-1,-1,4,0,17,0]],F:[18,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11]],G:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,-1,-1,13,8,18,8]],H:[22,[4,21,4,0,-1,-1,18,21,18,0,-1,-1,4,11,18,11]],I:[8,[4,21,4,0]],J:[16,[12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7]],K:[21,[4,21,4,0,-1,-1,18,21,4,7,-1,-1,9,12,18,0]],L:[17,[4,21,4,0,-1,-1,4,0,16,0]],M:[24,[4,21,4,0,-1,-1,4,21,12,0,-1,-1,20,21,12,0,-1,-1,20,21,20,0]],N:[22,[4,21,4,0,-1,-1,4,21,18,0,-1,-1,18,21,18,0]],O:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21]],P:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10]],Q:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,-1,-1,12,4,18,-2]],R:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,-1,-1,11,11,18,0]],S:[20,[17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],T:[16,[8,21,8,0,-1,-1,1,21,15,21]],U:[22,[4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21]],V:[18,[1,21,9,0,-1,-1,17,21,9,0]],W:[24,[2,21,7,0,-1,-1,12,21,7,0,-1,-1,12,21,17,0,-1,-1,22,21,17,0]],X:[20,[3,21,17,0,-1,-1,17,21,3,0]],Y:[18,[1,21,9,11,9,0,-1,-1,17,21,9,11]],Z:[20,[17,21,3,0,-1,-1,3,21,17,21,-1,-1,3,0,17,0]],"[":[14,[4,25,4,-7,-1,-1,5,25,5,-7,-1,-1,4,25,11,25,-1,-1,4,-7,11,-7]],"\\":[14,[0,21,14,-3]],"]":[14,[9,25,9,-7,-1,-1,10,25,10,-7,-1,-1,3,25,10,25,-1,-1,3,-7,10,-7]],"^":[16,[6,15,8,18,10,15,-1,-1,3,12,8,17,13,12,-1,-1,8,17,8,0]],_:[16,[0,-2,16,-2]],"`":[10,[6,21,5,20,4,18,4,16,5,15,6,16,5,17]],a:[19,[15,14,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],b:[19,[4,21,4,0,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],c:[18,[15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],d:[19,[15,21,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],e:[18,[3,8,15,8,15,10,14,12,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],f:[12,[10,21,8,21,6,20,5,17,5,0,-1,-1,2,14,9,14]],g:[19,[15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],h:[19,[4,21,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],i:[8,[3,21,4,20,5,21,4,22,3,21,-1,-1,4,14,4,0]],j:[10,[5,21,6,20,7,21,6,22,5,21,-1,-1,6,14,6,-3,5,-6,3,-7,1,-7]],k:[17,[4,21,4,0,-1,-1,14,14,4,4,-1,-1,8,8,15,0]],l:[8,[4,21,4,0]],m:[30,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0,-1,-1,15,10,18,13,20,14,23,14,25,13,26,10,26,0]],n:[19,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],o:[19,[8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14]],p:[19,[4,14,4,-7,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],q:[19,[15,14,15,-7,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],r:[13,[4,14,4,0,-1,-1,4,8,5,11,7,13,9,14,12,14]],s:[17,[14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3]],t:[12,[5,21,5,4,6,1,8,0,10,0,-1,-1,2,14,9,14]],u:[19,[4,14,4,4,5,1,7,0,10,0,12,1,15,4,-1,-1,15,14,15,0]],v:[16,[2,14,8,0,-1,-1,14,14,8,0]],w:[22,[3,14,7,0,-1,-1,11,14,7,0,-1,-1,11,14,15,0,-1,-1,19,14,15,0]],x:[17,[3,14,14,0,-1,-1,14,14,3,0]],y:[16,[2,14,8,0,-1,-1,14,14,8,0,6,-4,4,-6,2,-7,1,-7]],z:[17,[14,14,3,0,-1,-1,3,14,14,14,-1,-1,3,0,14,0]],"{":[14,[9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,-1,-1,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,-1,-1,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7]],"|":[8,[4,25,4,-7]],"}":[14,[5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,-1,-1,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,-1,-1,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7]],"~":[24,[3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,-1,-1,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]]}; | |
},{"../data/buffer":51,"../data/extent":54,"../data/pos_array":57,"../util/browser":195,"./vertex_array_object":80,"@mapbox/gl-matrix":1}],70:[function(_dereq_,module,exports){ | |
"use strict";function drawFill(t,e,r,i){var a=t.gl;a.enable(a.STENCIL_TEST);var l=!r.paint["fill-pattern"]&&r.isPaintValueFeatureConstant("fill-color")&&r.isPaintValueFeatureConstant("fill-opacity")&&1===r.paint["fill-color"][3]&&1===r.paint["fill-opacity"];t.isOpaquePass===l&&(t.setDepthSublayer(1),drawFillTiles(t,e,r,i,drawFillTile)),!t.isOpaquePass&&r.paint["fill-antialias"]&&(t.lineWidth(2),t.depthMask(!1),t.setDepthSublayer(r.getPaintProperty("fill-outline-color")?2:0),drawFillTiles(t,e,r,i,drawStrokeTile))}function drawFillTiles(t,e,r,i,a){for(var l=!0,n=0,o=i;n<o.length;n+=1){var f=o[n],s=e.getTile(f),u=s.getBucket(r);u&&(t.enableTileClippingMask(f),a(t,e,r,s,f,u.buffers,l),l=!1)}}function drawFillTile(t,e,r,i,a,l,n){for(var o=t.gl,f=l.layerData[r.id],s=setFillProgram("fill",r.paint["fill-pattern"],t,f,r,i,a,n),u=0,p=l.segments;u<p.length;u+=1){var g=p[u];g.vaos[r.id].bind(o,s,l.layoutVertexBuffer,l.elementBuffer,f.paintVertexBuffer,g.vertexOffset),o.drawElements(o.TRIANGLES,3*g.primitiveLength,o.UNSIGNED_SHORT,3*g.primitiveOffset*2)}}function drawStrokeTile(t,e,r,i,a,l,n){var o=t.gl,f=l.layerData[r.id],s=r.paint["fill-pattern"]&&!r.getPaintProperty("fill-outline-color"),u=setFillProgram("fillOutline",s,t,f,r,i,a,n);o.uniform2f(u.u_world,o.drawingBufferWidth,o.drawingBufferHeight);for(var p=0,g=l.segments2;p<g.length;p+=1){var m=g[p];m.vaos[r.id].bind(o,u,l.layoutVertexBuffer,l.elementBuffer2,f.paintVertexBuffer,m.vertexOffset),o.drawElements(o.LINES,2*m.primitiveLength,o.UNSIGNED_SHORT,2*m.primitiveOffset*2)}}function setFillProgram(t,e,r,i,a,l,n,o){var f,s=r.currentProgram;return e?(f=r.useProgram(t+"Pattern",i.programConfiguration),(o||f!==s)&&(i.programConfiguration.setUniforms(r.gl,f,a,{zoom:r.transform.zoom}),pattern.prepare(a.paint["fill-pattern"],r,f)),pattern.setTile(l,r,f)):(f=r.useProgram(t,i.programConfiguration),(o||f!==s)&&i.programConfiguration.setUniforms(r.gl,f,a,{zoom:r.transform.zoom})),r.gl.uniformMatrix4fv(f.u_matrix,!1,r.translatePosMatrix(n.posMatrix,l,a.paint["fill-translate"],a.paint["fill-translate-anchor"])),f}var pattern=_dereq_("./pattern");module.exports=drawFill; | |
},{"./pattern":78}],71:[function(_dereq_,module,exports){ | |
"use strict";function draw(t,e,r,i){if(0!==r.paint["fill-extrusion-opacity"]){var a=t.gl;a.disable(a.STENCIL_TEST),a.enable(a.DEPTH_TEST),t.depthMask(!0);var s=new ExtrusionTexture(a,t,r);s.bindFramebuffer(),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);for(var u=0;u<i.length;u++)drawExtrusion(t,e,r,i[u]);s.unbindFramebuffer(),s.renderToMap()}}function ExtrusionTexture(t,e,r){this.gl=t,this.width=e.width,this.height=e.height,this.painter=e,this.layer=r,this.texture=null,this.fbo=null,this.fbos=this.painter.preFbos[this.width]&&this.painter.preFbos[this.width][this.height]}function drawExtrusion(t,e,r,i){if(!t.isOpaquePass){var a=e.getTile(i),s=a.getBucket(r);if(s){var u=s.buffers,f=t.gl,n=r.paint["fill-extrusion-pattern"],o=u.layerData[r.id],h=o.programConfiguration,E=t.useProgram(n?"fillExtrusionPattern":"fillExtrusion",h);h.setUniforms(f,E,r,{zoom:t.transform.zoom}),n&&(pattern.prepare(n,t,E),pattern.setTile(a,t,E),f.uniform1f(E.u_height_factor,-Math.pow(2,i.z)/a.tileSize/8)),t.gl.uniformMatrix4fv(E.u_matrix,!1,t.translatePosMatrix(i.posMatrix,a,r.paint["fill-extrusion-translate"],r.paint["fill-extrusion-translate-anchor"])),setLight(E,t);for(var T=0,l=u.segments;T<l.length;T+=1){var x=l[T];x.vaos[r.id].bind(f,E,u.layoutVertexBuffer,u.elementBuffer,o.paintVertexBuffer,x.vertexOffset),f.drawElements(f.TRIANGLES,3*x.primitiveLength,f.UNSIGNED_SHORT,3*x.primitiveOffset*2)}}}}function setLight(t,e){var r=e.gl,i=e.style.light,a=i.calculated.position,s=[a.x,a.y,a.z],u=mat3.create();"viewport"===i.calculated.anchor&&mat3.fromRotation(u,-e.transform.angle),vec3.transformMat3(s,s,u),r.uniform3fv(t.u_lightpos,s),r.uniform1f(t.u_lightintensity,i.calculated.intensity),r.uniform3fv(t.u_lightcolor,i.calculated.color.slice(0,3))}var glMatrix=_dereq_("@mapbox/gl-matrix"),Buffer=_dereq_("../data/buffer"),VertexArrayObject=_dereq_("./vertex_array_object"),PosArray=_dereq_("../data/pos_array"),pattern=_dereq_("./pattern"),mat3=glMatrix.mat3,mat4=glMatrix.mat4,vec3=glMatrix.vec3;module.exports=draw,ExtrusionTexture.prototype.bindFramebuffer=function(){var t=this.gl;if(this.texture=this.painter.getViewportTexture(this.width,this.height),t.activeTexture(t.TEXTURE1),this.texture?t.bindTexture(t.TEXTURE_2D,this.texture):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,null),this.texture.width=this.width,this.texture.height=this.height),this.fbos)this.fbo=this.fbos.pop(),t.bindFramebuffer(t.FRAMEBUFFER,this.fbo),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.texture,0);else{this.fbo=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,this.fbo);var e=t.createRenderbuffer();t.bindRenderbuffer(t.RENDERBUFFER,e),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,this.width,this.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.texture,0)}},ExtrusionTexture.prototype.unbindFramebuffer=function(){this.painter.bindDefaultFramebuffer(),this.fbos?this.fbos.push(this.fbo):(this.painter.preFbos[this.width]||(this.painter.preFbos[this.width]={}),this.painter.preFbos[this.width][this.height]=[this.fbo]),this.painter.saveViewportTexture(this.texture)},ExtrusionTexture.prototype.renderToMap=function(){var t=this.gl,e=this.painter,r=e.useProgram("extrusionTexture");t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.texture),t.uniform1f(r.u_opacity,this.layer.paint["fill-extrusion-opacity"]),t.uniform1i(r.u_image,1),t.uniformMatrix4fv(r.u_matrix,!1,mat4.ortho(mat4.create(),0,e.width,e.height,0,0,1)),t.disable(t.DEPTH_TEST),t.uniform2f(r.u_world,t.drawingBufferWidth,t.drawingBufferHeight);var i=new PosArray;i.emplaceBack(0,0),i.emplaceBack(1,0),i.emplaceBack(0,1),i.emplaceBack(1,1);var a=Buffer.fromStructArray(i,Buffer.BufferType.VERTEX),s=new VertexArrayObject;s.bind(t,r,a),t.drawArrays(t.TRIANGLE_STRIP,0,4),t.enable(t.DEPTH_TEST)}; | |
},{"../data/buffer":51,"../data/pos_array":57,"./pattern":78,"./vertex_array_object":80,"@mapbox/gl-matrix":1}],72:[function(_dereq_,module,exports){ | |
"use strict";function drawLineTile(e,i,t,r,a,n,o,f,s){var l,u,m,_,p=i.gl,g=a.paint["line-dasharray"],d=a.paint["line-pattern"];if(f||s){var v=1/pixelsToTileUnits(t,1,i.transform.tileZoom);if(g){l=i.lineAtlas.getDash(g.from,"round"===a.layout["line-cap"]),u=i.lineAtlas.getDash(g.to,"round"===a.layout["line-cap"]);var T=l.width*g.fromScale,h=u.width*g.toScale;p.uniform2f(e.u_patternscale_a,v/T,-l.height/2),p.uniform2f(e.u_patternscale_b,v/h,-u.height/2),p.uniform1f(e.u_sdfgamma,i.lineAtlas.width/(256*Math.min(T,h)*browser.devicePixelRatio)/2)}else if(d){if(m=i.spriteAtlas.getPosition(d.from,!0),_=i.spriteAtlas.getPosition(d.to,!0),!m||!_)return;p.uniform2f(e.u_pattern_size_a,m.size[0]*d.fromScale/v,_.size[1]),p.uniform2f(e.u_pattern_size_b,_.size[0]*d.toScale/v,_.size[1])}p.uniform2f(e.u_gl_units_to_pixels,1/i.transform.pixelsToGLUnits[0],1/i.transform.pixelsToGLUnits[1])}f&&(g?(p.uniform1i(e.u_image,0),p.activeTexture(p.TEXTURE0),i.lineAtlas.bind(p),p.uniform1f(e.u_tex_y_a,l.y),p.uniform1f(e.u_tex_y_b,u.y),p.uniform1f(e.u_mix,g.t)):d&&(p.uniform1i(e.u_image,0),p.activeTexture(p.TEXTURE0),i.spriteAtlas.bind(p,!0),p.uniform2fv(e.u_pattern_tl_a,m.tl),p.uniform2fv(e.u_pattern_br_a,m.br),p.uniform2fv(e.u_pattern_tl_b,_.tl),p.uniform2fv(e.u_pattern_br_b,_.br),p.uniform1f(e.u_fade,d.t)),p.uniform1f(e.u_width,a.paint["line-width"])),i.enableTileClippingMask(n);var x=i.translatePosMatrix(n.posMatrix,t,a.paint["line-translate"],a.paint["line-translate-anchor"]);p.uniformMatrix4fv(e.u_matrix,!1,x),p.uniform1f(e.u_ratio,1/pixelsToTileUnits(t,1,i.transform.zoom));for(var b=0,c=r.segments;b<c.length;b+=1){var w=c[b];w.vaos[a.id].bind(p,e,r.layoutVertexBuffer,r.elementBuffer,o.paintVertexBuffer,w.vertexOffset),p.drawElements(p.TRIANGLES,3*w.primitiveLength,p.UNSIGNED_SHORT,3*w.primitiveOffset*2)}}var browser=_dereq_("../util/browser"),pixelsToTileUnits=_dereq_("../source/pixels_to_tile_units");module.exports=function(e,i,t,r){if(!e.isOpaquePass){e.setDepthSublayer(0),e.depthMask(!1);var a=e.gl;if(a.enable(a.STENCIL_TEST),!(t.paint["line-width"]<=0))for(var n,o=t.paint["line-dasharray"]?"lineSDF":t.paint["line-pattern"]?"linePattern":"line",f=!0,s=0,l=r;s<l.length;s+=1){var u=l[s],m=i.getTile(u),_=m.getBucket(t);if(_){var p=_.buffers.layerData[t.id],g=e.currentProgram,d=e.useProgram(o,p.programConfiguration),v=f||d!==g,T=n!==m.coord.z;v&&p.programConfiguration.setUniforms(e.gl,d,t,{zoom:e.transform.zoom}),drawLineTile(d,e,m,_.buffers,t,u,p,v,T),n=m.coord.z,f=!1}}}}; | |
},{"../source/pixels_to_tile_units":88,"../util/browser":195}],73:[function(_dereq_,module,exports){ | |
"use strict";function drawRaster(r,t,e,a){if(!r.isOpaquePass){var i=r.gl;i.enable(i.DEPTH_TEST),r.depthMask(!0),i.depthFunc(i.LESS);for(var o=a.length&&a[0].z,n=0;n<a.length;n++){var u=a[n];r.setDepthSublayer(u.z-o),drawRasterTile(r,t,e,u)}i.depthFunc(i.LEQUAL)}}function drawRasterTile(r,t,e,a){var i=r.gl;i.disable(i.STENCIL_TEST);var o=t.getTile(a),n=r.transform.calculatePosMatrix(a,t.getSource().maxzoom);o.registerFadeDuration(r.style.animationLoop,e.paint["raster-fade-duration"]);var u=r.useProgram("raster");i.uniformMatrix4fv(u.u_matrix,!1,n),i.uniform1f(u.u_brightness_low,e.paint["raster-brightness-min"]),i.uniform1f(u.u_brightness_high,e.paint["raster-brightness-max"]),i.uniform1f(u.u_saturation_factor,saturationFactor(e.paint["raster-saturation"])),i.uniform1f(u.u_contrast_factor,contrastFactor(e.paint["raster-contrast"])),i.uniform3fv(u.u_spin_weights,spinWeights(e.paint["raster-hue-rotate"]));var s,c,f=o.sourceCache&&o.sourceCache.findLoadedParent(a,0,{}),d=getFadeValues(o,f,e,r.transform);i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,o.texture),i.activeTexture(i.TEXTURE1),f?(i.bindTexture(i.TEXTURE_2D,f.texture),s=Math.pow(2,f.coord.z-o.coord.z),c=[o.coord.x*s%1,o.coord.y*s%1]):i.bindTexture(i.TEXTURE_2D,o.texture),i.uniform2fv(u.u_tl_parent,c||[0,0]),i.uniform1f(u.u_scale_parent,s||1),i.uniform1f(u.u_buffer_scale,1),i.uniform1f(u.u_fade_t,d.mix),i.uniform1f(u.u_opacity,d.opacity*e.paint["raster-opacity"]),i.uniform1i(u.u_image0,0),i.uniform1i(u.u_image1,1);var m=o.boundsBuffer||r.rasterBoundsBuffer,p=o.boundsVAO||r.rasterBoundsVAO;p.bind(i,u,m),i.drawArrays(i.TRIANGLE_STRIP,0,m.length)}function spinWeights(r){r*=Math.PI/180;var t=Math.sin(r),e=Math.cos(r);return[(2*e+1)/3,(-Math.sqrt(3)*t-e+1)/3,(Math.sqrt(3)*t-e+1)/3]}function contrastFactor(r){return r>0?1/(1-r):1+r}function saturationFactor(r){return r>0?1-1/(1.001-r):-r}function getFadeValues(r,t,e,a){var i=e.paint["raster-fade-duration"];if(r.sourceCache&&i>0){var o=Date.now(),n=(o-r.timeAdded)/i,u=t?(o-t.timeAdded)/i:-1,s=r.sourceCache.getSource(),c=a.coveringZoomLevel({tileSize:s.tileSize,roundZoom:s.roundZoom}),f=!t||Math.abs(t.coord.z-c)>Math.abs(r.coord.z-c),d=f&&r.refreshedUponExpiration?1:util.clamp(f?n:1-u,0,1);return r.refreshedUponExpiration&&n>=1&&(r.refreshedUponExpiration=!1),t?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}var util=_dereq_("../util/util");module.exports=drawRaster; | |
},{"../util/util":215}],74:[function(_dereq_,module,exports){ | |
"use strict";function drawSymbols(t,e,i,o){if(!t.isOpaquePass){var a=!(i.layout["text-allow-overlap"]||i.layout["icon-allow-overlap"]||i.layout["text-ignore-placement"]||i.layout["icon-ignore-placement"]),n=t.gl;a?n.disable(n.STENCIL_TEST):n.enable(n.STENCIL_TEST),t.setDepthSublayer(0),t.depthMask(!1),drawLayerSymbols(t,e,i,o,!1,i.paint["icon-translate"],i.paint["icon-translate-anchor"],i.layout["icon-rotation-alignment"],i.layout["icon-rotation-alignment"]),drawLayerSymbols(t,e,i,o,!0,i.paint["text-translate"],i.paint["text-translate-anchor"],i.layout["text-rotation-alignment"],i.layout["text-pitch-alignment"]),e.map.showCollisionBoxes&&drawCollisionDebug(t,e,i,o)}}function drawLayerSymbols(t,e,i,o,a,n,r,s,l){if(a||!t.style.sprite||t.style.sprite.loaded()){var u=t.gl,m="map"===s,f="map"===l,c=f;c?u.enable(u.DEPTH_TEST):u.disable(u.DEPTH_TEST);for(var p,_,g=0,y=o;g<y.length;g+=1){var d=y[g],T=e.getTile(d),v=T.getBucket(i);if(v){var h=a?v.buffers.glyph:v.buffers.icon;if(h&&h.segments.length){var x=h.layerData[i.id],b=x.programConfiguration,S=a||v.sdfIcons,z=a?v.textSizeData:v.iconSizeData;p&&v.fontstack===_||(p=t.useProgram(S?"symbolSDF":"symbolIcon",b),b.setUniforms(u,p,i,{zoom:t.transform.zoom}),setSymbolDrawState(p,t,i,d.z,a,S,m,f,v.fontstack,v.iconsNeedLinear,z)),t.enableTileClippingMask(d),u.uniformMatrix4fv(p.u_matrix,!1,t.translatePosMatrix(d.posMatrix,T,n,r)),drawTileSymbols(p,b,t,i,T,h,a,S,f),_=v.fontstack}}}c||u.enable(u.DEPTH_TEST)}}function setSymbolDrawState(t,e,i,o,a,n,r,s,l,u,m){var f=e.gl,c=e.transform;if(f.uniform1i(t.u_rotate_with_map,r),f.uniform1i(t.u_pitch_with_map,s),f.activeTexture(f.TEXTURE0),f.uniform1i(t.u_texture,0),f.uniform1f(t.u_is_text,a?1:0),a){var p=l&&e.glyphSource.getGlyphAtlas(l);if(!p)return;p.updateTexture(f),f.uniform2f(t.u_texsize,p.width/4,p.height/4)}else{var _=e.options.rotating||e.options.zooming,g=!i.isLayoutValueFeatureConstant("icon-size")||!i.isLayoutValueZoomConstant("icon-size")||1!==i.getLayoutValue("icon-size",{zoom:c.zoom}),y=g||browser.devicePixelRatio!==e.spriteAtlas.pixelRatio||u,d=s||c.pitch;e.spriteAtlas.bind(f,n||_||y||d),f.uniform2f(t.u_texsize,e.spriteAtlas.width/4,e.spriteAtlas.height/4)}if(f.activeTexture(f.TEXTURE1),e.frameHistory.bind(f),f.uniform1i(t.u_fadetexture,1),f.uniform1f(t.u_zoom,c.zoom),f.uniform1f(t.u_pitch,c.pitch/360*2*Math.PI),f.uniform1f(t.u_bearing,c.bearing/360*2*Math.PI),f.uniform1f(t.u_aspect_ratio,c.width/c.height),f.uniform1i(t.u_is_size_zoom_constant,m.isZoomConstant?1:0),f.uniform1i(t.u_is_size_feature_constant,m.isFeatureConstant?1:0),m.isZoomConstant||m.isFeatureConstant)if(m.isFeatureConstant&&!m.isZoomConstant){var T;if("interval"===m.functionType)T=i.getLayoutValue(a?"text-size":"icon-size",{zoom:c.zoom});else{var v="interval"===m.functionType?0:interpolationFactor(c.zoom,m.functionBase,m.coveringZoomRange[0],m.coveringZoomRange[1]),h=m.coveringStopValues[0],x=m.coveringStopValues[1];T=h+(x-h)*util.clamp(v,0,1)}f.uniform1f(t.u_size,T),f.uniform1f(t.u_layout_size,m.layoutSize)}else m.isFeatureConstant&&m.isZoomConstant&&f.uniform1f(t.u_size,m.layoutSize);else{var b=interpolationFactor(c.zoom,m.functionBase,m.coveringZoomRange[0],m.coveringZoomRange[1]);f.uniform1f(t.u_size_t,util.clamp(b,0,1))}}function drawTileSymbols(t,e,i,o,a,n,r,s,l){var u=i.gl,m=i.transform;if(l){var f=pixelsToTileUnits(a,1,m.zoom);u.uniform2f(t.u_extrude_scale,f,f)}else{var c=m.cameraToCenterDistance;u.uniform2f(t.u_extrude_scale,m.pixelsToGLUnits[0]*c,m.pixelsToGLUnits[1]*c)}if(s){var p=(r?"text":"icon")+"-halo-width",_=!o.isPaintValueFeatureConstant(p)||o.paint[p],g=(l?Math.cos(m._pitch):1)*m.cameraToCenterDistance;u.uniform1f(t.u_gamma_scale,g),_&&(u.uniform1f(t.u_is_halo,1),drawSymbolElements(n,o,u,t)),u.uniform1f(t.u_is_halo,0)}drawSymbolElements(n,o,u,t)}function drawSymbolElements(t,e,i,o){for(var a=t.layerData[e.id],n=a&&a.paintVertexBuffer,r=0,s=t.segments;r<s.length;r+=1){var l=s[r];l.vaos[e.id].bind(i,o,t.layoutVertexBuffer,t.elementBuffer,n,l.vertexOffset),i.drawElements(i.TRIANGLES,3*l.primitiveLength,i.UNSIGNED_SHORT,3*l.primitiveOffset*2)}}var util=_dereq_("../util/util"),browser=_dereq_("../util/browser"),drawCollisionDebug=_dereq_("./draw_collision_debug"),pixelsToTileUnits=_dereq_("../source/pixels_to_tile_units"),interpolationFactor=_dereq_("../style-spec/function").interpolationFactor;module.exports=drawSymbols; | |
},{"../source/pixels_to_tile_units":88,"../style-spec/function":107,"../util/browser":195,"../util/util":215,"./draw_collision_debug":68}],75:[function(_dereq_,module,exports){ | |
"use strict";var FrameHistory=function(){this.changeTimes=new Float64Array(256),this.changeOpacities=new Uint8Array(256),this.opacities=new Uint8ClampedArray(256),this.array=new Uint8Array(this.opacities.buffer),this.previousZoom=0,this.firstFrame=!0};FrameHistory.prototype.record=function(e,t,i){var r=this;this.firstFrame&&(e=0,this.firstFrame=!1),t=Math.floor(10*t);var a;if(t<this.previousZoom)for(a=t+1;a<=this.previousZoom;a++)r.changeTimes[a]=e,r.changeOpacities[a]=r.opacities[a];else for(a=t;a>this.previousZoom;a--)r.changeTimes[a]=e,r.changeOpacities[a]=r.opacities[a];for(a=0;a<256;a++){var s=e-r.changeTimes[a],o=255*(i?s/i:1);a<=t?r.opacities[a]=r.changeOpacities[a]+o:r.opacities[a]=r.changeOpacities[a]-o}this.changed=!0,this.previousZoom=t},FrameHistory.prototype.bind=function(e){this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.changed&&(e.texSubImage2D(e.TEXTURE_2D,0,0,0,256,1,e.ALPHA,e.UNSIGNED_BYTE,this.array),this.changed=!1)):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,256,1,0,e.ALPHA,e.UNSIGNED_BYTE,this.array))},module.exports=FrameHistory; | |
},{}],76:[function(_dereq_,module,exports){ | |
"use strict";var util=_dereq_("../util/util"),LineAtlas=function(t,i){this.width=t,this.height=i,this.nextRow=0,this.bytes=4,this.data=new Uint8Array(this.width*this.height*this.bytes),this.positions={}};LineAtlas.prototype.setSprite=function(t){this.sprite=t},LineAtlas.prototype.getDash=function(t,i){var e=t.join(",")+i;return this.positions[e]||(this.positions[e]=this.addDash(t,i)),this.positions[e]},LineAtlas.prototype.addDash=function(t,i){var e=this,h=i?7:0,s=2*h+1,a=128;if(this.nextRow+s>this.height)return util.warnOnce("LineAtlas out of space"),null;for(var r=0,n=0;n<t.length;n++)r+=t[n];for(var o=this.width/r,E=o/2,T=t.length%2===1,R=-h;R<=h;R++)for(var u=e.nextRow+h+R,d=e.width*u,l=T?-t[t.length-1]:0,x=t[0],A=1,_=0;_<this.width;_++){for(;x<_/o;)l=x,x+=t[A],T&&A===t.length-1&&(x+=t[0]),A++;var p=Math.abs(_-l*o),g=Math.abs(_-x*o),w=Math.min(p,g),D=A%2===1,U=void 0;if(i){var f=h?R/h*(E+1):0;if(D){var X=E-Math.abs(f);U=Math.sqrt(w*w+X*X)}else U=E-Math.sqrt(w*w+f*f)}else U=(D?1:-1)*w;e.data[3+4*(d+_)]=Math.max(0,Math.min(255,U+a))}var v={y:(this.nextRow+h+.5)/this.height,height:2*h/this.height,width:r};return this.nextRow+=s,this.dirty=!0,v},LineAtlas.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.RGBA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,this.data))},module.exports=LineAtlas; | |
},{"../util/util":215}],77:[function(_dereq_,module,exports){ | |
"use strict";var browser=_dereq_("../util/browser"),mat4=_dereq_("@mapbox/gl-matrix").mat4,FrameHistory=_dereq_("./frame_history"),SourceCache=_dereq_("../source/source_cache"),EXTENT=_dereq_("../data/extent"),pixelsToTileUnits=_dereq_("../source/pixels_to_tile_units"),util=_dereq_("../util/util"),Buffer=_dereq_("../data/buffer"),VertexArrayObject=_dereq_("./vertex_array_object"),RasterBoundsArray=_dereq_("../data/raster_bounds_array"),PosArray=_dereq_("../data/pos_array"),ProgramConfiguration=_dereq_("../data/program_configuration"),shaders=_dereq_("./shaders"),draw={symbol:_dereq_("./draw_symbol"),circle:_dereq_("./draw_circle"),line:_dereq_("./draw_line"),fill:_dereq_("./draw_fill"),"fill-extrusion":_dereq_("./draw_fill_extrusion"),raster:_dereq_("./draw_raster"),background:_dereq_("./draw_background"),debug:_dereq_("./draw_debug")},Painter=function(e,r){this.gl=e,this.transform=r,this.reusableTextures={tiles:{},viewport:null},this.preFbos={},this.frameHistory=new FrameHistory,this.setup(),this.numSublayers=SourceCache.maxUnderzooming+SourceCache.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.lineWidthRange=e.getParameter(e.ALIASED_LINE_WIDTH_RANGE),this.basicFillProgramConfiguration=ProgramConfiguration.createStatic(["color","opacity"]),this.emptyProgramConfiguration=new ProgramConfiguration};Painter.prototype.resize=function(e,r){var t=this.gl;this.width=e*browser.devicePixelRatio,this.height=r*browser.devicePixelRatio,t.viewport(0,0,this.width,this.height)},Painter.prototype.setup=function(){var e=this.gl;e.verbose=!0,e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),e.enable(e.STENCIL_TEST),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),this._depthMask=!1,e.depthMask(!1);var r=new PosArray;r.emplaceBack(0,0),r.emplaceBack(EXTENT,0),r.emplaceBack(0,EXTENT),r.emplaceBack(EXTENT,EXTENT),this.tileExtentBuffer=Buffer.fromStructArray(r,Buffer.BufferType.VERTEX),this.tileExtentVAO=new VertexArrayObject,this.tileExtentPatternVAO=new VertexArrayObject;var t=new PosArray;t.emplaceBack(0,0),t.emplaceBack(EXTENT,0),t.emplaceBack(EXTENT,EXTENT),t.emplaceBack(0,EXTENT),t.emplaceBack(0,0),this.debugBuffer=Buffer.fromStructArray(t,Buffer.BufferType.VERTEX),this.debugVAO=new VertexArrayObject;var i=new RasterBoundsArray;i.emplaceBack(0,0,0,0),i.emplaceBack(EXTENT,0,32767,0),i.emplaceBack(0,EXTENT,0,32767),i.emplaceBack(EXTENT,EXTENT,32767,32767),this.rasterBoundsBuffer=Buffer.fromStructArray(i,Buffer.BufferType.VERTEX),this.rasterBoundsVAO=new VertexArrayObject,this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))},Painter.prototype.clearColor=function(){var e=this.gl;e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)},Painter.prototype.clearStencil=function(){var e=this.gl;e.clearStencil(0),e.stencilMask(255),e.clear(e.STENCIL_BUFFER_BIT)},Painter.prototype.clearDepth=function(){var e=this.gl;e.clearDepth(1),this.depthMask(!0),e.clear(e.DEPTH_BUFFER_BIT)},Painter.prototype._renderTileClippingMasks=function(e){var r=this,t=this.gl;t.colorMask(!1,!1,!1,!1),this.depthMask(!1),t.disable(t.DEPTH_TEST),t.enable(t.STENCIL_TEST),t.stencilMask(255),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE);var i=1;this._tileClippingMaskIDs={};for(var a=0,s=e;a<s.length;a+=1){var o=s[a],n=r._tileClippingMaskIDs[o.id]=i++;t.stencilFunc(t.ALWAYS,n,255);var l=r.useProgram("fill",r.basicFillProgramConfiguration);t.uniformMatrix4fv(l.u_matrix,!1,o.posMatrix),r.tileExtentVAO.bind(t,l,r.tileExtentBuffer),t.drawArrays(t.TRIANGLE_STRIP,0,r.tileExtentBuffer.length)}t.stencilMask(0),t.colorMask(!0,!0,!0,!0),this.depthMask(!0),t.enable(t.DEPTH_TEST)},Painter.prototype.enableTileClippingMask=function(e){var r=this.gl;r.stencilFunc(r.EQUAL,this._tileClippingMaskIDs[e.id],255)},Painter.prototype.prepareBuffers=function(){},Painter.prototype.bindDefaultFramebuffer=function(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null)},Painter.prototype.render=function(e,r){if(this.style=e,this.options=r,this.lineAtlas=e.lineAtlas,this.spriteAtlas=e.spriteAtlas,this.spriteAtlas.setSprite(e.sprite),this.glyphSource=e.glyphSource,this.frameHistory.record(Date.now(),this.transform.zoom,e.getTransition().duration),this.prepareBuffers(),this.clearColor(),this.clearDepth(),this.showOverdrawInspector(r.showOverdrawInspector),this.depthRange=(e._order.length+2)*this.numSublayers*this.depthEpsilon,this.isOpaquePass=!0,this.renderPass(),this.isOpaquePass=!1,this.renderPass(),this.options.showTileBoundaries){var t=this.style.sourceCaches[Object.keys(this.style.sourceCaches)[0]];t&&draw.debug(this,t,t.getVisibleCoordinates())}},Painter.prototype.renderPass=function(){var e,r,t=this,i=this.style._order;this.currentLayer=this.isOpaquePass?i.length-1:0,this.isOpaquePass?this._showOverdrawInspector||this.gl.disable(this.gl.BLEND):this.gl.enable(this.gl.BLEND);for(var a=0;a<i.length;a++){var s=t.style._layers[i[t.currentLayer]];s.source!==(e&&e.id)&&(e=t.style.sourceCaches[s.source],r=[],e&&(e.prepare&&e.prepare(),t.clearStencil(),r=e.getVisibleCoordinates(),e.getSource().isTileClipped&&t._renderTileClippingMasks(r)),t.isOpaquePass||r.reverse()),t.renderLayer(t,e,s,r),t.currentLayer+=t.isOpaquePass?-1:1}},Painter.prototype.depthMask=function(e){e!==this._depthMask&&(this._depthMask=e,this.gl.depthMask(e))},Painter.prototype.renderLayer=function(e,r,t,i){t.isHidden(this.transform.zoom)||("background"===t.type||i.length)&&(this.id=t.id,draw[t.type](e,r,t,i))},Painter.prototype.setDepthSublayer=function(e){var r=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon,t=r-1+this.depthRange;this.gl.depthRange(t,r)},Painter.prototype.translatePosMatrix=function(e,r,t,i){if(!t[0]&&!t[1])return e;if("viewport"===i){var a=Math.sin(-this.transform.angle),s=Math.cos(-this.transform.angle);t=[t[0]*s-t[1]*a,t[0]*a+t[1]*s]}var o=[pixelsToTileUnits(r,t[0],this.transform.zoom),pixelsToTileUnits(r,t[1],this.transform.zoom),0],n=new Float32Array(16);return mat4.translate(n,e,o),n},Painter.prototype.saveTileTexture=function(e){var r=this.reusableTextures.tiles[e.size];r?r.push(e):this.reusableTextures.tiles[e.size]=[e]},Painter.prototype.saveViewportTexture=function(e){this.reusableTextures.viewport=e},Painter.prototype.getTileTexture=function(e){var r=this.reusableTextures.tiles[e];return r&&r.length>0?r.pop():null},Painter.prototype.getViewportTexture=function(e,r){var t=this.reusableTextures.viewport;if(t)return t.width===e&&t.height===r?t:(this.gl.deleteTexture(t),void(this.reusableTextures.viewport=null))},Painter.prototype.lineWidth=function(e){this.gl.lineWidth(util.clamp(e,this.lineWidthRange[0],this.lineWidthRange[1]))},Painter.prototype.showOverdrawInspector=function(e){if(e||this._showOverdrawInspector){this._showOverdrawInspector=e;var r=this.gl;if(e){r.blendFunc(r.CONSTANT_COLOR,r.ONE);var t=8,i=1/t;r.blendColor(i,i,i,0),r.clearColor(0,0,0,1),r.clear(r.COLOR_BUFFER_BIT)}else r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA)}},Painter.prototype.createProgram=function(e,r){var t=this.gl,i=t.createProgram(),a=shaders[e],s="#define MAPBOX_GL_JS\n#define DEVICE_PIXEL_RATIO "+browser.devicePixelRatio.toFixed(1)+"\n";this._showOverdrawInspector&&(s+="#define OVERDRAW_INSPECTOR;\n");var o=r.applyPragmas(s+shaders.prelude.fragmentSource+a.fragmentSource,"fragment"),n=r.applyPragmas(s+shaders.prelude.vertexSource+a.vertexSource,"vertex"),l=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(l,o),t.compileShader(l),t.attachShader(i,l);var h=t.createShader(t.VERTEX_SHADER);t.shaderSource(h,n),t.compileShader(h),t.attachShader(i,h),t.linkProgram(i);for(var u=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES),c={program:i,numAttributes:u},p=0;p<u;p++){var d=t.getActiveAttrib(i,p);c[d.name]=t.getAttribLocation(i,d.name)}for(var f=t.getProgramParameter(i,t.ACTIVE_UNIFORMS),g=0;g<f;g++){var T=t.getActiveUniform(i,g);c[T.name]=t.getUniformLocation(i,T.name)}return c},Painter.prototype._createProgramCached=function(e,r){this.cache=this.cache||{};var t=""+e+(r.cacheKey||"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[t]||(this.cache[t]=this.createProgram(e,r)),this.cache[t]},Painter.prototype.useProgram=function(e,r){var t=this.gl,i=this._createProgramCached(e,r||this.emptyProgramConfiguration);return this.currentProgram!==i&&(t.useProgram(i.program),this.currentProgram=i),i},module.exports=Painter; | |
},{"../data/buffer":51,"../data/extent":54,"../data/pos_array":57,"../data/program_configuration":58,"../data/raster_bounds_array":59,"../source/pixels_to_tile_units":88,"../source/source_cache":93,"../util/browser":195,"../util/util":215,"./draw_background":66,"./draw_circle":67,"./draw_debug":69,"./draw_fill":70,"./draw_fill_extrusion":71,"./draw_line":72,"./draw_raster":73,"./draw_symbol":74,"./frame_history":75,"./shaders":79,"./vertex_array_object":80,"@mapbox/gl-matrix":1}],78:[function(_dereq_,module,exports){ | |
"use strict";var pixelsToTileUnits=_dereq_("../source/pixels_to_tile_units");exports.prepare=function(r,t,i){var o=t.gl,e=t.spriteAtlas.getPosition(r.from,!0),_=t.spriteAtlas.getPosition(r.to,!0);e&&_&&(o.uniform1i(i.u_image,0),o.uniform2fv(i.u_pattern_tl_a,e.tl),o.uniform2fv(i.u_pattern_br_a,e.br),o.uniform2fv(i.u_pattern_tl_b,_.tl),o.uniform2fv(i.u_pattern_br_b,_.br),o.uniform1f(i.u_mix,r.t),o.uniform2fv(i.u_pattern_size_a,e.size),o.uniform2fv(i.u_pattern_size_b,_.size),o.uniform1f(i.u_scale_a,r.fromScale),o.uniform1f(i.u_scale_b,r.toScale),o.activeTexture(o.TEXTURE0),t.spriteAtlas.bind(o,!0))},exports.setTile=function(r,t,i){var o=t.gl;o.uniform1f(i.u_tile_units_to_pixels,1/pixelsToTileUnits(r,1,t.transform.tileZoom));var e=Math.pow(2,r.coord.z),_=r.tileSize*Math.pow(2,t.transform.tileZoom)/e,u=_*(r.coord.x+r.coord.w*e),n=_*r.coord.y;o.uniform2f(i.u_pixel_coord_upper,u>>16,n>>16),o.uniform2f(i.u_pixel_coord_lower,65535&u,65535&n)}; | |
},{"../source/pixels_to_tile_units":88}],79:[function(_dereq_,module,exports){ | |
"use strict";var path=_dereq_("path");module.exports={prelude:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif\n\nfloat evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n\n// Unpack a pair of values that have been packed into a single float.\n// The packed values are assumed to be 8-bit unsigned integers, and are\n// packed like so:\n// packedValue = floor(input[0]) * 256 + input[1],\nvec2 unpack_float(const float packedValue) {\n int packedIntValue = int(packedValue);\n int v0 = packedIntValue / 256;\n return vec2(v0, packedIntValue - v0 * 256);\n}\n\n\n// To minimize the number of attributes needed in the mapbox-gl-native shaders,\n// we encode a 4-component color into a pair of floats (i.e. a vec2) as follows:\n// [ floor(color.r * 255) * 256 + color.g * 255,\n// floor(color.b * 255) * 256 + color.g * 255 ]\nvec4 decode_color(const vec2 encodedColor) {\n return vec4(\n unpack_float(encodedColor[0]) / 255.0,\n unpack_float(encodedColor[1]) / 255.0\n );\n}\n\n// Unpack a pair of paint values and interpolate between them.\nfloat unpack_mix_vec2(const vec2 packedValue, const float t) {\n return mix(packedValue[0], packedValue[1], t);\n}\n\n// Unpack a pair of paint values and interpolate between them.\nvec4 unpack_mix_vec4(const vec4 packedColors, const float t) {\n vec4 minColor = decode_color(vec2(packedColors[0], packedColors[1]));\n vec4 maxColor = decode_color(vec2(packedColors[2], packedColors[3]));\n return mix(minColor, maxColor, t);\n}\n\n// The offset depends on how many pixels are between the world origin and the edge of the tile:\n// vec2 offset = mod(pixel_coord, size)\n//\n// At high zoom levels there are a ton of pixels between the world origin and the edge of the tile.\n// The glsl spec only guarantees 16 bits of precision for highp floats. We need more than that.\n//\n// The pixel_coord is passed in as two 16 bit values:\n// pixel_coord_upper = floor(pixel_coord / 2^16)\n// pixel_coord_lower = mod(pixel_coord, 2^16)\n//\n// The offset is calculated in a series of steps that should preserve this precision:\nvec2 get_pattern_pos(const vec2 pixel_coord_upper, const vec2 pixel_coord_lower,\n const vec2 pattern_size, const float tile_units_to_pixels, const vec2 pos) {\n\n vec2 offset = mod(mod(mod(pixel_coord_upper, pattern_size) * 256.0, pattern_size) * 256.0 + pixel_coord_lower, pattern_size);\n return (tile_units_to_pixels * pos + offset) / pattern_size;\n}\n"},circle:{fragmentSource:"#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\n\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize mediump float radius\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize highp vec4 stroke_color\n #pragma mapbox: initialize mediump float stroke_width\n #pragma mapbox: initialize lowp float stroke_opacity\n\n float extrude_length = length(v_extrude);\n float antialiased_blur = -max(blur, v_antialiasblur);\n\n float opacity_t = smoothstep(0.0, antialiased_blur, extrude_length - 1.0);\n\n float color_t = stroke_width < 0.01 ? 0.0 : smoothstep(\n antialiased_blur,\n 0.0,\n extrude_length - radius / (radius + stroke_width)\n );\n\n gl_FragColor = opacity_t * mix(color * opacity, stroke_color * stroke_opacity, color_t);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform bool u_scale_with_map;\nuniform vec2 u_extrude_scale;\n\nattribute vec2 a_pos;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\n\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main(void) {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize mediump float radius\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize highp vec4 stroke_color\n #pragma mapbox: initialize mediump float stroke_width\n #pragma mapbox: initialize lowp float stroke_opacity\n\n // unencode the extrusion vector that we snuck into the a_pos vector\n v_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);\n\n vec2 extrude = v_extrude * (radius + stroke_width) * u_extrude_scale;\n // multiply a_pos by 0.5, since we had it * 2 in order to sneak\n // in extrusion data\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0, 1);\n\n if (u_scale_with_map) {\n gl_Position.xy += extrude;\n } else {\n gl_Position.xy += extrude * gl_Position.w;\n }\n\n // This is a minimum blur distance that serves as a faux-antialiasing for\n // the circle. since blur is a ratio of the circle's size and the intent is\n // to keep the blur at roughly 1px, the two are inversely related.\n v_antialiasblur = 1.0 / DEVICE_PIXEL_RATIO / (radius + stroke_width);\n}\n"},collisionBox:{fragmentSource:"uniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n",vertexSource:"attribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n"},debug:{fragmentSource:"uniform highp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, step(32767.0, a_pos.x), 1);\n}\n"},fill:{fragmentSource:"#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_FragColor = color * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},fillOutline:{fragmentSource:"#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = 1.0 - smoothstep(0.0, 1.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},fillOutlinePattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = 1.0 - smoothstep(0.0, 1.0, dist);\n\n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos);\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},fillPattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos);\n}\n"},fillExtrusion:{fragmentSource:"varying vec4 v_color;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define highp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n #pragma mapbox: initialize highp vec4 color\n\n gl_FragColor = v_color;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\n\nattribute vec2 a_pos;\nattribute vec3 a_normal;\nattribute float a_edgedistance;\n\nvarying vec4 v_color;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\n#pragma mapbox: define highp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n #pragma mapbox: initialize highp vec4 color\n\n base = max(0.0, base);\n height = max(0.0, height);\n\n float ed = a_edgedistance; // use each attrib in order to not trip a VAO assert\n float t = mod(a_normal.x, 2.0);\n\n gl_Position = u_matrix * vec4(a_pos, t > 0.0 ? height : base, 1);\n\n // Relative luminance (how dark/bright is the surface color?)\n float colorvalue = color.r * 0.2126 + color.g * 0.7152 + color.b * 0.0722;\n\n v_color = vec4(0.0, 0.0, 0.0, 1.0);\n\n // Add slight ambient lighting so no extrusions are totally black\n vec4 ambientlight = vec4(0.03, 0.03, 0.03, 1.0);\n color += ambientlight;\n\n // Calculate cos(theta), where theta is the angle between surface normal and diffuse light ray\n float directional = clamp(dot(a_normal / 16384.0, u_lightpos), 0.0, 1.0);\n\n // Adjust directional so that\n // the range of values for highlight/shading is narrower\n // with lower light intensity\n // and with lighter/brighter surface colors\n directional = mix((1.0 - u_lightintensity), max((1.0 - colorvalue + u_lightintensity), 1.0), directional);\n\n // Add gradient along z axis of side surfaces\n if (a_normal.y != 0.0) {\n directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);\n }\n\n // Assign final color based on surface + ambient light color, diffuse light directional, and light color\n // with lower bounds adjusted to hue of light\n // so that shading is tinted with the complementary (opposite) color to the light color\n v_color.r += clamp(color.r * directional * u_lightcolor.r, mix(0.0, 0.3, 1.0 - u_lightcolor.r), 1.0);\n v_color.g += clamp(color.g * directional * u_lightcolor.g, mix(0.0, 0.3, 1.0 - u_lightcolor.g), 1.0);\n v_color.b += clamp(color.b * directional * u_lightcolor.b, mix(0.0, 0.3, 1.0 - u_lightcolor.b), 1.0);\n}\n"},fillExtrusionPattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec4 v_lighting;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n vec4 mixedColor = mix(color1, color2, u_mix);\n\n gl_FragColor = mixedColor * v_lighting;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\nuniform float u_height_factor;\n\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\n\nattribute vec2 a_pos;\nattribute vec3 a_normal;\nattribute float a_edgedistance;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec4 v_lighting;\nvarying float v_directional;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n\n base = max(0.0, base);\n height = max(0.0, height);\n\n float t = mod(a_normal.x, 2.0);\n float z = t > 0.0 ? height : base;\n\n gl_Position = u_matrix * vec4(a_pos, z, 1);\n\n vec2 pos = a_normal.x == 1.0 && a_normal.y == 0.0 && a_normal.z == 16384.0\n ? a_pos // extrusion top\n : vec2(a_edgedistance, z * u_height_factor); // extrusion side\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, pos);\n\n v_lighting = vec4(0.0, 0.0, 0.0, 1.0);\n float directional = clamp(dot(a_normal / 16383.0, u_lightpos), 0.0, 1.0);\n directional = mix((1.0 - u_lightintensity), max((0.5 + u_lightintensity), 1.0), directional);\n\n if (a_normal.y != 0.0) {\n directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);\n }\n\n v_lighting.rgb += clamp(directional * u_lightcolor, mix(vec3(0.0), vec3(0.3), 1.0 - u_lightcolor), vec3(1.0));\n}\n"},extrusionTexture:{fragmentSource:"uniform sampler2D u_image;\nuniform float u_opacity;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_pos) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(0.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_world;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos * u_world, 0, 1);\n\n v_pos.x = a_pos.x;\n v_pos.y = 1.0 - a_pos.y;\n}\n"},line:{fragmentSource:"#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_width2;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_width;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n\n // these transformations used to be applied in the JS and native code bases. \n // moved them into the shader for clarity and simplicity. \n gapwidth = gapwidth / 2.0;\n float width = u_width / 2.0;\n offset = -1.0 * offset; \n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + width * (gapwidth > 0.0 ? 2.0 : 1.0) + ANTIALIASING;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit to get the position\n vec2 pos = floor(a_pos * 0.5);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_width2 = vec2(outset, inset);\n}\n"},linePattern:{fragmentSource:"uniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * v_width2.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_width2.s / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n gl_FragColor = color * alpha * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_width;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float gapwidth\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases. \n // moved them into the shader for clarity and simplicity. \n gapwidth = gapwidth / 2.0;\n float width = u_width / 2.0;\n offset = -1.0 * offset; \n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + width * (gapwidth > 0.0 ? 2.0 : 1.0) + ANTIALIASING;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit to get the position\n vec2 pos = floor(a_pos * 0.5);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_linesofar = a_linesofar;\n v_width2 = vec2(outset, inset);\n}\n"},lineSDF:{fragmentSource:"\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform vec2 u_gl_units_to_pixels;\nuniform mediump float u_width;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases. \n // moved them into the shader for clarity and simplicity. \n gapwidth = gapwidth / 2.0;\n float width = u_width / 2.0;\n offset = -1.0 * offset;\n \n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + width * (gapwidth > 0.0 ? 2.0 : 1.0) + ANTIALIASING;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist =outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit to get the position\n vec2 pos = floor(a_pos * 0.5);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n v_width2 = vec2(outset, inset);\n}\n" | |
},raster:{fragmentSource:"uniform float u_fade_t;\nuniform float u_opacity;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n vec4 color = mix(color0, color1, u_fade_t);\n color.a *= u_opacity;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb) * color.a, color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},symbolIcon:{fragmentSource:"uniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\n\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:'\nattribute vec4 a_pos_offset;\nattribute vec4 a_data;\n\n// icon-size data (see symbol_sdf.vertex.glsl for more)\nattribute vec3 a_size;\nuniform bool u_is_size_zoom_constant;\nuniform bool u_is_size_feature_constant;\nuniform mediump float u_size_t; // used to interpolate between zoom stops when size is a composite function\nuniform mediump float u_size; // used when size is both zoom and feature constant\nuniform mediump float u_layout_size; // used when size is feature constant\n\n#pragma mapbox: define lowp float opacity\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform bool u_is_text;\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 a_pos = a_pos_offset.xy;\n vec2 a_offset = a_pos_offset.zw;\n\n vec2 a_tex = a_data.xy;\n mediump vec2 label_data = unpack_float(a_data[2]);\n mediump float a_labelminzoom = label_data[0];\n mediump vec2 a_zoom = unpack_float(a_data[3]);\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n float size;\n // In order to accommodate placing labels around corners in\n // symbol-placement: line, each glyph in a label could have multiple\n // "quad"s only one of which should be shown at a given zoom level.\n // The min/max zoom assigned to each quad is based on the font size at\n // the vector tile\'s zoom level, which might be different than at the\n // currently rendered zoom level if text-size is zoom-dependent.\n // Thus, we compensate for this difference by calculating an adjustment\n // based on the scale of rendered text size relative to layout text size.\n mediump float layoutSize;\n if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = mix(a_size[0], a_size[1], u_size_t) / 10.0;\n layoutSize = a_size[2] / 10.0;\n } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = a_size[0] / 10.0;\n layoutSize = size;\n } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {\n size = u_size;\n layoutSize = u_layout_size;\n } else {\n size = u_size;\n layoutSize = u_size;\n }\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n mediump float zoomAdjust = log2(size / layoutSize);\n mediump float adjustedZoom = (u_zoom - zoomAdjust) * 10.0;\n // result: z = 0 if a_minzoom <= adjustedZoom < a_maxzoom, and 1 otherwise\n mediump float z = 2.0 - step(a_minzoom, adjustedZoom) - (1.0 - step(a_maxzoom, adjustedZoom));\n\n vec2 extrude = fontScale * u_extrude_scale * (a_offset / 64.0);\n if (u_rotate_with_map) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n'},symbolSDF:{fragmentSource:"#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105/DEVICE_PIXEL_RATIO\n\nuniform bool u_is_halo;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform highp float u_gamma_scale;\nuniform bool u_is_text;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\nvarying float v_size;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 fill_color\n #pragma mapbox: initialize highp vec4 halo_color\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float halo_width\n #pragma mapbox: initialize lowp float halo_blur\n\n float fontScale = u_is_text ? v_size / 24.0 : v_size;\n\n lowp vec4 color = fill_color;\n highp float gamma = EDGE_GAMMA / (fontScale * u_gamma_scale);\n lowp float buff = (256.0 - 64.0) / 256.0;\n if (u_is_halo) {\n color = halo_color;\n gamma = (halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_gamma_scale);\n buff = (6.0 - halo_width / fontScale) / SDF_PX;\n }\n\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n highp float gamma_scaled = gamma * v_gamma_scale;\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist) * fade_alpha;\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"const float PI = 3.141592653589793;\n\nattribute vec4 a_pos_offset;\nattribute vec4 a_data;\n\n// contents of a_size vary based on the type of property value\n// used for {text,icon}-size.\n// For constants, a_size is disabled.\n// For source functions, we bind only one value per vertex: the value of {text,icon}-size evaluated for the current feature.\n// For composite functions:\n// [ text-size(lowerZoomStop, feature),\n// text-size(upperZoomStop, feature),\n// layoutSize == text-size(layoutZoomLevel, feature) ]\nattribute vec3 a_size;\nuniform bool u_is_size_zoom_constant;\nuniform bool u_is_size_feature_constant;\nuniform mediump float u_size_t; // used to interpolate between zoom stops when size is a composite function\nuniform mediump float u_size; // used when size is both zoom and feature constant\nuniform mediump float u_layout_size; // used when size is feature constant\n\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform bool u_is_text;\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform bool u_pitch_with_map;\nuniform mediump float u_pitch;\nuniform mediump float u_bearing;\nuniform mediump float u_aspect_ratio;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\nvarying float v_size;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 fill_color\n #pragma mapbox: initialize highp vec4 halo_color\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float halo_width\n #pragma mapbox: initialize lowp float halo_blur\n\n vec2 a_pos = a_pos_offset.xy;\n vec2 a_offset = a_pos_offset.zw;\n\n vec2 a_tex = a_data.xy;\n\n mediump vec2 label_data = unpack_float(a_data[2]);\n mediump float a_labelminzoom = label_data[0];\n mediump float a_labelangle = label_data[1];\n\n mediump vec2 a_zoom = unpack_float(a_data[3]);\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // In order to accommodate placing labels around corners in\n // symbol-placement: line, each glyph in a label could have multiple\n // \"quad\"s only one of which should be shown at a given zoom level.\n // The min/max zoom assigned to each quad is based on the font size at\n // the vector tile's zoom level, which might be different than at the\n // currently rendered zoom level if text-size is zoom-dependent.\n // Thus, we compensate for this difference by calculating an adjustment\n // based on the scale of rendered text size relative to layout text size.\n mediump float layoutSize;\n if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\n v_size = mix(a_size[0], a_size[1], u_size_t) / 10.0;\n layoutSize = a_size[2] / 10.0;\n } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\n v_size = a_size[0] / 10.0;\n layoutSize = v_size;\n } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {\n v_size = u_size;\n layoutSize = u_layout_size;\n } else {\n v_size = u_size;\n layoutSize = u_size;\n }\n\n float fontScale = u_is_text ? v_size / 24.0 : v_size;\n\n mediump float zoomAdjust = log2(v_size / layoutSize);\n mediump float adjustedZoom = (u_zoom - zoomAdjust) * 10.0;\n // result: z = 0 if a_minzoom <= adjustedZoom < a_maxzoom, and 1 otherwise\n // Used below to move the vertex out of the clip space for when the current\n // zoom is out of the glyph's zoom range.\n mediump float z = 2.0 - step(a_minzoom, adjustedZoom) - (1.0 - step(a_maxzoom, adjustedZoom));\n\n // pitch-alignment: map\n // rotation-alignment: map | viewport\n if (u_pitch_with_map) {\n lowp float angle = u_rotate_with_map ? (a_labelangle / 256.0 * 2.0 * PI) : u_bearing;\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, asin, -1.0 * asin, acos);\n vec2 offset = RotationMatrix * a_offset;\n vec2 extrude = fontScale * u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: map\n } else if (u_rotate_with_map) {\n // foreshortening factor to apply on pitched maps\n // as a label goes from horizontal <=> vertical in angle\n // it goes from 0% foreshortening to up to around 70% foreshortening\n lowp float pitchfactor = 1.0 - cos(u_pitch * sin(u_pitch * 0.75));\n\n lowp float lineangle = a_labelangle / 256.0 * 2.0 * PI;\n\n // use the lineangle to position points a,b along the line\n // project the points and calculate the label angle in projected space\n // this calculation allows labels to be rendered unskewed on pitched maps\n vec4 a = u_matrix * vec4(a_pos, 0, 1);\n vec4 b = u_matrix * vec4(a_pos + vec2(cos(lineangle),sin(lineangle)), 0, 1);\n lowp float angle = atan((b[1]/b[3] - a[1]/a[3])/u_aspect_ratio, b[0]/b[3] - a[0]/a[3]);\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, -1.0 * asin, asin, acos);\n\n vec2 offset = RotationMatrix * (vec2((1.0-pitchfactor)+(pitchfactor*cos(angle*2.0)), 1.0) * a_offset);\n vec2 extrude = fontScale * u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: viewport\n } else {\n vec2 extrude = fontScale * u_extrude_scale * (a_offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_gamma_scale = gl_Position.w;\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"}}; | |
},{"path":23}],80:[function(_dereq_,module,exports){ | |
"use strict";var VertexArrayObject=function(){this.boundProgram=null,this.boundVertexBuffer=null,this.boundVertexBuffer2=null,this.boundElementBuffer=null,this.boundVertexOffset=null,this.vao=null};VertexArrayObject.prototype.bind=function(e,t,r,i,n,s){void 0===e.extVertexArrayObject&&(e.extVertexArrayObject=e.getExtension("OES_vertex_array_object"));var o=!this.vao||this.boundProgram!==t||this.boundVertexBuffer!==r||this.boundVertexBuffer2!==n||this.boundElementBuffer!==i||this.boundVertexOffset!==s;!e.extVertexArrayObject||o?(this.freshBind(e,t,r,i,n,s),this.gl=e):e.extVertexArrayObject.bindVertexArrayOES(this.vao)},VertexArrayObject.prototype.freshBind=function(e,t,r,i,n,s){var o,u=t.numAttributes;if(e.extVertexArrayObject)this.vao&&this.destroy(),this.vao=e.extVertexArrayObject.createVertexArrayOES(),e.extVertexArrayObject.bindVertexArrayOES(this.vao),o=0,this.boundProgram=t,this.boundVertexBuffer=r,this.boundVertexBuffer2=n,this.boundElementBuffer=i,this.boundVertexOffset=s;else{o=e.currentNumAttributes||0;for(var b=u;b<o;b++)e.disableVertexAttribArray(b)}r.enableAttributes(e,t),n&&n.enableAttributes(e,t),r.bind(e),r.setVertexAttribPointers(e,t,s),n&&(n.bind(e),n.setVertexAttribPointers(e,t,s)),i&&i.bind(e),e.currentNumAttributes=u},VertexArrayObject.prototype.destroy=function(){this.vao&&(this.gl.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)},module.exports=VertexArrayObject; | |
},{}],81:[function(_dereq_,module,exports){ | |
"use strict";var util=_dereq_("../util/util");exports.packUint8ToFloat=function(t,l){return t=util.clamp(Math.floor(t),0,255),l=util.clamp(Math.floor(l),0,255),256*t+l}; | |
},{"../util/util":215}],82:[function(_dereq_,module,exports){ | |
"use strict";var ImageSource=_dereq_("./image_source"),window=_dereq_("../util/window"),CanvasSource=function(t){function i(i,a,s,n){t.call(this,i,a,s,n),this.options=a,this.animate=!a.hasOwnProperty("animate")||a.animate}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.load=function(){if(this.canvas=this.canvas||window.document.getElementById(this.options.canvas),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions())return this.fire("error",new Error("Canvas dimensions cannot be less than or equal to zero."));var t;this.play=function(){t=this.map.style.animationLoop.set(1/0),this.map._rerender()},this.pause=function(){this.map.style.animationLoop.cancel(t)},this._finishLoading()},i.prototype.getCanvas=function(){return this.canvas},i.prototype.onAdd=function(t){this.map||(this.map=t,this.load(),this.canvas&&this.animate&&this.play())},i.prototype.prepare=function(){var t=!1;this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||this.tile&&this._prepareImage(this.map.painter.gl,this.canvas,t)},i.prototype.serialize=function(){return{type:"canvas",canvas:this.canvas,coordinates:this.coordinates}},i.prototype._hasInvalidDimensions=function(){for(var t=this,i=0,a=[t.canvas.width,t.canvas.height];i<a.length;i+=1){var s=a[i];if(isNaN(s)||s<=0)return!0}return!1},i}(ImageSource);module.exports=CanvasSource; | |
},{"../util/window":197,"./image_source":86}],83:[function(_dereq_,module,exports){ | |
"use strict";function resolveURL(t){var e=window.document.createElement("a");return e.href=t,e.href}var Evented=_dereq_("../util/evented"),util=_dereq_("../util/util"),window=_dereq_("../util/window"),EXTENT=_dereq_("../data/extent"),GeoJSONSource=function(t){function e(e,o,i,r){t.call(this),o=o||{},this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this.dispatcher=i,this.setEventedParent(r),this._data=o.data,void 0!==o.maxzoom&&(this.maxzoom=o.maxzoom),o.type&&(this.type=o.type);var a=EXTENT/this.tileSize;this.workerOptions=util.extend({source:this.id,cluster:o.cluster||!1,geojsonVtOptions:{buffer:(void 0!==o.buffer?o.buffer:128)*a,tolerance:(void 0!==o.tolerance?o.tolerance:.375)*a,extent:EXTENT,maxZoom:this.maxzoom},superclusterOptions:{maxZoom:Math.min(o.clusterMaxZoom,this.maxzoom-1)||this.maxzoom-1,extent:EXTENT,radius:(o.clusterRadius||50)*a,log:!1}},o.workerOptions)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.load=function(){var t=this;this.fire("dataloading",{dataType:"source"}),this._updateWorkerData(function(e){return e?void t.fire("error",{error:e}):void t.fire("data",{dataType:"source",sourceDataType:"metadata"})})},e.prototype.onAdd=function(t){this.load(),this.map=t},e.prototype.setData=function(t){var e=this;return this._data=t,this.fire("dataloading",{dataType:"source"}),this._updateWorkerData(function(t){return t?e.fire("error",{error:t}):void e.fire("data",{dataType:"source",sourceDataType:"content"})}),this},e.prototype._updateWorkerData=function(t){var e=this,o=util.extend({},this.workerOptions),i=this._data;"string"==typeof i?o.url=resolveURL(i):o.data=JSON.stringify(i),this.workerID=this.dispatcher.send(this.type+".loadData",o,function(o){e._loaded=!0,t(o)})},e.prototype.loadTile=function(t,e){var o=this,i=t.coord.z>this.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,r={type:this.type,uid:t.uid,coord:t.coord,zoom:t.coord.z,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,overscaling:i,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send("loadTile",r,function(i,r){if(t.unloadVectorData(),!t.aborted)return i?e(i):(t.loadVectorData(r,o.map.painter),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(o)),e(null))},this.workerID)},e.prototype.abortTile=function(t){t.aborted=!0},e.prototype.unloadTile=function(t){t.unloadVectorData(),this.dispatcher.send("removeTile",{uid:t.uid,type:this.type,source:this.id},function(){},t.workerID)},e.prototype.onRemove=function(){this.dispatcher.broadcast("removeSource",{type:this.type,source:this.id},function(){})},e.prototype.serialize=function(){return{type:this.type,data:this._data}},e}(Evented);module.exports=GeoJSONSource; | |
},{"../data/extent":54,"../util/evented":203,"../util/util":215,"../util/window":197}],84:[function(_dereq_,module,exports){ | |
"use strict";var ajax=_dereq_("../util/ajax"),rewind=_dereq_("geojson-rewind"),GeoJSONWrapper=_dereq_("./geojson_wrapper"),vtpbf=_dereq_("vt-pbf"),supercluster=_dereq_("supercluster"),geojsonvt=_dereq_("geojson-vt"),VectorTileWorkerSource=_dereq_("./vector_tile_worker_source"),GeoJSONWorkerSource=function(e){function r(r,t,o){e.call(this,r,t),o&&(this.loadGeoJSON=o),this._geoJSONIndexes={}}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.loadVectorData=function(e,r){var t=e.source,o=e.coord;if(!this._geoJSONIndexes[t])return r(null,null);var n=this._geoJSONIndexes[t].getTile(Math.min(o.z,e.maxZoom),o.x,o.y);if(!n)return r(null,null);var u=new GeoJSONWrapper(n.features);u.name="_geojsonTileLayer";var a=vtpbf({layers:{_geojsonTileLayer:u}});0===a.byteOffset&&a.byteLength===a.buffer.byteLength||(a=new Uint8Array(a)),u.rawData=a.buffer,r(null,u)},r.prototype.loadData=function(e,r){var t=function(t,o){var n=this;return t?r(t):"object"!=typeof o?r(new Error("Input data is not a valid GeoJSON object.")):(rewind(o,!0),void this._indexData(o,e,function(t,o){return t?r(t):(n._geoJSONIndexes[e.source]=o,void r(null))}))}.bind(this);this.loadGeoJSON(e,t)},r.prototype.loadGeoJSON=function(e,r){if(e.url)ajax.getJSON(e.url,r);else{if("string"!=typeof e.data)return r(new Error("Input data is not a valid GeoJSON object."));try{return r(null,JSON.parse(e.data))}catch(e){return r(new Error("Input data is not a valid GeoJSON object."))}}},r.prototype.removeSource=function(e){this._geoJSONIndexes[e.source]&&delete this._geoJSONIndexes[e.source]},r.prototype._indexData=function(e,r,t){try{r.cluster?t(null,supercluster(r.superclusterOptions).load(e.features)):t(null,geojsonvt(e,r.geojsonVtOptions))}catch(e){return t(e)}},r}(VectorTileWorkerSource);module.exports=GeoJSONWorkerSource; | |
},{"../util/ajax":194,"./geojson_wrapper":85,"./vector_tile_worker_source":98,"geojson-rewind":7,"geojson-vt":11,"supercluster":29,"vt-pbf":38}],85:[function(_dereq_,module,exports){ | |
"use strict";var Point=_dereq_("point-geometry"),VectorTileFeature=_dereq_("vector-tile").VectorTileFeature,EXTENT=_dereq_("../data/extent"),FeatureWrapper=function(e){var t=this;if(this.type=e.type,1===e.type){this.rawGeometry=[];for(var r=0;r<e.geometry.length;r++)t.rawGeometry.push([e.geometry[r]])}else this.rawGeometry=e.geometry;this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10)),this.extent=EXTENT};FeatureWrapper.prototype.loadGeometry=function(){var e=this,t=this.rawGeometry;this.geometry=[];for(var r=0;r<t.length;r++){for(var o=t[r],a=[],i=0;i<o.length;i++)a.push(new Point(o[i][0],o[i][1]));e.geometry.push(a)}return this.geometry},FeatureWrapper.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,r=-(1/0),o=1/0,a=-(1/0),i=0;i<e.length;i++)for(var p=e[i],n=0;n<p.length;n++){var h=p[n];t=Math.min(t,h.x),r=Math.max(r,h.x),o=Math.min(o,h.y),a=Math.max(a,h.y)}return[t,o,r,a]},FeatureWrapper.prototype.toGeoJSON=function(){VectorTileFeature.prototype.toGeoJSON.call(this)};var GeoJSONWrapper=function(e){this.features=e,this.length=e.length,this.extent=EXTENT};GeoJSONWrapper.prototype.feature=function(e){return new FeatureWrapper(this.features[e])},module.exports=GeoJSONWrapper; | |
},{"../data/extent":54,"point-geometry":26,"vector-tile":34}],86:[function(_dereq_,module,exports){ | |
"use strict";var util=_dereq_("../util/util"),window=_dereq_("../util/window"),TileCoord=_dereq_("./tile_coord"),LngLat=_dereq_("../geo/lng_lat"),Point=_dereq_("point-geometry"),Evented=_dereq_("../util/evented"),ajax=_dereq_("../util/ajax"),EXTENT=_dereq_("../data/extent"),RasterBoundsArray=_dereq_("../data/raster_bounds_array"),Buffer=_dereq_("../data/buffer"),VertexArrayObject=_dereq_("../render/vertex_array_object"),ImageSource=function(t){function e(e,o,r,i){t.call(this),this.id=e,this.dispatcher=r,this.coordinates=o.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.setEventedParent(i),this.options=o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.load=function(){var t=this;this.fire("dataloading",{dataType:"source"}),this.url=this.options.url,ajax.getImage(this.options.url,function(e,o){return e?t.fire("error",{error:e}):(t.image=o,void t._finishLoading())})},e.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire("data",{dataType:"source",sourceDataType:"metadata"}))},e.prototype.onAdd=function(t){this.load(),this.map=t,this.image&&this.setCoordinates(this.coordinates)},e.prototype.setCoordinates=function(t){this.coordinates=t;var e=this.map,o=t.map(function(t){return e.transform.locationCoordinate(LngLat.convert(t)).zoomTo(0)}),r=this.centerCoord=util.getCoordinatesCenter(o);return r.column=Math.floor(r.column),r.row=Math.floor(r.row),this.coord=new TileCoord(r.zoom,r.column,r.row),this.minzoom=this.maxzoom=r.zoom,this._tileCoords=o.map(function(t){var e=t.zoomTo(r.zoom);return new Point(Math.round((e.column-r.column)*EXTENT),Math.round((e.row-r.row)*EXTENT))}),this.fire("data",{dataType:"source",sourceDataType:"content"}),this},e.prototype._setTile=function(t){this.tile=t;var e=32767,o=new RasterBoundsArray;o.emplaceBack(this._tileCoords[0].x,this._tileCoords[0].y,0,0),o.emplaceBack(this._tileCoords[1].x,this._tileCoords[1].y,e,0),o.emplaceBack(this._tileCoords[3].x,this._tileCoords[3].y,0,e),o.emplaceBack(this._tileCoords[2].x,this._tileCoords[2].y,e,e),this.tile.buckets={},this.tile.boundsBuffer=Buffer.fromStructArray(o,Buffer.BufferType.VERTEX),this.tile.boundsVAO=new VertexArrayObject},e.prototype.prepare=function(){this.tile&&this.image&&this._prepareImage(this.map.painter.gl,this.image)},e.prototype._prepareImage=function(t,e,o){"loaded"!==this.tile.state?(this.tile.state="loaded",this.tile.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e)):o?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e):(e instanceof window.HTMLVideoElement||e instanceof window.ImageData||e instanceof window.HTMLCanvasElement)&&(t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,e))},e.prototype.loadTile=function(t,e){this.coord&&this.coord.toString()===t.coord.toString()?(this._setTile(t),e(null)):(t.state="errored",e(null))},e.prototype.serialize=function(){return{type:"image",urls:this.url,coordinates:this.coordinates}},e}(Evented);module.exports=ImageSource; | |
},{"../data/buffer":51,"../data/extent":54,"../data/raster_bounds_array":59,"../geo/lng_lat":62,"../render/vertex_array_object":80,"../util/ajax":194,"../util/evented":203,"../util/util":215,"../util/window":197,"./tile_coord":96,"point-geometry":26}],87:[function(_dereq_,module,exports){ | |
"use strict";var util=_dereq_("../util/util"),ajax=_dereq_("../util/ajax"),browser=_dereq_("../util/browser"),normalizeURL=_dereq_("../util/mapbox").normalizeSourceURL;module.exports=function(r,e){var o=function(r,o){if(r)return e(r);var i=util.pick(o,["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds"]);o.vector_layers&&(i.vectorLayers=o.vector_layers,i.vectorLayerIds=i.vectorLayers.map(function(r){return r.id})),e(null,i)};r.url?ajax.getJSON(normalizeURL(r.url),o):browser.frame(o.bind(null,null,r))}; | |
},{"../util/ajax":194,"../util/browser":195,"../util/mapbox":210,"../util/util":215}],88:[function(_dereq_,module,exports){ | |
"use strict";var EXTENT=_dereq_("../data/extent");module.exports=function(e,t,r){return t*(EXTENT/(e.tileSize*Math.pow(2,r-e.coord.z)))}; | |
},{"../data/extent":54}],89:[function(_dereq_,module,exports){ | |
"use strict";function sortTilesIn(e,r){var o=e.coord,t=r.coord;return o.z-t.z||o.y-t.y||o.w-t.w||o.x-t.x}function mergeRenderedFeatureLayers(e){for(var r=e[0]||{},o=1;o<e.length;o++){var t=e[o];for(var n in t){var a=t[n],i=r[n];if(void 0===i)i=r[n]=a;else for(var u=0;u<a.length;u++)i.push(a[u])}}return r}var TileCoord=_dereq_("./tile_coord");exports.rendered=function(e,r,o,t,n,a){var i=e.tilesIn(o);i.sort(sortTilesIn);for(var u=[],s=0;s<i.length;s++){var d=i[s];d.tile.featureIndex&&u.push(d.tile.featureIndex.query({queryGeometry:d.queryGeometry,scale:d.scale,tileSize:d.tile.tileSize,bearing:a,params:t},r))}return mergeRenderedFeatureLayers(u)},exports.source=function(e,r){for(var o=e.getRenderableIds().map(function(r){return e.getTileByID(r)}),t=[],n={},a=0;a<o.length;a++){var i=o[a],u=new TileCoord(Math.min(i.sourceMaxZoom,i.coord.z),i.coord.x,i.coord.y,0).id;n[u]||(n[u]=!0,i.querySourceFeatures(t,r))}return t}; | |
},{"./tile_coord":96}],90:[function(_dereq_,module,exports){ | |
"use strict";var util=_dereq_("../util/util"),ajax=_dereq_("../util/ajax"),Evented=_dereq_("../util/evented"),loadTileJSON=_dereq_("./load_tilejson"),normalizeURL=_dereq_("../util/mapbox").normalizeTileURL,TileBounds=_dereq_("./tile_bounds"),RasterTileSource=function(e){function t(t,i,r,o){e.call(this),this.id=t,this.dispatcher=r,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this.options=i,util.extend(this,util.pick(i,["url","scheme","tileSize"]))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.load=function(){var e=this;this.fire("dataloading",{dataType:"source"}),loadTileJSON(this.options,function(t,i){return t?e.fire("error",t):(util.extend(e,i),e.setBounds(i.bounds),e.fire("data",{dataType:"source",sourceDataType:"metadata"}),void e.fire("data",{dataType:"source",sourceDataType:"content"}))})},t.prototype.onAdd=function(e){this.load(),this.map=e},t.prototype.setBounds=function(e){this.bounds=e,e&&(this.tileBounds=new TileBounds(e,this.minzoom,this.maxzoom))},t.prototype.serialize=function(){return{type:"raster",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds}},t.prototype.hasTile=function(e){return!this.tileBounds||this.tileBounds.contains(e,this.maxzoom)},t.prototype.loadTile=function(e,t){function i(i,r){if(delete e.request,e.aborted)return this.state="unloaded",t(null);if(i)return this.state="errored",t(i);this.map._refreshExpiredTiles&&e.setExpiryData(r),delete r.cacheControl,delete r.expires;var o=this.map.painter.gl;e.texture=this.map.painter.getTileTexture(r.width),e.texture?(o.bindTexture(o.TEXTURE_2D,e.texture),o.texSubImage2D(o.TEXTURE_2D,0,0,0,o.RGBA,o.UNSIGNED_BYTE,r)):(e.texture=o.createTexture(),o.bindTexture(o.TEXTURE_2D,e.texture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR_MIPMAP_NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),this.map.painter.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,this.map.painter.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.map.painter.extTextureFilterAnisotropicMax),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,r),e.texture.size=r.width),o.generateMipmap(o.TEXTURE_2D),e.state="loaded",t(null)}var r=normalizeURL(e.coord.url(this.tiles,null,this.scheme),this.url,this.tileSize);e.request=ajax.getImage(r,i.bind(this))},t.prototype.abortTile=function(e){e.request&&(e.request.abort(),delete e.request)},t.prototype.unloadTile=function(e){e.texture&&this.map.painter.saveTileTexture(e.texture)},t}(Evented);module.exports=RasterTileSource; | |
},{"../util/ajax":194,"../util/evented":203,"../util/mapbox":210,"../util/util":215,"./load_tilejson":87,"./tile_bounds":95}],91:[function(_dereq_,module,exports){ | |
"use strict";var ajax=_dereq_("../util/ajax"),Evented=_dereq_("../util/evented"),window=_dereq_("../util/window"),pluginRequested=!1,pluginBlobURL=null;module.exports.evented=new Evented,module.exports.registerForPluginAvailability=function(e){return pluginBlobURL?e(pluginBlobURL,module.exports.errorCallback):module.exports.evented.once("pluginAvailable",e),e},module.exports.setRTLTextPlugin=function(e,l){if(pluginRequested)throw new Error("setRTLTextPlugin cannot be called multiple times.");pluginRequested=!0,module.exports.errorCallback=l,ajax.getArrayBuffer(e,function(e,t){e?l(e):(pluginBlobURL=window.URL.createObjectURL(new window.Blob([t.data]),{type:"text/javascript"}),module.exports.evented.fire("pluginAvailable",{pluginBlobURL:pluginBlobURL,errorCallback:l}))})}; | |
},{"../util/ajax":194,"../util/evented":203,"../util/window":197}],92:[function(_dereq_,module,exports){ | |
"use strict";var util=_dereq_("../util/util"),sourceTypes={vector:_dereq_("../source/vector_tile_source"),raster:_dereq_("../source/raster_tile_source"),geojson:_dereq_("../source/geojson_source"),video:_dereq_("../source/video_source"),image:_dereq_("../source/image_source"),canvas:_dereq_("../source/canvas_source")};exports.create=function(e,r,o,u){if(r=new sourceTypes[r.type](e,r,o,u),r.id!==e)throw new Error("Expected Source id to be "+e+" instead of "+r.id);return util.bindAll(["load","abort","unload","serialize","prepare"],r),r},exports.getType=function(e){return sourceTypes[e]},exports.setType=function(e,r){sourceTypes[e]=r}; | |
},{"../source/canvas_source":82,"../source/geojson_source":83,"../source/image_source":86,"../source/raster_tile_source":90,"../source/vector_tile_source":97,"../source/video_source":99,"../util/util":215}],93:[function(_dereq_,module,exports){ | |
"use strict";function coordinateToTilePoint(e,t,o){var i=o.zoomTo(Math.min(e.z,t));return{x:(i.column-(e.x+e.w*Math.pow(2,e.z)))*EXTENT,y:(i.row-e.y)*EXTENT}}function compareKeyZoom(e,t){return e%32-t%32}function isRasterType(e){return"raster"===e||"image"===e||"video"===e}var Source=_dereq_("./source"),Tile=_dereq_("./tile"),Evented=_dereq_("../util/evented"),TileCoord=_dereq_("./tile_coord"),Cache=_dereq_("../util/lru_cache"),Coordinate=_dereq_("../geo/coordinate"),util=_dereq_("../util/util"),EXTENT=_dereq_("../data/extent"),SourceCache=function(e){function t(t,o,i){e.call(this),this.id=t,this.dispatcher=i,this.on("data",function(e){"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),this.on("error",function(){this._sourceErrored=!0}),this._source=Source.create(t,o,i,this),this._tiles={},this._cache=new Cache(0,this.unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._isIdRenderable=this._isIdRenderable.bind(this)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.onAdd=function(e){this.map=e,this._source&&this._source.onAdd&&this._source.onAdd(e)},t.prototype.onRemove=function(e){this._source&&this._source.onRemove&&this._source.onRemove(e)},t.prototype.loaded=function(){var e=this;if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;for(var t in e._tiles){var o=e._tiles[t];if("loaded"!==o.state&&"errored"!==o.state)return!1}return!0},t.prototype.getSource=function(){return this._source},t.prototype.loadTile=function(e,t){return this._source.loadTile(e,t)},t.prototype.unloadTile=function(e){if(this._source.unloadTile)return this._source.unloadTile(e)},t.prototype.abortTile=function(e){if(this._source.abortTile)return this._source.abortTile(e)},t.prototype.serialize=function(){return this._source.serialize()},t.prototype.prepare=function(){if(this._sourceLoaded&&this._source.prepare)return this._source.prepare()},t.prototype.getIds=function(){return Object.keys(this._tiles).map(Number).sort(compareKeyZoom)},t.prototype.getRenderableIds=function(){return this.getIds().filter(this._isIdRenderable)},t.prototype._isIdRenderable=function(e){return this._tiles[e].hasData()&&!this._coveredTiles[e]},t.prototype.reload=function(){var e=this;this._cache.reset();for(var t in e._tiles)e.reloadTile(t,"reloading")},t.prototype.reloadTile=function(e,t){var o=this._tiles[e];o&&("loading"!==o.state&&(o.state=t),this.loadTile(o,this._tileLoaded.bind(this,o,e,t)))},t.prototype._tileLoaded=function(e,t,o,i){return i?(e.state="errored",void(404!==i.status&&this._source.fire("error",{tile:e,error:i}))):(e.sourceCache=this,e.timeAdded=(new Date).getTime(),"expired"===o&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),this._source.fire("data",{dataType:"source",tile:e,coord:e.coord}),void(this.map&&(this.map.painter.tileExtentVAO.vao=null)))},t.prototype.getTile=function(e){return this.getTileByID(e.id)},t.prototype.getTileByID=function(e){return this._tiles[e]},t.prototype.getZoom=function(e){return e.zoom+e.scaleZoom(e.tileSize/this._source.tileSize)},t.prototype.findLoadedChildren=function(e,t,o){var i=this,r=!1;for(var s in i._tiles){var a=i._tiles[s];if(!(o[s]||!a.hasData()||a.coord.z<=e.z||a.coord.z>t)){var n=Math.pow(2,Math.min(a.coord.z,i._source.maxzoom)-Math.min(e.z,i._source.maxzoom));if(Math.floor(a.coord.x/n)===e.x&&Math.floor(a.coord.y/n)===e.y)for(o[s]=!0,r=!0;a&&a.coord.z-1>e.z;){var d=a.coord.parent(i._source.maxzoom).id;a=i._tiles[d],a&&a.hasData()&&(delete o[s],o[d]=!0)}}}return r},t.prototype.findLoadedParent=function(e,t,o){for(var i=this,r=e.z-1;r>=t;r--){e=e.parent(i._source.maxzoom);var s=i._tiles[e.id];if(s&&s.hasData())return o[e.id]=!0,s;if(i._cache.has(e.id))return o[e.id]=!0,i._cache.getWithoutRemoving(e.id)}},t.prototype.updateCacheSize=function(e){var t=Math.ceil(e.width/e.tileSize)+1,o=Math.ceil(e.height/e.tileSize)+1,i=t*o,r=5;this._cache.setMaxSize(Math.floor(i*r))},t.prototype.update=function(e){var o=this;if(this.transform=e,this._sourceLoaded){var i,r,s,a;this.updateCacheSize(e);var n=(this._source.roundZoom?Math.round:Math.floor)(this.getZoom(e)),d=Math.max(n-t.maxOverzooming,this._source.minzoom),c=Math.max(n+t.maxUnderzooming,this._source.minzoom),h={};this._coveredTiles={};var u;for(this.used?this._source.coord?u=e.getVisibleWrappedCoordinates(this._source.coord):(u=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(u=u.filter(function(e){return o._source.hasTile(e)}))):u=[],i=0;i<u.length;i++)r=u[i],s=o.addTile(r),h[r.id]=!0,s.hasData()||o.findLoadedChildren(r,c,h)||(a=o.findLoadedParent(r,d,h),a&&o.addTile(a.coord));var l={};if(isRasterType(this._source.type))for(var m=Object.keys(h),p=0;p<m.length;p++){var _=m[p];r=TileCoord.fromID(_),s=o._tiles[_],s&&("undefined"==typeof s.fadeEndTime||s.fadeEndTime>=Date.now())&&(o.findLoadedChildren(r,c,h)&&(h[_]=!0),a=o.findLoadedParent(r,d,l),a&&o.addTile(a.coord))}var f;for(f in l)h[f]||(o._coveredTiles[f]=!0);for(f in l)h[f]=!0;var T=util.keysDifference(this._tiles,h);for(i=0;i<T.length;i++)o.removeTile(+T[i])}},t.prototype.addTile=function(e){var t=this._tiles[e.id];if(t)return t;var o=e.wrapped();t=this._tiles[o.id],t||(t=this._cache.get(o.id),t&&(t.redoPlacement(this._source),this._cacheTimers[o.id]&&(clearTimeout(this._cacheTimers[o.id]),this._cacheTimers[o.id]=void 0,this._setTileReloadTimer(o.id,t))));var i=Boolean(t);if(!i){var r=e.z,s=r>this._source.maxzoom?Math.pow(2,r-this._source.maxzoom):1;t=new Tile(o,this._source.tileSize*s,this._source.maxzoom),this.loadTile(t,this._tileLoaded.bind(this,t,e.id,t.state))}return t.uses++,this._tiles[e.id]=t,i||this._source.fire("dataloading",{tile:t,coord:t.coord,dataType:"source"}),t},t.prototype._setTileReloadTimer=function(e,t){var o=this,i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout(function(){o.reloadTile(e,"expired"),o._timers[e]=void 0},i))},t.prototype._setCacheInvalidationTimer=function(e,t){var o=this,i=t.getExpiryTimeout();i&&(this._cacheTimers[e]=setTimeout(function(){o._cache.remove(e),o._cacheTimers[e]=void 0},i))},t.prototype.removeTile=function(e){var t=this._tiles[e];if(t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),this._timers[e]=void 0),!(t.uses>0)))if(t.hasData()){var o=t.coord.wrapped().id;this._cache.add(o,t),this._setCacheInvalidationTimer(o,t)}else t.aborted=!0,this.abortTile(t),this.unloadTile(t)},t.prototype.clearTiles=function(){var e=this;for(var t in e._tiles)e.removeTile(t);this._cache.reset()},t.prototype.tilesIn=function(e){for(var t=this,o={},i=this.getIds(),r=1/0,s=1/0,a=-(1/0),n=-(1/0),d=e[0].zoom,c=0;c<e.length;c++){var h=e[c];r=Math.min(r,h.column),s=Math.min(s,h.row),a=Math.max(a,h.column),n=Math.max(n,h.row)}for(var u=0;u<i.length;u++){var l=t._tiles[i[u]],m=TileCoord.fromID(i[u]),p=[coordinateToTilePoint(m,l.sourceMaxZoom,new Coordinate(r,s,d)),coordinateToTilePoint(m,l.sourceMaxZoom,new Coordinate(a,n,d))];if(p[0].x<EXTENT&&p[0].y<EXTENT&&p[1].x>=0&&p[1].y>=0){for(var _=[],f=0;f<e.length;f++)_.push(coordinateToTilePoint(m,l.sourceMaxZoom,e[f]));var T=o[l.coord.id];void 0===T&&(T=o[l.coord.id]={tile:l,coord:m,queryGeometry:[],scale:Math.pow(2,t.transform.zoom-l.coord.z)}),T.queryGeometry.push(_)}}var v=[];for(var y in o)v.push(o[y]);return v},t.prototype.redoPlacement=function(){for(var e=this,t=this.getIds(),o=0;o<t.length;o++){var i=e.getTileByID(t[o]);i.redoPlacement(e._source)}},t.prototype.getVisibleCoordinates=function(){for(var e=this,t=this.getRenderableIds().map(TileCoord.fromID),o=0,i=t;o<i.length;o+=1){var r=i[o];r.posMatrix=e.transform.calculatePosMatrix(r,e._source.maxzoom)}return t},t}(Evented);SourceCache.maxOverzooming=10,SourceCache.maxUnderzooming=3,module.exports=SourceCache; | |
},{"../data/extent":54,"../geo/coordinate":61,"../util/evented":203,"../util/lru_cache":209,"../util/util":215,"./source":92,"./tile":94,"./tile_coord":96}],94:[function(_dereq_,module,exports){ | |
"use strict";var util=_dereq_("../util/util"),Bucket=_dereq_("../data/bucket"),FeatureIndex=_dereq_("../data/feature_index"),vt=_dereq_("vector-tile"),Protobuf=_dereq_("pbf"),GeoJSONFeature=_dereq_("../util/vectortile_to_geojson"),featureFilter=_dereq_("../style-spec/feature_filter"),CollisionTile=_dereq_("../symbol/collision_tile"),CollisionBoxArray=_dereq_("../symbol/collision_box"),CLOCK_SKEW_RETRY_TIMEOUT=3e4,Tile=function(e,t,i){this.coord=e,this.uid=util.uniqueId(),this.uses=0,this.tileSize=t,this.sourceMaxZoom=i,this.buckets={},this.expirationTime=null,this.expiredRequestCount=0,this.state="loading"};Tile.prototype.registerFadeDuration=function(e,t){var i=t+this.timeAdded;i<Date.now()||this.fadeEndTime&&i<this.fadeEndTime||(this.fadeEndTime=i,e.set(this.fadeEndTime-Date.now()))},Tile.prototype.loadVectorData=function(e,t){this.hasData()&&this.unloadVectorData(),this.state="loaded",e&&(e.rawTileData&&(this.rawTileData=e.rawTileData),this.collisionBoxArray=new CollisionBoxArray(e.collisionBoxArray),this.collisionTile=new CollisionTile(e.collisionTile,this.collisionBoxArray),this.featureIndex=new FeatureIndex(e.featureIndex,this.rawTileData,this.collisionTile),this.buckets=Bucket.deserialize(e.buckets,t.style))},Tile.prototype.reloadSymbolData=function(e,t){var i=this;if("unloaded"!==this.state){this.collisionTile=new CollisionTile(e.collisionTile,this.collisionBoxArray),this.featureIndex.setCollisionTile(this.collisionTile);for(var o in i.buckets){var r=i.buckets[o];"symbol"===r.layers[0].type&&(r.destroy(),delete i.buckets[o])}util.extend(this.buckets,Bucket.deserialize(e.buckets,t))}},Tile.prototype.unloadVectorData=function(){var e=this;for(var t in e.buckets)e.buckets[t].destroy();this.buckets={},this.collisionBoxArray=null,this.collisionTile=null,this.featureIndex=null,this.state="unloaded"},Tile.prototype.redoPlacement=function(e){var t=this;if("vector"===e.type||"geojson"===e.type)return"loaded"!==this.state?void(this.redoWhenDone=!0):void(this.collisionTile&&(this.state="reloading",e.dispatcher.send("redoPlacement",{type:e.type,uid:this.uid,source:e.id,angle:e.map.transform.angle,pitch:e.map.transform.pitch,showCollisionBoxes:e.map.showCollisionBoxes},function(i,o){t.reloadSymbolData(o,e.map.style),e.map&&(e.map.painter.tileExtentVAO.vao=null),t.state="loaded",t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(e))},this.workerID)))},Tile.prototype.getBucket=function(e){return this.buckets[e.id]},Tile.prototype.querySourceFeatures=function(e,t){var i=this;if(this.rawTileData){this.vtLayers||(this.vtLayers=new vt.VectorTile(new Protobuf(this.rawTileData)).layers);var o=this.vtLayers._geojsonTileLayer||this.vtLayers[t.sourceLayer];if(o)for(var r=featureFilter(t&&t.filter),s={z:this.coord.z,x:this.coord.x,y:this.coord.y},a=0;a<o.length;a++){var l=o.feature(a);if(r(l)){var n=new GeoJSONFeature(l,i.coord.z,i.coord.x,i.coord.y);n.tile=s,e.push(n)}}}},Tile.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},Tile.prototype.setExpiryData=function(e){var t=this.expirationTime;if(e.cacheControl){var i=util.parseCacheControl(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){var o=Date.now(),r=!1;if(this.expirationTime>o)r=!1;else if(t)if(this.expirationTime<t)r=!0;else{var s=this.expirationTime-t;s?this.expirationTime=o+Math.max(s,CLOCK_SKEW_RETRY_TIMEOUT):r=!0}else r=!0;r?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}},Tile.prototype.getExpiryTimeout=function(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)},module.exports=Tile; | |
},{"../data/bucket":45,"../data/feature_index":55,"../style-spec/feature_filter":105,"../symbol/collision_box":163,"../symbol/collision_tile":165,"../util/util":215,"../util/vectortile_to_geojson":216,"pbf":25,"vector-tile":34}],95:[function(_dereq_,module,exports){ | |
"use strict";var LngLatBounds=_dereq_("../geo/lng_lat_bounds"),clamp=_dereq_("../util/util").clamp,TileBounds=function(t,n,o){this.bounds=LngLatBounds.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=o||24};TileBounds.prototype.validateBounds=function(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]},TileBounds.prototype.contains=function(t,n){var o=n?Math.min(t.z,n):t.z,a={minX:Math.floor(this.lngX(this.bounds.getWest(),o)),minY:Math.floor(this.latY(this.bounds.getNorth(),o)),maxX:Math.ceil(this.lngX(this.bounds.getEast(),o)),maxY:Math.ceil(this.latY(this.bounds.getSouth(),o))},i=t.x>=a.minX&&t.x<a.maxX&&t.y>=a.minY&&t.y<a.maxY;return i},TileBounds.prototype.lngX=function(t,n){return(t+180)*(Math.pow(2,n)/360)},TileBounds.prototype.latY=function(t,n){var o=clamp(Math.sin(Math.PI/180*t),-.9999,.9999),a=Math.pow(2,n)/(2*Math.PI);return Math.pow(2,n-1)+.5*Math.log((1+o)/(1-o))*-a},module.exports=TileBounds; | |
},{"../geo/lng_lat_bounds":63,"../util/util":215}],96:[function(_dereq_,module,exports){ | |
"use strict";function edge(t,i){if(t.row>i.row){var o=t;t=i,i=o}return{x0:t.column,y0:t.row,x1:i.column,y1:i.row,dx:i.column-t.column,dy:i.row-t.row}}function scanSpans(t,i,o,r,e){var n=Math.max(o,Math.floor(i.y0)),h=Math.min(r,Math.ceil(i.y1));if(t.x0===i.x0&&t.y0===i.y0?t.x0+i.dy/t.dy*t.dx<i.x1:t.x1-i.dy/t.dy*t.dx<i.x0){var s=t;t=i,i=s}for(var a=t.dx/t.dy,d=i.dx/i.dy,y=t.dx>0,l=i.dx<0,u=n;u<h;u++){var x=a*Math.max(0,Math.min(t.dy,u+y-t.y0))+t.x0,c=d*Math.max(0,Math.min(i.dy,u+l-i.y0))+i.x0;e(Math.floor(c),Math.ceil(x),u)}}function scanTriangle(t,i,o,r,e,n){var h,s=edge(t,i),a=edge(i,o),d=edge(o,t);s.dy>a.dy&&(h=s,s=a,a=h),s.dy>d.dy&&(h=s,s=d,d=h),a.dy>d.dy&&(h=a,a=d,d=h),s.dy&&scanSpans(d,s,r,e,n),a.dy&&scanSpans(d,a,r,e,n)}function getQuadkey(t,i,o){for(var r,e="",n=t;n>0;n--)r=1<<n-1,e+=(i&r?1:0)+(o&r?2:0);return e}var WhooTS=_dereq_("@mapbox/whoots-js"),Coordinate=_dereq_("../geo/coordinate"),TileCoord=function(t,i,o,r){isNaN(r)&&(r=0),this.z=+t,this.x=+i,this.y=+o,this.w=+r,r*=2,r<0&&(r=r*-1-1);var e=1<<this.z;this.id=32*(e*e*r+e*this.y+this.x)+this.z,this.posMatrix=null};TileCoord.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y},TileCoord.prototype.toCoordinate=function(t){var i=Math.min(this.z,void 0===t?this.z:t),o=Math.pow(2,i),r=this.y,e=this.x+o*this.w;return new Coordinate(e,r,i)},TileCoord.prototype.url=function(t,i,o){var r=WhooTS.getTileBBox(this.x,this.y,this.z),e=getQuadkey(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace("{z}",Math.min(this.z,i||this.z)).replace("{x}",this.x).replace("{y}","tms"===o?Math.pow(2,this.z)-this.y-1:this.y).replace("{quadkey}",e).replace("{bbox-epsg-3857}",r)},TileCoord.prototype.parent=function(t){return 0===this.z?null:this.z>t?new TileCoord(this.z-1,this.x,this.y,this.w):new TileCoord(this.z-1,Math.floor(this.x/2),Math.floor(this.y/2),this.w)},TileCoord.prototype.wrapped=function(){return new TileCoord(this.z,this.x,this.y,0)},TileCoord.prototype.children=function(t){if(this.z>=t)return[new TileCoord(this.z+1,this.x,this.y,this.w)];var i=this.z+1,o=2*this.x,r=2*this.y;return[new TileCoord(i,o,r,this.w),new TileCoord(i,o+1,r,this.w),new TileCoord(i,o,r+1,this.w),new TileCoord(i,o+1,r+1,this.w)]},TileCoord.cover=function(t,i,o,r){function e(t,i,e){var s,a,d,y;if(e>=0&&e<=n)for(s=t;s<i;s++)a=Math.floor(s/n),d=(s%n+n)%n,0!==a&&r!==!0||(y=new TileCoord(o,d,e,a),h[y.id]=y)}void 0===r&&(r=!0);var n=1<<t,h={};return scanTriangle(i[0],i[1],i[2],0,n,e),scanTriangle(i[2],i[3],i[0],0,n,e),Object.keys(h).map(function(t){return h[t]})},TileCoord.fromID=function(t){var i=t%32,o=1<<i,r=(t-i)/32,e=r%o,n=(r-e)/o%o,h=Math.floor(r/(o*o));return h%2!==0&&(h=h*-1-1),h/=2,new TileCoord(i,e,n,h)},module.exports=TileCoord; | |
},{"../geo/coordinate":61,"@mapbox/whoots-js":4}],97:[function(_dereq_,module,exports){ | |
"use strict";var Evented=_dereq_("../util/evented"),util=_dereq_("../util/util"),loadTileJSON=_dereq_("./load_tilejson"),normalizeURL=_dereq_("../util/mapbox").normalizeTileURL,TileBounds=_dereq_("./tile_bounds"),VectorTileSource=function(e){function t(t,i,o,r){if(e.call(this),this.id=t,this.dispatcher=o,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,util.extend(this,util.pick(i,["url","scheme","tileSize"])),this._options=util.extend({type:"vector"},i),512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.load=function(){var e=this;this.fire("dataloading",{dataType:"source"}),loadTileJSON(this._options,function(t,i){return t?void e.fire("error",t):(util.extend(e,i),e.setBounds(i.bounds),e.fire("data",{dataType:"source",sourceDataType:"metadata"}),void e.fire("data",{dataType:"source",sourceDataType:"content"}))})},t.prototype.setBounds=function(e){this.bounds=e,e&&(this.tileBounds=new TileBounds(e,this.minzoom,this.maxzoom))},t.prototype.hasTile=function(e){return!this.tileBounds||this.tileBounds.contains(e,this.maxzoom)},t.prototype.onAdd=function(e){this.load(),this.map=e},t.prototype.serialize=function(){return util.extend({},this._options)},t.prototype.loadTile=function(e,t){function i(i,o){if(!e.aborted){if(i)return t(i);this.map._refreshExpiredTiles&&e.setExpiryData(o),e.loadVectorData(o,this.map.painter),e.redoWhenDone&&(e.redoWhenDone=!1,e.redoPlacement(this)),t(null),e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)}}var o=e.coord.z>this.maxzoom?Math.pow(2,e.coord.z-this.maxzoom):1,r={url:normalizeURL(e.coord.url(this.tiles,this.maxzoom,this.scheme),this.url),uid:e.uid,coord:e.coord,zoom:e.coord.z,tileSize:this.tileSize*o,type:this.type,source:this.id,overscaling:o,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};e.workerID&&"expired"!==e.state?"loading"===e.state?e.reloadCallback=t:this.dispatcher.send("reloadTile",r,i.bind(this),e.workerID):e.workerID=this.dispatcher.send("loadTile",r,i.bind(this))},t.prototype.abortTile=function(e){this.dispatcher.send("abortTile",{uid:e.uid,type:this.type,source:this.id},null,e.workerID)},t.prototype.unloadTile=function(e){e.unloadVectorData(),this.dispatcher.send("removeTile",{uid:e.uid,type:this.type,source:this.id},null,e.workerID)},t}(Evented);module.exports=VectorTileSource; | |
},{"../util/evented":203,"../util/mapbox":210,"../util/util":215,"./load_tilejson":87,"./tile_bounds":95}],98:[function(_dereq_,module,exports){ | |
"use strict";var ajax=_dereq_("../util/ajax"),vt=_dereq_("vector-tile"),Protobuf=_dereq_("pbf"),WorkerTile=_dereq_("./worker_tile"),util=_dereq_("../util/util"),VectorTileWorkerSource=function(e,r,t){this.actor=e,this.layerIndex=r,t&&(this.loadVectorData=t),this.loading={},this.loaded={}};VectorTileWorkerSource.prototype.loadTile=function(e,r){function t(e,t){return delete this.loading[o][i],e?r(e):t?(a.vectorTile=t,a.parse(t,this.layerIndex,this.actor,function(e,o,i){if(e)return r(e);var a={};t.expires&&(a.expires=t.expires),t.cacheControl&&(a.cacheControl=t.cacheControl),r(null,util.extend({rawTileData:t.rawData},o,a),i)}),this.loaded[o]=this.loaded[o]||{},void(this.loaded[o][i]=a)):r(null,null)}var o=e.source,i=e.uid;this.loading[o]||(this.loading[o]={});var a=this.loading[o][i]=new WorkerTile(e);a.abort=this.loadVectorData(e,t.bind(this))},VectorTileWorkerSource.prototype.reloadTile=function(e,r){function t(e,t){if(this.reloadCallback){var o=this.reloadCallback;delete this.reloadCallback,this.parse(this.vectorTile,a.layerIndex,a.actor,o)}r(e,t)}var o=this.loaded[e.source],i=e.uid,a=this;if(o&&o[i]){var l=o[i];"parsing"===l.status?l.reloadCallback=r:"done"===l.status&&l.parse(l.vectorTile,this.layerIndex,this.actor,t.bind(l))}},VectorTileWorkerSource.prototype.abortTile=function(e){var r=this.loading[e.source],t=e.uid;r&&r[t]&&r[t].abort&&(r[t].abort(),delete r[t])},VectorTileWorkerSource.prototype.removeTile=function(e){var r=this.loaded[e.source],t=e.uid;r&&r[t]&&delete r[t]},VectorTileWorkerSource.prototype.loadVectorData=function(e,r){function t(e,t){if(e)return r(e);var o=new vt.VectorTile(new Protobuf(t.data));o.rawData=t.data,o.cacheControl=t.cacheControl,o.expires=t.expires,r(e,o)}var o=ajax.getArrayBuffer(e.url,t.bind(this));return function(){o.abort()}},VectorTileWorkerSource.prototype.redoPlacement=function(e,r){var t=this.loaded[e.source],o=this.loading[e.source],i=e.uid;if(t&&t[i]){var a=t[i],l=a.redoPlacement(e.angle,e.pitch,e.showCollisionBoxes);l.result&&r(null,l.result,l.transferables)}else o&&o[i]&&(o[i].angle=e.angle)},module.exports=VectorTileWorkerSource; | |
},{"../util/ajax":194,"../util/util":215,"./worker_tile":101,"pbf":25,"vector-tile":34}],99:[function(_dereq_,module,exports){ | |
"use strict";var ajax=_dereq_("../util/ajax"),ImageSource=_dereq_("./image_source"),VideoSource=function(t){function e(e,o,i,r){t.call(this,e,o,i,r),this.roundZoom=!0,this.type="video",this.options=o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.load=function(){var t=this,e=this.options;this.urls=e.urls,ajax.getVideo(e.urls,function(e,o){if(e)return t.fire("error",{error:e});t.video=o,t.video.loop=!0;var i;t.video.addEventListener("playing",function(){i=t.map.style.animationLoop.set(1/0),t.map._rerender()}),t.video.addEventListener("pause",function(){t.map.style.animationLoop.cancel(i)}),t.map&&t.video.play(),t._finishLoading()})},e.prototype.getVideo=function(){return this.video},e.prototype.onAdd=function(t){this.map||(this.load(),this.map=t,this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},e.prototype.prepare=function(){!this.tile||this.video.readyState<2||this._prepareImage(this.map.painter.gl,this.video)},e.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},e}(ImageSource);module.exports=VideoSource; | |
},{"../util/ajax":194,"./image_source":86}],100:[function(_dereq_,module,exports){ | |
"use strict";var Actor=_dereq_("../util/actor"),StyleLayerIndex=_dereq_("../style/style_layer_index"),VectorTileWorkerSource=_dereq_("./vector_tile_worker_source"),GeoJSONWorkerSource=_dereq_("./geojson_worker_source"),globalRTLTextPlugin=_dereq_("./rtl_text_plugin"),Worker=function(e){var r=this;this.self=e,this.actor=new Actor(e,this),this.layerIndexes={},this.workerSourceTypes={vector:VectorTileWorkerSource,geojson:GeoJSONWorkerSource},this.workerSources={},this.self.registerWorkerSource=function(e,o){if(r.workerSourceTypes[e])throw new Error('Worker source with name "'+e+'" already registered.');r.workerSourceTypes[e]=o},this.self.registerRTLTextPlugin=function(e){if(globalRTLTextPlugin.applyArabicShaping||globalRTLTextPlugin.processBidirectionalText)throw new Error("RTL text plugin already registered.");globalRTLTextPlugin.applyArabicShaping=e.applyArabicShaping,globalRTLTextPlugin.processBidirectionalText=e.processBidirectionalText}};Worker.prototype.setLayers=function(e,r){this.getLayerIndex(e).replace(r)},Worker.prototype.updateLayers=function(e,r){this.getLayerIndex(e).update(r.layers,r.removedIds,r.symbolOrder)},Worker.prototype.loadTile=function(e,r,o){this.getWorkerSource(e,r.type).loadTile(r,o)},Worker.prototype.reloadTile=function(e,r,o){this.getWorkerSource(e,r.type).reloadTile(r,o)},Worker.prototype.abortTile=function(e,r){this.getWorkerSource(e,r.type).abortTile(r)},Worker.prototype.removeTile=function(e,r){this.getWorkerSource(e,r.type).removeTile(r)},Worker.prototype.removeSource=function(e,r){var o=this.getWorkerSource(e,r.type);void 0!==o.removeSource&&o.removeSource(r)},Worker.prototype.redoPlacement=function(e,r,o){this.getWorkerSource(e,r.type).redoPlacement(r,o)},Worker.prototype.loadWorkerSource=function(e,r,o){try{this.self.importScripts(r.url),o()}catch(e){o(e)}},Worker.prototype.loadRTLTextPlugin=function(e,r,o){try{globalRTLTextPlugin.applyArabicShaping||globalRTLTextPlugin.processBidirectionalText||this.self.importScripts(r)}catch(e){o(e)}},Worker.prototype.getLayerIndex=function(e){var r=this.layerIndexes[e];return r||(r=this.layerIndexes[e]=new StyleLayerIndex),r},Worker.prototype.getWorkerSource=function(e,r){var o=this;if(this.workerSources[e]||(this.workerSources[e]={}),!this.workerSources[e][r]){var t={send:function(r,t,i,n){o.actor.send(r,t,i,n,e)}};this.workerSources[e][r]=new this.workerSourceTypes[r](t,this.getLayerIndex(e))}return this.workerSources[e][r]},module.exports=function(e){return new Worker(e)}; | |
},{"../style/style_layer_index":157,"../util/actor":193,"./geojson_worker_source":84,"./rtl_text_plugin":91,"./vector_tile_worker_source":98}],101:[function(_dereq_,module,exports){ | |
"use strict";function recalculateLayers(e,i){for(var r=0,o=e.layers;r<o.length;r+=1){var t=o[r];t.recalculate(i)}}function serializeBuckets(e,i){return e.filter(function(e){return!e.isEmpty()}).map(function(e){return e.serialize(i)})}var FeatureIndex=_dereq_("../data/feature_index"),CollisionTile=_dereq_("../symbol/collision_tile"),CollisionBoxArray=_dereq_("../symbol/collision_box"),DictionaryCoder=_dereq_("../util/dictionary_coder"),util=_dereq_("../util/util"),WorkerTile=function(e){this.coord=e.coord,this.uid=e.uid,this.zoom=e.zoom,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=e.overscaling,this.angle=e.angle,this.pitch=e.pitch,this.showCollisionBoxes=e.showCollisionBoxes};WorkerTile.prototype.parse=function(e,i,r,o){var t=this;e.layers||(e={layers:{_geojsonTileLayer:e}}),this.status="parsing",this.data=e,this.collisionBoxArray=new CollisionBoxArray;var s=new DictionaryCoder(Object.keys(e.layers).sort()),l=new FeatureIndex(this.coord,this.overscaling);l.bucketLayerIDs={};var n={},a=0,c={featureIndex:l,iconDependencies:{},glyphDependencies:{}},u=i.familiesBySource[this.source];for(var h in u){var y=e.layers[h];if(y){1===y.version&&util.warnOnce('Vector tile source "'+t.source+'" layer "'+h+'" does not use vector tile spec v2 and therefore may have some rendering errors.');for(var d=s.encode(h),p=[],m=0;m<y.length;m++){var v=y.feature(m);v.index=m,v.sourceLayerIndex=d,p.push(v)}for(var f=0,g=u[h];f<g.length;f+=1){var x=g[f],B=x[0];if(!(B.minzoom&&t.zoom<B.minzoom||B.maxzoom&&t.zoom>=B.maxzoom||B.layout&&"none"===B.layout.visibility)){for(var b=0,k=x;b<k.length;b+=1){var z=k[b];z.recalculate(t.zoom)}var C=n[B.id]=B.createBucket({index:a,layers:x,zoom:t.zoom,overscaling:t.overscaling,collisionBoxArray:t.collisionBoxArray});C.populate(p,c),l.bucketLayerIDs[a]=x.map(function(e){return e.id}),a++}}}}var T=function(e){t.status="done",l.paintPropertyStatistics={};for(var i in n)util.extend(l.paintPropertyStatistics,n[i].getPaintPropertyStatistics());var r=[];o(null,{buckets:serializeBuckets(util.values(n),r),featureIndex:l.serialize(r),collisionTile:e.serialize(r),collisionBoxArray:t.collisionBoxArray.serialize()},r)};this.symbolBuckets=[];for(var w=i.symbolOrder.length-1;w>=0;w--){var A=n[i.symbolOrder[w]];A&&t.symbolBuckets.push(A)}if(0===this.symbolBuckets.length)return T(new CollisionTile(this.angle,this.pitch,this.collisionBoxArray));var D=0,I=Object.keys(c.iconDependencies),O=util.mapObject(c.glyphDependencies,function(e){return Object.keys(e).map(Number)}),L=function(e){if(e)return o(e);if(D++,2===D){for(var i=new CollisionTile(t.angle,t.pitch,t.collisionBoxArray),r=0,s=t.symbolBuckets;r<s.length;r+=1){var l=s[r];recalculateLayers(l,t.zoom),l.prepare(O,I),l.place(i,t.showCollisionBoxes)}T(i)}};Object.keys(O).length?r.send("getGlyphs",{uid:this.uid,stacks:O},function(e,i){O=i,L(e)}):L(),I.length?r.send("getIcons",{icons:I},function(e,i){I=i,L(e)}):L()},WorkerTile.prototype.redoPlacement=function(e,i,r){var o=this;if(this.angle=e,this.pitch=i,"done"!==this.status)return{};for(var t=new CollisionTile(this.angle,this.pitch,this.collisionBoxArray),s=0,l=o.symbolBuckets;s<l.length;s+=1){var n=l[s];recalculateLayers(n,o.zoom),n.place(t,r)}var a=[];return{result:{buckets:serializeBuckets(this.symbolBuckets,a),collisionTile:t.serialize(a)},transferables:a}},module.exports=WorkerTile; | |
},{"../data/feature_index":55,"../symbol/collision_box":163,"../symbol/collision_tile":165,"../util/dictionary_coder":200,"../util/util":215}],102:[function(_dereq_,module,exports){ | |
"use strict";function deref(r,e){var f={};for(var t in r)"ref"!==t&&(f[t]=r[t]);return refProperties.forEach(function(r){r in e&&(f[r]=e[r])}),f}function derefLayers(r){r=r.slice();for(var e=Object.create(null),f=0;f<r.length;f++)e[r[f].id]=r[f];for(var t=0;t<r.length;t++)"ref"in r[t]&&(r[t]=deref(r[t],e[r[t].ref]));return r}var refProperties=_dereq_("./util/ref_properties");module.exports=derefLayers; | |
},{"./util/ref_properties":125}],103:[function(_dereq_,module,exports){ | |
"use strict";function diffSources(e,r,o,a){e=e||{},r=r||{};var s;for(s in e)e.hasOwnProperty(s)&&(r.hasOwnProperty(s)||(o.push({command:operations.removeSource,args:[s]}),a[s]=!0));for(s in r)r.hasOwnProperty(s)&&(e.hasOwnProperty(s)?isEqual(e[s],r[s])||(o.push({command:operations.removeSource,args:[s]}),o.push({command:operations.addSource,args:[s,r[s]]}),a[s]=!0):o.push({command:operations.addSource,args:[s,r[s]]}))}function diffLayerPropertyChanges(e,r,o,a,s,t){e=e||{},r=r||{};var n;for(n in e)e.hasOwnProperty(n)&&(isEqual(e[n],r[n])||o.push({command:t,args:[a,n,r[n],s]}));for(n in r)r.hasOwnProperty(n)&&!e.hasOwnProperty(n)&&(isEqual(e[n],r[n])||o.push({command:t,args:[a,n,r[n],s]}))}function pluckId(e){return e.id}function indexById(e,r){return e[r.id]=r,e}function diffLayers(e,r,o){e=e||[],r=r||[];var a,s,t,n,i,p,m,u=e.map(pluckId),l=r.map(pluckId),y=e.reduce(indexById,{}),c=r.reduce(indexById,{}),d=u.slice(),h=Object.create(null);for(a=0,s=0;a<u.length;a++)t=u[a],c.hasOwnProperty(t)?s++:(o.push({command:operations.removeLayer,args:[t]}),d.splice(d.indexOf(t,s),1));for(a=0,s=0;a<l.length;a++)t=l[l.length-1-a],d[d.length-1-a]!==t&&(y.hasOwnProperty(t)?(o.push({command:operations.removeLayer,args:[t]}),d.splice(d.lastIndexOf(t,d.length-s),1)):s++,p=d[d.length-a],o.push({command:operations.addLayer,args:[c[t],p]}),d.splice(d.length-a,0,t),h[t]=!0);for(a=0;a<l.length;a++)if(t=l[a],n=y[t],i=c[t],!h[t]&&!isEqual(n,i))if(isEqual(n.source,i.source)&&isEqual(n["source-layer"],i["source-layer"])&&isEqual(n.type,i.type)){diffLayerPropertyChanges(n.layout,i.layout,o,t,null,operations.setLayoutProperty),diffLayerPropertyChanges(n.paint,i.paint,o,t,null,operations.setPaintProperty),isEqual(n.filter,i.filter)||o.push({command:operations.setFilter,args:[t,i.filter]}),isEqual(n.minzoom,i.minzoom)&&isEqual(n.maxzoom,i.maxzoom)||o.push({command:operations.setLayerZoomRange,args:[t,i.minzoom,i.maxzoom]});for(m in n)n.hasOwnProperty(m)&&"layout"!==m&&"paint"!==m&&"filter"!==m&&"metadata"!==m&&"minzoom"!==m&&"maxzoom"!==m&&(0===m.indexOf("paint.")?diffLayerPropertyChanges(n[m],i[m],o,t,m.slice(6),operations.setPaintProperty):isEqual(n[m],i[m])||o.push({command:operations.setLayerProperty,args:[t,m,i[m]]}));for(m in i)i.hasOwnProperty(m)&&!n.hasOwnProperty(m)&&"layout"!==m&&"paint"!==m&&"filter"!==m&&"metadata"!==m&&"minzoom"!==m&&"maxzoom"!==m&&(0===m.indexOf("paint.")?diffLayerPropertyChanges(n[m],i[m],o,t,m.slice(6),operations.setPaintProperty):isEqual(n[m],i[m])||o.push({command:operations.setLayerProperty,args:[t,m,i[m]]}))}else o.push({command:operations.removeLayer,args:[t]}),p=d[d.lastIndexOf(t)+1],o.push({command:operations.addLayer,args:[i,p]})}function diffStyles(e,r){if(!e)return[{command:operations.setStyle,args:[r]}];var o=[];try{if(!isEqual(e.version,r.version))return[{command:operations.setStyle,args:[r]}];isEqual(e.center,r.center)||o.push({command:operations.setCenter,args:[r.center]}),isEqual(e.zoom,r.zoom)||o.push({command:operations.setZoom,args:[r.zoom]}),isEqual(e.bearing,r.bearing)||o.push({command:operations.setBearing,args:[r.bearing]}),isEqual(e.pitch,r.pitch)||o.push({command:operations.setPitch,args:[r.pitch]}),isEqual(e.sprite,r.sprite)||o.push({command:operations.setSprite,args:[r.sprite]}),isEqual(e.glyphs,r.glyphs)||o.push({command:operations.setGlyphs,args:[r.glyphs]}),isEqual(e.transition,r.transition)||o.push({command:operations.setTransition,args:[r.transition]}),isEqual(e.light,r.light)||o.push({command:operations.setLight,args:[r.light]});var a={},s=[];diffSources(e.sources,r.sources,s,a);var t=[];e.layers&&e.layers.forEach(function(e){a[e.source]?o.push({command:operations.removeLayer,args:[e.id]}):t.push(e)}),o=o.concat(s),diffLayers(t,r.layers,o)}catch(e){console.warn("Unable to compute style diff:",e),o=[{command:operations.setStyle,args:[r]}]}return o}var isEqual=_dereq_("lodash.isequal"),operations={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};module.exports=diffStyles,module.exports.operations=operations; | |
},{"lodash.isequal":116}],104:[function(_dereq_,module,exports){ | |
"use strict";function ValidationError(r,i){this.message=(r?r+": ":"")+format.apply(format,Array.prototype.slice.call(arguments,2)),null!==i&&void 0!==i&&i.__line__&&(this.line=i.__line__)}var format=_dereq_("util").format;module.exports=ValidationError; | |
},{"util":33}],105:[function(_dereq_,module,exports){ | |
"use strict";function createFilter(e){return new Function("f","var p = (f && f.properties || {}); return "+compile(e))}function compile(e){if(!e)return"true";var i=e[0];if(e.length<=1)return"any"===i?"false":"true";var n="=="===i?compileComparisonOp(e[1],e[2],"===",!1):"!="===i?compileComparisonOp(e[1],e[2],"!==",!1):"<"===i||">"===i||"<="===i||">="===i?compileComparisonOp(e[1],e[2],i,!0):"any"===i?compileLogicalOp(e.slice(1),"||"):"all"===i?compileLogicalOp(e.slice(1),"&&"):"none"===i?compileNegation(compileLogicalOp(e.slice(1),"||")):"in"===i?compileInOp(e[1],e.slice(2)):"!in"===i?compileNegation(compileInOp(e[1],e.slice(2))):"has"===i?compileHasOp(e[1]):"!has"===i?compileNegation(compileHasOp(e[1])):"true";return"("+n+")"}function compilePropertyReference(e){return"$type"===e?"f.type":"$id"===e?"f.id":"p["+JSON.stringify(e)+"]"}function compileComparisonOp(e,i,n,r){var o=compilePropertyReference(e),t="$type"===e?types.indexOf(i):JSON.stringify(i);return(r?"typeof "+o+"=== typeof "+t+"&&":"")+o+n+t}function compileLogicalOp(e,i){return e.map(compile).join(i)}function compileInOp(e,i){"$type"===e&&(i=i.map(function(e){return types.indexOf(e)}));var n=JSON.stringify(i.sort(compare)),r=compilePropertyReference(e);return i.length<=200?n+".indexOf("+r+") !== -1":"function(v, a, i, j) {while (i <= j) { var m = (i + j) >> 1; if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;}return false; }("+r+", "+n+",0,"+(i.length-1)+")"}function compileHasOp(e){return"$id"===e?'"id" in f':JSON.stringify(e)+" in p"}function compileNegation(e){return"!("+e+")"}function compare(e,i){return e<i?-1:e>i?1:0}module.exports=createFilter;var types=["Unknown","Point","LineString","Polygon"]; | |
},{}],106:[function(_dereq_,module,exports){ | |
"use strict";function xyz2lab(r){return r>t3?Math.pow(r,1/3):r/t2+t0}function lab2xyz(r){return r>t1?r*r*r:t2*(r-t0)}function xyz2rgb(r){return 255*(r<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055)}function rgb2xyz(r){return r/=255,r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function rgbToLab(r){var t=rgb2xyz(r[0]),a=rgb2xyz(r[1]),n=rgb2xyz(r[2]),b=xyz2lab((.4124564*t+.3575761*a+.1804375*n)/Xn),o=xyz2lab((.2126729*t+.7151522*a+.072175*n)/Yn),g=xyz2lab((.0193339*t+.119192*a+.9503041*n)/Zn);return[116*o-16,500*(b-o),200*(o-g),r[3]]}function labToRgb(r){var t=(r[0]+16)/116,a=isNaN(r[1])?t:t+r[1]/500,n=isNaN(r[2])?t:t-r[2]/200;return t=Yn*lab2xyz(t),a=Xn*lab2xyz(a),n=Zn*lab2xyz(n),[xyz2rgb(3.2404542*a-1.5371385*t-.4985314*n),xyz2rgb(-.969266*a+1.8760108*t+.041556*n),xyz2rgb(.0556434*a-.2040259*t+1.0572252*n),r[3]]}function rgbToHcl(r){var t=rgbToLab(r),a=t[0],n=t[1],b=t[2],o=Math.atan2(b,n)*rad2deg;return[o<0?o+360:o,Math.sqrt(n*n+b*b),a,r[3]]}function hclToRgb(r){var t=r[0]*deg2rad,a=r[1],n=r[2];return labToRgb([n,Math.cos(t)*a,Math.sin(t)*a,r[3]])}var Xn=.95047,Yn=1,Zn=1.08883,t0=4/29,t1=6/29,t2=3*t1*t1,t3=t1*t1*t1,deg2rad=Math.PI/180,rad2deg=180/Math.PI;module.exports={lab:{forward:rgbToLab,reverse:labToRgb},hcl:{forward:rgbToHcl,reverse:hclToRgb}}; | |
},{}],107:[function(_dereq_,module,exports){ | |
"use strict";function identityFunction(t){return t}function createFunction(t,e){var o,n="color"===e.type;if(isFunctionDefinition(t)){var r=t.stops&&"object"==typeof t.stops[0][0],a=r||void 0!==t.property,i=r||!a,s=t.type||("interpolated"===e.function?"exponential":"interval");n&&(t=extend({},t),t.stops&&(t.stops=t.stops.map(function(t){return[t[0],parseColor(t[1])]})),t.default?t.default=parseColor(t.default):t.default=parseColor(e.default));var u,p,l;if("exponential"===s)u=evaluateExponentialFunction;else if("interval"===s)u=evaluateIntervalFunction;else if("categorical"===s){u=evaluateCategoricalFunction,p=Object.create(null);for(var c=0,f=t.stops;c<f.length;c+=1){var d=f[c];p[d[0]]=d[1]}l=typeof t.stops[0][0]}else{if("identity"!==s)throw new Error('Unknown function type "'+s+'"');u=evaluateIdentityFunction}var v;if(t.colorSpace&&"rgb"!==t.colorSpace){if(!colorSpaces[t.colorSpace])throw new Error("Unknown color space: "+t.colorSpace);var y=colorSpaces[t.colorSpace];t=JSON.parse(JSON.stringify(t));for(var F=0;F<t.stops.length;F++)t.stops[F]=[t.stops[F][0],y.forward(t.stops[F][1])];v=y.reverse}else v=identityFunction;if(r){for(var h={},g=[],C=0;C<t.stops.length;C++){var m=t.stops[C],S=m[0].zoom;void 0===h[S]&&(h[S]={zoom:S,type:t.type,property:t.property,default:t.default,stops:[]},g.push(S)),h[S].stops.push([m[0].value,m[1]])}for(var T=[],x=0,b=g;x<b.length;x+=1){var q=b[x];T.push([h[q].zoom,createFunction(h[q],e)])}o=function(o,n){return v(evaluateExponentialFunction({stops:T,base:t.base},e,o)(o,n))},o.isFeatureConstant=!1,o.isZoomConstant=!1}else i?(o=function(o){return v(u(t,e,o,p,l))},o.isFeatureConstant=!0,o.isZoomConstant=!1):(o=function(o,n){var r=n[t.property];return void 0===r?coalesce(t.default,e.default):v(u(t,e,r,p,l))},o.isFeatureConstant=!1,o.isZoomConstant=!0)}else n&&t&&(t=parseColor(t)),o=function(){return t},o.isFeatureConstant=!0,o.isZoomConstant=!0;return o}function coalesce(t,e,o){return void 0!==t?t:void 0!==e?e:void 0!==o?o:void 0}function evaluateCategoricalFunction(t,e,o,n,r){var a=typeof o===r?n[o]:void 0;return coalesce(a,t.default,e.default)}function evaluateIntervalFunction(t,e,o){if("number"!==getType(o))return coalesce(t.default,e.default);var n=t.stops.length;if(1===n)return t.stops[0][1];if(o<=t.stops[0][0])return t.stops[0][1];if(o>=t.stops[n-1][0])return t.stops[n-1][1];var r=findStopLessThanOrEqualTo(t.stops,o);return t.stops[r][1]}function evaluateExponentialFunction(t,e,o){var n=void 0!==t.base?t.base:1;if("number"!==getType(o))return coalesce(t.default,e.default);var r=t.stops.length;if(1===r)return t.stops[0][1];if(o<=t.stops[0][0])return t.stops[0][1];if(o>=t.stops[r-1][0])return t.stops[r-1][1];var a=findStopLessThanOrEqualTo(t.stops,o),i=interpolationFactor(o,n,t.stops[a][0],t.stops[a+1][0]),s=t.stops[a][1],u=t.stops[a+1][1],p=interpolate[e.type]||identityFunction;return"function"==typeof s?function(){var t=s.apply(void 0,arguments),e=u.apply(void 0,arguments);if(void 0!==t&&void 0!==e)return p(t,e,i)}:p(s,u,i)}function evaluateIdentityFunction(t,e,o){return"color"===e.type?o=parseColor(o):getType(o)!==e.type&&(o=void 0),coalesce(o,t.default,e.default)}function findStopLessThanOrEqualTo(t,e){for(var o,n,r=t.length,a=0,i=r-1,s=0;a<=i;){if(s=Math.floor((a+i)/2),o=t[s][0],n=t[s+1][0],e===o||e>o&&e<n)return s;o<e?a=s+1:o>e&&(i=s-1)}return Math.max(s-1,0)}function isFunctionDefinition(t){return"object"==typeof t&&(t.stops||"identity"===t.type)}function interpolationFactor(t,e,o,n){var r=n-o,a=t-o;return 1===e?a/r:(Math.pow(e,a)-1)/(Math.pow(e,r)-1)}var colorSpaces=_dereq_("./color_spaces"),parseColor=_dereq_("../util/parse_color"),extend=_dereq_("../util/extend"),getType=_dereq_("../util/get_type"),interpolate=_dereq_("../util/interpolate");module.exports=createFunction,module.exports.isFunctionDefinition=isFunctionDefinition,module.exports.interpolationFactor=interpolationFactor,module.exports.findStopLessThanOrEqualTo=findStopLessThanOrEqualTo; | |
},{"../util/extend":121,"../util/get_type":122,"../util/interpolate":123,"../util/parse_color":124,"./color_spaces":106}],108:[function(_dereq_,module,exports){ | |
"use strict";function key(r){return stringify(refProperties.map(function(e){return r[e]}))}function groupByLayout(r){for(var e={},t=0;t<r.length;t++){var i=key(r[t]),u=e[i];u||(u=e[i]=[]),u.push(r[t])}var n=[];for(var o in e)n.push(e[o]);return n}var refProperties=_dereq_("./util/ref_properties"),stringify=_dereq_("fast-stable-stringify");module.exports=groupByLayout; | |
},{"./util/ref_properties":125,"fast-stable-stringify":110}],109:[function(_dereq_,module,exports){ | |
function clamp_css_byte(e){return e=Math.round(e),e<0?0:e>255?255:e}function clamp_css_float(e){return e<0?0:e>1?1:e}function parse_css_int(e){return clamp_css_byte("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function parse_css_float(e){return clamp_css_float("%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))}function css_hue_to_rgb(e,r,l){return l<0?l+=1:l>1&&(l-=1),6*l<1?e+(r-e)*l*6:2*l<1?r:3*l<2?e+(r-e)*(2/3-l)*6:e}function parseCSSColor(e){var r=e.replace(/ /g,"").toLowerCase();if(r in kCSSColorTable)return kCSSColorTable[r].slice();if("#"===r[0]){if(4===r.length){var l=parseInt(r.substr(1),16);return l>=0&&l<=4095?[(3840&l)>>4|(3840&l)>>8,240&l|(240&l)>>4,15&l|(15&l)<<4,1]:null}if(7===r.length){var l=parseInt(r.substr(1),16);return l>=0&&l<=16777215?[(16711680&l)>>16,(65280&l)>>8,255&l,1]:null}return null}var a=r.indexOf("("),t=r.indexOf(")");if(a!==-1&&t+1===r.length){var n=r.substr(0,a),s=r.substr(a+1,t-(a+1)).split(","),o=1;switch(n){case"rgba":if(4!==s.length)return null;o=parse_css_float(s.pop());case"rgb":return 3!==s.length?null:[parse_css_int(s[0]),parse_css_int(s[1]),parse_css_int(s[2]),o];case"hsla":if(4!==s.length)return null;o=parse_css_float(s.pop());case"hsl":if(3!==s.length)return null;var i=(parseFloat(s[0])%360+360)%360/360,u=parse_css_float(s[1]),g=parse_css_float(s[2]),d=g<=.5?g*(u+1):g+u-g*u,c=2*g-d;return[clamp_css_byte(255*css_hue_to_rgb(c,d,i+1/3)),clamp_css_byte(255*css_hue_to_rgb(c,d,i)),clamp_css_byte(255*css_hue_to_rgb(c,d,i-1/3)),o];default:return null}}return null}var kCSSColorTable={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};try{exports.parseCSSColor=parseCSSColor}catch(e){} | |
},{}],110:[function(_dereq_,module,exports){ | |
function sss(r){var e,t,s,n,u,a;switch(typeof r){case"object":if(null===r)return null;if(isArray(r)){for(s="[",t=r.length-1,e=0;e<t;e++)s+=sss(r[e])+",";return t>-1&&(s+=sss(r[e])),s+"]"}for(n=objKeys(r).sort(),t=n.length,s="{",u=n[e=0],a=t>0&&void 0!==r[u];e<t;)a?(s+='"'+u.replace(strReg,strReplace)+'":'+sss(r[u]),u=n[++e],a=e<t&&void 0!==r[u],a&&(s+=",")):(u=n[++e],a=e<t&&void 0!==r[u]);return s+"}";case"undefined":return null;case"string":return'"'+r.replace(strReg,strReplace)+'"';default:return r}}var toString={}.toString,isArray=Array.isArray||function(r){return"[object Array]"===toString.call(r)},objKeys=Object.keys||function(r){var e=[];for(var t in r)r.hasOwnProperty(t)&&e.push(t);return e},strReg=/[\u0000-\u001f"\\]/g,strReplace=function(r){var e=r.charCodeAt(0);switch(e){case 34:return'\\"';case 92:return"\\\\";case 12:return"\\f";case 10:return"\\n";case 13:return"\\r";case 9:return"\\t";case 8:return"\\b";default:return e>15?"\\u00"+e.toString(16):"\\u000"+e.toString(16)}};module.exports=function(r){if(void 0!==r)return""+sss(r)},module.exports.stringSearch=strReg,module.exports.stringReplace=strReplace; | |
},{}],111:[function(_dereq_,module,exports){ | |
function isObjectLike(r){return!!r&&"object"==typeof r}function arraySome(r,e){for(var a=-1,t=r.length;++a<t;)if(e(r[a],a,r))return!0;return!1}function baseIsEqual(r,e,a,t,o,n){return r===e||(null==r||null==e||!isObject(r)&&!isObjectLike(e)?r!==r&&e!==e:baseIsEqualDeep(r,e,baseIsEqual,a,t,o,n))}function baseIsEqualDeep(r,e,a,t,o,n,u){var c=isArray(r),s=isArray(e),i=arrayTag,g=arrayTag;c||(i=objToString.call(r),i==argsTag?i=objectTag:i!=objectTag&&(c=isTypedArray(r))),s||(g=objToString.call(e),g==argsTag?g=objectTag:g!=objectTag&&(s=isTypedArray(e)));var b=i==objectTag,l=g==objectTag,f=i==g;if(f&&!c&&!b)return equalByTag(r,e,i);if(!o){var y=b&&hasOwnProperty.call(r,"__wrapped__"),T=l&&hasOwnProperty.call(e,"__wrapped__");if(y||T)return a(y?r.value():r,T?e.value():e,t,o,n,u)}if(!f)return!1;n||(n=[]),u||(u=[]);for(var j=n.length;j--;)if(n[j]==r)return u[j]==e;n.push(r),u.push(e);var p=(c?equalArrays:equalObjects)(r,e,a,t,o,n,u);return n.pop(),u.pop(),p}function equalArrays(r,e,a,t,o,n,u){var c=-1,s=r.length,i=e.length;if(s!=i&&!(o&&i>s))return!1;for(;++c<s;){var g=r[c],b=e[c],l=t?t(o?b:g,o?g:b,c):void 0;if(void 0!==l){if(l)continue;return!1}if(o){if(!arraySome(e,function(r){return g===r||a(g,r,t,o,n,u)}))return!1}else if(g!==b&&!a(g,b,t,o,n,u))return!1}return!0}function equalByTag(r,e,a){switch(a){case boolTag:case dateTag:return+r==+e;case errorTag:return r.name==e.name&&r.message==e.message;case numberTag:return r!=+r?e!=+e:r==+e;case regexpTag:case stringTag:return r==e+""}return!1}function equalObjects(r,e,a,t,o,n,u){var c=keys(r),s=c.length,i=keys(e),g=i.length;if(s!=g&&!o)return!1;for(var b=s;b--;){var l=c[b];if(!(o?l in e:hasOwnProperty.call(e,l)))return!1}for(var f=o;++b<s;){l=c[b];var y=r[l],T=e[l],j=t?t(o?T:y,o?y:T,l):void 0;if(!(void 0===j?a(y,T,t,o,n,u):j))return!1;f||(f="constructor"==l)}if(!f){var p=r.constructor,v=e.constructor;if(p!=v&&"constructor"in r&&"constructor"in e&&!("function"==typeof p&&p instanceof p&&"function"==typeof v&&v instanceof v))return!1}return!0}function isObject(r){var e=typeof r;return!!r&&("object"==e||"function"==e)}var isArray=_dereq_("lodash.isarray"),isTypedArray=_dereq_("lodash.istypedarray"),keys=_dereq_("lodash.keys"),argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",stringTag="[object String]",objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,objToString=objectProto.toString;module.exports=baseIsEqual; | |
},{"lodash.isarray":115,"lodash.istypedarray":117,"lodash.keys":118}],112:[function(_dereq_,module,exports){ | |
function bindCallback(n,t,r){if("function"!=typeof n)return identity;if(void 0===t)return n;switch(r){case 1:return function(r){return n.call(t,r)};case 3:return function(r,e,u){return n.call(t,r,e,u)};case 4:return function(r,e,u,c){return n.call(t,r,e,u,c)};case 5:return function(r,e,u,c,i){return n.call(t,r,e,u,c,i)}}return function(){return n.apply(t,arguments)}}function identity(n){return n}module.exports=bindCallback; | |
},{}],113:[function(_dereq_,module,exports){ | |
function isObjectLike(t){return!!t&&"object"==typeof t}function getNative(t,o){var e=null==t?void 0:t[o];return isNative(e)?e:void 0}function isFunction(t){return isObject(t)&&objToString.call(t)==funcTag}function isObject(t){var o=typeof t;return!!t&&("object"==o||"function"==o)}function isNative(t){return null!=t&&(isFunction(t)?reIsNative.test(fnToString.call(t)):isObjectLike(t)&&reIsHostCtor.test(t))}var funcTag="[object Function]",reIsHostCtor=/^\[object .+?Constructor\]$/,objectProto=Object.prototype,fnToString=Function.prototype.toString,hasOwnProperty=objectProto.hasOwnProperty,objToString=objectProto.toString,reIsNative=RegExp("^"+fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");module.exports=getNative; | |
},{}],114:[function(_dereq_,module,exports){ | |
function isArguments(t){return isArrayLikeObject(t)&&hasOwnProperty.call(t,"callee")&&(!propertyIsEnumerable.call(t,"callee")||objectToString.call(t)==argsTag)}function isArrayLike(t){return null!=t&&isLength(t.length)&&!isFunction(t)}function isArrayLikeObject(t){return isObjectLike(t)&&isArrayLike(t)}function isFunction(t){var e=isObject(t)?objectToString.call(t):"";return e==funcTag||e==genTag}function isLength(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=MAX_SAFE_INTEGER}function isObject(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function isObjectLike(t){return!!t&&"object"==typeof t}var MAX_SAFE_INTEGER=9007199254740991,argsTag="[object Arguments]",funcTag="[object Function]",genTag="[object GeneratorFunction]",objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,objectToString=objectProto.toString,propertyIsEnumerable=objectProto.propertyIsEnumerable;module.exports=isArguments; | |
},{}],115:[function(_dereq_,module,exports){ | |
function isObjectLike(t){return!!t&&"object"==typeof t}function getNative(t,r){var e=null==t?void 0:t[r];return isNative(e)?e:void 0}function isLength(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=MAX_SAFE_INTEGER}function isFunction(t){return isObject(t)&&objToString.call(t)==funcTag}function isObject(t){var r=typeof t;return!!t&&("object"==r||"function"==r)}function isNative(t){return null!=t&&(isFunction(t)?reIsNative.test(fnToString.call(t)):isObjectLike(t)&&reIsHostCtor.test(t))}var arrayTag="[object Array]",funcTag="[object Function]",reIsHostCtor=/^\[object .+?Constructor\]$/,objectProto=Object.prototype,fnToString=Function.prototype.toString,hasOwnProperty=objectProto.hasOwnProperty,objToString=objectProto.toString,reIsNative=RegExp("^"+fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nativeIsArray=getNative(Array,"isArray"),MAX_SAFE_INTEGER=9007199254740991,isArray=nativeIsArray||function(t){return isObjectLike(t)&&isLength(t.length)&&objToString.call(t)==arrayTag};module.exports=isArray; | |
},{}],116:[function(_dereq_,module,exports){ | |
function isEqual(a,l,i,e){i="function"==typeof i?bindCallback(i,e,3):void 0;var s=i?i(a,l):void 0;return void 0===s?baseIsEqual(a,l,i):!!s}var baseIsEqual=_dereq_("lodash._baseisequal"),bindCallback=_dereq_("lodash._bindcallback");module.exports=isEqual; | |
},{"lodash._baseisequal":111,"lodash._bindcallback":112}],117:[function(_dereq_,module,exports){ | |
function isLength(a){return"number"==typeof a&&a>-1&&a%1==0&&a<=MAX_SAFE_INTEGER}function isObjectLike(a){return!!a&&"object"==typeof a}function isTypedArray(a){return isObjectLike(a)&&isLength(a.length)&&!!typedArrayTags[objectToString.call(a)]}var MAX_SAFE_INTEGER=9007199254740991,argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",mapTag="[object Map]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",weakMapTag="[object WeakMap]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0,typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=!1;var objectProto=Object.prototype,objectToString=objectProto.toString;module.exports=isTypedArray; | |
},{}],118:[function(_dereq_,module,exports){ | |
function baseProperty(e){return function(t){return null==t?void 0:t[e]}}function isArrayLike(e){return null!=e&&isLength(getLength(e))}function isIndex(e,t){return e="number"==typeof e||reIsUint.test(e)?+e:-1,t=null==t?MAX_SAFE_INTEGER:t,e>-1&&e%1==0&&e<t}function isLength(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=MAX_SAFE_INTEGER}function shimKeys(e){for(var t=keysIn(e),r=t.length,n=r&&e.length,s=!!n&&isLength(n)&&(isArray(e)||isArguments(e)),o=-1,i=[];++o<r;){var u=t[o];(s&&isIndex(u,n)||hasOwnProperty.call(e,u))&&i.push(u)}return i}function isObject(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function keysIn(e){if(null==e)return[];isObject(e)||(e=Object(e));var t=e.length;t=t&&isLength(t)&&(isArray(e)||isArguments(e))&&t||0;for(var r=e.constructor,n=-1,s="function"==typeof r&&r.prototype===e,o=Array(t),i=t>0;++n<t;)o[n]=n+"";for(var u in e)i&&isIndex(u,t)||"constructor"==u&&(s||!hasOwnProperty.call(e,u))||o.push(u);return o}var getNative=_dereq_("lodash._getnative"),isArguments=_dereq_("lodash.isarguments"),isArray=_dereq_("lodash.isarray"),reIsUint=/^\d+$/,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,nativeKeys=getNative(Object,"keys"),MAX_SAFE_INTEGER=9007199254740991,getLength=baseProperty("length"),keys=nativeKeys?function(e){var t=null==e?void 0:e.constructor;return"function"==typeof t&&t.prototype===e||"function"!=typeof e&&isArrayLike(e)?shimKeys(e):isObject(e)?nativeKeys(e):[]}:shimKeys;module.exports=keys; | |
},{"lodash._getnative":113,"lodash.isarguments":114,"lodash.isarray":115}],119:[function(_dereq_,module,exports){ | |
"use strict";module.exports=_dereq_("./v8.json"); | |
},{"./v8.json":120}],120:[function(_dereq_,module,exports){ | |
module.exports={"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_tile","source_geojson","source_video","source_image","source_canvas"],"source_tile":{"type":{"required":true,"type":"enum","values":{"vector":{},"raster":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_canvas":{"type":{"required":true,"type":"enum","values":{"canvas":{}}},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}},"animate":{"type":"boolean","default":"true"},"canvas":{"type":"string","required":true}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"fill-extrusion":{},"raster":{},"background":{}}},"metadata":{"type":"*"},"ref":{"type":"string"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"paint.*":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_fill-extrusion","layout_symbol","layout_raster","layout_background"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible"}},"layout_fill":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible"}},"layout_circle":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible"}},"layout_line":{"line-cap":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"butt":{},"round":{},"square":{}},"default":"butt"},"line-join":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"bevel":{},"round":{},"miter":{}},"default":"miter"},"line-miter-limit":{"type":"number","default":2,"function":"interpolated","zoom-function":true,"requires":[{"line-join":"miter"}]},"line-round-limit":{"type":"number","default":1.05,"function":"interpolated","zoom-function":true,"requires":[{"line-join":"round"}]},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible"}},"layout_symbol":{"symbol-placement":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"point":{},"line":{}},"default":"point"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"function":"interpolated","zoom-function":true,"units":"pixels","requires":[{"symbol-placement":"line"}]},"symbol-avoid-edges":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"default":false},"icon-allow-overlap":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"default":false,"requires":["icon-image"]},"icon-ignore-placement":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"default":false,"requires":["icon-image"]},"icon-optional":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"default":false,"requires":["icon-image","text-field"]},"icon-rotation-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"]},"icon-size":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"requires":["icon-image"]},"icon-text-fit":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"none":{},"width":{},"height":{},"both":{}},"default":"none","requires":["icon-image","text-field"]},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"units":"pixels","function":"interpolated","zoom-function":true,"requires":["icon-image","text-field",{"icon-text-fit":["both","width","height"]}]},"icon-image":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"tokens":true},"icon-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","zoom-function":true,"property-function":true,"units":"degrees","requires":["icon-image"]},"icon-padding":{"type":"number","default":2,"minimum":0,"function":"interpolated","zoom-function":true,"units":"pixels","requires":["icon-image"]},"icon-keep-upright":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"requires":["icon-image"]},"text-pitch-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"]},"text-rotation-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"]},"text-field":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":"","tokens":true},"text-font":{"type":"array","value":"string","function":"piecewise-constant","zoom-function":true,"default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"]},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","function":"interpolated","zoom-function":true,"requires":["text-field"]},"text-line-height":{"type":"number","default":1.2,"units":"ems","function":"interpolated","zoom-function":true,"requires":["text-field"]},"text-letter-spacing":{"type":"number","default":0,"units":"ems","function":"interpolated","zoom-function":true,"requires":["text-field"]},"text-justify":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"]},"text-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["text-field"]},"text-max-angle":{"type":"number","default":45,"units":"degrees","function":"interpolated","zoom-function":true,"requires":["text-field",{"symbol-placement":"line"}]},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","function":"interpolated","zoom-function":true,"requires":["text-field"]},"text-keep-upright":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"]},"text-offset":{"type":"array","value":"number","units":"ems","function":"interpolated","zoom-function":true,"property-function":true,"length":2,"default":[0,0],"requires":["text-field"]},"text-allow-overlap":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"default":false,"requires":["text-field"]},"text-ignore-placement":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"default":false,"requires":["text-field"]},"text-optional":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"default":false,"requires":["text-field","icon-image"]},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible"}},"filter":{"type":"array","value":"*"},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":22,"value":["number","color"],"length":2},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"transition":false},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"function":"interpolated","zoom-function":true,"property-function":false},"color":{"type":"color","default":"#ffffff","function":"interpolated","zoom-function":true,"property-function":false,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":false,"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_fill-extrusion","paint_symbol","paint_raster","paint_background"],"paint_fill":{"fill-antialias":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"default":true},"fill-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"fill-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-pattern"}]},"fill-outline-color":{"type":"color","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}]},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels"},"fill-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"]},"fill-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"transition":true}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":false,"default":1,"minimum":0,"maximum":1,"transition":true},"fill-extrusion-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-extrusion-pattern"}]},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels"},"fill-extrusion-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"]},"fill-extrusion-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"transition":true},"fill-extrusion-height":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":0,"minimum":0,"maximum":65535,"units":"meters","transition":true},"fill-extrusion-base":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":0,"minimum":0,"maximum":65535,"units":"meters","transition":true,"requires":["fill-extrusion-height"]}},"paint_line":{"line-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"line-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"line-pattern"}]},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels"},"line-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"]},"line-width":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels"},"line-gap-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-offset":{"type":"number","default":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-dasharray":{"type":"array","value":"number","function":"piecewise-constant","zoom-function":true,"minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}]},"line-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"circle-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-blur":{"type":"number","default":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels"},"circle-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"]},"circle-pitch-scale":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"circle-stroke-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"]},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"]}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-hue-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","zoom-function":true,"transition":true,"units":"degrees"},"raster-brightness-min":{"type":"number","function":"interpolated","zoom-function":true,"default":0,"minimum":0,"maximum":1,"transition":true},"raster-brightness-max":{"type":"number","function":"interpolated","zoom-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"function":"interpolated","zoom-function":true,"transition":true,"units":"milliseconds"}},"paint_background":{"background-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"transition":true,"requires":[{"!":"background-pattern"}]},"background-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"transition":true},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}}} | |
},{}],121:[function(_dereq_,module,exports){ | |
"use strict";module.exports=function(r){for(var t=arguments,e=1;e<arguments.length;e++){var n=t[e];for(var o in n)r[o]=n[o]}return r}; | |
},{}],122:[function(_dereq_,module,exports){ | |
"use strict";module.exports=function(n){return n instanceof Number?"number":n instanceof String?"string":n instanceof Boolean?"boolean":Array.isArray(n)?"array":null===n?"null":typeof n}; | |
},{}],123:[function(_dereq_,module,exports){ | |
"use strict";function interpolate(t,e,n){return t*(1-n)+e*n}module.exports=interpolate,interpolate.number=interpolate,interpolate.vec2=function(t,e,n){return[interpolate(t[0],e[0],n),interpolate(t[1],e[1],n)]},interpolate.color=function(t,e,n){return[interpolate(t[0],e[0],n),interpolate(t[1],e[1],n),interpolate(t[2],e[2],n),interpolate(t[3],e[3],n)]},interpolate.array=function(t,e,n){return t.map(function(t,r){return interpolate(t,e[r],n)})}; | |
},{}],124:[function(_dereq_,module,exports){ | |
"use strict";var parseColorString=_dereq_("csscolorparser").parseCSSColor;module.exports=function(r){if("string"==typeof r){var e=parseColorString(r);if(!e)return;return[e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]]}return Array.isArray(r)?r:void 0}; | |
},{"csscolorparser":109}],125:[function(_dereq_,module,exports){ | |
"use strict";module.exports=["type","source","source-layer","minzoom","maxzoom","filter","layout"]; | |
},{}],126:[function(_dereq_,module,exports){ | |
"use strict";module.exports=function(n){return n instanceof Number||n instanceof String||n instanceof Boolean?n.valueOf():n}; | |
},{}],127:[function(_dereq_,module,exports){ | |
"use strict";var ValidationError=_dereq_("../error/validation_error"),getType=_dereq_("../util/get_type"),extend=_dereq_("../util/extend");module.exports=function(e){var r=_dereq_("./validate_function"),t=_dereq_("./validate_object"),i={"*":function(){return[]},array:_dereq_("./validate_array"),boolean:_dereq_("./validate_boolean"),number:_dereq_("./validate_number"),color:_dereq_("./validate_color"),constants:_dereq_("./validate_constants"),enum:_dereq_("./validate_enum"),filter:_dereq_("./validate_filter"),function:_dereq_("./validate_function"),layer:_dereq_("./validate_layer"),object:_dereq_("./validate_object"),source:_dereq_("./validate_source"),light:_dereq_("./validate_light"),string:_dereq_("./validate_string")},a=e.value,n=e.valueSpec,u=e.key,o=e.styleSpec,l=e.style;if("string"===getType(a)&&"@"===a[0]){if(o.$version>7)return[new ValidationError(u,a,"constants have been deprecated as of v8")];if(!(a in l.constants))return[new ValidationError(u,a,'constant "%s" not found',a)];e=extend({},e,{value:l.constants[a]})}return n.function&&"object"===getType(a)?r(e):n.type&&i[n.type]?i[n.type](e):t(extend({},e,{valueSpec:n.type?o[n.type]:n}))}; | |
},{"../error/validation_error":104,"../util/extend":121,"../util/get_type":122,"./validate_array":128,"./validate_boolean":129,"./validate_color":130,"./validate_constants":131,"./validate_enum":132,"./validate_filter":133,"./validate_function":134,"./validate_layer":136,"./validate_light":138,"./validate_number":139,"./validate_object":140,"./validate_source":143,"./validate_string":144}],128:[function(_dereq_,module,exports){ | |
"use strict";var getType=_dereq_("../util/get_type"),validate=_dereq_("./validate"),ValidationError=_dereq_("../error/validation_error");module.exports=function(e){var r=e.value,t=e.valueSpec,a=e.style,n=e.styleSpec,l=e.key,i=e.arrayElementValidator||validate;if("array"!==getType(r))return[new ValidationError(l,r,"array expected, %s found",getType(r))];if(t.length&&r.length!==t.length)return[new ValidationError(l,r,"array length %d expected, length %d found",t.length,r.length)];if(t["min-length"]&&r.length<t["min-length"])return[new ValidationError(l,r,"array length at least %d expected, length %d found",t["min-length"],r.length)];var o={type:t.value};n.$version<7&&(o.function=t.function),"object"===getType(t.value)&&(o=t.value);for(var u=[],d=0;d<r.length;d++)u=u.concat(i({array:r,arrayIndex:d,value:r[d],valueSpec:o,style:a,styleSpec:n,key:l+"["+d+"]"}));return u}; | |
},{"../error/validation_error":104,"../util/get_type":122,"./validate":127}],129:[function(_dereq_,module,exports){ | |
"use strict";var getType=_dereq_("../util/get_type"),ValidationError=_dereq_("../error/validation_error");module.exports=function(e){var r=e.value,o=e.key,t=getType(r);return"boolean"!==t?[new ValidationError(o,r,"boolean expected, %s found",t)]:[]}; | |
},{"../error/validation_error":104,"../util/get_type":122}],130:[function(_dereq_,module,exports){ | |
"use strict";var ValidationError=_dereq_("../error/validation_error"),getType=_dereq_("../util/get_type"),parseCSSColor=_dereq_("csscolorparser").parseCSSColor;module.exports=function(r){var e=r.key,o=r.value,t=getType(o);return"string"!==t?[new ValidationError(e,o,"color expected, %s found",t)]:null===parseCSSColor(o)?[new ValidationError(e,o,'color expected, "%s" found',o)]:[]}; | |
},{"../error/validation_error":104,"../util/get_type":122,"csscolorparser":109}],131:[function(_dereq_,module,exports){ | |
"use strict";var ValidationError=_dereq_("../error/validation_error"),getType=_dereq_("../util/get_type");module.exports=function(r){var e=r.key,t=r.value,a=r.styleSpec;if(a.$version>7)return t?[new ValidationError(e,t,"constants have been deprecated as of v8")]:[];var o=getType(t);if("object"!==o)return[new ValidationError(e,t,"object expected, %s found",o)];var n=[];for(var i in t)"@"!==i[0]&&n.push(new ValidationError(e+"."+i,t[i],'constants must start with "@"'));return n}; | |
},{"../error/validation_error":104,"../util/get_type":122}],132:[function(_dereq_,module,exports){ | |
"use strict";var ValidationError=_dereq_("../error/validation_error"),unbundle=_dereq_("../util/unbundle_jsonlint");module.exports=function(e){var r=e.key,n=e.value,u=e.valueSpec,o=[];return Array.isArray(u.values)?u.values.indexOf(unbundle(n))===-1&&o.push(new ValidationError(r,n,"expected one of [%s], %s found",u.values.join(", "),n)):Object.keys(u.values).indexOf(unbundle(n))===-1&&o.push(new ValidationError(r,n,"expected one of [%s], %s found",Object.keys(u.values).join(", "),n)),o}; | |
},{"../error/validation_error":104,"../util/unbundle_jsonlint":126}],133:[function(_dereq_,module,exports){ | |
"use strict";var ValidationError=_dereq_("../error/validation_error"),validateEnum=_dereq_("./validate_enum"),getType=_dereq_("../util/get_type"),unbundle=_dereq_("../util/unbundle_jsonlint");module.exports=function e(r){var t,a=r.value,n=r.key,l=r.styleSpec,s=[];if("array"!==getType(a))return[new ValidationError(n,a,"array expected, %s found",getType(a))];if(a.length<1)return[new ValidationError(n,a,"filter array must have at least 1 element")];switch(s=s.concat(validateEnum({key:n+"[0]",value:a[0],valueSpec:l.filter_operator,style:r.style,styleSpec:r.styleSpec})),unbundle(a[0])){case"<":case"<=":case">":case">=":a.length>=2&&"$type"===unbundle(a[1])&&s.push(new ValidationError(n,a,'"$type" cannot be use with operator "%s"',a[0]));case"==":case"!=":3!==a.length&&s.push(new ValidationError(n,a,'filter array for operator "%s" must have 3 elements',a[0]));case"in":case"!in":a.length>=2&&(t=getType(a[1]),"string"!==t&&s.push(new ValidationError(n+"[1]",a[1],"string expected, %s found",t)));for(var o=2;o<a.length;o++)t=getType(a[o]),"$type"===unbundle(a[1])?s=s.concat(validateEnum({key:n+"["+o+"]",value:a[o],valueSpec:l.geometry_type,style:r.style,styleSpec:r.styleSpec})):"string"!==t&&"number"!==t&&"boolean"!==t&&s.push(new ValidationError(n+"["+o+"]",a[o],"string, number, or boolean expected, %s found",t));break;case"any":case"all":case"none":for(var i=1;i<a.length;i++)s=s.concat(e({key:n+"["+i+"]",value:a[i],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":t=getType(a[1]),2!==a.length?s.push(new ValidationError(n,a,'filter array for "%s" operator must have 2 elements',a[0])):"string"!==t&&s.push(new ValidationError(n+"[1]",a[1],"string expected, %s found",t))}return s}; | |
},{"../error/validation_error":104,"../util/get_type":122,"../util/unbundle_jsonlint":126,"./validate_enum":132}],134:[function(_dereq_,module,exports){ | |
"use strict";var ValidationError=_dereq_("../error/validation_error"),getType=_dereq_("../util/get_type"),validate=_dereq_("./validate"),validateObject=_dereq_("./validate_object"),validateArray=_dereq_("./validate_array"),validateNumber=_dereq_("./validate_number"),unbundle=_dereq_("../util/unbundle_jsonlint");module.exports=function(e){function t(e){if("identity"===p)return[new ValidationError(e.key,e.value,'identity function may not have a "stops" property')];var t=[],a=e.value;return t=t.concat(validateArray({key:e.key,value:a,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:r})),"array"===getType(a)&&0===a.length&&t.push(new ValidationError(e.key,a,"array must have at least one stop")),t}function r(e){var t=[],r=e.value,o=e.key;if("array"!==getType(r))return[new ValidationError(o,r,"array expected, %s found",getType(r))];if(2!==r.length)return[new ValidationError(o,r,"array length %d expected, length %d found",2,r.length)];if(c){if("object"!==getType(r[0]))return[new ValidationError(o,r,"object expected, %s found",getType(r[0]))];if(void 0===r[0].zoom)return[new ValidationError(o,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new ValidationError(o,r,"object stop key must have value")];if(l&&l>unbundle(r[0].zoom))return[new ValidationError(o,r[0].zoom,"stop zoom values must appear in ascending order")];unbundle(r[0].zoom)!==l&&(l=unbundle(r[0].zoom),i=void 0,s={}),t=t.concat(validateObject({key:o+"[0]",value:r[0],valueSpec:{zoom:{}},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:validateNumber,value:a}}))}else t=t.concat(a({key:o+"[0]",value:r[0],valueSpec:{},style:e.style,styleSpec:e.styleSpec}));return t.concat(validate({key:o+"[1]",value:r[1],valueSpec:u,style:e.style,styleSpec:e.styleSpec}))}function a(e){var t=getType(e.value),r=unbundle(e.value);if(n){if(t!==n)return[new ValidationError(e.key,e.value,"%s stop domain type must match previous stop domain type %s",t,n)]}else n=t;if("number"!==t&&"string"!==t&&"boolean"!==t)return[new ValidationError(e.key,e.value,"stop domain value must be a number, string, or boolean")];if("number"!==t&&"categorical"!==p){var a="number expected, %s found";return u["property-function"]&&void 0===p&&(a+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ValidationError(e.key,e.value,a,t)]}return"categorical"!==p||"number"!==t||isFinite(r)&&Math.floor(r)===r?"number"===t&&void 0!==i&&r<i?[new ValidationError(e.key,e.value,"stop domain values must appear in ascending order")]:(i=r,"categorical"===p&&r in s?[new ValidationError(e.key,e.value,"stop domain values must be unique")]:(s[r]=!0,[])):[new ValidationError(e.key,e.value,"integer expected, found %s",r)]}function o(e){return validate({key:e.key,value:e.value,valueSpec:u,style:e.style,styleSpec:e.styleSpec})}var n,i,l,u=e.valueSpec,p=unbundle(e.value.type),s={},y="categorical"!==p&&void 0===e.value.property,d=!y,c="array"===getType(e.value.stops)&&"array"===getType(e.value.stops[0])&&"object"===getType(e.value.stops[0][0]),v=validateObject({key:e.key,value:e.value,valueSpec:e.styleSpec.function,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:t,default:o}});return"identity"===p&&y&&v.push(new ValidationError(e.key,e.value,'missing required property "property"')),"identity"===p||e.value.stops||v.push(new ValidationError(e.key,e.value,'missing required property "stops"')),"exponential"===p&&"piecewise-constant"===e.valueSpec.function&&v.push(new ValidationError(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(d&&!e.valueSpec["property-function"]?v.push(new ValidationError(e.key,e.value,"property functions not supported")):y&&!e.valueSpec["zoom-function"]&&v.push(new ValidationError(e.key,e.value,"zoom functions not supported"))),"categorical"!==p&&!c||void 0!==e.value.property||v.push(new ValidationError(e.key,e.value,'"property" property is required')),v}; | |
},{"../error/validation_error":104,"../util/get_type":122,"../util/unbundle_jsonlint":126,"./validate":127,"./validate_array":128,"./validate_number":139,"./validate_object":140}],135:[function(_dereq_,module,exports){ | |
"use strict";var ValidationError=_dereq_("../error/validation_error"),validateString=_dereq_("./validate_string");module.exports=function(r){var e=r.value,t=r.key,a=validateString(r);return a.length?a:(e.indexOf("{fontstack}")===-1&&a.push(new ValidationError(t,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&a.push(new ValidationError(t,e,'"glyphs" url must include a "{range}" token')),a)}; | |
},{"../error/validation_error":104,"./validate_string":144}],136:[function(_dereq_,module,exports){ | |
"use strict";var ValidationError=_dereq_("../error/validation_error"),unbundle=_dereq_("../util/unbundle_jsonlint"),validateObject=_dereq_("./validate_object"),validateFilter=_dereq_("./validate_filter"),validatePaintProperty=_dereq_("./validate_paint_property"),validateLayoutProperty=_dereq_("./validate_layout_property"),extend=_dereq_("../util/extend");module.exports=function(e){var r=[],t=e.value,a=e.key,i=e.style,l=e.styleSpec;t.type||t.ref||r.push(new ValidationError(a,t,'either "type" or "ref" is required'));var u=unbundle(t.type),n=unbundle(t.ref);if(t.id)for(var o=unbundle(t.id),s=0;s<e.arrayIndex;s++){var d=i.layers[s];unbundle(d.id)===o&&r.push(new ValidationError(a,t.id,'duplicate layer id "%s", previously used at line %d',t.id,d.id.__line__))}if("ref"in t){["type","source","source-layer","filter","layout"].forEach(function(e){e in t&&r.push(new ValidationError(a,t[e],'"%s" is prohibited for ref layers',e))});var y;i.layers.forEach(function(e){unbundle(e.id)===n&&(y=e)}),y?y.ref?r.push(new ValidationError(a,t.ref,"ref cannot reference another ref layer")):u=unbundle(y.type):r.push(new ValidationError(a,t.ref,'ref layer "%s" not found',n))}else if("background"!==u)if(t.source){var c=i.sources&&i.sources[t.source],p=c&&unbundle(c.type);c?"vector"===p&&"raster"===u?r.push(new ValidationError(a,t.source,'layer "%s" requires a raster source',t.id)):"raster"===p&&"raster"!==u?r.push(new ValidationError(a,t.source,'layer "%s" requires a vector source',t.id)):"vector"!==p||t["source-layer"]||r.push(new ValidationError(a,t,'layer "%s" must specify a "source-layer"',t.id)):r.push(new ValidationError(a,t.source,'source "%s" not found',t.source))}else r.push(new ValidationError(a,t,'missing required property "source"'));return r=r.concat(validateObject({key:a,value:t,valueSpec:l.layer,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":function(){return[]},filter:validateFilter,layout:function(e){return validateObject({layer:t,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":function(e){return validateLayoutProperty(extend({layerType:u},e))}}})},paint:function(e){return validateObject({layer:t,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":function(e){return validatePaintProperty(extend({layerType:u},e))}}})}}}))}; | |
},{"../error/validation_error":104,"../util/extend":121,"../util/unbundle_jsonlint":126,"./validate_filter":133,"./validate_layout_property":137,"./validate_object":140,"./validate_paint_property":141}],137:[function(_dereq_,module,exports){ | |
"use strict";var validateProperty=_dereq_("./validate_property");module.exports=function(r){return validateProperty(r,"layout")}; | |
},{"./validate_property":142}],138:[function(_dereq_,module,exports){ | |
"use strict";var ValidationError=_dereq_("../error/validation_error"),getType=_dereq_("../util/get_type"),validate=_dereq_("./validate");module.exports=function(e){var t=e.value,r=e.styleSpec,a=r.light,i=e.style,n=[],o=getType(t);if(void 0===t)return n;if("object"!==o)return n=n.concat([new ValidationError("light",t,"object expected, %s found",o)]);for(var l in t){var c=l.match(/^(.*)-transition$/);n=c&&a[c[1]]&&a[c[1]].transition?n.concat(validate({key:l,value:t[l],valueSpec:r.transition,style:i,styleSpec:r})):a[l]?n.concat(validate({key:l,value:t[l],valueSpec:a[l],style:i,styleSpec:r})):n.concat([new ValidationError(l,t[l],'unknown property "%s"',l)])}return n}; | |
},{"../error/validation_error":104,"../util/get_type":122,"./validate":127}],139:[function(_dereq_,module,exports){ | |
"use strict";var getType=_dereq_("../util/get_type"),ValidationError=_dereq_("../error/validation_error");module.exports=function(e){var r=e.key,i=e.value,m=e.valueSpec,a=getType(i);return"number"!==a?[new ValidationError(r,i,"number expected, %s found",a)]:"minimum"in m&&i<m.minimum?[new ValidationError(r,i,"%s is less than the minimum value %s",i,m.minimum)]:"maximum"in m&&i>m.maximum?[new ValidationError(r,i,"%s is greater than the maximum value %s",i,m.maximum)]:[]}; | |
},{"../error/validation_error":104,"../util/get_type":122}],140:[function(_dereq_,module,exports){ | |
"use strict";var ValidationError=_dereq_("../error/validation_error"),getType=_dereq_("../util/get_type"),validateSpec=_dereq_("./validate");module.exports=function(e){var r=e.key,t=e.value,i=e.valueSpec||{},a=e.objectElementValidators||{},o=e.style,l=e.styleSpec,n=[],u=getType(t);if("object"!==u)return[new ValidationError(r,t,"object expected, %s found",u)];for(var d in t){var p=d.split(".")[0],s=i[p]||i["*"],c=void 0;if(a[p])c=a[p];else if(i[p])c=validateSpec;else if(a["*"])c=a["*"];else{if(!i["*"]){n.push(new ValidationError(r,t[d],'unknown property "%s"',d));continue}c=validateSpec}n=n.concat(c({key:(r?r+".":r)+d,value:t[d],valueSpec:s,style:o,styleSpec:l,object:t,objectKey:d}))}for(var v in i)i[v].required&&void 0===i[v].default&&void 0===t[v]&&n.push(new ValidationError(r,t,'missing required property "%s"',v));return n}; | |
},{"../error/validation_error":104,"../util/get_type":122,"./validate":127}],141:[function(_dereq_,module,exports){ | |
"use strict";var validateProperty=_dereq_("./validate_property");module.exports=function(r){return validateProperty(r,"paint")}; | |
},{"./validate_property":142}],142:[function(_dereq_,module,exports){ | |
"use strict";var validate=_dereq_("./validate"),ValidationError=_dereq_("../error/validation_error"),getType=_dereq_("../util/get_type");module.exports=function(e,t){var r=e.key,i=e.style,a=e.styleSpec,n=e.value,o=e.objectKey,l=a[t+"_"+e.layerType];if(!l)return[];var y=o.match(/^(.*)-transition$/);if("paint"===t&&y&&l[y[1]]&&l[y[1]].transition)return validate({key:r,value:n,valueSpec:a.transition,style:i,styleSpec:a});var p=e.valueSpec||l[o];if(!p)return[new ValidationError(r,n,'unknown property "%s"',o)];var s;if("string"===getType(n)&&p["property-function"]&&!p.tokens&&(s=/^{([^}]+)}$/.exec(n)))return[new ValidationError(r,n,'"%s" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": %s` }`.',o,JSON.stringify(s[1]))];var u=[];return"symbol"===e.layerType&&"text-field"===o&&i&&!i.glyphs&&u.push(new ValidationError(r,n,'use of "text-field" requires a style "glyphs" property')),u.concat(validate({key:e.key,value:n,valueSpec:p,style:i,styleSpec:a}))}; | |
},{"../error/validation_error":104,"../util/get_type":122,"./validate":127}],143:[function(_dereq_,module,exports){ | |
"use strict";var ValidationError=_dereq_("../error/validation_error"),unbundle=_dereq_("../util/unbundle_jsonlint"),validateObject=_dereq_("./validate_object"),validateEnum=_dereq_("./validate_enum");module.exports=function(e){var a=e.value,t=e.key,r=e.styleSpec,l=e.style;if(!a.type)return[new ValidationError(t,a,'"type" is required')];var u=unbundle(a.type),i=[];switch(u){case"vector":case"raster":if(i=i.concat(validateObject({key:t,value:a,valueSpec:r.source_tile,style:e.style,styleSpec:r})),"url"in a)for(var s in a)["type","url","tileSize"].indexOf(s)<0&&i.push(new ValidationError(t+"."+s,a[s],'a source with a "url" property may not include a "%s" property',s));return i;case"geojson":return validateObject({key:t,value:a,valueSpec:r.source_geojson,style:l,styleSpec:r});case"video":return validateObject({key:t,value:a,valueSpec:r.source_video,style:l,styleSpec:r});case"image":return validateObject({key:t,value:a,valueSpec:r.source_image,style:l,styleSpec:r});case"canvas":return validateObject({key:t,value:a,valueSpec:r.source_canvas,style:l,styleSpec:r});default:return validateEnum({key:t+".type",value:a.type,valueSpec:{values:["vector","raster","geojson","video","image","canvas"]},style:l,styleSpec:r})}}; | |
},{"../error/validation_error":104,"../util/unbundle_jsonlint":126,"./validate_enum":132,"./validate_object":140}],144:[function(_dereq_,module,exports){ | |
"use strict";var getType=_dereq_("../util/get_type"),ValidationError=_dereq_("../error/validation_error");module.exports=function(r){var e=r.value,t=r.key,i=getType(e);return"string"!==i?[new ValidationError(t,e,"string expected, %s found",i)]:[]}; | |
},{"../error/validation_error":104,"../util/get_type":122}],145:[function(_dereq_,module,exports){ | |
"use strict";function validateStyleMin(e,a){a=a||latestStyleSpec;var t=[];return t=t.concat(validate({key:"",value:e,valueSpec:a.$root,styleSpec:a,style:e,objectElementValidators:{glyphs:validateGlyphsURL,"*":function(){return[]}}})),a.$version>7&&e.constants&&(t=t.concat(validateConstants({key:"constants",value:e.constants,style:e,styleSpec:a}))),sortErrors(t)}function sortErrors(e){return[].concat(e).sort(function(e,a){return e.line-a.line})}function wrapCleanErrors(e){return function(){return sortErrors(e.apply(this,arguments))}}var validateConstants=_dereq_("./validate/validate_constants"),validate=_dereq_("./validate/validate"),latestStyleSpec=_dereq_("./reference/latest"),validateGlyphsURL=_dereq_("./validate/validate_glyphs_url");validateStyleMin.source=wrapCleanErrors(_dereq_("./validate/validate_source")),validateStyleMin.light=wrapCleanErrors(_dereq_("./validate/validate_light")),validateStyleMin.layer=wrapCleanErrors(_dereq_("./validate/validate_layer")),validateStyleMin.filter=wrapCleanErrors(_dereq_("./validate/validate_filter")),validateStyleMin.paintProperty=wrapCleanErrors(_dereq_("./validate/validate_paint_property")),validateStyleMin.layoutProperty=wrapCleanErrors(_dereq_("./validate/validate_layout_property")),module.exports=validateStyleMin; | |
},{"./reference/latest":119,"./validate/validate":127,"./validate/validate_constants":131,"./validate/validate_filter":133,"./validate/validate_glyphs_url":135,"./validate/validate_layer":136,"./validate/validate_layout_property":137,"./validate/validate_light":138,"./validate/validate_paint_property":141,"./validate/validate_source":143}],146:[function(_dereq_,module,exports){ | |
"use strict";var AnimationLoop=function(){this.n=0,this.times=[]};AnimationLoop.prototype.stopped=function(){return this.times=this.times.filter(function(t){return t.time>=(new Date).getTime()}),!this.times.length},AnimationLoop.prototype.set=function(t){return this.times.push({id:this.n,time:t+(new Date).getTime()}),this.n++},AnimationLoop.prototype.cancel=function(t){this.times=this.times.filter(function(i){return i.id!==t})},module.exports=AnimationLoop; | |
},{}],147:[function(_dereq_,module,exports){ | |
"use strict";var Evented=_dereq_("../util/evented"),ajax=_dereq_("../util/ajax"),browser=_dereq_("../util/browser"),normalizeURL=_dereq_("../util/mapbox").normalizeSpriteURL,SpritePosition=function(){this.x=0,this.y=0,this.width=0,this.height=0,this.pixelRatio=1,this.sdf=!1},ImageSprite=function(t){function e(e,i){var r=this;t.call(this),this.base=e,this.retina=browser.devicePixelRatio>1,this.setEventedParent(i);var a=this.retina?"@2x":"";ajax.getJSON(normalizeURL(e,a,".json"),function(t,e){return t?void r.fire("error",{error:t}):(r.data=e,void(r.imgData&&r.fire("data",{dataType:"style"})))}),ajax.getImage(normalizeURL(e,a,".png"),function(t,e){return t?void r.fire("error",{error:t}):(r.imgData=browser.getImageData(e),r.width=e.width,void(r.data&&r.fire("data",{dataType:"style"})))})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toJSON=function(){return this.base},e.prototype.loaded=function(){return!(!this.data||!this.imgData)},e.prototype.resize=function(){var t=this;if(browser.devicePixelRatio>1!==this.retina){var i=new e(this.base);i.on("data",function(){t.data=i.data,t.imgData=i.imgData,t.width=i.width,t.retina=i.retina})}},e.prototype.getSpritePosition=function(t){if(!this.loaded())return new SpritePosition;var e=this.data&&this.data[t];return e&&this.imgData?e:new SpritePosition},e}(Evented);module.exports=ImageSprite; | |
},{"../util/ajax":194,"../util/browser":195,"../util/evented":203,"../util/mapbox":210}],148:[function(_dereq_,module,exports){ | |
"use strict";var styleSpec=_dereq_("../style-spec/reference/latest"),util=_dereq_("../util/util"),Evented=_dereq_("../util/evented"),validateStyle=_dereq_("./validate_style"),StyleDeclaration=_dereq_("./style_declaration"),StyleTransition=_dereq_("./style_transition"),TRANSITION_SUFFIX="-transition",Light=function(t){function i(i){t.call(this),this.properties=["anchor","color","position","intensity"],this._specifications=styleSpec.light,this.set(i)}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.set=function(t){var i=this;if(!this._validate(validateStyle.light,t)){this._declarations={},this._transitions={},this._transitionOptions={},this.calculated={},t=util.extend({anchor:this._specifications.anchor.default,color:this._specifications.color.default,position:this._specifications.position.default,intensity:this._specifications.intensity.default},t);for(var e=0,o=i.properties;e<o.length;e+=1){var n=o[e];i._declarations[n]=new StyleDeclaration(i._specifications[n],t[n])}return this}},i.prototype.getLight=function(){return{anchor:this.getLightProperty("anchor"),color:this.getLightProperty("color"),position:this.getLightProperty("position"),intensity:this.getLightProperty("intensity")}},i.prototype.getLightProperty=function(t){return util.endsWith(t,TRANSITION_SUFFIX)?this._transitionOptions[t]:this._declarations[t]&&this._declarations[t].value},i.prototype.getLightValue=function(t,i){if("position"===t){var e=this._transitions[t].calculate(i),o=util.sphericalToCartesian(e);return{x:o[0],y:o[1],z:o[2]}}return this._transitions[t].calculate(i)},i.prototype.setLight=function(t){var i=this;if(!this._validate(validateStyle.light,t))for(var e in t){var o=t[e];util.endsWith(e,TRANSITION_SUFFIX)?i._transitionOptions[e]=o:null===o||void 0===o?delete i._declarations[e]:i._declarations[e]=new StyleDeclaration(i._specifications[e],o)}},i.prototype.recalculate=function(t){var i=this;for(var e in i._declarations)i.calculated[e]=i.getLightValue(e,{zoom:t})},i.prototype._applyLightDeclaration=function(t,i,e,o,n){var r=e.transition?this._transitions[t]:void 0,a=this._specifications[t];if(null!==i&&void 0!==i||(i=new StyleDeclaration(a,a.default)),!r||r.declaration.json!==i.json){var s=util.extend({duration:300,delay:0},o,this.getLightProperty(t+TRANSITION_SUFFIX)),l=this._transitions[t]=new StyleTransition(a,i,r,s);l.instant()||(l.loopID=n.set(l.endTime-Date.now())),r&&n.cancel(r.loopID)}},i.prototype.updateLightTransitions=function(t,i,e){var o,n=this;for(o in n._declarations)n._applyLightDeclaration(o,n._declarations[o],t,i,e)},i.prototype._validate=function(t,i){return validateStyle.emitErrors(this,t.call(validateStyle,util.extend({value:i,style:{glyphs:!0,sprite:!0},styleSpec:styleSpec})))},i}(Evented);module.exports=Light; | |
},{"../style-spec/reference/latest":119,"../util/evented":203,"../util/util":215,"./style_declaration":150,"./style_transition":158,"./validate_style":159}],149:[function(_dereq_,module,exports){ | |
"use strict";var Evented=_dereq_("../util/evented"),StyleLayer=_dereq_("./style_layer"),ImageSprite=_dereq_("./image_sprite"),Light=_dereq_("./light"),GlyphSource=_dereq_("../symbol/glyph_source"),SpriteAtlas=_dereq_("../symbol/sprite_atlas"),LineAtlas=_dereq_("../render/line_atlas"),util=_dereq_("../util/util"),ajax=_dereq_("../util/ajax"),mapbox=_dereq_("../util/mapbox"),browser=_dereq_("../util/browser"),Dispatcher=_dereq_("../util/dispatcher"),AnimationLoop=_dereq_("./animation_loop"),validateStyle=_dereq_("./validate_style"),Source=_dereq_("../source/source"),QueryFeatures=_dereq_("../source/query_features"),SourceCache=_dereq_("../source/source_cache"),styleSpec=_dereq_("../style-spec/reference/latest"),MapboxGLFunction=_dereq_("../style-spec/function"),getWorkerPool=_dereq_("../util/global_worker_pool"),deref=_dereq_("../style-spec/deref"),diff=_dereq_("../style-spec/diff"),rtlTextPlugin=_dereq_("../source/rtl_text_plugin"),supportedDiffOperations=util.pick(diff.operations,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition"]),ignoredDiffOperations=util.pick(diff.operations,["setCenter","setZoom","setBearing","setPitch"]),Style=function(e){function t(t,r,i){var o=this;e.call(this),this.map=r,this.animationLoop=r&&r.animationLoop||new AnimationLoop,this.dispatcher=new Dispatcher(getWorkerPool(),this),this.spriteAtlas=new SpriteAtlas(1024,1024),this.spriteAtlas.setEventedParent(this),this.lineAtlas=new LineAtlas(256,512),this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory={},this._loaded=!1,util.bindAll(["_redoPlacement"],this),this._resetUpdates(),i=util.extend({validate:"string"!=typeof t||!mapbox.isMapboxURL(t)},i),this.setEventedParent(r),this.fire("dataloading",{dataType:"style"});var s=this;this._rtlTextPluginCallback=rtlTextPlugin.registerForPluginAvailability(function(e){s.dispatcher.broadcast("loadRTLTextPlugin",e.pluginBlobURL,e.errorCallback);for(var t in s.sourceCaches)s.sourceCaches[t].reload()});var a=function(e,t){if(e)return void o.fire("error",{error:e});if(!i.validate||!validateStyle.emitErrors(o,validateStyle(t))){o._loaded=!0,o.stylesheet=t,o.updateClasses();for(var r in t.sources)o.addSource(r,t.sources[r],i);t.sprite&&(o.sprite=new ImageSprite(t.sprite,o)),o.glyphSource=new GlyphSource(t.glyphs),o._resolve(),o.fire("data",{dataType:"style"}),o.fire("style.load")}};"string"==typeof t?ajax.getJSON(mapbox.normalizeStyleURL(t),a):browser.frame(a.bind(this,null,t)),this.on("data",function(e){if("source"===e.dataType&&"metadata"===e.sourceDataType){var t=o.sourceCaches[e.sourceId].getSource();if(t&&t.vectorLayerIds)for(var r in o._layers){var i=o._layers[r];i.source===t.id&&o._validateLayer(i)}}})}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype._validateLayer=function(e){var t=this.sourceCaches[e.source];if(e.sourceLayer&&t){var r=t.getSource();("geojson"===r.type||r.vectorLayerIds&&r.vectorLayerIds.indexOf(e.sourceLayer)===-1)&&this.fire("error",{error:new Error('Source layer "'+e.sourceLayer+'" does not exist on source "'+r.id+'" as specified by style layer "'+e.id+'"')})}},t.prototype.loaded=function(){var e=this;if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(var t in e.sourceCaches)if(!e.sourceCaches[t].loaded())return!1;return!(this.sprite&&!this.sprite.loaded())},t.prototype._resolve=function(){var e=this,t=deref(this.stylesheet.layers);this._order=t.map(function(e){return e.id}),this._layers={};for(var r=0,i=t;r<i.length;r+=1){var o=i[r];o=StyleLayer.create(o),o.setEventedParent(e,{layer:{id:o.id}}),e._layers[o.id]=o}this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new Light(this.stylesheet.light)},t.prototype._serializeLayers=function(e){var t=this;return e.map(function(e){return t._layers[e].serialize()})},t.prototype._applyClasses=function(e,t){var r=this;if(this._loaded){e=e||[],t=t||{transition:!0};var i=this.stylesheet.transition||{},o=this._updatedAllPaintProps?this._layers:this._updatedPaintProps;for(var s in o){var a=r._layers[s],n=r._updatedPaintProps[s];if(r._updatedAllPaintProps||n.all)a.updatePaintTransitions(e,t,i,r.animationLoop,r.zoomHistory);else for(var l in n)r._layers[s].updatePaintTransition(l,e,t,i,r.animationLoop,r.zoomHistory)}this.light.updateLightTransitions(t,i,this.animationLoop)}},t.prototype._recalculate=function(e){var t=this;if(this._loaded){for(var r in t.sourceCaches)t.sourceCaches[r].used=!1;this._updateZoomHistory(e);for(var i=0,o=t._order;i<o.length;i+=1){var s=o[i],a=t._layers[s];a.recalculate(e),!a.isHidden(e)&&a.source&&(t.sourceCaches[a.source].used=!0)}this.light.recalculate(e);var n=300;Math.floor(this.z)!==Math.floor(e)&&this.animationLoop.set(n),this.z=e}},t.prototype._updateZoomHistory=function(e){var t=this.zoomHistory;void 0===t.lastIntegerZoom&&(t.lastIntegerZoom=Math.floor(e),t.lastIntegerZoomTime=0,t.lastZoom=e),Math.floor(t.lastZoom)<Math.floor(e)?(t.lastIntegerZoom=Math.floor(e),t.lastIntegerZoomTime=Date.now()):Math.floor(t.lastZoom)>Math.floor(e)&&(t.lastIntegerZoom=Math.floor(e+1),t.lastIntegerZoomTime=Date.now()),t.lastZoom=e},t.prototype._checkLoaded=function(){if(!this._loaded)throw new Error("Style is not done loading")},t.prototype.update=function(e,t){var r=this;if(this._changed){var i=Object.keys(this._updatedLayers),o=Object.keys(this._removedLayers);(i.length||o.length||this._updatedSymbolOrder)&&this._updateWorkerLayers(i,o);for(var s in r._updatedSources){var a=r._updatedSources[s];"reload"===a?r._reloadSource(s):"clear"===a&&r._clearSource(s)}this._applyClasses(e,t),this._resetUpdates(),this.fire("data",{dataType:"style"})}},t.prototype._updateWorkerLayers=function(e,t){var r=this,i=this._updatedSymbolOrder?this._order.filter(function(e){return"symbol"===r._layers[e].type}):null;this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(e),removedIds:t,symbolOrder:i})},t.prototype._resetUpdates=function(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSymbolOrder=!1,this._updatedSources={},this._updatedPaintProps={},this._updatedAllPaintProps=!1},t.prototype.setState=function(e){var t=this;if(this._checkLoaded(),validateStyle.emitErrors(this,validateStyle(e)))return!1;e=util.extend({},e),e.layers=deref(e.layers);var r=diff(this.serialize(),e).filter(function(e){return!(e.command in ignoredDiffOperations)});if(0===r.length)return!1;var i=r.filter(function(e){return!(e.command in supportedDiffOperations)});if(i.length>0)throw new Error("Unimplemented: "+i.map(function(e){return e.command}).join(", ")+".");return r.forEach(function(e){"setTransition"!==e.command&&t[e.command].apply(t,e.args)}),this.stylesheet=e,!0},t.prototype.addSource=function(e,t,r){var i=this;if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!t.type)throw new Error("The type property must be defined, but the only the following properties were given: "+Object.keys(t)+".");var o=["vector","raster","geojson","video","image","canvas"],s=o.indexOf(t.type)>=0;if(!s||!this._validate(validateStyle.source,"sources."+e,t,null,r)){var a=this.sourceCaches[e]=new SourceCache(e,t,this.dispatcher);a.style=this,a.setEventedParent(this,function(){return{isSourceLoaded:i.loaded(),source:a.serialize(),sourceId:e}}),a.onAdd(this.map),this._changed=!0}},t.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");var t=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],t.setEventedParent(null),t.clearTiles(),t.onRemove&&t.onRemove(this.map),this._changed=!0},t.prototype.getSource=function(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()},t.prototype.addLayer=function(e,t,r){this._checkLoaded();var i=e.id;if("object"==typeof e.source&&(this.addSource(i,e.source),e=util.extend(e,{source:i})),!this._validate(validateStyle.layer,"layers."+i,e,{arrayIndex:-1},r)){var o=StyleLayer.create(e);this._validateLayer(o),o.setEventedParent(this,{layer:{id:i}});var s=t?this._order.indexOf(t):this._order.length;if(this._order.splice(s,0,i),this._layers[i]=o,this._removedLayers[i]&&o.source){var a=this._removedLayers[i];delete this._removedLayers[i],this._updatedSources[o.source]=a.type!==o.type?"clear":"reload"}this._updateLayer(o),"symbol"===o.type&&(this._updatedSymbolOrder=!0),this.updateClasses(i)}},t.prototype.moveLayer=function(e,t){this._checkLoaded(),this._changed=!0;var r=this._layers[e];if(!r)return void this.fire("error",{error:new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")});var i=this._order.indexOf(e);this._order.splice(i,1);var o=t?this._order.indexOf(t):this._order.length;this._order.splice(o,0,e),"symbol"===r.type&&(this._updatedSymbolOrder=!0,r.source&&!this._updatedSources[r.source]&&(this._updatedSources[r.source]="reload"))},t.prototype.removeLayer=function(e){this._checkLoaded();var t=this._layers[e];if(!t)return void this.fire("error",{error:new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")});t.setEventedParent(null);var r=this._order.indexOf(e);this._order.splice(r,1),"symbol"===t.type&&(this._updatedSymbolOrder=!0),this._changed=!0,this._removedLayers[e]=t,delete this._layers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e]},t.prototype.getLayer=function(e){return this._layers[e]},t.prototype.setLayerZoomRange=function(e,t,r){this._checkLoaded();var i=this.getLayer(e);return i?void(i.minzoom===t&&i.maxzoom===r||(null!=t&&(i.minzoom=t),null!=r&&(i.maxzoom=r),this._updateLayer(i))):void this.fire("error",{error:new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")})},t.prototype.setFilter=function(e,t){this._checkLoaded();var r=this.getLayer(e);return r?void(null!==t&&void 0!==t&&this._validate(validateStyle.filter,"layers."+r.id+".filter",t)||util.deepEqual(r.filter,t)||(r.filter=util.clone(t),this._updateLayer(r))):void this.fire("error",{error:new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")})},t.prototype.getFilter=function(e){return util.clone(this.getLayer(e).filter)},t.prototype.setLayoutProperty=function(e,t,r){this._checkLoaded();var i=this.getLayer(e);return i?void(util.deepEqual(i.getLayoutProperty(t),r)||(i.setLayoutProperty(t,r),this._updateLayer(i))):void this.fire("error",{error:new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")})},t.prototype.getLayoutProperty=function(e,t){return this.getLayer(e).getLayoutProperty(t)},t.prototype.setPaintProperty=function(e,t,r,i){this._checkLoaded();var o=this.getLayer(e);if(!o)return void this.fire("error",{error:new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")});if(!util.deepEqual(o.getPaintProperty(t,i),r)){var s=o.isPaintValueFeatureConstant(t);o.setPaintProperty(t,r,i);var a=!(r&&MapboxGLFunction.isFunctionDefinition(r)&&"$zoom"!==r.property&&void 0!==r.property);a&&s||this._updateLayer(o),this.updateClasses(e,t)}},t.prototype.getPaintProperty=function(e,t,r){return this.getLayer(e).getPaintProperty(t,r)},t.prototype.getTransition=function(){return util.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},t.prototype.updateClasses=function(e,t){if(this._changed=!0,e){var r=this._updatedPaintProps;r[e]||(r[e]={}),r[e][t||"all"]=!0}else this._updatedAllPaintProps=!0},t.prototype.serialize=function(){var e=this;return util.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:util.mapObject(this.sourceCaches,function(e){return e.serialize()}),layers:this._order.map(function(t){return e._layers[t].serialize()})},function(e){return void 0!==e})},t.prototype._updateLayer=function(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&(this._updatedSources[e.source]="reload"),this._changed=!0},t.prototype._flattenRenderedFeatures=function(e){for(var t=this,r=[],i=this._order.length-1;i>=0;i--)for(var o=t._order[i],s=0,a=e;s<a.length;s+=1){var n=a[s],l=n[o];if(l)for(var d=0,u=l;d<u.length;d+=1){var h=u[d];r.push(h)}}return r},t.prototype.queryRenderedFeatures=function(e,t,r,i){var o=this;t&&t.filter&&this._validate(validateStyle.filter,"queryRenderedFeatures.filter",t.filter);var s={};if(t&&t.layers){if(!Array.isArray(t.layers))return void this.fire("error",{error:"parameters.layers must be an Array."});for(var a=0,n=t.layers;a<n.length;a+=1){var l=n[a],d=o._layers[l];if(!d)return void o.fire("error",{error:"The layer '"+l+"' does not exist in the map's style and cannot be queried for features."});s[d.source]=!0}}var u=[];for(var h in o.sourceCaches)if(!t.layers||s[h]){var c=QueryFeatures.rendered(o.sourceCaches[h],o._layers,e,t,r,i);u.push(c)}return this._flattenRenderedFeatures(u)},t.prototype.querySourceFeatures=function(e,t){t&&t.filter&&this._validate(validateStyle.filter,"querySourceFeatures.filter",t.filter);var r=this.sourceCaches[e];return r?QueryFeatures.source(r,t):[]},t.prototype.addSourceType=function(e,t,r){return Source.getType(e)?r(new Error('A source type called "'+e+'" already exists.')):(Source.setType(e,t),t.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:t.workerSourceURL},r):r(null,null))},t.prototype.getLight=function(){return this.light.getLight()},t.prototype.setLight=function(e,t){this._checkLoaded();var r=this.light.getLight(),i=!1;for(var o in e)if(!util.deepEqual(e[o],r[o])){i=!0;break}if(i){var s=this.stylesheet.transition||{};this.light.setLight(e),this.light.updateLightTransitions(t||{transition:!0},s,this.animationLoop)}},t.prototype._validate=function(e,t,r,i,o){return(!o||o.validate!==!1)&&validateStyle.emitErrors(this,e.call(validateStyle,util.extend({key:t,style:this.serialize(),value:r,styleSpec:styleSpec},i)))},t.prototype._remove=function(){var e=this;rtlTextPlugin.evented.off("pluginAvailable",this._rtlTextPluginCallback);for(var t in e.sourceCaches)e.sourceCaches[t].clearTiles();this.dispatcher.remove()},t.prototype._clearSource=function(e){this.sourceCaches[e].clearTiles()},t.prototype._reloadSource=function(e){this.sourceCaches[e].reload()},t.prototype._updateSources=function(e){var t=this;for(var r in t.sourceCaches)t.sourceCaches[r].update(e)},t.prototype._redoPlacement=function(){var e=this;for(var t in e.sourceCaches)e.sourceCaches[t].redoPlacement()},t.prototype.getIcons=function(e,t,r){var i=this,o=function(){i.spriteAtlas.setSprite(i.sprite),i.spriteAtlas.addIcons(t.icons,r)};!this.sprite||this.sprite.loaded()?o():this.sprite.on("data",o)},t.prototype.getGlyphs=function(e,t,r){function i(e,t,i){e&&console.error(e),n[i]=t,a--,0===a&&r(null,n)}var o=this,s=t.stacks,a=Object.keys(s).length,n={};for(var l in s)o.glyphSource.getSimpleGlyphs(l,s[l],t.uid,i)},t}(Evented);module.exports=Style; | |
},{"../render/line_atlas":76,"../source/query_features":89,"../source/rtl_text_plugin":91,"../source/source":92,"../source/source_cache":93,"../style-spec/deref":102,"../style-spec/diff":103,"../style-spec/function":107,"../style-spec/reference/latest":119,"../symbol/glyph_source":168,"../symbol/sprite_atlas":172,"../util/ajax":194,"../util/browser":195,"../util/dispatcher":201,"../util/evented":203,"../util/global_worker_pool":205,"../util/mapbox":210,"../util/util":215,"./animation_loop":146,"./image_sprite":147,"./light":148,"./style_layer":151,"./validate_style":159}],150:[function(_dereq_,module,exports){ | |
"use strict";var createFunction=_dereq_("../style-spec/function"),util=_dereq_("../util/util"),StyleDeclaration=function(t,i){var o=this;if(this.value=util.clone(i),this.isFunction=createFunction.isFunctionDefinition(i),this.json=JSON.stringify(this.value),this.minimum=t.minimum,this.function=createFunction(this.value,t),this.isFeatureConstant=this.function.isFeatureConstant,this.isZoomConstant=this.function.isZoomConstant,this.isFeatureConstant||this.isZoomConstant){if(!this.isZoomConstant){this.stopZoomLevels=[];for(var n=0,s=o.value.stops;n<s.length;n+=1){var e=s[n];o.stopZoomLevels.indexOf(e[0])<0&&o.stopZoomLevels.push(e[0])}}}else{this.stopZoomLevels=[];for(var a=[],u=0,l=o.value.stops;u<l.length;u+=1){var r=l[u],c=r[0].zoom;o.stopZoomLevels.indexOf(c)<0&&(o.stopZoomLevels.push(c),a.push([c,a.length]))}this._functionInterpolationT=createFunction({type:"exponential",stops:a,base:i.base},{type:"number"})}};StyleDeclaration.prototype.calculate=function(t,i){var o=this.function(t&&t.zoom,i||{});return void 0!==this.minimum&&o<this.minimum?this.minimum:o},StyleDeclaration.prototype.calculateInterpolationT=function(t){return this.isFeatureConstant||this.isZoomConstant?0:this._functionInterpolationT(t&&t.zoom,{})},module.exports=StyleDeclaration; | |
},{"../style-spec/function":107,"../util/util":215}],151:[function(_dereq_,module,exports){ | |
"use strict";function getDeclarationValue(t){return t.value}var util=_dereq_("../util/util"),StyleTransition=_dereq_("./style_transition"),StyleDeclaration=_dereq_("./style_declaration"),styleSpec=_dereq_("../style-spec/reference/latest"),validateStyle=_dereq_("./validate_style"),parseColor=_dereq_("./../style-spec/util/parse_color"),Evented=_dereq_("../util/evented"),TRANSITION_SUFFIX="-transition",StyleLayer=function(t){function i(i){var a=this;t.call(this),this.id=i.id,this.metadata=i.metadata,this.type=i.type,this.source=i.source,this.sourceLayer=i["source-layer"],this.minzoom=i.minzoom,this.maxzoom=i.maxzoom,this.filter=i.filter,this.paint={},this.layout={},this._paintSpecifications=styleSpec["paint_"+this.type],this._layoutSpecifications=styleSpec["layout_"+this.type],this._paintTransitions={},this._paintTransitionOptions={},this._paintDeclarations={},this._layoutDeclarations={},this._layoutFunctions={};var e,o,n={validate:!1};for(var r in i){var s=r.match(/^paint(?:\.(.*))?$/);if(s){var l=s[1]||"";for(e in i[r])a.setPaintProperty(e,i[r][e],l,n)}}for(o in i.layout)a.setLayoutProperty(o,i.layout[o],n);for(e in a._paintSpecifications)a.paint[e]=a.getPaintValue(e);for(o in a._layoutSpecifications)a._updateLayoutValue(o)}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.setLayoutProperty=function(t,i,a){if(null==i)delete this._layoutDeclarations[t];else{var e="layers."+this.id+".layout."+t;if(this._validate(validateStyle.layoutProperty,e,t,i,a))return;this._layoutDeclarations[t]=new StyleDeclaration(this._layoutSpecifications[t],i)}this._updateLayoutValue(t)},i.prototype.getLayoutProperty=function(t){return this._layoutDeclarations[t]&&this._layoutDeclarations[t].value},i.prototype.getLayoutValue=function(t,i,a){var e=this._layoutSpecifications[t],o=this._layoutDeclarations[t];return o?o.calculate(i,a):e.default},i.prototype.setPaintProperty=function(t,i,a,e){var o="layers."+this.id+(a?'["paint.'+a+'"].':".paint.")+t;if(util.endsWith(t,TRANSITION_SUFFIX))if(this._paintTransitionOptions[a||""]||(this._paintTransitionOptions[a||""]={}),null===i||void 0===i)delete this._paintTransitionOptions[a||""][t];else{if(this._validate(validateStyle.paintProperty,o,t,i,e))return;this._paintTransitionOptions[a||""][t]=i}else if(this._paintDeclarations[a||""]||(this._paintDeclarations[a||""]={}),null===i||void 0===i)delete this._paintDeclarations[a||""][t];else{if(this._validate(validateStyle.paintProperty,o,t,i,e))return;this._paintDeclarations[a||""][t]=new StyleDeclaration(this._paintSpecifications[t],i)}},i.prototype.getPaintProperty=function(t,i){return i=i||"",util.endsWith(t,TRANSITION_SUFFIX)?this._paintTransitionOptions[i]&&this._paintTransitionOptions[i][t]:this._paintDeclarations[i]&&this._paintDeclarations[i][t]&&this._paintDeclarations[i][t].value},i.prototype.getPaintValue=function(t,i,a){var e=this._paintSpecifications[t],o=this._paintTransitions[t];return o?o.calculate(i,a):"color"===e.type&&e.default?parseColor(e.default):e.default},i.prototype.getPaintValueStopZoomLevels=function(t){var i=this._paintTransitions[t];return i?i.declaration.stopZoomLevels:[]},i.prototype.getLayoutValueStopZoomLevels=function(t){var i=this._layoutDeclarations[t];return i?i.stopZoomLevels:[]},i.prototype.getPaintInterpolationT=function(t,i){var a=this._paintTransitions[t];return a.declaration.calculateInterpolationT(i)},i.prototype.getLayoutInterpolationT=function(t,i){var a=this._layoutDeclarations[t];return a.calculateInterpolationT(i)},i.prototype.isPaintValueFeatureConstant=function(t){var i=this._paintTransitions[t];return!i||i.declaration.isFeatureConstant},i.prototype.isLayoutValueFeatureConstant=function(t){var i=this._layoutDeclarations[t];return!i||i.isFeatureConstant},i.prototype.isPaintValueZoomConstant=function(t){var i=this._paintTransitions[t];return!i||i.declaration.isZoomConstant},i.prototype.isLayoutValueZoomConstant=function(t){var i=this._layoutDeclarations[t];return!i||i.isZoomConstant},i.prototype.isHidden=function(t){return!!(this.minzoom&&t<this.minzoom)||(!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.layout.visibility)},i.prototype.updatePaintTransitions=function(t,i,a,e,o){for(var n=this,r=util.extend({},this._paintDeclarations[""]),s=0;s<t.length;s++)util.extend(r,n._paintDeclarations[t[s]]);var l;for(l in r)n._applyPaintDeclaration(l,r[l],i,a,e,o);for(l in n._paintTransitions)l in r||n._applyPaintDeclaration(l,null,i,a,e,o)},i.prototype.updatePaintTransition=function(t,i,a,e,o,n){for(var r=this,s=this._paintDeclarations[""][t],l=0;l<i.length;l++){var u=r._paintDeclarations[i[l]];u&&u[t]&&(s=u[t])}this._applyPaintDeclaration(t,s,a,e,o,n)},i.prototype.recalculate=function(t){var i=this;for(var a in i._paintTransitions)i.paint[a]=i.getPaintValue(a,{zoom:t});for(var e in i._layoutFunctions)i.layout[e]=i.getLayoutValue(e,{zoom:t})},i.prototype.serialize=function(){var t=this,i={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:util.mapObject(this._layoutDeclarations,getDeclarationValue)};for(var a in t._paintDeclarations){var e=""===a?"paint":"paint."+a;i[e]=util.mapObject(t._paintDeclarations[a],getDeclarationValue)}return util.filterObject(i,function(t,i){return void 0!==t&&!("layout"===i&&!Object.keys(t).length)})},i.prototype._applyPaintDeclaration=function(t,i,a,e,o,n){var r=a.transition?this._paintTransitions[t]:void 0,s=this._paintSpecifications[t];if(null!==i&&void 0!==i||(i=new StyleDeclaration(s,s.default)),!r||r.declaration.json!==i.json){var l=util.extend({duration:300,delay:0},e,this.getPaintProperty(t+TRANSITION_SUFFIX)),u=this._paintTransitions[t]=new StyleTransition(s,i,r,l,n);u.instant()||(u.loopID=o.set(u.endTime-Date.now())),r&&o.cancel(r.loopID)}},i.prototype._updateLayoutValue=function(t){var i=this._layoutDeclarations[t];i&&i.isFunction?this._layoutFunctions[t]=!0:(delete this._layoutFunctions[t],this.layout[t]=this.getLayoutValue(t))},i.prototype._validate=function(t,i,a,e,o){return(!o||o.validate!==!1)&&validateStyle.emitErrors(this,t.call(validateStyle,{key:i,layerType:this.type,objectKey:a,value:e,styleSpec:styleSpec,style:{glyphs:!0,sprite:!0}}))},i}(Evented);module.exports=StyleLayer;var subclasses={circle:_dereq_("./style_layer/circle_style_layer"),fill:_dereq_("./style_layer/fill_style_layer"),"fill-extrusion":_dereq_("./style_layer/fill_extrusion_style_layer"),line:_dereq_("./style_layer/line_style_layer"),symbol:_dereq_("./style_layer/symbol_style_layer")};StyleLayer.create=function(t){var i=subclasses[t.type]||StyleLayer;return new i(t)}; | |
},{"../style-spec/reference/latest":119,"../util/evented":203,"../util/util":215,"./../style-spec/util/parse_color":124,"./style_declaration":150,"./style_layer/circle_style_layer":152,"./style_layer/fill_extrusion_style_layer":153,"./style_layer/fill_style_layer":154,"./style_layer/line_style_layer":155,"./style_layer/symbol_style_layer":156,"./style_transition":158,"./validate_style":159}],152:[function(_dereq_,module,exports){ | |
"use strict";var StyleLayer=_dereq_("../style_layer"),CircleBucket=_dereq_("../../data/bucket/circle_bucket"),CircleStyleLayer=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.createBucket=function(e){return new CircleBucket(e)},t}(StyleLayer);module.exports=CircleStyleLayer; | |
},{"../../data/bucket/circle_bucket":46,"../style_layer":151}],153:[function(_dereq_,module,exports){ | |
"use strict";var StyleLayer=_dereq_("../style_layer"),FillExtrusionBucket=_dereq_("../../data/bucket/fill_extrusion_bucket"),FillExtrusionStyleLayer=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getPaintValue=function(e,r,o){var l=t.prototype.getPaintValue.call(this,e,r,o);return"fill-extrusion-color"===e&&l&&(l[3]=1),l},e.prototype.createBucket=function(t){return new FillExtrusionBucket(t)},e}(StyleLayer);module.exports=FillExtrusionStyleLayer; | |
},{"../../data/bucket/fill_extrusion_bucket":48,"../style_layer":151}],154:[function(_dereq_,module,exports){ | |
"use strict";var StyleLayer=_dereq_("../style_layer"),FillBucket=_dereq_("../../data/bucket/fill_bucket"),FillStyleLayer=function(t){function o(){t.apply(this,arguments)}return t&&(o.__proto__=t),o.prototype=Object.create(t&&t.prototype),o.prototype.constructor=o,o.prototype.getPaintValue=function(o,l,e){var i=this;if("fill-outline-color"===o){if(void 0===this.getPaintProperty("fill-outline-color"))return t.prototype.getPaintValue.call(this,"fill-color",l,e);for(var r=this._paintTransitions["fill-outline-color"];r;){var n=r&&r.declaration&&r.declaration.value;if(!n)return t.prototype.getPaintValue.call(i,"fill-color",l,e);r=r.oldTransition}}return t.prototype.getPaintValue.call(this,o,l,e)},o.prototype.getPaintValueStopZoomLevels=function(o){return"fill-outline-color"===o&&void 0===this.getPaintProperty("fill-outline-color")?t.prototype.getPaintValueStopZoomLevels.call(this,"fill-color"):t.prototype.getPaintValueStopZoomLevels.call(this,o)},o.prototype.getPaintInterpolationT=function(o,l){return"fill-outline-color"===o&&void 0===this.getPaintProperty("fill-outline-color")?t.prototype.getPaintInterpolationT.call(this,"fill-color",l):t.prototype.getPaintInterpolationT.call(this,o,l)},o.prototype.isPaintValueFeatureConstant=function(o){return"fill-outline-color"===o&&void 0===this.getPaintProperty("fill-outline-color")?t.prototype.isPaintValueFeatureConstant.call(this,"fill-color"):t.prototype.isPaintValueFeatureConstant.call(this,o)},o.prototype.isPaintValueZoomConstant=function(o){return"fill-outline-color"===o&&void 0===this.getPaintProperty("fill-outline-color")?t.prototype.isPaintValueZoomConstant.call(this,"fill-color"):t.prototype.isPaintValueZoomConstant.call(this,o)},o.prototype.createBucket=function(t){return new FillBucket(t)},o}(StyleLayer);module.exports=FillStyleLayer; | |
},{"../../data/bucket/fill_bucket":47,"../style_layer":151}],155:[function(_dereq_,module,exports){ | |
"use strict";var StyleLayer=_dereq_("../style_layer"),LineBucket=_dereq_("../../data/bucket/line_bucket"),util=_dereq_("../../util/util"),LineStyleLayer=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getPaintValue=function(t,r,o){var i=e.prototype.getPaintValue.call(this,t,r,o);if(i&&"line-dasharray"===t){var a=this.getPaintValue("line-width",util.extend({},r,{zoom:Math.floor(r.zoom)}),o);i.fromScale*=a,i.toScale*=a}return i},t.prototype.createBucket=function(e){return new LineBucket(e)},t}(StyleLayer);module.exports=LineStyleLayer; | |
},{"../../data/bucket/line_bucket":49,"../../util/util":215,"../style_layer":151}],156:[function(_dereq_,module,exports){ | |
"use strict";var StyleLayer=_dereq_("../style_layer"),SymbolBucket=_dereq_("../../data/bucket/symbol_bucket"),SymbolStyleLayer=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getLayoutValue=function(e,o,r){var a=t.prototype.getLayoutValue.call(this,e,o,r);if("auto"!==a)return a;switch(e){case"text-rotation-alignment":case"icon-rotation-alignment":return"line"===this.getLayoutValue("symbol-placement",o,r)?"map":"viewport";case"text-pitch-alignment":return this.getLayoutValue("text-rotation-alignment",o,r);default:return a}},e.prototype.createBucket=function(t){return new SymbolBucket(t)},e}(StyleLayer);module.exports=SymbolStyleLayer; | |
},{"../../data/bucket/symbol_bucket":50,"../style_layer":151}],157:[function(_dereq_,module,exports){ | |
"use strict";var StyleLayer=_dereq_("./style_layer"),util=_dereq_("../util/util"),featureFilter=_dereq_("../style-spec/feature_filter"),groupByLayout=_dereq_("../style-spec/group_by_layout"),StyleLayerIndex=function(e){e&&this.replace(e)};StyleLayerIndex.prototype.replace=function(e){var r=this;this.symbolOrder=[];for(var t=0,i=e;t<i.length;t+=1){var a=i[t];"symbol"===a.type&&r.symbolOrder.push(a.id)}this._layerConfigs={},this._layers={},this.update(e,[])},StyleLayerIndex.prototype.update=function(e,r,t){for(var i=this,a=0,l=e;a<l.length;a+=1){var y=l[a];i._layerConfigs[y.id]=y;var s=i._layers[y.id]=StyleLayer.create(y);s.updatePaintTransitions({},{transition:!1}),s.filter=featureFilter(s.filter)}for(var o=0,u=r;o<u.length;o+=1){var n=u[o];delete i._layerConfigs[n],delete i._layers[n]}t&&(this.symbolOrder=t),this.familiesBySource={};for(var f=groupByLayout(util.values(this._layerConfigs)),p=0,d=f;p<d.length;p+=1){var h=d[p],c=h.map(function(e){return i._layers[e.id]}),v=c[0];if(!v.layout||"none"!==v.layout.visibility){var _=v.source||"",g=i.familiesBySource[_];g||(g=i.familiesBySource[_]={});var L=v.sourceLayer||"_geojsonTileLayer",m=g[L];m||(m=g[L]=[]),m.push(c)}}},module.exports=StyleLayerIndex; | |
},{"../style-spec/feature_filter":105,"../style-spec/group_by_layout":108,"../util/util":215,"./style_layer":151}],158:[function(_dereq_,module,exports){ | |
"use strict";function interpZoomTransitioned(t,i,e){if(void 0!==t&&void 0!==i)return{from:t.to,fromScale:t.toScale,to:i.to,toScale:i.toScale,t:e}}var util=_dereq_("../util/util"),interpolate=_dereq_("../style-spec/util/interpolate"),fakeZoomHistory={lastIntegerZoom:0,lastIntegerZoomTime:0,lastZoom:0},StyleTransition=function(t,i,e,o,a){this.declaration=i,this.startTime=this.endTime=(new Date).getTime(),this.oldTransition=e,this.duration=o.duration||0,this.delay=o.delay||0,this.zoomTransitioned="piecewise-constant"===t.function&&t.transition,this.interp=this.zoomTransitioned?interpZoomTransitioned:interpolate[t.type],this.zoomHistory=a||fakeZoomHistory,this.instant()||(this.endTime=this.startTime+this.duration+this.delay),e&&e.endTime<=this.startTime&&delete e.oldTransition};StyleTransition.prototype.instant=function(){return!this.oldTransition||!this.interp||0===this.duration&&0===this.delay},StyleTransition.prototype.calculate=function(t,i,e){var o=this._calculateTargetValue(t,i);if(this.instant())return o;if(e=e||Date.now(),e>=this.endTime)return o;var a=this.oldTransition.calculate(t,i,this.startTime),n=util.easeCubicInOut((e-this.startTime-this.delay)/this.duration);return this.interp(a,o,n)},StyleTransition.prototype._calculateTargetValue=function(t,i){if(!this.zoomTransitioned)return this.declaration.calculate(t,i);var e=t.zoom,o=this.zoomHistory.lastIntegerZoom,a=e>o?2:.5,n=this.declaration.calculate({zoom:e>o?e-1:e+1},i),r=this.declaration.calculate({zoom:e},i),s=Math.min((Date.now()-this.zoomHistory.lastIntegerZoomTime)/this.duration,1),l=Math.abs(e-o),u=interpolate(s,1,l);return void 0!==n&&void 0!==r?{from:n,fromScale:a,to:r,toScale:1,t:u}:void 0},module.exports=StyleTransition; | |
},{"../style-spec/util/interpolate":123,"../util/util":215}],159:[function(_dereq_,module,exports){ | |
"use strict";module.exports=_dereq_("../style-spec/validate_style.min"),module.exports.emitErrors=function(r,e){if(e&&e.length){for(var t=0;t<e.length;t++)r.fire("error",{error:new Error(e[t].message)});return!0}return!1}; | |
},{"../style-spec/validate_style.min":145}],160:[function(_dereq_,module,exports){ | |
"use strict";var Point=_dereq_("point-geometry"),Anchor=function(t){function o(o,e,n,r){t.call(this,o,e),this.angle=n,void 0!==r&&(this.segment=r)}return t&&(o.__proto__=t),o.prototype=Object.create(t&&t.prototype),o.prototype.constructor=o,o.prototype.clone=function(){return new o(this.x,this.y,this.angle,this.segment)},o}(Point);module.exports=Anchor; | |
},{"point-geometry":26}],161:[function(_dereq_,module,exports){ | |
"use strict";function checkMaxAngle(e,t,a,r,n){if(void 0===t.segment)return!0;for(var i=t,s=t.segment+1,f=0;f>-a/2;){if(s--,s<0)return!1;f-=e[s].dist(i),i=e[s]}f+=e[s].dist(e[s+1]),s++;for(var l=[],o=0;f<a/2;){var u=e[s-1],c=e[s],g=e[s+1];if(!g)return!1;var h=u.angleTo(c)-c.angleTo(g);for(h=Math.abs((h+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:f,angleDelta:h}),o+=h;f-l[0].distance>r;)o-=l.shift().angleDelta;if(o>n)return!1;s++,f+=c.dist(g)}return!0}module.exports=checkMaxAngle; | |
},{}],162:[function(_dereq_,module,exports){ | |
"use strict";function clipLine(n,x,y,o,e){for(var r=[],t=0;t<n.length;t++)for(var i=n[t],u=void 0,d=0;d<i.length-1;d++){var P=i[d],w=i[d+1];P.x<x&&w.x<x||(P.x<x?P=new Point(x,P.y+(w.y-P.y)*((x-P.x)/(w.x-P.x)))._round():w.x<x&&(w=new Point(x,P.y+(w.y-P.y)*((x-P.x)/(w.x-P.x)))._round()),P.y<y&&w.y<y||(P.y<y?P=new Point(P.x+(w.x-P.x)*((y-P.y)/(w.y-P.y)),y)._round():w.y<y&&(w=new Point(P.x+(w.x-P.x)*((y-P.y)/(w.y-P.y)),y)._round()),P.x>=o&&w.x>=o||(P.x>=o?P=new Point(o,P.y+(w.y-P.y)*((o-P.x)/(w.x-P.x)))._round():w.x>=o&&(w=new Point(o,P.y+(w.y-P.y)*((o-P.x)/(w.x-P.x)))._round()),P.y>=e&&w.y>=e||(P.y>=e?P=new Point(P.x+(w.x-P.x)*((e-P.y)/(w.y-P.y)),e)._round():w.y>=e&&(w=new Point(P.x+(w.x-P.x)*((e-P.y)/(w.y-P.y)),e)._round()),u&&P.equals(u[u.length-1])||(u=[P],r.push(u)),u.push(w)))))}return r}var Point=_dereq_("point-geometry");module.exports=clipLine; | |
},{"point-geometry":26}],163:[function(_dereq_,module,exports){ | |
"use strict";var createStructArrayType=_dereq_("../util/struct_array"),Point=_dereq_("point-geometry"),CollisionBoxArray=createStructArrayType({members:[{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Float32",name:"maxScale"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"bbox0"},{type:"Int16",name:"bbox1"},{type:"Int16",name:"bbox2"},{type:"Int16",name:"bbox3"},{type:"Float32",name:"placementScale"}]});Object.defineProperty(CollisionBoxArray.prototype.StructType.prototype,"anchorPoint",{get:function(){return new Point(this.anchorPointX,this.anchorPointY)}}),module.exports=CollisionBoxArray; | |
},{"../util/struct_array":213,"point-geometry":26}],164:[function(_dereq_,module,exports){ | |
"use strict";var CollisionFeature=function(t,e,i,o,s,a,n,r,l,d,u){var h=n.top*r-l,x=n.bottom*r+l,f=n.left*r-l,m=n.right*r+l;if(this.boxStartIndex=t.length,d){var _=x-h,b=m-f;if(_>0)if(_=Math.max(10*r,_),u){var v=e[i.segment+1].sub(e[i.segment])._unit()._mult(b),c=[i.sub(v),i.add(v)];this._addLineCollisionBoxes(t,c,i,0,b,_,o,s,a)}else this._addLineCollisionBoxes(t,e,i,i.segment,b,_,o,s,a)}else t.emplaceBack(i.x,i.y,f,h,m,x,1/0,o,s,a,0,0,0,0,0);this.boxEndIndex=t.length};CollisionFeature.prototype._addLineCollisionBoxes=function(t,e,i,o,s,a,n,r,l){var d=a/2,u=Math.floor(s/d),h=-a/2,x=this.boxes,f=i,m=o+1,_=h;do{if(m--,m<0)return x;_-=e[m].dist(f),f=e[m]}while(_>-s/2);for(var b=e[m].dist(e[m+1]),v=0;v<u;v++){for(var c=-s/2+v*d;_+b<c;){if(_+=b,m++,m+1>=e.length)return x;b=e[m].dist(e[m+1])}var g=c-_,p=e[m],C=e[m+1],B=C.sub(p)._unit()._mult(g)._add(p)._round(),M=Math.max(Math.abs(c-h)-d/2,0),y=s/2/M;t.emplaceBack(B.x,B.y,-a/2,-a/2,a/2,a/2,y,n,r,l,0,0,0,0,0)}return x},module.exports=CollisionFeature; | |
},{}],165:[function(_dereq_,module,exports){ | |
"use strict";var Point=_dereq_("point-geometry"),EXTENT=_dereq_("../data/extent"),Grid=_dereq_("grid-index"),intersectionTests=_dereq_("../util/intersection_tests"),CollisionTile=function(t,e,i){if("object"==typeof t){var r=t;i=e,t=r.angle,e=r.pitch,this.grid=new Grid(r.grid),this.ignoredGrid=new Grid(r.ignoredGrid)}else this.grid=new Grid(EXTENT,12,6),this.ignoredGrid=new Grid(EXTENT,12,0);this.minScale=.5,this.maxScale=2,this.angle=t,this.pitch=e;var a=Math.sin(t),o=Math.cos(t);if(this.rotationMatrix=[o,-a,a,o],this.reverseRotationMatrix=[o,a,-a,o],this.yStretch=1/Math.cos(e/180*Math.PI),this.yStretch=Math.pow(this.yStretch,1.3),this.collisionBoxArray=i,0===i.length){i.emplaceBack();var n=32767;i.emplaceBack(0,0,0,-n,0,n,n,0,0,0,0,0,0,0,0,0),i.emplaceBack(EXTENT,0,0,-n,0,n,n,0,0,0,0,0,0,0,0,0),i.emplaceBack(0,0,-n,0,n,0,n,0,0,0,0,0,0,0,0,0),i.emplaceBack(0,EXTENT,-n,0,n,0,n,0,0,0,0,0,0,0,0,0)}this.tempCollisionBox=i.get(0),this.edges=[i.get(1),i.get(2),i.get(3),i.get(4)]};CollisionTile.prototype.serialize=function(t){var e=this.grid.toArrayBuffer(),i=this.ignoredGrid.toArrayBuffer();return t&&(t.push(e),t.push(i)),{angle:this.angle,pitch:this.pitch,grid:e,ignoredGrid:i}},CollisionTile.prototype.placeCollisionFeature=function(t,e,i){for(var r=this,a=this.collisionBoxArray,o=this.minScale,n=this.rotationMatrix,l=this.yStretch,h=t.boxStartIndex;h<t.boxEndIndex;h++){var s=a.get(h),x=s.anchorPoint._matMult(n),c=x.x,g=x.y,y=c+s.x1,d=g+s.y1*l,m=c+s.x2,u=g+s.y2*l;if(s.bbox0=y,s.bbox1=d,s.bbox2=m,s.bbox3=u,!e)for(var p=r.grid.query(y,d,m,u),M=0;M<p.length;M++){var f=a.get(p[M]),v=f.anchorPoint._matMult(n);if(o=r.getPlacementScale(o,x,s,v,f),o>=r.maxScale)return o}if(i){var S=void 0;if(r.angle){var P=r.reverseRotationMatrix,b=new Point(s.x1,s.y1).matMult(P),T=new Point(s.x2,s.y1).matMult(P),w=new Point(s.x1,s.y2).matMult(P),N=new Point(s.x2,s.y2).matMult(P);S=r.tempCollisionBox,S.anchorPointX=s.anchorPoint.x,S.anchorPointY=s.anchorPoint.y,S.x1=Math.min(b.x,T.x,w.x,N.x),S.y1=Math.min(b.y,T.x,w.x,N.x),S.x2=Math.max(b.x,T.x,w.x,N.x),S.y2=Math.max(b.y,T.x,w.x,N.x),S.maxScale=s.maxScale}else S=s;for(var B=0;B<this.edges.length;B++){var G=r.edges[B];if(o=r.getPlacementScale(o,s.anchorPoint,S,G.anchorPoint,G),o>=r.maxScale)return o}}}return o},CollisionTile.prototype.queryRenderedSymbols=function(t,e){var i={},r=[];if(0===t.length||0===this.grid.length&&0===this.ignoredGrid.length)return r;for(var a=this.collisionBoxArray,o=this.rotationMatrix,n=this.yStretch,l=[],h=1/0,s=1/0,x=-(1/0),c=-(1/0),g=0;g<t.length;g++)for(var y=t[g],d=0;d<y.length;d++){var m=y[d].matMult(o);h=Math.min(h,m.x),s=Math.min(s,m.y),x=Math.max(x,m.x),c=Math.max(c,m.y),l.push(m)}for(var u=this.grid.query(h,s,x,c),p=this.ignoredGrid.query(h,s,x,c),M=0;M<p.length;M++)u.push(p[M]);for(var f=Math.pow(2,Math.ceil(Math.log(e)/Math.LN2*10)/10),v=0;v<u.length;v++){var S=a.get(u[v]),P=S.sourceLayerIndex,b=S.featureIndex;if(void 0===i[P]&&(i[P]={}),!i[P][b]&&!(f<S.placementScale||f>S.maxScale)){var T=S.anchorPoint.matMult(o),w=T.x+S.x1/e,N=T.y+S.y1/e*n,B=T.x+S.x2/e,G=T.y+S.y2/e*n,E=[new Point(w,N),new Point(B,N),new Point(B,G),new Point(w,G)];intersectionTests.polygonIntersectsPolygon(l,E)&&(i[P][b]=!0,r.push(u[v]))}}return r},CollisionTile.prototype.getPlacementScale=function(t,e,i,r,a){var o=e.x-r.x,n=e.y-r.y,l=(a.x1-i.x2)/o,h=(a.x2-i.x1)/o,s=(a.y1-i.y2)*this.yStretch/n,x=(a.y2-i.y1)*this.yStretch/n;(isNaN(l)||isNaN(h))&&(l=h=1),(isNaN(s)||isNaN(x))&&(s=x=1);var c=Math.min(Math.max(l,h),Math.max(s,x)),g=a.maxScale,y=i.maxScale;return c>g&&(c=g),c>y&&(c=y),c>t&&c>=a.placementScale&&(t=c),t},CollisionTile.prototype.insertCollisionFeature=function(t,e,i){for(var r=this,a=i?this.ignoredGrid:this.grid,o=this.collisionBoxArray,n=t.boxStartIndex;n<t.boxEndIndex;n++){var l=o.get(n);l.placementScale=e,e<r.maxScale&&a.insert(n,l.bbox0,l.bbox1,l.bbox2,l.bbox3)}},module.exports=CollisionTile; | |
},{"../data/extent":54,"../util/intersection_tests":207,"grid-index":16,"point-geometry":26}],166:[function(_dereq_,module,exports){ | |
"use strict";function getAnchors(e,r,t,n,a,l,o,i,c){var h=n?.6*l*o:0,s=Math.max(n?n.right-n.left:0,a?a.right-a.left:0),u=0===e[0].x||e[0].x===c||0===e[0].y||e[0].y===c;r-s*o<r/4&&(r=s*o+r/4);var g=2*l,p=u?r/2*i%r:(s/2+g)*o*i%r;return resample(e,p,r,h,t,s*o,u,!1,c)}function resample(e,r,t,n,a,l,o,i,c){for(var h=l/2,s=0,u=0;u<e.length-1;u++)s+=e[u].dist(e[u+1]);for(var g=0,p=r-t,x=[],f=0;f<e.length-1;f++){for(var v=e[f],m=e[f+1],y=v.dist(m),A=m.angleTo(v);p+t<g+y;){p+=t;var d=(p-g)/y,k=interpolate(v.x,m.x,d),q=interpolate(v.y,m.y,d);if(k>=0&&k<c&&q>=0&&q<c&&p-h>=0&&p+h<=s){var M=new Anchor(k,q,A,f)._round();n&&!checkMaxAngle(e,M,l,n,a)||x.push(M)}}g+=y}return i||x.length||o||(x=resample(e,g/2,t,n,a,l,o,!0,c)),x}var interpolate=_dereq_("../style-spec/util/interpolate"),Anchor=_dereq_("../symbol/anchor"),checkMaxAngle=_dereq_("./check_max_angle");module.exports=getAnchors; | |
},{"../style-spec/util/interpolate":123,"../symbol/anchor":160,"./check_max_angle":161}],167:[function(_dereq_,module,exports){ | |
"use strict";var ShelfPack=_dereq_("@mapbox/shelf-pack"),util=_dereq_("../util/util"),SIZE_GROWTH_RATE=4,DEFAULT_SIZE=128,MAX_SIZE=2048,GlyphAtlas=function(){this.width=DEFAULT_SIZE,this.height=DEFAULT_SIZE,this.atlas=new ShelfPack(this.width,this.height),this.index={},this.ids={},this.data=new Uint8Array(this.width*this.height)};GlyphAtlas.prototype.getGlyphs=function(){var t,i,e,h=this,r={};for(var s in h.ids)t=s.split("#"),i=t[0],e=t[1],r[i]||(r[i]=[]),r[i].push(e);return r},GlyphAtlas.prototype.getRects=function(){var t,i,e,h=this,r={};for(var s in h.ids)t=s.split("#"),i=t[0],e=t[1],r[i]||(r[i]={}),r[i][e]=h.index[s];return r},GlyphAtlas.prototype.addGlyph=function(t,i,e,h){var r=this;if(!e)return null;var s=i+"#"+e.id;if(this.index[s])return this.ids[s].indexOf(t)<0&&this.ids[s].push(t),this.index[s];if(!e.bitmap)return null;var a=e.width+2*h,E=e.height+2*h,n=1,l=a+2*n,T=E+2*n;l+=4-l%4,T+=4-T%4;var u=this.atlas.packOne(l,T);if(u||(this.resize(),u=this.atlas.packOne(l,T)),!u)return util.warnOnce("glyph bitmap overflow"),null;this.index[s]=u,this.ids[s]=[t];for(var d=this.data,p=e.bitmap,A=0;A<E;A++)for(var _=r.width*(u.y+A+n)+u.x+n,o=a*A,x=0;x<a;x++)d[_+x]=p[o+x];return this.dirty=!0,u},GlyphAtlas.prototype.resize=function(){var t=this,i=this.width,e=this.height;if(!(i>=MAX_SIZE||e>=MAX_SIZE)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=SIZE_GROWTH_RATE,this.height*=SIZE_GROWTH_RATE,this.atlas.resize(this.width,this.height);for(var h=new ArrayBuffer(this.width*this.height),r=0;r<e;r++){var s=new Uint8Array(t.data.buffer,e*r,i),a=new Uint8Array(h,e*r*SIZE_GROWTH_RATE,i);a.set(s)}this.data=new Uint8Array(h)}},GlyphAtlas.prototype.bind=function(t){this.gl=t,this.texture?t.bindTexture(t.TEXTURE_2D,this.texture):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,null))},GlyphAtlas.prototype.updateTexture=function(t){this.bind(t),this.dirty&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data),this.dirty=!1)},module.exports=GlyphAtlas; | |
},{"../util/util":215,"@mapbox/shelf-pack":2}],168:[function(_dereq_,module,exports){ | |
"use strict";function glyphUrl(t,e,a,l){return l=l||"abc",a.replace("{s}",l[t.length%l.length]).replace("{fontstack}",t).replace("{range}",e)}var normalizeURL=_dereq_("../util/mapbox").normalizeGlyphsURL,ajax=_dereq_("../util/ajax"),verticalizePunctuation=_dereq_("../util/verticalize_punctuation"),Glyphs=_dereq_("../util/glyphs"),GlyphAtlas=_dereq_("../symbol/glyph_atlas"),Protobuf=_dereq_("pbf"),SimpleGlyph=function(t,e,a){var l=1;this.advance=t.advance,this.left=t.left-a-l,this.top=t.top+a+l,this.rect=e},GlyphSource=function(t){this.url=t&&normalizeURL(t),this.atlases={},this.stacks={},this.loading={}};GlyphSource.prototype.getSimpleGlyphs=function(t,e,a,l){var i=this;void 0===this.stacks[t]&&(this.stacks[t]={}),void 0===this.atlases[t]&&(this.atlases[t]=new GlyphAtlas);for(var r={},o=this.stacks[t],s=this.atlases[t],n=3,h={},p=0,u=function(e){var l=Math.floor(e/256);if(o[l]){var i=o[l].glyphs[e],u=s.addGlyph(a,t,i,n);i&&(r[e]=new SimpleGlyph(i,u,n))}else void 0===h[l]&&(h[l]=[],p++),h[l].push(e)},c=0;c<e.length;c++){var y=e[c],f=String.fromCharCode(y);u(y),verticalizePunctuation.lookup[f]&&u(verticalizePunctuation.lookup[f].charCodeAt(0))}p||l(void 0,r,t);var v=function(e,o,u){if(!e)for(var c=i.stacks[t][o]=u.stacks[0],y=0;y<h[o].length;y++){var f=h[o][y],v=c.glyphs[f],d=s.addGlyph(a,t,v,n);v&&(r[f]=new SimpleGlyph(v,d,n))}p--,p||l(void 0,r,t)};for(var d in h)i.loadRange(t,d,v)},GlyphSource.prototype.loadRange=function(t,e,a){if(256*e>65535)return a("glyphs > 65535 not supported");void 0===this.loading[t]&&(this.loading[t]={});var l=this.loading[t];if(l[e])l[e].push(a);else{l[e]=[a];var i=256*e+"-"+(256*e+255),r=glyphUrl(t,i,this.url);ajax.getArrayBuffer(r,function(t,a){for(var i=!t&&new Glyphs(new Protobuf(a.data)),r=0;r<l[e].length;r++)l[e][r](t,e,i);delete l[e]})}},GlyphSource.prototype.getGlyphAtlas=function(t){return this.atlases[t]},module.exports=GlyphSource; | |
},{"../symbol/glyph_atlas":167,"../util/ajax":194,"../util/glyphs":206,"../util/mapbox":210,"../util/verticalize_punctuation":217,"pbf":25}],169:[function(_dereq_,module,exports){ | |
"use strict";module.exports=function(e){function t(t){g.push(e[t]),l++}function r(e,t,r){var n=u[e];return delete u[e],u[t]=n,g[n].geometry[0].pop(),g[n].geometry[0]=g[n].geometry[0].concat(r[0]),n}function n(e,t,r){var n=i[t];return delete i[t],i[e]=n,g[n].geometry[0].shift(),g[n].geometry[0]=r[0].concat(g[n].geometry[0]),n}function o(e,t,r){var n=r?t[0][t[0].length-1]:t[0][0];return e+":"+n.x+":"+n.y}for(var i={},u={},g=[],l=0,m=0;m<e.length;m++){var y=e[m],c=y.geometry,f=y.text;if(f){var a=o(f,c),s=o(f,c,!0);if(a in u&&s in i&&u[a]!==i[s]){var v=n(a,s,c),d=r(a,s,g[v].geometry);delete i[a],delete u[s],u[o(f,g[d].geometry,!0)]=d,g[v].geometry=null}else a in u?r(a,s,c):s in i?n(a,s,c):(t(m),i[a]=l-1,u[s]=l-1)}else t(m)}return g.filter(function(e){return e.geometry})}; | |
},{}],170:[function(_dereq_,module,exports){ | |
"use strict";function SymbolQuad(t,e,n,a,i,o,l,r,h,c,g){this.anchorPoint=t,this.tl=e,this.tr=n,this.bl=a,this.br=i,this.tex=o,this.anchorAngle=l,this.glyphAngle=r,this.minScale=h,this.maxScale=c,this.writingMode=g}function getIconQuads(t,e,n,a,i,o,l,r,h){var c,g,u,m,s=e.image.rect,d=i.layout,x=1,S=e.left-x,f=S+s.w/e.image.pixelRatio,M=e.top-x,y=M+s.h/e.image.pixelRatio;if("none"!==d["icon-text-fit"]&&l){var P=f-S,p=y-M,w=d["text-size"]/24,v=l.left*w,b=l.right*w,I=l.top*w,_=l.bottom*w,Q=b-v,G=_-I,V=d["icon-text-fit-padding"][0],L=d["icon-text-fit-padding"][1],A=d["icon-text-fit-padding"][2],D=d["icon-text-fit-padding"][3],E="width"===d["icon-text-fit"]?.5*(G-p):0,F="height"===d["icon-text-fit"]?.5*(Q-P):0,q="width"===d["icon-text-fit"]||"both"===d["icon-text-fit"]?Q:P,N="height"===d["icon-text-fit"]||"both"===d["icon-text-fit"]?G:p;c=new Point(v+F-D,I+E-V),g=new Point(v+F+L+q,I+E-V),u=new Point(v+F+L+q,I+E+A+N),m=new Point(v+F-D,I+E+A+N)}else c=new Point(S,M),g=new Point(f,M),u=new Point(f,y),m=new Point(S,y);var R=i.getLayoutValue("icon-rotate",r,h)*Math.PI/180;if(o){var k=a[t.segment];if(t.y===k.y&&t.x===k.x&&t.segment+1<a.length){var z=a[t.segment+1];R+=Math.atan2(t.y-z.y,t.x-z.x)+Math.PI}else R+=Math.atan2(t.y-k.y,t.x-k.x)}if(R){var j=Math.sin(R),B=Math.cos(R),C=[B,-j,j,B];c=c.matMult(C),g=g.matMult(C),m=m.matMult(C),u=u.matMult(C)}return[new SymbolQuad(new Point(t.x,t.y),c,g,m,u,e.image.rect,0,0,minScale,1/0)]}function getGlyphQuads(t,e,n,a,i,o,l,r){for(var h=i.getLayoutValue("text-rotate",l,r)*Math.PI/180,c=i.layout["text-keep-upright"],g=e.positionedGlyphs,u=[],m=0;m<g.length;m++){var s=g[m],d=s.glyph;if(d){var x=d.rect;if(x){var S=(s.x+d.advance/2)*n,f=void 0,M=minScale;o?(f=[],M=getLineGlyphs(f,t,S,a,t.segment,!1),c&&(M=Math.min(M,getLineGlyphs(f,t,S,a,t.segment,!0)))):f=[{anchorPoint:new Point(t.x,t.y),upsideDown:!1,angle:0,maxScale:1/0,minScale:minScale}];var y=s.x+d.left,P=s.y-d.top,p=y+x.w,w=P+x.h,v=new Point(s.x,d.advance/2),b=new Point(y,P),I=new Point(p,P),_=new Point(y,w),Q=new Point(p,w);0!==s.angle&&(b._sub(v)._rotate(s.angle)._add(v),I._sub(v)._rotate(s.angle)._add(v),_._sub(v)._rotate(s.angle)._add(v),Q._sub(v)._rotate(s.angle)._add(v));for(var G=0;G<f.length;G++){var V=f[G],L=b,A=I,D=_,E=Q;if(h){var F=Math.sin(h),q=Math.cos(h),N=[q,-F,F,q];L=L.matMult(N),A=A.matMult(N),D=D.matMult(N),E=E.matMult(N)}var R=Math.max(V.minScale,M),k=(t.angle+(V.upsideDown?Math.PI:0)+2*Math.PI)%(2*Math.PI),z=(V.angle+(V.upsideDown?Math.PI:0)+2*Math.PI)%(2*Math.PI);u.push(new SymbolQuad(V.anchorPoint,L,A,D,E,x,k,z,R,V.maxScale,e.writingMode))}}}}return u}function getLineGlyphs(t,e,n,a,i,o){for(var l=n>=0^o,r=Math.abs(n),h=new Point(e.x,e.y),c=getSegmentEnd(l,a,i),g={anchor:h,end:c,index:i,minScale:getMinScaleForSegment(r,h,c),maxScale:1/0};;){if(insertSegmentGlyph(t,g,l,o),g.minScale<=e.scale)return e.scale;var u=getNextVirtualSegment(g,a,r,l);if(!u)return g.minScale;g=u}}function insertSegmentGlyph(t,e,n,a){var i=Math.atan2(e.end.y-e.anchor.y,e.end.x-e.anchor.x),o=n?i:i+Math.PI;t.push({anchorPoint:e.anchor,upsideDown:a,minScale:e.minScale,maxScale:e.maxScale,angle:(o+2*Math.PI)%(2*Math.PI)})}function getVirtualSegmentAnchor(t,e,n){var a=e.sub(t)._unit();return t.sub(a._mult(n))}function getMinScaleForSegment(t,e,n){var a=e.dist(n);return t/a}function getSegmentEnd(t,e,n){return t?e[n+1]:e[n]}function getNextVirtualSegment(t,e,n,a){for(var i=t.end,o=i,l=t.index;o.equals(i);){if(a&&l+2<e.length)l+=1;else{if(a||0===l)return null;l-=1}o=getSegmentEnd(a,e,l)}var r=getVirtualSegmentAnchor(i,o,t.anchor.dist(t.end));return{anchor:r,end:o,index:l,minScale:getMinScaleForSegment(n,r,o),maxScale:t.minScale}}var Point=_dereq_("point-geometry");module.exports={getIconQuads:getIconQuads,getGlyphQuads:getGlyphQuads,SymbolQuad:SymbolQuad};var minScale=.5; | |
},{"point-geometry":26}],171:[function(_dereq_,module,exports){ | |
"use strict";function PositionedGlyph(e,t,i,n,r){this.codePoint=e,this.x=t,this.y=i,this.glyph=n||null,this.angle=r}function Shaping(e,t,i,n,r,a,o){this.positionedGlyphs=e,this.text=t,this.top=i,this.bottom=n,this.left=r,this.right=a,this.writingMode=o}function breakLines(e,t){for(var i=[],n=0,r=0,a=t;r<a.length;r+=1){var o=a[r];i.push(e.substring(n,o)),n=o}return n<e.length&&i.push(e.substring(n,e.length)),i}function shapeText(e,t,i,n,r,a,o,s,h,l,c){var u=e.trim();c===WritingMode.vertical&&(u=verticalizePunctuation(u));var d,g=[],p=new Shaping(g,u,h[1],h[1],h[0],h[0],c);return d=rtlTextPlugin.processBidirectionalText?rtlTextPlugin.processBidirectionalText(u,determineLineBreaks(u,s,i,t)):breakLines(u,determineLineBreaks(u,s,i,t)),shapeLines(p,t,d,n,r,a,o,h,c,s,l),!!g.length&&p}function determineAverageLineWidth(e,t,i,n){var r=0;for(var a in e){var o=n[e.charCodeAt(a)];o&&(r+=o.advance+t)}var s=Math.max(1,Math.ceil(r/i));return r/s}function calculateBadness(e,t,i,n){var r=Math.pow(e-t,2);return n?e<t?r/2:2*r:r+Math.abs(i)*i}function calculatePenalty(e,t){var i=0;return 10===e&&(i-=1e4),40!==e&&65288!==e||(i+=50),41!==t&&65289!==t||(i+=50),i}function evaluateBreak(e,t,i,n,r,a){for(var o=null,s=calculateBadness(t,i,r,a),h=0,l=n;h<l.length;h+=1){var c=l[h],u=t-c.x,d=calculateBadness(u,i,r,a)+c.badness;d<=s&&(o=c,s=d)}return{index:e,x:t,priorBreak:o,badness:s}}function leastBadBreaks(e){return e?leastBadBreaks(e.priorBreak).concat(e.index):[]}function determineLineBreaks(e,t,i,n){if(!i)return[];if(!e)return[];for(var r=[],a=determineAverageLineWidth(e,t,i,n),o=0,s=0;s<e.length;s++){var h=e.charCodeAt(s),l=n[h];l&&!whitespace[h]&&(o+=l.advance+t),s<e.length-1&&(breakable[h]||scriptDetection.charAllowsIdeographicBreaking(h))&&r.push(evaluateBreak(s+1,o,a,r,calculatePenalty(h,e.charCodeAt(s+1)),!1))}return leastBadBreaks(evaluateBreak(e.length,o,a,r,0,!0))}function shapeLines(e,t,i,n,r,a,o,s,h,l,c){var u=-17,d=0,g=u,p=0,v=e.positionedGlyphs;for(var f in i){var x=i[f].trim();if(x.length){for(var B=v.length,k=0;k<x.length;k++){var P=x.charCodeAt(k),b=t[P];b&&(scriptDetection.charHasUprightVerticalOrientation(P)&&h!==WritingMode.horizontal?(v.push(new PositionedGlyph(P,d,0,b,-Math.PI/2)),d+=c+l):(v.push(new PositionedGlyph(P,d,g,b,0)),d+=b.advance+l))}if(v.length!==B){var m=d-l;p=Math.max(m,p),justifyLine(v,t,B,v.length-1,o)}d=0,g+=n}else g+=n}align(v,o,r,a,p,n,i.length,s);var y=i.length*n;e.top+=-a*y,e.bottom=e.top+y,e.left+=-r*p,e.right=e.left+p}function justifyLine(e,t,i,n,r){if(r)for(var a=t[e[n].codePoint].advance,o=(e[n].x+a)*r,s=i;s<=n;s++)e[s].x-=o}function align(e,t,i,n,r,a,o,s){for(var h=(t-i)*r+s[0],l=(-n*o+.5)*a+s[1],c=0;c<e.length;c++)e[c].x+=h,e[c].y+=l}function shapeIcon(e,t){if(!e||!e.rect)return null;var i=t[0],n=t[1],r=i-e.width/2,a=r+e.width,o=n-e.height/2,s=o+e.height;return new PositionedIcon(e,o,s,r,a)}function PositionedIcon(e,t,i,n,r){this.image=e,this.top=t,this.bottom=i,this.left=n,this.right=r}var scriptDetection=_dereq_("../util/script_detection"),verticalizePunctuation=_dereq_("../util/verticalize_punctuation"),rtlTextPlugin=_dereq_("../source/rtl_text_plugin"),WritingMode={horizontal:1,vertical:2};module.exports={shapeText:shapeText,shapeIcon:shapeIcon,WritingMode:WritingMode};var whitespace={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},breakable={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0}; | |
},{"../source/rtl_text_plugin":91,"../util/script_detection":211,"../util/verticalize_punctuation":217}],172:[function(_dereq_,module,exports){ | |
"use strict";function copyBitmap(t,i,e,r,a,h,s,o,n,l,p){var f,u,d=r*i+e,g=o*h+s;if(p)for(g-=h,u=-1;u<=l;u++,g+=h)for(d=((u+l)%l+r)*i+e,f=-1;f<=n;f++)a[g+f]=t[d+(f+n)%n];else for(u=0;u<l;u++,d+=i,g+=h)for(f=0;f<n;f++)a[g+f]=t[d+f]}var ShelfPack=_dereq_("@mapbox/shelf-pack"),browser=_dereq_("../util/browser"),util=_dereq_("../util/util"),window=_dereq_("../util/window"),Evented=_dereq_("../util/evented"),SpriteAtlas=function(t){function i(i,e){t.call(this),this.width=i,this.height=e,this.shelfPack=new ShelfPack(i,e),this.images={},this.data=!1,this.texture=0,this.filter=0,this.pixelRatio=browser.devicePixelRatio>1?2:1,this.dirty=!0}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.allocateImage=function(t,i){t/=this.pixelRatio,i/=this.pixelRatio;var e=2,r=t+e+(4-(t+e)%4),a=i+e+(4-(i+e)%4),h=this.shelfPack.packOne(r,a);return h?h:(util.warnOnce("SpriteAtlas out of space."),null)},i.prototype.addImage=function(t,i,e){var r,a,h;if(i instanceof window.HTMLImageElement?(r=i.width,a=i.height,i=browser.getImageData(i),h=1):(r=e.width,a=e.height,h=e.pixelRatio||1),ArrayBuffer.isView(i)&&(i=new Uint32Array(i.buffer)),!(i instanceof Uint32Array))return this.fire("error",{error:new Error("Image provided in an invalid format. Supported formats are HTMLImageElement and ArrayBufferView.")});if(this.images[t])return this.fire("error",{error:new Error("An image with this name already exists.")});var s=this.allocateImage(r,a);if(!s)return this.fire("error",{error:new Error("There is not enough space to add this image.")});var o={rect:s,width:r/h,height:a/h,sdf:!1,pixelRatio:h/this.pixelRatio};this.images[t]=o,this.copy(i,r,s,{pixelRatio:h,x:0,y:0,width:r,height:a},!1),this.fire("data",{dataType:"style"})},i.prototype.removeImage=function(t){var i=this.images[t];return delete this.images[t],i?(this.shelfPack.unref(i.rect),void this.fire("data",{dataType:"style"})):this.fire("error",{error:new Error("No image with this name exists.")})},i.prototype.getImage=function(t,i){if(this.images[t])return this.images[t];if(!this.sprite)return null;var e=this.sprite.getSpritePosition(t);if(!e.width||!e.height)return null;var r=this.allocateImage(e.width,e.height);if(!r)return null;var a={rect:r,width:e.width/e.pixelRatio,height:e.height/e.pixelRatio,sdf:e.sdf,pixelRatio:e.pixelRatio/this.pixelRatio};if(this.images[t]=a,!this.sprite.imgData)return null;var h=new Uint32Array(this.sprite.imgData.buffer);return this.copy(h,this.sprite.width,r,e,i),a},i.prototype.getPosition=function(t,i){var e=this.getImage(t,i),r=e&&e.rect;if(!r)return null;var a=e.width*e.pixelRatio,h=e.height*e.pixelRatio,s=1;return{size:[e.width,e.height],tl:[(r.x+s)/this.width,(r.y+s)/this.height],br:[(r.x+s+a)/this.width,(r.y+s+h)/this.height]}},i.prototype.allocate=function(){var t=this;if(!this.data){var i=Math.floor(this.width*this.pixelRatio),e=Math.floor(this.height*this.pixelRatio);this.data=new Uint32Array(i*e);for(var r=0;r<this.data.length;r++)t.data[r]=0}},i.prototype.copy=function(t,i,e,r,a){this.allocate();var h=this.data,s=1;copyBitmap(t,i,r.x,r.y,h,this.width*this.pixelRatio,(e.x+s)*this.pixelRatio,(e.y+s)*this.pixelRatio,r.width,r.height,a),this.dirty=!0},i.prototype.setSprite=function(t){t&&this.canvas&&(this.canvas.width=this.width*this.pixelRatio,this.canvas.height=this.height*this.pixelRatio),this.sprite=t},i.prototype.addIcons=function(t,i){for(var e=this,r=0;r<t.length;r++)e.getImage(t[r]);i(null,this.images)},i.prototype.bind=function(t,i){var e=!1;this.texture?t.bindTexture(t.TEXTURE_2D,this.texture):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e=!0);var r=i?t.LINEAR:t.NEAREST;r!==this.filter&&(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,r),this.filter=r),this.dirty&&(this.allocate(),e?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width*this.pixelRatio,this.height*this.pixelRatio,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(this.data.buffer)):t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width*this.pixelRatio,this.height*this.pixelRatio,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(this.data.buffer)),this.dirty=!1)},i}(Evented);module.exports=SpriteAtlas; | |
},{"../util/browser":195,"../util/evented":203,"../util/util":215,"../util/window":197,"@mapbox/shelf-pack":2}],173:[function(_dereq_,module,exports){ | |
"use strict";var rtlTextPlugin=_dereq_("../source/rtl_text_plugin");module.exports=function(e,r,t,a){var l=r.getLayoutValue("text-transform",t,a);return"uppercase"===l?e=e.toLocaleUpperCase():"lowercase"===l&&(e=e.toLocaleLowerCase()),rtlTextPlugin.applyArabicShaping&&(e=rtlTextPlugin.applyArabicShaping(e)),e}; | |
},{"../source/rtl_text_plugin":91}],174:[function(_dereq_,module,exports){ | |
"use strict";var DOM=_dereq_("../util/dom"),Point=_dereq_("point-geometry"),handlers={scrollZoom:_dereq_("./handler/scroll_zoom"),boxZoom:_dereq_("./handler/box_zoom"),dragRotate:_dereq_("./handler/drag_rotate"),dragPan:_dereq_("./handler/drag_pan"),keyboard:_dereq_("./handler/keyboard"),doubleClickZoom:_dereq_("./handler/dblclick_zoom"),touchZoomRotate:_dereq_("./handler/touch_zoom_rotate")};module.exports=function(e,t){function n(e){h("mouseout",e)}function o(t){e.stop(),L=DOM.mousePos(g,t),h("mousedown",t),E=!0}function r(t){var n=e.dragRotate&&e.dragRotate.isActive();p&&!n&&h("contextmenu",p),p=null,E=!1,h("mouseup",t)}function a(t){if(!(e.dragPan&&e.dragPan.isActive()||e.dragRotate&&e.dragRotate.isActive())){for(var n=t.toElement||t.target;n&&n!==g;)n=n.parentNode;n===g&&h("mousemove",t)}}function u(t){e.stop(),f("touchstart",t),!t.touches||t.touches.length>1||(b?(clearTimeout(b),b=null,h("dblclick",t)):b=setTimeout(l,300))}function i(e){f("touchmove",e)}function c(e){f("touchend",e)}function d(e){f("touchcancel",e)}function l(){b=null}function s(e){var t=DOM.mousePos(g,e);t.equals(L)&&h("click",e)}function v(e){h("dblclick",e),e.preventDefault()}function m(t){var n=e.dragRotate&&e.dragRotate.isActive();E||n?E&&(p=t):h("contextmenu",t),t.preventDefault()}function h(t,n){var o=DOM.mousePos(g,n);return e.fire(t,{lngLat:e.unproject(o),point:o,originalEvent:n})}function f(t,n){var o=DOM.touchPos(g,n),r=o.reduce(function(e,t,n,o){return e.add(t.div(o.length))},new Point(0,0));return e.fire(t,{lngLat:e.unproject(r),point:r,lngLats:o.map(function(t){return e.unproject(t)},this),points:o,originalEvent:n})}var g=e.getCanvasContainer(),p=null,E=!1,L=null,b=null;for(var q in handlers)e[q]=new handlers[q](e,t),t.interactive&&t[q]&&e[q].enable(t[q]);g.addEventListener("mouseout",n,!1),g.addEventListener("mousedown",o,!1),g.addEventListener("mouseup",r,!1),g.addEventListener("mousemove",a,!1),g.addEventListener("touchstart",u,!1),g.addEventListener("touchend",c,!1),g.addEventListener("touchmove",i,!1),g.addEventListener("touchcancel",d,!1),g.addEventListener("click",s,!1),g.addEventListener("dblclick",v,!1),g.addEventListener("contextmenu",m,!1)}; | |
},{"../util/dom":202,"./handler/box_zoom":182,"./handler/dblclick_zoom":183,"./handler/drag_pan":184,"./handler/drag_rotate":185,"./handler/keyboard":186,"./handler/scroll_zoom":187,"./handler/touch_zoom_rotate":188,"point-geometry":26}],175:[function(_dereq_,module,exports){ | |
"use strict";var util=_dereq_("../util/util"),interpolate=_dereq_("../style-spec/util/interpolate"),browser=_dereq_("../util/browser"),LngLat=_dereq_("../geo/lng_lat"),LngLatBounds=_dereq_("../geo/lng_lat_bounds"),Point=_dereq_("point-geometry"),Evented=_dereq_("../util/evented"),Camera=function(t){function e(e,i){t.call(this),this.moving=!1,this.transform=e,this._bearingSnap=i.bearingSnap}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCenter=function(){return this.transform.center},e.prototype.setCenter=function(t,e){return this.jumpTo({center:t},e)},e.prototype.panBy=function(t,e,i){return t=Point.convert(t).mult(-1),this.panTo(this.transform.center,util.extend({offset:t},e),i)},e.prototype.panTo=function(t,e,i){return this.easeTo(util.extend({center:t},e),i)},e.prototype.getZoom=function(){return this.transform.zoom},e.prototype.setZoom=function(t,e){return this.jumpTo({zoom:t},e),this},e.prototype.zoomTo=function(t,e,i){return this.easeTo(util.extend({zoom:t},e),i)},e.prototype.zoomIn=function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},e.prototype.zoomOut=function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},e.prototype.getBearing=function(){return this.transform.bearing},e.prototype.setBearing=function(t,e){return this.jumpTo({bearing:t},e),this},e.prototype.rotateTo=function(t,e,i){return this.easeTo(util.extend({bearing:t},e),i)},e.prototype.resetNorth=function(t,e){return this.rotateTo(0,util.extend({duration:1e3},t),e),this},e.prototype.snapToNorth=function(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this},e.prototype.getPitch=function(){return this.transform.pitch},e.prototype.setPitch=function(t,e){return this.jumpTo({pitch:t},e),this},e.prototype.fitBounds=function(t,e,i){if(e=util.extend({padding:{top:0,bottom:0,right:0,left:0},offset:[0,0],maxZoom:this.transform.maxZoom},e),"number"==typeof e.padding){var o=e.padding;e.padding={top:o,bottom:o,right:o,left:o}}if(!util.deepEqual(Object.keys(e.padding).sort(function(t,e){return t<e?-1:t>e?1:0}),["bottom","left","right","top"]))return void util.warnOnce("options.padding must be a positive number, or an Object with keys 'bottom', 'left', 'right', 'top'");t=LngLatBounds.convert(t);var n=[e.padding.left-e.padding.right,e.padding.top-e.padding.bottom],r=Math.min(e.padding.right,e.padding.left),a=Math.min(e.padding.top,e.padding.bottom);e.offset=[e.offset[0]+n[0],e.offset[1]+n[1]];var s=Point.convert(e.offset),h=this.transform,p=h.project(t.getNorthWest()),u=h.project(t.getSouthEast()),c=u.sub(p),f=(h.width-2*r-2*Math.abs(s.x))/c.x,m=(h.height-2*a-2*Math.abs(s.y))/c.y;return m<0||f<0?void util.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset."):(e.center=h.unproject(p.add(u).div(2)),e.zoom=Math.min(h.scaleZoom(h.scale*Math.min(f,m)),e.maxZoom),e.bearing=0,e.linear?this.easeTo(e,i):this.flyTo(e,i))},e.prototype.jumpTo=function(t,e){this.stop();var i=this.transform,o=!1,n=!1,r=!1;return"zoom"in t&&i.zoom!==+t.zoom&&(o=!0,i.zoom=+t.zoom),"center"in t&&(i.center=LngLat.convert(t.center)),"bearing"in t&&i.bearing!==+t.bearing&&(n=!0,i.bearing=+t.bearing),"pitch"in t&&i.pitch!==+t.pitch&&(r=!0,i.pitch=+t.pitch),this.fire("movestart",e).fire("move",e),o&&this.fire("zoomstart",e).fire("zoom",e).fire("zoomend",e),n&&this.fire("rotate",e),r&&this.fire("pitchstart",e).fire("pitch",e).fire("pitchend",e),this.fire("moveend",e)},e.prototype.easeTo=function(t,e){var i=this;this.stop(),t=util.extend({offset:[0,0],duration:500,easing:util.ease},t),t.animate===!1&&(t.duration=0),t.smoothEasing&&0!==t.duration&&(t.easing=this._smoothOutEasing(t.duration));var o=this.transform,n=this.getZoom(),r=this.getBearing(),a=this.getPitch(),s="zoom"in t?+t.zoom:n,h="bearing"in t?this._normalizeBearing(t.bearing,r):r,p="pitch"in t?+t.pitch:a,u=o.centerPoint.add(Point.convert(t.offset)),c=o.pointLocation(u),f=LngLat.convert(t.center||c);this._normalizeCenter(f);var m,g,d=o.project(c),l=o.project(f).sub(d),v=o.zoomScale(s-n);return t.around&&(m=LngLat.convert(t.around),g=o.locationPoint(m)),this.zooming=s!==n,this.rotating=r!==h,this.pitching=p!==a,this._prepareEase(e,t.noMoveStart),clearTimeout(this._onEaseEnd),this._ease(function(t){if(this.zooming&&(o.zoom=interpolate(n,s,t)),this.rotating&&(o.bearing=interpolate(r,h,t)),this.pitching&&(o.pitch=interpolate(a,p,t)),m)o.setLocationAtPoint(m,g);else{var i=o.zoomScale(o.zoom-n),c=s>n?Math.min(2,v):Math.max(.5,v),f=Math.pow(c,1-t),b=o.unproject(d.add(l.mult(t*f)).mult(i));o.setLocationAtPoint(o.renderWorldCopies?b.wrap():b,u)}this._fireMoveEvents(e)},function(){t.delayEndEvents?i._onEaseEnd=setTimeout(function(){return i._easeToEnd(e)},t.delayEndEvents):i._easeToEnd(e)},t),this},e.prototype._prepareEase=function(t,e){this.moving=!0,e||this.fire("movestart",t),this.zooming&&this.fire("zoomstart",t),this.pitching&&this.fire("pitchstart",t)},e.prototype._fireMoveEvents=function(t){this.fire("move",t),this.zooming&&this.fire("zoom",t),this.rotating&&this.fire("rotate",t),this.pitching&&this.fire("pitch",t)},e.prototype._easeToEnd=function(t){var e=this.zooming,i=this.pitching;this.moving=!1,this.zooming=!1,this.rotating=!1,this.pitching=!1,e&&this.fire("zoomend",t),i&&this.fire("pitchend",t),this.fire("moveend",t)},e.prototype.flyTo=function(t,e){function i(t){var e=(M*M-z*z+(t?-1:1)*L*L*E*E)/(2*(t?M:z)*L*E);return Math.log(Math.sqrt(e*e+1)-e)}function o(t){return(Math.exp(t)-Math.exp(-t))/2}function n(t){return(Math.exp(t)+Math.exp(-t))/2}function r(t){return o(t)/n(t)}var a=this;this.stop(),t=util.extend({offset:[0,0],speed:1.2,curve:1.42,easing:util.ease},t);var s=this.transform,h=this.getZoom(),p=this.getBearing(),u=this.getPitch(),c="zoom"in t?+t.zoom:h,f="bearing"in t?this._normalizeBearing(t.bearing,p):p,m="pitch"in t?+t.pitch:u,g=s.zoomScale(c-h),d=s.centerPoint.add(Point.convert(t.offset)),l=s.pointLocation(d),v=LngLat.convert(t.center||l);this._normalizeCenter(v);var b=s.project(l),y=s.project(v).sub(b),_=t.curve,z=Math.max(s.width,s.height),M=z/g,E=y.mag();if("minZoom"in t){var T=util.clamp(Math.min(t.minZoom,h,c),s.minZoom,s.maxZoom),x=z/s.zoomScale(T-h);_=Math.sqrt(x/E*2)}var L=_*_,j=i(0),w=function(t){return n(j)/n(j+_*t)},P=function(t){return z*((n(j)*r(j+_*t)-o(j))/L)/E},Z=(i(1)-j)/_;if(Math.abs(E)<1e-6){if(Math.abs(z-M)<1e-6)return this.easeTo(t,e);var q=M<z?-1:1;Z=Math.abs(Math.log(M/z))/_,P=function(){return 0},w=function(t){return Math.exp(q*_*t)}}if("duration"in t)t.duration=+t.duration;else{var B="screenSpeed"in t?+t.screenSpeed/_:+t.speed;t.duration=1e3*Z/B}return this.zooming=!0,this.rotating=p!==f,this.pitching=m!==u,this._prepareEase(e,!1),this._ease(function(t){var i=t*Z,o=1/w(i);s.zoom=h+s.scaleZoom(o),this.rotating&&(s.bearing=interpolate(p,f,t)),this.pitching&&(s.pitch=interpolate(u,m,t));var n=s.unproject(b.add(y.mult(P(i))).mult(o));s.setLocationAtPoint(s.renderWorldCopies?n.wrap():n,d),this._fireMoveEvents(e)},function(){return a._easeToEnd(e)},t),this},e.prototype.isEasing=function(){return!!this._abortFn},e.prototype.isMoving=function(){return this.moving},e.prototype.stop=function(){return this._abortFn&&(this._abortFn(),this._finishEase()),this},e.prototype._ease=function(t,e,i){this._finishFn=e,this._abortFn=browser.timed(function(e){t.call(this,i.easing(e)),1===e&&this._finishEase()},i.animate===!1?0:i.duration,this)},e.prototype._finishEase=function(){delete this._abortFn;var t=this._finishFn;delete this._finishFn,t.call(this)},e.prototype._normalizeBearing=function(t,e){t=util.wrap(t,-180,180);var i=Math.abs(t-e);return Math.abs(t-360-e)<i&&(t-=360),Math.abs(t+360-e)<i&&(t+=360),t},e.prototype._normalizeCenter=function(t){var e=this.transform;if(e.renderWorldCopies&&!e.lngRange){var i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}},e.prototype._smoothOutEasing=function(t){var e=util.ease;if(this._prevEase){var i=this._prevEase,o=(Date.now()-i.start)/i.duration,n=i.easing(o+.01)-i.easing(o),r=.27/Math.sqrt(n*n+1e-4)*.01,a=Math.sqrt(.0729-r*r);e=util.bezier(r,a,.25,1)}return this._prevEase={start:(new Date).getTime(),duration:t,easing:e},e},e}(Evented);module.exports=Camera; | |
},{"../geo/lng_lat":62,"../geo/lng_lat_bounds":63,"../style-spec/util/interpolate":123,"../util/browser":195,"../util/evented":203,"../util/util":215,"point-geometry":26}],176:[function(_dereq_,module,exports){ | |
"use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),AttributionControl=function(t){this.options=t,util.bindAll(["_updateEditLink","_updateData","_updateCompact"],this)};AttributionControl.prototype.getDefaultPosition=function(){return"bottom-right"},AttributionControl.prototype.onAdd=function(t){var i=this.options&&this.options.compact;return this._map=t,this._container=DOM.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),i&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===i&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},AttributionControl.prototype.onRemove=function(){this._container.parentNode.removeChild(this._container),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0},AttributionControl.prototype._updateEditLink=function(){if(this._editLink||(this._editLink=this._container.querySelector(".mapboxgl-improve-map")),this._editLink){var t=this._map.getCenter();this._editLink.href="https://www.mapbox.com/map-feedback/#/"+t.lng+"/"+t.lat+"/"+Math.round(this._map.getZoom()+1)}},AttributionControl.prototype._updateData=function(t){t&&"metadata"===t.sourceDataType&&(this._updateAttributions(),this._updateEditLink())},AttributionControl.prototype._updateAttributions=function(){if(this._map.style){var t=[],i=this._map.style.sourceCaches;for(var o in i){var n=i[o].getSource();n.attribution&&t.indexOf(n.attribution)<0&&t.push(n.attribution)}t.sort(function(t,i){return t.length-i.length}),t=t.filter(function(i,o){for(var n=o+1;n<t.length;n++)if(t[n].indexOf(i)>=0)return!1;return!0}),this._container.innerHTML=t.join(" | "),this._editLink=null}},AttributionControl.prototype._updateCompact=function(){var t=this._map.getCanvasContainer().offsetWidth<=640;this._container.classList[t?"add":"remove"]("mapboxgl-compact")},module.exports=AttributionControl; | |
},{"../../util/dom":202,"../../util/util":215}],177:[function(_dereq_,module,exports){ | |
"use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),window=_dereq_("../../util/window"),FullscreenControl=function(){this._fullscreen=!1,util.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in window.document&&(this._fullscreenchange="MSFullscreenChange")};FullscreenControl.prototype.onAdd=function(e){var n="mapboxgl-ctrl",l=this._container=DOM.create("div",n+" mapboxgl-ctrl-group"),t=this._fullscreenButton=DOM.create("button",n+"-icon "+n+"-fullscreen",this._container);return t.setAttribute("aria-label","Toggle fullscreen"),t.type="button",this._fullscreenButton.addEventListener("click",this._onClickFullscreen),this._mapContainer=e.getContainer(),window.document.addEventListener(this._fullscreenchange,this._changeIcon),l},FullscreenControl.prototype.onRemove=function(){this._container.parentNode.removeChild(this._container),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},FullscreenControl.prototype._isFullscreen=function(){return this._fullscreen},FullscreenControl.prototype._changeIcon=function(){var e=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;if(e===this._mapContainer!==this._fullscreen){this._fullscreen=!this._fullscreen;var n="mapboxgl-ctrl";this._fullscreenButton.classList.toggle(n+"-shrink"),this._fullscreenButton.classList.toggle(n+"-fullscreen")}},FullscreenControl.prototype._onClickFullscreen=function(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._mapContainer.requestFullscreen?this._mapContainer.requestFullscreen():this._mapContainer.mozRequestFullScreen?this._mapContainer.mozRequestFullScreen():this._mapContainer.msRequestFullscreen?this._mapContainer.msRequestFullscreen():this._mapContainer.webkitRequestFullscreen&&this._mapContainer.webkitRequestFullscreen()},module.exports=FullscreenControl; | |
},{"../../util/dom":202,"../../util/util":215,"../../util/window":197}],178:[function(_dereq_,module,exports){ | |
"use strict";function checkGeolocationSupport(t){void 0!==supportsGeolocation?t(supportsGeolocation):void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then(function(o){supportsGeolocation="denied"!==o.state,t(supportsGeolocation)}):(supportsGeolocation=!!window.navigator.geolocation,t(supportsGeolocation))}var Evented=_dereq_("../../util/evented"),DOM=_dereq_("../../util/dom"),window=_dereq_("../../util/window"),util=_dereq_("../../util/util"),defaultGeoPositionOptions={enableHighAccuracy:!1,timeout:6e3},className="mapboxgl-ctrl",supportsGeolocation,GeolocateControl=function(t){function o(o){t.call(this),this.options=o||{},util.bindAll(["_onSuccess","_onError","_finish","_setupUI"],this)}return t&&(o.__proto__=t),o.prototype=Object.create(t&&t.prototype),o.prototype.constructor=o,o.prototype.onAdd=function(t){return this._map=t,this._container=DOM.create("div",className+" "+className+"-group"),checkGeolocationSupport(this._setupUI),this._container},o.prototype.onRemove=function(){this._container.parentNode.removeChild(this._container),this._map=void 0},o.prototype._onSuccess=function(t){this._map.jumpTo({center:[t.coords.longitude,t.coords.latitude],zoom:17,bearing:0,pitch:0}),this.fire("geolocate",t),this._finish()},o.prototype._onError=function(t){this.fire("error",t),this._finish()},o.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},o.prototype._setupUI=function(t){t!==!1&&(this._container.addEventListener("contextmenu",function(t){return t.preventDefault()}),this._geolocateButton=DOM.create("button",className+"-icon "+className+"-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.setAttribute("aria-label","Geolocate"),this.options.watchPosition&&this._geolocateButton.setAttribute("aria-pressed",!1),this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)))},o.prototype._onClickGeolocate=function(){var t=util.extend(defaultGeoPositionOptions,this.options&&this.options.positionOptions||{});this.options.watchPosition?void 0!==this._geolocationWatchID?(this._geolocateButton.classList.remove("mapboxgl-watching"),this._geolocateButton.setAttribute("aria-pressed",!1),window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0):(this._geolocateButton.classList.add("mapboxgl-watching"),this._geolocateButton.setAttribute("aria-pressed",!0),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)):(window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,t),this._timeoutId=setTimeout(this._finish,1e4))},o}(Evented);module.exports=GeolocateControl; | |
},{"../../util/dom":202,"../../util/evented":203,"../../util/util":215,"../../util/window":197}],179:[function(_dereq_,module,exports){ | |
"use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),LogoControl=function(){util.bindAll(["_updateLogo"],this)};LogoControl.prototype.onAdd=function(o){return this._map=o,this._container=DOM.create("div","mapboxgl-ctrl"),this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._container},LogoControl.prototype.onRemove=function(){this._container.parentNode.removeChild(this._container),this._map.off("sourcedata",this._updateLogo)},LogoControl.prototype.getDefaultPosition=function(){return"bottom-left"},LogoControl.prototype._updateLogo=function(o){if(o&&"metadata"===o.sourceDataType)if(!this._container.childNodes.length&&this._logoRequired()){var t=DOM.create("a","mapboxgl-ctrl-logo");t.target="_blank",t.href="https://www.mapbox.com/",t.setAttribute("aria-label","Mapbox logo"),this._container.appendChild(t),this._map.off("data",this._updateLogo)}else this._container.childNodes.length&&!this._logoRequired()&&this.onRemove()},LogoControl.prototype._logoRequired=function(){if(this._map.style){var o=this._map.style.sourceCaches;for(var t in o){var e=o[t].getSource();if(e.mapbox_logo)return!0}return!1}},module.exports=LogoControl; | |
},{"../../util/dom":202,"../../util/util":215}],180:[function(_dereq_,module,exports){ | |
"use strict";function copyMouseEvent(t){return new window.MouseEvent(t.type,{button:2,buttons:2,bubbles:!0,cancelable:!0,detail:t.detail,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,movementX:t.movementX,movementY:t.movementY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey})}var DOM=_dereq_("../../util/dom"),window=_dereq_("../../util/window"),util=_dereq_("../../util/util"),className="mapboxgl-ctrl",NavigationControl=function(){util.bindAll(["_rotateCompassArrow"],this)};NavigationControl.prototype._rotateCompassArrow=function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t},NavigationControl.prototype.onAdd=function(t){return this._map=t,this._container=DOM.create("div",className+" "+className+"-group",t.getContainer()),this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._zoomInButton=this._createButton(className+"-icon "+className+"-zoom-in","Zoom In",t.zoomIn.bind(t)),this._zoomOutButton=this._createButton(className+"-icon "+className+"-zoom-out","Zoom Out",t.zoomOut.bind(t)),this._compass=this._createButton(className+"-icon "+className+"-compass","Reset North",t.resetNorth.bind(t)),this._compassArrow=DOM.create("span",className+"-compass-arrow",this._compass),this._compass.addEventListener("mousedown",this._onCompassDown.bind(this)),this._onCompassMove=this._onCompassMove.bind(this),this._onCompassUp=this._onCompassUp.bind(this),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._container},NavigationControl.prototype.onRemove=function(){this._container.parentNode.removeChild(this._container),this._map.off("rotate",this._rotateCompassArrow),this._map=void 0},NavigationControl.prototype._onContextMenu=function(t){t.preventDefault()},NavigationControl.prototype._onCompassDown=function(t){0===t.button&&(DOM.disableDrag(),window.document.addEventListener("mousemove",this._onCompassMove),window.document.addEventListener("mouseup",this._onCompassUp),this._map.getCanvasContainer().dispatchEvent(copyMouseEvent(t)),t.stopPropagation())},NavigationControl.prototype._onCompassMove=function(t){0===t.button&&(this._map.getCanvasContainer().dispatchEvent(copyMouseEvent(t)),t.stopPropagation())},NavigationControl.prototype._onCompassUp=function(t){0===t.button&&(window.document.removeEventListener("mousemove",this._onCompassMove),window.document.removeEventListener("mouseup",this._onCompassUp),DOM.enableDrag(),this._map.getCanvasContainer().dispatchEvent(copyMouseEvent(t)),t.stopPropagation())},NavigationControl.prototype._createButton=function(t,o,e){var n=DOM.create("button",t,this._container);return n.type="button",n.setAttribute("aria-label",o),n.addEventListener("click",function(){e()}),n},module.exports=NavigationControl; | |
},{"../../util/dom":202,"../../util/util":215,"../../util/window":197}],181:[function(_dereq_,module,exports){ | |
"use strict";function updateScale(t,e,o){var n=o&&o.maxWidth||100,i=t._container.clientHeight/2,a=getDistance(t.unproject([0,i]),t.unproject([n,i]));if(o&&"imperial"===o.unit){var r=3.2808*a;if(r>5280){var l=r/5280;setScale(e,n,l,"mi")}else setScale(e,n,r,"ft")}else setScale(e,n,a,"m")}function setScale(t,e,o,n){var i=getRoundNum(o),a=i/o;"m"===n&&i>=1e3&&(i/=1e3,n="km"),t.style.width=e*a+"px",t.innerHTML=i+n}function getDistance(t,e){var o=6371e3,n=Math.PI/180,i=t.lat*n,a=e.lat*n,r=Math.sin(i)*Math.sin(a)+Math.cos(i)*Math.cos(a)*Math.cos((e.lng-t.lng)*n),l=o*Math.acos(Math.min(r,1));return l}function getRoundNum(t){var e=Math.pow(10,(""+Math.floor(t)).length-1),o=t/e;return o=o>=10?10:o>=5?5:o>=3?3:o>=2?2:1,e*o}var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),ScaleControl=function(t){this.options=t,util.bindAll(["_onMove"],this)};ScaleControl.prototype.getDefaultPosition=function(){return"bottom-left"},ScaleControl.prototype._onMove=function(){updateScale(this._map,this._container,this.options)},ScaleControl.prototype.onAdd=function(t){return this._map=t,this._container=DOM.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},ScaleControl.prototype.onRemove=function(){this._container.parentNode.removeChild(this._container),this._map.off("move",this._onMove),this._map=void 0},module.exports=ScaleControl; | |
},{"../../util/dom":202,"../../util/util":215}],182:[function(_dereq_,module,exports){ | |
"use strict";var DOM=_dereq_("../../util/dom"),LngLatBounds=_dereq_("../../geo/lng_lat_bounds"),util=_dereq_("../../util/util"),window=_dereq_("../../util/window"),BoxZoomHandler=function(o){this._map=o,this._el=o.getCanvasContainer(),this._container=o.getContainer(),util.bindAll(["_onMouseDown","_onMouseMove","_onMouseUp","_onKeyDown"],this)};BoxZoomHandler.prototype.isEnabled=function(){return!!this._enabled},BoxZoomHandler.prototype.isActive=function(){return!!this._active},BoxZoomHandler.prototype.enable=function(){this.isEnabled()||(this._map.dragPan&&this._map.dragPan.disable(),this._el.addEventListener("mousedown",this._onMouseDown,!1),this._map.dragPan&&this._map.dragPan.enable(),this._enabled=!0)},BoxZoomHandler.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onMouseDown),this._enabled=!1)},BoxZoomHandler.prototype._onMouseDown=function(o){o.shiftKey&&0===o.button&&(window.document.addEventListener("mousemove",this._onMouseMove,!1),window.document.addEventListener("keydown",this._onKeyDown,!1),window.document.addEventListener("mouseup",this._onMouseUp,!1),DOM.disableDrag(),this._startPos=DOM.mousePos(this._el,o),this._active=!0)},BoxZoomHandler.prototype._onMouseMove=function(o){var e=this._startPos,t=DOM.mousePos(this._el,o);this._box||(this._box=DOM.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",o));var n=Math.min(e.x,t.x),i=Math.max(e.x,t.x),s=Math.min(e.y,t.y),a=Math.max(e.y,t.y);DOM.setTransform(this._box,"translate("+n+"px,"+s+"px)"),this._box.style.width=i-n+"px",this._box.style.height=a-s+"px"},BoxZoomHandler.prototype._onMouseUp=function(o){if(0===o.button){var e=this._startPos,t=DOM.mousePos(this._el,o),n=(new LngLatBounds).extend(this._map.unproject(e)).extend(this._map.unproject(t));this._finish(),e.x===t.x&&e.y===t.y?this._fireEvent("boxzoomcancel",o):this._map.fitBounds(n,{linear:!0}).fire("boxzoomend",{originalEvent:o,boxZoomBounds:n})}},BoxZoomHandler.prototype._onKeyDown=function(o){27===o.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",o))},BoxZoomHandler.prototype._finish=function(){this._active=!1,window.document.removeEventListener("mousemove",this._onMouseMove,!1),window.document.removeEventListener("keydown",this._onKeyDown,!1),window.document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.parentNode.removeChild(this._box),this._box=null),DOM.enableDrag()},BoxZoomHandler.prototype._fireEvent=function(o,e){return this._map.fire(o,{originalEvent:e})},module.exports=BoxZoomHandler; | |
},{"../../geo/lng_lat_bounds":63,"../../util/dom":202,"../../util/util":215,"../../util/window":197}],183:[function(_dereq_,module,exports){ | |
"use strict";var DoubleClickZoomHandler=function(o){this._map=o,this._onDblClick=this._onDblClick.bind(this)};DoubleClickZoomHandler.prototype.isEnabled=function(){return!!this._enabled},DoubleClickZoomHandler.prototype.enable=function(){this.isEnabled()||(this._map.on("dblclick",this._onDblClick),this._enabled=!0)},DoubleClickZoomHandler.prototype.disable=function(){this.isEnabled()&&(this._map.off("dblclick",this._onDblClick),this._enabled=!1)},DoubleClickZoomHandler.prototype._onDblClick=function(o){this._map.zoomTo(this._map.getZoom()+(o.originalEvent.shiftKey?-1:1),{around:o.lngLat},o)},module.exports=DoubleClickZoomHandler; | |
},{}],184:[function(_dereq_,module,exports){ | |
"use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),window=_dereq_("../../util/window"),inertiaLinearity=.3,inertiaEasing=util.bezier(0,0,inertiaLinearity,1),inertiaMaxSpeed=1400,inertiaDeceleration=2500,DragPanHandler=function(t){this._map=t,this._el=t.getCanvasContainer(),util.bindAll(["_onDown","_onMove","_onUp","_onTouchEnd","_onMouseUp"],this)};DragPanHandler.prototype.isEnabled=function(){return!!this._enabled},DragPanHandler.prototype.isActive=function(){return!!this._active},DragPanHandler.prototype.enable=function(){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-drag-pan"),this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown),this._enabled=!0)},DragPanHandler.prototype.disable=function(){this.isEnabled()&&(this._el.classList.remove("mapboxgl-touch-drag-pan"),this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown),this._enabled=!1)},DragPanHandler.prototype._onDown=function(t){this._ignoreEvent(t)||this.isActive()||(t.touches?(window.document.addEventListener("touchmove",this._onMove),window.document.addEventListener("touchend",this._onTouchEnd)):(window.document.addEventListener("mousemove",this._onMove),window.document.addEventListener("mouseup",this._onMouseUp)),window.addEventListener("blur",this._onMouseUp),this._active=!1,this._startPos=this._pos=DOM.mousePos(this._el,t),this._inertia=[[Date.now(),this._pos]])},DragPanHandler.prototype._onMove=function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._map.moving=!0,this._fireEvent("dragstart",t),this._fireEvent("movestart",t));var e=DOM.mousePos(this._el,t),n=this._map;n.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),e]),n.transform.setLocationAtPoint(n.transform.pointLocation(this._pos),e),this._fireEvent("drag",t),this._fireEvent("move",t),this._pos=e,t.preventDefault()}},DragPanHandler.prototype._onUp=function(t){var e=this;if(this.isActive()){this._active=!1,this._fireEvent("dragend",t),this._drainInertiaBuffer();var n=function(){e._map.moving=!1,e._fireEvent("moveend",t)},i=this._inertia;if(i.length<2)return void n();var o=i[i.length-1],r=i[0],a=o[1].sub(r[1]),s=(o[0]-r[0])/1e3;if(0===s||o[1].equals(r[1]))return void n();var u=a.mult(inertiaLinearity/s),d=u.mag();d>inertiaMaxSpeed&&(d=inertiaMaxSpeed,u._unit()._mult(d));var h=d/(inertiaDeceleration*inertiaLinearity),v=u.mult(-h/2);this._map.panBy(v,{duration:1e3*h,easing:inertiaEasing,noMoveStart:!0},{originalEvent:t})}},DragPanHandler.prototype._onMouseUp=function(t){this._ignoreEvent(t)||(this._onUp(t),window.document.removeEventListener("mousemove",this._onMove),window.document.removeEventListener("mouseup",this._onMouseUp),window.removeEventListener("blur",this._onMouseUp))},DragPanHandler.prototype._onTouchEnd=function(t){this._ignoreEvent(t)||(this._onUp(t),window.document.removeEventListener("touchmove",this._onMove),window.document.removeEventListener("touchend",this._onTouchEnd))},DragPanHandler.prototype._fireEvent=function(t,e){return this._map.fire(t,{originalEvent:e})},DragPanHandler.prototype._ignoreEvent=function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.isActive())return!0;if(e.dragRotate&&e.dragRotate.isActive())return!0;if(t.touches)return t.touches.length>1;if(t.ctrlKey)return!0;var n=1,i=0;return"mousemove"===t.type?t.buttons&0===n:t.button&&t.button!==i},DragPanHandler.prototype._drainInertiaBuffer=function(){for(var t=this._inertia,e=Date.now(),n=160;t.length>0&&e-t[0][0]>n;)t.shift()},module.exports=DragPanHandler; | |
},{"../../util/dom":202,"../../util/util":215,"../../util/window":197}],185:[function(_dereq_,module,exports){ | |
"use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),window=_dereq_("../../util/window"),inertiaLinearity=.25,inertiaEasing=util.bezier(0,0,inertiaLinearity,1),inertiaMaxSpeed=180,inertiaDeceleration=720,DragRotateHandler=function(t,e){this._map=t,this._el=t.getCanvasContainer(),this._bearingSnap=e.bearingSnap,this._pitchWithRotate=e.pitchWithRotate!==!1,util.bindAll(["_onDown","_onMove","_onUp"],this)};DragRotateHandler.prototype.isEnabled=function(){return!!this._enabled},DragRotateHandler.prototype.isActive=function(){return!!this._active},DragRotateHandler.prototype.enable=function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._enabled=!0)},DragRotateHandler.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._enabled=!1)},DragRotateHandler.prototype._onDown=function(t){this._ignoreEvent(t)||this.isActive()||(window.document.addEventListener("mousemove",this._onMove),window.document.addEventListener("mouseup",this._onUp),window.addEventListener("blur",this._onUp),this._active=!1,this._inertia=[[Date.now(),this._map.getBearing()]],this._startPos=this._pos=DOM.mousePos(this._el,t),this._center=this._map.transform.centerPoint,t.preventDefault())},DragRotateHandler.prototype._onMove=function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._map.moving=!0,this._fireEvent("rotatestart",t),this._fireEvent("movestart",t),this._pitchWithRotate&&this._fireEvent("pitchstart",t));var e=this._map;e.stop();var i=this._pos,n=DOM.mousePos(this._el,t),r=.8*(i.x-n.x),a=(i.y-n.y)*-.5,o=e.getBearing()-r,s=e.getPitch()-a,h=this._inertia,_=h[h.length-1];this._drainInertiaBuffer(),h.push([Date.now(),e._normalizeBearing(o,_[1])]),e.transform.bearing=o,this._pitchWithRotate&&(this._fireEvent("pitch",t),e.transform.pitch=s),this._fireEvent("rotate",t),this._fireEvent("move",t),this._pos=n}},DragRotateHandler.prototype._onUp=function(t){var e=this;if(!this._ignoreEvent(t)&&(window.document.removeEventListener("mousemove",this._onMove),window.document.removeEventListener("mouseup",this._onUp),window.removeEventListener("blur",this._onUp),this.isActive())){this._active=!1,this._fireEvent("rotateend",t),this._drainInertiaBuffer();var i=this._map,n=i.getBearing(),r=this._inertia,a=function(){Math.abs(n)<e._bearingSnap?i.resetNorth({noMoveStart:!0},{originalEvent:t}):(e._map.moving=!1,e._fireEvent("moveend",t)),e._pitchWithRotate&&e._fireEvent("pitchend",t)};if(r.length<2)return void a();var o=r[0],s=r[r.length-1],h=r[r.length-2],_=i._normalizeBearing(n,h[1]),v=s[1]-o[1],p=v<0?-1:1,d=(s[0]-o[0])/1e3;if(0===v||0===d)return void a();var u=Math.abs(v*(inertiaLinearity/d));u>inertiaMaxSpeed&&(u=inertiaMaxSpeed);var l=u/(inertiaDeceleration*inertiaLinearity),g=p*u*(l/2);_+=g,Math.abs(i._normalizeBearing(_,0))<this._bearingSnap&&(_=i._normalizeBearing(0,_)),i.rotateTo(_,{duration:1e3*l,easing:inertiaEasing,noMoveStart:!0},{originalEvent:t})}},DragRotateHandler.prototype._fireEvent=function(t,e){return this._map.fire(t,{originalEvent:e})},DragRotateHandler.prototype._ignoreEvent=function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.isActive())return!0;if(e.dragPan&&e.dragPan.isActive())return!0;if(t.touches)return t.touches.length>1;var i=t.ctrlKey?1:2,n=t.ctrlKey?0:2,r=t.button;return"undefined"!=typeof InstallTrigger&&2===t.button&&t.ctrlKey&&window.navigator.platform.toUpperCase().indexOf("MAC")>=0&&(r=0),"mousemove"===t.type?t.buttons&0===i:!this.isActive()&&r!==n},DragRotateHandler.prototype._drainInertiaBuffer=function(){for(var t=this._inertia,e=Date.now(),i=160;t.length>0&&e-t[0][0]>i;)t.shift()},module.exports=DragRotateHandler; | |
},{"../../util/dom":202,"../../util/util":215,"../../util/window":197}],186:[function(_dereq_,module,exports){ | |
"use strict";function easeOut(e){return e*(2-e)}var panStep=100,bearingStep=15,pitchStep=10,KeyboardHandler=function(e){this._map=e,this._el=e.getCanvasContainer(),this._onKeyDown=this._onKeyDown.bind(this)};KeyboardHandler.prototype.isEnabled=function(){return!!this._enabled},KeyboardHandler.prototype.enable=function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},KeyboardHandler.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},KeyboardHandler.prototype._onKeyDown=function(e){if(!(e.altKey||e.ctrlKey||e.metaKey)){var t=0,a=0,n=0,r=0,i=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?a=-1:(e.preventDefault(),r=-1);break;case 39:e.shiftKey?a=1:(e.preventDefault(),r=1);break;case 38:e.shiftKey?n=1:(e.preventDefault(),i=-1);break;case 40:e.shiftKey?n=-1:(i=1,e.preventDefault());break;default:return}var s=this._map,o=s.getZoom(),d={duration:300,delayEndEvents:500,easing:easeOut,zoom:t?Math.round(o)+t*(e.shiftKey?2:1):o,bearing:s.getBearing()+a*bearingStep,pitch:s.getPitch()+n*pitchStep,offset:[-r*panStep,-i*panStep],center:s.getCenter()};s.easeTo(d,{originalEvent:e})}},module.exports=KeyboardHandler; | |
},{}],187:[function(_dereq_,module,exports){ | |
"use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),browser=_dereq_("../../util/browser"),window=_dereq_("../../util/window"),ua=window.navigator.userAgent.toLowerCase(),firefox=ua.indexOf("firefox")!==-1,safari=ua.indexOf("safari")!==-1&&ua.indexOf("chrom")===-1,ScrollZoomHandler=function(e){this._map=e,this._el=e.getCanvasContainer(),util.bindAll(["_onWheel","_onTimeout"],this)};ScrollZoomHandler.prototype.isEnabled=function(){return!!this._enabled},ScrollZoomHandler.prototype.enable=function(e){this.isEnabled()||(this._el.addEventListener("wheel",this._onWheel,!1),this._el.addEventListener("mousewheel",this._onWheel,!1),this._enabled=!0,this._aroundCenter=e&&"center"===e.around)},ScrollZoomHandler.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("wheel",this._onWheel),this._el.removeEventListener("mousewheel",this._onWheel),this._enabled=!1)},ScrollZoomHandler.prototype._onWheel=function(e){var t;"wheel"===e.type?(t=e.deltaY,firefox&&e.deltaMode===window.WheelEvent.DOM_DELTA_PIXEL&&(t/=browser.devicePixelRatio),e.deltaMode===window.WheelEvent.DOM_DELTA_LINE&&(t*=40)):"mousewheel"===e.type&&(t=-e.wheelDeltaY,safari&&(t/=3));var o=browser.now(),i=o-(this._time||0);this._pos=DOM.mousePos(this._el,e),this._time=o,0!==t&&t%4.000244140625===0?this._type="wheel":0!==t&&Math.abs(t)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40)):this._type||(this._type=Math.abs(i*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&this._zoom(-t,e),e.preventDefault()},ScrollZoomHandler.prototype._onTimeout=function(){this._type="wheel",this._zoom(-this._lastValue)},ScrollZoomHandler.prototype._zoom=function(e,t){if(0!==e){var o=this._map,i=2/(1+Math.exp(-Math.abs(e/100)));e<0&&0!==i&&(i=1/i);var l=o.ease?o.ease.to:o.transform.scale,s=o.transform.scaleZoom(l*i);o.zoomTo(s,{duration:"wheel"===this._type?200:0,around:this._aroundCenter?o.getCenter():o.unproject(this._pos),delayEndEvents:200,smoothEasing:!0},{originalEvent:t})}},module.exports=ScrollZoomHandler; | |
},{"../../util/browser":195,"../../util/dom":202,"../../util/util":215,"../../util/window":197}],188:[function(_dereq_,module,exports){ | |
"use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),window=_dereq_("../../util/window"),inertiaLinearity=.15,inertiaEasing=util.bezier(0,0,inertiaLinearity,1),inertiaDeceleration=12,inertiaMaxSpeed=2.5,significantScaleThreshold=.15,significantRotateThreshold=4,TouchZoomRotateHandler=function(t){this._map=t,this._el=t.getCanvasContainer(),util.bindAll(["_onStart","_onMove","_onEnd"],this)};TouchZoomRotateHandler.prototype.isEnabled=function(){return!!this._enabled},TouchZoomRotateHandler.prototype.enable=function(t){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-zoom-rotate"),this._el.addEventListener("touchstart",this._onStart,!1),this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},TouchZoomRotateHandler.prototype.disable=function(){this.isEnabled()&&(this._el.classList.remove("mapboxgl-touch-zoom-rotate"),this._el.removeEventListener("touchstart",this._onStart),this._enabled=!1)},TouchZoomRotateHandler.prototype.disableRotation=function(){this._rotationDisabled=!0},TouchZoomRotateHandler.prototype.enableRotation=function(){this._rotationDisabled=!1},TouchZoomRotateHandler.prototype._onStart=function(t){if(2===t.touches.length){var e=DOM.mousePos(this._el,t.touches[0]),o=DOM.mousePos(this._el,t.touches[1]);this._startVec=e.sub(o),this._startScale=this._map.transform.scale,this._startBearing=this._map.transform.bearing,this._gestureIntent=void 0,this._inertia=[],window.document.addEventListener("touchmove",this._onMove,!1),window.document.addEventListener("touchend",this._onEnd,!1)}},TouchZoomRotateHandler.prototype._onMove=function(t){if(2===t.touches.length){var e=DOM.mousePos(this._el,t.touches[0]),o=DOM.mousePos(this._el,t.touches[1]),i=e.add(o).div(2),n=e.sub(o),a=n.mag()/this._startVec.mag(),r=this._rotationDisabled?0:180*n.angleWith(this._startVec)/Math.PI,s=this._map;if(this._gestureIntent){var h={duration:0,around:s.unproject(i)};"rotate"===this._gestureIntent&&(h.bearing=this._startBearing+r),"zoom"!==this._gestureIntent&&"rotate"!==this._gestureIntent||(h.zoom=s.transform.scaleZoom(this._startScale*a)),s.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),a,i]),s.easeTo(h,{originalEvent:t})}else{var u=Math.abs(1-a)>significantScaleThreshold,l=Math.abs(r)>significantRotateThreshold;l?this._gestureIntent="rotate":u&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._startVec=n,this._startScale=s.transform.scale,this._startBearing=s.transform.bearing)}t.preventDefault()}},TouchZoomRotateHandler.prototype._onEnd=function(t){window.document.removeEventListener("touchmove",this._onMove),window.document.removeEventListener("touchend",this._onEnd),this._drainInertiaBuffer();var e=this._inertia,o=this._map;if(e.length<2)return void o.snapToNorth({},{originalEvent:t});var i=e[e.length-1],n=e[0],a=o.transform.scaleZoom(this._startScale*i[1]),r=o.transform.scaleZoom(this._startScale*n[1]),s=a-r,h=(i[0]-n[0])/1e3,u=i[2];if(0===h||a===r)return void o.snapToNorth({},{originalEvent:t});var l=s*inertiaLinearity/h;Math.abs(l)>inertiaMaxSpeed&&(l=l>0?inertiaMaxSpeed:-inertiaMaxSpeed);var d=1e3*Math.abs(l/(inertiaDeceleration*inertiaLinearity)),c=a+l*d/2e3;c<0&&(c=0),o.easeTo({zoom:c,duration:d,easing:inertiaEasing,around:this._aroundCenter?o.getCenter():o.unproject(u)},{originalEvent:t})},TouchZoomRotateHandler.prototype._drainInertiaBuffer=function(){for(var t=this._inertia,e=Date.now(),o=160;t.length>2&&e-t[0][0]>o;)t.shift()},module.exports=TouchZoomRotateHandler; | |
},{"../../util/dom":202,"../../util/util":215,"../../util/window":197}],189:[function(_dereq_,module,exports){ | |
"use strict";var util=_dereq_("../util/util"),window=_dereq_("../util/window"),Hash=function(){util.bindAll(["_onHashChange","_updateHash"],this)};Hash.prototype.addTo=function(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},Hash.prototype.remove=function(){return window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),delete this._map,this},Hash.prototype._onHashChange=function(){var t=window.location.hash.replace("#","").split("/");return t.length>=3&&(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0),pitch:+(t[4]||0)}),!0)},Hash.prototype._updateHash=function(){var t=this._map.getCenter(),e=this._map.getZoom(),a=this._map.getBearing(),h=this._map.getPitch(),i=Math.max(0,Math.ceil(Math.log(e)/Math.LN2)),n="#"+Math.round(100*e)/100+"/"+t.lat.toFixed(i)+"/"+t.lng.toFixed(i);(a||h)&&(n+="/"+Math.round(10*a)/10),h&&(n+="/"+Math.round(h)),window.history.replaceState("","",n)},module.exports=Hash; | |
},{"../util/util":215,"../util/window":197}],190:[function(_dereq_,module,exports){ | |
"use strict";function removeNode(t){t.parentNode&&t.parentNode.removeChild(t)}var util=_dereq_("../util/util"),browser=_dereq_("../util/browser"),window=_dereq_("../util/window"),DOM=_dereq_("../util/dom"),ajax=_dereq_("../util/ajax"),Style=_dereq_("../style/style"),AnimationLoop=_dereq_("../style/animation_loop"),Painter=_dereq_("../render/painter"),Transform=_dereq_("../geo/transform"),Hash=_dereq_("./hash"),bindHandlers=_dereq_("./bind_handlers"),Camera=_dereq_("./camera"),LngLat=_dereq_("../geo/lng_lat"),LngLatBounds=_dereq_("../geo/lng_lat_bounds"),Point=_dereq_("point-geometry"),AttributionControl=_dereq_("./control/attribution_control"),LogoControl=_dereq_("./control/logo_control"),isSupported=_dereq_("mapbox-gl-supported"),defaultMinZoom=0,defaultMaxZoom=22,defaultOptions={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:defaultMinZoom,maxZoom:defaultMaxZoom,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0},Map=function(t){function e(e){var o=this;if(e=util.extend({},defaultOptions,e),null!=e.minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than minZoom");var i=new Transform(e.minZoom,e.maxZoom,e.renderWorldCopies);if(t.call(this,i,e),this._interactive=e.interactive,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,"string"==typeof e.container){if(this._container=window.document.getElementById(e.container),!this._container)throw new Error("Container '"+e.container+"' not found.")}else this._container=e.container;this.animationLoop=new AnimationLoop,e.maxBounds&&this.setMaxBounds(e.maxBounds),util.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored","_update","_render","_onData","_onDataLoading"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),this.on("moveend",function(){o.animationLoop.set(300),o._rerender()}),"undefined"!=typeof window&&(window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1)),bindHandlers(this,e),this._hash=e.hash&&(new Hash).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),this._classes=[],this.resize(),e.classes&&this.setClasses(e.classes),e.style&&this.setStyle(e.style),e.attributionControl&&this.addControl(new AttributionControl),this.addControl(new LogoControl,e.logoPosition),this.on("style.load",function(){this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this.style.update(this._classes,{transition:!1})}),this.on("data",this._onData),this.on("dataloading",this._onDataLoading)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var o={showTileBoundaries:{},showCollisionBoxes:{},showOverdrawInspector:{},repaint:{},vertices:{}};return e.prototype.addControl=function(t,e){void 0===e&&t.getDefaultPosition&&(e=t.getDefaultPosition()),void 0===e&&(e="top-right");var o=t.onAdd(this),i=this._controlPositions[e];return e.indexOf("bottom")!==-1?i.insertBefore(o,i.firstChild):i.appendChild(o),this},e.prototype.removeControl=function(t){return t.onRemove(this),this},e.prototype.addClass=function(t,e){return util.warnOnce("Style classes are deprecated and will be removed in an upcoming release of Mapbox GL JS."),this._classes.indexOf(t)>=0||""===t?this:(this._classes.push(t),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},e.prototype.removeClass=function(t,e){util.warnOnce("Style classes are deprecated and will be removed in an upcoming release of Mapbox GL JS.");var o=this._classes.indexOf(t);return o<0||""===t?this:(this._classes.splice(o,1),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},e.prototype.setClasses=function(t,e){util.warnOnce("Style classes are deprecated and will be removed in an upcoming release of Mapbox GL JS.");for(var o={},i=0;i<t.length;i++)""!==t[i]&&(o[t[i]]=!0);return this._classes=Object.keys(o),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0)},e.prototype.hasClass=function(t){return util.warnOnce("Style classes are deprecated and will be removed in an upcoming release of Mapbox GL JS."),this._classes.indexOf(t)>=0},e.prototype.getClasses=function(){return util.warnOnce("Style classes are deprecated and will be removed in an upcoming release of Mapbox GL JS."),this._classes},e.prototype.resize=function(){var t=this._containerDimensions(),e=t[0],o=t[1];return this._resizeCanvas(e,o),this.transform.resize(e,o),this.painter.resize(e,o),this.fire("movestart").fire("move").fire("resize").fire("moveend")},e.prototype.getBounds=function(){var t=new LngLatBounds(this.transform.pointLocation(new Point(0,this.transform.height)),this.transform.pointLocation(new Point(this.transform.width,0)));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new Point(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new Point(0,this.transform.size.y)))),t},e.prototype.setMaxBounds=function(t){if(t){var e=LngLatBounds.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null!==t&&void 0!==t||(this.transform.lngRange=[],this.transform.latRange=[],this._update());return this},e.prototype.setMinZoom=function(t){if(t=null===t||void 0===t?defaultMinZoom:t,t>=defaultMinZoom&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between "+defaultMinZoom+" and the current maxZoom, inclusive")},e.prototype.getMinZoom=function(){return this.transform.minZoom},e.prototype.setMaxZoom=function(t){if(t=null===t||void 0===t?defaultMaxZoom:t,t>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},e.prototype.getMaxZoom=function(){return this.transform.maxZoom},e.prototype.project=function(t){return this.transform.locationPoint(LngLat.convert(t))},e.prototype.unproject=function(t){return this.transform.pointLocation(Point.convert(t))},e.prototype.on=function(e,o,i){var r=this;if(void 0===i)return t.prototype.on.call(this,e,o);var s=function(){if("mouseenter"===e||"mouseover"===e){var t=!1,s=function(s){var n=r.queryRenderedFeatures(s.point,{layers:[o]});n.length?t||(t=!0,i.call(r,util.extend({features:n},s,{type:e}))):t=!1},n=function(){t=!1};return{layer:o,listener:i,delegates:{mousemove:s,mouseout:n}}}if("mouseleave"===e||"mouseout"===e){var a=!1,h=function(t){var s=r.queryRenderedFeatures(t.point,{layers:[o]});s.length?a=!0:a&&(a=!1,i.call(r,util.extend({},t,{type:e})))},l=function(t){a&&(a=!1,i.call(r,util.extend({},t,{type:e})))};return{layer:o,listener:i,delegates:{mousemove:h,mouseout:l}}}var u=function(t){var e=r.queryRenderedFeatures(t.point,{layers:[o]});e.length&&i.call(r,util.extend({features:e},t))};return{layer:o,listener:i,delegates:(d={},d[e]=u,d)};var d}();this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(s);for(var n in s.delegates)r.on(n,s.delegates[n]);return this},e.prototype.off=function(e,o,i){var r=this;if(void 0===i)return t.prototype.off.call(this,e,o);if(this._delegatedListeners&&this._delegatedListeners[e])for(var s=this._delegatedListeners[e],n=0;n<s.length;n++){var a=s[n];if(a.layer===o&&a.listener===i){for(var h in a.delegates)r.off(h,a.delegates[h]);return s.splice(n,1),r}}},e.prototype.queryRenderedFeatures=function(){function t(t){return t instanceof Point||Array.isArray(t)}var e,o={};return 2===arguments.length?(e=arguments[0],o=arguments[1]):1===arguments.length&&t(arguments[0])?e=arguments[0]:1===arguments.length&&(o=arguments[0]),this.style?this.style.queryRenderedFeatures(this._makeQueryGeometry(e),o,this.transform.zoom,this.transform.angle):[]},e.prototype._makeQueryGeometry=function(t){var e=this;void 0===t&&(t=[Point.convert([0,0]),Point.convert([this.transform.width,this.transform.height])]);var o,i=t instanceof Point||"number"==typeof t[0];if(i){var r=Point.convert(t);o=[r]}else{var s=[Point.convert(t[0]),Point.convert(t[1])];o=[s[0],new Point(s[1].x,s[0].y),s[1],new Point(s[0].x,s[1].y),s[0]]}return o=o.map(function(t){return e.transform.pointCoordinate(t)})},e.prototype.querySourceFeatures=function(t,e){return this.style.querySourceFeatures(t,e)},e.prototype.setStyle=function(t,e){var o=(!e||e.diff!==!1)&&this.style&&t&&!(t instanceof Style)&&"string"!=typeof t;if(o)try{return this.style.setState(t)&&this._update(!0),this}catch(t){util.warnOnce("Unable to perform style diff: "+(t.message||t.error||t)+". Rebuilding the style from scratch.")}return this.style&&(this.style.setEventedParent(null),this.style._remove(),this.off("rotate",this.style._redoPlacement),this.off("pitch",this.style._redoPlacement)),t?(t instanceof Style?this.style=t:this.style=new Style(t,this),this.style.setEventedParent(this,{style:this.style}),this.on("rotate",this.style._redoPlacement),this.on("pitch",this.style._redoPlacement),this):(this.style=null,this)},e.prototype.getStyle=function(){if(this.style)return this.style.serialize()},e.prototype.isStyleLoaded=function(){return this.style?this.style.loaded():util.warnOnce("There is no style added to the map.")},e.prototype.addSource=function(t,e){return this.style.addSource(t,e),this._update(!0),this},e.prototype.isSourceLoaded=function(t){var e=this.style&&this.style.sourceCaches[t];return void 0===e?void this.fire("error",{error:new Error("There is no source with ID '"+t+"'")}):e.loaded()},e.prototype.areTilesLoaded=function(){var t=this.style&&this.style.sourceCaches;for(var e in t){var o=t[e],i=o._tiles;for(var r in i){var s=i[r];if("loaded"!==s.state&&"errored"!==s.state)return!1}}return!0},e.prototype.addSourceType=function(t,e,o){return this.style.addSourceType(t,e,o)},e.prototype.removeSource=function(t){return this.style.removeSource(t),this._update(!0),this},e.prototype.getSource=function(t){return this.style.getSource(t)},e.prototype.addImage=function(t,e,o){this.style.spriteAtlas.addImage(t,e,o)},e.prototype.removeImage=function(t){this.style.spriteAtlas.removeImage(t)},e.prototype.loadImage=function(t,e){ajax.getImage(t,e)},e.prototype.addLayer=function(t,e){return this.style.addLayer(t,e),this._update(!0),this},e.prototype.moveLayer=function(t,e){return this.style.moveLayer(t,e),this._update(!0),this},e.prototype.removeLayer=function(t){return this.style.removeLayer(t),this._update(!0),this},e.prototype.getLayer=function(t){return this.style.getLayer(t)},e.prototype.setFilter=function(t,e){return this.style.setFilter(t,e),this._update(!0),this},e.prototype.setLayerZoomRange=function(t,e,o){return this.style.setLayerZoomRange(t,e,o),this._update(!0),this},e.prototype.getFilter=function(t){return this.style.getFilter(t)},e.prototype.setPaintProperty=function(t,e,o,i){return this.style.setPaintProperty(t,e,o,i),this._update(!0),this},e.prototype.getPaintProperty=function(t,e,o){return this.style.getPaintProperty(t,e,o)},e.prototype.setLayoutProperty=function(t,e,o){return this.style.setLayoutProperty(t,e,o),this._update(!0),this},e.prototype.getLayoutProperty=function(t,e){return this.style.getLayoutProperty(t,e)},e.prototype.setLight=function(t){return this.style.setLight(t),this._update(!0),this},e.prototype.getLight=function(){return this.style.getLight()},e.prototype.getContainer=function(){return this._container},e.prototype.getCanvasContainer=function(){return this._canvasContainer},e.prototype.getCanvas=function(){return this._canvas},e.prototype._containerDimensions=function(){var t=0,e=0;return this._container&&(t=this._container.offsetWidth||400,e=this._container.offsetHeight||300),[t,e]},e.prototype._setupContainer=function(){var t=this._container;t.classList.add("mapboxgl-map");var e=this._canvasContainer=DOM.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=DOM.create("canvas","mapboxgl-canvas",e),this._canvas.style.position="absolute",this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",0),this._canvas.setAttribute("aria-label","Map");var o=this._containerDimensions();this._resizeCanvas(o[0],o[1]);var i=this._controlContainer=DOM.create("div","mapboxgl-control-container",t),r=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(function(t){r[t]=DOM.create("div","mapboxgl-ctrl-"+t,i)})},e.prototype._resizeCanvas=function(t,e){var o=window.devicePixelRatio||1;this._canvas.width=o*t,this._canvas.height=o*e,this._canvas.style.width=t+"px",this._canvas.style.height=e+"px"},e.prototype._setupPainter=function(){var t=util.extend({failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer},isSupported.webGLContextAttributes),e=this._canvas.getContext("webgl",t)||this._canvas.getContext("experimental-webgl",t);return e?void(this.painter=new Painter(e,this.transform)):void this.fire("error",{error:new Error("Failed to initialize WebGL")})},e.prototype._contextLost=function(t){t.preventDefault(),this._frameId&&browser.cancelFrame(this._frameId),this.fire("webglcontextlost",{originalEvent:t})},e.prototype._contextRestored=function(t){this._setupPainter(),this.resize(),this._update(),this.fire("webglcontextrestored",{originalEvent:t})},e.prototype.loaded=function(){return!this._styleDirty&&!this._sourcesDirty&&!(!this.style||!this.style.loaded())},e.prototype._update=function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this._rerender(),this):this},e.prototype._render=function(){return this.style&&this._styleDirty&&(this._styleDirty=!1,this.style.update(this._classes,this._classOptions),this._classOptions=null,this.style._recalculate(this.transform.zoom)),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.rotating,zooming:this.zooming}),this.fire("render"),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire("load")),this._frameId=null,this.animationLoop.stopped()||(this._styleDirty=!0),(this._sourcesDirty||this._repaint||this._styleDirty)&&this._rerender(),this},e.prototype.remove=function(){this._hash&&this._hash.remove(),browser.cancelFrame(this._frameId),this.setStyle(null),"undefined"!=typeof window&&(window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1));var t=this.painter.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),removeNode(this._canvasContainer),removeNode(this._controlContainer),this._container.classList.remove("mapboxgl-map"),this.fire("remove")},e.prototype._rerender=function(){this.style&&!this._frameId&&(this._frameId=browser.frame(this._render))},e.prototype._onWindowOnline=function(){this._update()},e.prototype._onWindowResize=function(){this._trackResize&&this.stop().resize()._update()},o.showTileBoundaries.get=function(){return!!this._showTileBoundaries},o.showTileBoundaries.set=function(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},o.showCollisionBoxes.get=function(){return!!this._showCollisionBoxes},o.showCollisionBoxes.set=function(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,this.style._redoPlacement())},o.showOverdrawInspector.get=function(){return!!this._showOverdrawInspector},o.showOverdrawInspector.set=function(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},o.repaint.get=function(){return!!this._repaint},o.repaint.set=function(t){this._repaint=t,this._update()},o.vertices.get=function(){return!!this._vertices},o.vertices.set=function(t){this._vertices=t,this._update()},e.prototype._onData=function(t){this._update("style"===t.dataType),this.fire(t.dataType+"data",t)},e.prototype._onDataLoading=function(t){this.fire(t.dataType+"dataloading",t)},Object.defineProperties(e.prototype,o),e}(Camera);module.exports=Map; | |
},{"../geo/lng_lat":62,"../geo/lng_lat_bounds":63,"../geo/transform":64,"../render/painter":77,"../style/animation_loop":146,"../style/style":149,"../util/ajax":194,"../util/browser":195,"../util/dom":202,"../util/util":215,"../util/window":197,"./bind_handlers":174,"./camera":175,"./control/attribution_control":176,"./control/logo_control":179,"./hash":189,"mapbox-gl-supported":22,"point-geometry":26}],191:[function(_dereq_,module,exports){ | |
"use strict";var DOM=_dereq_("../util/dom"),LngLat=_dereq_("../geo/lng_lat"),Point=_dereq_("point-geometry"),smartWrap=_dereq_("../util/smart_wrap"),Marker=function(t,e){this._offset=Point.convert(e&&e.offset||[0,0]),this._update=this._update.bind(this),this._onMapClick=this._onMapClick.bind(this),t||(t=DOM.create("div")),t.classList.add("mapboxgl-marker"),this._element=t,this._popup=null};Marker.prototype.addTo=function(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this._update(),this._map.on("click",this._onMapClick),this},Marker.prototype.remove=function(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map=null),DOM.remove(this._element),this._popup&&this._popup.remove(),this},Marker.prototype.getLngLat=function(){return this._lngLat},Marker.prototype.setLngLat=function(t){return this._lngLat=LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this},Marker.prototype.getElement=function(){return this._element},Marker.prototype.setPopup=function(t){return this._popup&&(this._popup.remove(),this._popup=null),t&&(this._popup=t,this._popup.setLngLat(this._lngLat)),this},Marker.prototype._onMapClick=function(t){var e=t.originalEvent.target,p=this._element;this._popup&&(e===p||p.contains(e))&&this.togglePopup()},Marker.prototype.getPopup=function(){return this._popup},Marker.prototype.togglePopup=function(){var t=this._popup;t&&(t.isOpen()?t.remove():t.addTo(this._map))},Marker.prototype._update=function(t){this._map&&(this._map.transform.renderWorldCopies&&(this._lngLat=smartWrap(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset),t&&"moveend"!==t.type||(this._pos=this._pos.round()),DOM.setTransform(this._element,"translate("+this._pos.x+"px, "+this._pos.y+"px)"))},module.exports=Marker; | |
},{"../geo/lng_lat":62,"../util/dom":202,"../util/smart_wrap":212,"point-geometry":26}],192:[function(_dereq_,module,exports){ | |
"use strict";function normalizeOffset(t){if(t){if("number"==typeof t){var o=Math.round(Math.sqrt(.5*Math.pow(t,2)));return{top:new Point(0,t),"top-left":new Point(o,o),"top-right":new Point(-o,o),bottom:new Point(0,-t),"bottom-left":new Point(o,-o),"bottom-right":new Point(-o,-o),left:new Point(t,0),right:new Point(-t,0)}}if(isPointLike(t)){var e=Point.convert(t);return{top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{top:Point.convert(t.top||[0,0]),"top-left":Point.convert(t["top-left"]||[0,0]),"top-right":Point.convert(t["top-right"]||[0,0]),bottom:Point.convert(t.bottom||[0,0]),"bottom-left":Point.convert(t["bottom-left"]||[0,0]),"bottom-right":Point.convert(t["bottom-right"]||[0,0]),left:Point.convert(t.left||[0,0]),right:Point.convert(t.right||[0,0])}}return normalizeOffset(new Point(0,0))}function isPointLike(t){return t instanceof Point||Array.isArray(t)}var util=_dereq_("../util/util"),Evented=_dereq_("../util/evented"),DOM=_dereq_("../util/dom"),LngLat=_dereq_("../geo/lng_lat"),Point=_dereq_("point-geometry"),window=_dereq_("../util/window"),smartWrap=_dereq_("../util/smart_wrap"),defaultOptions={closeButton:!0,closeOnClick:!0},Popup=function(t){function o(o){t.call(this),this.options=util.extend(Object.create(defaultOptions),o),util.bindAll(["_update","_onClickClose"],this)}return t&&(o.__proto__=t),o.prototype=Object.create(t&&t.prototype),o.prototype.constructor=o,o.prototype.addTo=function(t){return this._map=t,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this},o.prototype.isOpen=function(){return!!this._map},o.prototype.remove=function(){return this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._container&&(this._container.parentNode.removeChild(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this.fire("close"),this},o.prototype.getLngLat=function(){return this._lngLat},o.prototype.setLngLat=function(t){return this._lngLat=LngLat.convert(t),this._pos=null,this._update(),this},o.prototype.setText=function(t){return this.setDOMContent(window.document.createTextNode(t))},o.prototype.setHTML=function(t){var o,e=window.document.createDocumentFragment(),n=window.document.createElement("body");for(n.innerHTML=t;;){if(o=n.firstChild,!o)break;e.appendChild(o)}return this.setDOMContent(e)},o.prototype.setDOMContent=function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},o.prototype._createContent=function(){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._content=DOM.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=DOM.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClickClose))},o.prototype._update=function(){if(this._map&&this._lngLat&&this._content){this._container||(this._container=DOM.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=DOM.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content)),this._map.transform.renderWorldCopies&&(this._lngLat=smartWrap(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat);var t=this.options.anchor,o=normalizeOffset(this.options.offset);if(!t){var e=this._container.offsetWidth,n=this._container.offsetHeight;t=this._pos.y+o.bottom.y<n?["top"]:this._pos.y>this._map.transform.height-n?["bottom"]:[],this._pos.x<e/2?t.push("left"):this._pos.x>this._map.transform.width-e/2&&t.push("right"),t=0===t.length?"bottom":t.join("-")}var i=this._pos.add(o[t]).round(),r={top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},s=this._container.classList;for(var p in r)s.remove("mapboxgl-popup-anchor-"+p);s.add("mapboxgl-popup-anchor-"+t),DOM.setTransform(this._container,r[t]+" translate("+i.x+"px,"+i.y+"px)")}},o.prototype._onClickClose=function(){this.remove()},o}(Evented);module.exports=Popup; | |
},{"../geo/lng_lat":62,"../util/dom":202,"../util/evented":203,"../util/smart_wrap":212,"../util/util":215,"../util/window":197,"point-geometry":26}],193:[function(_dereq_,module,exports){ | |
"use strict";var Actor=function(t,e,a){this.target=t,this.parent=e,this.mapId=a,this.callbacks={},this.callbackID=0,this.receive=this.receive.bind(this),this.target.addEventListener("message",this.receive,!1)};Actor.prototype.send=function(t,e,a,r,s){var i=a?this.mapId+":"+this.callbackID++:null;a&&(this.callbacks[i]=a),this.target.postMessage({targetMapId:s,sourceMapId:this.mapId,type:t,id:String(i),data:e},r)},Actor.prototype.receive=function(t){var e,a=this,r=t.data,s=r.id;if(!r.targetMapId||this.mapId===r.targetMapId){var i=function(t,e,r){a.target.postMessage({sourceMapId:a.mapId,type:"<response>",id:String(s),error:t?String(t):null,data:e},r)};if("<response>"===r.type)e=this.callbacks[r.id],delete this.callbacks[r.id],e&&e(r.error||null,r.data);else if("undefined"!=typeof r.id&&this.parent[r.type])this.parent[r.type](r.sourceMapId,r.data,i);else if("undefined"!=typeof r.id&&this.parent.getWorkerSource){var p=r.type.split("."),d=this.parent.getWorkerSource(r.sourceMapId,p[0]);d[p[1]](r.data,i)}else this.parent[r.type](r.data)}},Actor.prototype.remove=function(){this.target.removeEventListener("message",this.receive,!1)},module.exports=Actor; | |
},{}],194:[function(_dereq_,module,exports){ | |
"use strict";function sameOrigin(e){var t=window.document.createElement("a");return t.href=e,t.protocol===window.document.location.protocol&&t.host===window.document.location.host}var window=_dereq_("./window"),AJAXError=function(e){function t(t,r){e.call(this,t),this.status=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(Error);exports.getJSON=function(e,t){var r=new window.XMLHttpRequest;return r.open("GET",e,!0),r.setRequestHeader("Accept","application/json"),r.onerror=function(e){t(e)},r.onload=function(){if(r.status>=200&&r.status<300&&r.response){var e;try{e=JSON.parse(r.response)}catch(e){return t(e)}t(null,e)}else t(new AJAXError(r.statusText,r.status))},r.send(),r},exports.getArrayBuffer=function(e,t){var r=new window.XMLHttpRequest;return r.open("GET",e,!0),r.responseType="arraybuffer",r.onerror=function(e){t(e)},r.onload=function(){return 0===r.response.byteLength&&200===r.status?t(new Error("http status 200 returned without content.")):void(r.status>=200&&r.status<300&&r.response?t(null,{data:r.response,cacheControl:r.getResponseHeader("Cache-Control"),expires:r.getResponseHeader("Expires")}):t(new AJAXError(r.statusText,r.status)))},r.send(),r};var transparentPngUrl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";exports.getImage=function(e,t){return exports.getArrayBuffer(e,function(e,r){if(e)return t(e);var n=new window.Image,o=window.URL||window.webkitURL;n.onload=function(){t(null,n),o.revokeObjectURL(n.src)};var s=new window.Blob([new Uint8Array(r.data)],{type:"image/png"});n.cacheControl=r.cacheControl,n.expires=r.expires,n.src=r.data.byteLength?o.createObjectURL(s):transparentPngUrl})},exports.getVideo=function(e,t){var r=window.document.createElement("video");r.onloadstart=function(){t(null,r)};for(var n=0;n<e.length;n++){var o=window.document.createElement("source");sameOrigin(e[n])||(r.crossOrigin="Anonymous"),o.src=e[n],r.appendChild(o)}return r}; | |
},{"./window":197}],195:[function(_dereq_,module,exports){ | |
"use strict";var window=_dereq_("./window");module.exports.now=function(){return window.performance&&window.performance.now?window.performance.now.bind(window.performance):Date.now.bind(Date)}();var frame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;exports.frame=function(e){return frame(e)};var cancel=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame;exports.cancelFrame=function(e){cancel(e)},exports.timed=function(e,n,t){function o(i){r||(i=module.exports.now(),i>=a+n?e.call(t,1):(e.call(t,(i-a)/n),exports.frame(o)))}if(!n)return e.call(t,1),null;var r=!1,a=module.exports.now();return exports.frame(o),function(){r=!0}},exports.getImageData=function(e){var n=window.document.createElement("canvas"),t=n.getContext("2d");return n.width=e.width,n.height=e.height,t.drawImage(e,0,0,e.width,e.height),t.getImageData(0,0,e.width,e.height).data},exports.supported=_dereq_("mapbox-gl-supported"),exports.hardwareConcurrency=window.navigator.hardwareConcurrency||4,Object.defineProperty(exports,"devicePixelRatio",{get:function(){return window.devicePixelRatio}}),exports.supportsWebp=!1;var webpImgTest=window.document.createElement("img");webpImgTest.onload=function(){exports.supportsWebp=!0},webpImgTest.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="; | |
},{"./window":197,"mapbox-gl-supported":22}],196:[function(_dereq_,module,exports){ | |
"use strict";var WebWorkify=_dereq_("webworkify"),window=_dereq_("../window"),workerURL=window.URL.createObjectURL(new WebWorkify(_dereq_("../../source/worker"),{bare:!0}));module.exports=function(){return new window.Worker(workerURL)}; | |
},{"../../source/worker":100,"../window":197,"webworkify":41}],197:[function(_dereq_,module,exports){ | |
"use strict";module.exports=self; | |
},{}],198:[function(_dereq_,module,exports){ | |
"use strict";function compareAreas(e,r){return r.area-e.area}var quickselect=_dereq_("quickselect"),calculateSignedArea=_dereq_("./util").calculateSignedArea;module.exports=function(e,r){var a=e.length;if(a<=1)return[e];for(var t,u,c=[],i=0;i<a;i++){var l=calculateSignedArea(e[i]);0!==l&&(e[i].area=Math.abs(l),void 0===u&&(u=l<0),u===l<0?(t&&c.push(t),t=[e[i]]):t.push(e[i]))}if(t&&c.push(t),r>1)for(var n=0;n<c.length;n++)c[n].length<=r||(quickselect(c[n],r,1,c[n].length-1,compareAreas),c[n]=c[n].slice(0,r));return c}; | |
},{"./util":215,"quickselect":28}],199:[function(_dereq_,module,exports){ | |
"use strict";var config={API_URL:"https://api.mapbox.com",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null};module.exports=config; | |
},{}],200:[function(_dereq_,module,exports){ | |
"use strict";var DictionaryCoder=function(r){var t=this;this._stringToNumber={},this._numberToString=[];for(var o=0;o<r.length;o++){var i=r[o];t._stringToNumber[i]=o,t._numberToString[o]=i}};DictionaryCoder.prototype.encode=function(r){return this._stringToNumber[r]},DictionaryCoder.prototype.decode=function(r){return this._numberToString[r]},module.exports=DictionaryCoder; | |
},{}],201:[function(_dereq_,module,exports){ | |
"use strict";var util=_dereq_("./util"),Actor=_dereq_("./actor"),Dispatcher=function(t,r){var o=this;this.workerPool=t,this.actors=[],this.currentActor=0,this.id=util.uniqueId();for(var i=this.workerPool.acquire(this.id),e=0;e<i.length;e++){var s=i[e],c=new Actor(s,r,o.id);c.name="Worker "+e,o.actors.push(c)}};Dispatcher.prototype.broadcast=function(t,r,o){o=o||function(){},util.asyncAll(this.actors,function(o,i){o.send(t,r,i)},o)},Dispatcher.prototype.send=function(t,r,o,i,e){return("number"!=typeof i||isNaN(i))&&(i=this.currentActor=(this.currentActor+1)%this.actors.length),this.actors[i].send(t,r,o,e),i},Dispatcher.prototype.remove=function(){this.actors.forEach(function(t){t.remove()}),this.actors=[],this.workerPool.release(this.id)},module.exports=Dispatcher; | |
},{"./actor":193,"./util":215}],202:[function(_dereq_,module,exports){ | |
"use strict";function testProp(e){for(var t=0;t<e.length;t++)if(e[t]in docStyle)return e[t];return e[0]}function suppressClick(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",suppressClick,!0)}var Point=_dereq_("point-geometry"),window=_dereq_("./window");exports.create=function(e,t,o){var n=window.document.createElement(e);return t&&(n.className=t),o&&o.appendChild(n),n};var docStyle=window.document.documentElement.style,selectProp=testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),userSelect;exports.disableDrag=function(){selectProp&&(userSelect=docStyle[selectProp],docStyle[selectProp]="none")},exports.enableDrag=function(){selectProp&&(docStyle[selectProp]=userSelect)};var transformProp=testProp(["transform","WebkitTransform"]);exports.setTransform=function(e,t){e.style[transformProp]=t},exports.suppressClick=function(){window.addEventListener("click",suppressClick,!0),window.setTimeout(function(){window.removeEventListener("click",suppressClick,!0)},0)},exports.mousePos=function(e,t){var o=e.getBoundingClientRect();return t=t.touches?t.touches[0]:t,new Point(t.clientX-o.left-e.clientLeft,t.clientY-o.top-e.clientTop)},exports.touchPos=function(e,t){for(var o=e.getBoundingClientRect(),n=[],r="touchend"===t.type?t.changedTouches:t.touches,s=0;s<r.length;s++)n.push(new Point(r[s].clientX-o.left-e.clientLeft,r[s].clientY-o.top-e.clientTop));return n},exports.remove=function(e){e.parentNode&&e.parentNode.removeChild(e)}; | |
},{"./window":197,"point-geometry":26}],203:[function(_dereq_,module,exports){ | |
"use strict";function _addEventListener(e,t,n){n[e]=n[e]||[],n[e].push(t)}function _removeEventListener(e,t,n){if(n&&n[e]){var i=n[e].indexOf(t);i!==-1&&n[e].splice(i,1)}}var util=_dereq_("./util"),Evented=function(){};Evented.prototype.on=function(e,t){return this._listeners=this._listeners||{},_addEventListener(e,t,this._listeners),this},Evented.prototype.off=function(e,t){return _removeEventListener(e,t,this._listeners),_removeEventListener(e,t,this._oneTimeListeners),this},Evented.prototype.once=function(e,t){return this._oneTimeListeners=this._oneTimeListeners||{},_addEventListener(e,t,this._oneTimeListeners),this},Evented.prototype.fire=function(e,t){var n=this;if(this.listens(e)){t=util.extend({},t,{type:e,target:this});for(var i=this._listeners&&this._listeners[e]?this._listeners[e].slice():[],s=0;s<i.length;s++)i[s].call(n,t);for(var r=this._oneTimeListeners&&this._oneTimeListeners[e]?this._oneTimeListeners[e].slice():[],o=0;o<r.length;o++)r[o].call(n,t),_removeEventListener(e,r[o],n._oneTimeListeners);this._eventedParent&&this._eventedParent.fire(e,util.extend({},t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData))}else util.endsWith(e,"error")&&console.error(t&&t.error||t||"Empty error event");return this},Evented.prototype.listens=function(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)},Evented.prototype.setEventedParent=function(e,t){return this._eventedParent=e,this._eventedParentData=t,this},module.exports=Evented; | |
},{"./util":215}],204:[function(_dereq_,module,exports){ | |
"use strict";function compareMax(e,t){return t.max-e.max}function Cell(e,t,n,r){this.p=new Point(e,t),this.h=n,this.d=pointToPolygonDist(this.p,r),this.max=this.d+this.h*Math.SQRT2}function pointToPolygonDist(e,t){for(var n=!1,r=1/0,o=0;o<t.length;o++)for(var i=t[o],l=0,u=i.length,s=u-1;l<u;s=l++){var a=i[l],h=i[s];a.y>e.y!=h.y>e.y&&e.x<(h.x-a.x)*(e.y-a.y)/(h.y-a.y)+a.x&&(n=!n),r=Math.min(r,distToSegmentSquared(e,a,h))}return(n?1:-1)*Math.sqrt(r)}function getCentroidCell(e){for(var t=0,n=0,r=0,o=e[0],i=0,l=o.length,u=l-1;i<l;u=i++){var s=o[i],a=o[u],h=s.x*a.y-a.x*s.y;n+=(s.x+a.x)*h,r+=(s.y+a.y)*h,t+=3*h}return new Cell(n/t,r/t,0,e)}var Queue=_dereq_("tinyqueue"),Point=_dereq_("point-geometry"),distToSegmentSquared=_dereq_("./intersection_tests").distToSegmentSquared;module.exports=function(e,t,n){t=t||1;for(var r,o,i,l,u=e[0],s=0;s<u.length;s++){var a=u[s];(!s||a.x<r)&&(r=a.x),(!s||a.y<o)&&(o=a.y),(!s||a.x>i)&&(i=a.x),(!s||a.y>l)&&(l=a.y)}var h=i-r,p=l-o,y=Math.min(h,p),x=y/2,d=new Queue(null,compareMax);if(0===y)return[r,o];for(var g=r;g<i;g+=y)for(var f=o;f<l;f+=y)d.push(new Cell(g+x,f+x,x,e));for(var m=getCentroidCell(e),c=d.length;d.length;){var v=d.pop();(v.d>m.d||!m.d)&&(m=v,n&&console.log("found best %d after %d probes",Math.round(1e4*v.d)/1e4,c)),v.max-m.d<=t||(x=v.h/2,d.push(new Cell(v.p.x-x,v.p.y-x,x,e)),d.push(new Cell(v.p.x+x,v.p.y-x,x,e)),d.push(new Cell(v.p.x-x,v.p.y+x,x,e)),d.push(new Cell(v.p.x+x,v.p.y+x,x,e)),c+=4)}return n&&(console.log("num probes: "+c),console.log("best distance: "+m.d)),m.p}; | |
},{"./intersection_tests":207,"point-geometry":26,"tinyqueue":30}],205:[function(_dereq_,module,exports){ | |
"use strict";var WorkerPool=_dereq_("./worker_pool"),globalWorkerPool;module.exports=function(){return globalWorkerPool||(globalWorkerPool=new WorkerPool),globalWorkerPool}; | |
},{"./worker_pool":218}],206:[function(_dereq_,module,exports){ | |
"use strict";function Glyphs(a,e){this.stacks=a.readFields(readFontstacks,[],e)}function readFontstacks(a,e,r){if(1===a){var t=r.readMessage(readFontstack,{glyphs:{}});e.push(t)}}function readFontstack(a,e,r){if(1===a)e.name=r.readString();else if(2===a)e.range=r.readString();else if(3===a){var t=r.readMessage(readGlyph,{});e.glyphs[t.id]=t}}function readGlyph(a,e,r){1===a?e.id=r.readVarint():2===a?e.bitmap=r.readBytes():3===a?e.width=r.readVarint():4===a?e.height=r.readVarint():5===a?e.left=r.readSVarint():6===a?e.top=r.readSVarint():7===a&&(e.advance=r.readVarint())}module.exports=Glyphs; | |
},{}],207:[function(_dereq_,module,exports){ | |
"use strict";function polygonIntersectsPolygon(n,t){for(var e=0;e<n.length;e++)if(polygonContainsPoint(t,n[e]))return!0;for(var r=0;r<t.length;r++)if(polygonContainsPoint(n,t[r]))return!0;return!!lineIntersectsLine(n,t)}function multiPolygonIntersectsBufferedMultiPoint(n,t,e){for(var r=0;r<n.length;r++)for(var o=n[r],i=0;i<t.length;i++)for(var l=t[i],u=0;u<l.length;u++){var s=l[u];if(polygonContainsPoint(o,s))return!0;if(pointIntersectsBufferedLine(s,o,e))return!0}return!1}function multiPolygonIntersectsMultiPolygon(n,t){if(1===n.length&&1===n[0].length)return multiPolygonContainsPoint(t,n[0][0]);for(var e=0;e<t.length;e++)for(var r=t[e],o=0;o<r.length;o++)if(multiPolygonContainsPoint(n,r[o]))return!0;for(var i=0;i<n.length;i++){for(var l=n[i],u=0;u<l.length;u++)if(multiPolygonContainsPoint(t,l[u]))return!0;for(var s=0;s<t.length;s++)if(lineIntersectsLine(l,t[s]))return!0}return!1}function multiPolygonIntersectsBufferedMultiLine(n,t,e){for(var r=0;r<t.length;r++)for(var o=t[r],i=0;i<n.length;i++){var l=n[i];if(l.length>=3)for(var u=0;u<o.length;u++)if(polygonContainsPoint(l,o[u]))return!0;if(lineIntersectsBufferedLine(l,o,e))return!0}return!1}function lineIntersectsBufferedLine(n,t,e){if(n.length>1){if(lineIntersectsLine(n,t))return!0;for(var r=0;r<t.length;r++)if(pointIntersectsBufferedLine(t[r],n,e))return!0}for(var o=0;o<n.length;o++)if(pointIntersectsBufferedLine(n[o],t,e))return!0;return!1}function lineIntersectsLine(n,t){if(0===n.length||0===t.length)return!1;for(var e=0;e<n.length-1;e++)for(var r=n[e],o=n[e+1],i=0;i<t.length-1;i++){var l=t[i],u=t[i+1];if(lineSegmentIntersectsLineSegment(r,o,l,u))return!0}return!1}function lineSegmentIntersectsLineSegment(n,t,e,r){return isCounterClockwise(n,e,r)!==isCounterClockwise(t,e,r)&&isCounterClockwise(n,t,e)!==isCounterClockwise(n,t,r)}function pointIntersectsBufferedLine(n,t,e){var r=e*e;if(1===t.length)return n.distSqr(t[0])<r;for(var o=1;o<t.length;o++){var i=t[o-1],l=t[o];if(distToSegmentSquared(n,i,l)<r)return!0}return!1}function distToSegmentSquared(n,t,e){var r=t.distSqr(e);if(0===r)return n.distSqr(t);var o=((n.x-t.x)*(e.x-t.x)+(n.y-t.y)*(e.y-t.y))/r;return o<0?n.distSqr(t):o>1?n.distSqr(e):n.distSqr(e.sub(t)._mult(o)._add(t))}function multiPolygonContainsPoint(n,t){for(var e,r,o,i=!1,l=0;l<n.length;l++){e=n[l];for(var u=0,s=e.length-1;u<e.length;s=u++)r=e[u],o=e[s],r.y>t.y!=o.y>t.y&&t.x<(o.x-r.x)*(t.y-r.y)/(o.y-r.y)+r.x&&(i=!i)}return i}function polygonContainsPoint(n,t){for(var e=!1,r=0,o=n.length-1;r<n.length;o=r++){var i=n[r],l=n[o];i.y>t.y!=l.y>t.y&&t.x<(l.x-i.x)*(t.y-i.y)/(l.y-i.y)+i.x&&(e=!e)}return e}var isCounterClockwise=_dereq_("./util").isCounterClockwise;module.exports={multiPolygonIntersectsBufferedMultiPoint:multiPolygonIntersectsBufferedMultiPoint,multiPolygonIntersectsMultiPolygon:multiPolygonIntersectsMultiPolygon,multiPolygonIntersectsBufferedMultiLine:multiPolygonIntersectsBufferedMultiLine,polygonIntersectsPolygon:polygonIntersectsPolygon,distToSegmentSquared:distToSegmentSquared}; | |
},{"./util":215}],208:[function(_dereq_,module,exports){ | |
"use strict";var unicodeBlockLookup={"Latin-1 Supplement":function(n){return n>=128&&n<=255},"Hangul Jamo":function(n){return n>=4352&&n<=4607},"Unified Canadian Aboriginal Syllabics":function(n){return n>=5120&&n<=5759},"Unified Canadian Aboriginal Syllabics Extended":function(n){return n>=6320&&n<=6399},"General Punctuation":function(n){return n>=8192&&n<=8303},"Letterlike Symbols":function(n){return n>=8448&&n<=8527},"Number Forms":function(n){return n>=8528&&n<=8591},"Miscellaneous Technical":function(n){return n>=8960&&n<=9215},"Control Pictures":function(n){return n>=9216&&n<=9279},"Optical Character Recognition":function(n){return n>=9280&&n<=9311},"Enclosed Alphanumerics":function(n){return n>=9312&&n<=9471},"Geometric Shapes":function(n){return n>=9632&&n<=9727},"Miscellaneous Symbols":function(n){return n>=9728&&n<=9983},"Miscellaneous Symbols and Arrows":function(n){return n>=11008&&n<=11263},"CJK Radicals Supplement":function(n){return n>=11904&&n<=12031},"Kangxi Radicals":function(n){return n>=12032&&n<=12255},"Ideographic Description Characters":function(n){return n>=12272&&n<=12287},"CJK Symbols and Punctuation":function(n){return n>=12288&&n<=12351},Hiragana:function(n){return n>=12352&&n<=12447},Katakana:function(n){return n>=12448&&n<=12543},Bopomofo:function(n){return n>=12544&&n<=12591},"Hangul Compatibility Jamo":function(n){return n>=12592&&n<=12687},Kanbun:function(n){return n>=12688&&n<=12703},"Bopomofo Extended":function(n){return n>=12704&&n<=12735},"CJK Strokes":function(n){return n>=12736&&n<=12783},"Katakana Phonetic Extensions":function(n){return n>=12784&&n<=12799},"Enclosed CJK Letters and Months":function(n){return n>=12800&&n<=13055},"CJK Compatibility":function(n){return n>=13056&&n<=13311},"CJK Unified Ideographs Extension A":function(n){return n>=13312&&n<=19903},"Yijing Hexagram Symbols":function(n){return n>=19904&&n<=19967},"CJK Unified Ideographs":function(n){return n>=19968&&n<=40959},"Yi Syllables":function(n){return n>=40960&&n<=42127},"Yi Radicals":function(n){return n>=42128&&n<=42191},"Hangul Jamo Extended-A":function(n){return n>=43360&&n<=43391},"Hangul Syllables":function(n){return n>=44032&&n<=55215},"Hangul Jamo Extended-B":function(n){return n>=55216&&n<=55295},"Private Use Area":function(n){return n>=57344&&n<=63743},"CJK Compatibility Ideographs":function(n){return n>=63744&&n<=64255},"Vertical Forms":function(n){return n>=65040&&n<=65055},"CJK Compatibility Forms":function(n){return n>=65072&&n<=65103},"Small Form Variants":function(n){return n>=65104&&n<=65135},"Halfwidth and Fullwidth Forms":function(n){return n>=65280&&n<=65519}};module.exports=unicodeBlockLookup; | |
},{}],209:[function(_dereq_,module,exports){ | |
"use strict";var LRUCache=function(t,e){this.max=t,this.onRemove=e,this.reset()};LRUCache.prototype.reset=function(){var t=this;for(var e in t.data)t.onRemove(t.data[e]);return this.data={},this.order=[],this},LRUCache.prototype.add=function(t,e){if(this.has(t))this.order.splice(this.order.indexOf(t),1),this.data[t]=e,this.order.push(t);else if(this.data[t]=e,this.order.push(t),this.order.length>this.max){var r=this.get(this.order[0]);r&&this.onRemove(r)}return this},LRUCache.prototype.has=function(t){return t in this.data},LRUCache.prototype.keys=function(){return this.order},LRUCache.prototype.get=function(t){if(!this.has(t))return null;var e=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),e},LRUCache.prototype.getWithoutRemoving=function(t){if(!this.has(t))return null;var e=this.data[t];return e},LRUCache.prototype.remove=function(t){if(!this.has(t))return this;var e=this.data[t];return delete this.data[t],this.onRemove(e),this.order.splice(this.order.indexOf(t),1),this},LRUCache.prototype.setMaxSize=function(t){var e=this;for(this.max=t;this.order.length>this.max;){var r=e.get(e.order[0]);r&&e.onRemove(r)}return this},module.exports=LRUCache; | |
},{}],210:[function(_dereq_,module,exports){ | |
"use strict";function makeAPIURL(r,e){var t=parseUrl(config.API_URL);if(r.protocol=t.protocol,r.authority=t.authority,!config.REQUIRE_ACCESS_TOKEN)return formatUrl(r);if(e=e||config.ACCESS_TOKEN,!e)throw new Error("An API access token is required to use Mapbox GL. "+help);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+help);return r.params.push("access_token="+e),formatUrl(r)}function isMapboxURL(r){return 0===r.indexOf("mapbox:")}function replaceTempAccessToken(r){for(var e=0;e<r.length;e++)0===r[e].indexOf("access_token=tk.")&&(r[e]="access_token="+(config.ACCESS_TOKEN||""))}function parseUrl(r){var e=r.match(urlRe);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function formatUrl(r){var e=r.params.length?"?"+r.params.join("&"):"";return r.protocol+"://"+r.authority+r.path+e}var config=_dereq_("./config"),browser=_dereq_("./browser"),help="See https://www.mapbox.com/api-documentation/#access-tokens";exports.isMapboxURL=isMapboxURL,exports.normalizeStyleURL=function(r,e){if(!isMapboxURL(r))return r;var t=parseUrl(r);return t.path="/styles/v1"+t.path,makeAPIURL(t,e)},exports.normalizeGlyphsURL=function(r,e){if(!isMapboxURL(r))return r;var t=parseUrl(r);return t.path="/fonts/v1"+t.path,makeAPIURL(t,e)},exports.normalizeSourceURL=function(r,e){if(!isMapboxURL(r))return r;var t=parseUrl(r);return t.path="/v4/"+t.authority+".json",t.params.push("secure"),makeAPIURL(t,e)},exports.normalizeSpriteURL=function(r,e,t,o){var a=parseUrl(r);return isMapboxURL(r)?(a.path="/styles/v1"+a.path+"/sprite"+e+t,makeAPIURL(a,o)):(a.path+=""+e+t,formatUrl(a))};var imageExtensionRe=/(\.(png|jpg)\d*)(?=$)/;exports.normalizeTileURL=function(r,e,t){if(!e||!isMapboxURL(e))return r;var o=parseUrl(r),a=browser.devicePixelRatio>=2||512===t?"@2x":"",s=browser.supportsWebp?".webp":"$1";return o.path=o.path.replace(imageExtensionRe,""+a+s),replaceTempAccessToken(o.params),formatUrl(o)};var urlRe=/^(\w+):\/\/([^\/?]*)(\/[^?]+)?\??(.+)?/; | |
},{"./browser":195,"./config":199}],211:[function(_dereq_,module,exports){ | |
"use strict";var isChar=_dereq_("./is_char_in_unicode_block");module.exports.allowsIdeographicBreaking=function(a){for(var i=0,r=a;i<r.length;i+=1){var s=r[i];if(!exports.charAllowsIdeographicBreaking(s.charCodeAt(0)))return!1}return!0},module.exports.allowsVerticalWritingMode=function(a){for(var i=0,r=a;i<r.length;i+=1){var s=r[i];if(exports.charHasUprightVerticalOrientation(s.charCodeAt(0)))return!0}return!1},module.exports.charAllowsIdeographicBreaking=function(a){return!(a<11904)&&(!!isChar["Bopomofo Extended"](a)||(!!isChar.Bopomofo(a)||(!!isChar["CJK Compatibility Forms"](a)||(!!isChar["CJK Compatibility Ideographs"](a)||(!!isChar["CJK Compatibility"](a)||(!!isChar["CJK Radicals Supplement"](a)||(!!isChar["CJK Strokes"](a)||(!!isChar["CJK Symbols and Punctuation"](a)||(!!isChar["CJK Unified Ideographs Extension A"](a)||(!!isChar["CJK Unified Ideographs"](a)||(!!isChar["Enclosed CJK Letters and Months"](a)||(!!isChar["Halfwidth and Fullwidth Forms"](a)||(!!isChar.Hiragana(a)||(!!isChar["Ideographic Description Characters"](a)||(!!isChar["Kangxi Radicals"](a)||(!!isChar["Katakana Phonetic Extensions"](a)||(!!isChar.Katakana(a)||(!!isChar["Vertical Forms"](a)||(!!isChar["Yi Radicals"](a)||!!isChar["Yi Syllables"](a))))))))))))))))))))},exports.charHasUprightVerticalOrientation=function(a){return 746===a||747===a||!(a<4352)&&(!!isChar["Bopomofo Extended"](a)||(!!isChar.Bopomofo(a)||(!(!isChar["CJK Compatibility Forms"](a)||a>=65097&&a<=65103)||(!!isChar["CJK Compatibility Ideographs"](a)||(!!isChar["CJK Compatibility"](a)||(!!isChar["CJK Radicals Supplement"](a)||(!!isChar["CJK Strokes"](a)||(!(!isChar["CJK Symbols and Punctuation"](a)||a>=12296&&a<=12305||a>=12308&&a<=12319||12336===a)||(!!isChar["CJK Unified Ideographs Extension A"](a)||(!!isChar["CJK Unified Ideographs"](a)||(!!isChar["Enclosed CJK Letters and Months"](a)||(!!isChar["Hangul Compatibility Jamo"](a)||(!!isChar["Hangul Jamo Extended-A"](a)||(!!isChar["Hangul Jamo Extended-B"](a)||(!!isChar["Hangul Jamo"](a)||(!!isChar["Hangul Syllables"](a)||(!!isChar.Hiragana(a)||(!!isChar["Ideographic Description Characters"](a)||(!!isChar.Kanbun(a)||(!!isChar["Kangxi Radicals"](a)||(!!isChar["Katakana Phonetic Extensions"](a)||(!(!isChar.Katakana(a)||12540===a)||(!(!isChar["Halfwidth and Fullwidth Forms"](a)||65288===a||65289===a||65293===a||a>=65306&&a<=65310||65339===a||65341===a||65343===a||a>=65371&&a<=65503||65507===a||a>=65512&&a<=65519)||(!(!isChar["Small Form Variants"](a)||a>=65112&&a<=65118||a>=65123&&a<=65126)||(!!isChar["Unified Canadian Aboriginal Syllabics"](a)||(!!isChar["Unified Canadian Aboriginal Syllabics Extended"](a)||(!!isChar["Vertical Forms"](a)||(!!isChar["Yijing Hexagram Symbols"](a)||(!!isChar["Yi Syllables"](a)||!!isChar["Yi Radicals"](a))))))))))))))))))))))))))))))},exports.charHasNeutralVerticalOrientation=function(a){return!(!isChar["Latin-1 Supplement"](a)||167!==a&&169!==a&&174!==a&&177!==a&&188!==a&&189!==a&&190!==a&&215!==a&&247!==a)||(!(!isChar["General Punctuation"](a)||8214!==a&&8224!==a&&8225!==a&&8240!==a&&8241!==a&&8251!==a&&8252!==a&&8258!==a&&8263!==a&&8264!==a&&8265!==a&&8273!==a)||(!!isChar["Letterlike Symbols"](a)||(!!isChar["Number Forms"](a)||(!(!isChar["Miscellaneous Technical"](a)||!(a>=8960&&a<=8967||a>=8972&&a<=8991||a>=8996&&a<=9e3||9003===a||a>=9085&&a<=9114||a>=9150&&a<=9165||9167===a||a>=9169&&a<=9179||a>=9186&&a<=9215))||(!(!isChar["Control Pictures"](a)||9251===a)||(!!isChar["Optical Character Recognition"](a)||(!!isChar["Enclosed Alphanumerics"](a)||(!!isChar["Geometric Shapes"](a)||(!(!isChar["Miscellaneous Symbols"](a)||a>=9754&&a<=9759)||(!(!isChar["Miscellaneous Symbols and Arrows"](a)||!(a>=11026&&a<=11055||a>=11088&&a<=11097||a>=11192&&a<=11243))||(!!isChar["CJK Symbols and Punctuation"](a)||(!!isChar.Katakana(a)||(!!isChar["Private Use Area"](a)||(!!isChar["CJK Compatibility Forms"](a)||(!!isChar["Small Form Variants"](a)||(!!isChar["Halfwidth and Fullwidth Forms"](a)||(8734===a||8756===a||8757===a||a>=9984&&a<=10087||a>=10102&&a<=10131||65532===a||65533===a)))))))))))))))))},exports.charHasRotatedVerticalOrientation=function(a){return!(exports.charHasUprightVerticalOrientation(a)||exports.charHasNeutralVerticalOrientation(a))}; | |
},{"./is_char_in_unicode_block":208}],212:[function(_dereq_,module,exports){ | |
"use strict";var LngLat=_dereq_("../geo/lng_lat");module.exports=function(n,t,l){if(n=new LngLat(n.lng,n.lat),t){var a=new LngLat(n.lng-360,n.lat),i=new LngLat(n.lng+360,n.lat),o=l.locationPoint(n).distSqr(t);l.locationPoint(a).distSqr(t)<o?n=a:l.locationPoint(i).distSqr(t)<o&&(n=i)}for(;Math.abs(n.lng-l.center.lng)>180;){var e=l.locationPoint(n);if(e.x>=0&&e.y>=0&&e.x<=l.width&&e.y<=l.height)break;n.lng>l.center.lng?n.lng-=360:n.lng+=360}return n}; | |
},{"../geo/lng_lat":62}],213:[function(_dereq_,module,exports){ | |
"use strict";function createStructArrayType(t){var e=JSON.stringify(t);if(structArrayTypeCache[e])return structArrayTypeCache[e];var r=void 0===t.alignment?1:t.alignment,i=0,n=0,a=["Uint8"],o=t.members.map(function(t){a.indexOf(t.type)<0&&a.push(t.type);var e=sizeOf(t.type),o=i=align(i,Math.max(r,e)),s=t.components||1;return n=Math.max(n,e),i+=e*s,{name:t.name,type:t.type,components:s,offset:o}}),s=align(i,Math.max(n,r)),p=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Struct);p.prototype.alignment=r,p.prototype.size=s;for(var y=0,c=o;y<c.length;y+=1)for(var h=c[y],u=0;u<h.components;u++){var f=h.name+(1===h.components?"":u);Object.defineProperty(p.prototype,f,{get:createGetter(h,u),set:createSetter(h,u)})}var m=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(StructArray);return m.prototype.members=o,m.prototype.StructType=p,m.prototype.bytesPerElement=s,m.prototype.emplaceBack=createEmplaceBack(o,s),m.prototype._usedTypes=a,structArrayTypeCache[e]=m,m}function align(t,e){return Math.ceil(t/e)*e}function sizeOf(t){return viewTypes[t].BYTES_PER_ELEMENT}function getArrayViewName(t){return t.toLowerCase()}function createEmplaceBack(t,e){for(var r=[],i=[],n="var i = this.length;\nthis.resize(this.length + 1);\n",a=0,o=t;a<o.length;a+=1){var s=o[a],p=sizeOf(s.type);r.indexOf(p)<0&&(r.push(p),n+="var o"+p.toFixed(0)+" = i * "+(e/p).toFixed(0)+";\n");for(var y=0;y<s.components;y++){var c="v"+i.length,h="o"+p.toFixed(0)+" + "+(s.offset/p+y).toFixed(0);n+="this."+getArrayViewName(s.type)+"["+h+"] = "+c+";\n",i.push(c)}}return n+="return i;",new Function(i.toString(),n)}function createMemberComponentString(t,e){var r="this._pos"+sizeOf(t.type).toFixed(0),i=(t.offset/sizeOf(t.type)+e).toFixed(0),n=r+" + "+i;return"this._structArray."+getArrayViewName(t.type)+"["+n+"]"}function createGetter(t,e){return new Function("return "+createMemberComponentString(t,e)+";")}function createSetter(t,e){return new Function("x",createMemberComponentString(t,e)+" = x;")}module.exports=createStructArrayType;var viewTypes={Int8:Int8Array,Uint8:Uint8Array,Uint8Clamped:Uint8ClampedArray,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array,Float64:Float64Array},Struct=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},DEFAULT_CAPACITY=128,RESIZE_MULTIPLIER=5,StructArray=function(t){this.isTransferred=!1,void 0!==t?(this.arrayBuffer=t.arrayBuffer,this.length=t.length,this.capacity=this.arrayBuffer.byteLength/this.bytesPerElement,this._refreshViews()):(this.capacity=-1,this.resize(0))};StructArray.serialize=function(){return{members:this.prototype.members,alignment:this.prototype.StructType.prototype.alignment,bytesPerElement:this.prototype.bytesPerElement}},StructArray.prototype.serialize=function(t){return this._trim(),t&&(this.isTransferred=!0,t.push(this.arrayBuffer)),{length:this.length,arrayBuffer:this.arrayBuffer}},StructArray.prototype.get=function(t){return new this.StructType(this,t)},StructArray.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},StructArray.prototype.resize=function(t){if(this.length=t,t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*RESIZE_MULTIPLIER),DEFAULT_CAPACITY),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},StructArray.prototype._refreshViews=function(){for(var t=this,e=0,r=t._usedTypes;e<r.length;e+=1){var i=r[e];t[getArrayViewName(i)]=new viewTypes[i](t.arrayBuffer)}},StructArray.prototype.toArray=function(t,e){for(var r=this,i=[],n=t;n<e;n++){var a=r.get(n);i.push(a)}return i};var structArrayTypeCache={}; | |
},{}],214:[function(_dereq_,module,exports){ | |
"use strict";function resolveTokens(e,n){return n.replace(/{([^{}]+)}/g,function(n,r){return r in e?e[r]:""})}module.exports=resolveTokens; | |
},{}],215:[function(_dereq_,module,exports){ | |
"use strict";var UnitBezier=_dereq_("@mapbox/unitbezier"),Coordinate=_dereq_("../geo/coordinate"),Point=_dereq_("point-geometry");exports.easeCubicInOut=function(r){if(r<=0)return 0;if(r>=1)return 1;var e=r*r,t=e*r;return 4*(r<.5?t:3*(r-e)+t-.75)},exports.bezier=function(r,e,t,n){var o=new UnitBezier(r,e,t,n);return function(r){return o.solve(r)}},exports.ease=exports.bezier(.25,.1,.25,1),exports.clamp=function(r,e,t){return Math.min(t,Math.max(e,r))},exports.wrap=function(r,e,t){var n=t-e,o=((r-e)%n+n)%n+e;return o===e?t:o},exports.asyncAll=function(r,e,t){if(!r.length)return t(null,[]);var n=r.length,o=new Array(r.length),a=null;r.forEach(function(r,i){e(r,function(r,e){r&&(a=r),o[i]=e,0===--n&&t(a,o)})})},exports.values=function(r){var e=[];for(var t in r)e.push(r[t]);return e},exports.keysDifference=function(r,e){var t=[];for(var n in r)n in e||t.push(n);return t},exports.extend=function(r,e,t,n){for(var o=arguments,a=1;a<arguments.length;a++){var i=o[a];for(var u in i)r[u]=i[u]}return r},exports.pick=function(r,e){for(var t={},n=0;n<e.length;n++){var o=e[n];o in r&&(t[o]=r[o])}return t};var id=1;exports.uniqueId=function(){return id++},exports.bindAll=function(r,e){r.forEach(function(r){e[r]&&(e[r]=e[r].bind(e))})},exports.getCoordinatesCenter=function(r){for(var e=1/0,t=1/0,n=-(1/0),o=-(1/0),a=0;a<r.length;a++)e=Math.min(e,r[a].column),t=Math.min(t,r[a].row),n=Math.max(n,r[a].column),o=Math.max(o,r[a].row);var i=n-e,u=o-t,s=Math.max(i,u),c=Math.max(0,Math.floor(-Math.log(s)/Math.LN2));return new Coordinate((e+n)/2,(t+o)/2,0).zoomTo(c)},exports.endsWith=function(r,e){return r.indexOf(e,r.length-e.length)!==-1},exports.mapObject=function(r,e,t){var n=this,o={};for(var a in r)o[a]=e.call(t||n,r[a],a,r);return o},exports.filterObject=function(r,e,t){var n=this,o={};for(var a in r)e.call(t||n,r[a],a,r)&&(o[a]=r[a]);return o},exports.deepEqual=function(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(var t=0;t<r.length;t++)if(!exports.deepEqual(r[t],e[t]))return!1;return!0}if("object"==typeof r&&null!==r&&null!==e){if("object"!=typeof e)return!1;var n=Object.keys(r);if(n.length!==Object.keys(e).length)return!1;for(var o in r)if(!exports.deepEqual(r[o],e[o]))return!1;return!0}return r===e},exports.clone=function(r){return Array.isArray(r)?r.map(exports.clone):"object"==typeof r&&r?exports.mapObject(r,exports.clone):r},exports.arraysIntersect=function(r,e){for(var t=0;t<r.length;t++)if(e.indexOf(r[t])>=0)return!0;return!1};var warnOnceHistory={};exports.warnOnce=function(r){warnOnceHistory[r]||("undefined"!=typeof console&&console.warn(r),warnOnceHistory[r]=!0)},exports.isCounterClockwise=function(r,e,t){return(t.y-r.y)*(e.x-r.x)>(e.y-r.y)*(t.x-r.x)},exports.calculateSignedArea=function(r){for(var e=0,t=0,n=r.length,o=n-1,a=void 0,i=void 0;t<n;o=t++)a=r[t],i=r[o],e+=(i.x-a.x)*(a.y+i.y);return e},exports.isClosedPolygon=function(r){if(r.length<4)return!1;var e=r[0],t=r[r.length-1];return!(Math.abs(e.x-t.x)>0||Math.abs(e.y-t.y)>0)&&Math.abs(exports.calculateSignedArea(r))>.01},exports.sphericalToCartesian=function(r){var e=r[0],t=r[1],n=r[2];return t+=90,t*=Math.PI/180,n*=Math.PI/180,[e*Math.cos(t)*Math.sin(n),e*Math.sin(t)*Math.sin(n),e*Math.cos(n)]},exports.parseCacheControl=function(r){var e=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,t={};if(r.replace(e,function(r,e,n,o){var a=n||o;return t[e]=!a||a.toLowerCase(),""}),t["max-age"]){var n=parseInt(t["max-age"],10);isNaN(n)?delete t["max-age"]:t["max-age"]=n}return t}; | |
},{"../geo/coordinate":61,"@mapbox/unitbezier":3,"point-geometry":26}],216:[function(_dereq_,module,exports){ | |
"use strict";var Feature=function(e,t,r,o){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=r,e._y=o,this.properties=e.properties,null!=e.id&&(this.id=e.id)},prototypeAccessors={geometry:{}};prototypeAccessors.geometry.get=function(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},prototypeAccessors.geometry.set=function(e){this._geometry=e},Feature.prototype.toJSON=function(){var e=this,t={geometry:this.geometry};for(var r in e)"_geometry"!==r&&"_vectorTileFeature"!==r&&(t[r]=e[r]);return t},Object.defineProperties(Feature.prototype,prototypeAccessors),module.exports=Feature; | |
},{}],217:[function(_dereq_,module,exports){ | |
"use strict";var scriptDetection=_dereq_("./script_detection");module.exports=function(t){for(var o="",e=0;e<t.length;e++){var r=t.charCodeAt(e+1)||null,l=t.charCodeAt(e-1)||null,i=(!r||!scriptDetection.charHasRotatedVerticalOrientation(r)||module.exports.lookup[t[e+1]])&&(!l||!scriptDetection.charHasRotatedVerticalOrientation(l)||module.exports.lookup[t[e-1]]);o+=i&&module.exports.lookup[t[e]]?module.exports.lookup[t[e]]:t[e]}return o},module.exports.lookup={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"}; | |
},{"./script_detection":211}],218:[function(_dereq_,module,exports){ | |
"use strict";var WebWorker=_dereq_("./web_worker"),WorkerPool=function(){this.active={}};WorkerPool.prototype.acquire=function(r){var e=this;if(!this.workers){var o=_dereq_("../").workerCount;for(this.workers=[];this.workers.length<o;)e.workers.push(new WebWorker)}return this.active[r]=!0,this.workers.slice()},WorkerPool.prototype.release=function(r){delete this.active[r],0===Object.keys(this.active).length&&(this.workers.forEach(function(r){r.terminate()}),this.workers=null)},module.exports=WorkerPool; | |
},{"../":65,"./web_worker":196}]},{},[65])(65) | |
}); | |
//# sourceMappingURL=mapbox-gl.js.map | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(86))) | |
/***/ }), | |
/* 54 */ | |
/***/ (function(module, exports) { | |
// shim for using process in browser | |
var process = module.exports = {}; | |
// cached from whatever global is present so that test runners that stub it | |
// don't break things. But we need to wrap it in a try catch in case it is | |
// wrapped in strict mode code which doesn't define any globals. It's inside a | |
// function because try/catches deoptimize in certain engines. | |
var cachedSetTimeout; | |
var cachedClearTimeout; | |
function defaultSetTimout() { | |
throw new Error('setTimeout has not been defined'); | |
} | |
function defaultClearTimeout () { | |
throw new Error('clearTimeout has not been defined'); | |
} | |
(function () { | |
try { | |
if (typeof setTimeout === 'function') { | |
cachedSetTimeout = setTimeout; | |
} else { | |
cachedSetTimeout = defaultSetTimout; | |
} | |
} catch (e) { | |
cachedSetTimeout = defaultSetTimout; | |
} | |
try { | |
if (typeof clearTimeout === 'function') { | |
cachedClearTimeout = clearTimeout; | |
} else { | |
cachedClearTimeout = defaultClearTimeout; | |
} | |
} catch (e) { | |
cachedClearTimeout = defaultClearTimeout; | |
} | |
} ()) | |
function runTimeout(fun) { | |
if (cachedSetTimeout === setTimeout) { | |
//normal enviroments in sane situations | |
return setTimeout(fun, 0); | |
} | |
// if setTimeout wasn't available but was latter defined | |
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { | |
cachedSetTimeout = setTimeout; | |
return setTimeout(fun, 0); | |
} | |
try { | |
// when when somebody has screwed with setTimeout but no I.E. maddness | |
return cachedSetTimeout(fun, 0); | |
} catch(e){ | |
try { | |
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | |
return cachedSetTimeout.call(null, fun, 0); | |
} catch(e){ | |
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error | |
return cachedSetTimeout.call(this, fun, 0); | |
} | |
} | |
} | |
function runClearTimeout(marker) { | |
if (cachedClearTimeout === clearTimeout) { | |
//normal enviroments in sane situations | |
return clearTimeout(marker); | |
} | |
// if clearTimeout wasn't available but was latter defined | |
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { | |
cachedClearTimeout = clearTimeout; | |
return clearTimeout(marker); | |
} | |
try { | |
// when when somebody has screwed with setTimeout but no I.E. maddness | |
return cachedClearTimeout(marker); | |
} catch (e){ | |
try { | |
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | |
return cachedClearTimeout.call(null, marker); | |
} catch (e){ | |
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. | |
// Some versions of I.E. have different rules for clearTimeout vs setTimeout | |
return cachedClearTimeout.call(this, marker); | |
} | |
} | |
} | |
var queue = []; | |
var draining = false; | |
var currentQueue; | |
var queueIndex = -1; | |
function cleanUpNextTick() { | |
if (!draining || !currentQueue) { | |
return; | |
} | |
draining = false; | |
if (currentQueue.length) { | |
queue = currentQueue.concat(queue); | |
} else { | |
queueIndex = -1; | |
} | |
if (queue.length) { | |
drainQueue(); | |
} | |
} | |
function drainQueue() { | |
if (draining) { | |
return; | |
} | |
var timeout = runTimeout(cleanUpNextTick); | |
draining = true; | |
var len = queue.length; | |
while(len) { | |
currentQueue = queue; | |
queue = []; | |
while (++queueIndex < len) { | |
if (currentQueue) { | |
currentQueue[queueIndex].run(); | |
} | |
} | |
queueIndex = -1; | |
len = queue.length; | |
} | |
currentQueue = null; | |
draining = false; | |
runClearTimeout(timeout); | |
} | |
process.nextTick = function (fun) { | |
var args = new Array(arguments.length - 1); | |
if (arguments.length > 1) { | |
for (var i = 1; i < arguments.length; i++) { | |
args[i - 1] = arguments[i]; | |
} | |
} | |
queue.push(new Item(fun, args)); | |
if (queue.length === 1 && !draining) { | |
runTimeout(drainQueue); | |
} | |
}; | |
// v8 likes predictible objects | |
function Item(fun, array) { | |
this.fun = fun; | |
this.array = array; | |
} | |
Item.prototype.run = function () { | |
this.fun.apply(null, this.array); | |
}; | |
process.title = 'browser'; | |
process.browser = true; | |
process.env = {}; | |
process.argv = []; | |
process.version = ''; // empty string to avoid regexp issues | |
process.versions = {}; | |
function noop() {} | |
process.on = noop; | |
process.addListener = noop; | |
process.once = noop; | |
process.off = noop; | |
process.removeListener = noop; | |
process.removeAllListeners = noop; | |
process.emit = noop; | |
process.prependListener = noop; | |
process.prependOnceListener = noop; | |
process.listeners = function (name) { return [] } | |
process.binding = function (name) { | |
throw new Error('process.binding is not supported'); | |
}; | |
process.cwd = function () { return '/' }; | |
process.chdir = function (dir) { | |
throw new Error('process.chdir is not supported'); | |
}; | |
process.umask = function() { return 0; }; | |
/***/ }), | |
/* 55 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var asap = __webpack_require__(89); | |
function noop() {} | |
// States: | |
// | |
// 0 - pending | |
// 1 - fulfilled with _value | |
// 2 - rejected with _value | |
// 3 - adopted the state of another promise, _value | |
// | |
// once the state is no longer pending (0) it is immutable | |
// All `_` prefixed properties will be reduced to `_{random number}` | |
// at build time to obfuscate them and discourage their use. | |
// We don't use symbols or Object.defineProperty to fully hide them | |
// because the performance isn't good enough. | |
// to avoid using try/catch inside critical functions, we | |
// extract them to here. | |
var LAST_ERROR = null; | |
var IS_ERROR = {}; | |
function getThen(obj) { | |
try { | |
return obj.then; | |
} catch (ex) { | |
LAST_ERROR = ex; | |
return IS_ERROR; | |
} | |
} | |
function tryCallOne(fn, a) { | |
try { | |
return fn(a); | |
} catch (ex) { | |
LAST_ERROR = ex; | |
return IS_ERROR; | |
} | |
} | |
function tryCallTwo(fn, a, b) { | |
try { | |
fn(a, b); | |
} catch (ex) { | |
LAST_ERROR = ex; | |
return IS_ERROR; | |
} | |
} | |
module.exports = Promise; | |
function Promise(fn) { | |
if (typeof this !== 'object') { | |
throw new TypeError('Promises must be constructed via new'); | |
} | |
if (typeof fn !== 'function') { | |
throw new TypeError('not a function'); | |
} | |
this._45 = 0; | |
this._81 = 0; | |
this._65 = null; | |
this._54 = null; | |
if (fn === noop) return; | |
doResolve(fn, this); | |
} | |
Promise._10 = null; | |
Promise._97 = null; | |
Promise._61 = noop; | |
Promise.prototype.then = function(onFulfilled, onRejected) { | |
if (this.constructor !== Promise) { | |
return safeThen(this, onFulfilled, onRejected); | |
} | |
var res = new Promise(noop); | |
handle(this, new Handler(onFulfilled, onRejected, res)); | |
return res; | |
}; | |
function safeThen(self, onFulfilled, onRejected) { | |
return new self.constructor(function (resolve, reject) { | |
var res = new Promise(noop); | |
res.then(resolve, reject); | |
handle(self, new Handler(onFulfilled, onRejected, res)); | |
}); | |
}; | |
function handle(self, deferred) { | |
while (self._81 === 3) { | |
self = self._65; | |
} | |
if (Promise._10) { | |
Promise._10(self); | |
} | |
if (self._81 === 0) { | |
if (self._45 === 0) { | |
self._45 = 1; | |
self._54 = deferred; | |
return; | |
} | |
if (self._45 === 1) { | |
self._45 = 2; | |
self._54 = [self._54, deferred]; | |
return; | |
} | |
self._54.push(deferred); | |
return; | |
} | |
handleResolved(self, deferred); | |
} | |
function handleResolved(self, deferred) { | |
asap(function() { | |
var cb = self._81 === 1 ? deferred.onFulfilled : deferred.onRejected; | |
if (cb === null) { | |
if (self._81 === 1) { | |
resolve(deferred.promise, self._65); | |
} else { | |
reject(deferred.promise, self._65); | |
} | |
return; | |
} | |
var ret = tryCallOne(cb, self._65); | |
if (ret === IS_ERROR) { | |
reject(deferred.promise, LAST_ERROR); | |
} else { | |
resolve(deferred.promise, ret); | |
} | |
}); | |
} | |
function resolve(self, newValue) { | |
// Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure | |
if (newValue === self) { | |
return reject( | |
self, | |
new TypeError('A promise cannot be resolved with itself.') | |
); | |
} | |
if ( | |
newValue && | |
(typeof newValue === 'object' || typeof newValue === 'function') | |
) { | |
var then = getThen(newValue); | |
if (then === IS_ERROR) { | |
return reject(self, LAST_ERROR); | |
} | |
if ( | |
then === self.then && | |
newValue instanceof Promise | |
) { | |
self._81 = 3; | |
self._65 = newValue; | |
finale(self); | |
return; | |
} else if (typeof then === 'function') { | |
doResolve(then.bind(newValue), self); | |
return; | |
} | |
} | |
self._81 = 1; | |
self._65 = newValue; | |
finale(self); | |
} | |
function reject(self, newValue) { | |
self._81 = 2; | |
self._65 = newValue; | |
if (Promise._97) { | |
Promise._97(self, newValue); | |
} | |
finale(self); | |
} | |
function finale(self) { | |
if (self._45 === 1) { | |
handle(self, self._54); | |
self._54 = null; | |
} | |
if (self._45 === 2) { | |
for (var i = 0; i < self._54.length; i++) { | |
handle(self, self._54[i]); | |
} | |
self._54 = null; | |
} | |
} | |
function Handler(onFulfilled, onRejected, promise){ | |
this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; | |
this.onRejected = typeof onRejected === 'function' ? onRejected : null; | |
this.promise = promise; | |
} | |
/** | |
* Take a potentially misbehaving resolver function and make sure | |
* onFulfilled and onRejected are only called once. | |
* | |
* Makes no guarantees about asynchrony. | |
*/ | |
function doResolve(fn, promise) { | |
var done = false; | |
var res = tryCallTwo(fn, function (value) { | |
if (done) return; | |
done = true; | |
resolve(promise, value); | |
}, function (reason) { | |
if (done) return; | |
done = true; | |
reject(promise, reason); | |
}) | |
if (!done && res === IS_ERROR) { | |
done = true; | |
reject(promise, LAST_ERROR); | |
} | |
} | |
/***/ }), | |
/* 56 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
*/ | |
// React 15.5 references this module, and assumes PropTypes are still callable in production. | |
// Therefore we re-export development-only version with all the PropTypes checks here. | |
// However if one is migrating to the `prop-types` npm library, they will go through the | |
// `index.js` entry point, and it will branch depending on the environment. | |
var factory = __webpack_require__(117); | |
module.exports = function(isValidElement) { | |
// It is still allowed in 15.5. | |
var throwOnDirectAccess = false; | |
return factory(isValidElement, throwOnDirectAccess); | |
}; | |
/***/ }), | |
/* 57 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
*/ | |
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; | |
module.exports = ReactPropTypesSecret; | |
/***/ }), | |
/* 58 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/** | |
* CSS properties which accept numbers but are not in units of "px". | |
*/ | |
var isUnitlessNumber = { | |
animationIterationCount: true, | |
borderImageOutset: true, | |
borderImageSlice: true, | |
borderImageWidth: true, | |
boxFlex: true, | |
boxFlexGroup: true, | |
boxOrdinalGroup: true, | |
columnCount: true, | |
flex: true, | |
flexGrow: true, | |
flexPositive: true, | |
flexShrink: true, | |
flexNegative: true, | |
flexOrder: true, | |
gridRow: true, | |
gridColumn: true, | |
fontWeight: true, | |
lineClamp: true, | |
lineHeight: true, | |
opacity: true, | |
order: true, | |
orphans: true, | |
tabSize: true, | |
widows: true, | |
zIndex: true, | |
zoom: true, | |
// SVG-related properties | |
fillOpacity: true, | |
floodOpacity: true, | |
stopOpacity: true, | |
strokeDasharray: true, | |
strokeDashoffset: true, | |
strokeMiterlimit: true, | |
strokeOpacity: true, | |
strokeWidth: true | |
}; | |
/** | |
* @param {string} prefix vendor-specific prefix, eg: Webkit | |
* @param {string} key style name, eg: transitionDuration | |
* @return {string} style name prefixed with `prefix`, properly camelCased, eg: | |
* WebkitTransitionDuration | |
*/ | |
function prefixKey(prefix, key) { | |
return prefix + key.charAt(0).toUpperCase() + key.substring(1); | |
} | |
/** | |
* Support style names that may come passed in prefixed by adding permutations | |
* of vendor prefixes. | |
*/ | |
var prefixes = ['Webkit', 'ms', 'Moz', 'O']; | |
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an | |
// infinite loop, because it iterates over the newly added props too. | |
Object.keys(isUnitlessNumber).forEach(function (prop) { | |
prefixes.forEach(function (prefix) { | |
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop]; | |
}); | |
}); | |
/** | |
* Most style properties can be unset by doing .style[prop] = '' but IE8 | |
* doesn't like doing that with shorthand properties so for the properties that | |
* IE8 breaks on, which are listed here, we instead unset each of the | |
* individual properties. See http://bugs.jquery.com/ticket/12385. | |
* The 4-value 'clock' properties like margin, padding, border-width seem to | |
* behave without any problems. Curiously, list-style works too without any | |
* special prodding. | |
*/ | |
var shorthandPropertyExpansions = { | |
background: { | |
backgroundAttachment: true, | |
backgroundColor: true, | |
backgroundImage: true, | |
backgroundPositionX: true, | |
backgroundPositionY: true, | |
backgroundRepeat: true | |
}, | |
backgroundPosition: { | |
backgroundPositionX: true, | |
backgroundPositionY: true | |
}, | |
border: { | |
borderWidth: true, | |
borderStyle: true, | |
borderColor: true | |
}, | |
borderBottom: { | |
borderBottomWidth: true, | |
borderBottomStyle: true, | |
borderBottomColor: true | |
}, | |
borderLeft: { | |
borderLeftWidth: true, | |
borderLeftStyle: true, | |
borderLeftColor: true | |
}, | |
borderRight: { | |
borderRightWidth: true, | |
borderRightStyle: true, | |
borderRightColor: true | |
}, | |
borderTop: { | |
borderTopWidth: true, | |
borderTopStyle: true, | |
borderTopColor: true | |
}, | |
font: { | |
fontStyle: true, | |
fontVariant: true, | |
fontWeight: true, | |
fontSize: true, | |
lineHeight: true, | |
fontFamily: true | |
}, | |
outline: { | |
outlineWidth: true, | |
outlineStyle: true, | |
outlineColor: true | |
} | |
}; | |
var CSSProperty = { | |
isUnitlessNumber: isUnitlessNumber, | |
shorthandPropertyExpansions: shorthandPropertyExpansions | |
}; | |
module.exports = CSSProperty; | |
/***/ }), | |
/* 59 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(2); | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
var PooledClass = __webpack_require__(13); | |
var invariant = __webpack_require__(0); | |
/** | |
* A specialized pseudo-event module to help keep track of components waiting to | |
* be notified when their DOM representations are available for use. | |
* | |
* This implements `PooledClass`, so you should never need to instantiate this. | |
* Instead, use `CallbackQueue.getPooled()`. | |
* | |
* @class ReactMountReady | |
* @implements PooledClass | |
* @internal | |
*/ | |
var CallbackQueue = function () { | |
function CallbackQueue(arg) { | |
_classCallCheck(this, CallbackQueue); | |
this._callbacks = null; | |
this._contexts = null; | |
this._arg = arg; | |
} | |
/** | |
* Enqueues a callback to be invoked when `notifyAll` is invoked. | |
* | |
* @param {function} callback Invoked when `notifyAll` is invoked. | |
* @param {?object} context Context to call `callback` with. | |
* @internal | |
*/ | |
CallbackQueue.prototype.enqueue = function enqueue(callback, context) { | |
this._callbacks = this._callbacks || []; | |
this._callbacks.push(callback); | |
this._contexts = this._contexts || []; | |
this._contexts.push(context); | |
}; | |
/** | |
* Invokes all enqueued callbacks and clears the queue. This is invoked after | |
* the DOM representation of a component has been created or updated. | |
* | |
* @internal | |
*/ | |
CallbackQueue.prototype.notifyAll = function notifyAll() { | |
var callbacks = this._callbacks; | |
var contexts = this._contexts; | |
var arg = this._arg; | |
if (callbacks && contexts) { | |
!(callbacks.length === contexts.length) ? false ? invariant(false, 'Mismatched list of contexts in callback queue') : _prodInvariant('24') : void 0; | |
this._callbacks = null; | |
this._contexts = null; | |
for (var i = 0; i < callbacks.length; i++) { | |
callbacks[i].call(contexts[i], arg); | |
} | |
callbacks.length = 0; | |
contexts.length = 0; | |
} | |
}; | |
CallbackQueue.prototype.checkpoint = function checkpoint() { | |
return this._callbacks ? this._callbacks.length : 0; | |
}; | |
CallbackQueue.prototype.rollback = function rollback(len) { | |
if (this._callbacks && this._contexts) { | |
this._callbacks.length = len; | |
this._contexts.length = len; | |
} | |
}; | |
/** | |
* Resets the internal queue. | |
* | |
* @internal | |
*/ | |
CallbackQueue.prototype.reset = function reset() { | |
this._callbacks = null; | |
this._contexts = null; | |
}; | |
/** | |
* `PooledClass` looks for this. | |
*/ | |
CallbackQueue.prototype.destructor = function destructor() { | |
this.reset(); | |
}; | |
return CallbackQueue; | |
}(); | |
module.exports = PooledClass.addPoolingTo(CallbackQueue); | |
/***/ }), | |
/* 60 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var DOMProperty = __webpack_require__(15); | |
var ReactDOMComponentTree = __webpack_require__(4); | |
var ReactInstrumentation = __webpack_require__(8); | |
var quoteAttributeValueForBrowser = __webpack_require__(180); | |
var warning = __webpack_require__(1); | |
var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$'); | |
var illegalAttributeNameCache = {}; | |
var validatedAttributeNameCache = {}; | |
function isAttributeNameSafe(attributeName) { | |
if (validatedAttributeNameCache.hasOwnProperty(attributeName)) { | |
return true; | |
} | |
if (illegalAttributeNameCache.hasOwnProperty(attributeName)) { | |
return false; | |
} | |
if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { | |
validatedAttributeNameCache[attributeName] = true; | |
return true; | |
} | |
illegalAttributeNameCache[attributeName] = true; | |
false ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0; | |
return false; | |
} | |
function shouldIgnoreValue(propertyInfo, value) { | |
return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false; | |
} | |
/** | |
* Operations for dealing with DOM properties. | |
*/ | |
var DOMPropertyOperations = { | |
/** | |
* Creates markup for the ID property. | |
* | |
* @param {string} id Unescaped ID. | |
* @return {string} Markup string. | |
*/ | |
createMarkupForID: function (id) { | |
return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id); | |
}, | |
setAttributeForID: function (node, id) { | |
node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id); | |
}, | |
createMarkupForRoot: function () { | |
return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""'; | |
}, | |
setAttributeForRoot: function (node) { | |
node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, ''); | |
}, | |
/** | |
* Creates markup for a property. | |
* | |
* @param {string} name | |
* @param {*} value | |
* @return {?string} Markup string, or null if the property was invalid. | |
*/ | |
createMarkupForProperty: function (name, value) { | |
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | |
if (propertyInfo) { | |
if (shouldIgnoreValue(propertyInfo, value)) { | |
return ''; | |
} | |
var attributeName = propertyInfo.attributeName; | |
if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { | |
return attributeName + '=""'; | |
} | |
return attributeName + '=' + quoteAttributeValueForBrowser(value); | |
} else if (DOMProperty.isCustomAttribute(name)) { | |
if (value == null) { | |
return ''; | |
} | |
return name + '=' + quoteAttributeValueForBrowser(value); | |
} | |
return null; | |
}, | |
/** | |
* Creates markup for a custom property. | |
* | |
* @param {string} name | |
* @param {*} value | |
* @return {string} Markup string, or empty string if the property was invalid. | |
*/ | |
createMarkupForCustomAttribute: function (name, value) { | |
if (!isAttributeNameSafe(name) || value == null) { | |
return ''; | |
} | |
return name + '=' + quoteAttributeValueForBrowser(value); | |
}, | |
/** | |
* Sets the value for a property on a node. | |
* | |
* @param {DOMElement} node | |
* @param {string} name | |
* @param {*} value | |
*/ | |
setValueForProperty: function (node, name, value) { | |
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | |
if (propertyInfo) { | |
var mutationMethod = propertyInfo.mutationMethod; | |
if (mutationMethod) { | |
mutationMethod(node, value); | |
} else if (shouldIgnoreValue(propertyInfo, value)) { | |
this.deleteValueForProperty(node, name); | |
return; | |
} else if (propertyInfo.mustUseProperty) { | |
// Contrary to `setAttribute`, object properties are properly | |
// `toString`ed by IE8/9. | |
node[propertyInfo.propertyName] = value; | |
} else { | |
var attributeName = propertyInfo.attributeName; | |
var namespace = propertyInfo.attributeNamespace; | |
// `setAttribute` with objects becomes only `[object]` in IE8/9, | |
// ('' + value) makes it output the correct toString()-value. | |
if (namespace) { | |
node.setAttributeNS(namespace, attributeName, '' + value); | |
} else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { | |
node.setAttribute(attributeName, ''); | |
} else { | |
node.setAttribute(attributeName, '' + value); | |
} | |
} | |
} else if (DOMProperty.isCustomAttribute(name)) { | |
DOMPropertyOperations.setValueForAttribute(node, name, value); | |
return; | |
} | |
if (false) { | |
var payload = {}; | |
payload[name] = value; | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, | |
type: 'update attribute', | |
payload: payload | |
}); | |
} | |
}, | |
setValueForAttribute: function (node, name, value) { | |
if (!isAttributeNameSafe(name)) { | |
return; | |
} | |
if (value == null) { | |
node.removeAttribute(name); | |
} else { | |
node.setAttribute(name, '' + value); | |
} | |
if (false) { | |
var payload = {}; | |
payload[name] = value; | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, | |
type: 'update attribute', | |
payload: payload | |
}); | |
} | |
}, | |
/** | |
* Deletes an attributes from a node. | |
* | |
* @param {DOMElement} node | |
* @param {string} name | |
*/ | |
deleteValueForAttribute: function (node, name) { | |
node.removeAttribute(name); | |
if (false) { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, | |
type: 'remove attribute', | |
payload: name | |
}); | |
} | |
}, | |
/** | |
* Deletes the value for a property on a node. | |
* | |
* @param {DOMElement} node | |
* @param {string} name | |
*/ | |
deleteValueForProperty: function (node, name) { | |
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | |
if (propertyInfo) { | |
var mutationMethod = propertyInfo.mutationMethod; | |
if (mutationMethod) { | |
mutationMethod(node, undefined); | |
} else if (propertyInfo.mustUseProperty) { | |
var propName = propertyInfo.propertyName; | |
if (propertyInfo.hasBooleanValue) { | |
node[propName] = false; | |
} else { | |
node[propName] = ''; | |
} | |
} else { | |
node.removeAttribute(propertyInfo.attributeName); | |
} | |
} else if (DOMProperty.isCustomAttribute(name)) { | |
node.removeAttribute(name); | |
} | |
if (false) { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, | |
type: 'remove attribute', | |
payload: name | |
}); | |
} | |
} | |
}; | |
module.exports = DOMPropertyOperations; | |
/***/ }), | |
/* 61 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2015-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ReactDOMComponentFlags = { | |
hasCachedChildNodes: 1 << 0 | |
}; | |
module.exports = ReactDOMComponentFlags; | |
/***/ }), | |
/* 62 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _assign = __webpack_require__(3); | |
var LinkedValueUtils = __webpack_require__(37); | |
var ReactDOMComponentTree = __webpack_require__(4); | |
var ReactUpdates = __webpack_require__(9); | |
var warning = __webpack_require__(1); | |
var didWarnValueLink = false; | |
var didWarnValueDefaultValue = false; | |
function updateOptionsIfPendingUpdateAndMounted() { | |
if (this._rootNodeID && this._wrapperState.pendingUpdate) { | |
this._wrapperState.pendingUpdate = false; | |
var props = this._currentElement.props; | |
var value = LinkedValueUtils.getValue(props); | |
if (value != null) { | |
updateOptions(this, Boolean(props.multiple), value); | |
} | |
} | |
} | |
function getDeclarationErrorAddendum(owner) { | |
if (owner) { | |
var name = owner.getName(); | |
if (name) { | |
return ' Check the render method of `' + name + '`.'; | |
} | |
} | |
return ''; | |
} | |
var valuePropNames = ['value', 'defaultValue']; | |
/** | |
* Validation function for `value` and `defaultValue`. | |
* @private | |
*/ | |
function checkSelectPropTypes(inst, props) { | |
var owner = inst._currentElement._owner; | |
LinkedValueUtils.checkPropTypes('select', props, owner); | |
if (props.valueLink !== undefined && !didWarnValueLink) { | |
false ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0; | |
didWarnValueLink = true; | |
} | |
for (var i = 0; i < valuePropNames.length; i++) { | |
var propName = valuePropNames[i]; | |
if (props[propName] == null) { | |
continue; | |
} | |
var isArray = Array.isArray(props[propName]); | |
if (props.multiple && !isArray) { | |
false ? warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0; | |
} else if (!props.multiple && isArray) { | |
false ? warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0; | |
} | |
} | |
} | |
/** | |
* @param {ReactDOMComponent} inst | |
* @param {boolean} multiple | |
* @param {*} propValue A stringable (with `multiple`, a list of stringables). | |
* @private | |
*/ | |
function updateOptions(inst, multiple, propValue) { | |
var selectedValue, i; | |
var options = ReactDOMComponentTree.getNodeFromInstance(inst).options; | |
if (multiple) { | |
selectedValue = {}; | |
for (i = 0; i < propValue.length; i++) { | |
selectedValue['' + propValue[i]] = true; | |
} | |
for (i = 0; i < options.length; i++) { | |
var selected = selectedValue.hasOwnProperty(options[i].value); | |
if (options[i].selected !== selected) { | |
options[i].selected = selected; | |
} | |
} | |
} else { | |
// Do not set `select.value` as exact behavior isn't consistent across all | |
// browsers for all cases. | |
selectedValue = '' + propValue; | |
for (i = 0; i < options.length; i++) { | |
if (options[i].value === selectedValue) { | |
options[i].selected = true; | |
return; | |
} | |
} | |
if (options.length) { | |
options[0].selected = true; | |
} | |
} | |
} | |
/** | |
* Implements a <select> host component that allows optionally setting the | |
* props `value` and `defaultValue`. If `multiple` is false, the prop must be a | |
* stringable. If `multiple` is true, the prop must be an array of stringables. | |
* | |
* If `value` is not supplied (or null/undefined), user actions that change the | |
* selected option will trigger updates to the rendered options. | |
* | |
* If it is supplied (and not null/undefined), the rendered options will not | |
* update in response to user actions. Instead, the `value` prop must change in | |
* order for the rendered options to update. | |
* | |
* If `defaultValue` is provided, any options with the supplied values will be | |
* selected. | |
*/ | |
var ReactDOMSelect = { | |
getHostProps: function (inst, props) { | |
return _assign({}, props, { | |
onChange: inst._wrapperState.onChange, | |
value: undefined | |
}); | |
}, | |
mountWrapper: function (inst, props) { | |
if (false) { | |
checkSelectPropTypes(inst, props); | |
} | |
var value = LinkedValueUtils.getValue(props); | |
inst._wrapperState = { | |
pendingUpdate: false, | |
initialValue: value != null ? value : props.defaultValue, | |
listeners: null, | |
onChange: _handleChange.bind(inst), | |
wasMultiple: Boolean(props.multiple) | |
}; | |
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { | |
false ? warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0; | |
didWarnValueDefaultValue = true; | |
} | |
}, | |
getSelectValueContext: function (inst) { | |
// ReactDOMOption looks at this initial value so the initial generated | |
// markup has correct `selected` attributes | |
return inst._wrapperState.initialValue; | |
}, | |
postUpdateWrapper: function (inst) { | |
var props = inst._currentElement.props; | |
// After the initial mount, we control selected-ness manually so don't pass | |
// this value down | |
inst._wrapperState.initialValue = undefined; | |
var wasMultiple = inst._wrapperState.wasMultiple; | |
inst._wrapperState.wasMultiple = Boolean(props.multiple); | |
var value = LinkedValueUtils.getValue(props); | |
if (value != null) { | |
inst._wrapperState.pendingUpdate = false; | |
updateOptions(inst, Boolean(props.multiple), value); | |
} else if (wasMultiple !== Boolean(props.multiple)) { | |
// For simplicity, reapply `defaultValue` if `multiple` is toggled. | |
if (props.defaultValue != null) { | |
updateOptions(inst, Boolean(props.multiple), props.defaultValue); | |
} else { | |
// Revert the select back to its default unselected state. | |
updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : ''); | |
} | |
} | |
} | |
}; | |
function _handleChange(event) { | |
var props = this._currentElement.props; | |
var returnValue = LinkedValueUtils.executeOnChange(props, event); | |
if (this._rootNodeID) { | |
this._wrapperState.pendingUpdate = true; | |
} | |
ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this); | |
return returnValue; | |
} | |
module.exports = ReactDOMSelect; | |
/***/ }), | |
/* 63 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2014-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var emptyComponentFactory; | |
var ReactEmptyComponentInjection = { | |
injectEmptyComponentFactory: function (factory) { | |
emptyComponentFactory = factory; | |
} | |
}; | |
var ReactEmptyComponent = { | |
create: function (instantiate) { | |
return emptyComponentFactory(instantiate); | |
} | |
}; | |
ReactEmptyComponent.injection = ReactEmptyComponentInjection; | |
module.exports = ReactEmptyComponent; | |
/***/ }), | |
/* 64 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var ReactFeatureFlags = { | |
// When true, call console.time() before and .timeEnd() after each top-level | |
// render (both initial renders and updates). Useful when looking at prod-mode | |
// timeline profiles in Chrome, for example. | |
logTopLevelRenders: false | |
}; | |
module.exports = ReactFeatureFlags; | |
/***/ }), | |
/* 65 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2014-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(2); | |
var invariant = __webpack_require__(0); | |
var genericComponentClass = null; | |
var textComponentClass = null; | |
var ReactHostComponentInjection = { | |
// This accepts a class that receives the tag string. This is a catch all | |
// that can render any kind of tag. | |
injectGenericComponentClass: function (componentClass) { | |
genericComponentClass = componentClass; | |
}, | |
// This accepts a text component class that takes the text string to be | |
// rendered as props. | |
injectTextComponentClass: function (componentClass) { | |
textComponentClass = componentClass; | |
} | |
}; | |
/** | |
* Get a host internal component class for a specific tag. | |
* | |
* @param {ReactElement} element The element to create. | |
* @return {function} The internal class constructor function. | |
*/ | |
function createInternalComponent(element) { | |
!genericComponentClass ? false ? invariant(false, 'There is no registered component for the tag %s', element.type) : _prodInvariant('111', element.type) : void 0; | |
return new genericComponentClass(element); | |
} | |
/** | |
* @param {ReactText} text | |
* @return {ReactComponent} | |
*/ | |
function createInstanceForText(text) { | |
return new textComponentClass(text); | |
} | |
/** | |
* @param {ReactComponent} component | |
* @return {boolean} | |
*/ | |
function isTextComponent(component) { | |
return component instanceof textComponentClass; | |
} | |
var ReactHostComponent = { | |
createInternalComponent: createInternalComponent, | |
createInstanceForText: createInstanceForText, | |
isTextComponent: isTextComponent, | |
injection: ReactHostComponentInjection | |
}; | |
module.exports = ReactHostComponent; | |
/***/ }), | |
/* 66 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ReactDOMSelection = __webpack_require__(140); | |
var containsNode = __webpack_require__(97); | |
var focusNode = __webpack_require__(51); | |
var getActiveElement = __webpack_require__(52); | |
function isInDocument(node) { | |
return containsNode(document.documentElement, node); | |
} | |
/** | |
* @ReactInputSelection: React input selection module. Based on Selection.js, | |
* but modified to be suitable for react and has a couple of bug fixes (doesn't | |
* assume buttons have range selections allowed). | |
* Input selection module for React. | |
*/ | |
var ReactInputSelection = { | |
hasSelectionCapabilities: function (elem) { | |
var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); | |
return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true'); | |
}, | |
getSelectionInformation: function () { | |
var focusedElem = getActiveElement(); | |
return { | |
focusedElem: focusedElem, | |
selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null | |
}; | |
}, | |
/** | |
* @restoreSelection: If any selection information was potentially lost, | |
* restore it. This is useful when performing operations that could remove dom | |
* nodes and place them back in, resulting in focus being lost. | |
*/ | |
restoreSelection: function (priorSelectionInformation) { | |
var curFocusedElem = getActiveElement(); | |
var priorFocusedElem = priorSelectionInformation.focusedElem; | |
var priorSelectionRange = priorSelectionInformation.selectionRange; | |
if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { | |
if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) { | |
ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange); | |
} | |
focusNode(priorFocusedElem); | |
} | |
}, | |
/** | |
* @getSelection: Gets the selection bounds of a focused textarea, input or | |
* contentEditable node. | |
* -@input: Look up selection bounds of this input | |
* -@return {start: selectionStart, end: selectionEnd} | |
*/ | |
getSelection: function (input) { | |
var selection; | |
if ('selectionStart' in input) { | |
// Modern browser with input or textarea. | |
selection = { | |
start: input.selectionStart, | |
end: input.selectionEnd | |
}; | |
} else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') { | |
// IE8 input. | |
var range = document.selection.createRange(); | |
// There can only be one selection per document in IE, so it must | |
// be in our element. | |
if (range.parentElement() === input) { | |
selection = { | |
start: -range.moveStart('character', -input.value.length), | |
end: -range.moveEnd('character', -input.value.length) | |
}; | |
} | |
} else { | |
// Content editable or old IE textarea. | |
selection = ReactDOMSelection.getOffsets(input); | |
} | |
return selection || { start: 0, end: 0 }; | |
}, | |
/** | |
* @setSelection: Sets the selection bounds of a textarea or input and focuses | |
* the input. | |
* -@input Set selection bounds of this input or textarea | |
* -@offsets Object of same form that is returned from get* | |
*/ | |
setSelection: function (input, offsets) { | |
var start = offsets.start; | |
var end = offsets.end; | |
if (end === undefined) { | |
end = start; | |
} | |
if ('selectionStart' in input) { | |
input.selectionStart = start; | |
input.selectionEnd = Math.min(end, input.value.length); | |
} else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') { | |
var range = input.createTextRange(); | |
range.collapse(true); | |
range.moveStart('character', start); | |
range.moveEnd('character', end - start); | |
range.select(); | |
} else { | |
ReactDOMSelection.setOffsets(input, offsets); | |
} | |
} | |
}; | |
module.exports = ReactInputSelection; | |
/***/ }), | |
/* 67 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(2); | |
var DOMLazyTree = __webpack_require__(14); | |
var DOMProperty = __webpack_require__(15); | |
var React = __webpack_require__(17); | |
var ReactBrowserEventEmitter = __webpack_require__(25); | |
var ReactCurrentOwner = __webpack_require__(11); | |
var ReactDOMComponentTree = __webpack_require__(4); | |
var ReactDOMContainerInfo = __webpack_require__(134); | |
var ReactDOMFeatureFlags = __webpack_require__(136); | |
var ReactFeatureFlags = __webpack_require__(64); | |
var ReactInstanceMap = __webpack_require__(23); | |
var ReactInstrumentation = __webpack_require__(8); | |
var ReactMarkupChecksum = __webpack_require__(150); | |
var ReactReconciler = __webpack_require__(16); | |
var ReactUpdateQueue = __webpack_require__(40); | |
var ReactUpdates = __webpack_require__(9); | |
var emptyObject = __webpack_require__(20); | |
var instantiateReactComponent = __webpack_require__(74); | |
var invariant = __webpack_require__(0); | |
var setInnerHTML = __webpack_require__(29); | |
var shouldUpdateReactComponent = __webpack_require__(46); | |
var warning = __webpack_require__(1); | |
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; | |
var ROOT_ATTR_NAME = DOMProperty.ROOT_ATTRIBUTE_NAME; | |
var ELEMENT_NODE_TYPE = 1; | |
var DOC_NODE_TYPE = 9; | |
var DOCUMENT_FRAGMENT_NODE_TYPE = 11; | |
var instancesByReactRootID = {}; | |
/** | |
* Finds the index of the first character | |
* that's not common between the two given strings. | |
* | |
* @return {number} the index of the character where the strings diverge | |
*/ | |
function firstDifferenceIndex(string1, string2) { | |
var minLen = Math.min(string1.length, string2.length); | |
for (var i = 0; i < minLen; i++) { | |
if (string1.charAt(i) !== string2.charAt(i)) { | |
return i; | |
} | |
} | |
return string1.length === string2.length ? -1 : minLen; | |
} | |
/** | |
* @param {DOMElement|DOMDocument} container DOM element that may contain | |
* a React component | |
* @return {?*} DOM element that may have the reactRoot ID, or null. | |
*/ | |
function getReactRootElementInContainer(container) { | |
if (!container) { | |
return null; | |
} | |
if (container.nodeType === DOC_NODE_TYPE) { | |
return container.documentElement; | |
} else { | |
return container.firstChild; | |
} | |
} | |
function internalGetID(node) { | |
// If node is something like a window, document, or text node, none of | |
// which support attributes or a .getAttribute method, gracefully return | |
// the empty string, as if the attribute were missing. | |
return node.getAttribute && node.getAttribute(ATTR_NAME) || ''; | |
} | |
/** | |
* Mounts this component and inserts it into the DOM. | |
* | |
* @param {ReactComponent} componentInstance The instance to mount. | |
* @param {DOMElement} container DOM element to mount into. | |
* @param {ReactReconcileTransaction} transaction | |
* @param {boolean} shouldReuseMarkup If true, do not insert markup | |
*/ | |
function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) { | |
var markerName; | |
if (ReactFeatureFlags.logTopLevelRenders) { | |
var wrappedElement = wrapperInstance._currentElement.props.child; | |
var type = wrappedElement.type; | |
markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name); | |
console.time(markerName); | |
} | |
var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context, 0 /* parentDebugID */ | |
); | |
if (markerName) { | |
console.timeEnd(markerName); | |
} | |
wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance; | |
ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction); | |
} | |
/** | |
* Batched mount. | |
* | |
* @param {ReactComponent} componentInstance The instance to mount. | |
* @param {DOMElement} container DOM element to mount into. | |
* @param {boolean} shouldReuseMarkup If true, do not insert markup | |
*/ | |
function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) { | |
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled( | |
/* useCreateElement */ | |
!shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement); | |
transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context); | |
ReactUpdates.ReactReconcileTransaction.release(transaction); | |
} | |
/** | |
* Unmounts a component and removes it from the DOM. | |
* | |
* @param {ReactComponent} instance React component instance. | |
* @param {DOMElement} container DOM element to unmount from. | |
* @final | |
* @internal | |
* @see {ReactMount.unmountComponentAtNode} | |
*/ | |
function unmountComponentFromNode(instance, container, safely) { | |
if (false) { | |
ReactInstrumentation.debugTool.onBeginFlush(); | |
} | |
ReactReconciler.unmountComponent(instance, safely); | |
if (false) { | |
ReactInstrumentation.debugTool.onEndFlush(); | |
} | |
if (container.nodeType === DOC_NODE_TYPE) { | |
container = container.documentElement; | |
} | |
// http://jsperf.com/emptying-a-node | |
while (container.lastChild) { | |
container.removeChild(container.lastChild); | |
} | |
} | |
/** | |
* True if the supplied DOM node has a direct React-rendered child that is | |
* not a React root element. Useful for warning in `render`, | |
* `unmountComponentAtNode`, etc. | |
* | |
* @param {?DOMElement} node The candidate DOM node. | |
* @return {boolean} True if the DOM element contains a direct child that was | |
* rendered by React but is not a root element. | |
* @internal | |
*/ | |
function hasNonRootReactChild(container) { | |
var rootEl = getReactRootElementInContainer(container); | |
if (rootEl) { | |
var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl); | |
return !!(inst && inst._hostParent); | |
} | |
} | |
/** | |
* True if the supplied DOM node is a React DOM element and | |
* it has been rendered by another copy of React. | |
* | |
* @param {?DOMElement} node The candidate DOM node. | |
* @return {boolean} True if the DOM has been rendered by another copy of React | |
* @internal | |
*/ | |
function nodeIsRenderedByOtherInstance(container) { | |
var rootEl = getReactRootElementInContainer(container); | |
return !!(rootEl && isReactNode(rootEl) && !ReactDOMComponentTree.getInstanceFromNode(rootEl)); | |
} | |
/** | |
* True if the supplied DOM node is a valid node element. | |
* | |
* @param {?DOMElement} node The candidate DOM node. | |
* @return {boolean} True if the DOM is a valid DOM node. | |
* @internal | |
*/ | |
function isValidContainer(node) { | |
return !!(node && (node.nodeType === ELEMENT_NODE_TYPE || node.nodeType === DOC_NODE_TYPE || node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)); | |
} | |
/** | |
* True if the supplied DOM node is a valid React node element. | |
* | |
* @param {?DOMElement} node The candidate DOM node. | |
* @return {boolean} True if the DOM is a valid React DOM node. | |
* @internal | |
*/ | |
function isReactNode(node) { | |
return isValidContainer(node) && (node.hasAttribute(ROOT_ATTR_NAME) || node.hasAttribute(ATTR_NAME)); | |
} | |
function getHostRootInstanceInContainer(container) { | |
var rootEl = getReactRootElementInContainer(container); | |
var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl); | |
return prevHostInstance && !prevHostInstance._hostParent ? prevHostInstance : null; | |
} | |
function getTopLevelWrapperInContainer(container) { | |
var root = getHostRootInstanceInContainer(container); | |
return root ? root._hostContainerInfo._topLevelWrapper : null; | |
} | |
/** | |
* Temporary (?) hack so that we can store all top-level pending updates on | |
* composites instead of having to worry about different types of components | |
* here. | |
*/ | |
var topLevelRootCounter = 1; | |
var TopLevelWrapper = function () { | |
this.rootID = topLevelRootCounter++; | |
}; | |
TopLevelWrapper.prototype.isReactComponent = {}; | |
if (false) { | |
TopLevelWrapper.displayName = 'TopLevelWrapper'; | |
} | |
TopLevelWrapper.prototype.render = function () { | |
return this.props.child; | |
}; | |
TopLevelWrapper.isReactTopLevelWrapper = true; | |
/** | |
* Mounting is the process of initializing a React component by creating its | |
* representative DOM elements and inserting them into a supplied `container`. | |
* Any prior content inside `container` is destroyed in the process. | |
* | |
* ReactMount.render( | |
* component, | |
* document.getElementById('container') | |
* ); | |
* | |
* <div id="container"> <-- Supplied `container`. | |
* <div data-reactid=".3"> <-- Rendered reactRoot of React | |
* // ... component. | |
* </div> | |
* </div> | |
* | |
* Inside of `container`, the first element rendered is the "reactRoot". | |
*/ | |
var ReactMount = { | |
TopLevelWrapper: TopLevelWrapper, | |
/** | |
* Used by devtools. The keys are not important. | |
*/ | |
_instancesByReactRootID: instancesByReactRootID, | |
/** | |
* This is a hook provided to support rendering React components while | |
* ensuring that the apparent scroll position of its `container` does not | |
* change. | |
* | |
* @param {DOMElement} container The `container` being rendered into. | |
* @param {function} renderCallback This must be called once to do the render. | |
*/ | |
scrollMonitor: function (container, renderCallback) { | |
renderCallback(); | |
}, | |
/** | |
* Take a component that's already mounted into the DOM and replace its props | |
* @param {ReactComponent} prevComponent component instance already in the DOM | |
* @param {ReactElement} nextElement component instance to render | |
* @param {DOMElement} container container to render into | |
* @param {?function} callback function triggered on completion | |
*/ | |
_updateRootComponent: function (prevComponent, nextElement, nextContext, container, callback) { | |
ReactMount.scrollMonitor(container, function () { | |
ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement, nextContext); | |
if (callback) { | |
ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback); | |
} | |
}); | |
return prevComponent; | |
}, | |
/** | |
* Render a new component into the DOM. Hooked by hooks! | |
* | |
* @param {ReactElement} nextElement element to render | |
* @param {DOMElement} container container to render into | |
* @param {boolean} shouldReuseMarkup if we should skip the markup insertion | |
* @return {ReactComponent} nextComponent | |
*/ | |
_renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) { | |
// Various parts of our code (such as ReactCompositeComponent's | |
// _renderValidatedComponent) assume that calls to render aren't nested; | |
// verify that that's the case. | |
false ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0; | |
!isValidContainer(container) ? false ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : _prodInvariant('37') : void 0; | |
ReactBrowserEventEmitter.ensureScrollValueMonitoring(); | |
var componentInstance = instantiateReactComponent(nextElement, false); | |
// The initial render is synchronous but any updates that happen during | |
// rendering, in componentWillMount or componentDidMount, will be batched | |
// according to the current batching strategy. | |
ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, container, shouldReuseMarkup, context); | |
var wrapperID = componentInstance._instance.rootID; | |
instancesByReactRootID[wrapperID] = componentInstance; | |
return componentInstance; | |
}, | |
/** | |
* Renders a React component into the DOM in the supplied `container`. | |
* | |
* If the React component was previously rendered into `container`, this will | |
* perform an update on it and only mutate the DOM as necessary to reflect the | |
* latest React component. | |
* | |
* @param {ReactComponent} parentComponent The conceptual parent of this render tree. | |
* @param {ReactElement} nextElement Component element to render. | |
* @param {DOMElement} container DOM element to render into. | |
* @param {?function} callback function triggered on completion | |
* @return {ReactComponent} Component instance rendered in `container`. | |
*/ | |
renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { | |
!(parentComponent != null && ReactInstanceMap.has(parentComponent)) ? false ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0; | |
return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback); | |
}, | |
_renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { | |
ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render'); | |
!React.isValidElement(nextElement) ? false ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : | |
// Check if it quacks like an element | |
nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : _prodInvariant('39', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : void 0; | |
false ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0; | |
var nextWrappedElement = React.createElement(TopLevelWrapper, { child: nextElement }); | |
var nextContext; | |
if (parentComponent) { | |
var parentInst = ReactInstanceMap.get(parentComponent); | |
nextContext = parentInst._processChildContext(parentInst._context); | |
} else { | |
nextContext = emptyObject; | |
} | |
var prevComponent = getTopLevelWrapperInContainer(container); | |
if (prevComponent) { | |
var prevWrappedElement = prevComponent._currentElement; | |
var prevElement = prevWrappedElement.props.child; | |
if (shouldUpdateReactComponent(prevElement, nextElement)) { | |
var publicInst = prevComponent._renderedComponent.getPublicInstance(); | |
var updatedCallback = callback && function () { | |
callback.call(publicInst); | |
}; | |
ReactMount._updateRootComponent(prevComponent, nextWrappedElement, nextContext, container, updatedCallback); | |
return publicInst; | |
} else { | |
ReactMount.unmountComponentAtNode(container); | |
} | |
} | |
var reactRootElement = getReactRootElementInContainer(container); | |
var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement); | |
var containerHasNonRootReactChild = hasNonRootReactChild(container); | |
if (false) { | |
process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : void 0; | |
if (!containerHasReactMarkup || reactRootElement.nextSibling) { | |
var rootElementSibling = reactRootElement; | |
while (rootElementSibling) { | |
if (internalGetID(rootElementSibling)) { | |
process.env.NODE_ENV !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : void 0; | |
break; | |
} | |
rootElementSibling = rootElementSibling.nextSibling; | |
} | |
} | |
} | |
var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild; | |
var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, nextContext)._renderedComponent.getPublicInstance(); | |
if (callback) { | |
callback.call(component); | |
} | |
return component; | |
}, | |
/** | |
* Renders a React component into the DOM in the supplied `container`. | |
* See https://facebook.github.io/react/docs/top-level-api.html#reactdom.render | |
* | |
* If the React component was previously rendered into `container`, this will | |
* perform an update on it and only mutate the DOM as necessary to reflect the | |
* latest React component. | |
* | |
* @param {ReactElement} nextElement Component element to render. | |
* @param {DOMElement} container DOM element to render into. | |
* @param {?function} callback function triggered on completion | |
* @return {ReactComponent} Component instance rendered in `container`. | |
*/ | |
render: function (nextElement, container, callback) { | |
return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback); | |
}, | |
/** | |
* Unmounts and destroys the React component rendered in the `container`. | |
* See https://facebook.github.io/react/docs/top-level-api.html#reactdom.unmountcomponentatnode | |
* | |
* @param {DOMElement} container DOM element containing a React component. | |
* @return {boolean} True if a component was found in and unmounted from | |
* `container` | |
*/ | |
unmountComponentAtNode: function (container) { | |
// Various parts of our code (such as ReactCompositeComponent's | |
// _renderValidatedComponent) assume that calls to render aren't nested; | |
// verify that that's the case. (Strictly speaking, unmounting won't cause a | |
// render but we still don't expect to be in a render call here.) | |
false ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0; | |
!isValidContainer(container) ? false ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : _prodInvariant('40') : void 0; | |
if (false) { | |
process.env.NODE_ENV !== 'production' ? warning(!nodeIsRenderedByOtherInstance(container), 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by another copy of React.') : void 0; | |
} | |
var prevComponent = getTopLevelWrapperInContainer(container); | |
if (!prevComponent) { | |
// Check if the node being unmounted was rendered by React, but isn't a | |
// root node. | |
var containerHasNonRootReactChild = hasNonRootReactChild(container); | |
// Check if the container itself is a React root node. | |
var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME); | |
if (false) { | |
process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0; | |
} | |
return false; | |
} | |
delete instancesByReactRootID[prevComponent._instance.rootID]; | |
ReactUpdates.batchedUpdates(unmountComponentFromNode, prevComponent, container, false); | |
return true; | |
}, | |
_mountImageIntoNode: function (markup, container, instance, shouldReuseMarkup, transaction) { | |
!isValidContainer(container) ? false ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : _prodInvariant('41') : void 0; | |
if (shouldReuseMarkup) { | |
var rootElement = getReactRootElementInContainer(container); | |
if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) { | |
ReactDOMComponentTree.precacheNode(instance, rootElement); | |
return; | |
} else { | |
var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | |
rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | |
var rootMarkup = rootElement.outerHTML; | |
rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum); | |
var normalizedMarkup = markup; | |
if (false) { | |
// because rootMarkup is retrieved from the DOM, various normalizations | |
// will have occurred which will not be present in `markup`. Here, | |
// insert markup into a <div> or <iframe> depending on the container | |
// type to perform the same normalizations before comparing. | |
var normalizer; | |
if (container.nodeType === ELEMENT_NODE_TYPE) { | |
normalizer = document.createElement('div'); | |
normalizer.innerHTML = markup; | |
normalizedMarkup = normalizer.innerHTML; | |
} else { | |
normalizer = document.createElement('iframe'); | |
document.body.appendChild(normalizer); | |
normalizer.contentDocument.write(markup); | |
normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML; | |
document.body.removeChild(normalizer); | |
} | |
} | |
var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup); | |
var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20); | |
!(container.nodeType !== DOC_NODE_TYPE) ? false ? invariant(false, 'You\'re trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side:\n%s', difference) : _prodInvariant('42', difference) : void 0; | |
if (false) { | |
process.env.NODE_ENV !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : void 0; | |
} | |
} | |
} | |
!(container.nodeType !== DOC_NODE_TYPE) ? false ? invariant(false, 'You\'re trying to render a component to the document but you didn\'t use server rendering. We can\'t do this without using server rendering due to cross-browser quirks. See ReactDOMServer.renderToString() for server rendering.') : _prodInvariant('43') : void 0; | |
if (transaction.useCreateElement) { | |
while (container.lastChild) { | |
container.removeChild(container.lastChild); | |
} | |
DOMLazyTree.insertTreeBefore(container, markup, null); | |
} else { | |
setInnerHTML(container, markup); | |
ReactDOMComponentTree.precacheNode(instance, container.firstChild); | |
} | |
if (false) { | |
var hostNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild); | |
if (hostNode._debugID !== 0) { | |
ReactInstrumentation.debugTool.onHostOperation({ | |
instanceID: hostNode._debugID, | |
type: 'mount', | |
payload: markup.toString() | |
}); | |
} | |
} | |
} | |
}; | |
module.exports = ReactMount; | |
/***/ }), | |
/* 68 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(2); | |
var React = __webpack_require__(17); | |
var invariant = __webpack_require__(0); | |
var ReactNodeTypes = { | |
HOST: 0, | |
COMPOSITE: 1, | |
EMPTY: 2, | |
getType: function (node) { | |
if (node === null || node === false) { | |
return ReactNodeTypes.EMPTY; | |
} else if (React.isValidElement(node)) { | |
if (typeof node.type === 'function') { | |
return ReactNodeTypes.COMPOSITE; | |
} else { | |
return ReactNodeTypes.HOST; | |
} | |
} | |
true ? false ? invariant(false, 'Unexpected node: %s', node) : _prodInvariant('26', node) : void 0; | |
} | |
}; | |
module.exports = ReactNodeTypes; | |
/***/ }), | |
/* 69 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ViewportMetrics = { | |
currentScrollLeft: 0, | |
currentScrollTop: 0, | |
refreshScrollValues: function (scrollPosition) { | |
ViewportMetrics.currentScrollLeft = scrollPosition.x; | |
ViewportMetrics.currentScrollTop = scrollPosition.y; | |
} | |
}; | |
module.exports = ViewportMetrics; | |
/***/ }), | |
/* 70 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2014-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(2); | |
var invariant = __webpack_require__(0); | |
/** | |
* Accumulates items that must not be null or undefined into the first one. This | |
* is used to conserve memory by avoiding array allocations, and thus sacrifices | |
* API cleanness. Since `current` can be null before being passed in and not | |
* null after this function, make sure to assign it back to `current`: | |
* | |
* `a = accumulateInto(a, b);` | |
* | |
* This API should be sparingly used. Try `accumulate` for something cleaner. | |
* | |
* @return {*|array<*>} An accumulation of items. | |
*/ | |
function accumulateInto(current, next) { | |
!(next != null) ? false ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0; | |
if (current == null) { | |
return next; | |
} | |
// Both are not empty. Warning: Never call x.concat(y) when you are not | |
// certain that x is an Array (x could be a string with concat method). | |
if (Array.isArray(current)) { | |
if (Array.isArray(next)) { | |
current.push.apply(current, next); | |
return current; | |
} | |
current.push(next); | |
return current; | |
} | |
if (Array.isArray(next)) { | |
// A bit too dangerous to mutate `next`. | |
return [current].concat(next); | |
} | |
return [current, next]; | |
} | |
module.exports = accumulateInto; | |
/***/ }), | |
/* 71 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
/** | |
* @param {array} arr an "accumulation" of items which is either an Array or | |
* a single item. Useful when paired with the `accumulate` module. This is a | |
* simple utility that allows us to reason about a collection of items, but | |
* handling the case when there is exactly one item (and we do not need to | |
* allocate an array). | |
*/ | |
function forEachAccumulated(arr, cb, scope) { | |
if (Array.isArray(arr)) { | |
arr.forEach(cb, scope); | |
} else if (arr) { | |
cb.call(scope, arr); | |
} | |
} | |
module.exports = forEachAccumulated; | |
/***/ }), | |
/* 72 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ReactNodeTypes = __webpack_require__(68); | |
function getHostComponentFromComposite(inst) { | |
var type; | |
while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) { | |
inst = inst._renderedComponent; | |
} | |
if (type === ReactNodeTypes.HOST) { | |
return inst._renderedComponent; | |
} else if (type === ReactNodeTypes.EMPTY) { | |
return null; | |
} | |
} | |
module.exports = getHostComponentFromComposite; | |
/***/ }), | |
/* 73 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ExecutionEnvironment = __webpack_require__(5); | |
var contentKey = null; | |
/** | |
* Gets the key used to access text content on a DOM node. | |
* | |
* @return {?string} Key used to access text content. | |
* @internal | |
*/ | |
function getTextContentAccessor() { | |
if (!contentKey && ExecutionEnvironment.canUseDOM) { | |
// Prefer textContent to innerText because many browsers support both but | |
// SVG <text> elements don't support innerText even when <div> does. | |
contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText'; | |
} | |
return contentKey; | |
} | |
module.exports = getTextContentAccessor; | |
/***/ }), | |
/* 74 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(2), | |
_assign = __webpack_require__(3); | |
var ReactCompositeComponent = __webpack_require__(131); | |
var ReactEmptyComponent = __webpack_require__(63); | |
var ReactHostComponent = __webpack_require__(65); | |
var getNextDebugID = __webpack_require__(205); | |
var invariant = __webpack_require__(0); | |
var warning = __webpack_require__(1); | |
// To avoid a cyclic dependency, we create the final class in this module | |
var ReactCompositeComponentWrapper = function (element) { | |
this.construct(element); | |
}; | |
function getDeclarationErrorAddendum(owner) { | |
if (owner) { | |
var name = owner.getName(); | |
if (name) { | |
return ' Check the render method of `' + name + '`.'; | |
} | |
} | |
return ''; | |
} | |
/** | |
* Check if the type reference is a known internal type. I.e. not a user | |
* provided composite type. | |
* | |
* @param {function} type | |
* @return {boolean} Returns true if this is a valid internal type. | |
*/ | |
function isInternalComponentType(type) { | |
return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function'; | |
} | |
/** | |
* Given a ReactNode, create an instance that will actually be mounted. | |
* | |
* @param {ReactNode} node | |
* @param {boolean} shouldHaveDebugID | |
* @return {object} A new instance of the element's constructor. | |
* @protected | |
*/ | |
function instantiateReactComponent(node, shouldHaveDebugID) { | |
var instance; | |
if (node === null || node === false) { | |
instance = ReactEmptyComponent.create(instantiateReactComponent); | |
} else if (typeof node === 'object') { | |
var element = node; | |
var type = element.type; | |
if (typeof type !== 'function' && typeof type !== 'string') { | |
var info = ''; | |
if (false) { | |
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { | |
info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.'; | |
} | |
} | |
info += getDeclarationErrorAddendum(element._owner); | |
true ? false ? invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', type == null ? type : typeof type, info) : _prodInvariant('130', type == null ? type : typeof type, info) : void 0; | |
} | |
// Special case string values | |
if (typeof element.type === 'string') { | |
instance = ReactHostComponent.createInternalComponent(element); | |
} else if (isInternalComponentType(element.type)) { | |
// This is temporarily available for custom components that are not string | |
// representations. I.e. ART. Once those are updated to use the string | |
// representation, we can drop this code path. | |
instance = new element.type(element); | |
// We renamed this. Allow the old name for compat. :( | |
if (!instance.getHostNode) { | |
instance.getHostNode = instance.getNativeNode; | |
} | |
} else { | |
instance = new ReactCompositeComponentWrapper(element); | |
} | |
} else if (typeof node === 'string' || typeof node === 'number') { | |
instance = ReactHostComponent.createInstanceForText(node); | |
} else { | |
true ? false ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : _prodInvariant('131', typeof node) : void 0; | |
} | |
if (false) { | |
process.env.NODE_ENV !== 'production' ? warning(typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.getHostNode === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : void 0; | |
} | |
// These two fields are used by the DOM and ART diffing algorithms | |
// respectively. Instead of using expandos on components, we should be | |
// storing the state needed by the diffing algorithms elsewhere. | |
instance._mountIndex = 0; | |
instance._mountImage = null; | |
if (false) { | |
instance._debugID = shouldHaveDebugID ? getNextDebugID() : 0; | |
} | |
// Internal instances should fully constructed at this point, so they should | |
// not get any new fields added to them at this point. | |
if (false) { | |
if (Object.preventExtensions) { | |
Object.preventExtensions(instance); | |
} | |
} | |
return instance; | |
} | |
_assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent, { | |
_instantiateReactComponent: instantiateReactComponent | |
}); | |
module.exports = instantiateReactComponent; | |
/***/ }), | |
/* 75 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
/** | |
* @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary | |
*/ | |
var supportedInputTypes = { | |
'color': true, | |
'date': true, | |
'datetime': true, | |
'datetime-local': true, | |
'email': true, | |
'month': true, | |
'number': true, | |
'password': true, | |
'range': true, | |
'search': true, | |
'tel': true, | |
'text': true, | |
'time': true, | |
'url': true, | |
'week': true | |
}; | |
function isTextInputElement(elem) { | |
var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); | |
if (nodeName === 'input') { | |
return !!supportedInputTypes[elem.type]; | |
} | |
if (nodeName === 'textarea') { | |
return true; | |
} | |
return false; | |
} | |
module.exports = isTextInputElement; | |
/***/ }), | |
/* 76 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ExecutionEnvironment = __webpack_require__(5); | |
var escapeTextContentForBrowser = __webpack_require__(28); | |
var setInnerHTML = __webpack_require__(29); | |
/** | |
* Set the textContent property of a node, ensuring that whitespace is preserved | |
* even in IE8. innerText is a poor substitute for textContent and, among many | |
* issues, inserts <br> instead of the literal newline chars. innerHTML behaves | |
* as it should. | |
* | |
* @param {DOMElement} node | |
* @param {string} text | |
* @internal | |
*/ | |
var setTextContent = function (node, text) { | |
if (text) { | |
var firstChild = node.firstChild; | |
if (firstChild && firstChild === node.lastChild && firstChild.nodeType === 3) { | |
firstChild.nodeValue = text; | |
return; | |
} | |
} | |
node.textContent = text; | |
}; | |
if (ExecutionEnvironment.canUseDOM) { | |
if (!('textContent' in document.documentElement)) { | |
setTextContent = function (node, text) { | |
if (node.nodeType === 3) { | |
node.nodeValue = text; | |
return; | |
} | |
setInnerHTML(node, escapeTextContentForBrowser(text)); | |
}; | |
} | |
} | |
module.exports = setTextContent; | |
/***/ }), | |
/* 77 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(2); | |
var ReactCurrentOwner = __webpack_require__(11); | |
var REACT_ELEMENT_TYPE = __webpack_require__(146); | |
var getIteratorFn = __webpack_require__(177); | |
var invariant = __webpack_require__(0); | |
var KeyEscapeUtils = __webpack_require__(36); | |
var warning = __webpack_require__(1); | |
var SEPARATOR = '.'; | |
var SUBSEPARATOR = ':'; | |
/** | |
* This is inlined from ReactElement since this file is shared between | |
* isomorphic and renderers. We could extract this to a | |
* | |
*/ | |
/** | |
* TODO: Test that a single child and an array with one item have the same key | |
* pattern. | |
*/ | |
var didWarnAboutMaps = false; | |
/** | |
* Generate a key string that identifies a component within a set. | |
* | |
* @param {*} component A component that could contain a manual key. | |
* @param {number} index Index that is used if a manual key is not provided. | |
* @return {string} | |
*/ | |
function getComponentKey(component, index) { | |
// Do some typechecking here since we call this blindly. We want to ensure | |
// that we don't block potential future ES APIs. | |
if (component && typeof component === 'object' && component.key != null) { | |
// Explicit key | |
return KeyEscapeUtils.escape(component.key); | |
} | |
// Implicit key determined by the index in the set | |
return index.toString(36); | |
} | |
/** | |
* @param {?*} children Children tree container. | |
* @param {!string} nameSoFar Name of the key path so far. | |
* @param {!function} callback Callback to invoke with each child found. | |
* @param {?*} traverseContext Used to pass information throughout the traversal | |
* process. | |
* @return {!number} The number of children in this subtree. | |
*/ | |
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { | |
var type = typeof children; | |
if (type === 'undefined' || type === 'boolean') { | |
// All of the above are perceived as null. | |
children = null; | |
} | |
if (children === null || type === 'string' || type === 'number' || | |
// The following is inlined from ReactElement. This means we can optimize | |
// some checks. React Fiber also inlines this logic for similar purposes. | |
type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) { | |
callback(traverseContext, children, | |
// If it's the only child, treat the name as if it was wrapped in an array | |
// so that it's consistent if the number of children grows. | |
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); | |
return 1; | |
} | |
var child; | |
var nextName; | |
var subtreeCount = 0; // Count of children found in the current subtree. | |
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; | |
if (Array.isArray(children)) { | |
for (var i = 0; i < children.length; i++) { | |
child = children[i]; | |
nextName = nextNamePrefix + getComponentKey(child, i); | |
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | |
} | |
} else { | |
var iteratorFn = getIteratorFn(children); | |
if (iteratorFn) { | |
var iterator = iteratorFn.call(children); | |
var step; | |
if (iteratorFn !== children.entries) { | |
var ii = 0; | |
while (!(step = iterator.next()).done) { | |
child = step.value; | |
nextName = nextNamePrefix + getComponentKey(child, ii++); | |
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | |
} | |
} else { | |
if (false) { | |
var mapsAsChildrenAddendum = ''; | |
if (ReactCurrentOwner.current) { | |
var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName(); | |
if (mapsAsChildrenOwnerName) { | |
mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.'; | |
} | |
} | |
process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0; | |
didWarnAboutMaps = true; | |
} | |
// Iterator will provide entry [k,v] tuples rather than values. | |
while (!(step = iterator.next()).done) { | |
var entry = step.value; | |
if (entry) { | |
child = entry[1]; | |
nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); | |
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | |
} | |
} | |
} | |
} else if (type === 'object') { | |
var addendum = ''; | |
if (false) { | |
addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.'; | |
if (children._isReactElement) { | |
addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.'; | |
} | |
if (ReactCurrentOwner.current) { | |
var name = ReactCurrentOwner.current.getName(); | |
if (name) { | |
addendum += ' Check the render method of `' + name + '`.'; | |
} | |
} | |
} | |
var childrenString = String(children); | |
true ? false ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0; | |
} | |
} | |
return subtreeCount; | |
} | |
/** | |
* Traverses children that are typically specified as `props.children`, but | |
* might also be specified through attributes: | |
* | |
* - `traverseAllChildren(this.props.children, ...)` | |
* - `traverseAllChildren(this.props.leftPanelChildren, ...)` | |
* | |
* The `traverseContext` is an optional argument that is passed through the | |
* entire traversal. It can be used to store accumulations or anything else that | |
* the callback might find relevant. | |
* | |
* @param {?*} children Children tree object. | |
* @param {!function} callback To invoke upon traversing each child. | |
* @param {?*} traverseContext Context for traversal. | |
* @return {!number} The number of children in this subtree. | |
*/ | |
function traverseAllChildren(children, callback, traverseContext) { | |
if (children == null) { | |
return 0; | |
} | |
return traverseAllChildrenImpl(children, '', callback, traverseContext); | |
} | |
module.exports = traverseAllChildren; | |
/***/ }), | |
/* 78 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || (function () { | |
var extendStatics = Object.setPrototypeOf || | |
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | |
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | |
return function (d, b) { | |
extendStatics(d, b); | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
})(); | |
var __assign = (this && this.__assign) || Object.assign || function(t) { | |
for (var s, i = 1, n = arguments.length; i < n; i++) { | |
s = arguments[i]; | |
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | |
t[p] = s[p]; | |
} | |
return t; | |
}; | |
Object.defineProperty(exports, "__esModule", { value: true }); | |
var React = __webpack_require__(6); | |
var PropTypes = __webpack_require__(12); | |
var overlays_1 = __webpack_require__(81); | |
var defaultStyle = { | |
zIndex: 3 | |
}; | |
var ProjectedLayer = (function (_super) { | |
__extends(ProjectedLayer, _super); | |
function ProjectedLayer() { | |
var _this = _super !== null && _super.apply(this, arguments) || this; | |
_this.state = {}; | |
_this.setContainer = function (el) { | |
if (el) { | |
_this.container = el; | |
} | |
}; | |
_this.handleMapMove = function () { | |
if (!_this.prevent) { | |
_this.setState(overlays_1.overlayState(_this.props, _this.context.map, _this.container)); | |
} | |
}; | |
return _this; | |
} | |
ProjectedLayer.prototype.componentDidMount = function () { | |
var map = this.context.map; | |
map.on('move', this.handleMapMove); | |
this.handleMapMove(); | |
}; | |
ProjectedLayer.prototype.componentWillReceiveProps = function (nextProps) { | |
var coordinates = this.props.coordinates; | |
if (coordinates[0] !== nextProps.coordinates[0] | |
|| coordinates[1] !== nextProps.coordinates[1]) { | |
this.setState(overlays_1.overlayState(nextProps, this.context.map, this.container)); | |
} | |
}; | |
ProjectedLayer.prototype.componentWillUnmount = function () { | |
var map = this.context.map; | |
this.prevent = true; | |
map.off('move', this.handleMapMove); | |
}; | |
ProjectedLayer.prototype.render = function () { | |
var _a = this.props, style = _a.style, children = _a.children, className = _a.className, onClick = _a.onClick, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave; | |
var finalStyle = __assign({}, defaultStyle, style, { transform: overlays_1.overlayTransform(this.state).join(' ') }); | |
return (React.createElement("div", { className: className, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, style: finalStyle, ref: this.setContainer }, children)); | |
}; | |
return ProjectedLayer; | |
}(React.Component)); | |
ProjectedLayer.contextTypes = { | |
map: PropTypes.object | |
}; | |
ProjectedLayer.defaultProps = { | |
anchor: overlays_1.anchors[0], | |
offset: 0, | |
onClick: function () { | |
var args = []; | |
for (var _i = 0; _i < arguments.length; _i++) { | |
args[_i] = arguments[_i]; | |
} | |
return args; | |
} | |
}; | |
exports.default = ProjectedLayer; | |
//# sourceMappingURL=projected-layer.js.map | |
/***/ }), | |
/* 79 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { value: true }); | |
exports.getClassName = function (defaultClassName, className) { return (className ? className.split(' ').concat(defaultClassName).join(' ') : defaultClassName.join(' ')); }; | |
//# sourceMappingURL=classname.js.map | |
/***/ }), | |
/* 80 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { value: true }); | |
var reduce = __webpack_require__(208); | |
var find = function (obj, predicate) { return (Object.keys(obj).filter(function (key) { return predicate(obj[key], key); })[0]); }; | |
var diff = function (obj1, obj2) { return (reduce(obj2, function (res, value, key) { | |
var toMutate = res; | |
if (find(obj1, function (v, k) { return key === k && value !== v; })) { | |
toMutate[key] = value; | |
} | |
return toMutate; | |
}, {})); }; | |
exports.default = diff; | |
//# sourceMappingURL=diff.js.map | |
/***/ }), | |
/* 81 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { value: true }); | |
var mapbox_gl_1 = __webpack_require__(53); | |
exports.anchors = [ | |
'center', | |
'top', | |
'bottom', | |
'left', | |
'right', | |
'top-left', | |
'top-right', | |
'bottom-left', | |
'bottom-right' | |
]; | |
exports.anchorTranslates = { | |
'center': 'translate(-50%, -50%)', | |
'top': 'translate(-50%, 0)', | |
'left': 'translate(0, -50%)', | |
'right': 'translate(-100%, -50%)', | |
'bottom': 'translate(-50%, -100%)', | |
'top-left': 'translate(0, 0)', | |
'top-right': 'translate(-100%, 0)', | |
'bottom-left': 'translate(0, -100%)', | |
'bottom-right': 'translate(-100%, -100%)' | |
}; | |
var defaultElement = { offsetWidth: 0, offsetHeight: 0 }; | |
var isPointLike = function (input) { return (input instanceof mapbox_gl_1.Point || Array.isArray(input)); }; | |
var projectCoordinates = function (map, coordinates) { return (map.project(mapbox_gl_1.LngLat.convert(coordinates))); }; | |
var calculateAnchor = function (map, offsets, position, _a) { | |
var _b = _a === void 0 ? defaultElement : _a, offsetHeight = _b.offsetHeight, offsetWidth = _b.offsetWidth; | |
var anchor = []; | |
if (position.y + offsets.bottom.y - offsetHeight < 0) { | |
anchor = [exports.anchors[1]]; | |
} | |
else if (position.y + offsets.top.y + offsetHeight > map.transform.height) { | |
anchor = [exports.anchors[2]]; | |
} | |
if (position.x < offsetWidth / 2) { | |
anchor.push(exports.anchors[3]); | |
} | |
else if (position.x > map.transform.width - offsetWidth / 2) { | |
anchor.push(exports.anchors[4]); | |
} | |
if (anchor.length === 0) { | |
return exports.anchors[2]; | |
} | |
return anchor.join('-'); | |
}; | |
var normalizedOffsets = function (offset) { | |
if (!offset) { | |
return normalizedOffsets(new mapbox_gl_1.Point(0, 0)); | |
} | |
if (typeof offset === 'number') { | |
var cornerOffset = Math.round(Math.sqrt(0.5 * Math.pow(offset, 2))); | |
return { | |
'center': new mapbox_gl_1.Point(offset, offset), | |
'top': new mapbox_gl_1.Point(0, offset), | |
'bottom': new mapbox_gl_1.Point(0, -offset), | |
'left': new mapbox_gl_1.Point(offset, 0), | |
'right': new mapbox_gl_1.Point(-offset, 0), | |
'top-left': new mapbox_gl_1.Point(cornerOffset, cornerOffset), | |
'top-right': new mapbox_gl_1.Point(-cornerOffset, cornerOffset), | |
'bottom-left': new mapbox_gl_1.Point(cornerOffset, -cornerOffset), | |
'bottom-right': new mapbox_gl_1.Point(-cornerOffset, -cornerOffset) | |
}; | |
} | |
if (isPointLike(offset)) { | |
return exports.anchors.reduce(function (res, anchor) { | |
res[anchor] = mapbox_gl_1.Point.convert(offset); | |
return res; | |
}, {}); | |
} | |
return exports.anchors.reduce(function (res, anchor) { | |
res[anchor] = mapbox_gl_1.Point.convert(offset[anchor] || [0, 0]); | |
return res; | |
}, {}); | |
}; | |
exports.overlayState = function (props, map, container) { | |
var position = projectCoordinates(map, props.coordinates); | |
var offsets = normalizedOffsets(props.offset); | |
var anchor = props.anchor | |
|| calculateAnchor(map, offsets, position, container); | |
return { | |
anchor: anchor, | |
position: position, | |
offset: offsets[anchor] | |
}; | |
}; | |
var moveTranslate = function (point) { return (point ? "translate(" + point.x.toFixed(0) + "px, " + point.y.toFixed(0) + "px)" : ''); }; | |
exports.overlayTransform = function (_a) { | |
var anchor = _a.anchor, position = _a.position, offset = _a.offset; | |
var res = [moveTranslate(position)]; | |
if (offset && offset.x !== undefined && offset.y !== undefined) { | |
res.push(moveTranslate(offset)); | |
} | |
if (anchor) { | |
res.push(exports.anchorTranslates[anchor]); | |
} | |
return res; | |
}; | |
//# sourceMappingURL=overlays.js.map | |
/***/ }), | |
/* 82 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { value: true }); | |
var index = 0; | |
exports.generateID = function () { | |
return index += 1; | |
}; | |
//# sourceMappingURL=uid.js.map | |
/***/ }), | |
/* 83 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2016-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var _prodInvariant = __webpack_require__(19); | |
var ReactCurrentOwner = __webpack_require__(11); | |
var invariant = __webpack_require__(0); | |
var warning = __webpack_require__(1); | |
function isNative(fn) { | |
// Based on isNative() from Lodash | |
var funcToString = Function.prototype.toString; | |
var hasOwnProperty = Object.prototype.hasOwnProperty; | |
var reIsNative = RegExp('^' + funcToString | |
// Take an example native function source for comparison | |
.call(hasOwnProperty) | |
// Strip regex characters so we can use it for regex | |
.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') | |
// Remove hasOwnProperty from the template to make it generic | |
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); | |
try { | |
var source = funcToString.call(fn); | |
return reIsNative.test(source); | |
} catch (err) { | |
return false; | |
} | |
} | |
var canUseCollections = | |
// Array.from | |
typeof Array.from === 'function' && | |
// Map | |
typeof Map === 'function' && isNative(Map) && | |
// Map.prototype.keys | |
Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) && | |
// Set | |
typeof Set === 'function' && isNative(Set) && | |
// Set.prototype.keys | |
Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys); | |
var setItem; | |
var getItem; | |
var removeItem; | |
var getItemIDs; | |
var addRoot; | |
var removeRoot; | |
var getRootIDs; | |
if (canUseCollections) { | |
var itemMap = new Map(); | |
var rootIDSet = new Set(); | |
setItem = function (id, item) { | |
itemMap.set(id, item); | |
}; | |
getItem = function (id) { | |
return itemMap.get(id); | |
}; | |
removeItem = function (id) { | |
itemMap['delete'](id); | |
}; | |
getItemIDs = function () { | |
return Array.from(itemMap.keys()); | |
}; | |
addRoot = function (id) { | |
rootIDSet.add(id); | |
}; | |
removeRoot = function (id) { | |
rootIDSet['delete'](id); | |
}; | |
getRootIDs = function () { | |
return Array.from(rootIDSet.keys()); | |
}; | |
} else { | |
var itemByKey = {}; | |
var rootByKey = {}; | |
// Use non-numeric keys to prevent V8 performance issues: | |
// https://github.com/facebook/react/pull/7232 | |
var getKeyFromID = function (id) { | |
return '.' + id; | |
}; | |
var getIDFromKey = function (key) { | |
return parseInt(key.substr(1), 10); | |
}; | |
setItem = function (id, item) { | |
var key = getKeyFromID(id); | |
itemByKey[key] = item; | |
}; | |
getItem = function (id) { | |
var key = getKeyFromID(id); | |
return itemByKey[key]; | |
}; | |
removeItem = function (id) { | |
var key = getKeyFromID(id); | |
delete itemByKey[key]; | |
}; | |
getItemIDs = function () { | |
return Object.keys(itemByKey).map(getIDFromKey); | |
}; | |
addRoot = function (id) { | |
var key = getKeyFromID(id); | |
rootByKey[key] = true; | |
}; | |
removeRoot = function (id) { | |
var key = getKeyFromID(id); | |
delete rootByKey[key]; | |
}; | |
getRootIDs = function () { | |
return Object.keys(rootByKey).map(getIDFromKey); | |
}; | |
} | |
var unmountedIDs = []; | |
function purgeDeep(id) { | |
var item = getItem(id); | |
if (item) { | |
var childIDs = item.childIDs; | |
removeItem(id); | |
childIDs.forEach(purgeDeep); | |
} | |
} | |
function describeComponentFrame(name, source, ownerName) { | |
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : ''); | |
} | |
function getDisplayName(element) { | |
if (element == null) { | |
return '#empty'; | |
} else if (typeof element === 'string' || typeof element === 'number') { | |
return '#text'; | |
} else if (typeof element.type === 'string') { | |
return element.type; | |
} else { | |
return element.type.displayName || element.type.name || 'Unknown'; | |
} | |
} | |
function describeID(id) { | |
var name = ReactComponentTreeHook.getDisplayName(id); | |
var element = ReactComponentTreeHook.getElement(id); | |
var ownerID = ReactComponentTreeHook.getOwnerID(id); | |
var ownerName; | |
if (ownerID) { | |
ownerName = ReactComponentTreeHook.getDisplayName(ownerID); | |
} | |
false ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0; | |
return describeComponentFrame(name, element && element._source, ownerName); | |
} | |
var ReactComponentTreeHook = { | |
onSetChildren: function (id, nextChildIDs) { | |
var item = getItem(id); | |
!item ? false ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0; | |
item.childIDs = nextChildIDs; | |
for (var i = 0; i < nextChildIDs.length; i++) { | |
var nextChildID = nextChildIDs[i]; | |
var nextChild = getItem(nextChildID); | |
!nextChild ? false ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('140') : void 0; | |
!(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? false ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : _prodInvariant('141') : void 0; | |
!nextChild.isMounted ? false ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0; | |
if (nextChild.parentID == null) { | |
nextChild.parentID = id; | |
// TODO: This shouldn't be necessary but mounting a new root during in | |
// componentWillMount currently causes not-yet-mounted components to | |
// be purged from our tree data so their parent id is missing. | |
} | |
!(nextChild.parentID === id) ? false ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : _prodInvariant('142', nextChildID, nextChild.parentID, id) : void 0; | |
} | |
}, | |
onBeforeMountComponent: function (id, element, parentID) { | |
var item = { | |
element: element, | |
parentID: parentID, | |
text: null, | |
childIDs: [], | |
isMounted: false, | |
updateCount: 0 | |
}; | |
setItem(id, item); | |
}, | |
onBeforeUpdateComponent: function (id, element) { | |
var item = getItem(id); | |
if (!item || !item.isMounted) { | |
// We may end up here as a result of setState() in componentWillUnmount(). | |
// In this case, ignore the element. | |
return; | |
} | |
item.element = element; | |
}, | |
onMountComponent: function (id) { | |
var item = getItem(id); | |
!item ? false ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0; | |
item.isMounted = true; | |
var isRoot = item.parentID === 0; | |
if (isRoot) { | |
addRoot(id); | |
} | |
}, | |
onUpdateComponent: function (id) { | |
var item = getItem(id); | |
if (!item || !item.isMounted) { | |
// We may end up here as a result of setState() in componentWillUnmount(). | |
// In this case, ignore the element. | |
return; | |
} | |
item.updateCount++; | |
}, | |
onUnmountComponent: function (id) { | |
var item = getItem(id); | |
if (item) { | |
// We need to check if it exists. | |
// `item` might not exist if it is inside an error boundary, and a sibling | |
// error boundary child threw while mounting. Then this instance never | |
// got a chance to mount, but it still gets an unmounting event during | |
// the error boundary cleanup. | |
item.isMounted = false; | |
var isRoot = item.parentID === 0; | |
if (isRoot) { | |
removeRoot(id); | |
} | |
} | |
unmountedIDs.push(id); | |
}, | |
purgeUnmountedComponents: function () { | |
if (ReactComponentTreeHook._preventPurging) { | |
// Should only be used for testing. | |
return; | |
} | |
for (var i = 0; i < unmountedIDs.length; i++) { | |
var id = unmountedIDs[i]; | |
purgeDeep(id); | |
} | |
unmountedIDs.length = 0; | |
}, | |
isMounted: function (id) { | |
var item = getItem(id); | |
return item ? item.isMounted : false; | |
}, | |
getCurrentStackAddendum: function (topElement) { | |
var info = ''; | |
if (topElement) { | |
var name = getDisplayName(topElement); | |
var owner = topElement._owner; | |
info += describeComponentFrame(name, topElement._source, owner && owner.getName()); | |
} | |
var currentOwner = ReactCurrentOwner.current; | |
var id = currentOwner && currentOwner._debugID; | |
info += ReactComponentTreeHook.getStackAddendumByID(id); | |
return info; | |
}, | |
getStackAddendumByID: function (id) { | |
var info = ''; | |
while (id) { | |
info += describeID(id); | |
id = ReactComponentTreeHook.getParentID(id); | |
} | |
return info; | |
}, | |
getChildIDs: function (id) { | |
var item = getItem(id); | |
return item ? item.childIDs : []; | |
}, | |
getDisplayName: function (id) { | |
var element = ReactComponentTreeHook.getElement(id); | |
if (!element) { | |
return null; | |
} | |
return getDisplayName(element); | |
}, | |
getElement: function (id) { | |
var item = getItem(id); | |
return item ? item.element : null; | |
}, | |
getOwnerID: function (id) { | |
var element = ReactComponentTreeHook.getElement(id); | |
if (!element || !element._owner) { | |
return null; | |
} | |
return element._owner._debugID; | |
}, | |
getParentID: function (id) { | |
var item = getItem(id); | |
return item ? item.parentID : null; | |
}, | |
getSource: function (id) { | |
var item = getItem(id); | |
var element = item ? item.element : null; | |
var source = element != null ? element._source : null; | |
return source; | |
}, | |
getText: function (id) { | |
var element = ReactComponentTreeHook.getElement(id); | |
if (typeof element === 'string') { | |
return element; | |
} else if (typeof element === 'number') { | |
return '' + element; | |
} else { | |
return null; | |
} | |
}, | |
getUpdateCount: function (id) { | |
var item = getItem(id); | |
return item ? item.updateCount : 0; | |
}, | |
getRootIDs: getRootIDs, | |
getRegisteredIDs: getItemIDs | |
}; | |
module.exports = ReactComponentTreeHook; | |
/***/ }), | |
/* 84 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2014-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
// The Symbol used to tag the ReactElement type. If there is no native Symbol | |
// nor polyfill, then a plain number is used for performance. | |
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; | |
module.exports = REACT_ELEMENT_TYPE; | |
/***/ }), | |
/* 85 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var canDefineProperty = false; | |
if (false) { | |
try { | |
// $FlowFixMe https://github.com/facebook/flow/issues/285 | |
Object.defineProperty({}, 'x', { get: function () {} }); | |
canDefineProperty = true; | |
} catch (x) { | |
// IE will fail on defineProperty | |
} | |
} | |
module.exports = canDefineProperty; | |
/***/ }), | |
/* 86 */ | |
/***/ (function(module, exports) { | |
var g; | |
// This works in non-strict mode | |
g = (function() { | |
return this; | |
})(); | |
try { | |
// This works if eval is allowed (see CSP) | |
g = g || Function("return this")() || (1,eval)("this"); | |
} catch(e) { | |
// This works if the window reference is available | |
if(typeof window === "object") | |
g = window; | |
} | |
// g can still be undefined, but nothing to do about it... | |
// We return undefined, instead of nothing here, so it's | |
// easier to handle this case. if(!global) { ...} | |
module.exports = g; | |
/***/ }), | |
/* 87 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
if (typeof Promise === 'undefined') { | |
// Rejection tracking prevents a common issue where React gets into an | |
// inconsistent state due to an error, but it gets swallowed by a Promise, | |
// and the user has no idea what causes React's erratic future behavior. | |
__webpack_require__(114).enable(); | |
window.Promise = __webpack_require__(113); | |
} | |
// fetch() polyfill for making API calls. | |
__webpack_require__(210); | |
// Object.assign() is commonly used with React. | |
// It will use the native implementation if it's present and isn't buggy. | |
Object.assign = __webpack_require__(3); | |
/***/ }), | |
/* 88 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(6); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react_dom__ = __webpack_require__(118); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react_dom___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_react_dom__); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__App__ = __webpack_require__(90); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__registerServiceWorker__ = __webpack_require__(91); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__index_css__ = __webpack_require__(94); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__index_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__index_css__); | |
__WEBPACK_IMPORTED_MODULE_1_react_dom___default.a.render(__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_2__App__["a" /* default */], null), document.getElementById('root')); | |
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__registerServiceWorker__["a" /* default */])(); | |
/***/ }), | |
/* 89 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(global) { | |
// Use the fastest means possible to execute a task in its own turn, with | |
// priority over other events including IO, animation, reflow, and redraw | |
// events in browsers. | |
// | |
// An exception thrown by a task will permanently interrupt the processing of | |
// subsequent tasks. The higher level `asap` function ensures that if an | |
// exception is thrown by a task, that the task queue will continue flushing as | |
// soon as possible, but if you use `rawAsap` directly, you are responsible to | |
// either ensure that no exceptions are thrown from your task, or to manually | |
// call `rawAsap.requestFlush` if an exception is thrown. | |
module.exports = rawAsap; | |
function rawAsap(task) { | |
if (!queue.length) { | |
requestFlush(); | |
flushing = true; | |
} | |
// Equivalent to push, but avoids a function call. | |
queue[queue.length] = task; | |
} | |
var queue = []; | |
// Once a flush has been requested, no further calls to `requestFlush` are | |
// necessary until the next `flush` completes. | |
var flushing = false; | |
// `requestFlush` is an implementation-specific method that attempts to kick | |
// off a `flush` event as quickly as possible. `flush` will attempt to exhaust | |
// the event queue before yielding to the browser's own event loop. | |
var requestFlush; | |
// The position of the next task to execute in the task queue. This is | |
// preserved between calls to `flush` so that it can be resumed if | |
// a task throws an exception. | |
var index = 0; | |
// If a task schedules additional tasks recursively, the task queue can grow | |
// unbounded. To prevent memory exhaustion, the task queue will periodically | |
// truncate already-completed tasks. | |
var capacity = 1024; | |
// The flush function processes all tasks that have been scheduled with | |
// `rawAsap` unless and until one of those tasks throws an exception. | |
// If a task throws an exception, `flush` ensures that its state will remain | |
// consistent and will resume where it left off when called again. | |
// However, `flush` does not make any arrangements to be called again if an | |
// exception is thrown. | |
function flush() { | |
while (index < queue.length) { | |
var currentIndex = index; | |
// Advance the index before calling the task. This ensures that we will | |
// begin flushing on the next task the task throws an error. | |
index = index + 1; | |
queue[currentIndex].call(); | |
// Prevent leaking memory for long chains of recursive calls to `asap`. | |
// If we call `asap` within tasks scheduled by `asap`, the queue will | |
// grow, but to avoid an O(n) walk for every task we execute, we don't | |
// shift tasks off the queue after they have been executed. | |
// Instead, we periodically shift 1024 tasks off the queue. | |
if (index > capacity) { | |
// Manually shift all values starting at the index back to the | |
// beginning of the queue. | |
for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) { | |
queue[scan] = queue[scan + index]; | |
} | |
queue.length -= index; | |
index = 0; | |
} | |
} | |
queue.length = 0; | |
index = 0; | |
flushing = false; | |
} | |
// `requestFlush` is implemented using a strategy based on data collected from | |
// every available SauceLabs Selenium web driver worker at time of writing. | |
// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593 | |
// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that | |
// have WebKitMutationObserver but not un-prefixed MutationObserver. | |
// Must use `global` or `self` instead of `window` to work in both frames and web | |
// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop. | |
/* globals self */ | |
var scope = typeof global !== "undefined" ? global : self; | |
var BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver; | |
// MutationObservers are desirable because they have high priority and work | |
// reliably everywhere they are implemented. | |
// They are implemented in all modern browsers. | |
// | |
// - Android 4-4.3 | |
// - Chrome 26-34 | |
// - Firefox 14-29 | |
// - Internet Explorer 11 | |
// - iPad Safari 6-7.1 | |
// - iPhone Safari 7-7.1 | |
// - Safari 6-7 | |
if (typeof BrowserMutationObserver === "function") { | |
requestFlush = makeRequestCallFromMutationObserver(flush); | |
// MessageChannels are desirable because they give direct access to the HTML | |
// task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera | |
// 11-12, and in web workers in many engines. | |
// Although message channels yield to any queued rendering and IO tasks, they | |
// would be better than imposing the 4ms delay of timers. | |
// However, they do not work reliably in Internet Explorer or Safari. | |
// Internet Explorer 10 is the only browser that has setImmediate but does | |
// not have MutationObservers. | |
// Although setImmediate yields to the browser's renderer, it would be | |
// preferrable to falling back to setTimeout since it does not have | |
// the minimum 4ms penalty. | |
// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and | |
// Desktop to a lesser extent) that renders both setImmediate and | |
// MessageChannel useless for the purposes of ASAP. | |
// https://github.com/kriskowal/q/issues/396 | |
// Timers are implemented universally. | |
// We fall back to timers in workers in most engines, and in foreground | |
// contexts in the following browsers. | |
// However, note that even this simple case requires nuances to operate in a | |
// broad spectrum of browsers. | |
// | |
// - Firefox 3-13 | |
// - Internet Explorer 6-9 | |
// - iPad Safari 4.3 | |
// - Lynx 2.8.7 | |
} else { | |
requestFlush = makeRequestCallFromTimer(flush); | |
} | |
// `requestFlush` requests that the high priority event queue be flushed as | |
// soon as possible. | |
// This is useful to prevent an error thrown in a task from stalling the event | |
// queue if the exception handled by Node.js’s | |
// `process.on("uncaughtException")` or by a domain. | |
rawAsap.requestFlush = requestFlush; | |
// To request a high priority event, we induce a mutation observer by toggling | |
// the text of a text node between "1" and "-1". | |
function makeRequestCallFromMutationObserver(callback) { | |
var toggle = 1; | |
var observer = new BrowserMutationObserver(callback); | |
var node = document.createTextNode(""); | |
observer.observe(node, {characterData: true}); | |
return function requestCall() { | |
toggle = -toggle; | |
node.data = toggle; | |
}; | |
} | |
// The message channel technique was discovered by Malte Ubl and was the | |
// original foundation for this library. | |
// http://www.nonblocking.io/2011/06/windownexttick.html | |
// Safari 6.0.5 (at least) intermittently fails to create message ports on a | |
// page's first load. Thankfully, this version of Safari supports | |
// MutationObservers, so we don't need to fall back in that case. | |
// function makeRequestCallFromMessageChannel(callback) { | |
// var channel = new MessageChannel(); | |
// channel.port1.onmessage = callback; | |
// return function requestCall() { | |
// channel.port2.postMessage(0); | |
// }; | |
// } | |
// For reasons explained above, we are also unable to use `setImmediate` | |
// under any circumstances. | |
// Even if we were, there is another bug in Internet Explorer 10. | |
// It is not sufficient to assign `setImmediate` to `requestFlush` because | |
// `setImmediate` must be called *by name* and therefore must be wrapped in a | |
// closure. | |
// Never forget. | |
// function makeRequestCallFromSetImmediate(callback) { | |
// return function requestCall() { | |
// setImmediate(callback); | |
// }; | |
// } | |
// Safari 6.0 has a problem where timers will get lost while the user is | |
// scrolling. This problem does not impact ASAP because Safari 6.0 supports | |
// mutation observers, so that implementation is used instead. | |
// However, if we ever elect to use timers in Safari, the prevalent work-around | |
// is to add a scroll event listener that calls for a flush. | |
// `setTimeout` does not call the passed callback if the delay is less than | |
// approximately 7 in web workers in Firefox 8 through 18, and sometimes not | |
// even then. | |
function makeRequestCallFromTimer(callback) { | |
return function requestCall() { | |
// We dispatch a timeout with a specified delay of 0 for engines that | |
// can reliably accommodate that request. This will usually be snapped | |
// to a 4 milisecond delay, but once we're flushing, there's no delay | |
// between events. | |
var timeoutHandle = setTimeout(handleTimer, 0); | |
// However, since this timer gets frequently dropped in Firefox | |
// workers, we enlist an interval handle that will try to fire | |
// an event 20 times per second until it succeeds. | |
var intervalHandle = setInterval(handleTimer, 50); | |
function handleTimer() { | |
// Whichever timer succeeds will cancel both timers and | |
// execute the callback. | |
clearTimeout(timeoutHandle); | |
clearInterval(intervalHandle); | |
callback(); | |
} | |
}; | |
} | |
// This is for `asap.js` only. | |
// Its name will be periodically randomized to break any code that depends on | |
// its existence. | |
rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer; | |
// ASAP was originally a nextTick shim included in Q. This was factored out | |
// into this ASAP package. It was later adapted to RSVP which made further | |
// amendments. These decisions, particularly to marginalize MessageChannel and | |
// to capture the MutationObserver implementation in a closure, were integrated | |
// back into ASAP proper. | |
// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(86))) | |
/***/ }), | |
/* 90 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(6); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react_mapbox_gl__ = __webpack_require__(186); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react_mapbox_gl___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_react_mapbox_gl__); | |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | |
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | |
var App = function (_Component) { | |
_inherits(App, _Component); | |
function App() { | |
_classCallCheck(this, App); | |
return _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).apply(this, arguments)); | |
} | |
_createClass(App, [{ | |
key: "render", | |
value: function render() { | |
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_1_react_mapbox_gl___default.a, { | |
style: "mapbox://styles/mapbox/streets-v8", | |
accessToken: "pk.eyJ1IjoiZGF2aWRhc2NoZXIiLCJhIjoiY2l2dTBlc2swMDAzcjJ0bW4xdTJ1ZGZhZSJ9.uxbzY-xlJ1FJ7lu95S_9cw", | |
containerStyle: { | |
height: "100vh", | |
width: "100vw" | |
} | |
}); | |
} | |
}]); | |
return App; | |
}(__WEBPACK_IMPORTED_MODULE_0_react__["Component"]); | |
/* harmony default export */ __webpack_exports__["a"] = (App); | |
/***/ }), | |
/* 91 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* harmony export (immutable) */ __webpack_exports__["a"] = register; | |
/* unused harmony export unregister */ | |
// In production, we register a service worker to serve assets from local cache. | |
// This lets the app load faster on subsequent visits in production, and gives | |
// it offline capabilities. However, it also means that developers (and users) | |
// will only see deployed updates on the "N+1" visit to a page, since previously | |
// cached resources are updated in the background. | |
// To learn more about the benefits of this model, read https://goo.gl/KwvDNy. | |
// This link also includes instructions on opting out of this behavior. | |
function register() { | |
if ("production" === 'production' && 'serviceWorker' in navigator) { | |
window.addEventListener('load', function () { | |
var swUrl = "" + '/service-worker.js'; | |
navigator.serviceWorker.register(swUrl).then(function (registration) { | |
registration.onupdatefound = function () { | |
var installingWorker = registration.installing; | |
installingWorker.onstatechange = function () { | |
if (installingWorker.state === 'installed') { | |
if (navigator.serviceWorker.controller) { | |
// At this point, the old content will have been purged and | |
// the fresh content will have been added to the cache. | |
// It's the perfect time to display a "New content is | |
// available; please refresh." message in your web app. | |
console.log('New content is available; please refresh.'); | |
} else { | |
// At this point, everything has been precached. | |
// It's the perfect time to display a | |
// "Content is cached for offline use." message. | |
console.log('Content is cached for offline use.'); | |
} | |
} | |
}; | |
}; | |
}).catch(function (error) { | |
console.error('Error during service worker registration:', error); | |
}); | |
}); | |
} | |
} | |
function unregister() { | |
if ('serviceWorker' in navigator) { | |
navigator.serviceWorker.ready.then(function (registration) { | |
registration.unregister(); | |
}); | |
} | |
} | |
/***/ }), | |
/* 92 */ | |
/***/ (function(module, exports) { | |
var supportsArgumentsClass = (function(){ | |
return Object.prototype.toString.call(arguments) | |
})() == '[object Arguments]'; | |
exports = module.exports = supportsArgumentsClass ? supported : unsupported; | |
exports.supported = supported; | |
function supported(object) { | |
return Object.prototype.toString.call(object) == '[object Arguments]'; | |
}; | |
exports.unsupported = unsupported; | |
function unsupported(object){ | |
return object && | |
typeof object == 'object' && | |
typeof object.length == 'number' && | |
Object.prototype.hasOwnProperty.call(object, 'callee') && | |
!Object.prototype.propertyIsEnumerable.call(object, 'callee') || | |
false; | |
}; | |
/***/ }), | |
/* 93 */ | |
/***/ (function(module, exports) { | |
exports = module.exports = typeof Object.keys === 'function' | |
? Object.keys : shim; | |
exports.shim = shim; | |
function shim (obj) { | |
var keys = []; | |
for (var key in obj) keys.push(key); | |
return keys; | |
} | |
/***/ }), | |
/* 94 */ | |
/***/ (function(module, exports) { | |
// removed by extract-text-webpack-plugin | |
/***/ }), | |
/* 95 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
var _hyphenPattern = /-(.)/g; | |
/** | |
* Camelcases a hyphenated string, for example: | |
* | |
* > camelize('background-color') | |
* < "backgroundColor" | |
* | |
* @param {string} string | |
* @return {string} | |
*/ | |
function camelize(string) { | |
return string.replace(_hyphenPattern, function (_, character) { | |
return character.toUpperCase(); | |
}); | |
} | |
module.exports = camelize; | |
/***/ }), | |
/* 96 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
var camelize = __webpack_require__(95); | |
var msPattern = /^-ms-/; | |
/** | |
* Camelcases a hyphenated CSS property name, for example: | |
* | |
* > camelizeStyleName('background-color') | |
* < "backgroundColor" | |
* > camelizeStyleName('-moz-transition') | |
* < "MozTransition" | |
* > camelizeStyleName('-ms-transition') | |
* < "msTransition" | |
* | |
* As Andi Smith suggests | |
* (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix | |
* is converted to lowercase `ms`. | |
* | |
* @param {string} string | |
* @return {string} | |
*/ | |
function camelizeStyleName(string) { | |
return camelize(string.replace(msPattern, 'ms-')); | |
} | |
module.exports = camelizeStyleName; | |
/***/ }), | |
/* 97 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
*/ | |
var isTextNode = __webpack_require__(105); | |
/*eslint-disable no-bitwise */ | |
/** | |
* Checks if a given DOM node contains or is another DOM node. | |
*/ | |
function containsNode(outerNode, innerNode) { | |
if (!outerNode || !innerNode) { | |
return false; | |
} else if (outerNode === innerNode) { | |
return true; | |
} else if (isTextNode(outerNode)) { | |
return false; | |
} else if (isTextNode(innerNode)) { | |
return containsNode(outerNode, innerNode.parentNode); | |
} else if ('contains' in outerNode) { | |
return outerNode.contains(innerNode); | |
} else if (outerNode.compareDocumentPosition) { | |
return !!(outerNode.compareDocumentPosition(innerNode) & 16); | |
} else { | |
return false; | |
} | |
} | |
module.exports = containsNode; | |
/***/ }), | |
/* 98 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
var invariant = __webpack_require__(0); | |
/** | |
* Convert array-like objects to arrays. | |
* | |
* This API assumes the caller knows the contents of the data type. For less | |
* well defined inputs use createArrayFromMixed. | |
* | |
* @param {object|function|filelist} obj | |
* @return {array} | |
*/ | |
function toArray(obj) { | |
var length = obj.length; | |
// Some browsers builtin objects can report typeof 'function' (e.g. NodeList | |
// in old versions of Safari). | |
!(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? false ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0; | |
!(typeof length === 'number') ? false ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0; | |
!(length === 0 || length - 1 in obj) ? false ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0; | |
!(typeof obj.callee !== 'function') ? false ? invariant(false, 'toArray: Object can\'t be `arguments`. Use rest params ' + '(function(...args) {}) or Array.from() instead.') : invariant(false) : void 0; | |
// Old IE doesn't give collections access to hasOwnProperty. Assume inputs | |
// without method will throw during the slice call and skip straight to the | |
// fallback. | |
if (obj.hasOwnProperty) { | |
try { | |
return Array.prototype.slice.call(obj); | |
} catch (e) { | |
// IE < 9 does not support Array#slice on collections objects | |
} | |
} | |
// Fall back to copying key by key. This assumes all keys have a value, | |
// so will not preserve sparsely populated inputs. | |
var ret = Array(length); | |
for (var ii = 0; ii < length; ii++) { | |
ret[ii] = obj[ii]; | |
} | |
return ret; | |
} | |
/** | |
* Perform a heuristic test to determine if an object is "array-like". | |
* | |
* A monk asked Joshu, a Zen master, "Has a dog Buddha nature?" | |
* Joshu replied: "Mu." | |
* | |
* This function determines if its argument has "array nature": it returns | |
* true if the argument is an actual array, an `arguments' object, or an | |
* HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()). | |
* | |
* It will return false for other array-like objects like Filelist. | |
* | |
* @param {*} obj | |
* @return {boolean} | |
*/ | |
function hasArrayNature(obj) { | |
return ( | |
// not null/false | |
!!obj && ( | |
// arrays are objects, NodeLists are functions in Safari | |
typeof obj == 'object' || typeof obj == 'function') && | |
// quacks like an array | |
'length' in obj && | |
// not window | |
!('setInterval' in obj) && | |
// no DOM node should be considered an array-like | |
// a 'select' element has 'length' and 'item' properties on IE8 | |
typeof obj.nodeType != 'number' && ( | |
// a real array | |
Array.isArray(obj) || | |
// arguments | |
'callee' in obj || | |
// HTMLCollection/NodeList | |
'item' in obj) | |
); | |
} | |
/** | |
* Ensure that the argument is an array by wrapping it in an array if it is not. | |
* Creates a copy of the argument if it is already an array. | |
* | |
* This is mostly useful idiomatically: | |
* | |
* var createArrayFromMixed = require('createArrayFromMixed'); | |
* | |
* function takesOneOrMoreThings(things) { | |
* things = createArrayFromMixed(things); | |
* ... | |
* } | |
* | |
* This allows you to treat `things' as an array, but accept scalars in the API. | |
* | |
* If you need to convert an array-like object, like `arguments`, into an array | |
* use toArray instead. | |
* | |
* @param {*} obj | |
* @return {array} | |
*/ | |
function createArrayFromMixed(obj) { | |
if (!hasArrayNature(obj)) { | |
return [obj]; | |
} else if (Array.isArray(obj)) { | |
return obj.slice(); | |
} else { | |
return toArray(obj); | |
} | |
} | |
module.exports = createArrayFromMixed; | |
/***/ }), | |
/* 99 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
/*eslint-disable fb-www/unsafe-html*/ | |
var ExecutionEnvironment = __webpack_require__(5); | |
var createArrayFromMixed = __webpack_require__(98); | |
var getMarkupWrap = __webpack_require__(100); | |
var invariant = __webpack_require__(0); | |
/** | |
* Dummy container used to render all markup. | |
*/ | |
var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; | |
/** | |
* Pattern used by `getNodeName`. | |
*/ | |
var nodeNamePattern = /^\s*<(\w+)/; | |
/** | |
* Extracts the `nodeName` of the first element in a string of markup. | |
* | |
* @param {string} markup String of markup. | |
* @return {?string} Node name of the supplied markup. | |
*/ | |
function getNodeName(markup) { | |
var nodeNameMatch = markup.match(nodeNamePattern); | |
return nodeNameMatch && nodeNameMatch[1].toLowerCase(); | |
} | |
/** | |
* Creates an array containing the nodes rendered from the supplied markup. The | |
* optionally supplied `handleScript` function will be invoked once for each | |
* <script> element that is rendered. If no `handleScript` function is supplied, | |
* an exception is thrown if any <script> elements are rendered. | |
* | |
* @param {string} markup A string of valid HTML markup. | |
* @param {?function} handleScript Invoked once for each rendered <script>. | |
* @return {array<DOMElement|DOMTextNode>} An array of rendered nodes. | |
*/ | |
function createNodesFromMarkup(markup, handleScript) { | |
var node = dummyNode; | |
!!!dummyNode ? false ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0; | |
var nodeName = getNodeName(markup); | |
var wrap = nodeName && getMarkupWrap(nodeName); | |
if (wrap) { | |
node.innerHTML = wrap[1] + markup + wrap[2]; | |
var wrapDepth = wrap[0]; | |
while (wrapDepth--) { | |
node = node.lastChild; | |
} | |
} else { | |
node.innerHTML = markup; | |
} | |
var scripts = node.getElementsByTagName('script'); | |
if (scripts.length) { | |
!handleScript ? false ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : void 0; | |
createArrayFromMixed(scripts).forEach(handleScript); | |
} | |
var nodes = Array.from(node.childNodes); | |
while (node.lastChild) { | |
node.removeChild(node.lastChild); | |
} | |
return nodes; | |
} | |
module.exports = createNodesFromMarkup; | |
/***/ }), | |
/* 100 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
/*eslint-disable fb-www/unsafe-html */ | |
var ExecutionEnvironment = __webpack_require__(5); | |
var invariant = __webpack_require__(0); | |
/** | |
* Dummy container used to detect which wraps are necessary. | |
*/ | |
var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; | |
/** | |
* Some browsers cannot use `innerHTML` to render certain elements standalone, | |
* so we wrap them, render the wrapped nodes, then extract the desired node. | |
* | |
* In IE8, certain elements cannot render alone, so wrap all elements ('*'). | |
*/ | |
var shouldWrap = {}; | |
var selectWrap = [1, '<select multiple="true">', '</select>']; | |
var tableWrap = [1, '<table>', '</table>']; | |
var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>']; | |
var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>']; | |
var markupWrap = { | |
'*': [1, '?<div>', '</div>'], | |
'area': [1, '<map>', '</map>'], | |
'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'], | |
'legend': [1, '<fieldset>', '</fieldset>'], | |
'param': [1, '<object>', '</object>'], | |
'tr': [2, '<table><tbody>', '</tbody></table>'], | |
'optgroup': selectWrap, | |
'option': selectWrap, | |
'caption': tableWrap, | |
'colgroup': tableWrap, | |
'tbody': tableWrap, | |
'tfoot': tableWrap, | |
'thead': tableWrap, | |
'td': trWrap, | |
'th': trWrap | |
}; | |
// Initialize the SVG elements since we know they'll always need to be wrapped | |
// consistently. If they are created inside a <div> they will be initialized in | |
// the wrong namespace (and will not display). | |
var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan']; | |
svgElements.forEach(function (nodeName) { | |
markupWrap[nodeName] = svgWrap; | |
shouldWrap[nodeName] = true; | |
}); | |
/** | |
* Gets the markup wrap configuration for the supplied `nodeName`. | |
* | |
* NOTE: This lazily detects which wraps are necessary for the current browser. | |
* | |
* @param {string} nodeName Lowercase `nodeName`. | |
* @return {?array} Markup wrap configuration, if applicable. | |
*/ | |
function getMarkupWrap(nodeName) { | |
!!!dummyNode ? false ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0; | |
if (!markupWrap.hasOwnProperty(nodeName)) { | |
nodeName = '*'; | |
} | |
if (!shouldWrap.hasOwnProperty(nodeName)) { | |
if (nodeName === '*') { | |
dummyNode.innerHTML = '<link />'; | |
} else { | |
dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>'; | |
} | |
shouldWrap[nodeName] = !dummyNode.firstChild; | |
} | |
return shouldWrap[nodeName] ? markupWrap[nodeName] : null; | |
} | |
module.exports = getMarkupWrap; | |
/***/ }), | |
/* 101 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
/** | |
* Gets the scroll position of the supplied element or window. | |
* | |
* The return values are unbounded, unlike `getScrollPosition`. This means they | |
* may be negative or exceed the element boundaries (which is possible using | |
* inertial scrolling). | |
* | |
* @param {DOMWindow|DOMElement} scrollable | |
* @return {object} Map with `x` and `y` keys. | |
*/ | |
function getUnboundedScrollPosition(scrollable) { | |
if (scrollable.Window && scrollable instanceof scrollable.Window) { | |
return { | |
x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft, | |
y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop | |
}; | |
} | |
return { | |
x: scrollable.scrollLeft, | |
y: scrollable.scrollTop | |
}; | |
} | |
module.exports = getUnboundedScrollPosition; | |
/***/ }), | |
/* 102 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
var _uppercasePattern = /([A-Z])/g; | |
/** | |
* Hyphenates a camelcased string, for example: | |
* | |
* > hyphenate('backgroundColor') | |
* < "background-color" | |
* | |
* For CSS style names, use `hyphenateStyleName` instead which works properly | |
* with all vendor prefixes, including `ms`. | |
* | |
* @param {string} string | |
* @return {string} | |
*/ | |
function hyphenate(string) { | |
return string.replace(_uppercasePattern, '-$1').toLowerCase(); | |
} | |
module.exports = hyphenate; | |
/***/ }), | |
/* 103 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
var hyphenate = __webpack_require__(102); | |
var msPattern = /^ms-/; | |
/** | |
* Hyphenates a camelcased CSS property name, for example: | |
* | |
* > hyphenateStyleName('backgroundColor') | |
* < "background-color" | |
* > hyphenateStyleName('MozTransition') | |
* < "-moz-transition" | |
* > hyphenateStyleName('msTransition') | |
* < "-ms-transition" | |
* | |
* As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix | |
* is converted to `-ms-`. | |
* | |
* @param {string} string | |
* @return {string} | |
*/ | |
function hyphenateStyleName(string) { | |
return hyphenate(string).replace(msPattern, '-ms-'); | |
} | |
module.exports = hyphenateStyleName; | |
/***/ }), | |
/* 104 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
/** | |
* @param {*} object The object to check. | |
* @return {boolean} Whether or not the object is a DOM node. | |
*/ | |
function isNode(object) { | |
var doc = object ? object.ownerDocument || object : document; | |
var defaultView = doc.defaultView || window; | |
return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string')); | |
} | |
module.exports = isNode; | |
/***/ }), | |
/* 105 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @typechecks | |
*/ | |
var isNode = __webpack_require__(104); | |
/** | |
* @param {*} object The object to check. | |
* @return {boolean} Whether or not the object is a DOM text node. | |
*/ | |
function isTextNode(object) { | |
return isNode(object) && object.nodeType == 3; | |
} | |
module.exports = isTextNode; | |
/***/ }), | |
/* 106 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* | |
* @typechecks static-only | |
*/ | |
/** | |
* Memoizes the return value of a function that accepts one string argument. | |
*/ | |
function memoizeStringOnly(callback) { | |
var cache = {}; | |
return function (string) { | |
if (!cache.hasOwnProperty(string)) { | |
cache[string] = callback.call(this, string); | |
} | |
return cache[string]; | |
}; | |
} | |
module.exports = memoizeStringOnly; | |
/***/ }), | |
/* 107 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/*! | |
* for-in <https://github.com/jonschlinkert/for-in> | |
* | |
* Copyright (c) 2014-2017, Jon Schlinkert. | |
* Released under the MIT License. | |
*/ | |
module.exports = function forIn(obj, fn, thisArg) { | |
for (var key in obj) { | |
if (fn.call(thisArg, obj[key], key, obj) === false) { | |
break; | |
} | |
} | |
}; | |
/***/ }), | |
/* 108 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/*! | |
* for-own <https://github.com/jonschlinkert/for-own> | |
* | |
* Copyright (c) 2014-2017, Jon Schlinkert. | |
* Released under the MIT License. | |
*/ | |
var forIn = __webpack_require__(107); | |
var hasOwn = Object.prototype.hasOwnProperty; | |
module.exports = function forOwn(obj, fn, thisArg) { | |
forIn(obj, function(val, key) { | |
if (hasOwn.call(obj, key)) { | |
return fn.call(thisArg, obj[key], key, obj); | |
} | |
}); | |
}; | |
/***/ }), | |
/* 109 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var sort = __webpack_require__(111); | |
var range = __webpack_require__(110); | |
var within = __webpack_require__(112); | |
module.exports = kdbush; | |
function kdbush(points, getX, getY, nodeSize, ArrayType) { | |
return new KDBush(points, getX, getY, nodeSize, ArrayType); | |
} | |
function KDBush(points, getX, getY, nodeSize, ArrayType) { | |
getX = getX || defaultGetX; | |
getY = getY || defaultGetY; | |
ArrayType = ArrayType || Array; | |
this.nodeSize = nodeSize || 64; | |
this.points = points; | |
this.ids = new ArrayType(points.length); | |
this.coords = new ArrayType(points.length * 2); | |
for (var i = 0; i < points.length; i++) { | |
this.ids[i] = i; | |
this.coords[2 * i] = getX(points[i]); | |
this.coords[2 * i + 1] = getY(points[i]); | |
} | |
sort(this.ids, this.coords, this.nodeSize, 0, this.ids.length - 1, 0); | |
} | |
KDBush.prototype = { | |
range: function (minX, minY, maxX, maxY) { | |
return range(this.ids, this.coords, minX, minY, maxX, maxY, this.nodeSize); | |
}, | |
within: function (x, y, r) { | |
return within(this.ids, this.coords, x, y, r, this.nodeSize); | |
} | |
}; | |
function defaultGetX(p) { return p[0]; } | |
function defaultGetY(p) { return p[1]; } | |
/***/ }), | |
/* 110 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
module.exports = range; | |
function range(ids, coords, minX, minY, maxX, maxY, nodeSize) { | |
var stack = [0, ids.length - 1, 0]; | |
var result = []; | |
var x, y; | |
while (stack.length) { | |
var axis = stack.pop(); | |
var right = stack.pop(); | |
var left = stack.pop(); | |
if (right - left <= nodeSize) { | |
for (var i = left; i <= right; i++) { | |
x = coords[2 * i]; | |
y = coords[2 * i + 1]; | |
if (x >= minX && x <= maxX && y >= minY && y <= maxY) result.push(ids[i]); | |
} | |
continue; | |
} | |
var m = Math.floor((left + right) / 2); | |
x = coords[2 * m]; | |
y = coords[2 * m + 1]; | |
if (x >= minX && x <= maxX && y >= minY && y <= maxY) result.push(ids[m]); | |
var nextAxis = (axis + 1) % 2; | |
if (axis === 0 ? minX <= x : minY <= y) { | |
stack.push(left); | |
stack.push(m - 1); | |
stack.push(nextAxis); | |
} | |
if (axis === 0 ? maxX >= x : maxY >= y) { | |
stack.push(m + 1); | |
stack.push(right); | |
stack.push(nextAxis); | |
} | |
} | |
return result; | |
} | |
/***/ }), | |
/* 111 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
module.exports = sortKD; | |
function sortKD(ids, coords, nodeSize, left, right, depth) { | |
if (right - left <= nodeSize) return; | |
var m = Math.floor((left + right) / 2); | |
select(ids, coords, m, left, right, depth % 2); | |
sortKD(ids, coords, nodeSize, left, m - 1, depth + 1); | |
sortKD(ids, coords, nodeSize, m + 1, right, depth + 1); | |
} | |
function select(ids, coords, k, left, right, inc) { | |
while (right > left) { | |
if (right - left > 600) { | |
var n = right - left + 1; | |
var m = k - left + 1; | |
var z = Math.log(n); | |
var s = 0.5 * Math.exp(2 * z / 3); | |
var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); | |
var newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); | |
var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); | |
select(ids, coords, k, newLeft, newRight, inc); | |
} | |
var t = coords[2 * k + inc]; | |
var i = left; | |
var j = right; | |
swapItem(ids, coords, left, k); | |
if (coords[2 * right + inc] > t) swapItem(ids, coords, left, right); | |
while (i < j) { | |
swapItem(ids, coords, i, j); | |
i++; | |
j--; | |
while (coords[2 * i + inc] < t) i++; | |
while (coords[2 * j + inc] > t) j--; | |
} | |
if (coords[2 * left + inc] === t) swapItem(ids, coords, left, j); | |
else { | |
j++; | |
swapItem(ids, coords, j, right); | |
} | |
if (j <= k) left = j + 1; | |
if (k <= j) right = j - 1; | |
} | |
} | |
function swapItem(ids, coords, i, j) { | |
swap(ids, i, j); | |
swap(coords, 2 * i, 2 * j); | |
swap(coords, 2 * i + 1, 2 * j + 1); | |
} | |
function swap(arr, i, j) { | |
var tmp = arr[i]; | |
arr[i] = arr[j]; | |
arr[j] = tmp; | |
} | |
/***/ }), | |
/* 112 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
module.exports = within; | |
function within(ids, coords, qx, qy, r, nodeSize) { | |
var stack = [0, ids.length - 1, 0]; | |
var result = []; | |
var r2 = r * r; | |
while (stack.length) { | |
var axis = stack.pop(); | |
var right = stack.pop(); | |
var left = stack.pop(); | |
if (right - left <= nodeSize) { | |
for (var i = left; i <= right; i++) { | |
if (sqDist(coords[2 * i], coords[2 * i + 1], qx, qy) <= r2) result.push(ids[i]); | |
} | |
continue; | |
} | |
var m = Math.floor((left + right) / 2); | |
var x = coords[2 * m]; | |
var y = coords[2 * m + 1]; | |
if (sqDist(x, y, qx, qy) <= r2) result.push(ids[m]); | |
var nextAxis = (axis + 1) % 2; | |
if (axis === 0 ? qx - r <= x : qy - r <= y) { | |
stack.push(left); | |
stack.push(m - 1); | |
stack.push(nextAxis); | |
} | |
if (axis === 0 ? qx + r >= x : qy + r >= y) { | |
stack.push(m + 1); | |
stack.push(right); | |
stack.push(nextAxis); | |
} | |
} | |
return result; | |
} | |
function sqDist(ax, ay, bx, by) { | |
var dx = ax - bx; | |
var dy = ay - by; | |
return dx * dx + dy * dy; | |
} | |
/***/ }), | |
/* 113 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
//This file contains the ES6 extensions to the core Promises/A+ API | |
var Promise = __webpack_require__(55); | |
module.exports = Promise; | |
/* Static Functions */ | |
var TRUE = valuePromise(true); | |
var FALSE = valuePromise(false); | |
var NULL = valuePromise(null); | |
var UNDEFINED = valuePromise(undefined); | |
var ZERO = valuePromise(0); | |
var EMPTYSTRING = valuePromise(''); | |
function valuePromise(value) { | |
var p = new Promise(Promise._61); | |
p._81 = 1; | |
p._65 = value; | |
return p; | |
} | |
Promise.resolve = function (value) { | |
if (value instanceof Promise) return value; | |
if (value === null) return NULL; | |
if (value === undefined) return UNDEFINED; | |
if (value === true) return TRUE; | |
if (value === false) return FALSE; | |
if (value === 0) return ZERO; | |
if (value === '') return EMPTYSTRING; | |
if (typeof value === 'object' || typeof value === 'function') { | |
try { | |
var then = value.then; | |
if (typeof then === 'function') { | |
return new Promise(then.bind(value)); | |
} | |
} catch (ex) { | |
return new Promise(function (resolve, reject) { | |
reject(ex); | |
}); | |
} | |
} | |
return valuePromise(value); | |
}; | |
Promise.all = function (arr) { | |
var args = Array.prototype.slice.call(arr); | |
return new Promise(function (resolve, reject) { | |
if (args.length === 0) return resolve([]); | |
var remaining = args.length; | |
function res(i, val) { | |
if (val && (typeof val === 'object' || typeof val === 'function')) { | |
if (val instanceof Promise && val.then === Promise.prototype.then) { | |
while (val._81 === 3) { | |
val = val._65; | |
} | |
if (val._81 === 1) return res(i, val._65); | |
if (val._81 === 2) reject(val._65); | |
val.then(function (val) { | |
res(i, val); | |
}, reject); | |
return; | |
} else { | |
var then = val.then; | |
if (typeof then === 'function') { | |
var p = new Promise(then.bind(val)); | |
p.then(function (val) { | |
res(i, val); | |
}, reject); | |
return; | |
} | |
} | |
} | |
args[i] = val; | |
if (--remaining === 0) { | |
resolve(args); | |
} | |
} | |
for (var i = 0; i < args.length; i++) { | |
res(i, args[i]); | |
} | |
}); | |
}; | |
Promise.reject = function (value) { | |
return new Promise(function (resolve, reject) { | |
reject(value); | |
}); | |
}; | |
Promise.race = function (values) { | |
return new Promise(function (resolve, reject) { | |
values.forEach(function(value){ | |
Promise.resolve(value).then(resolve, reject); | |
}); | |
}); | |
}; | |
/* Prototype Methods */ | |
Promise.prototype['catch'] = function (onRejected) { | |
return this.then(null, onRejected); | |
}; | |
/***/ }), | |
/* 114 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var Promise = __webpack_require__(55); | |
var DEFAULT_WHITELIST = [ | |
ReferenceError, | |
TypeError, | |
RangeError | |
]; | |
var enabled = false; | |
exports.disable = disable; | |
function disable() { | |
enabled = false; | |
Promise._10 = null; | |
Promise._97 = null; | |
} | |
exports.enable = enable; | |
function enable(options) { | |
options = options || {}; | |
if (enabled) disable(); | |
enabled = true; | |
var id = 0; | |
var displayId = 0; | |
var rejections = {}; | |
Promise._10 = function (promise) { | |
if ( | |
promise._81 === 2 && // IS REJECTED | |
rejections[promise._72] | |
) { | |
if (rejections[promise._72].logged) { | |
onHandled(promise._72); | |
} else { | |
clearTimeout(rejections[promise._72].timeout); | |
} | |
delete rejections[promise._72]; | |
} | |
}; | |
Promise._97 = function (promise, err) { | |
if (promise._45 === 0) { // not yet handled | |
promise._72 = id++; | |
rejections[promise._72] = { | |
displayId: null, | |
error: err, | |
timeout: setTimeout( | |
onUnhandled.bind(null, promise._72), | |
// For reference errors and type errors, this almost always | |
// means the programmer made a mistake, so log them after just | |
// 100ms | |
// otherwise, wait 2 seconds to see if they get handled | |
matchWhitelist(err, DEFAULT_WHITELIST) | |
? 100 | |
: 2000 | |
), | |
logged: false | |
}; | |
} | |
}; | |
function onUnhandled(id) { | |
if ( | |
options.allRejections || | |
matchWhitelist( | |
rejections[id].error, | |
options.whitelist || DEFAULT_WHITELIST | |
) | |
) { | |
rejections[id].displayId = displayId++; | |
if (options.onUnhandled) { | |
rejections[id].logged = true; | |
options.onUnhandled( | |
rejections[id].displayId, | |
rejections[id].error | |
); | |
} else { | |
rejections[id].logged = true; | |
logError( | |
rejections[id].displayId, | |
rejections[id].error | |
); | |
} | |
} | |
} | |
function onHandled(id) { | |
if (rejections[id].logged) { | |
if (options.onHandled) { | |
options.onHandled(rejections[id].displayId, rejections[id].error); | |
} else if (!rejections[id].onUnhandled) { | |
console.warn( | |
'Promise Rejection Handled (id: ' + rejections[id].displayId + '):' | |
); | |
console.warn( | |
' This means you can ignore any previous messages of the form "Possible Unhandled Promise Rejection" with id ' + | |
rejections[id].displayId + '.' | |
); | |
} | |
} | |
} | |
} | |
function logError(id, error) { | |
console.warn('Possible Unhandled Promise Rejection (id: ' + id + '):'); | |
var errStr = (error && (error.stack || error)) + ''; | |
errStr.split('\n').forEach(function (line) { | |
console.warn(' ' + line); | |
}); | |
} | |
function matchWhitelist(error, list) { | |
return list.some(function (cls) { | |
return error instanceof cls; | |
}); | |
} | |
/***/ }), | |
/* 115 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
*/ | |
if (false) { | |
var invariant = require('fbjs/lib/invariant'); | |
var warning = require('fbjs/lib/warning'); | |
var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); | |
var loggedTypeFailures = {}; | |
} | |
/** | |
* Assert that the values match with the type specs. | |
* Error messages are memorized and will only be shown once. | |
* | |
* @param {object} typeSpecs Map of name to a ReactPropType | |
* @param {object} values Runtime values that need to be type-checked | |
* @param {string} location e.g. "prop", "context", "child context" | |
* @param {string} componentName Name of the component for error messages. | |
* @param {?Function} getStack Returns the component stack. | |
* @private | |
*/ | |
function checkPropTypes(typeSpecs, values, location, componentName, getStack) { | |
if (false) { | |
for (var typeSpecName in typeSpecs) { | |
if (typeSpecs.hasOwnProperty(typeSpecName)) { | |
var error; | |
// Prop type validation may throw. In case they do, we don't want to | |
// fail the render phase where it didn't fail before. So we log it. | |
// After these have been cleaned up, we'll let them throw. | |
try { | |
// This is intentionally an invariant that gets caught. It's the same | |
// behavior as without this statement except with a better message. | |
invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', location, typeSpecName); | |
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); | |
} catch (ex) { | |
error = ex; | |
} | |
warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); | |
if (error instanceof Error && !(error.message in loggedTypeFailures)) { | |
// Only monitor this failure once because there tends to be a lot of the | |
// same error. | |
loggedTypeFailures[error.message] = true; | |
var stack = getStack ? getStack() : ''; | |
warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); | |
} | |
} | |
} | |
} | |
} | |
module.exports = checkPropTypes; | |
/***/ }), | |
/* 116 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
*/ | |
var emptyFunction = __webpack_require__(7); | |
var invariant = __webpack_require__(0); | |
var ReactPropTypesSecret = __webpack_require__(57); | |
module.exports = function() { | |
function shim(props, propName, componentName, location, propFullName, secret) { | |
if (secret === ReactPropTypesSecret) { | |
// It is still safe when called from React. | |
return; | |
} | |
invariant( | |
false, | |
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + | |
'Use PropTypes.checkPropTypes() to call them. ' + | |
'Read more at http://fb.me/use-check-prop-types' | |
); | |
}; | |
shim.isRequired = shim; | |
function getShim() { | |
return shim; | |
}; | |
// Important! | |
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. | |
var ReactPropTypes = { | |
array: shim, | |
bool: shim, | |
func: shim, | |
number: shim, | |
object: shim, | |
string: shim, | |
symbol: shim, | |
any: shim, | |
arrayOf: getShim, | |
element: shim, | |
instanceOf: getShim, | |
node: shim, | |
objectOf: getShim, | |
oneOf: getShim, | |
oneOfType: getShim, | |
shape: getShim | |
}; | |
ReactPropTypes.checkPropTypes = emptyFunction; | |
ReactPropTypes.PropTypes = ReactPropTypes; | |
return ReactPropTypes; | |
}; | |
/***/ }), | |
/* 117 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
*/ | |
var emptyFunction = __webpack_require__(7); | |
var invariant = __webpack_require__(0); | |
var warning = __webpack_require__(1); | |
var ReactPropTypesSecret = __webpack_require__(57); | |
var checkPropTypes = __webpack_require__(115); | |
module.exports = function(isValidElement, throwOnDirectAccess) { | |
/* global Symbol */ | |
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; | |
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. | |
/** | |
* Returns the iterator method function contained on the iterable object. | |
* | |
* Be sure to invoke the function with the iterable as context: | |
* | |
* var iteratorFn = getIteratorFn(myIterable); | |
* if (iteratorFn) { | |
* var iterator = iteratorFn.call(myIterable); | |
* ... | |
* } | |
* | |
* @param {?object} maybeIterable | |
* @return {?function} | |
*/ | |
function getIteratorFn(maybeIterable) { | |
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); | |
if (typeof iteratorFn === 'function') { | |
return iteratorFn; | |
} | |
} | |
/** | |
* Collection of methods that allow declaration and validation of props that are | |
* supplied to React components. Example usage: | |
* | |
* var Props = require('ReactPropTypes'); | |
* var MyArticle = React.createClass({ | |
* propTypes: { | |
* // An optional string prop named "description". | |
* description: Props.string, | |
* | |
* // A required enum prop named "category". | |
* category: Props.oneOf(['News','Photos']).isRequired, | |
* | |
* // A prop named "dialog" that requires an instance of Dialog. | |
* dialog: Props.instanceOf(Dialog).isRequired | |
* }, | |
* render: function() { ... } | |
* }); | |
* | |
* A more formal specification of how these methods are used: | |
* | |
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) | |
* decl := ReactPropTypes.{type}(.isRequired)? | |
* | |
* Each and every declaration produces a function with the same signature. This | |
* allows the creation of custom validation functions. For example: | |
* | |
* var MyLink = React.createClass({ | |
* propTypes: { | |
* // An optional string or URI prop named "href". | |
* href: function(props, propName, componentName) { | |
* var propValue = props[propName]; | |
* if (propValue != null && typeof propValue !== 'string' && | |
* !(propValue instanceof URI)) { | |
* return new Error( | |
* 'Expected a string or an URI for ' + propName + ' in ' + | |
* componentName | |
* ); | |
* } | |
* } | |
* }, | |
* render: function() {...} | |
* }); | |
* | |
* @internal | |
*/ | |
var ANONYMOUS = '<<anonymous>>'; | |
// Important! | |
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`. | |
var ReactPropTypes = { | |
array: createPrimitiveTypeChecker('array'), | |
bool: createPrimitiveTypeChecker('boolean'), | |
func: createPrimitiveTypeChecker('function'), | |
number: createPrimitiveTypeChecker('number'), | |
object: createPrimitiveTypeChecker('object'), | |
string: createPrimitiveTypeChecker('string'), | |
symbol: createPrimitiveTypeChecker('symbol'), | |
any: createAnyTypeChecker(), | |
arrayOf: createArrayOfTypeChecker, | |
element: createElementTypeChecker(), | |
instanceOf: createInstanceTypeChecker, | |
node: createNodeChecker(), | |
objectOf: createObjectOfTypeChecker, | |
oneOf: createEnumTypeChecker, | |
oneOfType: createUnionTypeChecker, | |
shape: createShapeTypeChecker | |
}; | |
/** | |
* inlined Object.is polyfill to avoid requiring consumers ship their own | |
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is | |
*/ | |
/*eslint-disable no-self-compare*/ | |
function is(x, y) { | |
// SameValue algorithm | |
if (x === y) { | |
// Steps 1-5, 7-10 | |
// Steps 6.b-6.e: +0 != -0 | |
return x !== 0 || 1 / x === 1 / y; | |
} else { | |
// Step 6.a: NaN == NaN | |
return x !== x && y !== y; | |
} | |
} | |
/*eslint-enable no-self-compare*/ | |
/** | |
* We use an Error-like object for backward compatibility as people may call | |
* PropTypes directly and inspect their output. However, we don't use real | |
* Errors anymore. We don't inspect their stack anyway, and creating them | |
* is prohibitively expensive if they are created too often, such as what | |
* happens in oneOfType() for any type before the one that matched. | |
*/ | |
function PropTypeError(message) { | |
this.message = message; | |
this.stack = ''; | |
} | |
// Make `instanceof Error` still work for returned errors. | |
PropTypeError.prototype = Error.prototype; | |
function createChainableTypeChecker(validate) { | |
if (false) { | |
var manualPropTypeCallCache = {}; | |
var manualPropTypeWarningCount = 0; | |
} | |
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { | |
componentName = componentName || ANONYMOUS; | |
propFullName = propFullName || propName; | |
if (secret !== ReactPropTypesSecret) { | |
if (throwOnDirectAccess) { | |
// New behavior only for users of `prop-types` package | |
invariant( | |
false, | |
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + | |
'Use `PropTypes.checkPropTypes()` to call them. ' + | |
'Read more at http://fb.me/use-check-prop-types' | |
); | |
} else if (false) { | |
// Old behavior for people using React.PropTypes | |
var cacheKey = componentName + ':' + propName; | |
if ( | |
!manualPropTypeCallCache[cacheKey] && | |
// Avoid spamming the console because they are often not actionable except for lib authors | |
manualPropTypeWarningCount < 3 | |
) { | |
warning( | |
false, | |
'You are manually calling a React.PropTypes validation ' + | |
'function for the `%s` prop on `%s`. This is deprecated ' + | |
'and will throw in the standalone `prop-types` package. ' + | |
'You may be seeing this warning due to a third-party PropTypes ' + | |
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', | |
propFullName, | |
componentName | |
); | |
manualPropTypeCallCache[cacheKey] = true; | |
manualPropTypeWarningCount++; | |
} | |
} | |
} | |
if (props[propName] == null) { | |
if (isRequired) { | |
if (props[propName] === null) { | |
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); | |
} | |
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); | |
} | |
return null; | |
} else { | |
return validate(props, propName, componentName, location, propFullName); | |
} | |
} | |
var chainedCheckType = checkType.bind(null, false); | |
chainedCheckType.isRequired = checkType.bind(null, true); | |
return chainedCheckType; | |
} | |
function createPrimitiveTypeChecker(expectedType) { | |
function validate(props, propName, componentName, location, propFullName, secret) { | |
var propValue = props[propName]; | |
var propType = getPropType(propValue); | |
if (propType !== expectedType) { | |
// `propValue` being instance of, say, date/regexp, pass the 'object' | |
// check, but we can offer a more precise error message here rather than | |
// 'of type `object`'. | |
var preciseType = getPreciseType(propValue); | |
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); | |
} | |
return null; | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function createAnyTypeChecker() { | |
return createChainableTypeChecker(emptyFunction.thatReturnsNull); | |
} | |
function createArrayOfTypeChecker(typeChecker) { | |
function validate(props, propName, componentName, location, propFullName) { | |
if (typeof typeChecker !== 'function') { | |
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); | |
} | |
var propValue = props[propName]; | |
if (!Array.isArray(propValue)) { | |
var propType = getPropType(propValue); | |
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); | |
} | |
for (var i = 0; i < propValue.length; i++) { | |
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); | |
if (error instanceof Error) { | |
return error; | |
} | |
} | |
return null; | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function createElementTypeChecker() { | |
function validate(props, propName, componentName, location, propFullName) { | |
var propValue = props[propName]; | |
if (!isValidElement(propValue)) { | |
var propType = getPropType(propValue); | |
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); | |
} | |
return null; | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function createInstanceTypeChecker(expectedClass) { | |
function validate(props, propName, componentName, location, propFullName) { | |
if (!(props[propName] instanceof expectedClass)) { | |
var expectedClassName = expectedClass.name || ANONYMOUS; | |
var actualClassName = getClassName(props[propName]); | |
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); | |
} | |
return null; | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function createEnumTypeChecker(expectedValues) { | |
if (!Array.isArray(expectedValues)) { | |
false ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; | |
return emptyFunction.thatReturnsNull; | |
} | |
function validate(props, propName, componentName, location, propFullName) { | |
var propValue = props[propName]; | |
for (var i = 0; i < expectedValues.length; i++) { | |
if (is(propValue, expectedValues[i])) { | |
return null; | |
} | |
} | |
var valuesString = JSON.stringify(expectedValues); | |
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function createObjectOfTypeChecker(typeChecker) { | |
function validate(props, propName, componentName, location, propFullName) { | |
if (typeof typeChecker !== 'function') { | |
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); | |
} | |
var propValue = props[propName]; | |
var propType = getPropType(propValue); | |
if (propType !== 'object') { | |
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); | |
} | |
for (var key in propValue) { | |
if (propValue.hasOwnProperty(key)) { | |
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); | |
if (error instanceof Error) { | |
return error; | |
} | |
} | |
} | |
return null; | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function createUnionTypeChecker(arrayOfTypeCheckers) { | |
if (!Array.isArray(arrayOfTypeCheckers)) { | |
false ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; | |
return emptyFunction.thatReturnsNull; | |
} | |
for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | |
var checker = arrayOfTypeCheckers[i]; | |
if (typeof checker !== 'function') { | |
warning( | |
false, | |
'Invalid argument supplid to oneOfType. Expected an array of check functions, but ' + | |
'received %s at index %s.', | |
getPostfixForTypeWarning(checker), | |
i | |
); | |
return emptyFunction.thatReturnsNull; | |
} | |
} | |
function validate(props, propName, componentName, location, propFullName) { | |
for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | |
var checker = arrayOfTypeCheckers[i]; | |
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { | |
return null; | |
} | |
} | |
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function createNodeChecker() { | |
function validate(props, propName, componentName, location, propFullName) { | |
if (!isNode(props[propName])) { | |
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); | |
} | |
return null; | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function createShapeTypeChecker(shapeTypes) { | |
function validate(props, propName, componentName, location, propFullName) { | |
var propValue = props[propName]; | |
var propType = getPropType(propValue); | |
if (propType !== 'object') { | |
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); | |
} | |
for (var key in shapeTypes) { | |
var checker = shapeTypes[key]; | |
if (!checker) { | |
continue; | |
} | |
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); | |
if (error) { | |
return error; | |
} | |
} | |
return null; | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function isNode(propValue) { | |
switch (typeof propValue) { | |
case 'number': | |
case 'string': | |
case 'undefined': | |
return true; | |
case 'boolean': | |
return !propValue; | |
case 'object': | |
if (Array.isArray(propValue)) { | |
return propValue.every(isNode); | |
} | |
if (propValue === null || isValidElement(propValue)) { | |
return true; | |
} | |
var iteratorFn = getIteratorFn(propValue); | |
if (iteratorFn) { | |
var iterator = iteratorFn.call(propValue); | |
var step; | |
if (iteratorFn !== propValue.entries) { | |
while (!(step = iterator.next()).done) { | |
if (!isNode(step.value)) { | |
return false; | |
} | |
} | |
} else { | |
// Iterator will provide entry [k,v] tuples rather than values. | |
while (!(step = iterator.next()).done) { | |
var entry = step.value; | |
if (entry) { | |
if (!isNode(entry[1])) { | |
return false; | |
} | |
} | |
} | |
} | |
} else { | |
return false; | |
} | |
return true; | |
default: | |
return false; | |
} | |
} | |
function isSymbol(propType, propValue) { | |
// Native Symbol. | |
if (propType === 'symbol') { | |
return true; | |
} | |
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' | |
if (propValue['@@toStringTag'] === 'Symbol') { | |
return true; | |
} | |
// Fallback for non-spec compliant Symbols which are polyfilled. | |
if (typeof Symbol === 'function' && propValue instanceof Symbol) { | |
return true; | |
} | |
return false; | |
} | |
// Equivalent of `typeof` but with special handling for array and regexp. | |
function getPropType(propValue) { | |
var propType = typeof propValue; | |
if (Array.isArray(propValue)) { | |
return 'array'; | |
} | |
if (propValue instanceof RegExp) { | |
// Old webkits (at least until Android 4.0) return 'function' rather than | |
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/ | |
// passes PropTypes.object. | |
return 'object'; | |
} | |
if (isSymbol(propType, propValue)) { | |
return 'symbol'; | |
} | |
return propType; | |
} | |
// This handles more types than `getPropType`. Only used for error messages. | |
// See `createPrimitiveTypeChecker`. | |
function getPreciseType(propValue) { | |
if (typeof propValue === 'undefined' || propValue === null) { | |
return '' + propValue; | |
} | |
var propType = getPropType(propValue); | |
if (propType === 'object') { | |
if (propValue instanceof Date) { | |
return 'date'; | |
} else if (propValue instanceof RegExp) { | |
return 'regexp'; | |
} | |
} | |
return propType; | |
} | |
// Returns a string that is postfixed to a warning about an invalid type. | |
// For example, "undefined" or "of type array" | |
function getPostfixForTypeWarning(value) { | |
var type = getPreciseType(value); | |
switch (type) { | |
case 'array': | |
case 'object': | |
return 'an ' + type; | |
case 'boolean': | |
case 'date': | |
case 'regexp': | |
return 'a ' + type; | |
default: | |
return type; | |
} | |
} | |
// Returns class name of the object, if any. | |
function getClassName(propValue) { | |
if (!propValue.constructor || !propValue.constructor.name) { | |
return ANONYMOUS; | |
} | |
return propValue.constructor.name; | |
} | |
ReactPropTypes.checkPropTypes = checkPropTypes; | |
ReactPropTypes.PropTypes = ReactPropTypes; | |
return ReactPropTypes; | |
}; | |
/***/ }), | |
/* 118 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
module.exports = __webpack_require__(132); | |
/***/ }), | |
/* 119 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ARIADOMPropertyConfig = { | |
Properties: { | |
// Global States and Properties | |
'aria-current': 0, // state | |
'aria-details': 0, | |
'aria-disabled': 0, // state | |
'aria-hidden': 0, // state | |
'aria-invalid': 0, // state | |
'aria-keyshortcuts': 0, | |
'aria-label': 0, | |
'aria-roledescription': 0, | |
// Widget Attributes | |
'aria-autocomplete': 0, | |
'aria-checked': 0, | |
'aria-expanded': 0, | |
'aria-haspopup': 0, | |
'aria-level': 0, | |
'aria-modal': 0, | |
'aria-multiline': 0, | |
'aria-multiselectable': 0, | |
'aria-orientation': 0, | |
'aria-placeholder': 0, | |
'aria-pressed': 0, | |
'aria-readonly': 0, | |
'aria-required': 0, | |
'aria-selected': 0, | |
'aria-sort': 0, | |
'aria-valuemax': 0, | |
'aria-valuemin': 0, | |
'aria-valuenow': 0, | |
'aria-valuetext': 0, | |
// Live Region Attributes | |
'aria-atomic': 0, | |
'aria-busy': 0, | |
'aria-live': 0, | |
'aria-relevant': 0, | |
// Drag-and-Drop Attributes | |
'aria-dropeffect': 0, | |
'aria-grabbed': 0, | |
// Relationship Attributes | |
'aria-activedescendant': 0, | |
'aria-colcount': 0, | |
'aria-colindex': 0, | |
'aria-colspan': 0, | |
'aria-controls': 0, | |
'aria-describedby': 0, | |
'aria-errormessage': 0, | |
'aria-flowto': 0, | |
'aria-labelledby': 0, | |
'aria-owns': 0, | |
'aria-posinset': 0, | |
'aria-rowcount': 0, | |
'aria-rowindex': 0, | |
'aria-rowspan': 0, | |
'aria-setsize': 0 | |
}, | |
DOMAttributeNames: {}, | |
DOMPropertyNames: {} | |
}; | |
module.exports = ARIADOMPropertyConfig; | |
/***/ }), | |
/* 120 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var ReactDOMComponentTree = __webpack_require__(4); | |
var focusNode = __webpack_require__(51); | |
var AutoFocusUtils = { | |
focusDOMComponent: function () { | |
focusNode(ReactDOMComponentTree.getNodeFromInstance(this)); | |
} | |
}; | |
module.exports = AutoFocusUtils; | |
/***/ }), | |
/* 121 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2013-present Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
*/ | |
var EventPropagators = __webpack_require__(22); | |
var ExecutionEnvironment = __webpack_require__(5); | |
var FallbackCompositionState = __webpack_require__(127); | |
var SyntheticCompositionEvent = __webpack_require__(164); | |
var SyntheticInputEvent = __webpack_require__(167); | |
var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space | |
var START_KEYCODE = 229; | |
var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window; | |
var documentMode = null; | |
if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) { | |
documentMode = document.documentMode; | |
} | |
// Webkit offers a very useful `textInput` event that can be used to | |
// directly represent `beforeInput`. The IE `textinput` event is not as | |
// useful, so we don't use it. | |
var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto(); | |
// In IE9+, we have access to composition events, but the data supplied | |
// by the native compositionend event may be incorrect. Japanese ideographic | |
// spaces, for instance (\u3000) are not recorded correctly. | |
var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11); | |
/** | |
* Opera <= 12 includes TextEvent in window, but does not fire | |
* text input events. Rely on keypress instead. | |
*/ | |
function isPresto() { | |
var opera = window.opera; | |
return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12; | |
} | |
var SPACEBAR_CODE = 32; | |
var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); | |
// Events and their corresponding property names. | |
var eventTypes = { | |
beforeInput: { | |
phasedRegistrationNames: { | |
bubbled: 'onBeforeInput', | |
captured: 'onBeforeInputCapture' | |
}, | |
dependencies: ['topCompositionEnd', 'topKeyPress', 'topTextInput', 'topPaste'] | |
}, | |
compositionEnd: { | |
phasedRegistrationNames: { | |
bubbled: 'onCompositionEnd', | |
captured: 'onCompositionEndCapture' | |
}, | |
dependencies: ['topBlur', 'topCompositionEnd', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] | |
}, | |
compositionStart: { | |
phasedRegistrationNames: { | |
bubbled: 'onCompositionStart', | |
captured: 'onCompositionStartCapture' | |
}, | |
dependencies: ['topBlur', 'topCompositionStart', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] | |
}, | |
compositionUpdate: { | |
phasedRegistrationNames: { | |
bubbled: 'onCompositionUpdate', | |
captured: 'onCompositionUpdateCapture' | |
}, | |
dependencies: ['topBlur', 'topCompositionUpdate', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] | |
} | |
}; | |
// Track whether we've ever handled a keypress on the space key. | |
var hasSpaceKeypress = false; | |
/** | |
* Return whether a native keypress event is assumed to be a command. | |
* This is required because Firefox fires `keypress` events for key commands | |
* (cut, copy, select-all, etc.) even though no character is inserted. | |
*/ | |
function isKeypressCommand(nativeEvent) { | |
return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && | |
// ctrlKey && altKey is equivalent to AltGr, and is not a command. | |
!(nativeEvent.ctrlKey && nativeEvent.altKey); | |
} | |
/** | |
* Translate native top level events into event types. | |
* | |
* @param {string} topLevelType | |
* @return {object} | |
*/ | |
function getCompositionEventType(topLevelType) { | |
switch (topLevelType) { | |
case 'topCompositionStart': | |
return eventTypes.compositionStart; | |
case 'topCompositionEnd': | |
return eventTypes.compositionEnd; | |
case 'topCompositionUpdate': | |
return eventTypes.compositionUpdate; | |
} | |
} | |
/** | |
* Does our fallback best-guess model think this event signifies that | |
* composition has begun? | |
* | |
* @param {string} topLevelType | |
* @param {object} nativeEvent | |
* @return {boolean} | |
*/ | |
function isFallbackCompositionStart(topLevelType, nativeEvent) { | |
return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE; | |
} | |
/** | |
* Does our fallback mode think that this event is the end of composition? | |
* | |
* @param {string} topLevelType | |
* @param {object} nativeEvent | |
* @return {boolean} | |
*/ | |
function isFallbackCompositionEnd(topLevelType, nativeEvent) { | |
switch (topLevelType) { | |
case 'topKeyUp': | |
// Command keys insert or clear IME input. | |
return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; | |
case 'topKeyDown': | |
// Expect IME keyCode on each keydown. If we get any other | |
// code we must have exited earlier. | |
return nativeEvent.keyCode !== START_KEYCODE; | |
case 'topKeyPress': | |
case 'topMouseDown': | |
case 'topBlur': | |
// Events are not possible without cancelling IME. | |
return true; | |
default: | |
return false; | |
} | |
} | |
/** | |
* Google Input Tools provides composition data via a CustomEvent, | |
* with the `data` property populated in the `detail` object. If this | |
* is available on the event object, use it. If not, this is a plain | |
* composition event and we have nothing special to extract. | |
* | |
* @param {object} nativeEvent | |
* @return {?string} | |
*/ | |
function getDataFromCustomEvent(nativeEvent) { | |
var detail = nativeEvent.detail; | |
if (typeof detail === 'object' && 'data' in detail) { | |
return detail.data; | |
} | |
return null; | |
} | |
// Track the current IME composition fallback object, if any. | |
var currentComposition = null; | |
/** | |
* @return {?object} A SyntheticCompositionEvent. | |
*/ | |
function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { | |
var eventType; | |
var fallbackData; | |
if (canUseCompositionEvent) { | |
eventType = getCompositionEventType(topLevelType); | |
} else if (!currentComposition) { | |
if (isFallbackCompositionStart(topLevelType, nativeEvent)) { | |
eventType = eventTypes.compositionStart; | |
} | |
} else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) { | |
eventType = eventTypes.compositionEnd; | |
} | |
if (!eventType) { | |
return null; | |
} | |
if (useFallbackCompositionData) { | |
// The current composition is stored statically and must not be | |
// overwritten while composition continues. | |
if (!currentComposition && eventType === eventTypes.compositionStart) { | |
currentComposition = FallbackCompositionState.getPooled(nativeEventTarget); | |
} else if (eventType === eventTypes.compositionEnd) { | |
if (currentComposition) { | |
fallbackData = currentComposition.getData(); | |
} | |
} | |
} | |
var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget); | |
if (fallbackData) { | |
// Inject data generated from fallback path into the synthetic event. | |
// This matches the property of native CompositionEventInterface. | |
event.data = fallbackData; | |
} else { | |
var customData = getDataFromCustomEvent(nativeEvent); | |
if (customData !== null) { | |
event.data = customData; | |
} | |
} | |
EventPropagators.accumulateTwoPhaseDispatches(event); | |
return event; | |
} | |
/** | |
* @param {string} topLevelType Record from `EventConstants`. | |
* @param {object} nativeEvent Native browser event. | |
* @return {?string} The string corresponding to this `beforeInput` event. | |
*/ | |
function getNativeBeforeInputChars(topLevelType, nativeEvent) { | |
switch (topLevelType) { | |
case 'topCompositionEnd': | |
return getDataFromCustomEvent(nativeEvent); | |
case 'topKeyPress': | |
/** | |
* If native `textInput` events are available, our goal is to make | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment