ant-kline
Version:
对kline.js的自定义修改
1,389 lines (1,331 loc) • 1.83 MB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("jquery"));
else if(typeof define === 'function' && define.amd)
define(["jquery"], factory);
else {
var a = typeof exports === 'object' ? factory(require("jquery")) : factory(root["$"]);
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_62__) {
return /******/ (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;
/******/
/******/ // 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 = 104);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright 2017 Google 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var assert_1 = __webpack_require__(64);
exports.assert = assert_1.assert;
exports.assertionError = assert_1.assertionError;
var crypt_1 = __webpack_require__(65);
exports.base64 = crypt_1.base64;
exports.base64Decode = crypt_1.base64Decode;
exports.base64Encode = crypt_1.base64Encode;
var constants_1 = __webpack_require__(45);
exports.CONSTANTS = constants_1.CONSTANTS;
var deepCopy_1 = __webpack_require__(138);
exports.deepCopy = deepCopy_1.deepCopy;
exports.deepExtend = deepCopy_1.deepExtend;
exports.patchProperty = deepCopy_1.patchProperty;
var deferred_1 = __webpack_require__(139);
exports.Deferred = deferred_1.Deferred;
var environment_1 = __webpack_require__(140);
exports.getUA = environment_1.getUA;
exports.isMobileCordova = environment_1.isMobileCordova;
exports.isNodeSdk = environment_1.isNodeSdk;
exports.isReactNative = environment_1.isReactNative;
var errors_1 = __webpack_require__(141);
exports.ErrorFactory = errors_1.ErrorFactory;
exports.FirebaseError = errors_1.FirebaseError;
exports.patchCapture = errors_1.patchCapture;
var json_1 = __webpack_require__(66);
exports.jsonEval = json_1.jsonEval;
exports.stringify = json_1.stringify;
var jwt_1 = __webpack_require__(142);
exports.decode = jwt_1.decode;
exports.isAdmin = jwt_1.isAdmin;
exports.issuedAtTime = jwt_1.issuedAtTime;
exports.isValidFormat = jwt_1.isValidFormat;
exports.isValidTimestamp = jwt_1.isValidTimestamp;
var obj_1 = __webpack_require__(67);
exports.clone = obj_1.clone;
exports.contains = obj_1.contains;
exports.every = obj_1.every;
exports.extend = obj_1.extend;
exports.findKey = obj_1.findKey;
exports.findValue = obj_1.findValue;
exports.forEach = obj_1.forEach;
exports.getAnyKey = obj_1.getAnyKey;
exports.getCount = obj_1.getCount;
exports.getValues = obj_1.getValues;
exports.isEmpty = obj_1.isEmpty;
exports.isNonNullObject = obj_1.isNonNullObject;
exports.map = obj_1.map;
exports.safeGet = obj_1.safeGet;
var query_1 = __webpack_require__(143);
exports.querystring = query_1.querystring;
exports.querystringDecode = query_1.querystringDecode;
var sha1_1 = __webpack_require__(144);
exports.Sha1 = sha1_1.Sha1;
var subscribe_1 = __webpack_require__(146);
exports.async = subscribe_1.async;
exports.createSubscribe = subscribe_1.createSubscribe;
var validation_1 = __webpack_require__(147);
exports.errorPrefix = validation_1.errorPrefix;
exports.validateArgCount = validation_1.validateArgCount;
exports.validateCallback = validation_1.validateCallback;
exports.validateContextObject = validation_1.validateContextObject;
exports.validateNamespace = validation_1.validateNamespace;
var utf8_1 = __webpack_require__(148);
exports.stringLength = utf8_1.stringLength;
exports.stringToByteArray = utf8_1.stringToByteArray;
//# sourceMappingURL=index.js.map
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright 2017 Google 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = __webpack_require__(0);
var util_2 = __webpack_require__(0);
var util_3 = __webpack_require__(0);
var util_4 = __webpack_require__(0);
var util_5 = __webpack_require__(0);
var util_6 = __webpack_require__(0);
var storage_1 = __webpack_require__(29);
var util_7 = __webpack_require__(0);
var logger_1 = __webpack_require__(155);
var logClient = new logger_1.Logger('@firebase/database');
/**
* Returns a locally-unique ID (generated by just incrementing up from 0 each time its called).
* @type {function(): number} Generated ID.
*/
exports.LUIDGenerator = (function () {
var id = 1;
return function () {
return id++;
};
})();
/**
* Sha1 hash of the input string
* @param {!string} str The string to hash
* @return {!string} The resulting hash
*/
exports.sha1 = function (str) {
var utf8Bytes = util_5.stringToByteArray(str);
var sha1 = new util_4.Sha1();
sha1.update(utf8Bytes);
var sha1Bytes = sha1.digest();
return util_3.base64.encodeByteArray(sha1Bytes);
};
/**
* @param {...*} var_args
* @return {string}
* @private
*/
var buildLogMessage_ = function () {
var var_args = [];
for (var _i = 0; _i < arguments.length; _i++) {
var_args[_i] = arguments[_i];
}
var message = '';
for (var i = 0; i < var_args.length; i++) {
if (Array.isArray(var_args[i]) ||
(var_args[i] &&
typeof var_args[i] === 'object' &&
typeof var_args[i].length === 'number')) {
message += buildLogMessage_.apply(null, var_args[i]);
}
else if (typeof var_args[i] === 'object') {
message += util_6.stringify(var_args[i]);
}
else {
message += var_args[i];
}
message += ' ';
}
return message;
};
/**
* Use this for all debug messages in Firebase.
* @type {?function(string)}
*/
exports.logger = null;
/**
* Flag to check for log availability on first log message
* @type {boolean}
* @private
*/
var firstLog_ = true;
/**
* The implementation of Firebase.enableLogging (defined here to break dependencies)
* @param {boolean|?function(string)} logger_ A flag to turn on logging, or a custom logger
* @param {boolean=} persistent Whether or not to persist logging settings across refreshes
*/
exports.enableLogging = function (logger_, persistent) {
util_1.assert(!persistent || (logger_ === true || logger_ === false), "Can't turn on custom loggers persistently.");
if (logger_ === true) {
logClient.logLevel = logger_1.LogLevel.VERBOSE;
exports.logger = logClient.log.bind(logClient);
if (persistent)
storage_1.SessionStorage.set('logging_enabled', true);
}
else if (typeof logger_ === 'function') {
exports.logger = logger_;
}
else {
exports.logger = null;
storage_1.SessionStorage.remove('logging_enabled');
}
};
/**
*
* @param {...(string|Arguments)} var_args
*/
exports.log = function () {
var var_args = [];
for (var _i = 0; _i < arguments.length; _i++) {
var_args[_i] = arguments[_i];
}
if (firstLog_ === true) {
firstLog_ = false;
if (exports.logger === null && storage_1.SessionStorage.get('logging_enabled') === true)
exports.enableLogging(true);
}
if (exports.logger) {
var message = buildLogMessage_.apply(null, var_args);
exports.logger(message);
}
};
/**
* @param {!string} prefix
* @return {function(...[*])}
*/
exports.logWrapper = function (prefix) {
return function () {
var var_args = [];
for (var _i = 0; _i < arguments.length; _i++) {
var_args[_i] = arguments[_i];
}
exports.log.apply(void 0, [prefix].concat(var_args));
};
};
/**
* @param {...string} var_args
*/
exports.error = function () {
var var_args = [];
for (var _i = 0; _i < arguments.length; _i++) {
var_args[_i] = arguments[_i];
}
var message = 'FIREBASE INTERNAL ERROR: ' + buildLogMessage_.apply(void 0, var_args);
logClient.error(message);
};
/**
* @param {...string} var_args
*/
exports.fatal = function () {
var var_args = [];
for (var _i = 0; _i < arguments.length; _i++) {
var_args[_i] = arguments[_i];
}
var message = "FIREBASE FATAL ERROR: " + buildLogMessage_.apply(void 0, var_args);
logClient.error(message);
throw new Error(message);
};
/**
* @param {...*} var_args
*/
exports.warn = function () {
var var_args = [];
for (var _i = 0; _i < arguments.length; _i++) {
var_args[_i] = arguments[_i];
}
var message = 'FIREBASE WARNING: ' + buildLogMessage_.apply(void 0, var_args);
logClient.warn(message);
};
/**
* Logs a warning if the containing page uses https. Called when a call to new Firebase
* does not use https.
*/
exports.warnIfPageIsSecure = function () {
// Be very careful accessing browser globals. Who knows what may or may not exist.
if (typeof window !== 'undefined' &&
window.location &&
window.location.protocol &&
window.location.protocol.indexOf('https:') !== -1) {
exports.warn('Insecure Firebase access from a secure page. ' +
'Please use https in calls to new Firebase().');
}
};
/**
* @param {!String} methodName
*/
exports.warnAboutUnsupportedMethod = function (methodName) {
exports.warn(methodName +
' is unsupported and will likely change soon. ' +
'Please do not use.');
};
/**
* Returns true if data is NaN, or +/- Infinity.
* @param {*} data
* @return {boolean}
*/
exports.isInvalidJSONNumber = function (data) {
return (typeof data === 'number' &&
(data != data || // NaN
data == Number.POSITIVE_INFINITY ||
data == Number.NEGATIVE_INFINITY));
};
/**
* @param {function()} fn
*/
exports.executeWhenDOMReady = function (fn) {
if (util_7.isNodeSdk() || document.readyState === 'complete') {
fn();
}
else {
// Modeled after jQuery. Try DOMContentLoaded and onreadystatechange (which
// fire before onload), but fall back to onload.
var called_1 = false;
var wrappedFn_1 = function () {
if (!document.body) {
setTimeout(wrappedFn_1, Math.floor(10));
return;
}
if (!called_1) {
called_1 = true;
fn();
}
};
if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', wrappedFn_1, false);
// fallback to onload.
window.addEventListener('load', wrappedFn_1, false);
}
else if (document.attachEvent) {
// IE.
document.attachEvent('onreadystatechange', function () {
if (document.readyState === 'complete')
wrappedFn_1();
});
// fallback to onload.
window.attachEvent('onload', wrappedFn_1);
// jQuery has an extra hack for IE that we could employ (based on
// http://javascript.nwbox.com/IEContentLoaded/) But it looks really old.
// I'm hoping we don't need it.
}
}
};
/**
* Minimum key name. Invalid for actual data, used as a marker to sort before any valid names
* @type {!string}
*/
exports.MIN_NAME = '[MIN_NAME]';
/**
* Maximum key name. Invalid for actual data, used as a marker to sort above any valid names
* @type {!string}
*/
exports.MAX_NAME = '[MAX_NAME]';
/**
* Compares valid Firebase key names, plus min and max name
* @param {!string} a
* @param {!string} b
* @return {!number}
*/
exports.nameCompare = function (a, b) {
if (a === b) {
return 0;
}
else if (a === exports.MIN_NAME || b === exports.MAX_NAME) {
return -1;
}
else if (b === exports.MIN_NAME || a === exports.MAX_NAME) {
return 1;
}
else {
var aAsInt = exports.tryParseInt(a), bAsInt = exports.tryParseInt(b);
if (aAsInt !== null) {
if (bAsInt !== null) {
return aAsInt - bAsInt == 0 ? a.length - b.length : aAsInt - bAsInt;
}
else {
return -1;
}
}
else if (bAsInt !== null) {
return 1;
}
else {
return a < b ? -1 : 1;
}
}
};
/**
* @param {!string} a
* @param {!string} b
* @return {!number} comparison result.
*/
exports.stringCompare = function (a, b) {
if (a === b) {
return 0;
}
else if (a < b) {
return -1;
}
else {
return 1;
}
};
/**
* @param {string} key
* @param {Object} obj
* @return {*}
*/
exports.requireKey = function (key, obj) {
if (obj && key in obj) {
return obj[key];
}
else {
throw new Error('Missing required key (' + key + ') in object: ' + util_6.stringify(obj));
}
};
/**
* @param {*} obj
* @return {string}
*/
exports.ObjectToUniqueKey = function (obj) {
if (typeof obj !== 'object' || obj === null)
return util_6.stringify(obj);
var keys = [];
for (var k in obj) {
keys.push(k);
}
// Export as json, but with the keys sorted.
keys.sort();
var key = '{';
for (var i = 0; i < keys.length; i++) {
if (i !== 0)
key += ',';
key += util_6.stringify(keys[i]);
key += ':';
key += exports.ObjectToUniqueKey(obj[keys[i]]);
}
key += '}';
return key;
};
/**
* Splits a string into a number of smaller segments of maximum size
* @param {!string} str The string
* @param {!number} segsize The maximum number of chars in the string.
* @return {Array.<string>} The string, split into appropriately-sized chunks
*/
exports.splitStringBySize = function (str, segsize) {
var len = str.length;
if (len <= segsize) {
return [str];
}
var dataSegs = [];
for (var c = 0; c < len; c += segsize) {
if (c + segsize > len) {
dataSegs.push(str.substring(c, len));
}
else {
dataSegs.push(str.substring(c, c + segsize));
}
}
return dataSegs;
};
/**
* Apply a function to each (key, value) pair in an object or
* apply a function to each (index, value) pair in an array
* @param {!(Object|Array)} obj The object or array to iterate over
* @param {function(?, ?)} fn The function to apply
*/
exports.each = function (obj, fn) {
if (Array.isArray(obj)) {
for (var i = 0; i < obj.length; ++i) {
fn(i, obj[i]);
}
}
else {
/**
* in the conversion of code we removed the goog.object.forEach
* function which did a value,key callback. We standardized on
* a single impl that does a key, value callback. So we invert
* to not have to touch the `each` code points
*/
util_2.forEach(obj, function (key, val) { return fn(val, key); });
}
};
/**
* Like goog.bind, but doesn't bother to create a closure if opt_context is null/undefined.
* @param {function(*)} callback Callback function.
* @param {?Object=} context Optional context to bind to.
* @return {function(*)}
*/
exports.bindCallback = function (callback, context) {
return context ? callback.bind(context) : callback;
};
/**
* Borrowed from http://hg.secondlife.com/llsd/src/tip/js/typedarray.js (MIT License)
* I made one modification at the end and removed the NaN / Infinity
* handling (since it seemed broken [caused an overflow] and we don't need it). See MJL comments.
* @param {!number} v A double
* @return {string}
*/
exports.doubleToIEEE754String = function (v) {
util_1.assert(!exports.isInvalidJSONNumber(v), 'Invalid JSON number'); // MJL
var ebits = 11, fbits = 52;
var bias = (1 << (ebits - 1)) - 1, s, e, f, ln, i, bits, str;
// Compute sign, exponent, fraction
// Skip NaN / Infinity handling --MJL.
if (v === 0) {
e = 0;
f = 0;
s = 1 / v === -Infinity ? 1 : 0;
}
else {
s = v < 0;
v = Math.abs(v);
if (v >= Math.pow(2, 1 - bias)) {
// Normalized
ln = Math.min(Math.floor(Math.log(v) / Math.LN2), bias);
e = ln + bias;
f = Math.round(v * Math.pow(2, fbits - ln) - Math.pow(2, fbits));
}
else {
// Denormalized
e = 0;
f = Math.round(v / Math.pow(2, 1 - bias - fbits));
}
}
// Pack sign, exponent, fraction
bits = [];
for (i = fbits; i; i -= 1) {
bits.push(f % 2 ? 1 : 0);
f = Math.floor(f / 2);
}
for (i = ebits; i; i -= 1) {
bits.push(e % 2 ? 1 : 0);
e = Math.floor(e / 2);
}
bits.push(s ? 1 : 0);
bits.reverse();
str = bits.join('');
// Return the data as a hex string. --MJL
var hexByteString = '';
for (i = 0; i < 64; i += 8) {
var hexByte = parseInt(str.substr(i, 8), 2).toString(16);
if (hexByte.length === 1)
hexByte = '0' + hexByte;
hexByteString = hexByteString + hexByte;
}
return hexByteString.toLowerCase();
};
/**
* Used to detect if we're in a Chrome content script (which executes in an
* isolated environment where long-polling doesn't work).
* @return {boolean}
*/
exports.isChromeExtensionContentScript = function () {
return !!(typeof window === 'object' &&
window['chrome'] &&
window['chrome']['extension'] &&
!/^chrome/.test(window.location.href));
};
/**
* Used to detect if we're in a Windows 8 Store app.
* @return {boolean}
*/
exports.isWindowsStoreApp = function () {
// Check for the presence of a couple WinRT globals
return typeof Windows === 'object' && typeof Windows.UI === 'object';
};
/**
* Converts a server error code to a Javascript Error
* @param {!string} code
* @param {!Query} query
* @return {Error}
*/
exports.errorForServerCode = function (code, query) {
var reason = 'Unknown Error';
if (code === 'too_big') {
reason =
'The data requested exceeds the maximum size ' +
'that can be accessed with a single request.';
}
else if (code == 'permission_denied') {
reason = "Client doesn't have permission to access the desired data.";
}
else if (code == 'unavailable') {
reason = 'The service is unavailable';
}
var error = new Error(code + ' at ' + query.path.toString() + ': ' + reason);
error.code = code.toUpperCase();
return error;
};
/**
* Used to test for integer-looking strings
* @type {RegExp}
* @private
*/
exports.INTEGER_REGEXP_ = new RegExp('^-?\\d{1,10}$');
/**
* If the string contains a 32-bit integer, return it. Else return null.
* @param {!string} str
* @return {?number}
*/
exports.tryParseInt = function (str) {
if (exports.INTEGER_REGEXP_.test(str)) {
var intVal = Number(str);
if (intVal >= -2147483648 && intVal <= 2147483647) {
return intVal;
}
}
return null;
};
/**
* Helper to run some code but catch any exceptions and re-throw them later.
* Useful for preventing user callbacks from breaking internal code.
*
* Re-throwing the exception from a setTimeout is a little evil, but it's very
* convenient (we don't have to try to figure out when is a safe point to
* re-throw it), and the behavior seems reasonable:
*
* * If you aren't pausing on exceptions, you get an error in the console with
* the correct stack trace.
* * If you're pausing on all exceptions, the debugger will pause on your
* exception and then again when we rethrow it.
* * If you're only pausing on uncaught exceptions, the debugger will only pause
* on us re-throwing it.
*
* @param {!function()} fn The code to guard.
*/
exports.exceptionGuard = function (fn) {
try {
fn();
}
catch (e) {
// Re-throw exception when it's safe.
setTimeout(function () {
// It used to be that "throw e" would result in a good console error with
// relevant context, but as of Chrome 39, you just get the firebase.js
// file/line number where we re-throw it, which is useless. So we log
// e.stack explicitly.
var stack = e.stack || '';
exports.warn('Exception was thrown by user callback.', stack);
throw e;
}, Math.floor(0));
}
};
/**
* Helper function to safely call opt_callback with the specified arguments. It:
* 1. Turns into a no-op if opt_callback is null or undefined.
* 2. Wraps the call inside exceptionGuard to prevent exceptions from breaking our state.
*
* @param {?Function=} callback Optional onComplete callback.
* @param {...*} var_args Arbitrary args to be passed to opt_onComplete
*/
exports.callUserCallback = function (callback) {
var var_args = [];
for (var _i = 1; _i < arguments.length; _i++) {
var_args[_i - 1] = arguments[_i];
}
if (typeof callback === 'function') {
exports.exceptionGuard(function () {
callback.apply(void 0, var_args);
});
}
};
/**
* @return {boolean} true if we think we're currently being crawled.
*/
exports.beingCrawled = function () {
var userAgent = (typeof window === 'object' &&
window['navigator'] &&
window['navigator']['userAgent']) ||
'';
// For now we whitelist the most popular crawlers. We should refine this to be the set of crawlers we
// believe to support JavaScript/AJAX rendering.
// NOTE: Google Webmaster Tools doesn't really belong, but their "This is how a visitor to your website
// would have seen the page" is flaky if we don't treat it as a crawler.
return (userAgent.search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i) >= 0);
};
/**
* Export a property of an object using a getter function.
*
* @param {!Object} object
* @param {string} name
* @param {!function(): *} fnGet
*/
exports.exportPropGetter = function (object, name, fnGet) {
Object.defineProperty(object, name, { get: fnGet });
};
/**
* Same as setTimeout() except on Node.JS it will /not/ prevent the process from exiting.
*
* It is removed with clearTimeout() as normal.
*
* @param {Function} fn Function to run.
* @param {number} time Milliseconds to wait before running.
* @return {number|Object} The setTimeout() return value.
*/
exports.setTimeoutNonBlocking = function (fn, time) {
var timeout = setTimeout(fn, time);
if (typeof timeout === 'object' && timeout['unref']) {
timeout['unref']();
}
return timeout;
};
//# sourceMappingURL=util.js.map
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright 2017 Google 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = __webpack_require__(1);
var util_2 = __webpack_require__(0);
/**
* An immutable object representing a parsed path. It's immutable so that you
* can pass them around to other functions without worrying about them changing
* it.
*/
var Path = /** @class */ (function () {
/**
* @param {string|Array.<string>} pathOrString Path string to parse,
* or another path, or the raw tokens array
* @param {number=} pieceNum
*/
function Path(pathOrString, pieceNum) {
if (pieceNum === void 0) {
this.pieces_ = pathOrString.split('/');
// Remove empty pieces.
var copyTo = 0;
for (var i = 0; i < this.pieces_.length; i++) {
if (this.pieces_[i].length > 0) {
this.pieces_[copyTo] = this.pieces_[i];
copyTo++;
}
}
this.pieces_.length = copyTo;
this.pieceNum_ = 0;
}
else {
this.pieces_ = pathOrString;
this.pieceNum_ = pieceNum;
}
}
Object.defineProperty(Path, "Empty", {
/**
* Singleton to represent an empty path
*
* @const
*/
get: function () {
return new Path('');
},
enumerable: true,
configurable: true
});
Path.prototype.getFront = function () {
if (this.pieceNum_ >= this.pieces_.length)
return null;
return this.pieces_[this.pieceNum_];
};
/**
* @return {number} The number of segments in this path
*/
Path.prototype.getLength = function () {
return this.pieces_.length - this.pieceNum_;
};
/**
* @return {!Path}
*/
Path.prototype.popFront = function () {
var pieceNum = this.pieceNum_;
if (pieceNum < this.pieces_.length) {
pieceNum++;
}
return new Path(this.pieces_, pieceNum);
};
/**
* @return {?string}
*/
Path.prototype.getBack = function () {
if (this.pieceNum_ < this.pieces_.length)
return this.pieces_[this.pieces_.length - 1];
return null;
};
Path.prototype.toString = function () {
var pathString = '';
for (var i = this.pieceNum_; i < this.pieces_.length; i++) {
if (this.pieces_[i] !== '')
pathString += '/' + this.pieces_[i];
}
return pathString || '/';
};
Path.prototype.toUrlEncodedString = function () {
var pathString = '';
for (var i = this.pieceNum_; i < this.pieces_.length; i++) {
if (this.pieces_[i] !== '')
pathString += '/' + encodeURIComponent(String(this.pieces_[i]));
}
return pathString || '/';
};
/**
* Shallow copy of the parts of the path.
*
* @param {number=} begin
* @return {!Array<string>}
*/
Path.prototype.slice = function (begin) {
if (begin === void 0) { begin = 0; }
return this.pieces_.slice(this.pieceNum_ + begin);
};
/**
* @return {?Path}
*/
Path.prototype.parent = function () {
if (this.pieceNum_ >= this.pieces_.length)
return null;
var pieces = [];
for (var i = this.pieceNum_; i < this.pieces_.length - 1; i++)
pieces.push(this.pieces_[i]);
return new Path(pieces, 0);
};
/**
* @param {string|!Path} childPathObj
* @return {!Path}
*/
Path.prototype.child = function (childPathObj) {
var pieces = [];
for (var i = this.pieceNum_; i < this.pieces_.length; i++)
pieces.push(this.pieces_[i]);
if (childPathObj instanceof Path) {
for (var i = childPathObj.pieceNum_; i < childPathObj.pieces_.length; i++) {
pieces.push(childPathObj.pieces_[i]);
}
}
else {
var childPieces = childPathObj.split('/');
for (var i = 0; i < childPieces.length; i++) {
if (childPieces[i].length > 0)
pieces.push(childPieces[i]);
}
}
return new Path(pieces, 0);
};
/**
* @return {boolean} True if there are no segments in this path
*/
Path.prototype.isEmpty = function () {
return this.pieceNum_ >= this.pieces_.length;
};
/**
* @param {!Path} outerPath
* @param {!Path} innerPath
* @return {!Path} The path from outerPath to innerPath
*/
Path.relativePath = function (outerPath, innerPath) {
var outer = outerPath.getFront(), inner = innerPath.getFront();
if (outer === null) {
return innerPath;
}
else if (outer === inner) {
return Path.relativePath(outerPath.popFront(), innerPath.popFront());
}
else {
throw new Error('INTERNAL ERROR: innerPath (' +
innerPath +
') is not within ' +
'outerPath (' +
outerPath +
')');
}
};
/**
* @param {!Path} left
* @param {!Path} right
* @return {number} -1, 0, 1 if left is less, equal, or greater than the right.
*/
Path.comparePaths = function (left, right) {
var leftKeys = left.slice();
var rightKeys = right.slice();
for (var i = 0; i < leftKeys.length && i < rightKeys.length; i++) {
var cmp = util_1.nameCompare(leftKeys[i], rightKeys[i]);
if (cmp !== 0)
return cmp;
}
if (leftKeys.length === rightKeys.length)
return 0;
return leftKeys.length < rightKeys.length ? -1 : 1;
};
/**
*
* @param {Path} other
* @return {boolean} true if paths are the same.
*/
Path.prototype.equals = function (other) {
if (this.getLength() !== other.getLength()) {
return false;
}
for (var i = this.pieceNum_, j = other.pieceNum_; i <= this.pieces_.length; i++, j++) {
if (this.pieces_[i] !== other.pieces_[j]) {
return false;
}
}
return true;
};
/**
*
* @param {!Path} other
* @return {boolean} True if this path is a parent (or the same as) other
*/
Path.prototype.contains = function (other) {
var i = this.pieceNum_;
var j = other.pieceNum_;
if (this.getLength() > other.getLength()) {
return false;
}
while (i < this.pieces_.length) {
if (this.pieces_[i] !== other.pieces_[j]) {
return false;
}
++i;
++j;
}
return true;
};
return Path;
}()); // end Path
exports.Path = Path;
/**
* Dynamic (mutable) path used to count path lengths.
*
* This class is used to efficiently check paths for valid
* length (in UTF8 bytes) and depth (used in path validation).
*
* Throws Error exception if path is ever invalid.
*
* The definition of a path always begins with '/'.
*/
var ValidationPath = /** @class */ (function () {
/**
* @param {!Path} path Initial Path.
* @param {string} errorPrefix_ Prefix for any error messages.
*/
function ValidationPath(path, errorPrefix_) {
this.errorPrefix_ = errorPrefix_;
/** @type {!Array<string>} */
this.parts_ = path.slice();
/** @type {number} Initialize to number of '/' chars needed in path. */
this.byteLength_ = Math.max(1, this.parts_.length);
for (var i = 0; i < this.parts_.length; i++) {
this.byteLength_ += util_2.stringLength(this.parts_[i]);
}
this.checkValid_();
}
Object.defineProperty(ValidationPath, "MAX_PATH_DEPTH", {
/** @const {number} Maximum key depth. */
get: function () {
return 32;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ValidationPath, "MAX_PATH_LENGTH_BYTES", {
/** @const {number} Maximum number of (UTF8) bytes in a Firebase path. */
get: function () {
return 768;
},
enumerable: true,
configurable: true
});
/** @param {string} child */
ValidationPath.prototype.push = function (child) {
// Count the needed '/'
if (this.parts_.length > 0) {
this.byteLength_ += 1;
}
this.parts_.push(child);
this.byteLength_ += util_2.stringLength(child);
this.checkValid_();
};
ValidationPath.prototype.pop = function () {
var last = this.parts_.pop();
this.byteLength_ -= util_2.stringLength(last);
// Un-count the previous '/'
if (this.parts_.length > 0) {
this.byteLength_ -= 1;
}
};
ValidationPath.prototype.checkValid_ = function () {
if (this.byteLength_ > ValidationPath.MAX_PATH_LENGTH_BYTES) {
throw new Error(this.errorPrefix_ +
'has a key path longer than ' +
ValidationPath.MAX_PATH_LENGTH_BYTES +
' bytes (' +
this.byteLength_ +
').');
}
if (this.parts_.length > ValidationPath.MAX_PATH_DEPTH) {
throw new Error(this.errorPrefix_ +
'path specified exceeds the maximum depth that can be written (' +
ValidationPath.MAX_PATH_DEPTH +
') or object contains a cycle ' +
this.toErrorString());
}
};
/**
* String for use in error messages - uses '.' notation for path.
*
* @return {string}
*/
ValidationPath.prototype.toErrorString = function () {
if (this.parts_.length == 0) {
return '';
}
return "in property '" + this.parts_.join('.') + "'";
};
return ValidationPath;
}());
exports.ValidationPath = ValidationPath;
//# sourceMappingURL=Path.js.map
/***/ }),
/* 3 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony export (immutable) */ __webpack_exports__["__extends"] = __extends;
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
/* harmony export (immutable) */ __webpack_exports__["__rest"] = __rest;
/* harmony export (immutable) */ __webpack_exports__["__decorate"] = __decorate;
/* harmony export (immutable) */ __webpack_exports__["__param"] = __param;
/* harmony export (immutable) */ __webpack_exports__["__metadata"] = __metadata;
/* harmony export (immutable) */ __webpack_exports__["__awaiter"] = __awaiter;
/* harmony export (immutable) */ __webpack_exports__["__generator"] = __generator;
/* harmony export (immutable) */ __webpack_exports__["__exportStar"] = __exportStar;
/* harmony export (immutable) */ __webpack_exports__["__values"] = __values;
/* harmony export (immutable) */ __webpack_exports__["__read"] = __read;
/* harmony export (immutable) */ __webpack_exports__["__spread"] = __spread;
/* harmony export (immutable) */ __webpack_exports__["__await"] = __await;
/* harmony export (immutable) */ __webpack_exports__["__asyncGenerator"] = __asyncGenerator;
/* harmony export (immutable) */ __webpack_exports__["__asyncDelegator"] = __asyncDelegator;
/* harmony export (immutable) */ __webpack_exports__["__asyncValues"] = __asyncValues;
/* harmony export (immutable) */ __webpack_exports__["__makeTemplateObject"] = __makeTemplateObject;
/* harmony export (immutable) */ __webpack_exports__["__importStar"] = __importStar;
/* harmony export (immutable) */ __webpack_exports__["__importDefault"] = __importDefault;
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
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
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
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 extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(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;
}
return __assign.apply(this, arguments);
}
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
function __awaiter(thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
function __exportStar(m, exports) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
function __values(o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
}
function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result.default = mod;
return result;
}
function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
/***/ }),
/* 4 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ChartManager; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__control__ = __webpack_require__(38);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__chart__ = __webpack_require__(105);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__indicators__ = __webpack_require__(109);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__ranges__ = __webpack_require__(61);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__templates__ = __webpack_require__(27);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__data_sources__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__chart_settings__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__data_providers__ = __webpack_require__(43);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__themes__ = __webpack_require__(22);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__plotters__ = __webpack_require__(41);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__ctools__ = __webpack_require__(40);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__areas__ = __webpack_require__(44);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__util__ = __webpack_require__(21);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var ChartManager =
/*#__PURE__*/
function () {
function ChartManager() {
_classCallCheck(this, ChartManager);
this._dataSources = {};
this._dataSourceCache = {};
this._dataProviders = {};
this._frames = {};
this._areas = {};
this._timelines = {};
this._ranges = {};
this._plotters = {};
this._themes = {};
this._titles = {};
this._frameMousePos = {};
this._dsChartStyle = {};
this._dragStarted = false;
this._oldX = 0;
this._fakeIndicators =