diff --git a/Enegrecer.htm b/Enegrecer.htm new file mode 100644 index 00000000..1100c984 --- /dev/null +++ b/Enegrecer.htm @@ -0,0 +1,11978 @@ + + + + + + + + + + + + Enegrecer + + + +

Redux Form Validation

+ + + +

\ No newline at end of file diff --git a/Enegrecer_files/bundle.js b/Enegrecer_files/bundle.js new file mode 100644 index 00000000..cb53fdc6 --- /dev/null +++ b/Enegrecer_files/bundle.js @@ -0,0 +1,117761 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ function hotDisposeChunk(chunkId) { +/******/ delete installedChunks[chunkId]; +/******/ } +/******/ var parentHotUpdateCallback = this["webpackHotUpdate"]; +/******/ this["webpackHotUpdate"] = +/******/ function webpackHotUpdateCallback(chunkId, moreModules) { // eslint-disable-line no-unused-vars +/******/ hotAddUpdateChunk(chunkId, moreModules); +/******/ if(parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules); +/******/ } ; +/******/ +/******/ function hotDownloadUpdateChunk(chunkId) { // eslint-disable-line no-unused-vars +/******/ var head = document.getElementsByTagName("head")[0]; +/******/ var script = document.createElement("script"); +/******/ script.type = "text/javascript"; +/******/ script.charset = "utf-8"; +/******/ script.src = __webpack_require__.p + "" + chunkId + "." + hotCurrentHash + ".hot-update.js"; +/******/ ; +/******/ head.appendChild(script); +/******/ } +/******/ +/******/ function hotDownloadManifest(requestTimeout) { // eslint-disable-line no-unused-vars +/******/ requestTimeout = requestTimeout || 10000; +/******/ return new Promise(function(resolve, reject) { +/******/ if(typeof XMLHttpRequest === "undefined") +/******/ return reject(new Error("No browser support")); +/******/ try { +/******/ var request = new XMLHttpRequest(); +/******/ var requestPath = __webpack_require__.p + "" + hotCurrentHash + ".hot-update.json"; +/******/ request.open("GET", requestPath, true); +/******/ request.timeout = requestTimeout; +/******/ request.send(null); +/******/ } catch(err) { +/******/ return reject(err); +/******/ } +/******/ request.onreadystatechange = function() { +/******/ if(request.readyState !== 4) return; +/******/ if(request.status === 0) { +/******/ // timeout +/******/ reject(new Error("Manifest request to " + requestPath + " timed out.")); +/******/ } else if(request.status === 404) { +/******/ // no update available +/******/ resolve(); +/******/ } else if(request.status !== 200 && request.status !== 304) { +/******/ // other failure +/******/ reject(new Error("Manifest request to " + requestPath + " failed.")); +/******/ } else { +/******/ // success +/******/ try { +/******/ var update = JSON.parse(request.responseText); +/******/ } catch(e) { +/******/ reject(e); +/******/ return; +/******/ } +/******/ resolve(update); +/******/ } +/******/ }; +/******/ }); +/******/ } +/******/ +/******/ +/******/ +/******/ var hotApplyOnUpdate = true; +/******/ var hotCurrentHash = "2b2a13c4fb4fdb2a3d43"; // eslint-disable-line no-unused-vars +/******/ var hotRequestTimeout = 10000; +/******/ var hotCurrentModuleData = {}; +/******/ var hotCurrentChildModule; // eslint-disable-line no-unused-vars +/******/ var hotCurrentParents = []; // eslint-disable-line no-unused-vars +/******/ var hotCurrentParentsTemp = []; // eslint-disable-line no-unused-vars +/******/ +/******/ function hotCreateRequire(moduleId) { // eslint-disable-line no-unused-vars +/******/ var me = installedModules[moduleId]; +/******/ if(!me) return __webpack_require__; +/******/ var fn = function(request) { +/******/ if(me.hot.active) { +/******/ if(installedModules[request]) { +/******/ if(installedModules[request].parents.indexOf(moduleId) < 0) +/******/ installedModules[request].parents.push(moduleId); +/******/ } else { +/******/ hotCurrentParents = [moduleId]; +/******/ hotCurrentChildModule = request; +/******/ } +/******/ if(me.children.indexOf(request) < 0) +/******/ me.children.push(request); +/******/ } else { +/******/ console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId); +/******/ hotCurrentParents = []; +/******/ } +/******/ return __webpack_require__(request); +/******/ }; +/******/ var ObjectFactory = function ObjectFactory(name) { +/******/ return { +/******/ configurable: true, +/******/ enumerable: true, +/******/ get: function() { +/******/ return __webpack_require__[name]; +/******/ }, +/******/ set: function(value) { +/******/ __webpack_require__[name] = value; +/******/ } +/******/ }; +/******/ }; +/******/ for(var name in __webpack_require__) { +/******/ if(Object.prototype.hasOwnProperty.call(__webpack_require__, name) && name !== "e") { +/******/ Object.defineProperty(fn, name, ObjectFactory(name)); +/******/ } +/******/ } +/******/ fn.e = function(chunkId) { +/******/ if(hotStatus === "ready") +/******/ hotSetStatus("prepare"); +/******/ hotChunksLoading++; +/******/ return __webpack_require__.e(chunkId).then(finishChunkLoading, function(err) { +/******/ finishChunkLoading(); +/******/ throw err; +/******/ }); +/******/ +/******/ function finishChunkLoading() { +/******/ hotChunksLoading--; +/******/ if(hotStatus === "prepare") { +/******/ if(!hotWaitingFilesMap[chunkId]) { +/******/ hotEnsureUpdateChunk(chunkId); +/******/ } +/******/ if(hotChunksLoading === 0 && hotWaitingFiles === 0) { +/******/ hotUpdateDownloaded(); +/******/ } +/******/ } +/******/ } +/******/ }; +/******/ return fn; +/******/ } +/******/ +/******/ function hotCreateModule(moduleId) { // eslint-disable-line no-unused-vars +/******/ var hot = { +/******/ // private stuff +/******/ _acceptedDependencies: {}, +/******/ _declinedDependencies: {}, +/******/ _selfAccepted: false, +/******/ _selfDeclined: false, +/******/ _disposeHandlers: [], +/******/ _main: hotCurrentChildModule !== moduleId, +/******/ +/******/ // Module API +/******/ active: true, +/******/ accept: function(dep, callback) { +/******/ if(typeof dep === "undefined") +/******/ hot._selfAccepted = true; +/******/ else if(typeof dep === "function") +/******/ hot._selfAccepted = dep; +/******/ else if(typeof dep === "object") +/******/ for(var i = 0; i < dep.length; i++) +/******/ hot._acceptedDependencies[dep[i]] = callback || function() {}; +/******/ else +/******/ hot._acceptedDependencies[dep] = callback || function() {}; +/******/ }, +/******/ decline: function(dep) { +/******/ if(typeof dep === "undefined") +/******/ hot._selfDeclined = true; +/******/ else if(typeof dep === "object") +/******/ for(var i = 0; i < dep.length; i++) +/******/ hot._declinedDependencies[dep[i]] = true; +/******/ else +/******/ hot._declinedDependencies[dep] = true; +/******/ }, +/******/ dispose: function(callback) { +/******/ hot._disposeHandlers.push(callback); +/******/ }, +/******/ addDisposeHandler: function(callback) { +/******/ hot._disposeHandlers.push(callback); +/******/ }, +/******/ removeDisposeHandler: function(callback) { +/******/ var idx = hot._disposeHandlers.indexOf(callback); +/******/ if(idx >= 0) hot._disposeHandlers.splice(idx, 1); +/******/ }, +/******/ +/******/ // Management API +/******/ check: hotCheck, +/******/ apply: hotApply, +/******/ status: function(l) { +/******/ if(!l) return hotStatus; +/******/ hotStatusHandlers.push(l); +/******/ }, +/******/ addStatusHandler: function(l) { +/******/ hotStatusHandlers.push(l); +/******/ }, +/******/ removeStatusHandler: function(l) { +/******/ var idx = hotStatusHandlers.indexOf(l); +/******/ if(idx >= 0) hotStatusHandlers.splice(idx, 1); +/******/ }, +/******/ +/******/ //inherit from previous dispose call +/******/ data: hotCurrentModuleData[moduleId] +/******/ }; +/******/ hotCurrentChildModule = undefined; +/******/ return hot; +/******/ } +/******/ +/******/ var hotStatusHandlers = []; +/******/ var hotStatus = "idle"; +/******/ +/******/ function hotSetStatus(newStatus) { +/******/ hotStatus = newStatus; +/******/ for(var i = 0; i < hotStatusHandlers.length; i++) +/******/ hotStatusHandlers[i].call(null, newStatus); +/******/ } +/******/ +/******/ // while downloading +/******/ var hotWaitingFiles = 0; +/******/ var hotChunksLoading = 0; +/******/ var hotWaitingFilesMap = {}; +/******/ var hotRequestedFilesMap = {}; +/******/ var hotAvailableFilesMap = {}; +/******/ var hotDeferred; +/******/ +/******/ // The update info +/******/ var hotUpdate, hotUpdateNewHash; +/******/ +/******/ function toModuleId(id) { +/******/ var isNumber = (+id) + "" === id; +/******/ return isNumber ? +id : id; +/******/ } +/******/ +/******/ function hotCheck(apply) { +/******/ if(hotStatus !== "idle") throw new Error("check() is only allowed in idle status"); +/******/ hotApplyOnUpdate = apply; +/******/ hotSetStatus("check"); +/******/ return hotDownloadManifest(hotRequestTimeout).then(function(update) { +/******/ if(!update) { +/******/ hotSetStatus("idle"); +/******/ return null; +/******/ } +/******/ hotRequestedFilesMap = {}; +/******/ hotWaitingFilesMap = {}; +/******/ hotAvailableFilesMap = update.c; +/******/ hotUpdateNewHash = update.h; +/******/ +/******/ hotSetStatus("prepare"); +/******/ var promise = new Promise(function(resolve, reject) { +/******/ hotDeferred = { +/******/ resolve: resolve, +/******/ reject: reject +/******/ }; +/******/ }); +/******/ hotUpdate = {}; +/******/ var chunkId = 0; +/******/ { // eslint-disable-line no-lone-blocks +/******/ /*globals chunkId */ +/******/ hotEnsureUpdateChunk(chunkId); +/******/ } +/******/ if(hotStatus === "prepare" && hotChunksLoading === 0 && hotWaitingFiles === 0) { +/******/ hotUpdateDownloaded(); +/******/ } +/******/ return promise; +/******/ }); +/******/ } +/******/ +/******/ function hotAddUpdateChunk(chunkId, moreModules) { // eslint-disable-line no-unused-vars +/******/ if(!hotAvailableFilesMap[chunkId] || !hotRequestedFilesMap[chunkId]) +/******/ return; +/******/ hotRequestedFilesMap[chunkId] = false; +/******/ for(var moduleId in moreModules) { +/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { +/******/ hotUpdate[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(--hotWaitingFiles === 0 && hotChunksLoading === 0) { +/******/ hotUpdateDownloaded(); +/******/ } +/******/ } +/******/ +/******/ function hotEnsureUpdateChunk(chunkId) { +/******/ if(!hotAvailableFilesMap[chunkId]) { +/******/ hotWaitingFilesMap[chunkId] = true; +/******/ } else { +/******/ hotRequestedFilesMap[chunkId] = true; +/******/ hotWaitingFiles++; +/******/ hotDownloadUpdateChunk(chunkId); +/******/ } +/******/ } +/******/ +/******/ function hotUpdateDownloaded() { +/******/ hotSetStatus("ready"); +/******/ var deferred = hotDeferred; +/******/ hotDeferred = null; +/******/ if(!deferred) return; +/******/ if(hotApplyOnUpdate) { +/******/ // Wrap deferred object in Promise to mark it as a well-handled Promise to +/******/ // avoid triggering uncaught exception warning in Chrome. +/******/ // See https://bugs.chromium.org/p/chromium/issues/detail?id=465666 +/******/ Promise.resolve().then(function() { +/******/ return hotApply(hotApplyOnUpdate); +/******/ }).then( +/******/ function(result) { +/******/ deferred.resolve(result); +/******/ }, +/******/ function(err) { +/******/ deferred.reject(err); +/******/ } +/******/ ); +/******/ } else { +/******/ var outdatedModules = []; +/******/ for(var id in hotUpdate) { +/******/ if(Object.prototype.hasOwnProperty.call(hotUpdate, id)) { +/******/ outdatedModules.push(toModuleId(id)); +/******/ } +/******/ } +/******/ deferred.resolve(outdatedModules); +/******/ } +/******/ } +/******/ +/******/ function hotApply(options) { +/******/ if(hotStatus !== "ready") throw new Error("apply() is only allowed in ready status"); +/******/ options = options || {}; +/******/ +/******/ var cb; +/******/ var i; +/******/ var j; +/******/ var module; +/******/ var moduleId; +/******/ +/******/ function getAffectedStuff(updateModuleId) { +/******/ var outdatedModules = [updateModuleId]; +/******/ var outdatedDependencies = {}; +/******/ +/******/ var queue = outdatedModules.slice().map(function(id) { +/******/ return { +/******/ chain: [id], +/******/ id: id +/******/ }; +/******/ }); +/******/ while(queue.length > 0) { +/******/ var queueItem = queue.pop(); +/******/ var moduleId = queueItem.id; +/******/ var chain = queueItem.chain; +/******/ module = installedModules[moduleId]; +/******/ if(!module || module.hot._selfAccepted) +/******/ continue; +/******/ if(module.hot._selfDeclined) { +/******/ return { +/******/ type: "self-declined", +/******/ chain: chain, +/******/ moduleId: moduleId +/******/ }; +/******/ } +/******/ if(module.hot._main) { +/******/ return { +/******/ type: "unaccepted", +/******/ chain: chain, +/******/ moduleId: moduleId +/******/ }; +/******/ } +/******/ for(var i = 0; i < module.parents.length; i++) { +/******/ var parentId = module.parents[i]; +/******/ var parent = installedModules[parentId]; +/******/ if(!parent) continue; +/******/ if(parent.hot._declinedDependencies[moduleId]) { +/******/ return { +/******/ type: "declined", +/******/ chain: chain.concat([parentId]), +/******/ moduleId: moduleId, +/******/ parentId: parentId +/******/ }; +/******/ } +/******/ if(outdatedModules.indexOf(parentId) >= 0) continue; +/******/ if(parent.hot._acceptedDependencies[moduleId]) { +/******/ if(!outdatedDependencies[parentId]) +/******/ outdatedDependencies[parentId] = []; +/******/ addAllToSet(outdatedDependencies[parentId], [moduleId]); +/******/ continue; +/******/ } +/******/ delete outdatedDependencies[parentId]; +/******/ outdatedModules.push(parentId); +/******/ queue.push({ +/******/ chain: chain.concat([parentId]), +/******/ id: parentId +/******/ }); +/******/ } +/******/ } +/******/ +/******/ return { +/******/ type: "accepted", +/******/ moduleId: updateModuleId, +/******/ outdatedModules: outdatedModules, +/******/ outdatedDependencies: outdatedDependencies +/******/ }; +/******/ } +/******/ +/******/ function addAllToSet(a, b) { +/******/ for(var i = 0; i < b.length; i++) { +/******/ var item = b[i]; +/******/ if(a.indexOf(item) < 0) +/******/ a.push(item); +/******/ } +/******/ } +/******/ +/******/ // at begin all updates modules are outdated +/******/ // the "outdated" status can propagate to parents if they don't accept the children +/******/ var outdatedDependencies = {}; +/******/ var outdatedModules = []; +/******/ var appliedUpdate = {}; +/******/ +/******/ var warnUnexpectedRequire = function warnUnexpectedRequire() { +/******/ console.warn("[HMR] unexpected require(" + result.moduleId + ") to disposed module"); +/******/ }; +/******/ +/******/ for(var id in hotUpdate) { +/******/ if(Object.prototype.hasOwnProperty.call(hotUpdate, id)) { +/******/ moduleId = toModuleId(id); +/******/ var result; +/******/ if(hotUpdate[id]) { +/******/ result = getAffectedStuff(moduleId); +/******/ } else { +/******/ result = { +/******/ type: "disposed", +/******/ moduleId: id +/******/ }; +/******/ } +/******/ var abortError = false; +/******/ var doApply = false; +/******/ var doDispose = false; +/******/ var chainInfo = ""; +/******/ if(result.chain) { +/******/ chainInfo = "\nUpdate propagation: " + result.chain.join(" -> "); +/******/ } +/******/ switch(result.type) { +/******/ case "self-declined": +/******/ if(options.onDeclined) +/******/ options.onDeclined(result); +/******/ if(!options.ignoreDeclined) +/******/ abortError = new Error("Aborted because of self decline: " + result.moduleId + chainInfo); +/******/ break; +/******/ case "declined": +/******/ if(options.onDeclined) +/******/ options.onDeclined(result); +/******/ if(!options.ignoreDeclined) +/******/ abortError = new Error("Aborted because of declined dependency: " + result.moduleId + " in " + result.parentId + chainInfo); +/******/ break; +/******/ case "unaccepted": +/******/ if(options.onUnaccepted) +/******/ options.onUnaccepted(result); +/******/ if(!options.ignoreUnaccepted) +/******/ abortError = new Error("Aborted because " + moduleId + " is not accepted" + chainInfo); +/******/ break; +/******/ case "accepted": +/******/ if(options.onAccepted) +/******/ options.onAccepted(result); +/******/ doApply = true; +/******/ break; +/******/ case "disposed": +/******/ if(options.onDisposed) +/******/ options.onDisposed(result); +/******/ doDispose = true; +/******/ break; +/******/ default: +/******/ throw new Error("Unexception type " + result.type); +/******/ } +/******/ if(abortError) { +/******/ hotSetStatus("abort"); +/******/ return Promise.reject(abortError); +/******/ } +/******/ if(doApply) { +/******/ appliedUpdate[moduleId] = hotUpdate[moduleId]; +/******/ addAllToSet(outdatedModules, result.outdatedModules); +/******/ for(moduleId in result.outdatedDependencies) { +/******/ if(Object.prototype.hasOwnProperty.call(result.outdatedDependencies, moduleId)) { +/******/ if(!outdatedDependencies[moduleId]) +/******/ outdatedDependencies[moduleId] = []; +/******/ addAllToSet(outdatedDependencies[moduleId], result.outdatedDependencies[moduleId]); +/******/ } +/******/ } +/******/ } +/******/ if(doDispose) { +/******/ addAllToSet(outdatedModules, [result.moduleId]); +/******/ appliedUpdate[moduleId] = warnUnexpectedRequire; +/******/ } +/******/ } +/******/ } +/******/ +/******/ // Store self accepted outdated modules to require them later by the module system +/******/ var outdatedSelfAcceptedModules = []; +/******/ for(i = 0; i < outdatedModules.length; i++) { +/******/ moduleId = outdatedModules[i]; +/******/ if(installedModules[moduleId] && installedModules[moduleId].hot._selfAccepted) +/******/ outdatedSelfAcceptedModules.push({ +/******/ module: moduleId, +/******/ errorHandler: installedModules[moduleId].hot._selfAccepted +/******/ }); +/******/ } +/******/ +/******/ // Now in "dispose" phase +/******/ hotSetStatus("dispose"); +/******/ Object.keys(hotAvailableFilesMap).forEach(function(chunkId) { +/******/ if(hotAvailableFilesMap[chunkId] === false) { +/******/ hotDisposeChunk(chunkId); +/******/ } +/******/ }); +/******/ +/******/ var idx; +/******/ var queue = outdatedModules.slice(); +/******/ while(queue.length > 0) { +/******/ moduleId = queue.pop(); +/******/ module = installedModules[moduleId]; +/******/ if(!module) continue; +/******/ +/******/ var data = {}; +/******/ +/******/ // Call dispose handlers +/******/ var disposeHandlers = module.hot._disposeHandlers; +/******/ for(j = 0; j < disposeHandlers.length; j++) { +/******/ cb = disposeHandlers[j]; +/******/ cb(data); +/******/ } +/******/ hotCurrentModuleData[moduleId] = data; +/******/ +/******/ // disable module (this disables requires from this module) +/******/ module.hot.active = false; +/******/ +/******/ // remove module from cache +/******/ delete installedModules[moduleId]; +/******/ +/******/ // when disposing there is no need to call dispose handler +/******/ delete outdatedDependencies[moduleId]; +/******/ +/******/ // remove "parents" references from all children +/******/ for(j = 0; j < module.children.length; j++) { +/******/ var child = installedModules[module.children[j]]; +/******/ if(!child) continue; +/******/ idx = child.parents.indexOf(moduleId); +/******/ if(idx >= 0) { +/******/ child.parents.splice(idx, 1); +/******/ } +/******/ } +/******/ } +/******/ +/******/ // remove outdated dependency from module children +/******/ var dependency; +/******/ var moduleOutdatedDependencies; +/******/ for(moduleId in outdatedDependencies) { +/******/ if(Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)) { +/******/ module = installedModules[moduleId]; +/******/ if(module) { +/******/ moduleOutdatedDependencies = outdatedDependencies[moduleId]; +/******/ for(j = 0; j < moduleOutdatedDependencies.length; j++) { +/******/ dependency = moduleOutdatedDependencies[j]; +/******/ idx = module.children.indexOf(dependency); +/******/ if(idx >= 0) module.children.splice(idx, 1); +/******/ } +/******/ } +/******/ } +/******/ } +/******/ +/******/ // Not in "apply" phase +/******/ hotSetStatus("apply"); +/******/ +/******/ hotCurrentHash = hotUpdateNewHash; +/******/ +/******/ // insert new code +/******/ for(moduleId in appliedUpdate) { +/******/ if(Object.prototype.hasOwnProperty.call(appliedUpdate, moduleId)) { +/******/ modules[moduleId] = appliedUpdate[moduleId]; +/******/ } +/******/ } +/******/ +/******/ // call accept handlers +/******/ var error = null; +/******/ for(moduleId in outdatedDependencies) { +/******/ if(Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)) { +/******/ module = installedModules[moduleId]; +/******/ if(module) { +/******/ moduleOutdatedDependencies = outdatedDependencies[moduleId]; +/******/ var callbacks = []; +/******/ for(i = 0; i < moduleOutdatedDependencies.length; i++) { +/******/ dependency = moduleOutdatedDependencies[i]; +/******/ cb = module.hot._acceptedDependencies[dependency]; +/******/ if(cb) { +/******/ if(callbacks.indexOf(cb) >= 0) continue; +/******/ callbacks.push(cb); +/******/ } +/******/ } +/******/ for(i = 0; i < callbacks.length; i++) { +/******/ cb = callbacks[i]; +/******/ try { +/******/ cb(moduleOutdatedDependencies); +/******/ } catch(err) { +/******/ if(options.onErrored) { +/******/ options.onErrored({ +/******/ type: "accept-errored", +/******/ moduleId: moduleId, +/******/ dependencyId: moduleOutdatedDependencies[i], +/******/ error: err +/******/ }); +/******/ } +/******/ if(!options.ignoreErrored) { +/******/ if(!error) +/******/ error = err; +/******/ } +/******/ } +/******/ } +/******/ } +/******/ } +/******/ } +/******/ +/******/ // Load self accepted modules +/******/ for(i = 0; i < outdatedSelfAcceptedModules.length; i++) { +/******/ var item = outdatedSelfAcceptedModules[i]; +/******/ moduleId = item.module; +/******/ hotCurrentParents = [moduleId]; +/******/ try { +/******/ __webpack_require__(moduleId); +/******/ } catch(err) { +/******/ if(typeof item.errorHandler === "function") { +/******/ try { +/******/ item.errorHandler(err); +/******/ } catch(err2) { +/******/ if(options.onErrored) { +/******/ options.onErrored({ +/******/ type: "self-accept-error-handler-errored", +/******/ moduleId: moduleId, +/******/ error: err2, +/******/ orginalError: err, // TODO remove in webpack 4 +/******/ originalError: err +/******/ }); +/******/ } +/******/ if(!options.ignoreErrored) { +/******/ if(!error) +/******/ error = err2; +/******/ } +/******/ if(!error) +/******/ error = err; +/******/ } +/******/ } else { +/******/ if(options.onErrored) { +/******/ options.onErrored({ +/******/ type: "self-accept-errored", +/******/ moduleId: moduleId, +/******/ error: err +/******/ }); +/******/ } +/******/ if(!options.ignoreErrored) { +/******/ if(!error) +/******/ error = err; +/******/ } +/******/ } +/******/ } +/******/ } +/******/ +/******/ // handle errors in accept handlers and self accepted module load +/******/ if(error) { +/******/ hotSetStatus("fail"); +/******/ return Promise.reject(error); +/******/ } +/******/ +/******/ hotSetStatus("idle"); +/******/ return new Promise(function(resolve) { +/******/ resolve(outdatedModules); +/******/ }); +/******/ } +/******/ +/******/ // 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: {}, +/******/ hot: hotCreateModule(moduleId), +/******/ parents: (hotCurrentParentsTemp = hotCurrentParents, hotCurrentParents = [], hotCurrentParentsTemp), +/******/ children: [] +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId)); +/******/ +/******/ // 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 = "/"; +/******/ +/******/ // __webpack_hash__ +/******/ __webpack_require__.h = function() { return hotCurrentHash; }; +/******/ +/******/ // Load entry module and return exports +/******/ return hotCreateRequire(0)(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "./node_modules/@firebase/app/dist/esm/index.js": +/*!******************************************************!*\ + !*** ./node_modules/@firebase/app/dist/esm/index.js ***! + \******************************************************/ +/*! exports provided: firebase, default */ +/*! all exports used */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "firebase", function() { return firebase; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_firebaseApp__ = __webpack_require__(/*! ./src/firebaseApp */ "./node_modules/@firebase/app/dist/esm/src/firebaseApp.js"); +/** + * 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. + */ + +var firebase = Object(__WEBPACK_IMPORTED_MODULE_0__src_firebaseApp__["a" /* createFirebaseNamespace */])(); +/* harmony default export */ __webpack_exports__["default"] = (firebase); + + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/app/dist/esm/src/firebaseApp.js": +/*!****************************************************************!*\ + !*** ./node_modules/@firebase/app/dist/esm/src/firebaseApp.js ***! + \****************************************************************/ +/*! exports provided: createFirebaseNamespace */ +/*! exports used: createFirebaseNamespace */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (immutable) */ __webpack_exports__["a"] = createFirebaseNamespace; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__firebase_util__ = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__firebase_util___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__firebase_util__); +/** + * 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. + */ + +var contains = function (obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +}; +var DEFAULT_ENTRY_NAME = '[DEFAULT]'; +// An array to capture listeners before the true auth functions +// exist +var tokenListeners = []; +/** + * Global context object for a collection of services using + * a shared authentication state. + */ +var FirebaseAppImpl = /** @class */ (function () { + function FirebaseAppImpl(options, name, firebase_) { + this.firebase_ = firebase_; + this.isDeleted_ = false; + this.services_ = {}; + this.name_ = name; + this.options_ = Object(__WEBPACK_IMPORTED_MODULE_0__firebase_util__["deepCopy"])(options); + this.INTERNAL = { + getUid: function () { return null; }, + getToken: function () { return Promise.resolve(null); }, + addAuthTokenListener: function (callback) { + tokenListeners.push(callback); + // Make sure callback is called, asynchronously, in the absence of the auth module + setTimeout(function () { return callback(null); }, 0); + }, + removeAuthTokenListener: function (callback) { + tokenListeners = tokenListeners.filter(function (listener) { return listener !== callback; }); + } + }; + } + Object.defineProperty(FirebaseAppImpl.prototype, "name", { + get: function () { + this.checkDestroyed_(); + return this.name_; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(FirebaseAppImpl.prototype, "options", { + get: function () { + this.checkDestroyed_(); + return this.options_; + }, + enumerable: true, + configurable: true + }); + FirebaseAppImpl.prototype.delete = function () { + var _this = this; + return new Promise(function (resolve) { + _this.checkDestroyed_(); + resolve(); + }) + .then(function () { + _this.firebase_.INTERNAL.removeApp(_this.name_); + var services = []; + Object.keys(_this.services_).forEach(function (serviceKey) { + Object.keys(_this.services_[serviceKey]).forEach(function (instanceKey) { + services.push(_this.services_[serviceKey][instanceKey]); + }); + }); + return Promise.all(services.map(function (service) { + return service.INTERNAL.delete(); + })); + }) + .then(function () { + _this.isDeleted_ = true; + _this.services_ = {}; + }); + }; + /** + * Return a service instance associated with this app (creating it + * on demand), identified by the passed instanceIdentifier. + * + * NOTE: Currently storage is the only one that is leveraging this + * functionality. They invoke it by calling: + * + * ```javascript + * firebase.app().storage('STORAGE BUCKET ID') + * ``` + * + * The service name is passed to this already + * @internal + */ + FirebaseAppImpl.prototype._getService = function (name, instanceIdentifier) { + if (instanceIdentifier === void 0) { instanceIdentifier = DEFAULT_ENTRY_NAME; } + this.checkDestroyed_(); + if (!this.services_[name]) { + this.services_[name] = {}; + } + if (!this.services_[name][instanceIdentifier]) { + /** + * If a custom instance has been defined (i.e. not '[DEFAULT]') + * then we will pass that instance on, otherwise we pass `null` + */ + var instanceSpecifier = instanceIdentifier !== DEFAULT_ENTRY_NAME + ? instanceIdentifier + : undefined; + var service = this.firebase_.INTERNAL.factories[name](this, this.extendApp.bind(this), instanceSpecifier); + this.services_[name][instanceIdentifier] = service; + } + return this.services_[name][instanceIdentifier]; + }; + /** + * Callback function used to extend an App instance at the time + * of service instance creation. + */ + FirebaseAppImpl.prototype.extendApp = function (props) { + var _this = this; + // Copy the object onto the FirebaseAppImpl prototype + Object(__WEBPACK_IMPORTED_MODULE_0__firebase_util__["deepExtend"])(this, props); + /** + * If the app has overwritten the addAuthTokenListener stub, forward + * the active token listeners on to the true fxn. + * + * TODO: This function is required due to our current module + * structure. Once we are able to rely strictly upon a single module + * implementation, this code should be refactored and Auth should + * provide these stubs and the upgrade logic + */ + if (props.INTERNAL && props.INTERNAL.addAuthTokenListener) { + tokenListeners.forEach(function (listener) { + _this.INTERNAL.addAuthTokenListener(listener); + }); + tokenListeners = []; + } + }; + /** + * This function will throw an Error if the App has already been deleted - + * use before performing API actions on the App. + */ + FirebaseAppImpl.prototype.checkDestroyed_ = function () { + if (this.isDeleted_) { + error('app-deleted', { name: this.name_ }); + } + }; + return FirebaseAppImpl; +}()); +// Prevent dead-code elimination of these methods w/o invalid property +// copying. +(FirebaseAppImpl.prototype.name && FirebaseAppImpl.prototype.options) || + FirebaseAppImpl.prototype.delete || + console.log('dc'); +/** + * Return a firebase namespace object. + * + * In production, this will be called exactly once and the result + * assigned to the 'firebase' global. It may be called multiple times + * in unit tests. + */ +function createFirebaseNamespace() { + var apps_ = {}; + var factories = {}; + var appHooks = {}; + // A namespace is a plain JavaScript Object. + var namespace = { + // Hack to prevent Babel from modifying the object returned + // as the firebase namespace. + __esModule: true, + initializeApp: initializeApp, + app: app, + apps: null, + Promise: Promise, + SDK_VERSION: '4.9.0', + INTERNAL: { + registerService: registerService, + createFirebaseNamespace: createFirebaseNamespace, + extendNamespace: extendNamespace, + createSubscribe: __WEBPACK_IMPORTED_MODULE_0__firebase_util__["createSubscribe"], + ErrorFactory: __WEBPACK_IMPORTED_MODULE_0__firebase_util__["ErrorFactory"], + removeApp: removeApp, + factories: factories, + useAsService: useAsService, + Promise: Promise, + deepExtend: __WEBPACK_IMPORTED_MODULE_0__firebase_util__["deepExtend"] + } + }; + // Inject a circular default export to allow Babel users who were previously + // using: + // + // import firebase from 'firebase'; + // which becomes: var firebase = require('firebase').default; + // + // instead of + // + // import * as firebase from 'firebase'; + // which becomes: var firebase = require('firebase'); + Object(__WEBPACK_IMPORTED_MODULE_0__firebase_util__["patchProperty"])(namespace, 'default', namespace); + // firebase.apps is a read-only getter. + Object.defineProperty(namespace, 'apps', { + get: getApps + }); + /** + * Called by App.delete() - but before any services associated with the App + * are deleted. + */ + function removeApp(name) { + var app = apps_[name]; + callAppHooks(app, 'delete'); + delete apps_[name]; + } + /** + * Get the App object for a given name (or DEFAULT). + */ + function app(name) { + name = name || DEFAULT_ENTRY_NAME; + if (!contains(apps_, name)) { + error('no-app', { name: name }); + } + return apps_[name]; + } + Object(__WEBPACK_IMPORTED_MODULE_0__firebase_util__["patchProperty"])(app, 'App', FirebaseAppImpl); + /** + * Create a new App instance (name must be unique). + */ + function initializeApp(options, name) { + if (name === undefined) { + name = DEFAULT_ENTRY_NAME; + } + else { + if (typeof name !== 'string' || name === '') { + error('bad-app-name', { name: name + '' }); + } + } + if (contains(apps_, name)) { + error('duplicate-app', { name: name }); + } + var app = new FirebaseAppImpl(options, name, namespace); + apps_[name] = app; + callAppHooks(app, 'create'); + return app; + } + /* + * Return an array of all the non-deleted FirebaseApps. + */ + function getApps() { + // Make a copy so caller cannot mutate the apps list. + return Object.keys(apps_).map(function (name) { return apps_[name]; }); + } + /* + * Register a Firebase Service. + * + * firebase.INTERNAL.registerService() + * + * TODO: Implement serviceProperties. + */ + function registerService(name, createService, serviceProperties, appHook, allowMultipleInstances) { + // Cannot re-register a service that already exists + if (factories[name]) { + error('duplicate-service', { name: name }); + } + // Capture the service factory for later service instantiation + factories[name] = createService; + // Capture the appHook, if passed + if (appHook) { + appHooks[name] = appHook; + // Run the **new** app hook on all existing apps + getApps().forEach(function (app) { + appHook('create', app); + }); + } + // The Service namespace is an accessor function ... + var serviceNamespace = function (appArg) { + if (appArg === void 0) { appArg = app(); } + if (typeof appArg[name] !== 'function') { + // Invalid argument. + // This happens in the following case: firebase.storage('gs:/') + error('invalid-app-argument', { name: name }); + } + // Forward service instance lookup to the FirebaseApp. + return appArg[name](); + }; + // ... and a container for service-level properties. + if (serviceProperties !== undefined) { + Object(__WEBPACK_IMPORTED_MODULE_0__firebase_util__["deepExtend"])(serviceNamespace, serviceProperties); + } + // Monkey-patch the serviceNamespace onto the firebase namespace + namespace[name] = serviceNamespace; + // Patch the FirebaseAppImpl prototype + FirebaseAppImpl.prototype[name] = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var serviceFxn = this._getService.bind(this, name); + return serviceFxn.apply(this, allowMultipleInstances ? args : []); + }; + return serviceNamespace; + } + /** + * Patch the top-level firebase namespace with additional properties. + * + * firebase.INTERNAL.extendNamespace() + */ + function extendNamespace(props) { + Object(__WEBPACK_IMPORTED_MODULE_0__firebase_util__["deepExtend"])(namespace, props); + } + function callAppHooks(app, eventName) { + Object.keys(factories).forEach(function (serviceName) { + // Ignore virtual services + var factoryName = useAsService(app, serviceName); + if (factoryName === null) { + return; + } + if (appHooks[factoryName]) { + appHooks[factoryName](eventName, app); + } + }); + } + // Map the requested service to a registered service name + // (used to map auth to serverAuth service when needed). + function useAsService(app, name) { + if (name === 'serverAuth') { + return null; + } + var useService = name; + var options = app.options; + return useService; + } + return namespace; +} +function error(code, args) { + throw appErrors.create(code, args); +} +// TypeScript does not support non-string indexes! +// let errors: {[code: AppError: string} = { +var errors = { + 'no-app': "No Firebase App '{$name}' has been created - " + + 'call Firebase App.initializeApp()', + 'bad-app-name': "Illegal App name: '{$name}", + 'duplicate-app': "Firebase App named '{$name}' already exists", + 'app-deleted': "Firebase App named '{$name}' already deleted", + 'duplicate-service': "Firebase service named '{$name}' already registered", + 'sa-not-supported': 'Initializing the Firebase SDK with a service ' + + 'account is only allowed in a Node.js environment. On client ' + + 'devices, you should instead initialize the SDK with an api key and ' + + 'auth domain', + 'invalid-app-argument': 'firebase.{$name}() takes either no argument or a ' + + 'Firebase App instance.' +}; +var appErrors = new __WEBPACK_IMPORTED_MODULE_0__firebase_util__["ErrorFactory"]('app', 'Firebase', errors); + + +//# sourceMappingURL=firebaseApp.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/auth/dist/auth.js": +/*!**************************************************!*\ + !*** ./node_modules/@firebase/auth/dist/auth.js ***! + \**************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(global) {(function() { + var firebase = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/esm/index.js").default; + var h,aa=aa||{},k=this;function m(a){return"string"==typeof a}function ba(a){return"boolean"==typeof a}function ca(){} +function da(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null"; +else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function ea(a){return null===a}function fa(a){return"array"==da(a)}function ha(a){var b=da(a);return"array"==b||"object"==b&&"number"==typeof a.length}function p(a){return"function"==da(a)}function q(a){var b=typeof a;return"object"==b&&null!=a||"function"==b}var ia="closure_uid_"+(1E9*Math.random()>>>0),ja=0;function ka(a,b,c){return a.call.apply(a.bind,arguments)} +function la(a,b,c){if(!a)throw Error();if(2")&&(a=a.replace(ua,">"));-1!=a.indexOf('"')&&(a=a.replace(va,"""));-1!=a.indexOf("'")&&(a=a.replace(wa,"'"));-1!=a.indexOf("\x00")&&(a=a.replace(xa,"�"));return a}var sa=/&/g,ta=//g,va=/"/g,wa=/'/g,xa=/\x00/g,ra=/[\x00&<>"']/;function v(a,b){return-1!=a.indexOf(b)}function ya(a,b){return ab?1:0};function za(a,b){b.unshift(a);u.call(this,oa.apply(null,b));b.shift()}t(za,u);za.prototype.name="AssertionError";function Aa(a,b){throw new za("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));};var Ba=Array.prototype.indexOf?function(a,b,c){return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(m(a))return m(b)&&1==b.length?a.indexOf(b,c):-1;for(;cb?null:m(a)?a.charAt(b):a[b]}function Ha(a,b){return 0<=Ba(a,b)}function Ia(a,b){b=Ba(a,b);var c;(c=0<=b)&&Array.prototype.splice.call(a,b,1);return c}function Ja(a,b){var c=0;Ca(a,function(d,e){b.call(void 0,d,e,a)&&1==Array.prototype.splice.call(a,e,1).length&&c++})}function Ka(a){return Array.prototype.concat.apply([],arguments)} +function La(a){var b=a.length;if(0parseFloat(gb)){fb=String(ib);break a}}fb=gb}var Za={}; +function jb(a){return Ya(a,function(){for(var b=0,c=pa(String(fb)).split("."),d=pa(String(a)).split("."),e=Math.max(c.length,d.length),f=0;0==b&&f");vc("");vc("
");function wc(a){var b=document;return m(a)?b.getElementById(a):a}function xc(a,b){Pa(b,function(b,d){b&&b.la&&(b=b.ja());"style"==d?a.style.cssText=b:"class"==d?a.className=b:"for"==d?a.htmlFor=b:yc.hasOwnProperty(d)?a.setAttribute(yc[d],b):0==d.lastIndexOf("aria-",0)||0==d.lastIndexOf("data-",0)?a.setAttribute(d,b):a[d]=b})} +var yc={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",nonce:"nonce",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"}; +function zc(a,b,c){var d=arguments,e=document,f=String(d[0]),g=d[1];if(!$b&&g&&(g.name||g.type)){f=["<",f];g.name&&f.push(' name="',qa(g.name),'"');if(g.type){f.push(' type="',qa(g.type),'"');var l={};Wa(l,g);delete l.type;g=l}f.push(">");f=f.join("")}f=e.createElement(f);g&&(m(g)?f.className=g:fa(g)?f.className=g.join(" "):xc(f,g));2=a.keyCode)a.keyCode=-1}catch(b){}};Qc.prototype.g=function(){return this.a};var Sc="closure_listenable_"+(1E6*Math.random()|0),Tc=0;function Uc(a,b,c,d,e){this.listener=a;this.a=null;this.src=b;this.type=c;this.capture=!!d;this.La=e;this.key=++Tc;this.ma=this.Ha=!1}function Vc(a){a.ma=!0;a.listener=null;a.a=null;a.src=null;a.La=null};function Wc(a){this.src=a;this.a={};this.b=0}function Xc(a,b,c,d,e,f){var g=b.toString();b=a.a[g];b||(b=a.a[g]=[],a.b++);var l=Yc(b,c,e,f);-1d.keyCode||void 0!=d.returnValue)){a:{var e=!1;if(0==d.keyCode)try{d.keyCode=-1;break a}catch(g){e=!0}if(e||void 0==d.returnValue)d.returnValue=!0}d=[];for(e=b.b;e;e=e.parentNode)d.push(e);a=a.type;for(e=d.length-1;0<=e;e--){b.b=d[e];var f=nd(d[e],a,!0,b);c=c&&f}for(e=0;e>>0);function ed(a){if(p(a))return a;a[pd]||(a[pd]=function(b){return a.handleEvent(b)});return a[pd]};function F(){Ic.call(this);this.u=new Wc(this);this.Ib=this;this.Ra=null}t(F,Ic);F.prototype[Sc]=!0;F.prototype.removeEventListener=function(a,b,c,d){E(this,a,b,c,d)}; +function G(a,b){var c,d=a.Ra;if(d)for(c=[];d;d=d.Ra)c.push(d);a=a.Ib;d=b.type||b;if(m(b))b=new C(b,a);else if(b instanceof C)b.target=b.target||a;else{var e=b;b=new C(d,a);Wa(b,e)}e=!0;if(c)for(var f=c.length-1;0<=f;f--){var g=b.b=c[f];e=qd(g,d,!0,b)&&e}g=b.b=a;e=qd(g,d,!0,b)&&e;e=qd(g,d,!1,b)&&e;if(c)for(f=0;f=Ad(this).value)for(p(b)&&(b=b()),a=new td(a,String(b),this.f),c&&(a.a=c),c="log:"+a.b,(a=k.console)&&a.timeStamp&&a.timeStamp(c),(a=k.msWriteProfilerMark)&&a(c),c=this;c;)c=c.a};var Bd={},Cd=null;function Dd(a){Cd||(Cd=new vd(""),Bd[""]=Cd,Cd.c=yd);var b;if(!(b=Bd[a])){b=new vd(a);var c=a.lastIndexOf("."),d=a.substr(c+1);c=Dd(a.substr(0,c));c.b||(c.b={});c.b[d]=b;b.a=c;Bd[a]=b}return b};function Ed(a,b){this.b={};this.a=[];this.c=0;var c=arguments.length;if(1>4);64!=g&&(b(f<<4&240|g>>2),64!=l&&b(g<<6&192|l))}} +function Md(){if(!Id){Id={};Jd={};for(var a=0;65>a;a++)Id[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a),Jd[Id[a]]=a,62<=a&&(Jd["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a)]=a)}};/* + Portions of this code are from MochiKit, received by + The Closure Authors under the MIT license. All other code is Copyright + 2005-2009 The Closure Authors. All Rights Reserved. +*/ +function Nd(a,b){this.g=[];this.v=a;this.o=b||null;this.f=this.a=!1;this.c=void 0;this.u=this.w=this.i=!1;this.h=0;this.b=null;this.l=0}Nd.prototype.cancel=function(a){if(this.a)this.c instanceof Nd&&this.c.cancel();else{if(this.b){var b=this.b;delete this.b;a?b.cancel(a):(b.l--,0>=b.l&&b.cancel())}this.v?this.v.call(this.o,this):this.u=!0;this.a||(a=new Od,Pd(this),Qd(this,!1,a))}};Nd.prototype.m=function(a,b){this.i=!1;Qd(this,a,b)};function Qd(a,b,c){a.a=!0;a.c=c;a.f=!b;Rd(a)} +function Pd(a){if(a.a){if(!a.u)throw new Sd;a.u=!1}}Nd.prototype.A=function(a){Pd(this);Qd(this,!0,a)};function Td(a,b){Ud(a,null,b,void 0)}function Ud(a,b,c,d){a.g.push([b,c,d]);a.a&&Rd(a)}Nd.prototype.then=function(a,b,c){var d,e,f=new z(function(a,b){d=a;e=b});Ud(this,d,function(a){a instanceof Od?f.cancel():e(a)});return f.then(a,b,c)};mb(Nd);function Vd(a){return Ea(a.g,function(a){return p(a[1])})} +function Rd(a){if(a.h&&a.a&&Vd(a)){var b=a.h,c=Wd[b];c&&(k.clearTimeout(c.a),delete Wd[b]);a.h=0}a.b&&(a.b.l--,delete a.b);b=a.c;for(var d=c=!1;a.g.length&&!a.i;){var e=a.g.shift(),f=e[0],g=e[1];e=e[2];if(f=a.f?g:f)try{var l=f.call(e||a.o,b);void 0!==l&&(a.f=a.f&&(l==b||l instanceof Error),a.c=b=l);if(nb(b)||"function"===typeof k.Promise&&b instanceof k.Promise)d=!0,a.i=!0}catch(n){b=n,a.f=!0,Vd(a)||(c=!0)}}a.c=b;d&&(l=r(a.m,a,!0),d=r(a.m,a,!1),b instanceof Nd?(Ud(b,l,d),b.w=!0):b.then(l,d));c&&(b= +new Xd(b),Wd[b.a]=b,a.h=b.a)}function Sd(){u.call(this)}t(Sd,u);Sd.prototype.message="Deferred has already fired";Sd.prototype.name="AlreadyCalledError";function Od(){u.call(this)}t(Od,u);Od.prototype.message="Deferred was canceled";Od.prototype.name="CanceledError";function Xd(a){this.a=k.setTimeout(r(this.c,this),0);this.b=a}Xd.prototype.c=function(){delete Wd[this.a];throw this.b;};var Wd={};function Yd(){this.b=-1};function Zd(a,b){this.b=-1;this.b=$d;this.f=k.Uint8Array?new Uint8Array(this.b):Array(this.b);this.g=this.c=0;this.a=[];this.i=a;this.h=b;this.l=k.Int32Array?new Int32Array(64):Array(64);ae||(k.Int32Array?ae=new Int32Array(be):ae=be);this.reset()}var ae;t(Zd,Yd);for(var $d=64,ce=$d-1,de=[],ee=0;eeb;b++){e=c[b-15]|0;d=c[b-2]|0;var f=(c[b-16]|0)+((e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3)|0,g=(c[b-7]|0)+((d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10)|0;c[b]=f+g|0}d=a.a[0]|0;e=a.a[1]|0;var l=a.a[2]|0,n=a.a[3]|0,D=a.a[4]|0,vb=a.a[5]|0,tc=a.a[6]|0;f=a.a[7]|0;for(b=0;64>b;b++){var Bj=((d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10))+(d&e^d&l^e&l)|0;g=D&vb^~D&tc;f=f+((D>>>6|D<<26)^(D>>>11|D<<21)^(D>>> +25|D<<7))|0;g=g+(ae[b]|0)|0;g=f+(g+(c[b]|0)|0)|0;f=tc;tc=vb;vb=D;D=n+g|0;n=l;l=e;e=d;d=g+Bj|0}a.a[0]=a.a[0]+d|0;a.a[1]=a.a[1]+e|0;a.a[2]=a.a[2]+l|0;a.a[3]=a.a[3]+n|0;a.a[4]=a.a[4]+D|0;a.a[5]=a.a[5]+vb|0;a.a[6]=a.a[6]+tc|0;a.a[7]=a.a[7]+f|0} +function he(a,b,c){void 0===c&&(c=b.length);var d=0,e=a.c;if(m(b))for(;d=f&&f==(f|0)))throw Error("message must be a byte array");a.f[e++]=f;e==a.b&&(ge(a),e=0)}else throw Error("message must be string or array");a.c=e;a.g+=c} +var be=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804, +4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function ie(){Zd.call(this,8,je)}t(ie,Zd);var je=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function ke(a){if(a.P&&"function"==typeof a.P)return a.P();if(m(a))return a.split("");if(ha(a)){for(var b=[],c=a.length,d=0;db)throw Error("Bad port number "+b);a.i=b}else a.i=null}function te(a,b,c){b instanceof se?(a.a=b,Ae(a.a,a.f)):(c||(b=ve(b,Be)),a.a=new se(b,0,a.f))}function I(a,b,c){a.a.set(b,c)}function Ce(a,b){return a.a.get(b)}function De(a){return a instanceof pe?new pe(a):new pe(a,void 0)}function Ee(a,b){var c=new pe(null,void 0);qe(c,"https");a&&(c.b=a);b&&(c.g=b);return c} +function ue(a,b){return a?b?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""}function ve(a,b,c){return m(a)?(a=encodeURI(a).replace(b,Fe),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null}function Fe(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)}var we=/[#\/\?@]/g,ye=/[\#\?:]/g,xe=/[\#\?]/g,Be=/[\#\?@]/g,ze=/#/g;function se(a,b,c){this.b=this.a=null;this.c=a||null;this.f=!!c} +function Ge(a){a.a||(a.a=new Ed,a.b=0,a.c&&oe(a.c,function(b,c){He(a,decodeURIComponent(b.replace(/\+/g," ")),c)}))}function Ie(a){var b=le(a);if("undefined"==typeof b)throw Error("Keys are undefined");var c=new se(null,0,void 0);a=ke(a);for(var d=0;d2*a.c&&Fd(a)))}h=se.prototype;h.clear=function(){this.a=this.c=null;this.b=0};function Me(a,b){Ge(a);b=Ke(a,b);return Gd(a.a.b,b)}h.forEach=function(a,b){Ge(this);this.a.forEach(function(c,d){w(c,function(c){a.call(b,c,d,this)},this)},this)};h.S=function(){Ge(this);for(var a=this.a.P(),b=this.a.S(),c=[],d=0;da?!1:!y||!kb||9',a=vc(a),g.document.write(uc(a)),g.document.close())):g=a.open(nc(b),c,g);if(g)try{g.focus()}catch(l){}return g} +function Ff(a){return new z(function(b){function c(){sd(2E3).then(function(){if(!a||a.closed)b();else return c()})}return c()})}var Gf=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;function Hf(){var a=null;return(new z(function(b){"complete"==k.document.readyState?b():(a=function(){b()},dd(window,"load",a))})).s(function(b){E(window,"load",a);throw b;})} +function If(){return Jf(void 0)?Hf().then(function(){return new z(function(a,b){var c=k.document,d=setTimeout(function(){b(Error("Cordova framework is not ready."))},1E3);c.addEventListener("deviceready",function(){clearTimeout(d);a()},!1)})}):B(Error("Cordova must run in an Android or iOS file scheme."))}function Jf(a){a=a||J();return!("file:"!==Kf()||!a.toLowerCase().match(/iphone|ipad|ipod|android/))}function Lf(){var a=k.window;try{return!(!a||a==a.top)}catch(b){return!1}} +function K(){return firebase.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":firebase.INTERNAL.hasOwnProperty("node")?"Node":"Browser"}function Mf(){var a=K();return"ReactNative"===a||"Node"===a}var Ef="Firefox",Af="Chrome"; +function zf(a){var b=a.toLowerCase();if(v(b,"opera/")||v(b,"opr/")||v(b,"opios/"))return"Opera";if(v(b,"iemobile"))return"IEMobile";if(v(b,"msie")||v(b,"trident/"))return"IE";if(v(b,"edge/"))return"Edge";if(v(b,"firefox/"))return Ef;if(v(b,"silk/"))return"Silk";if(v(b,"blackberry"))return"Blackberry";if(v(b,"webos"))return"Webos";if(!v(b,"safari/")||v(b,"chrome/")||v(b,"crios/")||v(b,"android"))if(!v(b,"chrome/")&&!v(b,"crios/")||v(b,"edge/")){if(v(b,"android"))return"Android";if((a=a.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&& +2==a.length)return a[1]}else return Af;else return"Safari";return"Other"}var Nf={Gc:"FirebaseCore-web",Ic:"FirebaseUI-web"};function Of(a,b){b=b||[];var c=[],d={},e;for(e in Nf)d[Nf[e]]=!0;for(e=0;eb)throw Error("Short delay should be less than long delay!");this.c=a;this.b=b;a=c||J();d=d||K();this.a=Bf(a)||"ReactNative"===d} +$f.prototype.get=function(){return this.a?this.b:this.c};function ag(){var a=k.document;return a&&"undefined"!==typeof a.visibilityState?"visible"==a.visibilityState:!0}function bg(){var a=k.document,b=null;return ag()||!a?A():(new z(function(c){b=function(){ag()&&(a.removeEventListener("visibilitychange",b,!1),c())};a.addEventListener("visibilitychange",b,!1)})).s(function(c){a.removeEventListener("visibilitychange",b,!1);throw c;})} +function cg(a){try{var b=new Date(parseInt(a,10));if(!isNaN(b.getTime())&&!/[^0-9]/.test(a))return b.toUTCString()}catch(c){}return null};var dg={};var eg;try{var fg={};Object.defineProperty(fg,"abcd",{configurable:!0,enumerable:!0,value:1});Object.defineProperty(fg,"abcd",{configurable:!0,enumerable:!0,value:2});eg=2==fg.abcd}catch(a){eg=!1}function M(a,b,c){eg?Object.defineProperty(a,b,{configurable:!0,enumerable:!0,value:c}):a[b]=c}function gg(a,b){if(b)for(var c in b)b.hasOwnProperty(c)&&M(a,c,b[c])}function hg(a){var b={};gg(b,a);return b}function ig(a){var b={},c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b} +function jg(a,b){if(!b||!b.length)return!0;if(!a)return!1;for(var c=0;c Auth section -> Sign in method tab.",a):"http"==d||"https"==d?c=oa("This domain (%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",a):b="operation-not-supported-in-this-environment"; +N.call(this,b,c)}t(yh,N);function zh(a,b,c){N.call(this,a,c);a=b||{};a.sb&&M(this,"email",a.sb);a.Y&&M(this,"phoneNumber",a.Y);a.credential&&M(this,"credential",a.credential)}t(zh,N);zh.prototype.B=function(){var a={code:this.code,message:this.message};this.email&&(a.email=this.email);this.phoneNumber&&(a.phoneNumber=this.phoneNumber);var b=this.credential&&this.credential.B();b&&Wa(a,b);return a};zh.prototype.toJSON=function(){return this.B()}; +function Ah(a){if(a.code){var b=a.code||"";0==b.indexOf(tg)&&(b=b.substring(tg.length));var c={credential:uh(a)};if(a.email)c.sb=a.email;else if(a.phoneNumber)c.Y=a.phoneNumber;else return new N(b,a.message||void 0);return new zh(b,c,a.message)}return null};function Bh(a){this.f=a}t(Bh,Ne);Bh.prototype.a=function(){return new this.f};Bh.prototype.b=function(){return{}}; +function Ch(a,b,c){var d="Node"==K();d=k.XMLHttpRequest||d&&firebase.INTERNAL.node&&firebase.INTERNAL.node.XMLHttpRequest;if(!d)throw new N("internal-error","The XMLHttpRequest compatibility library was not found.");this.b=a;a=b||{};this.i=a.secureTokenEndpoint||"https://securetoken.googleapis.com/v1/token";this.l=a.secureTokenTimeout||Dh;this.c=Ua(a.secureTokenHeaders||Eh);this.g=a.firebaseEndpoint||"https://www.googleapis.com/identitytoolkit/v3/relyingparty/";this.h=a.firebaseTimeout||Fh;this.a= +Ua(a.firebaseHeaders||Gh);c&&(this.a["X-Client-Version"]=c,this.c["X-Client-Version"]=c);this.f=new rf;this.o=new Bh(d)}var Hh,O="idToken",Dh=new $f(3E4,6E4),Eh={"Content-Type":"application/x-www-form-urlencoded"},Fh=new $f(3E4,6E4),Gh={"Content-Type":"application/json"};function Ih(a,b){b?a.a["X-Firebase-Locale"]=b:delete a.a["X-Firebase-Locale"]}function Jh(a,b){b?(a.a["X-Client-Version"]=b,a.c["X-Client-Version"]=b):(delete a.a["X-Client-Version"],delete a.c["X-Client-Version"])} +function Kh(a,b,c,d,e,f,g){Zf()?(yf()?a=r(a.m,a):(Hh||(Hh=new z(function(a,b){Lh(a,b)})),a=r(a.u,a)),a(b,c,d,e,f,g)):c&&c(null)} +Ch.prototype.m=function(a,b,c,d,e,f){var g="Node"==K(),l=Mf()?g?new Se(this.o):new Se:new Se(this.f);if(f){l.f=Math.max(0,f);var n=setTimeout(function(){G(l,"timeout")},f)}fd(l,"complete",function(){n&&clearTimeout(n);var a=null;try{a=JSON.parse(hf(this))||null}catch(vb){a=null}b&&b(a)});ld(l,"ready",function(){n&&clearTimeout(n);Lc(this)});ld(l,"timeout",function(){n&&clearTimeout(n);Lc(this);b&&b(null)});Ye(l,a,c,d,e)}; +var Mh=dc("https://apis.google.com/js/client.js?onload=%{onload}"),Nh="__fcb"+Math.floor(1E6*Math.random()).toString();function Lh(a,b){if(((window.gapi||{}).client||{}).request)a();else{k[Nh]=function(){((window.gapi||{}).client||{}).request?a():b(Error("CORS_UNSUPPORTED"))};var c=hc(Mh,{onload:Nh});Td(kf(c),function(){b(Error("CORS_UNSUPPORTED"))})}} +Ch.prototype.u=function(a,b,c,d,e){var f=this;Hh.then(function(){window.gapi.client.setApiKey(f.b);var g=window.gapi.auth.getToken();window.gapi.auth.setToken(null);window.gapi.client.request({path:a,method:c,body:d,headers:e,authType:"none",callback:function(a){window.gapi.auth.setToken(g);b&&b(a)}})}).s(function(a){b&&b({error:{message:a&&a.message||"CORS_UNSUPPORTED"}})})}; +function Oh(a,b){return new z(function(c,d){"refresh_token"==b.grant_type&&b.refresh_token||"authorization_code"==b.grant_type&&b.code?Kh(a,a.i+"?key="+encodeURIComponent(a.b),function(a){a?a.error?d(Ph(a)):a.access_token&&a.refresh_token?c(a):d(new N("internal-error")):d(new N("network-request-failed"))},"POST",Ie(b).toString(),a.c,a.l.get()):d(new N("internal-error"))})} +function Qh(a,b,c,d,e,f){var g=De(a.g+b);I(g,"key",a.b);f&&I(g,"cb",na().toString());var l="GET"==c;if(l)for(var n in d)d.hasOwnProperty(n)&&I(g,n,d[n]);return new z(function(b,f){Kh(a,g.toString(),function(a){a?a.error?f(Ph(a,e||{})):b(a):f(new N("network-request-failed"))},c,l?void 0:Cc(Vf(d)),a.a,a.h.get())})}function Rh(a){if(!jf.test(a.email))throw new N("invalid-email");}function Sh(a){"email"in a&&Rh(a)} +function Th(a,b){return Q(a,Uh,{identifier:b,continueUri:Sf()?vf():"http://localhost"}).then(function(a){return a.allProviders||[]})}function Vh(a){return Q(a,Wh,{}).then(function(a){return a.authorizedDomains||[]})}function Xh(a){if(!a[O])throw new N("internal-error");} +function Yh(a){if(a.phoneNumber||a.temporaryProof){if(!a.phoneNumber||!a.temporaryProof)throw new N("internal-error");}else{if(!a.sessionInfo)throw new N("missing-verification-id");if(!a.code)throw new N("missing-verification-code");}}Ch.prototype.gb=function(){return Q(this,Zh,{})};Ch.prototype.kb=function(a,b){return Q(this,$h,{idToken:a,email:b})};Ch.prototype.lb=function(a,b){return Q(this,lh,{idToken:a,password:b})};var ai={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};h=Ch.prototype; +h.mb=function(a,b){var c={idToken:a},d=[];Pa(ai,function(a,f){var e=b[f];null===e?d.push(a):f in b&&(c[f]=e)});d.length&&(c.deleteAttribute=d);return Q(this,$h,c)};h.cb=function(a,b){a={requestType:"PASSWORD_RESET",email:a};Wa(a,b);return Q(this,bi,a)};h.bb=function(a,b){a={requestType:"VERIFY_EMAIL",idToken:a};Wa(a,b);return Q(this,ci,a)};function sh(a,b){return Q(a,di,b)}h.Qa=function(a){return Q(this,ei,a)};function fi(a,b,c){return Q(a,gi,{idToken:b,deleteProvider:c})} +function hi(a){if(!a.requestUri||!a.sessionId&&!a.postBody)throw new N("internal-error");}function ii(a){var b=null;a.needConfirmation?(a.code="account-exists-with-different-credential",b=Ah(a)):"FEDERATED_USER_ID_ALREADY_LINKED"==a.errorMessage?(a.code="credential-already-in-use",b=Ah(a)):"EMAIL_EXISTS"==a.errorMessage?(a.code="email-already-in-use",b=Ah(a)):a.errorMessage&&(b=ji(a.errorMessage));if(b)throw b;if(!a[O])throw new N("internal-error");} +function Xg(a,b){b.returnIdpCredential=!0;return Q(a,ki,b)}function Zg(a,b){b.returnIdpCredential=!0;return Q(a,li,b)}function $g(a,b){b.returnIdpCredential=!0;b.autoCreate=!1;return Q(a,mi,b)}function ni(a){if(!a.oobCode)throw new N("invalid-action-code");}h.Ta=function(a,b){return Q(this,oi,{oobCode:a,newPassword:b})};h.Ia=function(a){return Q(this,pi,{oobCode:a})};h.Sa=function(a){return Q(this,qi,{oobCode:a})}; +var qi={endpoint:"setAccountInfo",D:ni,ga:"email"},pi={endpoint:"resetPassword",D:ni,O:function(a){if(!a.email||!a.requestType)throw new N("internal-error");}},ri={endpoint:"signupNewUser",D:function(a){Rh(a);if(!a.password)throw new N("weak-password");},O:Xh,T:!0},Uh={endpoint:"createAuthUri"},si={endpoint:"deleteAccount",ea:["idToken"]},gi={endpoint:"setAccountInfo",ea:["idToken","deleteProvider"],D:function(a){if(!fa(a.deleteProvider))throw new N("internal-error");}},ti={endpoint:"getAccountInfo"}, +ci={endpoint:"getOobConfirmationCode",ea:["idToken","requestType"],D:function(a){if("VERIFY_EMAIL"!=a.requestType)throw new N("internal-error");},ga:"email"},bi={endpoint:"getOobConfirmationCode",ea:["requestType"],D:function(a){if("PASSWORD_RESET"!=a.requestType)throw new N("internal-error");Rh(a)},ga:"email"},Wh={nb:!0,endpoint:"getProjectConfig",zb:"GET"},ui={nb:!0,endpoint:"getRecaptchaParam",zb:"GET",O:function(a){if(!a.recaptchaSiteKey)throw new N("internal-error");}},oi={endpoint:"resetPassword", +D:ni,ga:"email"},di={endpoint:"sendVerificationCode",ea:["phoneNumber","recaptchaToken"],ga:"sessionInfo"},$h={endpoint:"setAccountInfo",ea:["idToken"],D:Sh,T:!0},lh={endpoint:"setAccountInfo",ea:["idToken"],D:function(a){Sh(a);if(!a.password)throw new N("weak-password");},O:Xh,T:!0},Zh={endpoint:"signupNewUser",O:Xh,T:!0},ki={endpoint:"verifyAssertion",D:hi,O:ii,T:!0},mi={endpoint:"verifyAssertion",D:hi,O:function(a){if(a.errorMessage&&"USER_NOT_FOUND"==a.errorMessage)throw new N("user-not-found"); +if(a.errorMessage)throw ji(a.errorMessage);if(!a[O])throw new N("internal-error");},T:!0},li={endpoint:"verifyAssertion",D:function(a){hi(a);if(!a.idToken)throw new N("internal-error");},O:ii,T:!0},vi={endpoint:"verifyCustomToken",D:function(a){if(!a.token)throw new N("invalid-custom-token");},O:Xh,T:!0},kh={endpoint:"verifyPassword",D:function(a){Rh(a);if(!a.password)throw new N("wrong-password");},O:Xh,T:!0},ei={endpoint:"verifyPhoneNumber",D:Yh,O:Xh},ph={endpoint:"verifyPhoneNumber",D:function(a){if(!a.idToken)throw new N("internal-error"); +Yh(a)},O:function(a){if(a.temporaryProof)throw a.code="credential-already-in-use",Ah(a);Xh(a)}},qh={Pb:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",D:Yh,O:Xh}; +function Q(a,b,c){if(!jg(c,b.ea))return B(new N("internal-error"));var d=b.zb||"POST",e;return A(c).then(b.D).then(function(){b.T&&(c.returnSecureToken=!0);return Qh(a,b.endpoint,d,c,b.Pb,b.nb||!1)}).then(function(a){return e=a}).then(b.O).then(function(){if(!b.ga)return e;if(!(b.ga in e))throw new N("internal-error");return e[b.ga]})}function ji(a){return Ph({error:{errors:[{message:a}],code:400,message:a}})} +function Ph(a,b){var c=(a.error&&a.error.errors&&a.error.errors[0]||{}).reason||"";var d={keyInvalid:"invalid-api-key",ipRefererBlocked:"app-not-authorized"};if(c=d[c]?new N(d[c]):null)return c;c=a.error&&a.error.message||"";d={INVALID_CUSTOM_TOKEN:"invalid-custom-token",CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_EMAIL:"invalid-email",INVALID_PASSWORD:"wrong-password",USER_DISABLED:"user-disabled", +MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",INVALID_MESSAGE_PAYLOAD:"invalid-message-payload",INVALID_RECIPIENT_EMAIL:"invalid-recipient-email",INVALID_SENDER:"invalid-sender",EMAIL_NOT_FOUND:"user-not-found",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login", +INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",CORS_UNSUPPORTED:"cors-unsupported",DYNAMIC_LINK_NOT_ACTIVATED:"dynamic-link-not-activated",INVALID_APP_ID:"invalid-app-id",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",WEAK_PASSWORD:"weak-password",OPERATION_NOT_ALLOWED:"operation-not-allowed",USER_CANCELLED:"user-cancelled",CAPTCHA_CHECK_FAILED:"captcha-check-failed",INVALID_APP_CREDENTIAL:"invalid-app-credential",INVALID_CODE:"invalid-verification-code", +INVALID_PHONE_NUMBER:"invalid-phone-number",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_APP_CREDENTIAL:"missing-app-credential",MISSING_CODE:"missing-verification-code",MISSING_PHONE_NUMBER:"missing-phone-number",MISSING_SESSION_INFO:"missing-verification-id",QUOTA_EXCEEDED:"quota-exceeded",SESSION_EXPIRED:"code-expired",INVALID_CONTINUE_URI:"invalid-continue-uri",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",MISSING_IOS_BUNDLE_ID:"missing-ios-bundle-id", +UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",INVALID_CERT_HASH:"invalid-cert-hash"};Wa(d,b||{});b=(b=c.match(/^[^\s]+\s*:\s*(.*)$/))&&1b.c?he(b,fe,56-b.c):he(b,fe,b.b-(b.c-56));for(var d=63;56<=d;d--)b.f[d]=c&255,c/=256;ge(b);for(d=c=0;d>e&255;return Hd(a)} +h.Ca=function(a,b){b(new N("operation-not-supported-in-this-environment"));return A()};h.vb=function(){return B(new N("operation-not-supported-in-this-environment"))};h.Hb=function(){return!1};h.Db=function(){return!0};h.yb=function(){return!0}; +h.Aa=function(a,b,c){if(this.c)return B(new N("redirect-operation-pending"));var d=this,e=k.document,f=null,g=null,l=null,n=null;return this.c=Qb(A().then(function(){vh(b);return Kj(d)}).then(function(){return Lj(d,a,b,c)}).then(function(){return(new z(function(a,b){g=function(){var b=L("cordova.plugins.browsertab.close",k);a();"function"===typeof b&&b();d.a&&"function"===typeof d.a.close&&(d.a.close(),d.a=null);return!1};d.ua(g);l=function(){f||(f=sd(d.w).then(function(){b(new N("redirect-cancelled-by-user"))}))}; +n=function(){ag()&&l()};e.addEventListener("resume",l,!1);J().toLowerCase().match(/android/)||e.addEventListener("visibilitychange",n,!1)})).s(function(a){return Mj(d).then(function(){throw a;})})}),function(){l&&e.removeEventListener("resume",l,!1);n&&e.removeEventListener("visibilitychange",n,!1);f&&f.cancel();g&&d.Ja(g);d.c=null})}; +function Lj(a,b,c,d){var e=Ij(),f=new wh(b,d,null,e,new N("no-auth-event")),g=L("BuildInfo.packageName",k);if("string"!==typeof g)throw new N("invalid-cordova-configuration");var l=L("BuildInfo.displayName",k),n={};if(J().toLowerCase().match(/iphone|ipad|ipod/))n.ibi=g;else if(J().toLowerCase().match(/android/))n.apn=g;else return B(new N("operation-not-supported-in-this-environment"));l&&(n.appDisplayName=l);e=Jj(e);n.sessionId=e;var D=Ri(a.u,a.i,a.l,b,c,null,d,a.m,n,a.o);return a.ba().then(function(){var b= +a.h;return a.A.a.set(Dj,f.B(),b)}).then(function(){var b=L("cordova.plugins.browsertab.isAvailable",k);if("function"!==typeof b)throw new N("invalid-cordova-configuration");var c=null;b(function(b){if(b){c=L("cordova.plugins.browsertab.openUrl",k);if("function"!==typeof c)throw new N("invalid-cordova-configuration");c(D)}else{c=L("cordova.InAppBrowser.open",k);if("function"!==typeof c)throw new N("invalid-cordova-configuration");b=J();b=!(!b.match(/(iPad|iPhone|iPod).*OS 7_\d/i)&&!b.match(/(iPad|iPhone|iPod).*OS 8_\d/i)); +a.a=c(D,b?"_blank":"_system","location=yes")}})})}function Nj(a,b){for(var c=0;ca.f&&(a.a=a.f);return b} +function qk(a,b){sk(a);a.b=sd(rk(a,b)).then(function(){return a.l?A():bg()}).then(function(){return a.h()}).then(function(){qk(a,!0)}).s(function(b){a.i(b)&&qk(a,!1)})}function sk(a){a.b&&(a.b.cancel(),a.b=null)};function tk(a){this.f=a;this.b=this.a=null;this.c=0}tk.prototype.B=function(){return{apiKey:this.f.b,refreshToken:this.a,accessToken:this.b,expirationTime:this.c}};function uk(a,b){var c=b[O],d=b.refreshToken;b=vk(b.expiresIn);a.b=c;a.c=b;a.a=d}function vk(a){return na()+1E3*parseInt(a,10)} +function wk(a,b){return Oh(a.f,b).then(function(b){a.b=b.access_token;a.c=vk(b.expires_in);a.a=b.refresh_token;return{accessToken:a.b,expirationTime:a.c,refreshToken:a.a}}).s(function(b){"auth/user-token-expired"==b.code&&(a.a=null);throw b;})}tk.prototype.getToken=function(a){a=!!a;return this.b&&!this.a?B(new N("user-token-expired")):a||!this.b||na()>this.c-3E4?this.a?wk(this,{grant_type:"refresh_token",refresh_token:this.a}):A(null):A({accessToken:this.b,expirationTime:this.c,refreshToken:this.a})};function xk(a,b){this.a=a||null;this.b=b||null;gg(this,{lastSignInTime:cg(b||null),creationTime:cg(a||null)})}function yk(a){return new xk(a.a,a.b)}xk.prototype.B=function(){return{lastLoginAt:this.b,createdAt:this.a}};function zk(a,b,c,d,e,f){gg(this,{uid:a,displayName:d||null,photoURL:e||null,email:c||null,phoneNumber:f||null,providerId:b})}function Ak(a,b){C.call(this,a);for(var c in b)this[c]=b[c]}t(Ak,C); +function Bk(a,b,c){this.A=[];this.G=a.apiKey;this.o=a.appName;this.w=a.authDomain||null;a=firebase.SDK_VERSION?Of(firebase.SDK_VERSION):null;this.c=new Ch(this.G,xi(yi),a);this.h=new tk(this.c);Ck(this,b[O]);uk(this.h,b);M(this,"refreshToken",this.h.a);Dk(this,c||{});F.call(this);this.I=!1;this.w&&Rf()&&(this.a=gk(this.w,this.G,this.o));this.N=[];this.i=null;this.l=Ek(this);this.U=r(this.Ga,this);var d=this;this.ha=null;this.ra=function(a){d.na(a.h)};this.W=null;this.R=[];this.qa=function(a){Fk(d, +a.f)};this.V=null}t(Bk,F);Bk.prototype.na=function(a){this.ha=a;Ih(this.c,a)};Bk.prototype.$=function(){return this.ha};function Gk(a,b){a.W&&E(a.W,"languageCodeChanged",a.ra);(a.W=b)&&cd(b,"languageCodeChanged",a.ra)}function Fk(a,b){a.R=b;Jh(a.c,firebase.SDK_VERSION?Of(firebase.SDK_VERSION,a.R):null)}Bk.prototype.Ka=function(){return La(this.R)};function Hk(a,b){a.V&&E(a.V,"frameworkChanged",a.qa);(a.V=b)&&cd(b,"frameworkChanged",a.qa)}Bk.prototype.Ga=function(){this.l.b&&(sk(this.l),this.l.start())}; +function Ik(a){try{return firebase.app(a.o).auth()}catch(b){throw new N("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+a.o+"'!");}}function Ek(a){return new pk(function(){return a.F(!0)},function(a){return a&&"auth/network-request-failed"==a.code?!0:!1},function(){var b=a.h.c-na()-3E5;return 0this.o&&(this.o=0);0==this.o&&U(this)&&Kk(U(this));this.removeAuthTokenListener(a)}; +h.addAuthTokenListener=function(a){var b=this;this.m.push(a);T(this,this.i.then(function(){b.l||Ha(b.m,a)&&a(Il(b))}))};h.removeAuthTokenListener=function(a){Ja(this.m,function(b){return b==a})};function Hl(a,b){a.I.push(b);T(a,a.i.then(function(){!a.l&&Ha(a.I,b)&&a.R!==a.getUid()&&(a.R=a.getUid(),b(Il(a)))}))}h.delete=function(){this.l=!0;for(var a=0;ae||e>=Kl.length)throw new N("internal-error", +"Argument validator received an unsupported number of arguments.");c=Kl[e];d=(d?"":c+" argument ")+(b.name?'"'+b.name+'" ':"")+"must be "+b.K+".";break a}d=null}}if(d)throw new N("argument-error",a+" failed: "+d);}var Kl="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" ");function V(a,b){return{name:a||"",K:"a valid string",optional:!!b,M:m}}function Ll(){return{name:"opt_forceRefresh",K:"a boolean",optional:!0,M:ba}} +function W(a,b){return{name:a||"",K:"a valid object",optional:!!b,M:q}}function Ml(a,b){return{name:a||"",K:"a function",optional:!!b,M:p}}function Nl(a,b){return{name:a||"",K:"null",optional:!!b,M:ea}}function Ol(){return{name:"",K:"an HTML element",optional:!1,M:function(a){return!!(a&&a instanceof Element)}}}function Pl(){return{name:"auth",K:"an instance of Firebase Auth",optional:!0,M:function(a){return!!(a&&a instanceof ul)}}} +function Ql(){return{name:"app",K:"an instance of Firebase App",optional:!0,M:function(a){return!!(a&&a instanceof firebase.app.App)}}}function Rl(a){return{name:a?a+"Credential":"credential",K:a?"a valid "+a+" credential":"a valid credential",optional:!1,M:function(b){if(!b)return!1;var c=!a||b.providerId===a;return!(!b.wa||!c)}}} +function Sl(){return{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(a){return!!(a&&a.providerId&&a.hasOwnProperty&&a.hasOwnProperty("isOAuthProvider"))}}}function Tl(){return{name:"applicationVerifier",K:"an implementation of firebase.auth.ApplicationVerifier",optional:!1,M:function(a){return!!(a&&m(a.type)&&p(a.verify))}}}function X(a,b,c,d){return{name:c||"",K:a.K+" or "+b.K,optional:!!d,M:function(c){return a.M(c)||b.M(c)}}};function Ul(a,b,c,d,e,f){M(this,"type","recaptcha");this.b=this.c=null;this.m=!1;this.l=b;this.a=c||{theme:"light",type:"image"};this.g=[];if(this.a[Vl])throw new N("argument-error","sitekey should not be provided for reCAPTCHA as one is automatically provisioned for the current project.");this.h="invisible"===this.a[Wl];if(!wc(b)||!this.h&&wc(b).hasChildNodes())throw new N("argument-error","reCAPTCHA container is either not found or already contains inner elements!");this.u=new Ch(a,f||null,e||null); +this.o=d||function(){return null};var g=this;this.i=[];var l=this.a[Xl];this.a[Xl]=function(a){Yl(g,a);if("function"===typeof l)l(a);else if("string"===typeof l){var b=L(l,k);"function"===typeof b&&b(a)}};var n=this.a[Zl];this.a[Zl]=function(){Yl(g,null);if("function"===typeof n)n();else if("string"===typeof n){var a=L(n,k);"function"===typeof a&&a()}}}var Xl="callback",Zl="expired-callback",Vl="sitekey",Wl="size";function Yl(a,b){for(var c=0;c} */ + DatabaseInternals.prototype.delete = function () { + this.database.checkDeleted_('delete'); + RepoManager_1.RepoManager.getInstance().deleteRepo(this.database.repo_); + this.database.repo_ = null; + this.database.root_ = null; + this.database.INTERNAL = null; + this.database = null; + return Promise.resolve(); + }; + return DatabaseInternals; +}()); +exports.DatabaseInternals = DatabaseInternals; + +//# sourceMappingURL=Database.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/api/Query.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/api/Query.js ***! + \*******************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var KeyIndex_1 = __webpack_require__(/*! ../core/snap/indexes/KeyIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/KeyIndex.js"); +var PriorityIndex_1 = __webpack_require__(/*! ../core/snap/indexes/PriorityIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PriorityIndex.js"); +var ValueIndex_1 = __webpack_require__(/*! ../core/snap/indexes/ValueIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/ValueIndex.js"); +var PathIndex_1 = __webpack_require__(/*! ../core/snap/indexes/PathIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PathIndex.js"); +var util_2 = __webpack_require__(/*! ../core/util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var Path_1 = __webpack_require__(/*! ../core/util/Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +var validation_1 = __webpack_require__(/*! ../core/util/validation */ "./node_modules/@firebase/database/dist/cjs/src/core/util/validation.js"); +var util_3 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var EventRegistration_1 = __webpack_require__(/*! ../core/view/EventRegistration */ "./node_modules/@firebase/database/dist/cjs/src/core/view/EventRegistration.js"); +var util_4 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var __referenceConstructor; +/** + * A Query represents a filter to be applied to a firebase location. This object purely represents the + * query expression (and exposes our public API to build the query). The actual query logic is in ViewBase.js. + * + * Since every Firebase reference is a query, Firebase inherits from this object. + */ +var Query = /** @class */ (function () { + function Query(repo, path, queryParams_, orderByCalled_) { + this.repo = repo; + this.path = path; + this.queryParams_ = queryParams_; + this.orderByCalled_ = orderByCalled_; + } + Object.defineProperty(Query, "__referenceConstructor", { + get: function () { + util_1.assert(__referenceConstructor, 'Reference.ts has not been loaded'); + return __referenceConstructor; + }, + set: function (val) { + __referenceConstructor = val; + }, + enumerable: true, + configurable: true + }); + /** + * Validates start/end values for queries. + * @param {!QueryParams} params + * @private + */ + Query.validateQueryEndpoints_ = function (params) { + var startNode = null; + var endNode = null; + if (params.hasStart()) { + startNode = params.getIndexStartValue(); + } + if (params.hasEnd()) { + endNode = params.getIndexEndValue(); + } + if (params.getIndex() === KeyIndex_1.KEY_INDEX) { + var tooManyArgsError = 'Query: When ordering by key, you may only pass one argument to ' + + 'startAt(), endAt(), or equalTo().'; + var wrongArgTypeError = 'Query: When ordering by key, the argument passed to startAt(), endAt(),' + + 'or equalTo() must be a string.'; + if (params.hasStart()) { + var startName = params.getIndexStartName(); + if (startName != util_2.MIN_NAME) { + throw new Error(tooManyArgsError); + } + else if (typeof startNode !== 'string') { + throw new Error(wrongArgTypeError); + } + } + if (params.hasEnd()) { + var endName = params.getIndexEndName(); + if (endName != util_2.MAX_NAME) { + throw new Error(tooManyArgsError); + } + else if (typeof endNode !== 'string') { + throw new Error(wrongArgTypeError); + } + } + } + else if (params.getIndex() === PriorityIndex_1.PRIORITY_INDEX) { + if ((startNode != null && !validation_1.isValidPriority(startNode)) || + (endNode != null && !validation_1.isValidPriority(endNode))) { + throw new Error('Query: When ordering by priority, the first argument passed to startAt(), ' + + 'endAt(), or equalTo() must be a valid priority value (null, a number, or a string).'); + } + } + else { + util_1.assert(params.getIndex() instanceof PathIndex_1.PathIndex || + params.getIndex() === ValueIndex_1.VALUE_INDEX, 'unknown index type.'); + if ((startNode != null && typeof startNode === 'object') || + (endNode != null && typeof endNode === 'object')) { + throw new Error('Query: First argument passed to startAt(), endAt(), or equalTo() cannot be ' + + 'an object.'); + } + } + }; + /** + * Validates that limit* has been called with the correct combination of parameters + * @param {!QueryParams} params + * @private + */ + Query.validateLimit_ = function (params) { + if (params.hasStart() && + params.hasEnd() && + params.hasLimit() && + !params.hasAnchoredLimit()) { + throw new Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead."); + } + }; + /** + * Validates that no other order by call has been made + * @param {!string} fnName + * @private + */ + Query.prototype.validateNoPreviousOrderByCall_ = function (fnName) { + if (this.orderByCalled_ === true) { + throw new Error(fnName + ": You can't combine multiple orderBy calls."); + } + }; + /** + * @return {!QueryParams} + */ + Query.prototype.getQueryParams = function () { + return this.queryParams_; + }; + /** + * @return {!Reference} + */ + Query.prototype.getRef = function () { + util_3.validateArgCount('Query.ref', 0, 0, arguments.length); + // This is a slight hack. We cannot goog.require('fb.api.Firebase'), since Firebase requires fb.api.Query. + // However, we will always export 'Firebase' to the global namespace, so it's guaranteed to exist by the time this + // method gets called. + return new Query.__referenceConstructor(this.repo, this.path); + }; + /** + * @param {!string} eventType + * @param {!function(DataSnapshot, string=)} callback + * @param {(function(Error)|Object)=} cancelCallbackOrContext + * @param {Object=} context + * @return {!function(DataSnapshot, string=)} + */ + Query.prototype.on = function (eventType, callback, cancelCallbackOrContext, context) { + util_3.validateArgCount('Query.on', 2, 4, arguments.length); + validation_1.validateEventType('Query.on', 1, eventType, false); + util_3.validateCallback('Query.on', 2, callback, false); + var ret = Query.getCancelAndContextArgs_('Query.on', cancelCallbackOrContext, context); + if (eventType === 'value') { + this.onValueEvent(callback, ret.cancel, ret.context); + } + else { + var callbacks = {}; + callbacks[eventType] = callback; + this.onChildEvent(callbacks, ret.cancel, ret.context); + } + return callback; + }; + /** + * @param {!function(!DataSnapshot)} callback + * @param {?function(Error)} cancelCallback + * @param {?Object} context + * @protected + */ + Query.prototype.onValueEvent = function (callback, cancelCallback, context) { + var container = new EventRegistration_1.ValueEventRegistration(callback, cancelCallback || null, context || null); + this.repo.addEventCallbackForQuery(this, container); + }; + /** + * @param {!Object.} callbacks + * @param {?function(Error)} cancelCallback + * @param {?Object} context + * @protected + */ + Query.prototype.onChildEvent = function (callbacks, cancelCallback, context) { + var container = new EventRegistration_1.ChildEventRegistration(callbacks, cancelCallback, context); + this.repo.addEventCallbackForQuery(this, container); + }; + /** + * @param {string=} eventType + * @param {(function(!DataSnapshot, ?string=))=} callback + * @param {Object=} context + */ + Query.prototype.off = function (eventType, callback, context) { + util_3.validateArgCount('Query.off', 0, 3, arguments.length); + validation_1.validateEventType('Query.off', 1, eventType, true); + util_3.validateCallback('Query.off', 2, callback, true); + util_3.validateContextObject('Query.off', 3, context, true); + var container = null; + var callbacks = null; + if (eventType === 'value') { + var valueCallback = callback || null; + container = new EventRegistration_1.ValueEventRegistration(valueCallback, null, context || null); + } + else if (eventType) { + if (callback) { + callbacks = {}; + callbacks[eventType] = callback; + } + container = new EventRegistration_1.ChildEventRegistration(callbacks, null, context || null); + } + this.repo.removeEventCallbackForQuery(this, container); + }; + /** + * Attaches a listener, waits for the first event, and then removes the listener + * @param {!string} eventType + * @param {!function(!DataSnapshot, string=)} userCallback + * @param cancelOrContext + * @param context + * @return {!firebase.Promise} + */ + Query.prototype.once = function (eventType, userCallback, cancelOrContext, context) { + var _this = this; + util_3.validateArgCount('Query.once', 1, 4, arguments.length); + validation_1.validateEventType('Query.once', 1, eventType, false); + util_3.validateCallback('Query.once', 2, userCallback, true); + var ret = Query.getCancelAndContextArgs_('Query.once', cancelOrContext, context); + // TODO: Implement this more efficiently (in particular, use 'get' wire protocol for 'value' event) + // TODO: consider actually wiring the callbacks into the promise. We cannot do this without a breaking change + // because the API currently expects callbacks will be called synchronously if the data is cached, but this is + // against the Promise specification. + var firstCall = true; + var deferred = new util_4.Deferred(); + // A dummy error handler in case a user wasn't expecting promises + deferred.promise.catch(function () { }); + var onceCallback = function (snapshot) { + // NOTE: Even though we unsubscribe, we may get called multiple times if a single action (e.g. set() with JSON) + // triggers multiple events (e.g. child_added or child_changed). + if (firstCall) { + firstCall = false; + _this.off(eventType, onceCallback); + if (userCallback) { + userCallback.bind(ret.context)(snapshot); + } + deferred.resolve(snapshot); + } + }; + this.on(eventType, onceCallback, + /*cancel=*/ function (err) { + _this.off(eventType, onceCallback); + if (ret.cancel) + ret.cancel.bind(ret.context)(err); + deferred.reject(err); + }); + return deferred.promise; + }; + /** + * Set a limit and anchor it to the start of the window. + * @param {!number} limit + * @return {!Query} + */ + Query.prototype.limitToFirst = function (limit) { + util_3.validateArgCount('Query.limitToFirst', 1, 1, arguments.length); + if (typeof limit !== 'number' || + Math.floor(limit) !== limit || + limit <= 0) { + throw new Error('Query.limitToFirst: First argument must be a positive integer.'); + } + if (this.queryParams_.hasLimit()) { + throw new Error('Query.limitToFirst: Limit was already set (by another call to limit, ' + + 'limitToFirst, or limitToLast).'); + } + return new Query(this.repo, this.path, this.queryParams_.limitToFirst(limit), this.orderByCalled_); + }; + /** + * Set a limit and anchor it to the end of the window. + * @param {!number} limit + * @return {!Query} + */ + Query.prototype.limitToLast = function (limit) { + util_3.validateArgCount('Query.limitToLast', 1, 1, arguments.length); + if (typeof limit !== 'number' || + Math.floor(limit) !== limit || + limit <= 0) { + throw new Error('Query.limitToLast: First argument must be a positive integer.'); + } + if (this.queryParams_.hasLimit()) { + throw new Error('Query.limitToLast: Limit was already set (by another call to limit, ' + + 'limitToFirst, or limitToLast).'); + } + return new Query(this.repo, this.path, this.queryParams_.limitToLast(limit), this.orderByCalled_); + }; + /** + * Given a child path, return a new query ordered by the specified grandchild path. + * @param {!string} path + * @return {!Query} + */ + Query.prototype.orderByChild = function (path) { + util_3.validateArgCount('Query.orderByChild', 1, 1, arguments.length); + if (path === '$key') { + throw new Error('Query.orderByChild: "$key" is invalid. Use Query.orderByKey() instead.'); + } + else if (path === '$priority') { + throw new Error('Query.orderByChild: "$priority" is invalid. Use Query.orderByPriority() instead.'); + } + else if (path === '$value') { + throw new Error('Query.orderByChild: "$value" is invalid. Use Query.orderByValue() instead.'); + } + validation_1.validatePathString('Query.orderByChild', 1, path, false); + this.validateNoPreviousOrderByCall_('Query.orderByChild'); + var parsedPath = new Path_1.Path(path); + if (parsedPath.isEmpty()) { + throw new Error('Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead.'); + } + var index = new PathIndex_1.PathIndex(parsedPath); + var newParams = this.queryParams_.orderBy(index); + Query.validateQueryEndpoints_(newParams); + return new Query(this.repo, this.path, newParams, /*orderByCalled=*/ true); + }; + /** + * Return a new query ordered by the KeyIndex + * @return {!Query} + */ + Query.prototype.orderByKey = function () { + util_3.validateArgCount('Query.orderByKey', 0, 0, arguments.length); + this.validateNoPreviousOrderByCall_('Query.orderByKey'); + var newParams = this.queryParams_.orderBy(KeyIndex_1.KEY_INDEX); + Query.validateQueryEndpoints_(newParams); + return new Query(this.repo, this.path, newParams, /*orderByCalled=*/ true); + }; + /** + * Return a new query ordered by the PriorityIndex + * @return {!Query} + */ + Query.prototype.orderByPriority = function () { + util_3.validateArgCount('Query.orderByPriority', 0, 0, arguments.length); + this.validateNoPreviousOrderByCall_('Query.orderByPriority'); + var newParams = this.queryParams_.orderBy(PriorityIndex_1.PRIORITY_INDEX); + Query.validateQueryEndpoints_(newParams); + return new Query(this.repo, this.path, newParams, /*orderByCalled=*/ true); + }; + /** + * Return a new query ordered by the ValueIndex + * @return {!Query} + */ + Query.prototype.orderByValue = function () { + util_3.validateArgCount('Query.orderByValue', 0, 0, arguments.length); + this.validateNoPreviousOrderByCall_('Query.orderByValue'); + var newParams = this.queryParams_.orderBy(ValueIndex_1.VALUE_INDEX); + Query.validateQueryEndpoints_(newParams); + return new Query(this.repo, this.path, newParams, /*orderByCalled=*/ true); + }; + /** + * @param {number|string|boolean|null} value + * @param {?string=} name + * @return {!Query} + */ + Query.prototype.startAt = function (value, name) { + if (value === void 0) { value = null; } + util_3.validateArgCount('Query.startAt', 0, 2, arguments.length); + validation_1.validateFirebaseDataArg('Query.startAt', 1, value, this.path, true); + validation_1.validateKey('Query.startAt', 2, name, true); + var newParams = this.queryParams_.startAt(value, name); + Query.validateLimit_(newParams); + Query.validateQueryEndpoints_(newParams); + if (this.queryParams_.hasStart()) { + throw new Error('Query.startAt: Starting point was already set (by another call to startAt ' + + 'or equalTo).'); + } + // Calling with no params tells us to start at the beginning. + if (value === undefined) { + value = null; + name = null; + } + return new Query(this.repo, this.path, newParams, this.orderByCalled_); + }; + /** + * @param {number|string|boolean|null} value + * @param {?string=} name + * @return {!Query} + */ + Query.prototype.endAt = function (value, name) { + if (value === void 0) { value = null; } + util_3.validateArgCount('Query.endAt', 0, 2, arguments.length); + validation_1.validateFirebaseDataArg('Query.endAt', 1, value, this.path, true); + validation_1.validateKey('Query.endAt', 2, name, true); + var newParams = this.queryParams_.endAt(value, name); + Query.validateLimit_(newParams); + Query.validateQueryEndpoints_(newParams); + if (this.queryParams_.hasEnd()) { + throw new Error('Query.endAt: Ending point was already set (by another call to endAt or ' + + 'equalTo).'); + } + return new Query(this.repo, this.path, newParams, this.orderByCalled_); + }; + /** + * Load the selection of children with exactly the specified value, and, optionally, + * the specified name. + * @param {number|string|boolean|null} value + * @param {string=} name + * @return {!Query} + */ + Query.prototype.equalTo = function (value, name) { + util_3.validateArgCount('Query.equalTo', 1, 2, arguments.length); + validation_1.validateFirebaseDataArg('Query.equalTo', 1, value, this.path, false); + validation_1.validateKey('Query.equalTo', 2, name, true); + if (this.queryParams_.hasStart()) { + throw new Error('Query.equalTo: Starting point was already set (by another call to startAt or ' + + 'equalTo).'); + } + if (this.queryParams_.hasEnd()) { + throw new Error('Query.equalTo: Ending point was already set (by another call to endAt or ' + + 'equalTo).'); + } + return this.startAt(value, name).endAt(value, name); + }; + /** + * @return {!string} URL for this location. + */ + Query.prototype.toString = function () { + util_3.validateArgCount('Query.toString', 0, 0, arguments.length); + return this.repo.toString() + this.path.toUrlEncodedString(); + }; + // Do not create public documentation. This is intended to make JSON serialization work but is otherwise unnecessary + // for end-users. + Query.prototype.toJSON = function () { + // An optional spacer argument is unnecessary for a string. + util_3.validateArgCount('Query.toJSON', 0, 1, arguments.length); + return this.toString(); + }; + /** + * An object representation of the query parameters used by this Query. + * @return {!Object} + */ + Query.prototype.queryObject = function () { + return this.queryParams_.getQueryObject(); + }; + /** + * @return {!string} + */ + Query.prototype.queryIdentifier = function () { + var obj = this.queryObject(); + var id = util_2.ObjectToUniqueKey(obj); + return id === '{}' ? 'default' : id; + }; + /** + * Return true if this query and the provided query are equivalent; otherwise, return false. + * @param {Query} other + * @return {boolean} + */ + Query.prototype.isEqual = function (other) { + util_3.validateArgCount('Query.isEqual', 1, 1, arguments.length); + if (!(other instanceof Query)) { + var error = 'Query.isEqual failed: First argument must be an instance of firebase.database.Query.'; + throw new Error(error); + } + var sameRepo = this.repo === other.repo; + var samePath = this.path.equals(other.path); + var sameQueryIdentifier = this.queryIdentifier() === other.queryIdentifier(); + return sameRepo && samePath && sameQueryIdentifier; + }; + /** + * Helper used by .on and .once to extract the context and or cancel arguments. + * @param {!string} fnName The function name (on or once) + * @param {(function(Error)|Object)=} cancelOrContext + * @param {Object=} context + * @return {{cancel: ?function(Error), context: ?Object}} + * @private + */ + Query.getCancelAndContextArgs_ = function (fnName, cancelOrContext, context) { + var ret = { cancel: null, context: null }; + if (cancelOrContext && context) { + ret.cancel = cancelOrContext; + util_3.validateCallback(fnName, 3, ret.cancel, true); + ret.context = context; + util_3.validateContextObject(fnName, 4, ret.context, true); + } + else if (cancelOrContext) { + // we have either a cancel callback or a context. + if (typeof cancelOrContext === 'object' && cancelOrContext !== null) { + // it's a context! + ret.context = cancelOrContext; + } + else if (typeof cancelOrContext === 'function') { + ret.cancel = cancelOrContext; + } + else { + throw new Error(util_3.errorPrefix(fnName, 3, true) + + ' must either be a cancel callback or a context object.'); + } + } + return ret; + }; + Object.defineProperty(Query.prototype, "ref", { + get: function () { + return this.getRef(); + }, + enumerable: true, + configurable: true + }); + return Query; +}()); +exports.Query = Query; + +//# sourceMappingURL=Query.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/api/Reference.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/api/Reference.js ***! + \***********************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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. + */ +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 __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var onDisconnect_1 = __webpack_require__(/*! ./onDisconnect */ "./node_modules/@firebase/database/dist/cjs/src/api/onDisconnect.js"); +var TransactionResult_1 = __webpack_require__(/*! ./TransactionResult */ "./node_modules/@firebase/database/dist/cjs/src/api/TransactionResult.js"); +var util_1 = __webpack_require__(/*! ../core/util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var NextPushId_1 = __webpack_require__(/*! ../core/util/NextPushId */ "./node_modules/@firebase/database/dist/cjs/src/core/util/NextPushId.js"); +var Query_1 = __webpack_require__(/*! ./Query */ "./node_modules/@firebase/database/dist/cjs/src/api/Query.js"); +var Repo_1 = __webpack_require__(/*! ../core/Repo */ "./node_modules/@firebase/database/dist/cjs/src/core/Repo.js"); +var Path_1 = __webpack_require__(/*! ../core/util/Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +var QueryParams_1 = __webpack_require__(/*! ../core/view/QueryParams */ "./node_modules/@firebase/database/dist/cjs/src/core/view/QueryParams.js"); +var validation_1 = __webpack_require__(/*! ../core/util/validation */ "./node_modules/@firebase/database/dist/cjs/src/core/util/validation.js"); +var util_2 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_3 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var SyncPoint_1 = __webpack_require__(/*! ../core/SyncPoint */ "./node_modules/@firebase/database/dist/cjs/src/core/SyncPoint.js"); +var Reference = /** @class */ (function (_super) { + __extends(Reference, _super); + /** + * Call options: + * new Reference(Repo, Path) or + * new Reference(url: string, string|RepoManager) + * + * Externally - this is the firebase.database.Reference type. + * + * @param {!Repo} repo + * @param {(!Path)} path + * @extends {Query} + */ + function Reference(repo, path) { + var _this = this; + if (!(repo instanceof Repo_1.Repo)) { + throw new Error('new Reference() no longer supported - use app.database().'); + } + // call Query's constructor, passing in the repo and path. + _this = _super.call(this, repo, path, QueryParams_1.QueryParams.DEFAULT, false) || this; + return _this; + } + /** @return {?string} */ + Reference.prototype.getKey = function () { + util_2.validateArgCount('Reference.key', 0, 0, arguments.length); + if (this.path.isEmpty()) + return null; + else + return this.path.getBack(); + }; + /** + * @param {!(string|Path)} pathString + * @return {!Reference} + */ + Reference.prototype.child = function (pathString) { + util_2.validateArgCount('Reference.child', 1, 1, arguments.length); + if (typeof pathString === 'number') { + pathString = String(pathString); + } + else if (!(pathString instanceof Path_1.Path)) { + if (this.path.getFront() === null) + validation_1.validateRootPathString('Reference.child', 1, pathString, false); + else + validation_1.validatePathString('Reference.child', 1, pathString, false); + } + return new Reference(this.repo, this.path.child(pathString)); + }; + /** @return {?Reference} */ + Reference.prototype.getParent = function () { + util_2.validateArgCount('Reference.parent', 0, 0, arguments.length); + var parentPath = this.path.parent(); + return parentPath === null ? null : new Reference(this.repo, parentPath); + }; + /** @return {!Reference} */ + Reference.prototype.getRoot = function () { + util_2.validateArgCount('Reference.root', 0, 0, arguments.length); + var ref = this; + while (ref.getParent() !== null) { + ref = ref.getParent(); + } + return ref; + }; + /** @return {!Database} */ + Reference.prototype.databaseProp = function () { + return this.repo.database; + }; + /** + * @param {*} newVal + * @param {function(?Error)=} onComplete + * @return {!Promise} + */ + Reference.prototype.set = function (newVal, onComplete) { + util_2.validateArgCount('Reference.set', 1, 2, arguments.length); + validation_1.validateWritablePath('Reference.set', this.path); + validation_1.validateFirebaseDataArg('Reference.set', 1, newVal, this.path, false); + util_2.validateCallback('Reference.set', 2, onComplete, true); + var deferred = new util_3.Deferred(); + this.repo.setWithPriority(this.path, newVal, + /*priority=*/ null, deferred.wrapCallback(onComplete)); + return deferred.promise; + }; + /** + * @param {!Object} objectToMerge + * @param {function(?Error)=} onComplete + * @return {!Promise} + */ + Reference.prototype.update = function (objectToMerge, onComplete) { + util_2.validateArgCount('Reference.update', 1, 2, arguments.length); + validation_1.validateWritablePath('Reference.update', this.path); + if (Array.isArray(objectToMerge)) { + var newObjectToMerge = {}; + for (var i = 0; i < objectToMerge.length; ++i) { + newObjectToMerge['' + i] = objectToMerge[i]; + } + objectToMerge = newObjectToMerge; + util_1.warn('Passing an Array to Firebase.update() is deprecated. ' + + 'Use set() if you want to overwrite the existing data, or ' + + 'an Object with integer keys if you really do want to ' + + 'only update some of the children.'); + } + validation_1.validateFirebaseMergeDataArg('Reference.update', 1, objectToMerge, this.path, false); + util_2.validateCallback('Reference.update', 2, onComplete, true); + var deferred = new util_3.Deferred(); + this.repo.update(this.path, objectToMerge, deferred.wrapCallback(onComplete)); + return deferred.promise; + }; + /** + * @param {*} newVal + * @param {string|number|null} newPriority + * @param {function(?Error)=} onComplete + * @return {!Promise} + */ + Reference.prototype.setWithPriority = function (newVal, newPriority, onComplete) { + util_2.validateArgCount('Reference.setWithPriority', 2, 3, arguments.length); + validation_1.validateWritablePath('Reference.setWithPriority', this.path); + validation_1.validateFirebaseDataArg('Reference.setWithPriority', 1, newVal, this.path, false); + validation_1.validatePriority('Reference.setWithPriority', 2, newPriority, false); + util_2.validateCallback('Reference.setWithPriority', 3, onComplete, true); + if (this.getKey() === '.length' || this.getKey() === '.keys') + throw 'Reference.setWithPriority failed: ' + + this.getKey() + + ' is a read-only object.'; + var deferred = new util_3.Deferred(); + this.repo.setWithPriority(this.path, newVal, newPriority, deferred.wrapCallback(onComplete)); + return deferred.promise; + }; + /** + * @param {function(?Error)=} onComplete + * @return {!Promise} + */ + Reference.prototype.remove = function (onComplete) { + util_2.validateArgCount('Reference.remove', 0, 1, arguments.length); + validation_1.validateWritablePath('Reference.remove', this.path); + util_2.validateCallback('Reference.remove', 1, onComplete, true); + return this.set(null, onComplete); + }; + /** + * @param {function(*):*} transactionUpdate + * @param {(function(?Error, boolean, ?DataSnapshot))=} onComplete + * @param {boolean=} applyLocally + * @return {!Promise} + */ + Reference.prototype.transaction = function (transactionUpdate, onComplete, applyLocally) { + util_2.validateArgCount('Reference.transaction', 1, 3, arguments.length); + validation_1.validateWritablePath('Reference.transaction', this.path); + util_2.validateCallback('Reference.transaction', 1, transactionUpdate, false); + util_2.validateCallback('Reference.transaction', 2, onComplete, true); + // NOTE: applyLocally is an internal-only option for now. We need to decide if we want to keep it and how + // to expose it. + validation_1.validateBoolean('Reference.transaction', 3, applyLocally, true); + if (this.getKey() === '.length' || this.getKey() === '.keys') + throw 'Reference.transaction failed: ' + + this.getKey() + + ' is a read-only object.'; + if (applyLocally === undefined) + applyLocally = true; + var deferred = new util_3.Deferred(); + if (typeof onComplete === 'function') { + deferred.promise.catch(function () { }); + } + var promiseComplete = function (error, committed, snapshot) { + if (error) { + deferred.reject(error); + } + else { + deferred.resolve(new TransactionResult_1.TransactionResult(committed, snapshot)); + } + if (typeof onComplete === 'function') { + onComplete(error, committed, snapshot); + } + }; + this.repo.startTransaction(this.path, transactionUpdate, promiseComplete, applyLocally); + return deferred.promise; + }; + /** + * @param {string|number|null} priority + * @param {function(?Error)=} onComplete + * @return {!Promise} + */ + Reference.prototype.setPriority = function (priority, onComplete) { + util_2.validateArgCount('Reference.setPriority', 1, 2, arguments.length); + validation_1.validateWritablePath('Reference.setPriority', this.path); + validation_1.validatePriority('Reference.setPriority', 1, priority, false); + util_2.validateCallback('Reference.setPriority', 2, onComplete, true); + var deferred = new util_3.Deferred(); + this.repo.setWithPriority(this.path.child('.priority'), priority, null, deferred.wrapCallback(onComplete)); + return deferred.promise; + }; + /** + * @param {*=} value + * @param {function(?Error)=} onComplete + * @return {!Reference} + */ + Reference.prototype.push = function (value, onComplete) { + util_2.validateArgCount('Reference.push', 0, 2, arguments.length); + validation_1.validateWritablePath('Reference.push', this.path); + validation_1.validateFirebaseDataArg('Reference.push', 1, value, this.path, true); + util_2.validateCallback('Reference.push', 2, onComplete, true); + var now = this.repo.serverTime(); + var name = NextPushId_1.nextPushId(now); + // push() returns a ThennableReference whose promise is fulfilled with a regular Reference. + // We use child() to create handles to two different references. The first is turned into a + // ThennableReference below by adding then() and catch() methods and is used as the + // return value of push(). The second remains a regular Reference and is used as the fulfilled + // value of the first ThennableReference. + var thennablePushRef = this.child(name); + var pushRef = this.child(name); + var promise; + if (value != null) { + promise = thennablePushRef.set(value, onComplete).then(function () { return pushRef; }); + } + else { + promise = Promise.resolve(pushRef); + } + thennablePushRef.then = promise.then.bind(promise); + thennablePushRef.catch = promise.then.bind(promise, undefined); + if (typeof onComplete === 'function') { + promise.catch(function () { }); + } + return thennablePushRef; + }; + /** + * @return {!OnDisconnect} + */ + Reference.prototype.onDisconnect = function () { + validation_1.validateWritablePath('Reference.onDisconnect', this.path); + return new onDisconnect_1.OnDisconnect(this.repo, this.path); + }; + Object.defineProperty(Reference.prototype, "database", { + get: function () { + return this.databaseProp(); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Reference.prototype, "key", { + get: function () { + return this.getKey(); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Reference.prototype, "parent", { + get: function () { + return this.getParent(); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Reference.prototype, "root", { + get: function () { + return this.getRoot(); + }, + enumerable: true, + configurable: true + }); + return Reference; +}(Query_1.Query)); +exports.Reference = Reference; +/** + * Define reference constructor in various modules + * + * We are doing this here to avoid several circular + * dependency issues + */ +Query_1.Query.__referenceConstructor = Reference; +SyncPoint_1.SyncPoint.__referenceConstructor = Reference; + +//# sourceMappingURL=Reference.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/api/TransactionResult.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/api/TransactionResult.js ***! + \*******************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var TransactionResult = /** @class */ (function () { + /** + * A type for the resolve value of Firebase.transaction. + * @constructor + * @dict + * @param {boolean} committed + * @param {DataSnapshot} snapshot + */ + function TransactionResult(committed, snapshot) { + this.committed = committed; + this.snapshot = snapshot; + } + // Do not create public documentation. This is intended to make JSON serialization work but is otherwise unnecessary + // for end-users + TransactionResult.prototype.toJSON = function () { + util_1.validateArgCount('TransactionResult.toJSON', 0, 1, arguments.length); + return { committed: this.committed, snapshot: this.snapshot.toJSON() }; + }; + return TransactionResult; +}()); +exports.TransactionResult = TransactionResult; + +//# sourceMappingURL=TransactionResult.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/api/internal.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/api/internal.js ***! + \**********************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 WebSocketConnection_1 = __webpack_require__(/*! ../realtime/WebSocketConnection */ "./node_modules/@firebase/database/dist/cjs/src/realtime/WebSocketConnection.js"); +var BrowserPollConnection_1 = __webpack_require__(/*! ../realtime/BrowserPollConnection */ "./node_modules/@firebase/database/dist/cjs/src/realtime/BrowserPollConnection.js"); +/** + * INTERNAL methods for internal-use only (tests, etc.). + * + * Customers shouldn't use these or else should be aware that they could break at any time. + * + * @const + */ +exports.forceLongPolling = function () { + WebSocketConnection_1.WebSocketConnection.forceDisallow(); + BrowserPollConnection_1.BrowserPollConnection.forceAllow(); +}; +exports.forceWebSockets = function () { + BrowserPollConnection_1.BrowserPollConnection.forceDisallow(); +}; +/* Used by App Manager */ +exports.isWebSocketsAvailable = function () { + return WebSocketConnection_1.WebSocketConnection['isAvailable'](); +}; +exports.setSecurityDebugCallback = function (ref, callback) { + ref.repo.persistentConnection_.securityDebugCallback_ = callback; +}; +exports.stats = function (ref, showDelta) { + ref.repo.stats(showDelta); +}; +exports.statsIncrementCounter = function (ref, metric) { + ref.repo.statsIncrementCounter(metric); +}; +exports.dataUpdateCount = function (ref) { + return ref.repo.dataUpdateCount; +}; +exports.interceptServerData = function (ref, callback) { + return ref.repo.interceptServerData_(callback); +}; + +//# sourceMappingURL=internal.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/api/onDisconnect.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/api/onDisconnect.js ***! + \**************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var validation_1 = __webpack_require__(/*! ../core/util/validation */ "./node_modules/@firebase/database/dist/cjs/src/core/util/validation.js"); +var util_2 = __webpack_require__(/*! ../core/util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var util_3 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * @constructor + */ +var OnDisconnect = /** @class */ (function () { + /** + * @param {!Repo} repo_ + * @param {!Path} path_ + */ + function OnDisconnect(repo_, path_) { + this.repo_ = repo_; + this.path_ = path_; + } + /** + * @param {function(?Error)=} onComplete + * @return {!firebase.Promise} + */ + OnDisconnect.prototype.cancel = function (onComplete) { + util_1.validateArgCount('OnDisconnect.cancel', 0, 1, arguments.length); + util_1.validateCallback('OnDisconnect.cancel', 1, onComplete, true); + var deferred = new util_3.Deferred(); + this.repo_.onDisconnectCancel(this.path_, deferred.wrapCallback(onComplete)); + return deferred.promise; + }; + /** + * @param {function(?Error)=} onComplete + * @return {!firebase.Promise} + */ + OnDisconnect.prototype.remove = function (onComplete) { + util_1.validateArgCount('OnDisconnect.remove', 0, 1, arguments.length); + validation_1.validateWritablePath('OnDisconnect.remove', this.path_); + util_1.validateCallback('OnDisconnect.remove', 1, onComplete, true); + var deferred = new util_3.Deferred(); + this.repo_.onDisconnectSet(this.path_, null, deferred.wrapCallback(onComplete)); + return deferred.promise; + }; + /** + * @param {*} value + * @param {function(?Error)=} onComplete + * @return {!firebase.Promise} + */ + OnDisconnect.prototype.set = function (value, onComplete) { + util_1.validateArgCount('OnDisconnect.set', 1, 2, arguments.length); + validation_1.validateWritablePath('OnDisconnect.set', this.path_); + validation_1.validateFirebaseDataArg('OnDisconnect.set', 1, value, this.path_, false); + util_1.validateCallback('OnDisconnect.set', 2, onComplete, true); + var deferred = new util_3.Deferred(); + this.repo_.onDisconnectSet(this.path_, value, deferred.wrapCallback(onComplete)); + return deferred.promise; + }; + /** + * @param {*} value + * @param {number|string|null} priority + * @param {function(?Error)=} onComplete + * @return {!firebase.Promise} + */ + OnDisconnect.prototype.setWithPriority = function (value, priority, onComplete) { + util_1.validateArgCount('OnDisconnect.setWithPriority', 2, 3, arguments.length); + validation_1.validateWritablePath('OnDisconnect.setWithPriority', this.path_); + validation_1.validateFirebaseDataArg('OnDisconnect.setWithPriority', 1, value, this.path_, false); + validation_1.validatePriority('OnDisconnect.setWithPriority', 2, priority, false); + util_1.validateCallback('OnDisconnect.setWithPriority', 3, onComplete, true); + var deferred = new util_3.Deferred(); + this.repo_.onDisconnectSetWithPriority(this.path_, value, priority, deferred.wrapCallback(onComplete)); + return deferred.promise; + }; + /** + * @param {!Object} objectToMerge + * @param {function(?Error)=} onComplete + * @return {!firebase.Promise} + */ + OnDisconnect.prototype.update = function (objectToMerge, onComplete) { + util_1.validateArgCount('OnDisconnect.update', 1, 2, arguments.length); + validation_1.validateWritablePath('OnDisconnect.update', this.path_); + if (Array.isArray(objectToMerge)) { + var newObjectToMerge = {}; + for (var i = 0; i < objectToMerge.length; ++i) { + newObjectToMerge['' + i] = objectToMerge[i]; + } + objectToMerge = newObjectToMerge; + util_2.warn('Passing an Array to firebase.database.onDisconnect().update() is deprecated. Use set() if you want to overwrite the ' + + 'existing data, or an Object with integer keys if you really do want to only update some of the children.'); + } + validation_1.validateFirebaseMergeDataArg('OnDisconnect.update', 1, objectToMerge, this.path_, false); + util_1.validateCallback('OnDisconnect.update', 2, onComplete, true); + var deferred = new util_3.Deferred(); + this.repo_.onDisconnectUpdate(this.path_, objectToMerge, deferred.wrapCallback(onComplete)); + return deferred.promise; + }; + return OnDisconnect; +}()); +exports.OnDisconnect = OnDisconnect; + +//# sourceMappingURL=onDisconnect.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/api/test_access.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/api/test_access.js ***! + \*************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 RepoInfo_1 = __webpack_require__(/*! ../core/RepoInfo */ "./node_modules/@firebase/database/dist/cjs/src/core/RepoInfo.js"); +var PersistentConnection_1 = __webpack_require__(/*! ../core/PersistentConnection */ "./node_modules/@firebase/database/dist/cjs/src/core/PersistentConnection.js"); +var RepoManager_1 = __webpack_require__(/*! ../core/RepoManager */ "./node_modules/@firebase/database/dist/cjs/src/core/RepoManager.js"); +var Connection_1 = __webpack_require__(/*! ../realtime/Connection */ "./node_modules/@firebase/database/dist/cjs/src/realtime/Connection.js"); +exports.DataConnection = PersistentConnection_1.PersistentConnection; +/** + * @param {!string} pathString + * @param {function(*)} onComplete + */ +PersistentConnection_1.PersistentConnection.prototype.simpleListen = function (pathString, onComplete) { + this.sendRequest('q', { p: pathString }, onComplete); +}; +/** + * @param {*} data + * @param {function(*)} onEcho + */ +PersistentConnection_1.PersistentConnection.prototype.echo = function (data, onEcho) { + this.sendRequest('echo', { d: data }, onEcho); +}; +// RealTimeConnection properties that we use in tests. +exports.RealTimeConnection = Connection_1.Connection; +/** + * @param {function(): string} newHash + * @return {function()} + */ +exports.hijackHash = function (newHash) { + var oldPut = PersistentConnection_1.PersistentConnection.prototype.put; + PersistentConnection_1.PersistentConnection.prototype.put = function (pathString, data, opt_onComplete, opt_hash) { + if (opt_hash !== undefined) { + opt_hash = newHash(); + } + oldPut.call(this, pathString, data, opt_onComplete, opt_hash); + }; + return function () { + PersistentConnection_1.PersistentConnection.prototype.put = oldPut; + }; +}; +/** + * @type {function(new:RepoInfo, !string, boolean, !string, boolean): undefined} + */ +exports.ConnectionTarget = RepoInfo_1.RepoInfo; +/** + * @param {!Query} query + * @return {!string} + */ +exports.queryIdentifier = function (query) { + return query.queryIdentifier(); +}; +/** + * @param {!Query} firebaseRef + * @return {!Object} + */ +exports.listens = function (firebaseRef) { + return firebaseRef.repo.persistentConnection_.listens_; +}; +/** + * Forces the RepoManager to create Repos that use ReadonlyRestClient instead of PersistentConnection. + * + * @param {boolean} forceRestClient + */ +exports.forceRestClient = function (forceRestClient) { + RepoManager_1.RepoManager.getInstance().forceRestClient(forceRestClient); +}; + +//# sourceMappingURL=test_access.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/AuthTokenProvider.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/AuthTokenProvider.js ***! + \********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! ./util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +/** + * Abstraction around FirebaseApp's token fetching capabilities. + */ +var AuthTokenProvider = /** @class */ (function () { + /** + * @param {!FirebaseApp} app_ + */ + function AuthTokenProvider(app_) { + this.app_ = app_; + } + /** + * @param {boolean} forceRefresh + * @return {!Promise} + */ + AuthTokenProvider.prototype.getToken = function (forceRefresh) { + return this.app_['INTERNAL']['getToken'](forceRefresh).then(null, + // .catch + function (error) { + // TODO: Need to figure out all the cases this is raised and whether + // this makes sense. + if (error && error.code === 'auth/token-not-initialized') { + util_1.log('Got auth/token-not-initialized error. Treating as null token.'); + return null; + } + else { + return Promise.reject(error); + } + }); + }; + AuthTokenProvider.prototype.addTokenChangeListener = function (listener) { + // TODO: We might want to wrap the listener and call it with no args to + // avoid a leaky abstraction, but that makes removing the listener harder. + this.app_['INTERNAL']['addAuthTokenListener'](listener); + }; + AuthTokenProvider.prototype.removeTokenChangeListener = function (listener) { + this.app_['INTERNAL']['removeAuthTokenListener'](listener); + }; + AuthTokenProvider.prototype.notifyForInvalidToken = function () { + var errorMessage = 'Provided authentication credentials for the app named "' + + this.app_.name + + '" are invalid. This usually indicates your app was not ' + + 'initialized correctly. '; + if ('credential' in this.app_.options) { + errorMessage += + 'Make sure the "credential" property provided to initializeApp() ' + + 'is authorized to access the specified "databaseURL" and is from the correct ' + + 'project.'; + } + else if ('serviceAccount' in this.app_.options) { + errorMessage += + 'Make sure the "serviceAccount" property provided to initializeApp() ' + + 'is authorized to access the specified "databaseURL" and is from the correct ' + + 'project.'; + } + else { + errorMessage += + 'Make sure the "apiKey" and "databaseURL" properties provided to ' + + 'initializeApp() match the values provided for your app at ' + + 'https://console.firebase.google.com/.'; + } + util_1.warn(errorMessage); + }; + return AuthTokenProvider; +}()); +exports.AuthTokenProvider = AuthTokenProvider; + +//# sourceMappingURL=AuthTokenProvider.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/CompoundWrite.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/CompoundWrite.js ***! + \****************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 ImmutableTree_1 = __webpack_require__(/*! ./util/ImmutableTree */ "./node_modules/@firebase/database/dist/cjs/src/core/util/ImmutableTree.js"); +var Path_1 = __webpack_require__(/*! ./util/Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +var util_1 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var Node_1 = __webpack_require__(/*! ./snap/Node */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/Node.js"); +var PriorityIndex_1 = __webpack_require__(/*! ./snap/indexes/PriorityIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PriorityIndex.js"); +var util_2 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * This class holds a collection of writes that can be applied to nodes in unison. It abstracts away the logic with + * dealing with priority writes and multiple nested writes. At any given path there is only allowed to be one write + * modifying that path. Any write to an existing path or shadowing an existing path will modify that existing write + * to reflect the write added. + * + * @constructor + * @param {!ImmutableTree.} writeTree + */ +var CompoundWrite = /** @class */ (function () { + function CompoundWrite(writeTree_) { + this.writeTree_ = writeTree_; + } + /** + * @param {!Path} path + * @param {!Node} node + * @return {!CompoundWrite} + */ + CompoundWrite.prototype.addWrite = function (path, node) { + if (path.isEmpty()) { + return new CompoundWrite(new ImmutableTree_1.ImmutableTree(node)); + } + else { + var rootmost = this.writeTree_.findRootMostValueAndPath(path); + if (rootmost != null) { + var rootMostPath = rootmost.path; + var value = rootmost.value; + var relativePath = Path_1.Path.relativePath(rootMostPath, path); + value = value.updateChild(relativePath, node); + return new CompoundWrite(this.writeTree_.set(rootMostPath, value)); + } + else { + var subtree = new ImmutableTree_1.ImmutableTree(node); + var newWriteTree = this.writeTree_.setTree(path, subtree); + return new CompoundWrite(newWriteTree); + } + } + }; + /** + * @param {!Path} path + * @param {!Object.} updates + * @return {!CompoundWrite} + */ + CompoundWrite.prototype.addWrites = function (path, updates) { + var newWrite = this; + util_1.forEach(updates, function (childKey, node) { + newWrite = newWrite.addWrite(path.child(childKey), node); + }); + return newWrite; + }; + /** + * Will remove a write at the given path and deeper paths. This will not modify a write at a higher + * location, which must be removed by calling this method with that path. + * + * @param {!Path} path The path at which a write and all deeper writes should be removed + * @return {!CompoundWrite} The new CompoundWrite with the removed path + */ + CompoundWrite.prototype.removeWrite = function (path) { + if (path.isEmpty()) { + return CompoundWrite.Empty; + } + else { + var newWriteTree = this.writeTree_.setTree(path, ImmutableTree_1.ImmutableTree.Empty); + return new CompoundWrite(newWriteTree); + } + }; + /** + * Returns whether this CompoundWrite will fully overwrite a node at a given location and can therefore be + * considered "complete". + * + * @param {!Path} path The path to check for + * @return {boolean} Whether there is a complete write at that path + */ + CompoundWrite.prototype.hasCompleteWrite = function (path) { + return this.getCompleteNode(path) != null; + }; + /** + * Returns a node for a path if and only if the node is a "complete" overwrite at that path. This will not aggregate + * writes from deeper paths, but will return child nodes from a more shallow path. + * + * @param {!Path} path The path to get a complete write + * @return {?Node} The node if complete at that path, or null otherwise. + */ + CompoundWrite.prototype.getCompleteNode = function (path) { + var rootmost = this.writeTree_.findRootMostValueAndPath(path); + if (rootmost != null) { + return this.writeTree_ + .get(rootmost.path) + .getChild(Path_1.Path.relativePath(rootmost.path, path)); + } + else { + return null; + } + }; + /** + * Returns all children that are guaranteed to be a complete overwrite. + * + * @return {!Array.} A list of all complete children. + */ + CompoundWrite.prototype.getCompleteChildren = function () { + var children = []; + var node = this.writeTree_.value; + if (node != null) { + // If it's a leaf node, it has no children; so nothing to do. + if (!node.isLeafNode()) { + node.forEachChild(PriorityIndex_1.PRIORITY_INDEX, function (childName, childNode) { + children.push(new Node_1.NamedNode(childName, childNode)); + }); + } + } + else { + this.writeTree_.children.inorderTraversal(function (childName, childTree) { + if (childTree.value != null) { + children.push(new Node_1.NamedNode(childName, childTree.value)); + } + }); + } + return children; + }; + /** + * @param {!Path} path + * @return {!CompoundWrite} + */ + CompoundWrite.prototype.childCompoundWrite = function (path) { + if (path.isEmpty()) { + return this; + } + else { + var shadowingNode = this.getCompleteNode(path); + if (shadowingNode != null) { + return new CompoundWrite(new ImmutableTree_1.ImmutableTree(shadowingNode)); + } + else { + return new CompoundWrite(this.writeTree_.subtree(path)); + } + } + }; + /** + * Returns true if this CompoundWrite is empty and therefore does not modify any nodes. + * @return {boolean} Whether this CompoundWrite is empty + */ + CompoundWrite.prototype.isEmpty = function () { + return this.writeTree_.isEmpty(); + }; + /** + * Applies this CompoundWrite to a node. The node is returned with all writes from this CompoundWrite applied to the + * node + * @param {!Node} node The node to apply this CompoundWrite to + * @return {!Node} The node with all writes applied + */ + CompoundWrite.prototype.apply = function (node) { + return CompoundWrite.applySubtreeWrite_(Path_1.Path.Empty, this.writeTree_, node); + }; + /** + * @type {!CompoundWrite} + */ + CompoundWrite.Empty = new CompoundWrite(new ImmutableTree_1.ImmutableTree(null)); + /** + * @param {!Path} relativePath + * @param {!ImmutableTree.} writeTree + * @param {!Node} node + * @return {!Node} + * @private + */ + CompoundWrite.applySubtreeWrite_ = function (relativePath, writeTree, node) { + if (writeTree.value != null) { + // Since there a write is always a leaf, we're done here + return node.updateChild(relativePath, writeTree.value); + } + else { + var priorityWrite_1 = null; + writeTree.children.inorderTraversal(function (childKey, childTree) { + if (childKey === '.priority') { + // Apply priorities at the end so we don't update priorities for either empty nodes or forget + // to apply priorities to empty nodes that are later filled + util_2.assert(childTree.value !== null, 'Priority writes must always be leaf nodes'); + priorityWrite_1 = childTree.value; + } + else { + node = CompoundWrite.applySubtreeWrite_(relativePath.child(childKey), childTree, node); + } + }); + // If there was a priority write, we only apply it if the node is not empty + if (!node.getChild(relativePath).isEmpty() && priorityWrite_1 !== null) { + node = node.updateChild(relativePath.child('.priority'), priorityWrite_1); + } + return node; + } + }; + return CompoundWrite; +}()); +exports.CompoundWrite = CompoundWrite; + +//# sourceMappingURL=CompoundWrite.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/PersistentConnection.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/PersistentConnection.js ***! + \***********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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. + */ +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 __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var app_1 = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/esm/index.js"); +var util_1 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_3 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_4 = __webpack_require__(/*! ./util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var Path_1 = __webpack_require__(/*! ./util/Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +var VisibilityMonitor_1 = __webpack_require__(/*! ./util/VisibilityMonitor */ "./node_modules/@firebase/database/dist/cjs/src/core/util/VisibilityMonitor.js"); +var OnlineMonitor_1 = __webpack_require__(/*! ./util/OnlineMonitor */ "./node_modules/@firebase/database/dist/cjs/src/core/util/OnlineMonitor.js"); +var util_5 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var Connection_1 = __webpack_require__(/*! ../realtime/Connection */ "./node_modules/@firebase/database/dist/cjs/src/realtime/Connection.js"); +var util_6 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_7 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var ServerActions_1 = __webpack_require__(/*! ./ServerActions */ "./node_modules/@firebase/database/dist/cjs/src/core/ServerActions.js"); +var RECONNECT_MIN_DELAY = 1000; +var RECONNECT_MAX_DELAY_DEFAULT = 60 * 5 * 1000; // 5 minutes in milliseconds (Case: 1858) +var RECONNECT_MAX_DELAY_FOR_ADMINS = 30 * 1000; // 30 seconds for admin clients (likely to be a backend server) +var RECONNECT_DELAY_MULTIPLIER = 1.3; +var RECONNECT_DELAY_RESET_TIMEOUT = 30000; // Reset delay back to MIN_DELAY after being connected for 30sec. +var SERVER_KILL_INTERRUPT_REASON = 'server_kill'; +// If auth fails repeatedly, we'll assume something is wrong and log a warning / back off. +var INVALID_AUTH_TOKEN_THRESHOLD = 3; +/** + * Firebase connection. Abstracts wire protocol and handles reconnecting. + * + * NOTE: All JSON objects sent to the realtime connection must have property names enclosed + * in quotes to make sure the closure compiler does not minify them. + */ +var PersistentConnection = /** @class */ (function (_super) { + __extends(PersistentConnection, _super); + /** + * @implements {ServerActions} + * @param {!RepoInfo} repoInfo_ Data about the namespace we are connecting to + * @param {function(string, *, boolean, ?number)} onDataUpdate_ A callback for new data from the server + * @param onConnectStatus_ + * @param onServerInfoUpdate_ + * @param authTokenProvider_ + * @param authOverride_ + */ + function PersistentConnection(repoInfo_, onDataUpdate_, onConnectStatus_, onServerInfoUpdate_, authTokenProvider_, authOverride_) { + var _this = _super.call(this) || this; + _this.repoInfo_ = repoInfo_; + _this.onDataUpdate_ = onDataUpdate_; + _this.onConnectStatus_ = onConnectStatus_; + _this.onServerInfoUpdate_ = onServerInfoUpdate_; + _this.authTokenProvider_ = authTokenProvider_; + _this.authOverride_ = authOverride_; + // Used for diagnostic logging. + _this.id = PersistentConnection.nextPersistentConnectionId_++; + _this.log_ = util_4.logWrapper('p:' + _this.id + ':'); + /** @private {Object} */ + _this.interruptReasons_ = {}; + _this.listens_ = {}; + _this.outstandingPuts_ = []; + _this.outstandingPutCount_ = 0; + _this.onDisconnectRequestQueue_ = []; + _this.connected_ = false; + _this.reconnectDelay_ = RECONNECT_MIN_DELAY; + _this.maxReconnectDelay_ = RECONNECT_MAX_DELAY_DEFAULT; + _this.securityDebugCallback_ = null; + _this.lastSessionId = null; + /** @private {number|null} */ + _this.establishConnectionTimer_ = null; + /** @private {boolean} */ + _this.visible_ = false; + // Before we get connected, we keep a queue of pending messages to send. + _this.requestCBHash_ = {}; + _this.requestNumber_ = 0; + /** @private {?{ + * sendRequest(Object), + * close() + * }} */ + _this.realtime_ = null; + /** @private {string|null} */ + _this.authToken_ = null; + _this.forceTokenRefresh_ = false; + _this.invalidAuthTokenCount_ = 0; + _this.firstConnection_ = true; + _this.lastConnectionAttemptTime_ = null; + _this.lastConnectionEstablishedTime_ = null; + if (authOverride_ && !util_7.isNodeSdk()) { + throw new Error('Auth override specified in options, but not supported on non Node.js platforms'); + } + _this.scheduleConnect_(0); + VisibilityMonitor_1.VisibilityMonitor.getInstance().on('visible', _this.onVisible_, _this); + if (repoInfo_.host.indexOf('fblocal') === -1) { + OnlineMonitor_1.OnlineMonitor.getInstance().on('online', _this.onOnline_, _this); + } + return _this; + } + /** + * @param {!string} action + * @param {*} body + * @param {function(*)=} onResponse + * @protected + */ + PersistentConnection.prototype.sendRequest = function (action, body, onResponse) { + var curReqNum = ++this.requestNumber_; + var msg = { r: curReqNum, a: action, b: body }; + this.log_(util_2.stringify(msg)); + util_3.assert(this.connected_, "sendRequest call when we're not connected not allowed."); + this.realtime_.sendRequest(msg); + if (onResponse) { + this.requestCBHash_[curReqNum] = onResponse; + } + }; + /** + * @inheritDoc + */ + PersistentConnection.prototype.listen = function (query, currentHashFn, tag, onComplete) { + var queryId = query.queryIdentifier(); + var pathString = query.path.toString(); + this.log_('Listen called for ' + pathString + ' ' + queryId); + this.listens_[pathString] = this.listens_[pathString] || {}; + util_3.assert(query.getQueryParams().isDefault() || + !query.getQueryParams().loadsAllData(), 'listen() called for non-default but complete query'); + util_3.assert(!this.listens_[pathString][queryId], 'listen() called twice for same path/queryId.'); + var listenSpec = { + onComplete: onComplete, + hashFn: currentHashFn, + query: query, + tag: tag + }; + this.listens_[pathString][queryId] = listenSpec; + if (this.connected_) { + this.sendListen_(listenSpec); + } + }; + /** + * @param {!{onComplete(), + * hashFn():!string, + * query: !Query, + * tag: ?number}} listenSpec + * @private + */ + PersistentConnection.prototype.sendListen_ = function (listenSpec) { + var _this = this; + var query = listenSpec.query; + var pathString = query.path.toString(); + var queryId = query.queryIdentifier(); + this.log_('Listen on ' + pathString + ' for ' + queryId); + var req = { /*path*/ p: pathString }; + var action = 'q'; + // Only bother to send query if it's non-default. + if (listenSpec.tag) { + req['q'] = query.queryObject(); + req['t'] = listenSpec.tag; + } + req['h'] = listenSpec.hashFn(); + this.sendRequest(action, req, function (message) { + var payload = message['d']; + var status = message['s']; + // print warnings in any case... + PersistentConnection.warnOnListenWarnings_(payload, query); + var currentListenSpec = _this.listens_[pathString] && _this.listens_[pathString][queryId]; + // only trigger actions if the listen hasn't been removed and readded + if (currentListenSpec === listenSpec) { + _this.log_('listen response', message); + if (status !== 'ok') { + _this.removeListen_(pathString, queryId); + } + if (listenSpec.onComplete) { + listenSpec.onComplete(status, payload); + } + } + }); + }; + /** + * @param {*} payload + * @param {!Query} query + * @private + */ + PersistentConnection.warnOnListenWarnings_ = function (payload, query) { + if (payload && typeof payload === 'object' && util_1.contains(payload, 'w')) { + var warnings = util_1.safeGet(payload, 'w'); + if (Array.isArray(warnings) && ~warnings.indexOf('no_index')) { + var indexSpec = '".indexOn": "' + + query + .getQueryParams() + .getIndex() + .toString() + + '"'; + var indexPath = query.path.toString(); + util_4.warn("Using an unspecified index. Your data will be downloaded and " + + ("filtered on the client. Consider adding " + indexSpec + " at ") + + (indexPath + " to your security rules for better performance.")); + } + } + }; + /** + * @inheritDoc + */ + PersistentConnection.prototype.refreshAuthToken = function (token) { + this.authToken_ = token; + this.log_('Auth token refreshed'); + if (this.authToken_) { + this.tryAuth(); + } + else { + //If we're connected we want to let the server know to unauthenticate us. If we're not connected, simply delete + //the credential so we dont become authenticated next time we connect. + if (this.connected_) { + this.sendRequest('unauth', {}, function () { }); + } + } + this.reduceReconnectDelayIfAdminCredential_(token); + }; + /** + * @param {!string} credential + * @private + */ + PersistentConnection.prototype.reduceReconnectDelayIfAdminCredential_ = function (credential) { + // NOTE: This isn't intended to be bulletproof (a malicious developer can always just modify the client). + // Additionally, we don't bother resetting the max delay back to the default if auth fails / expires. + var isFirebaseSecret = credential && credential.length === 40; + if (isFirebaseSecret || util_5.isAdmin(credential)) { + this.log_('Admin auth credential detected. Reducing max reconnect time.'); + this.maxReconnectDelay_ = RECONNECT_MAX_DELAY_FOR_ADMINS; + } + }; + /** + * Attempts to authenticate with the given credentials. If the authentication attempt fails, it's triggered like + * a auth revoked (the connection is closed). + */ + PersistentConnection.prototype.tryAuth = function () { + var _this = this; + if (this.connected_ && this.authToken_) { + var token_1 = this.authToken_; + var authMethod = util_5.isValidFormat(token_1) ? 'auth' : 'gauth'; + var requestData = { cred: token_1 }; + if (this.authOverride_ === null) { + requestData['noauth'] = true; + } + else if (typeof this.authOverride_ === 'object') { + requestData['authvar'] = this.authOverride_; + } + this.sendRequest(authMethod, requestData, function (res) { + var status = res['s']; + var data = res['d'] || 'error'; + if (_this.authToken_ === token_1) { + if (status === 'ok') { + _this.invalidAuthTokenCount_ = 0; + } + else { + // Triggers reconnect and force refresh for auth token + _this.onAuthRevoked_(status, data); + } + } + }); + } + }; + /** + * @inheritDoc + */ + PersistentConnection.prototype.unlisten = function (query, tag) { + var pathString = query.path.toString(); + var queryId = query.queryIdentifier(); + this.log_('Unlisten called for ' + pathString + ' ' + queryId); + util_3.assert(query.getQueryParams().isDefault() || + !query.getQueryParams().loadsAllData(), 'unlisten() called for non-default but complete query'); + var listen = this.removeListen_(pathString, queryId); + if (listen && this.connected_) { + this.sendUnlisten_(pathString, queryId, query.queryObject(), tag); + } + }; + PersistentConnection.prototype.sendUnlisten_ = function (pathString, queryId, queryObj, tag) { + this.log_('Unlisten on ' + pathString + ' for ' + queryId); + var req = { /*path*/ p: pathString }; + var action = 'n'; + // Only bother sending queryId if it's non-default. + if (tag) { + req['q'] = queryObj; + req['t'] = tag; + } + this.sendRequest(action, req); + }; + /** + * @inheritDoc + */ + PersistentConnection.prototype.onDisconnectPut = function (pathString, data, onComplete) { + if (this.connected_) { + this.sendOnDisconnect_('o', pathString, data, onComplete); + } + else { + this.onDisconnectRequestQueue_.push({ + pathString: pathString, + action: 'o', + data: data, + onComplete: onComplete + }); + } + }; + /** + * @inheritDoc + */ + PersistentConnection.prototype.onDisconnectMerge = function (pathString, data, onComplete) { + if (this.connected_) { + this.sendOnDisconnect_('om', pathString, data, onComplete); + } + else { + this.onDisconnectRequestQueue_.push({ + pathString: pathString, + action: 'om', + data: data, + onComplete: onComplete + }); + } + }; + /** + * @inheritDoc + */ + PersistentConnection.prototype.onDisconnectCancel = function (pathString, onComplete) { + if (this.connected_) { + this.sendOnDisconnect_('oc', pathString, null, onComplete); + } + else { + this.onDisconnectRequestQueue_.push({ + pathString: pathString, + action: 'oc', + data: null, + onComplete: onComplete + }); + } + }; + PersistentConnection.prototype.sendOnDisconnect_ = function (action, pathString, data, onComplete) { + var request = { /*path*/ p: pathString, /*data*/ d: data }; + this.log_('onDisconnect ' + action, request); + this.sendRequest(action, request, function (response) { + if (onComplete) { + setTimeout(function () { + onComplete(response['s'], response['d']); + }, Math.floor(0)); + } + }); + }; + /** + * @inheritDoc + */ + PersistentConnection.prototype.put = function (pathString, data, onComplete, hash) { + this.putInternal('p', pathString, data, onComplete, hash); + }; + /** + * @inheritDoc + */ + PersistentConnection.prototype.merge = function (pathString, data, onComplete, hash) { + this.putInternal('m', pathString, data, onComplete, hash); + }; + PersistentConnection.prototype.putInternal = function (action, pathString, data, onComplete, hash) { + var request = { + /*path*/ p: pathString, + /*data*/ d: data + }; + if (hash !== undefined) + request['h'] = hash; + // TODO: Only keep track of the most recent put for a given path? + this.outstandingPuts_.push({ + action: action, + request: request, + onComplete: onComplete + }); + this.outstandingPutCount_++; + var index = this.outstandingPuts_.length - 1; + if (this.connected_) { + this.sendPut_(index); + } + else { + this.log_('Buffering put: ' + pathString); + } + }; + PersistentConnection.prototype.sendPut_ = function (index) { + var _this = this; + var action = this.outstandingPuts_[index].action; + var request = this.outstandingPuts_[index].request; + var onComplete = this.outstandingPuts_[index].onComplete; + this.outstandingPuts_[index].queued = this.connected_; + this.sendRequest(action, request, function (message) { + _this.log_(action + ' response', message); + delete _this.outstandingPuts_[index]; + _this.outstandingPutCount_--; + // Clean up array occasionally. + if (_this.outstandingPutCount_ === 0) { + _this.outstandingPuts_ = []; + } + if (onComplete) + onComplete(message['s'], message['d']); + }); + }; + /** + * @inheritDoc + */ + PersistentConnection.prototype.reportStats = function (stats) { + var _this = this; + // If we're not connected, we just drop the stats. + if (this.connected_) { + var request = { /*counters*/ c: stats }; + this.log_('reportStats', request); + this.sendRequest(/*stats*/ 's', request, function (result) { + var status = result['s']; + if (status !== 'ok') { + var errorReason = result['d']; + _this.log_('reportStats', 'Error sending stats: ' + errorReason); + } + }); + } + }; + /** + * @param {*} message + * @private + */ + PersistentConnection.prototype.onDataMessage_ = function (message) { + if ('r' in message) { + // this is a response + this.log_('from server: ' + util_2.stringify(message)); + var reqNum = message['r']; + var onResponse = this.requestCBHash_[reqNum]; + if (onResponse) { + delete this.requestCBHash_[reqNum]; + onResponse(message['b']); + } + } + else if ('error' in message) { + throw 'A server-side error has occurred: ' + message['error']; + } + else if ('a' in message) { + // a and b are action and body, respectively + this.onDataPush_(message['a'], message['b']); + } + }; + PersistentConnection.prototype.onDataPush_ = function (action, body) { + this.log_('handleServerMessage', action, body); + if (action === 'd') + this.onDataUpdate_(body['p'], body['d'], + /*isMerge*/ false, body['t']); + else if (action === 'm') + this.onDataUpdate_(body['p'], body['d'], + /*isMerge=*/ true, body['t']); + else if (action === 'c') + this.onListenRevoked_(body['p'], body['q']); + else if (action === 'ac') + this.onAuthRevoked_(body['s'], body['d']); + else if (action === 'sd') + this.onSecurityDebugPacket_(body); + else + util_4.error('Unrecognized action received from server: ' + + util_2.stringify(action) + + '\nAre you using the latest client?'); + }; + PersistentConnection.prototype.onReady_ = function (timestamp, sessionId) { + this.log_('connection ready'); + this.connected_ = true; + this.lastConnectionEstablishedTime_ = new Date().getTime(); + this.handleTimestamp_(timestamp); + this.lastSessionId = sessionId; + if (this.firstConnection_) { + this.sendConnectStats_(); + } + this.restoreState_(); + this.firstConnection_ = false; + this.onConnectStatus_(true); + }; + PersistentConnection.prototype.scheduleConnect_ = function (timeout) { + var _this = this; + util_3.assert(!this.realtime_, "Scheduling a connect when we're already connected/ing?"); + if (this.establishConnectionTimer_) { + clearTimeout(this.establishConnectionTimer_); + } + // NOTE: Even when timeout is 0, it's important to do a setTimeout to work around an infuriating "Security Error" in + // Firefox when trying to write to our long-polling iframe in some scenarios (e.g. Forge or our unit tests). + this.establishConnectionTimer_ = setTimeout(function () { + _this.establishConnectionTimer_ = null; + _this.establishConnection_(); + }, Math.floor(timeout)); + }; + /** + * @param {boolean} visible + * @private + */ + PersistentConnection.prototype.onVisible_ = function (visible) { + // NOTE: Tabbing away and back to a window will defeat our reconnect backoff, but I think that's fine. + if (visible && + !this.visible_ && + this.reconnectDelay_ === this.maxReconnectDelay_) { + this.log_('Window became visible. Reducing delay.'); + this.reconnectDelay_ = RECONNECT_MIN_DELAY; + if (!this.realtime_) { + this.scheduleConnect_(0); + } + } + this.visible_ = visible; + }; + PersistentConnection.prototype.onOnline_ = function (online) { + if (online) { + this.log_('Browser went online.'); + this.reconnectDelay_ = RECONNECT_MIN_DELAY; + if (!this.realtime_) { + this.scheduleConnect_(0); + } + } + else { + this.log_('Browser went offline. Killing connection.'); + if (this.realtime_) { + this.realtime_.close(); + } + } + }; + PersistentConnection.prototype.onRealtimeDisconnect_ = function () { + this.log_('data client disconnected'); + this.connected_ = false; + this.realtime_ = null; + // Since we don't know if our sent transactions succeeded or not, we need to cancel them. + this.cancelSentTransactions_(); + // Clear out the pending requests. + this.requestCBHash_ = {}; + if (this.shouldReconnect_()) { + if (!this.visible_) { + this.log_("Window isn't visible. Delaying reconnect."); + this.reconnectDelay_ = this.maxReconnectDelay_; + this.lastConnectionAttemptTime_ = new Date().getTime(); + } + else if (this.lastConnectionEstablishedTime_) { + // If we've been connected long enough, reset reconnect delay to minimum. + var timeSinceLastConnectSucceeded = new Date().getTime() - this.lastConnectionEstablishedTime_; + if (timeSinceLastConnectSucceeded > RECONNECT_DELAY_RESET_TIMEOUT) + this.reconnectDelay_ = RECONNECT_MIN_DELAY; + this.lastConnectionEstablishedTime_ = null; + } + var timeSinceLastConnectAttempt = new Date().getTime() - this.lastConnectionAttemptTime_; + var reconnectDelay = Math.max(0, this.reconnectDelay_ - timeSinceLastConnectAttempt); + reconnectDelay = Math.random() * reconnectDelay; + this.log_('Trying to reconnect in ' + reconnectDelay + 'ms'); + this.scheduleConnect_(reconnectDelay); + // Adjust reconnect delay for next time. + this.reconnectDelay_ = Math.min(this.maxReconnectDelay_, this.reconnectDelay_ * RECONNECT_DELAY_MULTIPLIER); + } + this.onConnectStatus_(false); + }; + PersistentConnection.prototype.establishConnection_ = function () { + if (this.shouldReconnect_()) { + this.log_('Making a connection attempt'); + this.lastConnectionAttemptTime_ = new Date().getTime(); + this.lastConnectionEstablishedTime_ = null; + var onDataMessage_1 = this.onDataMessage_.bind(this); + var onReady_1 = this.onReady_.bind(this); + var onDisconnect_1 = this.onRealtimeDisconnect_.bind(this); + var connId_1 = this.id + ':' + PersistentConnection.nextConnectionId_++; + var self_1 = this; + var lastSessionId_1 = this.lastSessionId; + var canceled_1 = false; + var connection_1 = null; + var closeFn_1 = function () { + if (connection_1) { + connection_1.close(); + } + else { + canceled_1 = true; + onDisconnect_1(); + } + }; + var sendRequestFn = function (msg) { + util_3.assert(connection_1, "sendRequest call when we're not connected not allowed."); + connection_1.sendRequest(msg); + }; + this.realtime_ = { + close: closeFn_1, + sendRequest: sendRequestFn + }; + var forceRefresh = this.forceTokenRefresh_; + this.forceTokenRefresh_ = false; + // First fetch auth token, and establish connection after fetching the token was successful + this.authTokenProvider_ + .getToken(forceRefresh) + .then(function (result) { + if (!canceled_1) { + util_4.log('getToken() completed. Creating connection.'); + self_1.authToken_ = result && result.accessToken; + connection_1 = new Connection_1.Connection(connId_1, self_1.repoInfo_, onDataMessage_1, onReady_1, onDisconnect_1, + /* onKill= */ function (reason) { + util_4.warn(reason + ' (' + self_1.repoInfo_.toString() + ')'); + self_1.interrupt(SERVER_KILL_INTERRUPT_REASON); + }, lastSessionId_1); + } + else { + util_4.log('getToken() completed but was canceled'); + } + }) + .then(null, function (error) { + self_1.log_('Failed to get token: ' + error); + if (!canceled_1) { + if (util_6.CONSTANTS.NODE_ADMIN) { + // This may be a critical error for the Admin Node.js SDK, so log a warning. + // But getToken() may also just have temporarily failed, so we still want to + // continue retrying. + util_4.warn(error); + } + closeFn_1(); + } + }); + } + }; + /** + * @param {string} reason + */ + PersistentConnection.prototype.interrupt = function (reason) { + util_4.log('Interrupting connection for reason: ' + reason); + this.interruptReasons_[reason] = true; + if (this.realtime_) { + this.realtime_.close(); + } + else { + if (this.establishConnectionTimer_) { + clearTimeout(this.establishConnectionTimer_); + this.establishConnectionTimer_ = null; + } + if (this.connected_) { + this.onRealtimeDisconnect_(); + } + } + }; + /** + * @param {string} reason + */ + PersistentConnection.prototype.resume = function (reason) { + util_4.log('Resuming connection for reason: ' + reason); + delete this.interruptReasons_[reason]; + if (util_1.isEmpty(this.interruptReasons_)) { + this.reconnectDelay_ = RECONNECT_MIN_DELAY; + if (!this.realtime_) { + this.scheduleConnect_(0); + } + } + }; + PersistentConnection.prototype.handleTimestamp_ = function (timestamp) { + var delta = timestamp - new Date().getTime(); + this.onServerInfoUpdate_({ serverTimeOffset: delta }); + }; + PersistentConnection.prototype.cancelSentTransactions_ = function () { + for (var i = 0; i < this.outstandingPuts_.length; i++) { + var put = this.outstandingPuts_[i]; + if (put && /*hash*/ 'h' in put.request && put.queued) { + if (put.onComplete) + put.onComplete('disconnect'); + delete this.outstandingPuts_[i]; + this.outstandingPutCount_--; + } + } + // Clean up array occasionally. + if (this.outstandingPutCount_ === 0) + this.outstandingPuts_ = []; + }; + /** + * @param {!string} pathString + * @param {Array.<*>=} query + * @private + */ + PersistentConnection.prototype.onListenRevoked_ = function (pathString, query) { + // Remove the listen and manufacture a "permission_denied" error for the failed listen. + var queryId; + if (!query) { + queryId = 'default'; + } + else { + queryId = query.map(function (q) { return util_4.ObjectToUniqueKey(q); }).join('$'); + } + var listen = this.removeListen_(pathString, queryId); + if (listen && listen.onComplete) + listen.onComplete('permission_denied'); + }; + /** + * @param {!string} pathString + * @param {!string} queryId + * @return {{queries:Array., onComplete:function(string)}} + * @private + */ + PersistentConnection.prototype.removeListen_ = function (pathString, queryId) { + var normalizedPathString = new Path_1.Path(pathString).toString(); // normalize path. + var listen; + if (this.listens_[normalizedPathString] !== undefined) { + listen = this.listens_[normalizedPathString][queryId]; + delete this.listens_[normalizedPathString][queryId]; + if (util_1.getCount(this.listens_[normalizedPathString]) === 0) { + delete this.listens_[normalizedPathString]; + } + } + else { + // all listens for this path has already been removed + listen = undefined; + } + return listen; + }; + PersistentConnection.prototype.onAuthRevoked_ = function (statusCode, explanation) { + util_4.log('Auth token revoked: ' + statusCode + '/' + explanation); + this.authToken_ = null; + this.forceTokenRefresh_ = true; + this.realtime_.close(); + if (statusCode === 'invalid_token' || statusCode === 'permission_denied') { + // We'll wait a couple times before logging the warning / increasing the + // retry period since oauth tokens will report as "invalid" if they're + // just expired. Plus there may be transient issues that resolve themselves. + this.invalidAuthTokenCount_++; + if (this.invalidAuthTokenCount_ >= INVALID_AUTH_TOKEN_THRESHOLD) { + // Set a long reconnect delay because recovery is unlikely + this.reconnectDelay_ = RECONNECT_MAX_DELAY_FOR_ADMINS; + // Notify the auth token provider that the token is invalid, which will log + // a warning + this.authTokenProvider_.notifyForInvalidToken(); + } + } + }; + PersistentConnection.prototype.onSecurityDebugPacket_ = function (body) { + if (this.securityDebugCallback_) { + this.securityDebugCallback_(body); + } + else { + if ('msg' in body && typeof console !== 'undefined') { + console.log('FIREBASE: ' + body['msg'].replace('\n', '\nFIREBASE: ')); + } + } + }; + PersistentConnection.prototype.restoreState_ = function () { + var _this = this; + //Re-authenticate ourselves if we have a credential stored. + this.tryAuth(); + // Puts depend on having received the corresponding data update from the server before they complete, so we must + // make sure to send listens before puts. + util_1.forEach(this.listens_, function (pathString, queries) { + util_1.forEach(queries, function (key, listenSpec) { + _this.sendListen_(listenSpec); + }); + }); + for (var i = 0; i < this.outstandingPuts_.length; i++) { + if (this.outstandingPuts_[i]) + this.sendPut_(i); + } + while (this.onDisconnectRequestQueue_.length) { + var request = this.onDisconnectRequestQueue_.shift(); + this.sendOnDisconnect_(request.action, request.pathString, request.data, request.onComplete); + } + }; + /** + * Sends client stats for first connection + * @private + */ + PersistentConnection.prototype.sendConnectStats_ = function () { + var stats = {}; + var clientName = 'js'; + if (util_6.CONSTANTS.NODE_ADMIN) { + clientName = 'admin_node'; + } + else if (util_6.CONSTANTS.NODE_CLIENT) { + clientName = 'node'; + } + stats['sdk.' + clientName + '.' + app_1.default.SDK_VERSION.replace(/\./g, '-')] = 1; + if (util_7.isMobileCordova()) { + stats['framework.cordova'] = 1; + } + else if (util_7.isReactNative()) { + stats['framework.reactnative'] = 1; + } + this.reportStats(stats); + }; + /** + * @return {boolean} + * @private + */ + PersistentConnection.prototype.shouldReconnect_ = function () { + var online = OnlineMonitor_1.OnlineMonitor.getInstance().currentlyOnline(); + return util_1.isEmpty(this.interruptReasons_) && online; + }; + /** + * @private + */ + PersistentConnection.nextPersistentConnectionId_ = 0; + /** + * Counter for number of connections created. Mainly used for tagging in the logs + * @type {number} + * @private + */ + PersistentConnection.nextConnectionId_ = 0; + return PersistentConnection; +}(ServerActions_1.ServerActions)); +exports.PersistentConnection = PersistentConnection; + +//# sourceMappingURL=PersistentConnection.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/ReadonlyRestClient.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/ReadonlyRestClient.js ***! + \*********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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. + */ +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 __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var util_1 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! ./util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var util_3 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_4 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_5 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var ServerActions_1 = __webpack_require__(/*! ./ServerActions */ "./node_modules/@firebase/database/dist/cjs/src/core/ServerActions.js"); +/** + * An implementation of ServerActions that communicates with the server via REST requests. + * This is mostly useful for compatibility with crawlers, where we don't want to spin up a full + * persistent connection (using WebSockets or long-polling) + */ +var ReadonlyRestClient = /** @class */ (function (_super) { + __extends(ReadonlyRestClient, _super); + /** + * @param {!RepoInfo} repoInfo_ Data about the namespace we are connecting to + * @param {function(string, *, boolean, ?number)} onDataUpdate_ A callback for new data from the server + * @param {AuthTokenProvider} authTokenProvider_ + * @implements {ServerActions} + */ + function ReadonlyRestClient(repoInfo_, onDataUpdate_, authTokenProvider_) { + var _this = _super.call(this) || this; + _this.repoInfo_ = repoInfo_; + _this.onDataUpdate_ = onDataUpdate_; + _this.authTokenProvider_ = authTokenProvider_; + /** @private {function(...[*])} */ + _this.log_ = util_2.logWrapper('p:rest:'); + /** + * We don't actually need to track listens, except to prevent us calling an onComplete for a listen + * that's been removed. :-/ + * + * @private {!Object.} + */ + _this.listens_ = {}; + return _this; + } + ReadonlyRestClient.prototype.reportStats = function (stats) { + throw new Error('Method not implemented.'); + }; + /** + * @param {!Query} query + * @param {?number=} tag + * @return {string} + * @private + */ + ReadonlyRestClient.getListenId_ = function (query, tag) { + if (tag !== undefined) { + return 'tag$' + tag; + } + else { + util_1.assert(query.getQueryParams().isDefault(), "should have a tag if it's not a default query."); + return query.path.toString(); + } + }; + /** @inheritDoc */ + ReadonlyRestClient.prototype.listen = function (query, currentHashFn, tag, onComplete) { + var _this = this; + var pathString = query.path.toString(); + this.log_('Listen called for ' + pathString + ' ' + query.queryIdentifier()); + // Mark this listener so we can tell if it's removed. + var listenId = ReadonlyRestClient.getListenId_(query, tag); + var thisListen = {}; + this.listens_[listenId] = thisListen; + var queryStringParamaters = query + .getQueryParams() + .toRestQueryStringParameters(); + this.restRequest_(pathString + '.json', queryStringParamaters, function (error, result) { + var data = result; + if (error === 404) { + data = null; + error = null; + } + if (error === null) { + _this.onDataUpdate_(pathString, data, /*isMerge=*/ false, tag); + } + if (util_4.safeGet(_this.listens_, listenId) === thisListen) { + var status_1; + if (!error) { + status_1 = 'ok'; + } + else if (error == 401) { + status_1 = 'permission_denied'; + } + else { + status_1 = 'rest_error:' + error; + } + onComplete(status_1, null); + } + }); + }; + /** @inheritDoc */ + ReadonlyRestClient.prototype.unlisten = function (query, tag) { + var listenId = ReadonlyRestClient.getListenId_(query, tag); + delete this.listens_[listenId]; + }; + /** @inheritDoc */ + ReadonlyRestClient.prototype.refreshAuthToken = function (token) { + // no-op since we just always call getToken. + }; + /** + * Performs a REST request to the given path, with the provided query string parameters, + * and any auth credentials we have. + * + * @param {!string} pathString + * @param {!Object.} queryStringParameters + * @param {?function(?number, *=)} callback + * @private + */ + ReadonlyRestClient.prototype.restRequest_ = function (pathString, queryStringParameters, callback) { + var _this = this; + if (queryStringParameters === void 0) { queryStringParameters = {}; } + queryStringParameters['format'] = 'export'; + this.authTokenProvider_ + .getToken(/*forceRefresh=*/ false) + .then(function (authTokenData) { + var authToken = authTokenData && authTokenData.accessToken; + if (authToken) { + queryStringParameters['auth'] = authToken; + } + var url = (_this.repoInfo_.secure ? 'https://' : 'http://') + + _this.repoInfo_.host + + pathString + + '?' + + util_5.querystring(queryStringParameters); + _this.log_('Sending REST request for ' + url); + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function () { + if (callback && xhr.readyState === 4) { + _this.log_('REST Response for ' + url + ' received. status:', xhr.status, 'response:', xhr.responseText); + var res = null; + if (xhr.status >= 200 && xhr.status < 300) { + try { + res = util_3.jsonEval(xhr.responseText); + } + catch (e) { + util_2.warn('Failed to parse JSON response for ' + + url + + ': ' + + xhr.responseText); + } + callback(null, res); + } + else { + // 401 and 404 are expected. + if (xhr.status !== 401 && xhr.status !== 404) { + util_2.warn('Got unsuccessful REST response for ' + + url + + ' Status: ' + + xhr.status); + } + callback(xhr.status); + } + callback = null; + } + }; + xhr.open('GET', url, /*asynchronous=*/ true); + xhr.send(); + }); + }; + return ReadonlyRestClient; +}(ServerActions_1.ServerActions)); +exports.ReadonlyRestClient = ReadonlyRestClient; + +//# sourceMappingURL=ReadonlyRestClient.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/Repo.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/Repo.js ***! + \*******************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 ServerValues_1 = __webpack_require__(/*! ./util/ServerValues */ "./node_modules/@firebase/database/dist/cjs/src/core/util/ServerValues.js"); +var nodeFromJSON_1 = __webpack_require__(/*! ./snap/nodeFromJSON */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/nodeFromJSON.js"); +var Path_1 = __webpack_require__(/*! ./util/Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +var SparseSnapshotTree_1 = __webpack_require__(/*! ./SparseSnapshotTree */ "./node_modules/@firebase/database/dist/cjs/src/core/SparseSnapshotTree.js"); +var SyncTree_1 = __webpack_require__(/*! ./SyncTree */ "./node_modules/@firebase/database/dist/cjs/src/core/SyncTree.js"); +var SnapshotHolder_1 = __webpack_require__(/*! ./SnapshotHolder */ "./node_modules/@firebase/database/dist/cjs/src/core/SnapshotHolder.js"); +var util_1 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! ./util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var util_3 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var AuthTokenProvider_1 = __webpack_require__(/*! ./AuthTokenProvider */ "./node_modules/@firebase/database/dist/cjs/src/core/AuthTokenProvider.js"); +var StatsManager_1 = __webpack_require__(/*! ./stats/StatsManager */ "./node_modules/@firebase/database/dist/cjs/src/core/stats/StatsManager.js"); +var StatsReporter_1 = __webpack_require__(/*! ./stats/StatsReporter */ "./node_modules/@firebase/database/dist/cjs/src/core/stats/StatsReporter.js"); +var StatsListener_1 = __webpack_require__(/*! ./stats/StatsListener */ "./node_modules/@firebase/database/dist/cjs/src/core/stats/StatsListener.js"); +var EventQueue_1 = __webpack_require__(/*! ./view/EventQueue */ "./node_modules/@firebase/database/dist/cjs/src/core/view/EventQueue.js"); +var PersistentConnection_1 = __webpack_require__(/*! ./PersistentConnection */ "./node_modules/@firebase/database/dist/cjs/src/core/PersistentConnection.js"); +var ReadonlyRestClient_1 = __webpack_require__(/*! ./ReadonlyRestClient */ "./node_modules/@firebase/database/dist/cjs/src/core/ReadonlyRestClient.js"); +var Database_1 = __webpack_require__(/*! ../api/Database */ "./node_modules/@firebase/database/dist/cjs/src/api/Database.js"); +var INTERRUPT_REASON = 'repo_interrupt'; +/** + * A connection to a single data repository. + */ +var Repo = /** @class */ (function () { + /** + * @param {!RepoInfo} repoInfo_ + * @param {boolean} forceRestClient + * @param {!FirebaseApp} app + */ + function Repo(repoInfo_, forceRestClient, app) { + var _this = this; + this.repoInfo_ = repoInfo_; + this.app = app; + this.dataUpdateCount = 0; + this.statsListener_ = null; + this.eventQueue_ = new EventQueue_1.EventQueue(); + this.nextWriteId_ = 1; + this.interceptServerDataCallback_ = null; + // A list of data pieces and paths to be set when this client disconnects. + this.onDisconnect_ = new SparseSnapshotTree_1.SparseSnapshotTree(); + /** + * TODO: This should be @private but it's used by test_access.js and internal.js + * @type {?PersistentConnection} + */ + this.persistentConnection_ = null; + /** @type {!AuthTokenProvider} */ + var authTokenProvider = new AuthTokenProvider_1.AuthTokenProvider(app); + this.stats_ = StatsManager_1.StatsManager.getCollection(repoInfo_); + if (forceRestClient || util_2.beingCrawled()) { + this.server_ = new ReadonlyRestClient_1.ReadonlyRestClient(this.repoInfo_, this.onDataUpdate_.bind(this), authTokenProvider); + // Minor hack: Fire onConnect immediately, since there's no actual connection. + setTimeout(this.onConnectStatus_.bind(this, true), 0); + } + else { + var authOverride = app.options['databaseAuthVariableOverride']; + // Validate authOverride + if (typeof authOverride !== 'undefined' && authOverride !== null) { + if (typeof authOverride !== 'object') { + throw new Error('Only objects are supported for option databaseAuthVariableOverride'); + } + try { + util_1.stringify(authOverride); + } + catch (e) { + throw new Error('Invalid authOverride provided: ' + e); + } + } + this.persistentConnection_ = new PersistentConnection_1.PersistentConnection(this.repoInfo_, this.onDataUpdate_.bind(this), this.onConnectStatus_.bind(this), this.onServerInfoUpdate_.bind(this), authTokenProvider, authOverride); + this.server_ = this.persistentConnection_; + } + authTokenProvider.addTokenChangeListener(function (token) { + _this.server_.refreshAuthToken(token); + }); + // In the case of multiple Repos for the same repoInfo (i.e. there are multiple Firebase.Contexts being used), + // we only want to create one StatsReporter. As such, we'll report stats over the first Repo created. + this.statsReporter_ = StatsManager_1.StatsManager.getOrCreateReporter(repoInfo_, function () { return new StatsReporter_1.StatsReporter(_this.stats_, _this.server_); }); + this.transactions_init_(); + // Used for .info. + this.infoData_ = new SnapshotHolder_1.SnapshotHolder(); + this.infoSyncTree_ = new SyncTree_1.SyncTree({ + startListening: function (query, tag, currentHashFn, onComplete) { + var infoEvents = []; + var node = _this.infoData_.getNode(query.path); + // This is possibly a hack, but we have different semantics for .info endpoints. We don't raise null events + // on initial data... + if (!node.isEmpty()) { + infoEvents = _this.infoSyncTree_.applyServerOverwrite(query.path, node); + setTimeout(function () { + onComplete('ok'); + }, 0); + } + return infoEvents; + }, + stopListening: function () { } + }); + this.updateInfo_('connected', false); + this.serverSyncTree_ = new SyncTree_1.SyncTree({ + startListening: function (query, tag, currentHashFn, onComplete) { + _this.server_.listen(query, currentHashFn, tag, function (status, data) { + var events = onComplete(status, data); + _this.eventQueue_.raiseEventsForChangedPath(query.path, events); + }); + // No synchronous events for network-backed sync trees + return []; + }, + stopListening: function (query, tag) { + _this.server_.unlisten(query, tag); + } + }); + } + /** + * @return {string} The URL corresponding to the root of this Firebase. + */ + Repo.prototype.toString = function () { + return ((this.repoInfo_.secure ? 'https://' : 'http://') + this.repoInfo_.host); + }; + /** + * @return {!string} The namespace represented by the repo. + */ + Repo.prototype.name = function () { + return this.repoInfo_.namespace; + }; + /** + * @return {!number} The time in milliseconds, taking the server offset into account if we have one. + */ + Repo.prototype.serverTime = function () { + var offsetNode = this.infoData_.getNode(new Path_1.Path('.info/serverTimeOffset')); + var offset = offsetNode.val() || 0; + return new Date().getTime() + offset; + }; + /** + * Generate ServerValues using some variables from the repo object. + * @return {!Object} + */ + Repo.prototype.generateServerValues = function () { + return ServerValues_1.generateWithValues({ + timestamp: this.serverTime() + }); + }; + /** + * Called by realtime when we get new messages from the server. + * + * @private + * @param {string} pathString + * @param {*} data + * @param {boolean} isMerge + * @param {?number} tag + */ + Repo.prototype.onDataUpdate_ = function (pathString, data, isMerge, tag) { + // For testing. + this.dataUpdateCount++; + var path = new Path_1.Path(pathString); + data = this.interceptServerDataCallback_ + ? this.interceptServerDataCallback_(pathString, data) + : data; + var events = []; + if (tag) { + if (isMerge) { + var taggedChildren = util_3.map(data, function (raw) { + return nodeFromJSON_1.nodeFromJSON(raw); + }); + events = this.serverSyncTree_.applyTaggedQueryMerge(path, taggedChildren, tag); + } + else { + var taggedSnap = nodeFromJSON_1.nodeFromJSON(data); + events = this.serverSyncTree_.applyTaggedQueryOverwrite(path, taggedSnap, tag); + } + } + else if (isMerge) { + var changedChildren = util_3.map(data, function (raw) { + return nodeFromJSON_1.nodeFromJSON(raw); + }); + events = this.serverSyncTree_.applyServerMerge(path, changedChildren); + } + else { + var snap = nodeFromJSON_1.nodeFromJSON(data); + events = this.serverSyncTree_.applyServerOverwrite(path, snap); + } + var affectedPath = path; + if (events.length > 0) { + // Since we have a listener outstanding for each transaction, receiving any events + // is a proxy for some change having occurred. + affectedPath = this.rerunTransactions_(path); + } + this.eventQueue_.raiseEventsForChangedPath(affectedPath, events); + }; + /** + * TODO: This should be @private but it's used by test_access.js and internal.js + * @param {?function(!string, *):*} callback + * @private + */ + Repo.prototype.interceptServerData_ = function (callback) { + this.interceptServerDataCallback_ = callback; + }; + /** + * @param {!boolean} connectStatus + * @private + */ + Repo.prototype.onConnectStatus_ = function (connectStatus) { + this.updateInfo_('connected', connectStatus); + if (connectStatus === false) { + this.runOnDisconnectEvents_(); + } + }; + /** + * @param {!Object} updates + * @private + */ + Repo.prototype.onServerInfoUpdate_ = function (updates) { + var _this = this; + util_2.each(updates, function (value, key) { + _this.updateInfo_(key, value); + }); + }; + /** + * + * @param {!string} pathString + * @param {*} value + * @private + */ + Repo.prototype.updateInfo_ = function (pathString, value) { + var path = new Path_1.Path('/.info/' + pathString); + var newNode = nodeFromJSON_1.nodeFromJSON(value); + this.infoData_.updateSnapshot(path, newNode); + var events = this.infoSyncTree_.applyServerOverwrite(path, newNode); + this.eventQueue_.raiseEventsForChangedPath(path, events); + }; + /** + * @return {!number} + * @private + */ + Repo.prototype.getNextWriteId_ = function () { + return this.nextWriteId_++; + }; + /** + * @param {!Path} path + * @param {*} newVal + * @param {number|string|null} newPriority + * @param {?function(?Error, *=)} onComplete + */ + Repo.prototype.setWithPriority = function (path, newVal, newPriority, onComplete) { + var _this = this; + this.log_('set', { + path: path.toString(), + value: newVal, + priority: newPriority + }); + // TODO: Optimize this behavior to either (a) store flag to skip resolving where possible and / or + // (b) store unresolved paths on JSON parse + var serverValues = this.generateServerValues(); + var newNodeUnresolved = nodeFromJSON_1.nodeFromJSON(newVal, newPriority); + var newNode = ServerValues_1.resolveDeferredValueSnapshot(newNodeUnresolved, serverValues); + var writeId = this.getNextWriteId_(); + var events = this.serverSyncTree_.applyUserOverwrite(path, newNode, writeId, true); + this.eventQueue_.queueEvents(events); + this.server_.put(path.toString(), newNodeUnresolved.val(/*export=*/ true), function (status, errorReason) { + var success = status === 'ok'; + if (!success) { + util_2.warn('set at ' + path + ' failed: ' + status); + } + var clearEvents = _this.serverSyncTree_.ackUserWrite(writeId, !success); + _this.eventQueue_.raiseEventsForChangedPath(path, clearEvents); + _this.callOnCompleteCallback(onComplete, status, errorReason); + }); + var affectedPath = this.abortTransactions_(path); + this.rerunTransactions_(affectedPath); + // We queued the events above, so just flush the queue here + this.eventQueue_.raiseEventsForChangedPath(affectedPath, []); + }; + /** + * @param {!Path} path + * @param {!Object} childrenToMerge + * @param {?function(?Error, *=)} onComplete + */ + Repo.prototype.update = function (path, childrenToMerge, onComplete) { + var _this = this; + this.log_('update', { path: path.toString(), value: childrenToMerge }); + // Start with our existing data and merge each child into it. + var empty = true; + var serverValues = this.generateServerValues(); + var changedChildren = {}; + util_3.forEach(childrenToMerge, function (changedKey, changedValue) { + empty = false; + var newNodeUnresolved = nodeFromJSON_1.nodeFromJSON(changedValue); + changedChildren[changedKey] = ServerValues_1.resolveDeferredValueSnapshot(newNodeUnresolved, serverValues); + }); + if (!empty) { + var writeId_1 = this.getNextWriteId_(); + var events = this.serverSyncTree_.applyUserMerge(path, changedChildren, writeId_1); + this.eventQueue_.queueEvents(events); + this.server_.merge(path.toString(), childrenToMerge, function (status, errorReason) { + var success = status === 'ok'; + if (!success) { + util_2.warn('update at ' + path + ' failed: ' + status); + } + var clearEvents = _this.serverSyncTree_.ackUserWrite(writeId_1, !success); + var affectedPath = clearEvents.length > 0 ? _this.rerunTransactions_(path) : path; + _this.eventQueue_.raiseEventsForChangedPath(affectedPath, clearEvents); + _this.callOnCompleteCallback(onComplete, status, errorReason); + }); + util_3.forEach(childrenToMerge, function (changedPath) { + var affectedPath = _this.abortTransactions_(path.child(changedPath)); + _this.rerunTransactions_(affectedPath); + }); + // We queued the events above, so just flush the queue here + this.eventQueue_.raiseEventsForChangedPath(path, []); + } + else { + util_2.log("update() called with empty data. Don't do anything."); + this.callOnCompleteCallback(onComplete, 'ok'); + } + }; + /** + * Applies all of the changes stored up in the onDisconnect_ tree. + * @private + */ + Repo.prototype.runOnDisconnectEvents_ = function () { + var _this = this; + this.log_('onDisconnectEvents'); + var serverValues = this.generateServerValues(); + var resolvedOnDisconnectTree = ServerValues_1.resolveDeferredValueTree(this.onDisconnect_, serverValues); + var events = []; + resolvedOnDisconnectTree.forEachTree(Path_1.Path.Empty, function (path, snap) { + events = events.concat(_this.serverSyncTree_.applyServerOverwrite(path, snap)); + var affectedPath = _this.abortTransactions_(path); + _this.rerunTransactions_(affectedPath); + }); + this.onDisconnect_ = new SparseSnapshotTree_1.SparseSnapshotTree(); + this.eventQueue_.raiseEventsForChangedPath(Path_1.Path.Empty, events); + }; + /** + * @param {!Path} path + * @param {?function(?Error, *=)} onComplete + */ + Repo.prototype.onDisconnectCancel = function (path, onComplete) { + var _this = this; + this.server_.onDisconnectCancel(path.toString(), function (status, errorReason) { + if (status === 'ok') { + _this.onDisconnect_.forget(path); + } + _this.callOnCompleteCallback(onComplete, status, errorReason); + }); + }; + /** + * @param {!Path} path + * @param {*} value + * @param {?function(?Error, *=)} onComplete + */ + Repo.prototype.onDisconnectSet = function (path, value, onComplete) { + var _this = this; + var newNode = nodeFromJSON_1.nodeFromJSON(value); + this.server_.onDisconnectPut(path.toString(), newNode.val(/*export=*/ true), function (status, errorReason) { + if (status === 'ok') { + _this.onDisconnect_.remember(path, newNode); + } + _this.callOnCompleteCallback(onComplete, status, errorReason); + }); + }; + /** + * @param {!Path} path + * @param {*} value + * @param {*} priority + * @param {?function(?Error, *=)} onComplete + */ + Repo.prototype.onDisconnectSetWithPriority = function (path, value, priority, onComplete) { + var _this = this; + var newNode = nodeFromJSON_1.nodeFromJSON(value, priority); + this.server_.onDisconnectPut(path.toString(), newNode.val(/*export=*/ true), function (status, errorReason) { + if (status === 'ok') { + _this.onDisconnect_.remember(path, newNode); + } + _this.callOnCompleteCallback(onComplete, status, errorReason); + }); + }; + /** + * @param {!Path} path + * @param {*} childrenToMerge + * @param {?function(?Error, *=)} onComplete + */ + Repo.prototype.onDisconnectUpdate = function (path, childrenToMerge, onComplete) { + var _this = this; + if (util_3.isEmpty(childrenToMerge)) { + util_2.log("onDisconnect().update() called with empty data. Don't do anything."); + this.callOnCompleteCallback(onComplete, 'ok'); + return; + } + this.server_.onDisconnectMerge(path.toString(), childrenToMerge, function (status, errorReason) { + if (status === 'ok') { + util_3.forEach(childrenToMerge, function (childName, childNode) { + var newChildNode = nodeFromJSON_1.nodeFromJSON(childNode); + _this.onDisconnect_.remember(path.child(childName), newChildNode); + }); + } + _this.callOnCompleteCallback(onComplete, status, errorReason); + }); + }; + /** + * @param {!Query} query + * @param {!EventRegistration} eventRegistration + */ + Repo.prototype.addEventCallbackForQuery = function (query, eventRegistration) { + var events; + if (query.path.getFront() === '.info') { + events = this.infoSyncTree_.addEventRegistration(query, eventRegistration); + } + else { + events = this.serverSyncTree_.addEventRegistration(query, eventRegistration); + } + this.eventQueue_.raiseEventsAtPath(query.path, events); + }; + /** + * @param {!Query} query + * @param {?EventRegistration} eventRegistration + */ + Repo.prototype.removeEventCallbackForQuery = function (query, eventRegistration) { + // These are guaranteed not to raise events, since we're not passing in a cancelError. However, we can future-proof + // a little bit by handling the return values anyways. + var events; + if (query.path.getFront() === '.info') { + events = this.infoSyncTree_.removeEventRegistration(query, eventRegistration); + } + else { + events = this.serverSyncTree_.removeEventRegistration(query, eventRegistration); + } + this.eventQueue_.raiseEventsAtPath(query.path, events); + }; + Repo.prototype.interrupt = function () { + if (this.persistentConnection_) { + this.persistentConnection_.interrupt(INTERRUPT_REASON); + } + }; + Repo.prototype.resume = function () { + if (this.persistentConnection_) { + this.persistentConnection_.resume(INTERRUPT_REASON); + } + }; + Repo.prototype.stats = function (showDelta) { + if (showDelta === void 0) { showDelta = false; } + if (typeof console === 'undefined') + return; + var stats; + if (showDelta) { + if (!this.statsListener_) + this.statsListener_ = new StatsListener_1.StatsListener(this.stats_); + stats = this.statsListener_.get(); + } + else { + stats = this.stats_.get(); + } + var longestName = Object.keys(stats).reduce(function (previousValue, currentValue) { + return Math.max(currentValue.length, previousValue); + }, 0); + util_3.forEach(stats, function (stat, value) { + // pad stat names to be the same length (plus 2 extra spaces). + for (var i = stat.length; i < longestName + 2; i++) + stat += ' '; + console.log(stat + value); + }); + }; + Repo.prototype.statsIncrementCounter = function (metric) { + this.stats_.incrementCounter(metric); + this.statsReporter_.includeStat(metric); + }; + /** + * @param {...*} var_args + * @private + */ + Repo.prototype.log_ = function () { + var var_args = []; + for (var _i = 0; _i < arguments.length; _i++) { + var_args[_i] = arguments[_i]; + } + var prefix = ''; + if (this.persistentConnection_) { + prefix = this.persistentConnection_.id + ':'; + } + util_2.log.apply(void 0, [prefix].concat(var_args)); + }; + /** + * @param {?function(?Error, *=)} callback + * @param {!string} status + * @param {?string=} errorReason + */ + Repo.prototype.callOnCompleteCallback = function (callback, status, errorReason) { + if (callback) { + util_2.exceptionGuard(function () { + if (status == 'ok') { + callback(null); + } + else { + var code = (status || 'error').toUpperCase(); + var message = code; + if (errorReason) + message += ': ' + errorReason; + var error = new Error(message); + error.code = code; + callback(error); + } + }); + } + }; + Object.defineProperty(Repo.prototype, "database", { + get: function () { + return this.__database || (this.__database = new Database_1.Database(this)); + }, + enumerable: true, + configurable: true + }); + return Repo; +}()); +exports.Repo = Repo; + +//# sourceMappingURL=Repo.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/RepoInfo.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/RepoInfo.js ***! + \***********************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var storage_1 = __webpack_require__(/*! ./storage/storage */ "./node_modules/@firebase/database/dist/cjs/src/core/storage/storage.js"); +var Constants_1 = __webpack_require__(/*! ../realtime/Constants */ "./node_modules/@firebase/database/dist/cjs/src/realtime/Constants.js"); +/** + * A class that holds metadata about a Repo object + * + * @constructor + */ +var RepoInfo = /** @class */ (function () { + /** + * @param {string} host Hostname portion of the url for the repo + * @param {boolean} secure Whether or not this repo is accessed over ssl + * @param {string} namespace The namespace represented by the repo + * @param {boolean} webSocketOnly Whether to prefer websockets over all other transports (used by Nest). + * @param {string=} persistenceKey Override the default session persistence storage key + */ + function RepoInfo(host, secure, namespace, webSocketOnly, persistenceKey) { + if (persistenceKey === void 0) { persistenceKey = ''; } + this.secure = secure; + this.namespace = namespace; + this.webSocketOnly = webSocketOnly; + this.persistenceKey = persistenceKey; + this.host = host.toLowerCase(); + this.domain = this.host.substr(this.host.indexOf('.') + 1); + this.internalHost = storage_1.PersistentStorage.get('host:' + host) || this.host; + } + RepoInfo.prototype.needsQueryParam = function () { + return this.host !== this.internalHost; + }; + RepoInfo.prototype.isCacheableHost = function () { + return this.internalHost.substr(0, 2) === 's-'; + }; + RepoInfo.prototype.isDemoHost = function () { + return this.domain === 'firebaseio-demo.com'; + }; + RepoInfo.prototype.isCustomHost = function () { + return (this.domain !== 'firebaseio.com' && this.domain !== 'firebaseio-demo.com'); + }; + RepoInfo.prototype.updateHost = function (newHost) { + if (newHost !== this.internalHost) { + this.internalHost = newHost; + if (this.isCacheableHost()) { + storage_1.PersistentStorage.set('host:' + this.host, this.internalHost); + } + } + }; + /** + * Returns the websocket URL for this repo + * @param {string} type of connection + * @param {Object} params list + * @return {string} The URL for this repo + */ + RepoInfo.prototype.connectionURL = function (type, params) { + util_1.assert(typeof type === 'string', 'typeof type must == string'); + util_1.assert(typeof params === 'object', 'typeof params must == object'); + var connURL; + if (type === Constants_1.WEBSOCKET) { + connURL = + (this.secure ? 'wss://' : 'ws://') + this.internalHost + '/.ws?'; + } + else if (type === Constants_1.LONG_POLLING) { + connURL = + (this.secure ? 'https://' : 'http://') + this.internalHost + '/.lp?'; + } + else { + throw new Error('Unknown connection type: ' + type); + } + if (this.needsQueryParam()) { + params['ns'] = this.namespace; + } + var pairs = []; + util_2.forEach(params, function (key, value) { + pairs.push(key + '=' + value); + }); + return connURL + pairs.join('&'); + }; + /** @return {string} */ + RepoInfo.prototype.toString = function () { + var str = this.toURLString(); + if (this.persistenceKey) { + str += '<' + this.persistenceKey + '>'; + } + return str; + }; + /** @return {string} */ + RepoInfo.prototype.toURLString = function () { + return (this.secure ? 'https://' : 'http://') + this.host; + }; + return RepoInfo; +}()); +exports.RepoInfo = RepoInfo; + +//# sourceMappingURL=RepoInfo.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/RepoManager.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/RepoManager.js ***! + \**************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var Repo_1 = __webpack_require__(/*! ./Repo */ "./node_modules/@firebase/database/dist/cjs/src/core/Repo.js"); +var util_2 = __webpack_require__(/*! ./util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var parser_1 = __webpack_require__(/*! ./util/libs/parser */ "./node_modules/@firebase/database/dist/cjs/src/core/util/libs/parser.js"); +var validation_1 = __webpack_require__(/*! ./util/validation */ "./node_modules/@firebase/database/dist/cjs/src/core/util/validation.js"); +__webpack_require__(/*! ./Repo_transaction */ "./node_modules/@firebase/database/dist/cjs/src/core/Repo_transaction.js"); +/** @const {string} */ +var DATABASE_URL_OPTION = 'databaseURL'; +var _staticInstance; +/** + * Creates and caches Repo instances. + */ +var RepoManager = /** @class */ (function () { + function RepoManager() { + /** + * @private {!Object.>} + */ + this.repos_ = {}; + /** + * If true, new Repos will be created to use ReadonlyRestClient (for testing purposes). + * @private {boolean} + */ + this.useRestClient_ = false; + } + RepoManager.getInstance = function () { + if (!_staticInstance) { + _staticInstance = new RepoManager(); + } + return _staticInstance; + }; + // TODO(koss): Remove these functions unless used in tests? + RepoManager.prototype.interrupt = function () { + for (var appName in this.repos_) { + for (var dbUrl in this.repos_[appName]) { + this.repos_[appName][dbUrl].interrupt(); + } + } + }; + RepoManager.prototype.resume = function () { + for (var appName in this.repos_) { + for (var dbUrl in this.repos_[appName]) { + this.repos_[appName][dbUrl].resume(); + } + } + }; + /** + * This function should only ever be called to CREATE a new database instance. + * + * @param {!FirebaseApp} app + * @return {!Database} + */ + RepoManager.prototype.databaseFromApp = function (app, url) { + var dbUrl = url || app.options[DATABASE_URL_OPTION]; + if (dbUrl === undefined) { + util_2.fatal("Can't determine Firebase Database URL. Be sure to include " + + DATABASE_URL_OPTION + + ' option when calling firebase.initializeApp().'); + } + var parsedUrl = parser_1.parseRepoInfo(dbUrl); + var repoInfo = parsedUrl.repoInfo; + validation_1.validateUrl('Invalid Firebase Database URL', 1, parsedUrl); + if (!parsedUrl.path.isEmpty()) { + util_2.fatal('Database URL must point to the root of a Firebase Database ' + + '(not including a child path).'); + } + var repo = this.createRepo(repoInfo, app); + return repo.database; + }; + /** + * Remove the repo and make sure it is disconnected. + * + * @param {!Repo} repo + */ + RepoManager.prototype.deleteRepo = function (repo) { + var appRepos = util_1.safeGet(this.repos_, repo.app.name); + // This should never happen... + if (!appRepos || util_1.safeGet(appRepos, repo.repoInfo_.toURLString()) !== repo) { + util_2.fatal("Database " + repo.app.name + "(" + repo.repoInfo_ + ") has already been deleted."); + } + repo.interrupt(); + delete appRepos[repo.repoInfo_.toURLString()]; + }; + /** + * Ensures a repo doesn't already exist and then creates one using the + * provided app. + * + * @param {!RepoInfo} repoInfo The metadata about the Repo + * @param {!FirebaseApp} app + * @return {!Repo} The Repo object for the specified server / repoName. + */ + RepoManager.prototype.createRepo = function (repoInfo, app) { + var appRepos = util_1.safeGet(this.repos_, app.name); + if (!appRepos) { + appRepos = {}; + this.repos_[app.name] = appRepos; + } + var repo = util_1.safeGet(appRepos, repoInfo.toURLString()); + if (repo) { + util_2.fatal('Database initialized multiple times. Please make sure the format of the database URL matches with each database() call.'); + } + repo = new Repo_1.Repo(repoInfo, this.useRestClient_, app); + appRepos[repoInfo.toURLString()] = repo; + return repo; + }; + /** + * Forces us to use ReadonlyRestClient instead of PersistentConnection for new Repos. + * @param {boolean} forceRestClient + */ + RepoManager.prototype.forceRestClient = function (forceRestClient) { + this.useRestClient_ = forceRestClient; + }; + return RepoManager; +}()); +exports.RepoManager = RepoManager; + +//# sourceMappingURL=RepoManager.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/Repo_transaction.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/Repo_transaction.js ***! + \*******************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var Reference_1 = __webpack_require__(/*! ../api/Reference */ "./node_modules/@firebase/database/dist/cjs/src/api/Reference.js"); +var DataSnapshot_1 = __webpack_require__(/*! ../api/DataSnapshot */ "./node_modules/@firebase/database/dist/cjs/src/api/DataSnapshot.js"); +var Path_1 = __webpack_require__(/*! ./util/Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +var Tree_1 = __webpack_require__(/*! ./util/Tree */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Tree.js"); +var PriorityIndex_1 = __webpack_require__(/*! ./snap/indexes/PriorityIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PriorityIndex.js"); +var util_2 = __webpack_require__(/*! ./util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var ServerValues_1 = __webpack_require__(/*! ./util/ServerValues */ "./node_modules/@firebase/database/dist/cjs/src/core/util/ServerValues.js"); +var validation_1 = __webpack_require__(/*! ./util/validation */ "./node_modules/@firebase/database/dist/cjs/src/core/util/validation.js"); +var util_3 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var nodeFromJSON_1 = __webpack_require__(/*! ./snap/nodeFromJSON */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/nodeFromJSON.js"); +var ChildrenNode_1 = __webpack_require__(/*! ./snap/ChildrenNode */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/ChildrenNode.js"); +var Repo_1 = __webpack_require__(/*! ./Repo */ "./node_modules/@firebase/database/dist/cjs/src/core/Repo.js"); +// TODO: This is pretty messy. Ideally, a lot of this would move into FirebaseData, or a transaction-specific +// component used by FirebaseData, but it has ties to user callbacks (transaction update and onComplete) as well +// as the realtime connection (to send transactions to the server). So that all needs to be decoupled first. +// For now it's part of Repo, but in its own file. +/** + * @enum {number} + */ +var TransactionStatus; +(function (TransactionStatus) { + // We've run the transaction and updated transactionResultData_ with the result, but it isn't currently sent to the + // server. A transaction will go from RUN -> SENT -> RUN if it comes back from the server as rejected due to + // mismatched hash. + TransactionStatus[TransactionStatus["RUN"] = 0] = "RUN"; + // We've run the transaction and sent it to the server and it's currently outstanding (hasn't come back as accepted + // or rejected yet). + TransactionStatus[TransactionStatus["SENT"] = 1] = "SENT"; + // Temporary state used to mark completed transactions (whether successful or aborted). The transaction will be + // removed when we get a chance to prune completed ones. + TransactionStatus[TransactionStatus["COMPLETED"] = 2] = "COMPLETED"; + // Used when an already-sent transaction needs to be aborted (e.g. due to a conflicting set() call that was made). + // If it comes back as unsuccessful, we'll abort it. + TransactionStatus[TransactionStatus["SENT_NEEDS_ABORT"] = 3] = "SENT_NEEDS_ABORT"; + // Temporary state used to mark transactions that need to be aborted. + TransactionStatus[TransactionStatus["NEEDS_ABORT"] = 4] = "NEEDS_ABORT"; +})(TransactionStatus = exports.TransactionStatus || (exports.TransactionStatus = {})); +/** + * If a transaction does not succeed after 25 retries, we abort it. Among other things this ensure that if there's + * ever a bug causing a mismatch between client / server hashes for some data, we won't retry indefinitely. + * @type {number} + * @const + * @private + */ +Repo_1.Repo.MAX_TRANSACTION_RETRIES_ = 25; +/** + * Setup the transaction data structures + * @private + */ +Repo_1.Repo.prototype.transactions_init_ = function () { + /** + * Stores queues of outstanding transactions for Firebase locations. + * + * @type {!Tree.>} + * @private + */ + this.transactionQueueTree_ = new Tree_1.Tree(); +}; +/** + * Creates a new transaction, adds it to the transactions we're tracking, and sends it to the server if possible. + * + * @param {!Path} path Path at which to do transaction. + * @param {function(*):*} transactionUpdate Update callback. + * @param {?function(?Error, boolean, ?DataSnapshot)} onComplete Completion callback. + * @param {boolean} applyLocally Whether or not to make intermediate results visible + */ +Repo_1.Repo.prototype.startTransaction = function (path, transactionUpdate, onComplete, applyLocally) { + this.log_('transaction on ' + path); + // Add a watch to make sure we get server updates. + var valueCallback = function () { }; + var watchRef = new Reference_1.Reference(this, path); + watchRef.on('value', valueCallback); + var unwatcher = function () { + watchRef.off('value', valueCallback); + }; + // Initialize transaction. + var transaction = { + path: path, + update: transactionUpdate, + onComplete: onComplete, + // One of TransactionStatus enums. + status: null, + // Used when combining transactions at different locations to figure out which one goes first. + order: util_2.LUIDGenerator(), + // Whether to raise local events for this transaction. + applyLocally: applyLocally, + // Count of how many times we've retried the transaction. + retryCount: 0, + // Function to call to clean up our .on() listener. + unwatcher: unwatcher, + // Stores why a transaction was aborted. + abortReason: null, + currentWriteId: null, + currentInputSnapshot: null, + currentOutputSnapshotRaw: null, + currentOutputSnapshotResolved: null + }; + // Run transaction initially. + var currentState = this.getLatestState_(path); + transaction.currentInputSnapshot = currentState; + var newVal = transaction.update(currentState.val()); + if (newVal === undefined) { + // Abort transaction. + transaction.unwatcher(); + transaction.currentOutputSnapshotRaw = null; + transaction.currentOutputSnapshotResolved = null; + if (transaction.onComplete) { + // We just set the input snapshot, so this cast should be safe + var snapshot = new DataSnapshot_1.DataSnapshot(transaction.currentInputSnapshot, new Reference_1.Reference(this, transaction.path), PriorityIndex_1.PRIORITY_INDEX); + transaction.onComplete(null, false, snapshot); + } + } + else { + validation_1.validateFirebaseData('transaction failed: Data returned ', newVal, transaction.path); + // Mark as run and add to our queue. + transaction.status = TransactionStatus.RUN; + var queueNode = this.transactionQueueTree_.subTree(path); + var nodeQueue = queueNode.getValue() || []; + nodeQueue.push(transaction); + queueNode.setValue(nodeQueue); + // Update visibleData and raise events + // Note: We intentionally raise events after updating all of our transaction state, since the user could + // start new transactions from the event callbacks. + var priorityForNode = void 0; + if (typeof newVal === 'object' && + newVal !== null && + util_3.contains(newVal, '.priority')) { + priorityForNode = util_3.safeGet(newVal, '.priority'); + util_1.assert(validation_1.isValidPriority(priorityForNode), 'Invalid priority returned by transaction. ' + + 'Priority must be a valid string, finite number, server value, or null.'); + } + else { + var currentNode = this.serverSyncTree_.calcCompleteEventCache(path) || + ChildrenNode_1.ChildrenNode.EMPTY_NODE; + priorityForNode = currentNode.getPriority().val(); + } + priorityForNode /** @type {null|number|string} */ = priorityForNode; + var serverValues = this.generateServerValues(); + var newNodeUnresolved = nodeFromJSON_1.nodeFromJSON(newVal, priorityForNode); + var newNode = ServerValues_1.resolveDeferredValueSnapshot(newNodeUnresolved, serverValues); + transaction.currentOutputSnapshotRaw = newNodeUnresolved; + transaction.currentOutputSnapshotResolved = newNode; + transaction.currentWriteId = this.getNextWriteId_(); + var events = this.serverSyncTree_.applyUserOverwrite(path, newNode, transaction.currentWriteId, transaction.applyLocally); + this.eventQueue_.raiseEventsForChangedPath(path, events); + this.sendReadyTransactions_(); + } +}; +/** + * @param {!Path} path + * @param {Array.=} excludeSets A specific set to exclude + * @return {Node} + * @private + */ +Repo_1.Repo.prototype.getLatestState_ = function (path, excludeSets) { + return (this.serverSyncTree_.calcCompleteEventCache(path, excludeSets) || + ChildrenNode_1.ChildrenNode.EMPTY_NODE); +}; +/** + * Sends any already-run transactions that aren't waiting for outstanding transactions to + * complete. + * + * Externally it's called with no arguments, but it calls itself recursively with a particular + * transactionQueueTree node to recurse through the tree. + * + * @param {Tree.>=} node transactionQueueTree node to start at. + * @private + */ +Repo_1.Repo.prototype.sendReadyTransactions_ = function (node) { + var _this = this; + if (node === void 0) { node = this.transactionQueueTree_; } + // Before recursing, make sure any completed transactions are removed. + if (!node) { + this.pruneCompletedTransactionsBelowNode_(node); + } + if (node.getValue() !== null) { + var queue = this.buildTransactionQueue_(node); + util_1.assert(queue.length > 0, 'Sending zero length transaction queue'); + var allRun = queue.every(function (transaction) { return transaction.status === TransactionStatus.RUN; }); + // If they're all run (and not sent), we can send them. Else, we must wait. + if (allRun) { + this.sendTransactionQueue_(node.path(), queue); + } + } + else if (node.hasChildren()) { + node.forEachChild(function (childNode) { + _this.sendReadyTransactions_(childNode); + }); + } +}; +/** + * Given a list of run transactions, send them to the server and then handle the result (success or failure). + * + * @param {!Path} path The location of the queue. + * @param {!Array.} queue Queue of transactions under the specified location. + * @private + */ +Repo_1.Repo.prototype.sendTransactionQueue_ = function (path, queue) { + var _this = this; + // Mark transactions as sent and increment retry count! + var setsToIgnore = queue.map(function (txn) { + return txn.currentWriteId; + }); + var latestState = this.getLatestState_(path, setsToIgnore); + var snapToSend = latestState; + var latestHash = latestState.hash(); + for (var i = 0; i < queue.length; i++) { + var txn = queue[i]; + util_1.assert(txn.status === TransactionStatus.RUN, 'tryToSendTransactionQueue_: items in queue should all be run.'); + txn.status = TransactionStatus.SENT; + txn.retryCount++; + var relativePath = Path_1.Path.relativePath(path, txn.path); + // If we've gotten to this point, the output snapshot must be defined. + snapToSend = snapToSend.updateChild(relativePath /**@type {!Node} */, txn.currentOutputSnapshotRaw); + } + var dataToSend = snapToSend.val(true); + var pathToSend = path; + // Send the put. + this.server_.put(pathToSend.toString(), dataToSend, function (status) { + _this.log_('transaction put response', { + path: pathToSend.toString(), + status: status + }); + var events = []; + if (status === 'ok') { + // Queue up the callbacks and fire them after cleaning up all of our transaction state, since + // the callback could trigger more transactions or sets. + var callbacks = []; + for (var i = 0; i < queue.length; i++) { + queue[i].status = TransactionStatus.COMPLETED; + events = events.concat(_this.serverSyncTree_.ackUserWrite(queue[i].currentWriteId)); + if (queue[i].onComplete) { + // We never unset the output snapshot, and given that this transaction is complete, it should be set + var node = queue[i].currentOutputSnapshotResolved; + var ref = new Reference_1.Reference(_this, queue[i].path); + var snapshot = new DataSnapshot_1.DataSnapshot(node, ref, PriorityIndex_1.PRIORITY_INDEX); + callbacks.push(queue[i].onComplete.bind(null, null, true, snapshot)); + } + queue[i].unwatcher(); + } + // Now remove the completed transactions. + _this.pruneCompletedTransactionsBelowNode_(_this.transactionQueueTree_.subTree(path)); + // There may be pending transactions that we can now send. + _this.sendReadyTransactions_(); + _this.eventQueue_.raiseEventsForChangedPath(path, events); + // Finally, trigger onComplete callbacks. + for (var i = 0; i < callbacks.length; i++) { + util_2.exceptionGuard(callbacks[i]); + } + } + else { + // transactions are no longer sent. Update their status appropriately. + if (status === 'datastale') { + for (var i = 0; i < queue.length; i++) { + if (queue[i].status === TransactionStatus.SENT_NEEDS_ABORT) + queue[i].status = TransactionStatus.NEEDS_ABORT; + else + queue[i].status = TransactionStatus.RUN; + } + } + else { + util_2.warn('transaction at ' + pathToSend.toString() + ' failed: ' + status); + for (var i = 0; i < queue.length; i++) { + queue[i].status = TransactionStatus.NEEDS_ABORT; + queue[i].abortReason = status; + } + } + _this.rerunTransactions_(path); + } + }, latestHash); +}; +/** + * Finds all transactions dependent on the data at changedPath and reruns them. + * + * Should be called any time cached data changes. + * + * Return the highest path that was affected by rerunning transactions. This is the path at which events need to + * be raised for. + * + * @param {!Path} changedPath The path in mergedData that changed. + * @return {!Path} The rootmost path that was affected by rerunning transactions. + * @private + */ +Repo_1.Repo.prototype.rerunTransactions_ = function (changedPath) { + var rootMostTransactionNode = this.getAncestorTransactionNode_(changedPath); + var path = rootMostTransactionNode.path(); + var queue = this.buildTransactionQueue_(rootMostTransactionNode); + this.rerunTransactionQueue_(queue, path); + return path; +}; +/** + * Does all the work of rerunning transactions (as well as cleans up aborted transactions and whatnot). + * + * @param {Array.} queue The queue of transactions to run. + * @param {!Path} path The path the queue is for. + * @private + */ +Repo_1.Repo.prototype.rerunTransactionQueue_ = function (queue, path) { + if (queue.length === 0) { + return; // Nothing to do! + } + // Queue up the callbacks and fire them after cleaning up all of our transaction state, since + // the callback could trigger more transactions or sets. + var callbacks = []; + var events = []; + // Ignore all of the sets we're going to re-run. + var txnsToRerun = queue.filter(function (q) { + return q.status === TransactionStatus.RUN; + }); + var setsToIgnore = txnsToRerun.map(function (q) { + return q.currentWriteId; + }); + for (var i = 0; i < queue.length; i++) { + var transaction = queue[i]; + var relativePath = Path_1.Path.relativePath(path, transaction.path); + var abortTransaction = false, abortReason = void 0; + util_1.assert(relativePath !== null, 'rerunTransactionsUnderNode_: relativePath should not be null.'); + if (transaction.status === TransactionStatus.NEEDS_ABORT) { + abortTransaction = true; + abortReason = transaction.abortReason; + events = events.concat(this.serverSyncTree_.ackUserWrite(transaction.currentWriteId, true)); + } + else if (transaction.status === TransactionStatus.RUN) { + if (transaction.retryCount >= Repo_1.Repo.MAX_TRANSACTION_RETRIES_) { + abortTransaction = true; + abortReason = 'maxretry'; + events = events.concat(this.serverSyncTree_.ackUserWrite(transaction.currentWriteId, true)); + } + else { + // This code reruns a transaction + var currentNode = this.getLatestState_(transaction.path, setsToIgnore); + transaction.currentInputSnapshot = currentNode; + var newData = queue[i].update(currentNode.val()); + if (newData !== undefined) { + validation_1.validateFirebaseData('transaction failed: Data returned ', newData, transaction.path); + var newDataNode = nodeFromJSON_1.nodeFromJSON(newData); + var hasExplicitPriority = typeof newData === 'object' && + newData != null && + util_3.contains(newData, '.priority'); + if (!hasExplicitPriority) { + // Keep the old priority if there wasn't a priority explicitly specified. + newDataNode = newDataNode.updatePriority(currentNode.getPriority()); + } + var oldWriteId = transaction.currentWriteId; + var serverValues = this.generateServerValues(); + var newNodeResolved = ServerValues_1.resolveDeferredValueSnapshot(newDataNode, serverValues); + transaction.currentOutputSnapshotRaw = newDataNode; + transaction.currentOutputSnapshotResolved = newNodeResolved; + transaction.currentWriteId = this.getNextWriteId_(); + // Mutates setsToIgnore in place + setsToIgnore.splice(setsToIgnore.indexOf(oldWriteId), 1); + events = events.concat(this.serverSyncTree_.applyUserOverwrite(transaction.path, newNodeResolved, transaction.currentWriteId, transaction.applyLocally)); + events = events.concat(this.serverSyncTree_.ackUserWrite(oldWriteId, true)); + } + else { + abortTransaction = true; + abortReason = 'nodata'; + events = events.concat(this.serverSyncTree_.ackUserWrite(transaction.currentWriteId, true)); + } + } + } + this.eventQueue_.raiseEventsForChangedPath(path, events); + events = []; + if (abortTransaction) { + // Abort. + queue[i].status = TransactionStatus.COMPLETED; + // Removing a listener can trigger pruning which can muck with mergedData/visibleData (as it prunes data). + // So defer the unwatcher until we're done. + (function (unwatcher) { + setTimeout(unwatcher, Math.floor(0)); + })(queue[i].unwatcher); + if (queue[i].onComplete) { + if (abortReason === 'nodata') { + var ref = new Reference_1.Reference(this, queue[i].path); + // We set this field immediately, so it's safe to cast to an actual snapshot + var lastInput /** @type {!Node} */ = queue[i].currentInputSnapshot; + var snapshot = new DataSnapshot_1.DataSnapshot(lastInput, ref, PriorityIndex_1.PRIORITY_INDEX); + callbacks.push(queue[i].onComplete.bind(null, null, false, snapshot)); + } + else { + callbacks.push(queue[i].onComplete.bind(null, new Error(abortReason), false, null)); + } + } + } + } + // Clean up completed transactions. + this.pruneCompletedTransactionsBelowNode_(this.transactionQueueTree_); + // Now fire callbacks, now that we're in a good, known state. + for (var i = 0; i < callbacks.length; i++) { + util_2.exceptionGuard(callbacks[i]); + } + // Try to send the transaction result to the server. + this.sendReadyTransactions_(); +}; +/** + * Returns the rootmost ancestor node of the specified path that has a pending transaction on it, or just returns + * the node for the given path if there are no pending transactions on any ancestor. + * + * @param {!Path} path The location to start at. + * @return {!Tree.>} The rootmost node with a transaction. + * @private + */ +Repo_1.Repo.prototype.getAncestorTransactionNode_ = function (path) { + var front; + // Start at the root and walk deeper into the tree towards path until we find a node with pending transactions. + var transactionNode = this.transactionQueueTree_; + while ((front = path.getFront()) !== null && + transactionNode.getValue() === null) { + transactionNode = transactionNode.subTree(front); + path = path.popFront(); + } + return transactionNode; +}; +/** + * Builds the queue of all transactions at or below the specified transactionNode. + * + * @param {!Tree.>} transactionNode + * @return {Array.} The generated queue. + * @private + */ +Repo_1.Repo.prototype.buildTransactionQueue_ = function (transactionNode) { + // Walk any child transaction queues and aggregate them into a single queue. + var transactionQueue = []; + this.aggregateTransactionQueuesForNode_(transactionNode, transactionQueue); + // Sort them by the order the transactions were created. + transactionQueue.sort(function (a, b) { + return a.order - b.order; + }); + return transactionQueue; +}; +/** + * @param {!Tree.>} node + * @param {Array.} queue + * @private + */ +Repo_1.Repo.prototype.aggregateTransactionQueuesForNode_ = function (node, queue) { + var _this = this; + var nodeQueue = node.getValue(); + if (nodeQueue !== null) { + for (var i = 0; i < nodeQueue.length; i++) { + queue.push(nodeQueue[i]); + } + } + node.forEachChild(function (child) { + _this.aggregateTransactionQueuesForNode_(child, queue); + }); +}; +/** + * Remove COMPLETED transactions at or below this node in the transactionQueueTree_. + * + * @param {!Tree.>} node + * @private + */ +Repo_1.Repo.prototype.pruneCompletedTransactionsBelowNode_ = function (node) { + var _this = this; + var queue = node.getValue(); + if (queue) { + var to = 0; + for (var from = 0; from < queue.length; from++) { + if (queue[from].status !== TransactionStatus.COMPLETED) { + queue[to] = queue[from]; + to++; + } + } + queue.length = to; + node.setValue(queue.length > 0 ? queue : null); + } + node.forEachChild(function (childNode) { + _this.pruneCompletedTransactionsBelowNode_(childNode); + }); +}; +/** + * Aborts all transactions on ancestors or descendants of the specified path. Called when doing a set() or update() + * since we consider them incompatible with transactions. + * + * @param {!Path} path Path for which we want to abort related transactions. + * @return {!Path} + * @private + */ +Repo_1.Repo.prototype.abortTransactions_ = function (path) { + var _this = this; + var affectedPath = this.getAncestorTransactionNode_(path).path(); + var transactionNode = this.transactionQueueTree_.subTree(path); + transactionNode.forEachAncestor(function (node) { + _this.abortTransactionsOnNode_(node); + }); + this.abortTransactionsOnNode_(transactionNode); + transactionNode.forEachDescendant(function (node) { + _this.abortTransactionsOnNode_(node); + }); + return affectedPath; +}; +/** + * Abort transactions stored in this transaction queue node. + * + * @param {!Tree.>} node Node to abort transactions for. + * @private + */ +Repo_1.Repo.prototype.abortTransactionsOnNode_ = function (node) { + var queue = node.getValue(); + if (queue !== null) { + // Queue up the callbacks and fire them after cleaning up all of our transaction state, since + // the callback could trigger more transactions or sets. + var callbacks = []; + // Go through queue. Any already-sent transactions must be marked for abort, while the unsent ones + // can be immediately aborted and removed. + var events = []; + var lastSent = -1; + for (var i = 0; i < queue.length; i++) { + if (queue[i].status === TransactionStatus.SENT_NEEDS_ABORT) { + // Already marked. No action needed. + } + else if (queue[i].status === TransactionStatus.SENT) { + util_1.assert(lastSent === i - 1, 'All SENT items should be at beginning of queue.'); + lastSent = i; + // Mark transaction for abort when it comes back. + queue[i].status = TransactionStatus.SENT_NEEDS_ABORT; + queue[i].abortReason = 'set'; + } + else { + util_1.assert(queue[i].status === TransactionStatus.RUN, 'Unexpected transaction status in abort'); + // We can abort it immediately. + queue[i].unwatcher(); + events = events.concat(this.serverSyncTree_.ackUserWrite(queue[i].currentWriteId, true)); + if (queue[i].onComplete) { + var snapshot = null; + callbacks.push(queue[i].onComplete.bind(null, new Error('set'), false, snapshot)); + } + } + } + if (lastSent === -1) { + // We're not waiting for any sent transactions. We can clear the queue. + node.setValue(null); + } + else { + // Remove the transactions we aborted. + queue.length = lastSent + 1; + } + // Now fire the callbacks. + this.eventQueue_.raiseEventsForChangedPath(node.path(), events); + for (var i = 0; i < callbacks.length; i++) { + util_2.exceptionGuard(callbacks[i]); + } + } +}; + +//# sourceMappingURL=Repo_transaction.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/ServerActions.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/ServerActions.js ***! + \****************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 }); +/** + * Interface defining the set of actions that can be performed against the Firebase server + * (basically corresponds to our wire protocol). + * + * @interface + */ +var ServerActions = /** @class */ (function () { + function ServerActions() { + } + /** + * @param {string} pathString + * @param {*} data + * @param {function(string, string)=} onComplete + * @param {string=} hash + */ + ServerActions.prototype.put = function (pathString, data, onComplete, hash) { }; + /** + * @param {string} pathString + * @param {*} data + * @param {function(string, ?string)} onComplete + * @param {string=} hash + */ + ServerActions.prototype.merge = function (pathString, data, onComplete, hash) { }; + /** + * Refreshes the auth token for the current connection. + * @param {string} token The authentication token + */ + ServerActions.prototype.refreshAuthToken = function (token) { }; + /** + * @param {string} pathString + * @param {*} data + * @param {function(string, string)=} onComplete + */ + ServerActions.prototype.onDisconnectPut = function (pathString, data, onComplete) { }; + /** + * @param {string} pathString + * @param {*} data + * @param {function(string, string)=} onComplete + */ + ServerActions.prototype.onDisconnectMerge = function (pathString, data, onComplete) { }; + /** + * @param {string} pathString + * @param {function(string, string)=} onComplete + */ + ServerActions.prototype.onDisconnectCancel = function (pathString, onComplete) { }; + /** + * @param {Object.} stats + */ + ServerActions.prototype.reportStats = function (stats) { }; + return ServerActions; +}()); +exports.ServerActions = ServerActions; + +//# sourceMappingURL=ServerActions.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/SnapshotHolder.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/SnapshotHolder.js ***! + \*****************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 ChildrenNode_1 = __webpack_require__(/*! ./snap/ChildrenNode */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/ChildrenNode.js"); +/** + * Mutable object which basically just stores a reference to the "latest" immutable snapshot. + * + * @constructor + */ +var SnapshotHolder = /** @class */ (function () { + function SnapshotHolder() { + this.rootNode_ = ChildrenNode_1.ChildrenNode.EMPTY_NODE; + } + SnapshotHolder.prototype.getNode = function (path) { + return this.rootNode_.getChild(path); + }; + SnapshotHolder.prototype.updateSnapshot = function (path, newSnapshotNode) { + this.rootNode_ = this.rootNode_.updateChild(path, newSnapshotNode); + }; + return SnapshotHolder; +}()); +exports.SnapshotHolder = SnapshotHolder; + +//# sourceMappingURL=SnapshotHolder.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/SparseSnapshotTree.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/SparseSnapshotTree.js ***! + \*********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 Path_1 = __webpack_require__(/*! ./util/Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +var PriorityIndex_1 = __webpack_require__(/*! ./snap/indexes/PriorityIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PriorityIndex.js"); +var CountedSet_1 = __webpack_require__(/*! ./util/CountedSet */ "./node_modules/@firebase/database/dist/cjs/src/core/util/CountedSet.js"); +/** + * Helper class to store a sparse set of snapshots. + * + * @constructor + */ +var SparseSnapshotTree = /** @class */ (function () { + function SparseSnapshotTree() { + /** + * @private + * @type {Node} + */ + this.value_ = null; + /** + * @private + * @type {CountedSet} + */ + this.children_ = null; + } + /** + * Gets the node stored at the given path if one exists. + * + * @param {!Path} path Path to look up snapshot for. + * @return {?Node} The retrieved node, or null. + */ + SparseSnapshotTree.prototype.find = function (path) { + if (this.value_ != null) { + return this.value_.getChild(path); + } + else if (!path.isEmpty() && this.children_ != null) { + var childKey = path.getFront(); + path = path.popFront(); + if (this.children_.contains(childKey)) { + var childTree = this.children_.get(childKey); + return childTree.find(path); + } + else { + return null; + } + } + else { + return null; + } + }; + /** + * Stores the given node at the specified path. If there is already a node + * at a shallower path, it merges the new data into that snapshot node. + * + * @param {!Path} path Path to look up snapshot for. + * @param {!Node} data The new data, or null. + */ + SparseSnapshotTree.prototype.remember = function (path, data) { + if (path.isEmpty()) { + this.value_ = data; + this.children_ = null; + } + else if (this.value_ !== null) { + this.value_ = this.value_.updateChild(path, data); + } + else { + if (this.children_ == null) { + this.children_ = new CountedSet_1.CountedSet(); + } + var childKey = path.getFront(); + if (!this.children_.contains(childKey)) { + this.children_.add(childKey, new SparseSnapshotTree()); + } + var child = this.children_.get(childKey); + path = path.popFront(); + child.remember(path, data); + } + }; + /** + * Purge the data at path from the cache. + * + * @param {!Path} path Path to look up snapshot for. + * @return {boolean} True if this node should now be removed. + */ + SparseSnapshotTree.prototype.forget = function (path) { + if (path.isEmpty()) { + this.value_ = null; + this.children_ = null; + return true; + } + else { + if (this.value_ !== null) { + if (this.value_.isLeafNode()) { + // We're trying to forget a node that doesn't exist + return false; + } + else { + var value = this.value_; + this.value_ = null; + var self_1 = this; + value.forEachChild(PriorityIndex_1.PRIORITY_INDEX, function (key, tree) { + self_1.remember(new Path_1.Path(key), tree); + }); + return this.forget(path); + } + } + else if (this.children_ !== null) { + var childKey = path.getFront(); + path = path.popFront(); + if (this.children_.contains(childKey)) { + var safeToRemove = this.children_.get(childKey).forget(path); + if (safeToRemove) { + this.children_.remove(childKey); + } + } + if (this.children_.isEmpty()) { + this.children_ = null; + return true; + } + else { + return false; + } + } + else { + return true; + } + } + }; + /** + * Recursively iterates through all of the stored tree and calls the + * callback on each one. + * + * @param {!Path} prefixPath Path to look up node for. + * @param {!Function} func The function to invoke for each tree. + */ + SparseSnapshotTree.prototype.forEachTree = function (prefixPath, func) { + if (this.value_ !== null) { + func(prefixPath, this.value_); + } + else { + this.forEachChild(function (key, tree) { + var path = new Path_1.Path(prefixPath.toString() + '/' + key); + tree.forEachTree(path, func); + }); + } + }; + /** + * Iterates through each immediate child and triggers the callback. + * + * @param {!Function} func The function to invoke for each child. + */ + SparseSnapshotTree.prototype.forEachChild = function (func) { + if (this.children_ !== null) { + this.children_.each(function (key, tree) { + func(key, tree); + }); + } + }; + return SparseSnapshotTree; +}()); +exports.SparseSnapshotTree = SparseSnapshotTree; + +//# sourceMappingURL=SparseSnapshotTree.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/SyncPoint.js": +/*!************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/SyncPoint.js ***! + \************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 CacheNode_1 = __webpack_require__(/*! ./view/CacheNode */ "./node_modules/@firebase/database/dist/cjs/src/core/view/CacheNode.js"); +var ChildrenNode_1 = __webpack_require__(/*! ./snap/ChildrenNode */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/ChildrenNode.js"); +var util_1 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var ViewCache_1 = __webpack_require__(/*! ./view/ViewCache */ "./node_modules/@firebase/database/dist/cjs/src/core/view/ViewCache.js"); +var View_1 = __webpack_require__(/*! ./view/View */ "./node_modules/@firebase/database/dist/cjs/src/core/view/View.js"); +var __referenceConstructor; +/** + * SyncPoint represents a single location in a SyncTree with 1 or more event registrations, meaning we need to + * maintain 1 or more Views at this location to cache server data and raise appropriate events for server changes + * and user writes (set, transaction, update). + * + * It's responsible for: + * - Maintaining the set of 1 or more views necessary at this location (a SyncPoint with 0 views should be removed). + * - Proxying user / server operations to the views as appropriate (i.e. applyServerOverwrite, + * applyUserOverwrite, etc.) + */ +var SyncPoint = /** @class */ (function () { + function SyncPoint() { + /** + * The Views being tracked at this location in the tree, stored as a map where the key is a + * queryId and the value is the View for that query. + * + * NOTE: This list will be quite small (usually 1, but perhaps 2 or 3; any more is an odd use case). + * + * @type {!Object.} + * @private + */ + this.views_ = {}; + } + Object.defineProperty(SyncPoint, "__referenceConstructor", { + get: function () { + util_1.assert(__referenceConstructor, 'Reference.ts has not been loaded'); + return __referenceConstructor; + }, + set: function (val) { + util_1.assert(!__referenceConstructor, '__referenceConstructor has already been defined'); + __referenceConstructor = val; + }, + enumerable: true, + configurable: true + }); + /** + * @return {boolean} + */ + SyncPoint.prototype.isEmpty = function () { + return util_2.isEmpty(this.views_); + }; + /** + * + * @param {!Operation} operation + * @param {!WriteTreeRef} writesCache + * @param {?Node} optCompleteServerCache + * @return {!Array.} + */ + SyncPoint.prototype.applyOperation = function (operation, writesCache, optCompleteServerCache) { + var queryId = operation.source.queryId; + if (queryId !== null) { + var view = util_2.safeGet(this.views_, queryId); + util_1.assert(view != null, 'SyncTree gave us an op for an invalid query.'); + return view.applyOperation(operation, writesCache, optCompleteServerCache); + } + else { + var events_1 = []; + util_2.forEach(this.views_, function (key, view) { + events_1 = events_1.concat(view.applyOperation(operation, writesCache, optCompleteServerCache)); + }); + return events_1; + } + }; + /** + * Add an event callback for the specified query. + * + * @param {!Query} query + * @param {!EventRegistration} eventRegistration + * @param {!WriteTreeRef} writesCache + * @param {?Node} serverCache Complete server cache, if we have it. + * @param {boolean} serverCacheComplete + * @return {!Array.} Events to raise. + */ + SyncPoint.prototype.addEventRegistration = function (query, eventRegistration, writesCache, serverCache, serverCacheComplete) { + var queryId = query.queryIdentifier(); + var view = util_2.safeGet(this.views_, queryId); + if (!view) { + // TODO: make writesCache take flag for complete server node + var eventCache = writesCache.calcCompleteEventCache(serverCacheComplete ? serverCache : null); + var eventCacheComplete = false; + if (eventCache) { + eventCacheComplete = true; + } + else if (serverCache instanceof ChildrenNode_1.ChildrenNode) { + eventCache = writesCache.calcCompleteEventChildren(serverCache); + eventCacheComplete = false; + } + else { + eventCache = ChildrenNode_1.ChildrenNode.EMPTY_NODE; + eventCacheComplete = false; + } + var viewCache = new ViewCache_1.ViewCache(new CacheNode_1.CacheNode( + /** @type {!Node} */ (eventCache), eventCacheComplete, false), new CacheNode_1.CacheNode( + /** @type {!Node} */ (serverCache), serverCacheComplete, false)); + view = new View_1.View(query, viewCache); + this.views_[queryId] = view; + } + // This is guaranteed to exist now, we just created anything that was missing + view.addEventRegistration(eventRegistration); + return view.getInitialEvents(eventRegistration); + }; + /** + * Remove event callback(s). Return cancelEvents if a cancelError is specified. + * + * If query is the default query, we'll check all views for the specified eventRegistration. + * If eventRegistration is null, we'll remove all callbacks for the specified view(s). + * + * @param {!Query} query + * @param {?EventRegistration} eventRegistration If null, remove all callbacks. + * @param {Error=} cancelError If a cancelError is provided, appropriate cancel events will be returned. + * @return {{removed:!Array., events:!Array.}} removed queries and any cancel events + */ + SyncPoint.prototype.removeEventRegistration = function (query, eventRegistration, cancelError) { + var queryId = query.queryIdentifier(); + var removed = []; + var cancelEvents = []; + var hadCompleteView = this.hasCompleteView(); + if (queryId === 'default') { + // When you do ref.off(...), we search all views for the registration to remove. + var self_1 = this; + util_2.forEach(this.views_, function (viewQueryId, view) { + cancelEvents = cancelEvents.concat(view.removeEventRegistration(eventRegistration, cancelError)); + if (view.isEmpty()) { + delete self_1.views_[viewQueryId]; + // We'll deal with complete views later. + if (!view + .getQuery() + .getQueryParams() + .loadsAllData()) { + removed.push(view.getQuery()); + } + } + }); + } + else { + // remove the callback from the specific view. + var view = util_2.safeGet(this.views_, queryId); + if (view) { + cancelEvents = cancelEvents.concat(view.removeEventRegistration(eventRegistration, cancelError)); + if (view.isEmpty()) { + delete this.views_[queryId]; + // We'll deal with complete views later. + if (!view + .getQuery() + .getQueryParams() + .loadsAllData()) { + removed.push(view.getQuery()); + } + } + } + } + if (hadCompleteView && !this.hasCompleteView()) { + // We removed our last complete view. + removed.push(new SyncPoint.__referenceConstructor(query.repo, query.path)); + } + return { removed: removed, events: cancelEvents }; + }; + /** + * @return {!Array.} + */ + SyncPoint.prototype.getQueryViews = function () { + var _this = this; + var values = Object.keys(this.views_).map(function (key) { return _this.views_[key]; }); + return values.filter(function (view) { + return !view + .getQuery() + .getQueryParams() + .loadsAllData(); + }); + }; + /** + * + * @param {!Path} path The path to the desired complete snapshot + * @return {?Node} A complete cache, if it exists + */ + SyncPoint.prototype.getCompleteServerCache = function (path) { + var serverCache = null; + util_2.forEach(this.views_, function (key, view) { + serverCache = serverCache || view.getCompleteServerCache(path); + }); + return serverCache; + }; + /** + * @param {!Query} query + * @return {?View} + */ + SyncPoint.prototype.viewForQuery = function (query) { + var params = query.getQueryParams(); + if (params.loadsAllData()) { + return this.getCompleteView(); + } + else { + var queryId = query.queryIdentifier(); + return util_2.safeGet(this.views_, queryId); + } + }; + /** + * @param {!Query} query + * @return {boolean} + */ + SyncPoint.prototype.viewExistsForQuery = function (query) { + return this.viewForQuery(query) != null; + }; + /** + * @return {boolean} + */ + SyncPoint.prototype.hasCompleteView = function () { + return this.getCompleteView() != null; + }; + /** + * @return {?View} + */ + SyncPoint.prototype.getCompleteView = function () { + var completeView = util_2.findValue(this.views_, function (view) { + return view + .getQuery() + .getQueryParams() + .loadsAllData(); + }); + return completeView || null; + }; + return SyncPoint; +}()); +exports.SyncPoint = SyncPoint; + +//# sourceMappingURL=SyncPoint.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/SyncTree.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/SyncTree.js ***! + \***********************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! ./util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var AckUserWrite_1 = __webpack_require__(/*! ./operation/AckUserWrite */ "./node_modules/@firebase/database/dist/cjs/src/core/operation/AckUserWrite.js"); +var ChildrenNode_1 = __webpack_require__(/*! ./snap/ChildrenNode */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/ChildrenNode.js"); +var util_3 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var ImmutableTree_1 = __webpack_require__(/*! ./util/ImmutableTree */ "./node_modules/@firebase/database/dist/cjs/src/core/util/ImmutableTree.js"); +var ListenComplete_1 = __webpack_require__(/*! ./operation/ListenComplete */ "./node_modules/@firebase/database/dist/cjs/src/core/operation/ListenComplete.js"); +var Merge_1 = __webpack_require__(/*! ./operation/Merge */ "./node_modules/@firebase/database/dist/cjs/src/core/operation/Merge.js"); +var Operation_1 = __webpack_require__(/*! ./operation/Operation */ "./node_modules/@firebase/database/dist/cjs/src/core/operation/Operation.js"); +var Overwrite_1 = __webpack_require__(/*! ./operation/Overwrite */ "./node_modules/@firebase/database/dist/cjs/src/core/operation/Overwrite.js"); +var Path_1 = __webpack_require__(/*! ./util/Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +var SyncPoint_1 = __webpack_require__(/*! ./SyncPoint */ "./node_modules/@firebase/database/dist/cjs/src/core/SyncPoint.js"); +var WriteTree_1 = __webpack_require__(/*! ./WriteTree */ "./node_modules/@firebase/database/dist/cjs/src/core/WriteTree.js"); +/** + * SyncTree is the central class for managing event callback registration, data caching, views + * (query processing), and event generation. There are typically two SyncTree instances for + * each Repo, one for the normal Firebase data, and one for the .info data. + * + * It has a number of responsibilities, including: + * - Tracking all user event callbacks (registered via addEventRegistration() and removeEventRegistration()). + * - Applying and caching data changes for user set(), transaction(), and update() calls + * (applyUserOverwrite(), applyUserMerge()). + * - Applying and caching data changes for server data changes (applyServerOverwrite(), + * applyServerMerge()). + * - Generating user-facing events for server and user changes (all of the apply* methods + * return the set of events that need to be raised as a result). + * - Maintaining the appropriate set of server listens to ensure we are always subscribed + * to the correct set of paths and queries to satisfy the current set of user event + * callbacks (listens are started/stopped using the provided listenProvider). + * + * NOTE: Although SyncTree tracks event callbacks and calculates events to raise, the actual + * events are returned to the caller rather than raised synchronously. + * + * @constructor + */ +var SyncTree = /** @class */ (function () { + /** + * @param {!ListenProvider} listenProvider_ Used by SyncTree to start / stop listening + * to server data. + */ + function SyncTree(listenProvider_) { + this.listenProvider_ = listenProvider_; + /** + * Tree of SyncPoints. There's a SyncPoint at any location that has 1 or more views. + * @type {!ImmutableTree.} + * @private + */ + this.syncPointTree_ = ImmutableTree_1.ImmutableTree.Empty; + /** + * A tree of all pending user writes (user-initiated set()'s, transaction()'s, update()'s, etc.). + * @type {!WriteTree} + * @private + */ + this.pendingWriteTree_ = new WriteTree_1.WriteTree(); + this.tagToQueryMap_ = {}; + this.queryToTagMap_ = {}; + } + /** + * Apply the data changes for a user-generated set() or transaction() call. + * + * @param {!Path} path + * @param {!Node} newData + * @param {number} writeId + * @param {boolean=} visible + * @return {!Array.} Events to raise. + */ + SyncTree.prototype.applyUserOverwrite = function (path, newData, writeId, visible) { + // Record pending write. + this.pendingWriteTree_.addOverwrite(path, newData, writeId, visible); + if (!visible) { + return []; + } + else { + return this.applyOperationToSyncPoints_(new Overwrite_1.Overwrite(Operation_1.OperationSource.User, path, newData)); + } + }; + /** + * Apply the data from a user-generated update() call + * + * @param {!Path} path + * @param {!Object.} changedChildren + * @param {!number} writeId + * @return {!Array.} Events to raise. + */ + SyncTree.prototype.applyUserMerge = function (path, changedChildren, writeId) { + // Record pending merge. + this.pendingWriteTree_.addMerge(path, changedChildren, writeId); + var changeTree = ImmutableTree_1.ImmutableTree.fromObject(changedChildren); + return this.applyOperationToSyncPoints_(new Merge_1.Merge(Operation_1.OperationSource.User, path, changeTree)); + }; + /** + * Acknowledge a pending user write that was previously registered with applyUserOverwrite() or applyUserMerge(). + * + * @param {!number} writeId + * @param {boolean=} revert True if the given write failed and needs to be reverted + * @return {!Array.} Events to raise. + */ + SyncTree.prototype.ackUserWrite = function (writeId, revert) { + if (revert === void 0) { revert = false; } + var write = this.pendingWriteTree_.getWrite(writeId); + var needToReevaluate = this.pendingWriteTree_.removeWrite(writeId); + if (!needToReevaluate) { + return []; + } + else { + var affectedTree_1 = ImmutableTree_1.ImmutableTree.Empty; + if (write.snap != null) { + // overwrite + affectedTree_1 = affectedTree_1.set(Path_1.Path.Empty, true); + } + else { + util_3.forEach(write.children, function (pathString, node) { + affectedTree_1 = affectedTree_1.set(new Path_1.Path(pathString), node); + }); + } + return this.applyOperationToSyncPoints_(new AckUserWrite_1.AckUserWrite(write.path, affectedTree_1, revert)); + } + }; + /** + * Apply new server data for the specified path.. + * + * @param {!Path} path + * @param {!Node} newData + * @return {!Array.} Events to raise. + */ + SyncTree.prototype.applyServerOverwrite = function (path, newData) { + return this.applyOperationToSyncPoints_(new Overwrite_1.Overwrite(Operation_1.OperationSource.Server, path, newData)); + }; + /** + * Apply new server data to be merged in at the specified path. + * + * @param {!Path} path + * @param {!Object.} changedChildren + * @return {!Array.} Events to raise. + */ + SyncTree.prototype.applyServerMerge = function (path, changedChildren) { + var changeTree = ImmutableTree_1.ImmutableTree.fromObject(changedChildren); + return this.applyOperationToSyncPoints_(new Merge_1.Merge(Operation_1.OperationSource.Server, path, changeTree)); + }; + /** + * Apply a listen complete for a query + * + * @param {!Path} path + * @return {!Array.} Events to raise. + */ + SyncTree.prototype.applyListenComplete = function (path) { + return this.applyOperationToSyncPoints_(new ListenComplete_1.ListenComplete(Operation_1.OperationSource.Server, path)); + }; + /** + * Apply new server data for the specified tagged query. + * + * @param {!Path} path + * @param {!Node} snap + * @param {!number} tag + * @return {!Array.} Events to raise. + */ + SyncTree.prototype.applyTaggedQueryOverwrite = function (path, snap, tag) { + var queryKey = this.queryKeyForTag_(tag); + if (queryKey != null) { + var r = SyncTree.parseQueryKey_(queryKey); + var queryPath = r.path, queryId = r.queryId; + var relativePath = Path_1.Path.relativePath(queryPath, path); + var op = new Overwrite_1.Overwrite(Operation_1.OperationSource.forServerTaggedQuery(queryId), relativePath, snap); + return this.applyTaggedOperation_(queryPath, op); + } + else { + // Query must have been removed already + return []; + } + }; + /** + * Apply server data to be merged in for the specified tagged query. + * + * @param {!Path} path + * @param {!Object.} changedChildren + * @param {!number} tag + * @return {!Array.} Events to raise. + */ + SyncTree.prototype.applyTaggedQueryMerge = function (path, changedChildren, tag) { + var queryKey = this.queryKeyForTag_(tag); + if (queryKey) { + var r = SyncTree.parseQueryKey_(queryKey); + var queryPath = r.path, queryId = r.queryId; + var relativePath = Path_1.Path.relativePath(queryPath, path); + var changeTree = ImmutableTree_1.ImmutableTree.fromObject(changedChildren); + var op = new Merge_1.Merge(Operation_1.OperationSource.forServerTaggedQuery(queryId), relativePath, changeTree); + return this.applyTaggedOperation_(queryPath, op); + } + else { + // We've already removed the query. No big deal, ignore the update + return []; + } + }; + /** + * Apply a listen complete for a tagged query + * + * @param {!Path} path + * @param {!number} tag + * @return {!Array.} Events to raise. + */ + SyncTree.prototype.applyTaggedListenComplete = function (path, tag) { + var queryKey = this.queryKeyForTag_(tag); + if (queryKey) { + var r = SyncTree.parseQueryKey_(queryKey); + var queryPath = r.path, queryId = r.queryId; + var relativePath = Path_1.Path.relativePath(queryPath, path); + var op = new ListenComplete_1.ListenComplete(Operation_1.OperationSource.forServerTaggedQuery(queryId), relativePath); + return this.applyTaggedOperation_(queryPath, op); + } + else { + // We've already removed the query. No big deal, ignore the update + return []; + } + }; + /** + * Add an event callback for the specified query. + * + * @param {!Query} query + * @param {!EventRegistration} eventRegistration + * @return {!Array.} Events to raise. + */ + SyncTree.prototype.addEventRegistration = function (query, eventRegistration) { + var path = query.path; + var serverCache = null; + var foundAncestorDefaultView = false; + // Any covering writes will necessarily be at the root, so really all we need to find is the server cache. + // Consider optimizing this once there's a better understanding of what actual behavior will be. + this.syncPointTree_.foreachOnPath(path, function (pathToSyncPoint, sp) { + var relativePath = Path_1.Path.relativePath(pathToSyncPoint, path); + serverCache = serverCache || sp.getCompleteServerCache(relativePath); + foundAncestorDefaultView = + foundAncestorDefaultView || sp.hasCompleteView(); + }); + var syncPoint = this.syncPointTree_.get(path); + if (!syncPoint) { + syncPoint = new SyncPoint_1.SyncPoint(); + this.syncPointTree_ = this.syncPointTree_.set(path, syncPoint); + } + else { + foundAncestorDefaultView = + foundAncestorDefaultView || syncPoint.hasCompleteView(); + serverCache = serverCache || syncPoint.getCompleteServerCache(Path_1.Path.Empty); + } + var serverCacheComplete; + if (serverCache != null) { + serverCacheComplete = true; + } + else { + serverCacheComplete = false; + serverCache = ChildrenNode_1.ChildrenNode.EMPTY_NODE; + var subtree = this.syncPointTree_.subtree(path); + subtree.foreachChild(function (childName, childSyncPoint) { + var completeCache = childSyncPoint.getCompleteServerCache(Path_1.Path.Empty); + if (completeCache) { + serverCache = serverCache.updateImmediateChild(childName, completeCache); + } + }); + } + var viewAlreadyExists = syncPoint.viewExistsForQuery(query); + if (!viewAlreadyExists && !query.getQueryParams().loadsAllData()) { + // We need to track a tag for this query + var queryKey = SyncTree.makeQueryKey_(query); + util_1.assert(!(queryKey in this.queryToTagMap_), 'View does not exist, but we have a tag'); + var tag = SyncTree.getNextQueryTag_(); + this.queryToTagMap_[queryKey] = tag; + // Coerce to string to avoid sparse arrays. + this.tagToQueryMap_['_' + tag] = queryKey; + } + var writesCache = this.pendingWriteTree_.childWrites(path); + var events = syncPoint.addEventRegistration(query, eventRegistration, writesCache, serverCache, serverCacheComplete); + if (!viewAlreadyExists && !foundAncestorDefaultView) { + var view /** @type !View */ = syncPoint.viewForQuery(query); + events = events.concat(this.setupListener_(query, view)); + } + return events; + }; + /** + * Remove event callback(s). + * + * If query is the default query, we'll check all queries for the specified eventRegistration. + * If eventRegistration is null, we'll remove all callbacks for the specified query/queries. + * + * @param {!Query} query + * @param {?EventRegistration} eventRegistration If null, all callbacks are removed. + * @param {Error=} cancelError If a cancelError is provided, appropriate cancel events will be returned. + * @return {!Array.} Cancel events, if cancelError was provided. + */ + SyncTree.prototype.removeEventRegistration = function (query, eventRegistration, cancelError) { + var _this = this; + // Find the syncPoint first. Then deal with whether or not it has matching listeners + var path = query.path; + var maybeSyncPoint = this.syncPointTree_.get(path); + var cancelEvents = []; + // A removal on a default query affects all queries at that location. A removal on an indexed query, even one without + // other query constraints, does *not* affect all queries at that location. So this check must be for 'default', and + // not loadsAllData(). + if (maybeSyncPoint && + (query.queryIdentifier() === 'default' || + maybeSyncPoint.viewExistsForQuery(query))) { + /** + * @type {{removed: !Array., events: !Array.}} + */ + var removedAndEvents = maybeSyncPoint.removeEventRegistration(query, eventRegistration, cancelError); + if (maybeSyncPoint.isEmpty()) { + this.syncPointTree_ = this.syncPointTree_.remove(path); + } + var removed = removedAndEvents.removed; + cancelEvents = removedAndEvents.events; + // We may have just removed one of many listeners and can short-circuit this whole process + // We may also not have removed a default listener, in which case all of the descendant listeners should already be + // properly set up. + // + // Since indexed queries can shadow if they don't have other query constraints, check for loadsAllData(), instead of + // queryId === 'default' + var removingDefault = -1 !== + removed.findIndex(function (query) { + return query.getQueryParams().loadsAllData(); + }); + var covered = this.syncPointTree_.findOnPath(path, function (relativePath, parentSyncPoint) { + return parentSyncPoint.hasCompleteView(); + }); + if (removingDefault && !covered) { + var subtree = this.syncPointTree_.subtree(path); + // There are potentially child listeners. Determine what if any listens we need to send before executing the + // removal + if (!subtree.isEmpty()) { + // We need to fold over our subtree and collect the listeners to send + var newViews = this.collectDistinctViewsForSubTree_(subtree); + // Ok, we've collected all the listens we need. Set them up. + for (var i = 0; i < newViews.length; ++i) { + var view = newViews[i], newQuery = view.getQuery(); + var listener = this.createListenerForView_(view); + this.listenProvider_.startListening(SyncTree.queryForListening_(newQuery), this.tagForQuery_(newQuery), listener.hashFn, listener.onComplete); + } + } + else { + // There's nothing below us, so nothing we need to start listening on + } + } + // If we removed anything and we're not covered by a higher up listen, we need to stop listening on this query + // The above block has us covered in terms of making sure we're set up on listens lower in the tree. + // Also, note that if we have a cancelError, it's already been removed at the provider level. + if (!covered && removed.length > 0 && !cancelError) { + // If we removed a default, then we weren't listening on any of the other queries here. Just cancel the one + // default. Otherwise, we need to iterate through and cancel each individual query + if (removingDefault) { + // We don't tag default listeners + var defaultTag = null; + this.listenProvider_.stopListening(SyncTree.queryForListening_(query), defaultTag); + } + else { + removed.forEach(function (queryToRemove) { + var tagToRemove = _this.queryToTagMap_[SyncTree.makeQueryKey_(queryToRemove)]; + _this.listenProvider_.stopListening(SyncTree.queryForListening_(queryToRemove), tagToRemove); + }); + } + } + // Now, clear all of the tags we're tracking for the removed listens + this.removeTags_(removed); + } + else { + // No-op, this listener must've been already removed + } + return cancelEvents; + }; + /** + * Returns a complete cache, if we have one, of the data at a particular path. The location must have a listener above + * it, but as this is only used by transaction code, that should always be the case anyways. + * + * Note: this method will *include* hidden writes from transaction with applyLocally set to false. + * @param {!Path} path The path to the data we want + * @param {Array.=} writeIdsToExclude A specific set to be excluded + * @return {?Node} + */ + SyncTree.prototype.calcCompleteEventCache = function (path, writeIdsToExclude) { + var includeHiddenSets = true; + var writeTree = this.pendingWriteTree_; + var serverCache = this.syncPointTree_.findOnPath(path, function (pathSoFar, syncPoint) { + var relativePath = Path_1.Path.relativePath(pathSoFar, path); + var serverCache = syncPoint.getCompleteServerCache(relativePath); + if (serverCache) { + return serverCache; + } + }); + return writeTree.calcCompleteEventCache(path, serverCache, writeIdsToExclude, includeHiddenSets); + }; + /** + * This collapses multiple unfiltered views into a single view, since we only need a single + * listener for them. + * + * @param {!ImmutableTree.} subtree + * @return {!Array.} + * @private + */ + SyncTree.prototype.collectDistinctViewsForSubTree_ = function (subtree) { + return subtree.fold(function (relativePath, maybeChildSyncPoint, childMap) { + if (maybeChildSyncPoint && maybeChildSyncPoint.hasCompleteView()) { + var completeView = maybeChildSyncPoint.getCompleteView(); + return [completeView]; + } + else { + // No complete view here, flatten any deeper listens into an array + var views_1 = []; + if (maybeChildSyncPoint) { + views_1 = maybeChildSyncPoint.getQueryViews(); + } + util_3.forEach(childMap, function (key, childViews) { + views_1 = views_1.concat(childViews); + }); + return views_1; + } + }); + }; + /** + * @param {!Array.} queries + * @private + */ + SyncTree.prototype.removeTags_ = function (queries) { + for (var j = 0; j < queries.length; ++j) { + var removedQuery = queries[j]; + if (!removedQuery.getQueryParams().loadsAllData()) { + // We should have a tag for this + var removedQueryKey = SyncTree.makeQueryKey_(removedQuery); + var removedQueryTag = this.queryToTagMap_[removedQueryKey]; + delete this.queryToTagMap_[removedQueryKey]; + delete this.tagToQueryMap_['_' + removedQueryTag]; + } + } + }; + /** + * Normalizes a query to a query we send the server for listening + * @param {!Query} query + * @return {!Query} The normalized query + * @private + */ + SyncTree.queryForListening_ = function (query) { + if (query.getQueryParams().loadsAllData() && + !query.getQueryParams().isDefault()) { + // We treat queries that load all data as default queries + // Cast is necessary because ref() technically returns Firebase which is actually fb.api.Firebase which inherits + // from Query + return /** @type {!Query} */ query.getRef(); + } + else { + return query; + } + }; + /** + * For a given new listen, manage the de-duplication of outstanding subscriptions. + * + * @param {!Query} query + * @param {!View} view + * @return {!Array.} This method can return events to support synchronous data sources + * @private + */ + SyncTree.prototype.setupListener_ = function (query, view) { + var path = query.path; + var tag = this.tagForQuery_(query); + var listener = this.createListenerForView_(view); + var events = this.listenProvider_.startListening(SyncTree.queryForListening_(query), tag, listener.hashFn, listener.onComplete); + var subtree = this.syncPointTree_.subtree(path); + // The root of this subtree has our query. We're here because we definitely need to send a listen for that, but we + // may need to shadow other listens as well. + if (tag) { + util_1.assert(!subtree.value.hasCompleteView(), "If we're adding a query, it shouldn't be shadowed"); + } + else { + // Shadow everything at or below this location, this is a default listener. + var queriesToStop = subtree.fold(function (relativePath, maybeChildSyncPoint, childMap) { + if (!relativePath.isEmpty() && + maybeChildSyncPoint && + maybeChildSyncPoint.hasCompleteView()) { + return [maybeChildSyncPoint.getCompleteView().getQuery()]; + } + else { + // No default listener here, flatten any deeper queries into an array + var queries_1 = []; + if (maybeChildSyncPoint) { + queries_1 = queries_1.concat(maybeChildSyncPoint.getQueryViews().map(function (view) { return view.getQuery(); })); + } + util_3.forEach(childMap, function (key, childQueries) { + queries_1 = queries_1.concat(childQueries); + }); + return queries_1; + } + }); + for (var i = 0; i < queriesToStop.length; ++i) { + var queryToStop = queriesToStop[i]; + this.listenProvider_.stopListening(SyncTree.queryForListening_(queryToStop), this.tagForQuery_(queryToStop)); + } + } + return events; + }; + /** + * + * @param {!View} view + * @return {{hashFn: function(), onComplete: function(!string, *)}} + * @private + */ + SyncTree.prototype.createListenerForView_ = function (view) { + var _this = this; + var query = view.getQuery(); + var tag = this.tagForQuery_(query); + return { + hashFn: function () { + var cache = view.getServerCache() || ChildrenNode_1.ChildrenNode.EMPTY_NODE; + return cache.hash(); + }, + onComplete: function (status) { + if (status === 'ok') { + if (tag) { + return _this.applyTaggedListenComplete(query.path, tag); + } + else { + return _this.applyListenComplete(query.path); + } + } + else { + // If a listen failed, kill all of the listeners here, not just the one that triggered the error. + // Note that this may need to be scoped to just this listener if we change permissions on filtered children + var error = util_2.errorForServerCode(status, query); + return _this.removeEventRegistration(query, + /*eventRegistration*/ null, error); + } + } + }; + }; + /** + * Given a query, computes a "queryKey" suitable for use in our queryToTagMap_. + * @private + * @param {!Query} query + * @return {string} + */ + SyncTree.makeQueryKey_ = function (query) { + return query.path.toString() + '$' + query.queryIdentifier(); + }; + /** + * Given a queryKey (created by makeQueryKey), parse it back into a path and queryId. + * @private + * @param {!string} queryKey + * @return {{queryId: !string, path: !Path}} + */ + SyncTree.parseQueryKey_ = function (queryKey) { + var splitIndex = queryKey.indexOf('$'); + util_1.assert(splitIndex !== -1 && splitIndex < queryKey.length - 1, 'Bad queryKey.'); + return { + queryId: queryKey.substr(splitIndex + 1), + path: new Path_1.Path(queryKey.substr(0, splitIndex)) + }; + }; + /** + * Return the query associated with the given tag, if we have one + * @param {!number} tag + * @return {?string} + * @private + */ + SyncTree.prototype.queryKeyForTag_ = function (tag) { + return this.tagToQueryMap_['_' + tag]; + }; + /** + * Return the tag associated with the given query. + * @param {!Query} query + * @return {?number} + * @private + */ + SyncTree.prototype.tagForQuery_ = function (query) { + var queryKey = SyncTree.makeQueryKey_(query); + return util_3.safeGet(this.queryToTagMap_, queryKey); + }; + /** + * Static accessor for query tags. + * @return {number} + * @private + */ + SyncTree.getNextQueryTag_ = function () { + return SyncTree.nextQueryTag_++; + }; + /** + * A helper method to apply tagged operations + * + * @param {!Path} queryPath + * @param {!Operation} operation + * @return {!Array.} + * @private + */ + SyncTree.prototype.applyTaggedOperation_ = function (queryPath, operation) { + var syncPoint = this.syncPointTree_.get(queryPath); + util_1.assert(syncPoint, "Missing sync point for query tag that we're tracking"); + var writesCache = this.pendingWriteTree_.childWrites(queryPath); + return syncPoint.applyOperation(operation, writesCache, + /*serverCache=*/ null); + }; + /** + * A helper method that visits all descendant and ancestor SyncPoints, applying the operation. + * + * NOTES: + * - Descendant SyncPoints will be visited first (since we raise events depth-first). + + * - We call applyOperation() on each SyncPoint passing three things: + * 1. A version of the Operation that has been made relative to the SyncPoint location. + * 2. A WriteTreeRef of any writes we have cached at the SyncPoint location. + * 3. A snapshot Node with cached server data, if we have it. + + * - We concatenate all of the events returned by each SyncPoint and return the result. + * + * @param {!Operation} operation + * @return {!Array.} + * @private + */ + SyncTree.prototype.applyOperationToSyncPoints_ = function (operation) { + return this.applyOperationHelper_(operation, this.syncPointTree_, + /*serverCache=*/ null, this.pendingWriteTree_.childWrites(Path_1.Path.Empty)); + }; + /** + * Recursive helper for applyOperationToSyncPoints_ + * + * @private + * @param {!Operation} operation + * @param {ImmutableTree.} syncPointTree + * @param {?Node} serverCache + * @param {!WriteTreeRef} writesCache + * @return {!Array.} + */ + SyncTree.prototype.applyOperationHelper_ = function (operation, syncPointTree, serverCache, writesCache) { + if (operation.path.isEmpty()) { + return this.applyOperationDescendantsHelper_(operation, syncPointTree, serverCache, writesCache); + } + else { + var syncPoint = syncPointTree.get(Path_1.Path.Empty); + // If we don't have cached server data, see if we can get it from this SyncPoint. + if (serverCache == null && syncPoint != null) { + serverCache = syncPoint.getCompleteServerCache(Path_1.Path.Empty); + } + var events = []; + var childName = operation.path.getFront(); + var childOperation = operation.operationForChild(childName); + var childTree = syncPointTree.children.get(childName); + if (childTree && childOperation) { + var childServerCache = serverCache + ? serverCache.getImmediateChild(childName) + : null; + var childWritesCache = writesCache.child(childName); + events = events.concat(this.applyOperationHelper_(childOperation, childTree, childServerCache, childWritesCache)); + } + if (syncPoint) { + events = events.concat(syncPoint.applyOperation(operation, writesCache, serverCache)); + } + return events; + } + }; + /** + * Recursive helper for applyOperationToSyncPoints_ + * + * @private + * @param {!Operation} operation + * @param {ImmutableTree.} syncPointTree + * @param {?Node} serverCache + * @param {!WriteTreeRef} writesCache + * @return {!Array.} + */ + SyncTree.prototype.applyOperationDescendantsHelper_ = function (operation, syncPointTree, serverCache, writesCache) { + var _this = this; + var syncPoint = syncPointTree.get(Path_1.Path.Empty); + // If we don't have cached server data, see if we can get it from this SyncPoint. + if (serverCache == null && syncPoint != null) { + serverCache = syncPoint.getCompleteServerCache(Path_1.Path.Empty); + } + var events = []; + syncPointTree.children.inorderTraversal(function (childName, childTree) { + var childServerCache = serverCache + ? serverCache.getImmediateChild(childName) + : null; + var childWritesCache = writesCache.child(childName); + var childOperation = operation.operationForChild(childName); + if (childOperation) { + events = events.concat(_this.applyOperationDescendantsHelper_(childOperation, childTree, childServerCache, childWritesCache)); + } + }); + if (syncPoint) { + events = events.concat(syncPoint.applyOperation(operation, writesCache, serverCache)); + } + return events; + }; + /** + * Static tracker for next query tag. + * @type {number} + * @private + */ + SyncTree.nextQueryTag_ = 1; + return SyncTree; +}()); +exports.SyncTree = SyncTree; + +//# sourceMappingURL=SyncTree.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/WriteTree.js": +/*!************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/WriteTree.js ***! + \************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var Path_1 = __webpack_require__(/*! ./util/Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +var CompoundWrite_1 = __webpack_require__(/*! ./CompoundWrite */ "./node_modules/@firebase/database/dist/cjs/src/core/CompoundWrite.js"); +var PriorityIndex_1 = __webpack_require__(/*! ./snap/indexes/PriorityIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PriorityIndex.js"); +var ChildrenNode_1 = __webpack_require__(/*! ./snap/ChildrenNode */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/ChildrenNode.js"); +/** + * WriteTree tracks all pending user-initiated writes and has methods to calculate the result of merging them + * with underlying server data (to create "event cache" data). Pending writes are added with addOverwrite() + * and addMerge(), and removed with removeWrite(). + * + * @constructor + */ +var WriteTree = /** @class */ (function () { + function WriteTree() { + /** + * A tree tracking the result of applying all visible writes. This does not include transactions with + * applyLocally=false or writes that are completely shadowed by other writes. + * + * @type {!CompoundWrite} + * @private + */ + this.visibleWrites_ = CompoundWrite_1.CompoundWrite.Empty; + /** + * A list of all pending writes, regardless of visibility and shadowed-ness. Used to calculate arbitrary + * sets of the changed data, such as hidden writes (from transactions) or changes with certain writes excluded (also + * used by transactions). + * + * @type {!Array.} + * @private + */ + this.allWrites_ = []; + this.lastWriteId_ = -1; + } + /** + * Create a new WriteTreeRef for the given path. For use with a new sync point at the given path. + * + * @param {!Path} path + * @return {!WriteTreeRef} + */ + WriteTree.prototype.childWrites = function (path) { + return new WriteTreeRef(path, this); + }; + /** + * Record a new overwrite from user code. + * + * @param {!Path} path + * @param {!Node} snap + * @param {!number} writeId + * @param {boolean=} visible This is set to false by some transactions. It should be excluded from event caches + */ + WriteTree.prototype.addOverwrite = function (path, snap, writeId, visible) { + util_2.assert(writeId > this.lastWriteId_, 'Stacking an older write on top of newer ones'); + if (visible === undefined) { + visible = true; + } + this.allWrites_.push({ + path: path, + snap: snap, + writeId: writeId, + visible: visible + }); + if (visible) { + this.visibleWrites_ = this.visibleWrites_.addWrite(path, snap); + } + this.lastWriteId_ = writeId; + }; + /** + * Record a new merge from user code. + * + * @param {!Path} path + * @param {!Object.} changedChildren + * @param {!number} writeId + */ + WriteTree.prototype.addMerge = function (path, changedChildren, writeId) { + util_2.assert(writeId > this.lastWriteId_, 'Stacking an older merge on top of newer ones'); + this.allWrites_.push({ + path: path, + children: changedChildren, + writeId: writeId, + visible: true + }); + this.visibleWrites_ = this.visibleWrites_.addWrites(path, changedChildren); + this.lastWriteId_ = writeId; + }; + /** + * @param {!number} writeId + * @return {?WriteRecord} + */ + WriteTree.prototype.getWrite = function (writeId) { + for (var i = 0; i < this.allWrites_.length; i++) { + var record = this.allWrites_[i]; + if (record.writeId === writeId) { + return record; + } + } + return null; + }; + /** + * Remove a write (either an overwrite or merge) that has been successfully acknowledge by the server. Recalculates + * the tree if necessary. We return true if it may have been visible, meaning views need to reevaluate. + * + * @param {!number} writeId + * @return {boolean} true if the write may have been visible (meaning we'll need to reevaluate / raise + * events as a result). + */ + WriteTree.prototype.removeWrite = function (writeId) { + // Note: disabling this check. It could be a transaction that preempted another transaction, and thus was applied + // out of order. + //const validClear = revert || this.allWrites_.length === 0 || writeId <= this.allWrites_[0].writeId; + //assert(validClear, "Either we don't have this write, or it's the first one in the queue"); + var _this = this; + var idx = this.allWrites_.findIndex(function (s) { + return s.writeId === writeId; + }); + util_2.assert(idx >= 0, 'removeWrite called with nonexistent writeId.'); + var writeToRemove = this.allWrites_[idx]; + this.allWrites_.splice(idx, 1); + var removedWriteWasVisible = writeToRemove.visible; + var removedWriteOverlapsWithOtherWrites = false; + var i = this.allWrites_.length - 1; + while (removedWriteWasVisible && i >= 0) { + var currentWrite = this.allWrites_[i]; + if (currentWrite.visible) { + if (i >= idx && + this.recordContainsPath_(currentWrite, writeToRemove.path)) { + // The removed write was completely shadowed by a subsequent write. + removedWriteWasVisible = false; + } + else if (writeToRemove.path.contains(currentWrite.path)) { + // Either we're covering some writes or they're covering part of us (depending on which came first). + removedWriteOverlapsWithOtherWrites = true; + } + } + i--; + } + if (!removedWriteWasVisible) { + return false; + } + else if (removedWriteOverlapsWithOtherWrites) { + // There's some shadowing going on. Just rebuild the visible writes from scratch. + this.resetTree_(); + return true; + } + else { + // There's no shadowing. We can safely just remove the write(s) from visibleWrites. + if (writeToRemove.snap) { + this.visibleWrites_ = this.visibleWrites_.removeWrite(writeToRemove.path); + } + else { + var children = writeToRemove.children; + util_1.forEach(children, function (childName) { + _this.visibleWrites_ = _this.visibleWrites_.removeWrite(writeToRemove.path.child(childName)); + }); + } + return true; + } + }; + /** + * Return a complete snapshot for the given path if there's visible write data at that path, else null. + * No server data is considered. + * + * @param {!Path} path + * @return {?Node} + */ + WriteTree.prototype.getCompleteWriteData = function (path) { + return this.visibleWrites_.getCompleteNode(path); + }; + /** + * Given optional, underlying server data, and an optional set of constraints (exclude some sets, include hidden + * writes), attempt to calculate a complete snapshot for the given path + * + * @param {!Path} treePath + * @param {?Node} completeServerCache + * @param {Array.=} writeIdsToExclude An optional set to be excluded + * @param {boolean=} includeHiddenWrites Defaults to false, whether or not to layer on writes with visible set to false + * @return {?Node} + */ + WriteTree.prototype.calcCompleteEventCache = function (treePath, completeServerCache, writeIdsToExclude, includeHiddenWrites) { + if (!writeIdsToExclude && !includeHiddenWrites) { + var shadowingNode = this.visibleWrites_.getCompleteNode(treePath); + if (shadowingNode != null) { + return shadowingNode; + } + else { + var subMerge = this.visibleWrites_.childCompoundWrite(treePath); + if (subMerge.isEmpty()) { + return completeServerCache; + } + else if (completeServerCache == null && + !subMerge.hasCompleteWrite(Path_1.Path.Empty)) { + // We wouldn't have a complete snapshot, since there's no underlying data and no complete shadow + return null; + } + else { + var layeredCache = completeServerCache || ChildrenNode_1.ChildrenNode.EMPTY_NODE; + return subMerge.apply(layeredCache); + } + } + } + else { + var merge = this.visibleWrites_.childCompoundWrite(treePath); + if (!includeHiddenWrites && merge.isEmpty()) { + return completeServerCache; + } + else { + // If the server cache is null, and we don't have a complete cache, we need to return null + if (!includeHiddenWrites && + completeServerCache == null && + !merge.hasCompleteWrite(Path_1.Path.Empty)) { + return null; + } + else { + var filter = function (write) { + return ((write.visible || includeHiddenWrites) && + (!writeIdsToExclude || + !~writeIdsToExclude.indexOf(write.writeId)) && + (write.path.contains(treePath) || treePath.contains(write.path))); + }; + var mergeAtPath = WriteTree.layerTree_(this.allWrites_, filter, treePath); + var layeredCache = completeServerCache || ChildrenNode_1.ChildrenNode.EMPTY_NODE; + return mergeAtPath.apply(layeredCache); + } + } + } + }; + /** + * With optional, underlying server data, attempt to return a children node of children that we have complete data for. + * Used when creating new views, to pre-fill their complete event children snapshot. + * + * @param {!Path} treePath + * @param {?ChildrenNode} completeServerChildren + * @return {!ChildrenNode} + */ + WriteTree.prototype.calcCompleteEventChildren = function (treePath, completeServerChildren) { + var completeChildren = ChildrenNode_1.ChildrenNode.EMPTY_NODE; + var topLevelSet = this.visibleWrites_.getCompleteNode(treePath); + if (topLevelSet) { + if (!topLevelSet.isLeafNode()) { + // we're shadowing everything. Return the children. + topLevelSet.forEachChild(PriorityIndex_1.PRIORITY_INDEX, function (childName, childSnap) { + completeChildren = completeChildren.updateImmediateChild(childName, childSnap); + }); + } + return completeChildren; + } + else if (completeServerChildren) { + // Layer any children we have on top of this + // We know we don't have a top-level set, so just enumerate existing children + var merge_1 = this.visibleWrites_.childCompoundWrite(treePath); + completeServerChildren.forEachChild(PriorityIndex_1.PRIORITY_INDEX, function (childName, childNode) { + var node = merge_1 + .childCompoundWrite(new Path_1.Path(childName)) + .apply(childNode); + completeChildren = completeChildren.updateImmediateChild(childName, node); + }); + // Add any complete children we have from the set + merge_1.getCompleteChildren().forEach(function (namedNode) { + completeChildren = completeChildren.updateImmediateChild(namedNode.name, namedNode.node); + }); + return completeChildren; + } + else { + // We don't have anything to layer on top of. Layer on any children we have + // Note that we can return an empty snap if we have a defined delete + var merge = this.visibleWrites_.childCompoundWrite(treePath); + merge.getCompleteChildren().forEach(function (namedNode) { + completeChildren = completeChildren.updateImmediateChild(namedNode.name, namedNode.node); + }); + return completeChildren; + } + }; + /** + * Given that the underlying server data has updated, determine what, if anything, needs to be + * applied to the event cache. + * + * Possibilities: + * + * 1. No writes are shadowing. Events should be raised, the snap to be applied comes from the server data + * + * 2. Some write is completely shadowing. No events to be raised + * + * 3. Is partially shadowed. Events + * + * Either existingEventSnap or existingServerSnap must exist + * + * @param {!Path} treePath + * @param {!Path} childPath + * @param {?Node} existingEventSnap + * @param {?Node} existingServerSnap + * @return {?Node} + */ + WriteTree.prototype.calcEventCacheAfterServerOverwrite = function (treePath, childPath, existingEventSnap, existingServerSnap) { + util_2.assert(existingEventSnap || existingServerSnap, 'Either existingEventSnap or existingServerSnap must exist'); + var path = treePath.child(childPath); + if (this.visibleWrites_.hasCompleteWrite(path)) { + // At this point we can probably guarantee that we're in case 2, meaning no events + // May need to check visibility while doing the findRootMostValueAndPath call + return null; + } + else { + // No complete shadowing. We're either partially shadowing or not shadowing at all. + var childMerge = this.visibleWrites_.childCompoundWrite(path); + if (childMerge.isEmpty()) { + // We're not shadowing at all. Case 1 + return existingServerSnap.getChild(childPath); + } + else { + // This could be more efficient if the serverNode + updates doesn't change the eventSnap + // However this is tricky to find out, since user updates don't necessary change the server + // snap, e.g. priority updates on empty nodes, or deep deletes. Another special case is if the server + // adds nodes, but doesn't change any existing writes. It is therefore not enough to + // only check if the updates change the serverNode. + // Maybe check if the merge tree contains these special cases and only do a full overwrite in that case? + return childMerge.apply(existingServerSnap.getChild(childPath)); + } + } + }; + /** + * Returns a complete child for a given server snap after applying all user writes or null if there is no + * complete child for this ChildKey. + * + * @param {!Path} treePath + * @param {!string} childKey + * @param {!CacheNode} existingServerSnap + * @return {?Node} + */ + WriteTree.prototype.calcCompleteChild = function (treePath, childKey, existingServerSnap) { + var path = treePath.child(childKey); + var shadowingNode = this.visibleWrites_.getCompleteNode(path); + if (shadowingNode != null) { + return shadowingNode; + } + else { + if (existingServerSnap.isCompleteForChild(childKey)) { + var childMerge = this.visibleWrites_.childCompoundWrite(path); + return childMerge.apply(existingServerSnap.getNode().getImmediateChild(childKey)); + } + else { + return null; + } + } + }; + /** + * Returns a node if there is a complete overwrite for this path. More specifically, if there is a write at + * a higher path, this will return the child of that write relative to the write and this path. + * Returns null if there is no write at this path. + * + * @param {!Path} path + * @return {?Node} + */ + WriteTree.prototype.shadowingWrite = function (path) { + return this.visibleWrites_.getCompleteNode(path); + }; + /** + * This method is used when processing child remove events on a query. If we can, we pull in children that were outside + * the window, but may now be in the window. + * + * @param {!Path} treePath + * @param {?Node} completeServerData + * @param {!NamedNode} startPost + * @param {!number} count + * @param {boolean} reverse + * @param {!Index} index + * @return {!Array.} + */ + WriteTree.prototype.calcIndexedSlice = function (treePath, completeServerData, startPost, count, reverse, index) { + var toIterate; + var merge = this.visibleWrites_.childCompoundWrite(treePath); + var shadowingNode = merge.getCompleteNode(Path_1.Path.Empty); + if (shadowingNode != null) { + toIterate = shadowingNode; + } + else if (completeServerData != null) { + toIterate = merge.apply(completeServerData); + } + else { + // no children to iterate on + return []; + } + toIterate = toIterate.withIndex(index); + if (!toIterate.isEmpty() && !toIterate.isLeafNode()) { + var nodes = []; + var cmp = index.getCompare(); + var iter = reverse + ? toIterate.getReverseIteratorFrom(startPost, index) + : toIterate.getIteratorFrom(startPost, index); + var next = iter.getNext(); + while (next && nodes.length < count) { + if (cmp(next, startPost) !== 0) { + nodes.push(next); + } + next = iter.getNext(); + } + return nodes; + } + else { + return []; + } + }; + /** + * @param {!WriteRecord} writeRecord + * @param {!Path} path + * @return {boolean} + * @private + */ + WriteTree.prototype.recordContainsPath_ = function (writeRecord, path) { + if (writeRecord.snap) { + return writeRecord.path.contains(path); + } + else { + // findKey can return undefined, so use !! to coerce to boolean + return !!util_1.findKey(writeRecord.children, function (childSnap, childName) { + return writeRecord.path.child(childName).contains(path); + }); + } + }; + /** + * Re-layer the writes and merges into a tree so we can efficiently calculate event snapshots + * @private + */ + WriteTree.prototype.resetTree_ = function () { + this.visibleWrites_ = WriteTree.layerTree_(this.allWrites_, WriteTree.DefaultFilter_, Path_1.Path.Empty); + if (this.allWrites_.length > 0) { + this.lastWriteId_ = this.allWrites_[this.allWrites_.length - 1].writeId; + } + else { + this.lastWriteId_ = -1; + } + }; + /** + * The default filter used when constructing the tree. Keep everything that's visible. + * + * @param {!WriteRecord} write + * @return {boolean} + * @private + */ + WriteTree.DefaultFilter_ = function (write) { + return write.visible; + }; + /** + * Static method. Given an array of WriteRecords, a filter for which ones to include, and a path, construct the tree of + * event data at that path. + * + * @param {!Array.} writes + * @param {!function(!WriteRecord):boolean} filter + * @param {!Path} treeRoot + * @return {!CompoundWrite} + * @private + */ + WriteTree.layerTree_ = function (writes, filter, treeRoot) { + var compoundWrite = CompoundWrite_1.CompoundWrite.Empty; + for (var i = 0; i < writes.length; ++i) { + var write = writes[i]; + // Theory, a later set will either: + // a) abort a relevant transaction, so no need to worry about excluding it from calculating that transaction + // b) not be relevant to a transaction (separate branch), so again will not affect the data for that transaction + if (filter(write)) { + var writePath = write.path; + var relativePath = void 0; + if (write.snap) { + if (treeRoot.contains(writePath)) { + relativePath = Path_1.Path.relativePath(treeRoot, writePath); + compoundWrite = compoundWrite.addWrite(relativePath, write.snap); + } + else if (writePath.contains(treeRoot)) { + relativePath = Path_1.Path.relativePath(writePath, treeRoot); + compoundWrite = compoundWrite.addWrite(Path_1.Path.Empty, write.snap.getChild(relativePath)); + } + else { + // There is no overlap between root path and write path, ignore write + } + } + else if (write.children) { + if (treeRoot.contains(writePath)) { + relativePath = Path_1.Path.relativePath(treeRoot, writePath); + compoundWrite = compoundWrite.addWrites(relativePath, write.children); + } + else if (writePath.contains(treeRoot)) { + relativePath = Path_1.Path.relativePath(writePath, treeRoot); + if (relativePath.isEmpty()) { + compoundWrite = compoundWrite.addWrites(Path_1.Path.Empty, write.children); + } + else { + var child = util_1.safeGet(write.children, relativePath.getFront()); + if (child) { + // There exists a child in this node that matches the root path + var deepNode = child.getChild(relativePath.popFront()); + compoundWrite = compoundWrite.addWrite(Path_1.Path.Empty, deepNode); + } + } + } + else { + // There is no overlap between root path and write path, ignore write + } + } + else { + throw util_2.assertionError('WriteRecord should have .snap or .children'); + } + } + } + return compoundWrite; + }; + return WriteTree; +}()); +exports.WriteTree = WriteTree; +/** + * A WriteTreeRef wraps a WriteTree and a path, for convenient access to a particular subtree. All of the methods + * just proxy to the underlying WriteTree. + * + * @constructor + */ +var WriteTreeRef = /** @class */ (function () { + /** + * @param {!Path} path + * @param {!WriteTree} writeTree + */ + function WriteTreeRef(path, writeTree) { + this.treePath_ = path; + this.writeTree_ = writeTree; + } + /** + * If possible, returns a complete event cache, using the underlying server data if possible. In addition, can be used + * to get a cache that includes hidden writes, and excludes arbitrary writes. Note that customizing the returned node + * can lead to a more expensive calculation. + * + * @param {?Node} completeServerCache + * @param {Array.=} writeIdsToExclude Optional writes to exclude. + * @param {boolean=} includeHiddenWrites Defaults to false, whether or not to layer on writes with visible set to false + * @return {?Node} + */ + WriteTreeRef.prototype.calcCompleteEventCache = function (completeServerCache, writeIdsToExclude, includeHiddenWrites) { + return this.writeTree_.calcCompleteEventCache(this.treePath_, completeServerCache, writeIdsToExclude, includeHiddenWrites); + }; + /** + * If possible, returns a children node containing all of the complete children we have data for. The returned data is a + * mix of the given server data and write data. + * + * @param {?ChildrenNode} completeServerChildren + * @return {!ChildrenNode} + */ + WriteTreeRef.prototype.calcCompleteEventChildren = function (completeServerChildren) { + return this.writeTree_.calcCompleteEventChildren(this.treePath_, completeServerChildren); + }; + /** + * Given that either the underlying server data has updated or the outstanding writes have updated, determine what, + * if anything, needs to be applied to the event cache. + * + * Possibilities: + * + * 1. No writes are shadowing. Events should be raised, the snap to be applied comes from the server data + * + * 2. Some write is completely shadowing. No events to be raised + * + * 3. Is partially shadowed. Events should be raised + * + * Either existingEventSnap or existingServerSnap must exist, this is validated via an assert + * + * @param {!Path} path + * @param {?Node} existingEventSnap + * @param {?Node} existingServerSnap + * @return {?Node} + */ + WriteTreeRef.prototype.calcEventCacheAfterServerOverwrite = function (path, existingEventSnap, existingServerSnap) { + return this.writeTree_.calcEventCacheAfterServerOverwrite(this.treePath_, path, existingEventSnap, existingServerSnap); + }; + /** + * Returns a node if there is a complete overwrite for this path. More specifically, if there is a write at + * a higher path, this will return the child of that write relative to the write and this path. + * Returns null if there is no write at this path. + * + * @param {!Path} path + * @return {?Node} + */ + WriteTreeRef.prototype.shadowingWrite = function (path) { + return this.writeTree_.shadowingWrite(this.treePath_.child(path)); + }; + /** + * This method is used when processing child remove events on a query. If we can, we pull in children that were outside + * the window, but may now be in the window + * + * @param {?Node} completeServerData + * @param {!NamedNode} startPost + * @param {!number} count + * @param {boolean} reverse + * @param {!Index} index + * @return {!Array.} + */ + WriteTreeRef.prototype.calcIndexedSlice = function (completeServerData, startPost, count, reverse, index) { + return this.writeTree_.calcIndexedSlice(this.treePath_, completeServerData, startPost, count, reverse, index); + }; + /** + * Returns a complete child for a given server snap after applying all user writes or null if there is no + * complete child for this ChildKey. + * + * @param {!string} childKey + * @param {!CacheNode} existingServerCache + * @return {?Node} + */ + WriteTreeRef.prototype.calcCompleteChild = function (childKey, existingServerCache) { + return this.writeTree_.calcCompleteChild(this.treePath_, childKey, existingServerCache); + }; + /** + * Return a WriteTreeRef for a child. + * + * @param {string} childName + * @return {!WriteTreeRef} + */ + WriteTreeRef.prototype.child = function (childName) { + return new WriteTreeRef(this.treePath_.child(childName), this.writeTree_); + }; + return WriteTreeRef; +}()); +exports.WriteTreeRef = WriteTreeRef; + +//# sourceMappingURL=WriteTree.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/operation/AckUserWrite.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/operation/AckUserWrite.js ***! + \*************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var Path_1 = __webpack_require__(/*! ../util/Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +var Operation_1 = __webpack_require__(/*! ./Operation */ "./node_modules/@firebase/database/dist/cjs/src/core/operation/Operation.js"); +var AckUserWrite = /** @class */ (function () { + /** + * + * @param {!Path} path + * @param {!ImmutableTree} affectedTree A tree containing true for each affected path. Affected paths can't overlap. + * @param {!boolean} revert + */ + function AckUserWrite( + /**@inheritDoc */ path, + /**@inheritDoc */ affectedTree, + /**@inheritDoc */ revert) { + this.path = path; + this.affectedTree = affectedTree; + this.revert = revert; + /** @inheritDoc */ + this.type = Operation_1.OperationType.ACK_USER_WRITE; + /** @inheritDoc */ + this.source = Operation_1.OperationSource.User; + } + /** + * @inheritDoc + */ + AckUserWrite.prototype.operationForChild = function (childName) { + if (!this.path.isEmpty()) { + util_1.assert(this.path.getFront() === childName, 'operationForChild called for unrelated child.'); + return new AckUserWrite(this.path.popFront(), this.affectedTree, this.revert); + } + else if (this.affectedTree.value != null) { + util_1.assert(this.affectedTree.children.isEmpty(), 'affectedTree should not have overlapping affected paths.'); + // All child locations are affected as well; just return same operation. + return this; + } + else { + var childTree = this.affectedTree.subtree(new Path_1.Path(childName)); + return new AckUserWrite(Path_1.Path.Empty, childTree, this.revert); + } + }; + return AckUserWrite; +}()); +exports.AckUserWrite = AckUserWrite; + +//# sourceMappingURL=AckUserWrite.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/operation/ListenComplete.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/operation/ListenComplete.js ***! + \***************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 Path_1 = __webpack_require__(/*! ../util/Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +var Operation_1 = __webpack_require__(/*! ./Operation */ "./node_modules/@firebase/database/dist/cjs/src/core/operation/Operation.js"); +/** + * @param {!OperationSource} source + * @param {!Path} path + * @constructor + * @implements {Operation} + */ +var ListenComplete = /** @class */ (function () { + function ListenComplete(source, path) { + this.source = source; + this.path = path; + /** @inheritDoc */ + this.type = Operation_1.OperationType.LISTEN_COMPLETE; + } + ListenComplete.prototype.operationForChild = function (childName) { + if (this.path.isEmpty()) { + return new ListenComplete(this.source, Path_1.Path.Empty); + } + else { + return new ListenComplete(this.source, this.path.popFront()); + } + }; + return ListenComplete; +}()); +exports.ListenComplete = ListenComplete; + +//# sourceMappingURL=ListenComplete.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/operation/Merge.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/operation/Merge.js ***! + \******************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 Operation_1 = __webpack_require__(/*! ./Operation */ "./node_modules/@firebase/database/dist/cjs/src/core/operation/Operation.js"); +var Overwrite_1 = __webpack_require__(/*! ./Overwrite */ "./node_modules/@firebase/database/dist/cjs/src/core/operation/Overwrite.js"); +var Path_1 = __webpack_require__(/*! ../util/Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +var util_1 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * @param {!OperationSource} source + * @param {!Path} path + * @param {!ImmutableTree.} children + * @constructor + * @implements {Operation} + */ +var Merge = /** @class */ (function () { + function Merge( + /**@inheritDoc */ source, + /**@inheritDoc */ path, + /**@inheritDoc */ children) { + this.source = source; + this.path = path; + this.children = children; + /** @inheritDoc */ + this.type = Operation_1.OperationType.MERGE; + } + /** + * @inheritDoc + */ + Merge.prototype.operationForChild = function (childName) { + if (this.path.isEmpty()) { + var childTree = this.children.subtree(new Path_1.Path(childName)); + if (childTree.isEmpty()) { + // This child is unaffected + return null; + } + else if (childTree.value) { + // We have a snapshot for the child in question. This becomes an overwrite of the child. + return new Overwrite_1.Overwrite(this.source, Path_1.Path.Empty, childTree.value); + } + else { + // This is a merge at a deeper level + return new Merge(this.source, Path_1.Path.Empty, childTree); + } + } + else { + util_1.assert(this.path.getFront() === childName, "Can't get a merge for a child not on the path of the operation"); + return new Merge(this.source, this.path.popFront(), this.children); + } + }; + /** + * @inheritDoc + */ + Merge.prototype.toString = function () { + return ('Operation(' + + this.path + + ': ' + + this.source.toString() + + ' merge: ' + + this.children.toString() + + ')'); + }; + return Merge; +}()); +exports.Merge = Merge; + +//# sourceMappingURL=Merge.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/operation/Operation.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/operation/Operation.js ***! + \**********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * + * @enum + */ +var OperationType; +(function (OperationType) { + OperationType[OperationType["OVERWRITE"] = 0] = "OVERWRITE"; + OperationType[OperationType["MERGE"] = 1] = "MERGE"; + OperationType[OperationType["ACK_USER_WRITE"] = 2] = "ACK_USER_WRITE"; + OperationType[OperationType["LISTEN_COMPLETE"] = 3] = "LISTEN_COMPLETE"; +})(OperationType = exports.OperationType || (exports.OperationType = {})); +/** + * @param {boolean} fromUser + * @param {boolean} fromServer + * @param {?string} queryId + * @param {boolean} tagged + * @constructor + */ +var OperationSource = /** @class */ (function () { + function OperationSource(fromUser, fromServer, queryId, tagged) { + this.fromUser = fromUser; + this.fromServer = fromServer; + this.queryId = queryId; + this.tagged = tagged; + util_1.assert(!tagged || fromServer, 'Tagged queries must be from server.'); + } + /** + * @const + * @type {!OperationSource} + */ + OperationSource.User = new OperationSource( + /*fromUser=*/ true, false, null, + /*tagged=*/ false); + /** + * @const + * @type {!OperationSource} + */ + OperationSource.Server = new OperationSource(false, + /*fromServer=*/ true, null, + /*tagged=*/ false); + /** + * @param {string} queryId + * @return {!OperationSource} + */ + OperationSource.forServerTaggedQuery = function (queryId) { + return new OperationSource(false, + /*fromServer=*/ true, queryId, + /*tagged=*/ true); + }; + return OperationSource; +}()); +exports.OperationSource = OperationSource; + +//# sourceMappingURL=Operation.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/operation/Overwrite.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/operation/Overwrite.js ***! + \**********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 Operation_1 = __webpack_require__(/*! ./Operation */ "./node_modules/@firebase/database/dist/cjs/src/core/operation/Operation.js"); +var Path_1 = __webpack_require__(/*! ../util/Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +/** + * @param {!OperationSource} source + * @param {!Path} path + * @param {!Node} snap + * @constructor + * @implements {Operation} + */ +var Overwrite = /** @class */ (function () { + function Overwrite(source, path, snap) { + this.source = source; + this.path = path; + this.snap = snap; + /** @inheritDoc */ + this.type = Operation_1.OperationType.OVERWRITE; + } + Overwrite.prototype.operationForChild = function (childName) { + if (this.path.isEmpty()) { + return new Overwrite(this.source, Path_1.Path.Empty, this.snap.getImmediateChild(childName)); + } + else { + return new Overwrite(this.source, this.path.popFront(), this.snap); + } + }; + return Overwrite; +}()); +exports.Overwrite = Overwrite; + +//# sourceMappingURL=Overwrite.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/snap/ChildrenNode.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/snap/ChildrenNode.js ***! + \********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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. + */ +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 __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var util_1 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! ../util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var SortedMap_1 = __webpack_require__(/*! ../util/SortedMap */ "./node_modules/@firebase/database/dist/cjs/src/core/util/SortedMap.js"); +var Node_1 = __webpack_require__(/*! ./Node */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/Node.js"); +var snap_1 = __webpack_require__(/*! ./snap */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/snap.js"); +var PriorityIndex_1 = __webpack_require__(/*! ./indexes/PriorityIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PriorityIndex.js"); +var KeyIndex_1 = __webpack_require__(/*! ./indexes/KeyIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/KeyIndex.js"); +var IndexMap_1 = __webpack_require__(/*! ./IndexMap */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/IndexMap.js"); +var LeafNode_1 = __webpack_require__(/*! ./LeafNode */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/LeafNode.js"); +var comparators_1 = __webpack_require__(/*! ./comparators */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/comparators.js"); +// TODO: For memory savings, don't store priorityNode_ if it's empty. +var EMPTY_NODE; +/** + * ChildrenNode is a class for storing internal nodes in a DataSnapshot + * (i.e. nodes with children). It implements Node and stores the + * list of children in the children property, sorted by child name. + * + * @constructor + * @implements {Node} + */ +var ChildrenNode = /** @class */ (function () { + /** + * + * @param {!SortedMap.} children_ List of children + * of this node.. + * @param {?Node} priorityNode_ The priority of this node (as a snapshot node). + * @param {!IndexMap} indexMap_ + */ + function ChildrenNode(children_, priorityNode_, indexMap_) { + this.children_ = children_; + this.priorityNode_ = priorityNode_; + this.indexMap_ = indexMap_; + this.lazyHash_ = null; + /** + * Note: The only reason we allow null priority is for EMPTY_NODE, since we can't use + * EMPTY_NODE as the priority of EMPTY_NODE. We might want to consider making EMPTY_NODE its own + * class instead of an empty ChildrenNode. + */ + if (this.priorityNode_) { + snap_1.validatePriorityNode(this.priorityNode_); + } + if (this.children_.isEmpty()) { + util_1.assert(!this.priorityNode_ || this.priorityNode_.isEmpty(), 'An empty node cannot have a priority'); + } + } + Object.defineProperty(ChildrenNode, "EMPTY_NODE", { + get: function () { + return (EMPTY_NODE || + (EMPTY_NODE = new ChildrenNode(new SortedMap_1.SortedMap(comparators_1.NAME_COMPARATOR), null, IndexMap_1.IndexMap.Default))); + }, + enumerable: true, + configurable: true + }); + /** @inheritDoc */ + ChildrenNode.prototype.isLeafNode = function () { + return false; + }; + /** @inheritDoc */ + ChildrenNode.prototype.getPriority = function () { + return this.priorityNode_ || EMPTY_NODE; + }; + /** @inheritDoc */ + ChildrenNode.prototype.updatePriority = function (newPriorityNode) { + if (this.children_.isEmpty()) { + // Don't allow priorities on empty nodes + return this; + } + else { + return new ChildrenNode(this.children_, newPriorityNode, this.indexMap_); + } + }; + /** @inheritDoc */ + ChildrenNode.prototype.getImmediateChild = function (childName) { + // Hack to treat priority as a regular child + if (childName === '.priority') { + return this.getPriority(); + } + else { + var child = this.children_.get(childName); + return child === null ? EMPTY_NODE : child; + } + }; + /** @inheritDoc */ + ChildrenNode.prototype.getChild = function (path) { + var front = path.getFront(); + if (front === null) + return this; + return this.getImmediateChild(front).getChild(path.popFront()); + }; + /** @inheritDoc */ + ChildrenNode.prototype.hasChild = function (childName) { + return this.children_.get(childName) !== null; + }; + /** @inheritDoc */ + ChildrenNode.prototype.updateImmediateChild = function (childName, newChildNode) { + util_1.assert(newChildNode, 'We should always be passing snapshot nodes'); + if (childName === '.priority') { + return this.updatePriority(newChildNode); + } + else { + var namedNode = new Node_1.NamedNode(childName, newChildNode); + var newChildren = void 0, newIndexMap = void 0, newPriority = void 0; + if (newChildNode.isEmpty()) { + newChildren = this.children_.remove(childName); + newIndexMap = this.indexMap_.removeFromIndexes(namedNode, this.children_); + } + else { + newChildren = this.children_.insert(childName, newChildNode); + newIndexMap = this.indexMap_.addToIndexes(namedNode, this.children_); + } + newPriority = newChildren.isEmpty() ? EMPTY_NODE : this.priorityNode_; + return new ChildrenNode(newChildren, newPriority, newIndexMap); + } + }; + /** @inheritDoc */ + ChildrenNode.prototype.updateChild = function (path, newChildNode) { + var front = path.getFront(); + if (front === null) { + return newChildNode; + } + else { + util_1.assert(path.getFront() !== '.priority' || path.getLength() === 1, '.priority must be the last token in a path'); + var newImmediateChild = this.getImmediateChild(front).updateChild(path.popFront(), newChildNode); + return this.updateImmediateChild(front, newImmediateChild); + } + }; + /** @inheritDoc */ + ChildrenNode.prototype.isEmpty = function () { + return this.children_.isEmpty(); + }; + /** @inheritDoc */ + ChildrenNode.prototype.numChildren = function () { + return this.children_.count(); + }; + /** @inheritDoc */ + ChildrenNode.prototype.val = function (exportFormat) { + if (this.isEmpty()) + return null; + var obj = {}; + var numKeys = 0, maxKey = 0, allIntegerKeys = true; + this.forEachChild(PriorityIndex_1.PRIORITY_INDEX, function (key, childNode) { + obj[key] = childNode.val(exportFormat); + numKeys++; + if (allIntegerKeys && ChildrenNode.INTEGER_REGEXP_.test(key)) { + maxKey = Math.max(maxKey, Number(key)); + } + else { + allIntegerKeys = false; + } + }); + if (!exportFormat && allIntegerKeys && maxKey < 2 * numKeys) { + // convert to array. + var array = []; + for (var key in obj) + array[key] = obj[key]; + return array; + } + else { + if (exportFormat && !this.getPriority().isEmpty()) { + obj['.priority'] = this.getPriority().val(); + } + return obj; + } + }; + /** @inheritDoc */ + ChildrenNode.prototype.hash = function () { + if (this.lazyHash_ === null) { + var toHash_1 = ''; + if (!this.getPriority().isEmpty()) + toHash_1 += + 'priority:' + + snap_1.priorityHashText(this.getPriority().val()) + + ':'; + this.forEachChild(PriorityIndex_1.PRIORITY_INDEX, function (key, childNode) { + var childHash = childNode.hash(); + if (childHash !== '') + toHash_1 += ':' + key + ':' + childHash; + }); + this.lazyHash_ = toHash_1 === '' ? '' : util_2.sha1(toHash_1); + } + return this.lazyHash_; + }; + /** @inheritDoc */ + ChildrenNode.prototype.getPredecessorChildName = function (childName, childNode, index) { + var idx = this.resolveIndex_(index); + if (idx) { + var predecessor = idx.getPredecessorKey(new Node_1.NamedNode(childName, childNode)); + return predecessor ? predecessor.name : null; + } + else { + return this.children_.getPredecessorKey(childName); + } + }; + /** + * @param {!Index} indexDefinition + * @return {?string} + */ + ChildrenNode.prototype.getFirstChildName = function (indexDefinition) { + var idx = this.resolveIndex_(indexDefinition); + if (idx) { + var minKey = idx.minKey(); + return minKey && minKey.name; + } + else { + return this.children_.minKey(); + } + }; + /** + * @param {!Index} indexDefinition + * @return {?NamedNode} + */ + ChildrenNode.prototype.getFirstChild = function (indexDefinition) { + var minKey = this.getFirstChildName(indexDefinition); + if (minKey) { + return new Node_1.NamedNode(minKey, this.children_.get(minKey)); + } + else { + return null; + } + }; + /** + * Given an index, return the key name of the largest value we have, according to that index + * @param {!Index} indexDefinition + * @return {?string} + */ + ChildrenNode.prototype.getLastChildName = function (indexDefinition) { + var idx = this.resolveIndex_(indexDefinition); + if (idx) { + var maxKey = idx.maxKey(); + return maxKey && maxKey.name; + } + else { + return this.children_.maxKey(); + } + }; + /** + * @param {!Index} indexDefinition + * @return {?NamedNode} + */ + ChildrenNode.prototype.getLastChild = function (indexDefinition) { + var maxKey = this.getLastChildName(indexDefinition); + if (maxKey) { + return new Node_1.NamedNode(maxKey, this.children_.get(maxKey)); + } + else { + return null; + } + }; + /** + * @inheritDoc + */ + ChildrenNode.prototype.forEachChild = function (index, action) { + var idx = this.resolveIndex_(index); + if (idx) { + return idx.inorderTraversal(function (wrappedNode) { + return action(wrappedNode.name, wrappedNode.node); + }); + } + else { + return this.children_.inorderTraversal(action); + } + }; + /** + * @param {!Index} indexDefinition + * @return {SortedMapIterator} + */ + ChildrenNode.prototype.getIterator = function (indexDefinition) { + return this.getIteratorFrom(indexDefinition.minPost(), indexDefinition); + }; + /** + * + * @param {!NamedNode} startPost + * @param {!Index} indexDefinition + * @return {!SortedMapIterator} + */ + ChildrenNode.prototype.getIteratorFrom = function (startPost, indexDefinition) { + var idx = this.resolveIndex_(indexDefinition); + if (idx) { + return idx.getIteratorFrom(startPost, function (key) { return key; }); + } + else { + var iterator = this.children_.getIteratorFrom(startPost.name, Node_1.NamedNode.Wrap); + var next = iterator.peek(); + while (next != null && indexDefinition.compare(next, startPost) < 0) { + iterator.getNext(); + next = iterator.peek(); + } + return iterator; + } + }; + /** + * @param {!Index} indexDefinition + * @return {!SortedMapIterator} + */ + ChildrenNode.prototype.getReverseIterator = function (indexDefinition) { + return this.getReverseIteratorFrom(indexDefinition.maxPost(), indexDefinition); + }; + /** + * @param {!NamedNode} endPost + * @param {!Index} indexDefinition + * @return {!SortedMapIterator} + */ + ChildrenNode.prototype.getReverseIteratorFrom = function (endPost, indexDefinition) { + var idx = this.resolveIndex_(indexDefinition); + if (idx) { + return idx.getReverseIteratorFrom(endPost, function (key) { + return key; + }); + } + else { + var iterator = this.children_.getReverseIteratorFrom(endPost.name, Node_1.NamedNode.Wrap); + var next = iterator.peek(); + while (next != null && indexDefinition.compare(next, endPost) > 0) { + iterator.getNext(); + next = iterator.peek(); + } + return iterator; + } + }; + /** + * @inheritDoc + */ + ChildrenNode.prototype.compareTo = function (other) { + if (this.isEmpty()) { + if (other.isEmpty()) { + return 0; + } + else { + return -1; + } + } + else if (other.isLeafNode() || other.isEmpty()) { + return 1; + } + else if (other === exports.MAX_NODE) { + return -1; + } + else { + // Must be another node with children. + return 0; + } + }; + /** + * @inheritDoc + */ + ChildrenNode.prototype.withIndex = function (indexDefinition) { + if (indexDefinition === KeyIndex_1.KEY_INDEX || + this.indexMap_.hasIndex(indexDefinition)) { + return this; + } + else { + var newIndexMap = this.indexMap_.addIndex(indexDefinition, this.children_); + return new ChildrenNode(this.children_, this.priorityNode_, newIndexMap); + } + }; + /** + * @inheritDoc + */ + ChildrenNode.prototype.isIndexed = function (index) { + return index === KeyIndex_1.KEY_INDEX || this.indexMap_.hasIndex(index); + }; + /** + * @inheritDoc + */ + ChildrenNode.prototype.equals = function (other) { + if (other === this) { + return true; + } + else if (other.isLeafNode()) { + return false; + } + else { + var otherChildrenNode = other; + if (!this.getPriority().equals(otherChildrenNode.getPriority())) { + return false; + } + else if (this.children_.count() === otherChildrenNode.children_.count()) { + var thisIter = this.getIterator(PriorityIndex_1.PRIORITY_INDEX); + var otherIter = otherChildrenNode.getIterator(PriorityIndex_1.PRIORITY_INDEX); + var thisCurrent = thisIter.getNext(); + var otherCurrent = otherIter.getNext(); + while (thisCurrent && otherCurrent) { + if (thisCurrent.name !== otherCurrent.name || + !thisCurrent.node.equals(otherCurrent.node)) { + return false; + } + thisCurrent = thisIter.getNext(); + otherCurrent = otherIter.getNext(); + } + return thisCurrent === null && otherCurrent === null; + } + else { + return false; + } + } + }; + /** + * Returns a SortedMap ordered by index, or null if the default (by-key) ordering can be used + * instead. + * + * @private + * @param {!Index} indexDefinition + * @return {?SortedMap.} + */ + ChildrenNode.prototype.resolveIndex_ = function (indexDefinition) { + if (indexDefinition === KeyIndex_1.KEY_INDEX) { + return null; + } + else { + return this.indexMap_.get(indexDefinition.toString()); + } + }; + /** + * @private + * @type {RegExp} + */ + ChildrenNode.INTEGER_REGEXP_ = /^(0|[1-9]\d*)$/; + return ChildrenNode; +}()); +exports.ChildrenNode = ChildrenNode; +/** + * @constructor + * @extends {ChildrenNode} + * @private + */ +var MaxNode = /** @class */ (function (_super) { + __extends(MaxNode, _super); + function MaxNode() { + return _super.call(this, new SortedMap_1.SortedMap(comparators_1.NAME_COMPARATOR), ChildrenNode.EMPTY_NODE, IndexMap_1.IndexMap.Default) || this; + } + MaxNode.prototype.compareTo = function (other) { + if (other === this) { + return 0; + } + else { + return 1; + } + }; + MaxNode.prototype.equals = function (other) { + // Not that we every compare it, but MAX_NODE is only ever equal to itself + return other === this; + }; + MaxNode.prototype.getPriority = function () { + return this; + }; + MaxNode.prototype.getImmediateChild = function (childName) { + return ChildrenNode.EMPTY_NODE; + }; + MaxNode.prototype.isEmpty = function () { + return false; + }; + return MaxNode; +}(ChildrenNode)); +exports.MaxNode = MaxNode; +/** + * Marker that will sort higher than any other snapshot. + * @type {!MAX_NODE} + * @const + */ +exports.MAX_NODE = new MaxNode(); +Object.defineProperties(Node_1.NamedNode, { + MIN: { + value: new Node_1.NamedNode(util_2.MIN_NAME, ChildrenNode.EMPTY_NODE) + }, + MAX: { + value: new Node_1.NamedNode(util_2.MAX_NAME, exports.MAX_NODE) + } +}); +/** + * Reference Extensions + */ +KeyIndex_1.KeyIndex.__EMPTY_NODE = ChildrenNode.EMPTY_NODE; +LeafNode_1.LeafNode.__childrenNodeConstructor = ChildrenNode; +snap_1.setMaxNode(exports.MAX_NODE); +PriorityIndex_1.setMaxNode(exports.MAX_NODE); + +//# sourceMappingURL=ChildrenNode.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/snap/IndexMap.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/snap/IndexMap.js ***! + \****************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var childSet_1 = __webpack_require__(/*! ./childSet */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/childSet.js"); +var util_2 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var Node_1 = __webpack_require__(/*! ./Node */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/Node.js"); +var PriorityIndex_1 = __webpack_require__(/*! ./indexes/PriorityIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PriorityIndex.js"); +var KeyIndex_1 = __webpack_require__(/*! ./indexes/KeyIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/KeyIndex.js"); +var _defaultIndexMap; +var fallbackObject = {}; +/** + * + * @param {Object.>} indexes + * @param {Object.} indexSet + * @constructor + */ +var IndexMap = /** @class */ (function () { + function IndexMap(indexes_, indexSet_) { + this.indexes_ = indexes_; + this.indexSet_ = indexSet_; + } + Object.defineProperty(IndexMap, "Default", { + /** + * The default IndexMap for nodes without a priority + * @type {!IndexMap} + * @const + */ + get: function () { + util_1.assert(fallbackObject && PriorityIndex_1.PRIORITY_INDEX, 'ChildrenNode.ts has not been loaded'); + _defaultIndexMap = + _defaultIndexMap || + new IndexMap({ '.priority': fallbackObject }, { '.priority': PriorityIndex_1.PRIORITY_INDEX }); + return _defaultIndexMap; + }, + enumerable: true, + configurable: true + }); + /** + * + * @param {!string} indexKey + * @return {?SortedMap.} + */ + IndexMap.prototype.get = function (indexKey) { + var sortedMap = util_2.safeGet(this.indexes_, indexKey); + if (!sortedMap) + throw new Error('No index defined for ' + indexKey); + if (sortedMap === fallbackObject) { + // The index exists, but it falls back to just name comparison. Return null so that the calling code uses the + // regular child map + return null; + } + else { + return sortedMap; + } + }; + /** + * @param {!Index} indexDefinition + * @return {boolean} + */ + IndexMap.prototype.hasIndex = function (indexDefinition) { + return util_2.contains(this.indexSet_, indexDefinition.toString()); + }; + /** + * @param {!Index} indexDefinition + * @param {!SortedMap.} existingChildren + * @return {!IndexMap} + */ + IndexMap.prototype.addIndex = function (indexDefinition, existingChildren) { + util_1.assert(indexDefinition !== KeyIndex_1.KEY_INDEX, "KeyIndex always exists and isn't meant to be added to the IndexMap."); + var childList = []; + var sawIndexedValue = false; + var iter = existingChildren.getIterator(Node_1.NamedNode.Wrap); + var next = iter.getNext(); + while (next) { + sawIndexedValue = + sawIndexedValue || indexDefinition.isDefinedOn(next.node); + childList.push(next); + next = iter.getNext(); + } + var newIndex; + if (sawIndexedValue) { + newIndex = childSet_1.buildChildSet(childList, indexDefinition.getCompare()); + } + else { + newIndex = fallbackObject; + } + var indexName = indexDefinition.toString(); + var newIndexSet = util_2.clone(this.indexSet_); + newIndexSet[indexName] = indexDefinition; + var newIndexes = util_2.clone(this.indexes_); + newIndexes[indexName] = newIndex; + return new IndexMap(newIndexes, newIndexSet); + }; + /** + * Ensure that this node is properly tracked in any indexes that we're maintaining + * @param {!NamedNode} namedNode + * @param {!SortedMap.} existingChildren + * @return {!IndexMap} + */ + IndexMap.prototype.addToIndexes = function (namedNode, existingChildren) { + var _this = this; + var newIndexes = util_2.map(this.indexes_, function (indexedChildren, indexName) { + var index = util_2.safeGet(_this.indexSet_, indexName); + util_1.assert(index, 'Missing index implementation for ' + indexName); + if (indexedChildren === fallbackObject) { + // Check to see if we need to index everything + if (index.isDefinedOn(namedNode.node)) { + // We need to build this index + var childList = []; + var iter = existingChildren.getIterator(Node_1.NamedNode.Wrap); + var next = iter.getNext(); + while (next) { + if (next.name != namedNode.name) { + childList.push(next); + } + next = iter.getNext(); + } + childList.push(namedNode); + return childSet_1.buildChildSet(childList, index.getCompare()); + } + else { + // No change, this remains a fallback + return fallbackObject; + } + } + else { + var existingSnap = existingChildren.get(namedNode.name); + var newChildren = indexedChildren; + if (existingSnap) { + newChildren = newChildren.remove(new Node_1.NamedNode(namedNode.name, existingSnap)); + } + return newChildren.insert(namedNode, namedNode.node); + } + }); + return new IndexMap(newIndexes, this.indexSet_); + }; + /** + * Create a new IndexMap instance with the given value removed + * @param {!NamedNode} namedNode + * @param {!SortedMap.} existingChildren + * @return {!IndexMap} + */ + IndexMap.prototype.removeFromIndexes = function (namedNode, existingChildren) { + var newIndexes = util_2.map(this.indexes_, function (indexedChildren) { + if (indexedChildren === fallbackObject) { + // This is the fallback. Just return it, nothing to do in this case + return indexedChildren; + } + else { + var existingSnap = existingChildren.get(namedNode.name); + if (existingSnap) { + return indexedChildren.remove(new Node_1.NamedNode(namedNode.name, existingSnap)); + } + else { + // No record of this child + return indexedChildren; + } + } + }); + return new IndexMap(newIndexes, this.indexSet_); + }; + return IndexMap; +}()); +exports.IndexMap = IndexMap; + +//# sourceMappingURL=IndexMap.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/snap/LeafNode.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/snap/LeafNode.js ***! + \****************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! ../util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var snap_1 = __webpack_require__(/*! ./snap */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/snap.js"); +var __childrenNodeConstructor; +/** + * LeafNode is a class for storing leaf nodes in a DataSnapshot. It + * implements Node and stores the value of the node (a string, + * number, or boolean) accessible via getValue(). + */ +var LeafNode = /** @class */ (function () { + /** + * @implements {Node} + * @param {!(string|number|boolean|Object)} value_ The value to store in this leaf node. + * The object type is possible in the event of a deferred value + * @param {!Node=} priorityNode_ The priority of this node. + */ + function LeafNode(value_, priorityNode_) { + if (priorityNode_ === void 0) { priorityNode_ = LeafNode.__childrenNodeConstructor.EMPTY_NODE; } + this.value_ = value_; + this.priorityNode_ = priorityNode_; + this.lazyHash_ = null; + util_1.assert(this.value_ !== undefined && this.value_ !== null, "LeafNode shouldn't be created with null/undefined value."); + snap_1.validatePriorityNode(this.priorityNode_); + } + Object.defineProperty(LeafNode, "__childrenNodeConstructor", { + get: function () { + return __childrenNodeConstructor; + }, + set: function (val) { + __childrenNodeConstructor = val; + }, + enumerable: true, + configurable: true + }); + /** @inheritDoc */ + LeafNode.prototype.isLeafNode = function () { + return true; + }; + /** @inheritDoc */ + LeafNode.prototype.getPriority = function () { + return this.priorityNode_; + }; + /** @inheritDoc */ + LeafNode.prototype.updatePriority = function (newPriorityNode) { + return new LeafNode(this.value_, newPriorityNode); + }; + /** @inheritDoc */ + LeafNode.prototype.getImmediateChild = function (childName) { + // Hack to treat priority as a regular child + if (childName === '.priority') { + return this.priorityNode_; + } + else { + return LeafNode.__childrenNodeConstructor.EMPTY_NODE; + } + }; + /** @inheritDoc */ + LeafNode.prototype.getChild = function (path) { + if (path.isEmpty()) { + return this; + } + else if (path.getFront() === '.priority') { + return this.priorityNode_; + } + else { + return LeafNode.__childrenNodeConstructor.EMPTY_NODE; + } + }; + /** + * @inheritDoc + */ + LeafNode.prototype.hasChild = function () { + return false; + }; + /** @inheritDoc */ + LeafNode.prototype.getPredecessorChildName = function (childName, childNode) { + return null; + }; + /** @inheritDoc */ + LeafNode.prototype.updateImmediateChild = function (childName, newChildNode) { + if (childName === '.priority') { + return this.updatePriority(newChildNode); + } + else if (newChildNode.isEmpty() && childName !== '.priority') { + return this; + } + else { + return LeafNode.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(childName, newChildNode).updatePriority(this.priorityNode_); + } + }; + /** @inheritDoc */ + LeafNode.prototype.updateChild = function (path, newChildNode) { + var front = path.getFront(); + if (front === null) { + return newChildNode; + } + else if (newChildNode.isEmpty() && front !== '.priority') { + return this; + } + else { + util_1.assert(front !== '.priority' || path.getLength() === 1, '.priority must be the last token in a path'); + return this.updateImmediateChild(front, LeafNode.__childrenNodeConstructor.EMPTY_NODE.updateChild(path.popFront(), newChildNode)); + } + }; + /** @inheritDoc */ + LeafNode.prototype.isEmpty = function () { + return false; + }; + /** @inheritDoc */ + LeafNode.prototype.numChildren = function () { + return 0; + }; + /** @inheritDoc */ + LeafNode.prototype.forEachChild = function (index, action) { + return false; + }; + /** + * @inheritDoc + */ + LeafNode.prototype.val = function (exportFormat) { + if (exportFormat && !this.getPriority().isEmpty()) + return { + '.value': this.getValue(), + '.priority': this.getPriority().val() + }; + else + return this.getValue(); + }; + /** @inheritDoc */ + LeafNode.prototype.hash = function () { + if (this.lazyHash_ === null) { + var toHash = ''; + if (!this.priorityNode_.isEmpty()) + toHash += + 'priority:' + + snap_1.priorityHashText(this.priorityNode_.val()) + + ':'; + var type = typeof this.value_; + toHash += type + ':'; + if (type === 'number') { + toHash += util_2.doubleToIEEE754String(this.value_); + } + else { + toHash += this.value_; + } + this.lazyHash_ = util_2.sha1(toHash); + } + return this.lazyHash_; + }; + /** + * Returns the value of the leaf node. + * @return {Object|string|number|boolean} The value of the node. + */ + LeafNode.prototype.getValue = function () { + return this.value_; + }; + /** + * @inheritDoc + */ + LeafNode.prototype.compareTo = function (other) { + if (other === LeafNode.__childrenNodeConstructor.EMPTY_NODE) { + return 1; + } + else if (other instanceof LeafNode.__childrenNodeConstructor) { + return -1; + } + else { + util_1.assert(other.isLeafNode(), 'Unknown node type'); + return this.compareToLeafNode_(other); + } + }; + /** + * Comparison specifically for two leaf nodes + * @param {!LeafNode} otherLeaf + * @return {!number} + * @private + */ + LeafNode.prototype.compareToLeafNode_ = function (otherLeaf) { + var otherLeafType = typeof otherLeaf.value_; + var thisLeafType = typeof this.value_; + var otherIndex = LeafNode.VALUE_TYPE_ORDER.indexOf(otherLeafType); + var thisIndex = LeafNode.VALUE_TYPE_ORDER.indexOf(thisLeafType); + util_1.assert(otherIndex >= 0, 'Unknown leaf type: ' + otherLeafType); + util_1.assert(thisIndex >= 0, 'Unknown leaf type: ' + thisLeafType); + if (otherIndex === thisIndex) { + // Same type, compare values + if (thisLeafType === 'object') { + // Deferred value nodes are all equal, but we should also never get to this point... + return 0; + } + else { + // Note that this works because true > false, all others are number or string comparisons + if (this.value_ < otherLeaf.value_) { + return -1; + } + else if (this.value_ === otherLeaf.value_) { + return 0; + } + else { + return 1; + } + } + } + else { + return thisIndex - otherIndex; + } + }; + /** + * @inheritDoc + */ + LeafNode.prototype.withIndex = function () { + return this; + }; + /** + * @inheritDoc + */ + LeafNode.prototype.isIndexed = function () { + return true; + }; + /** + * @inheritDoc + */ + LeafNode.prototype.equals = function (other) { + /** + * @inheritDoc + */ + if (other === this) { + return true; + } + else if (other.isLeafNode()) { + var otherLeaf = other; + return (this.value_ === otherLeaf.value_ && + this.priorityNode_.equals(otherLeaf.priorityNode_)); + } + else { + return false; + } + }; + /** + * The sort order for comparing leaf nodes of different types. If two leaf nodes have + * the same type, the comparison falls back to their value + * @type {Array.} + * @const + */ + LeafNode.VALUE_TYPE_ORDER = ['object', 'boolean', 'number', 'string']; + return LeafNode; +}()); +exports.LeafNode = LeafNode; + +//# sourceMappingURL=LeafNode.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/snap/Node.js": +/*!************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/snap/Node.js ***! + \************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 }); +/** + * + * @param {!string} name + * @param {!Node} node + * @constructor + * @struct + */ +var NamedNode = /** @class */ (function () { + function NamedNode(name, node) { + this.name = name; + this.node = node; + } + /** + * + * @param {!string} name + * @param {!Node} node + * @return {NamedNode} + */ + NamedNode.Wrap = function (name, node) { + return new NamedNode(name, node); + }; + return NamedNode; +}()); +exports.NamedNode = NamedNode; + +//# sourceMappingURL=Node.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/snap/childSet.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/snap/childSet.js ***! + \****************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 SortedMap_1 = __webpack_require__(/*! ../util/SortedMap */ "./node_modules/@firebase/database/dist/cjs/src/core/util/SortedMap.js"); +var SortedMap_2 = __webpack_require__(/*! ../util/SortedMap */ "./node_modules/@firebase/database/dist/cjs/src/core/util/SortedMap.js"); +var LOG_2 = Math.log(2); +/** + * @constructor + */ +var Base12Num = /** @class */ (function () { + /** + * @param {number} length + */ + function Base12Num(length) { + var logBase2 = function (num) { + return parseInt((Math.log(num) / LOG_2), 10); + }; + var bitMask = function (bits) { return parseInt(Array(bits + 1).join('1'), 2); }; + this.count = logBase2(length + 1); + this.current_ = this.count - 1; + var mask = bitMask(this.count); + this.bits_ = (length + 1) & mask; + } + /** + * @return {boolean} + */ + Base12Num.prototype.nextBitIsOne = function () { + //noinspection JSBitwiseOperatorUsage + var result = !(this.bits_ & (0x1 << this.current_)); + this.current_--; + return result; + }; + return Base12Num; +}()); +/** + * Takes a list of child nodes and constructs a SortedSet using the given comparison + * function + * + * Uses the algorithm described in the paper linked here: + * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.46.1458 + * + * @template K, V + * @param {Array.} childList Unsorted list of children + * @param {function(!NamedNode, !NamedNode):number} cmp The comparison method to be used + * @param {(function(NamedNode):K)=} keyFn An optional function to extract K from a node wrapper, if K's + * type is not NamedNode + * @param {(function(K, K):number)=} mapSortFn An optional override for comparator used by the generated sorted map + * @return {SortedMap.} + */ +exports.buildChildSet = function (childList, cmp, keyFn, mapSortFn) { + childList.sort(cmp); + var buildBalancedTree = function (low, high) { + var length = high - low; + var namedNode; + var key; + if (length == 0) { + return null; + } + else if (length == 1) { + namedNode = childList[low]; + key = keyFn ? keyFn(namedNode) : namedNode; + return new SortedMap_1.LLRBNode(key, namedNode.node, SortedMap_1.LLRBNode.BLACK, null, null); + } + else { + var middle = parseInt((length / 2), 10) + low; + var left = buildBalancedTree(low, middle); + var right = buildBalancedTree(middle + 1, high); + namedNode = childList[middle]; + key = keyFn ? keyFn(namedNode) : namedNode; + return new SortedMap_1.LLRBNode(key, namedNode.node, SortedMap_1.LLRBNode.BLACK, left, right); + } + }; + var buildFrom12Array = function (base12) { + var node = null; + var root = null; + var index = childList.length; + var buildPennant = function (chunkSize, color) { + var low = index - chunkSize; + var high = index; + index -= chunkSize; + var childTree = buildBalancedTree(low + 1, high); + var namedNode = childList[low]; + var key = keyFn ? keyFn(namedNode) : namedNode; + attachPennant(new SortedMap_1.LLRBNode(key, namedNode.node, color, null, childTree)); + }; + var attachPennant = function (pennant) { + if (node) { + node.left = pennant; + node = pennant; + } + else { + root = pennant; + node = pennant; + } + }; + for (var i = 0; i < base12.count; ++i) { + var isOne = base12.nextBitIsOne(); + // The number of nodes taken in each slice is 2^(arr.length - (i + 1)) + var chunkSize = Math.pow(2, base12.count - (i + 1)); + if (isOne) { + buildPennant(chunkSize, SortedMap_1.LLRBNode.BLACK); + } + else { + // current == 2 + buildPennant(chunkSize, SortedMap_1.LLRBNode.BLACK); + buildPennant(chunkSize, SortedMap_1.LLRBNode.RED); + } + } + return root; + }; + var base12 = new Base12Num(childList.length); + var root = buildFrom12Array(base12); + return new SortedMap_2.SortedMap(mapSortFn || cmp, root); +}; + +//# sourceMappingURL=childSet.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/snap/comparators.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/snap/comparators.js ***! + \*******************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! ../util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +function NAME_ONLY_COMPARATOR(left, right) { + return util_1.nameCompare(left.name, right.name); +} +exports.NAME_ONLY_COMPARATOR = NAME_ONLY_COMPARATOR; +function NAME_COMPARATOR(left, right) { + return util_1.nameCompare(left, right); +} +exports.NAME_COMPARATOR = NAME_COMPARATOR; + +//# sourceMappingURL=comparators.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/Index.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/Index.js ***! + \*********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 Node_1 = __webpack_require__(/*! ../Node */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/Node.js"); +var util_1 = __webpack_require__(/*! ../../util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +/** + * + * @constructor + */ +var Index = /** @class */ (function () { + function Index() { + } + /** + * @return {function(!NamedNode, !NamedNode):number} A standalone comparison function for + * this index + */ + Index.prototype.getCompare = function () { + return this.compare.bind(this); + }; + /** + * Given a before and after value for a node, determine if the indexed value has changed. Even if they are different, + * it's possible that the changes are isolated to parts of the snapshot that are not indexed. + * + * @param {!Node} oldNode + * @param {!Node} newNode + * @return {boolean} True if the portion of the snapshot being indexed changed between oldNode and newNode + */ + Index.prototype.indexedValueChanged = function (oldNode, newNode) { + var oldWrapped = new Node_1.NamedNode(util_1.MIN_NAME, oldNode); + var newWrapped = new Node_1.NamedNode(util_1.MIN_NAME, newNode); + return this.compare(oldWrapped, newWrapped) !== 0; + }; + /** + * @return {!NamedNode} a node wrapper that will sort equal to or less than + * any other node wrapper, using this index + */ + Index.prototype.minPost = function () { + return Node_1.NamedNode.MIN; + }; + return Index; +}()); +exports.Index = Index; + +//# sourceMappingURL=Index.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/KeyIndex.js": +/*!************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/KeyIndex.js ***! + \************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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. + */ +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 __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Index_1 = __webpack_require__(/*! ./Index */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/Index.js"); +var Node_1 = __webpack_require__(/*! ../Node */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/Node.js"); +var util_1 = __webpack_require__(/*! ../../util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var util_2 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var __EMPTY_NODE; +var KeyIndex = /** @class */ (function (_super) { + __extends(KeyIndex, _super); + function KeyIndex() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(KeyIndex, "__EMPTY_NODE", { + get: function () { + return __EMPTY_NODE; + }, + set: function (val) { + __EMPTY_NODE = val; + }, + enumerable: true, + configurable: true + }); + /** + * @inheritDoc + */ + KeyIndex.prototype.compare = function (a, b) { + return util_1.nameCompare(a.name, b.name); + }; + /** + * @inheritDoc + */ + KeyIndex.prototype.isDefinedOn = function (node) { + // We could probably return true here (since every node has a key), but it's never called + // so just leaving unimplemented for now. + throw util_2.assertionError('KeyIndex.isDefinedOn not expected to be called.'); + }; + /** + * @inheritDoc + */ + KeyIndex.prototype.indexedValueChanged = function (oldNode, newNode) { + return false; // The key for a node never changes. + }; + /** + * @inheritDoc + */ + KeyIndex.prototype.minPost = function () { + return Node_1.NamedNode.MIN; + }; + /** + * @inheritDoc + */ + KeyIndex.prototype.maxPost = function () { + // TODO: This should really be created once and cached in a static property, but + // NamedNode isn't defined yet, so I can't use it in a static. Bleh. + return new Node_1.NamedNode(util_1.MAX_NAME, __EMPTY_NODE); + }; + /** + * @param {*} indexValue + * @param {string} name + * @return {!NamedNode} + */ + KeyIndex.prototype.makePost = function (indexValue, name) { + util_2.assert(typeof indexValue === 'string', 'KeyIndex indexValue must always be a string.'); + // We just use empty node, but it'll never be compared, since our comparator only looks at name. + return new Node_1.NamedNode(indexValue, __EMPTY_NODE); + }; + /** + * @return {!string} String representation for inclusion in a query spec + */ + KeyIndex.prototype.toString = function () { + return '.key'; + }; + return KeyIndex; +}(Index_1.Index)); +exports.KeyIndex = KeyIndex; +exports.KEY_INDEX = new KeyIndex(); + +//# sourceMappingURL=KeyIndex.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PathIndex.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PathIndex.js ***! + \*************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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. + */ +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 __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var util_1 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! ../../util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var Index_1 = __webpack_require__(/*! ./Index */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/Index.js"); +var ChildrenNode_1 = __webpack_require__(/*! ../ChildrenNode */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/ChildrenNode.js"); +var Node_1 = __webpack_require__(/*! ../Node */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/Node.js"); +var nodeFromJSON_1 = __webpack_require__(/*! ../nodeFromJSON */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/nodeFromJSON.js"); +/** + * @param {!Path} indexPath + * @constructor + * @extends {Index} + */ +var PathIndex = /** @class */ (function (_super) { + __extends(PathIndex, _super); + function PathIndex(indexPath_) { + var _this = _super.call(this) || this; + _this.indexPath_ = indexPath_; + util_1.assert(!indexPath_.isEmpty() && indexPath_.getFront() !== '.priority', "Can't create PathIndex with empty path or .priority key"); + return _this; + } + /** + * @param {!Node} snap + * @return {!Node} + * @protected + */ + PathIndex.prototype.extractChild = function (snap) { + return snap.getChild(this.indexPath_); + }; + /** + * @inheritDoc + */ + PathIndex.prototype.isDefinedOn = function (node) { + return !node.getChild(this.indexPath_).isEmpty(); + }; + /** + * @inheritDoc + */ + PathIndex.prototype.compare = function (a, b) { + var aChild = this.extractChild(a.node); + var bChild = this.extractChild(b.node); + var indexCmp = aChild.compareTo(bChild); + if (indexCmp === 0) { + return util_2.nameCompare(a.name, b.name); + } + else { + return indexCmp; + } + }; + /** + * @inheritDoc + */ + PathIndex.prototype.makePost = function (indexValue, name) { + var valueNode = nodeFromJSON_1.nodeFromJSON(indexValue); + var node = ChildrenNode_1.ChildrenNode.EMPTY_NODE.updateChild(this.indexPath_, valueNode); + return new Node_1.NamedNode(name, node); + }; + /** + * @inheritDoc + */ + PathIndex.prototype.maxPost = function () { + var node = ChildrenNode_1.ChildrenNode.EMPTY_NODE.updateChild(this.indexPath_, ChildrenNode_1.MAX_NODE); + return new Node_1.NamedNode(util_2.MAX_NAME, node); + }; + /** + * @inheritDoc + */ + PathIndex.prototype.toString = function () { + return this.indexPath_.slice().join('/'); + }; + return PathIndex; +}(Index_1.Index)); +exports.PathIndex = PathIndex; + +//# sourceMappingURL=PathIndex.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PriorityIndex.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PriorityIndex.js ***! + \*****************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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. + */ +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 __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Index_1 = __webpack_require__(/*! ./Index */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/Index.js"); +var util_1 = __webpack_require__(/*! ../../util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var Node_1 = __webpack_require__(/*! ../Node */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/Node.js"); +var LeafNode_1 = __webpack_require__(/*! ../LeafNode */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/LeafNode.js"); +var nodeFromJSON; +var MAX_NODE; +function setNodeFromJSON(val) { + nodeFromJSON = val; +} +exports.setNodeFromJSON = setNodeFromJSON; +function setMaxNode(val) { + MAX_NODE = val; +} +exports.setMaxNode = setMaxNode; +/** + * @constructor + * @extends {Index} + * @private + */ +var PriorityIndex = /** @class */ (function (_super) { + __extends(PriorityIndex, _super); + function PriorityIndex() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * @inheritDoc + */ + PriorityIndex.prototype.compare = function (a, b) { + var aPriority = a.node.getPriority(); + var bPriority = b.node.getPriority(); + var indexCmp = aPriority.compareTo(bPriority); + if (indexCmp === 0) { + return util_1.nameCompare(a.name, b.name); + } + else { + return indexCmp; + } + }; + /** + * @inheritDoc + */ + PriorityIndex.prototype.isDefinedOn = function (node) { + return !node.getPriority().isEmpty(); + }; + /** + * @inheritDoc + */ + PriorityIndex.prototype.indexedValueChanged = function (oldNode, newNode) { + return !oldNode.getPriority().equals(newNode.getPriority()); + }; + /** + * @inheritDoc + */ + PriorityIndex.prototype.minPost = function () { + return Node_1.NamedNode.MIN; + }; + /** + * @inheritDoc + */ + PriorityIndex.prototype.maxPost = function () { + return new Node_1.NamedNode(util_1.MAX_NAME, new LeafNode_1.LeafNode('[PRIORITY-POST]', MAX_NODE)); + }; + /** + * @param {*} indexValue + * @param {string} name + * @return {!NamedNode} + */ + PriorityIndex.prototype.makePost = function (indexValue, name) { + var priorityNode = nodeFromJSON(indexValue); + return new Node_1.NamedNode(name, new LeafNode_1.LeafNode('[PRIORITY-POST]', priorityNode)); + }; + /** + * @return {!string} String representation for inclusion in a query spec + */ + PriorityIndex.prototype.toString = function () { + return '.priority'; + }; + return PriorityIndex; +}(Index_1.Index)); +exports.PriorityIndex = PriorityIndex; +exports.PRIORITY_INDEX = new PriorityIndex(); + +//# sourceMappingURL=PriorityIndex.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/ValueIndex.js": +/*!**************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/ValueIndex.js ***! + \**************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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. + */ +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 __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Index_1 = __webpack_require__(/*! ./Index */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/Index.js"); +var Node_1 = __webpack_require__(/*! ../Node */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/Node.js"); +var util_1 = __webpack_require__(/*! ../../util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var nodeFromJSON_1 = __webpack_require__(/*! ../nodeFromJSON */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/nodeFromJSON.js"); +/** + * @constructor + * @extends {Index} + * @private + */ +var ValueIndex = /** @class */ (function (_super) { + __extends(ValueIndex, _super); + function ValueIndex() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * @inheritDoc + */ + ValueIndex.prototype.compare = function (a, b) { + var indexCmp = a.node.compareTo(b.node); + if (indexCmp === 0) { + return util_1.nameCompare(a.name, b.name); + } + else { + return indexCmp; + } + }; + /** + * @inheritDoc + */ + ValueIndex.prototype.isDefinedOn = function (node) { + return true; + }; + /** + * @inheritDoc + */ + ValueIndex.prototype.indexedValueChanged = function (oldNode, newNode) { + return !oldNode.equals(newNode); + }; + /** + * @inheritDoc + */ + ValueIndex.prototype.minPost = function () { + return Node_1.NamedNode.MIN; + }; + /** + * @inheritDoc + */ + ValueIndex.prototype.maxPost = function () { + return Node_1.NamedNode.MAX; + }; + /** + * @param {*} indexValue + * @param {string} name + * @return {!NamedNode} + */ + ValueIndex.prototype.makePost = function (indexValue, name) { + var valueNode = nodeFromJSON_1.nodeFromJSON(indexValue); + return new Node_1.NamedNode(name, valueNode); + }; + /** + * @return {!string} String representation for inclusion in a query spec + */ + ValueIndex.prototype.toString = function () { + return '.value'; + }; + return ValueIndex; +}(Index_1.Index)); +exports.ValueIndex = ValueIndex; +exports.VALUE_INDEX = new ValueIndex(); + +//# sourceMappingURL=ValueIndex.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/snap/nodeFromJSON.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/snap/nodeFromJSON.js ***! + \********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 ChildrenNode_1 = __webpack_require__(/*! ./ChildrenNode */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/ChildrenNode.js"); +var LeafNode_1 = __webpack_require__(/*! ./LeafNode */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/LeafNode.js"); +var Node_1 = __webpack_require__(/*! ./Node */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/Node.js"); +var util_1 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var childSet_1 = __webpack_require__(/*! ./childSet */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/childSet.js"); +var comparators_1 = __webpack_require__(/*! ./comparators */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/comparators.js"); +var IndexMap_1 = __webpack_require__(/*! ./IndexMap */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/IndexMap.js"); +var PriorityIndex_1 = __webpack_require__(/*! ./indexes/PriorityIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PriorityIndex.js"); +var USE_HINZE = true; +/** + * Constructs a snapshot node representing the passed JSON and returns it. + * @param {*} json JSON to create a node for. + * @param {?string|?number=} priority Optional priority to use. This will be ignored if the + * passed JSON contains a .priority property. + * @return {!Node} + */ +function nodeFromJSON(json, priority) { + if (priority === void 0) { priority = null; } + if (json === null) { + return ChildrenNode_1.ChildrenNode.EMPTY_NODE; + } + if (typeof json === 'object' && '.priority' in json) { + priority = json['.priority']; + } + util_2.assert(priority === null || + typeof priority === 'string' || + typeof priority === 'number' || + (typeof priority === 'object' && '.sv' in priority), 'Invalid priority type found: ' + typeof priority); + if (typeof json === 'object' && '.value' in json && json['.value'] !== null) { + json = json['.value']; + } + // Valid leaf nodes include non-objects or server-value wrapper objects + if (typeof json !== 'object' || '.sv' in json) { + var jsonLeaf = json; + return new LeafNode_1.LeafNode(jsonLeaf, nodeFromJSON(priority)); + } + if (!(json instanceof Array) && USE_HINZE) { + var children_1 = []; + var childrenHavePriority_1 = false; + var hinzeJsonObj_1 = json; + util_1.forEach(hinzeJsonObj_1, function (key, child) { + if (typeof key !== 'string' || key.substring(0, 1) !== '.') { + // Ignore metadata nodes + var childNode = nodeFromJSON(hinzeJsonObj_1[key]); + if (!childNode.isEmpty()) { + childrenHavePriority_1 = + childrenHavePriority_1 || !childNode.getPriority().isEmpty(); + children_1.push(new Node_1.NamedNode(key, childNode)); + } + } + }); + if (children_1.length == 0) { + return ChildrenNode_1.ChildrenNode.EMPTY_NODE; + } + var childSet = childSet_1.buildChildSet(children_1, comparators_1.NAME_ONLY_COMPARATOR, function (namedNode) { return namedNode.name; }, comparators_1.NAME_COMPARATOR); + if (childrenHavePriority_1) { + var sortedChildSet = childSet_1.buildChildSet(children_1, PriorityIndex_1.PRIORITY_INDEX.getCompare()); + return new ChildrenNode_1.ChildrenNode(childSet, nodeFromJSON(priority), new IndexMap_1.IndexMap({ '.priority': sortedChildSet }, { '.priority': PriorityIndex_1.PRIORITY_INDEX })); + } + else { + return new ChildrenNode_1.ChildrenNode(childSet, nodeFromJSON(priority), IndexMap_1.IndexMap.Default); + } + } + else { + var node_1 = ChildrenNode_1.ChildrenNode.EMPTY_NODE; + var jsonObj_1 = json; + util_1.forEach(jsonObj_1, function (key, childData) { + if (util_1.contains(jsonObj_1, key)) { + if (key.substring(0, 1) !== '.') { + // ignore metadata nodes. + var childNode = nodeFromJSON(childData); + if (childNode.isLeafNode() || !childNode.isEmpty()) + node_1 = node_1.updateImmediateChild(key, childNode); + } + } + }); + return node_1.updatePriority(nodeFromJSON(priority)); + } +} +exports.nodeFromJSON = nodeFromJSON; +PriorityIndex_1.setNodeFromJSON(nodeFromJSON); + +//# sourceMappingURL=nodeFromJSON.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/snap/snap.js": +/*!************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/snap/snap.js ***! + \************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! ../util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var util_3 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var MAX_NODE; +function setMaxNode(val) { + MAX_NODE = val; +} +exports.setMaxNode = setMaxNode; +/** + * @param {(!string|!number)} priority + * @return {!string} + */ +exports.priorityHashText = function (priority) { + if (typeof priority === 'number') + return 'number:' + util_2.doubleToIEEE754String(priority); + else + return 'string:' + priority; +}; +/** + * Validates that a priority snapshot Node is valid. + * + * @param {!Node} priorityNode + */ +exports.validatePriorityNode = function (priorityNode) { + if (priorityNode.isLeafNode()) { + var val = priorityNode.val(); + util_1.assert(typeof val === 'string' || + typeof val === 'number' || + (typeof val === 'object' && util_3.contains(val, '.sv')), 'Priority must be a string or number.'); + } + else { + util_1.assert(priorityNode === MAX_NODE || priorityNode.isEmpty(), 'priority of unexpected type.'); + } + // Don't call getPriority() on MAX_NODE to avoid hitting assertion. + util_1.assert(priorityNode === MAX_NODE || priorityNode.getPriority().isEmpty(), "Priority nodes can't have a priority of their own."); +}; + +//# sourceMappingURL=snap.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/stats/StatsCollection.js": +/*!************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/stats/StatsCollection.js ***! + \************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * Tracks a collection of stats. + * + * @constructor + */ +var StatsCollection = /** @class */ (function () { + function StatsCollection() { + this.counters_ = {}; + } + StatsCollection.prototype.incrementCounter = function (name, amount) { + if (amount === void 0) { amount = 1; } + if (!util_2.contains(this.counters_, name)) + this.counters_[name] = 0; + this.counters_[name] += amount; + }; + StatsCollection.prototype.get = function () { + return util_1.deepCopy(this.counters_); + }; + return StatsCollection; +}()); +exports.StatsCollection = StatsCollection; + +//# sourceMappingURL=StatsCollection.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/stats/StatsListener.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/stats/StatsListener.js ***! + \**********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * Returns the delta from the previous call to get stats. + * + * @param collection_ The collection to "listen" to. + * @constructor + */ +var StatsListener = /** @class */ (function () { + function StatsListener(collection_) { + this.collection_ = collection_; + this.last_ = null; + } + StatsListener.prototype.get = function () { + var newStats = this.collection_.get(); + var delta = util_1.clone(newStats); + if (this.last_) { + util_1.forEach(this.last_, function (stat, value) { + delta[stat] = delta[stat] - value; + }); + } + this.last_ = newStats; + return delta; + }; + return StatsListener; +}()); +exports.StatsListener = StatsListener; + +//# sourceMappingURL=StatsListener.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/stats/StatsManager.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/stats/StatsManager.js ***! + \*********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 StatsCollection_1 = __webpack_require__(/*! ./StatsCollection */ "./node_modules/@firebase/database/dist/cjs/src/core/stats/StatsCollection.js"); +var StatsManager = /** @class */ (function () { + function StatsManager() { + } + StatsManager.getCollection = function (repoInfo) { + var hashString = repoInfo.toString(); + if (!this.collections_[hashString]) { + this.collections_[hashString] = new StatsCollection_1.StatsCollection(); + } + return this.collections_[hashString]; + }; + StatsManager.getOrCreateReporter = function (repoInfo, creatorFunction) { + var hashString = repoInfo.toString(); + if (!this.reporters_[hashString]) { + this.reporters_[hashString] = creatorFunction(); + } + return this.reporters_[hashString]; + }; + StatsManager.collections_ = {}; + StatsManager.reporters_ = {}; + return StatsManager; +}()); +exports.StatsManager = StatsManager; + +//# sourceMappingURL=StatsManager.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/stats/StatsReporter.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/stats/StatsReporter.js ***! + \**********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! ../util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var StatsListener_1 = __webpack_require__(/*! ./StatsListener */ "./node_modules/@firebase/database/dist/cjs/src/core/stats/StatsListener.js"); +// Assuming some apps may have a short amount of time on page, and a bulk of firebase operations probably +// happen on page load, we try to report our first set of stats pretty quickly, but we wait at least 10 +// seconds to try to ensure the Firebase connection is established / settled. +var FIRST_STATS_MIN_TIME = 10 * 1000; +var FIRST_STATS_MAX_TIME = 30 * 1000; +// We'll continue to report stats on average every 5 minutes. +var REPORT_STATS_INTERVAL = 5 * 60 * 1000; +/** + * @constructor + */ +var StatsReporter = /** @class */ (function () { + /** + * @param collection + * @param server_ + */ + function StatsReporter(collection, server_) { + this.server_ = server_; + this.statsToReport_ = {}; + this.statsListener_ = new StatsListener_1.StatsListener(collection); + var timeout = FIRST_STATS_MIN_TIME + + (FIRST_STATS_MAX_TIME - FIRST_STATS_MIN_TIME) * Math.random(); + util_2.setTimeoutNonBlocking(this.reportStats_.bind(this), Math.floor(timeout)); + } + StatsReporter.prototype.includeStat = function (stat) { + this.statsToReport_[stat] = true; + }; + StatsReporter.prototype.reportStats_ = function () { + var _this = this; + var stats = this.statsListener_.get(); + var reportedStats = {}; + var haveStatsToReport = false; + util_1.forEach(stats, function (stat, value) { + if (value > 0 && util_1.contains(_this.statsToReport_, stat)) { + reportedStats[stat] = value; + haveStatsToReport = true; + } + }); + if (haveStatsToReport) { + this.server_.reportStats(reportedStats); + } + // queue our next run. + util_2.setTimeoutNonBlocking(this.reportStats_.bind(this), Math.floor(Math.random() * 2 * REPORT_STATS_INTERVAL)); + }; + return StatsReporter; +}()); +exports.StatsReporter = StatsReporter; + +//# sourceMappingURL=StatsReporter.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/storage/DOMStorageWrapper.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/storage/DOMStorageWrapper.js ***! + \****************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * Wraps a DOM Storage object and: + * - automatically encode objects as JSON strings before storing them to allow us to store arbitrary types. + * - prefixes names with "firebase:" to avoid collisions with app data. + * + * We automatically (see storage.js) create two such wrappers, one for sessionStorage, + * and one for localStorage. + * + * @constructor + */ +var DOMStorageWrapper = /** @class */ (function () { + /** + * @param {Storage} domStorage_ The underlying storage object (e.g. localStorage or sessionStorage) + */ + function DOMStorageWrapper(domStorage_) { + this.domStorage_ = domStorage_; + // Use a prefix to avoid collisions with other stuff saved by the app. + this.prefix_ = 'firebase:'; + } + /** + * @param {string} key The key to save the value under + * @param {?Object} value The value being stored, or null to remove the key. + */ + DOMStorageWrapper.prototype.set = function (key, value) { + if (value == null) { + this.domStorage_.removeItem(this.prefixedName_(key)); + } + else { + this.domStorage_.setItem(this.prefixedName_(key), util_1.stringify(value)); + } + }; + /** + * @param {string} key + * @return {*} The value that was stored under this key, or null + */ + DOMStorageWrapper.prototype.get = function (key) { + var storedVal = this.domStorage_.getItem(this.prefixedName_(key)); + if (storedVal == null) { + return null; + } + else { + return util_1.jsonEval(storedVal); + } + }; + /** + * @param {string} key + */ + DOMStorageWrapper.prototype.remove = function (key) { + this.domStorage_.removeItem(this.prefixedName_(key)); + }; + /** + * @param {string} name + * @return {string} + */ + DOMStorageWrapper.prototype.prefixedName_ = function (name) { + return this.prefix_ + name; + }; + DOMStorageWrapper.prototype.toString = function () { + return this.domStorage_.toString(); + }; + return DOMStorageWrapper; +}()); +exports.DOMStorageWrapper = DOMStorageWrapper; + +//# sourceMappingURL=DOMStorageWrapper.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/storage/MemoryStorage.js": +/*!************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/storage/MemoryStorage.js ***! + \************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * An in-memory storage implementation that matches the API of DOMStorageWrapper + * (TODO: create interface for both to implement). + * + * @constructor + */ +var MemoryStorage = /** @class */ (function () { + function MemoryStorage() { + this.cache_ = {}; + this.isInMemoryStorage = true; + } + MemoryStorage.prototype.set = function (key, value) { + if (value == null) { + delete this.cache_[key]; + } + else { + this.cache_[key] = value; + } + }; + MemoryStorage.prototype.get = function (key) { + if (util_1.contains(this.cache_, key)) { + return this.cache_[key]; + } + return null; + }; + MemoryStorage.prototype.remove = function (key) { + delete this.cache_[key]; + }; + return MemoryStorage; +}()); +exports.MemoryStorage = MemoryStorage; + +//# sourceMappingURL=MemoryStorage.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/storage/storage.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/storage/storage.js ***! + \******************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 DOMStorageWrapper_1 = __webpack_require__(/*! ./DOMStorageWrapper */ "./node_modules/@firebase/database/dist/cjs/src/core/storage/DOMStorageWrapper.js"); +var MemoryStorage_1 = __webpack_require__(/*! ./MemoryStorage */ "./node_modules/@firebase/database/dist/cjs/src/core/storage/MemoryStorage.js"); +/** + * Helper to create a DOMStorageWrapper or else fall back to MemoryStorage. + * TODO: Once MemoryStorage and DOMStorageWrapper have a shared interface this method annotation should change + * to reflect this type + * + * @param {string} domStorageName Name of the underlying storage object + * (e.g. 'localStorage' or 'sessionStorage'). + * @return {?} Turning off type information until a common interface is defined. + */ +var createStoragefor = function (domStorageName) { + try { + // NOTE: just accessing "localStorage" or "window['localStorage']" may throw a security exception, + // so it must be inside the try/catch. + if (typeof window !== 'undefined' && + typeof window[domStorageName] !== 'undefined') { + // Need to test cache. Just because it's here doesn't mean it works + var domStorage = window[domStorageName]; + domStorage.setItem('firebase:sentinel', 'cache'); + domStorage.removeItem('firebase:sentinel'); + return new DOMStorageWrapper_1.DOMStorageWrapper(domStorage); + } + } + catch (e) { } + // Failed to create wrapper. Just return in-memory storage. + // TODO: log? + return new MemoryStorage_1.MemoryStorage(); +}; +/** A storage object that lasts across sessions */ +exports.PersistentStorage = createStoragefor('localStorage'); +/** A storage object that only lasts one session */ +exports.SessionStorage = createStoragefor('sessionStorage'); + +//# sourceMappingURL=storage.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/util/CountedSet.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/util/CountedSet.js ***! + \******************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * Implements a set with a count of elements. + * + * @template K, V + */ +var CountedSet = /** @class */ (function () { + function CountedSet() { + this.set = {}; + } + /** + * @param {!K} item + * @param {V} val + */ + CountedSet.prototype.add = function (item, val) { + this.set[item] = val !== null ? val : true; + }; + /** + * @param {!K} key + * @return {boolean} + */ + CountedSet.prototype.contains = function (key) { + return util_1.contains(this.set, key); + }; + /** + * @param {!K} item + * @return {V} + */ + CountedSet.prototype.get = function (item) { + return this.contains(item) ? this.set[item] : undefined; + }; + /** + * @param {!K} item + */ + CountedSet.prototype.remove = function (item) { + delete this.set[item]; + }; + /** + * Deletes everything in the set + */ + CountedSet.prototype.clear = function () { + this.set = {}; + }; + /** + * True if there's nothing in the set + * @return {boolean} + */ + CountedSet.prototype.isEmpty = function () { + return util_1.isEmpty(this.set); + }; + /** + * @return {number} The number of items in the set + */ + CountedSet.prototype.count = function () { + return util_1.getCount(this.set); + }; + /** + * Run a function on each k,v pair in the set + * @param {function(K, V)} fn + */ + CountedSet.prototype.each = function (fn) { + util_1.forEach(this.set, function (k, v) { return fn(k, v); }); + }; + /** + * Mostly for debugging + * @return {Array.} The keys present in this CountedSet + */ + CountedSet.prototype.keys = function () { + var keys = []; + util_1.forEach(this.set, function (k) { + keys.push(k); + }); + return keys; + }; + return CountedSet; +}()); +exports.CountedSet = CountedSet; + +//# sourceMappingURL=CountedSet.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/util/EventEmitter.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/util/EventEmitter.js ***! + \********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * Base class to be used if you want to emit events. Call the constructor with + * the set of allowed event names. + */ +var EventEmitter = /** @class */ (function () { + /** + * @param {!Array.} allowedEvents_ + */ + function EventEmitter(allowedEvents_) { + this.allowedEvents_ = allowedEvents_; + this.listeners_ = {}; + util_1.assert(Array.isArray(allowedEvents_) && allowedEvents_.length > 0, 'Requires a non-empty array'); + } + /** + * To be called by derived classes to trigger events. + * @param {!string} eventType + * @param {...*} var_args + */ + EventEmitter.prototype.trigger = function (eventType) { + var var_args = []; + for (var _i = 1; _i < arguments.length; _i++) { + var_args[_i - 1] = arguments[_i]; + } + if (Array.isArray(this.listeners_[eventType])) { + // Clone the list, since callbacks could add/remove listeners. + var listeners = this.listeners_[eventType].slice(); + for (var i = 0; i < listeners.length; i++) { + listeners[i].callback.apply(listeners[i].context, var_args); + } + } + }; + EventEmitter.prototype.on = function (eventType, callback, context) { + this.validateEventType_(eventType); + this.listeners_[eventType] = this.listeners_[eventType] || []; + this.listeners_[eventType].push({ callback: callback, context: context }); + var eventData = this.getInitialEvent(eventType); + if (eventData) { + callback.apply(context, eventData); + } + }; + EventEmitter.prototype.off = function (eventType, callback, context) { + this.validateEventType_(eventType); + var listeners = this.listeners_[eventType] || []; + for (var i = 0; i < listeners.length; i++) { + if (listeners[i].callback === callback && + (!context || context === listeners[i].context)) { + listeners.splice(i, 1); + return; + } + } + }; + EventEmitter.prototype.validateEventType_ = function (eventType) { + util_1.assert(this.allowedEvents_.find(function (et) { + return et === eventType; + }), 'Unknown event: ' + eventType); + }; + return EventEmitter; +}()); +exports.EventEmitter = EventEmitter; + +//# sourceMappingURL=EventEmitter.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/util/ImmutableTree.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/util/ImmutableTree.js ***! + \*********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 SortedMap_1 = __webpack_require__(/*! ./SortedMap */ "./node_modules/@firebase/database/dist/cjs/src/core/util/SortedMap.js"); +var Path_1 = __webpack_require__(/*! ./Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +var util_1 = __webpack_require__(/*! ./util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var util_2 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var emptyChildrenSingleton; +/** + * Singleton empty children collection. + * + * @const + * @type {!SortedMap.>} + */ +var EmptyChildren = function () { + if (!emptyChildrenSingleton) { + emptyChildrenSingleton = new SortedMap_1.SortedMap(util_1.stringCompare); + } + return emptyChildrenSingleton; +}; +/** + * A tree with immutable elements. + */ +var ImmutableTree = /** @class */ (function () { + /** + * @template T + * @param {?T} value + * @param {SortedMap.>=} children + */ + function ImmutableTree(value, children) { + if (children === void 0) { children = EmptyChildren(); } + this.value = value; + this.children = children; + } + /** + * @template T + * @param {!Object.} obj + * @return {!ImmutableTree.} + */ + ImmutableTree.fromObject = function (obj) { + var tree = ImmutableTree.Empty; + util_2.forEach(obj, function (childPath, childSnap) { + tree = tree.set(new Path_1.Path(childPath), childSnap); + }); + return tree; + }; + /** + * True if the value is empty and there are no children + * @return {boolean} + */ + ImmutableTree.prototype.isEmpty = function () { + return this.value === null && this.children.isEmpty(); + }; + /** + * Given a path and predicate, return the first node and the path to that node + * where the predicate returns true. + * + * TODO Do a perf test -- If we're creating a bunch of {path: value:} objects + * on the way back out, it may be better to pass down a pathSoFar obj. + * + * @param {!Path} relativePath The remainder of the path + * @param {function(T):boolean} predicate The predicate to satisfy to return a + * node + * @return {?{path:!Path, value:!T}} + */ + ImmutableTree.prototype.findRootMostMatchingPathAndValue = function (relativePath, predicate) { + if (this.value != null && predicate(this.value)) { + return { path: Path_1.Path.Empty, value: this.value }; + } + else { + if (relativePath.isEmpty()) { + return null; + } + else { + var front = relativePath.getFront(); + var child = this.children.get(front); + if (child !== null) { + var childExistingPathAndValue = child.findRootMostMatchingPathAndValue(relativePath.popFront(), predicate); + if (childExistingPathAndValue != null) { + var fullPath = new Path_1.Path(front).child(childExistingPathAndValue.path); + return { path: fullPath, value: childExistingPathAndValue.value }; + } + else { + return null; + } + } + else { + return null; + } + } + } + }; + /** + * Find, if it exists, the shortest subpath of the given path that points a defined + * value in the tree + * @param {!Path} relativePath + * @return {?{path: !Path, value: !T}} + */ + ImmutableTree.prototype.findRootMostValueAndPath = function (relativePath) { + return this.findRootMostMatchingPathAndValue(relativePath, function () { return true; }); + }; + /** + * @param {!Path} relativePath + * @return {!ImmutableTree.} The subtree at the given path + */ + ImmutableTree.prototype.subtree = function (relativePath) { + if (relativePath.isEmpty()) { + return this; + } + else { + var front = relativePath.getFront(); + var childTree = this.children.get(front); + if (childTree !== null) { + return childTree.subtree(relativePath.popFront()); + } + else { + return ImmutableTree.Empty; + } + } + }; + /** + * Sets a value at the specified path. + * + * @param {!Path} relativePath Path to set value at. + * @param {?T} toSet Value to set. + * @return {!ImmutableTree.} Resulting tree. + */ + ImmutableTree.prototype.set = function (relativePath, toSet) { + if (relativePath.isEmpty()) { + return new ImmutableTree(toSet, this.children); + } + else { + var front = relativePath.getFront(); + var child = this.children.get(front) || ImmutableTree.Empty; + var newChild = child.set(relativePath.popFront(), toSet); + var newChildren = this.children.insert(front, newChild); + return new ImmutableTree(this.value, newChildren); + } + }; + /** + * Removes the value at the specified path. + * + * @param {!Path} relativePath Path to value to remove. + * @return {!ImmutableTree.} Resulting tree. + */ + ImmutableTree.prototype.remove = function (relativePath) { + if (relativePath.isEmpty()) { + if (this.children.isEmpty()) { + return ImmutableTree.Empty; + } + else { + return new ImmutableTree(null, this.children); + } + } + else { + var front = relativePath.getFront(); + var child = this.children.get(front); + if (child) { + var newChild = child.remove(relativePath.popFront()); + var newChildren = void 0; + if (newChild.isEmpty()) { + newChildren = this.children.remove(front); + } + else { + newChildren = this.children.insert(front, newChild); + } + if (this.value === null && newChildren.isEmpty()) { + return ImmutableTree.Empty; + } + else { + return new ImmutableTree(this.value, newChildren); + } + } + else { + return this; + } + } + }; + /** + * Gets a value from the tree. + * + * @param {!Path} relativePath Path to get value for. + * @return {?T} Value at path, or null. + */ + ImmutableTree.prototype.get = function (relativePath) { + if (relativePath.isEmpty()) { + return this.value; + } + else { + var front = relativePath.getFront(); + var child = this.children.get(front); + if (child) { + return child.get(relativePath.popFront()); + } + else { + return null; + } + } + }; + /** + * Replace the subtree at the specified path with the given new tree. + * + * @param {!Path} relativePath Path to replace subtree for. + * @param {!ImmutableTree} newTree New tree. + * @return {!ImmutableTree} Resulting tree. + */ + ImmutableTree.prototype.setTree = function (relativePath, newTree) { + if (relativePath.isEmpty()) { + return newTree; + } + else { + var front = relativePath.getFront(); + var child = this.children.get(front) || ImmutableTree.Empty; + var newChild = child.setTree(relativePath.popFront(), newTree); + var newChildren = void 0; + if (newChild.isEmpty()) { + newChildren = this.children.remove(front); + } + else { + newChildren = this.children.insert(front, newChild); + } + return new ImmutableTree(this.value, newChildren); + } + }; + /** + * Performs a depth first fold on this tree. Transforms a tree into a single + * value, given a function that operates on the path to a node, an optional + * current value, and a map of child names to folded subtrees + * @template V + * @param {function(Path, ?T, Object.):V} fn + * @return {V} + */ + ImmutableTree.prototype.fold = function (fn) { + return this.fold_(Path_1.Path.Empty, fn); + }; + /** + * Recursive helper for public-facing fold() method + * @template V + * @param {!Path} pathSoFar + * @param {function(Path, ?T, Object.):V} fn + * @return {V} + * @private + */ + ImmutableTree.prototype.fold_ = function (pathSoFar, fn) { + var accum = {}; + this.children.inorderTraversal(function (childKey, childTree) { + accum[childKey] = childTree.fold_(pathSoFar.child(childKey), fn); + }); + return fn(pathSoFar, this.value, accum); + }; + /** + * Find the first matching value on the given path. Return the result of applying f to it. + * @template V + * @param {!Path} path + * @param {!function(!Path, !T):?V} f + * @return {?V} + */ + ImmutableTree.prototype.findOnPath = function (path, f) { + return this.findOnPath_(path, Path_1.Path.Empty, f); + }; + ImmutableTree.prototype.findOnPath_ = function (pathToFollow, pathSoFar, f) { + var result = this.value ? f(pathSoFar, this.value) : false; + if (result) { + return result; + } + else { + if (pathToFollow.isEmpty()) { + return null; + } + else { + var front = pathToFollow.getFront(); + var nextChild = this.children.get(front); + if (nextChild) { + return nextChild.findOnPath_(pathToFollow.popFront(), pathSoFar.child(front), f); + } + else { + return null; + } + } + } + }; + /** + * + * @param {!Path} path + * @param {!function(!Path, !T)} f + * @returns {!ImmutableTree.} + */ + ImmutableTree.prototype.foreachOnPath = function (path, f) { + return this.foreachOnPath_(path, Path_1.Path.Empty, f); + }; + ImmutableTree.prototype.foreachOnPath_ = function (pathToFollow, currentRelativePath, f) { + if (pathToFollow.isEmpty()) { + return this; + } + else { + if (this.value) { + f(currentRelativePath, this.value); + } + var front = pathToFollow.getFront(); + var nextChild = this.children.get(front); + if (nextChild) { + return nextChild.foreachOnPath_(pathToFollow.popFront(), currentRelativePath.child(front), f); + } + else { + return ImmutableTree.Empty; + } + } + }; + /** + * Calls the given function for each node in the tree that has a value. + * + * @param {function(!Path, !T)} f A function to be called with + * the path from the root of the tree to a node, and the value at that node. + * Called in depth-first order. + */ + ImmutableTree.prototype.foreach = function (f) { + this.foreach_(Path_1.Path.Empty, f); + }; + ImmutableTree.prototype.foreach_ = function (currentRelativePath, f) { + this.children.inorderTraversal(function (childName, childTree) { + childTree.foreach_(currentRelativePath.child(childName), f); + }); + if (this.value) { + f(currentRelativePath, this.value); + } + }; + /** + * + * @param {function(string, !T)} f + */ + ImmutableTree.prototype.foreachChild = function (f) { + this.children.inorderTraversal(function (childName, childTree) { + if (childTree.value) { + f(childName, childTree.value); + } + }); + }; + ImmutableTree.Empty = new ImmutableTree(null); + return ImmutableTree; +}()); +exports.ImmutableTree = ImmutableTree; + +//# sourceMappingURL=ImmutableTree.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/util/NextPushId.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/util/NextPushId.js ***! + \******************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * Fancy ID generator that creates 20-character string identifiers with the + * following properties: + * + * 1. They're based on timestamp so that they sort *after* any existing ids. + * 2. They contain 72-bits of random data after the timestamp so that IDs won't + * collide with other clients' IDs. + * 3. They sort *lexicographically* (so the timestamp is converted to characters + * that will sort properly). + * 4. They're monotonically increasing. Even if you generate more than one in + * the same timestamp, the latter ones will sort after the former ones. We do + * this by using the previous random bits but "incrementing" them by 1 (only + * in the case of a timestamp collision). + */ +exports.nextPushId = (function () { + // Modeled after base64 web-safe chars, but ordered by ASCII. + var PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; + // Timestamp of last push, used to prevent local collisions if you push twice + // in one ms. + var lastPushTime = 0; + // We generate 72-bits of randomness which get turned into 12 characters and + // appended to the timestamp to prevent collisions with other clients. We + // store the last characters we generated because in the event of a collision, + // we'll use those same characters except "incremented" by one. + var lastRandChars = []; + return function (now) { + var duplicateTime = now === lastPushTime; + lastPushTime = now; + var i; + var timeStampChars = new Array(8); + for (i = 7; i >= 0; i--) { + timeStampChars[i] = PUSH_CHARS.charAt(now % 64); + // NOTE: Can't use << here because javascript will convert to int and lose + // the upper bits. + now = Math.floor(now / 64); + } + util_1.assert(now === 0, 'Cannot push at time == 0'); + var id = timeStampChars.join(''); + if (!duplicateTime) { + for (i = 0; i < 12; i++) { + lastRandChars[i] = Math.floor(Math.random() * 64); + } + } + else { + // If the timestamp hasn't changed since last push, use the same random + // number, except incremented by 1. + for (i = 11; i >= 0 && lastRandChars[i] === 63; i--) { + lastRandChars[i] = 0; + } + lastRandChars[i]++; + } + for (i = 0; i < 12; i++) { + id += PUSH_CHARS.charAt(lastRandChars[i]); + } + util_1.assert(id.length === 20, 'nextPushId: Length should be 20.'); + return id; + }; +})(); + +//# sourceMappingURL=NextPushId.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/util/OnlineMonitor.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/util/OnlineMonitor.js ***! + \*********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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. + */ +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 __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var util_1 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var EventEmitter_1 = __webpack_require__(/*! ./EventEmitter */ "./node_modules/@firebase/database/dist/cjs/src/core/util/EventEmitter.js"); +var util_2 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * Monitors online state (as reported by window.online/offline events). + * + * The expectation is that this could have many false positives (thinks we are online + * when we're not), but no false negatives. So we can safely use it to determine when + * we definitely cannot reach the internet. + * + * @extends {EventEmitter} + */ +var OnlineMonitor = /** @class */ (function (_super) { + __extends(OnlineMonitor, _super); + function OnlineMonitor() { + var _this = _super.call(this, ['online']) || this; + _this.online_ = true; + // We've had repeated complaints that Cordova apps can get stuck "offline", e.g. + // https://forum.ionicframework.com/t/firebase-connection-is-lost-and-never-come-back/43810 + // It would seem that the 'online' event does not always fire consistently. So we disable it + // for Cordova. + if (typeof window !== 'undefined' && + typeof window.addEventListener !== 'undefined' && + !util_2.isMobileCordova()) { + window.addEventListener('online', function () { + if (!_this.online_) { + _this.online_ = true; + _this.trigger('online', true); + } + }, false); + window.addEventListener('offline', function () { + if (_this.online_) { + _this.online_ = false; + _this.trigger('online', false); + } + }, false); + } + return _this; + } + OnlineMonitor.getInstance = function () { + return new OnlineMonitor(); + }; + /** + * @param {!string} eventType + * @return {Array.} + */ + OnlineMonitor.prototype.getInitialEvent = function (eventType) { + util_1.assert(eventType === 'online', 'Unknown event type: ' + eventType); + return [this.online_]; + }; + /** + * @return {boolean} + */ + OnlineMonitor.prototype.currentlyOnline = function () { + return this.online_; + }; + return OnlineMonitor; +}(EventEmitter_1.EventEmitter)); +exports.OnlineMonitor = OnlineMonitor; + +//# sourceMappingURL=OnlineMonitor.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js": +/*!************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js ***! + \************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! ./util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var util_2 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * 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.} 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} + */ + 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} */ + 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 + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/util/ServerValues.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/util/ServerValues.js ***! + \********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var Path_1 = __webpack_require__(/*! ./Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +var SparseSnapshotTree_1 = __webpack_require__(/*! ../SparseSnapshotTree */ "./node_modules/@firebase/database/dist/cjs/src/core/SparseSnapshotTree.js"); +var LeafNode_1 = __webpack_require__(/*! ../snap/LeafNode */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/LeafNode.js"); +var nodeFromJSON_1 = __webpack_require__(/*! ../snap/nodeFromJSON */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/nodeFromJSON.js"); +var PriorityIndex_1 = __webpack_require__(/*! ../snap/indexes/PriorityIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PriorityIndex.js"); +/** + * Generate placeholders for deferred values. + * @param {?Object} values + * @return {!Object} + */ +exports.generateWithValues = function (values) { + values = values || {}; + values['timestamp'] = values['timestamp'] || new Date().getTime(); + return values; +}; +/** + * Value to use when firing local events. When writing server values, fire + * local events with an approximate value, otherwise return value as-is. + * @param {(Object|string|number|boolean)} value + * @param {!Object} serverValues + * @return {!(string|number|boolean)} + */ +exports.resolveDeferredValue = function (value, serverValues) { + if (!value || typeof value !== 'object') { + return value; + } + else { + util_1.assert('.sv' in value, 'Unexpected leaf node or priority contents'); + return serverValues[value['.sv']]; + } +}; +/** + * Recursively replace all deferred values and priorities in the tree with the + * specified generated replacement values. + * @param {!SparseSnapshotTree} tree + * @param {!Object} serverValues + * @return {!SparseSnapshotTree} + */ +exports.resolveDeferredValueTree = function (tree, serverValues) { + var resolvedTree = new SparseSnapshotTree_1.SparseSnapshotTree(); + tree.forEachTree(new Path_1.Path(''), function (path, node) { + resolvedTree.remember(path, exports.resolveDeferredValueSnapshot(node, serverValues)); + }); + return resolvedTree; +}; +/** + * Recursively replace all deferred values and priorities in the node with the + * specified generated replacement values. If there are no server values in the node, + * it'll be returned as-is. + * @param {!Node} node + * @param {!Object} serverValues + * @return {!Node} + */ +exports.resolveDeferredValueSnapshot = function (node, serverValues) { + var rawPri = node.getPriority().val(); + var priority = exports.resolveDeferredValue(rawPri, serverValues); + var newNode; + if (node.isLeafNode()) { + var leafNode = node; + var value = exports.resolveDeferredValue(leafNode.getValue(), serverValues); + if (value !== leafNode.getValue() || + priority !== leafNode.getPriority().val()) { + return new LeafNode_1.LeafNode(value, nodeFromJSON_1.nodeFromJSON(priority)); + } + else { + return node; + } + } + else { + var childrenNode = node; + newNode = childrenNode; + if (priority !== childrenNode.getPriority().val()) { + newNode = newNode.updatePriority(new LeafNode_1.LeafNode(priority)); + } + childrenNode.forEachChild(PriorityIndex_1.PRIORITY_INDEX, function (childName, childNode) { + var newChildNode = exports.resolveDeferredValueSnapshot(childNode, serverValues); + if (newChildNode !== childNode) { + newNode = newNode.updateImmediateChild(childName, newChildNode); + } + }); + return newNode; + } +}; + +//# sourceMappingURL=ServerValues.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/util/SortedMap.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/util/SortedMap.js ***! + \*****************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 }); +/** + * An iterator over an LLRBNode. + */ +var SortedMapIterator = /** @class */ (function () { + /** + * @template K, V, T + * @param {LLRBNode|LLRBEmptyNode} node Node to iterate. + * @param {?K} startKey + * @param {function(K, K): number} comparator + * @param {boolean} isReverse_ Whether or not to iterate in reverse + * @param {(function(K, V):T)=} resultGenerator_ + */ + function SortedMapIterator(node, startKey, comparator, isReverse_, resultGenerator_) { + if (resultGenerator_ === void 0) { resultGenerator_ = null; } + this.isReverse_ = isReverse_; + this.resultGenerator_ = resultGenerator_; + /** @private + * @type {Array.} + */ + this.nodeStack_ = []; + var cmp = 1; + while (!node.isEmpty()) { + node = node; + cmp = startKey ? comparator(node.key, startKey) : 1; + // flip the comparison if we're going in reverse + if (isReverse_) + cmp *= -1; + if (cmp < 0) { + // This node is less than our start key. ignore it + if (this.isReverse_) { + node = node.left; + } + else { + node = node.right; + } + } + else if (cmp === 0) { + // This node is exactly equal to our start key. Push it on the stack, but stop iterating; + this.nodeStack_.push(node); + break; + } + else { + // This node is greater than our start key, add it to the stack and move to the next one + this.nodeStack_.push(node); + if (this.isReverse_) { + node = node.right; + } + else { + node = node.left; + } + } + } + } + SortedMapIterator.prototype.getNext = function () { + if (this.nodeStack_.length === 0) + return null; + var node = this.nodeStack_.pop(); + var result; + if (this.resultGenerator_) + result = this.resultGenerator_(node.key, node.value); + else + result = { key: node.key, value: node.value }; + if (this.isReverse_) { + node = node.left; + while (!node.isEmpty()) { + this.nodeStack_.push(node); + node = node.right; + } + } + else { + node = node.right; + while (!node.isEmpty()) { + this.nodeStack_.push(node); + node = node.left; + } + } + return result; + }; + SortedMapIterator.prototype.hasNext = function () { + return this.nodeStack_.length > 0; + }; + SortedMapIterator.prototype.peek = function () { + if (this.nodeStack_.length === 0) + return null; + var node = this.nodeStack_[this.nodeStack_.length - 1]; + if (this.resultGenerator_) { + return this.resultGenerator_(node.key, node.value); + } + else { + return { key: node.key, value: node.value }; + } + }; + return SortedMapIterator; +}()); +exports.SortedMapIterator = SortedMapIterator; +/** + * Represents a node in a Left-leaning Red-Black tree. + */ +var LLRBNode = /** @class */ (function () { + /** + * @template K, V + * @param {!K} key Key associated with this node. + * @param {!V} value Value associated with this node. + * @param {?boolean} color Whether this node is red. + * @param {?(LLRBNode|LLRBEmptyNode)=} left Left child. + * @param {?(LLRBNode|LLRBEmptyNode)=} right Right child. + */ + function LLRBNode(key, value, color, left, right) { + this.key = key; + this.value = value; + this.color = color != null ? color : LLRBNode.RED; + this.left = + left != null ? left : SortedMap.EMPTY_NODE; + this.right = + right != null ? right : SortedMap.EMPTY_NODE; + } + /** + * Returns a copy of the current node, optionally replacing pieces of it. + * + * @param {?K} key New key for the node, or null. + * @param {?V} value New value for the node, or null. + * @param {?boolean} color New color for the node, or null. + * @param {?LLRBNode|LLRBEmptyNode} left New left child for the node, or null. + * @param {?LLRBNode|LLRBEmptyNode} right New right child for the node, or null. + * @return {!LLRBNode} The node copy. + */ + LLRBNode.prototype.copy = function (key, value, color, left, right) { + return new LLRBNode(key != null ? key : this.key, value != null ? value : this.value, color != null ? color : this.color, left != null ? left : this.left, right != null ? right : this.right); + }; + /** + * @return {number} The total number of nodes in the tree. + */ + LLRBNode.prototype.count = function () { + return this.left.count() + 1 + this.right.count(); + }; + /** + * @return {boolean} True if the tree is empty. + */ + LLRBNode.prototype.isEmpty = function () { + return false; + }; + /** + * Traverses the tree in key order and calls the specified action function + * for each node. + * + * @param {function(!K, !V):*} action Callback function to be called for each + * node. If it returns true, traversal is aborted. + * @return {*} The first truthy value returned by action, or the last falsey + * value returned by action + */ + LLRBNode.prototype.inorderTraversal = function (action) { + return (this.left.inorderTraversal(action) || + action(this.key, this.value) || + this.right.inorderTraversal(action)); + }; + /** + * Traverses the tree in reverse key order and calls the specified action function + * for each node. + * + * @param {function(!Object, !Object)} action Callback function to be called for each + * node. If it returns true, traversal is aborted. + * @return {*} True if traversal was aborted. + */ + LLRBNode.prototype.reverseTraversal = function (action) { + return (this.right.reverseTraversal(action) || + action(this.key, this.value) || + this.left.reverseTraversal(action)); + }; + /** + * @return {!Object} The minimum node in the tree. + * @private + */ + LLRBNode.prototype.min_ = function () { + if (this.left.isEmpty()) { + return this; + } + else { + return this.left.min_(); + } + }; + /** + * @return {!K} The maximum key in the tree. + */ + LLRBNode.prototype.minKey = function () { + return this.min_().key; + }; + /** + * @return {!K} The maximum key in the tree. + */ + LLRBNode.prototype.maxKey = function () { + if (this.right.isEmpty()) { + return this.key; + } + else { + return this.right.maxKey(); + } + }; + /** + * + * @param {!Object} key Key to insert. + * @param {!Object} value Value to insert. + * @param {Comparator} comparator Comparator. + * @return {!LLRBNode} New tree, with the key/value added. + */ + LLRBNode.prototype.insert = function (key, value, comparator) { + var cmp, n; + n = this; + cmp = comparator(key, n.key); + if (cmp < 0) { + n = n.copy(null, null, null, n.left.insert(key, value, comparator), null); + } + else if (cmp === 0) { + n = n.copy(null, value, null, null, null); + } + else { + n = n.copy(null, null, null, null, n.right.insert(key, value, comparator)); + } + return n.fixUp_(); + }; + /** + * @private + * @return {!LLRBNode|LLRBEmptyNode} New tree, with the minimum key removed. + */ + LLRBNode.prototype.removeMin_ = function () { + if (this.left.isEmpty()) { + return SortedMap.EMPTY_NODE; + } + var n = this; + if (!n.left.isRed_() && !n.left.left.isRed_()) + n = n.moveRedLeft_(); + n = n.copy(null, null, null, n.left.removeMin_(), null); + return n.fixUp_(); + }; + /** + * @param {!Object} key The key of the item to remove. + * @param {Comparator} comparator Comparator. + * @return {!LLRBNode|LLRBEmptyNode} New tree, with the specified item removed. + */ + LLRBNode.prototype.remove = function (key, comparator) { + var n, smallest; + n = this; + if (comparator(key, n.key) < 0) { + if (!n.left.isEmpty() && !n.left.isRed_() && !n.left.left.isRed_()) { + n = n.moveRedLeft_(); + } + n = n.copy(null, null, null, n.left.remove(key, comparator), null); + } + else { + if (n.left.isRed_()) + n = n.rotateRight_(); + if (!n.right.isEmpty() && !n.right.isRed_() && !n.right.left.isRed_()) { + n = n.moveRedRight_(); + } + if (comparator(key, n.key) === 0) { + if (n.right.isEmpty()) { + return SortedMap.EMPTY_NODE; + } + else { + smallest = n.right.min_(); + n = n.copy(smallest.key, smallest.value, null, null, n.right.removeMin_()); + } + } + n = n.copy(null, null, null, null, n.right.remove(key, comparator)); + } + return n.fixUp_(); + }; + /** + * @private + * @return {boolean} Whether this is a RED node. + */ + LLRBNode.prototype.isRed_ = function () { + return this.color; + }; + /** + * @private + * @return {!LLRBNode} New tree after performing any needed rotations. + */ + LLRBNode.prototype.fixUp_ = function () { + var n = this; + if (n.right.isRed_() && !n.left.isRed_()) + n = n.rotateLeft_(); + if (n.left.isRed_() && n.left.left.isRed_()) + n = n.rotateRight_(); + if (n.left.isRed_() && n.right.isRed_()) + n = n.colorFlip_(); + return n; + }; + /** + * @private + * @return {!LLRBNode} New tree, after moveRedLeft. + */ + LLRBNode.prototype.moveRedLeft_ = function () { + var n = this.colorFlip_(); + if (n.right.left.isRed_()) { + n = n.copy(null, null, null, null, n.right.rotateRight_()); + n = n.rotateLeft_(); + n = n.colorFlip_(); + } + return n; + }; + /** + * @private + * @return {!LLRBNode} New tree, after moveRedRight. + */ + LLRBNode.prototype.moveRedRight_ = function () { + var n = this.colorFlip_(); + if (n.left.left.isRed_()) { + n = n.rotateRight_(); + n = n.colorFlip_(); + } + return n; + }; + /** + * @private + * @return {!LLRBNode} New tree, after rotateLeft. + */ + LLRBNode.prototype.rotateLeft_ = function () { + var nl = this.copy(null, null, LLRBNode.RED, null, this.right.left); + return this.right.copy(null, null, this.color, nl, null); + }; + /** + * @private + * @return {!LLRBNode} New tree, after rotateRight. + */ + LLRBNode.prototype.rotateRight_ = function () { + var nr = this.copy(null, null, LLRBNode.RED, this.left.right, null); + return this.left.copy(null, null, this.color, null, nr); + }; + /** + * @private + * @return {!LLRBNode} New tree, after colorFlip. + */ + LLRBNode.prototype.colorFlip_ = function () { + var left = this.left.copy(null, null, !this.left.color, null, null); + var right = this.right.copy(null, null, !this.right.color, null, null); + return this.copy(null, null, !this.color, left, right); + }; + /** + * For testing. + * + * @private + * @return {boolean} True if all is well. + */ + LLRBNode.prototype.checkMaxDepth_ = function () { + var blackDepth = this.check_(); + return Math.pow(2.0, blackDepth) <= this.count() + 1; + }; + /** + * @private + * @return {number} Not sure what this returns exactly. :-). + */ + LLRBNode.prototype.check_ = function () { + var blackDepth; + if (this.isRed_() && this.left.isRed_()) { + throw new Error('Red node has red child(' + this.key + ',' + this.value + ')'); + } + if (this.right.isRed_()) { + throw new Error('Right child of (' + this.key + ',' + this.value + ') is red'); + } + blackDepth = this.left.check_(); + if (blackDepth !== this.right.check_()) { + throw new Error('Black depths differ'); + } + else { + return blackDepth + (this.isRed_() ? 0 : 1); + } + }; + LLRBNode.RED = true; + LLRBNode.BLACK = false; + return LLRBNode; +}()); +exports.LLRBNode = LLRBNode; +/** + * Represents an empty node (a leaf node in the Red-Black Tree). + */ +var LLRBEmptyNode = /** @class */ (function () { + function LLRBEmptyNode() { + } + /** + * Returns a copy of the current node. + * + * @return {!LLRBEmptyNode} The node copy. + */ + LLRBEmptyNode.prototype.copy = function (key, value, color, left, right) { + return this; + }; + /** + * Returns a copy of the tree, with the specified key/value added. + * + * @param {!K} key Key to be added. + * @param {!V} value Value to be added. + * @param {Comparator} comparator Comparator. + * @return {!LLRBNode} New tree, with item added. + */ + LLRBEmptyNode.prototype.insert = function (key, value, comparator) { + return new LLRBNode(key, value, null); + }; + /** + * Returns a copy of the tree, with the specified key removed. + * + * @param {!K} key The key to remove. + * @param {Comparator} comparator Comparator. + * @return {!LLRBEmptyNode} New tree, with item removed. + */ + LLRBEmptyNode.prototype.remove = function (key, comparator) { + return this; + }; + /** + * @return {number} The total number of nodes in the tree. + */ + LLRBEmptyNode.prototype.count = function () { + return 0; + }; + /** + * @return {boolean} True if the tree is empty. + */ + LLRBEmptyNode.prototype.isEmpty = function () { + return true; + }; + /** + * Traverses the tree in key order and calls the specified action function + * for each node. + * + * @param {function(!K, !V):*} action Callback function to be called for each + * node. If it returns true, traversal is aborted. + * @return {boolean} True if traversal was aborted. + */ + LLRBEmptyNode.prototype.inorderTraversal = function (action) { + return false; + }; + /** + * Traverses the tree in reverse key order and calls the specified action function + * for each node. + * + * @param {function(!K, !V)} action Callback function to be called for each + * node. If it returns true, traversal is aborted. + * @return {boolean} True if traversal was aborted. + */ + LLRBEmptyNode.prototype.reverseTraversal = function (action) { + return false; + }; + /** + * @return {null} + */ + LLRBEmptyNode.prototype.minKey = function () { + return null; + }; + /** + * @return {null} + */ + LLRBEmptyNode.prototype.maxKey = function () { + return null; + }; + /** + * @private + * @return {number} Not sure what this returns exactly. :-). + */ + LLRBEmptyNode.prototype.check_ = function () { + return 0; + }; + /** + * @private + * @return {boolean} Whether this node is red. + */ + LLRBEmptyNode.prototype.isRed_ = function () { + return false; + }; + return LLRBEmptyNode; +}()); +exports.LLRBEmptyNode = LLRBEmptyNode; +/** + * An immutable sorted map implementation, based on a Left-leaning Red-Black + * tree. + */ +var SortedMap = /** @class */ (function () { + /** + * @template K, V + * @param {function(K, K):number} comparator_ Key comparator. + * @param {LLRBNode=} root_ (Optional) Root node for the map. + */ + function SortedMap(comparator_, root_) { + if (root_ === void 0) { root_ = SortedMap.EMPTY_NODE; } + this.comparator_ = comparator_; + this.root_ = root_; + } + /** + * Returns a copy of the map, with the specified key/value added or replaced. + * (TODO: We should perhaps rename this method to 'put') + * + * @param {!K} key Key to be added. + * @param {!V} value Value to be added. + * @return {!SortedMap.} New map, with item added. + */ + SortedMap.prototype.insert = function (key, value) { + return new SortedMap(this.comparator_, this.root_ + .insert(key, value, this.comparator_) + .copy(null, null, LLRBNode.BLACK, null, null)); + }; + /** + * Returns a copy of the map, with the specified key removed. + * + * @param {!K} key The key to remove. + * @return {!SortedMap.} New map, with item removed. + */ + SortedMap.prototype.remove = function (key) { + return new SortedMap(this.comparator_, this.root_ + .remove(key, this.comparator_) + .copy(null, null, LLRBNode.BLACK, null, null)); + }; + /** + * Returns the value of the node with the given key, or null. + * + * @param {!K} key The key to look up. + * @return {?V} The value of the node with the given key, or null if the + * key doesn't exist. + */ + SortedMap.prototype.get = function (key) { + var cmp; + var node = this.root_; + while (!node.isEmpty()) { + cmp = this.comparator_(key, node.key); + if (cmp === 0) { + return node.value; + } + else if (cmp < 0) { + node = node.left; + } + else if (cmp > 0) { + node = node.right; + } + } + return null; + }; + /** + * Returns the key of the item *before* the specified key, or null if key is the first item. + * @param {K} key The key to find the predecessor of + * @return {?K} The predecessor key. + */ + SortedMap.prototype.getPredecessorKey = function (key) { + var cmp, node = this.root_, rightParent = null; + while (!node.isEmpty()) { + cmp = this.comparator_(key, node.key); + if (cmp === 0) { + if (!node.left.isEmpty()) { + node = node.left; + while (!node.right.isEmpty()) + node = node.right; + return node.key; + } + else if (rightParent) { + return rightParent.key; + } + else { + return null; // first item. + } + } + else if (cmp < 0) { + node = node.left; + } + else if (cmp > 0) { + rightParent = node; + node = node.right; + } + } + throw new Error('Attempted to find predecessor key for a nonexistent key. What gives?'); + }; + /** + * @return {boolean} True if the map is empty. + */ + SortedMap.prototype.isEmpty = function () { + return this.root_.isEmpty(); + }; + /** + * @return {number} The total number of nodes in the map. + */ + SortedMap.prototype.count = function () { + return this.root_.count(); + }; + /** + * @return {?K} The minimum key in the map. + */ + SortedMap.prototype.minKey = function () { + return this.root_.minKey(); + }; + /** + * @return {?K} The maximum key in the map. + */ + SortedMap.prototype.maxKey = function () { + return this.root_.maxKey(); + }; + /** + * Traverses the map in key order and calls the specified action function + * for each key/value pair. + * + * @param {function(!K, !V):*} action Callback function to be called + * for each key/value pair. If action returns true, traversal is aborted. + * @return {*} The first truthy value returned by action, or the last falsey + * value returned by action + */ + SortedMap.prototype.inorderTraversal = function (action) { + return this.root_.inorderTraversal(action); + }; + /** + * Traverses the map in reverse key order and calls the specified action function + * for each key/value pair. + * + * @param {function(!Object, !Object)} action Callback function to be called + * for each key/value pair. If action returns true, traversal is aborted. + * @return {*} True if the traversal was aborted. + */ + SortedMap.prototype.reverseTraversal = function (action) { + return this.root_.reverseTraversal(action); + }; + /** + * Returns an iterator over the SortedMap. + * @template T + * @param {(function(K, V):T)=} resultGenerator + * @return {SortedMapIterator.} The iterator. + */ + SortedMap.prototype.getIterator = function (resultGenerator) { + return new SortedMapIterator(this.root_, null, this.comparator_, false, resultGenerator); + }; + SortedMap.prototype.getIteratorFrom = function (key, resultGenerator) { + return new SortedMapIterator(this.root_, key, this.comparator_, false, resultGenerator); + }; + SortedMap.prototype.getReverseIteratorFrom = function (key, resultGenerator) { + return new SortedMapIterator(this.root_, key, this.comparator_, true, resultGenerator); + }; + SortedMap.prototype.getReverseIterator = function (resultGenerator) { + return new SortedMapIterator(this.root_, null, this.comparator_, true, resultGenerator); + }; + /** + * Always use the same empty node, to reduce memory. + * @const + */ + SortedMap.EMPTY_NODE = new LLRBEmptyNode(); + return SortedMap; +}()); +exports.SortedMap = SortedMap; + +//# sourceMappingURL=SortedMap.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/util/Tree.js": +/*!************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/util/Tree.js ***! + \************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var Path_1 = __webpack_require__(/*! ./Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +var util_2 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * Node in a Tree. + */ +var TreeNode = /** @class */ (function () { + function TreeNode() { + // TODO: Consider making accessors that create children and value lazily or + // separate Internal / Leaf 'types'. + this.children = {}; + this.childCount = 0; + this.value = null; + } + return TreeNode; +}()); +exports.TreeNode = TreeNode; +/** + * A light-weight tree, traversable by path. Nodes can have both values and children. + * Nodes are not enumerated (by forEachChild) unless they have a value or non-empty + * children. + */ +var Tree = /** @class */ (function () { + /** + * @template T + * @param {string=} name_ Optional name of the node. + * @param {Tree=} parent_ Optional parent node. + * @param {TreeNode=} node_ Optional node to wrap. + */ + function Tree(name_, parent_, node_) { + if (name_ === void 0) { name_ = ''; } + if (parent_ === void 0) { parent_ = null; } + if (node_ === void 0) { node_ = new TreeNode(); } + this.name_ = name_; + this.parent_ = parent_; + this.node_ = node_; + } + /** + * Returns a sub-Tree for the given path. + * + * @param {!(string|Path)} pathObj Path to look up. + * @return {!Tree.} Tree for path. + */ + Tree.prototype.subTree = function (pathObj) { + // TODO: Require pathObj to be Path? + var path = pathObj instanceof Path_1.Path ? pathObj : new Path_1.Path(pathObj); + var child = this, next; + while ((next = path.getFront()) !== null) { + var childNode = util_2.safeGet(child.node_.children, next) || new TreeNode(); + child = new Tree(next, child, childNode); + path = path.popFront(); + } + return child; + }; + /** + * Returns the data associated with this tree node. + * + * @return {?T} The data or null if no data exists. + */ + Tree.prototype.getValue = function () { + return this.node_.value; + }; + /** + * Sets data to this tree node. + * + * @param {!T} value Value to set. + */ + Tree.prototype.setValue = function (value) { + util_1.assert(typeof value !== 'undefined', 'Cannot set value to undefined'); + this.node_.value = value; + this.updateParents_(); + }; + /** + * Clears the contents of the tree node (its value and all children). + */ + Tree.prototype.clear = function () { + this.node_.value = null; + this.node_.children = {}; + this.node_.childCount = 0; + this.updateParents_(); + }; + /** + * @return {boolean} Whether the tree has any children. + */ + Tree.prototype.hasChildren = function () { + return this.node_.childCount > 0; + }; + /** + * @return {boolean} Whether the tree is empty (no value or children). + */ + Tree.prototype.isEmpty = function () { + return this.getValue() === null && !this.hasChildren(); + }; + /** + * Calls action for each child of this tree node. + * + * @param {function(!Tree.)} action Action to be called for each child. + */ + Tree.prototype.forEachChild = function (action) { + var _this = this; + util_2.forEach(this.node_.children, function (child, childTree) { + action(new Tree(child, _this, childTree)); + }); + }; + /** + * Does a depth-first traversal of this node's descendants, calling action for each one. + * + * @param {function(!Tree.)} action Action to be called for each child. + * @param {boolean=} includeSelf Whether to call action on this node as well. Defaults to + * false. + * @param {boolean=} childrenFirst Whether to call action on children before calling it on + * parent. + */ + Tree.prototype.forEachDescendant = function (action, includeSelf, childrenFirst) { + if (includeSelf && !childrenFirst) + action(this); + this.forEachChild(function (child) { + child.forEachDescendant(action, /*includeSelf=*/ true, childrenFirst); + }); + if (includeSelf && childrenFirst) + action(this); + }; + /** + * Calls action on each ancestor node. + * + * @param {function(!Tree.)} action Action to be called on each parent; return + * true to abort. + * @param {boolean=} includeSelf Whether to call action on this node as well. + * @return {boolean} true if the action callback returned true. + */ + Tree.prototype.forEachAncestor = function (action, includeSelf) { + var node = includeSelf ? this : this.parent(); + while (node !== null) { + if (action(node)) { + return true; + } + node = node.parent(); + } + return false; + }; + /** + * Does a depth-first traversal of this node's descendants. When a descendant with a value + * is found, action is called on it and traversal does not continue inside the node. + * Action is *not* called on this node. + * + * @param {function(!Tree.)} action Action to be called for each child. + */ + Tree.prototype.forEachImmediateDescendantWithValue = function (action) { + this.forEachChild(function (child) { + if (child.getValue() !== null) + action(child); + else + child.forEachImmediateDescendantWithValue(action); + }); + }; + /** + * @return {!Path} The path of this tree node, as a Path. + */ + Tree.prototype.path = function () { + return new Path_1.Path(this.parent_ === null + ? this.name_ + : this.parent_.path() + '/' + this.name_); + }; + /** + * @return {string} The name of the tree node. + */ + Tree.prototype.name = function () { + return this.name_; + }; + /** + * @return {?Tree} The parent tree node, or null if this is the root of the tree. + */ + Tree.prototype.parent = function () { + return this.parent_; + }; + /** + * Adds or removes this child from its parent based on whether it's empty or not. + * + * @private + */ + Tree.prototype.updateParents_ = function () { + if (this.parent_ !== null) + this.parent_.updateChild_(this.name_, this); + }; + /** + * Adds or removes the passed child to this tree node, depending on whether it's empty. + * + * @param {string} childName The name of the child to update. + * @param {!Tree.} child The child to update. + * @private + */ + Tree.prototype.updateChild_ = function (childName, child) { + var childEmpty = child.isEmpty(); + var childExists = util_2.contains(this.node_.children, childName); + if (childEmpty && childExists) { + delete this.node_.children[childName]; + this.node_.childCount--; + this.updateParents_(); + } + else if (!childEmpty && !childExists) { + this.node_.children[childName] = child.node_; + this.node_.childCount++; + this.updateParents_(); + } + }; + return Tree; +}()); +exports.Tree = Tree; + +//# sourceMappingURL=Tree.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/util/VisibilityMonitor.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/util/VisibilityMonitor.js ***! + \*************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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. + */ +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 __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var EventEmitter_1 = __webpack_require__(/*! ./EventEmitter */ "./node_modules/@firebase/database/dist/cjs/src/core/util/EventEmitter.js"); +var util_1 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * @extends {EventEmitter} + */ +var VisibilityMonitor = /** @class */ (function (_super) { + __extends(VisibilityMonitor, _super); + function VisibilityMonitor() { + var _this = _super.call(this, ['visible']) || this; + var hidden; + var visibilityChange; + if (typeof document !== 'undefined' && + typeof document.addEventListener !== 'undefined') { + if (typeof document['hidden'] !== 'undefined') { + // Opera 12.10 and Firefox 18 and later support + visibilityChange = 'visibilitychange'; + hidden = 'hidden'; + } + else if (typeof document['mozHidden'] !== 'undefined') { + visibilityChange = 'mozvisibilitychange'; + hidden = 'mozHidden'; + } + else if (typeof document['msHidden'] !== 'undefined') { + visibilityChange = 'msvisibilitychange'; + hidden = 'msHidden'; + } + else if (typeof document['webkitHidden'] !== 'undefined') { + visibilityChange = 'webkitvisibilitychange'; + hidden = 'webkitHidden'; + } + } + // Initially, we always assume we are visible. This ensures that in browsers + // without page visibility support or in cases where we are never visible + // (e.g. chrome extension), we act as if we are visible, i.e. don't delay + // reconnects + _this.visible_ = true; + if (visibilityChange) { + document.addEventListener(visibilityChange, function () { + var visible = !document[hidden]; + if (visible !== _this.visible_) { + _this.visible_ = visible; + _this.trigger('visible', visible); + } + }, false); + } + return _this; + } + VisibilityMonitor.getInstance = function () { + return new VisibilityMonitor(); + }; + /** + * @param {!string} eventType + * @return {Array.} + */ + VisibilityMonitor.prototype.getInitialEvent = function (eventType) { + util_1.assert(eventType === 'visible', 'Unknown event type: ' + eventType); + return [this.visible_]; + }; + return VisibilityMonitor; +}(EventEmitter_1.EventEmitter)); +exports.VisibilityMonitor = VisibilityMonitor; + +//# sourceMappingURL=VisibilityMonitor.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/util/libs/parser.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/util/libs/parser.js ***! + \*******************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 Path_1 = __webpack_require__(/*! ../Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +var RepoInfo_1 = __webpack_require__(/*! ../../RepoInfo */ "./node_modules/@firebase/database/dist/cjs/src/core/RepoInfo.js"); +var util_1 = __webpack_require__(/*! ../util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +/** + * @param {!string} pathString + * @return {string} + */ +function decodePath(pathString) { + var pathStringDecoded = ''; + var pieces = pathString.split('/'); + for (var i = 0; i < pieces.length; i++) { + if (pieces[i].length > 0) { + var piece = pieces[i]; + try { + piece = decodeURIComponent(piece.replace(/\+/g, ' ')); + } + catch (e) { } + pathStringDecoded += '/' + piece; + } + } + return pathStringDecoded; +} +/** + * + * @param {!string} dataURL + * @return {{repoInfo: !RepoInfo, path: !Path}} + */ +exports.parseRepoInfo = function (dataURL) { + var parsedUrl = exports.parseURL(dataURL), namespace = parsedUrl.subdomain; + if (parsedUrl.domain === 'firebase') { + util_1.fatal(parsedUrl.host + + ' is no longer supported. ' + + 'Please use .firebaseio.com instead'); + } + // Catch common error of uninitialized namespace value. + if (!namespace || namespace == 'undefined') { + util_1.fatal('Cannot parse Firebase url. Please use https://.firebaseio.com'); + } + if (!parsedUrl.secure) { + util_1.warnIfPageIsSecure(); + } + var webSocketOnly = parsedUrl.scheme === 'ws' || parsedUrl.scheme === 'wss'; + return { + repoInfo: new RepoInfo_1.RepoInfo(parsedUrl.host, parsedUrl.secure, namespace, webSocketOnly), + path: new Path_1.Path(parsedUrl.pathString) + }; +}; +/** + * + * @param {!string} dataURL + * @return {{host: string, port: number, domain: string, subdomain: string, secure: boolean, scheme: string, pathString: string}} + */ +exports.parseURL = function (dataURL) { + // Default to empty strings in the event of a malformed string. + var host = '', domain = '', subdomain = '', pathString = ''; + // Always default to SSL, unless otherwise specified. + var secure = true, scheme = 'https', port = 443; + // Don't do any validation here. The caller is responsible for validating the result of parsing. + if (typeof dataURL === 'string') { + // Parse scheme. + var colonInd = dataURL.indexOf('//'); + if (colonInd >= 0) { + scheme = dataURL.substring(0, colonInd - 1); + dataURL = dataURL.substring(colonInd + 2); + } + // Parse host and path. + var slashInd = dataURL.indexOf('/'); + if (slashInd === -1) { + slashInd = dataURL.length; + } + host = dataURL.substring(0, slashInd); + pathString = decodePath(dataURL.substring(slashInd)); + var parts = host.split('.'); + if (parts.length === 3) { + // Normalize namespaces to lowercase to share storage / connection. + domain = parts[1]; + subdomain = parts[0].toLowerCase(); + } + else if (parts.length === 2) { + domain = parts[0]; + } + // If we have a port, use scheme for determining if it's secure. + colonInd = host.indexOf(':'); + if (colonInd >= 0) { + secure = scheme === 'https' || scheme === 'wss'; + port = parseInt(host.substring(colonInd + 1), 10); + } + } + return { + host: host, + port: port, + domain: domain, + subdomain: subdomain, + secure: secure, + scheme: scheme, + pathString: pathString + }; +}; + +//# sourceMappingURL=parser.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js": +/*!************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/util/util.js ***! + \************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_3 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_4 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_5 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_6 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var storage_1 = __webpack_require__(/*! ../storage/storage */ "./node_modules/@firebase/database/dist/cjs/src/core/storage/storage.js"); +var util_7 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * 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) { + if (typeof console !== 'undefined') { + if (typeof console.log === 'function') { + exports.logger = console.log.bind(console); + } + else if (typeof console.log === 'object') { + // IE does this. + exports.logger = function (message) { + console.log(message); + }; + } + } + 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]; + } + if (typeof console !== 'undefined') { + var message = 'FIREBASE INTERNAL ERROR: ' + buildLogMessage_.apply(void 0, var_args); + if (typeof console.error !== 'undefined') { + console.error(message); + } + else { + console.log(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 = buildLogMessage_.apply(void 0, var_args); + throw new Error('FIREBASE FATAL ERROR: ' + message); +}; +/** + * @param {...*} var_args + */ +exports.warn = function () { + var var_args = []; + for (var _i = 0; _i < arguments.length; _i++) { + var_args[_i] = arguments[_i]; + } + if (typeof console !== 'undefined') { + var message = 'FIREBASE WARNING: ' + buildLogMessage_.apply(void 0, var_args); + if (typeof console.warn !== 'undefined') { + console.warn(message); + } + else { + console.log(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.} 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 + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/util/validation.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/util/validation.js ***! + \******************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 Path_1 = __webpack_require__(/*! ./Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +var util_1 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! ./util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var util_3 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_4 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * True for invalid Firebase keys + * @type {RegExp} + * @private + */ +exports.INVALID_KEY_REGEX_ = /[\[\].#$\/\u0000-\u001F\u007F]/; +/** + * True for invalid Firebase paths. + * Allows '/' in paths. + * @type {RegExp} + * @private + */ +exports.INVALID_PATH_REGEX_ = /[\[\].#$\u0000-\u001F\u007F]/; +/** + * Maximum number of characters to allow in leaf value + * @type {number} + * @private + */ +exports.MAX_LEAF_SIZE_ = 10 * 1024 * 1024; +/** + * @param {*} key + * @return {boolean} + */ +exports.isValidKey = function (key) { + return (typeof key === 'string' && key.length !== 0 && !exports.INVALID_KEY_REGEX_.test(key)); +}; +/** + * @param {string} pathString + * @return {boolean} + */ +exports.isValidPathString = function (pathString) { + return (typeof pathString === 'string' && + pathString.length !== 0 && + !exports.INVALID_PATH_REGEX_.test(pathString)); +}; +/** + * @param {string} pathString + * @return {boolean} + */ +exports.isValidRootPathString = function (pathString) { + if (pathString) { + // Allow '/.info/' at the beginning. + pathString = pathString.replace(/^\/*\.info(\/|$)/, '/'); + } + return exports.isValidPathString(pathString); +}; +/** + * @param {*} priority + * @return {boolean} + */ +exports.isValidPriority = function (priority) { + return (priority === null || + typeof priority === 'string' || + (typeof priority === 'number' && !util_2.isInvalidJSONNumber(priority)) || + (priority && typeof priority === 'object' && util_1.contains(priority, '.sv'))); +}; +/** + * Pre-validate a datum passed as an argument to Firebase function. + * + * @param {string} fnName + * @param {number} argumentNumber + * @param {*} data + * @param {!Path} path + * @param {boolean} optional + */ +exports.validateFirebaseDataArg = function (fnName, argumentNumber, data, path, optional) { + if (optional && data === undefined) + return; + exports.validateFirebaseData(util_3.errorPrefix(fnName, argumentNumber, optional), data, path); +}; +/** + * Validate a data object client-side before sending to server. + * + * @param {string} errorPrefix + * @param {*} data + * @param {!Path|!ValidationPath} path_ + */ +exports.validateFirebaseData = function (errorPrefix, data, path_) { + var path = path_ instanceof Path_1.Path ? new Path_1.ValidationPath(path_, errorPrefix) : path_; + if (data === undefined) { + throw new Error(errorPrefix + 'contains undefined ' + path.toErrorString()); + } + if (typeof data === 'function') { + throw new Error(errorPrefix + + 'contains a function ' + + path.toErrorString() + + ' with contents = ' + + data.toString()); + } + if (util_2.isInvalidJSONNumber(data)) { + throw new Error(errorPrefix + 'contains ' + data.toString() + ' ' + path.toErrorString()); + } + // Check max leaf size, but try to avoid the utf8 conversion if we can. + if (typeof data === 'string' && + data.length > exports.MAX_LEAF_SIZE_ / 3 && + util_4.stringLength(data) > exports.MAX_LEAF_SIZE_) { + throw new Error(errorPrefix + + 'contains a string greater than ' + + exports.MAX_LEAF_SIZE_ + + ' utf8 bytes ' + + path.toErrorString() + + " ('" + + data.substring(0, 50) + + "...')"); + } + // TODO = Perf = Consider combining the recursive validation of keys into NodeFromJSON + // to save extra walking of large objects. + if (data && typeof data === 'object') { + var hasDotValue_1 = false, hasActualChild_1 = false; + util_1.forEach(data, function (key, value) { + if (key === '.value') { + hasDotValue_1 = true; + } + else if (key !== '.priority' && key !== '.sv') { + hasActualChild_1 = true; + if (!exports.isValidKey(key)) { + throw new Error(errorPrefix + + ' contains an invalid key (' + + key + + ') ' + + path.toErrorString() + + '. Keys must be non-empty strings ' + + 'and can\'t contain ".", "#", "$", "/", "[", or "]"'); + } + } + path.push(key); + exports.validateFirebaseData(errorPrefix, value, path); + path.pop(); + }); + if (hasDotValue_1 && hasActualChild_1) { + throw new Error(errorPrefix + + ' contains ".value" child ' + + path.toErrorString() + + ' in addition to actual children.'); + } + } +}; +/** + * Pre-validate paths passed in the firebase function. + * + * @param {string} errorPrefix + * @param {Array} mergePaths + */ +exports.validateFirebaseMergePaths = function (errorPrefix, mergePaths) { + var i, curPath; + for (i = 0; i < mergePaths.length; i++) { + curPath = mergePaths[i]; + var keys = curPath.slice(); + for (var j = 0; j < keys.length; j++) { + if (keys[j] === '.priority' && j === keys.length - 1) { + // .priority is OK + } + else if (!exports.isValidKey(keys[j])) { + throw new Error(errorPrefix + + 'contains an invalid key (' + + keys[j] + + ') in path ' + + curPath.toString() + + '. Keys must be non-empty strings ' + + 'and can\'t contain ".", "#", "$", "/", "[", or "]"'); + } + } + } + // Check that update keys are not descendants of each other. + // We rely on the property that sorting guarantees that ancestors come + // right before descendants. + mergePaths.sort(Path_1.Path.comparePaths); + var prevPath = null; + for (i = 0; i < mergePaths.length; i++) { + curPath = mergePaths[i]; + if (prevPath !== null && prevPath.contains(curPath)) { + throw new Error(errorPrefix + + 'contains a path ' + + prevPath.toString() + + ' that is ancestor of another path ' + + curPath.toString()); + } + prevPath = curPath; + } +}; +/** + * pre-validate an object passed as an argument to firebase function ( + * must be an object - e.g. for firebase.update()). + * + * @param {string} fnName + * @param {number} argumentNumber + * @param {*} data + * @param {!Path} path + * @param {boolean} optional + */ +exports.validateFirebaseMergeDataArg = function (fnName, argumentNumber, data, path, optional) { + if (optional && data === undefined) + return; + var errorPrefix = util_3.errorPrefix(fnName, argumentNumber, optional); + if (!(data && typeof data === 'object') || Array.isArray(data)) { + throw new Error(errorPrefix + ' must be an object containing the children to replace.'); + } + var mergePaths = []; + util_1.forEach(data, function (key, value) { + var curPath = new Path_1.Path(key); + exports.validateFirebaseData(errorPrefix, value, path.child(curPath)); + if (curPath.getBack() === '.priority') { + if (!exports.isValidPriority(value)) { + throw new Error(errorPrefix + + "contains an invalid value for '" + + curPath.toString() + + "', which must be a valid " + + 'Firebase priority (a string, finite number, server value, or null).'); + } + } + mergePaths.push(curPath); + }); + exports.validateFirebaseMergePaths(errorPrefix, mergePaths); +}; +exports.validatePriority = function (fnName, argumentNumber, priority, optional) { + if (optional && priority === undefined) + return; + if (util_2.isInvalidJSONNumber(priority)) + throw new Error(util_3.errorPrefix(fnName, argumentNumber, optional) + + 'is ' + + priority.toString() + + ', but must be a valid Firebase priority (a string, finite number, ' + + 'server value, or null).'); + // Special case to allow importing data with a .sv. + if (!exports.isValidPriority(priority)) + throw new Error(util_3.errorPrefix(fnName, argumentNumber, optional) + + 'must be a valid Firebase priority ' + + '(a string, finite number, server value, or null).'); +}; +exports.validateEventType = function (fnName, argumentNumber, eventType, optional) { + if (optional && eventType === undefined) + return; + switch (eventType) { + case 'value': + case 'child_added': + case 'child_removed': + case 'child_changed': + case 'child_moved': + break; + default: + throw new Error(util_3.errorPrefix(fnName, argumentNumber, optional) + + 'must be a valid event type = "value", "child_added", "child_removed", ' + + '"child_changed", or "child_moved".'); + } +}; +exports.validateKey = function (fnName, argumentNumber, key, optional) { + if (optional && key === undefined) + return; + if (!exports.isValidKey(key)) + throw new Error(util_3.errorPrefix(fnName, argumentNumber, optional) + + 'was an invalid key = "' + + key + + '". Firebase keys must be non-empty strings and ' + + 'can\'t contain ".", "#", "$", "/", "[", or "]").'); +}; +exports.validatePathString = function (fnName, argumentNumber, pathString, optional) { + if (optional && pathString === undefined) + return; + if (!exports.isValidPathString(pathString)) + throw new Error(util_3.errorPrefix(fnName, argumentNumber, optional) + + 'was an invalid path = "' + + pathString + + '". Paths must be non-empty strings and ' + + 'can\'t contain ".", "#", "$", "[", or "]"'); +}; +exports.validateRootPathString = function (fnName, argumentNumber, pathString, optional) { + if (pathString) { + // Allow '/.info/' at the beginning. + pathString = pathString.replace(/^\/*\.info(\/|$)/, '/'); + } + exports.validatePathString(fnName, argumentNumber, pathString, optional); +}; +exports.validateWritablePath = function (fnName, path) { + if (path.getFront() === '.info') { + throw new Error(fnName + " failed = Can't modify data under /.info/"); + } +}; +exports.validateUrl = function (fnName, argumentNumber, parsedUrl) { + // TODO = Validate server better. + var pathString = parsedUrl.path.toString(); + if (!(typeof parsedUrl.repoInfo.host === 'string') || + parsedUrl.repoInfo.host.length === 0 || + !exports.isValidKey(parsedUrl.repoInfo.namespace) || + (pathString.length !== 0 && !exports.isValidRootPathString(pathString))) { + throw new Error(util_3.errorPrefix(fnName, argumentNumber, false) + + 'must be a valid firebase URL and ' + + 'the path can\'t contain ".", "#", "$", "[", or "]".'); + } +}; +exports.validateCredential = function (fnName, argumentNumber, cred, optional) { + if (optional && cred === undefined) + return; + if (!(typeof cred === 'string')) + throw new Error(util_3.errorPrefix(fnName, argumentNumber, optional) + + 'must be a valid credential (a string).'); +}; +exports.validateBoolean = function (fnName, argumentNumber, bool, optional) { + if (optional && bool === undefined) + return; + if (typeof bool !== 'boolean') + throw new Error(util_3.errorPrefix(fnName, argumentNumber, optional) + 'must be a boolean.'); +}; +exports.validateString = function (fnName, argumentNumber, string, optional) { + if (optional && string === undefined) + return; + if (!(typeof string === 'string')) { + throw new Error(util_3.errorPrefix(fnName, argumentNumber, optional) + + 'must be a valid string.'); + } +}; +exports.validateObject = function (fnName, argumentNumber, obj, optional) { + if (optional && obj === undefined) + return; + if (!(obj && typeof obj === 'object') || obj === null) { + throw new Error(util_3.errorPrefix(fnName, argumentNumber, optional) + + 'must be a valid object.'); + } +}; +exports.validateObjectContainsKey = function (fnName, argumentNumber, obj, key, optional, opt_type) { + var objectContainsKey = obj && typeof obj === 'object' && util_1.contains(obj, key); + if (!objectContainsKey) { + if (optional) { + return; + } + else { + throw new Error(util_3.errorPrefix(fnName, argumentNumber, optional) + + 'must contain the key "' + + key + + '"'); + } + } + if (opt_type) { + var val = util_1.safeGet(obj, key); + if ((opt_type === 'number' && !(typeof val === 'number')) || + (opt_type === 'string' && !(typeof val === 'string')) || + (opt_type === 'boolean' && !(typeof val === 'boolean')) || + (opt_type === 'function' && !(typeof val === 'function')) || + (opt_type === 'object' && !(typeof val === 'object') && val)) { + if (optional) { + throw new Error(util_3.errorPrefix(fnName, argumentNumber, optional) + + 'contains invalid value for key "' + + key + + '" (must be of type "' + + opt_type + + '")'); + } + else { + throw new Error(util_3.errorPrefix(fnName, argumentNumber, optional) + + 'must contain the key "' + + key + + '" with type "' + + opt_type + + '"'); + } + } + } +}; + +//# sourceMappingURL=validation.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/view/CacheNode.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/view/CacheNode.js ***! + \*****************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 }); +/** + * A cache node only stores complete children. Additionally it holds a flag whether the node can be considered fully + * initialized in the sense that we know at one point in time this represented a valid state of the world, e.g. + * initialized with data from the server, or a complete overwrite by the client. The filtered flag also tracks + * whether a node potentially had children removed due to a filter. + */ +var CacheNode = /** @class */ (function () { + /** + * @param {!Node} node_ + * @param {boolean} fullyInitialized_ + * @param {boolean} filtered_ + */ + function CacheNode(node_, fullyInitialized_, filtered_) { + this.node_ = node_; + this.fullyInitialized_ = fullyInitialized_; + this.filtered_ = filtered_; + } + /** + * Returns whether this node was fully initialized with either server data or a complete overwrite by the client + * @return {boolean} + */ + CacheNode.prototype.isFullyInitialized = function () { + return this.fullyInitialized_; + }; + /** + * Returns whether this node is potentially missing children due to a filter applied to the node + * @return {boolean} + */ + CacheNode.prototype.isFiltered = function () { + return this.filtered_; + }; + /** + * @param {!Path} path + * @return {boolean} + */ + CacheNode.prototype.isCompleteForPath = function (path) { + if (path.isEmpty()) { + return this.isFullyInitialized() && !this.filtered_; + } + var childKey = path.getFront(); + return this.isCompleteForChild(childKey); + }; + /** + * @param {!string} key + * @return {boolean} + */ + CacheNode.prototype.isCompleteForChild = function (key) { + return ((this.isFullyInitialized() && !this.filtered_) || this.node_.hasChild(key)); + }; + /** + * @return {!Node} + */ + CacheNode.prototype.getNode = function () { + return this.node_; + }; + return CacheNode; +}()); +exports.CacheNode = CacheNode; + +//# sourceMappingURL=CacheNode.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/view/Change.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/view/Change.js ***! + \**************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 }); +/** + * @constructor + * @struct + * @param {!string} type The event type + * @param {!Node} snapshotNode The data + * @param {string=} childName The name for this child, if it's a child event + * @param {Node=} oldSnap Used for intermediate processing of child changed events + * @param {string=} prevName The name for the previous child, if applicable + */ +var Change = /** @class */ (function () { + function Change(type, snapshotNode, childName, oldSnap, prevName) { + this.type = type; + this.snapshotNode = snapshotNode; + this.childName = childName; + this.oldSnap = oldSnap; + this.prevName = prevName; + } + /** + * @param {!Node} snapshot + * @return {!Change} + */ + Change.valueChange = function (snapshot) { + return new Change(Change.VALUE, snapshot); + }; + /** + * @param {string} childKey + * @param {!Node} snapshot + * @return {!Change} + */ + Change.childAddedChange = function (childKey, snapshot) { + return new Change(Change.CHILD_ADDED, snapshot, childKey); + }; + /** + * @param {string} childKey + * @param {!Node} snapshot + * @return {!Change} + */ + Change.childRemovedChange = function (childKey, snapshot) { + return new Change(Change.CHILD_REMOVED, snapshot, childKey); + }; + /** + * @param {string} childKey + * @param {!Node} newSnapshot + * @param {!Node} oldSnapshot + * @return {!Change} + */ + Change.childChangedChange = function (childKey, newSnapshot, oldSnapshot) { + return new Change(Change.CHILD_CHANGED, newSnapshot, childKey, oldSnapshot); + }; + /** + * @param {string} childKey + * @param {!Node} snapshot + * @return {!Change} + */ + Change.childMovedChange = function (childKey, snapshot) { + return new Change(Change.CHILD_MOVED, snapshot, childKey); + }; + //event types + /** Event type for a child added */ + Change.CHILD_ADDED = 'child_added'; + /** Event type for a child removed */ + Change.CHILD_REMOVED = 'child_removed'; + /** Event type for a child changed */ + Change.CHILD_CHANGED = 'child_changed'; + /** Event type for a child moved */ + Change.CHILD_MOVED = 'child_moved'; + /** Event type for a value change */ + Change.VALUE = 'value'; + return Change; +}()); +exports.Change = Change; + +//# sourceMappingURL=Change.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/view/ChildChangeAccumulator.js": +/*!******************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/view/ChildChangeAccumulator.js ***! + \******************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var Change_1 = __webpack_require__(/*! ./Change */ "./node_modules/@firebase/database/dist/cjs/src/core/view/Change.js"); +var util_2 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * @constructor + */ +var ChildChangeAccumulator = /** @class */ (function () { + function ChildChangeAccumulator() { + this.changeMap_ = {}; + } + /** + * @param {!Change} change + */ + ChildChangeAccumulator.prototype.trackChildChange = function (change) { + var type = change.type; + var childKey /** @type {!string} */ = change.childName; + util_2.assert(type == Change_1.Change.CHILD_ADDED || + type == Change_1.Change.CHILD_CHANGED || + type == Change_1.Change.CHILD_REMOVED, 'Only child changes supported for tracking'); + util_2.assert(childKey !== '.priority', 'Only non-priority child changes can be tracked.'); + var oldChange = util_1.safeGet(this.changeMap_, childKey); + if (oldChange) { + var oldType = oldChange.type; + if (type == Change_1.Change.CHILD_ADDED && oldType == Change_1.Change.CHILD_REMOVED) { + this.changeMap_[childKey] = Change_1.Change.childChangedChange(childKey, change.snapshotNode, oldChange.snapshotNode); + } + else if (type == Change_1.Change.CHILD_REMOVED && + oldType == Change_1.Change.CHILD_ADDED) { + delete this.changeMap_[childKey]; + } + else if (type == Change_1.Change.CHILD_REMOVED && + oldType == Change_1.Change.CHILD_CHANGED) { + this.changeMap_[childKey] = Change_1.Change.childRemovedChange(childKey, oldChange.oldSnap); + } + else if (type == Change_1.Change.CHILD_CHANGED && + oldType == Change_1.Change.CHILD_ADDED) { + this.changeMap_[childKey] = Change_1.Change.childAddedChange(childKey, change.snapshotNode); + } + else if (type == Change_1.Change.CHILD_CHANGED && + oldType == Change_1.Change.CHILD_CHANGED) { + this.changeMap_[childKey] = Change_1.Change.childChangedChange(childKey, change.snapshotNode, oldChange.oldSnap); + } + else { + throw util_2.assertionError('Illegal combination of changes: ' + + change + + ' occurred after ' + + oldChange); + } + } + else { + this.changeMap_[childKey] = change; + } + }; + /** + * @return {!Array.} + */ + ChildChangeAccumulator.prototype.getChanges = function () { + return util_1.getValues(this.changeMap_); + }; + return ChildChangeAccumulator; +}()); +exports.ChildChangeAccumulator = ChildChangeAccumulator; + +//# sourceMappingURL=ChildChangeAccumulator.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/view/CompleteChildSource.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/view/CompleteChildSource.js ***! + \***************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 CacheNode_1 = __webpack_require__(/*! ./CacheNode */ "./node_modules/@firebase/database/dist/cjs/src/core/view/CacheNode.js"); +/** + * An implementation of CompleteChildSource that never returns any additional children + * + * @private + * @constructor + * @implements CompleteChildSource + */ +var NoCompleteChildSource_ = /** @class */ (function () { + function NoCompleteChildSource_() { + } + /** + * @inheritDoc + */ + NoCompleteChildSource_.prototype.getCompleteChild = function (childKey) { + return null; + }; + /** + * @inheritDoc + */ + NoCompleteChildSource_.prototype.getChildAfterChild = function (index, child, reverse) { + return null; + }; + return NoCompleteChildSource_; +}()); +exports.NoCompleteChildSource_ = NoCompleteChildSource_; +/** + * Singleton instance. + * @const + * @type {!CompleteChildSource} + */ +exports.NO_COMPLETE_CHILD_SOURCE = new NoCompleteChildSource_(); +/** + * An implementation of CompleteChildSource that uses a WriteTree in addition to any other server data or + * old event caches available to calculate complete children. + * + * + * @implements CompleteChildSource + */ +var WriteTreeCompleteChildSource = /** @class */ (function () { + /** + * @param {!WriteTreeRef} writes_ + * @param {!ViewCache} viewCache_ + * @param {?Node} optCompleteServerCache_ + */ + function WriteTreeCompleteChildSource(writes_, viewCache_, optCompleteServerCache_) { + if (optCompleteServerCache_ === void 0) { optCompleteServerCache_ = null; } + this.writes_ = writes_; + this.viewCache_ = viewCache_; + this.optCompleteServerCache_ = optCompleteServerCache_; + } + /** + * @inheritDoc + */ + WriteTreeCompleteChildSource.prototype.getCompleteChild = function (childKey) { + var node = this.viewCache_.getEventCache(); + if (node.isCompleteForChild(childKey)) { + return node.getNode().getImmediateChild(childKey); + } + else { + var serverNode = this.optCompleteServerCache_ != null + ? new CacheNode_1.CacheNode(this.optCompleteServerCache_, true, false) + : this.viewCache_.getServerCache(); + return this.writes_.calcCompleteChild(childKey, serverNode); + } + }; + /** + * @inheritDoc + */ + WriteTreeCompleteChildSource.prototype.getChildAfterChild = function (index, child, reverse) { + var completeServerData = this.optCompleteServerCache_ != null + ? this.optCompleteServerCache_ + : this.viewCache_.getCompleteServerSnap(); + var nodes = this.writes_.calcIndexedSlice(completeServerData, child, 1, reverse, index); + if (nodes.length === 0) { + return null; + } + else { + return nodes[0]; + } + }; + return WriteTreeCompleteChildSource; +}()); +exports.WriteTreeCompleteChildSource = WriteTreeCompleteChildSource; + +//# sourceMappingURL=CompleteChildSource.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/view/Event.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/view/Event.js ***! + \*************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * Encapsulates the data needed to raise an event + * @implements {Event} + */ +var DataEvent = /** @class */ (function () { + /** + * @param {!string} eventType One of: value, child_added, child_changed, child_moved, child_removed + * @param {!EventRegistration} eventRegistration The function to call to with the event data. User provided + * @param {!DataSnapshot} snapshot The data backing the event + * @param {?string=} prevName Optional, the name of the previous child for child_* events. + */ + function DataEvent(eventType, eventRegistration, snapshot, prevName) { + this.eventType = eventType; + this.eventRegistration = eventRegistration; + this.snapshot = snapshot; + this.prevName = prevName; + } + /** + * @inheritDoc + */ + DataEvent.prototype.getPath = function () { + var ref = this.snapshot.getRef(); + if (this.eventType === 'value') { + return ref.path; + } + else { + return ref.getParent().path; + } + }; + /** + * @inheritDoc + */ + DataEvent.prototype.getEventType = function () { + return this.eventType; + }; + /** + * @inheritDoc + */ + DataEvent.prototype.getEventRunner = function () { + return this.eventRegistration.getEventRunner(this); + }; + /** + * @inheritDoc + */ + DataEvent.prototype.toString = function () { + return (this.getPath().toString() + + ':' + + this.eventType + + ':' + + util_1.stringify(this.snapshot.exportVal())); + }; + return DataEvent; +}()); +exports.DataEvent = DataEvent; +var CancelEvent = /** @class */ (function () { + /** + * @param {EventRegistration} eventRegistration + * @param {Error} error + * @param {!Path} path + */ + function CancelEvent(eventRegistration, error, path) { + this.eventRegistration = eventRegistration; + this.error = error; + this.path = path; + } + /** + * @inheritDoc + */ + CancelEvent.prototype.getPath = function () { + return this.path; + }; + /** + * @inheritDoc + */ + CancelEvent.prototype.getEventType = function () { + return 'cancel'; + }; + /** + * @inheritDoc + */ + CancelEvent.prototype.getEventRunner = function () { + return this.eventRegistration.getEventRunner(this); + }; + /** + * @inheritDoc + */ + CancelEvent.prototype.toString = function () { + return this.path.toString() + ':cancel'; + }; + return CancelEvent; +}()); +exports.CancelEvent = CancelEvent; + +//# sourceMappingURL=Event.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/view/EventGenerator.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/view/EventGenerator.js ***! + \**********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 Node_1 = __webpack_require__(/*! ../snap/Node */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/Node.js"); +var Change_1 = __webpack_require__(/*! ./Change */ "./node_modules/@firebase/database/dist/cjs/src/core/view/Change.js"); +var util_1 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * An EventGenerator is used to convert "raw" changes (Change) as computed by the + * CacheDiffer into actual events (Event) that can be raised. See generateEventsForChanges() + * for details. + * + * @constructor + */ +var EventGenerator = /** @class */ (function () { + /** + * + * @param {!Query} query_ + */ + function EventGenerator(query_) { + this.query_ = query_; + /** + * @private + * @type {!Index} + */ + this.index_ = this.query_.getQueryParams().getIndex(); + } + /** + * Given a set of raw changes (no moved events and prevName not specified yet), and a set of + * EventRegistrations that should be notified of these changes, generate the actual events to be raised. + * + * Notes: + * - child_moved events will be synthesized at this time for any child_changed events that affect + * our index. + * - prevName will be calculated based on the index ordering. + * + * @param {!Array.} changes + * @param {!Node} eventCache + * @param {!Array.} eventRegistrations + * @return {!Array.} + */ + EventGenerator.prototype.generateEventsForChanges = function (changes, eventCache, eventRegistrations) { + var _this = this; + var events = []; + var moves = []; + changes.forEach(function (change) { + if (change.type === Change_1.Change.CHILD_CHANGED && + _this.index_.indexedValueChanged(change.oldSnap, change.snapshotNode)) { + moves.push(Change_1.Change.childMovedChange(change.childName, change.snapshotNode)); + } + }); + this.generateEventsForType_(events, Change_1.Change.CHILD_REMOVED, changes, eventRegistrations, eventCache); + this.generateEventsForType_(events, Change_1.Change.CHILD_ADDED, changes, eventRegistrations, eventCache); + this.generateEventsForType_(events, Change_1.Change.CHILD_MOVED, moves, eventRegistrations, eventCache); + this.generateEventsForType_(events, Change_1.Change.CHILD_CHANGED, changes, eventRegistrations, eventCache); + this.generateEventsForType_(events, Change_1.Change.VALUE, changes, eventRegistrations, eventCache); + return events; + }; + /** + * Given changes of a single change type, generate the corresponding events. + * + * @param {!Array.} events + * @param {!string} eventType + * @param {!Array.} changes + * @param {!Array.} registrations + * @param {!Node} eventCache + * @private + */ + EventGenerator.prototype.generateEventsForType_ = function (events, eventType, changes, registrations, eventCache) { + var _this = this; + var filteredChanges = changes.filter(function (change) { return change.type === eventType; }); + filteredChanges.sort(this.compareChanges_.bind(this)); + filteredChanges.forEach(function (change) { + var materializedChange = _this.materializeSingleChange_(change, eventCache); + registrations.forEach(function (registration) { + if (registration.respondsTo(change.type)) { + events.push(registration.createEvent(materializedChange, _this.query_)); + } + }); + }); + }; + /** + * @param {!Change} change + * @param {!Node} eventCache + * @return {!Change} + * @private + */ + EventGenerator.prototype.materializeSingleChange_ = function (change, eventCache) { + if (change.type === 'value' || change.type === 'child_removed') { + return change; + } + else { + change.prevName = eventCache.getPredecessorChildName( + /** @type {!string} */ + change.childName, change.snapshotNode, this.index_); + return change; + } + }; + /** + * @param {!Change} a + * @param {!Change} b + * @return {number} + * @private + */ + EventGenerator.prototype.compareChanges_ = function (a, b) { + if (a.childName == null || b.childName == null) { + throw util_1.assertionError('Should only compare child_ events.'); + } + var aWrapped = new Node_1.NamedNode(a.childName, a.snapshotNode); + var bWrapped = new Node_1.NamedNode(b.childName, b.snapshotNode); + return this.index_.compare(aWrapped, bWrapped); + }; + return EventGenerator; +}()); +exports.EventGenerator = EventGenerator; + +//# sourceMappingURL=EventGenerator.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/view/EventQueue.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/view/EventQueue.js ***! + \******************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! ../util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +/** + * The event queue serves a few purposes: + * 1. It ensures we maintain event order in the face of event callbacks doing operations that result in more + * events being queued. + * 2. raiseQueuedEvents() handles being called reentrantly nicely. That is, if in the course of raising events, + * raiseQueuedEvents() is called again, the "inner" call will pick up raising events where the "outer" call + * left off, ensuring that the events are still raised synchronously and in order. + * 3. You can use raiseEventsAtPath and raiseEventsForChangedPath to ensure only relevant previously-queued + * events are raised synchronously. + * + * NOTE: This can all go away if/when we move to async events. + * + * @constructor + */ +var EventQueue = /** @class */ (function () { + function EventQueue() { + /** + * @private + * @type {!Array.} + */ + this.eventLists_ = []; + /** + * Tracks recursion depth of raiseQueuedEvents_, for debugging purposes. + * @private + * @type {!number} + */ + this.recursionDepth_ = 0; + } + /** + * @param {!Array.} eventDataList The new events to queue. + */ + EventQueue.prototype.queueEvents = function (eventDataList) { + // We group events by path, storing them in a single EventList, to make it easier to skip over them quickly. + var currList = null; + for (var i = 0; i < eventDataList.length; i++) { + var eventData = eventDataList[i]; + var eventPath = eventData.getPath(); + if (currList !== null && !eventPath.equals(currList.getPath())) { + this.eventLists_.push(currList); + currList = null; + } + if (currList === null) { + currList = new EventList(eventPath); + } + currList.add(eventData); + } + if (currList) { + this.eventLists_.push(currList); + } + }; + /** + * Queues the specified events and synchronously raises all events (including previously queued ones) + * for the specified path. + * + * It is assumed that the new events are all for the specified path. + * + * @param {!Path} path The path to raise events for. + * @param {!Array.} eventDataList The new events to raise. + */ + EventQueue.prototype.raiseEventsAtPath = function (path, eventDataList) { + this.queueEvents(eventDataList); + this.raiseQueuedEventsMatchingPredicate_(function (eventPath) { + return eventPath.equals(path); + }); + }; + /** + * Queues the specified events and synchronously raises all events (including previously queued ones) for + * locations related to the specified change path (i.e. all ancestors and descendants). + * + * It is assumed that the new events are all related (ancestor or descendant) to the specified path. + * + * @param {!Path} changedPath The path to raise events for. + * @param {!Array.} eventDataList The events to raise + */ + EventQueue.prototype.raiseEventsForChangedPath = function (changedPath, eventDataList) { + this.queueEvents(eventDataList); + this.raiseQueuedEventsMatchingPredicate_(function (eventPath) { + return eventPath.contains(changedPath) || changedPath.contains(eventPath); + }); + }; + /** + * @param {!function(!Path):boolean} predicate + * @private + */ + EventQueue.prototype.raiseQueuedEventsMatchingPredicate_ = function (predicate) { + this.recursionDepth_++; + var sentAll = true; + for (var i = 0; i < this.eventLists_.length; i++) { + var eventList = this.eventLists_[i]; + if (eventList) { + var eventPath = eventList.getPath(); + if (predicate(eventPath)) { + this.eventLists_[i].raise(); + this.eventLists_[i] = null; + } + else { + sentAll = false; + } + } + } + if (sentAll) { + this.eventLists_ = []; + } + this.recursionDepth_--; + }; + return EventQueue; +}()); +exports.EventQueue = EventQueue; +/** + * @param {!Path} path + * @constructor + */ +var EventList = /** @class */ (function () { + function EventList(path_) { + this.path_ = path_; + /** + * @type {!Array.} + * @private + */ + this.events_ = []; + } + /** + * @param {!Event} eventData + */ + EventList.prototype.add = function (eventData) { + this.events_.push(eventData); + }; + /** + * Iterates through the list and raises each event + */ + EventList.prototype.raise = function () { + for (var i = 0; i < this.events_.length; i++) { + var eventData = this.events_[i]; + if (eventData !== null) { + this.events_[i] = null; + var eventFn = eventData.getEventRunner(); + if (util_1.logger) { + util_1.log('event: ' + eventData.toString()); + } + util_1.exceptionGuard(eventFn); + } + } + }; + /** + * @return {!Path} + */ + EventList.prototype.getPath = function () { + return this.path_; + }; + return EventList; +}()); +exports.EventList = EventList; + +//# sourceMappingURL=EventQueue.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/view/EventRegistration.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/view/EventRegistration.js ***! + \*************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 DataSnapshot_1 = __webpack_require__(/*! ../../api/DataSnapshot */ "./node_modules/@firebase/database/dist/cjs/src/api/DataSnapshot.js"); +var Event_1 = __webpack_require__(/*! ./Event */ "./node_modules/@firebase/database/dist/cjs/src/core/view/Event.js"); +var util_1 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * Represents registration for 'value' events. + */ +var ValueEventRegistration = /** @class */ (function () { + /** + * @param {?function(!DataSnapshot)} callback_ + * @param {?function(Error)} cancelCallback_ + * @param {?Object} context_ + */ + function ValueEventRegistration(callback_, cancelCallback_, context_) { + this.callback_ = callback_; + this.cancelCallback_ = cancelCallback_; + this.context_ = context_; + } + /** + * @inheritDoc + */ + ValueEventRegistration.prototype.respondsTo = function (eventType) { + return eventType === 'value'; + }; + /** + * @inheritDoc + */ + ValueEventRegistration.prototype.createEvent = function (change, query) { + var index = query.getQueryParams().getIndex(); + return new Event_1.DataEvent('value', this, new DataSnapshot_1.DataSnapshot(change.snapshotNode, query.getRef(), index)); + }; + /** + * @inheritDoc + */ + ValueEventRegistration.prototype.getEventRunner = function (eventData) { + var ctx = this.context_; + if (eventData.getEventType() === 'cancel') { + util_2.assert(this.cancelCallback_, 'Raising a cancel event on a listener with no cancel callback'); + var cancelCB_1 = this.cancelCallback_; + return function () { + // We know that error exists, we checked above that this is a cancel event + cancelCB_1.call(ctx, eventData.error); + }; + } + else { + var cb_1 = this.callback_; + return function () { + cb_1.call(ctx, eventData.snapshot); + }; + } + }; + /** + * @inheritDoc + */ + ValueEventRegistration.prototype.createCancelEvent = function (error, path) { + if (this.cancelCallback_) { + return new Event_1.CancelEvent(this, error, path); + } + else { + return null; + } + }; + /** + * @inheritDoc + */ + ValueEventRegistration.prototype.matches = function (other) { + if (!(other instanceof ValueEventRegistration)) { + return false; + } + else if (!other.callback_ || !this.callback_) { + // If no callback specified, we consider it to match any callback. + return true; + } + else { + return (other.callback_ === this.callback_ && other.context_ === this.context_); + } + }; + /** + * @inheritDoc + */ + ValueEventRegistration.prototype.hasAnyCallback = function () { + return this.callback_ !== null; + }; + return ValueEventRegistration; +}()); +exports.ValueEventRegistration = ValueEventRegistration; +/** + * Represents the registration of 1 or more child_xxx events. + * + * Currently, it is always exactly 1 child_xxx event, but the idea is we might let you + * register a group of callbacks together in the future. + * + * @constructor + * @implements {EventRegistration} + */ +var ChildEventRegistration = /** @class */ (function () { + /** + * @param {?Object.} callbacks_ + * @param {?function(Error)} cancelCallback_ + * @param {Object=} context_ + */ + function ChildEventRegistration(callbacks_, cancelCallback_, context_) { + this.callbacks_ = callbacks_; + this.cancelCallback_ = cancelCallback_; + this.context_ = context_; + } + /** + * @inheritDoc + */ + ChildEventRegistration.prototype.respondsTo = function (eventType) { + var eventToCheck = eventType === 'children_added' ? 'child_added' : eventType; + eventToCheck = + eventToCheck === 'children_removed' ? 'child_removed' : eventToCheck; + return util_1.contains(this.callbacks_, eventToCheck); + }; + /** + * @inheritDoc + */ + ChildEventRegistration.prototype.createCancelEvent = function (error, path) { + if (this.cancelCallback_) { + return new Event_1.CancelEvent(this, error, path); + } + else { + return null; + } + }; + /** + * @inheritDoc + */ + ChildEventRegistration.prototype.createEvent = function (change, query) { + util_2.assert(change.childName != null, 'Child events should have a childName.'); + var ref = query.getRef().child(/** @type {!string} */ (change.childName)); + var index = query.getQueryParams().getIndex(); + return new Event_1.DataEvent(change.type, this, new DataSnapshot_1.DataSnapshot(change.snapshotNode, ref, index), change.prevName); + }; + /** + * @inheritDoc + */ + ChildEventRegistration.prototype.getEventRunner = function (eventData) { + var ctx = this.context_; + if (eventData.getEventType() === 'cancel') { + util_2.assert(this.cancelCallback_, 'Raising a cancel event on a listener with no cancel callback'); + var cancelCB_2 = this.cancelCallback_; + return function () { + // We know that error exists, we checked above that this is a cancel event + cancelCB_2.call(ctx, eventData.error); + }; + } + else { + var cb_2 = this.callbacks_[eventData.eventType]; + return function () { + cb_2.call(ctx, eventData.snapshot, eventData.prevName); + }; + } + }; + /** + * @inheritDoc + */ + ChildEventRegistration.prototype.matches = function (other) { + if (other instanceof ChildEventRegistration) { + if (!this.callbacks_ || !other.callbacks_) { + return true; + } + else if (this.context_ === other.context_) { + var otherCount = util_1.getCount(other.callbacks_); + var thisCount = util_1.getCount(this.callbacks_); + if (otherCount === thisCount) { + // If count is 1, do an exact match on eventType, if either is defined but null, it's a match. + // If event types don't match, not a match + // If count is not 1, exact match across all + if (otherCount === 1) { + var otherKey /** @type {!string} */ = util_1.getAnyKey(other.callbacks_); + var thisKey /** @type {!string} */ = util_1.getAnyKey(this.callbacks_); + return (thisKey === otherKey && + (!other.callbacks_[otherKey] || + !this.callbacks_[thisKey] || + other.callbacks_[otherKey] === this.callbacks_[thisKey])); + } + else { + // Exact match on each key. + return util_1.every(this.callbacks_, function (eventType, cb) { return other.callbacks_[eventType] === cb; }); + } + } + } + } + return false; + }; + /** + * @inheritDoc + */ + ChildEventRegistration.prototype.hasAnyCallback = function () { + return this.callbacks_ !== null; + }; + return ChildEventRegistration; +}()); +exports.ChildEventRegistration = ChildEventRegistration; + +//# sourceMappingURL=EventRegistration.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/view/QueryParams.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/view/QueryParams.js ***! + \*******************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! ../util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var KeyIndex_1 = __webpack_require__(/*! ../snap/indexes/KeyIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/KeyIndex.js"); +var PriorityIndex_1 = __webpack_require__(/*! ../snap/indexes/PriorityIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PriorityIndex.js"); +var ValueIndex_1 = __webpack_require__(/*! ../snap/indexes/ValueIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/ValueIndex.js"); +var PathIndex_1 = __webpack_require__(/*! ../snap/indexes/PathIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PathIndex.js"); +var IndexedFilter_1 = __webpack_require__(/*! ./filter/IndexedFilter */ "./node_modules/@firebase/database/dist/cjs/src/core/view/filter/IndexedFilter.js"); +var LimitedFilter_1 = __webpack_require__(/*! ./filter/LimitedFilter */ "./node_modules/@firebase/database/dist/cjs/src/core/view/filter/LimitedFilter.js"); +var RangedFilter_1 = __webpack_require__(/*! ./filter/RangedFilter */ "./node_modules/@firebase/database/dist/cjs/src/core/view/filter/RangedFilter.js"); +var util_3 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/** + * This class is an immutable-from-the-public-api struct containing a set of query parameters defining a + * range to be returned for a particular location. It is assumed that validation of parameters is done at the + * user-facing API level, so it is not done here. + * @constructor + */ +var QueryParams = /** @class */ (function () { + function QueryParams() { + this.limitSet_ = false; + this.startSet_ = false; + this.startNameSet_ = false; + this.endSet_ = false; + this.endNameSet_ = false; + this.limit_ = 0; + this.viewFrom_ = ''; + this.indexStartValue_ = null; + this.indexStartName_ = ''; + this.indexEndValue_ = null; + this.indexEndName_ = ''; + this.index_ = PriorityIndex_1.PRIORITY_INDEX; + } + /** + * @return {boolean} + */ + QueryParams.prototype.hasStart = function () { + return this.startSet_; + }; + /** + * @return {boolean} True if it would return from left. + */ + QueryParams.prototype.isViewFromLeft = function () { + if (this.viewFrom_ === '') { + // limit(), rather than limitToFirst or limitToLast was called. + // This means that only one of startSet_ and endSet_ is true. Use them + // to calculate which side of the view to anchor to. If neither is set, + // anchor to the end. + return this.startSet_; + } + else { + return (this.viewFrom_ === QueryParams.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT); + } + }; + /** + * Only valid to call if hasStart() returns true + * @return {*} + */ + QueryParams.prototype.getIndexStartValue = function () { + util_1.assert(this.startSet_, 'Only valid if start has been set'); + return this.indexStartValue_; + }; + /** + * Only valid to call if hasStart() returns true. + * Returns the starting key name for the range defined by these query parameters + * @return {!string} + */ + QueryParams.prototype.getIndexStartName = function () { + util_1.assert(this.startSet_, 'Only valid if start has been set'); + if (this.startNameSet_) { + return this.indexStartName_; + } + else { + return util_2.MIN_NAME; + } + }; + /** + * @return {boolean} + */ + QueryParams.prototype.hasEnd = function () { + return this.endSet_; + }; + /** + * Only valid to call if hasEnd() returns true. + * @return {*} + */ + QueryParams.prototype.getIndexEndValue = function () { + util_1.assert(this.endSet_, 'Only valid if end has been set'); + return this.indexEndValue_; + }; + /** + * Only valid to call if hasEnd() returns true. + * Returns the end key name for the range defined by these query parameters + * @return {!string} + */ + QueryParams.prototype.getIndexEndName = function () { + util_1.assert(this.endSet_, 'Only valid if end has been set'); + if (this.endNameSet_) { + return this.indexEndName_; + } + else { + return util_2.MAX_NAME; + } + }; + /** + * @return {boolean} + */ + QueryParams.prototype.hasLimit = function () { + return this.limitSet_; + }; + /** + * @return {boolean} True if a limit has been set and it has been explicitly anchored + */ + QueryParams.prototype.hasAnchoredLimit = function () { + return this.limitSet_ && this.viewFrom_ !== ''; + }; + /** + * Only valid to call if hasLimit() returns true + * @return {!number} + */ + QueryParams.prototype.getLimit = function () { + util_1.assert(this.limitSet_, 'Only valid if limit has been set'); + return this.limit_; + }; + /** + * @return {!Index} + */ + QueryParams.prototype.getIndex = function () { + return this.index_; + }; + /** + * @return {!QueryParams} + * @private + */ + QueryParams.prototype.copy_ = function () { + var copy = new QueryParams(); + copy.limitSet_ = this.limitSet_; + copy.limit_ = this.limit_; + copy.startSet_ = this.startSet_; + copy.indexStartValue_ = this.indexStartValue_; + copy.startNameSet_ = this.startNameSet_; + copy.indexStartName_ = this.indexStartName_; + copy.endSet_ = this.endSet_; + copy.indexEndValue_ = this.indexEndValue_; + copy.endNameSet_ = this.endNameSet_; + copy.indexEndName_ = this.indexEndName_; + copy.index_ = this.index_; + copy.viewFrom_ = this.viewFrom_; + return copy; + }; + /** + * @param {!number} newLimit + * @return {!QueryParams} + */ + QueryParams.prototype.limit = function (newLimit) { + var newParams = this.copy_(); + newParams.limitSet_ = true; + newParams.limit_ = newLimit; + newParams.viewFrom_ = ''; + return newParams; + }; + /** + * @param {!number} newLimit + * @return {!QueryParams} + */ + QueryParams.prototype.limitToFirst = function (newLimit) { + var newParams = this.copy_(); + newParams.limitSet_ = true; + newParams.limit_ = newLimit; + newParams.viewFrom_ = QueryParams.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT; + return newParams; + }; + /** + * @param {!number} newLimit + * @return {!QueryParams} + */ + QueryParams.prototype.limitToLast = function (newLimit) { + var newParams = this.copy_(); + newParams.limitSet_ = true; + newParams.limit_ = newLimit; + newParams.viewFrom_ = QueryParams.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_RIGHT; + return newParams; + }; + /** + * @param {*} indexValue + * @param {?string=} key + * @return {!QueryParams} + */ + QueryParams.prototype.startAt = function (indexValue, key) { + var newParams = this.copy_(); + newParams.startSet_ = true; + if (!(indexValue !== undefined)) { + indexValue = null; + } + newParams.indexStartValue_ = indexValue; + if (key != null) { + newParams.startNameSet_ = true; + newParams.indexStartName_ = key; + } + else { + newParams.startNameSet_ = false; + newParams.indexStartName_ = ''; + } + return newParams; + }; + /** + * @param {*} indexValue + * @param {?string=} key + * @return {!QueryParams} + */ + QueryParams.prototype.endAt = function (indexValue, key) { + var newParams = this.copy_(); + newParams.endSet_ = true; + if (!(indexValue !== undefined)) { + indexValue = null; + } + newParams.indexEndValue_ = indexValue; + if (key !== undefined) { + newParams.endNameSet_ = true; + newParams.indexEndName_ = key; + } + else { + newParams.endNameSet_ = false; + newParams.indexEndName_ = ''; + } + return newParams; + }; + /** + * @param {!Index} index + * @return {!QueryParams} + */ + QueryParams.prototype.orderBy = function (index) { + var newParams = this.copy_(); + newParams.index_ = index; + return newParams; + }; + /** + * @return {!Object} + */ + QueryParams.prototype.getQueryObject = function () { + var WIRE_PROTOCOL_CONSTANTS = QueryParams.WIRE_PROTOCOL_CONSTANTS_; + var obj = {}; + if (this.startSet_) { + obj[WIRE_PROTOCOL_CONSTANTS.INDEX_START_VALUE] = this.indexStartValue_; + if (this.startNameSet_) { + obj[WIRE_PROTOCOL_CONSTANTS.INDEX_START_NAME] = this.indexStartName_; + } + } + if (this.endSet_) { + obj[WIRE_PROTOCOL_CONSTANTS.INDEX_END_VALUE] = this.indexEndValue_; + if (this.endNameSet_) { + obj[WIRE_PROTOCOL_CONSTANTS.INDEX_END_NAME] = this.indexEndName_; + } + } + if (this.limitSet_) { + obj[WIRE_PROTOCOL_CONSTANTS.LIMIT] = this.limit_; + var viewFrom = this.viewFrom_; + if (viewFrom === '') { + if (this.isViewFromLeft()) { + viewFrom = WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_LEFT; + } + else { + viewFrom = WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_RIGHT; + } + } + obj[WIRE_PROTOCOL_CONSTANTS.VIEW_FROM] = viewFrom; + } + // For now, priority index is the default, so we only specify if it's some other index + if (this.index_ !== PriorityIndex_1.PRIORITY_INDEX) { + obj[WIRE_PROTOCOL_CONSTANTS.INDEX] = this.index_.toString(); + } + return obj; + }; + /** + * @return {boolean} + */ + QueryParams.prototype.loadsAllData = function () { + return !(this.startSet_ || this.endSet_ || this.limitSet_); + }; + /** + * @return {boolean} + */ + QueryParams.prototype.isDefault = function () { + return this.loadsAllData() && this.index_ == PriorityIndex_1.PRIORITY_INDEX; + }; + /** + * @return {!NodeFilter} + */ + QueryParams.prototype.getNodeFilter = function () { + if (this.loadsAllData()) { + return new IndexedFilter_1.IndexedFilter(this.getIndex()); + } + else if (this.hasLimit()) { + return new LimitedFilter_1.LimitedFilter(this); + } + else { + return new RangedFilter_1.RangedFilter(this); + } + }; + /** + * Returns a set of REST query string parameters representing this query. + * + * @return {!Object.} query string parameters + */ + QueryParams.prototype.toRestQueryStringParameters = function () { + var REST_CONSTANTS = QueryParams.REST_QUERY_CONSTANTS_; + var qs = {}; + if (this.isDefault()) { + return qs; + } + var orderBy; + if (this.index_ === PriorityIndex_1.PRIORITY_INDEX) { + orderBy = REST_CONSTANTS.PRIORITY_INDEX; + } + else if (this.index_ === ValueIndex_1.VALUE_INDEX) { + orderBy = REST_CONSTANTS.VALUE_INDEX; + } + else if (this.index_ === KeyIndex_1.KEY_INDEX) { + orderBy = REST_CONSTANTS.KEY_INDEX; + } + else { + util_1.assert(this.index_ instanceof PathIndex_1.PathIndex, 'Unrecognized index type!'); + orderBy = this.index_.toString(); + } + qs[REST_CONSTANTS.ORDER_BY] = util_3.stringify(orderBy); + if (this.startSet_) { + qs[REST_CONSTANTS.START_AT] = util_3.stringify(this.indexStartValue_); + if (this.startNameSet_) { + qs[REST_CONSTANTS.START_AT] += ',' + util_3.stringify(this.indexStartName_); + } + } + if (this.endSet_) { + qs[REST_CONSTANTS.END_AT] = util_3.stringify(this.indexEndValue_); + if (this.endNameSet_) { + qs[REST_CONSTANTS.END_AT] += ',' + util_3.stringify(this.indexEndName_); + } + } + if (this.limitSet_) { + if (this.isViewFromLeft()) { + qs[REST_CONSTANTS.LIMIT_TO_FIRST] = this.limit_; + } + else { + qs[REST_CONSTANTS.LIMIT_TO_LAST] = this.limit_; + } + } + return qs; + }; + /** + * Wire Protocol Constants + * @const + * @enum {string} + * @private + */ + QueryParams.WIRE_PROTOCOL_CONSTANTS_ = { + INDEX_START_VALUE: 'sp', + INDEX_START_NAME: 'sn', + INDEX_END_VALUE: 'ep', + INDEX_END_NAME: 'en', + LIMIT: 'l', + VIEW_FROM: 'vf', + VIEW_FROM_LEFT: 'l', + VIEW_FROM_RIGHT: 'r', + INDEX: 'i' + }; + /** + * REST Query Constants + * @const + * @enum {string} + * @private + */ + QueryParams.REST_QUERY_CONSTANTS_ = { + ORDER_BY: 'orderBy', + PRIORITY_INDEX: '$priority', + VALUE_INDEX: '$value', + KEY_INDEX: '$key', + START_AT: 'startAt', + END_AT: 'endAt', + LIMIT_TO_FIRST: 'limitToFirst', + LIMIT_TO_LAST: 'limitToLast' + }; + /** + * Default, empty query parameters + * @type {!QueryParams} + * @const + */ + QueryParams.DEFAULT = new QueryParams(); + return QueryParams; +}()); +exports.QueryParams = QueryParams; + +//# sourceMappingURL=QueryParams.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/view/View.js": +/*!************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/view/View.js ***! + \************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 IndexedFilter_1 = __webpack_require__(/*! ./filter/IndexedFilter */ "./node_modules/@firebase/database/dist/cjs/src/core/view/filter/IndexedFilter.js"); +var ViewProcessor_1 = __webpack_require__(/*! ./ViewProcessor */ "./node_modules/@firebase/database/dist/cjs/src/core/view/ViewProcessor.js"); +var ChildrenNode_1 = __webpack_require__(/*! ../snap/ChildrenNode */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/ChildrenNode.js"); +var CacheNode_1 = __webpack_require__(/*! ./CacheNode */ "./node_modules/@firebase/database/dist/cjs/src/core/view/CacheNode.js"); +var ViewCache_1 = __webpack_require__(/*! ./ViewCache */ "./node_modules/@firebase/database/dist/cjs/src/core/view/ViewCache.js"); +var EventGenerator_1 = __webpack_require__(/*! ./EventGenerator */ "./node_modules/@firebase/database/dist/cjs/src/core/view/EventGenerator.js"); +var util_1 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var Operation_1 = __webpack_require__(/*! ../operation/Operation */ "./node_modules/@firebase/database/dist/cjs/src/core/operation/Operation.js"); +var Change_1 = __webpack_require__(/*! ./Change */ "./node_modules/@firebase/database/dist/cjs/src/core/view/Change.js"); +var PriorityIndex_1 = __webpack_require__(/*! ../snap/indexes/PriorityIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PriorityIndex.js"); +/** + * A view represents a specific location and query that has 1 or more event registrations. + * + * It does several things: + * - Maintains the list of event registrations for this location/query. + * - Maintains a cache of the data visible for this location/query. + * - Applies new operations (via applyOperation), updates the cache, and based on the event + * registrations returns the set of events to be raised. + * @constructor + */ +var View = /** @class */ (function () { + /** + * + * @param {!Query} query_ + * @param {!ViewCache} initialViewCache + */ + function View(query_, initialViewCache) { + this.query_ = query_; + this.eventRegistrations_ = []; + var params = this.query_.getQueryParams(); + var indexFilter = new IndexedFilter_1.IndexedFilter(params.getIndex()); + var filter = params.getNodeFilter(); + /** + * @type {ViewProcessor} + * @private + */ + this.processor_ = new ViewProcessor_1.ViewProcessor(filter); + var initialServerCache = initialViewCache.getServerCache(); + var initialEventCache = initialViewCache.getEventCache(); + // Don't filter server node with other filter than index, wait for tagged listen + var serverSnap = indexFilter.updateFullNode(ChildrenNode_1.ChildrenNode.EMPTY_NODE, initialServerCache.getNode(), null); + var eventSnap = filter.updateFullNode(ChildrenNode_1.ChildrenNode.EMPTY_NODE, initialEventCache.getNode(), null); + var newServerCache = new CacheNode_1.CacheNode(serverSnap, initialServerCache.isFullyInitialized(), indexFilter.filtersNodes()); + var newEventCache = new CacheNode_1.CacheNode(eventSnap, initialEventCache.isFullyInitialized(), filter.filtersNodes()); + /** + * @type {!ViewCache} + * @private + */ + this.viewCache_ = new ViewCache_1.ViewCache(newEventCache, newServerCache); + /** + * @type {!EventGenerator} + * @private + */ + this.eventGenerator_ = new EventGenerator_1.EventGenerator(this.query_); + } + /** + * @return {!Query} + */ + View.prototype.getQuery = function () { + return this.query_; + }; + /** + * @return {?Node} + */ + View.prototype.getServerCache = function () { + return this.viewCache_.getServerCache().getNode(); + }; + /** + * @param {!Path} path + * @return {?Node} + */ + View.prototype.getCompleteServerCache = function (path) { + var cache = this.viewCache_.getCompleteServerSnap(); + if (cache) { + // If this isn't a "loadsAllData" view, then cache isn't actually a complete cache and + // we need to see if it contains the child we're interested in. + if (this.query_.getQueryParams().loadsAllData() || + (!path.isEmpty() && !cache.getImmediateChild(path.getFront()).isEmpty())) { + return cache.getChild(path); + } + } + return null; + }; + /** + * @return {boolean} + */ + View.prototype.isEmpty = function () { + return this.eventRegistrations_.length === 0; + }; + /** + * @param {!EventRegistration} eventRegistration + */ + View.prototype.addEventRegistration = function (eventRegistration) { + this.eventRegistrations_.push(eventRegistration); + }; + /** + * @param {?EventRegistration} eventRegistration If null, remove all callbacks. + * @param {Error=} cancelError If a cancelError is provided, appropriate cancel events will be returned. + * @return {!Array.} Cancel events, if cancelError was provided. + */ + View.prototype.removeEventRegistration = function (eventRegistration, cancelError) { + var cancelEvents = []; + if (cancelError) { + util_1.assert(eventRegistration == null, 'A cancel should cancel all event registrations.'); + var path_1 = this.query_.path; + this.eventRegistrations_.forEach(function (registration) { + cancelError /** @type {!Error} */ = cancelError; + var maybeEvent = registration.createCancelEvent(cancelError, path_1); + if (maybeEvent) { + cancelEvents.push(maybeEvent); + } + }); + } + if (eventRegistration) { + var remaining = []; + for (var i = 0; i < this.eventRegistrations_.length; ++i) { + var existing = this.eventRegistrations_[i]; + if (!existing.matches(eventRegistration)) { + remaining.push(existing); + } + else if (eventRegistration.hasAnyCallback()) { + // We're removing just this one + remaining = remaining.concat(this.eventRegistrations_.slice(i + 1)); + break; + } + } + this.eventRegistrations_ = remaining; + } + else { + this.eventRegistrations_ = []; + } + return cancelEvents; + }; + /** + * Applies the given Operation, updates our cache, and returns the appropriate events. + * + * @param {!Operation} operation + * @param {!WriteTreeRef} writesCache + * @param {?Node} completeServerCache + * @return {!Array.} + */ + View.prototype.applyOperation = function (operation, writesCache, completeServerCache) { + if (operation.type === Operation_1.OperationType.MERGE && + operation.source.queryId !== null) { + util_1.assert(this.viewCache_.getCompleteServerSnap(), 'We should always have a full cache before handling merges'); + util_1.assert(this.viewCache_.getCompleteEventSnap(), 'Missing event cache, even though we have a server cache'); + } + var oldViewCache = this.viewCache_; + var result = this.processor_.applyOperation(oldViewCache, operation, writesCache, completeServerCache); + this.processor_.assertIndexed(result.viewCache); + util_1.assert(result.viewCache.getServerCache().isFullyInitialized() || + !oldViewCache.getServerCache().isFullyInitialized(), 'Once a server snap is complete, it should never go back'); + this.viewCache_ = result.viewCache; + return this.generateEventsForChanges_(result.changes, result.viewCache.getEventCache().getNode(), null); + }; + /** + * @param {!EventRegistration} registration + * @return {!Array.} + */ + View.prototype.getInitialEvents = function (registration) { + var eventSnap = this.viewCache_.getEventCache(); + var initialChanges = []; + if (!eventSnap.getNode().isLeafNode()) { + var eventNode = eventSnap.getNode(); + eventNode.forEachChild(PriorityIndex_1.PRIORITY_INDEX, function (key, childNode) { + initialChanges.push(Change_1.Change.childAddedChange(key, childNode)); + }); + } + if (eventSnap.isFullyInitialized()) { + initialChanges.push(Change_1.Change.valueChange(eventSnap.getNode())); + } + return this.generateEventsForChanges_(initialChanges, eventSnap.getNode(), registration); + }; + /** + * @private + * @param {!Array.} changes + * @param {!Node} eventCache + * @param {EventRegistration=} eventRegistration + * @return {!Array.} + */ + View.prototype.generateEventsForChanges_ = function (changes, eventCache, eventRegistration) { + var registrations = eventRegistration + ? [eventRegistration] + : this.eventRegistrations_; + return this.eventGenerator_.generateEventsForChanges(changes, eventCache, registrations); + }; + return View; +}()); +exports.View = View; + +//# sourceMappingURL=View.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/view/ViewCache.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/view/ViewCache.js ***! + \*****************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 ChildrenNode_1 = __webpack_require__(/*! ../snap/ChildrenNode */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/ChildrenNode.js"); +var CacheNode_1 = __webpack_require__(/*! ./CacheNode */ "./node_modules/@firebase/database/dist/cjs/src/core/view/CacheNode.js"); +/** + * Stores the data we have cached for a view. + * + * serverSnap is the cached server data, eventSnap is the cached event data (server data plus any local writes). + * + * @constructor + */ +var ViewCache = /** @class */ (function () { + /** + * + * @param {!CacheNode} eventCache_ + * @param {!CacheNode} serverCache_ + */ + function ViewCache(eventCache_, serverCache_) { + this.eventCache_ = eventCache_; + this.serverCache_ = serverCache_; + } + /** + * @param {!Node} eventSnap + * @param {boolean} complete + * @param {boolean} filtered + * @return {!ViewCache} + */ + ViewCache.prototype.updateEventSnap = function (eventSnap, complete, filtered) { + return new ViewCache(new CacheNode_1.CacheNode(eventSnap, complete, filtered), this.serverCache_); + }; + /** + * @param {!Node} serverSnap + * @param {boolean} complete + * @param {boolean} filtered + * @return {!ViewCache} + */ + ViewCache.prototype.updateServerSnap = function (serverSnap, complete, filtered) { + return new ViewCache(this.eventCache_, new CacheNode_1.CacheNode(serverSnap, complete, filtered)); + }; + /** + * @return {!CacheNode} + */ + ViewCache.prototype.getEventCache = function () { + return this.eventCache_; + }; + /** + * @return {?Node} + */ + ViewCache.prototype.getCompleteEventSnap = function () { + return this.eventCache_.isFullyInitialized() + ? this.eventCache_.getNode() + : null; + }; + /** + * @return {!CacheNode} + */ + ViewCache.prototype.getServerCache = function () { + return this.serverCache_; + }; + /** + * @return {?Node} + */ + ViewCache.prototype.getCompleteServerSnap = function () { + return this.serverCache_.isFullyInitialized() + ? this.serverCache_.getNode() + : null; + }; + /** + * @const + * @type {ViewCache} + */ + ViewCache.Empty = new ViewCache(new CacheNode_1.CacheNode(ChildrenNode_1.ChildrenNode.EMPTY_NODE, + /*fullyInitialized=*/ false, + /*filtered=*/ false), new CacheNode_1.CacheNode(ChildrenNode_1.ChildrenNode.EMPTY_NODE, + /*fullyInitialized=*/ false, + /*filtered=*/ false)); + return ViewCache; +}()); +exports.ViewCache = ViewCache; + +//# sourceMappingURL=ViewCache.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/view/ViewProcessor.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/view/ViewProcessor.js ***! + \*********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 Operation_1 = __webpack_require__(/*! ../operation/Operation */ "./node_modules/@firebase/database/dist/cjs/src/core/operation/Operation.js"); +var util_1 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var ChildChangeAccumulator_1 = __webpack_require__(/*! ./ChildChangeAccumulator */ "./node_modules/@firebase/database/dist/cjs/src/core/view/ChildChangeAccumulator.js"); +var Change_1 = __webpack_require__(/*! ./Change */ "./node_modules/@firebase/database/dist/cjs/src/core/view/Change.js"); +var ChildrenNode_1 = __webpack_require__(/*! ../snap/ChildrenNode */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/ChildrenNode.js"); +var KeyIndex_1 = __webpack_require__(/*! ../snap/indexes/KeyIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/KeyIndex.js"); +var ImmutableTree_1 = __webpack_require__(/*! ../util/ImmutableTree */ "./node_modules/@firebase/database/dist/cjs/src/core/util/ImmutableTree.js"); +var Path_1 = __webpack_require__(/*! ../util/Path */ "./node_modules/@firebase/database/dist/cjs/src/core/util/Path.js"); +var CompleteChildSource_1 = __webpack_require__(/*! ./CompleteChildSource */ "./node_modules/@firebase/database/dist/cjs/src/core/view/CompleteChildSource.js"); +/** + * @constructor + * @struct + */ +var ProcessorResult = /** @class */ (function () { + /** + * @param {!ViewCache} viewCache + * @param {!Array.} changes + */ + function ProcessorResult(viewCache, changes) { + this.viewCache = viewCache; + this.changes = changes; + } + return ProcessorResult; +}()); +exports.ProcessorResult = ProcessorResult; +/** + * @constructor + */ +var ViewProcessor = /** @class */ (function () { + /** + * @param {!NodeFilter} filter_ + */ + function ViewProcessor(filter_) { + this.filter_ = filter_; + } + /** + * @param {!ViewCache} viewCache + */ + ViewProcessor.prototype.assertIndexed = function (viewCache) { + util_1.assert(viewCache + .getEventCache() + .getNode() + .isIndexed(this.filter_.getIndex()), 'Event snap not indexed'); + util_1.assert(viewCache + .getServerCache() + .getNode() + .isIndexed(this.filter_.getIndex()), 'Server snap not indexed'); + }; + /** + * @param {!ViewCache} oldViewCache + * @param {!Operation} operation + * @param {!WriteTreeRef} writesCache + * @param {?Node} completeCache + * @return {!ProcessorResult} + */ + ViewProcessor.prototype.applyOperation = function (oldViewCache, operation, writesCache, completeCache) { + var accumulator = new ChildChangeAccumulator_1.ChildChangeAccumulator(); + var newViewCache, filterServerNode; + if (operation.type === Operation_1.OperationType.OVERWRITE) { + var overwrite = operation; + if (overwrite.source.fromUser) { + newViewCache = this.applyUserOverwrite_(oldViewCache, overwrite.path, overwrite.snap, writesCache, completeCache, accumulator); + } + else { + util_1.assert(overwrite.source.fromServer, 'Unknown source.'); + // We filter the node if it's a tagged update or the node has been previously filtered and the + // update is not at the root in which case it is ok (and necessary) to mark the node unfiltered + // again + filterServerNode = + overwrite.source.tagged || + (oldViewCache.getServerCache().isFiltered() && + !overwrite.path.isEmpty()); + newViewCache = this.applyServerOverwrite_(oldViewCache, overwrite.path, overwrite.snap, writesCache, completeCache, filterServerNode, accumulator); + } + } + else if (operation.type === Operation_1.OperationType.MERGE) { + var merge = operation; + if (merge.source.fromUser) { + newViewCache = this.applyUserMerge_(oldViewCache, merge.path, merge.children, writesCache, completeCache, accumulator); + } + else { + util_1.assert(merge.source.fromServer, 'Unknown source.'); + // We filter the node if it's a tagged update or the node has been previously filtered + filterServerNode = + merge.source.tagged || oldViewCache.getServerCache().isFiltered(); + newViewCache = this.applyServerMerge_(oldViewCache, merge.path, merge.children, writesCache, completeCache, filterServerNode, accumulator); + } + } + else if (operation.type === Operation_1.OperationType.ACK_USER_WRITE) { + var ackUserWrite = operation; + if (!ackUserWrite.revert) { + newViewCache = this.ackUserWrite_(oldViewCache, ackUserWrite.path, ackUserWrite.affectedTree, writesCache, completeCache, accumulator); + } + else { + newViewCache = this.revertUserWrite_(oldViewCache, ackUserWrite.path, writesCache, completeCache, accumulator); + } + } + else if (operation.type === Operation_1.OperationType.LISTEN_COMPLETE) { + newViewCache = this.listenComplete_(oldViewCache, operation.path, writesCache, accumulator); + } + else { + throw util_1.assertionError('Unknown operation type: ' + operation.type); + } + var changes = accumulator.getChanges(); + ViewProcessor.maybeAddValueEvent_(oldViewCache, newViewCache, changes); + return new ProcessorResult(newViewCache, changes); + }; + /** + * @param {!ViewCache} oldViewCache + * @param {!ViewCache} newViewCache + * @param {!Array.} accumulator + * @private + */ + ViewProcessor.maybeAddValueEvent_ = function (oldViewCache, newViewCache, accumulator) { + var eventSnap = newViewCache.getEventCache(); + if (eventSnap.isFullyInitialized()) { + var isLeafOrEmpty = eventSnap.getNode().isLeafNode() || eventSnap.getNode().isEmpty(); + var oldCompleteSnap = oldViewCache.getCompleteEventSnap(); + if (accumulator.length > 0 || + !oldViewCache.getEventCache().isFullyInitialized() || + (isLeafOrEmpty && + !eventSnap + .getNode() + .equals(/** @type {!Node} */ (oldCompleteSnap))) || + !eventSnap + .getNode() + .getPriority() + .equals(oldCompleteSnap.getPriority())) { + accumulator.push(Change_1.Change.valueChange( + /** @type {!Node} */ newViewCache.getCompleteEventSnap())); + } + } + }; + /** + * @param {!ViewCache} viewCache + * @param {!Path} changePath + * @param {!WriteTreeRef} writesCache + * @param {!CompleteChildSource} source + * @param {!ChildChangeAccumulator} accumulator + * @return {!ViewCache} + * @private + */ + ViewProcessor.prototype.generateEventCacheAfterServerEvent_ = function (viewCache, changePath, writesCache, source, accumulator) { + var oldEventSnap = viewCache.getEventCache(); + if (writesCache.shadowingWrite(changePath) != null) { + // we have a shadowing write, ignore changes + return viewCache; + } + else { + var newEventCache = void 0, serverNode = void 0; + if (changePath.isEmpty()) { + // TODO: figure out how this plays with "sliding ack windows" + util_1.assert(viewCache.getServerCache().isFullyInitialized(), 'If change path is empty, we must have complete server data'); + if (viewCache.getServerCache().isFiltered()) { + // We need to special case this, because we need to only apply writes to complete children, or + // we might end up raising events for incomplete children. If the server data is filtered deep + // writes cannot be guaranteed to be complete + var serverCache = viewCache.getCompleteServerSnap(); + var completeChildren = serverCache instanceof ChildrenNode_1.ChildrenNode + ? serverCache + : ChildrenNode_1.ChildrenNode.EMPTY_NODE; + var completeEventChildren = writesCache.calcCompleteEventChildren(completeChildren); + newEventCache = this.filter_.updateFullNode(viewCache.getEventCache().getNode(), completeEventChildren, accumulator); + } + else { + var completeNode = writesCache.calcCompleteEventCache(viewCache.getCompleteServerSnap()); + newEventCache = this.filter_.updateFullNode(viewCache.getEventCache().getNode(), completeNode, accumulator); + } + } + else { + var childKey = changePath.getFront(); + if (childKey == '.priority') { + util_1.assert(changePath.getLength() == 1, "Can't have a priority with additional path components"); + var oldEventNode = oldEventSnap.getNode(); + serverNode = viewCache.getServerCache().getNode(); + // we might have overwrites for this priority + var updatedPriority = writesCache.calcEventCacheAfterServerOverwrite(changePath, oldEventNode, serverNode); + if (updatedPriority != null) { + newEventCache = this.filter_.updatePriority(oldEventNode, updatedPriority); + } + else { + // priority didn't change, keep old node + newEventCache = oldEventSnap.getNode(); + } + } + else { + var childChangePath = changePath.popFront(); + // update child + var newEventChild = void 0; + if (oldEventSnap.isCompleteForChild(childKey)) { + serverNode = viewCache.getServerCache().getNode(); + var eventChildUpdate = writesCache.calcEventCacheAfterServerOverwrite(changePath, oldEventSnap.getNode(), serverNode); + if (eventChildUpdate != null) { + newEventChild = oldEventSnap + .getNode() + .getImmediateChild(childKey) + .updateChild(childChangePath, eventChildUpdate); + } + else { + // Nothing changed, just keep the old child + newEventChild = oldEventSnap + .getNode() + .getImmediateChild(childKey); + } + } + else { + newEventChild = writesCache.calcCompleteChild(childKey, viewCache.getServerCache()); + } + if (newEventChild != null) { + newEventCache = this.filter_.updateChild(oldEventSnap.getNode(), childKey, newEventChild, childChangePath, source, accumulator); + } + else { + // no complete child available or no change + newEventCache = oldEventSnap.getNode(); + } + } + } + return viewCache.updateEventSnap(newEventCache, oldEventSnap.isFullyInitialized() || changePath.isEmpty(), this.filter_.filtersNodes()); + } + }; + /** + * @param {!ViewCache} oldViewCache + * @param {!Path} changePath + * @param {!Node} changedSnap + * @param {!WriteTreeRef} writesCache + * @param {?Node} completeCache + * @param {boolean} filterServerNode + * @param {!ChildChangeAccumulator} accumulator + * @return {!ViewCache} + * @private + */ + ViewProcessor.prototype.applyServerOverwrite_ = function (oldViewCache, changePath, changedSnap, writesCache, completeCache, filterServerNode, accumulator) { + var oldServerSnap = oldViewCache.getServerCache(); + var newServerCache; + var serverFilter = filterServerNode + ? this.filter_ + : this.filter_.getIndexedFilter(); + if (changePath.isEmpty()) { + newServerCache = serverFilter.updateFullNode(oldServerSnap.getNode(), changedSnap, null); + } + else if (serverFilter.filtersNodes() && !oldServerSnap.isFiltered()) { + // we want to filter the server node, but we didn't filter the server node yet, so simulate a full update + var newServerNode = oldServerSnap + .getNode() + .updateChild(changePath, changedSnap); + newServerCache = serverFilter.updateFullNode(oldServerSnap.getNode(), newServerNode, null); + } + else { + var childKey = changePath.getFront(); + if (!oldServerSnap.isCompleteForPath(changePath) && + changePath.getLength() > 1) { + // We don't update incomplete nodes with updates intended for other listeners + return oldViewCache; + } + var childChangePath = changePath.popFront(); + var childNode = oldServerSnap.getNode().getImmediateChild(childKey); + var newChildNode = childNode.updateChild(childChangePath, changedSnap); + if (childKey == '.priority') { + newServerCache = serverFilter.updatePriority(oldServerSnap.getNode(), newChildNode); + } + else { + newServerCache = serverFilter.updateChild(oldServerSnap.getNode(), childKey, newChildNode, childChangePath, CompleteChildSource_1.NO_COMPLETE_CHILD_SOURCE, null); + } + } + var newViewCache = oldViewCache.updateServerSnap(newServerCache, oldServerSnap.isFullyInitialized() || changePath.isEmpty(), serverFilter.filtersNodes()); + var source = new CompleteChildSource_1.WriteTreeCompleteChildSource(writesCache, newViewCache, completeCache); + return this.generateEventCacheAfterServerEvent_(newViewCache, changePath, writesCache, source, accumulator); + }; + /** + * @param {!ViewCache} oldViewCache + * @param {!Path} changePath + * @param {!Node} changedSnap + * @param {!WriteTreeRef} writesCache + * @param {?Node} completeCache + * @param {!ChildChangeAccumulator} accumulator + * @return {!ViewCache} + * @private + */ + ViewProcessor.prototype.applyUserOverwrite_ = function (oldViewCache, changePath, changedSnap, writesCache, completeCache, accumulator) { + var oldEventSnap = oldViewCache.getEventCache(); + var newViewCache, newEventCache; + var source = new CompleteChildSource_1.WriteTreeCompleteChildSource(writesCache, oldViewCache, completeCache); + if (changePath.isEmpty()) { + newEventCache = this.filter_.updateFullNode(oldViewCache.getEventCache().getNode(), changedSnap, accumulator); + newViewCache = oldViewCache.updateEventSnap(newEventCache, true, this.filter_.filtersNodes()); + } + else { + var childKey = changePath.getFront(); + if (childKey === '.priority') { + newEventCache = this.filter_.updatePriority(oldViewCache.getEventCache().getNode(), changedSnap); + newViewCache = oldViewCache.updateEventSnap(newEventCache, oldEventSnap.isFullyInitialized(), oldEventSnap.isFiltered()); + } + else { + var childChangePath = changePath.popFront(); + var oldChild = oldEventSnap.getNode().getImmediateChild(childKey); + var newChild = void 0; + if (childChangePath.isEmpty()) { + // Child overwrite, we can replace the child + newChild = changedSnap; + } + else { + var childNode = source.getCompleteChild(childKey); + if (childNode != null) { + if (childChangePath.getBack() === '.priority' && + childNode.getChild(childChangePath.parent()).isEmpty()) { + // This is a priority update on an empty node. If this node exists on the server, the + // server will send down the priority in the update, so ignore for now + newChild = childNode; + } + else { + newChild = childNode.updateChild(childChangePath, changedSnap); + } + } + else { + // There is no complete child node available + newChild = ChildrenNode_1.ChildrenNode.EMPTY_NODE; + } + } + if (!oldChild.equals(newChild)) { + var newEventSnap = this.filter_.updateChild(oldEventSnap.getNode(), childKey, newChild, childChangePath, source, accumulator); + newViewCache = oldViewCache.updateEventSnap(newEventSnap, oldEventSnap.isFullyInitialized(), this.filter_.filtersNodes()); + } + else { + newViewCache = oldViewCache; + } + } + } + return newViewCache; + }; + /** + * @param {!ViewCache} viewCache + * @param {string} childKey + * @return {boolean} + * @private + */ + ViewProcessor.cacheHasChild_ = function (viewCache, childKey) { + return viewCache.getEventCache().isCompleteForChild(childKey); + }; + /** + * @param {!ViewCache} viewCache + * @param {!Path} path + * @param {ImmutableTree.} changedChildren + * @param {!WriteTreeRef} writesCache + * @param {?Node} serverCache + * @param {!ChildChangeAccumulator} accumulator + * @return {!ViewCache} + * @private + */ + ViewProcessor.prototype.applyUserMerge_ = function (viewCache, path, changedChildren, writesCache, serverCache, accumulator) { + var _this = this; + // HACK: In the case of a limit query, there may be some changes that bump things out of the + // window leaving room for new items. It's important we process these changes first, so we + // iterate the changes twice, first processing any that affect items currently in view. + // TODO: I consider an item "in view" if cacheHasChild is true, which checks both the server + // and event snap. I'm not sure if this will result in edge cases when a child is in one but + // not the other. + var curViewCache = viewCache; + changedChildren.foreach(function (relativePath, childNode) { + var writePath = path.child(relativePath); + if (ViewProcessor.cacheHasChild_(viewCache, writePath.getFront())) { + curViewCache = _this.applyUserOverwrite_(curViewCache, writePath, childNode, writesCache, serverCache, accumulator); + } + }); + changedChildren.foreach(function (relativePath, childNode) { + var writePath = path.child(relativePath); + if (!ViewProcessor.cacheHasChild_(viewCache, writePath.getFront())) { + curViewCache = _this.applyUserOverwrite_(curViewCache, writePath, childNode, writesCache, serverCache, accumulator); + } + }); + return curViewCache; + }; + /** + * @param {!Node} node + * @param {ImmutableTree.} merge + * @return {!Node} + * @private + */ + ViewProcessor.prototype.applyMerge_ = function (node, merge) { + merge.foreach(function (relativePath, childNode) { + node = node.updateChild(relativePath, childNode); + }); + return node; + }; + /** + * @param {!ViewCache} viewCache + * @param {!Path} path + * @param {!ImmutableTree.} changedChildren + * @param {!WriteTreeRef} writesCache + * @param {?Node} serverCache + * @param {boolean} filterServerNode + * @param {!ChildChangeAccumulator} accumulator + * @return {!ViewCache} + * @private + */ + ViewProcessor.prototype.applyServerMerge_ = function (viewCache, path, changedChildren, writesCache, serverCache, filterServerNode, accumulator) { + var _this = this; + // If we don't have a cache yet, this merge was intended for a previously listen in the same location. Ignore it and + // wait for the complete data update coming soon. + if (viewCache + .getServerCache() + .getNode() + .isEmpty() && + !viewCache.getServerCache().isFullyInitialized()) { + return viewCache; + } + // HACK: In the case of a limit query, there may be some changes that bump things out of the + // window leaving room for new items. It's important we process these changes first, so we + // iterate the changes twice, first processing any that affect items currently in view. + // TODO: I consider an item "in view" if cacheHasChild is true, which checks both the server + // and event snap. I'm not sure if this will result in edge cases when a child is in one but + // not the other. + var curViewCache = viewCache; + var viewMergeTree; + if (path.isEmpty()) { + viewMergeTree = changedChildren; + } + else { + viewMergeTree = ImmutableTree_1.ImmutableTree.Empty.setTree(path, changedChildren); + } + var serverNode = viewCache.getServerCache().getNode(); + viewMergeTree.children.inorderTraversal(function (childKey, childTree) { + if (serverNode.hasChild(childKey)) { + var serverChild = viewCache + .getServerCache() + .getNode() + .getImmediateChild(childKey); + var newChild = _this.applyMerge_(serverChild, childTree); + curViewCache = _this.applyServerOverwrite_(curViewCache, new Path_1.Path(childKey), newChild, writesCache, serverCache, filterServerNode, accumulator); + } + }); + viewMergeTree.children.inorderTraversal(function (childKey, childMergeTree) { + var isUnknownDeepMerge = !viewCache.getServerCache().isCompleteForChild(childKey) && + childMergeTree.value == null; + if (!serverNode.hasChild(childKey) && !isUnknownDeepMerge) { + var serverChild = viewCache + .getServerCache() + .getNode() + .getImmediateChild(childKey); + var newChild = _this.applyMerge_(serverChild, childMergeTree); + curViewCache = _this.applyServerOverwrite_(curViewCache, new Path_1.Path(childKey), newChild, writesCache, serverCache, filterServerNode, accumulator); + } + }); + return curViewCache; + }; + /** + * @param {!ViewCache} viewCache + * @param {!Path} ackPath + * @param {!ImmutableTree} affectedTree + * @param {!WriteTreeRef} writesCache + * @param {?Node} completeCache + * @param {!ChildChangeAccumulator} accumulator + * @return {!ViewCache} + * @private + */ + ViewProcessor.prototype.ackUserWrite_ = function (viewCache, ackPath, affectedTree, writesCache, completeCache, accumulator) { + if (writesCache.shadowingWrite(ackPath) != null) { + return viewCache; + } + // Only filter server node if it is currently filtered + var filterServerNode = viewCache.getServerCache().isFiltered(); + // Essentially we'll just get our existing server cache for the affected paths and re-apply it as a server update + // now that it won't be shadowed. + var serverCache = viewCache.getServerCache(); + if (affectedTree.value != null) { + // This is an overwrite. + if ((ackPath.isEmpty() && serverCache.isFullyInitialized()) || + serverCache.isCompleteForPath(ackPath)) { + return this.applyServerOverwrite_(viewCache, ackPath, serverCache.getNode().getChild(ackPath), writesCache, completeCache, filterServerNode, accumulator); + } + else if (ackPath.isEmpty()) { + // This is a goofy edge case where we are acking data at this location but don't have full data. We + // should just re-apply whatever we have in our cache as a merge. + var changedChildren_1 = ImmutableTree_1.ImmutableTree.Empty; + serverCache.getNode().forEachChild(KeyIndex_1.KEY_INDEX, function (name, node) { + changedChildren_1 = changedChildren_1.set(new Path_1.Path(name), node); + }); + return this.applyServerMerge_(viewCache, ackPath, changedChildren_1, writesCache, completeCache, filterServerNode, accumulator); + } + else { + return viewCache; + } + } + else { + // This is a merge. + var changedChildren_2 = ImmutableTree_1.ImmutableTree.Empty; + affectedTree.foreach(function (mergePath, value) { + var serverCachePath = ackPath.child(mergePath); + if (serverCache.isCompleteForPath(serverCachePath)) { + changedChildren_2 = changedChildren_2.set(mergePath, serverCache.getNode().getChild(serverCachePath)); + } + }); + return this.applyServerMerge_(viewCache, ackPath, changedChildren_2, writesCache, completeCache, filterServerNode, accumulator); + } + }; + /** + * @param {!ViewCache} viewCache + * @param {!Path} path + * @param {!WriteTreeRef} writesCache + * @param {!ChildChangeAccumulator} accumulator + * @return {!ViewCache} + * @private + */ + ViewProcessor.prototype.listenComplete_ = function (viewCache, path, writesCache, accumulator) { + var oldServerNode = viewCache.getServerCache(); + var newViewCache = viewCache.updateServerSnap(oldServerNode.getNode(), oldServerNode.isFullyInitialized() || path.isEmpty(), oldServerNode.isFiltered()); + return this.generateEventCacheAfterServerEvent_(newViewCache, path, writesCache, CompleteChildSource_1.NO_COMPLETE_CHILD_SOURCE, accumulator); + }; + /** + * @param {!ViewCache} viewCache + * @param {!Path} path + * @param {!WriteTreeRef} writesCache + * @param {?Node} completeServerCache + * @param {!ChildChangeAccumulator} accumulator + * @return {!ViewCache} + * @private + */ + ViewProcessor.prototype.revertUserWrite_ = function (viewCache, path, writesCache, completeServerCache, accumulator) { + var complete; + if (writesCache.shadowingWrite(path) != null) { + return viewCache; + } + else { + var source = new CompleteChildSource_1.WriteTreeCompleteChildSource(writesCache, viewCache, completeServerCache); + var oldEventCache = viewCache.getEventCache().getNode(); + var newEventCache = void 0; + if (path.isEmpty() || path.getFront() === '.priority') { + var newNode = void 0; + if (viewCache.getServerCache().isFullyInitialized()) { + newNode = writesCache.calcCompleteEventCache(viewCache.getCompleteServerSnap()); + } + else { + var serverChildren = viewCache.getServerCache().getNode(); + util_1.assert(serverChildren instanceof ChildrenNode_1.ChildrenNode, 'serverChildren would be complete if leaf node'); + newNode = writesCache.calcCompleteEventChildren(serverChildren); + } + newNode = newNode; + newEventCache = this.filter_.updateFullNode(oldEventCache, newNode, accumulator); + } + else { + var childKey = path.getFront(); + var newChild = writesCache.calcCompleteChild(childKey, viewCache.getServerCache()); + if (newChild == null && + viewCache.getServerCache().isCompleteForChild(childKey)) { + newChild = oldEventCache.getImmediateChild(childKey); + } + if (newChild != null) { + newEventCache = this.filter_.updateChild(oldEventCache, childKey, newChild, path.popFront(), source, accumulator); + } + else if (viewCache + .getEventCache() + .getNode() + .hasChild(childKey)) { + // No complete child available, delete the existing one, if any + newEventCache = this.filter_.updateChild(oldEventCache, childKey, ChildrenNode_1.ChildrenNode.EMPTY_NODE, path.popFront(), source, accumulator); + } + else { + newEventCache = oldEventCache; + } + if (newEventCache.isEmpty() && + viewCache.getServerCache().isFullyInitialized()) { + // We might have reverted all child writes. Maybe the old event was a leaf node + complete = writesCache.calcCompleteEventCache(viewCache.getCompleteServerSnap()); + if (complete.isLeafNode()) { + newEventCache = this.filter_.updateFullNode(newEventCache, complete, accumulator); + } + } + } + complete = + viewCache.getServerCache().isFullyInitialized() || + writesCache.shadowingWrite(Path_1.Path.Empty) != null; + return viewCache.updateEventSnap(newEventCache, complete, this.filter_.filtersNodes()); + } + }; + return ViewProcessor; +}()); +exports.ViewProcessor = ViewProcessor; + +//# sourceMappingURL=ViewProcessor.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/view/filter/IndexedFilter.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/view/filter/IndexedFilter.js ***! + \****************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var Change_1 = __webpack_require__(/*! ../Change */ "./node_modules/@firebase/database/dist/cjs/src/core/view/Change.js"); +var ChildrenNode_1 = __webpack_require__(/*! ../../snap/ChildrenNode */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/ChildrenNode.js"); +var PriorityIndex_1 = __webpack_require__(/*! ../../snap/indexes/PriorityIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PriorityIndex.js"); +/** + * Doesn't really filter nodes but applies an index to the node and keeps track of any changes + * + * @constructor + * @implements {NodeFilter} + * @param {!Index} index + */ +var IndexedFilter = /** @class */ (function () { + function IndexedFilter(index_) { + this.index_ = index_; + } + IndexedFilter.prototype.updateChild = function (snap, key, newChild, affectedPath, source, optChangeAccumulator) { + util_1.assert(snap.isIndexed(this.index_), 'A node must be indexed if only a child is updated'); + var oldChild = snap.getImmediateChild(key); + // Check if anything actually changed. + if (oldChild.getChild(affectedPath).equals(newChild.getChild(affectedPath))) { + // There's an edge case where a child can enter or leave the view because affectedPath was set to null. + // In this case, affectedPath will appear null in both the old and new snapshots. So we need + // to avoid treating these cases as "nothing changed." + if (oldChild.isEmpty() == newChild.isEmpty()) { + // Nothing changed. + // This assert should be valid, but it's expensive (can dominate perf testing) so don't actually do it. + //assert(oldChild.equals(newChild), 'Old and new snapshots should be equal.'); + return snap; + } + } + if (optChangeAccumulator != null) { + if (newChild.isEmpty()) { + if (snap.hasChild(key)) { + optChangeAccumulator.trackChildChange(Change_1.Change.childRemovedChange(key, oldChild)); + } + else { + util_1.assert(snap.isLeafNode(), 'A child remove without an old child only makes sense on a leaf node'); + } + } + else if (oldChild.isEmpty()) { + optChangeAccumulator.trackChildChange(Change_1.Change.childAddedChange(key, newChild)); + } + else { + optChangeAccumulator.trackChildChange(Change_1.Change.childChangedChange(key, newChild, oldChild)); + } + } + if (snap.isLeafNode() && newChild.isEmpty()) { + return snap; + } + else { + // Make sure the node is indexed + return snap.updateImmediateChild(key, newChild).withIndex(this.index_); + } + }; + /** + * @inheritDoc + */ + IndexedFilter.prototype.updateFullNode = function (oldSnap, newSnap, optChangeAccumulator) { + if (optChangeAccumulator != null) { + if (!oldSnap.isLeafNode()) { + oldSnap.forEachChild(PriorityIndex_1.PRIORITY_INDEX, function (key, childNode) { + if (!newSnap.hasChild(key)) { + optChangeAccumulator.trackChildChange(Change_1.Change.childRemovedChange(key, childNode)); + } + }); + } + if (!newSnap.isLeafNode()) { + newSnap.forEachChild(PriorityIndex_1.PRIORITY_INDEX, function (key, childNode) { + if (oldSnap.hasChild(key)) { + var oldChild = oldSnap.getImmediateChild(key); + if (!oldChild.equals(childNode)) { + optChangeAccumulator.trackChildChange(Change_1.Change.childChangedChange(key, childNode, oldChild)); + } + } + else { + optChangeAccumulator.trackChildChange(Change_1.Change.childAddedChange(key, childNode)); + } + }); + } + } + return newSnap.withIndex(this.index_); + }; + /** + * @inheritDoc + */ + IndexedFilter.prototype.updatePriority = function (oldSnap, newPriority) { + if (oldSnap.isEmpty()) { + return ChildrenNode_1.ChildrenNode.EMPTY_NODE; + } + else { + return oldSnap.updatePriority(newPriority); + } + }; + /** + * @inheritDoc + */ + IndexedFilter.prototype.filtersNodes = function () { + return false; + }; + /** + * @inheritDoc + */ + IndexedFilter.prototype.getIndexedFilter = function () { + return this; + }; + /** + * @inheritDoc + */ + IndexedFilter.prototype.getIndex = function () { + return this.index_; + }; + return IndexedFilter; +}()); +exports.IndexedFilter = IndexedFilter; + +//# sourceMappingURL=IndexedFilter.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/view/filter/LimitedFilter.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/view/filter/LimitedFilter.js ***! + \****************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 RangedFilter_1 = __webpack_require__(/*! ./RangedFilter */ "./node_modules/@firebase/database/dist/cjs/src/core/view/filter/RangedFilter.js"); +var ChildrenNode_1 = __webpack_require__(/*! ../../snap/ChildrenNode */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/ChildrenNode.js"); +var Node_1 = __webpack_require__(/*! ../../snap/Node */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/Node.js"); +var util_1 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var Change_1 = __webpack_require__(/*! ../Change */ "./node_modules/@firebase/database/dist/cjs/src/core/view/Change.js"); +/** + * Applies a limit and a range to a node and uses RangedFilter to do the heavy lifting where possible + * + * @constructor + * @implements {NodeFilter} + */ +var LimitedFilter = /** @class */ (function () { + /** + * @param {!QueryParams} params + */ + function LimitedFilter(params) { + this.rangedFilter_ = new RangedFilter_1.RangedFilter(params); + this.index_ = params.getIndex(); + this.limit_ = params.getLimit(); + this.reverse_ = !params.isViewFromLeft(); + } + /** + * @inheritDoc + */ + LimitedFilter.prototype.updateChild = function (snap, key, newChild, affectedPath, source, optChangeAccumulator) { + if (!this.rangedFilter_.matches(new Node_1.NamedNode(key, newChild))) { + newChild = ChildrenNode_1.ChildrenNode.EMPTY_NODE; + } + if (snap.getImmediateChild(key).equals(newChild)) { + // No change + return snap; + } + else if (snap.numChildren() < this.limit_) { + return this.rangedFilter_ + .getIndexedFilter() + .updateChild(snap, key, newChild, affectedPath, source, optChangeAccumulator); + } + else { + return this.fullLimitUpdateChild_(snap, key, newChild, source, optChangeAccumulator); + } + }; + /** + * @inheritDoc + */ + LimitedFilter.prototype.updateFullNode = function (oldSnap, newSnap, optChangeAccumulator) { + var filtered; + if (newSnap.isLeafNode() || newSnap.isEmpty()) { + // Make sure we have a children node with the correct index, not a leaf node; + filtered = ChildrenNode_1.ChildrenNode.EMPTY_NODE.withIndex(this.index_); + } + else { + if (this.limit_ * 2 < newSnap.numChildren() && + newSnap.isIndexed(this.index_)) { + // Easier to build up a snapshot, since what we're given has more than twice the elements we want + filtered = ChildrenNode_1.ChildrenNode.EMPTY_NODE.withIndex(this.index_); + // anchor to the startPost, endPost, or last element as appropriate + var iterator = void 0; + if (this.reverse_) { + iterator = newSnap.getReverseIteratorFrom(this.rangedFilter_.getEndPost(), this.index_); + } + else { + iterator = newSnap.getIteratorFrom(this.rangedFilter_.getStartPost(), this.index_); + } + var count = 0; + while (iterator.hasNext() && count < this.limit_) { + var next = iterator.getNext(); + var inRange = void 0; + if (this.reverse_) { + inRange = + this.index_.compare(this.rangedFilter_.getStartPost(), next) <= 0; + } + else { + inRange = + this.index_.compare(next, this.rangedFilter_.getEndPost()) <= 0; + } + if (inRange) { + filtered = filtered.updateImmediateChild(next.name, next.node); + count++; + } + else { + // if we have reached the end post, we cannot keep adding elemments + break; + } + } + } + else { + // The snap contains less than twice the limit. Faster to delete from the snap than build up a new one + filtered = newSnap.withIndex(this.index_); + // Don't support priorities on queries + filtered = filtered.updatePriority(ChildrenNode_1.ChildrenNode.EMPTY_NODE); + var startPost = void 0; + var endPost = void 0; + var cmp = void 0; + var iterator = void 0; + if (this.reverse_) { + iterator = filtered.getReverseIterator(this.index_); + startPost = this.rangedFilter_.getEndPost(); + endPost = this.rangedFilter_.getStartPost(); + var indexCompare_1 = this.index_.getCompare(); + cmp = function (a, b) { return indexCompare_1(b, a); }; + } + else { + iterator = filtered.getIterator(this.index_); + startPost = this.rangedFilter_.getStartPost(); + endPost = this.rangedFilter_.getEndPost(); + cmp = this.index_.getCompare(); + } + var count = 0; + var foundStartPost = false; + while (iterator.hasNext()) { + var next = iterator.getNext(); + if (!foundStartPost && cmp(startPost, next) <= 0) { + // start adding + foundStartPost = true; + } + var inRange = foundStartPost && count < this.limit_ && cmp(next, endPost) <= 0; + if (inRange) { + count++; + } + else { + filtered = filtered.updateImmediateChild(next.name, ChildrenNode_1.ChildrenNode.EMPTY_NODE); + } + } + } + } + return this.rangedFilter_ + .getIndexedFilter() + .updateFullNode(oldSnap, filtered, optChangeAccumulator); + }; + /** + * @inheritDoc + */ + LimitedFilter.prototype.updatePriority = function (oldSnap, newPriority) { + // Don't support priorities on queries + return oldSnap; + }; + /** + * @inheritDoc + */ + LimitedFilter.prototype.filtersNodes = function () { + return true; + }; + /** + * @inheritDoc + */ + LimitedFilter.prototype.getIndexedFilter = function () { + return this.rangedFilter_.getIndexedFilter(); + }; + /** + * @inheritDoc + */ + LimitedFilter.prototype.getIndex = function () { + return this.index_; + }; + /** + * @param {!Node} snap + * @param {string} childKey + * @param {!Node} childSnap + * @param {!CompleteChildSource} source + * @param {?ChildChangeAccumulator} changeAccumulator + * @return {!Node} + * @private + */ + LimitedFilter.prototype.fullLimitUpdateChild_ = function (snap, childKey, childSnap, source, changeAccumulator) { + // TODO: rename all cache stuff etc to general snap terminology + var cmp; + if (this.reverse_) { + var indexCmp_1 = this.index_.getCompare(); + cmp = function (a, b) { return indexCmp_1(b, a); }; + } + else { + cmp = this.index_.getCompare(); + } + var oldEventCache = snap; + util_1.assert(oldEventCache.numChildren() == this.limit_, ''); + var newChildNamedNode = new Node_1.NamedNode(childKey, childSnap); + var windowBoundary = this.reverse_ + ? oldEventCache.getFirstChild(this.index_) + : oldEventCache.getLastChild(this.index_); + var inRange = this.rangedFilter_.matches(newChildNamedNode); + if (oldEventCache.hasChild(childKey)) { + var oldChildSnap = oldEventCache.getImmediateChild(childKey); + var nextChild = source.getChildAfterChild(this.index_, windowBoundary, this.reverse_); + while (nextChild != null && + (nextChild.name == childKey || oldEventCache.hasChild(nextChild.name))) { + // There is a weird edge case where a node is updated as part of a merge in the write tree, but hasn't + // been applied to the limited filter yet. Ignore this next child which will be updated later in + // the limited filter... + nextChild = source.getChildAfterChild(this.index_, nextChild, this.reverse_); + } + var compareNext = nextChild == null ? 1 : cmp(nextChild, newChildNamedNode); + var remainsInWindow = inRange && !childSnap.isEmpty() && compareNext >= 0; + if (remainsInWindow) { + if (changeAccumulator != null) { + changeAccumulator.trackChildChange(Change_1.Change.childChangedChange(childKey, childSnap, oldChildSnap)); + } + return oldEventCache.updateImmediateChild(childKey, childSnap); + } + else { + if (changeAccumulator != null) { + changeAccumulator.trackChildChange(Change_1.Change.childRemovedChange(childKey, oldChildSnap)); + } + var newEventCache = oldEventCache.updateImmediateChild(childKey, ChildrenNode_1.ChildrenNode.EMPTY_NODE); + var nextChildInRange = nextChild != null && this.rangedFilter_.matches(nextChild); + if (nextChildInRange) { + if (changeAccumulator != null) { + changeAccumulator.trackChildChange(Change_1.Change.childAddedChange(nextChild.name, nextChild.node)); + } + return newEventCache.updateImmediateChild(nextChild.name, nextChild.node); + } + else { + return newEventCache; + } + } + } + else if (childSnap.isEmpty()) { + // we're deleting a node, but it was not in the window, so ignore it + return snap; + } + else if (inRange) { + if (cmp(windowBoundary, newChildNamedNode) >= 0) { + if (changeAccumulator != null) { + changeAccumulator.trackChildChange(Change_1.Change.childRemovedChange(windowBoundary.name, windowBoundary.node)); + changeAccumulator.trackChildChange(Change_1.Change.childAddedChange(childKey, childSnap)); + } + return oldEventCache + .updateImmediateChild(childKey, childSnap) + .updateImmediateChild(windowBoundary.name, ChildrenNode_1.ChildrenNode.EMPTY_NODE); + } + else { + return snap; + } + } + else { + return snap; + } + }; + return LimitedFilter; +}()); +exports.LimitedFilter = LimitedFilter; + +//# sourceMappingURL=LimitedFilter.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/core/view/filter/RangedFilter.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/core/view/filter/RangedFilter.js ***! + \***************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 IndexedFilter_1 = __webpack_require__(/*! ./IndexedFilter */ "./node_modules/@firebase/database/dist/cjs/src/core/view/filter/IndexedFilter.js"); +var PriorityIndex_1 = __webpack_require__(/*! ../../snap/indexes/PriorityIndex */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/indexes/PriorityIndex.js"); +var Node_1 = __webpack_require__(/*! ../../../core/snap/Node */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/Node.js"); +var ChildrenNode_1 = __webpack_require__(/*! ../../snap/ChildrenNode */ "./node_modules/@firebase/database/dist/cjs/src/core/snap/ChildrenNode.js"); +/** + * Filters nodes by range and uses an IndexFilter to track any changes after filtering the node + * + * @constructor + * @implements {NodeFilter} + */ +var RangedFilter = /** @class */ (function () { + /** + * @param {!QueryParams} params + */ + function RangedFilter(params) { + this.indexedFilter_ = new IndexedFilter_1.IndexedFilter(params.getIndex()); + this.index_ = params.getIndex(); + this.startPost_ = RangedFilter.getStartPost_(params); + this.endPost_ = RangedFilter.getEndPost_(params); + } + /** + * @return {!NamedNode} + */ + RangedFilter.prototype.getStartPost = function () { + return this.startPost_; + }; + /** + * @return {!NamedNode} + */ + RangedFilter.prototype.getEndPost = function () { + return this.endPost_; + }; + /** + * @param {!NamedNode} node + * @return {boolean} + */ + RangedFilter.prototype.matches = function (node) { + return (this.index_.compare(this.getStartPost(), node) <= 0 && + this.index_.compare(node, this.getEndPost()) <= 0); + }; + /** + * @inheritDoc + */ + RangedFilter.prototype.updateChild = function (snap, key, newChild, affectedPath, source, optChangeAccumulator) { + if (!this.matches(new Node_1.NamedNode(key, newChild))) { + newChild = ChildrenNode_1.ChildrenNode.EMPTY_NODE; + } + return this.indexedFilter_.updateChild(snap, key, newChild, affectedPath, source, optChangeAccumulator); + }; + /** + * @inheritDoc + */ + RangedFilter.prototype.updateFullNode = function (oldSnap, newSnap, optChangeAccumulator) { + if (newSnap.isLeafNode()) { + // Make sure we have a children node with the correct index, not a leaf node; + newSnap = ChildrenNode_1.ChildrenNode.EMPTY_NODE; + } + var filtered = newSnap.withIndex(this.index_); + // Don't support priorities on queries + filtered = filtered.updatePriority(ChildrenNode_1.ChildrenNode.EMPTY_NODE); + var self = this; + newSnap.forEachChild(PriorityIndex_1.PRIORITY_INDEX, function (key, childNode) { + if (!self.matches(new Node_1.NamedNode(key, childNode))) { + filtered = filtered.updateImmediateChild(key, ChildrenNode_1.ChildrenNode.EMPTY_NODE); + } + }); + return this.indexedFilter_.updateFullNode(oldSnap, filtered, optChangeAccumulator); + }; + /** + * @inheritDoc + */ + RangedFilter.prototype.updatePriority = function (oldSnap, newPriority) { + // Don't support priorities on queries + return oldSnap; + }; + /** + * @inheritDoc + */ + RangedFilter.prototype.filtersNodes = function () { + return true; + }; + /** + * @inheritDoc + */ + RangedFilter.prototype.getIndexedFilter = function () { + return this.indexedFilter_; + }; + /** + * @inheritDoc + */ + RangedFilter.prototype.getIndex = function () { + return this.index_; + }; + /** + * @param {!QueryParams} params + * @return {!NamedNode} + * @private + */ + RangedFilter.getStartPost_ = function (params) { + if (params.hasStart()) { + var startName = params.getIndexStartName(); + return params.getIndex().makePost(params.getIndexStartValue(), startName); + } + else { + return params.getIndex().minPost(); + } + }; + /** + * @param {!QueryParams} params + * @return {!NamedNode} + * @private + */ + RangedFilter.getEndPost_ = function (params) { + if (params.hasEnd()) { + var endName = params.getIndexEndName(); + return params.getIndex().makePost(params.getIndexEndValue(), endName); + } + else { + return params.getIndex().maxPost(); + } + }; + return RangedFilter; +}()); +exports.RangedFilter = RangedFilter; + +//# sourceMappingURL=RangedFilter.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/realtime/BrowserPollConnection.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/realtime/BrowserPollConnection.js ***! + \****************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! ../core/util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var CountedSet_1 = __webpack_require__(/*! ../core/util/CountedSet */ "./node_modules/@firebase/database/dist/cjs/src/core/util/CountedSet.js"); +var StatsManager_1 = __webpack_require__(/*! ../core/stats/StatsManager */ "./node_modules/@firebase/database/dist/cjs/src/core/stats/StatsManager.js"); +var PacketReceiver_1 = __webpack_require__(/*! ./polling/PacketReceiver */ "./node_modules/@firebase/database/dist/cjs/src/realtime/polling/PacketReceiver.js"); +var Constants_1 = __webpack_require__(/*! ./Constants */ "./node_modules/@firebase/database/dist/cjs/src/realtime/Constants.js"); +var util_2 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_3 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +// URL query parameters associated with longpolling +exports.FIREBASE_LONGPOLL_START_PARAM = 'start'; +exports.FIREBASE_LONGPOLL_CLOSE_COMMAND = 'close'; +exports.FIREBASE_LONGPOLL_COMMAND_CB_NAME = 'pLPCommand'; +exports.FIREBASE_LONGPOLL_DATA_CB_NAME = 'pRTLPCB'; +exports.FIREBASE_LONGPOLL_ID_PARAM = 'id'; +exports.FIREBASE_LONGPOLL_PW_PARAM = 'pw'; +exports.FIREBASE_LONGPOLL_SERIAL_PARAM = 'ser'; +exports.FIREBASE_LONGPOLL_CALLBACK_ID_PARAM = 'cb'; +exports.FIREBASE_LONGPOLL_SEGMENT_NUM_PARAM = 'seg'; +exports.FIREBASE_LONGPOLL_SEGMENTS_IN_PACKET = 'ts'; +exports.FIREBASE_LONGPOLL_DATA_PARAM = 'd'; +exports.FIREBASE_LONGPOLL_DISCONN_FRAME_PARAM = 'disconn'; +exports.FIREBASE_LONGPOLL_DISCONN_FRAME_REQUEST_PARAM = 'dframe'; +//Data size constants. +//TODO: Perf: the maximum length actually differs from browser to browser. +// We should check what browser we're on and set accordingly. +var MAX_URL_DATA_SIZE = 1870; +var SEG_HEADER_SIZE = 30; //ie: &seg=8299234&ts=982389123&d= +var MAX_PAYLOAD_SIZE = MAX_URL_DATA_SIZE - SEG_HEADER_SIZE; +/** + * Keepalive period + * send a fresh request at minimum every 25 seconds. Opera has a maximum request + * length of 30 seconds that we can't exceed. + * @const + * @type {number} + */ +var KEEPALIVE_REQUEST_INTERVAL = 25000; +/** + * How long to wait before aborting a long-polling connection attempt. + * @const + * @type {number} + */ +var LP_CONNECT_TIMEOUT = 30000; +/** + * This class manages a single long-polling connection. + * + * @constructor + * @implements {Transport} + */ +var BrowserPollConnection = /** @class */ (function () { + /** + * @param {string} connId An identifier for this connection, used for logging + * @param {RepoInfo} repoInfo The info for the endpoint to send data to. + * @param {string=} transportSessionId Optional transportSessionid if we are reconnecting for an existing + * transport session + * @param {string=} lastSessionId Optional lastSessionId if the PersistentConnection has already created a + * connection previously + */ + function BrowserPollConnection(connId, repoInfo, transportSessionId, lastSessionId) { + this.connId = connId; + this.repoInfo = repoInfo; + this.transportSessionId = transportSessionId; + this.lastSessionId = lastSessionId; + this.bytesSent = 0; + this.bytesReceived = 0; + this.everConnected_ = false; + this.log_ = util_1.logWrapper(connId); + this.stats_ = StatsManager_1.StatsManager.getCollection(repoInfo); + this.urlFn = function (params) { + return repoInfo.connectionURL(Constants_1.LONG_POLLING, params); + }; + } + /** + * + * @param {function(Object)} onMessage Callback when messages arrive + * @param {function()} onDisconnect Callback with connection lost. + */ + BrowserPollConnection.prototype.open = function (onMessage, onDisconnect) { + var _this = this; + this.curSegmentNum = 0; + this.onDisconnect_ = onDisconnect; + this.myPacketOrderer = new PacketReceiver_1.PacketReceiver(onMessage); + this.isClosed_ = false; + this.connectTimeoutTimer_ = setTimeout(function () { + _this.log_('Timed out trying to connect.'); + // Make sure we clear the host cache + _this.onClosed_(); + _this.connectTimeoutTimer_ = null; + }, Math.floor(LP_CONNECT_TIMEOUT)); + // Ensure we delay the creation of the iframe until the DOM is loaded. + util_1.executeWhenDOMReady(function () { + if (_this.isClosed_) + return; + //Set up a callback that gets triggered once a connection is set up. + _this.scriptTagHolder = new FirebaseIFrameScriptHolder(function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var command = args[0], arg1 = args[1], arg2 = args[2], arg3 = args[3], arg4 = args[4]; + _this.incrementIncomingBytes_(args); + if (!_this.scriptTagHolder) + return; // we closed the connection. + if (_this.connectTimeoutTimer_) { + clearTimeout(_this.connectTimeoutTimer_); + _this.connectTimeoutTimer_ = null; + } + _this.everConnected_ = true; + if (command == exports.FIREBASE_LONGPOLL_START_PARAM) { + _this.id = arg1; + _this.password = arg2; + } + else if (command === exports.FIREBASE_LONGPOLL_CLOSE_COMMAND) { + // Don't clear the host cache. We got a response from the server, so we know it's reachable + if (arg1) { + // We aren't expecting any more data (other than what the server's already in the process of sending us + // through our already open polls), so don't send any more. + _this.scriptTagHolder.sendNewPolls = false; + // arg1 in this case is the last response number sent by the server. We should try to receive + // all of the responses up to this one before closing + _this.myPacketOrderer.closeAfter(arg1, function () { + _this.onClosed_(); + }); + } + else { + _this.onClosed_(); + } + } + else { + throw new Error('Unrecognized command received: ' + command); + } + }, function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var pN = args[0], data = args[1]; + _this.incrementIncomingBytes_(args); + _this.myPacketOrderer.handleResponse(pN, data); + }, function () { + _this.onClosed_(); + }, _this.urlFn); + //Send the initial request to connect. The serial number is simply to keep the browser from pulling previous results + //from cache. + var urlParams = {}; + urlParams[exports.FIREBASE_LONGPOLL_START_PARAM] = 't'; + urlParams[exports.FIREBASE_LONGPOLL_SERIAL_PARAM] = Math.floor(Math.random() * 100000000); + if (_this.scriptTagHolder.uniqueCallbackIdentifier) + urlParams[exports.FIREBASE_LONGPOLL_CALLBACK_ID_PARAM] = _this.scriptTagHolder.uniqueCallbackIdentifier; + urlParams[Constants_1.VERSION_PARAM] = Constants_1.PROTOCOL_VERSION; + if (_this.transportSessionId) { + urlParams[Constants_1.TRANSPORT_SESSION_PARAM] = _this.transportSessionId; + } + if (_this.lastSessionId) { + urlParams[Constants_1.LAST_SESSION_PARAM] = _this.lastSessionId; + } + if (!util_3.isNodeSdk() && + typeof location !== 'undefined' && + location.href && + location.href.indexOf(Constants_1.FORGE_DOMAIN) !== -1) { + urlParams[Constants_1.REFERER_PARAM] = Constants_1.FORGE_REF; + } + var connectURL = _this.urlFn(urlParams); + _this.log_('Connecting via long-poll to ' + connectURL); + _this.scriptTagHolder.addTag(connectURL, function () { + /* do nothing */ + }); + }); + }; + /** + * Call this when a handshake has completed successfully and we want to consider the connection established + */ + BrowserPollConnection.prototype.start = function () { + this.scriptTagHolder.startLongPoll(this.id, this.password); + this.addDisconnectPingFrame(this.id, this.password); + }; + /** + * Forces long polling to be considered as a potential transport + */ + BrowserPollConnection.forceAllow = function () { + BrowserPollConnection.forceAllow_ = true; + }; + /** + * Forces longpolling to not be considered as a potential transport + */ + BrowserPollConnection.forceDisallow = function () { + BrowserPollConnection.forceDisallow_ = true; + }; + // Static method, use string literal so it can be accessed in a generic way + BrowserPollConnection.isAvailable = function () { + // NOTE: In React-Native there's normally no 'document', but if you debug a React-Native app in + // the Chrome debugger, 'document' is defined, but document.createElement is null (2015/06/08). + return (BrowserPollConnection.forceAllow_ || + (!BrowserPollConnection.forceDisallow_ && + typeof document !== 'undefined' && + document.createElement != null && + !util_1.isChromeExtensionContentScript() && + !util_1.isWindowsStoreApp() && + !util_3.isNodeSdk())); + }; + /** + * No-op for polling + */ + BrowserPollConnection.prototype.markConnectionHealthy = function () { }; + /** + * Stops polling and cleans up the iframe + * @private + */ + BrowserPollConnection.prototype.shutdown_ = function () { + this.isClosed_ = true; + if (this.scriptTagHolder) { + this.scriptTagHolder.close(); + this.scriptTagHolder = null; + } + //remove the disconnect frame, which will trigger an XHR call to the server to tell it we're leaving. + if (this.myDisconnFrame) { + document.body.removeChild(this.myDisconnFrame); + this.myDisconnFrame = null; + } + if (this.connectTimeoutTimer_) { + clearTimeout(this.connectTimeoutTimer_); + this.connectTimeoutTimer_ = null; + } + }; + /** + * Triggered when this transport is closed + * @private + */ + BrowserPollConnection.prototype.onClosed_ = function () { + if (!this.isClosed_) { + this.log_('Longpoll is closing itself'); + this.shutdown_(); + if (this.onDisconnect_) { + this.onDisconnect_(this.everConnected_); + this.onDisconnect_ = null; + } + } + }; + /** + * External-facing close handler. RealTime has requested we shut down. Kill our connection and tell the server + * that we've left. + */ + BrowserPollConnection.prototype.close = function () { + if (!this.isClosed_) { + this.log_('Longpoll is being closed.'); + this.shutdown_(); + } + }; + /** + * Send the JSON object down to the server. It will need to be stringified, base64 encoded, and then + * broken into chunks (since URLs have a small maximum length). + * @param {!Object} data The JSON data to transmit. + */ + BrowserPollConnection.prototype.send = function (data) { + var dataStr = util_2.stringify(data); + this.bytesSent += dataStr.length; + this.stats_.incrementCounter('bytes_sent', dataStr.length); + //first, lets get the base64-encoded data + var base64data = util_2.base64Encode(dataStr); + //We can only fit a certain amount in each URL, so we need to split this request + //up into multiple pieces if it doesn't fit in one request. + var dataSegs = util_1.splitStringBySize(base64data, MAX_PAYLOAD_SIZE); + //Enqueue each segment for transmission. We assign each chunk a sequential ID and a total number + //of segments so that we can reassemble the packet on the server. + for (var i = 0; i < dataSegs.length; i++) { + this.scriptTagHolder.enqueueSegment(this.curSegmentNum, dataSegs.length, dataSegs[i]); + this.curSegmentNum++; + } + }; + /** + * This is how we notify the server that we're leaving. + * We aren't able to send requests with DHTML on a window close event, but we can + * trigger XHR requests in some browsers (everything but Opera basically). + * @param {!string} id + * @param {!string} pw + */ + BrowserPollConnection.prototype.addDisconnectPingFrame = function (id, pw) { + if (util_3.isNodeSdk()) + return; + this.myDisconnFrame = document.createElement('iframe'); + var urlParams = {}; + urlParams[exports.FIREBASE_LONGPOLL_DISCONN_FRAME_REQUEST_PARAM] = 't'; + urlParams[exports.FIREBASE_LONGPOLL_ID_PARAM] = id; + urlParams[exports.FIREBASE_LONGPOLL_PW_PARAM] = pw; + this.myDisconnFrame.src = this.urlFn(urlParams); + this.myDisconnFrame.style.display = 'none'; + document.body.appendChild(this.myDisconnFrame); + }; + /** + * Used to track the bytes received by this client + * @param {*} args + * @private + */ + BrowserPollConnection.prototype.incrementIncomingBytes_ = function (args) { + // TODO: This is an annoying perf hit just to track the number of incoming bytes. Maybe it should be opt-in. + var bytesReceived = util_2.stringify(args).length; + this.bytesReceived += bytesReceived; + this.stats_.incrementCounter('bytes_received', bytesReceived); + }; + return BrowserPollConnection; +}()); +exports.BrowserPollConnection = BrowserPollConnection; +/********************************************************************************************* + * A wrapper around an iframe that is used as a long-polling script holder. + * @constructor + *********************************************************************************************/ +var FirebaseIFrameScriptHolder = /** @class */ (function () { + /** + * @param commandCB - The callback to be called when control commands are recevied from the server. + * @param onMessageCB - The callback to be triggered when responses arrive from the server. + * @param onDisconnect - The callback to be triggered when this tag holder is closed + * @param urlFn - A function that provides the URL of the endpoint to send data to. + */ + function FirebaseIFrameScriptHolder(commandCB, onMessageCB, onDisconnect, urlFn) { + this.onDisconnect = onDisconnect; + this.urlFn = urlFn; + //We maintain a count of all of the outstanding requests, because if we have too many active at once it can cause + //problems in some browsers. + /** + * @type {CountedSet.} + */ + this.outstandingRequests = new CountedSet_1.CountedSet(); + //A queue of the pending segments waiting for transmission to the server. + this.pendingSegs = []; + //A serial number. We use this for two things: + // 1) A way to ensure the browser doesn't cache responses to polls + // 2) A way to make the server aware when long-polls arrive in a different order than we started them. The + // server needs to release both polls in this case or it will cause problems in Opera since Opera can only execute + // JSONP code in the order it was added to the iframe. + this.currentSerial = Math.floor(Math.random() * 100000000); + // This gets set to false when we're "closing down" the connection (e.g. we're switching transports but there's still + // incoming data from the server that we're waiting for). + this.sendNewPolls = true; + if (!util_3.isNodeSdk()) { + //Each script holder registers a couple of uniquely named callbacks with the window. These are called from the + //iframes where we put the long-polling script tags. We have two callbacks: + // 1) Command Callback - Triggered for control issues, like starting a connection. + // 2) Message Callback - Triggered when new data arrives. + this.uniqueCallbackIdentifier = util_1.LUIDGenerator(); + window[exports.FIREBASE_LONGPOLL_COMMAND_CB_NAME + this.uniqueCallbackIdentifier] = commandCB; + window[exports.FIREBASE_LONGPOLL_DATA_CB_NAME + this.uniqueCallbackIdentifier] = onMessageCB; + //Create an iframe for us to add script tags to. + this.myIFrame = FirebaseIFrameScriptHolder.createIFrame_(); + // Set the iframe's contents. + var script = ''; + // if we set a javascript url, it's IE and we need to set the document domain. The javascript url is sufficient + // for ie9, but ie8 needs to do it again in the document itself. + if (this.myIFrame.src && + this.myIFrame.src.substr(0, 'javascript:'.length) === 'javascript:') { + var currentDomain = document.domain; + script = ''; + } + var iframeContents = '' + script + ''; + try { + this.myIFrame.doc.open(); + this.myIFrame.doc.write(iframeContents); + this.myIFrame.doc.close(); + } + catch (e) { + util_1.log('frame writing exception'); + if (e.stack) { + util_1.log(e.stack); + } + util_1.log(e); + } + } + else { + this.commandCB = commandCB; + this.onMessageCB = onMessageCB; + } + } + /** + * Each browser has its own funny way to handle iframes. Here we mush them all together into one object that I can + * actually use. + * @private + * @return {Element} + */ + FirebaseIFrameScriptHolder.createIFrame_ = function () { + var iframe = document.createElement('iframe'); + iframe.style.display = 'none'; + // This is necessary in order to initialize the document inside the iframe + if (document.body) { + document.body.appendChild(iframe); + try { + // If document.domain has been modified in IE, this will throw an error, and we need to set the + // domain of the iframe's document manually. We can do this via a javascript: url as the src attribute + // Also note that we must do this *after* the iframe has been appended to the page. Otherwise it doesn't work. + var a = iframe.contentWindow.document; + if (!a) { + // Apologies for the log-spam, I need to do something to keep closure from optimizing out the assignment above. + util_1.log('No IE domain setting required'); + } + } + catch (e) { + var domain = document.domain; + iframe.src = + "javascript:void((function(){document.open();document.domain='" + + domain + + "';document.close();})())"; + } + } + else { + // LongPollConnection attempts to delay initialization until the document is ready, so hopefully this + // never gets hit. + throw 'Document body has not initialized. Wait to initialize Firebase until after the document is ready.'; + } + // Get the document of the iframe in a browser-specific way. + if (iframe.contentDocument) { + iframe.doc = iframe.contentDocument; // Firefox, Opera, Safari + } + else if (iframe.contentWindow) { + iframe.doc = iframe.contentWindow.document; // Internet Explorer + } + else if (iframe.document) { + iframe.doc = iframe.document; //others? + } + return iframe; + }; + /** + * Cancel all outstanding queries and remove the frame. + */ + FirebaseIFrameScriptHolder.prototype.close = function () { + var _this = this; + //Mark this iframe as dead, so no new requests are sent. + this.alive = false; + if (this.myIFrame) { + //We have to actually remove all of the html inside this iframe before removing it from the + //window, or IE will continue loading and executing the script tags we've already added, which + //can lead to some errors being thrown. Setting innerHTML seems to be the easiest way to do this. + this.myIFrame.doc.body.innerHTML = ''; + setTimeout(function () { + if (_this.myIFrame !== null) { + document.body.removeChild(_this.myIFrame); + _this.myIFrame = null; + } + }, Math.floor(0)); + } + if (util_3.isNodeSdk() && this.myID) { + var urlParams = {}; + urlParams[exports.FIREBASE_LONGPOLL_DISCONN_FRAME_PARAM] = 't'; + urlParams[exports.FIREBASE_LONGPOLL_ID_PARAM] = this.myID; + urlParams[exports.FIREBASE_LONGPOLL_PW_PARAM] = this.myPW; + var theURL = this.urlFn(urlParams); + FirebaseIFrameScriptHolder.nodeRestRequest(theURL); + } + // Protect from being called recursively. + var onDisconnect = this.onDisconnect; + if (onDisconnect) { + this.onDisconnect = null; + onDisconnect(); + } + }; + /** + * Actually start the long-polling session by adding the first script tag(s) to the iframe. + * @param {!string} id - The ID of this connection + * @param {!string} pw - The password for this connection + */ + FirebaseIFrameScriptHolder.prototype.startLongPoll = function (id, pw) { + this.myID = id; + this.myPW = pw; + this.alive = true; + //send the initial request. If there are requests queued, make sure that we transmit as many as we are currently able to. + while (this.newRequest_()) { } + }; + /** + * This is called any time someone might want a script tag to be added. It adds a script tag when there aren't + * too many outstanding requests and we are still alive. + * + * If there are outstanding packet segments to send, it sends one. If there aren't, it sends a long-poll anyways if + * needed. + */ + FirebaseIFrameScriptHolder.prototype.newRequest_ = function () { + // We keep one outstanding request open all the time to receive data, but if we need to send data + // (pendingSegs.length > 0) then we create a new request to send the data. The server will automatically + // close the old request. + if (this.alive && + this.sendNewPolls && + this.outstandingRequests.count() < (this.pendingSegs.length > 0 ? 2 : 1)) { + //construct our url + this.currentSerial++; + var urlParams = {}; + urlParams[exports.FIREBASE_LONGPOLL_ID_PARAM] = this.myID; + urlParams[exports.FIREBASE_LONGPOLL_PW_PARAM] = this.myPW; + urlParams[exports.FIREBASE_LONGPOLL_SERIAL_PARAM] = this.currentSerial; + var theURL = this.urlFn(urlParams); + //Now add as much data as we can. + var curDataString = ''; + var i = 0; + while (this.pendingSegs.length > 0) { + //first, lets see if the next segment will fit. + var nextSeg = this.pendingSegs[0]; + if (nextSeg.d.length + SEG_HEADER_SIZE + curDataString.length <= + MAX_URL_DATA_SIZE) { + //great, the segment will fit. Lets append it. + var theSeg = this.pendingSegs.shift(); + curDataString = + curDataString + + '&' + + exports.FIREBASE_LONGPOLL_SEGMENT_NUM_PARAM + + i + + '=' + + theSeg.seg + + '&' + + exports.FIREBASE_LONGPOLL_SEGMENTS_IN_PACKET + + i + + '=' + + theSeg.ts + + '&' + + exports.FIREBASE_LONGPOLL_DATA_PARAM + + i + + '=' + + theSeg.d; + i++; + } + else { + break; + } + } + theURL = theURL + curDataString; + this.addLongPollTag_(theURL, this.currentSerial); + return true; + } + else { + return false; + } + }; + /** + * Queue a packet for transmission to the server. + * @param segnum - A sequential id for this packet segment used for reassembly + * @param totalsegs - The total number of segments in this packet + * @param data - The data for this segment. + */ + FirebaseIFrameScriptHolder.prototype.enqueueSegment = function (segnum, totalsegs, data) { + //add this to the queue of segments to send. + this.pendingSegs.push({ seg: segnum, ts: totalsegs, d: data }); + //send the data immediately if there isn't already data being transmitted, unless + //startLongPoll hasn't been called yet. + if (this.alive) { + this.newRequest_(); + } + }; + /** + * Add a script tag for a regular long-poll request. + * @param {!string} url - The URL of the script tag. + * @param {!number} serial - The serial number of the request. + * @private + */ + FirebaseIFrameScriptHolder.prototype.addLongPollTag_ = function (url, serial) { + var _this = this; + //remember that we sent this request. + this.outstandingRequests.add(serial, 1); + var doNewRequest = function () { + _this.outstandingRequests.remove(serial); + _this.newRequest_(); + }; + // If this request doesn't return on its own accord (by the server sending us some data), we'll + // create a new one after the KEEPALIVE interval to make sure we always keep a fresh request open. + var keepaliveTimeout = setTimeout(doNewRequest, Math.floor(KEEPALIVE_REQUEST_INTERVAL)); + var readyStateCB = function () { + // Request completed. Cancel the keepalive. + clearTimeout(keepaliveTimeout); + // Trigger a new request so we can continue receiving data. + doNewRequest(); + }; + this.addTag(url, readyStateCB); + }; + /** + * Add an arbitrary script tag to the iframe. + * @param {!string} url - The URL for the script tag source. + * @param {!function()} loadCB - A callback to be triggered once the script has loaded. + */ + FirebaseIFrameScriptHolder.prototype.addTag = function (url, loadCB) { + var _this = this; + if (util_3.isNodeSdk()) { + this.doNodeLongPoll(url, loadCB); + } + else { + setTimeout(function () { + try { + // if we're already closed, don't add this poll + if (!_this.sendNewPolls) + return; + var newScript_1 = _this.myIFrame.doc.createElement('script'); + newScript_1.type = 'text/javascript'; + newScript_1.async = true; + newScript_1.src = url; + newScript_1.onload = newScript_1.onreadystatechange = function () { + var rstate = newScript_1.readyState; + if (!rstate || rstate === 'loaded' || rstate === 'complete') { + newScript_1.onload = newScript_1.onreadystatechange = null; + if (newScript_1.parentNode) { + newScript_1.parentNode.removeChild(newScript_1); + } + loadCB(); + } + }; + newScript_1.onerror = function () { + util_1.log('Long-poll script failed to load: ' + url); + _this.sendNewPolls = false; + _this.close(); + }; + _this.myIFrame.doc.body.appendChild(newScript_1); + } + catch (e) { + // TODO: we should make this error visible somehow + } + }, Math.floor(1)); + } + }; + return FirebaseIFrameScriptHolder; +}()); +exports.FirebaseIFrameScriptHolder = FirebaseIFrameScriptHolder; + +//# sourceMappingURL=BrowserPollConnection.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/realtime/Connection.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/realtime/Connection.js ***! + \*****************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! ../core/util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var storage_1 = __webpack_require__(/*! ../core/storage/storage */ "./node_modules/@firebase/database/dist/cjs/src/core/storage/storage.js"); +var Constants_1 = __webpack_require__(/*! ./Constants */ "./node_modules/@firebase/database/dist/cjs/src/realtime/Constants.js"); +var TransportManager_1 = __webpack_require__(/*! ./TransportManager */ "./node_modules/@firebase/database/dist/cjs/src/realtime/TransportManager.js"); +// Abort upgrade attempt if it takes longer than 60s. +var UPGRADE_TIMEOUT = 60000; +// For some transports (WebSockets), we need to "validate" the transport by exchanging a few requests and responses. +// If we haven't sent enough requests within 5s, we'll start sending noop ping requests. +var DELAY_BEFORE_SENDING_EXTRA_REQUESTS = 5000; +// If the initial data sent triggers a lot of bandwidth (i.e. it's a large put or a listen for a large amount of data) +// then we may not be able to exchange our ping/pong requests within the healthy timeout. So if we reach the timeout +// but we've sent/received enough bytes, we don't cancel the connection. +var BYTES_SENT_HEALTHY_OVERRIDE = 10 * 1024; +var BYTES_RECEIVED_HEALTHY_OVERRIDE = 100 * 1024; +var MESSAGE_TYPE = 't'; +var MESSAGE_DATA = 'd'; +var CONTROL_SHUTDOWN = 's'; +var CONTROL_RESET = 'r'; +var CONTROL_ERROR = 'e'; +var CONTROL_PONG = 'o'; +var SWITCH_ACK = 'a'; +var END_TRANSMISSION = 'n'; +var PING = 'p'; +var SERVER_HELLO = 'h'; +/** + * Creates a new real-time connection to the server using whichever method works + * best in the current browser. + * + * @constructor + */ +var Connection = /** @class */ (function () { + /** + * @param {!string} id - an id for this connection + * @param {!RepoInfo} repoInfo_ - the info for the endpoint to connect to + * @param {function(Object)} onMessage_ - the callback to be triggered when a server-push message arrives + * @param {function(number, string)} onReady_ - the callback to be triggered when this connection is ready to send messages. + * @param {function()} onDisconnect_ - the callback to be triggered when a connection was lost + * @param {function(string)} onKill_ - the callback to be triggered when this connection has permanently shut down. + * @param {string=} lastSessionId - last session id in persistent connection. is used to clean up old session in real-time server + */ + function Connection(id, repoInfo_, onMessage_, onReady_, onDisconnect_, onKill_, lastSessionId) { + this.id = id; + this.repoInfo_ = repoInfo_; + this.onMessage_ = onMessage_; + this.onReady_ = onReady_; + this.onDisconnect_ = onDisconnect_; + this.onKill_ = onKill_; + this.lastSessionId = lastSessionId; + this.connectionCount = 0; + this.pendingDataMessages = []; + this.state_ = 0 /* CONNECTING */; + this.log_ = util_1.logWrapper('c:' + this.id + ':'); + this.transportManager_ = new TransportManager_1.TransportManager(repoInfo_); + this.log_('Connection created'); + this.start_(); + } + /** + * Starts a connection attempt + * @private + */ + Connection.prototype.start_ = function () { + var _this = this; + var conn = this.transportManager_.initialTransport(); + this.conn_ = new conn(this.nextTransportId_(), this.repoInfo_, undefined, this.lastSessionId); + // For certain transports (WebSockets), we need to send and receive several messages back and forth before we + // can consider the transport healthy. + this.primaryResponsesRequired_ = conn['responsesRequiredToBeHealthy'] || 0; + var onMessageReceived = this.connReceiver_(this.conn_); + var onConnectionLost = this.disconnReceiver_(this.conn_); + this.tx_ = this.conn_; + this.rx_ = this.conn_; + this.secondaryConn_ = null; + this.isHealthy_ = false; + /* + * Firefox doesn't like when code from one iframe tries to create another iframe by way of the parent frame. + * This can occur in the case of a redirect, i.e. we guessed wrong on what server to connect to and received a reset. + * Somehow, setTimeout seems to make this ok. That doesn't make sense from a security perspective, since you should + * still have the context of your originating frame. + */ + setTimeout(function () { + // this.conn_ gets set to null in some of the tests. Check to make sure it still exists before using it + _this.conn_ && _this.conn_.open(onMessageReceived, onConnectionLost); + }, Math.floor(0)); + var healthyTimeout_ms = conn['healthyTimeout'] || 0; + if (healthyTimeout_ms > 0) { + this.healthyTimeout_ = util_1.setTimeoutNonBlocking(function () { + _this.healthyTimeout_ = null; + if (!_this.isHealthy_) { + if (_this.conn_ && + _this.conn_.bytesReceived > BYTES_RECEIVED_HEALTHY_OVERRIDE) { + _this.log_('Connection exceeded healthy timeout but has received ' + + _this.conn_.bytesReceived + + ' bytes. Marking connection healthy.'); + _this.isHealthy_ = true; + _this.conn_.markConnectionHealthy(); + } + else if (_this.conn_ && + _this.conn_.bytesSent > BYTES_SENT_HEALTHY_OVERRIDE) { + _this.log_('Connection exceeded healthy timeout but has sent ' + + _this.conn_.bytesSent + + ' bytes. Leaving connection alive.'); + // NOTE: We don't want to mark it healthy, since we have no guarantee that the bytes have made it to + // the server. + } + else { + _this.log_('Closing unhealthy connection after timeout.'); + _this.close(); + } + } + }, Math.floor(healthyTimeout_ms)); + } + }; + /** + * @return {!string} + * @private + */ + Connection.prototype.nextTransportId_ = function () { + return 'c:' + this.id + ':' + this.connectionCount++; + }; + Connection.prototype.disconnReceiver_ = function (conn) { + var _this = this; + return function (everConnected) { + if (conn === _this.conn_) { + _this.onConnectionLost_(everConnected); + } + else if (conn === _this.secondaryConn_) { + _this.log_('Secondary connection lost.'); + _this.onSecondaryConnectionLost_(); + } + else { + _this.log_('closing an old connection'); + } + }; + }; + Connection.prototype.connReceiver_ = function (conn) { + var _this = this; + return function (message) { + if (_this.state_ != 2 /* DISCONNECTED */) { + if (conn === _this.rx_) { + _this.onPrimaryMessageReceived_(message); + } + else if (conn === _this.secondaryConn_) { + _this.onSecondaryMessageReceived_(message); + } + else { + _this.log_('message on old connection'); + } + } + }; + }; + /** + * + * @param {Object} dataMsg An arbitrary data message to be sent to the server + */ + Connection.prototype.sendRequest = function (dataMsg) { + // wrap in a data message envelope and send it on + var msg = { t: 'd', d: dataMsg }; + this.sendData_(msg); + }; + Connection.prototype.tryCleanupConnection = function () { + if (this.tx_ === this.secondaryConn_ && this.rx_ === this.secondaryConn_) { + this.log_('cleaning up and promoting a connection: ' + this.secondaryConn_.connId); + this.conn_ = this.secondaryConn_; + this.secondaryConn_ = null; + // the server will shutdown the old connection + } + }; + Connection.prototype.onSecondaryControl_ = function (controlData) { + if (MESSAGE_TYPE in controlData) { + var cmd = controlData[MESSAGE_TYPE]; + if (cmd === SWITCH_ACK) { + this.upgradeIfSecondaryHealthy_(); + } + else if (cmd === CONTROL_RESET) { + // Most likely the session wasn't valid. Abandon the switch attempt + this.log_('Got a reset on secondary, closing it'); + this.secondaryConn_.close(); + // If we were already using this connection for something, than we need to fully close + if (this.tx_ === this.secondaryConn_ || + this.rx_ === this.secondaryConn_) { + this.close(); + } + } + else if (cmd === CONTROL_PONG) { + this.log_('got pong on secondary.'); + this.secondaryResponsesRequired_--; + this.upgradeIfSecondaryHealthy_(); + } + } + }; + Connection.prototype.onSecondaryMessageReceived_ = function (parsedData) { + var layer = util_1.requireKey('t', parsedData); + var data = util_1.requireKey('d', parsedData); + if (layer == 'c') { + this.onSecondaryControl_(data); + } + else if (layer == 'd') { + // got a data message, but we're still second connection. Need to buffer it up + this.pendingDataMessages.push(data); + } + else { + throw new Error('Unknown protocol layer: ' + layer); + } + }; + Connection.prototype.upgradeIfSecondaryHealthy_ = function () { + if (this.secondaryResponsesRequired_ <= 0) { + this.log_('Secondary connection is healthy.'); + this.isHealthy_ = true; + this.secondaryConn_.markConnectionHealthy(); + this.proceedWithUpgrade_(); + } + else { + // Send a ping to make sure the connection is healthy. + this.log_('sending ping on secondary.'); + this.secondaryConn_.send({ t: 'c', d: { t: PING, d: {} } }); + } + }; + Connection.prototype.proceedWithUpgrade_ = function () { + // tell this connection to consider itself open + this.secondaryConn_.start(); + // send ack + this.log_('sending client ack on secondary'); + this.secondaryConn_.send({ t: 'c', d: { t: SWITCH_ACK, d: {} } }); + // send end packet on primary transport, switch to sending on this one + // can receive on this one, buffer responses until end received on primary transport + this.log_('Ending transmission on primary'); + this.conn_.send({ t: 'c', d: { t: END_TRANSMISSION, d: {} } }); + this.tx_ = this.secondaryConn_; + this.tryCleanupConnection(); + }; + Connection.prototype.onPrimaryMessageReceived_ = function (parsedData) { + // Must refer to parsedData properties in quotes, so closure doesn't touch them. + var layer = util_1.requireKey('t', parsedData); + var data = util_1.requireKey('d', parsedData); + if (layer == 'c') { + this.onControl_(data); + } + else if (layer == 'd') { + this.onDataMessage_(data); + } + }; + Connection.prototype.onDataMessage_ = function (message) { + this.onPrimaryResponse_(); + // We don't do anything with data messages, just kick them up a level + this.onMessage_(message); + }; + Connection.prototype.onPrimaryResponse_ = function () { + if (!this.isHealthy_) { + this.primaryResponsesRequired_--; + if (this.primaryResponsesRequired_ <= 0) { + this.log_('Primary connection is healthy.'); + this.isHealthy_ = true; + this.conn_.markConnectionHealthy(); + } + } + }; + Connection.prototype.onControl_ = function (controlData) { + var cmd = util_1.requireKey(MESSAGE_TYPE, controlData); + if (MESSAGE_DATA in controlData) { + var payload = controlData[MESSAGE_DATA]; + if (cmd === SERVER_HELLO) { + this.onHandshake_(payload); + } + else if (cmd === END_TRANSMISSION) { + this.log_('recvd end transmission on primary'); + this.rx_ = this.secondaryConn_; + for (var i = 0; i < this.pendingDataMessages.length; ++i) { + this.onDataMessage_(this.pendingDataMessages[i]); + } + this.pendingDataMessages = []; + this.tryCleanupConnection(); + } + else if (cmd === CONTROL_SHUTDOWN) { + // This was previously the 'onKill' callback passed to the lower-level connection + // payload in this case is the reason for the shutdown. Generally a human-readable error + this.onConnectionShutdown_(payload); + } + else if (cmd === CONTROL_RESET) { + // payload in this case is the host we should contact + this.onReset_(payload); + } + else if (cmd === CONTROL_ERROR) { + util_1.error('Server Error: ' + payload); + } + else if (cmd === CONTROL_PONG) { + this.log_('got pong on primary.'); + this.onPrimaryResponse_(); + this.sendPingOnPrimaryIfNecessary_(); + } + else { + util_1.error('Unknown control packet command: ' + cmd); + } + } + }; + /** + * + * @param {Object} handshake The handshake data returned from the server + * @private + */ + Connection.prototype.onHandshake_ = function (handshake) { + var timestamp = handshake.ts; + var version = handshake.v; + var host = handshake.h; + this.sessionId = handshake.s; + this.repoInfo_.updateHost(host); + // if we've already closed the connection, then don't bother trying to progress further + if (this.state_ == 0 /* CONNECTING */) { + this.conn_.start(); + this.onConnectionEstablished_(this.conn_, timestamp); + if (Constants_1.PROTOCOL_VERSION !== version) { + util_1.warn('Protocol version mismatch detected'); + } + // TODO: do we want to upgrade? when? maybe a delay? + this.tryStartUpgrade_(); + } + }; + Connection.prototype.tryStartUpgrade_ = function () { + var conn = this.transportManager_.upgradeTransport(); + if (conn) { + this.startUpgrade_(conn); + } + }; + Connection.prototype.startUpgrade_ = function (conn) { + var _this = this; + this.secondaryConn_ = new conn(this.nextTransportId_(), this.repoInfo_, this.sessionId); + // For certain transports (WebSockets), we need to send and receive several messages back and forth before we + // can consider the transport healthy. + this.secondaryResponsesRequired_ = + conn['responsesRequiredToBeHealthy'] || 0; + var onMessage = this.connReceiver_(this.secondaryConn_); + var onDisconnect = this.disconnReceiver_(this.secondaryConn_); + this.secondaryConn_.open(onMessage, onDisconnect); + // If we haven't successfully upgraded after UPGRADE_TIMEOUT, give up and kill the secondary. + util_1.setTimeoutNonBlocking(function () { + if (_this.secondaryConn_) { + _this.log_('Timed out trying to upgrade.'); + _this.secondaryConn_.close(); + } + }, Math.floor(UPGRADE_TIMEOUT)); + }; + Connection.prototype.onReset_ = function (host) { + this.log_('Reset packet received. New host: ' + host); + this.repoInfo_.updateHost(host); + // TODO: if we're already "connected", we need to trigger a disconnect at the next layer up. + // We don't currently support resets after the connection has already been established + if (this.state_ === 1 /* CONNECTED */) { + this.close(); + } + else { + // Close whatever connections we have open and start again. + this.closeConnections_(); + this.start_(); + } + }; + Connection.prototype.onConnectionEstablished_ = function (conn, timestamp) { + var _this = this; + this.log_('Realtime connection established.'); + this.conn_ = conn; + this.state_ = 1 /* CONNECTED */; + if (this.onReady_) { + this.onReady_(timestamp, this.sessionId); + this.onReady_ = null; + } + // If after 5 seconds we haven't sent enough requests to the server to get the connection healthy, + // send some pings. + if (this.primaryResponsesRequired_ === 0) { + this.log_('Primary connection is healthy.'); + this.isHealthy_ = true; + } + else { + util_1.setTimeoutNonBlocking(function () { + _this.sendPingOnPrimaryIfNecessary_(); + }, Math.floor(DELAY_BEFORE_SENDING_EXTRA_REQUESTS)); + } + }; + Connection.prototype.sendPingOnPrimaryIfNecessary_ = function () { + // If the connection isn't considered healthy yet, we'll send a noop ping packet request. + if (!this.isHealthy_ && this.state_ === 1 /* CONNECTED */) { + this.log_('sending ping on primary.'); + this.sendData_({ t: 'c', d: { t: PING, d: {} } }); + } + }; + Connection.prototype.onSecondaryConnectionLost_ = function () { + var conn = this.secondaryConn_; + this.secondaryConn_ = null; + if (this.tx_ === conn || this.rx_ === conn) { + // we are relying on this connection already in some capacity. Therefore, a failure is real + this.close(); + } + }; + /** + * + * @param {boolean} everConnected Whether or not the connection ever reached a server. Used to determine if + * we should flush the host cache + * @private + */ + Connection.prototype.onConnectionLost_ = function (everConnected) { + this.conn_ = null; + // NOTE: IF you're seeing a Firefox error for this line, I think it might be because it's getting + // called on window close and RealtimeState.CONNECTING is no longer defined. Just a guess. + if (!everConnected && this.state_ === 0 /* CONNECTING */) { + this.log_('Realtime connection failed.'); + // Since we failed to connect at all, clear any cached entry for this namespace in case the machine went away + if (this.repoInfo_.isCacheableHost()) { + storage_1.PersistentStorage.remove('host:' + this.repoInfo_.host); + // reset the internal host to what we would show the user, i.e. .firebaseio.com + this.repoInfo_.internalHost = this.repoInfo_.host; + } + } + else if (this.state_ === 1 /* CONNECTED */) { + this.log_('Realtime connection lost.'); + } + this.close(); + }; + /** + * + * @param {string} reason + * @private + */ + Connection.prototype.onConnectionShutdown_ = function (reason) { + this.log_('Connection shutdown command received. Shutting down...'); + if (this.onKill_) { + this.onKill_(reason); + this.onKill_ = null; + } + // We intentionally don't want to fire onDisconnect (kill is a different case), + // so clear the callback. + this.onDisconnect_ = null; + this.close(); + }; + Connection.prototype.sendData_ = function (data) { + if (this.state_ !== 1 /* CONNECTED */) { + throw 'Connection is not connected'; + } + else { + this.tx_.send(data); + } + }; + /** + * Cleans up this connection, calling the appropriate callbacks + */ + Connection.prototype.close = function () { + if (this.state_ !== 2 /* DISCONNECTED */) { + this.log_('Closing realtime connection.'); + this.state_ = 2 /* DISCONNECTED */; + this.closeConnections_(); + if (this.onDisconnect_) { + this.onDisconnect_(); + this.onDisconnect_ = null; + } + } + }; + /** + * + * @private + */ + Connection.prototype.closeConnections_ = function () { + this.log_('Shutting down all connections'); + if (this.conn_) { + this.conn_.close(); + this.conn_ = null; + } + if (this.secondaryConn_) { + this.secondaryConn_.close(); + this.secondaryConn_ = null; + } + if (this.healthyTimeout_) { + clearTimeout(this.healthyTimeout_); + this.healthyTimeout_ = null; + } + }; + return Connection; +}()); +exports.Connection = Connection; + +//# sourceMappingURL=Connection.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/realtime/Constants.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/realtime/Constants.js ***! + \****************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 }); +exports.PROTOCOL_VERSION = '5'; +exports.VERSION_PARAM = 'v'; +exports.TRANSPORT_SESSION_PARAM = 's'; +exports.REFERER_PARAM = 'r'; +exports.FORGE_REF = 'f'; +exports.FORGE_DOMAIN = 'firebaseio.com'; +exports.LAST_SESSION_PARAM = 'ls'; +exports.WEBSOCKET = 'websocket'; +exports.LONG_POLLING = 'long_polling'; + +//# sourceMappingURL=Constants.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/realtime/TransportManager.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/realtime/TransportManager.js ***! + \***********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 BrowserPollConnection_1 = __webpack_require__(/*! ./BrowserPollConnection */ "./node_modules/@firebase/database/dist/cjs/src/realtime/BrowserPollConnection.js"); +var WebSocketConnection_1 = __webpack_require__(/*! ./WebSocketConnection */ "./node_modules/@firebase/database/dist/cjs/src/realtime/WebSocketConnection.js"); +var util_1 = __webpack_require__(/*! ../core/util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +/** + * Currently simplistic, this class manages what transport a Connection should use at various stages of its + * lifecycle. + * + * It starts with longpolling in a browser, and httppolling on node. It then upgrades to websockets if + * they are available. + * @constructor + */ +var TransportManager = /** @class */ (function () { + /** + * @param {!RepoInfo} repoInfo Metadata around the namespace we're connecting to + */ + function TransportManager(repoInfo) { + this.initTransports_(repoInfo); + } + Object.defineProperty(TransportManager, "ALL_TRANSPORTS", { + /** + * @const + * @type {!Array.} + */ + get: function () { + return [BrowserPollConnection_1.BrowserPollConnection, WebSocketConnection_1.WebSocketConnection]; + }, + enumerable: true, + configurable: true + }); + /** + * @param {!RepoInfo} repoInfo + * @private + */ + TransportManager.prototype.initTransports_ = function (repoInfo) { + var isWebSocketsAvailable = WebSocketConnection_1.WebSocketConnection && WebSocketConnection_1.WebSocketConnection['isAvailable'](); + var isSkipPollConnection = isWebSocketsAvailable && !WebSocketConnection_1.WebSocketConnection.previouslyFailed(); + if (repoInfo.webSocketOnly) { + if (!isWebSocketsAvailable) + util_1.warn("wss:// URL used, but browser isn't known to support websockets. Trying anyway."); + isSkipPollConnection = true; + } + if (isSkipPollConnection) { + this.transports_ = [WebSocketConnection_1.WebSocketConnection]; + } + else { + var transports_1 = (this.transports_ = []); + util_1.each(TransportManager.ALL_TRANSPORTS, function (i, transport) { + if (transport && transport['isAvailable']()) { + transports_1.push(transport); + } + }); + } + }; + /** + * @return {function(new:Transport, !string, !RepoInfo, string=, string=)} The constructor for the + * initial transport to use + */ + TransportManager.prototype.initialTransport = function () { + if (this.transports_.length > 0) { + return this.transports_[0]; + } + else { + throw new Error('No transports available'); + } + }; + /** + * @return {?function(new:Transport, function(),function(), string=)} The constructor for the next + * transport, or null + */ + TransportManager.prototype.upgradeTransport = function () { + if (this.transports_.length > 1) { + return this.transports_[1]; + } + else { + return null; + } + }; + return TransportManager; +}()); +exports.TransportManager = TransportManager; + +//# sourceMappingURL=TransportManager.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/realtime/WebSocketConnection.js": +/*!**************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/realtime/WebSocketConnection.js ***! + \**************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) { +/** + * 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 app_1 = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/esm/index.js"); +var util_1 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_2 = __webpack_require__(/*! ../core/util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +var StatsManager_1 = __webpack_require__(/*! ../core/stats/StatsManager */ "./node_modules/@firebase/database/dist/cjs/src/core/stats/StatsManager.js"); +var Constants_1 = __webpack_require__(/*! ./Constants */ "./node_modules/@firebase/database/dist/cjs/src/realtime/Constants.js"); +var util_3 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var storage_1 = __webpack_require__(/*! ../core/storage/storage */ "./node_modules/@firebase/database/dist/cjs/src/core/storage/storage.js"); +var util_4 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var util_5 = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +var WEBSOCKET_MAX_FRAME_SIZE = 16384; +var WEBSOCKET_KEEPALIVE_INTERVAL = 45000; +var WebSocketImpl = null; +if (typeof MozWebSocket !== 'undefined') { + WebSocketImpl = MozWebSocket; +} +else if (typeof WebSocket !== 'undefined') { + WebSocketImpl = WebSocket; +} +function setWebSocketImpl(impl) { + WebSocketImpl = impl; +} +exports.setWebSocketImpl = setWebSocketImpl; +/** + * Create a new websocket connection with the given callbacks. + * @constructor + * @implements {Transport} + */ +var WebSocketConnection = /** @class */ (function () { + /** + * @param {string} connId identifier for this transport + * @param {RepoInfo} repoInfo The info for the websocket endpoint. + * @param {string=} transportSessionId Optional transportSessionId if this is connecting to an existing transport + * session + * @param {string=} lastSessionId Optional lastSessionId if there was a previous connection + */ + function WebSocketConnection(connId, repoInfo, transportSessionId, lastSessionId) { + this.connId = connId; + this.keepaliveTimer = null; + this.frames = null; + this.totalFrames = 0; + this.bytesSent = 0; + this.bytesReceived = 0; + this.log_ = util_2.logWrapper(this.connId); + this.stats_ = StatsManager_1.StatsManager.getCollection(repoInfo); + this.connURL = WebSocketConnection.connectionURL_(repoInfo, transportSessionId, lastSessionId); + } + /** + * @param {RepoInfo} repoInfo The info for the websocket endpoint. + * @param {string=} transportSessionId Optional transportSessionId if this is connecting to an existing transport + * session + * @param {string=} lastSessionId Optional lastSessionId if there was a previous connection + * @return {string} connection url + * @private + */ + WebSocketConnection.connectionURL_ = function (repoInfo, transportSessionId, lastSessionId) { + var urlParams = {}; + urlParams[Constants_1.VERSION_PARAM] = Constants_1.PROTOCOL_VERSION; + if (!util_5.isNodeSdk() && + typeof location !== 'undefined' && + location.href && + location.href.indexOf(Constants_1.FORGE_DOMAIN) !== -1) { + urlParams[Constants_1.REFERER_PARAM] = Constants_1.FORGE_REF; + } + if (transportSessionId) { + urlParams[Constants_1.TRANSPORT_SESSION_PARAM] = transportSessionId; + } + if (lastSessionId) { + urlParams[Constants_1.LAST_SESSION_PARAM] = lastSessionId; + } + return repoInfo.connectionURL(Constants_1.WEBSOCKET, urlParams); + }; + /** + * + * @param onMessage Callback when messages arrive + * @param onDisconnect Callback with connection lost. + */ + WebSocketConnection.prototype.open = function (onMessage, onDisconnect) { + var _this = this; + this.onDisconnect = onDisconnect; + this.onMessage = onMessage; + this.log_('Websocket connecting to ' + this.connURL); + this.everConnected_ = false; + // Assume failure until proven otherwise. + storage_1.PersistentStorage.set('previous_websocket_failure', true); + try { + if (util_5.isNodeSdk()) { + var device = util_3.CONSTANTS.NODE_ADMIN ? 'AdminNode' : 'Node'; + // UA Format: Firebase//// + var options = { + headers: { + 'User-Agent': "Firebase/" + Constants_1.PROTOCOL_VERSION + "/" + app_1.default.SDK_VERSION + "/" + process.platform + "/" + device + } + }; + // Plumb appropriate http_proxy environment variable into faye-websocket if it exists. + var env = Object({"NODE_ENV":"development","PUBLIC_URL":""}); + var proxy = this.connURL.indexOf('wss://') == 0 + ? env['HTTPS_PROXY'] || env['https_proxy'] + : env['HTTP_PROXY'] || env['http_proxy']; + if (proxy) { + options['proxy'] = { origin: proxy }; + } + this.mySock = new WebSocketImpl(this.connURL, [], options); + } + else { + this.mySock = new WebSocketImpl(this.connURL); + } + } + catch (e) { + this.log_('Error instantiating WebSocket.'); + var error = e.message || e.data; + if (error) { + this.log_(error); + } + this.onClosed_(); + return; + } + this.mySock.onopen = function () { + _this.log_('Websocket connected.'); + _this.everConnected_ = true; + }; + this.mySock.onclose = function () { + _this.log_('Websocket connection was disconnected.'); + _this.mySock = null; + _this.onClosed_(); + }; + this.mySock.onmessage = function (m) { + _this.handleIncomingFrame(m); + }; + this.mySock.onerror = function (e) { + _this.log_('WebSocket error. Closing connection.'); + var error = e.message || e.data; + if (error) { + _this.log_(error); + } + _this.onClosed_(); + }; + }; + /** + * No-op for websockets, we don't need to do anything once the connection is confirmed as open + */ + WebSocketConnection.prototype.start = function () { }; + WebSocketConnection.forceDisallow = function () { + WebSocketConnection.forceDisallow_ = true; + }; + WebSocketConnection.isAvailable = function () { + var isOldAndroid = false; + if (typeof navigator !== 'undefined' && navigator.userAgent) { + var oldAndroidRegex = /Android ([0-9]{0,}\.[0-9]{0,})/; + var oldAndroidMatch = navigator.userAgent.match(oldAndroidRegex); + if (oldAndroidMatch && oldAndroidMatch.length > 1) { + if (parseFloat(oldAndroidMatch[1]) < 4.4) { + isOldAndroid = true; + } + } + } + return (!isOldAndroid && + WebSocketImpl !== null && + !WebSocketConnection.forceDisallow_); + }; + /** + * Returns true if we previously failed to connect with this transport. + * @return {boolean} + */ + WebSocketConnection.previouslyFailed = function () { + // If our persistent storage is actually only in-memory storage, + // we default to assuming that it previously failed to be safe. + return (storage_1.PersistentStorage.isInMemoryStorage || + storage_1.PersistentStorage.get('previous_websocket_failure') === true); + }; + WebSocketConnection.prototype.markConnectionHealthy = function () { + storage_1.PersistentStorage.remove('previous_websocket_failure'); + }; + WebSocketConnection.prototype.appendFrame_ = function (data) { + this.frames.push(data); + if (this.frames.length == this.totalFrames) { + var fullMess = this.frames.join(''); + this.frames = null; + var jsonMess = util_4.jsonEval(fullMess); + //handle the message + this.onMessage(jsonMess); + } + }; + /** + * @param {number} frameCount The number of frames we are expecting from the server + * @private + */ + WebSocketConnection.prototype.handleNewFrameCount_ = function (frameCount) { + this.totalFrames = frameCount; + this.frames = []; + }; + /** + * Attempts to parse a frame count out of some text. If it can't, assumes a value of 1 + * @param {!String} data + * @return {?String} Any remaining data to be process, or null if there is none + * @private + */ + WebSocketConnection.prototype.extractFrameCount_ = function (data) { + util_1.assert(this.frames === null, 'We already have a frame buffer'); + // TODO: The server is only supposed to send up to 9999 frames (i.e. length <= 4), but that isn't being enforced + // currently. So allowing larger frame counts (length <= 6). See https://app.asana.com/0/search/8688598998380/8237608042508 + if (data.length <= 6) { + var frameCount = Number(data); + if (!isNaN(frameCount)) { + this.handleNewFrameCount_(frameCount); + return null; + } + } + this.handleNewFrameCount_(1); + return data; + }; + /** + * Process a websocket frame that has arrived from the server. + * @param mess The frame data + */ + WebSocketConnection.prototype.handleIncomingFrame = function (mess) { + if (this.mySock === null) + return; // Chrome apparently delivers incoming packets even after we .close() the connection sometimes. + var data = mess['data']; + this.bytesReceived += data.length; + this.stats_.incrementCounter('bytes_received', data.length); + this.resetKeepAlive(); + if (this.frames !== null) { + // we're buffering + this.appendFrame_(data); + } + else { + // try to parse out a frame count, otherwise, assume 1 and process it + var remainingData = this.extractFrameCount_(data); + if (remainingData !== null) { + this.appendFrame_(remainingData); + } + } + }; + /** + * Send a message to the server + * @param {Object} data The JSON object to transmit + */ + WebSocketConnection.prototype.send = function (data) { + this.resetKeepAlive(); + var dataStr = util_4.stringify(data); + this.bytesSent += dataStr.length; + this.stats_.incrementCounter('bytes_sent', dataStr.length); + //We can only fit a certain amount in each websocket frame, so we need to split this request + //up into multiple pieces if it doesn't fit in one request. + var dataSegs = util_2.splitStringBySize(dataStr, WEBSOCKET_MAX_FRAME_SIZE); + //Send the length header + if (dataSegs.length > 1) { + this.sendString_(String(dataSegs.length)); + } + //Send the actual data in segments. + for (var i = 0; i < dataSegs.length; i++) { + this.sendString_(dataSegs[i]); + } + }; + WebSocketConnection.prototype.shutdown_ = function () { + this.isClosed_ = true; + if (this.keepaliveTimer) { + clearInterval(this.keepaliveTimer); + this.keepaliveTimer = null; + } + if (this.mySock) { + this.mySock.close(); + this.mySock = null; + } + }; + WebSocketConnection.prototype.onClosed_ = function () { + if (!this.isClosed_) { + this.log_('WebSocket is closing itself'); + this.shutdown_(); + // since this is an internal close, trigger the close listener + if (this.onDisconnect) { + this.onDisconnect(this.everConnected_); + this.onDisconnect = null; + } + } + }; + /** + * External-facing close handler. + * Close the websocket and kill the connection. + */ + WebSocketConnection.prototype.close = function () { + if (!this.isClosed_) { + this.log_('WebSocket is being closed'); + this.shutdown_(); + } + }; + /** + * Kill the current keepalive timer and start a new one, to ensure that it always fires N seconds after + * the last activity. + */ + WebSocketConnection.prototype.resetKeepAlive = function () { + var _this = this; + clearInterval(this.keepaliveTimer); + this.keepaliveTimer = setInterval(function () { + //If there has been no websocket activity for a while, send a no-op + if (_this.mySock) { + _this.sendString_('0'); + } + _this.resetKeepAlive(); + }, Math.floor(WEBSOCKET_KEEPALIVE_INTERVAL)); + }; + /** + * Send a string over the websocket. + * + * @param {string} str String to send. + * @private + */ + WebSocketConnection.prototype.sendString_ = function (str) { + // Firefox seems to sometimes throw exceptions (NS_ERROR_UNEXPECTED) from websocket .send() + // calls for some unknown reason. We treat these as an error and disconnect. + // See https://app.asana.com/0/58926111402292/68021340250410 + try { + this.mySock.send(str); + } + catch (e) { + this.log_('Exception thrown from WebSocket.send():', e.message || e.data, 'Closing connection.'); + setTimeout(this.onClosed_.bind(this), 0); + } + }; + /** + * Number of response before we consider the connection "healthy." + * @type {number} + */ + WebSocketConnection.responsesRequiredToBeHealthy = 2; + /** + * Time to wait for the connection te become healthy before giving up. + * @type {number} + */ + WebSocketConnection.healthyTimeout = 30000; + return WebSocketConnection; +}()); +exports.WebSocketConnection = WebSocketConnection; + +//# sourceMappingURL=WebSocketConnection.js.map + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! ./../../../../../../process/browser.js */ "./node_modules/process/browser.js"))) + +/***/ }), + +/***/ "./node_modules/@firebase/database/dist/cjs/src/realtime/polling/PacketReceiver.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/@firebase/database/dist/cjs/src/realtime/polling/PacketReceiver.js ***! + \*****************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! ../../core/util/util */ "./node_modules/@firebase/database/dist/cjs/src/core/util/util.js"); +/** + * This class ensures the packets from the server arrive in order + * This class takes data from the server and ensures it gets passed into the callbacks in order. + * @constructor + */ +var PacketReceiver = /** @class */ (function () { + /** + * @param onMessage_ + */ + function PacketReceiver(onMessage_) { + this.onMessage_ = onMessage_; + this.pendingResponses = []; + this.currentResponseNum = 0; + this.closeAfterResponse = -1; + this.onClose = null; + } + PacketReceiver.prototype.closeAfter = function (responseNum, callback) { + this.closeAfterResponse = responseNum; + this.onClose = callback; + if (this.closeAfterResponse < this.currentResponseNum) { + this.onClose(); + this.onClose = null; + } + }; + /** + * Each message from the server comes with a response number, and an array of data. The responseNumber + * allows us to ensure that we process them in the right order, since we can't be guaranteed that all + * browsers will respond in the same order as the requests we sent + * @param {number} requestNum + * @param {Array} data + */ + PacketReceiver.prototype.handleResponse = function (requestNum, data) { + var _this = this; + this.pendingResponses[requestNum] = data; + var _loop_1 = function () { + var toProcess = this_1.pendingResponses[this_1.currentResponseNum]; + delete this_1.pendingResponses[this_1.currentResponseNum]; + var _loop_2 = function (i) { + if (toProcess[i]) { + util_1.exceptionGuard(function () { + _this.onMessage_(toProcess[i]); + }); + } + }; + for (var i = 0; i < toProcess.length; ++i) { + _loop_2(i); + } + if (this_1.currentResponseNum === this_1.closeAfterResponse) { + if (this_1.onClose) { + this_1.onClose(); + this_1.onClose = null; + } + return "break"; + } + this_1.currentResponseNum++; + }; + var this_1 = this; + while (this.pendingResponses[this.currentResponseNum]) { + var state_1 = _loop_1(); + if (state_1 === "break") + break; + } + }; + return PacketReceiver; +}()); +exports.PacketReceiver = PacketReceiver; + +//# sourceMappingURL=PacketReceiver.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/messaging/dist/esm/index.js": +/*!************************************************************!*\ + !*** ./node_modules/@firebase/messaging/dist/esm/index.js ***! + \************************************************************/ +/*! exports provided: registerMessaging */ +/*! all exports used */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* harmony export (immutable) */ __webpack_exports__["registerMessaging"] = registerMessaging; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_controllers_window_controller__ = __webpack_require__(/*! ./src/controllers/window-controller */ "./node_modules/@firebase/messaging/dist/esm/src/controllers/window-controller.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_controllers_sw_controller__ = __webpack_require__(/*! ./src/controllers/sw-controller */ "./node_modules/@firebase/messaging/dist/esm/src/controllers/sw-controller.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__firebase_app__ = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/esm/index.js"); +/** + * 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. + */ + + + + +function registerMessaging(instance) { + var messagingName = 'messaging'; + var factoryMethod = function (app) { + if (self && 'ServiceWorkerGlobalScope' in self) { + return new __WEBPACK_IMPORTED_MODULE_1__src_controllers_sw_controller__["a" /* default */](app); + } + // Assume we are in the window context. + return new __WEBPACK_IMPORTED_MODULE_0__src_controllers_window_controller__["a" /* default */](app); + }; + var namespaceExports = { + // no-inline + Messaging: __WEBPACK_IMPORTED_MODULE_0__src_controllers_window_controller__["a" /* default */] + }; + instance.INTERNAL.registerService(messagingName, factoryMethod, namespaceExports); +} +registerMessaging(__WEBPACK_IMPORTED_MODULE_2__firebase_app__["firebase"]); + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/messaging/dist/esm/src/controllers/controller-interface.js": +/*!*******************************************************************************************!*\ + !*** ./node_modules/@firebase/messaging/dist/esm/src/controllers/controller-interface.js ***! + \*******************************************************************************************/ +/*! exports provided: default */ +/*! exports used: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__firebase_util__ = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__firebase_util___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__firebase_util__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__models_errors__ = __webpack_require__(/*! ../models/errors */ "./node_modules/@firebase/messaging/dist/esm/src/models/errors.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__models_token_manager__ = __webpack_require__(/*! ../models/token-manager */ "./node_modules/@firebase/messaging/dist/esm/src/models/token-manager.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__models_notification_permission__ = __webpack_require__(/*! ../models/notification-permission */ "./node_modules/@firebase/messaging/dist/esm/src/models/notification-permission.js"); +/** + * 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. + */ + + + + + +var SENDER_ID_OPTION_NAME = 'messagingSenderId'; +var ControllerInterface = /** @class */ (function () { + /** + * An interface of the Messaging Service API + * @param {!firebase.app.App} app + */ + function ControllerInterface(app) { + var _this = this; + this.errorFactory_ = new __WEBPACK_IMPORTED_MODULE_0__firebase_util__["ErrorFactory"]('messaging', 'Messaging', __WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].map); + if (!app.options[SENDER_ID_OPTION_NAME] || + typeof app.options[SENDER_ID_OPTION_NAME] !== 'string') { + throw this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.BAD_SENDER_ID); + } + this.messagingSenderId_ = app.options[SENDER_ID_OPTION_NAME]; + this.tokenManager_ = new __WEBPACK_IMPORTED_MODULE_2__models_token_manager__["a" /* default */](); + this.app = app; + this.INTERNAL = {}; + this.INTERNAL.delete = function () { return _this.delete; }; + } + /** + * @export + * @return {Promise | Promise} Returns a promise that + * resolves to an FCM token. + */ + ControllerInterface.prototype.getToken = function () { + var _this = this; + // Check with permissions + var currentPermission = this.getNotificationPermission_(); + if (currentPermission !== __WEBPACK_IMPORTED_MODULE_3__models_notification_permission__["a" /* default */].granted) { + if (currentPermission === __WEBPACK_IMPORTED_MODULE_3__models_notification_permission__["a" /* default */].denied) { + return Promise.reject(this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.NOTIFICATIONS_BLOCKED)); + } + // We must wait for permission to be granted + return Promise.resolve(null); + } + return this.getSWRegistration_().then(function (registration) { + return _this.tokenManager_ + .getSavedToken(_this.messagingSenderId_, registration) + .then(function (token) { + if (token) { + return token; + } + return _this.tokenManager_.createToken(_this.messagingSenderId_, registration); + }); + }); + }; + /** + * This method deletes tokens that the token manager looks after and then + * unregisters the push subscription if it exists. + * @export + * @param {string} token + * @return {Promise} + */ + ControllerInterface.prototype.deleteToken = function (token) { + var _this = this; + return this.tokenManager_.deleteToken(token).then(function () { + return _this.getSWRegistration_() + .then(function (registration) { + if (registration) { + return registration.pushManager.getSubscription(); + } + }) + .then(function (subscription) { + if (subscription) { + return subscription.unsubscribe(); + } + }); + }); + }; + ControllerInterface.prototype.getSWRegistration_ = function () { + throw this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.SHOULD_BE_INHERITED); + }; + // + // The following methods should only be available in the window. + // + ControllerInterface.prototype.requestPermission = function () { + throw this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.AVAILABLE_IN_WINDOW); + }; + /** + * @export + * @param {!ServiceWorkerRegistration} registration + */ + ControllerInterface.prototype.useServiceWorker = function (registration) { + throw this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.AVAILABLE_IN_WINDOW); + }; + /** + * @export + * @param {!firebase.Observer|function(*)} nextOrObserver + * @param {function(!Error)=} optError + * @param {function()=} optCompleted + * @return {!function()} + */ + ControllerInterface.prototype.onMessage = function (nextOrObserver, optError, optCompleted) { + throw this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.AVAILABLE_IN_WINDOW); + }; + /** + * @export + * @param {!firebase.Observer|function()} nextOrObserver An observer object + * or a function triggered on token refresh. + * @param {function(!Error)=} optError Optional A function + * triggered on token refresh error. + * @param {function()=} optCompleted Optional function triggered when the + * observer is removed. + * @return {!function()} The unsubscribe function for the observer. + */ + ControllerInterface.prototype.onTokenRefresh = function (nextOrObserver, optError, optCompleted) { + throw this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.AVAILABLE_IN_WINDOW); + }; + // + // The following methods are used by the service worker only. + // + /** + * @export + * @param {function(Object)} callback + */ + ControllerInterface.prototype.setBackgroundMessageHandler = function (callback) { + throw this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.AVAILABLE_IN_SW); + }; + // + // The following methods are used by the service themselves and not exposed + // publicly or not expected to be used by developers. + // + /** + * This method is required to adhere to the Firebase interface. + * It closes any currently open indexdb database connections. + */ + ControllerInterface.prototype.delete = function () { + return this.tokenManager_.closeDatabase(); + }; + /** + * Returns the current Notification Permission state. + * @private + * @return {string} The currenct permission state. + */ + ControllerInterface.prototype.getNotificationPermission_ = function () { + return Notification.permission; + }; + /** + * @protected + * @returns {TokenManager} + */ + ControllerInterface.prototype.getTokenManager = function () { + return this.tokenManager_; + }; + return ControllerInterface; +}()); +/* harmony default export */ __webpack_exports__["a"] = (ControllerInterface); + +//# sourceMappingURL=controller-interface.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/messaging/dist/esm/src/controllers/sw-controller.js": +/*!************************************************************************************!*\ + !*** ./node_modules/@firebase/messaging/dist/esm/src/controllers/sw-controller.js ***! + \************************************************************************************/ +/*! exports provided: default */ +/*! exports used: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__controller_interface__ = __webpack_require__(/*! ./controller-interface */ "./node_modules/@firebase/messaging/dist/esm/src/controllers/controller-interface.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__models_errors__ = __webpack_require__(/*! ../models/errors */ "./node_modules/@firebase/messaging/dist/esm/src/models/errors.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__models_worker_page_message__ = __webpack_require__(/*! ../models/worker-page-message */ "./node_modules/@firebase/messaging/dist/esm/src/models/worker-page-message.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__models_fcm_details__ = __webpack_require__(/*! ../models/fcm-details */ "./node_modules/@firebase/messaging/dist/esm/src/models/fcm-details.js"); +/** + * 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. + */ + +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 FCM_MSG = 'FCM_MSG'; +var SWController = /** @class */ (function (_super) { + __extends(SWController, _super); + function SWController(app) { + var _this = _super.call(this, app) || this; + self.addEventListener('push', function (e) { return _this.onPush_(e); }, false); + self.addEventListener('pushsubscriptionchange', function (e) { return _this.onSubChange_(e); }, false); + self.addEventListener('notificationclick', function (e) { return _this.onNotificationClick_(e); }, false); + /** + * @private + * @type {function(Object)|null} + */ + _this.bgMessageHandler_ = null; + return _this; + } + /** + * A handler for push events that shows notifications based on the content of + * the payload. + * + * The payload must be a JSON-encoded Object with a `notification` key. The + * value of the `notification` property will be used as the NotificationOptions + * object passed to showNotification. Additionally, the `title` property of the + * notification object will be used as the title. + * + * If there is no notification data in the payload then no notification will be + * shown. + * @private + */ + SWController.prototype.onPush_ = function (event) { + var _this = this; + var msgPayload; + try { + msgPayload = event.data.json(); + } + catch (err) { + // Not JSON so not an FCM message + return; + } + var handleMsgPromise = this.hasVisibleClients_().then(function (hasVisibleClients) { + if (hasVisibleClients) { + // Do not need to show a notification. + if (msgPayload.notification || _this.bgMessageHandler_) { + // Send to page + return _this.sendMessageToWindowClients_(msgPayload); + } + return; + } + var notificationDetails = _this.getNotificationData_(msgPayload); + if (notificationDetails) { + var notificationTitle = notificationDetails.title || ''; + return self.registration.showNotification(notificationTitle, notificationDetails); + } + else if (_this.bgMessageHandler_) { + return _this.bgMessageHandler_(msgPayload); + } + }); + event.waitUntil(handleMsgPromise); + }; + /** + * @private + */ + SWController.prototype.onSubChange_ = function (event) { + var _this = this; + var promiseChain = this.getToken().then(function (token) { + if (!token) { + // We can't resubscribe if we don't have an FCM token for this scope. + throw _this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.NO_FCM_TOKEN_FOR_RESUBSCRIBE); + } + var tokenDetails = null; + var tokenManager = _this.getTokenManager(); + return tokenManager + .getTokenDetailsFromToken(token) + .then(function (details) { + tokenDetails = details; + if (!tokenDetails) { + throw _this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.INVALID_SAVED_TOKEN); + } + // Attempt to get a new subscription + return self.registration.pushManager.subscribe(__WEBPACK_IMPORTED_MODULE_3__models_fcm_details__["a" /* default */].SUBSCRIPTION_OPTIONS); + }) + .then(function (newSubscription) { + // Send new subscription to FCM. + return tokenManager.subscribeToFCM(tokenDetails.fcmSenderId, newSubscription, tokenDetails.fcmPushSet); + }) + .catch(function (err) { + // The best thing we can do is log this to the terminal so + // developers might notice the error. + return tokenManager.deleteToken(tokenDetails.fcmToken).then(function () { + throw _this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.UNABLE_TO_RESUBSCRIBE, { + message: err + }); + }); + }); + }); + event.waitUntil(promiseChain); + }; + /** + * @private + */ + SWController.prototype.onNotificationClick_ = function (event) { + var _this = this; + if (!(event.notification && + event.notification.data && + event.notification.data[FCM_MSG])) { + // Not an FCM notification, do nothing. + return; + } + // Prevent other listeners from receiving the event + event.stopImmediatePropagation(); + event.notification.close(); + var msgPayload = event.notification.data[FCM_MSG]; + var clickAction = msgPayload['notification']['click_action']; + if (!clickAction) { + // Nothing to do. + return; + } + var promiseChain = this.getWindowClient_(clickAction) + .then(function (windowClient) { + if (!windowClient) { + // Unable to find window client so need to open one. + return self.clients.openWindow(clickAction); + } + return windowClient; + }) + .then(function (windowClient) { + if (!windowClient) { + // Window Client will not be returned if it's for a third party origin. + return; + } + // Delete notification data from payload before sending to the page. + var notificationData = msgPayload['notification']; + delete msgPayload['notification']; + var internalMsg = __WEBPACK_IMPORTED_MODULE_2__models_worker_page_message__["a" /* default */].createNewMsg(__WEBPACK_IMPORTED_MODULE_2__models_worker_page_message__["a" /* default */].TYPES_OF_MSG.NOTIFICATION_CLICKED, msgPayload); + // Attempt to send a message to the client to handle the data + // Is affected by: https://github.com/slightlyoff/ServiceWorker/issues/728 + return _this.attemptToMessageClient_(windowClient, internalMsg); + }); + event.waitUntil(promiseChain); + }; + /** + * @private + * @param {Object} msgPayload + * @return {NotificationOptions|undefined} + */ + SWController.prototype.getNotificationData_ = function (msgPayload) { + if (!msgPayload) { + return; + } + if (typeof msgPayload.notification !== 'object') { + return; + } + var notificationInformation = Object.assign({}, msgPayload.notification); + // Put the message payload under FCM_MSG name so we can identify the + // notification as being an FCM notification vs a notification from + // somewhere else (i.e. normal web push or developer generated + // notification). + notificationInformation['data'] = (_a = {}, + _a[FCM_MSG] = msgPayload, + _a); + return notificationInformation; + var _a; + }; + /** + * Calling setBackgroundMessageHandler will opt in to some specific + * behaviours. + * 1.) If a notification doesn't need to be shown due to a window already + * being visible, then push messages will be sent to the page. + * 2.) If a notification needs to be shown, and the message contains no + * notification data this method will be called + * and the promise it returns will be passed to event.waitUntil. + * If you do not set this callback then all push messages will let and the + * developer can handle them in a their own 'push' event callback + * @export + * @param {function(Object)} callback The callback to be called when a push + * message is received and a notification must be shown. The callback will + * be given the data from the push message. + */ + SWController.prototype.setBackgroundMessageHandler = function (callback) { + if (callback && typeof callback !== 'function') { + throw this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.BG_HANDLER_FUNCTION_EXPECTED); + } + this.bgMessageHandler_ = callback; + }; + /** + * @private + * @param {string} url The URL to look for when focusing a client. + * @return {Object} Returns an existing window client or a newly opened + * WindowClient. + */ + SWController.prototype.getWindowClient_ = function (url) { + // Use URL to normalize the URL when comparing to windowClients. + // This at least handles whether to include trailing slashes or not + var parsedURL = new URL(url).href; + return self.clients + .matchAll({ + type: 'window', + includeUncontrolled: true + }) + .then(function (clientList) { + var suitableClient = null; + for (var i = 0; i < clientList.length; i++) { + var parsedClientUrl = new URL(clientList[i].url).href; + if (parsedClientUrl === parsedURL) { + suitableClient = clientList[i]; + break; + } + } + if (suitableClient) { + suitableClient.focus(); + return suitableClient; + } + }); + }; + /** + * This message will attempt to send the message to a window client. + * @private + * @param {Object} client The WindowClient to send the message to. + * @param {Object} message The message to send to the client. + * @returns {Promise} Returns a promise that resolves after sending the + * message. This does not guarantee that the message was successfully + * received. + */ + SWController.prototype.attemptToMessageClient_ = function (client, message) { + var _this = this; + return new Promise(function (resolve, reject) { + if (!client) { + return reject(_this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.NO_WINDOW_CLIENT_TO_MSG)); + } + client.postMessage(message); + resolve(); + }); + }; + /** + * @private + * @returns {Promise} If there is currently a visible WindowClient, + * this method will resolve to true, otherwise false. + */ + SWController.prototype.hasVisibleClients_ = function () { + return self.clients + .matchAll({ + type: 'window', + includeUncontrolled: true + }) + .then(function (clientList) { + return clientList.some(function (client) { return client.visibilityState === 'visible'; }); + }); + }; + /** + * @private + * @param {Object} msgPayload The data from the push event that should be sent + * to all available pages. + * @returns {Promise} Returns a promise that resolves once the message + * has been sent to all WindowClients. + */ + SWController.prototype.sendMessageToWindowClients_ = function (msgPayload) { + var _this = this; + return self.clients + .matchAll({ + type: 'window', + includeUncontrolled: true + }) + .then(function (clientList) { + var internalMsg = __WEBPACK_IMPORTED_MODULE_2__models_worker_page_message__["a" /* default */].createNewMsg(__WEBPACK_IMPORTED_MODULE_2__models_worker_page_message__["a" /* default */].TYPES_OF_MSG.PUSH_MSG_RECEIVED, msgPayload); + return Promise.all(clientList.map(function (client) { + return _this.attemptToMessageClient_(client, internalMsg); + })); + }); + }; + /** + * This will register the default service worker and return the registration. + * @private + * @return {Promise} The service worker + * registration to be used for the push service. + */ + SWController.prototype.getSWRegistration_ = function () { + return Promise.resolve(self.registration); + }; + return SWController; +}(__WEBPACK_IMPORTED_MODULE_0__controller_interface__["a" /* default */])); +/* harmony default export */ __webpack_exports__["a"] = (SWController); + +//# sourceMappingURL=sw-controller.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/messaging/dist/esm/src/controllers/window-controller.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@firebase/messaging/dist/esm/src/controllers/window-controller.js ***! + \****************************************************************************************/ +/*! exports provided: default */ +/*! exports used: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__controller_interface__ = __webpack_require__(/*! ./controller-interface */ "./node_modules/@firebase/messaging/dist/esm/src/controllers/controller-interface.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__models_errors__ = __webpack_require__(/*! ../models/errors */ "./node_modules/@firebase/messaging/dist/esm/src/models/errors.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__models_worker_page_message__ = __webpack_require__(/*! ../models/worker-page-message */ "./node_modules/@firebase/messaging/dist/esm/src/models/worker-page-message.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__models_default_sw__ = __webpack_require__(/*! ../models/default-sw */ "./node_modules/@firebase/messaging/dist/esm/src/models/default-sw.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__models_notification_permission__ = __webpack_require__(/*! ../models/notification-permission */ "./node_modules/@firebase/messaging/dist/esm/src/models/notification-permission.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__firebase_util__ = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__firebase_util___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__firebase_util__); +/** + * 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. + */ + +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 WindowController = /** @class */ (function (_super) { + __extends(WindowController, _super); + /** + * A service that provides a MessagingService instance. + * @param {!firebase.app.App} app + */ + function WindowController(app) { + var _this = _super.call(this, app) || this; + _this.messageObserver_ = null; + _this.onMessage_ = Object(__WEBPACK_IMPORTED_MODULE_5__firebase_util__["createSubscribe"])(function (observer) { + _this.messageObserver_ = observer; + }); + _this.tokenRefreshObserver_ = null; + _this.onTokenRefresh_ = Object(__WEBPACK_IMPORTED_MODULE_5__firebase_util__["createSubscribe"])(function (observer) { + _this.tokenRefreshObserver_ = observer; + }); + _this.setupSWMessageListener_(); + return _this; + } + /** + * This method returns an FCM token if it can be generated. + * The return promise will reject if the browser doesn't support + * FCM, if permission is denied for notifications or it's not + * possible to generate a token. + * @export + * @return {Promise | Promise} Returns a promise the + * resolves to an FCM token or null if permission isn't granted. + */ + WindowController.prototype.getToken = function () { + var _this = this; + // Check that the required API's are available + if (!this.isSupported_()) { + return Promise.reject(this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.UNSUPPORTED_BROWSER)); + } + return this.manifestCheck_().then(function () { + return _super.prototype.getToken.call(_this); + }); + }; + /** + * The method checks that a manifest is defined and has the correct GCM + * sender ID. + * @private + * @return {Promise} Returns a promise that resolves if the manifest matches + * our required sender ID + */ + WindowController.prototype.manifestCheck_ = function () { + var _this = this; + if (this.manifestCheckPromise_) { + return this.manifestCheckPromise_; + } + var manifestTag = document.querySelector('link[rel="manifest"]'); + if (!manifestTag) { + this.manifestCheckPromise_ = Promise.resolve(); + } + else { + this.manifestCheckPromise_ = fetch(manifestTag.href) + .then(function (response) { + return response.json(); + }) + .catch(function () { + // If the download or parsing fails allow check. + // We only want to error if we KNOW that the gcm_sender_id is incorrect. + return Promise.resolve(); + }) + .then(function (manifestContent) { + if (!manifestContent) { + return; + } + if (!manifestContent['gcm_sender_id']) { + return; + } + if (manifestContent['gcm_sender_id'] !== '103953800507') { + throw _this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.INCORRECT_GCM_SENDER_ID); + } + }); + } + return this.manifestCheckPromise_; + }; + /** + * Request permission if it is not currently granted + * @export + * @returns {Promise} Resolves if the permission was granted, otherwise + * rejects + */ + WindowController.prototype.requestPermission = function () { + var _this = this; + if (Notification.permission === __WEBPACK_IMPORTED_MODULE_4__models_notification_permission__["a" /* default */].granted) { + return Promise.resolve(); + } + return new Promise(function (resolve, reject) { + var managePermissionResult = function (result) { + if (result === __WEBPACK_IMPORTED_MODULE_4__models_notification_permission__["a" /* default */].granted) { + return resolve(); + } + else if (result === __WEBPACK_IMPORTED_MODULE_4__models_notification_permission__["a" /* default */].denied) { + return reject(_this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.PERMISSION_BLOCKED)); + } + else { + return reject(_this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.PERMISSION_DEFAULT)); + } + }; + // The Notification.requestPermission API was changed to + // return a promise so now have to handle both in case + // browsers stop support callbacks for promised version + var permissionPromise = Notification.requestPermission(function (result) { + if (permissionPromise) { + // Let the promise manage this + return; + } + managePermissionResult(result); + }); + if (permissionPromise) { + // Prefer the promise version as it's the future API. + permissionPromise.then(managePermissionResult); + } + }); + }; + /** + * This method allows a developer to override the default service worker and + * instead use a custom service worker. + * @export + * @param {!ServiceWorkerRegistration} registration The service worker + * registration that should be used to receive the push messages. + */ + WindowController.prototype.useServiceWorker = function (registration) { + if (!(registration instanceof ServiceWorkerRegistration)) { + throw this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.SW_REGISTRATION_EXPECTED); + } + if (typeof this.registrationToUse_ !== 'undefined') { + throw this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.USE_SW_BEFORE_GET_TOKEN); + } + this.registrationToUse_ = registration; + }; + /** + * @export + * @param {!firebase.Observer|function(*)} nextOrObserver An observer object + * or a function triggered on message. + * @param {function(!Error)=} optError Optional A function triggered on + * message error. + * @param {function()=} optCompleted Optional function triggered when the + * observer is removed. + * @return {!function()} The unsubscribe function for the observer. + */ + WindowController.prototype.onMessage = function (nextOrObserver, optError, optCompleted) { + return this.onMessage_(nextOrObserver, optError, optCompleted); + }; + /** + * @export + * @param {!firebase.Observer|function()} nextOrObserver An observer object + * or a function triggered on token refresh. + * @param {function(!Error)=} optError Optional A function + * triggered on token refresh error. + * @param {function()=} optCompleted Optional function triggered when the + * observer is removed. + * @return {!function()} The unsubscribe function for the observer. + */ + WindowController.prototype.onTokenRefresh = function (nextOrObserver, optError, optCompleted) { + return this.onTokenRefresh_(nextOrObserver, optError, optCompleted); + }; + /** + * Given a registration, wait for the service worker it relates to + * become activer + * @private + * @param {ServiceWorkerRegistration} registration Registration to wait + * for service worker to become active + * @return {Promise} Wait for service worker + * registration to become active + */ + WindowController.prototype.waitForRegistrationToActivate_ = function (registration) { + var _this = this; + var serviceWorker = registration.installing || registration.waiting || registration.active; + return new Promise(function (resolve, reject) { + if (!serviceWorker) { + // This is a rare scenario but has occured in firefox + reject(_this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.NO_SW_IN_REG)); + return; + } + // Because the Promise function is called on next tick there is a + // small chance that the worker became active or redundant already. + if (serviceWorker.state === 'activated') { + resolve(registration); + return; + } + if (serviceWorker.state === 'redundant') { + reject(_this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.SW_REG_REDUNDANT)); + return; + } + var stateChangeListener = function () { + if (serviceWorker.state === 'activated') { + resolve(registration); + } + else if (serviceWorker.state === 'redundant') { + reject(_this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.SW_REG_REDUNDANT)); + } + else { + // Return early and wait to next state change + return; + } + serviceWorker.removeEventListener('statechange', stateChangeListener); + }; + serviceWorker.addEventListener('statechange', stateChangeListener); + }); + }; + /** + * This will regiater the default service worker and return the registration + * @private + * @return {Promise} The service worker + * registration to be used for the push service. + */ + WindowController.prototype.getSWRegistration_ = function () { + var _this = this; + if (this.registrationToUse_) { + return this.waitForRegistrationToActivate_(this.registrationToUse_); + } + // Make the registration null so we know useServiceWorker will not + // use a new service worker as registrationToUse_ is no longer undefined + this.registrationToUse_ = null; + return navigator.serviceWorker + .register(__WEBPACK_IMPORTED_MODULE_3__models_default_sw__["a" /* default */].path, { + scope: __WEBPACK_IMPORTED_MODULE_3__models_default_sw__["a" /* default */].scope + }) + .catch(function (err) { + throw _this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__models_errors__["a" /* default */].codes.FAILED_DEFAULT_REGISTRATION, { + browserErrorMessage: err.message + }); + }) + .then(function (registration) { + return _this.waitForRegistrationToActivate_(registration).then(function () { + _this.registrationToUse_ = registration; + // We update after activation due to an issue with Firefox v49 where + // a race condition occassionally causes the service work to not + // install + registration.update(); + return registration; + }); + }); + }; + /** + * This method will set up a message listener to handle + * events from the service worker that should trigger + * events in the page. + * + * @private + */ + WindowController.prototype.setupSWMessageListener_ = function () { + var _this = this; + if (!('serviceWorker' in navigator)) { + return; + } + navigator.serviceWorker.addEventListener('message', function (event) { + if (!event.data || !event.data[__WEBPACK_IMPORTED_MODULE_2__models_worker_page_message__["a" /* default */].PARAMS.TYPE_OF_MSG]) { + // Not a message from FCM + return; + } + var workerPageMessage = event.data; + switch (workerPageMessage[__WEBPACK_IMPORTED_MODULE_2__models_worker_page_message__["a" /* default */].PARAMS.TYPE_OF_MSG]) { + case __WEBPACK_IMPORTED_MODULE_2__models_worker_page_message__["a" /* default */].TYPES_OF_MSG.PUSH_MSG_RECEIVED: + case __WEBPACK_IMPORTED_MODULE_2__models_worker_page_message__["a" /* default */].TYPES_OF_MSG.NOTIFICATION_CLICKED: + var pushMessage = workerPageMessage[__WEBPACK_IMPORTED_MODULE_2__models_worker_page_message__["a" /* default */].PARAMS.DATA]; + _this.messageObserver_.next(pushMessage); + break; + default: + // Noop. + break; + } + }, false); + }; + /** + * Checks to see if the required API's are valid or not. + * @private + * @return {boolean} Returns true if the desired APIs are available. + */ + WindowController.prototype.isSupported_ = function () { + return ('serviceWorker' in navigator && + 'PushManager' in window && + 'Notification' in window && + 'fetch' in window && + ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') && + PushSubscription.prototype.hasOwnProperty('getKey')); + }; + return WindowController; +}(__WEBPACK_IMPORTED_MODULE_0__controller_interface__["a" /* default */])); +/* harmony default export */ __webpack_exports__["a"] = (WindowController); + +//# sourceMappingURL=window-controller.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/messaging/dist/esm/src/helpers/array-buffer-to-base64.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/@firebase/messaging/dist/esm/src/helpers/array-buffer-to-base64.js ***! + \*****************************************************************************************/ +/*! exports provided: default */ +/*! exports used: default */ +/***/ (function(module, __webpack_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. + */ +function toBase64(arrayBuffer) { + var uint8Version = new Uint8Array(arrayBuffer); + return window.btoa(String.fromCharCode.apply(null, uint8Version)); +} +/* harmony default export */ __webpack_exports__["a"] = (function (arrayBuffer) { + var base64String = toBase64(arrayBuffer); + return base64String + .replace(/=/g, '') + .replace(/\+/g, '-') + .replace(/\//g, '_'); +});; + +//# sourceMappingURL=array-buffer-to-base64.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/messaging/dist/esm/src/models/default-sw.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@firebase/messaging/dist/esm/src/models/default-sw.js ***! + \****************************************************************************/ +/*! exports provided: default */ +/*! exports used: default */ +/***/ (function(module, __webpack_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. + */ + +/* harmony default export */ __webpack_exports__["a"] = ({ + path: '/firebase-messaging-sw.js', + scope: '/firebase-cloud-messaging-push-scope' +}); + +//# sourceMappingURL=default-sw.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/messaging/dist/esm/src/models/errors.js": +/*!************************************************************************!*\ + !*** ./node_modules/@firebase/messaging/dist/esm/src/models/errors.js ***! + \************************************************************************/ +/*! exports provided: default */ +/*! exports used: default */ +/***/ (function(module, __webpack_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. + */ + +var CODES = { + AVAILABLE_IN_WINDOW: 'only-available-in-window', + AVAILABLE_IN_SW: 'only-available-in-sw', + SHOULD_BE_INHERITED: 'should-be-overriden', + BAD_SENDER_ID: 'bad-sender-id', + INCORRECT_GCM_SENDER_ID: 'incorrect-gcm-sender-id', + PERMISSION_DEFAULT: 'permission-default', + PERMISSION_BLOCKED: 'permission-blocked', + UNSUPPORTED_BROWSER: 'unsupported-browser', + NOTIFICATIONS_BLOCKED: 'notifications-blocked', + FAILED_DEFAULT_REGISTRATION: 'failed-serviceworker-registration', + SW_REGISTRATION_EXPECTED: 'sw-registration-expected', + GET_SUBSCRIPTION_FAILED: 'get-subscription-failed', + INVALID_SAVED_TOKEN: 'invalid-saved-token', + SW_REG_REDUNDANT: 'sw-reg-redundant', + TOKEN_SUBSCRIBE_FAILED: 'token-subscribe-failed', + TOKEN_SUBSCRIBE_NO_TOKEN: 'token-subscribe-no-token', + TOKEN_SUBSCRIBE_NO_PUSH_SET: 'token-subscribe-no-push-set', + USE_SW_BEFORE_GET_TOKEN: 'use-sw-before-get-token', + INVALID_DELETE_TOKEN: 'invalid-delete-token', + DELETE_TOKEN_NOT_FOUND: 'delete-token-not-found', + DELETE_SCOPE_NOT_FOUND: 'delete-scope-not-found', + BG_HANDLER_FUNCTION_EXPECTED: 'bg-handler-function-expected', + NO_WINDOW_CLIENT_TO_MSG: 'no-window-client-to-msg', + UNABLE_TO_RESUBSCRIBE: 'unable-to-resubscribe', + NO_FCM_TOKEN_FOR_RESUBSCRIBE: 'no-fcm-token-for-resubscribe', + FAILED_TO_DELETE_TOKEN: 'failed-to-delete-token', + NO_SW_IN_REG: 'no-sw-in-reg', + BAD_SCOPE: 'bad-scope', + BAD_VAPID_KEY: 'bad-vapid-key', + BAD_SUBSCRIPTION: 'bad-subscription', + BAD_TOKEN: 'bad-token', + BAD_PUSH_SET: 'bad-push-set', + FAILED_DELETE_VAPID_KEY: 'failed-delete-vapid-key' +}; +var ERROR_MAP = (_a = {}, + _a[CODES.AVAILABLE_IN_WINDOW] = 'This method is available in a Window context.', + _a[CODES.AVAILABLE_IN_SW] = 'This method is available in a service worker ' + 'context.', + _a[CODES.SHOULD_BE_INHERITED] = 'This method should be overriden by ' + 'extended classes.', + _a[CODES.BAD_SENDER_ID] = "Please ensure that 'messagingSenderId' is set " + + 'correctly in the options passed into firebase.initializeApp().', + _a[CODES.PERMISSION_DEFAULT] = 'The required permissions were not granted and ' + 'dismissed instead.', + _a[CODES.PERMISSION_BLOCKED] = 'The required permissions were not granted and ' + 'blocked instead.', + _a[CODES.UNSUPPORTED_BROWSER] = "This browser doesn't support the API's " + + 'required to use the firebase SDK.', + _a[CODES.NOTIFICATIONS_BLOCKED] = 'Notifications have been blocked.', + _a[CODES.FAILED_DEFAULT_REGISTRATION] = 'We are unable to register the ' + + 'default service worker. {$browserErrorMessage}', + _a[CODES.SW_REGISTRATION_EXPECTED] = 'A service worker registration was the ' + 'expected input.', + _a[CODES.GET_SUBSCRIPTION_FAILED] = 'There was an error when trying to get ' + + 'any existing Push Subscriptions.', + _a[CODES.INVALID_SAVED_TOKEN] = 'Unable to access details of the saved token.', + _a[CODES.SW_REG_REDUNDANT] = 'The service worker being used for push was made ' + 'redundant.', + _a[CODES.TOKEN_SUBSCRIBE_FAILED] = 'A problem occured while subscribing the ' + 'user to FCM: {$message}', + _a[CODES.TOKEN_SUBSCRIBE_NO_TOKEN] = 'FCM returned no token when subscribing ' + 'the user to push.', + _a[CODES.TOKEN_SUBSCRIBE_NO_PUSH_SET] = 'FCM returned an invalid response ' + 'when getting an FCM token.', + _a[CODES.USE_SW_BEFORE_GET_TOKEN] = 'You must call useServiceWorker() before ' + + 'calling getToken() to ensure your service worker is used.', + _a[CODES.INVALID_DELETE_TOKEN] = 'You must pass a valid token into ' + + 'deleteToken(), i.e. the token from getToken().', + _a[CODES.DELETE_TOKEN_NOT_FOUND] = 'The deletion attempt for token could not ' + + 'be performed as the token was not found.', + _a[CODES.DELETE_SCOPE_NOT_FOUND] = 'The deletion attempt for service worker ' + + 'scope could not be performed as the scope was not found.', + _a[CODES.BG_HANDLER_FUNCTION_EXPECTED] = 'The input to ' + 'setBackgroundMessageHandler() must be a function.', + _a[CODES.NO_WINDOW_CLIENT_TO_MSG] = 'An attempt was made to message a ' + 'non-existant window client.', + _a[CODES.UNABLE_TO_RESUBSCRIBE] = 'There was an error while re-subscribing ' + + 'the FCM token for push messaging. Will have to resubscribe the ' + + 'user on next visit. {$message}', + _a[CODES.NO_FCM_TOKEN_FOR_RESUBSCRIBE] = 'Could not find an FCM token ' + + 'and as a result, unable to resubscribe. Will have to resubscribe the ' + + 'user on next visit.', + _a[CODES.FAILED_TO_DELETE_TOKEN] = 'Unable to delete the currently saved token.', + _a[CODES.NO_SW_IN_REG] = 'Even though the service worker registration was ' + + 'successful, there was a problem accessing the service worker itself.', + _a[CODES.INCORRECT_GCM_SENDER_ID] = "Please change your web app manifest's " + + "'gcm_sender_id' value to '103953800507' to use Firebase messaging.", + _a[CODES.BAD_SCOPE] = 'The service worker scope must be a string with at ' + + 'least one character.', + _a[CODES.BAD_VAPID_KEY] = 'The public VAPID key must be a string with at ' + 'least one character.', + _a[CODES.BAD_SUBSCRIPTION] = 'The subscription must be a valid ' + 'PushSubscription.', + _a[CODES.BAD_TOKEN] = 'The FCM Token used for storage / lookup was not ' + + 'a valid token string.', + _a[CODES.BAD_PUSH_SET] = 'The FCM push set used for storage / lookup was not ' + + 'not a valid push set string.', + _a[CODES.FAILED_DELETE_VAPID_KEY] = 'The VAPID key could not be deleted.', + _a); +/* harmony default export */ __webpack_exports__["a"] = ({ + codes: CODES, + map: ERROR_MAP +}); +var _a; + +//# sourceMappingURL=errors.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/messaging/dist/esm/src/models/fcm-details.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@firebase/messaging/dist/esm/src/models/fcm-details.js ***! + \*****************************************************************************/ +/*! exports provided: default */ +/*! exports used: default */ +/***/ (function(module, __webpack_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. + */ + +var FCM_APPLICATION_SERVER_KEY = [ + 0x04, + 0x33, + 0x94, + 0xf7, + 0xdf, + 0xa1, + 0xeb, + 0xb1, + 0xdc, + 0x03, + 0xa2, + 0x5e, + 0x15, + 0x71, + 0xdb, + 0x48, + 0xd3, + 0x2e, + 0xed, + 0xed, + 0xb2, + 0x34, + 0xdb, + 0xb7, + 0x47, + 0x3a, + 0x0c, + 0x8f, + 0xc4, + 0xcc, + 0xe1, + 0x6f, + 0x3c, + 0x8c, + 0x84, + 0xdf, + 0xab, + 0xb6, + 0x66, + 0x3e, + 0xf2, + 0x0c, + 0xd4, + 0x8b, + 0xfe, + 0xe3, + 0xf9, + 0x76, + 0x2f, + 0x14, + 0x1c, + 0x63, + 0x08, + 0x6a, + 0x6f, + 0x2d, + 0xb1, + 0x1a, + 0x95, + 0xb0, + 0xce, + 0x37, + 0xc0, + 0x9c, + 0x6e +]; +var SUBSCRIPTION_DETAILS = { + userVisibleOnly: true, + applicationServerKey: new Uint8Array(FCM_APPLICATION_SERVER_KEY) +}; +/* harmony default export */ __webpack_exports__["a"] = ({ + ENDPOINT: 'https://fcm.googleapis.com', + APPLICATION_SERVER_KEY: FCM_APPLICATION_SERVER_KEY, + SUBSCRIPTION_OPTIONS: SUBSCRIPTION_DETAILS +}); + +//# sourceMappingURL=fcm-details.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/messaging/dist/esm/src/models/notification-permission.js": +/*!*****************************************************************************************!*\ + !*** ./node_modules/@firebase/messaging/dist/esm/src/models/notification-permission.js ***! + \*****************************************************************************************/ +/*! exports provided: default */ +/*! exports used: default */ +/***/ (function(module, __webpack_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. + */ + +/* harmony default export */ __webpack_exports__["a"] = ({ + granted: 'granted', + default: 'default', + denied: 'denied' +}); + +//# sourceMappingURL=notification-permission.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/messaging/dist/esm/src/models/token-manager.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@firebase/messaging/dist/esm/src/models/token-manager.js ***! + \*******************************************************************************/ +/*! exports provided: default */ +/*! exports used: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__firebase_util__ = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/cjs/index.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__firebase_util___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__firebase_util__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__errors__ = __webpack_require__(/*! ./errors */ "./node_modules/@firebase/messaging/dist/esm/src/models/errors.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__helpers_array_buffer_to_base64__ = __webpack_require__(/*! ../helpers/array-buffer-to-base64 */ "./node_modules/@firebase/messaging/dist/esm/src/helpers/array-buffer-to-base64.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__fcm_details__ = __webpack_require__(/*! ./fcm-details */ "./node_modules/@firebase/messaging/dist/esm/src/models/fcm-details.js"); +/** + * 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. + */ + + + + + +var FCM_TOKEN_OBJ_STORE = 'fcm_token_object_Store'; +var FCM_TOKEN_DETAILS_DB_VERSION = 1; +var TokenManager = /** @class */ (function () { + function TokenManager() { + this.errorFactory_ = new __WEBPACK_IMPORTED_MODULE_0__firebase_util__["ErrorFactory"]('messaging', 'Messaging', __WEBPACK_IMPORTED_MODULE_1__errors__["a" /* default */].map); + this.openDbPromise_ = null; + } + /** + * Get the indexedDB as a promsie. + * @private + * @return {Promise} The IndexedDB database + */ + TokenManager.prototype.openDatabase_ = function () { + if (this.openDbPromise_) { + return this.openDbPromise_; + } + this.openDbPromise_ = new Promise(function (resolve, reject) { + var request = indexedDB.open(TokenManager.DB_NAME, FCM_TOKEN_DETAILS_DB_VERSION); + request.onerror = function (event) { + reject(event.target.error); + }; + request.onsuccess = function (event) { + resolve(event.target.result); + }; + request.onupgradeneeded = function (event) { + var db = event.target.result; + var objectStore = db.createObjectStore(FCM_TOKEN_OBJ_STORE, { + keyPath: 'swScope' + }); + // Make sure the sender ID can be searched + objectStore.createIndex('fcmSenderId', 'fcmSenderId', { + unique: false + }); + objectStore.createIndex('fcmToken', 'fcmToken', { + unique: true + }); + }; + }); + return this.openDbPromise_; + }; + /** + * Close the currently open database. + * @return {Promise} Returns the result of the promise chain. + */ + TokenManager.prototype.closeDatabase = function () { + var _this = this; + if (this.openDbPromise_) { + return this.openDbPromise_.then(function (db) { + db.close(); + _this.openDbPromise_ = null; + }); + } + return Promise.resolve(); + }; + /** + * Given a token, this method will look up the details in indexedDB. + * @public + * @param {string} fcmToken + * @return {Promise} The details associated with that token. + */ + TokenManager.prototype.getTokenDetailsFromToken = function (fcmToken) { + return this.openDatabase_().then(function (db) { + return new Promise(function (resolve, reject) { + var transaction = db.transaction([FCM_TOKEN_OBJ_STORE]); + var objectStore = transaction.objectStore(FCM_TOKEN_OBJ_STORE); + var index = objectStore.index('fcmToken'); + var request = index.get(fcmToken); + request.onerror = function (event) { + reject(event.target.error); + }; + request.onsuccess = function (event) { + resolve(event.target.result); + }; + }); + }); + }; + TokenManager.prototype.getTokenDetailsFromSWScope_ = function (swScope) { + return this.openDatabase_().then(function (db) { + return new Promise(function (resolve, reject) { + var transaction = db.transaction([FCM_TOKEN_OBJ_STORE]); + var objectStore = transaction.objectStore(FCM_TOKEN_OBJ_STORE); + var scopeRequest = objectStore.get(swScope); + scopeRequest.onerror = function (event) { + reject(event.target.error); + }; + scopeRequest.onsuccess = function (event) { + resolve(event.target.result); + }; + }); + }); + }; + TokenManager.prototype.getAllTokenDetailsForSenderId_ = function (senderId) { + return this.openDatabase_().then(function (db) { + return new Promise(function (resolve, reject) { + var transaction = db.transaction([FCM_TOKEN_OBJ_STORE]); + var objectStore = transaction.objectStore(FCM_TOKEN_OBJ_STORE); + var senderIdTokens = []; + var cursorRequest = objectStore.openCursor(); + cursorRequest.onerror = function (event) { + reject(event.target.error); + }; + cursorRequest.onsuccess = function (event) { + var cursor = event.target.result; + if (cursor) { + if (cursor.value['fcmSenderId'] === senderId) { + senderIdTokens.push(cursor.value); + } + cursor.continue(); + } + else { + resolve(senderIdTokens); + } + }; + }); + }); + }; + /** + * Given a PushSubscription and messagingSenderId, get an FCM token. + * @public + * @param {string} senderId The 'messagingSenderId' to tie the token to. + * @param {PushSubscription} subscription The PushSusbcription to "federate". + * @param {string=} pushSet If defined this will swap the subscription for + * matching FCM token. + * @return {Promise} Returns the FCM token to be used in place + * of the PushSubscription. + */ + TokenManager.prototype.subscribeToFCM = function (senderId, subscription, pushSet) { + var _this = this; + var p256dh = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_array_buffer_to_base64__["a" /* default */])(subscription['getKey']('p256dh')); + var auth = Object(__WEBPACK_IMPORTED_MODULE_2__helpers_array_buffer_to_base64__["a" /* default */])(subscription['getKey']('auth')); + var fcmSubscribeBody = "authorized_entity=" + senderId + "&" + + ("endpoint=" + subscription.endpoint + "&") + + ("encryption_key=" + p256dh + "&") + + ("encryption_auth=" + auth); + if (pushSet) { + fcmSubscribeBody += "&pushSet=" + pushSet; + } + var headers = new Headers(); + headers.append('Content-Type', 'application/x-www-form-urlencoded'); + var subscribeOptions = { + method: 'POST', + headers: headers, + body: fcmSubscribeBody + }; + return fetch(__WEBPACK_IMPORTED_MODULE_3__fcm_details__["a" /* default */].ENDPOINT + '/fcm/connect/subscribe', subscribeOptions) + .then(function (response) { return response.json(); }) + .then(function (response) { + var fcmTokenResponse = response; + if (fcmTokenResponse['error']) { + var message = fcmTokenResponse['error']['message']; + throw _this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__errors__["a" /* default */].codes.TOKEN_SUBSCRIBE_FAILED, { + message: message + }); + } + if (!fcmTokenResponse['token']) { + throw _this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__errors__["a" /* default */].codes.TOKEN_SUBSCRIBE_NO_TOKEN); + } + if (!fcmTokenResponse['pushSet']) { + throw _this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__errors__["a" /* default */].codes.TOKEN_SUBSCRIBE_NO_PUSH_SET); + } + return { + token: fcmTokenResponse['token'], + pushSet: fcmTokenResponse['pushSet'] + }; + }); + }; + /** + * Checks the that fields in the PushSubscription are equivalent to the + * details stores in the masterTokenDetails. + * @private + * @param {PushSubscription} subscription The push subscription we expect + * the master token to match. + * @param {Object} masterTokenDetails The saved details we wish to compare + * with the PushSubscription + * @return {boolean} true if the subscription and token details are + * equivalent. + */ + TokenManager.prototype.isSameSubscription_ = function (subscription, masterTokenDetails) { + // getKey() isn't defined in the PushSubscription externs file, hence + // subscription['getKey'](''). + return (subscription.endpoint === masterTokenDetails['endpoint'] && + Object(__WEBPACK_IMPORTED_MODULE_2__helpers_array_buffer_to_base64__["a" /* default */])(subscription['getKey']('auth')) === + masterTokenDetails['auth'] && + Object(__WEBPACK_IMPORTED_MODULE_2__helpers_array_buffer_to_base64__["a" /* default */])(subscription['getKey']('p256dh')) === + masterTokenDetails['p256dh']); + }; + /** + * Save the details for the fcm token for re-use at a later date. + * @private + * @param {string} senderId The 'messagingSenderId' used for this project + * @param {ServiceWorkerRegistration} swRegistration The service worker + * used to subscribe the user for web push + * @param {PushSubscription} subscription The push subscription passed to + * FCM for the current token. + * @param {string} fcmToken The FCM token currently used on this + * device. + * @param {string} fcmPushSet The FCM push tied to the fcm token. + * @return {Promise} + */ + TokenManager.prototype.saveTokenDetails_ = function (senderId, swRegistration, subscription, fcmToken, fcmPushSet) { + var details = { + swScope: swRegistration.scope, + endpoint: subscription.endpoint, + auth: Object(__WEBPACK_IMPORTED_MODULE_2__helpers_array_buffer_to_base64__["a" /* default */])(subscription['getKey']('auth')), + p256dh: Object(__WEBPACK_IMPORTED_MODULE_2__helpers_array_buffer_to_base64__["a" /* default */])(subscription['getKey']('p256dh')), + fcmToken: fcmToken, + fcmPushSet: fcmPushSet, + fcmSenderId: senderId + }; + return this.openDatabase_().then(function (db) { + return new Promise(function (resolve, reject) { + var transaction = db.transaction([FCM_TOKEN_OBJ_STORE], 'readwrite'); + var objectStore = transaction.objectStore(FCM_TOKEN_OBJ_STORE); + var request = objectStore.put(details); + request.onerror = function (event) { + reject(event.target.error); + }; + request.onsuccess = function (event) { + resolve(); + }; + }); + }); + }; + /** + * Returns the saved FCM Token if one is available and still valid, + * otherwise `null` is returned. + * @param {string} senderId This should be the sender ID associated with the + * FCM Token being retrieved. + * @param {ServiceWorkerRegistration} swRegistration Registration to be used + * to subscribe the user to push. + * @return {Promise | Promise} Returns the saved FCM Token if + * avilable and valid. + * @export + */ + TokenManager.prototype.getSavedToken = function (senderId, swRegistration) { + var _this = this; + if (!(swRegistration instanceof ServiceWorkerRegistration)) { + return Promise.reject(this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__errors__["a" /* default */].codes.SW_REGISTRATION_EXPECTED)); + } + if (typeof senderId !== 'string' || senderId.length === 0) { + return Promise.reject(this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__errors__["a" /* default */].codes.BAD_SENDER_ID)); + } + return this.getAllTokenDetailsForSenderId_(senderId) + .then(function (allTokenDetails) { + if (allTokenDetails.length === 0) { + return; + } + var index = allTokenDetails.findIndex(function (tokenDetails) { + return (swRegistration.scope === tokenDetails['swScope'] && + senderId === tokenDetails['fcmSenderId']); + }); + if (index === -1) { + return; + } + return allTokenDetails[index]; + }) + .then(function (tokenDetails) { + if (!tokenDetails) { + return; + } + return swRegistration.pushManager + .getSubscription() + .catch(function (err) { + throw _this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__errors__["a" /* default */].codes.GET_SUBSCRIPTION_FAILED); + }) + .then(function (subscription) { + if (subscription && + _this.isSameSubscription_(subscription, tokenDetails)) { + return tokenDetails['fcmToken']; + } + }); + }); + }; + /** + * Creates a new FCM token. + */ + TokenManager.prototype.createToken = function (senderId, swRegistration) { + var _this = this; + if (typeof senderId !== 'string' || senderId.length === 0) { + return Promise.reject(this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__errors__["a" /* default */].codes.BAD_SENDER_ID)); + } + if (!(swRegistration instanceof ServiceWorkerRegistration)) { + return Promise.reject(this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__errors__["a" /* default */].codes.SW_REGISTRATION_EXPECTED)); + } + // Check for existing subscription first + var subscription; + var fcmTokenDetails; + return swRegistration.pushManager + .getSubscription() + .then(function (subscription) { + if (subscription) { + return subscription; + } + return swRegistration.pushManager.subscribe(__WEBPACK_IMPORTED_MODULE_3__fcm_details__["a" /* default */].SUBSCRIPTION_OPTIONS); + }) + .then(function (sub) { + subscription = sub; + return _this.subscribeToFCM(senderId, subscription); + }) + .then(function (tokenDetails) { + fcmTokenDetails = tokenDetails; + return _this.saveTokenDetails_(senderId, swRegistration, subscription, fcmTokenDetails['token'], fcmTokenDetails['pushSet']); + }) + .then(function () { return fcmTokenDetails['token']; }); + }; + /** + * This method deletes details of the current FCM token. + * It's returning a promise in case we need to move to an async + * method for deleting at a later date. + * @param {string} token Token to be deleted + * @return {Promise} Resolves once the FCM token details have been + * deleted and returns the deleted details. + */ + TokenManager.prototype.deleteToken = function (token) { + var _this = this; + if (typeof token !== 'string' || token.length === 0) { + return Promise.reject(this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__errors__["a" /* default */].codes.INVALID_DELETE_TOKEN)); + } + return this.getTokenDetailsFromToken(token).then(function (details) { + if (!details) { + throw _this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__errors__["a" /* default */].codes.DELETE_TOKEN_NOT_FOUND); + } + return _this.openDatabase_().then(function (db) { + return new Promise(function (resolve, reject) { + var transaction = db.transaction([FCM_TOKEN_OBJ_STORE], 'readwrite'); + var objectStore = transaction.objectStore(FCM_TOKEN_OBJ_STORE); + var request = objectStore.delete(details['swScope']); + request.onerror = function (event) { + reject(event.target.error); + }; + request.onsuccess = function (event) { + if (event.target.result === 0) { + reject(_this.errorFactory_.create(__WEBPACK_IMPORTED_MODULE_1__errors__["a" /* default */].codes.FAILED_TO_DELETE_TOKEN)); + return; + } + resolve(details); + }; + }); + }); + }); + }; + return TokenManager; +}()); +/* harmony default export */ __webpack_exports__["a"] = (TokenManager); + +//# sourceMappingURL=token-manager.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/messaging/dist/esm/src/models/worker-page-message.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/@firebase/messaging/dist/esm/src/models/worker-page-message.js ***! + \*************************************************************************************/ +/*! exports provided: default */ +/*! exports used: default */ +/***/ (function(module, __webpack_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. + */ + +// These fields are strings to prevent closure from thinking goog.getMsg +// should be used to initialise the values +var PARAMS = { + TYPE_OF_MSG: 'firebase-messaging-msg-type', + DATA: 'firebase-messaging-msg-data' +}; +// This value isn't using the TYPE_OF_MSG short hand as closure +// expects the variable to be defined via goog.getMsg +var msgType = { + PUSH_MSG_RECEIVED: 'push-msg-received', + NOTIFICATION_CLICKED: 'notification-clicked' +}; +var createNewMsg = function (msgType, msgData) { + var message = (_a = {}, + _a[PARAMS.TYPE_OF_MSG] = msgType, + _a[PARAMS.DATA] = msgData, + _a); + return message; + var _a; +}; +/* harmony default export */ __webpack_exports__["a"] = ({ + PARAMS: PARAMS, + TYPES_OF_MSG: msgType, + createNewMsg: createNewMsg +}); + +//# sourceMappingURL=worker-page-message.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/polyfill/dist/esm/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/@firebase/polyfill/dist/esm/index.js ***! + \***********************************************************/ +/*! no exports provided */ +/*! all exports used */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_polyfills_promise__ = __webpack_require__(/*! ./src/polyfills/promise */ "./node_modules/@firebase/polyfill/dist/esm/src/polyfills/promise.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_polyfills_promise___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__src_polyfills_promise__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_shims_find__ = __webpack_require__(/*! ./src/shims/find */ "./node_modules/@firebase/polyfill/dist/esm/src/shims/find.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_shims_find___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__src_shims_find__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_shims_findIndex__ = __webpack_require__(/*! ./src/shims/findIndex */ "./node_modules/@firebase/polyfill/dist/esm/src/shims/findIndex.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_shims_findIndex___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__src_shims_findIndex__); +/** + * 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. + */ + + + + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/polyfill/dist/esm/src/polyfills/promise.js": +/*!***************************************************************************!*\ + !*** ./node_modules/@firebase/polyfill/dist/esm/src/polyfills/promise.js ***! + \***************************************************************************/ +/*! dynamic exports provided */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(global) {/** + * 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. + */ +var __global = (function () { + if (typeof global !== 'undefined') { + return global; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof self !== 'undefined') { + return self; + } + throw new Error('unable to locate global object'); +})(); +// Polyfill Promise +if (typeof Promise === 'undefined') { + // HACK: TS throws an error if I attempt to use 'dot-notation' + __global['Promise'] = Promise = __webpack_require__(/*! promise-polyfill */ "./node_modules/promise-polyfill/promise.js"); +} + +//# sourceMappingURL=promise.js.map + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! ./../../../../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ "./node_modules/@firebase/polyfill/dist/esm/src/shims/find.js": +/*!********************************************************************!*\ + !*** ./node_modules/@firebase/polyfill/dist/esm/src/shims/find.js ***! + \********************************************************************/ +/*! dynamic exports provided */ +/***/ (function(module, exports) { + +/** + * 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. + */ +/** + * This is the Array.prototype.find polyfill from MDN + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find + * https://tc39.github.io/ecma262/#sec-array.prototype.find + */ +if (!Array.prototype.find) { + Object.defineProperty(Array.prototype, 'find', { + value: function (predicate) { + // 1. Let O be ? ToObject(this value). + if (this == null) { + throw new TypeError('"this" is null or not defined'); + } + var o = Object(this); + // 2. Let len be ? ToLength(? Get(O, "length")). + var len = o.length >>> 0; + // 3. If IsCallable(predicate) is false, throw a TypeError exception. + if (typeof predicate !== 'function') { + throw new TypeError('predicate must be a function'); + } + // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + var thisArg = arguments[1]; + // 5. Let k be 0. + var k = 0; + // 6. Repeat, while k < len + while (k < len) { + // a. Let Pk be ! ToString(k). + // b. Let kValue be ? Get(O, Pk). + // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + // d. If testResult is true, return kValue. + var kValue = o[k]; + if (predicate.call(thisArg, kValue, k, o)) { + return kValue; + } + // e. Increase k by 1. + k++; + } + // 7. Return undefined. + return undefined; + } + }); +} + +//# sourceMappingURL=find.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/polyfill/dist/esm/src/shims/findIndex.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@firebase/polyfill/dist/esm/src/shims/findIndex.js ***! + \*************************************************************************/ +/*! dynamic exports provided */ +/***/ (function(module, exports) { + +/** + * 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. + */ +/** + * This is the Array.prototype.findIndex polyfill from MDN + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex + * https://tc39.github.io/ecma262/#sec-array.prototype.findIndex + */ +if (!Array.prototype.findIndex) { + Object.defineProperty(Array.prototype, 'findIndex', { + value: function (predicate) { + // 1. Let O be ? ToObject(this value). + if (this == null) { + throw new TypeError('"this" is null or not defined'); + } + var o = Object(this); + // 2. Let len be ? ToLength(? Get(O, "length")). + var len = o.length >>> 0; + // 3. If IsCallable(predicate) is false, throw a TypeError exception. + if (typeof predicate !== 'function') { + throw new TypeError('predicate must be a function'); + } + // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + var thisArg = arguments[1]; + // 5. Let k be 0. + var k = 0; + // 6. Repeat, while k < len + while (k < len) { + // a. Let Pk be ! ToString(k). + // b. Let kValue be ? Get(O, Pk). + // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + // d. If testResult is true, return k. + var kValue = o[k]; + if (predicate.call(thisArg, kValue, k, o)) { + return k; + } + // e. Increase k by 1. + k++; + } + // 7. Return -1. + return -1; + } + }); +} + +//# sourceMappingURL=findIndex.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/index.js": +/*!**********************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/index.js ***! + \**********************************************************/ +/*! exports provided: registerStorage */ +/*! all exports used */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* harmony export (immutable) */ __webpack_exports__["registerStorage"] = registerStorage; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__firebase_app__ = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/esm/index.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_implementation_string__ = __webpack_require__(/*! ./src/implementation/string */ "./node_modules/@firebase/storage/dist/esm/src/implementation/string.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_implementation_taskenums__ = __webpack_require__(/*! ./src/implementation/taskenums */ "./node_modules/@firebase/storage/dist/esm/src/implementation/taskenums.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__src_implementation_xhriopool__ = __webpack_require__(/*! ./src/implementation/xhriopool */ "./node_modules/@firebase/storage/dist/esm/src/implementation/xhriopool.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__src_reference__ = __webpack_require__(/*! ./src/reference */ "./node_modules/@firebase/storage/dist/esm/src/reference.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__src_service__ = __webpack_require__(/*! ./src/service */ "./node_modules/@firebase/storage/dist/esm/src/service.js"); +/** + * 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. + */ + + + + + + + +/** + * Type constant for Firebase Storage. + */ +var STORAGE_TYPE = 'storage'; +function factory(app, unused, opt_url) { + return new __WEBPACK_IMPORTED_MODULE_5__src_service__["a" /* Service */](app, new __WEBPACK_IMPORTED_MODULE_3__src_implementation_xhriopool__["a" /* XhrIoPool */](), opt_url); +} +function registerStorage(instance) { + var namespaceExports = { + // no-inline + TaskState: __WEBPACK_IMPORTED_MODULE_2__src_implementation_taskenums__["c" /* TaskState */], + TaskEvent: __WEBPACK_IMPORTED_MODULE_2__src_implementation_taskenums__["b" /* TaskEvent */], + StringFormat: __WEBPACK_IMPORTED_MODULE_1__src_implementation_string__["a" /* StringFormat */], + Storage: __WEBPACK_IMPORTED_MODULE_5__src_service__["a" /* Service */], + Reference: __WEBPACK_IMPORTED_MODULE_4__src_reference__["a" /* Reference */] + }; + instance.INTERNAL.registerService(STORAGE_TYPE, factory, namespaceExports, undefined, + // Allow multiple storage instances per app. + true); +} +registerStorage(__WEBPACK_IMPORTED_MODULE_0__firebase_app__["default"]); + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/args.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/args.js ***! + \****************************************************************************/ +/*! exports provided: validate, ArgSpec, and_, stringSpec, uploadDataSpec, metadataSpec, nonNegativeNumberSpec, looseObjectSpec, nullFunctionSpec */ +/*! exports used: looseObjectSpec, metadataSpec, nonNegativeNumberSpec, nullFunctionSpec, stringSpec, uploadDataSpec, validate */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (immutable) */ __webpack_exports__["g"] = validate; +/* unused harmony export ArgSpec */ +/* unused harmony export and_ */ +/* harmony export (immutable) */ __webpack_exports__["e"] = stringSpec; +/* harmony export (immutable) */ __webpack_exports__["f"] = uploadDataSpec; +/* harmony export (immutable) */ __webpack_exports__["b"] = metadataSpec; +/* harmony export (immutable) */ __webpack_exports__["c"] = nonNegativeNumberSpec; +/* harmony export (immutable) */ __webpack_exports__["a"] = looseObjectSpec; +/* harmony export (immutable) */ __webpack_exports__["d"] = nullFunctionSpec; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__error__ = __webpack_require__(/*! ./error */ "./node_modules/@firebase/storage/dist/esm/src/implementation/error.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__metadata__ = __webpack_require__(/*! ./metadata */ "./node_modules/@firebase/storage/dist/esm/src/implementation/metadata.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__type__ = __webpack_require__(/*! ./type */ "./node_modules/@firebase/storage/dist/esm/src/implementation/type.js"); +/** + * 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. + */ + + + +/** + * @param name Name of the function. + * @param specs Argument specs. + * @param passed The actual arguments passed to the function. + * @throws {fbs.Error} If the arguments are invalid. + */ +function validate(name, specs, passed) { + var minArgs = specs.length; + var maxArgs = specs.length; + for (var i = 0; i < specs.length; i++) { + if (specs[i].optional) { + minArgs = i; + break; + } + } + var validLength = minArgs <= passed.length && passed.length <= maxArgs; + if (!validLength) { + throw __WEBPACK_IMPORTED_MODULE_0__error__["g" /* invalidArgumentCount */](minArgs, maxArgs, name, passed.length); + } + for (var i = 0; i < passed.length; i++) { + try { + specs[i].validator(passed[i]); + } + catch (e) { + if (e instanceof Error) { + throw __WEBPACK_IMPORTED_MODULE_0__error__["f" /* invalidArgument */](i, name, e.message); + } + else { + throw __WEBPACK_IMPORTED_MODULE_0__error__["f" /* invalidArgument */](i, name, e); + } + } + } +} +/** + * @struct + */ +var ArgSpec = /** @class */ (function () { + function ArgSpec(validator, opt_optional) { + var self = this; + this.validator = function (p) { + if (self.optional && !__WEBPACK_IMPORTED_MODULE_2__type__["c" /* isJustDef */](p)) { + return; + } + validator(p); + }; + this.optional = !!opt_optional; + } + return ArgSpec; +}()); + +function and_(v1, v2) { + return function (p) { + v1(p); + v2(p); + }; +} +function stringSpec(opt_validator, opt_optional) { + function stringValidator(p) { + if (!__WEBPACK_IMPORTED_MODULE_2__type__["j" /* isString */](p)) { + throw 'Expected string.'; + } + } + var validator; + if (opt_validator) { + validator = and_(stringValidator, opt_validator); + } + else { + validator = stringValidator; + } + return new ArgSpec(validator, opt_optional); +} +function uploadDataSpec() { + function validator(p) { + var valid = p instanceof Uint8Array || + p instanceof ArrayBuffer || + (__WEBPACK_IMPORTED_MODULE_2__type__["e" /* isNativeBlobDefined */]() && p instanceof Blob); + if (!valid) { + throw 'Expected Blob or File.'; + } + } + return new ArgSpec(validator); +} +function metadataSpec(opt_optional) { + return new ArgSpec(__WEBPACK_IMPORTED_MODULE_1__metadata__["c" /* metadataValidator */], opt_optional); +} +function nonNegativeNumberSpec() { + function validator(p) { + var valid = __WEBPACK_IMPORTED_MODULE_2__type__["h" /* isNumber */](p) && p >= 0; + if (!valid) { + throw 'Expected a number 0 or greater.'; + } + } + return new ArgSpec(validator); +} +function looseObjectSpec(opt_validator, opt_optional) { + function validator(p) { + var isLooseObject = p === null || (__WEBPACK_IMPORTED_MODULE_2__type__["a" /* isDef */](p) && p instanceof Object); + if (!isLooseObject) { + throw 'Expected an Object.'; + } + if (opt_validator !== undefined && opt_validator !== null) { + opt_validator(p); + } + } + return new ArgSpec(validator, opt_optional); +} +function nullFunctionSpec(opt_optional) { + function validator(p) { + var valid = p === null || __WEBPACK_IMPORTED_MODULE_2__type__["b" /* isFunction */](p); + if (!valid) { + throw 'Expected a Function.'; + } + } + return new ArgSpec(validator, opt_optional); +} + +//# sourceMappingURL=args.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/array.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/array.js ***! + \*****************************************************************************/ +/*! exports provided: contains, clone, remove */ +/*! exports used: clone, contains, remove */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (immutable) */ __webpack_exports__["b"] = contains; +/* harmony export (immutable) */ __webpack_exports__["a"] = clone; +/* harmony export (immutable) */ __webpack_exports__["c"] = remove; +/** + * 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. + */ +/** + * Returns true if the object is contained in the array (compared with ===). + * @template T + */ +function contains(array, elem) { + return array.indexOf(elem) !== -1; +} +/** + * Returns a shallow copy of the array or array-like object (e.g. arguments). + * @template T + */ +function clone(arraylike) { + return Array.prototype.slice.call(arraylike); +} +/** + * Removes the given element from the given array, if it is contained. + * Directly modifies the passed-in array. + * @template T + */ +function remove(array, elem) { + var i = array.indexOf(elem); + if (i !== -1) { + array.splice(i, 1); + } +} + +//# sourceMappingURL=array.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/async.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/async.js ***! + \*****************************************************************************/ +/*! exports provided: async */ +/*! exports used: async */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (immutable) */ __webpack_exports__["a"] = async; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__promise_external__ = __webpack_require__(/*! ./promise_external */ "./node_modules/@firebase/storage/dist/esm/src/implementation/promise_external.js"); +/** + * 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. + */ +/** + * @fileoverview Method for invoking a callback asynchronously. + */ + +/** + * Returns a function that invokes f with its arguments asynchronously as a + * microtask, i.e. as soon as possible after the current script returns back + * into browser code. + */ +function async(f) { + return function () { + var argsToForward = []; + for (var _i = 0; _i < arguments.length; _i++) { + argsToForward[_i] = arguments[_i]; + } + __WEBPACK_IMPORTED_MODULE_0__promise_external__["c" /* resolve */](true).then(function () { + f.apply(null, argsToForward); + }); + }; +} + +//# sourceMappingURL=async.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/authwrapper.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/authwrapper.js ***! + \***********************************************************************************/ +/*! exports provided: AuthWrapper */ +/*! exports used: AuthWrapper */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AuthWrapper; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constants__ = __webpack_require__(/*! ./constants */ "./node_modules/@firebase/storage/dist/esm/src/implementation/constants.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__error__ = __webpack_require__(/*! ./error */ "./node_modules/@firebase/storage/dist/esm/src/implementation/error.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__failrequest__ = __webpack_require__(/*! ./failrequest */ "./node_modules/@firebase/storage/dist/esm/src/implementation/failrequest.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__location__ = __webpack_require__(/*! ./location */ "./node_modules/@firebase/storage/dist/esm/src/implementation/location.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__promise_external__ = __webpack_require__(/*! ./promise_external */ "./node_modules/@firebase/storage/dist/esm/src/implementation/promise_external.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__requestmap__ = __webpack_require__(/*! ./requestmap */ "./node_modules/@firebase/storage/dist/esm/src/implementation/requestmap.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__type__ = __webpack_require__(/*! ./type */ "./node_modules/@firebase/storage/dist/esm/src/implementation/type.js"); + + + + + + + +/** + * @param app If null, getAuthToken always resolves with null. + * @param service The storage service associated with this auth wrapper. + * Untyped to avoid circular type dependencies. + * @struct + */ +var AuthWrapper = /** @class */ (function () { + function AuthWrapper(app, maker, requestMaker, service, pool) { + this.bucket_ = null; + this.deleted_ = false; + this.app_ = app; + if (this.app_ !== null) { + var options = this.app_.options; + if (__WEBPACK_IMPORTED_MODULE_6__type__["a" /* isDef */](options)) { + this.bucket_ = AuthWrapper.extractBucket_(options); + } + } + this.storageRefMaker_ = maker; + this.requestMaker_ = requestMaker; + this.pool_ = pool; + this.service_ = service; + this.maxOperationRetryTime_ = __WEBPACK_IMPORTED_MODULE_0__constants__["d" /* defaultMaxOperationRetryTime */]; + this.maxUploadRetryTime_ = __WEBPACK_IMPORTED_MODULE_0__constants__["e" /* defaultMaxUploadRetryTime */]; + this.requestMap_ = new __WEBPACK_IMPORTED_MODULE_5__requestmap__["a" /* RequestMap */](); + } + AuthWrapper.extractBucket_ = function (config) { + var bucketString = config[__WEBPACK_IMPORTED_MODULE_0__constants__["c" /* configOption */]] || null; + if (bucketString == null) { + return null; + } + var loc = __WEBPACK_IMPORTED_MODULE_3__location__["a" /* Location */].makeFromBucketSpec(bucketString); + return loc.bucket; + }; + AuthWrapper.prototype.getAuthToken = function () { + // TODO(andysoto): remove ifDef checks after firebase-app implements stubs + // (b/28673818). + if (this.app_ !== null && + __WEBPACK_IMPORTED_MODULE_6__type__["a" /* isDef */](this.app_.INTERNAL) && + __WEBPACK_IMPORTED_MODULE_6__type__["a" /* isDef */](this.app_.INTERNAL.getToken)) { + return this.app_.INTERNAL.getToken().then(function (response) { + if (response !== null) { + return response.accessToken; + } + else { + return null; + } + }, function (_error) { + return null; + }); + } + else { + return __WEBPACK_IMPORTED_MODULE_4__promise_external__["c" /* resolve */](null); + } + }; + AuthWrapper.prototype.bucket = function () { + if (this.deleted_) { + throw __WEBPACK_IMPORTED_MODULE_1__error__["b" /* appDeleted */](); + } + else { + return this.bucket_; + } + }; + /** + * The service associated with this auth wrapper. Untyped to avoid circular + * type dependencies. + */ + AuthWrapper.prototype.service = function () { + return this.service_; + }; + /** + * Returns a new firebaseStorage.Reference object referencing this AuthWrapper + * at the given Location. + * @param loc The Location. + * @return Actually a firebaseStorage.Reference, typing not allowed + * because of circular dependency problems. + */ + AuthWrapper.prototype.makeStorageReference = function (loc) { + return this.storageRefMaker_(this, loc); + }; + AuthWrapper.prototype.makeRequest = function (requestInfo, authToken) { + if (!this.deleted_) { + var request = this.requestMaker_(requestInfo, authToken, this.pool_); + this.requestMap_.addRequest(request); + return request; + } + else { + return new __WEBPACK_IMPORTED_MODULE_2__failrequest__["a" /* FailRequest */](__WEBPACK_IMPORTED_MODULE_1__error__["b" /* appDeleted */]()); + } + }; + /** + * Stop running requests and prevent more from being created. + */ + AuthWrapper.prototype.deleteApp = function () { + this.deleted_ = true; + this.app_ = null; + this.requestMap_.clear(); + }; + AuthWrapper.prototype.maxUploadRetryTime = function () { + return this.maxUploadRetryTime_; + }; + AuthWrapper.prototype.setMaxUploadRetryTime = function (time) { + this.maxUploadRetryTime_ = time; + }; + AuthWrapper.prototype.maxOperationRetryTime = function () { + return this.maxOperationRetryTime_; + }; + AuthWrapper.prototype.setMaxOperationRetryTime = function (time) { + this.maxOperationRetryTime_ = time; + }; + return AuthWrapper; +}()); + + +//# sourceMappingURL=authwrapper.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/backoff.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/backoff.js ***! + \*******************************************************************************/ +/*! exports provided: start, stop */ +/*! exports used: start, stop */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (immutable) */ __webpack_exports__["a"] = start; +/* harmony export (immutable) */ __webpack_exports__["b"] = stop; +/** + * 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. + */ +/** + * @param f May be invoked + * before the function returns. + * @param callback Get all the arguments passed to the function + * passed to f, including the initial boolean. + */ +function start(f, callback, timeout) { + // TODO(andysoto): make this code cleaner (probably refactor into an actual + // type instead of a bunch of functions with state shared in the closure) + var waitSeconds = 1; + // Would type this as "number" but that doesn't work for Node so ¯\_(ツ)_/¯ + var timeoutId = null; + var hitTimeout = false; + var cancelState = 0; + function canceled() { + return cancelState === 2; + } + var triggeredCallback = false; + function triggerCallback() { + if (!triggeredCallback) { + triggeredCallback = true; + callback.apply(null, arguments); + } + } + function callWithDelay(millis) { + timeoutId = setTimeout(function () { + timeoutId = null; + f(handler, canceled()); + }, millis); + } + function handler(success) { + var var_args = []; + for (var _i = 1; _i < arguments.length; _i++) { + var_args[_i - 1] = arguments[_i]; + } + if (triggeredCallback) { + return; + } + if (success) { + triggerCallback.apply(null, arguments); + return; + } + var mustStop = canceled() || hitTimeout; + if (mustStop) { + triggerCallback.apply(null, arguments); + return; + } + if (waitSeconds < 64) { + /* TODO(andysoto): don't back off so quickly if we know we're offline. */ + waitSeconds *= 2; + } + var waitMillis; + if (cancelState === 1) { + cancelState = 2; + waitMillis = 0; + } + else { + waitMillis = (waitSeconds + Math.random()) * 1000; + } + callWithDelay(waitMillis); + } + var stopped = false; + function stop(wasTimeout) { + if (stopped) { + return; + } + stopped = true; + if (triggeredCallback) { + return; + } + if (timeoutId !== null) { + if (!wasTimeout) { + cancelState = 2; + } + clearTimeout(timeoutId); + callWithDelay(0); + } + else { + if (!wasTimeout) { + cancelState = 1; + } + } + } + callWithDelay(0); + setTimeout(function () { + hitTimeout = true; + stop(true); + }, timeout); + return stop; +} +/** + * Stops the retry loop from repeating. + * If the function is currently "in between" retries, it is invoked immediately + * with the second parameter as "true". Otherwise, it will be invoked once more + * after the current invocation finishes iff the current invocation would have + * triggered another retry. + */ +function stop(id) { + id(false); +} + +//# sourceMappingURL=backoff.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/blob.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/blob.js ***! + \****************************************************************************/ +/*! exports provided: FbsBlob */ +/*! exports used: FbsBlob */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FbsBlob; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__fs__ = __webpack_require__(/*! ./fs */ "./node_modules/@firebase/storage/dist/esm/src/implementation/fs.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__string__ = __webpack_require__(/*! ./string */ "./node_modules/@firebase/storage/dist/esm/src/implementation/string.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__type__ = __webpack_require__(/*! ./type */ "./node_modules/@firebase/storage/dist/esm/src/implementation/type.js"); +/** + * 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. + */ +/** + * @file Provides a Blob-like wrapper for various binary types (including the + * native Blob type). This makes it possible to upload types like ArrayBuffers, + * making uploads possible in environments without the native Blob type. + */ + + + + +/** + * @param opt_elideCopy If true, doesn't copy mutable input data + * (e.g. Uint8Arrays). Pass true only if you know the objects will not be + * modified after this blob's construction. + */ +var FbsBlob = /** @class */ (function () { + function FbsBlob(data, opt_elideCopy) { + var size = 0; + var blobType = ''; + if (__WEBPACK_IMPORTED_MODULE_2__type__["d" /* isNativeBlob */](data)) { + this.data_ = data; + size = data.size; + blobType = data.type; + } + else if (data instanceof ArrayBuffer) { + if (opt_elideCopy) { + this.data_ = new Uint8Array(data); + } + else { + this.data_ = new Uint8Array(data.byteLength); + this.data_.set(new Uint8Array(data)); + } + size = this.data_.length; + } + else if (data instanceof Uint8Array) { + if (opt_elideCopy) { + this.data_ = data; + } + else { + this.data_ = new Uint8Array(data.length); + this.data_.set(data); + } + size = data.length; + } + this.size_ = size; + this.type_ = blobType; + } + FbsBlob.prototype.size = function () { + return this.size_; + }; + FbsBlob.prototype.type = function () { + return this.type_; + }; + FbsBlob.prototype.slice = function (startByte, endByte) { + if (__WEBPACK_IMPORTED_MODULE_2__type__["d" /* isNativeBlob */](this.data_)) { + var realBlob = this.data_; + var sliced = __WEBPACK_IMPORTED_MODULE_0__fs__["b" /* sliceBlob */](realBlob, startByte, endByte); + if (sliced === null) { + return null; + } + return new FbsBlob(sliced); + } + else { + var slice = new Uint8Array(this.data_.buffer, startByte, endByte - startByte); + return new FbsBlob(slice, true); + } + }; + FbsBlob.getBlob = function () { + var var_args = []; + for (var _i = 0; _i < arguments.length; _i++) { + var_args[_i] = arguments[_i]; + } + if (__WEBPACK_IMPORTED_MODULE_2__type__["e" /* isNativeBlobDefined */]()) { + var blobby = var_args.map(function (val) { + if (val instanceof FbsBlob) { + return val.data_; + } + else { + return val; + } + }); + return new FbsBlob(__WEBPACK_IMPORTED_MODULE_0__fs__["a" /* getBlob */].apply(null, blobby)); + } + else { + var uint8Arrays = var_args.map(function (val) { + if (__WEBPACK_IMPORTED_MODULE_2__type__["j" /* isString */](val)) { + return __WEBPACK_IMPORTED_MODULE_1__string__["b" /* dataFromString */](__WEBPACK_IMPORTED_MODULE_1__string__["a" /* StringFormat */].RAW, val).data; + } + else { + // Blobs don't exist, so this has to be a Uint8Array. + return val.data_; + } + }); + var finalLength_1 = 0; + uint8Arrays.forEach(function (array) { + finalLength_1 += array.byteLength; + }); + var merged_1 = new Uint8Array(finalLength_1); + var index_1 = 0; + uint8Arrays.forEach(function (array) { + for (var i = 0; i < array.length; i++) { + merged_1[index_1++] = array[i]; + } + }); + return new FbsBlob(merged_1, true); + } + }; + FbsBlob.prototype.uploadData = function () { + return this.data_; + }; + return FbsBlob; +}()); + + +//# sourceMappingURL=blob.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/constants.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/constants.js ***! + \*********************************************************************************/ +/*! exports provided: domainBase, downloadBase, apiBaseUrl, apiUploadBaseUrl, setDomainBase, configOption, shortMaxOperationRetryTime, defaultMaxOperationRetryTime, defaultMaxUploadRetryTime, minSafeInteger */ +/*! exports used: apiBaseUrl, apiUploadBaseUrl, configOption, defaultMaxOperationRetryTime, defaultMaxUploadRetryTime, domainBase, downloadBase, minSafeInteger */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return domainBase; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return downloadBase; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return apiBaseUrl; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return apiUploadBaseUrl; }); +/* unused harmony export setDomainBase */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return configOption; }); +/* unused harmony export shortMaxOperationRetryTime */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return defaultMaxOperationRetryTime; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return defaultMaxUploadRetryTime; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return minSafeInteger; }); +/** + * 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. + */ +/** + * @fileoverview Constants used in the Firebase Storage library. + */ +/** + * Domain and scheme for API calls. + */ +var domainBase = 'https://firebasestorage.googleapis.com'; +/** + * Domain and scheme for object downloads. + */ +var downloadBase = 'https://firebasestorage.googleapis.com'; +/** + * Base URL for non-upload calls to the API. + */ +var apiBaseUrl = '/v0'; +/** + * Base URL for upload calls to the API. + */ +var apiUploadBaseUrl = '/v0'; +function setDomainBase(domainBase) { + domainBase = domainBase; +} +var configOption = 'storageBucket'; +/** + * 1 minute + */ +var shortMaxOperationRetryTime = 1 * 60 * 1000; +/** + * 2 minutes + */ +var defaultMaxOperationRetryTime = 2 * 60 * 1000; +/** + * 10 minutes + */ +var defaultMaxUploadRetryTime = 10 * 60 * 100; +/** + * This is the value of Number.MIN_SAFE_INTEGER, which is not well supported + * enough for us to use it directly. + */ +var minSafeInteger = -9007199254740991; + +//# sourceMappingURL=constants.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/error.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/error.js ***! + \*****************************************************************************/ +/*! exports provided: FirebaseStorageError, errors, Code, prependCode, unknown, objectNotFound, bucketNotFound, projectNotFound, quotaExceeded, unauthenticated, unauthorized, retryLimitExceeded, invalidChecksum, canceled, invalidEventName, invalidUrl, invalidDefaultBucket, noDefaultBucket, cannotSliceBlob, serverFileWrongSize, noDownloadURL, invalidArgument, invalidArgumentCount, appDeleted, invalidRootOperation, invalidFormat, internalError */ +/*! exports used: Code, appDeleted, canceled, cannotSliceBlob, internalError, invalidArgument, invalidArgumentCount, invalidDefaultBucket, invalidFormat, invalidRootOperation, invalidUrl, noDownloadURL, objectNotFound, quotaExceeded, retryLimitExceeded, serverFileWrongSize, unauthenticated, unauthorized, unknown */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* unused harmony export FirebaseStorageError */ +/* unused harmony export errors */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Code; }); +/* unused harmony export prependCode */ +/* harmony export (immutable) */ __webpack_exports__["s"] = unknown; +/* harmony export (immutable) */ __webpack_exports__["m"] = objectNotFound; +/* unused harmony export bucketNotFound */ +/* unused harmony export projectNotFound */ +/* harmony export (immutable) */ __webpack_exports__["n"] = quotaExceeded; +/* harmony export (immutable) */ __webpack_exports__["q"] = unauthenticated; +/* harmony export (immutable) */ __webpack_exports__["r"] = unauthorized; +/* harmony export (immutable) */ __webpack_exports__["o"] = retryLimitExceeded; +/* unused harmony export invalidChecksum */ +/* harmony export (immutable) */ __webpack_exports__["c"] = canceled; +/* unused harmony export invalidEventName */ +/* harmony export (immutable) */ __webpack_exports__["k"] = invalidUrl; +/* harmony export (immutable) */ __webpack_exports__["h"] = invalidDefaultBucket; +/* unused harmony export noDefaultBucket */ +/* harmony export (immutable) */ __webpack_exports__["d"] = cannotSliceBlob; +/* harmony export (immutable) */ __webpack_exports__["p"] = serverFileWrongSize; +/* harmony export (immutable) */ __webpack_exports__["l"] = noDownloadURL; +/* harmony export (immutable) */ __webpack_exports__["f"] = invalidArgument; +/* harmony export (immutable) */ __webpack_exports__["g"] = invalidArgumentCount; +/* harmony export (immutable) */ __webpack_exports__["b"] = appDeleted; +/* harmony export (immutable) */ __webpack_exports__["j"] = invalidRootOperation; +/* harmony export (immutable) */ __webpack_exports__["i"] = invalidFormat; +/* harmony export (immutable) */ __webpack_exports__["e"] = internalError; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constants__ = __webpack_require__(/*! ./constants */ "./node_modules/@firebase/storage/dist/esm/src/implementation/constants.js"); +/** + * 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. + */ + +var FirebaseStorageError = /** @class */ (function () { + function FirebaseStorageError(code, message) { + this.code_ = prependCode(code); + this.message_ = 'Firebase Storage: ' + message; + this.serverResponse_ = null; + this.name_ = 'FirebaseError'; + } + FirebaseStorageError.prototype.codeProp = function () { + return this.code; + }; + FirebaseStorageError.prototype.codeEquals = function (code) { + return prependCode(code) === this.codeProp(); + }; + FirebaseStorageError.prototype.serverResponseProp = function () { + return this.serverResponse_; + }; + FirebaseStorageError.prototype.setServerResponseProp = function (serverResponse) { + this.serverResponse_ = serverResponse; + }; + Object.defineProperty(FirebaseStorageError.prototype, "name", { + get: function () { + return this.name_; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(FirebaseStorageError.prototype, "code", { + get: function () { + return this.code_; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(FirebaseStorageError.prototype, "message", { + get: function () { + return this.message_; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(FirebaseStorageError.prototype, "serverResponse", { + get: function () { + return this.serverResponse_; + }, + enumerable: true, + configurable: true + }); + return FirebaseStorageError; +}()); + +var errors = {}; +var Code = { + // Shared between all platforms + UNKNOWN: 'unknown', + OBJECT_NOT_FOUND: 'object-not-found', + BUCKET_NOT_FOUND: 'bucket-not-found', + PROJECT_NOT_FOUND: 'project-not-found', + QUOTA_EXCEEDED: 'quota-exceeded', + UNAUTHENTICATED: 'unauthenticated', + UNAUTHORIZED: 'unauthorized', + RETRY_LIMIT_EXCEEDED: 'retry-limit-exceeded', + INVALID_CHECKSUM: 'invalid-checksum', + CANCELED: 'canceled', + // JS specific + INVALID_EVENT_NAME: 'invalid-event-name', + INVALID_URL: 'invalid-url', + INVALID_DEFAULT_BUCKET: 'invalid-default-bucket', + NO_DEFAULT_BUCKET: 'no-default-bucket', + CANNOT_SLICE_BLOB: 'cannot-slice-blob', + SERVER_FILE_WRONG_SIZE: 'server-file-wrong-size', + NO_DOWNLOAD_URL: 'no-download-url', + INVALID_ARGUMENT: 'invalid-argument', + INVALID_ARGUMENT_COUNT: 'invalid-argument-count', + APP_DELETED: 'app-deleted', + INVALID_ROOT_OPERATION: 'invalid-root-operation', + INVALID_FORMAT: 'invalid-format', + INTERNAL_ERROR: 'internal-error' +}; +function prependCode(code) { + return 'storage/' + code; +} +function unknown() { + var message = 'An unknown error occurred, please check the error payload for ' + + 'server response.'; + return new FirebaseStorageError(Code.UNKNOWN, message); +} +function objectNotFound(path) { + return new FirebaseStorageError(Code.OBJECT_NOT_FOUND, "Object '" + path + "' does not exist."); +} +function bucketNotFound(bucket) { + return new FirebaseStorageError(Code.BUCKET_NOT_FOUND, "Bucket '" + bucket + "' does not exist."); +} +function projectNotFound(project) { + return new FirebaseStorageError(Code.PROJECT_NOT_FOUND, "Project '" + project + "' does not exist."); +} +function quotaExceeded(bucket) { + return new FirebaseStorageError(Code.QUOTA_EXCEEDED, "Quota for bucket '" + + bucket + + "' exceeded, please view quota on " + + 'https://firebase.google.com/pricing/.'); +} +function unauthenticated() { + var message = 'User is not authenticated, please authenticate using Firebase ' + + 'Authentication and try again.'; + return new FirebaseStorageError(Code.UNAUTHENTICATED, message); +} +function unauthorized(path) { + return new FirebaseStorageError(Code.UNAUTHORIZED, "User does not have permission to access '" + path + "'."); +} +function retryLimitExceeded() { + return new FirebaseStorageError(Code.RETRY_LIMIT_EXCEEDED, 'Max retry time for operation exceeded, please try again.'); +} +function invalidChecksum(path, checksum, calculated) { + return new FirebaseStorageError(Code.INVALID_CHECKSUM, "Uploaded/downloaded object '" + + path + + "' has checksum '" + + checksum + + "' which does not match '" + + calculated + + "'. Please retry the upload/download."); +} +function canceled() { + return new FirebaseStorageError(Code.CANCELED, 'User canceled the upload/download.'); +} +function invalidEventName(name) { + return new FirebaseStorageError(Code.INVALID_EVENT_NAME, "Invalid event name '" + name + "'."); +} +function invalidUrl(url) { + return new FirebaseStorageError(Code.INVALID_URL, "Invalid URL '" + url + "'."); +} +function invalidDefaultBucket(bucket) { + return new FirebaseStorageError(Code.INVALID_DEFAULT_BUCKET, "Invalid default bucket '" + bucket + "'."); +} +function noDefaultBucket() { + return new FirebaseStorageError(Code.NO_DEFAULT_BUCKET, 'No default bucket ' + + "found. Did you set the '" + + __WEBPACK_IMPORTED_MODULE_0__constants__["c" /* configOption */] + + "' property when initializing the app?"); +} +function cannotSliceBlob() { + return new FirebaseStorageError(Code.CANNOT_SLICE_BLOB, 'Cannot slice blob for upload. Please retry the upload.'); +} +function serverFileWrongSize() { + return new FirebaseStorageError(Code.SERVER_FILE_WRONG_SIZE, 'Server recorded incorrect upload file size, please retry the upload.'); +} +function noDownloadURL() { + return new FirebaseStorageError(Code.NO_DOWNLOAD_URL, 'The given file does not have any download URLs.'); +} +function invalidArgument(index, fnName, message) { + return new FirebaseStorageError(Code.INVALID_ARGUMENT, 'Invalid argument in `' + fnName + '` at index ' + index + ': ' + message); +} +function invalidArgumentCount(argMin, argMax, fnName, real) { + var countPart; + var plural; + if (argMin === argMax) { + countPart = argMin; + plural = argMin === 1 ? 'argument' : 'arguments'; + } + else { + countPart = 'between ' + argMin + ' and ' + argMax; + plural = 'arguments'; + } + return new FirebaseStorageError(Code.INVALID_ARGUMENT_COUNT, 'Invalid argument count in `' + + fnName + + '`: Expected ' + + countPart + + ' ' + + plural + + ', received ' + + real + + '.'); +} +function appDeleted() { + return new FirebaseStorageError(Code.APP_DELETED, 'The Firebase app was deleted.'); +} +/** + * @param name The name of the operation that was invalid. + */ +function invalidRootOperation(name) { + return new FirebaseStorageError(Code.INVALID_ROOT_OPERATION, "The operation '" + + name + + "' cannot be performed on a root reference, create a non-root " + + "reference using child, such as .child('file.png')."); +} +/** + * @param format The format that was not valid. + * @param message A message describing the format violation. + */ +function invalidFormat(format, message) { + return new FirebaseStorageError(Code.INVALID_FORMAT, "String does not match format '" + format + "': " + message); +} +/** + * @param message A message describing the internal error. + */ +function internalError(message) { + throw new FirebaseStorageError(Code.INTERNAL_ERROR, 'Internal error: ' + message); +} + +//# sourceMappingURL=error.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/failrequest.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/failrequest.js ***! + \***********************************************************************************/ +/*! exports provided: FailRequest */ +/*! exports used: FailRequest */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FailRequest; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__promise_external__ = __webpack_require__(/*! ./promise_external */ "./node_modules/@firebase/storage/dist/esm/src/implementation/promise_external.js"); + +/** + * A request whose promise always fails. + * @struct + * @template T + */ +var FailRequest = /** @class */ (function () { + function FailRequest(error) { + this.promise_ = __WEBPACK_IMPORTED_MODULE_0__promise_external__["b" /* reject */](error); + } + /** @inheritDoc */ + FailRequest.prototype.getPromise = function () { + return this.promise_; + }; + /** @inheritDoc */ + FailRequest.prototype.cancel = function (appDelete) { + if (appDelete === void 0) { appDelete = false; } + }; + return FailRequest; +}()); + + +//# sourceMappingURL=failrequest.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/fs.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/fs.js ***! + \**************************************************************************/ +/*! exports provided: getBlob, sliceBlob */ +/*! exports used: getBlob, sliceBlob */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (immutable) */ __webpack_exports__["a"] = getBlob; +/* harmony export (immutable) */ __webpack_exports__["b"] = sliceBlob; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__type__ = __webpack_require__(/*! ./type */ "./node_modules/@firebase/storage/dist/esm/src/implementation/type.js"); + +function getBlobBuilder() { + if (typeof BlobBuilder !== 'undefined') { + return BlobBuilder; + } + else if (typeof WebKitBlobBuilder !== 'undefined') { + return WebKitBlobBuilder; + } + else { + return undefined; + } +} +/** + * Concatenates one or more values together and converts them to a Blob. + * + * @param var_args The values that will make up the resulting blob. + * @return The blob. + */ +function getBlob() { + var var_args = []; + for (var _i = 0; _i < arguments.length; _i++) { + var_args[_i] = arguments[_i]; + } + var BlobBuilder = getBlobBuilder(); + if (BlobBuilder !== undefined) { + var bb = new BlobBuilder(); + for (var i = 0; i < var_args.length; i++) { + bb.append(var_args[i]); + } + return bb.getBlob(); + } + else { + if (__WEBPACK_IMPORTED_MODULE_0__type__["e" /* isNativeBlobDefined */]()) { + return new Blob(var_args); + } + else { + throw Error("This browser doesn't seem to support creating Blobs"); + } + } +} +/** + * Slices the blob. The returned blob contains data from the start byte + * (inclusive) till the end byte (exclusive). Negative indices cannot be used. + * + * @param blob The blob to be sliced. + * @param start Index of the starting byte. + * @param end Index of the ending byte. + * @return The blob slice or null if not supported. + */ +function sliceBlob(blob, start, end) { + if (blob.webkitSlice) { + return blob.webkitSlice(start, end); + } + else if (blob.mozSlice) { + return blob.mozSlice(start, end); + } + else if (blob.slice) { + return blob.slice(start, end); + } + return null; +} + +//# sourceMappingURL=fs.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/json.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/json.js ***! + \****************************************************************************/ +/*! exports provided: jsonObjectOrNull */ +/*! exports used: jsonObjectOrNull */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (immutable) */ __webpack_exports__["a"] = jsonObjectOrNull; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__type__ = __webpack_require__(/*! ./type */ "./node_modules/@firebase/storage/dist/esm/src/implementation/type.js"); +/** + * 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. + */ + +/** + * Returns the Object resulting from parsing the given JSON, or null if the + * given string does not represent a JSON object. + */ +function jsonObjectOrNull(s) { + var obj; + try { + obj = JSON.parse(s); + } + catch (e) { + return null; + } + if (__WEBPACK_IMPORTED_MODULE_0__type__["f" /* isNonArrayObject */](obj)) { + return obj; + } + else { + return null; + } +} + +//# sourceMappingURL=json.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/location.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/location.js ***! + \********************************************************************************/ +/*! exports provided: Location */ +/*! exports used: Location */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Location; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__error__ = __webpack_require__(/*! ./error */ "./node_modules/@firebase/storage/dist/esm/src/implementation/error.js"); +/** + * 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. + */ +/** + * @fileoverview Functionality related to the parsing/composition of bucket/ + * object location. + */ + +/** + * @struct + */ +var Location = /** @class */ (function () { + function Location(bucket, path) { + this.bucket = bucket; + this.path_ = path; + } + Object.defineProperty(Location.prototype, "path", { + get: function () { + return this.path_; + }, + enumerable: true, + configurable: true + }); + Location.prototype.fullServerUrl = function () { + var encode = encodeURIComponent; + return '/b/' + encode(this.bucket) + '/o/' + encode(this.path); + }; + Location.prototype.bucketOnlyServerUrl = function () { + var encode = encodeURIComponent; + return '/b/' + encode(this.bucket) + '/o'; + }; + Location.makeFromBucketSpec = function (bucketString) { + var bucketLocation; + try { + bucketLocation = Location.makeFromUrl(bucketString); + } + catch (e) { + // Not valid URL, use as-is. This lets you put bare bucket names in + // config. + return new Location(bucketString, ''); + } + if (bucketLocation.path === '') { + return bucketLocation; + } + else { + throw __WEBPACK_IMPORTED_MODULE_0__error__["h" /* invalidDefaultBucket */](bucketString); + } + }; + Location.makeFromUrl = function (url) { + var location = null; + var bucketDomain = '([A-Za-z0-9.\\-]+)'; + function gsModify(loc) { + if (loc.path.charAt(loc.path.length - 1) === '/') { + loc.path_ = loc.path_.slice(0, -1); + } + } + var gsPath = '(/(.*))?$'; + var path = '(/([^?#]*).*)?$'; + var gsRegex = new RegExp('^gs://' + bucketDomain + gsPath, 'i'); + var gsIndices = { bucket: 1, path: 3 }; + function httpModify(loc) { + loc.path_ = decodeURIComponent(loc.path); + } + var version = 'v[A-Za-z0-9_]+'; + var httpRegex = new RegExp('^https?://firebasestorage\\.googleapis\\.com/' + + version + + '/b/' + + bucketDomain + + '/o' + + path, 'i'); + var httpIndices = { bucket: 1, path: 3 }; + var groups = [ + { regex: gsRegex, indices: gsIndices, postModify: gsModify }, + { regex: httpRegex, indices: httpIndices, postModify: httpModify } + ]; + for (var i = 0; i < groups.length; i++) { + var group = groups[i]; + var captures = group.regex.exec(url); + if (captures) { + var bucketValue = captures[group.indices.bucket]; + var pathValue = captures[group.indices.path]; + if (!pathValue) { + pathValue = ''; + } + location = new Location(bucketValue, pathValue); + group.postModify(location); + break; + } + } + if (location == null) { + throw __WEBPACK_IMPORTED_MODULE_0__error__["k" /* invalidUrl */](url); + } + return location; + }; + return Location; +}()); + + +//# sourceMappingURL=location.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/metadata.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/metadata.js ***! + \********************************************************************************/ +/*! exports provided: noXform_, Mapping, xformPath, getMappings, addRef, fromResource, fromResourceString, toResourceString, metadataValidator */ +/*! exports used: fromResourceString, getMappings, metadataValidator, toResourceString */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* unused harmony export noXform_ */ +/* unused harmony export Mapping */ +/* unused harmony export xformPath */ +/* harmony export (immutable) */ __webpack_exports__["b"] = getMappings; +/* unused harmony export addRef */ +/* unused harmony export fromResource */ +/* harmony export (immutable) */ __webpack_exports__["a"] = fromResourceString; +/* harmony export (immutable) */ __webpack_exports__["d"] = toResourceString; +/* harmony export (immutable) */ __webpack_exports__["c"] = metadataValidator; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__json__ = __webpack_require__(/*! ./json */ "./node_modules/@firebase/storage/dist/esm/src/implementation/json.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__location__ = __webpack_require__(/*! ./location */ "./node_modules/@firebase/storage/dist/esm/src/implementation/location.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__path__ = __webpack_require__(/*! ./path */ "./node_modules/@firebase/storage/dist/esm/src/implementation/path.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__type__ = __webpack_require__(/*! ./type */ "./node_modules/@firebase/storage/dist/esm/src/implementation/type.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__url__ = __webpack_require__(/*! ./url */ "./node_modules/@firebase/storage/dist/esm/src/implementation/url.js"); +/** + * 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. + */ + + + + + +function noXform_(metadata, value) { + return value; +} +/** + * @struct + */ +var Mapping = /** @class */ (function () { + function Mapping(server, opt_local, opt_writable, opt_xform) { + this.server = server; + this.local = opt_local || server; + this.writable = !!opt_writable; + this.xform = opt_xform || noXform_; + } + return Mapping; +}()); + +var mappings_ = null; +function xformPath(fullPath) { + var valid = __WEBPACK_IMPORTED_MODULE_3__type__["j" /* isString */](fullPath); + if (!valid || fullPath.length < 2) { + return fullPath; + } + else { + fullPath = fullPath; + return __WEBPACK_IMPORTED_MODULE_2__path__["b" /* lastComponent */](fullPath); + } +} +function getMappings() { + if (mappings_) { + return mappings_; + } + var mappings = []; + mappings.push(new Mapping('bucket')); + mappings.push(new Mapping('generation')); + mappings.push(new Mapping('metageneration')); + mappings.push(new Mapping('name', 'fullPath', true)); + function mappingsXformPath(metadata, fullPath) { + return xformPath(fullPath); + } + var nameMapping = new Mapping('name'); + nameMapping.xform = mappingsXformPath; + mappings.push(nameMapping); + /** + * Coerces the second param to a number, if it is defined. + */ + function xformSize(metadata, size) { + if (__WEBPACK_IMPORTED_MODULE_3__type__["a" /* isDef */](size)) { + return +size; + } + else { + return size; + } + } + var sizeMapping = new Mapping('size'); + sizeMapping.xform = xformSize; + mappings.push(sizeMapping); + mappings.push(new Mapping('timeCreated')); + mappings.push(new Mapping('updated')); + mappings.push(new Mapping('md5Hash', null, true)); + mappings.push(new Mapping('cacheControl', null, true)); + mappings.push(new Mapping('contentDisposition', null, true)); + mappings.push(new Mapping('contentEncoding', null, true)); + mappings.push(new Mapping('contentLanguage', null, true)); + mappings.push(new Mapping('contentType', null, true)); + mappings.push(new Mapping('metadata', 'customMetadata', true)); + /** + * Transforms a comma-separated string of tokens into a list of download + * URLs. + */ + function xformTokens(metadata, tokens) { + var valid = __WEBPACK_IMPORTED_MODULE_3__type__["j" /* isString */](tokens) && tokens.length > 0; + if (!valid) { + // This can happen if objects are uploaded through GCS and retrieved + // through list, so we don't want to throw an Error. + return []; + } + var encode = encodeURIComponent; + var tokensList = tokens.split(','); + var urls = tokensList.map(function (token) { + var bucket = metadata['bucket']; + var path = metadata['fullPath']; + var urlPart = '/b/' + encode(bucket) + '/o/' + encode(path); + var base = __WEBPACK_IMPORTED_MODULE_4__url__["a" /* makeDownloadUrl */](urlPart); + var queryString = __WEBPACK_IMPORTED_MODULE_4__url__["c" /* makeQueryString */]({ + alt: 'media', + token: token + }); + return base + queryString; + }); + return urls; + } + mappings.push(new Mapping('downloadTokens', 'downloadURLs', false, xformTokens)); + mappings_ = mappings; + return mappings_; +} +function addRef(metadata, authWrapper) { + function generateRef() { + var bucket = metadata['bucket']; + var path = metadata['fullPath']; + var loc = new __WEBPACK_IMPORTED_MODULE_1__location__["a" /* Location */](bucket, path); + return authWrapper.makeStorageReference(loc); + } + Object.defineProperty(metadata, 'ref', { get: generateRef }); +} +function fromResource(authWrapper, resource, mappings) { + var metadata = {}; + metadata['type'] = 'file'; + var len = mappings.length; + for (var i = 0; i < len; i++) { + var mapping = mappings[i]; + metadata[mapping.local] = mapping.xform(metadata, resource[mapping.server]); + } + addRef(metadata, authWrapper); + return metadata; +} +function fromResourceString(authWrapper, resourceString, mappings) { + var obj = __WEBPACK_IMPORTED_MODULE_0__json__["a" /* jsonObjectOrNull */](resourceString); + if (obj === null) { + return null; + } + var resource = obj; + return fromResource(authWrapper, resource, mappings); +} +function toResourceString(metadata, mappings) { + var resource = {}; + var len = mappings.length; + for (var i = 0; i < len; i++) { + var mapping = mappings[i]; + if (mapping.writable) { + resource[mapping.server] = metadata[mapping.local]; + } + } + return JSON.stringify(resource); +} +function metadataValidator(p) { + var validType = p && __WEBPACK_IMPORTED_MODULE_3__type__["i" /* isObject */](p); + if (!validType) { + throw 'Expected Metadata object.'; + } + for (var key in p) { + var val = p[key]; + if (key === 'customMetadata') { + if (!__WEBPACK_IMPORTED_MODULE_3__type__["i" /* isObject */](val)) { + throw 'Expected object for \'customMetadata\' mapping.'; + } + } + else { + if (__WEBPACK_IMPORTED_MODULE_3__type__["g" /* isNonNullObject */](val)) { + throw "Mapping for '" + key + "' cannot be an object."; + } + } + } +} + +//# sourceMappingURL=metadata.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/object.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/object.js ***! + \******************************************************************************/ +/*! exports provided: contains, forEach, clone */ +/*! exports used: clone, forEach */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* unused harmony export contains */ +/* harmony export (immutable) */ __webpack_exports__["b"] = forEach; +/* harmony export (immutable) */ __webpack_exports__["a"] = clone; +/** + * 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. + */ +/** + * @fileoverview Contains methods for working with objects. + */ +function contains(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} +function forEach(obj, f) { + for (var key in obj) { + if (contains(obj, key)) { + f(key, obj[key]); + } + } +} +function clone(obj) { + if (obj == null) { + return {}; + } + var c = {}; + forEach(obj, function (key, val) { + c[key] = val; + }); + return c; +} + +//# sourceMappingURL=object.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/observer.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/observer.js ***! + \********************************************************************************/ +/*! exports provided: Observer */ +/*! exports used: Observer */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Observer; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__type__ = __webpack_require__(/*! ./type */ "./node_modules/@firebase/storage/dist/esm/src/implementation/type.js"); +/** + * 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. + */ + +/** + * @struct + */ +var Observer = /** @class */ (function () { + function Observer(nextOrObserver, opt_error, opt_complete) { + var asFunctions = __WEBPACK_IMPORTED_MODULE_0__type__["b" /* isFunction */](nextOrObserver) || + __WEBPACK_IMPORTED_MODULE_0__type__["a" /* isDef */](opt_error) || + __WEBPACK_IMPORTED_MODULE_0__type__["a" /* isDef */](opt_complete); + if (asFunctions) { + this.next = nextOrObserver; + this.error = opt_error || null; + this.complete = opt_complete || null; + } + else { + var observer = nextOrObserver; + this.next = observer.next || null; + this.error = observer.error || null; + this.complete = observer.complete || null; + } + } + return Observer; +}()); + + +//# sourceMappingURL=observer.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/path.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/path.js ***! + \****************************************************************************/ +/*! exports provided: parent, child, lastComponent */ +/*! exports used: child, lastComponent, parent */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (immutable) */ __webpack_exports__["c"] = parent; +/* harmony export (immutable) */ __webpack_exports__["a"] = child; +/* harmony export (immutable) */ __webpack_exports__["b"] = lastComponent; +/** + * 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. + */ +/** + * @fileoverview Contains helper methods for manipulating paths. + */ +/** + * @return Null if the path is already at the root. + */ +function parent(path) { + if (path.length == 0) { + return null; + } + var index = path.lastIndexOf('/'); + if (index === -1) { + return ''; + } + var newPath = path.slice(0, index); + return newPath; +} +function child(path, childPath) { + var canonicalChildPath = childPath + .split('/') + .filter(function (component) { + return component.length > 0; + }) + .join('/'); + if (path.length === 0) { + return canonicalChildPath; + } + else { + return path + '/' + canonicalChildPath; + } +} +/** + * Returns the last component of a path. + * '/foo/bar' -> 'bar' + * '/foo/bar/baz/' -> 'baz/' + * '/a' -> 'a' + */ +function lastComponent(path) { + var index = path.lastIndexOf('/', path.length - 2); + if (index === -1) { + return path; + } + else { + return path.slice(index + 1); + } +} + +//# sourceMappingURL=path.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/promise_external.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/promise_external.js ***! + \****************************************************************************************/ +/*! exports provided: make, resolve, reject */ +/*! exports used: make, reject, resolve */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (immutable) */ __webpack_exports__["a"] = make; +/* harmony export (immutable) */ __webpack_exports__["c"] = resolve; +/* harmony export (immutable) */ __webpack_exports__["b"] = reject; +/** + * 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. + */ +/** + * @fileoverview Implements the promise abstraction interface for external + * (public SDK) packaging, which just passes through to the firebase-app impl. + */ +/** + * @template T + * @param {function((function(T): void), + * (function(!Error): void))} resolver + */ +function make(resolver) { + return new Promise(resolver); +} +/** + * @template T + */ +function resolve(value) { + return Promise.resolve(value); +} +function reject(error) { + return Promise.reject(error); +} + +//# sourceMappingURL=promise_external.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/request.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/request.js ***! + \*******************************************************************************/ +/*! exports provided: RequestEndStatus, addAuthHeader_, addVersionHeader_, makeRequest */ +/*! exports used: makeRequest */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* unused harmony export RequestEndStatus */ +/* unused harmony export addAuthHeader_ */ +/* unused harmony export addVersionHeader_ */ +/* harmony export (immutable) */ __webpack_exports__["a"] = makeRequest; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__firebase_app__ = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/esm/index.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__array__ = __webpack_require__(/*! ./array */ "./node_modules/@firebase/storage/dist/esm/src/implementation/array.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__backoff__ = __webpack_require__(/*! ./backoff */ "./node_modules/@firebase/storage/dist/esm/src/implementation/backoff.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__error__ = __webpack_require__(/*! ./error */ "./node_modules/@firebase/storage/dist/esm/src/implementation/error.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__object__ = __webpack_require__(/*! ./object */ "./node_modules/@firebase/storage/dist/esm/src/implementation/object.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__promise_external__ = __webpack_require__(/*! ./promise_external */ "./node_modules/@firebase/storage/dist/esm/src/implementation/promise_external.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__type__ = __webpack_require__(/*! ./type */ "./node_modules/@firebase/storage/dist/esm/src/implementation/type.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__url__ = __webpack_require__(/*! ./url */ "./node_modules/@firebase/storage/dist/esm/src/implementation/url.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__xhrio__ = __webpack_require__(/*! ./xhrio */ "./node_modules/@firebase/storage/dist/esm/src/implementation/xhrio.js"); +/** + * 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. + */ +/** + * @fileoverview Defines methods used to actually send HTTP requests from + * abstract representations. + */ + + + + + + + + + +/** + * @struct + * @template T + */ +var NetworkRequest = /** @class */ (function () { + function NetworkRequest(url, method, headers, body, successCodes, additionalRetryCodes, callback, errorCallback, timeout, progressCallback, pool) { + this.pendingXhr_ = null; + this.backoffId_ = null; + this.resolve_ = null; + this.reject_ = null; + this.canceled_ = false; + this.appDelete_ = false; + this.url_ = url; + this.method_ = method; + this.headers_ = headers; + this.body_ = body; + this.successCodes_ = successCodes.slice(); + this.additionalRetryCodes_ = additionalRetryCodes.slice(); + this.callback_ = callback; + this.errorCallback_ = errorCallback; + this.progressCallback_ = progressCallback; + this.timeout_ = timeout; + this.pool_ = pool; + var self = this; + this.promise_ = __WEBPACK_IMPORTED_MODULE_5__promise_external__["a" /* make */](function (resolve, reject) { + self.resolve_ = resolve; + self.reject_ = reject; + self.start_(); + }); + } + /** + * Actually starts the retry loop. + */ + NetworkRequest.prototype.start_ = function () { + var self = this; + function doTheRequest(backoffCallback, canceled) { + if (canceled) { + backoffCallback(false, new RequestEndStatus(false, null, true)); + return; + } + var xhr = self.pool_.createXhrIo(); + self.pendingXhr_ = xhr; + function progressListener(progressEvent) { + var loaded = progressEvent.loaded; + var total = progressEvent.lengthComputable ? progressEvent.total : -1; + if (self.progressCallback_ !== null) { + self.progressCallback_(loaded, total); + } + } + if (self.progressCallback_ !== null) { + xhr.addUploadProgressListener(progressListener); + } + xhr + .send(self.url_, self.method_, self.body_, self.headers_) + .then(function (xhr) { + if (self.progressCallback_ !== null) { + xhr.removeUploadProgressListener(progressListener); + } + self.pendingXhr_ = null; + xhr = xhr; + var hitServer = xhr.getErrorCode() === __WEBPACK_IMPORTED_MODULE_8__xhrio__["a" /* ErrorCode */].NO_ERROR; + var status = xhr.getStatus(); + if (!hitServer || self.isRetryStatusCode_(status)) { + var wasCanceled = xhr.getErrorCode() === __WEBPACK_IMPORTED_MODULE_8__xhrio__["a" /* ErrorCode */].ABORT; + backoffCallback(false, new RequestEndStatus(false, null, wasCanceled)); + return; + } + var successCode = __WEBPACK_IMPORTED_MODULE_1__array__["b" /* contains */](self.successCodes_, status); + backoffCallback(true, new RequestEndStatus(successCode, xhr)); + }); + } + /** + * @param requestWentThrough True if the request eventually went + * through, false if it hit the retry limit or was canceled. + */ + function backoffDone(requestWentThrough, status) { + var resolve = self.resolve_; + var reject = self.reject_; + var xhr = status.xhr; + if (status.wasSuccessCode) { + try { + var result = self.callback_(xhr, xhr.getResponseText()); + if (__WEBPACK_IMPORTED_MODULE_6__type__["c" /* isJustDef */](result)) { + resolve(result); + } + else { + resolve(); + } + } + catch (e) { + reject(e); + } + } + else { + if (xhr !== null) { + var err = __WEBPACK_IMPORTED_MODULE_3__error__["s" /* unknown */](); + err.setServerResponseProp(xhr.getResponseText()); + if (self.errorCallback_) { + reject(self.errorCallback_(xhr, err)); + } + else { + reject(err); + } + } + else { + if (status.canceled) { + var err = self.appDelete_ + ? __WEBPACK_IMPORTED_MODULE_3__error__["b" /* appDeleted */]() + : __WEBPACK_IMPORTED_MODULE_3__error__["c" /* canceled */](); + reject(err); + } + else { + var err = __WEBPACK_IMPORTED_MODULE_3__error__["o" /* retryLimitExceeded */](); + reject(err); + } + } + } + } + if (this.canceled_) { + backoffDone(false, new RequestEndStatus(false, null, true)); + } + else { + this.backoffId_ = __WEBPACK_IMPORTED_MODULE_2__backoff__["a" /* start */](doTheRequest, backoffDone, this.timeout_); + } + }; + /** @inheritDoc */ + NetworkRequest.prototype.getPromise = function () { + return this.promise_; + }; + /** @inheritDoc */ + NetworkRequest.prototype.cancel = function (appDelete) { + this.canceled_ = true; + this.appDelete_ = appDelete || false; + if (this.backoffId_ !== null) { + __WEBPACK_IMPORTED_MODULE_2__backoff__["b" /* stop */](this.backoffId_); + } + if (this.pendingXhr_ !== null) { + this.pendingXhr_.abort(); + } + }; + NetworkRequest.prototype.isRetryStatusCode_ = function (status) { + // The codes for which to retry came from this page: + // https://cloud.google.com/storage/docs/exponential-backoff + var isFiveHundredCode = status >= 500 && status < 600; + var extraRetryCodes = [ + // Request Timeout: web server didn't receive full request in time. + 408, + // Too Many Requests: you're getting rate-limited, basically. + 429 + ]; + var isExtraRetryCode = __WEBPACK_IMPORTED_MODULE_1__array__["b" /* contains */](extraRetryCodes, status); + var isRequestSpecificRetryCode = __WEBPACK_IMPORTED_MODULE_1__array__["b" /* contains */](this.additionalRetryCodes_, status); + return isFiveHundredCode || isExtraRetryCode || isRequestSpecificRetryCode; + }; + return NetworkRequest; +}()); +/** + * A collection of information about the result of a network request. + * @param opt_canceled Defaults to false. + * @struct + */ +var RequestEndStatus = /** @class */ (function () { + function RequestEndStatus(wasSuccessCode, xhr, opt_canceled) { + this.wasSuccessCode = wasSuccessCode; + this.xhr = xhr; + this.canceled = !!opt_canceled; + } + return RequestEndStatus; +}()); + +function addAuthHeader_(headers, authToken) { + if (authToken !== null && authToken.length > 0) { + headers['Authorization'] = 'Firebase ' + authToken; + } +} +function addVersionHeader_(headers) { + var number = typeof __WEBPACK_IMPORTED_MODULE_0__firebase_app__["default"] !== 'undefined' ? __WEBPACK_IMPORTED_MODULE_0__firebase_app__["default"].SDK_VERSION : 'AppManager'; + headers['X-Firebase-Storage-Version'] = 'webjs/' + number; +} +/** + * @template T + */ +function makeRequest(requestInfo, authToken, pool) { + var queryPart = __WEBPACK_IMPORTED_MODULE_7__url__["c" /* makeQueryString */](requestInfo.urlParams); + var url = requestInfo.url + queryPart; + var headers = __WEBPACK_IMPORTED_MODULE_4__object__["a" /* clone */](requestInfo.headers); + addAuthHeader_(headers, authToken); + addVersionHeader_(headers); + return new NetworkRequest(url, requestInfo.method, headers, requestInfo.body, requestInfo.successCodes, requestInfo.additionalRetryCodes, requestInfo.handler, requestInfo.errorHandler, requestInfo.timeout, requestInfo.progressCallback, pool); +} + +//# sourceMappingURL=request.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/requestinfo.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/requestinfo.js ***! + \***********************************************************************************/ +/*! exports provided: RequestInfo */ +/*! exports used: RequestInfo */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return RequestInfo; }); +var RequestInfo = /** @class */ (function () { + function RequestInfo(url, method, + /** + * Returns the value with which to resolve the request's promise. Only called + * if the request is successful. Throw from this function to reject the + * returned Request's promise with the thrown error. + * Note: The XhrIo passed to this function may be reused after this callback + * returns. Do not keep a reference to it in any way. + */ + handler, timeout) { + this.url = url; + this.method = method; + this.handler = handler; + this.timeout = timeout; + this.urlParams = {}; + this.headers = {}; + this.body = null; + this.errorHandler = null; + /** + * Called with the current number of bytes uploaded and total size (-1 if not + * computable) of the request body (i.e. used to report upload progress). + */ + this.progressCallback = null; + this.successCodes = [200]; + this.additionalRetryCodes = []; + } + return RequestInfo; +}()); + + +//# sourceMappingURL=requestinfo.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/requestmap.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/requestmap.js ***! + \**********************************************************************************/ +/*! exports provided: RequestMap */ +/*! exports used: RequestMap */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return RequestMap; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__object__ = __webpack_require__(/*! ./object */ "./node_modules/@firebase/storage/dist/esm/src/implementation/object.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__constants__ = __webpack_require__(/*! ./constants */ "./node_modules/@firebase/storage/dist/esm/src/implementation/constants.js"); +/** + * 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. + */ + + +/** + * @struct + */ +var RequestMap = /** @class */ (function () { + function RequestMap() { + this.map_ = {}; + this.id_ = __WEBPACK_IMPORTED_MODULE_1__constants__["h" /* minSafeInteger */]; + } + /** + * Registers the given request with this map. + * The request is unregistered when it completes. + * @param r The request to register. + */ + RequestMap.prototype.addRequest = function (r) { + var id = this.id_; + this.id_++; + this.map_[id] = r; + var self = this; + function unmap() { + delete self.map_[id]; + } + r.getPromise().then(unmap, unmap); + }; + /** + * Cancels all registered requests. + */ + RequestMap.prototype.clear = function () { + __WEBPACK_IMPORTED_MODULE_0__object__["b" /* forEach */](this.map_, function (key, val) { + if (val) { + val.cancel(true); + } + }); + this.map_ = {}; + }; + return RequestMap; +}()); + + +//# sourceMappingURL=requestmap.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/requests.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/requests.js ***! + \********************************************************************************/ +/*! exports provided: handlerCheck, metadataHandler, sharedErrorHandler, objectErrorHandler, getMetadata, updateMetadata, deleteObject, determineContentType_, metadataForUpload_, multipartUpload, ResumableUploadStatus, checkResumeHeader_, createResumableUpload, getResumableUploadStatus, resumableUploadChunkSize, continueResumableUpload */ +/*! exports used: ResumableUploadStatus, continueResumableUpload, createResumableUpload, deleteObject, getMetadata, getResumableUploadStatus, multipartUpload, resumableUploadChunkSize, updateMetadata */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* unused harmony export handlerCheck */ +/* unused harmony export metadataHandler */ +/* unused harmony export sharedErrorHandler */ +/* unused harmony export objectErrorHandler */ +/* harmony export (immutable) */ __webpack_exports__["e"] = getMetadata; +/* harmony export (immutable) */ __webpack_exports__["i"] = updateMetadata; +/* harmony export (immutable) */ __webpack_exports__["d"] = deleteObject; +/* unused harmony export determineContentType_ */ +/* unused harmony export metadataForUpload_ */ +/* harmony export (immutable) */ __webpack_exports__["g"] = multipartUpload; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ResumableUploadStatus; }); +/* unused harmony export checkResumeHeader_ */ +/* harmony export (immutable) */ __webpack_exports__["c"] = createResumableUpload; +/* harmony export (immutable) */ __webpack_exports__["f"] = getResumableUploadStatus; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return resumableUploadChunkSize; }); +/* harmony export (immutable) */ __webpack_exports__["b"] = continueResumableUpload; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__array__ = __webpack_require__(/*! ./array */ "./node_modules/@firebase/storage/dist/esm/src/implementation/array.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__blob__ = __webpack_require__(/*! ./blob */ "./node_modules/@firebase/storage/dist/esm/src/implementation/blob.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__error__ = __webpack_require__(/*! ./error */ "./node_modules/@firebase/storage/dist/esm/src/implementation/error.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__metadata__ = __webpack_require__(/*! ./metadata */ "./node_modules/@firebase/storage/dist/esm/src/implementation/metadata.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__object__ = __webpack_require__(/*! ./object */ "./node_modules/@firebase/storage/dist/esm/src/implementation/object.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__requestinfo__ = __webpack_require__(/*! ./requestinfo */ "./node_modules/@firebase/storage/dist/esm/src/implementation/requestinfo.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__type__ = __webpack_require__(/*! ./type */ "./node_modules/@firebase/storage/dist/esm/src/implementation/type.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__url__ = __webpack_require__(/*! ./url */ "./node_modules/@firebase/storage/dist/esm/src/implementation/url.js"); +/** + * 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. + */ + + + + + + + + +/** + * Throws the UNKNOWN FirebaseStorageError if cndn is false. + */ +function handlerCheck(cndn) { + if (!cndn) { + throw __WEBPACK_IMPORTED_MODULE_2__error__["s" /* unknown */](); + } +} +function metadataHandler(authWrapper, mappings) { + function handler(xhr, text) { + var metadata = __WEBPACK_IMPORTED_MODULE_3__metadata__["a" /* fromResourceString */](authWrapper, text, mappings); + handlerCheck(metadata !== null); + return metadata; + } + return handler; +} +function sharedErrorHandler(location) { + function errorHandler(xhr, err) { + var newErr; + if (xhr.getStatus() === 401) { + newErr = __WEBPACK_IMPORTED_MODULE_2__error__["q" /* unauthenticated */](); + } + else { + if (xhr.getStatus() === 402) { + newErr = __WEBPACK_IMPORTED_MODULE_2__error__["n" /* quotaExceeded */](location.bucket); + } + else { + if (xhr.getStatus() === 403) { + newErr = __WEBPACK_IMPORTED_MODULE_2__error__["r" /* unauthorized */](location.path); + } + else { + newErr = err; + } + } + } + newErr.setServerResponseProp(err.serverResponseProp()); + return newErr; + } + return errorHandler; +} +function objectErrorHandler(location) { + var shared = sharedErrorHandler(location); + function errorHandler(xhr, err) { + var newErr = shared(xhr, err); + if (xhr.getStatus() === 404) { + newErr = __WEBPACK_IMPORTED_MODULE_2__error__["m" /* objectNotFound */](location.path); + } + newErr.setServerResponseProp(err.serverResponseProp()); + return newErr; + } + return errorHandler; +} +function getMetadata(authWrapper, location, mappings) { + var urlPart = location.fullServerUrl(); + var url = __WEBPACK_IMPORTED_MODULE_7__url__["b" /* makeNormalUrl */](urlPart); + var method = 'GET'; + var timeout = authWrapper.maxOperationRetryTime(); + var requestInfo = new __WEBPACK_IMPORTED_MODULE_5__requestinfo__["a" /* RequestInfo */](url, method, metadataHandler(authWrapper, mappings), timeout); + requestInfo.errorHandler = objectErrorHandler(location); + return requestInfo; +} +function updateMetadata(authWrapper, location, metadata, mappings) { + var urlPart = location.fullServerUrl(); + var url = __WEBPACK_IMPORTED_MODULE_7__url__["b" /* makeNormalUrl */](urlPart); + var method = 'PATCH'; + var body = __WEBPACK_IMPORTED_MODULE_3__metadata__["d" /* toResourceString */](metadata, mappings); + var headers = { 'Content-Type': 'application/json; charset=utf-8' }; + var timeout = authWrapper.maxOperationRetryTime(); + var requestInfo = new __WEBPACK_IMPORTED_MODULE_5__requestinfo__["a" /* RequestInfo */](url, method, metadataHandler(authWrapper, mappings), timeout); + requestInfo.headers = headers; + requestInfo.body = body; + requestInfo.errorHandler = objectErrorHandler(location); + return requestInfo; +} +function deleteObject(authWrapper, location) { + var urlPart = location.fullServerUrl(); + var url = __WEBPACK_IMPORTED_MODULE_7__url__["b" /* makeNormalUrl */](urlPart); + var method = 'DELETE'; + var timeout = authWrapper.maxOperationRetryTime(); + function handler(xhr, text) { } + var requestInfo = new __WEBPACK_IMPORTED_MODULE_5__requestinfo__["a" /* RequestInfo */](url, method, handler, timeout); + requestInfo.successCodes = [200, 204]; + requestInfo.errorHandler = objectErrorHandler(location); + return requestInfo; +} +function determineContentType_(metadata, blob) { + return ((metadata && metadata['contentType']) || + (blob && blob.type()) || + 'application/octet-stream'); +} +function metadataForUpload_(location, blob, opt_metadata) { + var metadata = __WEBPACK_IMPORTED_MODULE_4__object__["a" /* clone */](opt_metadata); + metadata['fullPath'] = location.path; + metadata['size'] = blob.size(); + if (!metadata['contentType']) { + metadata['contentType'] = determineContentType_(null, blob); + } + return metadata; +} +function multipartUpload(authWrapper, location, mappings, blob, opt_metadata) { + var urlPart = location.bucketOnlyServerUrl(); + var headers = { + 'X-Goog-Upload-Protocol': 'multipart' + }; + function genBoundary() { + var str = ''; + for (var i = 0; i < 2; i++) { + str = + str + + Math.random() + .toString() + .slice(2); + } + return str; + } + var boundary = genBoundary(); + headers['Content-Type'] = 'multipart/related; boundary=' + boundary; + var metadata = metadataForUpload_(location, blob, opt_metadata); + var metadataString = __WEBPACK_IMPORTED_MODULE_3__metadata__["d" /* toResourceString */](metadata, mappings); + var preBlobPart = '--' + + boundary + + '\r\n' + + 'Content-Type: application/json; charset=utf-8\r\n\r\n' + + metadataString + + '\r\n--' + + boundary + + '\r\n' + + 'Content-Type: ' + + metadata['contentType'] + + '\r\n\r\n'; + var postBlobPart = '\r\n--' + boundary + '--'; + var body = __WEBPACK_IMPORTED_MODULE_1__blob__["a" /* FbsBlob */].getBlob(preBlobPart, blob, postBlobPart); + if (body === null) { + throw __WEBPACK_IMPORTED_MODULE_2__error__["d" /* cannotSliceBlob */](); + } + var urlParams = { name: metadata['fullPath'] }; + var url = __WEBPACK_IMPORTED_MODULE_7__url__["d" /* makeUploadUrl */](urlPart); + var method = 'POST'; + var timeout = authWrapper.maxUploadRetryTime(); + var requestInfo = new __WEBPACK_IMPORTED_MODULE_5__requestinfo__["a" /* RequestInfo */](url, method, metadataHandler(authWrapper, mappings), timeout); + requestInfo.urlParams = urlParams; + requestInfo.headers = headers; + requestInfo.body = body.uploadData(); + requestInfo.errorHandler = sharedErrorHandler(location); + return requestInfo; +} +/** + * @param current The number of bytes that have been uploaded so far. + * @param total The total number of bytes in the upload. + * @param opt_finalized True if the server has finished the upload. + * @param opt_metadata The upload metadata, should + * only be passed if opt_finalized is true. + * @struct + */ +var ResumableUploadStatus = /** @class */ (function () { + function ResumableUploadStatus(current, total, finalized, metadata) { + this.current = current; + this.total = total; + this.finalized = !!finalized; + this.metadata = metadata || null; + } + return ResumableUploadStatus; +}()); + +function checkResumeHeader_(xhr, opt_allowed) { + var status; + try { + status = xhr.getResponseHeader('X-Goog-Upload-Status'); + } + catch (e) { + handlerCheck(false); + } + var allowed = opt_allowed || ['active']; + handlerCheck(__WEBPACK_IMPORTED_MODULE_0__array__["b" /* contains */](allowed, status)); + return status; +} +function createResumableUpload(authWrapper, location, mappings, blob, opt_metadata) { + var urlPart = location.bucketOnlyServerUrl(); + var metadata = metadataForUpload_(location, blob, opt_metadata); + var urlParams = { name: metadata['fullPath'] }; + var url = __WEBPACK_IMPORTED_MODULE_7__url__["d" /* makeUploadUrl */](urlPart); + var method = 'POST'; + var headers = { + 'X-Goog-Upload-Protocol': 'resumable', + 'X-Goog-Upload-Command': 'start', + 'X-Goog-Upload-Header-Content-Length': blob.size(), + 'X-Goog-Upload-Header-Content-Type': metadata['contentType'], + 'Content-Type': 'application/json; charset=utf-8' + }; + var body = __WEBPACK_IMPORTED_MODULE_3__metadata__["d" /* toResourceString */](metadata, mappings); + var timeout = authWrapper.maxUploadRetryTime(); + function handler(xhr, text) { + checkResumeHeader_(xhr); + var url; + try { + url = xhr.getResponseHeader('X-Goog-Upload-URL'); + } + catch (e) { + handlerCheck(false); + } + handlerCheck(__WEBPACK_IMPORTED_MODULE_6__type__["j" /* isString */](url)); + return url; + } + var requestInfo = new __WEBPACK_IMPORTED_MODULE_5__requestinfo__["a" /* RequestInfo */](url, method, handler, timeout); + requestInfo.urlParams = urlParams; + requestInfo.headers = headers; + requestInfo.body = body; + requestInfo.errorHandler = sharedErrorHandler(location); + return requestInfo; +} +/** + * @param url From a call to fbs.requests.createResumableUpload. + */ +function getResumableUploadStatus(authWrapper, location, url, blob) { + var headers = { 'X-Goog-Upload-Command': 'query' }; + function handler(xhr, text) { + var status = checkResumeHeader_(xhr, ['active', 'final']); + var sizeString; + try { + sizeString = xhr.getResponseHeader('X-Goog-Upload-Size-Received'); + } + catch (e) { + handlerCheck(false); + } + var size = parseInt(sizeString, 10); + handlerCheck(!isNaN(size)); + return new ResumableUploadStatus(size, blob.size(), status === 'final'); + } + var method = 'POST'; + var timeout = authWrapper.maxUploadRetryTime(); + var requestInfo = new __WEBPACK_IMPORTED_MODULE_5__requestinfo__["a" /* RequestInfo */](url, method, handler, timeout); + requestInfo.headers = headers; + requestInfo.errorHandler = sharedErrorHandler(location); + return requestInfo; +} +/** + * Any uploads via the resumable upload API must transfer a number of bytes + * that is a multiple of this number. + */ +var resumableUploadChunkSize = 256 * 1024; +/** + * @param url From a call to fbs.requests.createResumableUpload. + * @param chunkSize Number of bytes to upload. + * @param opt_status The previous status. + * If not passed or null, we start from the beginning. + * @throws fbs.Error If the upload is already complete, the passed in status + * has a final size inconsistent with the blob, or the blob cannot be sliced + * for upload. + */ +function continueResumableUpload(location, authWrapper, url, blob, chunkSize, mappings, opt_status, opt_progressCallback) { + // TODO(andysoto): standardize on internal asserts + // assert(!(opt_status && opt_status.finalized)); + var status = new ResumableUploadStatus(0, 0); + if (opt_status) { + status.current = opt_status.current; + status.total = opt_status.total; + } + else { + status.current = 0; + status.total = blob.size(); + } + if (blob.size() !== status.total) { + throw __WEBPACK_IMPORTED_MODULE_2__error__["p" /* serverFileWrongSize */](); + } + var bytesLeft = status.total - status.current; + var bytesToUpload = bytesLeft; + if (chunkSize > 0) { + bytesToUpload = Math.min(bytesToUpload, chunkSize); + } + var startByte = status.current; + var endByte = startByte + bytesToUpload; + var uploadCommand = bytesToUpload === bytesLeft ? 'upload, finalize' : 'upload'; + var headers = { + 'X-Goog-Upload-Command': uploadCommand, + 'X-Goog-Upload-Offset': status.current + }; + var body = blob.slice(startByte, endByte); + if (body === null) { + throw __WEBPACK_IMPORTED_MODULE_2__error__["d" /* cannotSliceBlob */](); + } + function handler(xhr, text) { + // TODO(andysoto): Verify the MD5 of each uploaded range: + // the 'x-range-md5' header comes back with status code 308 responses. + // We'll only be able to bail out though, because you can't re-upload a + // range that you previously uploaded. + var uploadStatus = checkResumeHeader_(xhr, ['active', 'final']); + var newCurrent = status.current + bytesToUpload; + var size = blob.size(); + var metadata; + if (uploadStatus === 'final') { + metadata = metadataHandler(authWrapper, mappings)(xhr, text); + } + else { + metadata = null; + } + return new ResumableUploadStatus(newCurrent, size, uploadStatus === 'final', metadata); + } + var method = 'POST'; + var timeout = authWrapper.maxUploadRetryTime(); + var requestInfo = new __WEBPACK_IMPORTED_MODULE_5__requestinfo__["a" /* RequestInfo */](url, method, handler, timeout); + requestInfo.headers = headers; + requestInfo.body = body.uploadData(); + requestInfo.progressCallback = opt_progressCallback || null; + requestInfo.errorHandler = sharedErrorHandler(location); + return requestInfo; +} + +//# sourceMappingURL=requests.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/string.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/string.js ***! + \******************************************************************************/ +/*! exports provided: StringFormat, formatValidator, StringData, dataFromString, utf8Bytes_, percentEncodedBytes_, base64Bytes_, dataURLBytes_, dataURLContentType_ */ +/*! exports used: StringFormat, dataFromString, formatValidator */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return StringFormat; }); +/* harmony export (immutable) */ __webpack_exports__["c"] = formatValidator; +/* unused harmony export StringData */ +/* harmony export (immutable) */ __webpack_exports__["b"] = dataFromString; +/* unused harmony export utf8Bytes_ */ +/* unused harmony export percentEncodedBytes_ */ +/* unused harmony export base64Bytes_ */ +/* unused harmony export dataURLBytes_ */ +/* unused harmony export dataURLContentType_ */ +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__error__ = __webpack_require__(/*! ./error */ "./node_modules/@firebase/storage/dist/esm/src/implementation/error.js"); +/** + * 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. + */ + +var StringFormat = { + RAW: 'raw', + BASE64: 'base64', + BASE64URL: 'base64url', + DATA_URL: 'data_url' +}; +function formatValidator(stringFormat) { + switch (stringFormat) { + case StringFormat.RAW: + case StringFormat.BASE64: + case StringFormat.BASE64URL: + case StringFormat.DATA_URL: + return; + default: + throw 'Expected one of the event types: [' + + StringFormat.RAW + + ', ' + + StringFormat.BASE64 + + ', ' + + StringFormat.BASE64URL + + ', ' + + StringFormat.DATA_URL + + '].'; + } +} +/** + * @struct + */ +var StringData = /** @class */ (function () { + function StringData(data, opt_contentType) { + this.data = data; + this.contentType = opt_contentType || null; + } + return StringData; +}()); + +function dataFromString(format, string) { + switch (format) { + case StringFormat.RAW: + return new StringData(utf8Bytes_(string)); + case StringFormat.BASE64: + case StringFormat.BASE64URL: + return new StringData(base64Bytes_(format, string)); + case StringFormat.DATA_URL: + return new StringData(dataURLBytes_(string), dataURLContentType_(string)); + } + // assert(false); + throw __WEBPACK_IMPORTED_MODULE_0__error__["s" /* unknown */](); +} +function utf8Bytes_(string) { + var b = []; + for (var i = 0; i < string.length; i++) { + var c = string.charCodeAt(i); + if (c <= 127) { + b.push(c); + } + else { + if (c <= 2047) { + b.push(192 | (c >> 6), 128 | (c & 63)); + } + else { + if ((c & 64512) == 55296) { + // The start of a surrogate pair. + var valid = i < string.length - 1 && + (string.charCodeAt(i + 1) & 64512) == 56320; + if (!valid) { + // The second surrogate wasn't there. + b.push(239, 191, 189); + } + else { + var hi = c; + var lo = string.charCodeAt(++i); + c = 65536 | ((hi & 1023) << 10) | (lo & 1023); + b.push(240 | (c >> 18), 128 | ((c >> 12) & 63), 128 | ((c >> 6) & 63), 128 | (c & 63)); + } + } + else { + if ((c & 64512) == 56320) { + // Invalid low surrogate. + b.push(239, 191, 189); + } + else { + b.push(224 | (c >> 12), 128 | ((c >> 6) & 63), 128 | (c & 63)); + } + } + } + } + } + return new Uint8Array(b); +} +function percentEncodedBytes_(string) { + var decoded; + try { + decoded = decodeURIComponent(string); + } + catch (e) { + throw __WEBPACK_IMPORTED_MODULE_0__error__["i" /* invalidFormat */](StringFormat.DATA_URL, 'Malformed data URL.'); + } + return utf8Bytes_(decoded); +} +function base64Bytes_(format, string) { + switch (format) { + case StringFormat.BASE64: { + var hasMinus = string.indexOf('-') !== -1; + var hasUnder = string.indexOf('_') !== -1; + if (hasMinus || hasUnder) { + var invalidChar = hasMinus ? '-' : '_'; + throw __WEBPACK_IMPORTED_MODULE_0__error__["i" /* invalidFormat */](format, "Invalid character '" + + invalidChar + + "' found: is it base64url encoded?"); + } + break; + } + case StringFormat.BASE64URL: { + var hasPlus = string.indexOf('+') !== -1; + var hasSlash = string.indexOf('/') !== -1; + if (hasPlus || hasSlash) { + var invalidChar = hasPlus ? '+' : '/'; + throw __WEBPACK_IMPORTED_MODULE_0__error__["i" /* invalidFormat */](format, "Invalid character '" + invalidChar + "' found: is it base64 encoded?"); + } + string = string.replace(/-/g, '+').replace(/_/g, '/'); + break; + } + } + var bytes; + try { + bytes = atob(string); + } + catch (e) { + throw __WEBPACK_IMPORTED_MODULE_0__error__["i" /* invalidFormat */](format, 'Invalid character found'); + } + var array = new Uint8Array(bytes.length); + for (var i = 0; i < bytes.length; i++) { + array[i] = bytes.charCodeAt(i); + } + return array; +} +/** + * @struct + */ +var DataURLParts = /** @class */ (function () { + function DataURLParts(dataURL) { + this.base64 = false; + this.contentType = null; + var matches = dataURL.match(/^data:([^,]+)?,/); + if (matches === null) { + throw __WEBPACK_IMPORTED_MODULE_0__error__["i" /* invalidFormat */](StringFormat.DATA_URL, "Must be formatted 'data:[][;base64],"); + } + var middle = matches[1] || null; + if (middle != null) { + this.base64 = endsWith(middle, ';base64'); + this.contentType = this.base64 + ? middle.substring(0, middle.length - ';base64'.length) + : middle; + } + this.rest = dataURL.substring(dataURL.indexOf(',') + 1); + } + return DataURLParts; +}()); +function dataURLBytes_(string) { + var parts = new DataURLParts(string); + if (parts.base64) { + return base64Bytes_(StringFormat.BASE64, parts.rest); + } + else { + return percentEncodedBytes_(parts.rest); + } +} +function dataURLContentType_(string) { + var parts = new DataURLParts(string); + return parts.contentType; +} +function endsWith(s, end) { + var longEnough = s.length >= end.length; + if (!longEnough) { + return false; + } + return s.substring(s.length - end.length) === end; +} + +//# sourceMappingURL=string.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/taskenums.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/taskenums.js ***! + \*********************************************************************************/ +/*! exports provided: TaskEvent, InternalTaskState, TaskState, taskStateFromInternalTaskState */ +/*! exports used: InternalTaskState, TaskEvent, TaskState, taskStateFromInternalTaskState */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return TaskEvent; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return InternalTaskState; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return TaskState; }); +/* harmony export (immutable) */ __webpack_exports__["d"] = taskStateFromInternalTaskState; +/** + * 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. + */ +var TaskEvent = { + /** Triggered whenever the task changes or progress is updated. */ + STATE_CHANGED: 'state_changed' +}; +var InternalTaskState = { + RUNNING: 'running', + PAUSING: 'pausing', + PAUSED: 'paused', + SUCCESS: 'success', + CANCELING: 'canceling', + CANCELED: 'canceled', + ERROR: 'error' +}; +var TaskState = { + /** The task is currently transferring data. */ + RUNNING: 'running', + /** The task was paused by the user. */ + PAUSED: 'paused', + /** The task completed successfully. */ + SUCCESS: 'success', + /** The task was canceled. */ + CANCELED: 'canceled', + /** The task failed with an error. */ + ERROR: 'error' +}; +function taskStateFromInternalTaskState(state) { + switch (state) { + case InternalTaskState.RUNNING: + case InternalTaskState.PAUSING: + case InternalTaskState.CANCELING: + return TaskState.RUNNING; + case InternalTaskState.PAUSED: + return TaskState.PAUSED; + case InternalTaskState.SUCCESS: + return TaskState.SUCCESS; + case InternalTaskState.CANCELED: + return TaskState.CANCELED; + case InternalTaskState.ERROR: + return TaskState.ERROR; + default: + // TODO(andysoto): assert(false); + return TaskState.ERROR; + } +} + +//# sourceMappingURL=taskenums.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/type.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/type.js ***! + \****************************************************************************/ +/*! exports provided: isDef, isJustDef, isFunction, isObject, isNonNullObject, isNonArrayObject, isString, isNumber, isNativeBlob, isNativeBlobDefined */ +/*! exports used: isDef, isFunction, isJustDef, isNativeBlob, isNativeBlobDefined, isNonArrayObject, isNonNullObject, isNumber, isObject, isString */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (immutable) */ __webpack_exports__["a"] = isDef; +/* harmony export (immutable) */ __webpack_exports__["c"] = isJustDef; +/* harmony export (immutable) */ __webpack_exports__["b"] = isFunction; +/* harmony export (immutable) */ __webpack_exports__["i"] = isObject; +/* harmony export (immutable) */ __webpack_exports__["g"] = isNonNullObject; +/* harmony export (immutable) */ __webpack_exports__["f"] = isNonArrayObject; +/* harmony export (immutable) */ __webpack_exports__["j"] = isString; +/* harmony export (immutable) */ __webpack_exports__["h"] = isNumber; +/* harmony export (immutable) */ __webpack_exports__["d"] = isNativeBlob; +/* harmony export (immutable) */ __webpack_exports__["e"] = isNativeBlobDefined; +/** + * 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. + */ +/** + * @return False if the object is undefined or null, true otherwise. + */ +function isDef(p) { + return p != null; +} +function isJustDef(p) { + return p !== void 0; +} +function isFunction(p) { + return typeof p === 'function'; +} +function isObject(p) { + return typeof p === 'object'; +} +function isNonNullObject(p) { + return isObject(p) && p !== null; +} +function isNonArrayObject(p) { + return isObject(p) && !Array.isArray(p); +} +function isString(p) { + return typeof p === 'string' || p instanceof String; +} +function isNumber(p) { + return typeof p === 'number' || p instanceof Number; +} +function isNativeBlob(p) { + return isNativeBlobDefined() && p instanceof Blob; +} +function isNativeBlobDefined() { + return typeof Blob !== 'undefined'; +} + +//# sourceMappingURL=type.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/url.js": +/*!***************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/url.js ***! + \***************************************************************************/ +/*! exports provided: makeNormalUrl, makeDownloadUrl, makeUploadUrl, makeQueryString */ +/*! exports used: makeDownloadUrl, makeNormalUrl, makeQueryString, makeUploadUrl */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (immutable) */ __webpack_exports__["b"] = makeNormalUrl; +/* harmony export (immutable) */ __webpack_exports__["a"] = makeDownloadUrl; +/* harmony export (immutable) */ __webpack_exports__["d"] = makeUploadUrl; +/* harmony export (immutable) */ __webpack_exports__["c"] = makeQueryString; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constants__ = __webpack_require__(/*! ./constants */ "./node_modules/@firebase/storage/dist/esm/src/implementation/constants.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__object__ = __webpack_require__(/*! ./object */ "./node_modules/@firebase/storage/dist/esm/src/implementation/object.js"); +/** + * 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. + */ +/** + * @fileoverview Functions to create and manipulate URLs for the server API. + */ + + +function makeNormalUrl(urlPart) { + return __WEBPACK_IMPORTED_MODULE_0__constants__["f" /* domainBase */] + __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* apiBaseUrl */] + urlPart; +} +function makeDownloadUrl(urlPart) { + return __WEBPACK_IMPORTED_MODULE_0__constants__["g" /* downloadBase */] + __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* apiBaseUrl */] + urlPart; +} +function makeUploadUrl(urlPart) { + return __WEBPACK_IMPORTED_MODULE_0__constants__["f" /* domainBase */] + __WEBPACK_IMPORTED_MODULE_0__constants__["b" /* apiUploadBaseUrl */] + urlPart; +} +function makeQueryString(params) { + var encode = encodeURIComponent; + var queryPart = '?'; + __WEBPACK_IMPORTED_MODULE_1__object__["b" /* forEach */](params, function (key, val) { + var nextPart = encode(key) + '=' + encode(val); + queryPart = queryPart + nextPart + '&'; + }); + // Chop off the extra '&' or '?' on the end + queryPart = queryPart.slice(0, -1); + return queryPart; +} + +//# sourceMappingURL=url.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/xhrio.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/xhrio.js ***! + \*****************************************************************************/ +/*! exports provided: ErrorCode */ +/*! exports used: ErrorCode */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ErrorCode; }); +/** + * 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. + */ +/** + * @enum{number} + */ +var ErrorCode; +(function (ErrorCode) { + ErrorCode[ErrorCode["NO_ERROR"] = 0] = "NO_ERROR"; + ErrorCode[ErrorCode["NETWORK_ERROR"] = 1] = "NETWORK_ERROR"; + ErrorCode[ErrorCode["ABORT"] = 2] = "ABORT"; +})(ErrorCode || (ErrorCode = {})); + +//# sourceMappingURL=xhrio.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/xhrio_network.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/xhrio_network.js ***! + \*************************************************************************************/ +/*! exports provided: NetworkXhrIo */ +/*! exports used: NetworkXhrIo */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NetworkXhrIo; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__error__ = __webpack_require__(/*! ./error */ "./node_modules/@firebase/storage/dist/esm/src/implementation/error.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__object__ = __webpack_require__(/*! ./object */ "./node_modules/@firebase/storage/dist/esm/src/implementation/object.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__promise_external__ = __webpack_require__(/*! ./promise_external */ "./node_modules/@firebase/storage/dist/esm/src/implementation/promise_external.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__type__ = __webpack_require__(/*! ./type */ "./node_modules/@firebase/storage/dist/esm/src/implementation/type.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__xhrio__ = __webpack_require__(/*! ./xhrio */ "./node_modules/@firebase/storage/dist/esm/src/implementation/xhrio.js"); +/** + * 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. + */ + + + + + +/** + * We use this instead of goog.net.XhrIo because goog.net.XhrIo is hyuuuuge and + * doesn't work in React Native on Android. + */ +var NetworkXhrIo = /** @class */ (function () { + function NetworkXhrIo() { + var _this = this; + this.sent_ = false; + this.xhr_ = new XMLHttpRequest(); + this.errorCode_ = __WEBPACK_IMPORTED_MODULE_4__xhrio__["a" /* ErrorCode */].NO_ERROR; + this.sendPromise_ = __WEBPACK_IMPORTED_MODULE_2__promise_external__["a" /* make */](function (resolve, reject) { + _this.xhr_.addEventListener('abort', function (event) { + _this.errorCode_ = __WEBPACK_IMPORTED_MODULE_4__xhrio__["a" /* ErrorCode */].ABORT; + resolve(_this); + }); + _this.xhr_.addEventListener('error', function (event) { + _this.errorCode_ = __WEBPACK_IMPORTED_MODULE_4__xhrio__["a" /* ErrorCode */].NETWORK_ERROR; + resolve(_this); + }); + _this.xhr_.addEventListener('load', function (event) { + resolve(_this); + }); + }); + } + /** + * @override + */ + NetworkXhrIo.prototype.send = function (url, method, opt_body, opt_headers) { + var _this = this; + if (this.sent_) { + throw __WEBPACK_IMPORTED_MODULE_0__error__["e" /* internalError */]('cannot .send() more than once'); + } + this.sent_ = true; + this.xhr_.open(method, url, true); + if (__WEBPACK_IMPORTED_MODULE_3__type__["a" /* isDef */](opt_headers)) { + var headers = opt_headers; + __WEBPACK_IMPORTED_MODULE_1__object__["b" /* forEach */](headers, function (key, val) { + _this.xhr_.setRequestHeader(key, val.toString()); + }); + } + if (__WEBPACK_IMPORTED_MODULE_3__type__["a" /* isDef */](opt_body)) { + this.xhr_.send(opt_body); + } + else { + this.xhr_.send(); + } + return this.sendPromise_; + }; + /** + * @override + */ + NetworkXhrIo.prototype.getErrorCode = function () { + if (!this.sent_) { + throw __WEBPACK_IMPORTED_MODULE_0__error__["e" /* internalError */]('cannot .getErrorCode() before sending'); + } + return this.errorCode_; + }; + /** + * @override + */ + NetworkXhrIo.prototype.getStatus = function () { + if (!this.sent_) { + throw __WEBPACK_IMPORTED_MODULE_0__error__["e" /* internalError */]('cannot .getStatus() before sending'); + } + try { + return this.xhr_.status; + } + catch (e) { + return -1; + } + }; + /** + * @override + */ + NetworkXhrIo.prototype.getResponseText = function () { + if (!this.sent_) { + throw __WEBPACK_IMPORTED_MODULE_0__error__["e" /* internalError */]('cannot .getResponseText() before sending'); + } + return this.xhr_.responseText; + }; + /** + * Aborts the request. + * @override + */ + NetworkXhrIo.prototype.abort = function () { + this.xhr_.abort(); + }; + /** + * @override + */ + NetworkXhrIo.prototype.getResponseHeader = function (header) { + return this.xhr_.getResponseHeader(header); + }; + /** + * @override + */ + NetworkXhrIo.prototype.addUploadProgressListener = function (listener) { + if (__WEBPACK_IMPORTED_MODULE_3__type__["a" /* isDef */](this.xhr_.upload)) { + this.xhr_.upload.addEventListener('progress', listener); + } + }; + /** + * @override + */ + NetworkXhrIo.prototype.removeUploadProgressListener = function (listener) { + if (__WEBPACK_IMPORTED_MODULE_3__type__["a" /* isDef */](this.xhr_.upload)) { + this.xhr_.upload.removeEventListener('progress', listener); + } + }; + return NetworkXhrIo; +}()); + + +//# sourceMappingURL=xhrio_network.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/implementation/xhriopool.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/implementation/xhriopool.js ***! + \*********************************************************************************/ +/*! exports provided: XhrIoPool */ +/*! exports used: XhrIoPool */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return XhrIoPool; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__xhrio_network__ = __webpack_require__(/*! ./xhrio_network */ "./node_modules/@firebase/storage/dist/esm/src/implementation/xhrio_network.js"); +/** + * 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. + */ + +/** + * Factory-like class for creating XhrIo instances. + */ +var XhrIoPool = /** @class */ (function () { + function XhrIoPool() { + } + XhrIoPool.prototype.createXhrIo = function () { + return new __WEBPACK_IMPORTED_MODULE_0__xhrio_network__["a" /* NetworkXhrIo */](); + }; + return XhrIoPool; +}()); + + +//# sourceMappingURL=xhriopool.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/reference.js": +/*!******************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/reference.js ***! + \******************************************************************/ +/*! exports provided: Reference */ +/*! exports used: Reference */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Reference; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__implementation_args__ = __webpack_require__(/*! ./implementation/args */ "./node_modules/@firebase/storage/dist/esm/src/implementation/args.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__implementation_blob__ = __webpack_require__(/*! ./implementation/blob */ "./node_modules/@firebase/storage/dist/esm/src/implementation/blob.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__implementation_error__ = __webpack_require__(/*! ./implementation/error */ "./node_modules/@firebase/storage/dist/esm/src/implementation/error.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__implementation_location__ = __webpack_require__(/*! ./implementation/location */ "./node_modules/@firebase/storage/dist/esm/src/implementation/location.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__implementation_metadata__ = __webpack_require__(/*! ./implementation/metadata */ "./node_modules/@firebase/storage/dist/esm/src/implementation/metadata.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__implementation_object__ = __webpack_require__(/*! ./implementation/object */ "./node_modules/@firebase/storage/dist/esm/src/implementation/object.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__implementation_path__ = __webpack_require__(/*! ./implementation/path */ "./node_modules/@firebase/storage/dist/esm/src/implementation/path.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__implementation_requests__ = __webpack_require__(/*! ./implementation/requests */ "./node_modules/@firebase/storage/dist/esm/src/implementation/requests.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__implementation_string__ = __webpack_require__(/*! ./implementation/string */ "./node_modules/@firebase/storage/dist/esm/src/implementation/string.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__implementation_type__ = __webpack_require__(/*! ./implementation/type */ "./node_modules/@firebase/storage/dist/esm/src/implementation/type.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__task__ = __webpack_require__(/*! ./task */ "./node_modules/@firebase/storage/dist/esm/src/task.js"); +/** + * 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. + */ +/** + * @fileoverview Defines the Firebase Storage Reference class. + */ + + + + + + + + + + + + +/** + * Provides methods to interact with a bucket in the Firebase Storage service. + * @param location An fbs.location, or the URL at + * which to base this object, in one of the following forms: + * gs:/// + * http[s]://firebasestorage.googleapis.com/ + * /b//o/ + * Any query or fragment strings will be ignored in the http[s] + * format. If no value is passed, the storage object will use a URL based on + * the project ID of the base firebase.App instance. + */ +var Reference = /** @class */ (function () { + function Reference(authWrapper, location) { + this.authWrapper = authWrapper; + if (location instanceof __WEBPACK_IMPORTED_MODULE_3__implementation_location__["a" /* Location */]) { + this.location = location; + } + else { + this.location = __WEBPACK_IMPORTED_MODULE_3__implementation_location__["a" /* Location */].makeFromUrl(location); + } + } + /** + * @return The URL for the bucket and path this object references, + * in the form gs:/// + * @override + */ + Reference.prototype.toString = function () { + __WEBPACK_IMPORTED_MODULE_0__implementation_args__["g" /* validate */]('toString', [], arguments); + return 'gs://' + this.location.bucket + '/' + this.location.path; + }; + Reference.prototype.newRef = function (authWrapper, location) { + return new Reference(authWrapper, location); + }; + Reference.prototype.mappings = function () { + return __WEBPACK_IMPORTED_MODULE_4__implementation_metadata__["b" /* getMappings */](); + }; + /** + * @return A reference to the object obtained by + * appending childPath, removing any duplicate, beginning, or trailing + * slashes. + */ + Reference.prototype.child = function (childPath) { + __WEBPACK_IMPORTED_MODULE_0__implementation_args__["g" /* validate */]('child', [__WEBPACK_IMPORTED_MODULE_0__implementation_args__["e" /* stringSpec */]()], arguments); + var newPath = __WEBPACK_IMPORTED_MODULE_6__implementation_path__["a" /* child */](this.location.path, childPath); + var location = new __WEBPACK_IMPORTED_MODULE_3__implementation_location__["a" /* Location */](this.location.bucket, newPath); + return this.newRef(this.authWrapper, location); + }; + Object.defineProperty(Reference.prototype, "parent", { + /** + * @return A reference to the parent of the + * current object, or null if the current object is the root. + */ + get: function () { + var newPath = __WEBPACK_IMPORTED_MODULE_6__implementation_path__["c" /* parent */](this.location.path); + if (newPath === null) { + return null; + } + var location = new __WEBPACK_IMPORTED_MODULE_3__implementation_location__["a" /* Location */](this.location.bucket, newPath); + return this.newRef(this.authWrapper, location); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Reference.prototype, "root", { + /** + * @return An reference to the root of this + * object's bucket. + */ + get: function () { + var location = new __WEBPACK_IMPORTED_MODULE_3__implementation_location__["a" /* Location */](this.location.bucket, ''); + return this.newRef(this.authWrapper, location); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Reference.prototype, "bucket", { + get: function () { + return this.location.bucket; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Reference.prototype, "fullPath", { + get: function () { + return this.location.path; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Reference.prototype, "name", { + get: function () { + return __WEBPACK_IMPORTED_MODULE_6__implementation_path__["b" /* lastComponent */](this.location.path); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Reference.prototype, "storage", { + get: function () { + return this.authWrapper.service(); + }, + enumerable: true, + configurable: true + }); + /** + * Uploads a blob to this object's location. + * @param data The blob to upload. + * @return An UploadTask that lets you control and + * observe the upload. + */ + Reference.prototype.put = function (data, metadata) { + if (metadata === void 0) { metadata = null; } + __WEBPACK_IMPORTED_MODULE_0__implementation_args__["g" /* validate */]('put', [__WEBPACK_IMPORTED_MODULE_0__implementation_args__["f" /* uploadDataSpec */](), __WEBPACK_IMPORTED_MODULE_0__implementation_args__["b" /* metadataSpec */](true)], arguments); + this.throwIfRoot_('put'); + return new __WEBPACK_IMPORTED_MODULE_10__task__["a" /* UploadTask */](this, this.authWrapper, this.location, this.mappings(), new __WEBPACK_IMPORTED_MODULE_1__implementation_blob__["a" /* FbsBlob */](data), metadata); + }; + /** + * Uploads a string to this object's location. + * @param string The string to upload. + * @param opt_format The format of the string to upload. + * @return An UploadTask that lets you control and + * observe the upload. + */ + Reference.prototype.putString = function (string, format, opt_metadata) { + if (format === void 0) { format = __WEBPACK_IMPORTED_MODULE_8__implementation_string__["a" /* StringFormat */].RAW; } + __WEBPACK_IMPORTED_MODULE_0__implementation_args__["g" /* validate */]('putString', [ + __WEBPACK_IMPORTED_MODULE_0__implementation_args__["e" /* stringSpec */](), + __WEBPACK_IMPORTED_MODULE_0__implementation_args__["e" /* stringSpec */](__WEBPACK_IMPORTED_MODULE_8__implementation_string__["c" /* formatValidator */], true), + __WEBPACK_IMPORTED_MODULE_0__implementation_args__["b" /* metadataSpec */](true) + ], arguments); + this.throwIfRoot_('putString'); + var data = __WEBPACK_IMPORTED_MODULE_8__implementation_string__["b" /* dataFromString */](format, string); + var metadata = __WEBPACK_IMPORTED_MODULE_5__implementation_object__["a" /* clone */](opt_metadata); + if (!__WEBPACK_IMPORTED_MODULE_9__implementation_type__["a" /* isDef */](metadata['contentType']) && __WEBPACK_IMPORTED_MODULE_9__implementation_type__["a" /* isDef */](data.contentType)) { + metadata['contentType'] = data.contentType; + } + return new __WEBPACK_IMPORTED_MODULE_10__task__["a" /* UploadTask */](this, this.authWrapper, this.location, this.mappings(), new __WEBPACK_IMPORTED_MODULE_1__implementation_blob__["a" /* FbsBlob */](data.data, true), metadata); + }; + /** + * Deletes the object at this location. + * @return A promise that resolves if the deletion succeeds. + */ + Reference.prototype.delete = function () { + __WEBPACK_IMPORTED_MODULE_0__implementation_args__["g" /* validate */]('delete', [], arguments); + this.throwIfRoot_('delete'); + var self = this; + return this.authWrapper.getAuthToken().then(function (authToken) { + var requestInfo = __WEBPACK_IMPORTED_MODULE_7__implementation_requests__["d" /* deleteObject */](self.authWrapper, self.location); + return self.authWrapper.makeRequest(requestInfo, authToken).getPromise(); + }); + }; + /** + * A promise that resolves with the metadata for this object. If this + * object doesn't exist or metadata cannot be retreived, the promise is + * rejected. + */ + Reference.prototype.getMetadata = function () { + __WEBPACK_IMPORTED_MODULE_0__implementation_args__["g" /* validate */]('getMetadata', [], arguments); + this.throwIfRoot_('getMetadata'); + var self = this; + return this.authWrapper.getAuthToken().then(function (authToken) { + var requestInfo = __WEBPACK_IMPORTED_MODULE_7__implementation_requests__["e" /* getMetadata */](self.authWrapper, self.location, self.mappings()); + return self.authWrapper.makeRequest(requestInfo, authToken).getPromise(); + }); + }; + /** + * Updates the metadata for this object. + * @param metadata The new metadata for the object. + * Only values that have been explicitly set will be changed. Explicitly + * setting a value to null will remove the metadata. + * @return A promise that resolves + * with the new metadata for this object. + * @see firebaseStorage.Reference.prototype.getMetadata + */ + Reference.prototype.updateMetadata = function (metadata) { + __WEBPACK_IMPORTED_MODULE_0__implementation_args__["g" /* validate */]('updateMetadata', [__WEBPACK_IMPORTED_MODULE_0__implementation_args__["b" /* metadataSpec */]()], arguments); + this.throwIfRoot_('updateMetadata'); + var self = this; + return this.authWrapper.getAuthToken().then(function (authToken) { + var requestInfo = __WEBPACK_IMPORTED_MODULE_7__implementation_requests__["i" /* updateMetadata */](self.authWrapper, self.location, metadata, self.mappings()); + return self.authWrapper.makeRequest(requestInfo, authToken).getPromise(); + }); + }; + /** + * @return A promise that resolves with the download + * URL for this object. + */ + Reference.prototype.getDownloadURL = function () { + __WEBPACK_IMPORTED_MODULE_0__implementation_args__["g" /* validate */]('getDownloadURL', [], arguments); + this.throwIfRoot_('getDownloadURL'); + return this.getMetadata().then(function (metadata) { + var url = metadata['downloadURLs'][0]; + if (__WEBPACK_IMPORTED_MODULE_9__implementation_type__["a" /* isDef */](url)) { + return url; + } + else { + throw __WEBPACK_IMPORTED_MODULE_2__implementation_error__["l" /* noDownloadURL */](); + } + }); + }; + Reference.prototype.throwIfRoot_ = function (name) { + if (this.location.path === '') { + throw __WEBPACK_IMPORTED_MODULE_2__implementation_error__["j" /* invalidRootOperation */](name); + } + }; + return Reference; +}()); + + +//# sourceMappingURL=reference.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/service.js": +/*!****************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/service.js ***! + \****************************************************************/ +/*! exports provided: Service, ServiceInternals */ +/*! exports used: Service */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Service; }); +/* unused harmony export ServiceInternals */ +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__implementation_args__ = __webpack_require__(/*! ./implementation/args */ "./node_modules/@firebase/storage/dist/esm/src/implementation/args.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__implementation_authwrapper__ = __webpack_require__(/*! ./implementation/authwrapper */ "./node_modules/@firebase/storage/dist/esm/src/implementation/authwrapper.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__implementation_location__ = __webpack_require__(/*! ./implementation/location */ "./node_modules/@firebase/storage/dist/esm/src/implementation/location.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__implementation_promise_external__ = __webpack_require__(/*! ./implementation/promise_external */ "./node_modules/@firebase/storage/dist/esm/src/implementation/promise_external.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__implementation_request__ = __webpack_require__(/*! ./implementation/request */ "./node_modules/@firebase/storage/dist/esm/src/implementation/request.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__reference__ = __webpack_require__(/*! ./reference */ "./node_modules/@firebase/storage/dist/esm/src/reference.js"); +/** + * 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. + */ + + + + + + +/** + * A service that provides firebaseStorage.Reference instances. + * @param opt_url gs:// url to a custom Storage Bucket + * + * @struct + */ +var Service = /** @class */ (function () { + function Service(app, pool, url) { + this.bucket_ = null; + function maker(authWrapper, loc) { + return new __WEBPACK_IMPORTED_MODULE_5__reference__["a" /* Reference */](authWrapper, loc); + } + this.authWrapper_ = new __WEBPACK_IMPORTED_MODULE_1__implementation_authwrapper__["a" /* AuthWrapper */](app, maker, __WEBPACK_IMPORTED_MODULE_4__implementation_request__["a" /* makeRequest */], this, pool); + this.app_ = app; + if (url != null) { + this.bucket_ = __WEBPACK_IMPORTED_MODULE_2__implementation_location__["a" /* Location */].makeFromBucketSpec(url); + } + else { + var authWrapperBucket = this.authWrapper_.bucket(); + if (authWrapperBucket != null) { + this.bucket_ = new __WEBPACK_IMPORTED_MODULE_2__implementation_location__["a" /* Location */](authWrapperBucket, ''); + } + } + this.internals_ = new ServiceInternals(this); + } + /** + * Returns a firebaseStorage.Reference for the given path in the default + * bucket. + */ + Service.prototype.ref = function (path) { + function validator(path) { + if (/^[A-Za-z]+:\/\//.test(path)) { + throw 'Expected child path but got a URL, use refFromURL instead.'; + } + } + __WEBPACK_IMPORTED_MODULE_0__implementation_args__["g" /* validate */]('ref', [__WEBPACK_IMPORTED_MODULE_0__implementation_args__["e" /* stringSpec */](validator, true)], arguments); + if (this.bucket_ == null) { + throw new Error('No Storage Bucket defined in Firebase Options.'); + } + var ref = new __WEBPACK_IMPORTED_MODULE_5__reference__["a" /* Reference */](this.authWrapper_, this.bucket_); + if (path != null) { + return ref.child(path); + } + else { + return ref; + } + }; + /** + * Returns a firebaseStorage.Reference object for the given absolute URL, + * which must be a gs:// or http[s]:// URL. + */ + Service.prototype.refFromURL = function (url) { + function validator(p) { + if (!/^[A-Za-z]+:\/\//.test(p)) { + throw 'Expected full URL but got a child path, use ref instead.'; + } + try { + __WEBPACK_IMPORTED_MODULE_2__implementation_location__["a" /* Location */].makeFromUrl(p); + } + catch (e) { + throw 'Expected valid full URL but got an invalid one.'; + } + } + __WEBPACK_IMPORTED_MODULE_0__implementation_args__["g" /* validate */]('refFromURL', [__WEBPACK_IMPORTED_MODULE_0__implementation_args__["e" /* stringSpec */](validator, false)], arguments); + return new __WEBPACK_IMPORTED_MODULE_5__reference__["a" /* Reference */](this.authWrapper_, url); + }; + Object.defineProperty(Service.prototype, "maxUploadRetryTime", { + get: function () { + return this.authWrapper_.maxUploadRetryTime(); + }, + enumerable: true, + configurable: true + }); + Service.prototype.setMaxUploadRetryTime = function (time) { + __WEBPACK_IMPORTED_MODULE_0__implementation_args__["g" /* validate */]('setMaxUploadRetryTime', [__WEBPACK_IMPORTED_MODULE_0__implementation_args__["c" /* nonNegativeNumberSpec */]()], arguments); + this.authWrapper_.setMaxUploadRetryTime(time); + }; + Object.defineProperty(Service.prototype, "maxOperationRetryTime", { + get: function () { + return this.authWrapper_.maxOperationRetryTime(); + }, + enumerable: true, + configurable: true + }); + Service.prototype.setMaxOperationRetryTime = function (time) { + __WEBPACK_IMPORTED_MODULE_0__implementation_args__["g" /* validate */]('setMaxOperationRetryTime', [__WEBPACK_IMPORTED_MODULE_0__implementation_args__["c" /* nonNegativeNumberSpec */]()], arguments); + this.authWrapper_.setMaxOperationRetryTime(time); + }; + Object.defineProperty(Service.prototype, "app", { + get: function () { + return this.app_; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Service.prototype, "INTERNAL", { + get: function () { + return this.internals_; + }, + enumerable: true, + configurable: true + }); + return Service; +}()); + +/** + * @struct + */ +var ServiceInternals = /** @class */ (function () { + function ServiceInternals(service) { + this.service_ = service; + } + /** + * Called when the associated app is deleted. + * @see {!fbs.AuthWrapper.prototype.deleteApp} + */ + ServiceInternals.prototype.delete = function () { + this.service_.authWrapper_.deleteApp(); + return __WEBPACK_IMPORTED_MODULE_3__implementation_promise_external__["c" /* resolve */](undefined); + }; + return ServiceInternals; +}()); + + +//# sourceMappingURL=service.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/task.js": +/*!*************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/task.js ***! + \*************************************************************/ +/*! exports provided: UploadTask */ +/*! exports used: UploadTask */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return UploadTask; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__ = __webpack_require__(/*! ./implementation/taskenums */ "./node_modules/@firebase/storage/dist/esm/src/implementation/taskenums.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__implementation_observer__ = __webpack_require__(/*! ./implementation/observer */ "./node_modules/@firebase/storage/dist/esm/src/implementation/observer.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__tasksnapshot__ = __webpack_require__(/*! ./tasksnapshot */ "./node_modules/@firebase/storage/dist/esm/src/tasksnapshot.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__implementation_args__ = __webpack_require__(/*! ./implementation/args */ "./node_modules/@firebase/storage/dist/esm/src/implementation/args.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__implementation_array__ = __webpack_require__(/*! ./implementation/array */ "./node_modules/@firebase/storage/dist/esm/src/implementation/array.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__implementation_async__ = __webpack_require__(/*! ./implementation/async */ "./node_modules/@firebase/storage/dist/esm/src/implementation/async.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__implementation_error__ = __webpack_require__(/*! ./implementation/error */ "./node_modules/@firebase/storage/dist/esm/src/implementation/error.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__implementation_promise_external__ = __webpack_require__(/*! ./implementation/promise_external */ "./node_modules/@firebase/storage/dist/esm/src/implementation/promise_external.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__implementation_requests__ = __webpack_require__(/*! ./implementation/requests */ "./node_modules/@firebase/storage/dist/esm/src/implementation/requests.js"); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__implementation_type__ = __webpack_require__(/*! ./implementation/type */ "./node_modules/@firebase/storage/dist/esm/src/implementation/type.js"); +/** + * 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. + */ +/** + * @fileoverview Defines types for interacting with blob transfer tasks. + */ + + + + + + + + + + + + +/** + * Represents a blob being uploaded. Can be used to pause/resume/cancel the + * upload and manage callbacks for various events. + */ +var UploadTask = /** @class */ (function () { + /** + * @param ref The firebaseStorage.Reference object this task came + * from, untyped to avoid cyclic dependencies. + * @param blob The blob to upload. + */ + function UploadTask(ref, authWrapper, location, mappings, blob, metadata) { + if (metadata === void 0) { metadata = null; } + var _this = this; + this.transferred_ = 0; + this.needToFetchStatus_ = false; + this.needToFetchMetadata_ = false; + this.observers_ = []; + this.error_ = null; + this.uploadUrl_ = null; + this.request_ = null; + this.chunkMultiplier_ = 1; + this.resolve_ = null; + this.reject_ = null; + this.ref_ = ref; + this.authWrapper_ = authWrapper; + this.location_ = location; + this.blob_ = blob; + this.metadata_ = metadata; + this.mappings_ = mappings; + this.resumable_ = this.shouldDoResumable_(this.blob_); + this.state_ = __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].RUNNING; + this.errorHandler_ = function (error) { + _this.request_ = null; + _this.chunkMultiplier_ = 1; + if (error.codeEquals(__WEBPACK_IMPORTED_MODULE_6__implementation_error__["a" /* Code */].CANCELED)) { + _this.needToFetchStatus_ = true; + _this.completeTransitions_(); + } + else { + _this.error_ = error; + _this.transition_(__WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].ERROR); + } + }; + this.metadataErrorHandler_ = function (error) { + _this.request_ = null; + if (error.codeEquals(__WEBPACK_IMPORTED_MODULE_6__implementation_error__["a" /* Code */].CANCELED)) { + _this.completeTransitions_(); + } + else { + _this.error_ = error; + _this.transition_(__WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].ERROR); + } + }; + this.promise_ = __WEBPACK_IMPORTED_MODULE_7__implementation_promise_external__["a" /* make */](function (resolve, reject) { + _this.resolve_ = resolve; + _this.reject_ = reject; + _this.start_(); + }); + // Prevent uncaught rejections on the internal promise from bubbling out + // to the top level with a dummy handler. + this.promise_.then(null, function () { }); + } + UploadTask.prototype.makeProgressCallback_ = function () { + var _this = this; + var sizeBefore = this.transferred_; + return function (loaded, total) { + _this.updateProgress_(sizeBefore + loaded); + }; + }; + UploadTask.prototype.shouldDoResumable_ = function (blob) { + return blob.size() > 256 * 1024; + }; + UploadTask.prototype.start_ = function () { + if (this.state_ !== __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].RUNNING) { + // This can happen if someone pauses us in a resume callback, for example. + return; + } + if (this.request_ !== null) { + return; + } + if (this.resumable_) { + if (this.uploadUrl_ === null) { + this.createResumable_(); + } + else { + if (this.needToFetchStatus_) { + this.fetchStatus_(); + } + else { + if (this.needToFetchMetadata_) { + // Happens if we miss the metadata on upload completion. + this.fetchMetadata_(); + } + else { + this.continueUpload_(); + } + } + } + } + else { + this.oneShotUpload_(); + } + }; + UploadTask.prototype.resolveToken_ = function (callback) { + var _this = this; + this.authWrapper_.getAuthToken().then(function (authToken) { + switch (_this.state_) { + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].RUNNING: + callback(authToken); + break; + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].CANCELING: + _this.transition_(__WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].CANCELED); + break; + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].PAUSING: + _this.transition_(__WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].PAUSED); + break; + default: + } + }); + }; + // TODO(andysoto): assert false + UploadTask.prototype.createResumable_ = function () { + var _this = this; + this.resolveToken_(function (authToken) { + var requestInfo = __WEBPACK_IMPORTED_MODULE_8__implementation_requests__["c" /* createResumableUpload */](_this.authWrapper_, _this.location_, _this.mappings_, _this.blob_, _this.metadata_); + var createRequest = _this.authWrapper_.makeRequest(requestInfo, authToken); + _this.request_ = createRequest; + createRequest.getPromise().then(function (url) { + _this.request_ = null; + _this.uploadUrl_ = url; + _this.needToFetchStatus_ = false; + _this.completeTransitions_(); + }, _this.errorHandler_); + }); + }; + UploadTask.prototype.fetchStatus_ = function () { + var _this = this; + // TODO(andysoto): assert(this.uploadUrl_ !== null); + var url = this.uploadUrl_; + this.resolveToken_(function (authToken) { + var requestInfo = __WEBPACK_IMPORTED_MODULE_8__implementation_requests__["f" /* getResumableUploadStatus */](_this.authWrapper_, _this.location_, url, _this.blob_); + var statusRequest = _this.authWrapper_.makeRequest(requestInfo, authToken); + _this.request_ = statusRequest; + statusRequest.getPromise().then(function (status) { + status = status; + _this.request_ = null; + _this.updateProgress_(status.current); + _this.needToFetchStatus_ = false; + if (status.finalized) { + _this.needToFetchMetadata_ = true; + } + _this.completeTransitions_(); + }, _this.errorHandler_); + }); + }; + UploadTask.prototype.continueUpload_ = function () { + var _this = this; + var chunkSize = __WEBPACK_IMPORTED_MODULE_8__implementation_requests__["h" /* resumableUploadChunkSize */] * this.chunkMultiplier_; + var status = new __WEBPACK_IMPORTED_MODULE_8__implementation_requests__["a" /* ResumableUploadStatus */](this.transferred_, this.blob_.size()); + // TODO(andysoto): assert(this.uploadUrl_ !== null); + var url = this.uploadUrl_; + this.resolveToken_(function (authToken) { + var requestInfo; + try { + requestInfo = __WEBPACK_IMPORTED_MODULE_8__implementation_requests__["b" /* continueResumableUpload */](_this.location_, _this.authWrapper_, url, _this.blob_, chunkSize, _this.mappings_, status, _this.makeProgressCallback_()); + } + catch (e) { + _this.error_ = e; + _this.transition_(__WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].ERROR); + return; + } + var uploadRequest = _this.authWrapper_.makeRequest(requestInfo, authToken); + _this.request_ = uploadRequest; + uploadRequest + .getPromise() + .then(function (newStatus) { + _this.increaseMultiplier_(); + _this.request_ = null; + _this.updateProgress_(newStatus.current); + if (newStatus.finalized) { + _this.metadata_ = newStatus.metadata; + _this.transition_(__WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].SUCCESS); + } + else { + _this.completeTransitions_(); + } + }, _this.errorHandler_); + }); + }; + UploadTask.prototype.increaseMultiplier_ = function () { + var currentSize = __WEBPACK_IMPORTED_MODULE_8__implementation_requests__["h" /* resumableUploadChunkSize */] * this.chunkMultiplier_; + // Max chunk size is 32M. + if (currentSize < 32 * 1024 * 1024) { + this.chunkMultiplier_ *= 2; + } + }; + UploadTask.prototype.fetchMetadata_ = function () { + var _this = this; + this.resolveToken_(function (authToken) { + var requestInfo = __WEBPACK_IMPORTED_MODULE_8__implementation_requests__["e" /* getMetadata */](_this.authWrapper_, _this.location_, _this.mappings_); + var metadataRequest = _this.authWrapper_.makeRequest(requestInfo, authToken); + _this.request_ = metadataRequest; + metadataRequest.getPromise().then(function (metadata) { + _this.request_ = null; + _this.metadata_ = metadata; + _this.transition_(__WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].SUCCESS); + }, _this.metadataErrorHandler_); + }); + }; + UploadTask.prototype.oneShotUpload_ = function () { + var _this = this; + this.resolveToken_(function (authToken) { + var requestInfo = __WEBPACK_IMPORTED_MODULE_8__implementation_requests__["g" /* multipartUpload */](_this.authWrapper_, _this.location_, _this.mappings_, _this.blob_, _this.metadata_); + var multipartRequest = _this.authWrapper_.makeRequest(requestInfo, authToken); + _this.request_ = multipartRequest; + multipartRequest.getPromise().then(function (metadata) { + _this.request_ = null; + _this.metadata_ = metadata; + _this.updateProgress_(_this.blob_.size()); + _this.transition_(__WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].SUCCESS); + }, _this.errorHandler_); + }); + }; + UploadTask.prototype.updateProgress_ = function (transferred) { + var old = this.transferred_; + this.transferred_ = transferred; + // A progress update can make the "transferred" value smaller (e.g. a + // partial upload not completed by server, after which the "transferred" + // value may reset to the value at the beginning of the request). + if (this.transferred_ !== old) { + this.notifyObservers_(); + } + }; + UploadTask.prototype.transition_ = function (state) { + if (this.state_ === state) { + return; + } + switch (state) { + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].CANCELING: + // TODO(andysoto): + // assert(this.state_ === InternalTaskState.RUNNING || + // this.state_ === InternalTaskState.PAUSING); + this.state_ = state; + if (this.request_ !== null) { + this.request_.cancel(); + } + break; + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].PAUSING: + // TODO(andysoto): + // assert(this.state_ === InternalTaskState.RUNNING); + this.state_ = state; + if (this.request_ !== null) { + this.request_.cancel(); + } + break; + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].RUNNING: + // TODO(andysoto): + // assert(this.state_ === InternalTaskState.PAUSED || + // this.state_ === InternalTaskState.PAUSING); + var wasPaused = this.state_ === __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].PAUSED; + this.state_ = state; + if (wasPaused) { + this.notifyObservers_(); + this.start_(); + } + break; + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].PAUSED: + // TODO(andysoto): + // assert(this.state_ === InternalTaskState.PAUSING); + this.state_ = state; + this.notifyObservers_(); + break; + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].CANCELED: + // TODO(andysoto): + // assert(this.state_ === InternalTaskState.PAUSED || + // this.state_ === InternalTaskState.CANCELING); + this.error_ = __WEBPACK_IMPORTED_MODULE_6__implementation_error__["c" /* canceled */](); + this.state_ = state; + this.notifyObservers_(); + break; + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].ERROR: + // TODO(andysoto): + // assert(this.state_ === InternalTaskState.RUNNING || + // this.state_ === InternalTaskState.PAUSING || + // this.state_ === InternalTaskState.CANCELING); + this.state_ = state; + this.notifyObservers_(); + break; + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].SUCCESS: + // TODO(andysoto): + // assert(this.state_ === InternalTaskState.RUNNING || + // this.state_ === InternalTaskState.PAUSING || + // this.state_ === InternalTaskState.CANCELING); + this.state_ = state; + this.notifyObservers_(); + break; + } + }; + UploadTask.prototype.completeTransitions_ = function () { + switch (this.state_) { + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].PAUSING: + this.transition_(__WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].PAUSED); + break; + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].CANCELING: + this.transition_(__WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].CANCELED); + break; + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].RUNNING: + this.start_(); + break; + default: + // TODO(andysoto): assert(false); + break; + } + }; + Object.defineProperty(UploadTask.prototype, "snapshot", { + get: function () { + var externalState = __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["d" /* taskStateFromInternalTaskState */](this.state_); + return new __WEBPACK_IMPORTED_MODULE_2__tasksnapshot__["a" /* UploadTaskSnapshot */](this.transferred_, this.blob_.size(), externalState, this.metadata_, this, this.ref_); + }, + enumerable: true, + configurable: true + }); + /** + * Adds a callback for an event. + * @param type The type of event to listen for. + */ + UploadTask.prototype.on = function (type, nextOrObserver, error, completed) { + if (nextOrObserver === void 0) { nextOrObserver = undefined; } + if (error === void 0) { error = undefined; } + if (completed === void 0) { completed = undefined; } + function typeValidator(_p) { + if (type !== __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["b" /* TaskEvent */].STATE_CHANGED) { + throw "Expected one of the event types: [" + __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["b" /* TaskEvent */].STATE_CHANGED + "]."; + } + } + var nextOrObserverMessage = 'Expected a function or an Object with one of ' + + '`next`, `error`, `complete` properties.'; + var nextValidator = __WEBPACK_IMPORTED_MODULE_3__implementation_args__["d" /* nullFunctionSpec */](true).validator; + var observerValidator = __WEBPACK_IMPORTED_MODULE_3__implementation_args__["a" /* looseObjectSpec */](null, true).validator; + function nextOrObserverValidator(p) { + try { + nextValidator(p); + return; + } + catch (e) { } + try { + observerValidator(p); + var anyDefined = __WEBPACK_IMPORTED_MODULE_9__implementation_type__["c" /* isJustDef */](p['next']) || + __WEBPACK_IMPORTED_MODULE_9__implementation_type__["c" /* isJustDef */](p['error']) || + __WEBPACK_IMPORTED_MODULE_9__implementation_type__["c" /* isJustDef */](p['complete']); + if (!anyDefined) { + throw ''; + } + return; + } + catch (e) { + throw nextOrObserverMessage; + } + } + var specs = [ + __WEBPACK_IMPORTED_MODULE_3__implementation_args__["e" /* stringSpec */](typeValidator), + __WEBPACK_IMPORTED_MODULE_3__implementation_args__["a" /* looseObjectSpec */](nextOrObserverValidator, true), + __WEBPACK_IMPORTED_MODULE_3__implementation_args__["d" /* nullFunctionSpec */](true), + __WEBPACK_IMPORTED_MODULE_3__implementation_args__["d" /* nullFunctionSpec */](true) + ]; + __WEBPACK_IMPORTED_MODULE_3__implementation_args__["g" /* validate */]('on', specs, arguments); + var self = this; + function makeBinder(specs) { + function binder(nextOrObserver, error, opt_complete) { + if (specs !== null) { + __WEBPACK_IMPORTED_MODULE_3__implementation_args__["g" /* validate */]('on', specs, arguments); + } + var observer = new __WEBPACK_IMPORTED_MODULE_1__implementation_observer__["a" /* Observer */](nextOrObserver, error, completed); + self.addObserver_(observer); + return function () { + self.removeObserver_(observer); + }; + } + return binder; + } + function binderNextOrObserverValidator(p) { + if (p === null) { + throw nextOrObserverMessage; + } + nextOrObserverValidator(p); + } + var binderSpecs = [ + __WEBPACK_IMPORTED_MODULE_3__implementation_args__["a" /* looseObjectSpec */](binderNextOrObserverValidator), + __WEBPACK_IMPORTED_MODULE_3__implementation_args__["d" /* nullFunctionSpec */](true), + __WEBPACK_IMPORTED_MODULE_3__implementation_args__["d" /* nullFunctionSpec */](true) + ]; + var typeOnly = !(__WEBPACK_IMPORTED_MODULE_9__implementation_type__["c" /* isJustDef */](nextOrObserver) || + __WEBPACK_IMPORTED_MODULE_9__implementation_type__["c" /* isJustDef */](error) || + __WEBPACK_IMPORTED_MODULE_9__implementation_type__["c" /* isJustDef */](completed)); + if (typeOnly) { + return makeBinder(binderSpecs); + } + else { + return makeBinder(null)(nextOrObserver, error, completed); + } + }; + /** + * This object behaves like a Promise, and resolves with its snapshot data + * when the upload completes. + * @param onFulfilled The fulfillment callback. Promise chaining works as normal. + * @param onRejected The rejection callback. + */ + UploadTask.prototype.then = function (onFulfilled, onRejected) { + // These casts are needed so that TypeScript can infer the types of the + // resulting Promise. + return this.promise_.then(onFulfilled, onRejected); + }; + /** + * Equivalent to calling `then(null, onRejected)`. + */ + UploadTask.prototype.catch = function (onRejected) { + return this.then(null, onRejected); + }; + /** + * Adds the given observer. + */ + UploadTask.prototype.addObserver_ = function (observer) { + this.observers_.push(observer); + this.notifyObserver_(observer); + }; + /** + * Removes the given observer. + */ + UploadTask.prototype.removeObserver_ = function (observer) { + __WEBPACK_IMPORTED_MODULE_4__implementation_array__["c" /* remove */](this.observers_, observer); + }; + UploadTask.prototype.notifyObservers_ = function () { + var _this = this; + this.finishPromise_(); + var observers = __WEBPACK_IMPORTED_MODULE_4__implementation_array__["a" /* clone */](this.observers_); + observers.forEach(function (observer) { + _this.notifyObserver_(observer); + }); + }; + UploadTask.prototype.finishPromise_ = function () { + if (this.resolve_ !== null) { + var triggered = true; + switch (__WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["d" /* taskStateFromInternalTaskState */](this.state_)) { + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["c" /* TaskState */].SUCCESS: + Object(__WEBPACK_IMPORTED_MODULE_5__implementation_async__["a" /* async */])(this.resolve_.bind(null, this.snapshot))(); + break; + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["c" /* TaskState */].CANCELED: + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["c" /* TaskState */].ERROR: + var toCall = this.reject_; + Object(__WEBPACK_IMPORTED_MODULE_5__implementation_async__["a" /* async */])(toCall.bind(null, this.error_))(); + break; + default: + triggered = false; + break; + } + if (triggered) { + this.resolve_ = null; + this.reject_ = null; + } + } + }; + UploadTask.prototype.notifyObserver_ = function (observer) { + var externalState = __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["d" /* taskStateFromInternalTaskState */](this.state_); + switch (externalState) { + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["c" /* TaskState */].RUNNING: + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["c" /* TaskState */].PAUSED: + if (observer.next !== null) { + Object(__WEBPACK_IMPORTED_MODULE_5__implementation_async__["a" /* async */])(observer.next.bind(observer, this.snapshot))(); + } + break; + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["c" /* TaskState */].SUCCESS: + if (observer.complete !== null) { + Object(__WEBPACK_IMPORTED_MODULE_5__implementation_async__["a" /* async */])(observer.complete.bind(observer))(); + } + break; + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["c" /* TaskState */].CANCELED: + case __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["c" /* TaskState */].ERROR: + if (observer.error !== null) { + Object(__WEBPACK_IMPORTED_MODULE_5__implementation_async__["a" /* async */])(observer.error.bind(observer, this.error_))(); + } + break; + default: + // TODO(andysoto): assert(false); + if (observer.error !== null) { + Object(__WEBPACK_IMPORTED_MODULE_5__implementation_async__["a" /* async */])(observer.error.bind(observer, this.error_))(); + } + } + }; + /** + * Resumes a paused task. Has no effect on a currently running or failed task. + * @return True if the operation took effect, false if ignored. + */ + UploadTask.prototype.resume = function () { + __WEBPACK_IMPORTED_MODULE_3__implementation_args__["g" /* validate */]('resume', [], arguments); + var valid = this.state_ === __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].PAUSED || + this.state_ === __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].PAUSING; + if (valid) { + this.transition_(__WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].RUNNING); + } + return valid; + }; + /** + * Pauses a currently running task. Has no effect on a paused or failed task. + * @return True if the operation took effect, false if ignored. + */ + UploadTask.prototype.pause = function () { + __WEBPACK_IMPORTED_MODULE_3__implementation_args__["g" /* validate */]('pause', [], arguments); + var valid = this.state_ === __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].RUNNING; + if (valid) { + this.transition_(__WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].PAUSING); + } + return valid; + }; + /** + * Cancels a currently running or paused task. Has no effect on a complete or + * failed task. + * @return True if the operation took effect, false if ignored. + */ + UploadTask.prototype.cancel = function () { + __WEBPACK_IMPORTED_MODULE_3__implementation_args__["g" /* validate */]('cancel', [], arguments); + var valid = this.state_ === __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].RUNNING || + this.state_ === __WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].PAUSING; + if (valid) { + this.transition_(__WEBPACK_IMPORTED_MODULE_0__implementation_taskenums__["a" /* InternalTaskState */].CANCELING); + } + return valid; + }; + return UploadTask; +}()); + + +//# sourceMappingURL=task.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/storage/dist/esm/src/tasksnapshot.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@firebase/storage/dist/esm/src/tasksnapshot.js ***! + \*********************************************************************/ +/*! exports provided: UploadTaskSnapshot */ +/*! exports used: UploadTaskSnapshot */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return UploadTaskSnapshot; }); +var UploadTaskSnapshot = /** @class */ (function () { + function UploadTaskSnapshot(bytesTransferred, totalBytes, state, metadata, task, ref) { + this.bytesTransferred = bytesTransferred; + this.totalBytes = totalBytes; + this.state = state; + this.metadata = metadata; + this.task = task; + this.ref = ref; + } + Object.defineProperty(UploadTaskSnapshot.prototype, "downloadURL", { + get: function () { + if (this.metadata !== null) { + var urls = this.metadata['downloadURLs']; + if (urls != null && urls[0] != null) { + return urls[0]; + } + else { + return null; + } + } + else { + return null; + } + }, + enumerable: true, + configurable: true + }); + return UploadTaskSnapshot; +}()); + + +//# sourceMappingURL=tasksnapshot.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/util/dist/cjs/index.js": +/*!*******************************************************!*\ + !*** ./node_modules/@firebase/util/dist/cjs/index.js ***! + \*******************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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. + */ +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", { value: true }); +__export(__webpack_require__(/*! ./src/assert */ "./node_modules/@firebase/util/dist/cjs/src/assert.js")); +__export(__webpack_require__(/*! ./src/crypt */ "./node_modules/@firebase/util/dist/cjs/src/crypt.js")); +__export(__webpack_require__(/*! ./src/constants */ "./node_modules/@firebase/util/dist/cjs/src/constants.js")); +__export(__webpack_require__(/*! ./src/deepCopy */ "./node_modules/@firebase/util/dist/cjs/src/deepCopy.js")); +__export(__webpack_require__(/*! ./src/deferred */ "./node_modules/@firebase/util/dist/cjs/src/deferred.js")); +__export(__webpack_require__(/*! ./src/environment */ "./node_modules/@firebase/util/dist/cjs/src/environment.js")); +__export(__webpack_require__(/*! ./src/errors */ "./node_modules/@firebase/util/dist/cjs/src/errors.js")); +__export(__webpack_require__(/*! ./src/json */ "./node_modules/@firebase/util/dist/cjs/src/json.js")); +__export(__webpack_require__(/*! ./src/jwt */ "./node_modules/@firebase/util/dist/cjs/src/jwt.js")); +__export(__webpack_require__(/*! ./src/obj */ "./node_modules/@firebase/util/dist/cjs/src/obj.js")); +__export(__webpack_require__(/*! ./src/query */ "./node_modules/@firebase/util/dist/cjs/src/query.js")); +__export(__webpack_require__(/*! ./src/sha1 */ "./node_modules/@firebase/util/dist/cjs/src/sha1.js")); +__export(__webpack_require__(/*! ./src/subscribe */ "./node_modules/@firebase/util/dist/cjs/src/subscribe.js")); +__export(__webpack_require__(/*! ./src/validation */ "./node_modules/@firebase/util/dist/cjs/src/validation.js")); +__export(__webpack_require__(/*! ./src/utf8 */ "./node_modules/@firebase/util/dist/cjs/src/utf8.js")); + +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/util/dist/cjs/src/assert.js": +/*!************************************************************!*\ + !*** ./node_modules/@firebase/util/dist/cjs/src/assert.js ***! + \************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 constants_1 = __webpack_require__(/*! ./constants */ "./node_modules/@firebase/util/dist/cjs/src/constants.js"); +/** + * Throws an error if the provided assertion is falsy + * @param {*} assertion The assertion to be tested for falsiness + * @param {!string} message The message to display if the check fails + */ +exports.assert = function (assertion, message) { + if (!assertion) { + throw exports.assertionError(message); + } +}; +/** + * Returns an Error object suitable for throwing. + * @param {string} message + * @return {!Error} + */ +exports.assertionError = function (message) { + return new Error('Firebase Database (' + + constants_1.CONSTANTS.SDK_VERSION + + ') INTERNAL ASSERT FAILED: ' + + message); +}; + +//# sourceMappingURL=assert.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/util/dist/cjs/src/constants.js": +/*!***************************************************************!*\ + !*** ./node_modules/@firebase/util/dist/cjs/src/constants.js ***! + \***************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 }); +/** + * @fileoverview Firebase constants. Some of these (@defines) can be overridden at compile-time. + */ +exports.CONSTANTS = { + /** + * @define {boolean} Whether this is the client Node.js SDK. + */ + NODE_CLIENT: false, + /** + * @define {boolean} Whether this is the Admin Node.js SDK. + */ + NODE_ADMIN: false, + /** + * Firebase SDK Version + */ + SDK_VERSION: '${JSCORE_VERSION}' +}; + +//# sourceMappingURL=constants.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/util/dist/cjs/src/crypt.js": +/*!***********************************************************!*\ + !*** ./node_modules/@firebase/util/dist/cjs/src/crypt.js ***! + \***********************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 stringToByteArray = function (str) { + // TODO(user): Use native implementations if/when available + var out = [], p = 0; + for (var i = 0; i < str.length; i++) { + var c = str.charCodeAt(i); + if (c < 128) { + out[p++] = c; + } + else if (c < 2048) { + out[p++] = (c >> 6) | 192; + out[p++] = (c & 63) | 128; + } + else if ((c & 0xfc00) == 0xd800 && + i + 1 < str.length && + (str.charCodeAt(i + 1) & 0xfc00) == 0xdc00) { + // Surrogate Pair + c = 0x10000 + ((c & 0x03ff) << 10) + (str.charCodeAt(++i) & 0x03ff); + out[p++] = (c >> 18) | 240; + out[p++] = ((c >> 12) & 63) | 128; + out[p++] = ((c >> 6) & 63) | 128; + out[p++] = (c & 63) | 128; + } + else { + out[p++] = (c >> 12) | 224; + out[p++] = ((c >> 6) & 63) | 128; + out[p++] = (c & 63) | 128; + } + } + return out; +}; +/** + * Turns an array of numbers into the string given by the concatenation of the + * characters to which the numbers correspond. + * @param {Array} bytes Array of numbers representing characters. + * @return {string} Stringification of the array. + */ +var byteArrayToString = function (bytes) { + // TODO(user): Use native implementations if/when available + var out = [], pos = 0, c = 0; + while (pos < bytes.length) { + var c1 = bytes[pos++]; + if (c1 < 128) { + out[c++] = String.fromCharCode(c1); + } + else if (c1 > 191 && c1 < 224) { + var c2 = bytes[pos++]; + out[c++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63)); + } + else if (c1 > 239 && c1 < 365) { + // Surrogate Pair + var c2 = bytes[pos++]; + var c3 = bytes[pos++]; + var c4 = bytes[pos++]; + var u = (((c1 & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | (c4 & 63)) - + 0x10000; + out[c++] = String.fromCharCode(0xd800 + (u >> 10)); + out[c++] = String.fromCharCode(0xdc00 + (u & 1023)); + } + else { + var c2 = bytes[pos++]; + var c3 = bytes[pos++]; + out[c++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); + } + } + return out.join(''); +}; +// Static lookup maps, lazily populated by init_() +exports.base64 = { + /** + * Maps bytes to characters. + * @type {Object} + * @private + */ + byteToCharMap_: null, + /** + * Maps characters to bytes. + * @type {Object} + * @private + */ + charToByteMap_: null, + /** + * Maps bytes to websafe characters. + * @type {Object} + * @private + */ + byteToCharMapWebSafe_: null, + /** + * Maps websafe characters to bytes. + * @type {Object} + * @private + */ + charToByteMapWebSafe_: null, + /** + * Our default alphabet, shared between + * ENCODED_VALS and ENCODED_VALS_WEBSAFE + * @type {string} + */ + ENCODED_VALS_BASE: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz' + '0123456789', + /** + * Our default alphabet. Value 64 (=) is special; it means "nothing." + * @type {string} + */ + get ENCODED_VALS() { + return this.ENCODED_VALS_BASE + '+/='; + }, + /** + * Our websafe alphabet. + * @type {string} + */ + get ENCODED_VALS_WEBSAFE() { + return this.ENCODED_VALS_BASE + '-_.'; + }, + /** + * Whether this browser supports the atob and btoa functions. This extension + * started at Mozilla but is now implemented by many browsers. We use the + * ASSUME_* variables to avoid pulling in the full useragent detection library + * but still allowing the standard per-browser compilations. + * + * @type {boolean} + */ + HAS_NATIVE_SUPPORT: typeof atob === 'function', + /** + * Base64-encode an array of bytes. + * + * @param {Array|Uint8Array} input An array of bytes (numbers with + * value in [0, 255]) to encode. + * @param {boolean=} opt_webSafe Boolean indicating we should use the + * alternative alphabet. + * @return {string} The base64 encoded string. + */ + encodeByteArray: function (input, opt_webSafe) { + if (!Array.isArray(input)) { + throw Error('encodeByteArray takes an array as a parameter'); + } + this.init_(); + var byteToCharMap = opt_webSafe + ? this.byteToCharMapWebSafe_ + : this.byteToCharMap_; + var output = []; + for (var i = 0; i < input.length; i += 3) { + var byte1 = input[i]; + var haveByte2 = i + 1 < input.length; + var byte2 = haveByte2 ? input[i + 1] : 0; + var haveByte3 = i + 2 < input.length; + var byte3 = haveByte3 ? input[i + 2] : 0; + var outByte1 = byte1 >> 2; + var outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4); + var outByte3 = ((byte2 & 0x0f) << 2) | (byte3 >> 6); + var outByte4 = byte3 & 0x3f; + if (!haveByte3) { + outByte4 = 64; + if (!haveByte2) { + outByte3 = 64; + } + } + output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]); + } + return output.join(''); + }, + /** + * Base64-encode a string. + * + * @param {string} input A string to encode. + * @param {boolean=} opt_webSafe If true, we should use the + * alternative alphabet. + * @return {string} The base64 encoded string. + */ + encodeString: function (input, opt_webSafe) { + // Shortcut for Mozilla browsers that implement + // a native base64 encoder in the form of "btoa/atob" + if (this.HAS_NATIVE_SUPPORT && !opt_webSafe) { + return btoa(input); + } + return this.encodeByteArray(stringToByteArray(input), opt_webSafe); + }, + /** + * Base64-decode a string. + * + * @param {string} input to decode. + * @param {boolean=} opt_webSafe True if we should use the + * alternative alphabet. + * @return {string} string representing the decoded value. + */ + decodeString: function (input, opt_webSafe) { + // Shortcut for Mozilla browsers that implement + // a native base64 encoder in the form of "btoa/atob" + if (this.HAS_NATIVE_SUPPORT && !opt_webSafe) { + return atob(input); + } + return byteArrayToString(this.decodeStringToByteArray(input, opt_webSafe)); + }, + /** + * Base64-decode a string. + * + * In base-64 decoding, groups of four characters are converted into three + * bytes. If the encoder did not apply padding, the input length may not + * be a multiple of 4. + * + * In this case, the last group will have fewer than 4 characters, and + * padding will be inferred. If the group has one or two characters, it decodes + * to one byte. If the group has three characters, it decodes to two bytes. + * + * @param {string} input Input to decode. + * @param {boolean=} opt_webSafe True if we should use the web-safe alphabet. + * @return {!Array} bytes representing the decoded value. + */ + decodeStringToByteArray: function (input, opt_webSafe) { + this.init_(); + var charToByteMap = opt_webSafe + ? this.charToByteMapWebSafe_ + : this.charToByteMap_; + var output = []; + for (var i = 0; i < input.length;) { + var byte1 = charToByteMap[input.charAt(i++)]; + var haveByte2 = i < input.length; + var byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0; + ++i; + var haveByte3 = i < input.length; + var byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64; + ++i; + var haveByte4 = i < input.length; + var byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64; + ++i; + if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) { + throw Error(); + } + var outByte1 = (byte1 << 2) | (byte2 >> 4); + output.push(outByte1); + if (byte3 != 64) { + var outByte2 = ((byte2 << 4) & 0xf0) | (byte3 >> 2); + output.push(outByte2); + if (byte4 != 64) { + var outByte3 = ((byte3 << 6) & 0xc0) | byte4; + output.push(outByte3); + } + } + } + return output; + }, + /** + * Lazy static initialization function. Called before + * accessing any of the static map variables. + * @private + */ + init_: function () { + if (!this.byteToCharMap_) { + this.byteToCharMap_ = {}; + this.charToByteMap_ = {}; + this.byteToCharMapWebSafe_ = {}; + this.charToByteMapWebSafe_ = {}; + // We want quick mappings back and forth, so we precompute two maps. + for (var i = 0; i < this.ENCODED_VALS.length; i++) { + this.byteToCharMap_[i] = this.ENCODED_VALS.charAt(i); + this.charToByteMap_[this.byteToCharMap_[i]] = i; + this.byteToCharMapWebSafe_[i] = this.ENCODED_VALS_WEBSAFE.charAt(i); + this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[i]] = i; + // Be forgiving when decoding and correctly decode both encodings. + if (i >= this.ENCODED_VALS_BASE.length) { + this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)] = i; + this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)] = i; + } + } + } + } +}; +/** + * URL-safe base64 encoding + * @param {!string} str + * @return {!string} + */ +exports.base64Encode = function (str) { + var utf8Bytes = stringToByteArray(str); + return exports.base64.encodeByteArray(utf8Bytes, true); +}; +/** + * URL-safe base64 decoding + * + * NOTE: DO NOT use the global atob() function - it does NOT support the + * base64Url variant encoding. + * + * @param {string} str To be decoded + * @return {?string} Decoded result, if possible + */ +exports.base64Decode = function (str) { + try { + return exports.base64.decodeString(str, true); + } + catch (e) { + console.error('base64Decode failed: ', e); + } + return null; +}; + +//# sourceMappingURL=crypt.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/util/dist/cjs/src/deepCopy.js": +/*!**************************************************************!*\ + !*** ./node_modules/@firebase/util/dist/cjs/src/deepCopy.js ***! + \**************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 }); +/** + * Do a deep-copy of basic JavaScript Objects or Arrays. + */ +function deepCopy(value) { + return deepExtend(undefined, value); +} +exports.deepCopy = deepCopy; +/** + * Copy properties from source to target (recursively allows extension + * of Objects and Arrays). Scalar values in the target are over-written. + * If target is undefined, an object of the appropriate type will be created + * (and returned). + * + * We recursively copy all child properties of plain Objects in the source- so + * that namespace- like dictionaries are merged. + * + * Note that the target can be a function, in which case the properties in + * the source Object are copied onto it as static properties of the Function. + */ +function deepExtend(target, source) { + if (!(source instanceof Object)) { + return source; + } + switch (source.constructor) { + case Date: + // Treat Dates like scalars; if the target date object had any child + // properties - they will be lost! + var dateValue = source; + return new Date(dateValue.getTime()); + case Object: + if (target === undefined) { + target = {}; + } + break; + case Array: + // Always copy the array source and overwrite the target. + target = []; + break; + default: + // Not a plain Object - treat it as a scalar. + return source; + } + for (var prop in source) { + if (!source.hasOwnProperty(prop)) { + continue; + } + target[prop] = deepExtend(target[prop], source[prop]); + } + return target; +} +exports.deepExtend = deepExtend; +// TODO: Really needed (for JSCompiler type checking)? +function patchProperty(obj, prop, value) { + obj[prop] = value; +} +exports.patchProperty = patchProperty; + +//# sourceMappingURL=deepCopy.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/util/dist/cjs/src/deferred.js": +/*!**************************************************************!*\ + !*** ./node_modules/@firebase/util/dist/cjs/src/deferred.js ***! + \**************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 Deferred = /** @class */ (function () { + function Deferred() { + var _this = this; + this.promise = new Promise(function (resolve, reject) { + _this.resolve = resolve; + _this.reject = reject; + }); + } + /** + * Our API internals are not promiseified and cannot because our callback APIs have subtle expectations around + * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback + * and returns a node-style callback which will resolve or reject the Deferred's promise. + * @param {((?function(?(Error)): (?|undefined))| (?function(?(Error),?=): (?|undefined)))=} callback + * @return {!function(?(Error), ?=)} + */ + Deferred.prototype.wrapCallback = function (callback) { + var _this = this; + return function (error, value) { + if (error) { + _this.reject(error); + } + else { + _this.resolve(value); + } + if (typeof callback === 'function') { + // Attaching noop handler just in case developer wasn't expecting + // promises + _this.promise.catch(function () { }); + // Some of our callbacks don't expect a value and our own tests + // assert that the parameter length is 1 + if (callback.length === 1) { + callback(error); + } + else { + callback(error, value); + } + } + }; + }; + return Deferred; +}()); +exports.Deferred = Deferred; + +//# sourceMappingURL=deferred.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/util/dist/cjs/src/environment.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@firebase/util/dist/cjs/src/environment.js ***! + \*****************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 constants_1 = __webpack_require__(/*! ./constants */ "./node_modules/@firebase/util/dist/cjs/src/constants.js"); +/** + * Returns navigator.userAgent string or '' if it's not defined. + * @return {string} user agent string + */ +exports.getUA = function () { + if (typeof navigator !== 'undefined' && + typeof navigator['userAgent'] === 'string') { + return navigator['userAgent']; + } + else { + return ''; + } +}; +/** + * Detect Cordova / PhoneGap / Ionic frameworks on a mobile device. + * + * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap in the Ripple emulator) nor + * Cordova `onDeviceReady`, which would normally wait for a callback. + * + * @return {boolean} isMobileCordova + */ +exports.isMobileCordova = function () { + return (typeof window !== 'undefined' && + !!(window['cordova'] || window['phonegap'] || window['PhoneGap']) && + /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(exports.getUA())); +}; +/** + * Detect React Native. + * + * @return {boolean} True if ReactNative environment is detected. + */ +exports.isReactNative = function () { + return (typeof navigator === 'object' && navigator['product'] === 'ReactNative'); +}; +/** + * Detect Node.js. + * + * @return {boolean} True if Node.js environment is detected. + */ +exports.isNodeSdk = function () { + return constants_1.CONSTANTS.NODE_CLIENT === true || constants_1.CONSTANTS.NODE_ADMIN === true; +}; + +//# sourceMappingURL=environment.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/util/dist/cjs/src/errors.js": +/*!************************************************************!*\ + !*** ./node_modules/@firebase/util/dist/cjs/src/errors.js ***! + \************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var ERROR_NAME = 'FirebaseError'; +var captureStackTrace = Error + .captureStackTrace; +// Export for faking in tests +function patchCapture(captureFake) { + var result = captureStackTrace; + captureStackTrace = captureFake; + return result; +} +exports.patchCapture = patchCapture; +var FirebaseError = /** @class */ (function () { + function FirebaseError(code, message) { + this.code = code; + this.message = message; + var stack; + // We want the stack value, if implemented by Error + if (captureStackTrace) { + // Patches this.stack, omitted calls above ErrorFactory#create + captureStackTrace(this, ErrorFactory.prototype.create); + } + else { + var err_1 = Error.apply(this, arguments); + this.name = ERROR_NAME; + // Make non-enumerable getter for the property. + Object.defineProperty(this, 'stack', { + get: function () { + return err_1.stack; + } + }); + } + } + return FirebaseError; +}()); +exports.FirebaseError = FirebaseError; +// Back-door inheritance +FirebaseError.prototype = Object.create(Error.prototype); +FirebaseError.prototype.constructor = FirebaseError; +FirebaseError.prototype.name = ERROR_NAME; +var ErrorFactory = /** @class */ (function () { + function ErrorFactory(service, serviceName, errors) { + this.service = service; + this.serviceName = serviceName; + this.errors = errors; + // Matches {$name}, by default. + this.pattern = /\{\$([^}]+)}/g; + // empty + } + ErrorFactory.prototype.create = function (code, data) { + if (data === undefined) { + data = {}; + } + var template = this.errors[code]; + var fullCode = this.service + '/' + code; + var message; + if (template === undefined) { + message = 'Error'; + } + else { + message = template.replace(this.pattern, function (match, key) { + var value = data[key]; + return value !== undefined ? value.toString() : '<' + key + '?>'; + }); + } + // Service: Error message (service/code). + message = this.serviceName + ': ' + message + ' (' + fullCode + ').'; + var err = new FirebaseError(fullCode, message); + // Populate the Error object with message parts for programmatic + // accesses (e.g., e.file). + for (var prop in data) { + if (!data.hasOwnProperty(prop) || prop.slice(-1) === '_') { + continue; + } + err[prop] = data[prop]; + } + return err; + }; + return ErrorFactory; +}()); +exports.ErrorFactory = ErrorFactory; + +//# sourceMappingURL=errors.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/util/dist/cjs/src/hash.js": +/*!**********************************************************!*\ + !*** ./node_modules/@firebase/util/dist/cjs/src/hash.js ***! + \**********************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 }); +// Copyright 2011 The Closure Library Authors. 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 +// +// 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. +/** + * @fileoverview Abstract cryptographic hash interface. + * + * See Sha1 and Md5 for sample implementations. + * + */ +/** + * Create a cryptographic hash instance. + * + * @constructor + * @struct + */ +var Hash = /** @class */ (function () { + function Hash() { + /** + * The block size for the hasher. + * @type {number} + */ + this.blockSize = -1; + } + return Hash; +}()); +exports.Hash = Hash; + +//# sourceMappingURL=hash.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/util/dist/cjs/src/json.js": +/*!**********************************************************!*\ + !*** ./node_modules/@firebase/util/dist/cjs/src/json.js ***! + \**********************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 }); +/** + * Evaluates a JSON string into a javascript object. + * + * @param {string} str A string containing JSON. + * @return {*} The javascript object representing the specified JSON. + */ +function jsonEval(str) { + return JSON.parse(str); +} +exports.jsonEval = jsonEval; +/** + * Returns JSON representing a javascript object. + * @param {*} data Javascript object to be stringified. + * @return {string} The JSON contents of the object. + */ +function stringify(data) { + return JSON.stringify(data); +} +exports.stringify = stringify; + +//# sourceMappingURL=json.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/util/dist/cjs/src/jwt.js": +/*!*********************************************************!*\ + !*** ./node_modules/@firebase/util/dist/cjs/src/jwt.js ***! + \*********************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 crypt_1 = __webpack_require__(/*! ./crypt */ "./node_modules/@firebase/util/dist/cjs/src/crypt.js"); +var json_1 = __webpack_require__(/*! ./json */ "./node_modules/@firebase/util/dist/cjs/src/json.js"); +/** + * Decodes a Firebase auth. token into constituent parts. + * + * Notes: + * - May return with invalid / incomplete claims if there's no native base64 decoding support. + * - Doesn't check if the token is actually valid. + * + * @param {?string} token + * @return {{header: *, claims: *, data: *, signature: string}} + */ +exports.decode = function (token) { + var header = {}, claims = {}, data = {}, signature = ''; + try { + var parts = token.split('.'); + header = json_1.jsonEval(crypt_1.base64Decode(parts[0]) || ''); + claims = json_1.jsonEval(crypt_1.base64Decode(parts[1]) || ''); + signature = parts[2]; + data = claims['d'] || {}; + delete claims['d']; + } + catch (e) { } + return { + header: header, + claims: claims, + data: data, + signature: signature + }; +}; +/** + * Decodes a Firebase auth. token and checks the validity of its time-based claims. Will return true if the + * token is within the time window authorized by the 'nbf' (not-before) and 'iat' (issued-at) claims. + * + * Notes: + * - May return a false negative if there's no native base64 decoding support. + * - Doesn't check if the token is actually valid. + * + * @param {?string} token + * @return {boolean} + */ +exports.isValidTimestamp = function (token) { + var claims = exports.decode(token).claims, now = Math.floor(new Date().getTime() / 1000), validSince, validUntil; + if (typeof claims === 'object') { + if (claims.hasOwnProperty('nbf')) { + validSince = claims['nbf']; + } + else if (claims.hasOwnProperty('iat')) { + validSince = claims['iat']; + } + if (claims.hasOwnProperty('exp')) { + validUntil = claims['exp']; + } + else { + // token will expire after 24h by default + validUntil = validSince + 86400; + } + } + return (now && validSince && validUntil && now >= validSince && now <= validUntil); +}; +/** + * Decodes a Firebase auth. token and returns its issued at time if valid, null otherwise. + * + * Notes: + * - May return null if there's no native base64 decoding support. + * - Doesn't check if the token is actually valid. + * + * @param {?string} token + * @return {?number} + */ +exports.issuedAtTime = function (token) { + var claims = exports.decode(token).claims; + if (typeof claims === 'object' && claims.hasOwnProperty('iat')) { + return claims['iat']; + } + return null; +}; +/** + * Decodes a Firebase auth. token and checks the validity of its format. Expects a valid issued-at time and non-empty + * signature. + * + * Notes: + * - May return a false negative if there's no native base64 decoding support. + * - Doesn't check if the token is actually valid. + * + * @param {?string} token + * @return {boolean} + */ +exports.isValidFormat = function (token) { + var decoded = exports.decode(token), claims = decoded.claims; + return (!!decoded.signature && + !!claims && + typeof claims === 'object' && + claims.hasOwnProperty('iat')); +}; +/** + * Attempts to peer into an auth token and determine if it's an admin auth token by looking at the claims portion. + * + * Notes: + * - May return a false negative if there's no native base64 decoding support. + * - Doesn't check if the token is actually valid. + * + * @param {?string} token + * @return {boolean} + */ +exports.isAdmin = function (token) { + var claims = exports.decode(token).claims; + return typeof claims === 'object' && claims['admin'] === true; +}; + +//# sourceMappingURL=jwt.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/util/dist/cjs/src/obj.js": +/*!*********************************************************!*\ + !*** ./node_modules/@firebase/util/dist/cjs/src/obj.js ***! + \*********************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 }); +// See http://www.devthought.com/2012/01/18/an-object-is-not-a-hash/ +exports.contains = function (obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +}; +exports.safeGet = function (obj, key) { + if (Object.prototype.hasOwnProperty.call(obj, key)) + return obj[key]; + // else return undefined. +}; +/** + * Enumerates the keys/values in an object, excluding keys defined on the prototype. + * + * @param {?Object.} obj Object to enumerate. + * @param {!function(K, V)} fn Function to call for each key and value. + * @template K,V + */ +exports.forEach = function (obj, fn) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + fn(key, obj[key]); + } + } +}; +/** + * Copies all the (own) properties from one object to another. + * @param {!Object} objTo + * @param {!Object} objFrom + * @return {!Object} objTo + */ +exports.extend = function (objTo, objFrom) { + exports.forEach(objFrom, function (key, value) { + objTo[key] = value; + }); + return objTo; +}; +/** + * Returns a clone of the specified object. + * @param {!Object} obj + * @return {!Object} cloned obj. + */ +exports.clone = function (obj) { + return exports.extend({}, obj); +}; +/** + * Returns true if obj has typeof "object" and is not null. Unlike goog.isObject(), does not return true + * for functions. + * + * @param obj {*} A potential object. + * @returns {boolean} True if it's an object. + */ +exports.isNonNullObject = function (obj) { + return typeof obj === 'object' && obj !== null; +}; +exports.isEmpty = function (obj) { + for (var key in obj) { + return false; + } + return true; +}; +exports.getCount = function (obj) { + var rv = 0; + for (var key in obj) { + rv++; + } + return rv; +}; +exports.map = function (obj, f, opt_obj) { + var res = {}; + for (var key in obj) { + res[key] = f.call(opt_obj, obj[key], key, obj); + } + return res; +}; +exports.findKey = function (obj, fn, opt_this) { + for (var key in obj) { + if (fn.call(opt_this, obj[key], key, obj)) { + return key; + } + } + return undefined; +}; +exports.findValue = function (obj, fn, opt_this) { + var key = exports.findKey(obj, fn, opt_this); + return key && obj[key]; +}; +exports.getAnyKey = function (obj) { + for (var key in obj) { + return key; + } +}; +exports.getValues = function (obj) { + var res = []; + var i = 0; + for (var key in obj) { + res[i++] = obj[key]; + } + return res; +}; +/** + * Tests whether every key/value pair in an object pass the test implemented + * by the provided function + * + * @param {?Object.} obj Object to test. + * @param {!function(K, V)} fn Function to call for each key and value. + * @template K,V + */ +exports.every = function (obj, fn) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + if (!fn(key, obj[key])) { + return false; + } + } + } + return true; +}; + +//# sourceMappingURL=obj.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/util/dist/cjs/src/query.js": +/*!***********************************************************!*\ + !*** ./node_modules/@firebase/util/dist/cjs/src/query.js ***! + \***********************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 obj_1 = __webpack_require__(/*! ./obj */ "./node_modules/@firebase/util/dist/cjs/src/obj.js"); +/** + * Returns a querystring-formatted string (e.g. &arg=val&arg2=val2) from a params + * object (e.g. {arg: 'val', arg2: 'val2'}) + * Note: You must prepend it with ? when adding it to a URL. + * + * @param {!Object} querystringParams + * @return {string} + */ +exports.querystring = function (querystringParams) { + var params = []; + obj_1.forEach(querystringParams, function (key, value) { + if (Array.isArray(value)) { + value.forEach(function (arrayVal) { + params.push(encodeURIComponent(key) + '=' + encodeURIComponent(arrayVal)); + }); + } + else { + params.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); + } + }); + return params.length ? '&' + params.join('&') : ''; +}; +/** + * Decodes a querystring (e.g. ?arg=val&arg2=val2) into a params object (e.g. {arg: 'val', arg2: 'val2'}) + * + * @param {string} querystring + * @return {!Object} + */ +exports.querystringDecode = function (querystring) { + var obj = {}; + var tokens = querystring.replace(/^\?/, '').split('&'); + tokens.forEach(function (token) { + if (token) { + var key = token.split('='); + obj[key[0]] = key[1]; + } + }); + return obj; +}; + +//# sourceMappingURL=query.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/util/dist/cjs/src/sha1.js": +/*!**********************************************************!*\ + !*** ./node_modules/@firebase/util/dist/cjs/src/sha1.js ***! + \**********************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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. + */ +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 __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var hash_1 = __webpack_require__(/*! ./hash */ "./node_modules/@firebase/util/dist/cjs/src/hash.js"); +/** + * @fileoverview SHA-1 cryptographic hash. + * Variable names follow the notation in FIPS PUB 180-3: + * http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf. + * + * Usage: + * var sha1 = new sha1(); + * sha1.update(bytes); + * var hash = sha1.digest(); + * + * Performance: + * Chrome 23: ~400 Mbit/s + * Firefox 16: ~250 Mbit/s + * + */ +/** + * SHA-1 cryptographic hash constructor. + * + * The properties declared here are discussed in the above algorithm document. + * @constructor + * @extends {Hash} + * @final + * @struct + */ +var Sha1 = /** @class */ (function (_super) { + __extends(Sha1, _super); + function Sha1() { + var _this = _super.call(this) || this; + /** + * Holds the previous values of accumulated variables a-e in the compress_ + * function. + * @type {!Array} + * @private + */ + _this.chain_ = []; + /** + * A buffer holding the partially computed hash result. + * @type {!Array} + * @private + */ + _this.buf_ = []; + /** + * An array of 80 bytes, each a part of the message to be hashed. Referred to + * as the message schedule in the docs. + * @type {!Array} + * @private + */ + _this.W_ = []; + /** + * Contains data needed to pad messages less than 64 bytes. + * @type {!Array} + * @private + */ + _this.pad_ = []; + /** + * @private {number} + */ + _this.inbuf_ = 0; + /** + * @private {number} + */ + _this.total_ = 0; + _this.blockSize = 512 / 8; + _this.pad_[0] = 128; + for (var i = 1; i < _this.blockSize; ++i) { + _this.pad_[i] = 0; + } + _this.reset(); + return _this; + } + Sha1.prototype.reset = function () { + this.chain_[0] = 0x67452301; + this.chain_[1] = 0xefcdab89; + this.chain_[2] = 0x98badcfe; + this.chain_[3] = 0x10325476; + this.chain_[4] = 0xc3d2e1f0; + this.inbuf_ = 0; + this.total_ = 0; + }; + /** + * Internal compress helper function. + * @param {!Array|!Uint8Array|string} buf Block to compress. + * @param {number=} opt_offset Offset of the block in the buffer. + * @private + */ + Sha1.prototype.compress_ = function (buf, opt_offset) { + if (!opt_offset) { + opt_offset = 0; + } + var W = this.W_; + // get 16 big endian words + if (typeof buf === 'string') { + for (var i = 0; i < 16; i++) { + // TODO(user): [bug 8140122] Recent versions of Safari for Mac OS and iOS + // have a bug that turns the post-increment ++ operator into pre-increment + // during JIT compilation. We have code that depends heavily on SHA-1 for + // correctness and which is affected by this bug, so I've removed all uses + // of post-increment ++ in which the result value is used. We can revert + // this change once the Safari bug + // (https://bugs.webkit.org/show_bug.cgi?id=109036) has been fixed and + // most clients have been updated. + W[i] = + (buf.charCodeAt(opt_offset) << 24) | + (buf.charCodeAt(opt_offset + 1) << 16) | + (buf.charCodeAt(opt_offset + 2) << 8) | + buf.charCodeAt(opt_offset + 3); + opt_offset += 4; + } + } + else { + for (var i = 0; i < 16; i++) { + W[i] = + (buf[opt_offset] << 24) | + (buf[opt_offset + 1] << 16) | + (buf[opt_offset + 2] << 8) | + buf[opt_offset + 3]; + opt_offset += 4; + } + } + // expand to 80 words + for (var i = 16; i < 80; i++) { + var t = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; + W[i] = ((t << 1) | (t >>> 31)) & 0xffffffff; + } + var a = this.chain_[0]; + var b = this.chain_[1]; + var c = this.chain_[2]; + var d = this.chain_[3]; + var e = this.chain_[4]; + var f, k; + // TODO(user): Try to unroll this loop to speed up the computation. + for (var i = 0; i < 80; i++) { + if (i < 40) { + if (i < 20) { + f = d ^ (b & (c ^ d)); + k = 0x5a827999; + } + else { + f = b ^ c ^ d; + k = 0x6ed9eba1; + } + } + else { + if (i < 60) { + f = (b & c) | (d & (b | c)); + k = 0x8f1bbcdc; + } + else { + f = b ^ c ^ d; + k = 0xca62c1d6; + } + } + var t = (((a << 5) | (a >>> 27)) + f + e + k + W[i]) & 0xffffffff; + e = d; + d = c; + c = ((b << 30) | (b >>> 2)) & 0xffffffff; + b = a; + a = t; + } + this.chain_[0] = (this.chain_[0] + a) & 0xffffffff; + this.chain_[1] = (this.chain_[1] + b) & 0xffffffff; + this.chain_[2] = (this.chain_[2] + c) & 0xffffffff; + this.chain_[3] = (this.chain_[3] + d) & 0xffffffff; + this.chain_[4] = (this.chain_[4] + e) & 0xffffffff; + }; + Sha1.prototype.update = function (bytes, opt_length) { + // TODO(johnlenz): tighten the function signature and remove this check + if (bytes == null) { + return; + } + if (opt_length === undefined) { + opt_length = bytes.length; + } + var lengthMinusBlock = opt_length - this.blockSize; + var n = 0; + // Using local instead of member variables gives ~5% speedup on Firefox 16. + var buf = this.buf_; + var inbuf = this.inbuf_; + // The outer while loop should execute at most twice. + while (n < opt_length) { + // When we have no data in the block to top up, we can directly process the + // input buffer (assuming it contains sufficient data). This gives ~25% + // speedup on Chrome 23 and ~15% speedup on Firefox 16, but requires that + // the data is provided in large chunks (or in multiples of 64 bytes). + if (inbuf == 0) { + while (n <= lengthMinusBlock) { + this.compress_(bytes, n); + n += this.blockSize; + } + } + if (typeof bytes === 'string') { + while (n < opt_length) { + buf[inbuf] = bytes.charCodeAt(n); + ++inbuf; + ++n; + if (inbuf == this.blockSize) { + this.compress_(buf); + inbuf = 0; + // Jump to the outer loop so we use the full-block optimization. + break; + } + } + } + else { + while (n < opt_length) { + buf[inbuf] = bytes[n]; + ++inbuf; + ++n; + if (inbuf == this.blockSize) { + this.compress_(buf); + inbuf = 0; + // Jump to the outer loop so we use the full-block optimization. + break; + } + } + } + } + this.inbuf_ = inbuf; + this.total_ += opt_length; + }; + /** @override */ + Sha1.prototype.digest = function () { + var digest = []; + var totalBits = this.total_ * 8; + // Add pad 0x80 0x00*. + if (this.inbuf_ < 56) { + this.update(this.pad_, 56 - this.inbuf_); + } + else { + this.update(this.pad_, this.blockSize - (this.inbuf_ - 56)); + } + // Add # bits. + for (var i = this.blockSize - 1; i >= 56; i--) { + this.buf_[i] = totalBits & 255; + totalBits /= 256; // Don't use bit-shifting here! + } + this.compress_(this.buf_); + var n = 0; + for (var i = 0; i < 5; i++) { + for (var j = 24; j >= 0; j -= 8) { + digest[n] = (this.chain_[i] >> j) & 255; + ++n; + } + } + return digest; + }; + return Sha1; +}(hash_1.Hash)); +exports.Sha1 = Sha1; + +//# sourceMappingURL=sha1.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/util/dist/cjs/src/subscribe.js": +/*!***************************************************************!*\ + !*** ./node_modules/@firebase/util/dist/cjs/src/subscribe.js ***! + \***************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Helper to make a Subscribe function (just like Promise helps make a + * Thenable). + * + * @param executor Function which can make calls to a single Observer + * as a proxy. + * @param onNoObservers Callback when count of Observers goes to zero. + */ +function createSubscribe(executor, onNoObservers) { + var proxy = new ObserverProxy(executor, onNoObservers); + return proxy.subscribe.bind(proxy); +} +exports.createSubscribe = createSubscribe; +/** + * Implement fan-out for any number of Observers attached via a subscribe + * function. + */ +var ObserverProxy = /** @class */ (function () { + /** + * @param executor Function which can make calls to a single Observer + * as a proxy. + * @param onNoObservers Callback when count of Observers goes to zero. + */ + function ObserverProxy(executor, onNoObservers) { + var _this = this; + this.observers = []; + this.unsubscribes = []; + this.observerCount = 0; + // Micro-task scheduling by calling task.then(). + this.task = Promise.resolve(); + this.finalized = false; + this.onNoObservers = onNoObservers; + // Call the executor asynchronously so subscribers that are called + // synchronously after the creation of the subscribe function + // can still receive the very first value generated in the executor. + this.task + .then(function () { + executor(_this); + }) + .catch(function (e) { + _this.error(e); + }); + } + ObserverProxy.prototype.next = function (value) { + this.forEachObserver(function (observer) { + observer.next(value); + }); + }; + ObserverProxy.prototype.error = function (error) { + this.forEachObserver(function (observer) { + observer.error(error); + }); + this.close(error); + }; + ObserverProxy.prototype.complete = function () { + this.forEachObserver(function (observer) { + observer.complete(); + }); + this.close(); + }; + /** + * Subscribe function that can be used to add an Observer to the fan-out list. + * + * - We require that no event is sent to a subscriber sychronously to their + * call to subscribe(). + */ + ObserverProxy.prototype.subscribe = function (nextOrObserver, error, complete) { + var _this = this; + var observer; + if (nextOrObserver === undefined && + error === undefined && + complete === undefined) { + throw new Error('Missing Observer.'); + } + // Assemble an Observer object when passed as callback functions. + if (implementsAnyMethods(nextOrObserver, ['next', 'error', 'complete'])) { + observer = nextOrObserver; + } + else { + observer = { + next: nextOrObserver, + error: error, + complete: complete + }; + } + if (observer.next === undefined) { + observer.next = noop; + } + if (observer.error === undefined) { + observer.error = noop; + } + if (observer.complete === undefined) { + observer.complete = noop; + } + var unsub = this.unsubscribeOne.bind(this, this.observers.length); + // Attempt to subscribe to a terminated Observable - we + // just respond to the Observer with the final error or complete + // event. + if (this.finalized) { + this.task.then(function () { + try { + if (_this.finalError) { + observer.error(_this.finalError); + } + else { + observer.complete(); + } + } + catch (e) { + // nothing + } + return; + }); + } + this.observers.push(observer); + return unsub; + }; + // Unsubscribe is synchronous - we guarantee that no events are sent to + // any unsubscribed Observer. + ObserverProxy.prototype.unsubscribeOne = function (i) { + if (this.observers === undefined || this.observers[i] === undefined) { + return; + } + delete this.observers[i]; + this.observerCount -= 1; + if (this.observerCount === 0 && this.onNoObservers !== undefined) { + this.onNoObservers(this); + } + }; + ObserverProxy.prototype.forEachObserver = function (fn) { + if (this.finalized) { + // Already closed by previous event....just eat the additional values. + return; + } + // Since sendOne calls asynchronously - there is no chance that + // this.observers will become undefined. + for (var i = 0; i < this.observers.length; i++) { + this.sendOne(i, fn); + } + }; + // Call the Observer via one of it's callback function. We are careful to + // confirm that the observe has not been unsubscribed since this asynchronous + // function had been queued. + ObserverProxy.prototype.sendOne = function (i, fn) { + var _this = this; + // Execute the callback asynchronously + this.task.then(function () { + if (_this.observers !== undefined && _this.observers[i] !== undefined) { + try { + fn(_this.observers[i]); + } + catch (e) { + // Ignore exceptions raised in Observers or missing methods of an + // Observer. + // Log error to console. b/31404806 + if (typeof console !== 'undefined' && console.error) { + console.error(e); + } + } + } + }); + }; + ObserverProxy.prototype.close = function (err) { + var _this = this; + if (this.finalized) { + return; + } + this.finalized = true; + if (err !== undefined) { + this.finalError = err; + } + // Proxy is no longer needed - garbage collect references + this.task.then(function () { + _this.observers = undefined; + _this.onNoObservers = undefined; + }); + }; + return ObserverProxy; +}()); +/** Turn synchronous function into one called asynchronously. */ +function async(fn, onError) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + Promise.resolve(true) + .then(function () { + fn.apply(void 0, args); + }) + .catch(function (error) { + if (onError) { + onError(error); + } + }); + }; +} +exports.async = async; +/** + * Return true if the object passed in implements any of the named methods. + */ +function implementsAnyMethods(obj, methods) { + if (typeof obj !== 'object' || obj === null) { + return false; + } + for (var _i = 0, methods_1 = methods; _i < methods_1.length; _i++) { + var method = methods_1[_i]; + if (method in obj && typeof obj[method] === 'function') { + return true; + } + } + return false; +} +function noop() { + // do nothing +} + +//# sourceMappingURL=subscribe.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/util/dist/cjs/src/utf8.js": +/*!**********************************************************!*\ + !*** ./node_modules/@firebase/util/dist/cjs/src/utf8.js ***! + \**********************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! ./assert */ "./node_modules/@firebase/util/dist/cjs/src/assert.js"); +// Code originally came from goog.crypt.stringToUtf8ByteArray, but for some reason they +// automatically replaced '\r\n' with '\n', and they didn't handle surrogate pairs, +// so it's been modified. +// Note that not all Unicode characters appear as single characters in JavaScript strings. +// fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters +// use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first +// character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate +// pair). +// See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3 +/** + * @param {string} str + * @return {Array} + */ +exports.stringToByteArray = function (str) { + var out = [], p = 0; + for (var i = 0; i < str.length; i++) { + var c = str.charCodeAt(i); + // Is this the lead surrogate in a surrogate pair? + if (c >= 0xd800 && c <= 0xdbff) { + var high = c - 0xd800; // the high 10 bits. + i++; + assert_1.assert(i < str.length, 'Surrogate pair missing trail surrogate.'); + var low = str.charCodeAt(i) - 0xdc00; // the low 10 bits. + c = 0x10000 + (high << 10) + low; + } + if (c < 128) { + out[p++] = c; + } + else if (c < 2048) { + out[p++] = (c >> 6) | 192; + out[p++] = (c & 63) | 128; + } + else if (c < 65536) { + out[p++] = (c >> 12) | 224; + out[p++] = ((c >> 6) & 63) | 128; + out[p++] = (c & 63) | 128; + } + else { + out[p++] = (c >> 18) | 240; + out[p++] = ((c >> 12) & 63) | 128; + out[p++] = ((c >> 6) & 63) | 128; + out[p++] = (c & 63) | 128; + } + } + return out; +}; +/** + * Calculate length without actually converting; useful for doing cheaper validation. + * @param {string} str + * @return {number} + */ +exports.stringLength = function (str) { + var p = 0; + for (var i = 0; i < str.length; i++) { + var c = str.charCodeAt(i); + if (c < 128) { + p++; + } + else if (c < 2048) { + p += 2; + } + else if (c >= 0xd800 && c <= 0xdbff) { + // Lead surrogate of a surrogate pair. The pair together will take 4 bytes to represent. + p += 4; + i++; // skip trail surrogate. + } + else { + p += 3; + } + } + return p; +}; + +//# sourceMappingURL=utf8.js.map + + +/***/ }), + +/***/ "./node_modules/@firebase/util/dist/cjs/src/validation.js": +/*!****************************************************************!*\ + !*** ./node_modules/@firebase/util/dist/cjs/src/validation.js ***! + \****************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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 }); +/** + * Check to make sure the appropriate number of arguments are provided for a public function. + * Throws an error if it fails. + * + * @param {!string} fnName The function name + * @param {!number} minCount The minimum number of arguments to allow for the function call + * @param {!number} maxCount The maximum number of argument to allow for the function call + * @param {!number} argCount The actual number of arguments provided. + */ +exports.validateArgCount = function (fnName, minCount, maxCount, argCount) { + var argError; + if (argCount < minCount) { + argError = 'at least ' + minCount; + } + else if (argCount > maxCount) { + argError = maxCount === 0 ? 'none' : 'no more than ' + maxCount; + } + if (argError) { + var error = fnName + + ' failed: Was called with ' + + argCount + + (argCount === 1 ? ' argument.' : ' arguments.') + + ' Expects ' + + argError + + '.'; + throw new Error(error); + } +}; +/** + * Generates a string to prefix an error message about failed argument validation + * + * @param {!string} fnName The function name + * @param {!number} argumentNumber The index of the argument + * @param {boolean} optional Whether or not the argument is optional + * @return {!string} The prefix to add to the error thrown for validation. + */ +function errorPrefix(fnName, argumentNumber, optional) { + var argName = ''; + switch (argumentNumber) { + case 1: + argName = optional ? 'first' : 'First'; + break; + case 2: + argName = optional ? 'second' : 'Second'; + break; + case 3: + argName = optional ? 'third' : 'Third'; + break; + case 4: + argName = optional ? 'fourth' : 'Fourth'; + break; + default: + throw new Error('errorPrefix called with argumentNumber > 4. Need to update it?'); + } + var error = fnName + ' failed: '; + error += argName + ' argument '; + return error; +} +exports.errorPrefix = errorPrefix; +/** + * @param {!string} fnName + * @param {!number} argumentNumber + * @param {!string} namespace + * @param {boolean} optional + */ +function validateNamespace(fnName, argumentNumber, namespace, optional) { + if (optional && !namespace) + return; + if (typeof namespace !== 'string') { + //TODO: I should do more validation here. We only allow certain chars in namespaces. + throw new Error(errorPrefix(fnName, argumentNumber, optional) + + 'must be a valid firebase namespace.'); + } +} +exports.validateNamespace = validateNamespace; +function validateCallback(fnName, argumentNumber, callback, optional) { + if (optional && !callback) + return; + if (typeof callback !== 'function') + throw new Error(errorPrefix(fnName, argumentNumber, optional) + + 'must be a valid function.'); +} +exports.validateCallback = validateCallback; +function validateContextObject(fnName, argumentNumber, context, optional) { + if (optional && !context) + return; + if (typeof context !== 'object' || context === null) + throw new Error(errorPrefix(fnName, argumentNumber, optional) + + 'must be a valid context object.'); +} +exports.validateContextObject = validateContextObject; + +//# sourceMappingURL=validation.js.map + + +/***/ }), + +/***/ "./node_modules/ansi-regex/index.js": +/*!******************************************!*\ + !*** ./node_modules/ansi-regex/index.js ***! + \******************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +module.exports = function () { + return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g; +}; + + +/***/ }), + +/***/ "./node_modules/asap/browser-raw.js": +/*!******************************************!*\ + !*** ./node_modules/asap/browser-raw.js ***! + \******************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (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__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ "./node_modules/babel-runtime/node_modules/regenerator-runtime/runtime-module.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/babel-runtime/node_modules/regenerator-runtime/runtime-module.js ***! + \***************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +// This method of obtaining a reference to the global object needs to be +// kept identical to the way it is obtained in runtime.js +var g = (function() { return this })() || Function("return this")(); + +// Use `getOwnPropertyNames` because not all browsers support calling +// `hasOwnProperty` on the global `self` object in a worker. See #183. +var hadRuntime = g.regeneratorRuntime && + Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0; + +// Save the old regeneratorRuntime in case it needs to be restored later. +var oldRuntime = hadRuntime && g.regeneratorRuntime; + +// Force reevalutation of runtime.js. +g.regeneratorRuntime = undefined; + +module.exports = __webpack_require__(/*! ./runtime */ "./node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js"); + +if (hadRuntime) { + // Restore the original runtime. + g.regeneratorRuntime = oldRuntime; +} else { + // Remove the global property added by runtime.js. + try { + delete g.regeneratorRuntime; + } catch(e) { + g.regeneratorRuntime = undefined; + } +} + + +/***/ }), + +/***/ "./node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js": +/*!********************************************************************************!*\ + !*** ./node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js ***! + \********************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports) { + +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +!(function(global) { + "use strict"; + + var Op = Object.prototype; + var hasOwn = Op.hasOwnProperty; + var undefined; // More compressible than void 0. + var $Symbol = typeof Symbol === "function" ? Symbol : {}; + var iteratorSymbol = $Symbol.iterator || "@@iterator"; + var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + + var inModule = typeof module === "object"; + var runtime = global.regeneratorRuntime; + if (runtime) { + if (inModule) { + // If regeneratorRuntime is defined globally and we're in a module, + // make the exports object identical to regeneratorRuntime. + module.exports = runtime; + } + // Don't bother evaluating the rest of this file if the runtime was + // already defined globally. + return; + } + + // Define the runtime globally (as expected by generated code) as either + // module.exports (if we're in a module) or a new, empty object. + runtime = global.regeneratorRuntime = inModule ? module.exports : {}; + + function wrap(innerFn, outerFn, self, tryLocsList) { + // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; + var generator = Object.create(protoGenerator.prototype); + var context = new Context(tryLocsList || []); + + // The ._invoke method unifies the implementations of the .next, + // .throw, and .return methods. + generator._invoke = makeInvokeMethod(innerFn, self, context); + + return generator; + } + runtime.wrap = wrap; + + // Try/catch helper to minimize deoptimizations. Returns a completion + // record like context.tryEntries[i].completion. This interface could + // have been (and was previously) designed to take a closure to be + // invoked without arguments, but in all the cases we care about we + // already have an existing method we want to call, so there's no need + // to create a new function object. We can even get away with assuming + // the method takes exactly one argument, since that happens to be true + // in every case, so we don't have to touch the arguments object. The + // only additional allocation required is the completion record, which + // has a stable shape and so hopefully should be cheap to allocate. + function tryCatch(fn, obj, arg) { + try { + return { type: "normal", arg: fn.call(obj, arg) }; + } catch (err) { + return { type: "throw", arg: err }; + } + } + + var GenStateSuspendedStart = "suspendedStart"; + var GenStateSuspendedYield = "suspendedYield"; + var GenStateExecuting = "executing"; + var GenStateCompleted = "completed"; + + // Returning this object from the innerFn has the same effect as + // breaking out of the dispatch switch statement. + var ContinueSentinel = {}; + + // Dummy constructor functions that we use as the .constructor and + // .constructor.prototype properties for functions that return Generator + // objects. For full spec compliance, you may wish to configure your + // minifier not to mangle the names of these two functions. + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + + // This is a polyfill for %IteratorPrototype% for environments that + // don't natively support it. + var IteratorPrototype = {}; + IteratorPrototype[iteratorSymbol] = function () { + return this; + }; + + var getProto = Object.getPrototypeOf; + var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + if (NativeIteratorPrototype && + NativeIteratorPrototype !== Op && + hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { + // This environment has a native %IteratorPrototype%; use it instead + // of the polyfill. + IteratorPrototype = NativeIteratorPrototype; + } + + var Gp = GeneratorFunctionPrototype.prototype = + Generator.prototype = Object.create(IteratorPrototype); + GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; + GeneratorFunctionPrototype.constructor = GeneratorFunction; + GeneratorFunctionPrototype[toStringTagSymbol] = + GeneratorFunction.displayName = "GeneratorFunction"; + + // Helper for defining the .next, .throw, and .return methods of the + // Iterator interface in terms of a single ._invoke method. + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function(method) { + prototype[method] = function(arg) { + return this._invoke(method, arg); + }; + }); + } + + runtime.isGeneratorFunction = function(genFun) { + var ctor = typeof genFun === "function" && genFun.constructor; + return ctor + ? ctor === GeneratorFunction || + // For the native GeneratorFunction constructor, the best we can + // do is to check its .name property. + (ctor.displayName || ctor.name) === "GeneratorFunction" + : false; + }; + + runtime.mark = function(genFun) { + if (Object.setPrototypeOf) { + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; + if (!(toStringTagSymbol in genFun)) { + genFun[toStringTagSymbol] = "GeneratorFunction"; + } + } + genFun.prototype = Object.create(Gp); + return genFun; + }; + + // Within the body of any async function, `await x` is transformed to + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test + // `hasOwn.call(value, "__await")` to determine if the yielded value is + // meant to be awaited. + runtime.awrap = function(arg) { + return { __await: arg }; + }; + + function AsyncIterator(generator) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if (record.type === "throw") { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + if (value && + typeof value === "object" && + hasOwn.call(value, "__await")) { + return Promise.resolve(value.__await).then(function(value) { + invoke("next", value, resolve, reject); + }, function(err) { + invoke("throw", err, resolve, reject); + }); + } + + return Promise.resolve(value).then(function(unwrapped) { + // When a yielded Promise is resolved, its final value becomes + // the .value of the Promise<{value,done}> result for the + // current iteration. If the Promise is rejected, however, the + // result for this iteration will be rejected with the same + // reason. Note that rejections of yielded Promises are not + // thrown back into the generator function, as is the case + // when an awaited Promise is rejected. This difference in + // behavior between yield and await is important, because it + // allows the consumer to decide what to do with the yielded + // rejection (swallow it and continue, manually .throw it back + // into the generator, abandon iteration, whatever). With + // await, by contrast, there is no opportunity to examine the + // rejection reason outside the generator function, so the + // only option is to throw it from the await expression, and + // let the generator function handle the exception. + result.value = unwrapped; + resolve(result); + }, reject); + } + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new Promise(function(resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + + return previousPromise = + // If enqueue has been called before, then we want to wait until + // all previous Promises have been resolved before calling invoke, + // so that results are always delivered in the correct order. If + // enqueue has not been called before, then it is important to + // call invoke immediately, without waiting on a callback to fire, + // so that the async generator function has the opportunity to do + // any necessary setup in a predictable way. This predictability + // is why the Promise constructor synchronously invokes its + // executor callback, and why async functions synchronously + // execute code before the first await. Since we implement simple + // async functions in terms of async generators, it is especially + // important to get this right, even though it requires care. + previousPromise ? previousPromise.then( + callInvokeWithMethodAndArg, + // Avoid propagating failures to Promises returned by later + // invocations of the iterator. + callInvokeWithMethodAndArg + ) : callInvokeWithMethodAndArg(); + } + + // Define the unified helper method that is used to implement .next, + // .throw, and .return (see defineIteratorMethods). + this._invoke = enqueue; + } + + defineIteratorMethods(AsyncIterator.prototype); + AsyncIterator.prototype[asyncIteratorSymbol] = function () { + return this; + }; + runtime.AsyncIterator = AsyncIterator; + + // Note that simple async functions are implemented on top of + // AsyncIterator objects; they just return a Promise for the value of + // the final result produced by the iterator. + runtime.async = function(innerFn, outerFn, self, tryLocsList) { + var iter = new AsyncIterator( + wrap(innerFn, outerFn, self, tryLocsList) + ); + + return runtime.isGeneratorFunction(outerFn) + ? iter // If outerFn is a generator, return the full iterator. + : iter.next().then(function(result) { + return result.done ? result.value : iter.next(); + }); + }; + + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error("Generator is already running"); + } + + if (state === GenStateCompleted) { + if (method === "throw") { + throw arg; + } + + // Be forgiving, per 25.3.3.3.3 of the spec: + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume + return doneResult(); + } + + context.method = method; + context.arg = arg; + + while (true) { + var delegate = context.delegate; + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; + } + } + + if (context.method === "next") { + // Setting context._sent for legacy support of Babel's + // function.sent implementation. + context.sent = context._sent = context.arg; + + } else if (context.method === "throw") { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw context.arg; + } + + context.dispatchException(context.arg); + + } else if (context.method === "return") { + context.abrupt("return", context.arg); + } + + state = GenStateExecuting; + + var record = tryCatch(innerFn, self, context); + if (record.type === "normal") { + // If an exception is thrown from innerFn, we leave state === + // GenStateExecuting and loop back for another invocation. + state = context.done + ? GenStateCompleted + : GenStateSuspendedYield; + + if (record.arg === ContinueSentinel) { + continue; + } + + return { + value: record.arg, + done: context.done + }; + + } else if (record.type === "throw") { + state = GenStateCompleted; + // Dispatch the exception by looping back around to the + // context.dispatchException(context.arg) call above. + context.method = "throw"; + context.arg = record.arg; + } + } + }; + } + + // Call delegate.iterator[context.method](context.arg) and handle the + // result, either by returning a { value, done } result from the + // delegate iterator, or by modifying context.method and context.arg, + // setting context.delegate to null, and returning the ContinueSentinel. + function maybeInvokeDelegate(delegate, context) { + var method = delegate.iterator[context.method]; + if (method === undefined) { + // A .throw or .return when the delegate iterator has no .throw + // method always terminates the yield* loop. + context.delegate = null; + + if (context.method === "throw") { + if (delegate.iterator.return) { + // If the delegate iterator has a return method, give it a + // chance to clean up. + context.method = "return"; + context.arg = undefined; + maybeInvokeDelegate(delegate, context); + + if (context.method === "throw") { + // If maybeInvokeDelegate(context) changed context.method from + // "return" to "throw", let that override the TypeError below. + return ContinueSentinel; + } + } + + context.method = "throw"; + context.arg = new TypeError( + "The iterator does not provide a 'throw' method"); + } + + return ContinueSentinel; + } + + var record = tryCatch(method, delegate.iterator, context.arg); + + if (record.type === "throw") { + context.method = "throw"; + context.arg = record.arg; + context.delegate = null; + return ContinueSentinel; + } + + var info = record.arg; + + if (! info) { + context.method = "throw"; + context.arg = new TypeError("iterator result is not an object"); + context.delegate = null; + return ContinueSentinel; + } + + if (info.done) { + // Assign the result of the finished delegate to the temporary + // variable specified by delegate.resultName (see delegateYield). + context[delegate.resultName] = info.value; + + // Resume execution at the desired location (see delegateYield). + context.next = delegate.nextLoc; + + // If context.method was "throw" but the delegate handled the + // exception, let the outer generator proceed normally. If + // context.method was "next", forget context.arg since it has been + // "consumed" by the delegate iterator. If context.method was + // "return", allow the original .return call to continue in the + // outer generator. + if (context.method !== "return") { + context.method = "next"; + context.arg = undefined; + } + + } else { + // Re-yield the result returned by the delegate method. + return info; + } + + // The delegate iterator is finished, so forget it and continue with + // the outer generator. + context.delegate = null; + return ContinueSentinel; + } + + // Define Generator.prototype.{next,throw,return} in terms of the + // unified ._invoke helper method. + defineIteratorMethods(Gp); + + Gp[toStringTagSymbol] = "Generator"; + + // A Generator should always return itself as the iterator object when the + // @@iterator function is called on it. Some browsers' implementations of the + // iterator prototype chain incorrectly implement this, causing the Generator + // object to not be returned from this call. This ensures that doesn't happen. + // See https://github.com/facebook/regenerator/issues/274 for more details. + Gp[iteratorSymbol] = function() { + return this; + }; + + Gp.toString = function() { + return "[object Generator]"; + }; + + function pushTryEntry(locs) { + var entry = { tryLoc: locs[0] }; + + if (1 in locs) { + entry.catchLoc = locs[1]; + } + + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; + } + + this.tryEntries.push(entry); + } + + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal"; + delete record.arg; + entry.completion = record; + } + + function Context(tryLocsList) { + // The root entry object (effectively a try statement without a catch + // or a finally block) gives us a place to store values thrown from + // locations where there is no enclosing try statement. + this.tryEntries = [{ tryLoc: "root" }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + runtime.keys = function(object) { + var keys = []; + for (var key in object) { + keys.push(key); + } + keys.reverse(); + + // Rather than returning an object with a next method, we keep + // things simple and return the next function itself. + return function next() { + while (keys.length) { + var key = keys.pop(); + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } + + // To avoid creating an additional object, we just hang the .value + // and .done properties off the next function object itself. This + // also ensures that the minifier will not anonymize the function. + next.done = true; + return next; + }; + }; + + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } + + if (typeof iterable.next === "function") { + return iterable; + } + + if (!isNaN(iterable.length)) { + var i = -1, next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; + } + } + + next.value = undefined; + next.done = true; + + return next; + }; + + return next.next = next; + } + } + + // Return an iterator with no values. + return { next: doneResult }; + } + runtime.values = values; + + function doneResult() { + return { value: undefined, done: true }; + } + + Context.prototype = { + constructor: Context, + + reset: function(skipTempReset) { + this.prev = 0; + this.next = 0; + // Resetting context._sent for legacy support of Babel's + // function.sent implementation. + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + + this.method = "next"; + this.arg = undefined; + + this.tryEntries.forEach(resetTryEntry); + + if (!skipTempReset) { + for (var name in this) { + // Not sure about the optimal order of these conditions: + if (name.charAt(0) === "t" && + hasOwn.call(this, name) && + !isNaN(+name.slice(1))) { + this[name] = undefined; + } + } + } + }, + + stop: function() { + this.done = true; + + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + if (rootRecord.type === "throw") { + throw rootRecord.arg; + } + + return this.rval; + }, + + dispatchException: function(exception) { + if (this.done) { + throw exception; + } + + var context = this; + function handle(loc, caught) { + record.type = "throw"; + record.arg = exception; + context.next = loc; + + if (caught) { + // If the dispatched exception was caught by a catch block, + // then let that catch block handle the exception normally. + context.method = "next"; + context.arg = undefined; + } + + return !! caught; + } + + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; + + if (entry.tryLoc === "root") { + // Exception thrown outside of any try block that could handle + // it, so set the completion value of the entire function to + // throw the exception. + return handle("end"); + } + + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"); + var hasFinally = hasOwn.call(entry, "finallyLoc"); + + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } + + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else { + throw new Error("try statement without catch or finally"); + } + } + } + }, + + abrupt: function(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && + hasOwn.call(entry, "finallyLoc") && + this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } + + if (finallyEntry && + (type === "break" || + type === "continue") && + finallyEntry.tryLoc <= arg && + arg <= finallyEntry.finallyLoc) { + // Ignore the finally entry if control is not jumping to a + // location outside the try/catch block. + finallyEntry = null; + } + + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; + + if (finallyEntry) { + this.method = "next"; + this.next = finallyEntry.finallyLoc; + return ContinueSentinel; + } + + return this.complete(record); + }, + + complete: function(record, afterLoc) { + if (record.type === "throw") { + throw record.arg; + } + + if (record.type === "break" || + record.type === "continue") { + this.next = record.arg; + } else if (record.type === "return") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } else if (record.type === "normal" && afterLoc) { + this.next = afterLoc; + } + + return ContinueSentinel; + }, + + finish: function(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) { + this.complete(entry.completion, entry.afterLoc); + resetTryEntry(entry); + return ContinueSentinel; + } + } + }, + + "catch": function(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } + return thrown; + } + } + + // The context.catch method must only be called with a location + // argument that corresponds to a known catch block. + throw new Error("illegal catch attempt"); + }, + + delegateYield: function(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + + if (this.method === "next") { + // Deliberately forget the last sent value so that we don't + // accidentally pass it on to the delegate. + this.arg = undefined; + } + + return ContinueSentinel; + } + }; +})( + // In sloppy mode, unbound `this` refers to the global object, fallback to + // Function constructor if we're in global strict mode. That is sadly a form + // of indirect eval which violates Content Security Policy. + (function() { return this })() || Function("return this")() +); + + +/***/ }), + +/***/ "./node_modules/babel-runtime/regenerator/index.js": +/*!*********************************************************!*\ + !*** ./node_modules/babel-runtime/regenerator/index.js ***! + \*********************************************************/ +/*! dynamic exports provided */ +/*! exports used: default */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! regenerator-runtime */ "./node_modules/babel-runtime/node_modules/regenerator-runtime/runtime-module.js"); + + +/***/ }), + +/***/ "./node_modules/chalk/index.js": +/*!*************************************!*\ + !*** ./node_modules/chalk/index.js ***! + \*************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) { +var escapeStringRegexp = __webpack_require__(/*! escape-string-regexp */ "./node_modules/escape-string-regexp/index.js"); +var ansiStyles = __webpack_require__(/*! ansi-styles */ "./node_modules/chalk/node_modules/ansi-styles/index.js"); +var stripAnsi = __webpack_require__(/*! strip-ansi */ "./node_modules/strip-ansi/index.js"); +var hasAnsi = __webpack_require__(/*! has-ansi */ "./node_modules/has-ansi/index.js"); +var supportsColor = __webpack_require__(/*! supports-color */ "./node_modules/chalk/node_modules/supports-color/index.js"); +var defineProps = Object.defineProperties; +var isSimpleWindowsTerm = process.platform === 'win32' && !/^xterm/i.test(Object({"NODE_ENV":"development","PUBLIC_URL":""}).TERM); + +function Chalk(options) { + // detect mode if not set manually + this.enabled = !options || options.enabled === undefined ? supportsColor : options.enabled; +} + +// use bright blue on Windows as the normal blue color is illegible +if (isSimpleWindowsTerm) { + ansiStyles.blue.open = '\u001b[94m'; +} + +var styles = (function () { + var ret = {}; + + Object.keys(ansiStyles).forEach(function (key) { + ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); + + ret[key] = { + get: function () { + return build.call(this, this._styles.concat(key)); + } + }; + }); + + return ret; +})(); + +var proto = defineProps(function chalk() {}, styles); + +function build(_styles) { + var builder = function () { + return applyStyle.apply(builder, arguments); + }; + + builder._styles = _styles; + builder.enabled = this.enabled; + // __proto__ is used because we must return a function, but there is + // no way to create a function with a different prototype. + /* eslint-disable no-proto */ + builder.__proto__ = proto; + + return builder; +} + +function applyStyle() { + // support varags, but simply cast to string in case there's only one arg + var args = arguments; + var argsLen = args.length; + var str = argsLen !== 0 && String(arguments[0]); + + if (argsLen > 1) { + // don't slice `arguments`, it prevents v8 optimizations + for (var a = 1; a < argsLen; a++) { + str += ' ' + args[a]; + } + } + + if (!this.enabled || !str) { + return str; + } + + var nestedStyles = this._styles; + var i = nestedStyles.length; + + // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, + // see https://github.com/chalk/chalk/issues/58 + // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. + var originalDim = ansiStyles.dim.open; + if (isSimpleWindowsTerm && (nestedStyles.indexOf('gray') !== -1 || nestedStyles.indexOf('grey') !== -1)) { + ansiStyles.dim.open = ''; + } + + while (i--) { + var code = ansiStyles[nestedStyles[i]]; + + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + str = code.open + str.replace(code.closeRe, code.open) + code.close; + } + + // Reset the original 'dim' if we changed it to work around the Windows dimmed gray issue. + ansiStyles.dim.open = originalDim; + + return str; +} + +function init() { + var ret = {}; + + Object.keys(styles).forEach(function (name) { + ret[name] = { + get: function () { + return build.call(this, [name]); + } + }; + }); + + return ret; +} + +defineProps(Chalk.prototype, init()); + +module.exports = new Chalk(); +module.exports.styles = ansiStyles; +module.exports.hasColor = hasAnsi; +module.exports.stripColor = stripAnsi; +module.exports.supportsColor = supportsColor; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js"))) + +/***/ }), + +/***/ "./node_modules/chalk/node_modules/ansi-styles/index.js": +/*!**************************************************************!*\ + !*** ./node_modules/chalk/node_modules/ansi-styles/index.js ***! + \**************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(module) { + +function assembleStyles () { + var styles = { + modifiers: { + reset: [0, 0], + bold: [1, 22], // 21 isn't widely supported and 22 does the same thing + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + colors: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39] + }, + bgColors: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49] + } + }; + + // fix humans + styles.colors.grey = styles.colors.gray; + + Object.keys(styles).forEach(function (groupName) { + var group = styles[groupName]; + + Object.keys(group).forEach(function (styleName) { + var style = group[styleName]; + + styles[styleName] = group[styleName] = { + open: '\u001b[' + style[0] + 'm', + close: '\u001b[' + style[1] + 'm' + }; + }); + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + }); + + return styles; +} + +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles +}); + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! ./../../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module))) + +/***/ }), + +/***/ "./node_modules/chalk/node_modules/supports-color/index.js": +/*!*****************************************************************!*\ + !*** ./node_modules/chalk/node_modules/supports-color/index.js ***! + \*****************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) { +var argv = process.argv; + +var terminator = argv.indexOf('--'); +var hasFlag = function (flag) { + flag = '--' + flag; + var pos = argv.indexOf(flag); + return pos !== -1 && (terminator !== -1 ? pos < terminator : true); +}; + +module.exports = (function () { + if ('FORCE_COLOR' in Object({"NODE_ENV":"development","PUBLIC_URL":""})) { + return true; + } + + if (hasFlag('no-color') || + hasFlag('no-colors') || + hasFlag('color=false')) { + return false; + } + + if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { + return true; + } + + if (process.stdout && !process.stdout.isTTY) { + return false; + } + + if (process.platform === 'win32') { + return true; + } + + if ('COLORTERM' in Object({"NODE_ENV":"development","PUBLIC_URL":""})) { + return true; + } + + if (Object({"NODE_ENV":"development","PUBLIC_URL":""}).TERM === 'dumb') { + return false; + } + + if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(Object({"NODE_ENV":"development","PUBLIC_URL":""}).TERM)) { + return true; + } + + return false; +})(); + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! ./../../../process/browser.js */ "./node_modules/process/browser.js"))) + +/***/ }), + +/***/ "./node_modules/css-loader/index.js?{\"importLoaders\":1}!./node_modules/postcss-loader/lib/index.js?{\"ident\":\"postcss\",\"plugins\":[null,null]}!./src/components/denuncias/denuncia.css": +/*!*************************************************************************************************************************************************************************!*\ + !*** ./node_modules/css-loader?{"importLoaders":1}!./node_modules/postcss-loader/lib?{"ident":"postcss","plugins":[null,null]}!./src/components/denuncias/denuncia.css ***! + \*************************************************************************************************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(undefined); +// imports + + +// module +exports.push([module.i, ".nav-wrapper {\n background-color: #26a69a !important;\n font-size: 14px;\n font-weight: bold;\n}\n\nform#form-nova-denuncia {\n margin: 15px auto;\n max-width: 960px; }\n form#form-nova-denuncia ::-webkit-input-placeholder {\n color: #C0C0C0; }\n form#form-nova-denuncia :-moz-placeholder {\n /* Firefox 18- */\n color: #C0C0C0; }\n form#form-nova-denuncia ::-moz-placeholder {\n /* Firefox 19+ */\n color: #C0C0C0; }\n form#form-nova-denuncia :-ms-input-placeholder {\n color: #C0C0C0; }\n form#form-nova-denuncia input:focus::-webkit-input-placeholder {\n color: transparent; }\n form#form-nova-denuncia textarea:focus::-webkit-input-placeholder {\n color: transparent; }\n form#form-nova-denuncia input {\n margin-bottom: 10px; }\n", ""]); + +// exports + + +/***/ }), + +/***/ "./node_modules/css-loader/index.js?{\"importLoaders\":1}!./node_modules/postcss-loader/lib/index.js?{\"ident\":\"postcss\",\"plugins\":[null,null]}!./src/components/home/css/home.css": +/*!********************************************************************************************************************************************************************!*\ + !*** ./node_modules/css-loader?{"importLoaders":1}!./node_modules/postcss-loader/lib?{"ident":"postcss","plugins":[null,null]}!./src/components/home/css/home.css ***! + \********************************************************************************************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +exports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(undefined); +// imports + + +// module +exports.push([module.i, ".en-extra-margin-right {\n margin-right: 40px; }\n\n.en-logo {\n font-family: 'Open Sans', sans-serif;\n font-weight: 700;\n font-size: 25px;\n color: #ff8100; }\n\n.en-topbar {\n padding: 34px 0;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: row;\n flex-direction: row; }\n .en-topbar .en-topbar__right {\n margin-left: auto; }\n\n.en-nav {\n text-transform: uppercase; }\n .en-nav > * {\n margin-left: 20px; }\n .en-nav a {\n color: #FFF;\n font-size: 14px; }\n\n.en-btn {\n display: inline-block;\n padding: 12px 18px;\n border-radius: 40px;\n color: #FFF;\n text-transform: uppercase; }\n .en-btn.en-btn--primary {\n background: #ff8100; }\n .en-btn.en-btn--colored {\n background-color: #eb5f56; }\n .en-btn.en-btn--outline {\n border: 1px solid transparent;\n background: transparent; }\n .en-btn.en-btn--outline.en-btn--primary {\n border-color: #ff8100;\n color: #ff8100; }\n .en-btn:hover {\n text-decoration: none;\n color: #fff; }\n\n.en-footer {\n padding: 80px 0; }\n\n.en-social {\n text-align: center; }\n .en-social .en-social__title {\n font-size: 20px;\n color: #939393;\n margin-bottom: 20px;\n display: block; }\n .en-social .en-social__links a {\n color: #939393;\n text-decoration: none;\n font-size: 30px;\n margin-right: 25px; }\n .en-social .en-social__links a:last-child {\n margin-right: 0; }\n\n* {\n font-family: 'Roboto', sans-serif; }\n\nbody {\n background: #f2f3f5; }\n\n.en-text--light {\n color: #fff;\n font-size: 17px;\n line-height: 1.4; }\n\n.en-subtitle--primary {\n font-size: 25px;\n text-transform: uppercase;\n color: #ff8100;\n font-weight: 700;\n margin-bottom: 5px; }\n\n.en-title {\n font-size: 50px;\n text-transform: uppercase;\n font-weight: 700;\n line-height: 1.1;\n margin-bottom: 20px; }\n .en-title.en-title--light {\n color: #fff; }\n .en-title.en-title--marker::after {\n content: \"\";\n display: block;\n width: 90px;\n height: 6px;\n background: #ff8100;\n margin-top: 10px;\n margin-left: 2px; }\n\n#banner {\n height: 600px;\n background: url(" + __webpack_require__(/*! ./../images/face.jpg */ "./src/components/home/images/face.jpg") + ") no-repeat center top;\n background-size: cover;\n border-left: 86px solid #ff8100;\n position: relative; }\n #banner #banner__blur {\n height: 100%;\n width: 20%;\n max-width: 0px;\n opacity: 0.84;\n position: absolute; }\n #banner .container > .row {\n margin: 30px -15px; }\n #banner #en-banner__description {\n margin-bottom: 33px; }\n\nh3 {\n margin: 30px 0 10px; }\n\nh4 {\n margin: 20px 0 10px; }\n", ""]); + +// exports + + +/***/ }), + +/***/ "./node_modules/css-loader/index.js?{\"importLoaders\":1}!./node_modules/postcss-loader/lib/index.js?{\"ident\":\"postcss\"}!./node_modules/font-awesome/css/font-awesome.css": +/*!************************************************************************************************************************************************************!*\ + !*** ./node_modules/css-loader?{"importLoaders":1}!./node_modules/postcss-loader/lib?{"ident":"postcss"}!./node_modules/font-awesome/css/font-awesome.css ***! + \************************************************************************************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +exports = module.exports = __webpack_require__(/*! ../../css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(undefined); +// imports + + +// module +exports.push([module.i, "/*!\n * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome\n * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)\n */\n/* FONT PATH\n * -------------------------- */\n@font-face {\n font-family: 'FontAwesome';\n src: url(" + __webpack_require__(/*! ../fonts/fontawesome-webfont.eot?v=4.7.0 */ "./node_modules/font-awesome/fonts/fontawesome-webfont.eot?v=4.7.0") + ");\n src: url(" + __webpack_require__(/*! ../fonts/fontawesome-webfont.eot */ "./node_modules/font-awesome/fonts/fontawesome-webfont.eot") + "?#iefix&v=4.7.0) format('embedded-opentype'), url(" + __webpack_require__(/*! ../fonts/fontawesome-webfont.woff2?v=4.7.0 */ "./node_modules/font-awesome/fonts/fontawesome-webfont.woff2?v=4.7.0") + ") format('woff2'), url(" + __webpack_require__(/*! ../fonts/fontawesome-webfont.woff?v=4.7.0 */ "./node_modules/font-awesome/fonts/fontawesome-webfont.woff?v=4.7.0") + ") format('woff'), url(" + __webpack_require__(/*! ../fonts/fontawesome-webfont.ttf?v=4.7.0 */ "./node_modules/font-awesome/fonts/fontawesome-webfont.ttf?v=4.7.0") + ") format('truetype'), url(" + __webpack_require__(/*! ../fonts/fontawesome-webfont.svg?v=4.7.0 */ "./node_modules/font-awesome/fonts/fontawesome-webfont.svg?v=4.7.0") + "#fontawesomeregular) format('svg');\n font-weight: normal;\n font-style: normal;\n}\n.fa {\n display: inline-block;\n font: normal normal normal 14px/1 FontAwesome;\n font-size: inherit;\n text-rendering: auto;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n/* makes the font 33% larger relative to the icon container */\n.fa-lg {\n font-size: 1.33333333em;\n line-height: 0.75em;\n vertical-align: -15%;\n}\n.fa-2x {\n font-size: 2em;\n}\n.fa-3x {\n font-size: 3em;\n}\n.fa-4x {\n font-size: 4em;\n}\n.fa-5x {\n font-size: 5em;\n}\n.fa-fw {\n width: 1.28571429em;\n text-align: center;\n}\n.fa-ul {\n padding-left: 0;\n margin-left: 2.14285714em;\n list-style-type: none;\n}\n.fa-ul > li {\n position: relative;\n}\n.fa-li {\n position: absolute;\n left: -2.14285714em;\n width: 2.14285714em;\n top: 0.14285714em;\n text-align: center;\n}\n.fa-li.fa-lg {\n left: -1.85714286em;\n}\n.fa-border {\n padding: .2em .25em .15em;\n border: solid 0.08em #eeeeee;\n border-radius: .1em;\n}\n.fa-pull-left {\n float: left;\n}\n.fa-pull-right {\n float: right;\n}\n.fa.fa-pull-left {\n margin-right: .3em;\n}\n.fa.fa-pull-right {\n margin-left: .3em;\n}\n/* Deprecated as of 4.4.0 */\n.pull-right {\n float: right;\n}\n.pull-left {\n float: left;\n}\n.fa.pull-left {\n margin-right: .3em;\n}\n.fa.pull-right {\n margin-left: .3em;\n}\n.fa-spin {\n -webkit-animation: fa-spin 2s infinite linear;\n animation: fa-spin 2s infinite linear;\n}\n.fa-pulse {\n -webkit-animation: fa-spin 1s infinite steps(8);\n animation: fa-spin 1s infinite steps(8);\n}\n@-webkit-keyframes fa-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg);\n }\n}\n@keyframes fa-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg);\n }\n}\n.fa-rotate-90 {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)\";\n -webkit-transform: rotate(90deg);\n -ms-transform: rotate(90deg);\n transform: rotate(90deg);\n}\n.fa-rotate-180 {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)\";\n -webkit-transform: rotate(180deg);\n -ms-transform: rotate(180deg);\n transform: rotate(180deg);\n}\n.fa-rotate-270 {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)\";\n -webkit-transform: rotate(270deg);\n -ms-transform: rotate(270deg);\n transform: rotate(270deg);\n}\n.fa-flip-horizontal {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)\";\n -webkit-transform: scale(-1, 1);\n -ms-transform: scale(-1, 1);\n transform: scale(-1, 1);\n}\n.fa-flip-vertical {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)\";\n -webkit-transform: scale(1, -1);\n -ms-transform: scale(1, -1);\n transform: scale(1, -1);\n}\n:root .fa-rotate-90,\n:root .fa-rotate-180,\n:root .fa-rotate-270,\n:root .fa-flip-horizontal,\n:root .fa-flip-vertical {\n -webkit-filter: none;\n filter: none;\n}\n.fa-stack {\n position: relative;\n display: inline-block;\n width: 2em;\n height: 2em;\n line-height: 2em;\n vertical-align: middle;\n}\n.fa-stack-1x,\n.fa-stack-2x {\n position: absolute;\n left: 0;\n width: 100%;\n text-align: center;\n}\n.fa-stack-1x {\n line-height: inherit;\n}\n.fa-stack-2x {\n font-size: 2em;\n}\n.fa-inverse {\n color: #ffffff;\n}\n/* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen\n readers do not read off random characters that represent icons */\n.fa-glass:before {\n content: \"\\F000\";\n}\n.fa-music:before {\n content: \"\\F001\";\n}\n.fa-search:before {\n content: \"\\F002\";\n}\n.fa-envelope-o:before {\n content: \"\\F003\";\n}\n.fa-heart:before {\n content: \"\\F004\";\n}\n.fa-star:before {\n content: \"\\F005\";\n}\n.fa-star-o:before {\n content: \"\\F006\";\n}\n.fa-user:before {\n content: \"\\F007\";\n}\n.fa-film:before {\n content: \"\\F008\";\n}\n.fa-th-large:before {\n content: \"\\F009\";\n}\n.fa-th:before {\n content: \"\\F00A\";\n}\n.fa-th-list:before {\n content: \"\\F00B\";\n}\n.fa-check:before {\n content: \"\\F00C\";\n}\n.fa-remove:before,\n.fa-close:before,\n.fa-times:before {\n content: \"\\F00D\";\n}\n.fa-search-plus:before {\n content: \"\\F00E\";\n}\n.fa-search-minus:before {\n content: \"\\F010\";\n}\n.fa-power-off:before {\n content: \"\\F011\";\n}\n.fa-signal:before {\n content: \"\\F012\";\n}\n.fa-gear:before,\n.fa-cog:before {\n content: \"\\F013\";\n}\n.fa-trash-o:before {\n content: \"\\F014\";\n}\n.fa-home:before {\n content: \"\\F015\";\n}\n.fa-file-o:before {\n content: \"\\F016\";\n}\n.fa-clock-o:before {\n content: \"\\F017\";\n}\n.fa-road:before {\n content: \"\\F018\";\n}\n.fa-download:before {\n content: \"\\F019\";\n}\n.fa-arrow-circle-o-down:before {\n content: \"\\F01A\";\n}\n.fa-arrow-circle-o-up:before {\n content: \"\\F01B\";\n}\n.fa-inbox:before {\n content: \"\\F01C\";\n}\n.fa-play-circle-o:before {\n content: \"\\F01D\";\n}\n.fa-rotate-right:before,\n.fa-repeat:before {\n content: \"\\F01E\";\n}\n.fa-refresh:before {\n content: \"\\F021\";\n}\n.fa-list-alt:before {\n content: \"\\F022\";\n}\n.fa-lock:before {\n content: \"\\F023\";\n}\n.fa-flag:before {\n content: \"\\F024\";\n}\n.fa-headphones:before {\n content: \"\\F025\";\n}\n.fa-volume-off:before {\n content: \"\\F026\";\n}\n.fa-volume-down:before {\n content: \"\\F027\";\n}\n.fa-volume-up:before {\n content: \"\\F028\";\n}\n.fa-qrcode:before {\n content: \"\\F029\";\n}\n.fa-barcode:before {\n content: \"\\F02A\";\n}\n.fa-tag:before {\n content: \"\\F02B\";\n}\n.fa-tags:before {\n content: \"\\F02C\";\n}\n.fa-book:before {\n content: \"\\F02D\";\n}\n.fa-bookmark:before {\n content: \"\\F02E\";\n}\n.fa-print:before {\n content: \"\\F02F\";\n}\n.fa-camera:before {\n content: \"\\F030\";\n}\n.fa-font:before {\n content: \"\\F031\";\n}\n.fa-bold:before {\n content: \"\\F032\";\n}\n.fa-italic:before {\n content: \"\\F033\";\n}\n.fa-text-height:before {\n content: \"\\F034\";\n}\n.fa-text-width:before {\n content: \"\\F035\";\n}\n.fa-align-left:before {\n content: \"\\F036\";\n}\n.fa-align-center:before {\n content: \"\\F037\";\n}\n.fa-align-right:before {\n content: \"\\F038\";\n}\n.fa-align-justify:before {\n content: \"\\F039\";\n}\n.fa-list:before {\n content: \"\\F03A\";\n}\n.fa-dedent:before,\n.fa-outdent:before {\n content: \"\\F03B\";\n}\n.fa-indent:before {\n content: \"\\F03C\";\n}\n.fa-video-camera:before {\n content: \"\\F03D\";\n}\n.fa-photo:before,\n.fa-image:before,\n.fa-picture-o:before {\n content: \"\\F03E\";\n}\n.fa-pencil:before {\n content: \"\\F040\";\n}\n.fa-map-marker:before {\n content: \"\\F041\";\n}\n.fa-adjust:before {\n content: \"\\F042\";\n}\n.fa-tint:before {\n content: \"\\F043\";\n}\n.fa-edit:before,\n.fa-pencil-square-o:before {\n content: \"\\F044\";\n}\n.fa-share-square-o:before {\n content: \"\\F045\";\n}\n.fa-check-square-o:before {\n content: \"\\F046\";\n}\n.fa-arrows:before {\n content: \"\\F047\";\n}\n.fa-step-backward:before {\n content: \"\\F048\";\n}\n.fa-fast-backward:before {\n content: \"\\F049\";\n}\n.fa-backward:before {\n content: \"\\F04A\";\n}\n.fa-play:before {\n content: \"\\F04B\";\n}\n.fa-pause:before {\n content: \"\\F04C\";\n}\n.fa-stop:before {\n content: \"\\F04D\";\n}\n.fa-forward:before {\n content: \"\\F04E\";\n}\n.fa-fast-forward:before {\n content: \"\\F050\";\n}\n.fa-step-forward:before {\n content: \"\\F051\";\n}\n.fa-eject:before {\n content: \"\\F052\";\n}\n.fa-chevron-left:before {\n content: \"\\F053\";\n}\n.fa-chevron-right:before {\n content: \"\\F054\";\n}\n.fa-plus-circle:before {\n content: \"\\F055\";\n}\n.fa-minus-circle:before {\n content: \"\\F056\";\n}\n.fa-times-circle:before {\n content: \"\\F057\";\n}\n.fa-check-circle:before {\n content: \"\\F058\";\n}\n.fa-question-circle:before {\n content: \"\\F059\";\n}\n.fa-info-circle:before {\n content: \"\\F05A\";\n}\n.fa-crosshairs:before {\n content: \"\\F05B\";\n}\n.fa-times-circle-o:before {\n content: \"\\F05C\";\n}\n.fa-check-circle-o:before {\n content: \"\\F05D\";\n}\n.fa-ban:before {\n content: \"\\F05E\";\n}\n.fa-arrow-left:before {\n content: \"\\F060\";\n}\n.fa-arrow-right:before {\n content: \"\\F061\";\n}\n.fa-arrow-up:before {\n content: \"\\F062\";\n}\n.fa-arrow-down:before {\n content: \"\\F063\";\n}\n.fa-mail-forward:before,\n.fa-share:before {\n content: \"\\F064\";\n}\n.fa-expand:before {\n content: \"\\F065\";\n}\n.fa-compress:before {\n content: \"\\F066\";\n}\n.fa-plus:before {\n content: \"\\F067\";\n}\n.fa-minus:before {\n content: \"\\F068\";\n}\n.fa-asterisk:before {\n content: \"\\F069\";\n}\n.fa-exclamation-circle:before {\n content: \"\\F06A\";\n}\n.fa-gift:before {\n content: \"\\F06B\";\n}\n.fa-leaf:before {\n content: \"\\F06C\";\n}\n.fa-fire:before {\n content: \"\\F06D\";\n}\n.fa-eye:before {\n content: \"\\F06E\";\n}\n.fa-eye-slash:before {\n content: \"\\F070\";\n}\n.fa-warning:before,\n.fa-exclamation-triangle:before {\n content: \"\\F071\";\n}\n.fa-plane:before {\n content: \"\\F072\";\n}\n.fa-calendar:before {\n content: \"\\F073\";\n}\n.fa-random:before {\n content: \"\\F074\";\n}\n.fa-comment:before {\n content: \"\\F075\";\n}\n.fa-magnet:before {\n content: \"\\F076\";\n}\n.fa-chevron-up:before {\n content: \"\\F077\";\n}\n.fa-chevron-down:before {\n content: \"\\F078\";\n}\n.fa-retweet:before {\n content: \"\\F079\";\n}\n.fa-shopping-cart:before {\n content: \"\\F07A\";\n}\n.fa-folder:before {\n content: \"\\F07B\";\n}\n.fa-folder-open:before {\n content: \"\\F07C\";\n}\n.fa-arrows-v:before {\n content: \"\\F07D\";\n}\n.fa-arrows-h:before {\n content: \"\\F07E\";\n}\n.fa-bar-chart-o:before,\n.fa-bar-chart:before {\n content: \"\\F080\";\n}\n.fa-twitter-square:before {\n content: \"\\F081\";\n}\n.fa-facebook-square:before {\n content: \"\\F082\";\n}\n.fa-camera-retro:before {\n content: \"\\F083\";\n}\n.fa-key:before {\n content: \"\\F084\";\n}\n.fa-gears:before,\n.fa-cogs:before {\n content: \"\\F085\";\n}\n.fa-comments:before {\n content: \"\\F086\";\n}\n.fa-thumbs-o-up:before {\n content: \"\\F087\";\n}\n.fa-thumbs-o-down:before {\n content: \"\\F088\";\n}\n.fa-star-half:before {\n content: \"\\F089\";\n}\n.fa-heart-o:before {\n content: \"\\F08A\";\n}\n.fa-sign-out:before {\n content: \"\\F08B\";\n}\n.fa-linkedin-square:before {\n content: \"\\F08C\";\n}\n.fa-thumb-tack:before {\n content: \"\\F08D\";\n}\n.fa-external-link:before {\n content: \"\\F08E\";\n}\n.fa-sign-in:before {\n content: \"\\F090\";\n}\n.fa-trophy:before {\n content: \"\\F091\";\n}\n.fa-github-square:before {\n content: \"\\F092\";\n}\n.fa-upload:before {\n content: \"\\F093\";\n}\n.fa-lemon-o:before {\n content: \"\\F094\";\n}\n.fa-phone:before {\n content: \"\\F095\";\n}\n.fa-square-o:before {\n content: \"\\F096\";\n}\n.fa-bookmark-o:before {\n content: \"\\F097\";\n}\n.fa-phone-square:before {\n content: \"\\F098\";\n}\n.fa-twitter:before {\n content: \"\\F099\";\n}\n.fa-facebook-f:before,\n.fa-facebook:before {\n content: \"\\F09A\";\n}\n.fa-github:before {\n content: \"\\F09B\";\n}\n.fa-unlock:before {\n content: \"\\F09C\";\n}\n.fa-credit-card:before {\n content: \"\\F09D\";\n}\n.fa-feed:before,\n.fa-rss:before {\n content: \"\\F09E\";\n}\n.fa-hdd-o:before {\n content: \"\\F0A0\";\n}\n.fa-bullhorn:before {\n content: \"\\F0A1\";\n}\n.fa-bell:before {\n content: \"\\F0F3\";\n}\n.fa-certificate:before {\n content: \"\\F0A3\";\n}\n.fa-hand-o-right:before {\n content: \"\\F0A4\";\n}\n.fa-hand-o-left:before {\n content: \"\\F0A5\";\n}\n.fa-hand-o-up:before {\n content: \"\\F0A6\";\n}\n.fa-hand-o-down:before {\n content: \"\\F0A7\";\n}\n.fa-arrow-circle-left:before {\n content: \"\\F0A8\";\n}\n.fa-arrow-circle-right:before {\n content: \"\\F0A9\";\n}\n.fa-arrow-circle-up:before {\n content: \"\\F0AA\";\n}\n.fa-arrow-circle-down:before {\n content: \"\\F0AB\";\n}\n.fa-globe:before {\n content: \"\\F0AC\";\n}\n.fa-wrench:before {\n content: \"\\F0AD\";\n}\n.fa-tasks:before {\n content: \"\\F0AE\";\n}\n.fa-filter:before {\n content: \"\\F0B0\";\n}\n.fa-briefcase:before {\n content: \"\\F0B1\";\n}\n.fa-arrows-alt:before {\n content: \"\\F0B2\";\n}\n.fa-group:before,\n.fa-users:before {\n content: \"\\F0C0\";\n}\n.fa-chain:before,\n.fa-link:before {\n content: \"\\F0C1\";\n}\n.fa-cloud:before {\n content: \"\\F0C2\";\n}\n.fa-flask:before {\n content: \"\\F0C3\";\n}\n.fa-cut:before,\n.fa-scissors:before {\n content: \"\\F0C4\";\n}\n.fa-copy:before,\n.fa-files-o:before {\n content: \"\\F0C5\";\n}\n.fa-paperclip:before {\n content: \"\\F0C6\";\n}\n.fa-save:before,\n.fa-floppy-o:before {\n content: \"\\F0C7\";\n}\n.fa-square:before {\n content: \"\\F0C8\";\n}\n.fa-navicon:before,\n.fa-reorder:before,\n.fa-bars:before {\n content: \"\\F0C9\";\n}\n.fa-list-ul:before {\n content: \"\\F0CA\";\n}\n.fa-list-ol:before {\n content: \"\\F0CB\";\n}\n.fa-strikethrough:before {\n content: \"\\F0CC\";\n}\n.fa-underline:before {\n content: \"\\F0CD\";\n}\n.fa-table:before {\n content: \"\\F0CE\";\n}\n.fa-magic:before {\n content: \"\\F0D0\";\n}\n.fa-truck:before {\n content: \"\\F0D1\";\n}\n.fa-pinterest:before {\n content: \"\\F0D2\";\n}\n.fa-pinterest-square:before {\n content: \"\\F0D3\";\n}\n.fa-google-plus-square:before {\n content: \"\\F0D4\";\n}\n.fa-google-plus:before {\n content: \"\\F0D5\";\n}\n.fa-money:before {\n content: \"\\F0D6\";\n}\n.fa-caret-down:before {\n content: \"\\F0D7\";\n}\n.fa-caret-up:before {\n content: \"\\F0D8\";\n}\n.fa-caret-left:before {\n content: \"\\F0D9\";\n}\n.fa-caret-right:before {\n content: \"\\F0DA\";\n}\n.fa-columns:before {\n content: \"\\F0DB\";\n}\n.fa-unsorted:before,\n.fa-sort:before {\n content: \"\\F0DC\";\n}\n.fa-sort-down:before,\n.fa-sort-desc:before {\n content: \"\\F0DD\";\n}\n.fa-sort-up:before,\n.fa-sort-asc:before {\n content: \"\\F0DE\";\n}\n.fa-envelope:before {\n content: \"\\F0E0\";\n}\n.fa-linkedin:before {\n content: \"\\F0E1\";\n}\n.fa-rotate-left:before,\n.fa-undo:before {\n content: \"\\F0E2\";\n}\n.fa-legal:before,\n.fa-gavel:before {\n content: \"\\F0E3\";\n}\n.fa-dashboard:before,\n.fa-tachometer:before {\n content: \"\\F0E4\";\n}\n.fa-comment-o:before {\n content: \"\\F0E5\";\n}\n.fa-comments-o:before {\n content: \"\\F0E6\";\n}\n.fa-flash:before,\n.fa-bolt:before {\n content: \"\\F0E7\";\n}\n.fa-sitemap:before {\n content: \"\\F0E8\";\n}\n.fa-umbrella:before {\n content: \"\\F0E9\";\n}\n.fa-paste:before,\n.fa-clipboard:before {\n content: \"\\F0EA\";\n}\n.fa-lightbulb-o:before {\n content: \"\\F0EB\";\n}\n.fa-exchange:before {\n content: \"\\F0EC\";\n}\n.fa-cloud-download:before {\n content: \"\\F0ED\";\n}\n.fa-cloud-upload:before {\n content: \"\\F0EE\";\n}\n.fa-user-md:before {\n content: \"\\F0F0\";\n}\n.fa-stethoscope:before {\n content: \"\\F0F1\";\n}\n.fa-suitcase:before {\n content: \"\\F0F2\";\n}\n.fa-bell-o:before {\n content: \"\\F0A2\";\n}\n.fa-coffee:before {\n content: \"\\F0F4\";\n}\n.fa-cutlery:before {\n content: \"\\F0F5\";\n}\n.fa-file-text-o:before {\n content: \"\\F0F6\";\n}\n.fa-building-o:before {\n content: \"\\F0F7\";\n}\n.fa-hospital-o:before {\n content: \"\\F0F8\";\n}\n.fa-ambulance:before {\n content: \"\\F0F9\";\n}\n.fa-medkit:before {\n content: \"\\F0FA\";\n}\n.fa-fighter-jet:before {\n content: \"\\F0FB\";\n}\n.fa-beer:before {\n content: \"\\F0FC\";\n}\n.fa-h-square:before {\n content: \"\\F0FD\";\n}\n.fa-plus-square:before {\n content: \"\\F0FE\";\n}\n.fa-angle-double-left:before {\n content: \"\\F100\";\n}\n.fa-angle-double-right:before {\n content: \"\\F101\";\n}\n.fa-angle-double-up:before {\n content: \"\\F102\";\n}\n.fa-angle-double-down:before {\n content: \"\\F103\";\n}\n.fa-angle-left:before {\n content: \"\\F104\";\n}\n.fa-angle-right:before {\n content: \"\\F105\";\n}\n.fa-angle-up:before {\n content: \"\\F106\";\n}\n.fa-angle-down:before {\n content: \"\\F107\";\n}\n.fa-desktop:before {\n content: \"\\F108\";\n}\n.fa-laptop:before {\n content: \"\\F109\";\n}\n.fa-tablet:before {\n content: \"\\F10A\";\n}\n.fa-mobile-phone:before,\n.fa-mobile:before {\n content: \"\\F10B\";\n}\n.fa-circle-o:before {\n content: \"\\F10C\";\n}\n.fa-quote-left:before {\n content: \"\\F10D\";\n}\n.fa-quote-right:before {\n content: \"\\F10E\";\n}\n.fa-spinner:before {\n content: \"\\F110\";\n}\n.fa-circle:before {\n content: \"\\F111\";\n}\n.fa-mail-reply:before,\n.fa-reply:before {\n content: \"\\F112\";\n}\n.fa-github-alt:before {\n content: \"\\F113\";\n}\n.fa-folder-o:before {\n content: \"\\F114\";\n}\n.fa-folder-open-o:before {\n content: \"\\F115\";\n}\n.fa-smile-o:before {\n content: \"\\F118\";\n}\n.fa-frown-o:before {\n content: \"\\F119\";\n}\n.fa-meh-o:before {\n content: \"\\F11A\";\n}\n.fa-gamepad:before {\n content: \"\\F11B\";\n}\n.fa-keyboard-o:before {\n content: \"\\F11C\";\n}\n.fa-flag-o:before {\n content: \"\\F11D\";\n}\n.fa-flag-checkered:before {\n content: \"\\F11E\";\n}\n.fa-terminal:before {\n content: \"\\F120\";\n}\n.fa-code:before {\n content: \"\\F121\";\n}\n.fa-mail-reply-all:before,\n.fa-reply-all:before {\n content: \"\\F122\";\n}\n.fa-star-half-empty:before,\n.fa-star-half-full:before,\n.fa-star-half-o:before {\n content: \"\\F123\";\n}\n.fa-location-arrow:before {\n content: \"\\F124\";\n}\n.fa-crop:before {\n content: \"\\F125\";\n}\n.fa-code-fork:before {\n content: \"\\F126\";\n}\n.fa-unlink:before,\n.fa-chain-broken:before {\n content: \"\\F127\";\n}\n.fa-question:before {\n content: \"\\F128\";\n}\n.fa-info:before {\n content: \"\\F129\";\n}\n.fa-exclamation:before {\n content: \"\\F12A\";\n}\n.fa-superscript:before {\n content: \"\\F12B\";\n}\n.fa-subscript:before {\n content: \"\\F12C\";\n}\n.fa-eraser:before {\n content: \"\\F12D\";\n}\n.fa-puzzle-piece:before {\n content: \"\\F12E\";\n}\n.fa-microphone:before {\n content: \"\\F130\";\n}\n.fa-microphone-slash:before {\n content: \"\\F131\";\n}\n.fa-shield:before {\n content: \"\\F132\";\n}\n.fa-calendar-o:before {\n content: \"\\F133\";\n}\n.fa-fire-extinguisher:before {\n content: \"\\F134\";\n}\n.fa-rocket:before {\n content: \"\\F135\";\n}\n.fa-maxcdn:before {\n content: \"\\F136\";\n}\n.fa-chevron-circle-left:before {\n content: \"\\F137\";\n}\n.fa-chevron-circle-right:before {\n content: \"\\F138\";\n}\n.fa-chevron-circle-up:before {\n content: \"\\F139\";\n}\n.fa-chevron-circle-down:before {\n content: \"\\F13A\";\n}\n.fa-html5:before {\n content: \"\\F13B\";\n}\n.fa-css3:before {\n content: \"\\F13C\";\n}\n.fa-anchor:before {\n content: \"\\F13D\";\n}\n.fa-unlock-alt:before {\n content: \"\\F13E\";\n}\n.fa-bullseye:before {\n content: \"\\F140\";\n}\n.fa-ellipsis-h:before {\n content: \"\\F141\";\n}\n.fa-ellipsis-v:before {\n content: \"\\F142\";\n}\n.fa-rss-square:before {\n content: \"\\F143\";\n}\n.fa-play-circle:before {\n content: \"\\F144\";\n}\n.fa-ticket:before {\n content: \"\\F145\";\n}\n.fa-minus-square:before {\n content: \"\\F146\";\n}\n.fa-minus-square-o:before {\n content: \"\\F147\";\n}\n.fa-level-up:before {\n content: \"\\F148\";\n}\n.fa-level-down:before {\n content: \"\\F149\";\n}\n.fa-check-square:before {\n content: \"\\F14A\";\n}\n.fa-pencil-square:before {\n content: \"\\F14B\";\n}\n.fa-external-link-square:before {\n content: \"\\F14C\";\n}\n.fa-share-square:before {\n content: \"\\F14D\";\n}\n.fa-compass:before {\n content: \"\\F14E\";\n}\n.fa-toggle-down:before,\n.fa-caret-square-o-down:before {\n content: \"\\F150\";\n}\n.fa-toggle-up:before,\n.fa-caret-square-o-up:before {\n content: \"\\F151\";\n}\n.fa-toggle-right:before,\n.fa-caret-square-o-right:before {\n content: \"\\F152\";\n}\n.fa-euro:before,\n.fa-eur:before {\n content: \"\\F153\";\n}\n.fa-gbp:before {\n content: \"\\F154\";\n}\n.fa-dollar:before,\n.fa-usd:before {\n content: \"\\F155\";\n}\n.fa-rupee:before,\n.fa-inr:before {\n content: \"\\F156\";\n}\n.fa-cny:before,\n.fa-rmb:before,\n.fa-yen:before,\n.fa-jpy:before {\n content: \"\\F157\";\n}\n.fa-ruble:before,\n.fa-rouble:before,\n.fa-rub:before {\n content: \"\\F158\";\n}\n.fa-won:before,\n.fa-krw:before {\n content: \"\\F159\";\n}\n.fa-bitcoin:before,\n.fa-btc:before {\n content: \"\\F15A\";\n}\n.fa-file:before {\n content: \"\\F15B\";\n}\n.fa-file-text:before {\n content: \"\\F15C\";\n}\n.fa-sort-alpha-asc:before {\n content: \"\\F15D\";\n}\n.fa-sort-alpha-desc:before {\n content: \"\\F15E\";\n}\n.fa-sort-amount-asc:before {\n content: \"\\F160\";\n}\n.fa-sort-amount-desc:before {\n content: \"\\F161\";\n}\n.fa-sort-numeric-asc:before {\n content: \"\\F162\";\n}\n.fa-sort-numeric-desc:before {\n content: \"\\F163\";\n}\n.fa-thumbs-up:before {\n content: \"\\F164\";\n}\n.fa-thumbs-down:before {\n content: \"\\F165\";\n}\n.fa-youtube-square:before {\n content: \"\\F166\";\n}\n.fa-youtube:before {\n content: \"\\F167\";\n}\n.fa-xing:before {\n content: \"\\F168\";\n}\n.fa-xing-square:before {\n content: \"\\F169\";\n}\n.fa-youtube-play:before {\n content: \"\\F16A\";\n}\n.fa-dropbox:before {\n content: \"\\F16B\";\n}\n.fa-stack-overflow:before {\n content: \"\\F16C\";\n}\n.fa-instagram:before {\n content: \"\\F16D\";\n}\n.fa-flickr:before {\n content: \"\\F16E\";\n}\n.fa-adn:before {\n content: \"\\F170\";\n}\n.fa-bitbucket:before {\n content: \"\\F171\";\n}\n.fa-bitbucket-square:before {\n content: \"\\F172\";\n}\n.fa-tumblr:before {\n content: \"\\F173\";\n}\n.fa-tumblr-square:before {\n content: \"\\F174\";\n}\n.fa-long-arrow-down:before {\n content: \"\\F175\";\n}\n.fa-long-arrow-up:before {\n content: \"\\F176\";\n}\n.fa-long-arrow-left:before {\n content: \"\\F177\";\n}\n.fa-long-arrow-right:before {\n content: \"\\F178\";\n}\n.fa-apple:before {\n content: \"\\F179\";\n}\n.fa-windows:before {\n content: \"\\F17A\";\n}\n.fa-android:before {\n content: \"\\F17B\";\n}\n.fa-linux:before {\n content: \"\\F17C\";\n}\n.fa-dribbble:before {\n content: \"\\F17D\";\n}\n.fa-skype:before {\n content: \"\\F17E\";\n}\n.fa-foursquare:before {\n content: \"\\F180\";\n}\n.fa-trello:before {\n content: \"\\F181\";\n}\n.fa-female:before {\n content: \"\\F182\";\n}\n.fa-male:before {\n content: \"\\F183\";\n}\n.fa-gittip:before,\n.fa-gratipay:before {\n content: \"\\F184\";\n}\n.fa-sun-o:before {\n content: \"\\F185\";\n}\n.fa-moon-o:before {\n content: \"\\F186\";\n}\n.fa-archive:before {\n content: \"\\F187\";\n}\n.fa-bug:before {\n content: \"\\F188\";\n}\n.fa-vk:before {\n content: \"\\F189\";\n}\n.fa-weibo:before {\n content: \"\\F18A\";\n}\n.fa-renren:before {\n content: \"\\F18B\";\n}\n.fa-pagelines:before {\n content: \"\\F18C\";\n}\n.fa-stack-exchange:before {\n content: \"\\F18D\";\n}\n.fa-arrow-circle-o-right:before {\n content: \"\\F18E\";\n}\n.fa-arrow-circle-o-left:before {\n content: \"\\F190\";\n}\n.fa-toggle-left:before,\n.fa-caret-square-o-left:before {\n content: \"\\F191\";\n}\n.fa-dot-circle-o:before {\n content: \"\\F192\";\n}\n.fa-wheelchair:before {\n content: \"\\F193\";\n}\n.fa-vimeo-square:before {\n content: \"\\F194\";\n}\n.fa-turkish-lira:before,\n.fa-try:before {\n content: \"\\F195\";\n}\n.fa-plus-square-o:before {\n content: \"\\F196\";\n}\n.fa-space-shuttle:before {\n content: \"\\F197\";\n}\n.fa-slack:before {\n content: \"\\F198\";\n}\n.fa-envelope-square:before {\n content: \"\\F199\";\n}\n.fa-wordpress:before {\n content: \"\\F19A\";\n}\n.fa-openid:before {\n content: \"\\F19B\";\n}\n.fa-institution:before,\n.fa-bank:before,\n.fa-university:before {\n content: \"\\F19C\";\n}\n.fa-mortar-board:before,\n.fa-graduation-cap:before {\n content: \"\\F19D\";\n}\n.fa-yahoo:before {\n content: \"\\F19E\";\n}\n.fa-google:before {\n content: \"\\F1A0\";\n}\n.fa-reddit:before {\n content: \"\\F1A1\";\n}\n.fa-reddit-square:before {\n content: \"\\F1A2\";\n}\n.fa-stumbleupon-circle:before {\n content: \"\\F1A3\";\n}\n.fa-stumbleupon:before {\n content: \"\\F1A4\";\n}\n.fa-delicious:before {\n content: \"\\F1A5\";\n}\n.fa-digg:before {\n content: \"\\F1A6\";\n}\n.fa-pied-piper-pp:before {\n content: \"\\F1A7\";\n}\n.fa-pied-piper-alt:before {\n content: \"\\F1A8\";\n}\n.fa-drupal:before {\n content: \"\\F1A9\";\n}\n.fa-joomla:before {\n content: \"\\F1AA\";\n}\n.fa-language:before {\n content: \"\\F1AB\";\n}\n.fa-fax:before {\n content: \"\\F1AC\";\n}\n.fa-building:before {\n content: \"\\F1AD\";\n}\n.fa-child:before {\n content: \"\\F1AE\";\n}\n.fa-paw:before {\n content: \"\\F1B0\";\n}\n.fa-spoon:before {\n content: \"\\F1B1\";\n}\n.fa-cube:before {\n content: \"\\F1B2\";\n}\n.fa-cubes:before {\n content: \"\\F1B3\";\n}\n.fa-behance:before {\n content: \"\\F1B4\";\n}\n.fa-behance-square:before {\n content: \"\\F1B5\";\n}\n.fa-steam:before {\n content: \"\\F1B6\";\n}\n.fa-steam-square:before {\n content: \"\\F1B7\";\n}\n.fa-recycle:before {\n content: \"\\F1B8\";\n}\n.fa-automobile:before,\n.fa-car:before {\n content: \"\\F1B9\";\n}\n.fa-cab:before,\n.fa-taxi:before {\n content: \"\\F1BA\";\n}\n.fa-tree:before {\n content: \"\\F1BB\";\n}\n.fa-spotify:before {\n content: \"\\F1BC\";\n}\n.fa-deviantart:before {\n content: \"\\F1BD\";\n}\n.fa-soundcloud:before {\n content: \"\\F1BE\";\n}\n.fa-database:before {\n content: \"\\F1C0\";\n}\n.fa-file-pdf-o:before {\n content: \"\\F1C1\";\n}\n.fa-file-word-o:before {\n content: \"\\F1C2\";\n}\n.fa-file-excel-o:before {\n content: \"\\F1C3\";\n}\n.fa-file-powerpoint-o:before {\n content: \"\\F1C4\";\n}\n.fa-file-photo-o:before,\n.fa-file-picture-o:before,\n.fa-file-image-o:before {\n content: \"\\F1C5\";\n}\n.fa-file-zip-o:before,\n.fa-file-archive-o:before {\n content: \"\\F1C6\";\n}\n.fa-file-sound-o:before,\n.fa-file-audio-o:before {\n content: \"\\F1C7\";\n}\n.fa-file-movie-o:before,\n.fa-file-video-o:before {\n content: \"\\F1C8\";\n}\n.fa-file-code-o:before {\n content: \"\\F1C9\";\n}\n.fa-vine:before {\n content: \"\\F1CA\";\n}\n.fa-codepen:before {\n content: \"\\F1CB\";\n}\n.fa-jsfiddle:before {\n content: \"\\F1CC\";\n}\n.fa-life-bouy:before,\n.fa-life-buoy:before,\n.fa-life-saver:before,\n.fa-support:before,\n.fa-life-ring:before {\n content: \"\\F1CD\";\n}\n.fa-circle-o-notch:before {\n content: \"\\F1CE\";\n}\n.fa-ra:before,\n.fa-resistance:before,\n.fa-rebel:before {\n content: \"\\F1D0\";\n}\n.fa-ge:before,\n.fa-empire:before {\n content: \"\\F1D1\";\n}\n.fa-git-square:before {\n content: \"\\F1D2\";\n}\n.fa-git:before {\n content: \"\\F1D3\";\n}\n.fa-y-combinator-square:before,\n.fa-yc-square:before,\n.fa-hacker-news:before {\n content: \"\\F1D4\";\n}\n.fa-tencent-weibo:before {\n content: \"\\F1D5\";\n}\n.fa-qq:before {\n content: \"\\F1D6\";\n}\n.fa-wechat:before,\n.fa-weixin:before {\n content: \"\\F1D7\";\n}\n.fa-send:before,\n.fa-paper-plane:before {\n content: \"\\F1D8\";\n}\n.fa-send-o:before,\n.fa-paper-plane-o:before {\n content: \"\\F1D9\";\n}\n.fa-history:before {\n content: \"\\F1DA\";\n}\n.fa-circle-thin:before {\n content: \"\\F1DB\";\n}\n.fa-header:before {\n content: \"\\F1DC\";\n}\n.fa-paragraph:before {\n content: \"\\F1DD\";\n}\n.fa-sliders:before {\n content: \"\\F1DE\";\n}\n.fa-share-alt:before {\n content: \"\\F1E0\";\n}\n.fa-share-alt-square:before {\n content: \"\\F1E1\";\n}\n.fa-bomb:before {\n content: \"\\F1E2\";\n}\n.fa-soccer-ball-o:before,\n.fa-futbol-o:before {\n content: \"\\F1E3\";\n}\n.fa-tty:before {\n content: \"\\F1E4\";\n}\n.fa-binoculars:before {\n content: \"\\F1E5\";\n}\n.fa-plug:before {\n content: \"\\F1E6\";\n}\n.fa-slideshare:before {\n content: \"\\F1E7\";\n}\n.fa-twitch:before {\n content: \"\\F1E8\";\n}\n.fa-yelp:before {\n content: \"\\F1E9\";\n}\n.fa-newspaper-o:before {\n content: \"\\F1EA\";\n}\n.fa-wifi:before {\n content: \"\\F1EB\";\n}\n.fa-calculator:before {\n content: \"\\F1EC\";\n}\n.fa-paypal:before {\n content: \"\\F1ED\";\n}\n.fa-google-wallet:before {\n content: \"\\F1EE\";\n}\n.fa-cc-visa:before {\n content: \"\\F1F0\";\n}\n.fa-cc-mastercard:before {\n content: \"\\F1F1\";\n}\n.fa-cc-discover:before {\n content: \"\\F1F2\";\n}\n.fa-cc-amex:before {\n content: \"\\F1F3\";\n}\n.fa-cc-paypal:before {\n content: \"\\F1F4\";\n}\n.fa-cc-stripe:before {\n content: \"\\F1F5\";\n}\n.fa-bell-slash:before {\n content: \"\\F1F6\";\n}\n.fa-bell-slash-o:before {\n content: \"\\F1F7\";\n}\n.fa-trash:before {\n content: \"\\F1F8\";\n}\n.fa-copyright:before {\n content: \"\\F1F9\";\n}\n.fa-at:before {\n content: \"\\F1FA\";\n}\n.fa-eyedropper:before {\n content: \"\\F1FB\";\n}\n.fa-paint-brush:before {\n content: \"\\F1FC\";\n}\n.fa-birthday-cake:before {\n content: \"\\F1FD\";\n}\n.fa-area-chart:before {\n content: \"\\F1FE\";\n}\n.fa-pie-chart:before {\n content: \"\\F200\";\n}\n.fa-line-chart:before {\n content: \"\\F201\";\n}\n.fa-lastfm:before {\n content: \"\\F202\";\n}\n.fa-lastfm-square:before {\n content: \"\\F203\";\n}\n.fa-toggle-off:before {\n content: \"\\F204\";\n}\n.fa-toggle-on:before {\n content: \"\\F205\";\n}\n.fa-bicycle:before {\n content: \"\\F206\";\n}\n.fa-bus:before {\n content: \"\\F207\";\n}\n.fa-ioxhost:before {\n content: \"\\F208\";\n}\n.fa-angellist:before {\n content: \"\\F209\";\n}\n.fa-cc:before {\n content: \"\\F20A\";\n}\n.fa-shekel:before,\n.fa-sheqel:before,\n.fa-ils:before {\n content: \"\\F20B\";\n}\n.fa-meanpath:before {\n content: \"\\F20C\";\n}\n.fa-buysellads:before {\n content: \"\\F20D\";\n}\n.fa-connectdevelop:before {\n content: \"\\F20E\";\n}\n.fa-dashcube:before {\n content: \"\\F210\";\n}\n.fa-forumbee:before {\n content: \"\\F211\";\n}\n.fa-leanpub:before {\n content: \"\\F212\";\n}\n.fa-sellsy:before {\n content: \"\\F213\";\n}\n.fa-shirtsinbulk:before {\n content: \"\\F214\";\n}\n.fa-simplybuilt:before {\n content: \"\\F215\";\n}\n.fa-skyatlas:before {\n content: \"\\F216\";\n}\n.fa-cart-plus:before {\n content: \"\\F217\";\n}\n.fa-cart-arrow-down:before {\n content: \"\\F218\";\n}\n.fa-diamond:before {\n content: \"\\F219\";\n}\n.fa-ship:before {\n content: \"\\F21A\";\n}\n.fa-user-secret:before {\n content: \"\\F21B\";\n}\n.fa-motorcycle:before {\n content: \"\\F21C\";\n}\n.fa-street-view:before {\n content: \"\\F21D\";\n}\n.fa-heartbeat:before {\n content: \"\\F21E\";\n}\n.fa-venus:before {\n content: \"\\F221\";\n}\n.fa-mars:before {\n content: \"\\F222\";\n}\n.fa-mercury:before {\n content: \"\\F223\";\n}\n.fa-intersex:before,\n.fa-transgender:before {\n content: \"\\F224\";\n}\n.fa-transgender-alt:before {\n content: \"\\F225\";\n}\n.fa-venus-double:before {\n content: \"\\F226\";\n}\n.fa-mars-double:before {\n content: \"\\F227\";\n}\n.fa-venus-mars:before {\n content: \"\\F228\";\n}\n.fa-mars-stroke:before {\n content: \"\\F229\";\n}\n.fa-mars-stroke-v:before {\n content: \"\\F22A\";\n}\n.fa-mars-stroke-h:before {\n content: \"\\F22B\";\n}\n.fa-neuter:before {\n content: \"\\F22C\";\n}\n.fa-genderless:before {\n content: \"\\F22D\";\n}\n.fa-facebook-official:before {\n content: \"\\F230\";\n}\n.fa-pinterest-p:before {\n content: \"\\F231\";\n}\n.fa-whatsapp:before {\n content: \"\\F232\";\n}\n.fa-server:before {\n content: \"\\F233\";\n}\n.fa-user-plus:before {\n content: \"\\F234\";\n}\n.fa-user-times:before {\n content: \"\\F235\";\n}\n.fa-hotel:before,\n.fa-bed:before {\n content: \"\\F236\";\n}\n.fa-viacoin:before {\n content: \"\\F237\";\n}\n.fa-train:before {\n content: \"\\F238\";\n}\n.fa-subway:before {\n content: \"\\F239\";\n}\n.fa-medium:before {\n content: \"\\F23A\";\n}\n.fa-yc:before,\n.fa-y-combinator:before {\n content: \"\\F23B\";\n}\n.fa-optin-monster:before {\n content: \"\\F23C\";\n}\n.fa-opencart:before {\n content: \"\\F23D\";\n}\n.fa-expeditedssl:before {\n content: \"\\F23E\";\n}\n.fa-battery-4:before,\n.fa-battery:before,\n.fa-battery-full:before {\n content: \"\\F240\";\n}\n.fa-battery-3:before,\n.fa-battery-three-quarters:before {\n content: \"\\F241\";\n}\n.fa-battery-2:before,\n.fa-battery-half:before {\n content: \"\\F242\";\n}\n.fa-battery-1:before,\n.fa-battery-quarter:before {\n content: \"\\F243\";\n}\n.fa-battery-0:before,\n.fa-battery-empty:before {\n content: \"\\F244\";\n}\n.fa-mouse-pointer:before {\n content: \"\\F245\";\n}\n.fa-i-cursor:before {\n content: \"\\F246\";\n}\n.fa-object-group:before {\n content: \"\\F247\";\n}\n.fa-object-ungroup:before {\n content: \"\\F248\";\n}\n.fa-sticky-note:before {\n content: \"\\F249\";\n}\n.fa-sticky-note-o:before {\n content: \"\\F24A\";\n}\n.fa-cc-jcb:before {\n content: \"\\F24B\";\n}\n.fa-cc-diners-club:before {\n content: \"\\F24C\";\n}\n.fa-clone:before {\n content: \"\\F24D\";\n}\n.fa-balance-scale:before {\n content: \"\\F24E\";\n}\n.fa-hourglass-o:before {\n content: \"\\F250\";\n}\n.fa-hourglass-1:before,\n.fa-hourglass-start:before {\n content: \"\\F251\";\n}\n.fa-hourglass-2:before,\n.fa-hourglass-half:before {\n content: \"\\F252\";\n}\n.fa-hourglass-3:before,\n.fa-hourglass-end:before {\n content: \"\\F253\";\n}\n.fa-hourglass:before {\n content: \"\\F254\";\n}\n.fa-hand-grab-o:before,\n.fa-hand-rock-o:before {\n content: \"\\F255\";\n}\n.fa-hand-stop-o:before,\n.fa-hand-paper-o:before {\n content: \"\\F256\";\n}\n.fa-hand-scissors-o:before {\n content: \"\\F257\";\n}\n.fa-hand-lizard-o:before {\n content: \"\\F258\";\n}\n.fa-hand-spock-o:before {\n content: \"\\F259\";\n}\n.fa-hand-pointer-o:before {\n content: \"\\F25A\";\n}\n.fa-hand-peace-o:before {\n content: \"\\F25B\";\n}\n.fa-trademark:before {\n content: \"\\F25C\";\n}\n.fa-registered:before {\n content: \"\\F25D\";\n}\n.fa-creative-commons:before {\n content: \"\\F25E\";\n}\n.fa-gg:before {\n content: \"\\F260\";\n}\n.fa-gg-circle:before {\n content: \"\\F261\";\n}\n.fa-tripadvisor:before {\n content: \"\\F262\";\n}\n.fa-odnoklassniki:before {\n content: \"\\F263\";\n}\n.fa-odnoklassniki-square:before {\n content: \"\\F264\";\n}\n.fa-get-pocket:before {\n content: \"\\F265\";\n}\n.fa-wikipedia-w:before {\n content: \"\\F266\";\n}\n.fa-safari:before {\n content: \"\\F267\";\n}\n.fa-chrome:before {\n content: \"\\F268\";\n}\n.fa-firefox:before {\n content: \"\\F269\";\n}\n.fa-opera:before {\n content: \"\\F26A\";\n}\n.fa-internet-explorer:before {\n content: \"\\F26B\";\n}\n.fa-tv:before,\n.fa-television:before {\n content: \"\\F26C\";\n}\n.fa-contao:before {\n content: \"\\F26D\";\n}\n.fa-500px:before {\n content: \"\\F26E\";\n}\n.fa-amazon:before {\n content: \"\\F270\";\n}\n.fa-calendar-plus-o:before {\n content: \"\\F271\";\n}\n.fa-calendar-minus-o:before {\n content: \"\\F272\";\n}\n.fa-calendar-times-o:before {\n content: \"\\F273\";\n}\n.fa-calendar-check-o:before {\n content: \"\\F274\";\n}\n.fa-industry:before {\n content: \"\\F275\";\n}\n.fa-map-pin:before {\n content: \"\\F276\";\n}\n.fa-map-signs:before {\n content: \"\\F277\";\n}\n.fa-map-o:before {\n content: \"\\F278\";\n}\n.fa-map:before {\n content: \"\\F279\";\n}\n.fa-commenting:before {\n content: \"\\F27A\";\n}\n.fa-commenting-o:before {\n content: \"\\F27B\";\n}\n.fa-houzz:before {\n content: \"\\F27C\";\n}\n.fa-vimeo:before {\n content: \"\\F27D\";\n}\n.fa-black-tie:before {\n content: \"\\F27E\";\n}\n.fa-fonticons:before {\n content: \"\\F280\";\n}\n.fa-reddit-alien:before {\n content: \"\\F281\";\n}\n.fa-edge:before {\n content: \"\\F282\";\n}\n.fa-credit-card-alt:before {\n content: \"\\F283\";\n}\n.fa-codiepie:before {\n content: \"\\F284\";\n}\n.fa-modx:before {\n content: \"\\F285\";\n}\n.fa-fort-awesome:before {\n content: \"\\F286\";\n}\n.fa-usb:before {\n content: \"\\F287\";\n}\n.fa-product-hunt:before {\n content: \"\\F288\";\n}\n.fa-mixcloud:before {\n content: \"\\F289\";\n}\n.fa-scribd:before {\n content: \"\\F28A\";\n}\n.fa-pause-circle:before {\n content: \"\\F28B\";\n}\n.fa-pause-circle-o:before {\n content: \"\\F28C\";\n}\n.fa-stop-circle:before {\n content: \"\\F28D\";\n}\n.fa-stop-circle-o:before {\n content: \"\\F28E\";\n}\n.fa-shopping-bag:before {\n content: \"\\F290\";\n}\n.fa-shopping-basket:before {\n content: \"\\F291\";\n}\n.fa-hashtag:before {\n content: \"\\F292\";\n}\n.fa-bluetooth:before {\n content: \"\\F293\";\n}\n.fa-bluetooth-b:before {\n content: \"\\F294\";\n}\n.fa-percent:before {\n content: \"\\F295\";\n}\n.fa-gitlab:before {\n content: \"\\F296\";\n}\n.fa-wpbeginner:before {\n content: \"\\F297\";\n}\n.fa-wpforms:before {\n content: \"\\F298\";\n}\n.fa-envira:before {\n content: \"\\F299\";\n}\n.fa-universal-access:before {\n content: \"\\F29A\";\n}\n.fa-wheelchair-alt:before {\n content: \"\\F29B\";\n}\n.fa-question-circle-o:before {\n content: \"\\F29C\";\n}\n.fa-blind:before {\n content: \"\\F29D\";\n}\n.fa-audio-description:before {\n content: \"\\F29E\";\n}\n.fa-volume-control-phone:before {\n content: \"\\F2A0\";\n}\n.fa-braille:before {\n content: \"\\F2A1\";\n}\n.fa-assistive-listening-systems:before {\n content: \"\\F2A2\";\n}\n.fa-asl-interpreting:before,\n.fa-american-sign-language-interpreting:before {\n content: \"\\F2A3\";\n}\n.fa-deafness:before,\n.fa-hard-of-hearing:before,\n.fa-deaf:before {\n content: \"\\F2A4\";\n}\n.fa-glide:before {\n content: \"\\F2A5\";\n}\n.fa-glide-g:before {\n content: \"\\F2A6\";\n}\n.fa-signing:before,\n.fa-sign-language:before {\n content: \"\\F2A7\";\n}\n.fa-low-vision:before {\n content: \"\\F2A8\";\n}\n.fa-viadeo:before {\n content: \"\\F2A9\";\n}\n.fa-viadeo-square:before {\n content: \"\\F2AA\";\n}\n.fa-snapchat:before {\n content: \"\\F2AB\";\n}\n.fa-snapchat-ghost:before {\n content: \"\\F2AC\";\n}\n.fa-snapchat-square:before {\n content: \"\\F2AD\";\n}\n.fa-pied-piper:before {\n content: \"\\F2AE\";\n}\n.fa-first-order:before {\n content: \"\\F2B0\";\n}\n.fa-yoast:before {\n content: \"\\F2B1\";\n}\n.fa-themeisle:before {\n content: \"\\F2B2\";\n}\n.fa-google-plus-circle:before,\n.fa-google-plus-official:before {\n content: \"\\F2B3\";\n}\n.fa-fa:before,\n.fa-font-awesome:before {\n content: \"\\F2B4\";\n}\n.fa-handshake-o:before {\n content: \"\\F2B5\";\n}\n.fa-envelope-open:before {\n content: \"\\F2B6\";\n}\n.fa-envelope-open-o:before {\n content: \"\\F2B7\";\n}\n.fa-linode:before {\n content: \"\\F2B8\";\n}\n.fa-address-book:before {\n content: \"\\F2B9\";\n}\n.fa-address-book-o:before {\n content: \"\\F2BA\";\n}\n.fa-vcard:before,\n.fa-address-card:before {\n content: \"\\F2BB\";\n}\n.fa-vcard-o:before,\n.fa-address-card-o:before {\n content: \"\\F2BC\";\n}\n.fa-user-circle:before {\n content: \"\\F2BD\";\n}\n.fa-user-circle-o:before {\n content: \"\\F2BE\";\n}\n.fa-user-o:before {\n content: \"\\F2C0\";\n}\n.fa-id-badge:before {\n content: \"\\F2C1\";\n}\n.fa-drivers-license:before,\n.fa-id-card:before {\n content: \"\\F2C2\";\n}\n.fa-drivers-license-o:before,\n.fa-id-card-o:before {\n content: \"\\F2C3\";\n}\n.fa-quora:before {\n content: \"\\F2C4\";\n}\n.fa-free-code-camp:before {\n content: \"\\F2C5\";\n}\n.fa-telegram:before {\n content: \"\\F2C6\";\n}\n.fa-thermometer-4:before,\n.fa-thermometer:before,\n.fa-thermometer-full:before {\n content: \"\\F2C7\";\n}\n.fa-thermometer-3:before,\n.fa-thermometer-three-quarters:before {\n content: \"\\F2C8\";\n}\n.fa-thermometer-2:before,\n.fa-thermometer-half:before {\n content: \"\\F2C9\";\n}\n.fa-thermometer-1:before,\n.fa-thermometer-quarter:before {\n content: \"\\F2CA\";\n}\n.fa-thermometer-0:before,\n.fa-thermometer-empty:before {\n content: \"\\F2CB\";\n}\n.fa-shower:before {\n content: \"\\F2CC\";\n}\n.fa-bathtub:before,\n.fa-s15:before,\n.fa-bath:before {\n content: \"\\F2CD\";\n}\n.fa-podcast:before {\n content: \"\\F2CE\";\n}\n.fa-window-maximize:before {\n content: \"\\F2D0\";\n}\n.fa-window-minimize:before {\n content: \"\\F2D1\";\n}\n.fa-window-restore:before {\n content: \"\\F2D2\";\n}\n.fa-times-rectangle:before,\n.fa-window-close:before {\n content: \"\\F2D3\";\n}\n.fa-times-rectangle-o:before,\n.fa-window-close-o:before {\n content: \"\\F2D4\";\n}\n.fa-bandcamp:before {\n content: \"\\F2D5\";\n}\n.fa-grav:before {\n content: \"\\F2D6\";\n}\n.fa-etsy:before {\n content: \"\\F2D7\";\n}\n.fa-imdb:before {\n content: \"\\F2D8\";\n}\n.fa-ravelry:before {\n content: \"\\F2D9\";\n}\n.fa-eercast:before {\n content: \"\\F2DA\";\n}\n.fa-microchip:before {\n content: \"\\F2DB\";\n}\n.fa-snowflake-o:before {\n content: \"\\F2DC\";\n}\n.fa-superpowers:before {\n content: \"\\F2DD\";\n}\n.fa-wpexplorer:before {\n content: \"\\F2DE\";\n}\n.fa-meetup:before {\n content: \"\\F2E0\";\n}\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n border: 0;\n}\n.sr-only-focusable:active,\n.sr-only-focusable:focus {\n position: static;\n width: auto;\n height: auto;\n margin: 0;\n overflow: visible;\n clip: auto;\n}\n", ""]); + +// exports + + +/***/ }), + +/***/ "./node_modules/css-loader/index.js?{\"importLoaders\":1}!./node_modules/postcss-loader/lib/index.js?{\"ident\":\"postcss\"}!./node_modules/materialize-css/dist/css/materialize.css": +/*!*******************************************************************************************************************************************************************!*\ + !*** ./node_modules/css-loader?{"importLoaders":1}!./node_modules/postcss-loader/lib?{"ident":"postcss"}!./node_modules/materialize-css/dist/css/materialize.css ***! + \*******************************************************************************************************************************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +exports = module.exports = __webpack_require__(/*! ../../../css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(undefined); +// imports + + +// module +exports.push([module.i, "/*!\r\n * Materialize v0.100.2 (http://materializecss.com)\r\n * Copyright 2014-2017 Materialize\r\n * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)\r\n */\r\n.materialize-red {\n background-color: #e51c23 !important;\n}\n\n.materialize-red-text {\n color: #e51c23 !important;\n}\n\n.materialize-red.lighten-5 {\n background-color: #fdeaeb !important;\n}\n\n.materialize-red-text.text-lighten-5 {\n color: #fdeaeb !important;\n}\n\n.materialize-red.lighten-4 {\n background-color: #f8c1c3 !important;\n}\n\n.materialize-red-text.text-lighten-4 {\n color: #f8c1c3 !important;\n}\n\n.materialize-red.lighten-3 {\n background-color: #f3989b !important;\n}\n\n.materialize-red-text.text-lighten-3 {\n color: #f3989b !important;\n}\n\n.materialize-red.lighten-2 {\n background-color: #ee6e73 !important;\n}\n\n.materialize-red-text.text-lighten-2 {\n color: #ee6e73 !important;\n}\n\n.materialize-red.lighten-1 {\n background-color: #ea454b !important;\n}\n\n.materialize-red-text.text-lighten-1 {\n color: #ea454b !important;\n}\n\n.materialize-red.darken-1 {\n background-color: #d0181e !important;\n}\n\n.materialize-red-text.text-darken-1 {\n color: #d0181e !important;\n}\n\n.materialize-red.darken-2 {\n background-color: #b9151b !important;\n}\n\n.materialize-red-text.text-darken-2 {\n color: #b9151b !important;\n}\n\n.materialize-red.darken-3 {\n background-color: #a21318 !important;\n}\n\n.materialize-red-text.text-darken-3 {\n color: #a21318 !important;\n}\n\n.materialize-red.darken-4 {\n background-color: #8b1014 !important;\n}\n\n.materialize-red-text.text-darken-4 {\n color: #8b1014 !important;\n}\n\n.red {\n background-color: #F44336 !important;\n}\n\n.red-text {\n color: #F44336 !important;\n}\n\n.red.lighten-5 {\n background-color: #FFEBEE !important;\n}\n\n.red-text.text-lighten-5 {\n color: #FFEBEE !important;\n}\n\n.red.lighten-4 {\n background-color: #FFCDD2 !important;\n}\n\n.red-text.text-lighten-4 {\n color: #FFCDD2 !important;\n}\n\n.red.lighten-3 {\n background-color: #EF9A9A !important;\n}\n\n.red-text.text-lighten-3 {\n color: #EF9A9A !important;\n}\n\n.red.lighten-2 {\n background-color: #E57373 !important;\n}\n\n.red-text.text-lighten-2 {\n color: #E57373 !important;\n}\n\n.red.lighten-1 {\n background-color: #EF5350 !important;\n}\n\n.red-text.text-lighten-1 {\n color: #EF5350 !important;\n}\n\n.red.darken-1 {\n background-color: #E53935 !important;\n}\n\n.red-text.text-darken-1 {\n color: #E53935 !important;\n}\n\n.red.darken-2 {\n background-color: #D32F2F !important;\n}\n\n.red-text.text-darken-2 {\n color: #D32F2F !important;\n}\n\n.red.darken-3 {\n background-color: #C62828 !important;\n}\n\n.red-text.text-darken-3 {\n color: #C62828 !important;\n}\n\n.red.darken-4 {\n background-color: #B71C1C !important;\n}\n\n.red-text.text-darken-4 {\n color: #B71C1C !important;\n}\n\n.red.accent-1 {\n background-color: #FF8A80 !important;\n}\n\n.red-text.text-accent-1 {\n color: #FF8A80 !important;\n}\n\n.red.accent-2 {\n background-color: #FF5252 !important;\n}\n\n.red-text.text-accent-2 {\n color: #FF5252 !important;\n}\n\n.red.accent-3 {\n background-color: #FF1744 !important;\n}\n\n.red-text.text-accent-3 {\n color: #FF1744 !important;\n}\n\n.red.accent-4 {\n background-color: #D50000 !important;\n}\n\n.red-text.text-accent-4 {\n color: #D50000 !important;\n}\n\n.pink {\n background-color: #e91e63 !important;\n}\n\n.pink-text {\n color: #e91e63 !important;\n}\n\n.pink.lighten-5 {\n background-color: #fce4ec !important;\n}\n\n.pink-text.text-lighten-5 {\n color: #fce4ec !important;\n}\n\n.pink.lighten-4 {\n background-color: #f8bbd0 !important;\n}\n\n.pink-text.text-lighten-4 {\n color: #f8bbd0 !important;\n}\n\n.pink.lighten-3 {\n background-color: #f48fb1 !important;\n}\n\n.pink-text.text-lighten-3 {\n color: #f48fb1 !important;\n}\n\n.pink.lighten-2 {\n background-color: #f06292 !important;\n}\n\n.pink-text.text-lighten-2 {\n color: #f06292 !important;\n}\n\n.pink.lighten-1 {\n background-color: #ec407a !important;\n}\n\n.pink-text.text-lighten-1 {\n color: #ec407a !important;\n}\n\n.pink.darken-1 {\n background-color: #d81b60 !important;\n}\n\n.pink-text.text-darken-1 {\n color: #d81b60 !important;\n}\n\n.pink.darken-2 {\n background-color: #c2185b !important;\n}\n\n.pink-text.text-darken-2 {\n color: #c2185b !important;\n}\n\n.pink.darken-3 {\n background-color: #ad1457 !important;\n}\n\n.pink-text.text-darken-3 {\n color: #ad1457 !important;\n}\n\n.pink.darken-4 {\n background-color: #880e4f !important;\n}\n\n.pink-text.text-darken-4 {\n color: #880e4f !important;\n}\n\n.pink.accent-1 {\n background-color: #ff80ab !important;\n}\n\n.pink-text.text-accent-1 {\n color: #ff80ab !important;\n}\n\n.pink.accent-2 {\n background-color: #ff4081 !important;\n}\n\n.pink-text.text-accent-2 {\n color: #ff4081 !important;\n}\n\n.pink.accent-3 {\n background-color: #f50057 !important;\n}\n\n.pink-text.text-accent-3 {\n color: #f50057 !important;\n}\n\n.pink.accent-4 {\n background-color: #c51162 !important;\n}\n\n.pink-text.text-accent-4 {\n color: #c51162 !important;\n}\n\n.purple {\n background-color: #9c27b0 !important;\n}\n\n.purple-text {\n color: #9c27b0 !important;\n}\n\n.purple.lighten-5 {\n background-color: #f3e5f5 !important;\n}\n\n.purple-text.text-lighten-5 {\n color: #f3e5f5 !important;\n}\n\n.purple.lighten-4 {\n background-color: #e1bee7 !important;\n}\n\n.purple-text.text-lighten-4 {\n color: #e1bee7 !important;\n}\n\n.purple.lighten-3 {\n background-color: #ce93d8 !important;\n}\n\n.purple-text.text-lighten-3 {\n color: #ce93d8 !important;\n}\n\n.purple.lighten-2 {\n background-color: #ba68c8 !important;\n}\n\n.purple-text.text-lighten-2 {\n color: #ba68c8 !important;\n}\n\n.purple.lighten-1 {\n background-color: #ab47bc !important;\n}\n\n.purple-text.text-lighten-1 {\n color: #ab47bc !important;\n}\n\n.purple.darken-1 {\n background-color: #8e24aa !important;\n}\n\n.purple-text.text-darken-1 {\n color: #8e24aa !important;\n}\n\n.purple.darken-2 {\n background-color: #7b1fa2 !important;\n}\n\n.purple-text.text-darken-2 {\n color: #7b1fa2 !important;\n}\n\n.purple.darken-3 {\n background-color: #6a1b9a !important;\n}\n\n.purple-text.text-darken-3 {\n color: #6a1b9a !important;\n}\n\n.purple.darken-4 {\n background-color: #4a148c !important;\n}\n\n.purple-text.text-darken-4 {\n color: #4a148c !important;\n}\n\n.purple.accent-1 {\n background-color: #ea80fc !important;\n}\n\n.purple-text.text-accent-1 {\n color: #ea80fc !important;\n}\n\n.purple.accent-2 {\n background-color: #e040fb !important;\n}\n\n.purple-text.text-accent-2 {\n color: #e040fb !important;\n}\n\n.purple.accent-3 {\n background-color: #d500f9 !important;\n}\n\n.purple-text.text-accent-3 {\n color: #d500f9 !important;\n}\n\n.purple.accent-4 {\n background-color: #aa00ff !important;\n}\n\n.purple-text.text-accent-4 {\n color: #aa00ff !important;\n}\n\n.deep-purple {\n background-color: #673ab7 !important;\n}\n\n.deep-purple-text {\n color: #673ab7 !important;\n}\n\n.deep-purple.lighten-5 {\n background-color: #ede7f6 !important;\n}\n\n.deep-purple-text.text-lighten-5 {\n color: #ede7f6 !important;\n}\n\n.deep-purple.lighten-4 {\n background-color: #d1c4e9 !important;\n}\n\n.deep-purple-text.text-lighten-4 {\n color: #d1c4e9 !important;\n}\n\n.deep-purple.lighten-3 {\n background-color: #b39ddb !important;\n}\n\n.deep-purple-text.text-lighten-3 {\n color: #b39ddb !important;\n}\n\n.deep-purple.lighten-2 {\n background-color: #9575cd !important;\n}\n\n.deep-purple-text.text-lighten-2 {\n color: #9575cd !important;\n}\n\n.deep-purple.lighten-1 {\n background-color: #7e57c2 !important;\n}\n\n.deep-purple-text.text-lighten-1 {\n color: #7e57c2 !important;\n}\n\n.deep-purple.darken-1 {\n background-color: #5e35b1 !important;\n}\n\n.deep-purple-text.text-darken-1 {\n color: #5e35b1 !important;\n}\n\n.deep-purple.darken-2 {\n background-color: #512da8 !important;\n}\n\n.deep-purple-text.text-darken-2 {\n color: #512da8 !important;\n}\n\n.deep-purple.darken-3 {\n background-color: #4527a0 !important;\n}\n\n.deep-purple-text.text-darken-3 {\n color: #4527a0 !important;\n}\n\n.deep-purple.darken-4 {\n background-color: #311b92 !important;\n}\n\n.deep-purple-text.text-darken-4 {\n color: #311b92 !important;\n}\n\n.deep-purple.accent-1 {\n background-color: #b388ff !important;\n}\n\n.deep-purple-text.text-accent-1 {\n color: #b388ff !important;\n}\n\n.deep-purple.accent-2 {\n background-color: #7c4dff !important;\n}\n\n.deep-purple-text.text-accent-2 {\n color: #7c4dff !important;\n}\n\n.deep-purple.accent-3 {\n background-color: #651fff !important;\n}\n\n.deep-purple-text.text-accent-3 {\n color: #651fff !important;\n}\n\n.deep-purple.accent-4 {\n background-color: #6200ea !important;\n}\n\n.deep-purple-text.text-accent-4 {\n color: #6200ea !important;\n}\n\n.indigo {\n background-color: #3f51b5 !important;\n}\n\n.indigo-text {\n color: #3f51b5 !important;\n}\n\n.indigo.lighten-5 {\n background-color: #e8eaf6 !important;\n}\n\n.indigo-text.text-lighten-5 {\n color: #e8eaf6 !important;\n}\n\n.indigo.lighten-4 {\n background-color: #c5cae9 !important;\n}\n\n.indigo-text.text-lighten-4 {\n color: #c5cae9 !important;\n}\n\n.indigo.lighten-3 {\n background-color: #9fa8da !important;\n}\n\n.indigo-text.text-lighten-3 {\n color: #9fa8da !important;\n}\n\n.indigo.lighten-2 {\n background-color: #7986cb !important;\n}\n\n.indigo-text.text-lighten-2 {\n color: #7986cb !important;\n}\n\n.indigo.lighten-1 {\n background-color: #5c6bc0 !important;\n}\n\n.indigo-text.text-lighten-1 {\n color: #5c6bc0 !important;\n}\n\n.indigo.darken-1 {\n background-color: #3949ab !important;\n}\n\n.indigo-text.text-darken-1 {\n color: #3949ab !important;\n}\n\n.indigo.darken-2 {\n background-color: #303f9f !important;\n}\n\n.indigo-text.text-darken-2 {\n color: #303f9f !important;\n}\n\n.indigo.darken-3 {\n background-color: #283593 !important;\n}\n\n.indigo-text.text-darken-3 {\n color: #283593 !important;\n}\n\n.indigo.darken-4 {\n background-color: #1a237e !important;\n}\n\n.indigo-text.text-darken-4 {\n color: #1a237e !important;\n}\n\n.indigo.accent-1 {\n background-color: #8c9eff !important;\n}\n\n.indigo-text.text-accent-1 {\n color: #8c9eff !important;\n}\n\n.indigo.accent-2 {\n background-color: #536dfe !important;\n}\n\n.indigo-text.text-accent-2 {\n color: #536dfe !important;\n}\n\n.indigo.accent-3 {\n background-color: #3d5afe !important;\n}\n\n.indigo-text.text-accent-3 {\n color: #3d5afe !important;\n}\n\n.indigo.accent-4 {\n background-color: #304ffe !important;\n}\n\n.indigo-text.text-accent-4 {\n color: #304ffe !important;\n}\n\n.blue {\n background-color: #2196F3 !important;\n}\n\n.blue-text {\n color: #2196F3 !important;\n}\n\n.blue.lighten-5 {\n background-color: #E3F2FD !important;\n}\n\n.blue-text.text-lighten-5 {\n color: #E3F2FD !important;\n}\n\n.blue.lighten-4 {\n background-color: #BBDEFB !important;\n}\n\n.blue-text.text-lighten-4 {\n color: #BBDEFB !important;\n}\n\n.blue.lighten-3 {\n background-color: #90CAF9 !important;\n}\n\n.blue-text.text-lighten-3 {\n color: #90CAF9 !important;\n}\n\n.blue.lighten-2 {\n background-color: #64B5F6 !important;\n}\n\n.blue-text.text-lighten-2 {\n color: #64B5F6 !important;\n}\n\n.blue.lighten-1 {\n background-color: #42A5F5 !important;\n}\n\n.blue-text.text-lighten-1 {\n color: #42A5F5 !important;\n}\n\n.blue.darken-1 {\n background-color: #1E88E5 !important;\n}\n\n.blue-text.text-darken-1 {\n color: #1E88E5 !important;\n}\n\n.blue.darken-2 {\n background-color: #1976D2 !important;\n}\n\n.blue-text.text-darken-2 {\n color: #1976D2 !important;\n}\n\n.blue.darken-3 {\n background-color: #1565C0 !important;\n}\n\n.blue-text.text-darken-3 {\n color: #1565C0 !important;\n}\n\n.blue.darken-4 {\n background-color: #0D47A1 !important;\n}\n\n.blue-text.text-darken-4 {\n color: #0D47A1 !important;\n}\n\n.blue.accent-1 {\n background-color: #82B1FF !important;\n}\n\n.blue-text.text-accent-1 {\n color: #82B1FF !important;\n}\n\n.blue.accent-2 {\n background-color: #448AFF !important;\n}\n\n.blue-text.text-accent-2 {\n color: #448AFF !important;\n}\n\n.blue.accent-3 {\n background-color: #2979FF !important;\n}\n\n.blue-text.text-accent-3 {\n color: #2979FF !important;\n}\n\n.blue.accent-4 {\n background-color: #2962FF !important;\n}\n\n.blue-text.text-accent-4 {\n color: #2962FF !important;\n}\n\n.light-blue {\n background-color: #03a9f4 !important;\n}\n\n.light-blue-text {\n color: #03a9f4 !important;\n}\n\n.light-blue.lighten-5 {\n background-color: #e1f5fe !important;\n}\n\n.light-blue-text.text-lighten-5 {\n color: #e1f5fe !important;\n}\n\n.light-blue.lighten-4 {\n background-color: #b3e5fc !important;\n}\n\n.light-blue-text.text-lighten-4 {\n color: #b3e5fc !important;\n}\n\n.light-blue.lighten-3 {\n background-color: #81d4fa !important;\n}\n\n.light-blue-text.text-lighten-3 {\n color: #81d4fa !important;\n}\n\n.light-blue.lighten-2 {\n background-color: #4fc3f7 !important;\n}\n\n.light-blue-text.text-lighten-2 {\n color: #4fc3f7 !important;\n}\n\n.light-blue.lighten-1 {\n background-color: #29b6f6 !important;\n}\n\n.light-blue-text.text-lighten-1 {\n color: #29b6f6 !important;\n}\n\n.light-blue.darken-1 {\n background-color: #039be5 !important;\n}\n\n.light-blue-text.text-darken-1 {\n color: #039be5 !important;\n}\n\n.light-blue.darken-2 {\n background-color: #0288d1 !important;\n}\n\n.light-blue-text.text-darken-2 {\n color: #0288d1 !important;\n}\n\n.light-blue.darken-3 {\n background-color: #0277bd !important;\n}\n\n.light-blue-text.text-darken-3 {\n color: #0277bd !important;\n}\n\n.light-blue.darken-4 {\n background-color: #01579b !important;\n}\n\n.light-blue-text.text-darken-4 {\n color: #01579b !important;\n}\n\n.light-blue.accent-1 {\n background-color: #80d8ff !important;\n}\n\n.light-blue-text.text-accent-1 {\n color: #80d8ff !important;\n}\n\n.light-blue.accent-2 {\n background-color: #40c4ff !important;\n}\n\n.light-blue-text.text-accent-2 {\n color: #40c4ff !important;\n}\n\n.light-blue.accent-3 {\n background-color: #00b0ff !important;\n}\n\n.light-blue-text.text-accent-3 {\n color: #00b0ff !important;\n}\n\n.light-blue.accent-4 {\n background-color: #0091ea !important;\n}\n\n.light-blue-text.text-accent-4 {\n color: #0091ea !important;\n}\n\n.cyan {\n background-color: #00bcd4 !important;\n}\n\n.cyan-text {\n color: #00bcd4 !important;\n}\n\n.cyan.lighten-5 {\n background-color: #e0f7fa !important;\n}\n\n.cyan-text.text-lighten-5 {\n color: #e0f7fa !important;\n}\n\n.cyan.lighten-4 {\n background-color: #b2ebf2 !important;\n}\n\n.cyan-text.text-lighten-4 {\n color: #b2ebf2 !important;\n}\n\n.cyan.lighten-3 {\n background-color: #80deea !important;\n}\n\n.cyan-text.text-lighten-3 {\n color: #80deea !important;\n}\n\n.cyan.lighten-2 {\n background-color: #4dd0e1 !important;\n}\n\n.cyan-text.text-lighten-2 {\n color: #4dd0e1 !important;\n}\n\n.cyan.lighten-1 {\n background-color: #26c6da !important;\n}\n\n.cyan-text.text-lighten-1 {\n color: #26c6da !important;\n}\n\n.cyan.darken-1 {\n background-color: #00acc1 !important;\n}\n\n.cyan-text.text-darken-1 {\n color: #00acc1 !important;\n}\n\n.cyan.darken-2 {\n background-color: #0097a7 !important;\n}\n\n.cyan-text.text-darken-2 {\n color: #0097a7 !important;\n}\n\n.cyan.darken-3 {\n background-color: #00838f !important;\n}\n\n.cyan-text.text-darken-3 {\n color: #00838f !important;\n}\n\n.cyan.darken-4 {\n background-color: #006064 !important;\n}\n\n.cyan-text.text-darken-4 {\n color: #006064 !important;\n}\n\n.cyan.accent-1 {\n background-color: #84ffff !important;\n}\n\n.cyan-text.text-accent-1 {\n color: #84ffff !important;\n}\n\n.cyan.accent-2 {\n background-color: #18ffff !important;\n}\n\n.cyan-text.text-accent-2 {\n color: #18ffff !important;\n}\n\n.cyan.accent-3 {\n background-color: #00e5ff !important;\n}\n\n.cyan-text.text-accent-3 {\n color: #00e5ff !important;\n}\n\n.cyan.accent-4 {\n background-color: #00b8d4 !important;\n}\n\n.cyan-text.text-accent-4 {\n color: #00b8d4 !important;\n}\n\n.teal {\n background-color: #009688 !important;\n}\n\n.teal-text {\n color: #009688 !important;\n}\n\n.teal.lighten-5 {\n background-color: #e0f2f1 !important;\n}\n\n.teal-text.text-lighten-5 {\n color: #e0f2f1 !important;\n}\n\n.teal.lighten-4 {\n background-color: #b2dfdb !important;\n}\n\n.teal-text.text-lighten-4 {\n color: #b2dfdb !important;\n}\n\n.teal.lighten-3 {\n background-color: #80cbc4 !important;\n}\n\n.teal-text.text-lighten-3 {\n color: #80cbc4 !important;\n}\n\n.teal.lighten-2 {\n background-color: #4db6ac !important;\n}\n\n.teal-text.text-lighten-2 {\n color: #4db6ac !important;\n}\n\n.teal.lighten-1 {\n background-color: #26a69a !important;\n}\n\n.teal-text.text-lighten-1 {\n color: #26a69a !important;\n}\n\n.teal.darken-1 {\n background-color: #00897b !important;\n}\n\n.teal-text.text-darken-1 {\n color: #00897b !important;\n}\n\n.teal.darken-2 {\n background-color: #00796b !important;\n}\n\n.teal-text.text-darken-2 {\n color: #00796b !important;\n}\n\n.teal.darken-3 {\n background-color: #00695c !important;\n}\n\n.teal-text.text-darken-3 {\n color: #00695c !important;\n}\n\n.teal.darken-4 {\n background-color: #004d40 !important;\n}\n\n.teal-text.text-darken-4 {\n color: #004d40 !important;\n}\n\n.teal.accent-1 {\n background-color: #a7ffeb !important;\n}\n\n.teal-text.text-accent-1 {\n color: #a7ffeb !important;\n}\n\n.teal.accent-2 {\n background-color: #64ffda !important;\n}\n\n.teal-text.text-accent-2 {\n color: #64ffda !important;\n}\n\n.teal.accent-3 {\n background-color: #1de9b6 !important;\n}\n\n.teal-text.text-accent-3 {\n color: #1de9b6 !important;\n}\n\n.teal.accent-4 {\n background-color: #00bfa5 !important;\n}\n\n.teal-text.text-accent-4 {\n color: #00bfa5 !important;\n}\n\n.green {\n background-color: #4CAF50 !important;\n}\n\n.green-text {\n color: #4CAF50 !important;\n}\n\n.green.lighten-5 {\n background-color: #E8F5E9 !important;\n}\n\n.green-text.text-lighten-5 {\n color: #E8F5E9 !important;\n}\n\n.green.lighten-4 {\n background-color: #C8E6C9 !important;\n}\n\n.green-text.text-lighten-4 {\n color: #C8E6C9 !important;\n}\n\n.green.lighten-3 {\n background-color: #A5D6A7 !important;\n}\n\n.green-text.text-lighten-3 {\n color: #A5D6A7 !important;\n}\n\n.green.lighten-2 {\n background-color: #81C784 !important;\n}\n\n.green-text.text-lighten-2 {\n color: #81C784 !important;\n}\n\n.green.lighten-1 {\n background-color: #66BB6A !important;\n}\n\n.green-text.text-lighten-1 {\n color: #66BB6A !important;\n}\n\n.green.darken-1 {\n background-color: #43A047 !important;\n}\n\n.green-text.text-darken-1 {\n color: #43A047 !important;\n}\n\n.green.darken-2 {\n background-color: #388E3C !important;\n}\n\n.green-text.text-darken-2 {\n color: #388E3C !important;\n}\n\n.green.darken-3 {\n background-color: #2E7D32 !important;\n}\n\n.green-text.text-darken-3 {\n color: #2E7D32 !important;\n}\n\n.green.darken-4 {\n background-color: #1B5E20 !important;\n}\n\n.green-text.text-darken-4 {\n color: #1B5E20 !important;\n}\n\n.green.accent-1 {\n background-color: #B9F6CA !important;\n}\n\n.green-text.text-accent-1 {\n color: #B9F6CA !important;\n}\n\n.green.accent-2 {\n background-color: #69F0AE !important;\n}\n\n.green-text.text-accent-2 {\n color: #69F0AE !important;\n}\n\n.green.accent-3 {\n background-color: #00E676 !important;\n}\n\n.green-text.text-accent-3 {\n color: #00E676 !important;\n}\n\n.green.accent-4 {\n background-color: #00C853 !important;\n}\n\n.green-text.text-accent-4 {\n color: #00C853 !important;\n}\n\n.light-green {\n background-color: #8bc34a !important;\n}\n\n.light-green-text {\n color: #8bc34a !important;\n}\n\n.light-green.lighten-5 {\n background-color: #f1f8e9 !important;\n}\n\n.light-green-text.text-lighten-5 {\n color: #f1f8e9 !important;\n}\n\n.light-green.lighten-4 {\n background-color: #dcedc8 !important;\n}\n\n.light-green-text.text-lighten-4 {\n color: #dcedc8 !important;\n}\n\n.light-green.lighten-3 {\n background-color: #c5e1a5 !important;\n}\n\n.light-green-text.text-lighten-3 {\n color: #c5e1a5 !important;\n}\n\n.light-green.lighten-2 {\n background-color: #aed581 !important;\n}\n\n.light-green-text.text-lighten-2 {\n color: #aed581 !important;\n}\n\n.light-green.lighten-1 {\n background-color: #9ccc65 !important;\n}\n\n.light-green-text.text-lighten-1 {\n color: #9ccc65 !important;\n}\n\n.light-green.darken-1 {\n background-color: #7cb342 !important;\n}\n\n.light-green-text.text-darken-1 {\n color: #7cb342 !important;\n}\n\n.light-green.darken-2 {\n background-color: #689f38 !important;\n}\n\n.light-green-text.text-darken-2 {\n color: #689f38 !important;\n}\n\n.light-green.darken-3 {\n background-color: #558b2f !important;\n}\n\n.light-green-text.text-darken-3 {\n color: #558b2f !important;\n}\n\n.light-green.darken-4 {\n background-color: #33691e !important;\n}\n\n.light-green-text.text-darken-4 {\n color: #33691e !important;\n}\n\n.light-green.accent-1 {\n background-color: #ccff90 !important;\n}\n\n.light-green-text.text-accent-1 {\n color: #ccff90 !important;\n}\n\n.light-green.accent-2 {\n background-color: #b2ff59 !important;\n}\n\n.light-green-text.text-accent-2 {\n color: #b2ff59 !important;\n}\n\n.light-green.accent-3 {\n background-color: #76ff03 !important;\n}\n\n.light-green-text.text-accent-3 {\n color: #76ff03 !important;\n}\n\n.light-green.accent-4 {\n background-color: #64dd17 !important;\n}\n\n.light-green-text.text-accent-4 {\n color: #64dd17 !important;\n}\n\n.lime {\n background-color: #cddc39 !important;\n}\n\n.lime-text {\n color: #cddc39 !important;\n}\n\n.lime.lighten-5 {\n background-color: #f9fbe7 !important;\n}\n\n.lime-text.text-lighten-5 {\n color: #f9fbe7 !important;\n}\n\n.lime.lighten-4 {\n background-color: #f0f4c3 !important;\n}\n\n.lime-text.text-lighten-4 {\n color: #f0f4c3 !important;\n}\n\n.lime.lighten-3 {\n background-color: #e6ee9c !important;\n}\n\n.lime-text.text-lighten-3 {\n color: #e6ee9c !important;\n}\n\n.lime.lighten-2 {\n background-color: #dce775 !important;\n}\n\n.lime-text.text-lighten-2 {\n color: #dce775 !important;\n}\n\n.lime.lighten-1 {\n background-color: #d4e157 !important;\n}\n\n.lime-text.text-lighten-1 {\n color: #d4e157 !important;\n}\n\n.lime.darken-1 {\n background-color: #c0ca33 !important;\n}\n\n.lime-text.text-darken-1 {\n color: #c0ca33 !important;\n}\n\n.lime.darken-2 {\n background-color: #afb42b !important;\n}\n\n.lime-text.text-darken-2 {\n color: #afb42b !important;\n}\n\n.lime.darken-3 {\n background-color: #9e9d24 !important;\n}\n\n.lime-text.text-darken-3 {\n color: #9e9d24 !important;\n}\n\n.lime.darken-4 {\n background-color: #827717 !important;\n}\n\n.lime-text.text-darken-4 {\n color: #827717 !important;\n}\n\n.lime.accent-1 {\n background-color: #f4ff81 !important;\n}\n\n.lime-text.text-accent-1 {\n color: #f4ff81 !important;\n}\n\n.lime.accent-2 {\n background-color: #eeff41 !important;\n}\n\n.lime-text.text-accent-2 {\n color: #eeff41 !important;\n}\n\n.lime.accent-3 {\n background-color: #c6ff00 !important;\n}\n\n.lime-text.text-accent-3 {\n color: #c6ff00 !important;\n}\n\n.lime.accent-4 {\n background-color: #aeea00 !important;\n}\n\n.lime-text.text-accent-4 {\n color: #aeea00 !important;\n}\n\n.yellow {\n background-color: #ffeb3b !important;\n}\n\n.yellow-text {\n color: #ffeb3b !important;\n}\n\n.yellow.lighten-5 {\n background-color: #fffde7 !important;\n}\n\n.yellow-text.text-lighten-5 {\n color: #fffde7 !important;\n}\n\n.yellow.lighten-4 {\n background-color: #fff9c4 !important;\n}\n\n.yellow-text.text-lighten-4 {\n color: #fff9c4 !important;\n}\n\n.yellow.lighten-3 {\n background-color: #fff59d !important;\n}\n\n.yellow-text.text-lighten-3 {\n color: #fff59d !important;\n}\n\n.yellow.lighten-2 {\n background-color: #fff176 !important;\n}\n\n.yellow-text.text-lighten-2 {\n color: #fff176 !important;\n}\n\n.yellow.lighten-1 {\n background-color: #ffee58 !important;\n}\n\n.yellow-text.text-lighten-1 {\n color: #ffee58 !important;\n}\n\n.yellow.darken-1 {\n background-color: #fdd835 !important;\n}\n\n.yellow-text.text-darken-1 {\n color: #fdd835 !important;\n}\n\n.yellow.darken-2 {\n background-color: #fbc02d !important;\n}\n\n.yellow-text.text-darken-2 {\n color: #fbc02d !important;\n}\n\n.yellow.darken-3 {\n background-color: #f9a825 !important;\n}\n\n.yellow-text.text-darken-3 {\n color: #f9a825 !important;\n}\n\n.yellow.darken-4 {\n background-color: #f57f17 !important;\n}\n\n.yellow-text.text-darken-4 {\n color: #f57f17 !important;\n}\n\n.yellow.accent-1 {\n background-color: #ffff8d !important;\n}\n\n.yellow-text.text-accent-1 {\n color: #ffff8d !important;\n}\n\n.yellow.accent-2 {\n background-color: #ffff00 !important;\n}\n\n.yellow-text.text-accent-2 {\n color: #ffff00 !important;\n}\n\n.yellow.accent-3 {\n background-color: #ffea00 !important;\n}\n\n.yellow-text.text-accent-3 {\n color: #ffea00 !important;\n}\n\n.yellow.accent-4 {\n background-color: #ffd600 !important;\n}\n\n.yellow-text.text-accent-4 {\n color: #ffd600 !important;\n}\n\n.amber {\n background-color: #ffc107 !important;\n}\n\n.amber-text {\n color: #ffc107 !important;\n}\n\n.amber.lighten-5 {\n background-color: #fff8e1 !important;\n}\n\n.amber-text.text-lighten-5 {\n color: #fff8e1 !important;\n}\n\n.amber.lighten-4 {\n background-color: #ffecb3 !important;\n}\n\n.amber-text.text-lighten-4 {\n color: #ffecb3 !important;\n}\n\n.amber.lighten-3 {\n background-color: #ffe082 !important;\n}\n\n.amber-text.text-lighten-3 {\n color: #ffe082 !important;\n}\n\n.amber.lighten-2 {\n background-color: #ffd54f !important;\n}\n\n.amber-text.text-lighten-2 {\n color: #ffd54f !important;\n}\n\n.amber.lighten-1 {\n background-color: #ffca28 !important;\n}\n\n.amber-text.text-lighten-1 {\n color: #ffca28 !important;\n}\n\n.amber.darken-1 {\n background-color: #ffb300 !important;\n}\n\n.amber-text.text-darken-1 {\n color: #ffb300 !important;\n}\n\n.amber.darken-2 {\n background-color: #ffa000 !important;\n}\n\n.amber-text.text-darken-2 {\n color: #ffa000 !important;\n}\n\n.amber.darken-3 {\n background-color: #ff8f00 !important;\n}\n\n.amber-text.text-darken-3 {\n color: #ff8f00 !important;\n}\n\n.amber.darken-4 {\n background-color: #ff6f00 !important;\n}\n\n.amber-text.text-darken-4 {\n color: #ff6f00 !important;\n}\n\n.amber.accent-1 {\n background-color: #ffe57f !important;\n}\n\n.amber-text.text-accent-1 {\n color: #ffe57f !important;\n}\n\n.amber.accent-2 {\n background-color: #ffd740 !important;\n}\n\n.amber-text.text-accent-2 {\n color: #ffd740 !important;\n}\n\n.amber.accent-3 {\n background-color: #ffc400 !important;\n}\n\n.amber-text.text-accent-3 {\n color: #ffc400 !important;\n}\n\n.amber.accent-4 {\n background-color: #ffab00 !important;\n}\n\n.amber-text.text-accent-4 {\n color: #ffab00 !important;\n}\n\n.orange {\n background-color: #ff9800 !important;\n}\n\n.orange-text {\n color: #ff9800 !important;\n}\n\n.orange.lighten-5 {\n background-color: #fff3e0 !important;\n}\n\n.orange-text.text-lighten-5 {\n color: #fff3e0 !important;\n}\n\n.orange.lighten-4 {\n background-color: #ffe0b2 !important;\n}\n\n.orange-text.text-lighten-4 {\n color: #ffe0b2 !important;\n}\n\n.orange.lighten-3 {\n background-color: #ffcc80 !important;\n}\n\n.orange-text.text-lighten-3 {\n color: #ffcc80 !important;\n}\n\n.orange.lighten-2 {\n background-color: #ffb74d !important;\n}\n\n.orange-text.text-lighten-2 {\n color: #ffb74d !important;\n}\n\n.orange.lighten-1 {\n background-color: #ffa726 !important;\n}\n\n.orange-text.text-lighten-1 {\n color: #ffa726 !important;\n}\n\n.orange.darken-1 {\n background-color: #fb8c00 !important;\n}\n\n.orange-text.text-darken-1 {\n color: #fb8c00 !important;\n}\n\n.orange.darken-2 {\n background-color: #f57c00 !important;\n}\n\n.orange-text.text-darken-2 {\n color: #f57c00 !important;\n}\n\n.orange.darken-3 {\n background-color: #ef6c00 !important;\n}\n\n.orange-text.text-darken-3 {\n color: #ef6c00 !important;\n}\n\n.orange.darken-4 {\n background-color: #e65100 !important;\n}\n\n.orange-text.text-darken-4 {\n color: #e65100 !important;\n}\n\n.orange.accent-1 {\n background-color: #ffd180 !important;\n}\n\n.orange-text.text-accent-1 {\n color: #ffd180 !important;\n}\n\n.orange.accent-2 {\n background-color: #ffab40 !important;\n}\n\n.orange-text.text-accent-2 {\n color: #ffab40 !important;\n}\n\n.orange.accent-3 {\n background-color: #ff9100 !important;\n}\n\n.orange-text.text-accent-3 {\n color: #ff9100 !important;\n}\n\n.orange.accent-4 {\n background-color: #ff6d00 !important;\n}\n\n.orange-text.text-accent-4 {\n color: #ff6d00 !important;\n}\n\n.deep-orange {\n background-color: #ff5722 !important;\n}\n\n.deep-orange-text {\n color: #ff5722 !important;\n}\n\n.deep-orange.lighten-5 {\n background-color: #fbe9e7 !important;\n}\n\n.deep-orange-text.text-lighten-5 {\n color: #fbe9e7 !important;\n}\n\n.deep-orange.lighten-4 {\n background-color: #ffccbc !important;\n}\n\n.deep-orange-text.text-lighten-4 {\n color: #ffccbc !important;\n}\n\n.deep-orange.lighten-3 {\n background-color: #ffab91 !important;\n}\n\n.deep-orange-text.text-lighten-3 {\n color: #ffab91 !important;\n}\n\n.deep-orange.lighten-2 {\n background-color: #ff8a65 !important;\n}\n\n.deep-orange-text.text-lighten-2 {\n color: #ff8a65 !important;\n}\n\n.deep-orange.lighten-1 {\n background-color: #ff7043 !important;\n}\n\n.deep-orange-text.text-lighten-1 {\n color: #ff7043 !important;\n}\n\n.deep-orange.darken-1 {\n background-color: #f4511e !important;\n}\n\n.deep-orange-text.text-darken-1 {\n color: #f4511e !important;\n}\n\n.deep-orange.darken-2 {\n background-color: #e64a19 !important;\n}\n\n.deep-orange-text.text-darken-2 {\n color: #e64a19 !important;\n}\n\n.deep-orange.darken-3 {\n background-color: #d84315 !important;\n}\n\n.deep-orange-text.text-darken-3 {\n color: #d84315 !important;\n}\n\n.deep-orange.darken-4 {\n background-color: #bf360c !important;\n}\n\n.deep-orange-text.text-darken-4 {\n color: #bf360c !important;\n}\n\n.deep-orange.accent-1 {\n background-color: #ff9e80 !important;\n}\n\n.deep-orange-text.text-accent-1 {\n color: #ff9e80 !important;\n}\n\n.deep-orange.accent-2 {\n background-color: #ff6e40 !important;\n}\n\n.deep-orange-text.text-accent-2 {\n color: #ff6e40 !important;\n}\n\n.deep-orange.accent-3 {\n background-color: #ff3d00 !important;\n}\n\n.deep-orange-text.text-accent-3 {\n color: #ff3d00 !important;\n}\n\n.deep-orange.accent-4 {\n background-color: #dd2c00 !important;\n}\n\n.deep-orange-text.text-accent-4 {\n color: #dd2c00 !important;\n}\n\n.brown {\n background-color: #795548 !important;\n}\n\n.brown-text {\n color: #795548 !important;\n}\n\n.brown.lighten-5 {\n background-color: #efebe9 !important;\n}\n\n.brown-text.text-lighten-5 {\n color: #efebe9 !important;\n}\n\n.brown.lighten-4 {\n background-color: #d7ccc8 !important;\n}\n\n.brown-text.text-lighten-4 {\n color: #d7ccc8 !important;\n}\n\n.brown.lighten-3 {\n background-color: #bcaaa4 !important;\n}\n\n.brown-text.text-lighten-3 {\n color: #bcaaa4 !important;\n}\n\n.brown.lighten-2 {\n background-color: #a1887f !important;\n}\n\n.brown-text.text-lighten-2 {\n color: #a1887f !important;\n}\n\n.brown.lighten-1 {\n background-color: #8d6e63 !important;\n}\n\n.brown-text.text-lighten-1 {\n color: #8d6e63 !important;\n}\n\n.brown.darken-1 {\n background-color: #6d4c41 !important;\n}\n\n.brown-text.text-darken-1 {\n color: #6d4c41 !important;\n}\n\n.brown.darken-2 {\n background-color: #5d4037 !important;\n}\n\n.brown-text.text-darken-2 {\n color: #5d4037 !important;\n}\n\n.brown.darken-3 {\n background-color: #4e342e !important;\n}\n\n.brown-text.text-darken-3 {\n color: #4e342e !important;\n}\n\n.brown.darken-4 {\n background-color: #3e2723 !important;\n}\n\n.brown-text.text-darken-4 {\n color: #3e2723 !important;\n}\n\n.blue-grey {\n background-color: #607d8b !important;\n}\n\n.blue-grey-text {\n color: #607d8b !important;\n}\n\n.blue-grey.lighten-5 {\n background-color: #eceff1 !important;\n}\n\n.blue-grey-text.text-lighten-5 {\n color: #eceff1 !important;\n}\n\n.blue-grey.lighten-4 {\n background-color: #cfd8dc !important;\n}\n\n.blue-grey-text.text-lighten-4 {\n color: #cfd8dc !important;\n}\n\n.blue-grey.lighten-3 {\n background-color: #b0bec5 !important;\n}\n\n.blue-grey-text.text-lighten-3 {\n color: #b0bec5 !important;\n}\n\n.blue-grey.lighten-2 {\n background-color: #90a4ae !important;\n}\n\n.blue-grey-text.text-lighten-2 {\n color: #90a4ae !important;\n}\n\n.blue-grey.lighten-1 {\n background-color: #78909c !important;\n}\n\n.blue-grey-text.text-lighten-1 {\n color: #78909c !important;\n}\n\n.blue-grey.darken-1 {\n background-color: #546e7a !important;\n}\n\n.blue-grey-text.text-darken-1 {\n color: #546e7a !important;\n}\n\n.blue-grey.darken-2 {\n background-color: #455a64 !important;\n}\n\n.blue-grey-text.text-darken-2 {\n color: #455a64 !important;\n}\n\n.blue-grey.darken-3 {\n background-color: #37474f !important;\n}\n\n.blue-grey-text.text-darken-3 {\n color: #37474f !important;\n}\n\n.blue-grey.darken-4 {\n background-color: #263238 !important;\n}\n\n.blue-grey-text.text-darken-4 {\n color: #263238 !important;\n}\n\n.grey {\n background-color: #9e9e9e !important;\n}\n\n.grey-text {\n color: #9e9e9e !important;\n}\n\n.grey.lighten-5 {\n background-color: #fafafa !important;\n}\n\n.grey-text.text-lighten-5 {\n color: #fafafa !important;\n}\n\n.grey.lighten-4 {\n background-color: #f5f5f5 !important;\n}\n\n.grey-text.text-lighten-4 {\n color: #f5f5f5 !important;\n}\n\n.grey.lighten-3 {\n background-color: #eeeeee !important;\n}\n\n.grey-text.text-lighten-3 {\n color: #eeeeee !important;\n}\n\n.grey.lighten-2 {\n background-color: #e0e0e0 !important;\n}\n\n.grey-text.text-lighten-2 {\n color: #e0e0e0 !important;\n}\n\n.grey.lighten-1 {\n background-color: #bdbdbd !important;\n}\n\n.grey-text.text-lighten-1 {\n color: #bdbdbd !important;\n}\n\n.grey.darken-1 {\n background-color: #757575 !important;\n}\n\n.grey-text.text-darken-1 {\n color: #757575 !important;\n}\n\n.grey.darken-2 {\n background-color: #616161 !important;\n}\n\n.grey-text.text-darken-2 {\n color: #616161 !important;\n}\n\n.grey.darken-3 {\n background-color: #424242 !important;\n}\n\n.grey-text.text-darken-3 {\n color: #424242 !important;\n}\n\n.grey.darken-4 {\n background-color: #212121 !important;\n}\n\n.grey-text.text-darken-4 {\n color: #212121 !important;\n}\n\n.black {\n background-color: #000000 !important;\n}\n\n.black-text {\n color: #000000 !important;\n}\n\n.white {\n background-color: #FFFFFF !important;\n}\n\n.white-text {\n color: #FFFFFF !important;\n}\n\n.transparent {\n background-color: transparent !important;\n}\n\n.transparent-text {\n color: transparent !important;\n}\n\n/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */\n/**\r\n * 1. Set default font family to sans-serif.\r\n * 2. Prevent iOS and IE text size adjust after device orientation change,\r\n * without disabling user zoom.\r\n */\nhtml {\n font-family: sans-serif;\n /* 1 */\n -ms-text-size-adjust: 100%;\n /* 2 */\n -webkit-text-size-adjust: 100%;\n /* 2 */\n}\n\n/**\r\n * Remove default margin.\r\n */\nbody {\n margin: 0;\n}\n\n/* HTML5 display definitions\r\n ========================================================================== */\n/**\r\n * Correct `block` display not defined for any HTML5 element in IE 8/9.\r\n * Correct `block` display not defined for `details` or `summary` in IE 10/11\r\n * and Firefox.\r\n * Correct `block` display not defined for `main` in IE 11.\r\n */\narticle,\naside,\ndetails,\nfigcaption,\nfigure,\nfooter,\nheader,\nhgroup,\nmain,\nmenu,\nnav,\nsection,\nsummary {\n display: block;\n}\n\n/**\r\n * 1. Correct `inline-block` display not defined in IE 8/9.\r\n * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.\r\n */\naudio,\ncanvas,\nprogress,\nvideo {\n display: inline-block;\n /* 1 */\n vertical-align: baseline;\n /* 2 */\n}\n\n/**\r\n * Prevent modern browsers from displaying `audio` without controls.\r\n * Remove excess height in iOS 5 devices.\r\n */\naudio:not([controls]) {\n display: none;\n height: 0;\n}\n\n/**\r\n * Address `[hidden]` styling not present in IE 8/9/10.\r\n * Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22.\r\n */\n[hidden],\ntemplate {\n display: none;\n}\n\n/* Links\r\n ========================================================================== */\n/**\r\n * Remove the gray background color from active links in IE 10.\r\n */\na {\n background-color: transparent;\n}\n\n/**\r\n * Improve readability of focused elements when they are also in an\r\n * active/hover state.\r\n */\na:active,\na:hover {\n outline: 0;\n}\n\n/* Text-level semantics\r\n ========================================================================== */\n/**\r\n * Address styling not present in IE 8/9/10/11, Safari, and Chrome.\r\n */\nabbr[title] {\n border-bottom: 1px dotted;\n}\n\n/**\r\n * Address style set to `bolder` in Firefox 4+, Safari, and Chrome.\r\n */\nb,\nstrong {\n font-weight: bold;\n}\n\n/**\r\n * Address styling not present in Safari and Chrome.\r\n */\ndfn {\n font-style: italic;\n}\n\n/**\r\n * Address variable `h1` font-size and margin within `section` and `article`\r\n * contexts in Firefox 4+, Safari, and Chrome.\r\n */\nh1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\n/**\r\n * Address styling not present in IE 8/9.\r\n */\nmark {\n background: #ff0;\n color: #000;\n}\n\n/**\r\n * Address inconsistent and variable font size in all browsers.\r\n */\nsmall {\n font-size: 80%;\n}\n\n/**\r\n * Prevent `sub` and `sup` affecting `line-height` in all browsers.\r\n */\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsup {\n top: -0.5em;\n}\n\nsub {\n bottom: -0.25em;\n}\n\n/* Embedded content\r\n ========================================================================== */\n/**\r\n * Remove border when inside `a` element in IE 8/9/10.\r\n */\nimg {\n border: 0;\n}\n\n/**\r\n * Correct overflow not hidden in IE 9/10/11.\r\n */\nsvg:not(:root) {\n overflow: hidden;\n}\n\n/* Grouping content\r\n ========================================================================== */\n/**\r\n * Address margin not present in IE 8/9 and Safari.\r\n */\nfigure {\n margin: 1em 40px;\n}\n\n/**\r\n * Address differences between Firefox and other browsers.\r\n */\nhr {\n -webkit-box-sizing: content-box;\n box-sizing: content-box;\n height: 0;\n}\n\n/**\r\n * Contain overflow in all browsers.\r\n */\npre {\n overflow: auto;\n}\n\n/**\r\n * Address odd `em`-unit font size rendering in all browsers.\r\n */\ncode,\nkbd,\npre,\nsamp {\n font-family: monospace, monospace;\n font-size: 1em;\n}\n\n/* Forms\r\n ========================================================================== */\n/**\r\n * Known limitation: by default, Chrome and Safari on OS X allow very limited\r\n * styling of `select`, unless a `border` property is set.\r\n */\n/**\r\n * 1. Correct color not being inherited.\r\n * Known issue: affects color of disabled elements.\r\n * 2. Correct font properties not being inherited.\r\n * 3. Address margins set differently in Firefox 4+, Safari, and Chrome.\r\n */\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n color: inherit;\n /* 1 */\n font: inherit;\n /* 2 */\n margin: 0;\n /* 3 */\n}\n\n/**\r\n * Address `overflow` set to `hidden` in IE 8/9/10/11.\r\n */\nbutton {\n overflow: visible;\n}\n\n/**\r\n * Address inconsistent `text-transform` inheritance for `button` and `select`.\r\n * All other form control elements do not inherit `text-transform` values.\r\n * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.\r\n * Correct `select` style inheritance in Firefox.\r\n */\nbutton,\nselect {\n text-transform: none;\n}\n\n/**\r\n * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`\r\n * and `video` controls.\r\n * 2. Correct inability to style clickable `input` types in iOS.\r\n * 3. Improve usability and consistency of cursor style between image-type\r\n * `input` and others.\r\n */\nbutton,\nhtml input[type=\"button\"],\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n -webkit-appearance: button;\n /* 2 */\n cursor: pointer;\n /* 3 */\n}\n\n/**\r\n * Re-set default cursor for disabled elements.\r\n */\nbutton[disabled],\nhtml input[disabled] {\n cursor: default;\n}\n\n/**\r\n * Remove inner padding and border in Firefox 4+.\r\n */\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n border: 0;\n padding: 0;\n}\n\n/**\r\n * Address Firefox 4+ setting `line-height` on `input` using `!important` in\r\n * the UA stylesheet.\r\n */\ninput {\n line-height: normal;\n}\n\n/**\r\n * It's recommended that you don't attempt to style these elements.\r\n * Firefox's implementation doesn't respect box-sizing, padding, or width.\r\n *\r\n * 1. Address box sizing set to `content-box` in IE 8/9/10.\r\n * 2. Remove excess padding in IE 8/9/10.\r\n */\ninput[type=\"checkbox\"],\ninput[type=\"radio\"] {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n /* 1 */\n padding: 0;\n /* 2 */\n}\n\n/**\r\n * Fix the cursor style for Chrome's increment/decrement buttons. For certain\r\n * `font-size` values of the `input`, it causes the cursor style of the\r\n * decrement button to change from `default` to `text`.\r\n */\ninput[type=\"number\"]::-webkit-inner-spin-button,\ninput[type=\"number\"]::-webkit-outer-spin-button {\n height: auto;\n}\n\n/**\r\n * 1. Address `appearance` set to `searchfield` in Safari and Chrome.\r\n * 2. Address `box-sizing` set to `border-box` in Safari and Chrome.\r\n */\ninput[type=\"search\"] {\n -webkit-appearance: textfield;\n /* 1 */\n -webkit-box-sizing: content-box;\n box-sizing: content-box;\n /* 2 */\n}\n\n/**\r\n * Remove inner padding and search cancel button in Safari and Chrome on OS X.\r\n * Safari (but not Chrome) clips the cancel button when the search input has\r\n * padding (and `textfield` appearance).\r\n */\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/**\r\n * Define consistent border, margin, and padding.\r\n */\nfieldset {\n border: 1px solid #c0c0c0;\n margin: 0 2px;\n padding: 0.35em 0.625em 0.75em;\n}\n\n/**\r\n * 1. Correct `color` not being inherited in IE 8/9/10/11.\r\n * 2. Remove padding so people aren't caught out if they zero out fieldsets.\r\n */\nlegend {\n border: 0;\n /* 1 */\n padding: 0;\n /* 2 */\n}\n\n/**\r\n * Remove default vertical scrollbar in IE 8/9/10/11.\r\n */\ntextarea {\n overflow: auto;\n}\n\n/**\r\n * Don't inherit the `font-weight` (applied by a rule above).\r\n * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.\r\n */\noptgroup {\n font-weight: bold;\n}\n\n/* Tables\r\n ========================================================================== */\n/**\r\n * Remove most spacing between table cells.\r\n */\ntable {\n border-collapse: collapse;\n border-spacing: 0;\n}\n\ntd,\nth {\n padding: 0;\n}\n\nhtml {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n\n*, *:before, *:after {\n -webkit-box-sizing: inherit;\n box-sizing: inherit;\n}\n\nul:not(.browser-default) {\n padding-left: 0;\n list-style-type: none;\n}\n\nul:not(.browser-default) > li {\n list-style-type: none;\n}\n\na {\n color: #039be5;\n text-decoration: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n.valign-wrapper {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.clearfix {\n clear: both;\n}\n\n.z-depth-0 {\n -webkit-box-shadow: none !important;\n box-shadow: none !important;\n}\n\n.z-depth-1, nav, .card-panel, .card, .toast, .btn, .btn-large, .btn-floating, .dropdown-content, .collapsible, .side-nav {\n -webkit-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);\n}\n\n.z-depth-1-half, .btn:hover, .btn-large:hover, .btn-floating:hover {\n -webkit-box-shadow: 0 3px 3px 0 rgba(0, 0, 0, 0.14), 0 1px 7px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -1px rgba(0, 0, 0, 0.2);\n box-shadow: 0 3px 3px 0 rgba(0, 0, 0, 0.14), 0 1px 7px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -1px rgba(0, 0, 0, 0.2);\n}\n\n.z-depth-2 {\n -webkit-box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.3);\n box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.3);\n}\n\n.z-depth-3 {\n -webkit-box-shadow: 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12), 0 3px 5px -1px rgba(0, 0, 0, 0.3);\n box-shadow: 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12), 0 3px 5px -1px rgba(0, 0, 0, 0.3);\n}\n\n.z-depth-4, .modal {\n -webkit-box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.3);\n box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.3);\n}\n\n.z-depth-5 {\n -webkit-box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.3);\n box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.3);\n}\n\n.hoverable {\n -webkit-transition: -webkit-box-shadow .25s;\n transition: -webkit-box-shadow .25s;\n -o-transition: box-shadow .25s;\n transition: box-shadow .25s;\n transition: box-shadow .25s, -webkit-box-shadow .25s;\n}\n\n.hoverable:hover {\n -webkit-box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);\n box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);\n}\n\n.divider {\n height: 1px;\n overflow: hidden;\n background-color: #e0e0e0;\n}\n\nblockquote {\n margin: 20px 0;\n padding-left: 1.5rem;\n border-left: 5px solid #ee6e73;\n}\n\ni {\n line-height: inherit;\n}\n\ni.left {\n float: left;\n margin-right: 15px;\n}\n\ni.right {\n float: right;\n margin-left: 15px;\n}\n\ni.tiny {\n font-size: 1rem;\n}\n\ni.small {\n font-size: 2rem;\n}\n\ni.medium {\n font-size: 4rem;\n}\n\ni.large {\n font-size: 6rem;\n}\n\nimg.responsive-img,\nvideo.responsive-video {\n max-width: 100%;\n height: auto;\n}\n\n.pagination li {\n display: inline-block;\n border-radius: 2px;\n text-align: center;\n vertical-align: top;\n height: 30px;\n}\n\n.pagination li a {\n color: #444;\n display: inline-block;\n font-size: 1.2rem;\n padding: 0 10px;\n line-height: 30px;\n}\n\n.pagination li.active a {\n color: #fff;\n}\n\n.pagination li.active {\n background-color: #ee6e73;\n}\n\n.pagination li.disabled a {\n cursor: default;\n color: #999;\n}\n\n.pagination li i {\n font-size: 2rem;\n}\n\n.pagination li.pages ul li {\n display: inline-block;\n float: none;\n}\n\n@media only screen and (max-width: 992px) {\n .pagination {\n width: 100%;\n }\n .pagination li.prev,\n .pagination li.next {\n width: 10%;\n }\n .pagination li.pages {\n width: 80%;\n overflow: hidden;\n white-space: nowrap;\n }\n}\n\n.breadcrumb {\n font-size: 18px;\n color: rgba(255, 255, 255, 0.7);\n}\n\n.breadcrumb i,\n.breadcrumb [class^=\"mdi-\"], .breadcrumb [class*=\"mdi-\"],\n.breadcrumb i.material-icons {\n display: inline-block;\n float: left;\n font-size: 24px;\n}\n\n.breadcrumb:before {\n content: '\\E5CC';\n color: rgba(255, 255, 255, 0.7);\n vertical-align: top;\n display: inline-block;\n font-family: 'Material Icons';\n font-weight: normal;\n font-style: normal;\n font-size: 25px;\n margin: 0 10px 0 8px;\n -webkit-font-smoothing: antialiased;\n}\n\n.breadcrumb:first-child:before {\n display: none;\n}\n\n.breadcrumb:last-child {\n color: #fff;\n}\n\n.parallax-container {\n position: relative;\n overflow: hidden;\n height: 500px;\n}\n\n.parallax-container .parallax {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: -1;\n}\n\n.parallax-container .parallax img {\n display: none;\n position: absolute;\n left: 50%;\n bottom: 0;\n min-width: 100%;\n min-height: 100%;\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n\n.pin-top, .pin-bottom {\n position: relative;\n}\n\n.pinned {\n position: fixed !important;\n}\n\n/*********************\r\n Transition Classes\r\n**********************/\nul.staggered-list li {\n opacity: 0;\n}\n\n.fade-in {\n opacity: 0;\n -webkit-transform-origin: 0 50%;\n -ms-transform-origin: 0 50%;\n transform-origin: 0 50%;\n}\n\n/*********************\r\n Media Query Classes\r\n**********************/\n@media only screen and (max-width: 600px) {\n .hide-on-small-only, .hide-on-small-and-down {\n display: none !important;\n }\n}\n\n@media only screen and (max-width: 992px) {\n .hide-on-med-and-down {\n display: none !important;\n }\n}\n\n@media only screen and (min-width: 601px) {\n .hide-on-med-and-up {\n display: none !important;\n }\n}\n\n@media only screen and (min-width: 600px) and (max-width: 992px) {\n .hide-on-med-only {\n display: none !important;\n }\n}\n\n@media only screen and (min-width: 993px) {\n .hide-on-large-only {\n display: none !important;\n }\n}\n\n@media only screen and (min-width: 993px) {\n .show-on-large {\n display: block !important;\n }\n}\n\n@media only screen and (min-width: 600px) and (max-width: 992px) {\n .show-on-medium {\n display: block !important;\n }\n}\n\n@media only screen and (max-width: 600px) {\n .show-on-small {\n display: block !important;\n }\n}\n\n@media only screen and (min-width: 601px) {\n .show-on-medium-and-up {\n display: block !important;\n }\n}\n\n@media only screen and (max-width: 992px) {\n .show-on-medium-and-down {\n display: block !important;\n }\n}\n\n@media only screen and (max-width: 600px) {\n .center-on-small-only {\n text-align: center;\n }\n}\n\n.page-footer {\n padding-top: 20px;\n color: #fff;\n background-color: #ee6e73;\n}\n\n.page-footer .footer-copyright {\n overflow: hidden;\n min-height: 50px;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-align: center;\n align-items: center;\n padding: 10px 0px;\n color: rgba(255, 255, 255, 0.8);\n background-color: rgba(51, 51, 51, 0.08);\n}\n\ntable, th, td {\n border: none;\n}\n\ntable {\n width: 100%;\n display: table;\n}\n\ntable.bordered > thead > tr,\ntable.bordered > tbody > tr {\n border-bottom: 1px solid #d0d0d0;\n}\n\ntable.striped > tbody > tr:nth-child(odd) {\n background-color: #f2f2f2;\n}\n\ntable.striped > tbody > tr > td {\n border-radius: 0;\n}\n\ntable.highlight > tbody > tr {\n -webkit-transition: background-color .25s ease;\n -o-transition: background-color .25s ease;\n transition: background-color .25s ease;\n}\n\ntable.highlight > tbody > tr:hover {\n background-color: #f2f2f2;\n}\n\ntable.centered thead tr th, table.centered tbody tr td {\n text-align: center;\n}\n\nthead {\n border-bottom: 1px solid #d0d0d0;\n}\n\ntd, th {\n padding: 15px 5px;\n display: table-cell;\n text-align: left;\n vertical-align: middle;\n border-radius: 2px;\n}\n\n@media only screen and (max-width: 992px) {\n table.responsive-table {\n width: 100%;\n border-collapse: collapse;\n border-spacing: 0;\n display: block;\n position: relative;\n /* sort out borders */\n }\n table.responsive-table td:empty:before {\n content: '\\A0';\n }\n table.responsive-table th,\n table.responsive-table td {\n margin: 0;\n vertical-align: top;\n }\n table.responsive-table th {\n text-align: left;\n }\n table.responsive-table thead {\n display: block;\n float: left;\n }\n table.responsive-table thead tr {\n display: block;\n padding: 0 10px 0 0;\n }\n table.responsive-table thead tr th::before {\n content: \"\\A0\";\n }\n table.responsive-table tbody {\n display: block;\n width: auto;\n position: relative;\n overflow-x: auto;\n white-space: nowrap;\n }\n table.responsive-table tbody tr {\n display: inline-block;\n vertical-align: top;\n }\n table.responsive-table th {\n display: block;\n text-align: right;\n }\n table.responsive-table td {\n display: block;\n min-height: 1.25em;\n text-align: left;\n }\n table.responsive-table tr {\n padding: 0 10px;\n }\n table.responsive-table thead {\n border: 0;\n border-right: 1px solid #d0d0d0;\n }\n table.responsive-table.bordered th {\n border-bottom: 0;\n border-left: 0;\n }\n table.responsive-table.bordered td {\n border-left: 0;\n border-right: 0;\n border-bottom: 0;\n }\n table.responsive-table.bordered tr {\n border: 0;\n }\n table.responsive-table.bordered tbody tr {\n border-right: 1px solid #d0d0d0;\n }\n}\n\n.collection {\n margin: 0.5rem 0 1rem 0;\n border: 1px solid #e0e0e0;\n border-radius: 2px;\n overflow: hidden;\n position: relative;\n}\n\n.collection .collection-item {\n background-color: #fff;\n line-height: 1.5rem;\n padding: 10px 20px;\n margin: 0;\n border-bottom: 1px solid #e0e0e0;\n}\n\n.collection .collection-item.avatar {\n min-height: 84px;\n padding-left: 72px;\n position: relative;\n}\n\n.collection .collection-item.avatar:not(.circle-clipper) > .circle,\n.collection .collection-item.avatar :not(.circle-clipper) > .circle {\n position: absolute;\n width: 42px;\n height: 42px;\n overflow: hidden;\n left: 15px;\n display: inline-block;\n vertical-align: middle;\n}\n\n.collection .collection-item.avatar i.circle {\n font-size: 18px;\n line-height: 42px;\n color: #fff;\n background-color: #999;\n text-align: center;\n}\n\n.collection .collection-item.avatar .title {\n font-size: 16px;\n}\n\n.collection .collection-item.avatar p {\n margin: 0;\n}\n\n.collection .collection-item.avatar .secondary-content {\n position: absolute;\n top: 16px;\n right: 16px;\n}\n\n.collection .collection-item:last-child {\n border-bottom: none;\n}\n\n.collection .collection-item.active {\n background-color: #26a69a;\n color: #eafaf9;\n}\n\n.collection .collection-item.active .secondary-content {\n color: #fff;\n}\n\n.collection a.collection-item {\n display: block;\n -webkit-transition: .25s;\n -o-transition: .25s;\n transition: .25s;\n color: #26a69a;\n}\n\n.collection a.collection-item:not(.active):hover {\n background-color: #ddd;\n}\n\n.collection.with-header .collection-header {\n background-color: #fff;\n border-bottom: 1px solid #e0e0e0;\n padding: 10px 20px;\n}\n\n.collection.with-header .collection-item {\n padding-left: 30px;\n}\n\n.collection.with-header .collection-item.avatar {\n padding-left: 72px;\n}\n\n.secondary-content {\n float: right;\n color: #26a69a;\n}\n\n.collapsible .collection {\n margin: 0;\n border: none;\n}\n\n.video-container {\n position: relative;\n padding-bottom: 56.25%;\n height: 0;\n overflow: hidden;\n}\n\n.video-container iframe, .video-container object, .video-container embed {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.progress {\n position: relative;\n height: 4px;\n display: block;\n width: 100%;\n background-color: #acece6;\n border-radius: 2px;\n margin: 0.5rem 0 1rem 0;\n overflow: hidden;\n}\n\n.progress .determinate {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n background-color: #26a69a;\n -webkit-transition: width .3s linear;\n -o-transition: width .3s linear;\n transition: width .3s linear;\n}\n\n.progress .indeterminate {\n background-color: #26a69a;\n}\n\n.progress .indeterminate:before {\n content: '';\n position: absolute;\n background-color: inherit;\n top: 0;\n left: 0;\n bottom: 0;\n will-change: left, right;\n -webkit-animation: indeterminate 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;\n animation: indeterminate 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;\n}\n\n.progress .indeterminate:after {\n content: '';\n position: absolute;\n background-color: inherit;\n top: 0;\n left: 0;\n bottom: 0;\n will-change: left, right;\n -webkit-animation: indeterminate-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;\n animation: indeterminate-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;\n -webkit-animation-delay: 1.15s;\n animation-delay: 1.15s;\n}\n\n@-webkit-keyframes indeterminate {\n 0% {\n left: -35%;\n right: 100%;\n }\n 60% {\n left: 100%;\n right: -90%;\n }\n 100% {\n left: 100%;\n right: -90%;\n }\n}\n\n@keyframes indeterminate {\n 0% {\n left: -35%;\n right: 100%;\n }\n 60% {\n left: 100%;\n right: -90%;\n }\n 100% {\n left: 100%;\n right: -90%;\n }\n}\n\n@-webkit-keyframes indeterminate-short {\n 0% {\n left: -200%;\n right: 100%;\n }\n 60% {\n left: 107%;\n right: -8%;\n }\n 100% {\n left: 107%;\n right: -8%;\n }\n}\n\n@keyframes indeterminate-short {\n 0% {\n left: -200%;\n right: 100%;\n }\n 60% {\n left: 107%;\n right: -8%;\n }\n 100% {\n left: 107%;\n right: -8%;\n }\n}\n\n/*******************\r\n Utility Classes\r\n*******************/\n.hide {\n display: none !important;\n}\n\n.left-align {\n text-align: left;\n}\n\n.right-align {\n text-align: right;\n}\n\n.center, .center-align {\n text-align: center;\n}\n\n.left {\n float: left !important;\n}\n\n.right {\n float: right !important;\n}\n\n.no-select, input[type=range],\ninput[type=range] + .thumb {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.circle {\n border-radius: 50%;\n}\n\n.center-block {\n display: block;\n margin-left: auto;\n margin-right: auto;\n}\n\n.truncate {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n -o-text-overflow: ellipsis;\n text-overflow: ellipsis;\n}\n\n.no-padding {\n padding: 0 !important;\n}\n\nspan.badge {\n min-width: 3rem;\n padding: 0 6px;\n margin-left: 14px;\n text-align: center;\n font-size: 1rem;\n line-height: 22px;\n height: 22px;\n color: #757575;\n float: right;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n\nspan.badge.new {\n font-weight: 300;\n font-size: 0.8rem;\n color: #fff;\n background-color: #26a69a;\n border-radius: 2px;\n}\n\nspan.badge.new:after {\n content: \" new\";\n}\n\nspan.badge[data-badge-caption]::after {\n content: \" \" attr(data-badge-caption);\n}\n\nnav ul a span.badge {\n display: inline-block;\n float: none;\n margin-left: 4px;\n line-height: 22px;\n height: 22px;\n -webkit-font-smoothing: auto;\n}\n\n.collection-item span.badge {\n margin-top: calc(0.75rem - 11px);\n}\n\n.collapsible span.badge {\n margin-left: auto;\n}\n\n.side-nav span.badge {\n margin-top: calc(24px - 11px);\n}\n\n/* This is needed for some mobile phones to display the Google Icon font properly */\n.material-icons {\n text-rendering: optimizeLegibility;\n -webkit-font-feature-settings: 'liga';\n font-feature-settings: 'liga';\n}\n\n.container {\n margin: 0 auto;\n max-width: 1280px;\n width: 90%;\n}\n\n@media only screen and (min-width: 601px) {\n .container {\n width: 85%;\n }\n}\n\n@media only screen and (min-width: 993px) {\n .container {\n width: 70%;\n }\n}\n\n.container .row {\n margin-left: -0.75rem;\n margin-right: -0.75rem;\n}\n\n.section {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n\n.section.no-pad {\n padding: 0;\n}\n\n.section.no-pad-bot {\n padding-bottom: 0;\n}\n\n.section.no-pad-top {\n padding-top: 0;\n}\n\n.row {\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 20px;\n}\n\n.row:after {\n content: \"\";\n display: table;\n clear: both;\n}\n\n.row .col {\n float: left;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n padding: 0 0.75rem;\n min-height: 1px;\n}\n\n.row .col[class*=\"push-\"], .row .col[class*=\"pull-\"] {\n position: relative;\n}\n\n.row .col.s1 {\n width: 8.3333333333%;\n margin-left: auto;\n left: auto;\n right: auto;\n}\n\n.row .col.s2 {\n width: 16.6666666667%;\n margin-left: auto;\n left: auto;\n right: auto;\n}\n\n.row .col.s3 {\n width: 25%;\n margin-left: auto;\n left: auto;\n right: auto;\n}\n\n.row .col.s4 {\n width: 33.3333333333%;\n margin-left: auto;\n left: auto;\n right: auto;\n}\n\n.row .col.s5 {\n width: 41.6666666667%;\n margin-left: auto;\n left: auto;\n right: auto;\n}\n\n.row .col.s6 {\n width: 50%;\n margin-left: auto;\n left: auto;\n right: auto;\n}\n\n.row .col.s7 {\n width: 58.3333333333%;\n margin-left: auto;\n left: auto;\n right: auto;\n}\n\n.row .col.s8 {\n width: 66.6666666667%;\n margin-left: auto;\n left: auto;\n right: auto;\n}\n\n.row .col.s9 {\n width: 75%;\n margin-left: auto;\n left: auto;\n right: auto;\n}\n\n.row .col.s10 {\n width: 83.3333333333%;\n margin-left: auto;\n left: auto;\n right: auto;\n}\n\n.row .col.s11 {\n width: 91.6666666667%;\n margin-left: auto;\n left: auto;\n right: auto;\n}\n\n.row .col.s12 {\n width: 100%;\n margin-left: auto;\n left: auto;\n right: auto;\n}\n\n.row .col.offset-s1 {\n margin-left: 8.3333333333%;\n}\n\n.row .col.pull-s1 {\n right: 8.3333333333%;\n}\n\n.row .col.push-s1 {\n left: 8.3333333333%;\n}\n\n.row .col.offset-s2 {\n margin-left: 16.6666666667%;\n}\n\n.row .col.pull-s2 {\n right: 16.6666666667%;\n}\n\n.row .col.push-s2 {\n left: 16.6666666667%;\n}\n\n.row .col.offset-s3 {\n margin-left: 25%;\n}\n\n.row .col.pull-s3 {\n right: 25%;\n}\n\n.row .col.push-s3 {\n left: 25%;\n}\n\n.row .col.offset-s4 {\n margin-left: 33.3333333333%;\n}\n\n.row .col.pull-s4 {\n right: 33.3333333333%;\n}\n\n.row .col.push-s4 {\n left: 33.3333333333%;\n}\n\n.row .col.offset-s5 {\n margin-left: 41.6666666667%;\n}\n\n.row .col.pull-s5 {\n right: 41.6666666667%;\n}\n\n.row .col.push-s5 {\n left: 41.6666666667%;\n}\n\n.row .col.offset-s6 {\n margin-left: 50%;\n}\n\n.row .col.pull-s6 {\n right: 50%;\n}\n\n.row .col.push-s6 {\n left: 50%;\n}\n\n.row .col.offset-s7 {\n margin-left: 58.3333333333%;\n}\n\n.row .col.pull-s7 {\n right: 58.3333333333%;\n}\n\n.row .col.push-s7 {\n left: 58.3333333333%;\n}\n\n.row .col.offset-s8 {\n margin-left: 66.6666666667%;\n}\n\n.row .col.pull-s8 {\n right: 66.6666666667%;\n}\n\n.row .col.push-s8 {\n left: 66.6666666667%;\n}\n\n.row .col.offset-s9 {\n margin-left: 75%;\n}\n\n.row .col.pull-s9 {\n right: 75%;\n}\n\n.row .col.push-s9 {\n left: 75%;\n}\n\n.row .col.offset-s10 {\n margin-left: 83.3333333333%;\n}\n\n.row .col.pull-s10 {\n right: 83.3333333333%;\n}\n\n.row .col.push-s10 {\n left: 83.3333333333%;\n}\n\n.row .col.offset-s11 {\n margin-left: 91.6666666667%;\n}\n\n.row .col.pull-s11 {\n right: 91.6666666667%;\n}\n\n.row .col.push-s11 {\n left: 91.6666666667%;\n}\n\n.row .col.offset-s12 {\n margin-left: 100%;\n}\n\n.row .col.pull-s12 {\n right: 100%;\n}\n\n.row .col.push-s12 {\n left: 100%;\n}\n\n@media only screen and (min-width: 601px) {\n .row .col.m1 {\n width: 8.3333333333%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.m2 {\n width: 16.6666666667%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.m3 {\n width: 25%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.m4 {\n width: 33.3333333333%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.m5 {\n width: 41.6666666667%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.m6 {\n width: 50%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.m7 {\n width: 58.3333333333%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.m8 {\n width: 66.6666666667%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.m9 {\n width: 75%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.m10 {\n width: 83.3333333333%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.m11 {\n width: 91.6666666667%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.m12 {\n width: 100%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.offset-m1 {\n margin-left: 8.3333333333%;\n }\n .row .col.pull-m1 {\n right: 8.3333333333%;\n }\n .row .col.push-m1 {\n left: 8.3333333333%;\n }\n .row .col.offset-m2 {\n margin-left: 16.6666666667%;\n }\n .row .col.pull-m2 {\n right: 16.6666666667%;\n }\n .row .col.push-m2 {\n left: 16.6666666667%;\n }\n .row .col.offset-m3 {\n margin-left: 25%;\n }\n .row .col.pull-m3 {\n right: 25%;\n }\n .row .col.push-m3 {\n left: 25%;\n }\n .row .col.offset-m4 {\n margin-left: 33.3333333333%;\n }\n .row .col.pull-m4 {\n right: 33.3333333333%;\n }\n .row .col.push-m4 {\n left: 33.3333333333%;\n }\n .row .col.offset-m5 {\n margin-left: 41.6666666667%;\n }\n .row .col.pull-m5 {\n right: 41.6666666667%;\n }\n .row .col.push-m5 {\n left: 41.6666666667%;\n }\n .row .col.offset-m6 {\n margin-left: 50%;\n }\n .row .col.pull-m6 {\n right: 50%;\n }\n .row .col.push-m6 {\n left: 50%;\n }\n .row .col.offset-m7 {\n margin-left: 58.3333333333%;\n }\n .row .col.pull-m7 {\n right: 58.3333333333%;\n }\n .row .col.push-m7 {\n left: 58.3333333333%;\n }\n .row .col.offset-m8 {\n margin-left: 66.6666666667%;\n }\n .row .col.pull-m8 {\n right: 66.6666666667%;\n }\n .row .col.push-m8 {\n left: 66.6666666667%;\n }\n .row .col.offset-m9 {\n margin-left: 75%;\n }\n .row .col.pull-m9 {\n right: 75%;\n }\n .row .col.push-m9 {\n left: 75%;\n }\n .row .col.offset-m10 {\n margin-left: 83.3333333333%;\n }\n .row .col.pull-m10 {\n right: 83.3333333333%;\n }\n .row .col.push-m10 {\n left: 83.3333333333%;\n }\n .row .col.offset-m11 {\n margin-left: 91.6666666667%;\n }\n .row .col.pull-m11 {\n right: 91.6666666667%;\n }\n .row .col.push-m11 {\n left: 91.6666666667%;\n }\n .row .col.offset-m12 {\n margin-left: 100%;\n }\n .row .col.pull-m12 {\n right: 100%;\n }\n .row .col.push-m12 {\n left: 100%;\n }\n}\n\n@media only screen and (min-width: 993px) {\n .row .col.l1 {\n width: 8.3333333333%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.l2 {\n width: 16.6666666667%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.l3 {\n width: 25%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.l4 {\n width: 33.3333333333%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.l5 {\n width: 41.6666666667%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.l6 {\n width: 50%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.l7 {\n width: 58.3333333333%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.l8 {\n width: 66.6666666667%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.l9 {\n width: 75%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.l10 {\n width: 83.3333333333%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.l11 {\n width: 91.6666666667%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.l12 {\n width: 100%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.offset-l1 {\n margin-left: 8.3333333333%;\n }\n .row .col.pull-l1 {\n right: 8.3333333333%;\n }\n .row .col.push-l1 {\n left: 8.3333333333%;\n }\n .row .col.offset-l2 {\n margin-left: 16.6666666667%;\n }\n .row .col.pull-l2 {\n right: 16.6666666667%;\n }\n .row .col.push-l2 {\n left: 16.6666666667%;\n }\n .row .col.offset-l3 {\n margin-left: 25%;\n }\n .row .col.pull-l3 {\n right: 25%;\n }\n .row .col.push-l3 {\n left: 25%;\n }\n .row .col.offset-l4 {\n margin-left: 33.3333333333%;\n }\n .row .col.pull-l4 {\n right: 33.3333333333%;\n }\n .row .col.push-l4 {\n left: 33.3333333333%;\n }\n .row .col.offset-l5 {\n margin-left: 41.6666666667%;\n }\n .row .col.pull-l5 {\n right: 41.6666666667%;\n }\n .row .col.push-l5 {\n left: 41.6666666667%;\n }\n .row .col.offset-l6 {\n margin-left: 50%;\n }\n .row .col.pull-l6 {\n right: 50%;\n }\n .row .col.push-l6 {\n left: 50%;\n }\n .row .col.offset-l7 {\n margin-left: 58.3333333333%;\n }\n .row .col.pull-l7 {\n right: 58.3333333333%;\n }\n .row .col.push-l7 {\n left: 58.3333333333%;\n }\n .row .col.offset-l8 {\n margin-left: 66.6666666667%;\n }\n .row .col.pull-l8 {\n right: 66.6666666667%;\n }\n .row .col.push-l8 {\n left: 66.6666666667%;\n }\n .row .col.offset-l9 {\n margin-left: 75%;\n }\n .row .col.pull-l9 {\n right: 75%;\n }\n .row .col.push-l9 {\n left: 75%;\n }\n .row .col.offset-l10 {\n margin-left: 83.3333333333%;\n }\n .row .col.pull-l10 {\n right: 83.3333333333%;\n }\n .row .col.push-l10 {\n left: 83.3333333333%;\n }\n .row .col.offset-l11 {\n margin-left: 91.6666666667%;\n }\n .row .col.pull-l11 {\n right: 91.6666666667%;\n }\n .row .col.push-l11 {\n left: 91.6666666667%;\n }\n .row .col.offset-l12 {\n margin-left: 100%;\n }\n .row .col.pull-l12 {\n right: 100%;\n }\n .row .col.push-l12 {\n left: 100%;\n }\n}\n\n@media only screen and (min-width: 1201px) {\n .row .col.xl1 {\n width: 8.3333333333%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.xl2 {\n width: 16.6666666667%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.xl3 {\n width: 25%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.xl4 {\n width: 33.3333333333%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.xl5 {\n width: 41.6666666667%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.xl6 {\n width: 50%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.xl7 {\n width: 58.3333333333%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.xl8 {\n width: 66.6666666667%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.xl9 {\n width: 75%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.xl10 {\n width: 83.3333333333%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.xl11 {\n width: 91.6666666667%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.xl12 {\n width: 100%;\n margin-left: auto;\n left: auto;\n right: auto;\n }\n .row .col.offset-xl1 {\n margin-left: 8.3333333333%;\n }\n .row .col.pull-xl1 {\n right: 8.3333333333%;\n }\n .row .col.push-xl1 {\n left: 8.3333333333%;\n }\n .row .col.offset-xl2 {\n margin-left: 16.6666666667%;\n }\n .row .col.pull-xl2 {\n right: 16.6666666667%;\n }\n .row .col.push-xl2 {\n left: 16.6666666667%;\n }\n .row .col.offset-xl3 {\n margin-left: 25%;\n }\n .row .col.pull-xl3 {\n right: 25%;\n }\n .row .col.push-xl3 {\n left: 25%;\n }\n .row .col.offset-xl4 {\n margin-left: 33.3333333333%;\n }\n .row .col.pull-xl4 {\n right: 33.3333333333%;\n }\n .row .col.push-xl4 {\n left: 33.3333333333%;\n }\n .row .col.offset-xl5 {\n margin-left: 41.6666666667%;\n }\n .row .col.pull-xl5 {\n right: 41.6666666667%;\n }\n .row .col.push-xl5 {\n left: 41.6666666667%;\n }\n .row .col.offset-xl6 {\n margin-left: 50%;\n }\n .row .col.pull-xl6 {\n right: 50%;\n }\n .row .col.push-xl6 {\n left: 50%;\n }\n .row .col.offset-xl7 {\n margin-left: 58.3333333333%;\n }\n .row .col.pull-xl7 {\n right: 58.3333333333%;\n }\n .row .col.push-xl7 {\n left: 58.3333333333%;\n }\n .row .col.offset-xl8 {\n margin-left: 66.6666666667%;\n }\n .row .col.pull-xl8 {\n right: 66.6666666667%;\n }\n .row .col.push-xl8 {\n left: 66.6666666667%;\n }\n .row .col.offset-xl9 {\n margin-left: 75%;\n }\n .row .col.pull-xl9 {\n right: 75%;\n }\n .row .col.push-xl9 {\n left: 75%;\n }\n .row .col.offset-xl10 {\n margin-left: 83.3333333333%;\n }\n .row .col.pull-xl10 {\n right: 83.3333333333%;\n }\n .row .col.push-xl10 {\n left: 83.3333333333%;\n }\n .row .col.offset-xl11 {\n margin-left: 91.6666666667%;\n }\n .row .col.pull-xl11 {\n right: 91.6666666667%;\n }\n .row .col.push-xl11 {\n left: 91.6666666667%;\n }\n .row .col.offset-xl12 {\n margin-left: 100%;\n }\n .row .col.pull-xl12 {\n right: 100%;\n }\n .row .col.push-xl12 {\n left: 100%;\n }\n}\n\nnav {\n color: #fff;\n background-color: #ee6e73;\n width: 100%;\n height: 56px;\n line-height: 56px;\n}\n\nnav.nav-extended {\n height: auto;\n}\n\nnav.nav-extended .nav-wrapper {\n min-height: 56px;\n height: auto;\n}\n\nnav.nav-extended .nav-content {\n position: relative;\n line-height: normal;\n}\n\nnav a {\n color: #fff;\n}\n\nnav i,\nnav [class^=\"mdi-\"], nav [class*=\"mdi-\"],\nnav i.material-icons {\n display: block;\n font-size: 24px;\n height: 56px;\n line-height: 56px;\n}\n\nnav .nav-wrapper {\n position: relative;\n height: 100%;\n}\n\n@media only screen and (min-width: 993px) {\n nav a.button-collapse {\n display: none;\n }\n}\n\nnav .button-collapse {\n float: left;\n position: relative;\n z-index: 1;\n height: 56px;\n margin: 0 18px;\n}\n\nnav .button-collapse i {\n height: 56px;\n line-height: 56px;\n}\n\nnav .brand-logo {\n position: absolute;\n color: #fff;\n display: inline-block;\n font-size: 2.1rem;\n padding: 0;\n}\n\nnav .brand-logo.center {\n left: 50%;\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n\n@media only screen and (max-width: 992px) {\n nav .brand-logo {\n left: 50%;\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n }\n nav .brand-logo.left, nav .brand-logo.right {\n padding: 0;\n -webkit-transform: none;\n -ms-transform: none;\n transform: none;\n }\n nav .brand-logo.left {\n left: 0.5rem;\n }\n nav .brand-logo.right {\n right: 0.5rem;\n left: auto;\n }\n}\n\nnav .brand-logo.right {\n right: 0.5rem;\n padding: 0;\n}\n\nnav .brand-logo i,\nnav .brand-logo [class^=\"mdi-\"], nav .brand-logo [class*=\"mdi-\"],\nnav .brand-logo i.material-icons {\n float: left;\n margin-right: 15px;\n}\n\nnav .nav-title {\n display: inline-block;\n font-size: 32px;\n padding: 28px 0;\n}\n\nnav ul {\n margin: 0;\n}\n\nnav ul li {\n -webkit-transition: background-color .3s;\n -o-transition: background-color .3s;\n transition: background-color .3s;\n float: left;\n padding: 0;\n}\n\nnav ul li.active {\n background-color: rgba(0, 0, 0, 0.1);\n}\n\nnav ul a {\n -webkit-transition: background-color .3s;\n -o-transition: background-color .3s;\n transition: background-color .3s;\n font-size: 1rem;\n color: #fff;\n display: block;\n padding: 0 15px;\n cursor: pointer;\n}\n\nnav ul a.btn, nav ul a.btn-large, nav ul a.btn-large, nav ul a.btn-flat, nav ul a.btn-floating {\n margin-top: -2px;\n margin-left: 15px;\n margin-right: 15px;\n}\n\nnav ul a.btn > .material-icons, nav ul a.btn-large > .material-icons, nav ul a.btn-large > .material-icons, nav ul a.btn-flat > .material-icons, nav ul a.btn-floating > .material-icons {\n height: inherit;\n line-height: inherit;\n}\n\nnav ul a:hover {\n background-color: rgba(0, 0, 0, 0.1);\n}\n\nnav ul.left {\n float: left;\n}\n\nnav form {\n height: 100%;\n}\n\nnav .input-field {\n margin: 0;\n height: 100%;\n}\n\nnav .input-field input {\n height: 100%;\n font-size: 1.2rem;\n border: none;\n padding-left: 2rem;\n}\n\nnav .input-field input:focus, nav .input-field input[type=text]:valid, nav .input-field input[type=password]:valid, nav .input-field input[type=email]:valid, nav .input-field input[type=url]:valid, nav .input-field input[type=date]:valid {\n border: none;\n -webkit-box-shadow: none;\n box-shadow: none;\n}\n\nnav .input-field label {\n top: 0;\n left: 0;\n}\n\nnav .input-field label i {\n color: rgba(255, 255, 255, 0.7);\n -webkit-transition: color .3s;\n -o-transition: color .3s;\n transition: color .3s;\n}\n\nnav .input-field label.active i {\n color: #fff;\n}\n\n.navbar-fixed {\n position: relative;\n height: 56px;\n z-index: 997;\n}\n\n.navbar-fixed nav {\n position: fixed;\n}\n\n@media only screen and (min-width: 601px) {\n nav.nav-extended .nav-wrapper {\n min-height: 64px;\n }\n nav, nav .nav-wrapper i, nav a.button-collapse, nav a.button-collapse i {\n height: 64px;\n line-height: 64px;\n }\n .navbar-fixed {\n height: 64px;\n }\n}\n\n@font-face {\n font-family: \"Roboto\";\n src: local(Roboto Thin), url(" + __webpack_require__(/*! ../fonts/roboto/Roboto-Thin.woff2 */ "./node_modules/materialize-css/dist/fonts/roboto/Roboto-Thin.woff2") + ") format(\"woff2\"), url(" + __webpack_require__(/*! ../fonts/roboto/Roboto-Thin.woff */ "./node_modules/materialize-css/dist/fonts/roboto/Roboto-Thin.woff") + ") format(\"woff\");\n font-weight: 100;\n}\n\n@font-face {\n font-family: \"Roboto\";\n src: local(Roboto Light), url(" + __webpack_require__(/*! ../fonts/roboto/Roboto-Light.woff2 */ "./node_modules/materialize-css/dist/fonts/roboto/Roboto-Light.woff2") + ") format(\"woff2\"), url(" + __webpack_require__(/*! ../fonts/roboto/Roboto-Light.woff */ "./node_modules/materialize-css/dist/fonts/roboto/Roboto-Light.woff") + ") format(\"woff\");\n font-weight: 300;\n}\n\n@font-face {\n font-family: \"Roboto\";\n src: local(Roboto Regular), url(" + __webpack_require__(/*! ../fonts/roboto/Roboto-Regular.woff2 */ "./node_modules/materialize-css/dist/fonts/roboto/Roboto-Regular.woff2") + ") format(\"woff2\"), url(" + __webpack_require__(/*! ../fonts/roboto/Roboto-Regular.woff */ "./node_modules/materialize-css/dist/fonts/roboto/Roboto-Regular.woff") + ") format(\"woff\");\n font-weight: 400;\n}\n\n@font-face {\n font-family: \"Roboto\";\n src: local(Roboto Medium), url(" + __webpack_require__(/*! ../fonts/roboto/Roboto-Medium.woff2 */ "./node_modules/materialize-css/dist/fonts/roboto/Roboto-Medium.woff2") + ") format(\"woff2\"), url(" + __webpack_require__(/*! ../fonts/roboto/Roboto-Medium.woff */ "./node_modules/materialize-css/dist/fonts/roboto/Roboto-Medium.woff") + ") format(\"woff\");\n font-weight: 500;\n}\n\n@font-face {\n font-family: \"Roboto\";\n src: local(Roboto Bold), url(" + __webpack_require__(/*! ../fonts/roboto/Roboto-Bold.woff2 */ "./node_modules/materialize-css/dist/fonts/roboto/Roboto-Bold.woff2") + ") format(\"woff2\"), url(" + __webpack_require__(/*! ../fonts/roboto/Roboto-Bold.woff */ "./node_modules/materialize-css/dist/fonts/roboto/Roboto-Bold.woff") + ") format(\"woff\");\n font-weight: 700;\n}\n\na {\n text-decoration: none;\n}\n\nhtml {\n line-height: 1.5;\n font-family: \"Roboto\", sans-serif;\n font-weight: normal;\n color: rgba(0, 0, 0, 0.87);\n}\n\n@media only screen and (min-width: 0) {\n html {\n font-size: 14px;\n }\n}\n\n@media only screen and (min-width: 992px) {\n html {\n font-size: 14.5px;\n }\n}\n\n@media only screen and (min-width: 1200px) {\n html {\n font-size: 15px;\n }\n}\n\nh1, h2, h3, h4, h5, h6 {\n font-weight: 400;\n line-height: 1.1;\n}\n\nh1 a, h2 a, h3 a, h4 a, h5 a, h6 a {\n font-weight: inherit;\n}\n\nh1 {\n font-size: 4.2rem;\n line-height: 110%;\n margin: 2.1rem 0 1.68rem 0;\n}\n\nh2 {\n font-size: 3.56rem;\n line-height: 110%;\n margin: 1.78rem 0 1.424rem 0;\n}\n\nh3 {\n font-size: 2.92rem;\n line-height: 110%;\n margin: 1.46rem 0 1.168rem 0;\n}\n\nh4 {\n font-size: 2.28rem;\n line-height: 110%;\n margin: 1.14rem 0 0.912rem 0;\n}\n\nh5 {\n font-size: 1.64rem;\n line-height: 110%;\n margin: 0.82rem 0 0.656rem 0;\n}\n\nh6 {\n font-size: 1rem;\n line-height: 110%;\n margin: 0.5rem 0 0.4rem 0;\n}\n\nem {\n font-style: italic;\n}\n\nstrong {\n font-weight: 500;\n}\n\nsmall {\n font-size: 75%;\n}\n\n.light, .page-footer .footer-copyright {\n font-weight: 300;\n}\n\n.thin {\n font-weight: 200;\n}\n\n.flow-text {\n font-weight: 300;\n}\n\n@media only screen and (min-width: 360px) {\n .flow-text {\n font-size: 1.2rem;\n }\n}\n\n@media only screen and (min-width: 390px) {\n .flow-text {\n font-size: 1.224rem;\n }\n}\n\n@media only screen and (min-width: 420px) {\n .flow-text {\n font-size: 1.248rem;\n }\n}\n\n@media only screen and (min-width: 450px) {\n .flow-text {\n font-size: 1.272rem;\n }\n}\n\n@media only screen and (min-width: 480px) {\n .flow-text {\n font-size: 1.296rem;\n }\n}\n\n@media only screen and (min-width: 510px) {\n .flow-text {\n font-size: 1.32rem;\n }\n}\n\n@media only screen and (min-width: 540px) {\n .flow-text {\n font-size: 1.344rem;\n }\n}\n\n@media only screen and (min-width: 570px) {\n .flow-text {\n font-size: 1.368rem;\n }\n}\n\n@media only screen and (min-width: 600px) {\n .flow-text {\n font-size: 1.392rem;\n }\n}\n\n@media only screen and (min-width: 630px) {\n .flow-text {\n font-size: 1.416rem;\n }\n}\n\n@media only screen and (min-width: 660px) {\n .flow-text {\n font-size: 1.44rem;\n }\n}\n\n@media only screen and (min-width: 690px) {\n .flow-text {\n font-size: 1.464rem;\n }\n}\n\n@media only screen and (min-width: 720px) {\n .flow-text {\n font-size: 1.488rem;\n }\n}\n\n@media only screen and (min-width: 750px) {\n .flow-text {\n font-size: 1.512rem;\n }\n}\n\n@media only screen and (min-width: 780px) {\n .flow-text {\n font-size: 1.536rem;\n }\n}\n\n@media only screen and (min-width: 810px) {\n .flow-text {\n font-size: 1.56rem;\n }\n}\n\n@media only screen and (min-width: 840px) {\n .flow-text {\n font-size: 1.584rem;\n }\n}\n\n@media only screen and (min-width: 870px) {\n .flow-text {\n font-size: 1.608rem;\n }\n}\n\n@media only screen and (min-width: 900px) {\n .flow-text {\n font-size: 1.632rem;\n }\n}\n\n@media only screen and (min-width: 930px) {\n .flow-text {\n font-size: 1.656rem;\n }\n}\n\n@media only screen and (min-width: 960px) {\n .flow-text {\n font-size: 1.68rem;\n }\n}\n\n@media only screen and (max-width: 360px) {\n .flow-text {\n font-size: 1.2rem;\n }\n}\n\n.scale-transition {\n -webkit-transition: -webkit-transform 0.3s cubic-bezier(0.53, 0.01, 0.36, 1.63) !important;\n transition: -webkit-transform 0.3s cubic-bezier(0.53, 0.01, 0.36, 1.63) !important;\n -o-transition: transform 0.3s cubic-bezier(0.53, 0.01, 0.36, 1.63) !important;\n transition: transform 0.3s cubic-bezier(0.53, 0.01, 0.36, 1.63) !important;\n transition: transform 0.3s cubic-bezier(0.53, 0.01, 0.36, 1.63), -webkit-transform 0.3s cubic-bezier(0.53, 0.01, 0.36, 1.63) !important;\n}\n\n.scale-transition.scale-out {\n -webkit-transform: scale(0);\n -ms-transform: scale(0);\n transform: scale(0);\n -webkit-transition: -webkit-transform .2s !important;\n transition: -webkit-transform .2s !important;\n -o-transition: transform .2s !important;\n transition: transform .2s !important;\n transition: transform .2s, -webkit-transform .2s !important;\n}\n\n.scale-transition.scale-in {\n -webkit-transform: scale(1);\n -ms-transform: scale(1);\n transform: scale(1);\n}\n\n.card-panel {\n -webkit-transition: -webkit-box-shadow .25s;\n transition: -webkit-box-shadow .25s;\n -o-transition: box-shadow .25s;\n transition: box-shadow .25s;\n transition: box-shadow .25s, -webkit-box-shadow .25s;\n padding: 24px;\n margin: 0.5rem 0 1rem 0;\n border-radius: 2px;\n background-color: #fff;\n}\n\n.card {\n position: relative;\n margin: 0.5rem 0 1rem 0;\n background-color: #fff;\n -webkit-transition: -webkit-box-shadow .25s;\n transition: -webkit-box-shadow .25s;\n -o-transition: box-shadow .25s;\n transition: box-shadow .25s;\n transition: box-shadow .25s, -webkit-box-shadow .25s;\n border-radius: 2px;\n}\n\n.card .card-title {\n font-size: 24px;\n font-weight: 300;\n}\n\n.card .card-title.activator {\n cursor: pointer;\n}\n\n.card.small, .card.medium, .card.large {\n position: relative;\n}\n\n.card.small .card-image, .card.medium .card-image, .card.large .card-image {\n max-height: 60%;\n overflow: hidden;\n}\n\n.card.small .card-image + .card-content, .card.medium .card-image + .card-content, .card.large .card-image + .card-content {\n max-height: 40%;\n}\n\n.card.small .card-content, .card.medium .card-content, .card.large .card-content {\n max-height: 100%;\n overflow: hidden;\n}\n\n.card.small .card-action, .card.medium .card-action, .card.large .card-action {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n}\n\n.card.small {\n height: 300px;\n}\n\n.card.medium {\n height: 400px;\n}\n\n.card.large {\n height: 500px;\n}\n\n.card.horizontal {\n display: -ms-flexbox;\n display: flex;\n}\n\n.card.horizontal.small .card-image, .card.horizontal.medium .card-image, .card.horizontal.large .card-image {\n height: 100%;\n max-height: none;\n overflow: visible;\n}\n\n.card.horizontal.small .card-image img, .card.horizontal.medium .card-image img, .card.horizontal.large .card-image img {\n height: 100%;\n}\n\n.card.horizontal .card-image {\n max-width: 50%;\n}\n\n.card.horizontal .card-image img {\n border-radius: 2px 0 0 2px;\n max-width: 100%;\n width: auto;\n}\n\n.card.horizontal .card-stacked {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n -ms-flex: 1;\n flex: 1 1;\n position: relative;\n}\n\n.card.horizontal .card-stacked .card-content {\n -ms-flex-positive: 1;\n flex-grow: 1;\n}\n\n.card.sticky-action .card-action {\n z-index: 2;\n}\n\n.card.sticky-action .card-reveal {\n z-index: 1;\n padding-bottom: 64px;\n}\n\n.card .card-image {\n position: relative;\n}\n\n.card .card-image img {\n display: block;\n border-radius: 2px 2px 0 0;\n position: relative;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n}\n\n.card .card-image .card-title {\n color: #fff;\n position: absolute;\n bottom: 0;\n left: 0;\n max-width: 100%;\n padding: 24px;\n}\n\n.card .card-content {\n padding: 24px;\n border-radius: 0 0 2px 2px;\n}\n\n.card .card-content p {\n margin: 0;\n color: inherit;\n}\n\n.card .card-content .card-title {\n display: block;\n line-height: 32px;\n margin-bottom: 8px;\n}\n\n.card .card-content .card-title i {\n line-height: 32px;\n}\n\n.card .card-action {\n position: relative;\n background-color: inherit;\n border-top: 1px solid rgba(160, 160, 160, 0.2);\n padding: 16px 24px;\n}\n\n.card .card-action:last-child {\n border-radius: 0 0 2px 2px;\n}\n\n.card .card-action a:not(.btn):not(.btn-large):not(.btn-large):not(.btn-floating) {\n color: #ffab40;\n margin-right: 24px;\n -webkit-transition: color .3s ease;\n -o-transition: color .3s ease;\n transition: color .3s ease;\n text-transform: uppercase;\n}\n\n.card .card-action a:not(.btn):not(.btn-large):not(.btn-large):not(.btn-floating):hover {\n color: #ffd8a6;\n}\n\n.card .card-reveal {\n padding: 24px;\n position: absolute;\n background-color: #fff;\n width: 100%;\n overflow-y: auto;\n left: 0;\n top: 100%;\n height: 100%;\n z-index: 3;\n display: none;\n}\n\n.card .card-reveal .card-title {\n cursor: pointer;\n display: block;\n}\n\n#toast-container {\n display: block;\n position: fixed;\n z-index: 10000;\n}\n\n@media only screen and (max-width: 600px) {\n #toast-container {\n min-width: 100%;\n bottom: 0%;\n }\n}\n\n@media only screen and (min-width: 601px) and (max-width: 992px) {\n #toast-container {\n left: 5%;\n bottom: 7%;\n max-width: 90%;\n }\n}\n\n@media only screen and (min-width: 993px) {\n #toast-container {\n top: 10%;\n right: 7%;\n max-width: 86%;\n }\n}\n\n.toast {\n border-radius: 2px;\n top: 35px;\n width: auto;\n margin-top: 10px;\n position: relative;\n max-width: 100%;\n height: auto;\n min-height: 48px;\n line-height: 1.5em;\n word-break: break-all;\n background-color: #323232;\n padding: 10px 25px;\n font-size: 1.1rem;\n font-weight: 300;\n color: #fff;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: justify;\n justify-content: space-between;\n cursor: default;\n}\n\n.toast .toast-action {\n color: #eeff41;\n font-weight: 500;\n margin-right: -25px;\n margin-left: 3rem;\n}\n\n.toast.rounded {\n border-radius: 24px;\n}\n\n@media only screen and (max-width: 600px) {\n .toast {\n width: 100%;\n border-radius: 0;\n }\n}\n\n.tabs {\n position: relative;\n overflow-x: auto;\n overflow-y: hidden;\n height: 48px;\n width: 100%;\n background-color: #fff;\n margin: 0 auto;\n white-space: nowrap;\n}\n\n.tabs.tabs-transparent {\n background-color: transparent;\n}\n\n.tabs.tabs-transparent .tab a,\n.tabs.tabs-transparent .tab.disabled a,\n.tabs.tabs-transparent .tab.disabled a:hover {\n color: rgba(255, 255, 255, 0.7);\n}\n\n.tabs.tabs-transparent .tab a:hover,\n.tabs.tabs-transparent .tab a.active {\n color: #fff;\n}\n\n.tabs.tabs-transparent .indicator {\n background-color: #fff;\n}\n\n.tabs.tabs-fixed-width {\n display: -ms-flexbox;\n display: flex;\n}\n\n.tabs.tabs-fixed-width .tab {\n -ms-flex-positive: 1;\n flex-grow: 1;\n}\n\n.tabs .tab {\n display: inline-block;\n text-align: center;\n line-height: 48px;\n height: 48px;\n padding: 0;\n margin: 0;\n text-transform: uppercase;\n}\n\n.tabs .tab a {\n color: rgba(238, 110, 115, 0.7);\n display: block;\n width: 100%;\n height: 100%;\n padding: 0 24px;\n font-size: 14px;\n -o-text-overflow: ellipsis;\n text-overflow: ellipsis;\n overflow: hidden;\n -webkit-transition: color .28s ease;\n -o-transition: color .28s ease;\n transition: color .28s ease;\n}\n\n.tabs .tab a:hover, .tabs .tab a.active {\n background-color: transparent;\n color: #ee6e73;\n}\n\n.tabs .tab.disabled a,\n.tabs .tab.disabled a:hover {\n color: rgba(238, 110, 115, 0.7);\n cursor: default;\n}\n\n.tabs .indicator {\n position: absolute;\n bottom: 0;\n height: 2px;\n background-color: #f6b2b5;\n will-change: left, right;\n}\n\n@media only screen and (max-width: 992px) {\n .tabs {\n display: -ms-flexbox;\n display: flex;\n }\n .tabs .tab {\n -ms-flex-positive: 1;\n flex-grow: 1;\n }\n .tabs .tab a {\n padding: 0 12px;\n }\n}\n\n.material-tooltip {\n padding: 10px 8px;\n font-size: 1rem;\n z-index: 2000;\n background-color: transparent;\n border-radius: 2px;\n color: #fff;\n min-height: 36px;\n line-height: 120%;\n opacity: 0;\n position: absolute;\n text-align: center;\n max-width: calc(100% - 4px);\n overflow: hidden;\n left: 0;\n top: 0;\n pointer-events: none;\n visibility: hidden;\n}\n\n.backdrop {\n position: absolute;\n opacity: 0;\n height: 7px;\n width: 14px;\n border-radius: 0 0 50% 50%;\n background-color: #323232;\n z-index: -1;\n -webkit-transform-origin: 50% 0%;\n -ms-transform-origin: 50% 0%;\n transform-origin: 50% 0%;\n visibility: hidden;\n}\n\n.btn, .btn-large,\n.btn-flat {\n border: none;\n border-radius: 2px;\n display: inline-block;\n height: 36px;\n line-height: 36px;\n padding: 0 2rem;\n text-transform: uppercase;\n vertical-align: middle;\n -webkit-tap-highlight-color: transparent;\n}\n\n.btn.disabled, .disabled.btn-large,\n.btn-floating.disabled,\n.btn-large.disabled,\n.btn-flat.disabled,\n.btn:disabled,\n.btn-large:disabled,\n.btn-floating:disabled,\n.btn-large:disabled,\n.btn-flat:disabled,\n.btn[disabled],\n[disabled].btn-large,\n.btn-floating[disabled],\n.btn-large[disabled],\n.btn-flat[disabled] {\n pointer-events: none;\n background-color: #DFDFDF !important;\n -webkit-box-shadow: none;\n box-shadow: none;\n color: #9F9F9F !important;\n cursor: default;\n}\n\n.btn.disabled:hover, .disabled.btn-large:hover,\n.btn-floating.disabled:hover,\n.btn-large.disabled:hover,\n.btn-flat.disabled:hover,\n.btn:disabled:hover,\n.btn-large:disabled:hover,\n.btn-floating:disabled:hover,\n.btn-large:disabled:hover,\n.btn-flat:disabled:hover,\n.btn[disabled]:hover,\n[disabled].btn-large:hover,\n.btn-floating[disabled]:hover,\n.btn-large[disabled]:hover,\n.btn-flat[disabled]:hover {\n background-color: #DFDFDF !important;\n color: #9F9F9F !important;\n}\n\n.btn, .btn-large,\n.btn-floating,\n.btn-large,\n.btn-flat {\n font-size: 1rem;\n outline: 0;\n}\n\n.btn i, .btn-large i,\n.btn-floating i,\n.btn-large i,\n.btn-flat i {\n font-size: 1.3rem;\n line-height: inherit;\n}\n\n.btn:focus, .btn-large:focus,\n.btn-floating:focus {\n background-color: #1d7d74;\n}\n\n.btn, .btn-large {\n text-decoration: none;\n color: #fff;\n background-color: #26a69a;\n text-align: center;\n letter-spacing: .5px;\n -webkit-transition: .2s ease-out;\n -o-transition: .2s ease-out;\n transition: .2s ease-out;\n cursor: pointer;\n}\n\n.btn:hover, .btn-large:hover {\n background-color: #2bbbad;\n}\n\n.btn-floating {\n display: inline-block;\n color: #fff;\n position: relative;\n overflow: hidden;\n z-index: 1;\n width: 40px;\n height: 40px;\n line-height: 40px;\n padding: 0;\n background-color: #26a69a;\n border-radius: 50%;\n -webkit-transition: .3s;\n -o-transition: .3s;\n transition: .3s;\n cursor: pointer;\n vertical-align: middle;\n}\n\n.btn-floating:hover {\n background-color: #26a69a;\n}\n\n.btn-floating:before {\n border-radius: 0;\n}\n\n.btn-floating.btn-large {\n width: 56px;\n height: 56px;\n}\n\n.btn-floating.btn-large.halfway-fab {\n bottom: -28px;\n}\n\n.btn-floating.btn-large i {\n line-height: 56px;\n}\n\n.btn-floating.halfway-fab {\n position: absolute;\n right: 24px;\n bottom: -20px;\n}\n\n.btn-floating.halfway-fab.left {\n right: auto;\n left: 24px;\n}\n\n.btn-floating i {\n width: inherit;\n display: inline-block;\n text-align: center;\n color: #fff;\n font-size: 1.6rem;\n line-height: 40px;\n}\n\nbutton.btn-floating {\n border: none;\n}\n\n.fixed-action-btn {\n position: fixed;\n right: 23px;\n bottom: 23px;\n padding-top: 15px;\n margin-bottom: 0;\n z-index: 997;\n}\n\n.fixed-action-btn.active ul {\n visibility: visible;\n}\n\n.fixed-action-btn.horizontal {\n padding: 0 0 0 15px;\n}\n\n.fixed-action-btn.horizontal ul {\n text-align: right;\n right: 64px;\n top: 50%;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n height: 100%;\n left: auto;\n width: 500px;\n /*width 100% only goes to width of button container */\n}\n\n.fixed-action-btn.horizontal ul li {\n display: inline-block;\n margin: 15px 15px 0 0;\n}\n\n.fixed-action-btn.toolbar {\n padding: 0;\n height: 56px;\n}\n\n.fixed-action-btn.toolbar.active > a i {\n opacity: 0;\n}\n\n.fixed-action-btn.toolbar ul {\n display: -ms-flexbox;\n display: flex;\n top: 0;\n bottom: 0;\n z-index: 1;\n}\n\n.fixed-action-btn.toolbar ul li {\n -ms-flex: 1;\n flex: 1 1;\n display: inline-block;\n margin: 0;\n height: 100%;\n -webkit-transition: none;\n -o-transition: none;\n transition: none;\n}\n\n.fixed-action-btn.toolbar ul li a {\n display: block;\n overflow: hidden;\n position: relative;\n width: 100%;\n height: 100%;\n background-color: transparent;\n -webkit-box-shadow: none;\n box-shadow: none;\n color: #fff;\n line-height: 56px;\n z-index: 1;\n}\n\n.fixed-action-btn.toolbar ul li a i {\n line-height: inherit;\n}\n\n.fixed-action-btn ul {\n left: 0;\n right: 0;\n text-align: center;\n position: absolute;\n bottom: 64px;\n margin: 0;\n visibility: hidden;\n}\n\n.fixed-action-btn ul li {\n margin-bottom: 15px;\n}\n\n.fixed-action-btn ul a.btn-floating {\n opacity: 0;\n}\n\n.fixed-action-btn .fab-backdrop {\n position: absolute;\n top: 0;\n left: 0;\n z-index: -1;\n width: 40px;\n height: 40px;\n background-color: #26a69a;\n border-radius: 50%;\n -webkit-transform: scale(0);\n -ms-transform: scale(0);\n transform: scale(0);\n}\n\n.btn-flat {\n -webkit-box-shadow: none;\n box-shadow: none;\n background-color: transparent;\n color: #343434;\n cursor: pointer;\n -webkit-transition: background-color .2s;\n -o-transition: background-color .2s;\n transition: background-color .2s;\n}\n\n.btn-flat:focus, .btn-flat:hover {\n -webkit-box-shadow: none;\n box-shadow: none;\n}\n\n.btn-flat:focus {\n background-color: rgba(0, 0, 0, 0.1);\n}\n\n.btn-flat.disabled {\n background-color: transparent !important;\n color: #b3b2b2 !important;\n cursor: default;\n}\n\n.btn-large {\n height: 54px;\n line-height: 54px;\n}\n\n.btn-large i {\n font-size: 1.6rem;\n}\n\n.btn-block {\n display: block;\n}\n\n.dropdown-content {\n background-color: #fff;\n margin: 0;\n display: none;\n min-width: 100px;\n max-height: 650px;\n overflow-y: auto;\n opacity: 0;\n position: absolute;\n z-index: 999;\n will-change: width, height;\n}\n\n.dropdown-content li {\n clear: both;\n color: rgba(0, 0, 0, 0.87);\n cursor: pointer;\n min-height: 50px;\n line-height: 1.5rem;\n width: 100%;\n text-align: left;\n text-transform: none;\n}\n\n.dropdown-content li:hover, .dropdown-content li.active, .dropdown-content li.selected {\n background-color: #eee;\n}\n\n.dropdown-content li.active.selected {\n background-color: #e1e1e1;\n}\n\n.dropdown-content li.divider {\n min-height: 0;\n height: 1px;\n}\n\n.dropdown-content li > a, .dropdown-content li > span {\n font-size: 16px;\n color: #26a69a;\n display: block;\n line-height: 22px;\n padding: 14px 16px;\n}\n\n.dropdown-content li > span > label {\n top: 1px;\n left: 0;\n height: 18px;\n}\n\n.dropdown-content li > a > i {\n height: inherit;\n line-height: inherit;\n float: left;\n margin: 0 24px 0 0;\n width: 24px;\n}\n\n.input-field.col .dropdown-content [type=\"checkbox\"] + label {\n top: 1px;\n left: 0;\n height: 18px;\n}\n\n/*!\r\n * Waves v0.6.0\r\n * http://fian.my.id/Waves\r\n *\r\n * Copyright 2014 Alfiana E. Sibuea and other contributors\r\n * Released under the MIT license\r\n * https://github.com/fians/Waves/blob/master/LICENSE\r\n */\n.waves-effect {\n position: relative;\n cursor: pointer;\n display: inline-block;\n overflow: hidden;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n vertical-align: middle;\n z-index: 1;\n -webkit-transition: .3s ease-out;\n -o-transition: .3s ease-out;\n transition: .3s ease-out;\n}\n\n.waves-effect .waves-ripple {\n position: absolute;\n border-radius: 50%;\n width: 20px;\n height: 20px;\n margin-top: -10px;\n margin-left: -10px;\n opacity: 0;\n background: rgba(0, 0, 0, 0.2);\n -webkit-transition: all 0.7s ease-out;\n -o-transition: all 0.7s ease-out;\n transition: all 0.7s ease-out;\n -webkit-transition-property: opacity, -webkit-transform;\n transition-property: opacity, -webkit-transform;\n -o-transition-property: transform, opacity;\n transition-property: transform, opacity;\n transition-property: transform, opacity, -webkit-transform;\n -webkit-transform: scale(0);\n -ms-transform: scale(0);\n transform: scale(0);\n pointer-events: none;\n}\n\n.waves-effect.waves-light .waves-ripple {\n background-color: rgba(255, 255, 255, 0.45);\n}\n\n.waves-effect.waves-red .waves-ripple {\n background-color: rgba(244, 67, 54, 0.7);\n}\n\n.waves-effect.waves-yellow .waves-ripple {\n background-color: rgba(255, 235, 59, 0.7);\n}\n\n.waves-effect.waves-orange .waves-ripple {\n background-color: rgba(255, 152, 0, 0.7);\n}\n\n.waves-effect.waves-purple .waves-ripple {\n background-color: rgba(156, 39, 176, 0.7);\n}\n\n.waves-effect.waves-green .waves-ripple {\n background-color: rgba(76, 175, 80, 0.7);\n}\n\n.waves-effect.waves-teal .waves-ripple {\n background-color: rgba(0, 150, 136, 0.7);\n}\n\n.waves-effect input[type=\"button\"], .waves-effect input[type=\"reset\"], .waves-effect input[type=\"submit\"] {\n border: 0;\n font-style: normal;\n font-size: inherit;\n text-transform: inherit;\n background: none;\n}\n\n.waves-effect img {\n position: relative;\n z-index: -1;\n}\n\n.waves-notransition {\n -webkit-transition: none !important;\n -o-transition: none !important;\n transition: none !important;\n}\n\n.waves-circle {\n -webkit-transform: translateZ(0);\n transform: translateZ(0);\n -webkit-mask-image: -webkit-radial-gradient(circle, white 100%, black 100%);\n}\n\n.waves-input-wrapper {\n border-radius: 0.2em;\n vertical-align: bottom;\n}\n\n.waves-input-wrapper .waves-button-input {\n position: relative;\n top: 0;\n left: 0;\n z-index: 1;\n}\n\n.waves-circle {\n text-align: center;\n width: 2.5em;\n height: 2.5em;\n line-height: 2.5em;\n border-radius: 50%;\n -webkit-mask-image: none;\n}\n\n.waves-block {\n display: block;\n}\n\n/* Firefox Bug: link not triggered */\n.waves-effect .waves-ripple {\n z-index: -1;\n}\n\n.modal {\n display: none;\n position: fixed;\n left: 0;\n right: 0;\n background-color: #fafafa;\n padding: 0;\n max-height: 70%;\n width: 55%;\n margin: auto;\n overflow-y: auto;\n border-radius: 2px;\n will-change: top, opacity;\n}\n\n@media only screen and (max-width: 992px) {\n .modal {\n width: 80%;\n }\n}\n\n.modal h1, .modal h2, .modal h3, .modal h4 {\n margin-top: 0;\n}\n\n.modal .modal-content {\n padding: 24px;\n}\n\n.modal .modal-close {\n cursor: pointer;\n}\n\n.modal .modal-footer {\n border-radius: 0 0 2px 2px;\n background-color: #fafafa;\n padding: 4px 6px;\n height: 56px;\n width: 100%;\n text-align: right;\n}\n\n.modal .modal-footer .btn, .modal .modal-footer .btn-large, .modal .modal-footer .btn-flat {\n margin: 6px 0;\n}\n\n.modal-overlay {\n position: fixed;\n z-index: 999;\n top: -25%;\n left: 0;\n bottom: 0;\n right: 0;\n height: 125%;\n width: 100%;\n background: #000;\n display: none;\n will-change: opacity;\n}\n\n.modal.modal-fixed-footer {\n padding: 0;\n height: 70%;\n}\n\n.modal.modal-fixed-footer .modal-content {\n position: absolute;\n height: calc(100% - 56px);\n max-height: 100%;\n width: 100%;\n overflow-y: auto;\n}\n\n.modal.modal-fixed-footer .modal-footer {\n border-top: 1px solid rgba(0, 0, 0, 0.1);\n position: absolute;\n bottom: 0;\n}\n\n.modal.bottom-sheet {\n top: auto;\n bottom: -100%;\n margin: 0;\n width: 100%;\n max-height: 45%;\n border-radius: 0;\n will-change: bottom, opacity;\n}\n\n.collapsible {\n border-top: 1px solid #ddd;\n border-right: 1px solid #ddd;\n border-left: 1px solid #ddd;\n margin: 0.5rem 0 1rem 0;\n}\n\n.collapsible-header {\n display: -ms-flexbox;\n display: flex;\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n line-height: 1.5;\n padding: 1rem;\n background-color: #fff;\n border-bottom: 1px solid #ddd;\n}\n\n.collapsible-header i {\n width: 2rem;\n font-size: 1.6rem;\n display: inline-block;\n text-align: center;\n margin-right: 1rem;\n}\n\n.collapsible-body {\n display: none;\n border-bottom: 1px solid #ddd;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n padding: 2rem;\n}\n\n.side-nav .collapsible,\n.side-nav.fixed .collapsible {\n border: none;\n -webkit-box-shadow: none;\n box-shadow: none;\n}\n\n.side-nav .collapsible li,\n.side-nav.fixed .collapsible li {\n padding: 0;\n}\n\n.side-nav .collapsible-header,\n.side-nav.fixed .collapsible-header {\n background-color: transparent;\n border: none;\n line-height: inherit;\n height: inherit;\n padding: 0 16px;\n}\n\n.side-nav .collapsible-header:hover,\n.side-nav.fixed .collapsible-header:hover {\n background-color: rgba(0, 0, 0, 0.05);\n}\n\n.side-nav .collapsible-header i,\n.side-nav.fixed .collapsible-header i {\n line-height: inherit;\n}\n\n.side-nav .collapsible-body,\n.side-nav.fixed .collapsible-body {\n border: 0;\n background-color: #fff;\n}\n\n.side-nav .collapsible-body li a,\n.side-nav.fixed .collapsible-body li a {\n padding: 0 23.5px 0 31px;\n}\n\n.collapsible.popout {\n border: none;\n -webkit-box-shadow: none;\n box-shadow: none;\n}\n\n.collapsible.popout > li {\n -webkit-box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);\n box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);\n margin: 0 24px;\n -webkit-transition: margin 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n -o-transition: margin 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n transition: margin 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n}\n\n.collapsible.popout > li.active {\n -webkit-box-shadow: 0 5px 11px 0 rgba(0, 0, 0, 0.18), 0 4px 15px 0 rgba(0, 0, 0, 0.15);\n box-shadow: 0 5px 11px 0 rgba(0, 0, 0, 0.18), 0 4px 15px 0 rgba(0, 0, 0, 0.15);\n margin: 16px 0;\n}\n\n.chip {\n display: inline-block;\n height: 32px;\n font-size: 13px;\n font-weight: 500;\n color: rgba(0, 0, 0, 0.6);\n line-height: 32px;\n padding: 0 12px;\n border-radius: 16px;\n background-color: #e4e4e4;\n margin-bottom: 5px;\n margin-right: 5px;\n}\n\n.chip > img {\n float: left;\n margin: 0 8px 0 -12px;\n height: 32px;\n width: 32px;\n border-radius: 50%;\n}\n\n.chip .close {\n cursor: pointer;\n float: right;\n font-size: 16px;\n line-height: 32px;\n padding-left: 8px;\n}\n\n.chips {\n border: none;\n border-bottom: 1px solid #9e9e9e;\n -webkit-box-shadow: none;\n box-shadow: none;\n margin: 0 0 20px 0;\n min-height: 45px;\n outline: none;\n -webkit-transition: all .3s;\n -o-transition: all .3s;\n transition: all .3s;\n}\n\n.chips.focus {\n border-bottom: 1px solid #26a69a;\n -webkit-box-shadow: 0 1px 0 0 #26a69a;\n box-shadow: 0 1px 0 0 #26a69a;\n}\n\n.chips:hover {\n cursor: text;\n}\n\n.chips .chip.selected {\n background-color: #26a69a;\n color: #fff;\n}\n\n.chips .input {\n background: none;\n border: 0;\n color: rgba(0, 0, 0, 0.6);\n display: inline-block;\n font-size: 1rem;\n height: 3rem;\n line-height: 32px;\n outline: 0;\n margin: 0;\n padding: 0 !important;\n width: 120px !important;\n}\n\n.chips .input:focus {\n border: 0 !important;\n -webkit-box-shadow: none !important;\n box-shadow: none !important;\n}\n\n.chips .autocomplete-content {\n margin-top: 0;\n margin-bottom: 0;\n}\n\n.prefix ~ .chips {\n margin-left: 3rem;\n width: 92%;\n width: calc(100% - 3rem);\n}\n\n.chips:empty ~ label {\n font-size: 0.8rem;\n -webkit-transform: translateY(-140%);\n -ms-transform: translateY(-140%);\n transform: translateY(-140%);\n}\n\n.materialboxed {\n display: block;\n cursor: -webkit-zoom-in;\n cursor: zoom-in;\n position: relative;\n -webkit-transition: opacity .4s;\n -o-transition: opacity .4s;\n transition: opacity .4s;\n -webkit-backface-visibility: hidden;\n}\n\n.materialboxed:hover:not(.active) {\n opacity: .8;\n}\n\n.materialboxed.active {\n cursor: -webkit-zoom-out;\n cursor: zoom-out;\n}\n\n#materialbox-overlay {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background-color: #292929;\n z-index: 1000;\n will-change: opacity;\n}\n\n.materialbox-caption {\n position: fixed;\n display: none;\n color: #fff;\n line-height: 50px;\n bottom: 0;\n left: 0;\n width: 100%;\n text-align: center;\n padding: 0% 15%;\n height: 50px;\n z-index: 1000;\n -webkit-font-smoothing: antialiased;\n}\n\nselect:focus {\n outline: 1px solid #c9f3ef;\n}\n\nbutton:focus {\n outline: none;\n background-color: #2ab7a9;\n}\n\nlabel {\n font-size: 0.8rem;\n color: #9e9e9e;\n}\n\n/* Text Inputs + Textarea\r\n ========================================================================== */\n/* Style Placeholders */\n::-webkit-input-placeholder {\n color: #d1d1d1;\n}\n:-ms-input-placeholder {\n color: #d1d1d1;\n}\n::-ms-input-placeholder {\n color: #d1d1d1;\n}\n::placeholder {\n color: #d1d1d1;\n}\n\n/* Text inputs */\ninput:not([type]),\ninput[type=text]:not(.browser-default),\ninput[type=password]:not(.browser-default),\ninput[type=email]:not(.browser-default),\ninput[type=url]:not(.browser-default),\ninput[type=time]:not(.browser-default),\ninput[type=date]:not(.browser-default),\ninput[type=datetime]:not(.browser-default),\ninput[type=datetime-local]:not(.browser-default),\ninput[type=tel]:not(.browser-default),\ninput[type=number]:not(.browser-default),\ninput[type=search]:not(.browser-default),\ntextarea.materialize-textarea {\n background-color: transparent;\n border: none;\n border-bottom: 1px solid #9e9e9e;\n border-radius: 0;\n outline: none;\n height: 3rem;\n width: 100%;\n font-size: 1rem;\n margin: 0 0 20px 0;\n padding: 0;\n -webkit-box-shadow: none;\n box-shadow: none;\n -webkit-box-sizing: content-box;\n box-sizing: content-box;\n -webkit-transition: all 0.3s;\n -o-transition: all 0.3s;\n transition: all 0.3s;\n}\n\ninput:not([type]):disabled, input:not([type])[readonly=\"readonly\"],\ninput[type=text]:not(.browser-default):disabled,\ninput[type=text]:not(.browser-default)[readonly=\"readonly\"],\ninput[type=password]:not(.browser-default):disabled,\ninput[type=password]:not(.browser-default)[readonly=\"readonly\"],\ninput[type=email]:not(.browser-default):disabled,\ninput[type=email]:not(.browser-default)[readonly=\"readonly\"],\ninput[type=url]:not(.browser-default):disabled,\ninput[type=url]:not(.browser-default)[readonly=\"readonly\"],\ninput[type=time]:not(.browser-default):disabled,\ninput[type=time]:not(.browser-default)[readonly=\"readonly\"],\ninput[type=date]:not(.browser-default):disabled,\ninput[type=date]:not(.browser-default)[readonly=\"readonly\"],\ninput[type=datetime]:not(.browser-default):disabled,\ninput[type=datetime]:not(.browser-default)[readonly=\"readonly\"],\ninput[type=datetime-local]:not(.browser-default):disabled,\ninput[type=datetime-local]:not(.browser-default)[readonly=\"readonly\"],\ninput[type=tel]:not(.browser-default):disabled,\ninput[type=tel]:not(.browser-default)[readonly=\"readonly\"],\ninput[type=number]:not(.browser-default):disabled,\ninput[type=number]:not(.browser-default)[readonly=\"readonly\"],\ninput[type=search]:not(.browser-default):disabled,\ninput[type=search]:not(.browser-default)[readonly=\"readonly\"],\ntextarea.materialize-textarea:disabled,\ntextarea.materialize-textarea[readonly=\"readonly\"] {\n color: rgba(0, 0, 0, 0.42);\n border-bottom: 1px dotted rgba(0, 0, 0, 0.42);\n}\n\ninput:not([type]):disabled + label,\ninput:not([type])[readonly=\"readonly\"] + label,\ninput[type=text]:not(.browser-default):disabled + label,\ninput[type=text]:not(.browser-default)[readonly=\"readonly\"] + label,\ninput[type=password]:not(.browser-default):disabled + label,\ninput[type=password]:not(.browser-default)[readonly=\"readonly\"] + label,\ninput[type=email]:not(.browser-default):disabled + label,\ninput[type=email]:not(.browser-default)[readonly=\"readonly\"] + label,\ninput[type=url]:not(.browser-default):disabled + label,\ninput[type=url]:not(.browser-default)[readonly=\"readonly\"] + label,\ninput[type=time]:not(.browser-default):disabled + label,\ninput[type=time]:not(.browser-default)[readonly=\"readonly\"] + label,\ninput[type=date]:not(.browser-default):disabled + label,\ninput[type=date]:not(.browser-default)[readonly=\"readonly\"] + label,\ninput[type=datetime]:not(.browser-default):disabled + label,\ninput[type=datetime]:not(.browser-default)[readonly=\"readonly\"] + label,\ninput[type=datetime-local]:not(.browser-default):disabled + label,\ninput[type=datetime-local]:not(.browser-default)[readonly=\"readonly\"] + label,\ninput[type=tel]:not(.browser-default):disabled + label,\ninput[type=tel]:not(.browser-default)[readonly=\"readonly\"] + label,\ninput[type=number]:not(.browser-default):disabled + label,\ninput[type=number]:not(.browser-default)[readonly=\"readonly\"] + label,\ninput[type=search]:not(.browser-default):disabled + label,\ninput[type=search]:not(.browser-default)[readonly=\"readonly\"] + label,\ntextarea.materialize-textarea:disabled + label,\ntextarea.materialize-textarea[readonly=\"readonly\"] + label {\n color: rgba(0, 0, 0, 0.42);\n}\n\ninput:not([type]):focus:not([readonly]),\ninput[type=text]:not(.browser-default):focus:not([readonly]),\ninput[type=password]:not(.browser-default):focus:not([readonly]),\ninput[type=email]:not(.browser-default):focus:not([readonly]),\ninput[type=url]:not(.browser-default):focus:not([readonly]),\ninput[type=time]:not(.browser-default):focus:not([readonly]),\ninput[type=date]:not(.browser-default):focus:not([readonly]),\ninput[type=datetime]:not(.browser-default):focus:not([readonly]),\ninput[type=datetime-local]:not(.browser-default):focus:not([readonly]),\ninput[type=tel]:not(.browser-default):focus:not([readonly]),\ninput[type=number]:not(.browser-default):focus:not([readonly]),\ninput[type=search]:not(.browser-default):focus:not([readonly]),\ntextarea.materialize-textarea:focus:not([readonly]) {\n border-bottom: 1px solid #26a69a;\n -webkit-box-shadow: 0 1px 0 0 #26a69a;\n box-shadow: 0 1px 0 0 #26a69a;\n}\n\ninput:not([type]):focus:not([readonly]) + label,\ninput[type=text]:not(.browser-default):focus:not([readonly]) + label,\ninput[type=password]:not(.browser-default):focus:not([readonly]) + label,\ninput[type=email]:not(.browser-default):focus:not([readonly]) + label,\ninput[type=url]:not(.browser-default):focus:not([readonly]) + label,\ninput[type=time]:not(.browser-default):focus:not([readonly]) + label,\ninput[type=date]:not(.browser-default):focus:not([readonly]) + label,\ninput[type=datetime]:not(.browser-default):focus:not([readonly]) + label,\ninput[type=datetime-local]:not(.browser-default):focus:not([readonly]) + label,\ninput[type=tel]:not(.browser-default):focus:not([readonly]) + label,\ninput[type=number]:not(.browser-default):focus:not([readonly]) + label,\ninput[type=search]:not(.browser-default):focus:not([readonly]) + label,\ntextarea.materialize-textarea:focus:not([readonly]) + label {\n color: #26a69a;\n}\n\ninput:not([type]).validate + label,\ninput[type=text]:not(.browser-default).validate + label,\ninput[type=password]:not(.browser-default).validate + label,\ninput[type=email]:not(.browser-default).validate + label,\ninput[type=url]:not(.browser-default).validate + label,\ninput[type=time]:not(.browser-default).validate + label,\ninput[type=date]:not(.browser-default).validate + label,\ninput[type=datetime]:not(.browser-default).validate + label,\ninput[type=datetime-local]:not(.browser-default).validate + label,\ninput[type=tel]:not(.browser-default).validate + label,\ninput[type=number]:not(.browser-default).validate + label,\ninput[type=search]:not(.browser-default).validate + label,\ntextarea.materialize-textarea.validate + label {\n width: 100%;\n}\n\ninput:not([type]).invalid + label:after,\ninput:not([type]).valid + label:after,\ninput[type=text]:not(.browser-default).invalid + label:after,\ninput[type=text]:not(.browser-default).valid + label:after,\ninput[type=password]:not(.browser-default).invalid + label:after,\ninput[type=password]:not(.browser-default).valid + label:after,\ninput[type=email]:not(.browser-default).invalid + label:after,\ninput[type=email]:not(.browser-default).valid + label:after,\ninput[type=url]:not(.browser-default).invalid + label:after,\ninput[type=url]:not(.browser-default).valid + label:after,\ninput[type=time]:not(.browser-default).invalid + label:after,\ninput[type=time]:not(.browser-default).valid + label:after,\ninput[type=date]:not(.browser-default).invalid + label:after,\ninput[type=date]:not(.browser-default).valid + label:after,\ninput[type=datetime]:not(.browser-default).invalid + label:after,\ninput[type=datetime]:not(.browser-default).valid + label:after,\ninput[type=datetime-local]:not(.browser-default).invalid + label:after,\ninput[type=datetime-local]:not(.browser-default).valid + label:after,\ninput[type=tel]:not(.browser-default).invalid + label:after,\ninput[type=tel]:not(.browser-default).valid + label:after,\ninput[type=number]:not(.browser-default).invalid + label:after,\ninput[type=number]:not(.browser-default).valid + label:after,\ninput[type=search]:not(.browser-default).invalid + label:after,\ninput[type=search]:not(.browser-default).valid + label:after,\ntextarea.materialize-textarea.invalid + label:after,\ntextarea.materialize-textarea.valid + label:after {\n display: none;\n}\n\ninput:not([type]).invalid + label.active:after,\ninput:not([type]).valid + label.active:after,\ninput[type=text]:not(.browser-default).invalid + label.active:after,\ninput[type=text]:not(.browser-default).valid + label.active:after,\ninput[type=password]:not(.browser-default).invalid + label.active:after,\ninput[type=password]:not(.browser-default).valid + label.active:after,\ninput[type=email]:not(.browser-default).invalid + label.active:after,\ninput[type=email]:not(.browser-default).valid + label.active:after,\ninput[type=url]:not(.browser-default).invalid + label.active:after,\ninput[type=url]:not(.browser-default).valid + label.active:after,\ninput[type=time]:not(.browser-default).invalid + label.active:after,\ninput[type=time]:not(.browser-default).valid + label.active:after,\ninput[type=date]:not(.browser-default).invalid + label.active:after,\ninput[type=date]:not(.browser-default).valid + label.active:after,\ninput[type=datetime]:not(.browser-default).invalid + label.active:after,\ninput[type=datetime]:not(.browser-default).valid + label.active:after,\ninput[type=datetime-local]:not(.browser-default).invalid + label.active:after,\ninput[type=datetime-local]:not(.browser-default).valid + label.active:after,\ninput[type=tel]:not(.browser-default).invalid + label.active:after,\ninput[type=tel]:not(.browser-default).valid + label.active:after,\ninput[type=number]:not(.browser-default).invalid + label.active:after,\ninput[type=number]:not(.browser-default).valid + label.active:after,\ninput[type=search]:not(.browser-default).invalid + label.active:after,\ninput[type=search]:not(.browser-default).valid + label.active:after,\ntextarea.materialize-textarea.invalid + label.active:after,\ntextarea.materialize-textarea.valid + label.active:after {\n display: block;\n}\n\n/* Validation Sass Placeholders */\ninput.valid:not([type]), input.valid:not([type]):focus,\ninput[type=text].valid:not(.browser-default),\ninput[type=text].valid:not(.browser-default):focus,\ninput[type=password].valid:not(.browser-default),\ninput[type=password].valid:not(.browser-default):focus,\ninput[type=email].valid:not(.browser-default),\ninput[type=email].valid:not(.browser-default):focus,\ninput[type=url].valid:not(.browser-default),\ninput[type=url].valid:not(.browser-default):focus,\ninput[type=time].valid:not(.browser-default),\ninput[type=time].valid:not(.browser-default):focus,\ninput[type=date].valid:not(.browser-default),\ninput[type=date].valid:not(.browser-default):focus,\ninput[type=datetime].valid:not(.browser-default),\ninput[type=datetime].valid:not(.browser-default):focus,\ninput[type=datetime-local].valid:not(.browser-default),\ninput[type=datetime-local].valid:not(.browser-default):focus,\ninput[type=tel].valid:not(.browser-default),\ninput[type=tel].valid:not(.browser-default):focus,\ninput[type=number].valid:not(.browser-default),\ninput[type=number].valid:not(.browser-default):focus,\ninput[type=search].valid:not(.browser-default),\ninput[type=search].valid:not(.browser-default):focus,\ntextarea.materialize-textarea.valid,\ntextarea.materialize-textarea.valid:focus, .select-wrapper.valid > input.select-dropdown {\n border-bottom: 1px solid #4CAF50;\n -webkit-box-shadow: 0 1px 0 0 #4CAF50;\n box-shadow: 0 1px 0 0 #4CAF50;\n}\n\ninput.invalid:not([type]), input.invalid:not([type]):focus,\ninput[type=text].invalid:not(.browser-default),\ninput[type=text].invalid:not(.browser-default):focus,\ninput[type=password].invalid:not(.browser-default),\ninput[type=password].invalid:not(.browser-default):focus,\ninput[type=email].invalid:not(.browser-default),\ninput[type=email].invalid:not(.browser-default):focus,\ninput[type=url].invalid:not(.browser-default),\ninput[type=url].invalid:not(.browser-default):focus,\ninput[type=time].invalid:not(.browser-default),\ninput[type=time].invalid:not(.browser-default):focus,\ninput[type=date].invalid:not(.browser-default),\ninput[type=date].invalid:not(.browser-default):focus,\ninput[type=datetime].invalid:not(.browser-default),\ninput[type=datetime].invalid:not(.browser-default):focus,\ninput[type=datetime-local].invalid:not(.browser-default),\ninput[type=datetime-local].invalid:not(.browser-default):focus,\ninput[type=tel].invalid:not(.browser-default),\ninput[type=tel].invalid:not(.browser-default):focus,\ninput[type=number].invalid:not(.browser-default),\ninput[type=number].invalid:not(.browser-default):focus,\ninput[type=search].invalid:not(.browser-default),\ninput[type=search].invalid:not(.browser-default):focus,\ntextarea.materialize-textarea.invalid,\ntextarea.materialize-textarea.invalid:focus, .select-wrapper.invalid > input.select-dropdown {\n border-bottom: 1px solid #F44336;\n -webkit-box-shadow: 0 1px 0 0 #F44336;\n box-shadow: 0 1px 0 0 #F44336;\n}\n\ninput:not([type]).valid + label:after,\ninput:not([type]):focus.valid + label:after,\ninput[type=text]:not(.browser-default).valid + label:after,\ninput[type=text]:not(.browser-default):focus.valid + label:after,\ninput[type=password]:not(.browser-default).valid + label:after,\ninput[type=password]:not(.browser-default):focus.valid + label:after,\ninput[type=email]:not(.browser-default).valid + label:after,\ninput[type=email]:not(.browser-default):focus.valid + label:after,\ninput[type=url]:not(.browser-default).valid + label:after,\ninput[type=url]:not(.browser-default):focus.valid + label:after,\ninput[type=time]:not(.browser-default).valid + label:after,\ninput[type=time]:not(.browser-default):focus.valid + label:after,\ninput[type=date]:not(.browser-default).valid + label:after,\ninput[type=date]:not(.browser-default):focus.valid + label:after,\ninput[type=datetime]:not(.browser-default).valid + label:after,\ninput[type=datetime]:not(.browser-default):focus.valid + label:after,\ninput[type=datetime-local]:not(.browser-default).valid + label:after,\ninput[type=datetime-local]:not(.browser-default):focus.valid + label:after,\ninput[type=tel]:not(.browser-default).valid + label:after,\ninput[type=tel]:not(.browser-default):focus.valid + label:after,\ninput[type=number]:not(.browser-default).valid + label:after,\ninput[type=number]:not(.browser-default):focus.valid + label:after,\ninput[type=search]:not(.browser-default).valid + label:after,\ninput[type=search]:not(.browser-default):focus.valid + label:after,\ntextarea.materialize-textarea.valid + label:after,\ntextarea.materialize-textarea:focus.valid + label:after, .select-wrapper.valid + label:after {\n content: attr(data-success);\n color: #4CAF50;\n opacity: 1;\n -webkit-transform: translateY(9px);\n -ms-transform: translateY(9px);\n transform: translateY(9px);\n}\n\ninput:not([type]).invalid + label:after,\ninput:not([type]):focus.invalid + label:after,\ninput[type=text]:not(.browser-default).invalid + label:after,\ninput[type=text]:not(.browser-default):focus.invalid + label:after,\ninput[type=password]:not(.browser-default).invalid + label:after,\ninput[type=password]:not(.browser-default):focus.invalid + label:after,\ninput[type=email]:not(.browser-default).invalid + label:after,\ninput[type=email]:not(.browser-default):focus.invalid + label:after,\ninput[type=url]:not(.browser-default).invalid + label:after,\ninput[type=url]:not(.browser-default):focus.invalid + label:after,\ninput[type=time]:not(.browser-default).invalid + label:after,\ninput[type=time]:not(.browser-default):focus.invalid + label:after,\ninput[type=date]:not(.browser-default).invalid + label:after,\ninput[type=date]:not(.browser-default):focus.invalid + label:after,\ninput[type=datetime]:not(.browser-default).invalid + label:after,\ninput[type=datetime]:not(.browser-default):focus.invalid + label:after,\ninput[type=datetime-local]:not(.browser-default).invalid + label:after,\ninput[type=datetime-local]:not(.browser-default):focus.invalid + label:after,\ninput[type=tel]:not(.browser-default).invalid + label:after,\ninput[type=tel]:not(.browser-default):focus.invalid + label:after,\ninput[type=number]:not(.browser-default).invalid + label:after,\ninput[type=number]:not(.browser-default):focus.invalid + label:after,\ninput[type=search]:not(.browser-default).invalid + label:after,\ninput[type=search]:not(.browser-default):focus.invalid + label:after,\ntextarea.materialize-textarea.invalid + label:after,\ntextarea.materialize-textarea:focus.invalid + label:after, .select-wrapper.invalid + label:after {\n content: attr(data-error);\n color: #F44336;\n opacity: 1;\n -webkit-transform: translateY(9px);\n -ms-transform: translateY(9px);\n transform: translateY(9px);\n}\n\ninput:not([type]) + label:after,\ninput[type=text]:not(.browser-default) + label:after,\ninput[type=password]:not(.browser-default) + label:after,\ninput[type=email]:not(.browser-default) + label:after,\ninput[type=url]:not(.browser-default) + label:after,\ninput[type=time]:not(.browser-default) + label:after,\ninput[type=date]:not(.browser-default) + label:after,\ninput[type=datetime]:not(.browser-default) + label:after,\ninput[type=datetime-local]:not(.browser-default) + label:after,\ninput[type=tel]:not(.browser-default) + label:after,\ninput[type=number]:not(.browser-default) + label:after,\ninput[type=search]:not(.browser-default) + label:after,\ntextarea.materialize-textarea + label:after, .select-wrapper + label:after {\n display: block;\n content: \"\";\n position: absolute;\n top: 100%;\n left: 0;\n opacity: 0;\n -webkit-transition: .2s opacity ease-out, .2s color ease-out;\n -o-transition: .2s opacity ease-out, .2s color ease-out;\n transition: .2s opacity ease-out, .2s color ease-out;\n}\n\n.input-field {\n position: relative;\n margin-top: 1rem;\n}\n\n.input-field.inline {\n display: inline-block;\n vertical-align: middle;\n margin-left: 5px;\n}\n\n.input-field.inline input,\n.input-field.inline .select-dropdown {\n margin-bottom: 1rem;\n}\n\n.input-field.col label {\n left: 0.75rem;\n}\n\n.input-field.col .prefix ~ label,\n.input-field.col .prefix ~ .validate ~ label {\n width: calc(100% - 3rem - 1.5rem);\n}\n\n.input-field label {\n color: #9e9e9e;\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n font-size: 1rem;\n cursor: text;\n -webkit-transition: -webkit-transform .2s ease-out;\n transition: -webkit-transform .2s ease-out;\n -o-transition: transform .2s ease-out;\n transition: transform .2s ease-out;\n transition: transform .2s ease-out, -webkit-transform .2s ease-out;\n -webkit-transform-origin: 0% 100%;\n -ms-transform-origin: 0% 100%;\n transform-origin: 0% 100%;\n text-align: initial;\n -webkit-transform: translateY(12px);\n -ms-transform: translateY(12px);\n transform: translateY(12px);\n pointer-events: none;\n}\n\n.input-field label:not(.label-icon).active {\n -webkit-transform: translateY(-14px) scale(0.8);\n -ms-transform: translateY(-14px) scale(0.8);\n transform: translateY(-14px) scale(0.8);\n -webkit-transform-origin: 0 0;\n -ms-transform-origin: 0 0;\n transform-origin: 0 0;\n}\n\n.input-field .prefix {\n position: absolute;\n width: 3rem;\n font-size: 2rem;\n -webkit-transition: color .2s;\n -o-transition: color .2s;\n transition: color .2s;\n}\n\n.input-field .prefix.active {\n color: #26a69a;\n}\n\n.input-field .prefix ~ input,\n.input-field .prefix ~ textarea,\n.input-field .prefix ~ label,\n.input-field .prefix ~ .validate ~ label,\n.input-field .prefix ~ .autocomplete-content {\n margin-left: 3rem;\n width: 92%;\n width: calc(100% - 3rem);\n}\n\n.input-field .prefix ~ label {\n margin-left: 3rem;\n}\n\n@media only screen and (max-width: 992px) {\n .input-field .prefix ~ input {\n width: 86%;\n width: calc(100% - 3rem);\n }\n}\n\n@media only screen and (max-width: 600px) {\n .input-field .prefix ~ input {\n width: 80%;\n width: calc(100% - 3rem);\n }\n}\n\n/* Search Field */\n.input-field input[type=search] {\n display: block;\n line-height: inherit;\n}\n\n.nav-wrapper .input-field input[type=search] {\n height: inherit;\n padding-left: 4rem;\n width: calc(100% - 4rem);\n border: 0;\n -webkit-box-shadow: none;\n box-shadow: none;\n}\n\n.input-field input[type=search]:focus {\n background-color: #fff;\n border: 0;\n -webkit-box-shadow: none;\n box-shadow: none;\n color: #444;\n}\n\n.input-field input[type=search]:focus + label i,\n.input-field input[type=search]:focus ~ .mdi-navigation-close,\n.input-field input[type=search]:focus ~ .material-icons {\n color: #444;\n}\n\n.input-field input[type=search] + label {\n left: 1rem;\n}\n\n.input-field input[type=search] ~ .mdi-navigation-close,\n.input-field input[type=search] ~ .material-icons {\n position: absolute;\n top: 0;\n right: 1rem;\n color: transparent;\n cursor: pointer;\n font-size: 2rem;\n -webkit-transition: .3s color;\n -o-transition: .3s color;\n transition: .3s color;\n}\n\n/* Textarea */\ntextarea {\n width: 100%;\n height: 3rem;\n background-color: transparent;\n}\n\ntextarea.materialize-textarea {\n overflow-y: hidden;\n /* prevents scroll bar flash */\n padding: .8rem 0 1.6rem 0;\n /* prevents text jump on Enter keypress */\n resize: none;\n min-height: 3rem;\n}\n\ntextarea.materialize-textarea.validate + label {\n height: 100%;\n}\n\ntextarea.materialize-textarea.validate + label::after {\n top: calc(100% - 12px);\n}\n\ntextarea.materialize-textarea.validate + label:not(.label-icon).active {\n -webkit-transform: translateY(-25px);\n -ms-transform: translateY(-25px);\n transform: translateY(-25px);\n}\n\n.hiddendiv {\n display: none;\n white-space: pre-wrap;\n word-wrap: break-word;\n overflow-wrap: break-word;\n /* future version of deprecated 'word-wrap' */\n padding-top: 1.2rem;\n /* prevents text jump on Enter keypress */\n position: absolute;\n top: 0;\n}\n\n/* Autocomplete */\n.autocomplete-content {\n margin-top: -20px;\n margin-bottom: 20px;\n display: block;\n opacity: 1;\n position: static;\n}\n\n.autocomplete-content li .highlight {\n color: #444;\n}\n\n.autocomplete-content li img {\n height: 40px;\n width: 40px;\n margin: 5px 15px;\n}\n\n/* Radio Buttons\r\n ========================================================================== */\n[type=\"radio\"]:not(:checked),\n[type=\"radio\"]:checked {\n position: absolute;\n opacity: 0;\n pointer-events: none;\n}\n\n[type=\"radio\"]:not(:checked) + label,\n[type=\"radio\"]:checked + label {\n position: relative;\n padding-left: 35px;\n cursor: pointer;\n display: inline-block;\n height: 25px;\n line-height: 25px;\n font-size: 1rem;\n -webkit-transition: .28s ease;\n -o-transition: .28s ease;\n transition: .28s ease;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n[type=\"radio\"] + label:before,\n[type=\"radio\"] + label:after {\n content: '';\n position: absolute;\n left: 0;\n top: 0;\n margin: 4px;\n width: 16px;\n height: 16px;\n z-index: 0;\n -webkit-transition: .28s ease;\n -o-transition: .28s ease;\n transition: .28s ease;\n}\n\n/* Unchecked styles */\n[type=\"radio\"]:not(:checked) + label:before,\n[type=\"radio\"]:not(:checked) + label:after,\n[type=\"radio\"]:checked + label:before,\n[type=\"radio\"]:checked + label:after,\n[type=\"radio\"].with-gap:checked + label:before,\n[type=\"radio\"].with-gap:checked + label:after {\n border-radius: 50%;\n}\n\n[type=\"radio\"]:not(:checked) + label:before,\n[type=\"radio\"]:not(:checked) + label:after {\n border: 2px solid #5a5a5a;\n}\n\n[type=\"radio\"]:not(:checked) + label:after {\n -webkit-transform: scale(0);\n -ms-transform: scale(0);\n transform: scale(0);\n}\n\n/* Checked styles */\n[type=\"radio\"]:checked + label:before {\n border: 2px solid transparent;\n}\n\n[type=\"radio\"]:checked + label:after,\n[type=\"radio\"].with-gap:checked + label:before,\n[type=\"radio\"].with-gap:checked + label:after {\n border: 2px solid #26a69a;\n}\n\n[type=\"radio\"]:checked + label:after,\n[type=\"radio\"].with-gap:checked + label:after {\n background-color: #26a69a;\n}\n\n[type=\"radio\"]:checked + label:after {\n -webkit-transform: scale(1.02);\n -ms-transform: scale(1.02);\n transform: scale(1.02);\n}\n\n/* Radio With gap */\n[type=\"radio\"].with-gap:checked + label:after {\n -webkit-transform: scale(0.5);\n -ms-transform: scale(0.5);\n transform: scale(0.5);\n}\n\n/* Focused styles */\n[type=\"radio\"].tabbed:focus + label:before {\n -webkit-box-shadow: 0 0 0 10px rgba(0, 0, 0, 0.1);\n box-shadow: 0 0 0 10px rgba(0, 0, 0, 0.1);\n}\n\n/* Disabled Radio With gap */\n[type=\"radio\"].with-gap:disabled:checked + label:before {\n border: 2px solid rgba(0, 0, 0, 0.42);\n}\n\n[type=\"radio\"].with-gap:disabled:checked + label:after {\n border: none;\n background-color: rgba(0, 0, 0, 0.42);\n}\n\n/* Disabled style */\n[type=\"radio\"]:disabled:not(:checked) + label:before,\n[type=\"radio\"]:disabled:checked + label:before {\n background-color: transparent;\n border-color: rgba(0, 0, 0, 0.42);\n}\n\n[type=\"radio\"]:disabled + label {\n color: rgba(0, 0, 0, 0.42);\n}\n\n[type=\"radio\"]:disabled:not(:checked) + label:before {\n border-color: rgba(0, 0, 0, 0.42);\n}\n\n[type=\"radio\"]:disabled:checked + label:after {\n background-color: rgba(0, 0, 0, 0.42);\n border-color: #949494;\n}\n\n/* Checkboxes\r\n ========================================================================== */\n/* CUSTOM CSS CHECKBOXES */\nform p {\n margin-bottom: 10px;\n text-align: left;\n}\n\nform p:last-child {\n margin-bottom: 0;\n}\n\n/* Remove default checkbox */\n[type=\"checkbox\"]:not(:checked),\n[type=\"checkbox\"]:checked {\n position: absolute;\n opacity: 0;\n pointer-events: none;\n}\n\n[type=\"checkbox\"] {\n /* checkbox aspect */\n}\n\n[type=\"checkbox\"] + label {\n position: relative;\n padding-left: 35px;\n cursor: pointer;\n display: inline-block;\n height: 25px;\n line-height: 25px;\n font-size: 1rem;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n[type=\"checkbox\"] + label:before,\n[type=\"checkbox\"]:not(.filled-in) + label:after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 18px;\n height: 18px;\n z-index: 0;\n border: 2px solid #5a5a5a;\n border-radius: 1px;\n margin-top: 2px;\n -webkit-transition: .2s;\n -o-transition: .2s;\n transition: .2s;\n}\n\n[type=\"checkbox\"]:not(.filled-in) + label:after {\n border: 0;\n -webkit-transform: scale(0);\n -ms-transform: scale(0);\n transform: scale(0);\n}\n\n[type=\"checkbox\"]:not(:checked):disabled + label:before {\n border: none;\n background-color: rgba(0, 0, 0, 0.42);\n}\n\n[type=\"checkbox\"].tabbed:focus + label:after {\n -webkit-transform: scale(1);\n -ms-transform: scale(1);\n transform: scale(1);\n border: 0;\n border-radius: 50%;\n -webkit-box-shadow: 0 0 0 10px rgba(0, 0, 0, 0.1);\n box-shadow: 0 0 0 10px rgba(0, 0, 0, 0.1);\n background-color: rgba(0, 0, 0, 0.1);\n}\n\n[type=\"checkbox\"]:checked + label:before {\n top: -4px;\n left: -5px;\n width: 12px;\n height: 22px;\n border-top: 2px solid transparent;\n border-left: 2px solid transparent;\n border-right: 2px solid #26a69a;\n border-bottom: 2px solid #26a69a;\n -webkit-transform: rotate(40deg);\n -ms-transform: rotate(40deg);\n transform: rotate(40deg);\n -webkit-backface-visibility: hidden;\n backface-visibility: hidden;\n -webkit-transform-origin: 100% 100%;\n -ms-transform-origin: 100% 100%;\n transform-origin: 100% 100%;\n}\n\n[type=\"checkbox\"]:checked:disabled + label:before {\n border-right: 2px solid rgba(0, 0, 0, 0.42);\n border-bottom: 2px solid rgba(0, 0, 0, 0.42);\n}\n\n/* Indeterminate checkbox */\n[type=\"checkbox\"]:indeterminate + label:before {\n top: -11px;\n left: -12px;\n width: 10px;\n height: 22px;\n border-top: none;\n border-left: none;\n border-right: 2px solid #26a69a;\n border-bottom: none;\n -webkit-transform: rotate(90deg);\n -ms-transform: rotate(90deg);\n transform: rotate(90deg);\n -webkit-backface-visibility: hidden;\n backface-visibility: hidden;\n -webkit-transform-origin: 100% 100%;\n -ms-transform-origin: 100% 100%;\n transform-origin: 100% 100%;\n}\n\n[type=\"checkbox\"]:indeterminate:disabled + label:before {\n border-right: 2px solid rgba(0, 0, 0, 0.42);\n background-color: transparent;\n}\n\n[type=\"checkbox\"].filled-in + label:after {\n border-radius: 2px;\n}\n\n[type=\"checkbox\"].filled-in + label:before,\n[type=\"checkbox\"].filled-in + label:after {\n content: '';\n left: 0;\n position: absolute;\n /* .1s delay is for check animation */\n -webkit-transition: border .25s, background-color .25s, width .20s .1s, height .20s .1s, top .20s .1s, left .20s .1s;\n -o-transition: border .25s, background-color .25s, width .20s .1s, height .20s .1s, top .20s .1s, left .20s .1s;\n transition: border .25s, background-color .25s, width .20s .1s, height .20s .1s, top .20s .1s, left .20s .1s;\n z-index: 1;\n}\n\n[type=\"checkbox\"].filled-in:not(:checked) + label:before {\n width: 0;\n height: 0;\n border: 3px solid transparent;\n left: 6px;\n top: 10px;\n -webkit-transform: rotateZ(37deg);\n -ms-transform: rotate(37deg);\n transform: rotateZ(37deg);\n -webkit-transform-origin: 100% 100%;\n -ms-transform-origin: 100% 100%;\n transform-origin: 100% 100%;\n}\n\n[type=\"checkbox\"].filled-in:not(:checked) + label:after {\n height: 20px;\n width: 20px;\n background-color: transparent;\n border: 2px solid #5a5a5a;\n top: 0px;\n z-index: 0;\n}\n\n[type=\"checkbox\"].filled-in:checked + label:before {\n top: 0;\n left: 1px;\n width: 8px;\n height: 13px;\n border-top: 2px solid transparent;\n border-left: 2px solid transparent;\n border-right: 2px solid #fff;\n border-bottom: 2px solid #fff;\n -webkit-transform: rotateZ(37deg);\n -ms-transform: rotate(37deg);\n transform: rotateZ(37deg);\n -webkit-transform-origin: 100% 100%;\n -ms-transform-origin: 100% 100%;\n transform-origin: 100% 100%;\n}\n\n[type=\"checkbox\"].filled-in:checked + label:after {\n top: 0;\n width: 20px;\n height: 20px;\n border: 2px solid #26a69a;\n background-color: #26a69a;\n z-index: 0;\n}\n\n[type=\"checkbox\"].filled-in.tabbed:focus + label:after {\n border-radius: 2px;\n border-color: #5a5a5a;\n background-color: rgba(0, 0, 0, 0.1);\n}\n\n[type=\"checkbox\"].filled-in.tabbed:checked:focus + label:after {\n border-radius: 2px;\n background-color: #26a69a;\n border-color: #26a69a;\n}\n\n[type=\"checkbox\"].filled-in:disabled:not(:checked) + label:before {\n background-color: transparent;\n border: 2px solid transparent;\n}\n\n[type=\"checkbox\"].filled-in:disabled:not(:checked) + label:after {\n border-color: transparent;\n background-color: #949494;\n}\n\n[type=\"checkbox\"].filled-in:disabled:checked + label:before {\n background-color: transparent;\n}\n\n[type=\"checkbox\"].filled-in:disabled:checked + label:after {\n background-color: #949494;\n border-color: #949494;\n}\n\n/* Switch\r\n ========================================================================== */\n.switch,\n.switch * {\n -webkit-tap-highlight-color: transparent;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.switch label {\n cursor: pointer;\n}\n\n.switch label input[type=checkbox] {\n opacity: 0;\n width: 0;\n height: 0;\n}\n\n.switch label input[type=checkbox]:checked + .lever {\n background-color: #84c7c1;\n}\n\n.switch label input[type=checkbox]:checked + .lever:before, .switch label input[type=checkbox]:checked + .lever:after {\n left: 18px;\n}\n\n.switch label input[type=checkbox]:checked + .lever:after {\n background-color: #26a69a;\n}\n\n.switch label .lever {\n content: \"\";\n display: inline-block;\n position: relative;\n width: 36px;\n height: 14px;\n background-color: rgba(0, 0, 0, 0.38);\n border-radius: 15px;\n margin-right: 10px;\n -webkit-transition: background 0.3s ease;\n -o-transition: background 0.3s ease;\n transition: background 0.3s ease;\n vertical-align: middle;\n margin: 0 16px;\n}\n\n.switch label .lever:before, .switch label .lever:after {\n content: \"\";\n position: absolute;\n display: inline-block;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n left: 0;\n top: -3px;\n -webkit-transition: left 0.3s ease, background .3s ease, -webkit-box-shadow 0.1s ease, -webkit-transform .1s ease;\n transition: left 0.3s ease, background .3s ease, -webkit-box-shadow 0.1s ease, -webkit-transform .1s ease;\n -o-transition: left 0.3s ease, background .3s ease, box-shadow 0.1s ease, transform .1s ease;\n transition: left 0.3s ease, background .3s ease, box-shadow 0.1s ease, transform .1s ease;\n transition: left 0.3s ease, background .3s ease, box-shadow 0.1s ease, transform .1s ease, -webkit-box-shadow 0.1s ease, -webkit-transform .1s ease;\n}\n\n.switch label .lever:before {\n background-color: rgba(38, 166, 154, 0.15);\n}\n\n.switch label .lever:after {\n background-color: #F1F1F1;\n -webkit-box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);\n box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);\n}\n\ninput[type=checkbox]:checked:not(:disabled) ~ .lever:active::before,\ninput[type=checkbox]:checked:not(:disabled).tabbed:focus ~ .lever::before {\n -webkit-transform: scale(2.4);\n -ms-transform: scale(2.4);\n transform: scale(2.4);\n background-color: rgba(38, 166, 154, 0.15);\n}\n\ninput[type=checkbox]:not(:disabled) ~ .lever:active:before,\ninput[type=checkbox]:not(:disabled).tabbed:focus ~ .lever::before {\n -webkit-transform: scale(2.4);\n -ms-transform: scale(2.4);\n transform: scale(2.4);\n background-color: rgba(0, 0, 0, 0.08);\n}\n\n.switch input[type=checkbox][disabled] + .lever {\n cursor: default;\n background-color: rgba(0, 0, 0, 0.12);\n}\n\n.switch label input[type=checkbox][disabled] + .lever:after,\n.switch label input[type=checkbox][disabled]:checked + .lever:after {\n background-color: #949494;\n}\n\n/* Select Field\r\n ========================================================================== */\nselect {\n display: none;\n}\n\nselect.browser-default {\n display: block;\n}\n\nselect {\n background-color: rgba(255, 255, 255, 0.9);\n width: 100%;\n padding: 5px;\n border: 1px solid #f2f2f2;\n border-radius: 2px;\n height: 3rem;\n}\n\n.input-field > select {\n display: block;\n position: absolute;\n width: 0;\n pointer-events: none;\n height: 0;\n top: 0;\n left: 0;\n opacity: 0;\n}\n\n.select-label {\n position: absolute;\n}\n\n.select-wrapper {\n position: relative;\n}\n\n.select-wrapper.valid + label,\n.select-wrapper.invalid + label {\n width: 100%;\n pointer-events: none;\n}\n\n.select-wrapper input.select-dropdown {\n position: relative;\n cursor: pointer;\n background-color: transparent;\n border: none;\n border-bottom: 1px solid #9e9e9e;\n outline: none;\n height: 3rem;\n line-height: 3rem;\n width: 100%;\n font-size: 1rem;\n margin: 0 0 20px 0;\n padding: 0;\n display: block;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.select-wrapper span.caret {\n color: initial;\n position: absolute;\n right: 0;\n top: 0;\n bottom: 0;\n height: 10px;\n margin: auto 0;\n font-size: 10px;\n line-height: 10px;\n}\n\n.select-wrapper + label {\n position: absolute;\n top: -26px;\n font-size: 0.8rem;\n}\n\nselect:disabled {\n color: rgba(0, 0, 0, 0.42);\n}\n\n.select-wrapper.disabled span.caret,\n.select-wrapper.disabled + label {\n color: rgba(0, 0, 0, 0.42);\n}\n\n.select-wrapper input.select-dropdown:disabled {\n color: rgba(0, 0, 0, 0.42);\n cursor: default;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.select-wrapper i {\n color: rgba(0, 0, 0, 0.3);\n}\n\n.select-dropdown li.disabled,\n.select-dropdown li.disabled > span,\n.select-dropdown li.optgroup {\n color: rgba(0, 0, 0, 0.3);\n background-color: transparent;\n}\n\n.select-dropdown.dropdown-content li.active {\n background-color: transparent;\n}\n\n.select-dropdown.dropdown-content li:hover {\n background-color: rgba(0, 0, 0, 0.06);\n}\n\n.select-dropdown.dropdown-content li.selected {\n background-color: rgba(0, 0, 0, 0.03);\n}\n\n.prefix ~ .select-wrapper {\n margin-left: 3rem;\n width: 92%;\n width: calc(100% - 3rem);\n}\n\n.prefix ~ label {\n margin-left: 3rem;\n}\n\n.select-dropdown li img {\n height: 40px;\n width: 40px;\n margin: 5px 15px;\n float: right;\n}\n\n.select-dropdown li.optgroup {\n border-top: 1px solid #eee;\n}\n\n.select-dropdown li.optgroup.selected > span {\n color: rgba(0, 0, 0, 0.7);\n}\n\n.select-dropdown li.optgroup > span {\n color: rgba(0, 0, 0, 0.4);\n}\n\n.select-dropdown li.optgroup ~ li.optgroup-option {\n padding-left: 1rem;\n}\n\n/* File Input\r\n ========================================================================== */\n.file-field {\n position: relative;\n}\n\n.file-field .file-path-wrapper {\n overflow: hidden;\n padding-left: 10px;\n}\n\n.file-field input.file-path {\n width: 100%;\n}\n\n.file-field .btn, .file-field .btn-large {\n float: left;\n height: 3rem;\n line-height: 3rem;\n}\n\n.file-field span {\n cursor: pointer;\n}\n\n.file-field input[type=file] {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n width: 100%;\n margin: 0;\n padding: 0;\n font-size: 20px;\n cursor: pointer;\n opacity: 0;\n filter: alpha(opacity=0);\n}\n\n.file-field input[type=file]::-webkit-file-upload-button {\n display: none;\n}\n\n/* Range\r\n ========================================================================== */\n.range-field {\n position: relative;\n}\n\ninput[type=range],\ninput[type=range] + .thumb {\n cursor: pointer;\n}\n\ninput[type=range] {\n position: relative;\n background-color: transparent;\n border: none;\n outline: none;\n width: 100%;\n margin: 15px 0;\n padding: 0;\n}\n\ninput[type=range]:focus {\n outline: none;\n}\n\ninput[type=range] + .thumb {\n position: absolute;\n top: 10px;\n left: 0;\n border: none;\n height: 0;\n width: 0;\n border-radius: 50%;\n background-color: #26a69a;\n margin-left: 7px;\n -webkit-transform-origin: 50% 50%;\n -ms-transform-origin: 50% 50%;\n transform-origin: 50% 50%;\n -webkit-transform: rotate(-45deg);\n -ms-transform: rotate(-45deg);\n transform: rotate(-45deg);\n}\n\ninput[type=range] + .thumb .value {\n display: block;\n width: 30px;\n text-align: center;\n color: #26a69a;\n font-size: 0;\n -webkit-transform: rotate(45deg);\n -ms-transform: rotate(45deg);\n transform: rotate(45deg);\n}\n\ninput[type=range] + .thumb.active {\n border-radius: 50% 50% 50% 0;\n}\n\ninput[type=range] + .thumb.active .value {\n color: #fff;\n margin-left: -1px;\n margin-top: 8px;\n font-size: 10px;\n}\n\ninput[type=range] {\n -webkit-appearance: none;\n}\n\ninput[type=range]::-webkit-slider-runnable-track {\n height: 3px;\n background: #c2c0c2;\n border: none;\n}\n\ninput[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n border: none;\n height: 14px;\n width: 14px;\n border-radius: 50%;\n background-color: #26a69a;\n -webkit-transform-origin: 50% 50%;\n transform-origin: 50% 50%;\n margin: -5px 0 0 0;\n -webkit-transition: .3s;\n -o-transition: .3s;\n transition: .3s;\n}\n\ninput[type=range]:focus::-webkit-slider-runnable-track {\n background: #ccc;\n}\n\ninput[type=range] {\n /* fix for FF unable to apply focus style bug */\n border: 1px solid white;\n /*required for proper track sizing in FF*/\n}\n\ninput[type=range]::-moz-range-track {\n height: 3px;\n background: #ddd;\n border: none;\n}\n\ninput[type=range]::-moz-range-thumb {\n border: none;\n height: 14px;\n width: 14px;\n border-radius: 50%;\n background: #26a69a;\n margin-top: -5px;\n}\n\ninput[type=range]:-moz-focusring {\n outline: 1px solid #fff;\n outline-offset: -1px;\n}\n\ninput[type=range]:focus::-moz-range-track {\n background: #ccc;\n}\n\ninput[type=range]::-ms-track {\n height: 3px;\n background: transparent;\n border-color: transparent;\n border-width: 6px 0;\n /*remove default tick marks*/\n color: transparent;\n}\n\ninput[type=range]::-ms-fill-lower {\n background: #777;\n}\n\ninput[type=range]::-ms-fill-upper {\n background: #ddd;\n}\n\ninput[type=range]::-ms-thumb {\n border: none;\n height: 14px;\n width: 14px;\n border-radius: 50%;\n background: #26a69a;\n}\n\ninput[type=range]:focus::-ms-fill-lower {\n background: #888;\n}\n\ninput[type=range]:focus::-ms-fill-upper {\n background: #ccc;\n}\n\n/***************\r\n Nav List\r\n***************/\n.table-of-contents.fixed {\n position: fixed;\n}\n\n.table-of-contents li {\n padding: 2px 0;\n}\n\n.table-of-contents a {\n display: inline-block;\n font-weight: 300;\n color: #757575;\n padding-left: 20px;\n height: 1.5rem;\n line-height: 1.5rem;\n letter-spacing: .4;\n display: inline-block;\n}\n\n.table-of-contents a:hover {\n color: #a8a8a8;\n padding-left: 19px;\n border-left: 1px solid #ee6e73;\n}\n\n.table-of-contents a.active {\n font-weight: 500;\n padding-left: 18px;\n border-left: 2px solid #ee6e73;\n}\n\n.side-nav {\n position: fixed;\n width: 300px;\n left: 0;\n top: 0;\n margin: 0;\n -webkit-transform: translateX(-100%);\n -ms-transform: translateX(-100%);\n transform: translateX(-100%);\n height: 100%;\n height: calc(100% + 60px);\n height: -moz-calc(100%);\n padding-bottom: 60px;\n background-color: #fff;\n z-index: 999;\n overflow-y: auto;\n will-change: transform;\n -webkit-backface-visibility: hidden;\n backface-visibility: hidden;\n -webkit-transform: translateX(-105%);\n -ms-transform: translateX(-105%);\n transform: translateX(-105%);\n}\n\n.side-nav.right-aligned {\n right: 0;\n -webkit-transform: translateX(105%);\n -ms-transform: translateX(105%);\n transform: translateX(105%);\n left: auto;\n -webkit-transform: translateX(100%);\n -ms-transform: translateX(100%);\n transform: translateX(100%);\n}\n\n.side-nav .collapsible {\n margin: 0;\n}\n\n.side-nav li {\n float: none;\n line-height: 48px;\n}\n\n.side-nav li.active {\n background-color: rgba(0, 0, 0, 0.05);\n}\n\n.side-nav li > a {\n color: rgba(0, 0, 0, 0.87);\n display: block;\n font-size: 14px;\n font-weight: 500;\n height: 48px;\n line-height: 48px;\n padding: 0 32px;\n}\n\n.side-nav li > a:hover {\n background-color: rgba(0, 0, 0, 0.05);\n}\n\n.side-nav li > a.btn, .side-nav li > a.btn-large, .side-nav li > a.btn-large, .side-nav li > a.btn-flat, .side-nav li > a.btn-floating {\n margin: 10px 15px;\n}\n\n.side-nav li > a.btn, .side-nav li > a.btn-large, .side-nav li > a.btn-large, .side-nav li > a.btn-floating {\n color: #fff;\n}\n\n.side-nav li > a.btn-flat {\n color: #343434;\n}\n\n.side-nav li > a.btn:hover, .side-nav li > a.btn-large:hover, .side-nav li > a.btn-large:hover {\n background-color: #2bbbad;\n}\n\n.side-nav li > a.btn-floating:hover {\n background-color: #26a69a;\n}\n\n.side-nav li > a > i,\n.side-nav li > a > [class^=\"mdi-\"], .side-nav li > a li > a > [class*=\"mdi-\"],\n.side-nav li > a > i.material-icons {\n float: left;\n height: 48px;\n line-height: 48px;\n margin: 0 32px 0 0;\n width: 24px;\n color: rgba(0, 0, 0, 0.54);\n}\n\n.side-nav .divider {\n margin: 8px 0 0 0;\n}\n\n.side-nav .subheader {\n cursor: initial;\n pointer-events: none;\n color: rgba(0, 0, 0, 0.54);\n font-size: 14px;\n font-weight: 500;\n line-height: 48px;\n}\n\n.side-nav .subheader:hover {\n background-color: transparent;\n}\n\n.side-nav .user-view,\n.side-nav .userView {\n position: relative;\n padding: 32px 32px 0;\n margin-bottom: 8px;\n}\n\n.side-nav .user-view > a,\n.side-nav .userView > a {\n height: auto;\n padding: 0;\n}\n\n.side-nav .user-view > a:hover,\n.side-nav .userView > a:hover {\n background-color: transparent;\n}\n\n.side-nav .user-view .background,\n.side-nav .userView .background {\n overflow: hidden;\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: -1;\n}\n\n.side-nav .user-view .circle, .side-nav .user-view .name, .side-nav .user-view .email,\n.side-nav .userView .circle,\n.side-nav .userView .name,\n.side-nav .userView .email {\n display: block;\n}\n\n.side-nav .user-view .circle,\n.side-nav .userView .circle {\n height: 64px;\n width: 64px;\n}\n\n.side-nav .user-view .name,\n.side-nav .user-view .email,\n.side-nav .userView .name,\n.side-nav .userView .email {\n font-size: 14px;\n line-height: 24px;\n}\n\n.side-nav .user-view .name,\n.side-nav .userView .name {\n margin-top: 16px;\n font-weight: 500;\n}\n\n.side-nav .user-view .email,\n.side-nav .userView .email {\n padding-bottom: 16px;\n font-weight: 400;\n}\n\n.drag-target {\n height: 100%;\n width: 10px;\n position: fixed;\n top: 0;\n z-index: 998;\n}\n\n.side-nav.fixed {\n left: 0;\n -webkit-transform: translateX(0);\n -ms-transform: translateX(0);\n transform: translateX(0);\n position: fixed;\n}\n\n.side-nav.fixed.right-aligned {\n right: 0;\n left: auto;\n}\n\n@media only screen and (max-width: 992px) {\n .side-nav.fixed {\n -webkit-transform: translateX(-105%);\n -ms-transform: translateX(-105%);\n transform: translateX(-105%);\n }\n .side-nav.fixed.right-aligned {\n -webkit-transform: translateX(105%);\n -ms-transform: translateX(105%);\n transform: translateX(105%);\n }\n .side-nav a {\n padding: 0 16px;\n }\n .side-nav .user-view,\n .side-nav .userView {\n padding: 16px 16px 0;\n }\n}\n\n.side-nav .collapsible-body > ul:not(.collapsible) > li.active,\n.side-nav.fixed .collapsible-body > ul:not(.collapsible) > li.active {\n background-color: #ee6e73;\n}\n\n.side-nav .collapsible-body > ul:not(.collapsible) > li.active a,\n.side-nav.fixed .collapsible-body > ul:not(.collapsible) > li.active a {\n color: #fff;\n}\n\n.side-nav .collapsible-body {\n padding: 0;\n}\n\n#sidenav-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n height: 120vh;\n background-color: rgba(0, 0, 0, 0.5);\n z-index: 997;\n will-change: opacity;\n}\n\n/*\r\n @license\r\n Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\r\n This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\r\n The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\r\n The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\r\n Code distributed by Google as part of the polymer project is also\r\n subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\r\n */\n/**************************/\n/* STYLES FOR THE SPINNER */\n/**************************/\n/*\r\n * Constants:\r\n * STROKEWIDTH = 3px\r\n * ARCSIZE = 270 degrees (amount of circle the arc takes up)\r\n * ARCTIME = 1333ms (time it takes to expand and contract arc)\r\n * ARCSTARTROT = 216 degrees (how much the start location of the arc\r\n * should rotate each time, 216 gives us a\r\n * 5 pointed star shape (it's 360/5 * 3).\r\n * For a 7 pointed star, we might do\r\n * 360/7 * 3 = 154.286)\r\n * CONTAINERWIDTH = 28px\r\n * SHRINK_TIME = 400ms\r\n */\n.preloader-wrapper {\n display: inline-block;\n position: relative;\n width: 50px;\n height: 50px;\n}\n\n.preloader-wrapper.small {\n width: 36px;\n height: 36px;\n}\n\n.preloader-wrapper.big {\n width: 64px;\n height: 64px;\n}\n\n.preloader-wrapper.active {\n /* duration: 360 * ARCTIME / (ARCSTARTROT + (360-ARCSIZE)) */\n -webkit-animation: container-rotate 1568ms linear infinite;\n animation: container-rotate 1568ms linear infinite;\n}\n\n@-webkit-keyframes container-rotate {\n to {\n -webkit-transform: rotate(360deg);\n }\n}\n\n@keyframes container-rotate {\n to {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n.spinner-layer {\n position: absolute;\n width: 100%;\n height: 100%;\n opacity: 0;\n border-color: #26a69a;\n}\n\n.spinner-blue,\n.spinner-blue-only {\n border-color: #4285f4;\n}\n\n.spinner-red,\n.spinner-red-only {\n border-color: #db4437;\n}\n\n.spinner-yellow,\n.spinner-yellow-only {\n border-color: #f4b400;\n}\n\n.spinner-green,\n.spinner-green-only {\n border-color: #0f9d58;\n}\n\n/**\r\n * IMPORTANT NOTE ABOUT CSS ANIMATION PROPERTIES (keanulee):\r\n *\r\n * iOS Safari (tested on iOS 8.1) does not handle animation-delay very well - it doesn't\r\n * guarantee that the animation will start _exactly_ after that value. So we avoid using\r\n * animation-delay and instead set custom keyframes for each color (as redundant as it\r\n * seems).\r\n *\r\n * We write out each animation in full (instead of separating animation-name,\r\n * animation-duration, etc.) because under the polyfill, Safari does not recognize those\r\n * specific properties properly, treats them as -webkit-animation, and overrides the\r\n * other animation rules. See https://github.com/Polymer/platform/issues/53.\r\n */\n.active .spinner-layer.spinner-blue {\n /* durations: 4 * ARCTIME */\n -webkit-animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both, blue-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;\n animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both, blue-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;\n}\n\n.active .spinner-layer.spinner-red {\n /* durations: 4 * ARCTIME */\n -webkit-animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both, red-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;\n animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both, red-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;\n}\n\n.active .spinner-layer.spinner-yellow {\n /* durations: 4 * ARCTIME */\n -webkit-animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both, yellow-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;\n animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both, yellow-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;\n}\n\n.active .spinner-layer.spinner-green {\n /* durations: 4 * ARCTIME */\n -webkit-animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both, green-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;\n animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both, green-fade-in-out 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;\n}\n\n.active .spinner-layer,\n.active .spinner-layer.spinner-blue-only,\n.active .spinner-layer.spinner-red-only,\n.active .spinner-layer.spinner-yellow-only,\n.active .spinner-layer.spinner-green-only {\n /* durations: 4 * ARCTIME */\n opacity: 1;\n -webkit-animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;\n animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;\n}\n\n@-webkit-keyframes fill-unfill-rotate {\n 12.5% {\n -webkit-transform: rotate(135deg);\n }\n /* 0.5 * ARCSIZE */\n 25% {\n -webkit-transform: rotate(270deg);\n }\n /* 1 * ARCSIZE */\n 37.5% {\n -webkit-transform: rotate(405deg);\n }\n /* 1.5 * ARCSIZE */\n 50% {\n -webkit-transform: rotate(540deg);\n }\n /* 2 * ARCSIZE */\n 62.5% {\n -webkit-transform: rotate(675deg);\n }\n /* 2.5 * ARCSIZE */\n 75% {\n -webkit-transform: rotate(810deg);\n }\n /* 3 * ARCSIZE */\n 87.5% {\n -webkit-transform: rotate(945deg);\n }\n /* 3.5 * ARCSIZE */\n to {\n -webkit-transform: rotate(1080deg);\n }\n /* 4 * ARCSIZE */\n}\n\n@keyframes fill-unfill-rotate {\n 12.5% {\n -webkit-transform: rotate(135deg);\n transform: rotate(135deg);\n }\n /* 0.5 * ARCSIZE */\n 25% {\n -webkit-transform: rotate(270deg);\n transform: rotate(270deg);\n }\n /* 1 * ARCSIZE */\n 37.5% {\n -webkit-transform: rotate(405deg);\n transform: rotate(405deg);\n }\n /* 1.5 * ARCSIZE */\n 50% {\n -webkit-transform: rotate(540deg);\n transform: rotate(540deg);\n }\n /* 2 * ARCSIZE */\n 62.5% {\n -webkit-transform: rotate(675deg);\n transform: rotate(675deg);\n }\n /* 2.5 * ARCSIZE */\n 75% {\n -webkit-transform: rotate(810deg);\n transform: rotate(810deg);\n }\n /* 3 * ARCSIZE */\n 87.5% {\n -webkit-transform: rotate(945deg);\n transform: rotate(945deg);\n }\n /* 3.5 * ARCSIZE */\n to {\n -webkit-transform: rotate(1080deg);\n transform: rotate(1080deg);\n }\n /* 4 * ARCSIZE */\n}\n\n@-webkit-keyframes blue-fade-in-out {\n from {\n opacity: 1;\n }\n 25% {\n opacity: 1;\n }\n 26% {\n opacity: 0;\n }\n 89% {\n opacity: 0;\n }\n 90% {\n opacity: 1;\n }\n 100% {\n opacity: 1;\n }\n}\n\n@keyframes blue-fade-in-out {\n from {\n opacity: 1;\n }\n 25% {\n opacity: 1;\n }\n 26% {\n opacity: 0;\n }\n 89% {\n opacity: 0;\n }\n 90% {\n opacity: 1;\n }\n 100% {\n opacity: 1;\n }\n}\n\n@-webkit-keyframes red-fade-in-out {\n from {\n opacity: 0;\n }\n 15% {\n opacity: 0;\n }\n 25% {\n opacity: 1;\n }\n 50% {\n opacity: 1;\n }\n 51% {\n opacity: 0;\n }\n}\n\n@keyframes red-fade-in-out {\n from {\n opacity: 0;\n }\n 15% {\n opacity: 0;\n }\n 25% {\n opacity: 1;\n }\n 50% {\n opacity: 1;\n }\n 51% {\n opacity: 0;\n }\n}\n\n@-webkit-keyframes yellow-fade-in-out {\n from {\n opacity: 0;\n }\n 40% {\n opacity: 0;\n }\n 50% {\n opacity: 1;\n }\n 75% {\n opacity: 1;\n }\n 76% {\n opacity: 0;\n }\n}\n\n@keyframes yellow-fade-in-out {\n from {\n opacity: 0;\n }\n 40% {\n opacity: 0;\n }\n 50% {\n opacity: 1;\n }\n 75% {\n opacity: 1;\n }\n 76% {\n opacity: 0;\n }\n}\n\n@-webkit-keyframes green-fade-in-out {\n from {\n opacity: 0;\n }\n 65% {\n opacity: 0;\n }\n 75% {\n opacity: 1;\n }\n 90% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n}\n\n@keyframes green-fade-in-out {\n from {\n opacity: 0;\n }\n 65% {\n opacity: 0;\n }\n 75% {\n opacity: 1;\n }\n 90% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n}\n\n/**\r\n * Patch the gap that appear between the two adjacent div.circle-clipper while the\r\n * spinner is rotating (appears on Chrome 38, Safari 7.1, and IE 11).\r\n */\n.gap-patch {\n position: absolute;\n top: 0;\n left: 45%;\n width: 10%;\n height: 100%;\n overflow: hidden;\n border-color: inherit;\n}\n\n.gap-patch .circle {\n width: 1000%;\n left: -450%;\n}\n\n.circle-clipper {\n display: inline-block;\n position: relative;\n width: 50%;\n height: 100%;\n overflow: hidden;\n border-color: inherit;\n}\n\n.circle-clipper .circle {\n width: 200%;\n height: 100%;\n border-width: 3px;\n /* STROKEWIDTH */\n border-style: solid;\n border-color: inherit;\n border-bottom-color: transparent !important;\n border-radius: 50%;\n -webkit-animation: none;\n animation: none;\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n}\n\n.circle-clipper.left .circle {\n left: 0;\n border-right-color: transparent !important;\n -webkit-transform: rotate(129deg);\n -ms-transform: rotate(129deg);\n transform: rotate(129deg);\n}\n\n.circle-clipper.right .circle {\n left: -100%;\n border-left-color: transparent !important;\n -webkit-transform: rotate(-129deg);\n -ms-transform: rotate(-129deg);\n transform: rotate(-129deg);\n}\n\n.active .circle-clipper.left .circle {\n /* duration: ARCTIME */\n -webkit-animation: left-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;\n animation: left-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;\n}\n\n.active .circle-clipper.right .circle {\n /* duration: ARCTIME */\n -webkit-animation: right-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;\n animation: right-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both;\n}\n\n@-webkit-keyframes left-spin {\n from {\n -webkit-transform: rotate(130deg);\n }\n 50% {\n -webkit-transform: rotate(-5deg);\n }\n to {\n -webkit-transform: rotate(130deg);\n }\n}\n\n@keyframes left-spin {\n from {\n -webkit-transform: rotate(130deg);\n transform: rotate(130deg);\n }\n 50% {\n -webkit-transform: rotate(-5deg);\n transform: rotate(-5deg);\n }\n to {\n -webkit-transform: rotate(130deg);\n transform: rotate(130deg);\n }\n}\n\n@-webkit-keyframes right-spin {\n from {\n -webkit-transform: rotate(-130deg);\n }\n 50% {\n -webkit-transform: rotate(5deg);\n }\n to {\n -webkit-transform: rotate(-130deg);\n }\n}\n\n@keyframes right-spin {\n from {\n -webkit-transform: rotate(-130deg);\n transform: rotate(-130deg);\n }\n 50% {\n -webkit-transform: rotate(5deg);\n transform: rotate(5deg);\n }\n to {\n -webkit-transform: rotate(-130deg);\n transform: rotate(-130deg);\n }\n}\n\n#spinnerContainer.cooldown {\n /* duration: SHRINK_TIME */\n -webkit-animation: container-rotate 1568ms linear infinite, fade-out 400ms cubic-bezier(0.4, 0, 0.2, 1);\n animation: container-rotate 1568ms linear infinite, fade-out 400ms cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n@-webkit-keyframes fade-out {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n@keyframes fade-out {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n.slider {\n position: relative;\n height: 400px;\n width: 100%;\n}\n\n.slider.fullscreen {\n height: 100%;\n width: 100%;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n}\n\n.slider.fullscreen ul.slides {\n height: 100%;\n}\n\n.slider.fullscreen ul.indicators {\n z-index: 2;\n bottom: 30px;\n}\n\n.slider .slides {\n background-color: #9e9e9e;\n margin: 0;\n height: 400px;\n}\n\n.slider .slides li {\n opacity: 0;\n position: absolute;\n top: 0;\n left: 0;\n z-index: 1;\n width: 100%;\n height: inherit;\n overflow: hidden;\n}\n\n.slider .slides li img {\n height: 100%;\n width: 100%;\n background-size: cover;\n background-position: center;\n}\n\n.slider .slides li .caption {\n color: #fff;\n position: absolute;\n top: 15%;\n left: 15%;\n width: 70%;\n opacity: 0;\n}\n\n.slider .slides li .caption p {\n color: #e0e0e0;\n}\n\n.slider .slides li.active {\n z-index: 2;\n}\n\n.slider .indicators {\n position: absolute;\n text-align: center;\n left: 0;\n right: 0;\n bottom: 0;\n margin: 0;\n}\n\n.slider .indicators .indicator-item {\n display: inline-block;\n position: relative;\n cursor: pointer;\n height: 16px;\n width: 16px;\n margin: 0 12px;\n background-color: #e0e0e0;\n -webkit-transition: background-color .3s;\n -o-transition: background-color .3s;\n transition: background-color .3s;\n border-radius: 50%;\n}\n\n.slider .indicators .indicator-item.active {\n background-color: #4CAF50;\n}\n\n.carousel {\n overflow: hidden;\n position: relative;\n width: 100%;\n height: 400px;\n -webkit-perspective: 500px;\n perspective: 500px;\n -webkit-transform-style: preserve-3d;\n transform-style: preserve-3d;\n -webkit-transform-origin: 0% 50%;\n -ms-transform-origin: 0% 50%;\n transform-origin: 0% 50%;\n}\n\n.carousel.carousel-slider {\n top: 0;\n left: 0;\n}\n\n.carousel.carousel-slider .carousel-fixed-item {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 20px;\n z-index: 1;\n}\n\n.carousel.carousel-slider .carousel-fixed-item.with-indicators {\n bottom: 68px;\n}\n\n.carousel.carousel-slider .carousel-item {\n width: 100%;\n height: 100%;\n min-height: 400px;\n position: absolute;\n top: 0;\n left: 0;\n}\n\n.carousel.carousel-slider .carousel-item h2 {\n font-size: 24px;\n font-weight: 500;\n line-height: 32px;\n}\n\n.carousel.carousel-slider .carousel-item p {\n font-size: 15px;\n}\n\n.carousel .carousel-item {\n display: none;\n width: 200px;\n height: 200px;\n position: absolute;\n top: 0;\n left: 0;\n}\n\n.carousel .carousel-item > img {\n width: 100%;\n}\n\n.carousel .indicators {\n position: absolute;\n text-align: center;\n left: 0;\n right: 0;\n bottom: 0;\n margin: 0;\n}\n\n.carousel .indicators .indicator-item {\n display: inline-block;\n position: relative;\n cursor: pointer;\n height: 8px;\n width: 8px;\n margin: 24px 4px;\n background-color: rgba(255, 255, 255, 0.5);\n -webkit-transition: background-color .3s;\n -o-transition: background-color .3s;\n transition: background-color .3s;\n border-radius: 50%;\n}\n\n.carousel .indicators .indicator-item.active {\n background-color: #fff;\n}\n\n.carousel.scrolling .carousel-item .materialboxed,\n.carousel .carousel-item:not(.active) .materialboxed {\n pointer-events: none;\n}\n\n.tap-target-wrapper {\n width: 800px;\n height: 800px;\n position: fixed;\n z-index: 1000;\n visibility: hidden;\n -webkit-transition: visibility 0s .3s;\n -o-transition: visibility 0s .3s;\n transition: visibility 0s .3s;\n}\n\n.tap-target-wrapper.open {\n visibility: visible;\n -webkit-transition: visibility 0s;\n -o-transition: visibility 0s;\n transition: visibility 0s;\n}\n\n.tap-target-wrapper.open .tap-target {\n -webkit-transform: scale(1);\n -ms-transform: scale(1);\n transform: scale(1);\n opacity: .95;\n -webkit-transition: opacity 0.3s cubic-bezier(0.42, 0, 0.58, 1), -webkit-transform 0.3s cubic-bezier(0.42, 0, 0.58, 1);\n transition: opacity 0.3s cubic-bezier(0.42, 0, 0.58, 1), -webkit-transform 0.3s cubic-bezier(0.42, 0, 0.58, 1);\n -o-transition: transform 0.3s cubic-bezier(0.42, 0, 0.58, 1), opacity 0.3s cubic-bezier(0.42, 0, 0.58, 1);\n transition: transform 0.3s cubic-bezier(0.42, 0, 0.58, 1), opacity 0.3s cubic-bezier(0.42, 0, 0.58, 1);\n transition: transform 0.3s cubic-bezier(0.42, 0, 0.58, 1), opacity 0.3s cubic-bezier(0.42, 0, 0.58, 1), -webkit-transform 0.3s cubic-bezier(0.42, 0, 0.58, 1);\n}\n\n.tap-target-wrapper.open .tap-target-wave::before {\n -webkit-transform: scale(1);\n -ms-transform: scale(1);\n transform: scale(1);\n}\n\n.tap-target-wrapper.open .tap-target-wave::after {\n visibility: visible;\n -webkit-animation: pulse-animation 1s cubic-bezier(0.24, 0, 0.38, 1) infinite;\n animation: pulse-animation 1s cubic-bezier(0.24, 0, 0.38, 1) infinite;\n -webkit-transition: opacity .3s,\r visibility 0s 1s,\r -webkit-transform .3s;\n transition: opacity .3s,\r visibility 0s 1s,\r -webkit-transform .3s;\n -o-transition: opacity .3s,\r transform .3s,\r visibility 0s 1s;\n transition: opacity .3s,\r transform .3s,\r visibility 0s 1s;\n transition: opacity .3s,\r transform .3s,\r visibility 0s 1s,\r -webkit-transform .3s;\n}\n\n.tap-target {\n position: absolute;\n font-size: 1rem;\n border-radius: 50%;\n background-color: #ee6e73;\n -webkit-box-shadow: 0 20px 20px 0 rgba(0, 0, 0, 0.14), 0 10px 50px 0 rgba(0, 0, 0, 0.12), 0 30px 10px -20px rgba(0, 0, 0, 0.2);\n box-shadow: 0 20px 20px 0 rgba(0, 0, 0, 0.14), 0 10px 50px 0 rgba(0, 0, 0, 0.12), 0 30px 10px -20px rgba(0, 0, 0, 0.2);\n width: 100%;\n height: 100%;\n opacity: 0;\n -webkit-transform: scale(0);\n -ms-transform: scale(0);\n transform: scale(0);\n -webkit-transition: opacity 0.3s cubic-bezier(0.42, 0, 0.58, 1), -webkit-transform 0.3s cubic-bezier(0.42, 0, 0.58, 1);\n transition: opacity 0.3s cubic-bezier(0.42, 0, 0.58, 1), -webkit-transform 0.3s cubic-bezier(0.42, 0, 0.58, 1);\n -o-transition: transform 0.3s cubic-bezier(0.42, 0, 0.58, 1), opacity 0.3s cubic-bezier(0.42, 0, 0.58, 1);\n transition: transform 0.3s cubic-bezier(0.42, 0, 0.58, 1), opacity 0.3s cubic-bezier(0.42, 0, 0.58, 1);\n transition: transform 0.3s cubic-bezier(0.42, 0, 0.58, 1), opacity 0.3s cubic-bezier(0.42, 0, 0.58, 1), -webkit-transform 0.3s cubic-bezier(0.42, 0, 0.58, 1);\n}\n\n.tap-target-content {\n position: relative;\n display: table-cell;\n}\n\n.tap-target-wave {\n position: absolute;\n border-radius: 50%;\n z-index: 10001;\n}\n\n.tap-target-wave::before, .tap-target-wave::after {\n content: '';\n display: block;\n position: absolute;\n width: 100%;\n height: 100%;\n border-radius: 50%;\n background-color: #ffffff;\n}\n\n.tap-target-wave::before {\n -webkit-transform: scale(0);\n -ms-transform: scale(0);\n transform: scale(0);\n -webkit-transition: -webkit-transform .3s;\n transition: -webkit-transform .3s;\n -o-transition: transform .3s;\n transition: transform .3s;\n transition: transform .3s, -webkit-transform .3s;\n}\n\n.tap-target-wave::after {\n visibility: hidden;\n -webkit-transition: opacity .3s,\r visibility 0s,\r -webkit-transform .3s;\n transition: opacity .3s,\r visibility 0s,\r -webkit-transform .3s;\n -o-transition: opacity .3s,\r transform .3s,\r visibility 0s;\n transition: opacity .3s,\r transform .3s,\r visibility 0s;\n transition: opacity .3s,\r transform .3s,\r visibility 0s,\r -webkit-transform .3s;\n z-index: -1;\n}\n\n.tap-target-origin {\n top: 50%;\n left: 50%;\n -webkit-transform: translate(-50%, -50%);\n -ms-transform: translate(-50%, -50%);\n transform: translate(-50%, -50%);\n z-index: 10002;\n position: absolute !important;\n}\n\n.tap-target-origin:not(.btn):not(.btn-large), .tap-target-origin:not(.btn):not(.btn-large):hover {\n background: none;\n}\n\n@media only screen and (max-width: 600px) {\n .tap-target, .tap-target-wrapper {\n width: 600px;\n height: 600px;\n }\n}\n\n.pulse {\n overflow: initial;\n position: relative;\n}\n\n.pulse::before {\n content: '';\n display: block;\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background-color: inherit;\n border-radius: inherit;\n -webkit-transition: opacity .3s, -webkit-transform .3s;\n transition: opacity .3s, -webkit-transform .3s;\n -o-transition: opacity .3s, transform .3s;\n transition: opacity .3s, transform .3s;\n transition: opacity .3s, transform .3s, -webkit-transform .3s;\n -webkit-animation: pulse-animation 1s cubic-bezier(0.24, 0, 0.38, 1) infinite;\n animation: pulse-animation 1s cubic-bezier(0.24, 0, 0.38, 1) infinite;\n z-index: -1;\n}\n\n@-webkit-keyframes pulse-animation {\n 0% {\n opacity: 1;\n -webkit-transform: scale(1);\n transform: scale(1);\n }\n 50% {\n opacity: 0;\n -webkit-transform: scale(1.5);\n transform: scale(1.5);\n }\n 100% {\n opacity: 0;\n -webkit-transform: scale(1.5);\n transform: scale(1.5);\n }\n}\n\n@keyframes pulse-animation {\n 0% {\n opacity: 1;\n -webkit-transform: scale(1);\n transform: scale(1);\n }\n 50% {\n opacity: 0;\n -webkit-transform: scale(1.5);\n transform: scale(1.5);\n }\n 100% {\n opacity: 0;\n -webkit-transform: scale(1.5);\n transform: scale(1.5);\n }\n}\n\n/* ==========================================================================\r\n $BASE-PICKER\r\n ========================================================================== */\n/**\r\n * Note: the root picker element should *NOT* be styled more than what's here.\r\n */\n.picker {\n font-size: 16px;\n text-align: left;\n line-height: 1.2;\n color: #000000;\n position: absolute;\n z-index: 10000;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n outline: none;\n}\n\n/**\r\n * The picker input element.\r\n */\n.picker__input {\n cursor: default;\n}\n\n/**\r\n * When the picker is opened, the input element is \"activated\".\r\n */\n.picker__input.picker__input--active {\n border-color: #0089ec;\n}\n\n/**\r\n * The holder is the only \"scrollable\" top-level container element.\r\n */\n.picker__holder {\n width: 100%;\n overflow-y: auto;\n -webkit-overflow-scrolling: touch;\n}\n\n/*!\r\n * Default mobile-first, responsive styling for pickadate.js\r\n * Demo: http://amsul.github.io/pickadate.js\r\n */\n/**\r\n * Note: the root picker element should *NOT* be styled more than what's here.\r\n */\n/**\r\n * Make the holder and frame fullscreen.\r\n */\n.picker__holder,\n.picker__frame {\n bottom: 0;\n left: 0;\n right: 0;\n top: 100%;\n}\n\n/**\r\n * The holder should overlay the entire screen.\r\n */\n.picker__holder {\n position: fixed;\n -webkit-transition: background 0.15s ease-out, top 0s 0.15s;\n -o-transition: background 0.15s ease-out, top 0s 0.15s;\n transition: background 0.15s ease-out, top 0s 0.15s;\n -webkit-backface-visibility: hidden;\n}\n\n/**\r\n * The frame that bounds the box contents of the picker.\r\n */\n.picker__frame {\n position: absolute;\n margin: 0 auto;\n min-width: 256px;\n width: 300px;\n max-height: 350px;\n -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n filter: alpha(opacity=0);\n -moz-opacity: 0;\n opacity: 0;\n -webkit-transition: all 0.15s ease-out;\n -o-transition: all 0.15s ease-out;\n transition: all 0.15s ease-out;\n}\n\n@media (min-height: 28.875em) {\n .picker__frame {\n overflow: visible;\n top: auto;\n bottom: -100%;\n max-height: 80%;\n }\n}\n\n@media (min-height: 40.125em) {\n .picker__frame {\n margin-bottom: 7.5%;\n }\n}\n\n/**\r\n * The wrapper sets the stage to vertically align the box contents.\r\n */\n.picker__wrap {\n display: table;\n width: 100%;\n height: 100%;\n}\n\n@media (min-height: 28.875em) {\n .picker__wrap {\n display: block;\n }\n}\n\n/**\r\n * The box contains all the picker contents.\r\n */\n.picker__box {\n background: #ffffff;\n display: table-cell;\n vertical-align: middle;\n}\n\n@media (min-height: 28.875em) {\n .picker__box {\n display: block;\n border: 1px solid #777777;\n border-top-color: #898989;\n border-bottom-width: 0;\n border-radius: 5px 5px 0 0;\n -webkit-box-shadow: 0 12px 36px 16px rgba(0, 0, 0, 0.24);\n box-shadow: 0 12px 36px 16px rgba(0, 0, 0, 0.24);\n }\n}\n\n/**\r\n * When the picker opens...\r\n */\n.picker--opened .picker__holder {\n top: 0;\n background: transparent;\n -ms-filter: \"progid:DXImageTransform.Microsoft.gradient(startColorstr=#1E000000,endColorstr=#1E000000)\";\n zoom: 1;\n background: rgba(0, 0, 0, 0.32);\n -webkit-transition: background 0.15s ease-out;\n -o-transition: background 0.15s ease-out;\n transition: background 0.15s ease-out;\n}\n\n.picker--opened .picker__frame {\n top: 0;\n -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)\";\n filter: alpha(opacity=100);\n -moz-opacity: 1;\n opacity: 1;\n}\n\n@media (min-height: 35.875em) {\n .picker--opened .picker__frame {\n top: 10%;\n bottom: auto;\n }\n}\n\n/**\r\n * For `large` screens, transform into an inline picker.\r\n */\n/* ==========================================================================\r\n CUSTOM MATERIALIZE STYLES\r\n ========================================================================== */\n.picker__input.picker__input--active {\n border-color: #E3F2FD;\n}\n\n.picker__frame {\n margin: 0 auto;\n max-width: 325px;\n}\n\n@media (min-height: 38.875em) {\n .picker--opened .picker__frame {\n top: 10%;\n bottom: auto;\n }\n}\n\n@media only screen and (min-width: 601px) {\n .picker__box {\n display: -ms-flexbox;\n display: flex;\n }\n .picker__frame {\n width: 80%;\n max-width: 600px;\n }\n}\n\n/* ==========================================================================\r\n $BASE-DATE-PICKER\r\n ========================================================================== */\n/**\r\n * The picker box.\r\n */\n.picker__box {\n padding: 0;\n border-radius: 2px;\n overflow: hidden;\n}\n\n/**\r\n * The header containing the month and year stuff.\r\n */\n.picker__header {\n text-align: center;\n position: relative;\n margin-top: .75em;\n}\n\n/**\r\n * The month and year labels.\r\n */\n.picker__month,\n.picker__year {\n display: inline-block;\n margin-left: .25em;\n margin-right: .25em;\n}\n\n/**\r\n * The month and year selectors.\r\n */\n.picker__select--month,\n.picker__select--year {\n height: 2em;\n padding: 0;\n margin-left: .25em;\n margin-right: .25em;\n}\n\n.picker__select--month.browser-default {\n display: inline;\n background-color: #FFFFFF;\n width: 40%;\n}\n\n.picker__select--year.browser-default {\n display: inline;\n background-color: #FFFFFF;\n width: 26%;\n}\n\n.picker__select--month:focus,\n.picker__select--year:focus {\n border-color: rgba(0, 0, 0, 0.05);\n}\n\n/**\r\n * The month navigation buttons.\r\n */\n.picker__nav--prev,\n.picker__nav--next {\n position: absolute;\n padding: .5em 1.25em;\n width: 1em;\n height: 1em;\n -webkit-box-sizing: content-box;\n box-sizing: content-box;\n top: -0.25em;\n}\n\n.picker__nav--prev {\n left: -1em;\n padding-right: 1.25em;\n}\n\n.picker__nav--next {\n right: -1em;\n padding-left: 1.25em;\n}\n\n.picker__nav--disabled,\n.picker__nav--disabled:hover,\n.picker__nav--disabled:before,\n.picker__nav--disabled:before:hover {\n cursor: default;\n background: none;\n border-right-color: #f5f5f5;\n border-left-color: #f5f5f5;\n}\n\n/**\r\n * The calendar table of dates\r\n */\n.picker__table {\n text-align: center;\n border-collapse: collapse;\n border-spacing: 0;\n table-layout: fixed;\n font-size: 1rem;\n width: 100%;\n margin-top: .75em;\n margin-bottom: .5em;\n}\n\n.picker__table th, .picker__table td {\n text-align: center;\n}\n\n.picker__table td {\n margin: 0;\n padding: 0;\n}\n\n/**\r\n * The weekday labels\r\n */\n.picker__weekday {\n width: 14.285714286%;\n font-size: .75em;\n padding-bottom: .25em;\n color: #999999;\n font-weight: 500;\n /* Increase the spacing a tad */\n}\n\n@media (min-height: 33.875em) {\n .picker__weekday {\n padding-bottom: .5em;\n }\n}\n\n/**\r\n * The days on the calendar\r\n */\n.picker__day--today {\n position: relative;\n color: #595959;\n letter-spacing: -.3;\n padding: .75rem 0;\n font-weight: 400;\n border: 1px solid transparent;\n}\n\n.picker__day--disabled:before {\n border-top-color: #aaaaaa;\n}\n\n.picker__day--infocus:hover {\n cursor: pointer;\n color: #000;\n font-weight: 500;\n}\n\n.picker__day--outfocus {\n display: none;\n padding: .75rem 0;\n color: #fff;\n}\n\n.picker__day--outfocus:hover {\n cursor: pointer;\n color: #dddddd;\n font-weight: 500;\n}\n\n.picker__day--highlighted:hover,\n.picker--focused .picker__day--highlighted {\n cursor: pointer;\n}\n\n.picker__day--selected,\n.picker__day--selected:hover,\n.picker--focused .picker__day--selected {\n border-radius: 50%;\n -webkit-transform: scale(0.75);\n -ms-transform: scale(0.75);\n transform: scale(0.75);\n background: #0089ec;\n color: #ffffff;\n}\n\n.picker__day--disabled,\n.picker__day--disabled:hover,\n.picker--focused .picker__day--disabled {\n background: #f5f5f5;\n border-color: #f5f5f5;\n color: #dddddd;\n cursor: default;\n}\n\n.picker__day--highlighted.picker__day--disabled,\n.picker__day--highlighted.picker__day--disabled:hover {\n background: #bbbbbb;\n}\n\n/**\r\n * The footer containing the \"today\", \"clear\", and \"close\" buttons.\r\n */\n.picker__footer {\n text-align: right;\n}\n\n.picker__button--today,\n.picker__button--clear,\n.picker__button--close {\n border: 1px solid #ffffff;\n background: #ffffff;\n font-size: .8em;\n padding: .66em 0;\n font-weight: bold;\n width: 33%;\n display: inline-block;\n vertical-align: bottom;\n}\n\n.picker__button--today:hover,\n.picker__button--clear:hover,\n.picker__button--close:hover {\n cursor: pointer;\n color: #000000;\n background: #b1dcfb;\n border-bottom-color: #b1dcfb;\n}\n\n.picker__button--today:focus,\n.picker__button--clear:focus,\n.picker__button--close:focus {\n background: #b1dcfb;\n border-color: rgba(0, 0, 0, 0.05);\n outline: none;\n}\n\n.picker__button--today:before,\n.picker__button--clear:before,\n.picker__button--close:before {\n position: relative;\n display: inline-block;\n height: 0;\n}\n\n.picker__button--today:before,\n.picker__button--clear:before {\n content: \" \";\n margin-right: .45em;\n}\n\n.picker__button--today:before {\n top: -0.05em;\n width: 0;\n border-top: 0.66em solid #0059bc;\n border-left: .66em solid transparent;\n}\n\n.picker__button--clear:before {\n top: -0.25em;\n width: .66em;\n border-top: 3px solid #ee2200;\n}\n\n.picker__button--close:before {\n content: \"\\D7\";\n top: -0.1em;\n vertical-align: top;\n font-size: 1.1em;\n margin-right: .35em;\n color: #777777;\n}\n\n.picker__button--today[disabled],\n.picker__button--today[disabled]:hover {\n background: #f5f5f5;\n border-color: #f5f5f5;\n color: #dddddd;\n cursor: default;\n}\n\n.picker__button--today[disabled]:before {\n border-top-color: #aaaaaa;\n}\n\n/* ==========================================================================\r\n CUSTOM MATERIALIZE STYLES\r\n ========================================================================== */\n/*.picker__box {\r\n border-radius: 2px;\r\n overflow: hidden;\r\n}*/\n.picker__date-display {\n text-align: left;\n background-color: #26a69a;\n color: #fff;\n padding: 18px;\n font-weight: 300;\n}\n\n@media only screen and (min-width: 601px) {\n .picker__date-display {\n -ms-flex: 1;\n flex: 1 1;\n }\n .picker__weekday-display {\n display: block;\n }\n .picker__container__wrapper {\n -ms-flex: 2;\n flex: 2 1;\n }\n}\n\n.picker__nav--prev:hover,\n.picker__nav--next:hover {\n cursor: pointer;\n color: #000000;\n background: #a1ded8;\n}\n\n.picker__weekday-display {\n font-weight: 500;\n font-size: 2.8rem;\n margin-right: 5px;\n margin-top: 4px;\n}\n\n.picker__month-display {\n font-size: 2.8rem;\n font-weight: 500;\n}\n\n.picker__day-display {\n font-size: 2.8rem;\n font-weight: 500;\n margin-right: 5px;\n}\n\n.picker__year-display {\n font-size: 1.5rem;\n font-weight: 500;\n color: rgba(255, 255, 255, 0.7);\n}\n\n/*.picker__box {\r\n padding: 0;\r\n}*/\n.picker__calendar-container {\n padding: 0 1rem;\n}\n\n.picker__calendar-container thead {\n border: none;\n}\n\n.picker__table {\n margin-top: 0;\n margin-bottom: .5em;\n}\n\n.picker__day--infocus {\n color: rgba(0, 0, 0, 0.87);\n letter-spacing: -.3px;\n padding: 0.75rem 0;\n font-weight: 400;\n border: 1px solid transparent;\n}\n\n@media only screen and (min-width: 601px) {\n .picker__day--infocus {\n padding: 1.1rem 0;\n }\n}\n\n.picker__day.picker__day--today {\n color: #26a69a;\n}\n\n.picker__day.picker__day--today.picker__day--selected {\n color: #fff;\n}\n\n.picker__weekday {\n font-size: .9rem;\n}\n\n.picker__day--selected,\n.picker__day--selected:hover,\n.picker--focused .picker__day--selected {\n border-radius: 50%;\n -webkit-transform: scale(0.9);\n -ms-transform: scale(0.9);\n transform: scale(0.9);\n background-color: #26a69a;\n color: #ffffff;\n}\n\n.picker__day--selected.picker__day--outfocus,\n.picker__day--selected:hover.picker__day--outfocus,\n.picker--focused .picker__day--selected.picker__day--outfocus {\n background-color: #a1ded8;\n}\n\n.picker__footer {\n text-align: right;\n padding: 5px 10px;\n}\n\n.picker__close, .picker__today, .picker__clear {\n font-size: 1.1rem;\n padding: 0 1rem;\n color: #26a69a;\n}\n\n.picker__clear {\n color: #f44336;\n float: left;\n}\n\n.picker__nav--prev:before,\n.picker__nav--next:before {\n content: \" \";\n border-top: .5em solid transparent;\n border-bottom: .5em solid transparent;\n border-right: 0.75em solid #676767;\n width: 0;\n height: 0;\n display: block;\n margin: 0 auto;\n}\n\n.picker__nav--next:before {\n border-right: 0;\n border-left: 0.75em solid #676767;\n}\n\nbutton.picker__today:focus, button.picker__clear:focus, button.picker__close:focus {\n background-color: #a1ded8;\n}\n\n/* ==========================================================================\r\n $BASE-TIME-PICKER\r\n ========================================================================== */\n/**\r\n * The list of times.\r\n */\n.picker__list {\n list-style: none;\n padding: 0.75em 0 4.2em;\n margin: 0;\n}\n\n/**\r\n * The times on the clock.\r\n */\n.picker__list-item {\n border-bottom: 1px solid #ddd;\n border-top: 1px solid #ddd;\n margin-bottom: -1px;\n position: relative;\n background: #fff;\n padding: .75em 1.25em;\n}\n\n@media (min-height: 46.75em) {\n .picker__list-item {\n padding: .5em 1em;\n }\n}\n\n/* Hovered time */\n.picker__list-item:hover {\n cursor: pointer;\n color: #000;\n background: #b1dcfb;\n border-color: #0089ec;\n z-index: 10;\n}\n\n/* Highlighted and hovered/focused time */\n.picker__list-item--highlighted {\n border-color: #0089ec;\n z-index: 10;\n}\n\n.picker__list-item--highlighted:hover,\n.picker--focused .picker__list-item--highlighted {\n cursor: pointer;\n color: #000;\n background: #b1dcfb;\n}\n\n/* Selected and hovered/focused time */\n.picker__list-item--selected,\n.picker__list-item--selected:hover,\n.picker--focused .picker__list-item--selected {\n background: #0089ec;\n color: #fff;\n z-index: 10;\n}\n\n/* Disabled time */\n.picker__list-item--disabled,\n.picker__list-item--disabled:hover,\n.picker--focused .picker__list-item--disabled {\n background: #f5f5f5;\n border-color: #f5f5f5;\n color: #ddd;\n cursor: default;\n border-color: #ddd;\n z-index: auto;\n}\n\n/**\r\n * The clear button\r\n */\n.picker--time .picker__button--clear {\n display: block;\n width: 80%;\n margin: 1em auto 0;\n padding: 1em 1.25em;\n background: none;\n border: 0;\n font-weight: 500;\n font-size: .67em;\n text-align: center;\n text-transform: uppercase;\n color: rgba(0, 0, 0, 0.87);\n}\n\n.picker--time .picker__button--clear:hover,\n.picker--time .picker__button--clear:focus {\n color: #000;\n background: #b1dcfb;\n background: #ee2200;\n border-color: #ee2200;\n cursor: pointer;\n color: #fff;\n outline: none;\n}\n\n.picker--time .picker__button--clear:before {\n top: -0.25em;\n color: rgba(0, 0, 0, 0.87);\n font-size: 1.25em;\n font-weight: bold;\n}\n\n.picker--time .picker__button--clear:hover:before,\n.picker--time .picker__button--clear:focus:before {\n color: #fff;\n}\n\n/* ==========================================================================\r\n $DEFAULT-TIME-PICKER\r\n ========================================================================== */\n/**\r\n * The frame the bounds the time picker.\r\n */\n.picker--time .picker__frame {\n min-width: 256px;\n max-width: 320px;\n}\n\n/**\r\n * The picker box.\r\n */\n.picker--time .picker__box {\n font-size: 1em;\n background: #f2f2f2;\n padding: 0;\n}\n\n@media (min-height: 40.125em) {\n .picker--time .picker__box {\n margin-bottom: 5em;\n }\n}\n\n/* ==========================================================================\r\n $DEFAULT-TIME-PICKER\r\n ========================================================================== */\n.clockpicker-display {\n font-size: 4rem;\n font-weight: bold;\n text-align: center;\n color: rgba(255, 255, 255, 0.6);\n font-weight: 400;\n clear: both;\n position: relative;\n}\n\n.clockpicker-span-am-pm {\n font-size: 1.3rem;\n position: absolute;\n right: 1rem;\n bottom: 0.3rem;\n line-height: 2rem;\n font-weight: 500;\n}\n\n@media only screen and (min-width: 601px) {\n .clockpicker-display {\n top: 32%;\n }\n .clockpicker-span-am-pm {\n position: relative;\n right: auto;\n bottom: auto;\n text-align: center;\n margin-top: 1.2rem;\n }\n}\n\n.text-primary {\n color: white;\n}\n\n.clockpicker-span-hours {\n margin-right: 3px;\n}\n\n.clockpicker-span-minutes {\n margin-left: 3px;\n}\n\n.clockpicker-span-hours,\n.clockpicker-span-minutes,\n.clockpicker-span-am-pm div {\n cursor: pointer;\n}\n\n.clockpicker-moving {\n cursor: move;\n}\n\n.clockpicker-plate {\n background-color: #eee;\n border-radius: 50%;\n width: 270px;\n height: 270px;\n overflow: visible;\n position: relative;\n margin: auto;\n margin-top: 25px;\n margin-bottom: 5px;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.clockpicker-canvas,\n.clockpicker-dial {\n width: 270px;\n height: 270px;\n position: absolute;\n left: -1px;\n top: -1px;\n}\n\n.clockpicker-minutes {\n visibility: hidden;\n}\n\n.clockpicker-tick {\n border-radius: 50%;\n color: rgba(0, 0, 0, 0.87);\n line-height: 40px;\n text-align: center;\n width: 40px;\n height: 40px;\n position: absolute;\n cursor: pointer;\n}\n\n.clockpicker-tick.active,\n.clockpicker-tick:hover {\n background-color: rgba(38, 166, 154, 0.25);\n}\n\n.clockpicker-dial {\n -webkit-transition: -webkit-transform 350ms, opacity 350ms;\n -webkit-transition: opacity 350ms, -webkit-transform 350ms;\n transition: opacity 350ms, -webkit-transform 350ms;\n -o-transition: transform 350ms, opacity 350ms;\n transition: transform 350ms, opacity 350ms;\n transition: transform 350ms, opacity 350ms, -webkit-transform 350ms;\n}\n\n.clockpicker-dial-out {\n opacity: 0;\n}\n\n.clockpicker-hours.clockpicker-dial-out {\n -webkit-transform: scale(1.2, 1.2);\n -ms-transform: scale(1.2, 1.2);\n transform: scale(1.2, 1.2);\n}\n\n.clockpicker-minutes.clockpicker-dial-out {\n -webkit-transform: scale(0.8, 0.8);\n -ms-transform: scale(0.8, 0.8);\n transform: scale(0.8, 0.8);\n}\n\n.clockpicker-canvas {\n -webkit-transition: opacity 175ms;\n -o-transition: opacity 175ms;\n transition: opacity 175ms;\n}\n\n.clockpicker-canvas-out {\n opacity: 0.25;\n}\n\n.clockpicker-canvas-bearing {\n stroke: none;\n fill: #26a69a;\n}\n\n.clockpicker-canvas-bg {\n stroke: none;\n fill: #26a69a;\n}\n\n.clockpicker-canvas-bg-trans {\n fill: #26a69a;\n}\n\n.clockpicker-canvas line {\n stroke: #26a69a;\n stroke-width: 4;\n stroke-linecap: round;\n /*shape-rendering: crispEdges;*/\n}\n", ""]); + +// exports + + +/***/ }), + +/***/ "./node_modules/css-loader/lib/css-base.js": +/*!*************************************************!*\ + !*** ./node_modules/css-loader/lib/css-base.js ***! + \*************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports) { + +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +// css base code, injected by the css-loader +module.exports = function(useSourceMap) { + var list = []; + + // return the list of modules as css string + list.toString = function toString() { + return this.map(function (item) { + var content = cssWithMappingToString(item, useSourceMap); + if(item[2]) { + return "@media " + item[2] + "{" + content + "}"; + } else { + return content; + } + }).join(""); + }; + + // import a list of modules into the list + list.i = function(modules, mediaQuery) { + if(typeof modules === "string") + modules = [[null, modules, ""]]; + var alreadyImportedModules = {}; + for(var i = 0; i < this.length; i++) { + var id = this[i][0]; + if(typeof id === "number") + alreadyImportedModules[id] = true; + } + for(i = 0; i < modules.length; i++) { + var item = modules[i]; + // skip already imported module + // this implementation is not 100% perfect for weird media query combinations + // when a module is imported multiple times with different media queries. + // I hope this will never occur (Hey this way we have smaller bundles) + if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { + if(mediaQuery && !item[2]) { + item[2] = mediaQuery; + } else if(mediaQuery) { + item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; + } + list.push(item); + } + } + }; + return list; +}; + +function cssWithMappingToString(item, useSourceMap) { + var content = item[1] || ''; + var cssMapping = item[3]; + if (!cssMapping) { + return content; + } + + if (useSourceMap && typeof btoa === 'function') { + var sourceMapping = toComment(cssMapping); + var sourceURLs = cssMapping.sources.map(function (source) { + return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */' + }); + + return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); + } + + return [content].join('\n'); +} + +// Adapted from convert-source-map (MIT) +function toComment(sourceMap) { + // eslint-disable-next-line no-undef + var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); + var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; + + return '/*# ' + data + ' */'; +} + + +/***/ }), + +/***/ "./node_modules/debug/src/browser.js": +/*!*******************************************!*\ + !*** ./node_modules/debug/src/browser.js ***! + \*******************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(process) {/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = __webpack_require__(/*! ./debug */ "./node_modules/debug/src/debug.js"); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + 'lightseagreen', + 'forestgreen', + 'goldenrod', + 'dodgerblue', + 'darkorchid', + 'crimson' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { + return true; + } + + // is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + try { + return JSON.stringify(v); + } catch (err) { + return '[UnexpectedJSONParseError]: ' + err.message; + } +}; + + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return; + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit') + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = Object({"NODE_ENV":"development","PUBLIC_URL":""}).DEBUG; + } + + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + return window.localStorage; + } catch (e) {} +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js"))) + +/***/ }), + +/***/ "./node_modules/debug/src/debug.js": +/*!*****************************************!*\ + !*** ./node_modules/debug/src/debug.js ***! + \*****************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = createDebug.debug = createDebug['default'] = createDebug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = __webpack_require__(/*! ms */ "./node_modules/ms/index.js"); + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.skips = []; + +/** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + +exports.formatters = {}; + +/** + * Previous log timestamp. + */ + +var prevTime; + +/** + * Select a color. + * @param {String} namespace + * @return {Number} + * @api private + */ + +function selectColor(namespace) { + var hash = 0, i; + + for (i in namespace) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return exports.colors[Math.abs(hash) % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function createDebug(namespace) { + + function debug() { + // disabled? + if (!debug.enabled) return; + + var self = debug; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // turn the `arguments` into a proper Array + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %O + args.unshift('%O'); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // apply env-specific formatting (colors, etc.) + exports.formatArgs.call(self, args); + + var logFn = debug.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = exports.enabled(namespace); + debug.useColors = exports.useColors(); + debug.color = selectColor(namespace); + + // env-specific initialization logic for debug instances + if ('function' === typeof exports.init) { + exports.init(debug); + } + + return debug; +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + exports.names = []; + exports.skips = []; + + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} + + +/***/ }), + +/***/ "./node_modules/es6-error/es6/index.js": +/*!*********************************************!*\ + !*** ./node_modules/es6-error/es6/index.js ***! + \*********************************************/ +/*! exports provided: default */ +/*! exports used: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +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; } + +function _extendableBuiltin(cls) { + function ExtendableBuiltin() { + cls.apply(this, arguments); + } + + ExtendableBuiltin.prototype = Object.create(cls.prototype, { + constructor: { + value: cls, + enumerable: false, + writable: true, + configurable: true + } + }); + + if (Object.setPrototypeOf) { + Object.setPrototypeOf(ExtendableBuiltin, cls); + } else { + ExtendableBuiltin.__proto__ = cls; + } + + return ExtendableBuiltin; +} + +var ExtendableError = function (_extendableBuiltin2) { + _inherits(ExtendableError, _extendableBuiltin2); + + function ExtendableError() { + var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + _classCallCheck(this, ExtendableError); + + // extending Error is weird and does not propagate `message` + var _this = _possibleConstructorReturn(this, (ExtendableError.__proto__ || Object.getPrototypeOf(ExtendableError)).call(this, message)); + + Object.defineProperty(_this, 'message', { + configurable: true, + enumerable: false, + value: message, + writable: true + }); + + Object.defineProperty(_this, 'name', { + configurable: true, + enumerable: false, + value: _this.constructor.name, + writable: true + }); + + if (Error.hasOwnProperty('captureStackTrace')) { + Error.captureStackTrace(_this, _this.constructor); + return _possibleConstructorReturn(_this); + } + + Object.defineProperty(_this, 'stack', { + configurable: true, + enumerable: false, + value: new Error(message).stack, + writable: true + }); + return _this; + } + + return ExtendableError; +}(_extendableBuiltin(Error)); + +/* harmony default export */ __webpack_exports__["a"] = (ExtendableError); + + +/***/ }), + +/***/ "./node_modules/escape-string-regexp/index.js": +/*!****************************************************!*\ + !*** ./node_modules/escape-string-regexp/index.js ***! + \****************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; + +module.exports = function (str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } + + return str.replace(matchOperatorsRe, '\\$&'); +}; + + +/***/ }), + +/***/ "./node_modules/fbjs/lib/EventListener.js": +/*!************************************************!*\ + !*** ./node_modules/fbjs/lib/EventListener.js ***! + \************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @typechecks + */ + +var emptyFunction = __webpack_require__(/*! ./emptyFunction */ "./node_modules/fbjs/lib/emptyFunction.js"); + +/** + * 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 (true) { + 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; + +/***/ }), + +/***/ "./node_modules/fbjs/lib/ExecutionEnvironment.js": +/*!*******************************************************!*\ + !*** ./node_modules/fbjs/lib/ExecutionEnvironment.js ***! + \*******************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +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; + +/***/ }), + +/***/ "./node_modules/fbjs/lib/camelize.js": +/*!*******************************************!*\ + !*** ./node_modules/fbjs/lib/camelize.js ***! + \*******************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @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; + +/***/ }), + +/***/ "./node_modules/fbjs/lib/camelizeStyleName.js": +/*!****************************************************!*\ + !*** ./node_modules/fbjs/lib/camelizeStyleName.js ***! + \****************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @typechecks + */ + + + +var camelize = __webpack_require__(/*! ./camelize */ "./node_modules/fbjs/lib/camelize.js"); + +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; + +/***/ }), + +/***/ "./node_modules/fbjs/lib/containsNode.js": +/*!***********************************************!*\ + !*** ./node_modules/fbjs/lib/containsNode.js ***! + \***********************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + +var isTextNode = __webpack_require__(/*! ./isTextNode */ "./node_modules/fbjs/lib/isTextNode.js"); + +/*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; + +/***/ }), + +/***/ "./node_modules/fbjs/lib/emptyFunction.js": +/*!************************************************!*\ + !*** ./node_modules/fbjs/lib/emptyFunction.js ***! + \************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + +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; + +/***/ }), + +/***/ "./node_modules/fbjs/lib/emptyObject.js": +/*!**********************************************!*\ + !*** ./node_modules/fbjs/lib/emptyObject.js ***! + \**********************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var emptyObject = {}; + +if (true) { + Object.freeze(emptyObject); +} + +module.exports = emptyObject; + +/***/ }), + +/***/ "./node_modules/fbjs/lib/focusNode.js": +/*!********************************************!*\ + !*** ./node_modules/fbjs/lib/focusNode.js ***! + \********************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +/** + * @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; + +/***/ }), + +/***/ "./node_modules/fbjs/lib/getActiveElement.js": +/*!***************************************************!*\ + !*** ./node_modules/fbjs/lib/getActiveElement.js ***! + \***************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @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; + +/***/ }), + +/***/ "./node_modules/fbjs/lib/hyphenate.js": +/*!********************************************!*\ + !*** ./node_modules/fbjs/lib/hyphenate.js ***! + \********************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @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; + +/***/ }), + +/***/ "./node_modules/fbjs/lib/hyphenateStyleName.js": +/*!*****************************************************!*\ + !*** ./node_modules/fbjs/lib/hyphenateStyleName.js ***! + \*****************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @typechecks + */ + + + +var hyphenate = __webpack_require__(/*! ./hyphenate */ "./node_modules/fbjs/lib/hyphenate.js"); + +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; + +/***/ }), + +/***/ "./node_modules/fbjs/lib/invariant.js": +/*!********************************************!*\ + !*** ./node_modules/fbjs/lib/invariant.js ***! + \********************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +/** + * 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 (true) { + 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; + +/***/ }), + +/***/ "./node_modules/fbjs/lib/isNode.js": +/*!*****************************************!*\ + !*** ./node_modules/fbjs/lib/isNode.js ***! + \*****************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @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; + +/***/ }), + +/***/ "./node_modules/fbjs/lib/isTextNode.js": +/*!*********************************************!*\ + !*** ./node_modules/fbjs/lib/isTextNode.js ***! + \*********************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @typechecks + */ + +var isNode = __webpack_require__(/*! ./isNode */ "./node_modules/fbjs/lib/isNode.js"); + +/** + * @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; + +/***/ }), + +/***/ "./node_modules/fbjs/lib/shallowEqual.js": +/*!***********************************************!*\ + !*** ./node_modules/fbjs/lib/shallowEqual.js ***! + \***********************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @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; + +/***/ }), + +/***/ "./node_modules/fbjs/lib/warning.js": +/*!******************************************!*\ + !*** ./node_modules/fbjs/lib/warning.js ***! + \******************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var emptyFunction = __webpack_require__(/*! ./emptyFunction */ "./node_modules/fbjs/lib/emptyFunction.js"); + +/** + * 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 (true) { + 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; + +/***/ }), + +/***/ "./node_modules/firebase/app/index.js": +/*!********************************************!*\ + !*** ./node_modules/firebase/app/index.js ***! + \********************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * 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. + */ + +__webpack_require__(/*! @firebase/polyfill */ "./node_modules/@firebase/polyfill/dist/esm/index.js"); +module.exports = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/esm/index.js").default; + + +/***/ }), + +/***/ "./node_modules/firebase/auth/index.js": +/*!*********************************************!*\ + !*** ./node_modules/firebase/auth/index.js ***! + \*********************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * 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. + */ + +__webpack_require__(/*! @firebase/auth */ "./node_modules/@firebase/auth/dist/auth.js"); + + +/***/ }), + +/***/ "./node_modules/firebase/database/index.js": +/*!*************************************************!*\ + !*** ./node_modules/firebase/database/index.js ***! + \*************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * 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. + */ + +module.exports = __webpack_require__(/*! @firebase/database */ "./node_modules/@firebase/database/dist/cjs/index.js"); + + +/***/ }), + +/***/ "./node_modules/firebase/index.js": +/*!****************************************!*\ + !*** ./node_modules/firebase/index.js ***! + \****************************************/ +/*! dynamic exports provided */ +/*! exports used: auth, database, initializeApp */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * 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. + */ + +var firebase = __webpack_require__(/*! ./app */ "./node_modules/firebase/app/index.js"); +__webpack_require__(/*! ./auth */ "./node_modules/firebase/auth/index.js"); +__webpack_require__(/*! ./database */ "./node_modules/firebase/database/index.js"); +__webpack_require__(/*! ./messaging */ "./node_modules/firebase/messaging/index.js"); +__webpack_require__(/*! ./storage */ "./node_modules/firebase/storage/index.js"); + +module.exports = firebase; + + +/***/ }), + +/***/ "./node_modules/firebase/messaging/index.js": +/*!**************************************************!*\ + !*** ./node_modules/firebase/messaging/index.js ***! + \**************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * 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. + */ + +__webpack_require__(/*! @firebase/messaging */ "./node_modules/@firebase/messaging/dist/esm/index.js"); + + +/***/ }), + +/***/ "./node_modules/firebase/storage/index.js": +/*!************************************************!*\ + !*** ./node_modules/firebase/storage/index.js ***! + \************************************************/ +/*! dynamic exports provided */ +/*! all exports used */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * 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. + */ + +__webpack_require__(/*! @firebase/storage */ "./node_modules/@firebase/storage/dist/esm/index.js"); + + +/***/ }), + +/***/ "./node_modules/font-awesome/css/font-awesome.css": +/*!********************************************************!*\ + !*** ./node_modules/font-awesome/css/font-awesome.css ***! + \********************************************************/ +/*! dynamic exports provided */ +/***/ (function(module, exports, __webpack_require__) { + +// style-loader: Adds some css to the DOM by adding a