diff --git a/dist/k-frame.js b/dist/k-frame.js index 65127f69..99e074d5 100644 --- a/dist/k-frame.js +++ b/dist/k-frame.js @@ -45,1145 +45,183 @@ /***/ function(module, exports, __webpack_require__) { __webpack_require__(1); + __webpack_require__(2); __webpack_require__(3); __webpack_require__(4); - __webpack_require__(5); + __webpack_require__(7); __webpack_require__(8); __webpack_require__(9); __webpack_require__(10); __webpack_require__(11); - __webpack_require__(12); /***/ }, /* 1 */ -/***/ function(module, exports, __webpack_require__) { - - __webpack_require__(2); +/***/ function(module, exports) { if (typeof AFRAME === 'undefined') { throw new Error('Component attempted to register before AFRAME was available.'); } + /** + * Audio visualizer system for A-Frame. Share AnalyserNodes between components that share the + * the `src`. + */ AFRAME.registerSystem('audio-visualizer', { init: function () { - this.dancers = {}; + this.analysers = {}; + this.context = new AudioContext(); }, - getOrCreateAudio: function (src) { - if (this.dancers[src]) { - return this.dancers[src]; - } - return this.createAudio(src); - }, + getOrCreateAnalyser: function (data) { + var context = this.context; + var analysers = this.analysers; + var analyser = context.createAnalyser(); + var audioEl = data.src; + var src = audioEl.getAttribute('src'); + + return new Promise(function (resolve) { + audioEl.addEventListener('canplay', function () { + if (analysers[src]) { + resolve(analysers[src]); + return; + } - createAudio: function (src) { - var dancer = new Dancer(); - dancer.load({src: src}); - dancer.play(); - this.dancers[src] = dancer; - return dancer; + var source = context.createMediaElementSource(audioEl) + source.connect(analyser); + analyser.connect(context.destination); + analyser.smoothingTimeConstant = data.smoothingTimeConstant; + analyser.fftSize = data.fftSize; + + // Store. + analysers[src] = analyser; + resolve(analysers[src]); + }); + }); } }); /** - * Audio Visualizer component for A-Frame. + * Audio visualizer component for A-Frame using AnalyserNode. */ AFRAME.registerComponent('audio-visualizer', { schema: { - unique: {default: false}, - src: {type: 'src'} + fftSize: {default: 2048}, + smoothingTimeConstant: {default: 0.8}, + src: {type: 'selector'}, + unique: {default: false} }, init: function () { - this.dancer = null; + this.analyser = null; + this.spectrum = null; }, update: function () { + var self = this; var data = this.data; var system = this.system; if (!data.src) { return; } + // Get or create AnalyserNode. if (data.unique) { - this.dancer = system.createAudio(data.src); + system.createAnalyser(data).then(emit); } else { - this.dancer = system.getOrCreateAudio(data.src); + system.getOrCreateAnalyser(data).then(emit); } - this.el.emit('audio-visualizer-ready', {dancer: this.dancer}); + function emit (analyser) { + self.analyser = analyser; + self.spectrum = new Uint8Array(self.analyser.frequencyBinCount); + self.el.emit('audio-analyser-ready', {analyser: analyser}); + } + }, + + /** + * Update spectrum on each frame. + */ + tick: function () { + if (!this.analyser) { return; } + this.analyser.getByteFrequencyData(this.spectrum); } }); /** - * Audio Visualizer Kick component for A-Frame. + * Component that triggers an event when frequency surprasses a threshold (e.g., a beat). + * + * @member {boolean} kicking - Whether component has just emitted a kick. */ AFRAME.registerComponent('audio-visualizer-kick', { dependencies: ['audio-visualizer'], schema: { - frequency: {type: 'array', default: [127, 129]}, - threshold: {default: 0.00001}, - decay: {default: 0.00001} + decay: {default: 0.02}, + frequency: {default: [0, 10]}, + threshold: {default: 0.3} }, init: function () { - this.kick = false; + this.currentThreshold = this.data.threshold; + this.kicking = false; }, - update: function () { + tick: function () { var data = this.data; var el = this.el; - var self = this; - - var kickData = AFRAME.utils.extend(data, { - onKick: function (dancer, magnitude) { - if (self.kick) { return; } // Already kicking. - el.emit('audio-visualizer-kick-start', this.arguments); - self.kick = true; - }, - offKick: function (dancer, magnitude) { - if (!self.kick) { return; } // Already not kicking. - el.emit('audio-visualizer-kick-end', this.arguments); - self.kick = false; - } - }); - - var dancer = this.el.components['audio-visualizer'].dancer; - if (dancer) { - createKick(dancer); - } else { - this.el.addEventListener('audio-visualizer-ready', function (evt) { - createKick(evt.detail.dancer); - }); - } - - function createKick (dancer) { - var kick = dancer.createKick(kickData); - kick.on(); - } - } - }); - - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - /* - * dancer - v0.4.0 - 2016-04-25 - * https://github.com/jsantell/dancer.js - * Copyright (c) 2016 Jordan Santell - * Licensed MIT - */ - (function() { - - var Dancer = function () { - this.audioAdapter = Dancer._getAdapter( this ); - this.events = {}; - this.sections = []; - this.bind( 'update', update ); - }; - - Dancer.version = '0.3.2'; - Dancer.adapters = {}; - - Dancer.prototype = { - - load : function ( source ) { - var path; - - // Loading an Audio element - if ( source instanceof HTMLElement ) { - this.source = source; - if ( Dancer.isSupported() === 'flash' ) { - this.source = { src: Dancer._getMP3SrcFromAudio( source ) }; - } - - // Loading an object with src, [codecs] - } else { - this.source = window.Audio ? new Audio() : {}; - this.source.src = Dancer._makeSupportedPath( source.src, source.codecs ); - } - - this.audio = this.audioAdapter.load( this.source ); - return this; - }, - - /* Controls */ - - play : function () { - this.audioAdapter.play(); - return this; - }, - - pause : function () { - this.audioAdapter.pause(); - return this; - }, - - setVolume : function ( volume ) { - this.audioAdapter.setVolume( volume ); - return this; - }, - - - /* Actions */ - - createKick : function ( options ) { - return new Dancer.Kick( this, options ); - }, - - bind : function ( name, callback ) { - if ( !this.events[ name ] ) { - this.events[ name ] = []; - } - this.events[ name ].push( callback ); - return this; - }, - - unbind : function ( name ) { - if ( this.events[ name ] ) { - delete this.events[ name ]; - } - return this; - }, - - trigger : function ( name ) { - var _this = this; - if ( this.events[ name ] ) { - this.events[ name ].forEach(function( callback ) { - callback.call( _this ); - }); - } - return this; - }, + if (!el.components['audio-visualizer'].spectrum) { return; } - /* Getters */ + var magnitude = this.maxAmplitude(data.frequency); - getVolume : function () { - return this.audioAdapter.getVolume(); - }, - - getProgress : function () { - return this.audioAdapter.getProgress(); - }, - - getTime : function () { - return this.audioAdapter.getTime(); - }, - - // Returns the magnitude of a frequency or average over a range of frequencies - getFrequency : function ( freq, endFreq ) { - var sum = 0; - if ( endFreq !== undefined ) { - for ( var i = freq; i <= endFreq; i++ ) { - sum += this.getSpectrum()[ i ]; - } - return sum / ( endFreq - freq + 1 ); - } else { - return this.getSpectrum()[ freq ]; - } - }, - - getWaveform : function () { - return this.audioAdapter.getWaveform(); - }, - - getSpectrum : function () { - return this.audioAdapter.getSpectrum(); - }, - - isLoaded : function () { - return this.audioAdapter.isLoaded; - }, - - isPlaying : function () { - return this.audioAdapter.isPlaying; - }, - - - /* Sections */ + if (magnitude > this.currentThreshold && magnitude > data.threshold) { + // Already kicking. + if (this.kicking) { return; } - after : function ( time, callback ) { - var _this = this; - this.sections.push({ - condition : function () { - return _this.getTime() > time; - }, - callback : callback + // Was under the threshold, but now kicking. + this.kicking = true; + el.emit('audio-visualizer-kick-start', { + currentThreshold: this.currentThreshold, + magnitude: magnitude }); - return this; - }, - - before : function ( time, callback ) { - var _this = this; - this.sections.push({ - condition : function () { - return _this.getTime() < time; - }, - callback : callback - }); - return this; - }, - - between : function ( startTime, endTime, callback ) { - var _this = this; - this.sections.push({ - condition : function () { - return _this.getTime() > startTime && _this.getTime() < endTime; - }, - callback : callback - }); - return this; - }, - - onceAt : function ( time, callback ) { - var - _this = this, - thisSection = null; - this.sections.push({ - condition : function () { - return _this.getTime() > time && !this.called; - }, - callback : function () { - callback.call( this ); - thisSection.called = true; - }, - called : false - }); - // Baking the section in the closure due to callback's this being the dancer instance - thisSection = this.sections[ this.sections.length - 1 ]; - return this; - } - }; - - function update () { - for ( var i in this.sections ) { - if ( this.sections[ i ].condition() ) - this.sections[ i ].callback.call( this ); - } - } - - window.Dancer = Dancer; - })(); - - (function ( Dancer ) { - - var CODECS = { - 'mp3' : 'audio/mpeg;', - 'ogg' : 'audio/ogg; codecs="vorbis"', - 'wav' : 'audio/wav; codecs="1"', - 'aac' : 'audio/mp4; codecs="mp4a.40.2"' - }, - audioEl = document.createElement( 'audio' ); - - Dancer.options = {}; - - Dancer.setOptions = function ( o ) { - for ( var option in o ) { - if ( o.hasOwnProperty( option ) ) { - Dancer.options[ option ] = o[ option ]; - } - } - }; - - Dancer.isSupported = function () { - if ( !window.Float32Array || !window.Uint32Array ) { - return null; - } else if ( !isUnsupportedSafari() && ( window.AudioContext || window.webkitAudioContext )) { - return 'webaudio'; - } else if ( FlashDetect.versionAtLeast( 9 ) ) { - return 'flash'; } else { - return ''; - } - }; - - Dancer.canPlay = function ( type ) { - var canPlay = audioEl.canPlayType; - return !!( - Dancer.isSupported() === 'flash' ? - type.toLowerCase() === 'mp3' : - audioEl.canPlayType && - audioEl.canPlayType( CODECS[ type.toLowerCase() ] ).replace( /no/, '')); - }; - - Dancer.addPlugin = function ( name, fn ) { - if ( Dancer.prototype[ name ] === undefined ) { - Dancer.prototype[ name ] = fn; - } - }; - - Dancer._makeSupportedPath = function ( source, codecs ) { - if ( !codecs ) { return source; } - - for ( var i = 0; i < codecs.length; i++ ) { - if ( Dancer.canPlay( codecs[ i ] ) ) { - return source + '.' + codecs[ i ]; - } - } - return source; - }; - - Dancer._getAdapter = function ( instance ) { - switch ( Dancer.isSupported() ) { - case 'webaudio': - return new Dancer.adapters.webaudio( instance ); - case 'flash': - return new Dancer.adapters.flash( instance ); - default: - return null; - } - }; - - Dancer._getMP3SrcFromAudio = function ( audioEl ) { - var sources = audioEl.children; - if ( audioEl.src ) { return audioEl.src; } - for ( var i = sources.length; i--; ) { - if (( sources[ i ].type || '' ).match( /audio\/mpeg/ )) return sources[ i ].src; - } - return null; - }; - - // Browser detection is lame, but Safari 6 has Web Audio API, - // but does not support processing audio from a Media Element Source - // https://gist.github.com/3265344 - function isUnsupportedSafari () { - var - isApple = !!( navigator.vendor || '' ).match( /Apple/ ), - version = navigator.userAgent.match( /Version\/([^ ]*)/ ); - version = version ? parseFloat( version[ 1 ] ) : 0; - return isApple && version <= 6; - } - - })( window.Dancer ); - - (function ( undefined ) { - var Kick = function ( dancer, o ) { - o = o || {}; - this.dancer = dancer; - this.frequency = o.frequency !== undefined ? o.frequency : [ 0, 10 ]; - this.threshold = o.threshold !== undefined ? o.threshold : 0.3; - this.decay = o.decay !== undefined ? o.decay : 0.02; - this.onKick = o.onKick; - this.offKick = o.offKick; - this.isOn = false; - this.currentThreshold = this.threshold; - - var _this = this; - this.dancer.bind( 'update', function () { - _this.onUpdate(); - }); - }; - - Kick.prototype = { - on : function () { - this.isOn = true; - return this; - }, - off : function () { - this.isOn = false; - return this; - }, - - set : function ( o ) { - o = o || {}; - this.frequency = o.frequency !== undefined ? o.frequency : this.frequency; - this.threshold = o.threshold !== undefined ? o.threshold : this.threshold; - this.decay = o.decay !== undefined ? o.decay : this.decay; - this.onKick = o.onKick || this.onKick; - this.offKick = o.offKick || this.offKick; - }, - - onUpdate : function () { - if ( !this.isOn ) { return; } - var magnitude = this.maxAmplitude( this.frequency ); - if ( magnitude >= this.currentThreshold && - magnitude >= this.threshold ) { - this.currentThreshold = magnitude; - this.onKick && this.onKick.call( this.dancer, magnitude ); - } else { - this.offKick && this.offKick.call( this.dancer, magnitude ); - this.currentThreshold -= this.decay; - } - }, - maxAmplitude : function ( frequency ) { - var - max = 0, - fft = this.dancer.getSpectrum(); - - // Sloppy array check - if ( !frequency.length ) { - return frequency < fft.length ? - fft[ ~~frequency ] : - null; - } - - for ( var i = frequency[ 0 ], l = frequency[ 1 ]; i <= l; i++ ) { - if ( fft[ i ] > max ) { max = fft[ i ]; } - } - return max; - } - }; - - window.Dancer.Kick = Kick; - })(); - - (function() { - var - SAMPLE_SIZE = 2048, - SAMPLE_RATE = 44100; - - var adapter = function ( dancer ) { - this.dancer = dancer; - this.audio = new Audio(); - this.context = window.AudioContext ? - new window.AudioContext() : - new window.webkitAudioContext(); - }; - - adapter.prototype = { - - load : function ( _source ) { - var _this = this; - this.audio = _source; - - this.isLoaded = false; - this.progress = 0; - - if (!this.context.createScriptProcessor) { - this.context.createScriptProcessor = this.context.createJavascriptNode; - } - this.proc = this.context.createScriptProcessor( SAMPLE_SIZE / 2, 1, 1 ); - - this.proc.onaudioprocess = function ( e ) { - _this.update.call( _this, e ); - }; - if (!this.context.createGain) { - this.context.createGain = this.context.createGainNode; - } - - this.gain = this.context.createGain(); - - this.fft = new FFT( SAMPLE_SIZE / 2, SAMPLE_RATE ); - this.signal = new Float32Array( SAMPLE_SIZE / 2 ); - - if ( this.audio.readyState < 3 ) { - this.audio.addEventListener( 'canplay', function () { - connectContext.call( _this ); - }); - } else { - connectContext.call( _this ); - } - - this.audio.addEventListener( 'progress', function ( e ) { - if ( e.currentTarget.duration ) { - _this.progress = e.currentTarget.seekable.end( 0 ) / e.currentTarget.duration; - } - }); - - return this.audio; - }, - - play : function () { - this.audio.play(); - this.isPlaying = true; - }, - - pause : function () { - this.audio.pause(); - this.isPlaying = false; - }, - - setVolume : function ( volume ) { - this.gain.gain.value = volume; - }, - - getVolume : function () { - return this.gain.gain.value; - }, - - getProgress : function() { - return this.progress; - }, - - getWaveform : function () { - return this.signal; - }, - - getSpectrum : function () { - return this.fft.spectrum; - }, - - getTime : function () { - return this.audio.currentTime; - }, - - update : function ( e ) { - if ( !this.isPlaying || !this.isLoaded ) return; - - var - buffers = [], - channels = e.inputBuffer.numberOfChannels, - resolution = SAMPLE_SIZE / channels, - sum = function ( prev, curr ) { - return prev[ i ] + curr[ i ]; - }, i; - - for ( i = channels; i--; ) { - buffers.push( e.inputBuffer.getChannelData( i ) ); - } - - for ( i = 0; i < resolution; i++ ) { - this.signal[ i ] = channels > 1 ? - buffers.reduce( sum ) / channels : - buffers[ 0 ][ i ]; - } - - this.fft.forward( this.signal ); - this.dancer.trigger( 'update' ); - } - }; - - function connectContext () { - this.source = this.context.createMediaElementSource( this.audio ); - this.source.connect( this.proc ); - this.source.connect( this.gain ); - this.gain.connect( this.context.destination ); - this.proc.connect( this.context.destination ); - - this.isLoaded = true; - this.progress = 1; - this.dancer.trigger( 'loaded' ); - } - - Dancer.adapters.webaudio = adapter; - - })(); - - (function() { - var - SAMPLE_SIZE = 1024, - SAMPLE_RATE = 44100, - smLoaded = false, - smLoading = false, - CONVERSION_COEFFICIENT = 0.93; - - var adapter = function ( dancer ) { - this.dancer = dancer; - this.wave_L = []; - this.wave_R = []; - this.spectrum = []; - window.SM2_DEFER = true; - }; - - adapter.prototype = { - // `source` can be either an Audio element, if supported, or an object - // either way, the path is stored in the `src` property - load : function ( source ) { - var _this = this; - this.path = source ? source.src : this.path; - - this.isLoaded = false; - this.progress = 0; - - !window.soundManager && !smLoading && loadSM.call( this ); - - if ( window.soundManager ) { - this.audio = soundManager.createSound({ - id : 'dancer' + Math.random() + '', - url : this.path, - stream : true, - autoPlay : false, - autoLoad : true, - whileplaying : function () { - _this.update(); - }, - whileloading : function () { - _this.progress = this.bytesLoaded / this.bytesTotal; - }, - onload : function () { - _this.fft = new FFT( SAMPLE_SIZE, SAMPLE_RATE ); - _this.signal = new Float32Array( SAMPLE_SIZE ); - _this.waveform = new Float32Array( SAMPLE_SIZE ); - _this.isLoaded = true; - _this.progress = 1; - _this.dancer.trigger( 'loaded' ); - } + // Update threshold. + this.currentThreshold -= data.decay; + + // Was kicking, but now under the threshold + if (this.kicking) { + this.kicking = false; + el.emit('audio-visualizer-kick-end', { + currentThreshold: this.currentThreshold, + magnitude: magnitude }); - this.dancer.audio = this.audio; } - - // Returns audio if SM already loaded -- otherwise, - // sets dancer instance's audio property after load - return this.audio; - }, - - play : function () { - this.audio.play(); - this.isPlaying = true; - }, - - pause : function () { - this.audio.pause(); - this.isPlaying = false; - }, - - setVolume : function ( volume ) { - this.audio.setVolume( volume * 100 ); - }, - - getVolume : function () { - return this.audio.volume / 100; - }, - - getProgress : function () { - return this.progress; - }, - - getWaveform : function () { - return this.waveform; - }, - - getSpectrum : function () { - return this.fft.spectrum; - }, - - getTime : function () { - return this.audio.position / 1000; - }, - - update : function () { - if ( !this.isPlaying && !this.isLoaded ) return; - this.wave_L = this.audio.waveformData.left; - this.wave_R = this.audio.waveformData.right; - var avg; - for ( var i = 0, j = this.wave_L.length; i < j; i++ ) { - avg = parseFloat(this.wave_L[ i ]) + parseFloat(this.wave_R[ i ]); - this.waveform[ 2 * i ] = avg / 2; - this.waveform[ i * 2 + 1 ] = avg / 2; - this.signal[ 2 * i ] = avg * CONVERSION_COEFFICIENT; - this.signal[ i * 2 + 1 ] = avg * CONVERSION_COEFFICIENT; - } - - this.fft.forward( this.signal ); - this.dancer.trigger( 'update' ); } - }; - - function loadSM () { - var adapter = this; - smLoading = true; - loadScript( Dancer.options.flashJS, function () { - soundManager = new SoundManager(); - soundManager.flashVersion = 9; - soundManager.flash9Options.useWaveformData = true; - soundManager.useWaveformData = true; - soundManager.useHighPerformance = true; - soundManager.useFastPolling = true; - soundManager.multiShot = false; - soundManager.debugMode = false; - soundManager.debugFlash = false; - soundManager.url = Dancer.options.flashSWF; - soundManager.onready(function () { - smLoaded = true; - adapter.load(); - }); - soundManager.ontimeout(function(){ - console.error( 'Error loading SoundManager2.swf' ); - }); - soundManager.beginDelayedInit(); - }); - } - - function loadScript ( url, callback ) { - var - script = document.createElement( 'script' ), - appender = document.getElementsByTagName( 'script' )[0]; - script.type = 'text/javascript'; - script.src = url; - script.onload = callback; - appender.parentNode.insertBefore( script, appender ); - } - - Dancer.adapters.flash = adapter; - - })(); - - /* - * DSP.js - a comprehensive digital signal processing library for javascript - * - * Created by Corban Brook on 2010-01-01. - * Copyright 2010 Corban Brook. All rights reserved. - * - */ - - // Fourier Transform Module used by DFT, FFT, RFFT - function FourierTransform(bufferSize, sampleRate) { - this.bufferSize = bufferSize; - this.sampleRate = sampleRate; - this.bandwidth = 2 / bufferSize * sampleRate / 2; - - this.spectrum = new Float32Array(bufferSize/2); - this.real = new Float32Array(bufferSize); - this.imag = new Float32Array(bufferSize); - - this.peakBand = 0; - this.peak = 0; + }, /** - * Calculates the *middle* frequency of an FFT band. - * - * @param {Number} index The index of the FFT band. - * - * @returns The middle frequency in Hz. + * Adapted from dancer.js. */ - this.getBandFrequency = function(index) { - return this.bandwidth * index + this.bandwidth / 2; - }; - - this.calculateSpectrum = function() { - var spectrum = this.spectrum, - real = this.real, - imag = this.imag, - bSi = 2 / this.bufferSize, - sqrt = Math.sqrt, - rval, - ival, - mag; - - for (var i = 0, N = bufferSize/2; i < N; i++) { - rval = real[i]; - ival = imag[i]; - mag = bSi * sqrt(rval * rval + ival * ival); - - if (mag > this.peak) { - this.peakBand = i; - this.peak = mag; - } + maxAmplitude: function (frequency) { + var max = 0; + var spectrum = this.el.components['audio-visualizer'].spectrum; - spectrum[i] = mag; + if (!frequency.length) { + return frequency < spectrum.length ? spectrum[~~frequency] : null; } - }; - } - - /** - * FFT is a class for calculating the Discrete Fourier Transform of a signal - * with the Fast Fourier Transform algorithm. - * - * @param {Number} bufferSize The size of the sample buffer to be computed. Must be power of 2 - * @param {Number} sampleRate The sampleRate of the buffer (eg. 44100) - * - * @constructor - */ - function FFT(bufferSize, sampleRate) { - FourierTransform.call(this, bufferSize, sampleRate); - - this.reverseTable = new Uint32Array(bufferSize); - - var limit = 1; - var bit = bufferSize >> 1; - var i; - - while (limit < bufferSize) { - for (i = 0; i < limit; i++) { - this.reverseTable[i + limit] = this.reverseTable[i] + bit; - } - - limit = limit << 1; - bit = bit >> 1; - } - - this.sinTable = new Float32Array(bufferSize); - this.cosTable = new Float32Array(bufferSize); - - for (i = 0; i < bufferSize; i++) { - this.sinTable[i] = Math.sin(-Math.PI/i); - this.cosTable[i] = Math.cos(-Math.PI/i); - } - } - - /** - * Performs a forward transform on the sample buffer. - * Converts a time domain signal to frequency domain spectra. - * - * @param {Array} buffer The sample buffer. Buffer Length must be power of 2 - * - * @returns The frequency spectrum array - */ - FFT.prototype.forward = function(buffer) { - // Locally scope variables for speed up - var bufferSize = this.bufferSize, - cosTable = this.cosTable, - sinTable = this.sinTable, - reverseTable = this.reverseTable, - real = this.real, - imag = this.imag, - spectrum = this.spectrum; - - var k = Math.floor(Math.log(bufferSize) / Math.LN2); - - if (Math.pow(2, k) !== bufferSize) { throw "Invalid buffer size, must be a power of 2."; } - if (bufferSize !== buffer.length) { throw "Supplied buffer is not the same size as defined FFT. FFT Size: " + bufferSize + " Buffer Size: " + buffer.length; } - - var halfSize = 1, - phaseShiftStepReal, - phaseShiftStepImag, - currentPhaseShiftReal, - currentPhaseShiftImag, - off, - tr, - ti, - tmpReal, - i; - - for (i = 0; i < bufferSize; i++) { - real[i] = buffer[reverseTable[i]]; - imag[i] = 0; - } - - while (halfSize < bufferSize) { - //phaseShiftStepReal = Math.cos(-Math.PI/halfSize); - //phaseShiftStepImag = Math.sin(-Math.PI/halfSize); - phaseShiftStepReal = cosTable[halfSize]; - phaseShiftStepImag = sinTable[halfSize]; - - currentPhaseShiftReal = 1; - currentPhaseShiftImag = 0; - - for (var fftStep = 0; fftStep < halfSize; fftStep++) { - i = fftStep; - - while (i < bufferSize) { - off = i + halfSize; - tr = (currentPhaseShiftReal * real[off]) - (currentPhaseShiftImag * imag[off]); - ti = (currentPhaseShiftReal * imag[off]) + (currentPhaseShiftImag * real[off]); - - real[off] = real[i] - tr; - imag[off] = imag[i] - ti; - real[i] += tr; - imag[i] += ti; - - i += halfSize << 1; + for (var i = frequency[0], l = frequency[1]; i <= l; i++) { + if (spectrum[i] > max) { + max = spectrum[i]; } - - tmpReal = currentPhaseShiftReal; - currentPhaseShiftReal = (tmpReal * phaseShiftStepReal) - (currentPhaseShiftImag * phaseShiftStepImag); - currentPhaseShiftImag = (tmpReal * phaseShiftStepImag) + (currentPhaseShiftImag * phaseShiftStepReal); } - - halfSize = halfSize << 1; + return max; } + }); - return this.calculateSpectrum(); - }; - - /* - Copyright (c) Copyright (c) 2007, Carl S. Yestrau All rights reserved. - Code licensed under the BSD License: http://www.featureblend.com/license.txt - Version: 1.0.4 - */ - var FlashDetect = new function(){ - var self = this; - self.installed = false; - self.raw = ""; - self.major = -1; - self.minor = -1; - self.revision = -1; - self.revisionStr = ""; - var activeXDetectRules = [ - { - "name":"ShockwaveFlash.ShockwaveFlash.7", - "version":function(obj){ - return getActiveXVersion(obj); - } - }, - { - "name":"ShockwaveFlash.ShockwaveFlash.6", - "version":function(obj){ - var version = "6,0,21"; - try{ - obj.AllowScriptAccess = "always"; - version = getActiveXVersion(obj); - }catch(err){} - return version; - } - }, - { - "name":"ShockwaveFlash.ShockwaveFlash", - "version":function(obj){ - return getActiveXVersion(obj); - } - } - ]; - /** - * Extract the ActiveX version of the plugin. - * - * @param {Object} The flash ActiveX object. - * @type String - */ - var getActiveXVersion = function(activeXObj){ - var version = -1; - try{ - version = activeXObj.GetVariable("$version"); - }catch(err){} - return version; - }; - /** - * Try and retrieve an ActiveX object having a specified name. - * - * @param {String} name The ActiveX object name lookup. - * @return One of ActiveX object or a simple object having an attribute of activeXError with a value of true. - * @type Object - */ - var getActiveXObject = function(name){ - var obj = -1; - try{ - obj = new ActiveXObject(name); - }catch(err){ - obj = {activeXError:true}; - } - return obj; - }; - /** - * Parse an ActiveX $version string into an object. - * - * @param {String} str The ActiveX Object GetVariable($version) return value. - * @return An object having raw, major, minor, revision and revisionStr attributes. - * @type Object - */ - var parseActiveXVersion = function(str){ - var versionArray = str.split(",");//replace with regex - return { - "raw":str, - "major":parseInt(versionArray[0].split(" ")[1], 10), - "minor":parseInt(versionArray[1], 10), - "revision":parseInt(versionArray[2], 10), - "revisionStr":versionArray[2] - }; - }; - /** - * Parse a standard enabledPlugin.description into an object. - * - * @param {String} str The enabledPlugin.description value. - * @return An object having raw, major, minor, revision and revisionStr attributes. - * @type Object - */ - var parseStandardVersion = function(str){ - var descParts = str.split(/ +/); - var majorMinor = descParts[2].split(/\./); - var revisionStr = descParts[3]; - return { - "raw":str, - "major":parseInt(majorMinor[0], 10), - "minor":parseInt(majorMinor[1], 10), - "revisionStr":revisionStr, - "revision":parseRevisionStrToInt(revisionStr) - }; - }; - /** - * Parse the plugin revision string into an integer. - * - * @param {String} The revision in string format. - * @type Number - */ - var parseRevisionStrToInt = function(str){ - return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision; - }; - /** - * Is the major version greater than or equal to a specified version. - * - * @param {Number} version The minimum required major version. - * @type Boolean - */ - self.majorAtLeast = function(version){ - return self.major >= version; - }; - /** - * Is the minor version greater than or equal to a specified version. - * - * @param {Number} version The minimum required minor version. - * @type Boolean - */ - self.minorAtLeast = function(version){ - return self.minor >= version; - }; - /** - * Is the revision version greater than or equal to a specified version. - * - * @param {Number} version The minimum required revision version. - * @type Boolean - */ - self.revisionAtLeast = function(version){ - return self.revision >= version; - }; - /** - * Is the version greater than or equal to a specified major, minor and revision. - * - * @param {Number} major The minimum required major version. - * @param {Number} (Optional) minor The minimum required minor version. - * @param {Number} (Optional) revision The minimum required revision version. - * @type Boolean - */ - self.versionAtLeast = function(major){ - var properties = [self.major, self.minor, self.revision]; - var len = Math.min(properties.length, arguments.length); - for(i=0; i=arguments[i]){ - if(i+10){ - var type = 'application/x-shockwave-flash'; - var mimeTypes = navigator.mimeTypes; - if(mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description){ - var version = mimeTypes[type].enabledPlugin.description; - var versionObj = parseStandardVersion(version); - self.raw = versionObj.raw; - self.major = versionObj.major; - self.minor = versionObj.minor; - self.revisionStr = versionObj.revisionStr; - self.revision = versionObj.revision; - self.installed = true; - } - }else if(navigator.appVersion.indexOf("Mac")==-1 && window.execScript){ - var version = -1; - for(var i=0; i":{"x_min":18.0625,"x_max":774,"ha":792,"o":"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"v":{"x_min":0,"x_max":675.15625,"ha":761,"o":"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},"τ":{"x_min":0.28125,"x_max":644.5,"ha":703,"o":"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},"ξ":{"x_min":0,"x_max":624.9375,"ha":699,"o":"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{"x_min":-3,"x_max":894.25,"ha":992,"o":"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},"Λ":{"x_min":0,"x_max":862.5,"ha":942,"o":"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},"I":{"x_min":41,"x_max":180,"ha":293,"o":"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},"G":{"x_min":0,"x_max":921,"ha":1011,"o":"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},"ΰ":{"x_min":0,"x_max":617,"ha":725,"o":"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{"x_min":0,"x_max":138.890625,"ha":236,"o":"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"·":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},"Υ":{"x_min":0.328125,"x_max":819.515625,"ha":889,"o":"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},"r":{"x_min":0,"x_max":355.5625,"ha":432,"o":"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},"x":{"x_min":0,"x_max":675,"ha":764,"o":"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},"μ":{"x_min":0,"x_max":696.609375,"ha":747,"o":"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},"h":{"x_min":0,"x_max":615,"ha":724,"o":"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},"φ":{"x_min":-2,"x_max":878,"ha":974,"o":"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},"f":{"x_min":0,"x_max":378,"ha":472,"o":"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"“":{"x_min":1,"x_max":348.21875,"ha":454,"o":"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},"A":{"x_min":0.03125,"x_max":906.953125,"ha":1008,"o":"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"6":{"x_min":53,"x_max":739,"ha":792,"o":"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},"‘":{"x_min":1,"x_max":139.890625,"ha":236,"o":"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},"ϊ":{"x_min":-70,"x_max":283,"ha":361,"o":"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},"π":{"x_min":-0.21875,"x_max":773.21875,"ha":857,"o":"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},"ά":{"x_min":0,"x_max":765.5625,"ha":809,"o":"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},"O":{"x_min":0,"x_max":958,"ha":1057,"o":"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},"n":{"x_min":0,"x_max":615,"ha":724,"o":"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},"3":{"x_min":54,"x_max":737,"ha":792,"o":"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},"9":{"x_min":53,"x_max":739,"ha":792,"o":"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},"l":{"x_min":41,"x_max":166,"ha":279,"o":"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"¤":{"x_min":40.09375,"x_max":728.796875,"ha":825,"o":"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},"κ":{"x_min":0,"x_max":632.328125,"ha":679,"o":"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},"4":{"x_min":48,"x_max":742.453125,"ha":792,"o":"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},"p":{"x_min":0,"x_max":685,"ha":786,"o":"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"‡":{"x_min":0,"x_max":777,"ha":835,"o":"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},"ψ":{"x_min":0,"x_max":808,"ha":907,"o":"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},"η":{"x_min":0.78125,"x_max":697,"ha":810,"o":"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},"cssFontWeight":"normal","ascender":1189,"underlinePosition":-100,"cssFontStyle":"normal","boundingBox":{"yMin":-334,"xMin":-111,"yMax":1189,"xMax":1672},"resolution":1000,"original_font_information":{"postscript_name":"Helvetiker-Regular","version_string":"Version 1.00 2004 initial release","vendor_url":"http://www.magenta.gr/","full_font_name":"Helvetiker","font_family_name":"Helvetiker","copyright":"Copyright (c) Μagenta ltd, 2004","description":"","trademark":"","designer":"","designer_url":"","unique_font_identifier":"Μagenta ltd:Helvetiker:22-10-104","license_url":"http://www.ellak.gr/fonts/MgOpen/license.html","license_description":"Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license (\"Fonts\") and associated documentation files (the \"Font Software\"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: \r\n\r\nThe above copyright and this permission notice shall be included in all copies of one or more of the Font Software typefaces.\r\n\r\nThe Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing the word \"MgOpen\", or if the modifications are accepted for inclusion in the Font Software itself by the each appointed Administrator.\r\n\r\nThis License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the \"MgOpen\" name.\r\n\r\nThe Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. \r\n\r\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.","manufacturer_name":"Μagenta ltd","font_sub_family_name":"Regular"},"descender":-334,"familyName":"Helvetiker","lineHeight":1522,"underlineThickness":50}); diff --git a/dist/k-frame.min.js b/dist/k-frame.min.js index e285458c..a0da871c 100644 --- a/dist/k-frame.min.js +++ b/dist/k-frame.min.js @@ -1,15 +1,15 @@ -!function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){n(1),n(3),n(4),n(5),n(8),n(9),n(10),n(11),n(12)},function(t,e,n){if(n(2),"undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerSystem("audio-visualizer",{init:function(){this.dancers={}},getOrCreateAudio:function(t){return this.dancers[t]?this.dancers[t]:this.createAudio(t)},createAudio:function(t){var e=new Dancer;return e.load({src:t}),e.play(),this.dancers[t]=e,e}}),AFRAME.registerComponent("audio-visualizer",{schema:{unique:{"default":!1},src:{type:"src"}},init:function(){this.dancer=null},update:function(){var t=this.data,e=this.system;t.src&&(t.unique?this.dancer=e.createAudio(t.src):this.dancer=e.getOrCreateAudio(t.src),this.el.emit("audio-visualizer-ready",{dancer:this.dancer}))}}),AFRAME.registerComponent("audio-visualizer-kick",{dependencies:["audio-visualizer"],schema:{frequency:{type:"array","default":[127,129]},threshold:{"default":1e-5},decay:{"default":1e-5}},init:function(){this.kick=!1},update:function(){function t(t){var e=t.createKick(r);e.on()}var e=this.data,n=this.el,i=this,r=AFRAME.utils.extend(e,{onKick:function(t,e){i.kick||(n.emit("audio-visualizer-kick-start",this.arguments),i.kick=!0)},offKick:function(t,e){i.kick&&(n.emit("audio-visualizer-kick-end",this.arguments),i.kick=!1)}}),o=this.el.components["audio-visualizer"].dancer;o?t(o):this.el.addEventListener("audio-visualizer-ready",function(e){t(e.detail.dancer)})}})},function(t,e){function n(t,e){this.bufferSize=t,this.sampleRate=e,this.bandwidth=2/t*e/2,this.spectrum=new Float32Array(t/2),this.real=new Float32Array(t),this.imag=new Float32Array(t),this.peakBand=0,this.peak=0,this.getBandFrequency=function(t){return this.bandwidth*t+this.bandwidth/2},this.calculateSpectrum=function(){for(var e,n,i,r=this.spectrum,o=this.real,a=this.imag,s=2/this.bufferSize,u=Math.sqrt,l=0,c=t/2;c>l;l++)e=o[l],n=a[l],i=s*u(e*e+n*n),i>this.peak&&(this.peakBand=l,this.peak=i),r[l]=i}}function r(t,e){n.call(this,t,e),this.reverseTable=new Uint32Array(t);for(var i,r=1,o=t>>1;t>r;){for(i=0;r>i;i++)this.reverseTable[i+r]=this.reverseTable[i]+o;r<<=1,o>>=1}for(this.sinTable=new Float32Array(t),this.cosTable=new Float32Array(t),i=0;t>i;i++)this.sinTable[i]=Math.sin(-Math.PI/i),this.cosTable[i]=Math.cos(-Math.PI/i)}!function(){function t(){for(var t in this.sections)this.sections[t].condition()&&this.sections[t].callback.call(this)}var e=function(){this.audioAdapter=e._getAdapter(this),this.events={},this.sections=[],this.bind("update",t)};e.version="0.3.2",e.adapters={},e.prototype={load:function(t){return t instanceof HTMLElement?(this.source=t,"flash"===e.isSupported()&&(this.source={src:e._getMP3SrcFromAudio(t)})):(this.source=window.Audio?new Audio:{},this.source.src=e._makeSupportedPath(t.src,t.codecs)),this.audio=this.audioAdapter.load(this.source),this},play:function(){return this.audioAdapter.play(),this},pause:function(){return this.audioAdapter.pause(),this},setVolume:function(t){return this.audioAdapter.setVolume(t),this},createKick:function(t){return new e.Kick(this,t)},bind:function(t,e){return this.events[t]||(this.events[t]=[]),this.events[t].push(e),this},unbind:function(t){return this.events[t]&&delete this.events[t],this},trigger:function(t){var e=this;return this.events[t]&&this.events[t].forEach(function(t){t.call(e)}),this},getVolume:function(){return this.audioAdapter.getVolume()},getProgress:function(){return this.audioAdapter.getProgress()},getTime:function(){return this.audioAdapter.getTime()},getFrequency:function(t,e){var n=0;if(void 0!==e){for(var i=t;e>=i;i++)n+=this.getSpectrum()[i];return n/(e-t+1)}return this.getSpectrum()[t]},getWaveform:function(){return this.audioAdapter.getWaveform()},getSpectrum:function(){return this.audioAdapter.getSpectrum()},isLoaded:function(){return this.audioAdapter.isLoaded},isPlaying:function(){return this.audioAdapter.isPlaying},after:function(t,e){var n=this;return this.sections.push({condition:function(){return n.getTime()>t},callback:e}),this},before:function(t,e){var n=this;return this.sections.push({condition:function(){return n.getTime()t&&i.getTime()t&&!this.called},callback:function(){e.call(this),i.called=!0},called:!1}),i=this.sections[this.sections.length-1],this}},window.Dancer=e}(),function(t){function e(){var t=!!(navigator.vendor||"").match(/Apple/),e=navigator.userAgent.match(/Version\/([^ ]*)/);return e=e?parseFloat(e[1]):0,t&&6>=e}var n={mp3:"audio/mpeg;",ogg:'audio/ogg; codecs="vorbis"',wav:'audio/wav; codecs="1"',aac:'audio/mp4; codecs="mp4a.40.2"'},i=document.createElement("audio");t.options={},t.setOptions=function(e){for(var n in e)e.hasOwnProperty(n)&&(t.options[n]=e[n])},t.isSupported=function(){return window.Float32Array&&window.Uint32Array?e()||!window.AudioContext&&!window.webkitAudioContext?o.versionAtLeast(9)?"flash":"":"webaudio":null},t.canPlay=function(e){i.canPlayType;return!!("flash"===t.isSupported()?"mp3"===e.toLowerCase():i.canPlayType&&i.canPlayType(n[e.toLowerCase()]).replace(/no/,""))},t.addPlugin=function(e,n){void 0===t.prototype[e]&&(t.prototype[e]=n)},t._makeSupportedPath=function(e,n){if(!n)return e;for(var i=0;i=this.currentThreshold&&t>=this.threshold?(this.currentThreshold=t,this.onKick&&this.onKick.call(this.dancer,t)):(this.offKick&&this.offKick.call(this.dancer,t),this.currentThreshold-=this.decay)}},maxAmplitude:function(t){var e=0,n=this.dancer.getSpectrum();if(!t.length)return t=i;i++)n[i]>e&&(e=n[i]);return e}},window.Dancer.Kick=e}(),function(){function t(){this.source=this.context.createMediaElementSource(this.audio),this.source.connect(this.proc),this.source.connect(this.gain),this.gain.connect(this.context.destination),this.proc.connect(this.context.destination),this.isLoaded=!0,this.progress=1,this.dancer.trigger("loaded")}var e=2048,n=44100,i=function(t){this.dancer=t,this.audio=new Audio,this.context=window.AudioContext?new window.AudioContext:new window.webkitAudioContext};i.prototype={load:function(i){var o=this;return this.audio=i,this.isLoaded=!1,this.progress=0,this.context.createScriptProcessor||(this.context.createScriptProcessor=this.context.createJavascriptNode),this.proc=this.context.createScriptProcessor(e/2,1,1),this.proc.onaudioprocess=function(t){o.update.call(o,t)},this.context.createGain||(this.context.createGain=this.context.createGainNode),this.gain=this.context.createGain(),this.fft=new r(e/2,n),this.signal=new Float32Array(e/2),this.audio.readyState<3?this.audio.addEventListener("canplay",function(){t.call(o)}):t.call(o),this.audio.addEventListener("progress",function(t){t.currentTarget.duration&&(o.progress=t.currentTarget.seekable.end(0)/t.currentTarget.duration)}),this.audio},play:function(){this.audio.play(),this.isPlaying=!0},pause:function(){this.audio.pause(),this.isPlaying=!1},setVolume:function(t){this.gain.gain.value=t},getVolume:function(){return this.gain.gain.value},getProgress:function(){return this.progress},getWaveform:function(){return this.signal},getSpectrum:function(){return this.fft.spectrum},getTime:function(){return this.audio.currentTime},update:function(t){if(this.isPlaying&&this.isLoaded){var n,i=[],r=t.inputBuffer.numberOfChannels,o=e/r,a=function(t,e){return t[n]+e[n]};for(n=r;n--;)i.push(t.inputBuffer.getChannelData(n));for(n=0;o>n;n++)this.signal[n]=r>1?i.reduce(a)/r:i[0][n];this.fft.forward(this.signal),this.dancer.trigger("update")}}},Dancer.adapters.webaudio=i}(),function(){function t(){var t=this;a=!0,e(Dancer.options.flashJS,function(){soundManager=new SoundManager,soundManager.flashVersion=9,soundManager.flash9Options.useWaveformData=!0,soundManager.useWaveformData=!0,soundManager.useHighPerformance=!0,soundManager.useFastPolling=!0,soundManager.multiShot=!1,soundManager.debugMode=!1,soundManager.debugFlash=!1,soundManager.url=Dancer.options.flashSWF,soundManager.onready(function(){o=!0,t.load()}),soundManager.ontimeout(function(){console.error("Error loading SoundManager2.swf")}),soundManager.beginDelayedInit()})}function e(t,e){var n=document.createElement("script"),i=document.getElementsByTagName("script")[0];n.type="text/javascript",n.src=t,n.onload=e,i.parentNode.insertBefore(n,i)}var n=1024,i=44100,o=!1,a=!1,s=.93,u=function(t){this.dancer=t,this.wave_L=[],this.wave_R=[],this.spectrum=[],window.SM2_DEFER=!0};u.prototype={load:function(e){var o=this;return this.path=e?e.src:this.path,this.isLoaded=!1,this.progress=0,!window.soundManager&&!a&&t.call(this),window.soundManager&&(this.audio=soundManager.createSound({id:"dancer"+Math.random(),url:this.path,stream:!0,autoPlay:!1,autoLoad:!0,whileplaying:function(){o.update()},whileloading:function(){o.progress=this.bytesLoaded/this.bytesTotal},onload:function(){o.fft=new r(n,i),o.signal=new Float32Array(n),o.waveform=new Float32Array(n),o.isLoaded=!0,o.progress=1,o.dancer.trigger("loaded")}}),this.dancer.audio=this.audio),this.audio},play:function(){this.audio.play(),this.isPlaying=!0},pause:function(){this.audio.pause(),this.isPlaying=!1},setVolume:function(t){this.audio.setVolume(100*t)},getVolume:function(){return this.audio.volume/100},getProgress:function(){return this.progress},getWaveform:function(){return this.waveform},getSpectrum:function(){return this.fft.spectrum},getTime:function(){return this.audio.position/1e3},update:function(){if(this.isPlaying||this.isLoaded){this.wave_L=this.audio.waveformData.left,this.wave_R=this.audio.waveformData.right;for(var t,e=0,n=this.wave_L.length;n>e;e++)t=parseFloat(this.wave_L[e])+parseFloat(this.wave_R[e]),this.waveform[2*e]=t/2,this.waveform[2*e+1]=t/2,this.signal[2*e]=t*s,this.signal[2*e+1]=t*s;this.fft.forward(this.signal),this.dancer.trigger("update")}}},Dancer.adapters.flash=u}(),r.prototype.forward=function(t){var e=this.bufferSize,n=this.cosTable,i=this.sinTable,r=this.reverseTable,o=this.real,a=this.imag,s=(this.spectrum,Math.floor(Math.log(e)/Math.LN2));if(Math.pow(2,s)!==e)throw"Invalid buffer size, must be a power of 2.";if(e!==t.length)throw"Supplied buffer is not the same size as defined FFT. FFT Size: "+e+" Buffer Size: "+t.length;var u,l,c,h,f,d,p,g,v,m=1;for(v=0;e>v;v++)o[v]=t[r[v]],a[v]=0;for(;e>m;){u=n[m],l=i[m],c=1,h=0;for(var b=0;m>b;b++){for(v=b;e>v;)f=v+m,d=c*o[f]-h*a[f],p=c*a[f]+h*o[f],o[f]=o[v]-d,a[f]=a[v]-p,o[v]+=d,a[v]+=p,v+=m<<1;g=c,c=g*u-h*l,h=g*l+h*u}m<<=1}return this.calculateSpectrum()};var o=new function(){var t=this;t.installed=!1,t.raw="",t.major=-1,t.minor=-1,t.revision=-1,t.revisionStr="";var e=[{name:"ShockwaveFlash.ShockwaveFlash.7",version:function(t){return n(t)}},{name:"ShockwaveFlash.ShockwaveFlash.6",version:function(t){var e="6,0,21";try{t.AllowScriptAccess="always",e=n(t)}catch(i){}return e}},{name:"ShockwaveFlash.ShockwaveFlash",version:function(t){return n(t)}}],n=function(t){var e=-1;try{e=t.GetVariable("$version")}catch(n){}return e},r=function(t){var e=-1;try{e=new ActiveXObject(t)}catch(n){e={activeXError:!0}}return e},o=function(t){var e=t.split(",");return{raw:t,major:parseInt(e[0].split(" ")[1],10),minor:parseInt(e[1],10),revision:parseInt(e[2],10),revisionStr:e[2]}},a=function(t){var e=t.split(/ +/),n=e[2].split(/\./),i=e[3];return{raw:t,major:parseInt(n[0],10),minor:parseInt(n[1],10),revisionStr:i,revision:s(i)}},s=function(e){return parseInt(e.replace(/[a-zA-Z]/g,""),10)||t.revision};t.majorAtLeast=function(e){return t.major>=e},t.minorAtLeast=function(e){return t.minor>=e},t.revisionAtLeast=function(e){return t.revision>=e},t.versionAtLeast=function(e){var n=[t.major,t.minor,t.revision],r=Math.min(n.length,arguments.length);for(i=0;i=arguments[i]){if(i+10){var n="application/x-shockwave-flash",i=navigator.mimeTypes;if(i&&i[n]&&i[n].enabledPlugin&&i[n].enabledPlugin.description){var s=i[n].enabledPlugin.description,u=a(s);t.raw=u.raw,t.major=u.major,t.minor=u.minor,t.revisionStr=u.revisionStr,t.revision=u.revision,t.installed=!0}}else if(-1==navigator.appVersion.indexOf("Mac")&&window.execScript)for(var s=-1,l=0;lthis.currentThreshold&&n>t.threshold){if(this.kicking)return;this.kicking=!0,e.emit("audio-visualizer-kick-start",{currentThreshold:this.currentThreshold,magnitude:n})}else this.currentThreshold-=t.decay,this.kicking&&(this.kicking=!1,e.emit("audio-visualizer-kick-end",{currentThreshold:this.currentThreshold,magnitude:n}))}},maxAmplitude:function(t){var e=0,n=this.el.components["audio-visualizer"].spectrum;if(!t.length)return t=i;i++)n[i]>e&&(e=n[i]);return e}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("entity-generator",{schema:{mixin:{"default":""},num:{"default":10}},init:function(){for(var t=this.data,e=0;et||t>1342177279)throw new RangeError("Invalid count value");t|=0;for(var n="";t;)1&t&&(n+=e),(t>>>=1)&&(e+=e);return n},y=function(t){v(this,"codePointAt");var e=String(this),n=e.length;if(t=Number(t)||0,t>=0&&n>t){t|=0;var i=e.charCodeAt(t);return 55296>i||i>56319||t+1===n?i:(t=e.charCodeAt(t+1),56320>t||t>57343?i:1024*(i-55296)+t+9216)}},q=function(t,e){return e=void 0===e?0:e,m(t,"includes"),v(this,"includes"),-1!==String(this).indexOf(t,e)},w=function(t,e){e=void 0===e?0:e,m(t,"startsWith"),v(this,"startsWith");var n=String(this);t+="";var i=n.length,r=t.length;e=Math.max(0,Math.min(0|e,n.length));for(var o=0;r>o&&i>e;)if(n[e++]!=t[o++])return!1;return o>=r},x=function(t,e){m(t,"endsWith"),v(this,"endsWith");var n=String(this);t+="",void 0===e&&(e=n.length),e=Math.max(0,Math.min(0|e,n.length));for(var i=t.length;i>0&&e>0;)if(n[--e]!=t[--i])return!1;return 0>=i};String.prototype.endsWith||(String.prototype.endsWith=x),String.prototype.startsWith||(String.prototype.startsWith=w),String.prototype.includes||(String.prototype.includes=q),String.prototype.codePointAt||(String.prototype.codePointAt=y),String.prototype.repeat||(String.prototype.repeat=b),g("values",function(){return p(this,function(t,e){return e})}),g("keys",function(){return p(this,function(t){return t})}),g("entries",function(){return p(this,function(t,e){return[t,e]})});var E=this,k=function(){},T=function(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var n=Object.prototype.toString.call(t);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof t.length&&"undefined"!=typeof t.splice&&"undefined"!=typeof t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||"undefined"!=typeof t.call&&"undefined"!=typeof t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&"undefined"==typeof t.call)return"object";return e},A=function(t){return"function"==T(t)},S=function(t,e,n){return t.call.apply(t.bind,arguments)},_=function(t,e,n){if(!t)throw Error();if(2"}),n=this.W+": "+n+" ("+this.V+"/"+t+").";t=new vt(t,n);for(var i in e)e.hasOwnProperty(i)&&"_"!==i.slice(-1)&&(t[i]=e[i]);return t},tt.all=function(t){return new tt(function(e,n){var i=t.length,r=[];if(i)for(var o,a=function(t,n){i--,r[t]=n,0==i&&e(r)},s=function(t){n(t)},u=0;u/g,ra=/"/g,sa=/'/g,ta=/\x00/g,ua=/[\x00&<>"']/,u=function(t,e){return-1!=t.indexOf(e)},va=function(t,e){return e>t?-1:t>e?1:0},wa=function(e,n){n.unshift(e),t.call(this,ma.apply(null,n)),n.shift()};r(wa,t),wa.prototype.name="AssertionError";var xa=function(t,e,n,i){var r="Assertion failed";if(n)var r=r+(": "+n),o=i;else t&&(r+=": "+t,o=e);throw new wa(""+r,o||[])},v=function(t,e,n){t||xa("",null,e,Array.prototype.slice.call(arguments,2))},ya=function(t,e){throw new wa("Failure"+(t?": "+t:""),Array.prototype.slice.call(arguments,1))},za=function(t,e,n){return ga(t)||xa("Expected number but got %s: %s.",[ca(t),t],e,Array.prototype.slice.call(arguments,2)),t},Aa=function(t,e,i){return n(t)||xa("Expected string but got %s: %s.",[ca(t),t],e,Array.prototype.slice.call(arguments,2)),t},Ba=function(t,e,n){p(t)||xa("Expected function but got %s: %s.",[ca(t),t],e,Array.prototype.slice.call(arguments,2))},Ca=Array.prototype.indexOf?function(t,e,n){return v(null!=t.length),Array.prototype.indexOf.call(t,e,n)}:function(t,e,i){if(i=null==i?0:0>i?Math.max(0,t.length+i):i,n(t))return n(e)&&1==e.length?t.indexOf(e,i):-1;for(;ia;a++)a in o&&e.call(i,o[a],a,t)},Da=function(t,e){for(var i=n(t)?t.split(""):t,r=t.length-1;r>=0;--r)r in i&&e.call(void 0,i[r],r,t)},Ea=Array.prototype.map?function(t,e,n){return v(null!=t.length),Array.prototype.map.call(t,e,n)}:function(t,e,i){for(var r=t.length,o=Array(r),a=n(t)?t.split(""):t,s=0;r>s;s++)s in a&&(o[s]=e.call(i,a[s],s,t));return o},Fa=Array.prototype.some?function(t,e,n){return v(null!=t.length),Array.prototype.some.call(t,e,n)}:function(t,e,i){for(var r=t.length,o=n(t)?t.split(""):t,a=0;r>a;a++)if(a in o&&e.call(i,o[a],a,t))return!0;return!1},Ha=function(t){var e;t:{e=Ga;for(var i=t.length,r=n(t)?t.split(""):t,o=0;i>o;o++)if(o in r&&e.call(void 0,r[o],o,t)){e=o;break t}e=-1}return 0>e?null:n(t)?t.charAt(e):t[e]},Ia=function(t,e){return 0<=Ca(t,e)},Ka=function(t,e){var n,i=Ca(t,e);return(n=i>=0)&&Ja(t,i),n},Ja=function(t,e){return v(null!=t.length),1==Array.prototype.splice.call(t,e,1).length},La=function(t,e){var n=0;Da(t,function(i,r){e.call(void 0,i,r,t)&&Ja(t,r)&&n++})},Ma=function(t){return Array.prototype.concat.apply(Array.prototype,arguments)},Na=function(t){return Array.prototype.concat.apply(Array.prototype,arguments)},Oa=function(t){var e=t.length;if(e>0){for(var n=Array(e),i=0;e>i;i++)n[i]=t[i];return n}return[]},Pa=function(t,e){for(var n=1;na;a++)t[r+a]=i[a]}else t.push(i)}},Qa=function(t,e){for(var n in t)e.call(void 0,t[n],n,t)},Ra=function(t){var e,n=[],i=0;for(e in t)n[i++]=t[e];return n},Sa=function(t){var e,n=[],i=0;for(e in t)n[i++]=e;return n},Ta=function(t){return null!==t&&"withCredentials"in t},Ua=function(t){for(var e in t)return!1;return!0},Va=function(t,e){for(var n in t)if(!(n in e)||t[n]!==e[n])return!1;for(n in e)if(!(n in t))return!1;return!0},Ya=function(t){var e,n={};for(e in t)n[e]=t[e];return n},Za="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),$a=function(t,e){for(var n,i,r=1;rparseFloat(kb)){jb=String(mb);break t}}jb=kb}var nb=jb,ob={},z=function(t){var e;if(!(e=ob[t])){e=0;for(var n=na(String(nb)).split("."),i=na(String(t)).split("."),r=Math.max(n.length,i.length),o=0;0==e&&r>o;o++){var a=n[o]||"",s=i[o]||"",u=RegExp("(\\d*)(\\D*)","g"),l=RegExp("(\\d*)(\\D*)","g");do{var c=u.exec(a)||["","",""],h=l.exec(s)||["","",""];if(0==c[0].length&&0==h[0].length)break;e=va(0==c[1].length?0:parseInt(c[1],10),0==h[1].length?0:parseInt(h[1],10))||va(0==c[2].length,0==h[2].length)||va(c[2],h[2])}while(0==e)}e=ob[t]=e>=0}return e},pb=l.document,qb=pb&&y?ib()||("CSS1Compat"==pb.compatMode?parseInt(nb,10):5):void 0,rb=null,sb=null,ub=function(t){var e="";return tb(t,function(t){e+=String.fromCharCode(t)}),e},tb=function(t,e){function n(e){for(;i>4),64!=a&&(e(o<<4&240|a>>2),64!=s&&e(a<<6&192|s))}},vb=function(){if(!rb){rb={},sb={};for(var t=0;65>t;t++)rb[t]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(t),sb[rb[t]]=t,t>=62&&(sb["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(t)]=t)}},xb=function(){this.Pb="",this.wd=wb};xb.prototype.ic=!0,xb.prototype.gc=function(){return this.Pb},xb.prototype.toString=function(){return"Const{"+this.Pb+"}"};var yb=function(t){return t instanceof xb&&t.constructor===xb&&t.wd===wb?t.Pb:(ya("expected object of type Const, got '"+t+"'"),"type_error:Const")},wb={},A=function(){this.aa="",this.vd=zb};A.prototype.ic=!0,A.prototype.gc=function(){return this.aa},A.prototype.toString=function(){return"SafeUrl{"+this.aa+"}"};var Ab=function(t){return t instanceof A&&t.constructor===A&&t.vd===zb?t.aa:(ya("expected object of type SafeUrl, got '"+t+"' of type "+ca(t)),"type_error:SafeUrl")},Bb=/^(?:(?:https?|mailto|ftp):|[^&:/?#]*(?:[/?#]|$))/i,Db=function(t){return t instanceof A?t:(t=t.ic?t.gc():String(t),Bb.test(t)||(t="about:invalid#zClosurez"),Cb(t))},zb={},Cb=function(t){var e=new A;return e.aa=t,e};Cb("about:blank");var Fb=function(){this.aa="",this.ud=Eb};Fb.prototype.ic=!0,Fb.prototype.gc=function(){return this.aa},Fb.prototype.toString=function(){return"SafeHtml{"+this.aa+"}"};var Gb=function(t){return t instanceof Fb&&t.constructor===Fb&&t.ud===Eb?t.aa:(ya("expected object of type SafeHtml, got '"+t+"' of type "+ca(t)),"type_error:SafeHtml")},Eb={};Fb.prototype.Zd=function(t){return this.aa=t,this};var Hb=function(t,e){var n;n=e instanceof A?e:Db(e),t.href=Ab(n)},Ib=function(t){return Ib[" "](t),t};Ib[" "]=ba;var Jb=!y||9<=Number(qb),Kb=y&&!z("9");!hb||z("528"),gb&&z("1.9b")||y&&z("8")||db&&z("9.5")||hb&&z("528"),gb&&!z("8")||y&&z("9");var Lb=function(){this.ra=this.ra,this.Gb=this.Gb};Lb.prototype.ra=!1,Lb.prototype.isDisposed=function(){return this.ra},Lb.prototype.Ga=function(){if(this.Gb)for(;this.Gb.length;)this.Gb.shift()()};var Mb=function(t,e){this.type=t,this.currentTarget=this.target=e,this.defaultPrevented=this.Na=!1,this.gd=!0};Mb.prototype.preventDefault=function(){this.defaultPrevented=!0,this.gd=!1};var Nb=function(t,e){Mb.call(this,t?t.type:""),this.relatedTarget=this.currentTarget=this.target=null,this.charCode=this.keyCode=this.button=this.screenY=this.screenX=this.clientY=this.clientX=this.offsetY=this.offsetX=0,this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.ub=this.state=null,t&&this.init(t,e)};r(Nb,Mb),Nb.prototype.init=function(t,e){var n=this.type=t.type,i=t.changedTouches?t.changedTouches[0]:null;this.target=t.target||t.srcElement,this.currentTarget=e;var r=t.relatedTarget;if(r){if(gb){var o;t:{try{Ib(r.nodeName),o=!0;break t}catch(a){}o=!1}o||(r=null)}}else"mouseover"==n?r=t.fromElement:"mouseout"==n&&(r=t.toElement);this.relatedTarget=r,null===i?(this.offsetX=hb||void 0!==t.offsetX?t.offsetX:t.layerX,this.offsetY=hb||void 0!==t.offsetY?t.offsetY:t.layerY,this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0):(this.clientX=void 0!==i.clientX?i.clientX:i.pageX,this.clientY=void 0!==i.clientY?i.clientY:i.pageY,this.screenX=i.screenX||0,this.screenY=i.screenY||0),this.button=t.button,this.keyCode=t.keyCode||0,this.charCode=t.charCode||("keypress"==n?t.keyCode:0),this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.state=t.state,this.ub=t,t.defaultPrevented&&this.preventDefault()},Nb.prototype.preventDefault=function(){Nb.yc.preventDefault.call(this);var t=this.ub;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,Kb)try{(t.ctrlKey||112<=t.keyCode&&123>=t.keyCode)&&(t.keyCode=-1)}catch(e){}};var Ob="closure_listenable_"+(1e6*Math.random()|0),Pb=0,Qb=function(t,e,n,i,r){this.listener=t,this.Ib=null,this.src=e,this.type=n,this.rb=!!i,this.zb=r,this.key=++Pb,this.Pa=this.qb=!1},Rb=function(t){t.Pa=!0,t.listener=null,t.Ib=null,t.src=null,t.zb=null},Sb=function(t){this.src=t,this.v={},this.pb=0};Sb.prototype.add=function(t,e,n,i,r){var o=t.toString();t=this.v[o],t||(t=this.v[o]=[],this.pb++);var a=Tb(t,e,i,r);return a>-1?(e=t[a],n||(e.qb=!1)):(e=new Qb(e,this.src,o,!!i,r),e.qb=n,t.push(e)),e},Sb.prototype.remove=function(t,e,n,i){if(t=t.toString(),!(t in this.v))return!1;var r=this.v[t];return e=Tb(r,e,n,i),e>-1?(Rb(r[e]),Ja(r,e),0==r.length&&(delete this.v[t],this.pb--),!0):!1};var Ub=function(t,e){var n=e.type;n in t.v&&Ka(t.v[n],e)&&(Rb(e),0==t.v[n].length&&(delete t.v[n],t.pb--))};Sb.prototype.ec=function(t,e,n,i){t=this.v[t.toString()];var r=-1;return t&&(r=Tb(t,e,n,i)),r>-1?t[r]:null};var Tb=function(t,e,n,i){for(var r=0;ri.keyCode||void 0!=i.returnValue)){t:{var o=!1;if(0==i.keyCode)try{i.keyCode=-1;break t}catch(a){o=!0}(o||void 0==i.returnValue)&&(i.returnValue=!0)}for(i=[],o=n.currentTarget;o;o=o.parentNode)i.push(o);for(var o=t.type,s=i.length-1;!n.Na&&s>=0;s--){n.currentTarget=i[s];var u=kc(i[s],o,!0,n),r=r&&u}for(s=0;!n.Na&&s>>0),Zb=function(t){return v(t,"Listener can not be null."),p(t)?t:(v(t.handleEvent,"An object listener must have handleEvent method."),t[lc]||(t[lc]=function(e){return t.handleEvent(e)}),t[lc])},mc=/^[+a-zA-Z0-9_.!#$%&'*\/=?^`{|}~-]+@([a-zA-Z0-9-]+\.)+[a-zA-Z0-9]{2,63}$/,nc=function(a){if(a=String(a),/^\s*$/.test(a)?0:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/(?:"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)[\s\u2028\u2029]*(?=:|,|]|}|$)/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,"")))try{return eval("("+a+")")}catch(b){}throw Error("Invalid JSON string: "+a)},qc=function(t){var e=[];return oc(new pc,t,e),e.join("")},pc=function(){this.Lb=void 0},oc=function(t,e,n){if(null==e)n.push("null");else{if("object"==typeof e){if(ea(e)){var i=e;e=i.length,n.push("[");for(var r="",o=0;e>o;o++)n.push(r),r=i[o],oc(t,t.Lb?t.Lb.call(i,String(o),r):r,n),r=",";return void n.push("]")}if(!(e instanceof String||e instanceof Number||e instanceof Boolean)){n.push("{"),o="";for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r=e[i],"function"!=typeof r&&(n.push(o),rc(i,n),n.push(":"),oc(t,t.Lb?t.Lb.call(e,i,r):r,n),o=","));return void n.push("}")}e=e.valueOf()}switch(typeof e){case"string":rc(e,n);break;case"number":n.push(isFinite(e)&&!isNaN(e)?String(e):"null");break;case"boolean":n.push(String(e));break;case"function":n.push("null");break;default:throw Error("Unknown type: "+typeof e)}}},sc={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\x0B":"\\u000b"},tc=/\uffff/.test("￿")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g,rc=function(t,e){ -e.push('"',t.replace(tc,function(t){var e=sc[t];return e||(e="\\u"+(65536|t.charCodeAt(0)).toString(16).substr(1),sc[t]=e),e}),'"')},uc=function(){};uc.prototype.Bc=null;var vc=function(t){return t.Bc||(t.Bc=t.Uc())},wc,xc=function(){};r(xc,uc),xc.prototype.$b=function(){var t=yc(this);return t?new ActiveXObject(t):new XMLHttpRequest},xc.prototype.Uc=function(){var t={};return yc(this)&&(t[0]=!0,t[1]=!0),t};var yc=function(t){if(!t.Qc&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var e=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],n=0;n=0;i--){var r=0|t[i];n&&r==e||(this.h[i]=r,n=!1)}},Cc={},Dc=function(t){if(t>=-128&&128>t){var e=Cc[t];if(e)return e}return e=new B([0|t],0>t?-1:0),t>=-128&&128>t&&(Cc[t]=e),e},E=function(t){if(isNaN(t)||!isFinite(t))return C;if(0>t)return D(E(-t));for(var e=[],n=1,i=0;t>=n;i++)e[i]=t/n|0,n*=4294967296;return new B(e,0)},Ec=function(t,e){if(0==t.length)throw Error("number format error: empty string");var n=e||10;if(2>n||n>36)throw Error("radix out of range: "+n);if("-"==t.charAt(0))return D(Ec(t.substring(1),n));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');for(var i=E(Math.pow(n,8)),r=C,o=0;oa?(a=E(Math.pow(n,a)),r=r.multiply(a).add(E(s))):(r=r.multiply(i),r=r.add(E(s)))}return r},C=Dc(0),Fc=Dc(1),Gc=Dc(16777216),Hc=function(t){if(-1==t.g)return-Hc(D(t));for(var e=0,n=1,i=0;it||t>36)throw Error("radix out of range: "+t);if(F(this))return"0";if(-1==this.g)return"-"+D(this).toString(t);for(var e=E(Math.pow(t,6)),n=this,i="";;){var r=Jc(n,e),n=Kc(n,r.multiply(e)),o=((0>>0).toString(t),n=r;if(F(n))return o+i;for(;6>o.length;)o="0"+o;i=""+o+i}};var G=function(t,e){return 0>e?0:e=0?n:4294967296+n},F=function(t){if(0!=t.g)return!1;for(var e=0;en;n++)if(G(this,n)!=G(t,n))return!1;return!0},B.prototype.compare=function(t){return t=Kc(this,t),-1==t.g?-1:F(t)?0:1};var D=function(t){for(var e=t.h.length,n=[],i=0;e>i;i++)n[i]=~t.h[i];return new B(n,~t.g).add(Fc)};B.prototype.add=function(t){for(var e=Math.max(this.h.length,t.h.length),n=[],i=0,r=0;e>=r;r++){var o=i+(65535&G(this,r))+(65535&G(t,r)),a=(o>>>16)+(G(this,r)>>>16)+(G(t,r)>>>16),i=a>>>16,o=65535&o,a=65535&a;n[r]=a<<16|o}return new B(n,-2147483648&n[n.length-1]?-1:0)};var Kc=function(t,e){return t.add(D(e))};B.prototype.multiply=function(t){if(F(this)||F(t))return C;if(-1==this.g)return-1==t.g?D(this).multiply(D(t)):D(D(this).multiply(t));if(-1==t.g)return D(this.multiply(D(t)));if(0>this.compare(Gc)&&0>t.compare(Gc))return E(Hc(this)*Hc(t));for(var e=this.h.length+t.h.length,n=[],i=0;2*e>i;i++)n[i]=0;for(i=0;i>>16,a=65535&G(this,i),s=G(t,r)>>>16,u=65535&G(t,r);n[2*i+2*r]+=a*u,Lc(n,2*i+2*r),n[2*i+2*r+1]+=o*u,Lc(n,2*i+2*r+1),n[2*i+2*r+1]+=a*s,Lc(n,2*i+2*r+1),n[2*i+2*r+2]+=o*s,Lc(n,2*i+2*r+2)}for(i=0;e>i;i++)n[i]=n[2*i+1]<<16|n[2*i];for(i=e;2*e>i;i++)n[i]=0;return new B(n,0)};var Lc=function(t,e){for(;(65535&t[e])!=t[e];)t[e+1]+=t[e]>>>16,t[e]&=65535},Jc=function(t,e){if(F(e))throw Error("division by zero");if(F(t))return C;if(-1==t.g)return-1==e.g?Jc(D(t),D(e)):D(Jc(D(t),e));if(-1==e.g)return D(Jc(t,D(e)));if(30=i.compare(t);)n=n.shiftLeft(1),i=i.shiftLeft(1);for(var r,o=Mc(n,1),a=Mc(i,1),i=Mc(i,2),n=Mc(n,2);!F(i);)r=a.add(i),0>=r.compare(t)&&(o=o.add(n),a=r),i=Mc(i,1),n=Mc(n,1);return o}for(n=C,i=t;0<=i.compare(e);){o=Math.max(1,Math.floor(Hc(i)/Hc(e))),a=Math.ceil(Math.log(o)/Math.LN2),a=48>=a?1:Math.pow(2,a-48),r=E(o);for(var s=r.multiply(e);-1==s.g||0r;r++)i[r]=G(t,r)|G(e,r);return new B(i,t.g|e.g)};B.prototype.shiftLeft=function(t){var e=t>>5;t%=32;for(var n=this.h.length+e+(t>0?1:0),i=[],r=0;n>r;r++)i[r]=t>0?G(this,r-e)<>>32-t:G(this,r-e);return new B(i,this.g)};var Mc=function(t,e){for(var n=e>>5,i=e%32,r=t.h.length-n,o=[],a=0;r>a;a++)o[a]=i>0?G(t,a+n)>>>i|G(t,a+n+1)<<32-i:G(t,a+n);return new B(o,t.g)},Oc=function(t,e){this.cb=t,this.ea=e};Oc.prototype.tb=function(t){return this.ea==t.ea&&this.cb.tb(Ya(t.cb))};var Rc=function(t){try{var e;if(e=0==t.lastIndexOf("[",0)){var n=t.length-1;e=n>=0&&t.indexOf("]",n)==n}return e?new Pc(t.substring(1,t.length-1)):new Qc(t)}catch(i){return null}},Qc=function(t){var e=C;if(t instanceof B){if(0!=t.g||0>t.compare(C)||0r||r>255||1!=n[i].length&&0==n[i].lastIndexOf("0",0))throw Error("In "+t+", octet "+i+" is not valid");r=E(r),e=Nc(e.shiftLeft(8),r)}}Oc.call(this,e,4)};r(Qc,Oc);var Tc=/^[0-9.]*$/,Sc=Kc(Fc.shiftLeft(32),Fc);Qc.prototype.toString=function(){if(this.va)return this.va;for(var t=Ic(this.cb,0),e=[],n=3;n>=0;n--)e[n]=String(255&t),t>>>=8;return this.va=e.join(".")};var Pc=function(t){var e=C;if(t instanceof B){if(0!=t.g||0>t.compare(C)||0>>16&65535).toString(16)),i.push((65535&t).toString(16)),Ja(n,n.length-1),Pa(n,i),t=n.join(":")}if(i=t.split("::"),2r)n=[];else{for(var o=[],a=0;r>a;a++)o[a]="0";n=Na(n,o,i)}}if(8!=n.length)throw Error(t+" is not a valid IPv6 address");for(i=0;ir.compare(C)||0=0;e--){var n=Ic(this.cb,e),i=65535&n;t.push((n>>>16).toString(16)),t.push(i.toString(16))}for(var n=e=-1,r=i=0,o=0;oi&&(i=r,e=n)):(n=-1,r=0);return i>0&&(e+i==t.length&&t.push(""),t.splice(e,i,""),0==e&&(t=[""].concat(t))),this.va=t.join(":")},!gb&&!y||y&&9<=Number(qb)||gb&&z("1.9.1"),y&&z("9");var Yc=function(t,e){Qa(e,function(e,n){"style"==n?t.style.cssText=e:"class"==n?t.className=e:"for"==n?t.htmlFor=e:Xc.hasOwnProperty(n)?t.setAttribute(Xc[n],e):0==n.lastIndexOf("aria-",0)||0==n.lastIndexOf("data-",0)?t.setAttribute(n,e):t[n]=e})},Xc={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"},Zc=function(t,e,n){this.ae=n,this.Cd=t,this.le=e,this.Fb=0,this.Ab=null};Zc.prototype.get=function(){var t;return 01)));a=a.next)r||(o=a);r&&(0==n.A&&1==i?zd(n,e):(o?(i=o,v(n.X),v(null!=i),i.next==n.Fa&&(n.Fa=i),i.next=i.next.next):Ad(n),Bd(n,r,3,e)))}t.l=null}else nd(t,3,e)},xd=function(t,e){t.X||2!=t.A&&3!=t.A||Cd(t),v(null!=e.wa),t.Fa?t.Fa.next=e:t.X=e,t.Fa=e},wd=function(t,e,n,i){var r=rd(null,null,null);return r.child=new H(function(t,o){r.wa=e?function(n){try{var r=e.call(i,n);t(r)}catch(a){o(a)}}:t,r.La=n?function(e){try{var r=n.call(i,e);void 0===r&&e instanceof od?o(e):t(r)}catch(a){o(a)}}:o}),r.child.l=t,xd(t,r),r.child};H.prototype.ve=function(t){v(1==this.A),this.A=0,nd(this,2,t)},H.prototype.we=function(t){v(1==this.A),this.A=0,nd(this,3,t)};var nd=function(t,e,n){0==t.A&&(t==n&&(e=3,n=new TypeError("Promise cannot resolve to itself")),t.A=1,td(n,t.ve,t.we,t)||(t.ca=n,t.A=e,t.l=null,Cd(t),3!=e||n instanceof od||Dd(t,n)))},td=function(t,e,n,i){if(t instanceof H)return null!=e&&Ba(e,"opt_onFulfilled should be a function."),null!=n&&Ba(n,"opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?"),xd(t,rd(e||ba,n||null,i)),!0;if(md(t))return t.then(e,n,i),!0;if(ha(t))try{var r=t.then;if(p(r))return Ed(t,r,e,n,i),!0}catch(o){return n.call(i,o),!0}return!1},Ed=function(t,e,n,i,r){var o=!1,a=function(t){o||(o=!0,n.call(r,t))},s=function(t){o||(o=!0,i.call(r,t))};try{e.call(t,a,s)}catch(u){s(u)}},Cd=function(t){t.cc||(t.cc=!0,jd(t.Gd,t))},Ad=function(t){var e=null;return t.X&&(e=t.X,t.X=e.next,e.next=null),t.X||(t.Fa=null),null!=e&&v(null!=e.wa),e};H.prototype.Gd=function(){for(var t;t=Ad(this);)Bd(this,t,this.A,this.ca);this.cc=!1};var Bd=function(t,e,n,i){if(3==n&&e.La&&!e.Wa)for(;t&&t.yb;t=t.l)t.yb=!1;if(e.child)e.child.l=null,Fd(e,n,i);else try{e.Wa?e.wa.call(e.context):Fd(e,n,i)}catch(r){Gd.call(null,r)}qd.put(e)},Fd=function(t,e,n){2==e?t.wa.call(t.context,n):t.La&&t.La.call(t.context,n)},Dd=function(t,e){t.yb=!0,jd(function(){t.yb&&Gd.call(null,e)})},Gd=$c,od=function(e){t.call(this,e)};r(od,t),od.prototype.name="cancel";var Hd=function(t,e){this.Mb=[],this.Zc=t,this.Hc=e||null,this.$a=this.Ia=!1,this.ca=void 0,this.wc=this.Ac=this.Xb=!1,this.Rb=0,this.l=null,this.Yb=0};Hd.prototype.cancel=function(t){if(this.Ia)this.ca instanceof Hd&&this.ca.cancel();else{if(this.l){var e=this.l;delete this.l,t?e.cancel(t):(e.Yb--,0>=e.Yb&&e.cancel())}this.Zc?this.Zc.call(this.Hc,this):this.wc=!0,this.Ia||Id(this,new Jd)}},Hd.prototype.Gc=function(t,e){this.Xb=!1,Kd(this,t,e)};var Kd=function(t,e,n){t.Ia=!0,t.ca=n,t.$a=!e,Ld(t)},Nd=function(t){if(t.Ia){if(!t.wc)throw new Md;t.wc=!1}};Hd.prototype.callback=function(t){Nd(this),Od(t),Kd(this,!0,t)};var Id=function(t,e){Nd(t),Od(e),Kd(t,!1,e)},Od=function(t){v(!(t instanceof Hd),"An execution sequence may not be initiated with a blocking Deferred.")},Qd=function(t,e){Pd(t,null,e,void 0)},Pd=function(t,e,n,i){v(!t.Ac,"Blocking Deferreds can not be re-used"),t.Mb.push([e,n,i]),t.Ia&&Ld(t)};Hd.prototype.then=function(t,e,n){var i,r,o=new H(function(t,e){i=t,r=e});return Pd(this,i,function(t){t instanceof Jd?o.cancel():r(t)}),o.then(t,e,n)},ld(Hd);var Rd=function(t){return Fa(t.Mb,function(t){return p(t[1])})},Ld=function(t){if(t.Rb&&t.Ia&&Rd(t)){var e=t.Rb,n=Sd[e];n&&(l.clearTimeout(n.ab),delete Sd[e]),t.Rb=0}t.l&&(t.l.Yb--,delete t.l);for(var e=t.ca,i=n=!1;t.Mb.length&&!t.Xb;){var r=t.Mb.shift(),o=r[0],a=r[1],r=r[2];if(o=t.$a?a:o)try{var s=o.call(r||t.Hc,e);void 0!==s&&(t.$a=t.$a&&(s==e||s instanceof Error),t.ca=e=s),(md(e)||"function"==typeof l.Promise&&e instanceof l.Promise)&&(i=!0,t.Xb=!0)}catch(u){e=u,t.$a=!0,Rd(t)||(n=!0)}}t.ca=e,i&&(s=q(t.Gc,t,!0),i=q(t.Gc,t,!1),e instanceof Hd?(Pd(e,s,i),e.Ac=!0):e.then(s,i)),n&&(e=new Td(e),Sd[e.ab]=e,t.Rb=e.ab)},Md=function(){t.call(this)};r(Md,t),Md.prototype.message="Deferred has already fired",Md.prototype.name="AlreadyCalledError";var Jd=function(){t.call(this)};r(Jd,t),Jd.prototype.message="Deferred was canceled",Jd.prototype.name="CanceledError";var Td=function(t){this.ab=l.setTimeout(q(this.ue,this),0),this.D=t};Td.prototype.ue=function(){throw v(Sd[this.ab],"Cannot throw an error that is not scheduled."),delete Sd[this.ab],this.D};var Sd={},Yd=function(t){var e={},n=e.document||document,i=document.createElement("SCRIPT"),r={hd:i,ob:void 0},o=new Hd(Ud,r),a=null,s=null!=e.timeout?e.timeout:5e3;return s>0&&(a=window.setTimeout(function(){Vd(i,!0),Id(o,new Wd(1,"Timeout reached for loading script "+t))},s),r.ob=a),i.onload=i.onreadystatechange=function(){i.readyState&&"loaded"!=i.readyState&&"complete"!=i.readyState||(Vd(i,e.Be||!1,a),o.callback(null))},i.onerror=function(){Vd(i,!0,a),Id(o,new Wd(0,"Error while loading script "+t))},r=e.attributes||{},$a(r,{type:"text/javascript",charset:"UTF-8",src:t}),Yc(i,r),Xd(n).appendChild(i),o},Xd=function(t){var e=t.getElementsByTagName("HEAD");return e&&0!=e.length?e[0]:t.documentElement},Ud=function(){if(this&&this.hd){var t=this.hd;t&&"SCRIPT"==t.tagName&&Vd(t,!0,this.ob)}},Vd=function(t,e,n){null!=n&&l.clearTimeout(n),t.onload=ba,t.onerror=ba,t.onreadystatechange=ba,e&&window.setTimeout(function(){t&&t.parentNode&&t.parentNode.removeChild(t)},0)},Wd=function(e,n){var i="Jsloader error (code #"+e+")";n&&(i+=": "+n),t.call(this,i),this.code=e};r(Wd,t);var J=function(){Lb.call(this),this.O=new Sb(this),this.yd=this,this.lc=null};r(J,Lb),J.prototype[Ob]=!0,J.prototype.addEventListener=function(t,e,n,i){Yb(this,t,e,n,i)},J.prototype.removeEventListener=function(t,e,n,i){hc(this,t,e,n,i)},J.prototype.dispatchEvent=function(t){Zd(this);var e,i=this.lc;if(i){e=[];for(var r=1;i;i=i.lc)e.push(i),v(1e3>++r,"infinite loop")}if(i=this.yd,r=t.type||t,n(t))t=new Mb(t,i);else if(t instanceof Mb)t.target=t.target||i;else{var o=t;t=new Mb(r,i),$a(t,o)}var a,o=!0;if(e)for(var s=e.length-1;!t.Na&&s>=0;s--)a=t.currentTarget=e[s],o=$d(a,r,!0,t)&&o;if(t.Na||(a=t.currentTarget=i,o=$d(a,r,!0,t)&&o,t.Na||(o=$d(a,r,!1,t)&&o)),e)for(s=0;!t.Na&&s=t.length)throw ae;if(e in t)return t[e++];e++}},n}throw Error("Not implemented")},de=function(t,e){if(fa(t))try{w(t,e,void 0)}catch(n){if(n!==ae)throw n}else{t=ce(t);try{for(;;)e.call(void 0,t.next(),void 0,t)}catch(n){if(n!==ae)throw n}}},ee=function(t,e){this.P={},this.m=[],this.ea=this.i=0;var n=arguments.length;if(n>1){if(n%2)throw Error("Uneven number of arguments");for(var i=0;n>i;i+=2)this.set(arguments[i],arguments[i+1])}else t&&this.addAll(t)};k=ee.prototype,k.wb=function(){return this.i},k.J=function(){fe(this);for(var t=[],e=0;e2*this.i&&fe(this),!0):!1};var fe=function(t){if(t.i!=t.m.length){for(var e=0,n=0;e=i.m.length)throw ae;var r=i.m[e++];return t?r:i.P[r]},r};var ge=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},ie=function(t){if(t.J&&"function"==typeof t.J)return t.J();if(n(t))return t.split("");if(fa(t)){for(var e=[],i=t.length,r=0;i>r;r++)e.push(t[r]);return e}return Ra(t)},je=function(t){if(t.Y&&"function"==typeof t.Y)return t.Y();if(!t.J||"function"!=typeof t.J){if(fa(t)||n(t)){var e=[];t=t.length;for(var i=0;t>i;i++)e.push(i);return e}return Sa(t)}},ke=function(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(fa(t)||n(t))w(t,e,void 0);else for(var i=je(t),r=ie(t),o=r.length,a=0;o>a;a++)e.call(void 0,r[a],i&&i[a],t)},le=function(t,e,n,i,r){this.reset(t,e,n,i,r)};le.prototype.Jc=null;var me=0;le.prototype.reset=function(t,e,n,i,r){"number"==typeof r||me++,i||la(),this.gb=t,this.de=e,delete this.Jc},le.prototype.kd=function(t){this.gb=t};var ne=function(t){this.ee=t,this.Pc=this.Zb=this.gb=this.l=null},oe=function(t,e){this.name=t,this.value=e};oe.prototype.toString=function(){return this.name};var pe=new oe("SEVERE",1e3),qe=new oe("CONFIG",700),re=new oe("FINE",500);ne.prototype.getParent=function(){return this.l},ne.prototype.kd=function(t){this.gb=t};var se=function(t){return t.gb?t.gb:t.l?se(t.l):(ya("Root logger has no level set."),null)};ne.prototype.log=function(t,e,n){if(t.value>=se(this).value)for(p(e)&&(e=e()),t=new le(t,String(e),this.ee),n&&(t.Jc=n),n="log:"+t.de,l.console&&(l.console.timeStamp?l.console.timeStamp(n):l.console.markTimeline&&l.console.markTimeline(n)),l.msWriteProfilerMark&&l.msWriteProfilerMark(n),n=this;n;){e=n;var i=t;if(e.Pc)for(var r,o=0;r=e.Pc[o];o++)r(i);n=n.getParent()}};var te={},ue=null,ve=function(t){ue||(ue=new ne(""),te[""]=ue,ue.kd(qe));var e;if(!(e=te[t])){e=new ne(t);var n=t.lastIndexOf("."),i=t.substr(n+1),n=ve(t.substr(0,n));n.Zb||(n.Zb={}),n.Zb[i]=e,e.l=n,te[t]=e}return e},K=function(t,e){t&&t.log(re,e,void 0)},we=function(t,e,n){if(p(t))n&&(t=q(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=q(t.handleEvent,t)}return 2147483647=0?(r=n[i].substring(0,o),a=n[i].substring(o+1)):r=n[i],e(r,a?decodeURIComponent(a.replace(/\+/g," ")):"")}},L=function(t){J.call(this),this.headers=new ee,this.Vb=t||null,this.ga=!1,this.Ub=this.a=null,this.fb=this.Wc=this.Cb="",this.ua=this.jc=this.Bb=this.bc=!1,this.Sa=0,this.Qb=null,this.fd="",this.Sb=this.ke=this.ye=!1};r(L,J);var Ae=L.prototype,Be=ve("goog.net.XhrIo");Ae.L=Be;var Ce=/^https?$/i,De=["POST","PUT"];L.prototype.send=function(t,e,n,i){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.Cb+"; newUri="+t);e=e?e.toUpperCase():"GET",this.Cb=t,this.fb="",this.Wc=e,this.bc=!1,this.ga=!0,this.a=this.Vb?this.Vb.$b():wc.$b(),this.Ub=vc(this.Vb?this.Vb:wc),this.a.onreadystatechange=q(this.ad,this),this.ke&&"onprogress"in this.a&&(this.a.onprogress=q(function(t){this.$c(t,!0)},this),this.a.upload&&(this.a.upload.onprogress=q(this.$c,this)));try{K(this.L,Ee(this,"Opening Xhr")),this.jc=!0,this.a.open(e,String(t),!0),this.jc=!1}catch(r){return K(this.L,Ee(this,"Error opening Xhr: "+r.message)),void this.D(5,r)}t=n||"";var o=this.headers.clone();i&&ke(i,function(t,e){o.set(e,t)}),i=Ha(o.Y()),n=l.FormData&&t instanceof l.FormData,!Ia(De,e)||i||n||o.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),o.forEach(function(t,e){this.a.setRequestHeader(e,t)},this),this.fd&&(this.a.responseType=this.fd),Ta(this.a)&&(this.a.withCredentials=this.ye);try{Fe(this),0e)throw Error("Bad port number "+e);t.Ma=e}else t.Ma=null},Re=function(t,e,n){M(t),t.ka=n?Te(e,!0):e},Se=function(t,e,n){M(t),e instanceof N?(t.S=e,t.S.vc(t.F)):(n||(e=Ue(e,Ze)),t.S=new N(e,0,t.F))},O=function(t,e,n){M(t),t.S.set(e,n)},M=function(t){if(t.$d)throw Error("Tried to modify a read-only Uri")};Ne.prototype.vc=function(t){return this.F=t,this.S&&this.S.vc(t),this};var $e=function(t,e){var n=new Ne(null,void 0);return Oe(n,"https"),t&&Pe(n,t),e&&Re(n,e),n},Te=function(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""},Ue=function(t,e,i){return n(t)?(t=encodeURI(t).replace(e,af),i&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null},af=function(t){return t=t.charCodeAt(0),"%"+(t>>4&15).toString(16)+(15&t).toString(16)},Ve=/[#\/\?@]/g,Xe=/[\#\?:]/g,We=/[\#\?]/g,Ze=/[\#\?@]/g,Ye=/#/g,N=function(t,e,n){this.i=this.j=null,this.C=t||null,this.F=!!n},bf=function(t){t.j||(t.j=new ee,t.i=0,t.C&&ze(t.C,function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n); -}))},df=function(t){var e=je(t);if("undefined"==typeof e)throw Error("Keys are undefined");var n=new N(null,0,void 0);t=ie(t);for(var i=0;i0?a:0,left:s>0?s:0,location:!0,resizable:!0,statusbar:!0,toolbar:!1};i&&(r.target=i),navigator.userAgent&&-1!=navigator.userAgent.indexOf("Firefox/")&&(n=n||"http://localhost");var l,o=n||"about:blank";(i=r)||(i={}),n=window,r=o instanceof A?o:Db("undefined"!=typeof o.href?o.href:String(o)),o=i.target||o.target,a=[];for(l in i)switch(l){case"width":case"height":case"top":case"left":a.push(l+"="+i[l]);break;case"target":case"noreferrer":break;default:a.push(l+"="+(i[l]?1:0))}if(l=a.join(","),(x("iPhone")&&!x("iPod")&&!x("iPad")||x("iPad")||x("iPod"))&&n.navigator&&n.navigator.standalone&&o&&"_self"!=o?(l=n.document.createElement("A"),r=r instanceof A?r:Db(r),l.href=Ab(r),l.setAttribute("target",o),i.noreferrer&&l.setAttribute("rel","noreferrer"),i=document.createEvent("MouseEvent"),i.initMouseEvent("click",!0,!0,n,1),l.dispatchEvent(i),l={}):i.noreferrer?(l=n.open("",o,l),i=Ab(r),l&&(fb&&u(i,";")&&(i="'"+i.replace(/'/g,"%27")+"'"),l.opener=null,n=new xb,n.Pb="b/12014412, meta tag with sanitized URL",ua.test(i)&&(-1!=i.indexOf("&")&&(i=i.replace(oa,"&")),-1!=i.indexOf("<")&&(i=i.replace(pa,"<")),-1!=i.indexOf(">")&&(i=i.replace(qa,">")),-1!=i.indexOf('"')&&(i=i.replace(ra,""")),-1!=i.indexOf("'")&&(i=i.replace(sa,"'")),-1!=i.indexOf("\x00")&&(i=i.replace(ta,"�"))),i='',Aa(yb(n),"must provide justification"),v(!/^[\s\xa0]*$/.test(yb(n)),"must provide non-empty justification"),l.document.write(Gb((new Fb).Zd(i))),l.document.close())):l=n.open(Ab(r),o,l),l)try{l.focus()}catch(c){}return l},gf=function(t){return new H(function(e){var n=function(){xe(2e3).then(function(){return t&&!t.closed?n():void e()})};return n()})},hf=function(){var t=null;return new H(function(e){"complete"==l.document.readyState?e():(t=function(){e()},fc(window,"load",t))}).I(function(e){throw hc(window,"load",t),e})},jf=function(){var t=navigator.userAgent,e=t.toLowerCase();return u(e,"opera/")||u(e,"opr/")||u(e,"opios/")?"Opera":u(e,"msie")||u(e,"trident/")?"IE":u(e,"edge/")?"Edge":u(e,"firefox/")?"Firefox":u(e,"silk/")?"Silk":u(e,"safari/")&&!u(e,"chrome/")?"Safari":!u(e,"chrome/")&&!u(e,"crios/")||u(e,"edge/")?(t=t.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==t.length?t[1]:"Other":"Chrome"},kf=function(t){return jf()+"/JsCore/"+t},lf=function(t){t=t.split(".");for(var e=l,n=0;n9?t=q(t.re,t):(Of||(Of=new H(function(t,e){Pf(t,e)})),t=q(t.qe,t)),t(e,n,i,r,o,a)};T.prototype.re=function(t,e,n,i,r,o){var a,s=new L(this.Bd);o&&(s.Sa=Math.max(0,o),a=setTimeout(function(){s.dispatchEvent("timeout")},o)),$b(s,"complete",function(){a&&clearTimeout(a);var t=null;try{var n;n=this.a?nc(this.a.responseText):void 0,t=n||null}catch(i){t=null}e&&e(t)}),gc(s,"ready",function(){a&&clearTimeout(a),this.ra||(this.ra=!0,this.Ga())}),gc(s,"timeout",function(){a&&clearTimeout(a),this.ra||(this.ra=!0,this.Ga()),e&&e(null)}),s.send(t,n,i,r)};var Rf="__fcb"+Math.floor(1e6*Math.random()).toString(),Pf=function(t,e){((window.gapi||{}).client||{}).request?t():(l[Rf]=function(){((window.gapi||{}).client||{}).request?t():e(Error("CORS_UNSUPPORTED"))},Qd(Yd("//apis.google.com/js/client.js?onload="+Rf),function(){e(Error("CORS_UNSUPPORTED"))}))};T.prototype.qe=function(t,e,n,i,r){var o=this;Of.then(function(){window.gapi.client.setApiKey(o.u);var a=window.gapi.auth.getToken();window.gapi.auth.setToken(null),window.gapi.client.request({path:t,method:n,body:i,headers:r,authType:"none",callback:function(t){window.gapi.auth.setToken(a),e&&e(t)}})}).I(function(t){e&&e({error:{message:t&&t.message||"CORS_UNSUPPORTED"}})})};var Tf=function(t,e){return new H(function(n,i){"refresh_token"==e.grant_type&&e.refresh_token||"authorization_code"==e.grant_type&&e.code?Qf(t,t.ne+"?key="+encodeURIComponent(t.u),function(t){t?t.error?i(Sf(t)):t.access_token&&t.refresh_token?n(t):i(new Q("internal-error")):i(new Q("network-request-failed"))},"POST",df(e).toString(),t.oe,t.pe):i(new Q("internal-error"))})},Uf=function(t){var e,n={};for(e in t)null!==t[e]&&void 0!==t[e]&&(n[e]=t[e]);return qc(n)},Vf=function(t,e,n,i,r){var o=t.Jd+e+"?key="+encodeURIComponent(t.u);return r&&(o+="&cb="+la().toString()),new H(function(e,r){Qf(t,o,function(t){t?t.error?r(Sf(t)):e(t):r(new Q("network-request-failed"))},n,Uf(i),t.Lc,t.Kd)})},Wf=function(t){if(!mc.test(t.email))throw new Q("invalid-email")},Xf=function(t){"email"in t&&Wf(t)},Zf=function(t,e){return R(t,Yf,{identifier:e,continueUri:window.location.href}).then(function(t){return t.allProviders||[]})},ag=function(t){return R(t,$f,{}).then(function(t){return t.authorizedDomains||[]})},bg=function(t){if(!t.idToken)throw new Q("internal-error")};T.prototype.signInAnonymously=function(){return R(this,cg,{})},T.prototype.updateEmail=function(t,e){return R(this,dg,{idToken:t,email:e})},T.prototype.updatePassword=function(t,e){return R(this,Hf,{idToken:t,password:e})};var eg={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};T.prototype.updateProfile=function(t,e){var n={idToken:t},i=[];return Qa(eg,function(t,r){var o=e[r];null===o?i.push(t):r in e&&(n[r]=o)}),i.length&&(n.deleteAttribute=i),R(this,dg,n)},T.prototype.sendPasswordResetEmail=function(t){return R(this,fg,{requestType:"PASSWORD_RESET",email:t})},T.prototype.sendEmailVerification=function(t){return R(this,gg,{requestType:"VERIFY_EMAIL",idToken:t})};var ig=function(t,e,n){return R(t,hg,{idToken:e,deleteProvider:n})},jg=function(t){if(!t.requestUri||!t.sessionId&&!t.postBody)throw new Q("internal-error")},kg=function(t){if(t.needConfirmation)throw(t&&t.email?new Lf(t.email,Kf(t),t.message):null)||new Q("account-exists-with-different-credential");if(!t.idToken)throw new Q("internal-error")},xf=function(t,e){return R(t,lg,e)},mg=function(t){if(!t.oobCode)throw new Q("invalid-action-code")};T.prototype.confirmPasswordReset=function(t,e){return R(this,ng,{oobCode:t,newPassword:e})},T.prototype.checkActionCode=function(t){return R(this,og,{oobCode:t})},T.prototype.applyActionCode=function(t){return R(this,pg,{oobCode:t})};var pg={endpoint:"setAccountInfo",w:mg,Ra:"email"},og={endpoint:"resetPassword",w:mg,la:function(t){if(!mc.test(t.email))throw new Q("internal-error")}},qg={endpoint:"signupNewUser",w:function(t){if(Wf(t),!t.password)throw new Q("weak-password")},la:bg,ma:!0},Yf={endpoint:"createAuthUri"},rg={endpoint:"deleteAccount",Qa:["idToken"]},hg={endpoint:"setAccountInfo",Qa:["idToken","deleteProvider"],w:function(t){if(!ea(t.deleteProvider))throw new Q("internal-error")}},sg={endpoint:"getAccountInfo"},gg={endpoint:"getOobConfirmationCode",Qa:["idToken","requestType"],w:function(t){if("VERIFY_EMAIL"!=t.requestType)throw new Q("internal-error")},Ra:"email"},fg={endpoint:"getOobConfirmationCode",Qa:["requestType"],w:function(t){if("PASSWORD_RESET"!=t.requestType)throw new Q("internal-error");Wf(t)},Ra:"email"},$f={Ad:!0,endpoint:"getProjectConfig",Sd:"GET"},ng={endpoint:"resetPassword",w:mg,Ra:"email"},dg={endpoint:"setAccountInfo",Qa:["idToken"],w:Xf,ma:!0},Hf={endpoint:"setAccountInfo",Qa:["idToken"],w:function(t){if(Xf(t),!t.password)throw new Q("weak-password")},la:bg,ma:!0},cg={endpoint:"signupNewUser",la:bg,ma:!0},lg={endpoint:"verifyAssertion",w:jg,la:kg,ma:!0},zf={endpoint:"verifyAssertion",w:function(t){if(jg(t),!t.idToken)throw new Q("internal-error")},la:kg,ma:!0},tg={endpoint:"verifyCustomToken",w:function(t){if(!t.token)throw new Q("invalid-custom-token")},la:bg,ma:!0},Gf={endpoint:"verifyPassword",w:function(t){if(Wf(t),!t.password)throw new Q("wrong-password")},la:bg,ma:!0},R=function(t,e,n){if(!qf(n,e.Qa))return sd(new Q("internal-error"));var i,r=e.Sd||"POST";return I(n).then(e.w).then(function(){return e.ma&&(n.returnSecureToken=!0),Vf(t,e.endpoint,r,n,e.Ad||!1)}).then(function(t){return i=t}).then(e.la).then(function(){if(!e.Ra)return i;if(!(e.Ra in i))throw new Q("internal-error");return i[e.Ra]})},Sf=function(t){var e;e=(t.error&&t.error.errors&&t.error.errors[0]||{}).reason||"";var n={keyInvalid:"invalid-api-key",ipRefererBlocked:"app-not-authorized"};if(e=n[e]?new Q(n[e]):null)return e;if(t=t.error&&t.error.message||"",e={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",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"},e[t])return new Q(e[t]);e={TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",WEAK_PASSWORD:"weak-password",OPERATION_NOT_ALLOWED:"operation-not-allowed"};for(var i in e)if(0===t.indexOf(i))return new Q(e[i]);return new Q("internal-error")},ug=function(t){this.G=t};ug.prototype.value=function(){return this.G},ug.prototype.ld=function(t){return this.G.style=t,this};var vg=function(t){this.G=t||{}};vg.prototype.value=function(){return this.G},vg.prototype.ld=function(t){return this.G.style=t,this};var xg=function(t){this.xe=t,this.hc=null,this.he=wg(this)},yg,zg=function(t){var e=new vg;return e.G.where=document.body,e.G.url=t.xe,e.G.messageHandlersFilter=lf("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"),e.G.attributes=e.G.attributes||{},new ug(e.G.attributes).ld({position:"absolute",top:"-100px",width:"1px",height:"1px"}),e.G.dontclear=!0,e},wg=function(t){return Ag().then(function(){return new H(function(e){lf("gapi.iframes.getContext")().open(zg(t).value(),function(n){t.hc=n,t.hc.restyle({setHideOnLeave:!1}),e()})})})},Bg=function(t,e){t.he.then(function(){t.hc.register("authEvent",e,lf("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})},Cg="__iframefcb"+Math.floor(1e6*Math.random()).toString(),Ag=function(){return yg?yg:yg=new H(function(t,e){var n=function(){lf("gapi.load")("gapi.iframes",function(){t()})};lf("gapi.iframes.Iframe")?t():lf("gapi.load")?n():(l[Cg]=function(){lf("gapi.load")?n():e()},Qd(Yd("//apis.google.com/js/api.js?onload="+Cg),function(){e()}))})},Eg=function(t,e,n,i){this.ha=t,this.u=e,this.W=n,i=this.qa=i||null,t=$e(t,"/__/auth/iframe"),O(t,"apiKey",e),O(t,"appName",n),i&&O(t,"v",i),this.Ud=t.toString(),this.Vd=new xg(this.Ud),this.Wb=[],Dg(this)},Fg=function(t,e,n,i,r,o,a,s,u){return t=$e(t,"/__/auth/handler"),O(t,"apiKey",e),O(t,"appName",n),O(t,"authType",i),O(t,"providerId",r),o&&o.length&&O(t,"scopes",o.join(",")),a&&O(t,"redirectUrl",a),s&&O(t,"eventId",s),u&&O(t,"v",u),t.toString()},Dg=function(t){Bg(t.Vd,function(e){var n={};if(e&&e.authEvent){var i=!1;if(e=e.authEvent||{},e.type){if(n=e.error)var r=(n=e.error)&&(n.name||n.code),n=r?new Q(r.substring(5),n.message):null;e=new uf(e.type,e.eventId,e.urlResponse,e.sessionId,n)}else e=null;for(n=0;n=i.length)throw ae;var r=Aa(i.key(e++));if(t)return r;if(r=i.getItem(r),!n(r))throw"Storage mechanism: Invalid value was encountered";return r},r},k.key=function(t){return this.H.key(t)};var Lg=function(){var t=null;try{t=window.localStorage||null}catch(e){}this.H=t};r(Lg,Jg);var Mg=function(){var t=null;try{t=window.sessionStorage||null}catch(e){}this.H=t};r(Mg,Jg);var Ng="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" "),U=function(t,e){return{name:t||"",U:"a valid string",optional:!!e,V:n}},Og=function(t){return{name:t||"",U:"a valid object",optional:!1,V:ha}},Pg=function(t,e){return{name:t||"",U:"a function",optional:!!e,V:p}},Qg=function(){return{name:"",U:"null",optional:!1,V:da}},Rg=function(){return{name:"credential",U:"a valid credential",optional:!1,V:function(t){return!(!t||!t.xb)}}},Sg=function(){return{name:"authProvider",U:"a valid Auth provider",optional:!1,V:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}},Tg=function(t,e,n,i){return{name:n||"",U:t.U+" or "+e.U,optional:!!i,V:function(n){return t.V(n)||e.V(n)}}},Vg=function(t,e){for(var n in e){var i=e[n].name;t[i]=Ug(i,t[n],e[n].b)}},V=function(t,e,n,i){t[e]=Ug(e,n,i)},Ug=function(t,e,n){if(!n)return e;var i=Wg(t);t=function(){var t,r=Array.prototype.slice.call(arguments);t:{t=Array.prototype.slice.call(r);var o;o=0;for(var a=!1,s=0;so||o>=Ng.length)throw new Q("internal-error","Argument validator received an unsupported number of arguments.");t=Ng[o]+" argument "+(t.name?'"'+t.name+'" ':"")+"must be "+t.U+".";break t}t=null}}if(t)throw new Q("argument-error",i+" failed: "+t);return e.apply(this,r)};for(var r in e)t[r]=e[r];for(r in e.prototype)t.prototype[r]=e.prototype[r];return t},Wg=function(t){return t=t.split("."),t[t.length-1]},$g=function(t,e,n){var i=(this.qa=firebase.SDK_VERSION||null)?kf(this.qa):null;this.c=new T(e,null,i),this.bd=Xg(this.c),this.ha=t,this.u=e,this.W=n,this.nb=[],this.Tc=!1,this.zd=q(this.Md,this),this.lb=new Yg,this.dd=new Zg,this.Ta={},this.Ta.unknown=this.lb,this.Ta.signInViaRedirect=this.lb,this.Ta.linkViaRedirect=this.lb,this.Ta.signInViaPopup=this.dd,this.Ta.linkViaPopup=this.dd},Xg=function(t){var e=window.location.href;return ag(t).then(function(t){t:{for(var n=(e instanceof Ne?e.clone():new Ne(e,void 0)).ia,i=0;ithis.Ha-3e4?this.ba?mh(this,{grant_type:"refresh_token",refresh_token:this.ba}):I(null):I({accessToken:this.Ea,expirationTime:this.Ha,refreshToken:this.ba})};var nh=function(t,e,n,i,r){of(this,{uid:t,displayName:i||null,photoURL:r||null,email:n||null,providerId:e})},oh=function(t,e){Mb.call(this,t);for(var n in e)this[n]=e[n]};r(oh,Mb);var W=function(t,e,n){this.M=[],this.u=t.apiKey,this.W=t.appName,this.ha=t.authDomain||null,t=firebase.SDK_VERSION?kf(firebase.SDK_VERSION):null,this.c=new T(this.u,null,t),this.oa=new jh(this.c),ph(this,e.idToken),lh(this.oa,e),P(this,"refreshToken",this.oa.ba),qh(this,n||{}),J.call(this),this.Hb=!1,this.ha&&(this.o=hh(this.ha,this.u,this.W)),this.Nb=[]};r(W,J);var ph=function(t,e){t.Vc=e,P(t,"_lat",e)},rh=function(t,e){La(t.Nb,function(t){return t==e})},sh=function(t){for(var e=[],n=0;no;o++)i+=".";try{var a=nc(ub(i));if(a.sub&&a.iss&&a.aud&&a.exp){n=new vf(a);break t}}catch(s){}}n=null}if(!n||e.uid!=n.be)throw new Q("user-mismatch");return Dh(e,t),e.reload()}))};var Fh=function(t,e){return Ah(t).then(function(){return Ia(wh(t),e)?sh(t).then(function(){throw new Q("provider-already-linked")}):void 0})};k=W.prototype,k.link=function(t){var e=this;return this.f(Fh(this,t.provider).then(function(){return e.getToken()}).then(function(n){return t.Xc(e.c,n)}).then(q(this.Kc,this)))},k.Kc=function(t){Dh(this,t);var e=this;return this.reload().then(function(){return e})},k.updateEmail=function(t){var e=this;return this.f(this.getToken().then(function(n){return e.c.updateEmail(n,t)}).then(function(t){return Dh(e,t),e.reload()}))},k.updatePassword=function(t){var e=this;return this.f(this.getToken().then(function(n){return e.c.updatePassword(n,t)}).then(function(t){return Dh(e,t),e.reload()}))},k.updateProfile=function(t){if(void 0===t.displayName&&void 0===t.photoURL)return vh(this);var e=this;return this.f(this.getToken().then(function(n){return e.c.updateProfile(n,{displayName:t.displayName,photoUrl:t.photoURL})}).then(function(t){return Dh(e,t),zh(e,"displayName",t.displayName||null),zh(e,"photoURL",t.photoUrl||null),sh(e)}).then(uh))},k.unlink=function(t){var e=this;return this.f(Ah(this).then(function(n){return Ia(wh(e),t)?ig(e.c,n,[t]).then(function(t){var n={};return w(t.providerUserInfo||[],function(t){n[t.providerId]=!0}),w(wh(e),function(t){n[t]||xh(e,t)}),sh(e)}):sh(e).then(function(){throw new Q("no-such-provider")})}))},k["delete"]=function(){var t=this;return this.f(this.getToken().then(function(e){return R(t.c,rg,{idToken:e})}).then(function(){t.dispatchEvent(new oh("userDeleted"))})).then(function(){Ch(t)})},k.Ec=function(t,e){return!!("linkViaPopup"==t&&(this.$||null)==e&&this.R||"linkViaRedirect"==t&&(this.Jb||null)==e)},k.Ba=function(t,e,n,i){"linkViaPopup"==t&&i==(this.$||null)&&(n&&this.xa?this.xa(n):e&&!n&&this.R&&this.R(e),this.ya&&(this.ya.cancel(),this.ya=null),delete this.R,delete this.xa)},k.Za=function(t,e){return"linkViaPopup"==t&&e==(this.$||null)||"linkViaRedirect"==t&&(this.Jb||null)==e?q(this.Hd,this):null},k.vb=function(){return this.uid+":::"+Math.floor(1e9*Math.random()).toString()},k.linkWithPopup=function(t){var e=this,n=sf(t.providerId),i=ff(n&&n.kb,n&&n.jb),r=this.vb(),n=Fh(this,t.providerId).then(function(){return sh(e)}).then(function(){return e.Ja(),e.getToken()}).then(function(){return dh(e.o,i,"linkViaPopup",t,r)}).then(function(t){return new H(function(n,i){e.Ba("linkViaPopup",null,new Q("cancelled-popup-request"),e.$||null),e.R=n,e.xa=i,e.$=r,e.ya=fh(e,"linkViaPopup",t,r)})}).then(function(t){return i&&(i||window).close(),t}).I(function(t){throw i&&(i||window).close(),t});return this.f(n)},k.linkWithRedirect=function(t){var e=this,n=null,i=this.vb(),r=Fh(this,t.providerId).then(function(){return e.Ja(),e.getToken()}).then(function(){return e.Jb=i,sh(e)}).then(function(t){return e.za&&(t=e.u+":"+e.W,t=Gh(e.za,Hh,e.N(),t)),t}).then(function(){return eh(e.o,"linkViaRedirect",t,i)}).I(function(t){if(n=t,e.za)return Ih(e.za,Hh,e.u+":"+e.W);throw n}).then(function(){if(n)throw n});return this.f(r)},k.Ja=function(){if(this.o&&this.Hb)return this.o;if(this.o&&!this.Hb)throw new Q("internal-error");throw new Q("auth-domain-config-required")},k.Hd=function(t,e){var n=this,i=null,r=this.getToken().then(function(i){return R(n.c,zf,{requestUri:t,sessionId:e,idToken:i})}).then(function(t){return i=Kf(t),n.Kc(t)}).then(function(t){return{user:t,credential:i}});return this.f(r)},k.sendEmailVerification=function(){var t=this;return this.f(this.getToken().then(function(e){return t.c.sendEmailVerification(e)}).then(function(e){return t.email!=e?t.reload():void 0}).then(function(){}))};var Ch=function(t){for(var e=0;er;r++)i[r]=e.charCodeAt(n)<<24|e.charCodeAt(n+1)<<16|e.charCodeAt(n+2)<<8|e.charCodeAt(n+3),n+=4;else for(r=0;16>r;r++)i[r]=e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3],n+=4;for(r=16;80>r;r++){var o=i[r-3]^i[r-8]^i[r-14]^i[r-16];i[r]=4294967295&(o<<1|o>>>31)}e=t.N[0],n=t.N[1];for(var a,s=t.N[2],u=t.N[3],l=t.N[4],r=0;80>r;r++)40>r?20>r?(o=u^n&(s^u),a=1518500249):(o=n^s^u,a=1859775393):60>r?(o=n&s|u&(n|s),a=2400959708):(o=n^s^u,a=3395469782),o=(e<<5|e>>>27)+o+l+a+i[r]&4294967295,l=u,u=s,s=4294967295&(n<<30|n>>>2),n=e,e=o;t.N[0]=t.N[0]+e&4294967295,t.N[1]=t.N[1]+n&4294967295,t.N[2]=t.N[2]+s&4294967295,t.N[3]=t.N[3]+u&4294967295,t.N[4]=t.N[4]+l&4294967295}function t(t,e){for(var n in t)e.call(void 0,t[n],n,t)}function oa(t,e){var n,i={};for(n in t)i[n]=e.call(void 0,t[n],n,t);return i}function pa(t,e){for(var n in t)if(!e.call(void 0,t[n],n,t))return!1;return!0}function qa(t){var e,n=0;for(e in t)n++;return n}function ra(t){for(var e in t)return e}function sa(t){var e,n=[],i=0;for(e in t)n[i++]=t[e];return n}function ta(t){var e,n=[],i=0;for(e in t)n[i++]=e;return n}function ua(t,e){for(var n in t)if(t[n]==e)return!0;return!1}function va(t,e,n){for(var i in t)if(e.call(n,t[i],i,t))return i}function wa(t,e){var n=va(t,e,void 0);return n&&t[n]}function xa(t){for(var e in t)return!1;return!0}function ya(t){var e,n={};for(e in t)n[e]=t[e];return n}function za(a){if(a=String(a),/^\s*$/.test(a)?0:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,"")))try{return eval("("+a+")")}catch(b){}throw Error("Invalid JSON string: "+a)}function Aa(){this.Fd=void 0}function Ba(t,e,n){switch(typeof e){case"string":Ca(e,n);break;case"number":n.push(isFinite(e)&&!isNaN(e)?e:"null");break;case"boolean":n.push(e);break;case"undefined":n.push("null");break;case"object":if(null==e){n.push("null");break}if(da(e)){var i=e.length;n.push("[");for(var r="",o=0;i>o;o++)n.push(r),r=e[o],Ba(t,t.Fd?t.Fd.call(e,String(o),r):r,n),r=",";n.push("]");break}n.push("{"),i="";for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r=e[o],"function"!=typeof r&&(n.push(i),Ca(o,n),n.push(":"),Ba(t,t.Fd?t.Fd.call(e,o,r):r,n),i=","));n.push("}");break;case"function":break;default:throw Error("Unknown type: "+typeof e)}}function Ca(t,e){e.push('"',t.replace(Ea,function(t){if(t in Da)return Da[t];var e=t.charCodeAt(0),n="\\u";return 16>e?n+="000":256>e?n+="00":4096>e&&(n+="0"),Da[t]=n+e.toString(16)}),'"')}function Ha(t){if(Error.captureStackTrace)Error.captureStackTrace(this,Ha);else{var e=Error().stack;e&&(this.stack=e)}t&&(this.message=String(t))}function Oa(t,e){var n=Pa(t,e,void 0);return 0>n?null:q(t)?t.charAt(n):t[n]}function Pa(t,e,n){for(var i=t.length,r=q(t)?t.split(""):t,o=0;i>o;o++)if(o in r&&e.call(n,r[o],o,t))return o;return-1}function Qa(t,e){var n=Ia(t,e);n>=0&&w.splice.call(t,n,1)}function Ra(t,e,n){return 2>=arguments.length?w.slice.call(t,e):w.slice.call(t,e,n)}function Sa(t,e){t.sort(e||Ta)}function Ta(t,e){return t>e?1:e>t?-1:0}function ab(t,e){if(!ea(t))throw Error("encodeByteArray takes an array as a parameter");bb();for(var n=e?Za:Ya,i=[],r=0;r>2,o=(3&o)<<4|s>>4,s=(15&s)<<2|l>>6,l=63&l;u||(l=64,a||(s=64)),i.push(n[c],n[o],n[s],n[l])}return i.join("")}function bb(){if(!Ya){Ya={},Za={},$a={};for(var t=0;65>t;t++)Ya[t]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(t),Za[t]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(t),$a[Za[t]]=t,t>=62&&($a["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(t)]=t)}}function cb(t){n.setTimeout(function(){throw t},0)}function eb(){var t=n.MessageChannel;if("undefined"==typeof t&&"undefined"!=typeof window&&window.postMessage&&window.addEventListener&&-1==v.indexOf("Presto")&&(t=function(){var t=document.createElement("iframe");t.style.display="none",t.src="",document.documentElement.appendChild(t);var e=t.contentWindow,t=e.document;t.open(),t.write(""),t.close();var n="callImmediate"+Math.random(),i="file:"==e.location.protocol?"*":e.location.protocol+"//"+e.location.host,t=r(function(t){"*"!=i&&t.origin!=i||t.data!=n||this.port1.onmessage()},this);e.addEventListener("message",t,!1),this.port1={},this.port2={postMessage:function(){e.postMessage(n,i)}}}),"undefined"!=typeof t&&-1==v.indexOf("Trident")&&-1==v.indexOf("MSIE")){var e=new t,i={},o=i;return e.port1.onmessage=function(){if(p(i.next)){i=i.next;var t=i.Ke;i.Ke=null,t()}},function(t){o.next={Ke:t},o=o.next,e.port2.postMessage(0)}}return"undefined"!=typeof document&&"onreadystatechange"in document.createElement("script")?function(t){var e=document.createElement("script");e.onreadystatechange=function(){e.onreadystatechange=null,e.parentNode.removeChild(e),e=null,t(),t=null},document.documentElement.appendChild(e)}:function(t){n.setTimeout(t,0)}}function fb(t,e){gb||hb(),ib||(gb(),ib=!0),jb.push(new kb(t,e))}function hb(){if(n.Promise&&n.Promise.resolve){var t=n.Promise.resolve();gb=function(){t.then(lb)}}else gb=function(){var t=lb;!ga(n.setImmediate)||n.Window&&n.Window.prototype&&n.Window.prototype.setImmediate==n.setImmediate?(db||(db=eb()),db(t)):n.setImmediate(t)}}function lb(){for(;jb.length;){var t=jb;jb=[];for(var e=0;e=0&&r>1));a++);o>=0&&(n.L==nb&&1==r?ub(n,e):(r=n.Ca.splice(o,1)[0],vb(n,r,sb,e)))}t.Ha=null}else pb(t,sb,e)}function wb(t,e){t.Ca&&t.Ca.length||t.L!=qb&&t.L!=sb||xb(t),t.Ca||(t.Ca=[]),t.Ca.push(e)}function tb(t,e,n,i){var r={m:null,ff:null,hf:null};return r.m=new mb(function(t,o){r.ff=e?function(n){try{var r=e.call(i,n);t(r)}catch(a){o(a)}}:t,r.hf=n?function(e){try{var r=n.call(i,e);!p(r)&&e instanceof rb?o(e):t(r)}catch(a){o(a)}}:o}),r.m.Ha=t,wb(t,r),r.m}function pb(t,e,n){if(t.L==nb){if(t==n)e=sb,n=new TypeError("Promise cannot resolve to itself");else{var i;if(n)try{i=!!n.$goog_Thenable}catch(r){i=!1}else i=!1;if(i)return t.L=1,void n.then(t.Af,t.Bf,t);if(ha(n))try{var o=n.then;if(ga(o))return void yb(t,n,o)}catch(a){e=sb,n=a}}t.sf=n,t.L=e,t.Ha=null,xb(t),e!=sb||n instanceof rb||zb(t,n)}}function yb(t,e,n){function i(e){o||(o=!0,t.Bf(e))}function r(e){o||(o=!0,t.Af(e))}t.L=1;var o=!1;try{n.call(e,r,i)}catch(a){i(a)}}function xb(t){t.be||(t.be=!0,fb(t.Sf,t))}function vb(t,e,n,i){if(n==qb)e.ff(i);else{if(e.m)for(;t&&t.jd;t=t.Ha)t.jd=!1;e.hf(i)}}function zb(t,e){t.jd=!0,fb(function(){t.jd&&Ab.call(null,e)})}function rb(t){Ha.call(this,t)}function Bb(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function x(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0}function Cb(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function y(t,e,n,i){var r;if(e>i?r="at least "+e:i>n&&(r=0===n?"none":"no more than "+n),r)throw Error(t+" failed: Was called with "+i+(1===i?" argument.":" arguments.")+" Expects "+r+".")}function Db(t,e,n){var i="";switch(e){case 1:i=n?"first":"First";break;case 2:i=n?"second":"Second";break;case 3:i=n?"third":"Third";break;case 4:i=n?"fourth":"Fourth";break;default:throw Error("errorPrefix called with argumentNumber > 4. Need to update it?")}return t=t+" failed: "+(i+" argument ")}function A(t,e,n,i){if((!i||p(n))&&!ga(n))throw Error(Db(t,e,i)+"must be a valid function.")}function Eb(t,e,n){if(p(n)&&(!ha(n)||null===n))throw Error(Db(t,e,!0)+"must be a valid context object.")}function Fb(t){var e=[];return Cb(t,function(t,n){da(n)?Ja(n,function(n){e.push(encodeURIComponent(t)+"="+encodeURIComponent(n))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(n))}),e.length?"&"+e.join("&"):""}function Hb(){var t=this;this.reject=this.resolve=null,this.ra=new Gb(function(e,n){t.resolve=e,t.reject=n})}function Ib(t,e){return function(n,i){n?t.reject(n):t.resolve(i),ga(e)&&(Jb(t.ra),1===e.length?e(n):e(n,i))}}function Jb(t){t.then(void 0,aa)}function Kb(t,e){if(!t)throw Lb(e)}function Lb(t){return Error("Firebase Database ("+firebase.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)}function Mb(t){for(var e=[],n=0,i=0;i=55296&&56319>=r&&(r-=55296,i++,Kb(ir?e[n++]=r:(2048>r?e[n++]=r>>6|192:(65536>r?e[n++]=r>>12|224:(e[n++]=r>>18|240,e[n++]=r>>12&63|128),e[n++]=r>>6&63|128),e[n++]=63&r|128)}return e}function Nb(t){for(var e=0,n=0;ni?e++:2048>i?e+=2:i>=55296&&56319>=i?(e+=4,n++):e+=3}return e}function Ob(t){return"undefined"!=typeof JSON&&p(JSON.parse)?JSON.parse(t):za(t)}function B(t){if("undefined"!=typeof JSON&&p(JSON.stringify))t=JSON.stringify(t);else{var e=[];Ba(new Aa,t,e),t=e.join("")}return t}function Pb(t,e){this.committed=t,this.snapshot=e}function Qb(t){this.se=t,this.Bd=[],this.Rb=0,this.Yd=-1,this.Gb=null}function Rb(t,e,n){t.Yd=e,t.Gb=n,t.Yd>4),64!=s&&(i.push(a<<4&240|s>>2),64!=u&&i.push(s<<6&192|u))}if(8192>i.length)e=String.fromCharCode.apply(null,i);else{for(t="",n=0;nt.ac?t.update(t.zd,56-t.ac):t.update(t.zd,t.Ya-(t.ac-56));for(var i=t.Ya-1;i>=56;i--)t.Wd[i]=255&n,n/=256;for(na(t,t.Wd),i=n=0;5>i;i++)for(var r=24;r>=0;r-=8)e[n]=t.N[i]>>r&255,++n;return ab(e)}function Zc(t){for(var e="",n=0;n=0&&(r=a.substring(0,s-1),a=a.substring(s+2)),s=a.indexOf("/"),-1===s&&(s=a.length),e=a.substring(0,s),o="",a=a.substring(s).split("/"),s=0;s=0&&(i="https"===r||"wss"===r)}return"firebase"===t&&dd(e+" is no longer supported. Please use .firebaseio.com instead"),n&&"undefined"!=n||dd("Cannot parse Firebase url. Please use https://.firebaseio.com"),i||"undefined"!=typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&O("Insecure Firebase access from a secure page. Please use https in calls to new Firebase()."),{kc:new fc(e,i,n,"ws"===r||"wss"===r),path:new L(o)}}function fd(t){return fa(t)&&(t!=t||t==Number.POSITIVE_INFINITY||t==Number.NEGATIVE_INFINITY)}function gd(t){if("complete"===document.readyState)t();else{var e=!1,n=function(){document.body?e||(e=!0,t()):setTimeout(n,Math.floor(10))};document.addEventListener?(document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&n()}),window.attachEvent("onload",n))}}function Lc(t,e){if(t===e)return 0;if("[MIN_NAME]"===t||"[MAX_NAME]"===e)return-1;if("[MIN_NAME]"===e||"[MAX_NAME]"===t)return 1;var n=hd(t),i=hd(e);return null!==n?null!==i?0==n-i?t.length-e.length:n-i:-1:null!==i?1:e>t?-1:1}function id(t,e){if(e&&t in e)return e[t];throw Error("Missing required key ("+t+") in object: "+B(e))}function jd(t){if("object"!=typeof t||null===t)return B(t);var e,n=[];for(e in t)n.push(e);n.sort(),e="{";for(var i=0;it?n.push(t.substring(i,t.length)):n.push(t.substring(i,i+e));return n}function ld(e,n){if(da(e))for(var i=0;it,t=Math.abs(t),t>=Math.pow(2,-1022)?(i=Math.min(Math.floor(Math.log(t)/Math.LN2),1023),n=i+1023,i=Math.round(t*Math.pow(2,52-i)-Math.pow(2,52))):(n=0,i=Math.round(t/Math.pow(2,-1074)))),r=[],t=52;t;--t)r.push(i%2?1:0),i=Math.floor(i/2);for(t=11;t;--t)r.push(n%2?1:0),n=Math.floor(n/2);for(r.push(e?1:0),r.reverse(),e=r.join(""),n="",t=0;64>t;t+=8)i=parseInt(e.substr(t,8),2).toString(16),1===i.length&&(i="0"+i),n+=i;return n.toLowerCase()}function hd(t){return nd.test(t)&&(t=Number(t),t>=-2147483648&&2147483647>=t)?t:null}function Tb(t){try{t()}catch(e){setTimeout(function(){throw O("Exception was thrown by user callback.",e.stack||""),e},Math.floor(0))}}function od(t,e,n){Object.defineProperty(t,e,{get:n})}function pd(t){var e={};try{var n=t.split(".");Ob(Xc(n[0])||""),e=Ob(Xc(n[1])||""),delete e.d}catch(i){}return t=e,"object"==typeof t&&!0===x(t,"admin")}function rd(t,e,n,i){this.Zd=t,this.f=bd(this.Zd),this.frames=this.Ac=null,this.qb=this.rb=this.Ee=0,this.Xa=oc(e),t={v:"5"},"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf("firebaseio.com")&&(t.r="f"),n&&(t.s=n),i&&(t.ls=i),this.Le=hc(e,"websocket",t)}function vd(t,e){if(t.frames.push(e),t.frames.length==t.Ee){var n=t.frames.join("");t.frames=null,n=Ob(n),t.fg(n)}}function ud(t){clearInterval(t.Ac),t.Ac=setInterval(function(){t.La&&wd(t,"0"),ud(t)},Math.floor(45e3))}function wd(t,e){try{t.La.send(e)}catch(n){t.f("Exception thrown from WebSocket.send():",n.message||n.data,"Closing connection."),setTimeout(r(t.fb,t),0)}}function xd(t,e,n){this.f=bd("p:rest:"),this.M=t,this.Hb=e,this.Vd=n,this.$={}}function yd(t,e){return p(e)?"tag$"+e:(H(zd(t.n),"should have a tag if it's not a default query."),t.path.toString())}function Bd(t,e,n,i){n=n||{},n.format="export",t.Vd.getToken(!1).then(function(r){(r=r&&r.accessToken)&&(n.auth=r);var o=(t.M.Sc?"https://":"http://")+t.M.host+e+"?"+Fb(n);t.f("Sending REST request for "+o);var a=new XMLHttpRequest;a.onreadystatechange=function(){if(i&&4===a.readyState){t.f("REST Response for "+o+" received. status:",a.status,"response:",a.responseText);var e=null;if(200<=a.status&&300>a.status){try{e=Ob(a.responseText)}catch(n){O("Failed to parse JSON response for "+o+": "+a.responseText)}i(null,e)}else 401!==a.status&&404!==a.status&&O("Got unsuccessful REST response for "+o+" Status: "+a.status),i(a.status);i=null}},a.open("GET",o,!0),a.send()})}function Cd(t,e,n){this.type=Dd,this.source=t,this.path=e,this.children=n}function Ed(){this.hb={}}function Fd(t,e){var n=e.type,i=e.Za;H("child_added"==n||"child_changed"==n||"child_removed"==n,"Only child changes supported for tracking"),H(".priority"!==i,"Only non-priority child changes can be tracked.");var r=x(t.hb,i);if(r){var o=r.type;if("child_added"==n&&"child_removed"==o)t.hb[i]=new I("child_changed",e.Ma,i,r.Ma);else if("child_removed"==n&&"child_added"==o)delete t.hb[i];else if("child_removed"==n&&"child_changed"==o)t.hb[i]=new I("child_removed",r.pe,i);else if("child_changed"==n&&"child_added"==o)t.hb[i]=new I("child_added",e.Ma,i);else{if("child_changed"!=n||"child_changed"!=o)throw Wc("Illegal combination of changes: "+e+" occurred after "+r);t.hb[i]=new I("child_changed",e.Ma,i,r.pe)}}else t.hb[i]=e}function Gd(t){this.W=t,this.g=t.n.g}function Hd(t,e,n,i){var r=[],o=[];return Ja(e,function(e){"child_changed"===e.type&&t.g.nd(e.pe,e.Ma)&&o.push(new I("child_moved",e.Ma,e.Za))}),Id(t,r,"child_removed",e,i,n),Id(t,r,"child_added",e,i,n),Id(t,r,"child_moved",o,i,n),Id(t,r,"child_changed",e,i,n),Id(t,r,Gc,e,i,n),r}function Id(t,e,n,i,o,a){i=Ka(i,function(t){return t.type===n}),Sa(i,r(t.Mf,t)),Ja(i,function(n){var i=Jd(t,n,a);Ja(o,function(r){r.rf(n.type)&&e.push(r.createEvent(i,t.W))})})}function Jd(t,e,n){return"value"!==e.type&&"child_removed"!==e.type&&(e.Dd=n.Xe(e.Za,e.Ma,t.g)),e}function Kd(t,e){this.Sd=t,this.Kf=e}function Ld(t){this.V=t}function Td(t,e,n,i,r,o){var a=e.O;if(null!=i.mc(n))return e;var s;if(n.e())H(Hc(e.u()),"If change path is empty, we must have complete server data"),Ic(e.u())?(r=Ec(e),i=i.sc(r instanceof P?r:F)):i=i.Ba(Ec(e)),o=t.V.za(e.O.j(),i,o);else{var u=J(n);if(".priority"==u)H(1==Wd(n),"Can't have a priority with additional path components"),o=a.j(),s=e.u().j(),i=i.$c(n,o,s),o=null!=i?t.V.ga(o,i):a.j();else{var l=D(n);Cc(a,u)?(s=e.u().j(),i=i.$c(n,a.j(),s),i=null!=i?a.j().R(u).F(l,i):a.j().R(u)):i=i.rc(u,e.u()),o=null!=i?t.V.F(a.j(),u,i,l,r,o):a.j()}}return Rd(e,o,a.ea||n.e(),t.V.Qa())}function Nd(t,e,n,i,r,o,a,s){var u=e.u();if(a=a?t.V:t.V.Vb(),n.e())i=a.za(u.j(),i,null);else if(a.Qa()&&!u.Tb)i=u.j().F(n,i),i=a.za(u.j(),i,null);else{var l=J(n);if(!Jc(u,n)&&1=0?(null!=o&&Fd(o,new I("child_changed",i,n,h)),e.U(n,i)):(null!=o&&Fd(o,new I("child_removed",h,n)),e=e.U(n,F),null!=l&&t.sa.matches(l)?(null!=o&&Fd(o,new I("child_added",l.S,l.name)),e.U(l.name,l.S)):e)}return i.e()?e:c&&0<=a(l,u)?(null!=o&&(Fd(o,new I("child_removed",l.S,l.name)),Fd(o,new I("child_added",i,n))),e.U(n,i).U(l.name,F)):e}function Uc(t,e){this.B=t,H(p(this.B)&&null!==this.B,"LeafNode shouldn't be created with null/undefined value."),this.aa=e||F,ne(this.aa),this.Eb=null}function qe(){}function ke(t){return r(t.compare,t)}function te(t){H(!t.e()&&".priority"!==J(t),"Can't create PathIndex with empty path or .priority key"),this.cc=t}function ve(){}function we(){}function xe(){}function Ae(){this.Sb=this.na=this.Lb=this.ka=this.xa=!1,this.oa=0,this.oc="",this.ec=null,this.Ab="",this.bc=null,this.yb="",this.g=N}function ie(t){return""===t.oc?t.ka:"l"===t.oc}function ee(t){return H(t.ka,"Only valid if start has been set"),t.ec}function de(t){return H(t.ka,"Only valid if start has been set"),t.Lb?t.Ab:"[MIN_NAME]"}function ge(t){return H(t.na,"Only valid if end has been set"),t.bc}function fe(t){return H(t.na,"Only valid if end has been set"),t.Sb?t.yb:"[MAX_NAME]"}function Ce(t){var e=new Ae;return e.xa=t.xa,e.oa=t.oa,e.ka=t.ka,e.ec=t.ec,e.Lb=t.Lb,e.Ab=t.Ab,e.na=t.na,e.bc=t.bc,e.Sb=t.Sb,e.yb=t.yb,e.g=t.g,e}function De(t,e){var n=Ce(t);return n.g=e,n}function Ee(t){var e={};if(t.ka&&(e.sp=t.ec,t.Lb&&(e.sn=t.Ab)),t.na&&(e.ep=t.bc,t.Sb&&(e.en=t.yb)),t.xa){e.l=t.oa;var n=t.oc;""===n&&(n=ie(t)?"l":"r"),e.vf=n}return t.g!==N&&(e.i=t.g.toString()),e}function S(t){return!(t.ka||t.na||t.xa)}function zd(t){return S(t)&&t.g==N}function Ad(t){var e={};if(zd(t))return e;var n;return t.g===N?n="$priority":t.g===ze?n="$value":t.g===ae?n="$key":(H(t.g instanceof te,"Unrecognized index type!"),n=t.g.toString()),e.orderBy=B(n),t.ka&&(e.startAt=B(t.ec),t.Lb&&(e.startAt+=","+B(t.Ab))),t.na&&(e.endAt=B(t.bc),t.Sb&&(e.endAt+=","+B(t.yb))),t.xa&&(ie(t)?e.limitToFirst=t.oa:e.limitToLast=t.oa),e}function Fe(t,e){this.od=t,this.dc=e}function Ge(t,e,n){var i=oa(t.od,function(i,r){var o=x(t.dc,r);if(H(o,"Missing index implementation for "+r),i===re){if(o.yc(e.S)){for(var a=[],s=n.Xb(Nc),u=R(s);u;)u.name!=e.name&&a.push(u),u=R(s);return a.push(e),He(a,ke(o))}return re}return o=n.get(e.name),a=i,o&&(a=a.remove(new K(e.name,o))),a.Ra(e,e.S)});return new Fe(i,t.dc)}function Ie(t,e,n){var i=oa(t.od,function(t){if(t===re)return t;var i=n.get(e.name);return i?t.remove(new K(e.name,i)):t});return new Fe(i,t.dc)}function Ke(){this.set={}}function Le(e,n){t(e.set,function(t,e){n(e,t)})}function Me(t,e,n,i){this.Zd=t,this.f=bd(t),this.kc=e,this.qb=this.rb=0,this.Xa=oc(e),this.zf=n,this.xc=!1,this.Db=i,this.Yc=function(t){return hc(e,"long_polling",t)}}function Qe(t,e){var n=B(e).length;t.qb+=n,lc(t.Xa,"bytes_received",n)}function Pe(t,e,n,i){if(this.Yc=i,this.kb=n,this.ue=new Ke,this.Qc=[],this.$d=Math.floor(1e8*Math.random()),this.Kd=!0,this.Qd=Vc(),window["pLPCommand"+this.Qd]=t,window["pRTLPCB"+this.Qd]=e,t=document.createElement("iframe"),t.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(t);try{t.contentWindow.document||E("No IE domain setting required")}catch(r){t.src="javascript:void((function(){document.open();document.domain='"+document.domain+"';document.close();})())"}t.contentDocument?t.ib=t.contentDocument:t.contentWindow?t.ib=t.contentWindow.document:t.document&&(t.ib=t.document),this.Ga=t,t="",this.Ga.src&&"javascript:"===this.Ga.src.substr(0,11)&&(t=''),t=""+t+"";try{this.Ga.ib.open(),this.Ga.ib.write(t),this.Ga.ib.close()}catch(o){E("frame writing exception"),o.stack&&E(o.stack),E(o)}}function Se(t){if(t.Ud&&t.Kd&&t.ue.count()<(0=t.Qc[0].Qe.length+30+n.length;){var r=t.Qc.shift(),n=n+"&seg"+i+"="+r.sg+"&ts"+i+"="+r.yg+"&d"+i+"="+r.Qe;i++}return Te(t,e+n,t.$d),!0}return!1}function Te(t,e,n){function i(){t.ue.remove(n),Se(t)}t.ue.add(n,1);var r=setTimeout(i,Math.floor(25e3));Re(t,e,function(){clearTimeout(r),i()})}function Re(t,e,n){setTimeout(function(){try{if(t.Kd){var i=t.Ga.ib.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.onload=i.onreadystatechange=function(){var t=i.readyState;t&&"loaded"!==t&&"complete"!==t||(i.onload=i.onreadystatechange=null,i.parentNode&&i.parentNode.removeChild(i),n())},i.onerror=function(){E("Long-poll script failed to load: "+e),t.Kd=!1,t.close()},t.Ga.ib.body.appendChild(i)}}catch(r){}},Math.floor(1))}function Ue(t){Ve(this,t)}function Ve(t,e){var n=rd&&rd.isAvailable(),i=n&&!(Xb.af||!0===Xb.get("previous_websocket_failure"));if(e.zg&&(n||O("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),i=!0),i)t.Wc=[rd];else{var r=t.Wc=[];ld(We,function(t,e){e&&e.isAvailable()&&r.push(e)})}}function Xe(t){if(00&&(t.md=setTimeout(function(){t.md=null,t.Cb||(t.I&&102400=t.uf?(t.f("Secondary connection is healthy."),t.Cb=!0,t.D.sd(),t.D.start(),t.f("sending client ack on secondary"),t.D.send({t:"c",d:{t:"a",d:{}}}),t.f("Ending transmission on primary"),t.I.send({t:"c",d:{t:"n",d:{}}}),t.Xc=t.D,df(t)):(t.f("sending ping on secondary."),t.D.send({t:"c",d:{t:"p",d:{}}}))}function ff(t){t.Cb||(t.we--,0>=t.we&&(t.f("Primary connection is healthy."),t.Cb=!0,t.I.sd()))}function cf(t,e){t.D=new e("c:"+t.id+":"+t.Me++,t.M,t.wf),t.uf=e.responsesRequiredToBeHealthy||0,t.D.open($e(t,t.D),af(t,t.D)),setTimeout(function(){t.D&&(t.f("Timed out trying to upgrade."),t.D.close())},Math.floor(6e4))}function bf(t,e,n){t.f("Realtime connection established."),t.I=e,t.L=1,t.Mc&&(t.Mc(n,t.wf),t.Mc=null),0===t.we?(t.f("Primary connection is healthy."),t.Cb=!0):setTimeout(function(){gf(t)},Math.floor(5e3))}function gf(t){t.Cb||1!==t.L||(t.f("sending ping on primary."),jf(t,{t:"c",d:{t:"p",d:{}}}))}function jf(t,e){if(1!==t.L)throw"Connection is not connected";t.Xc.send(e)}function ef(t){t.f("Shutting down all connections"),t.I&&(t.I.close(),t.I=null),t.D&&(t.D.close(),t.D=null),t.md&&(clearTimeout(t.md),t.md=null)}function L(t,e){if(1==arguments.length){this.o=t.split("/");for(var n=0,i=0;i=t.o.length?null:t.o[t.Z]}function Wd(t){return t.o.length-t.Z}function D(t){var e=t.Z;return e10485760/3&&10485760n?i=i.left:n>0&&(r=i,i=i.right)}throw Error("Attempted to find predecessor key for a nonexistent key. What gives?")}function Uf(t,e,n,i,r){for(this.Hd=r||null,this.ke=i,this.Sa=[],r=1;!t.e();)if(r=e?n(t.key,e):1,i&&(r*=-1),0>r)t=this.ke?t.left:t.right;else{if(0===r){this.Sa.push(t);break}this.Sa.push(t),t=this.ke?t.right:t.left}}function R(t){if(0===t.Sa.length)return null;var e,n=t.Sa.pop();if(e=t.Hd?t.Hd(n.key,n.value):{key:n.key,value:n.value},t.ke)for(n=n.left;!n.e();)t.Sa.push(n),n=n.right;else for(n=n.right;!n.e();)t.Sa.push(n),n=n.left;return e}function Vf(t){if(0===t.Sa.length)return null;var e;return e=t.Sa,e=e[e.length-1],t.Hd?t.Hd(e.key,e.value):{key:e.key,value:e.value}}function Wf(t,e,n,i,r){this.key=t,this.value=e,this.color=null!=n?n:!0,this.left=null!=i?i:Sf,this.right=null!=r?r:Sf}function Xf(t){return t.left.e()?t:Xf(t.left)}function Zf(t){return t.left.e()?Sf:(t.left.fa()||t.left.left.fa()||(t=$f(t)),t=t.Y(null,null,null,Zf(t.left),null),Yf(t))}function Yf(t){return t.right.fa()&&!t.left.fa()&&(t=cg(t)),t.left.fa()&&t.left.left.fa()&&(t=ag(t)),t.left.fa()&&t.right.fa()&&(t=bg(t)),t}function $f(t){return t=bg(t),t.right.left.fa()&&(t=t.Y(null,null,null,null,ag(t.right)),t=cg(t),t=bg(t)),t}function cg(t){return t.right.Y(null,null,t.color,t.Y(null,null,!0,null,t.right.left),null)}function ag(t){return t.left.Y(null,null,t.color,null,t.Y(null,null,!0,t.left.right,null))}function bg(t){return t.Y(null,null,!t.color,t.left.Y(null,null,!t.left.color,null,null),t.right.Y(null,null,!t.right.color,null,null))}function dg(){}function P(t,e,n){this.k=t,(this.aa=e)&&ne(this.aa),t.e()&&H(!this.aa||this.aa.e(),"An empty node cannot have a priority"),this.zb=n,this.Eb=null}function le(t,e){var n;return n=(n=fg(t,e))?(n=n.Hc())&&n.name:t.k.Hc(),n?new K(n,t.k.get(n)):null}function me(t,e){var n;return n=(n=fg(t,e))?(n=n.fc())&&n.name:t.k.fc(),n?new K(n,t.k.get(n)):null}function fg(t,e){return e===ae?null:t.zb.get(e.toString())}function M(e,n){if(null===e)return F;var i=null;if("object"==typeof e&&".priority"in e?i=e[".priority"]:"undefined"!=typeof n&&(i=n),H(null===i||"string"==typeof i||"number"==typeof i||"object"==typeof i&&".sv"in i,"Invalid priority type found: "+typeof i),"object"==typeof e&&".value"in e&&null!==e[".value"]&&(e=e[".value"]),"object"!=typeof e||".sv"in e)return new Uc(e,M(i));if(e instanceof Array){var r=F,o=e;return t(o,function(t,e){if(Bb(o,e)&&"."!==e.substring(0,1)){var n=M(t);!n.J()&&n.e()||(r=r.U(e,n))}}),r.ga(M(i))}var a=[],s=!1,u=e;if(Cb(u,function(t){if("string"!=typeof t||"."!==t.substring(0,1)){var e=M(u[t]);e.e()||(s=s||!e.C().e(),a.push(new K(t,e)))}}),0==a.length)return F; -var l=He(a,Kc,function(t){return t.name},Mc);if(s){var c=He(a,ke(N));return new P(l,M(i),new Fe({".priority":c},{".priority":N}))}return new P(l,M(i),Je)}function hg(t){this.count=parseInt(Math.log(t+1)/gg,10),this.Pe=this.count-1,this.Jf=t+1&parseInt(Array(this.count+1).join("1"),2)}function ig(t){var e=!(t.Jf&1<o.Cc,"Stacking an older write on top of newer ones"),p(a)||(a=!0),o.la.push({path:e,Ja:n,Zc:i,visible:a}),a&&(o.T=Og(o.T,e,n)),o.Cc=i,r?Bh(t,new Zb(Jg,e,n)):[]}function Ch(t,e,n,i){var r=t.lb;return H(i>r.Cc,"Stacking an older merge on top of newer ones"),r.la.push({path:e,children:n,Zc:i,visible:!0}),r.T=Pg(r.T,e,n),r.Cc=i,n=xg(n),Bh(t,new Cd(Jg,e,n))}function Dh(t,e,n){n=n||!1;var i=Zg(t.lb,e);if(t.lb.Ed(e)){var r=Q;return null!=i.Ja?r=r.set(C,!0):Cb(i.children,function(t,e){r=r.set(new L(t),e)}),Bh(t,new Ig(i.path,r,n))}return[]}function Eh(t,e,n){return n=xg(n),Bh(t,new Cd(Lg,e,n))}function Fh(t,e,n,i){if(i=Gh(t,i),null!=i){var r=Hh(i);return i=r.path,r=r.Ib,e=T(i,e),n=new Zb(new Kg(!1,!0,r,!0),e,n),Ih(t,i,n)}return[]}function Jh(t,e,n,i){if(i=Gh(t,i)){var r=Hh(i);return i=r.path,r=r.Ib,e=T(i,e),n=xg(n),n=new Cd(new Kg(!1,!0,r,!0),e,n),Ih(t,i,n)}return[]}function Nh(e){return Ag(e,function(e,n,i){if(n&&null!=Vg(n))return[Vg(n)];var r=[];return n&&(r=Wg(n)),t(i,function(t){r=r.concat(t)}),r})}function Rh(t,e){for(var n=0;ni;){if(0==o)for(;n>=i;)na(this,t,i),i+=this.Ya;if(q(t)){for(;e>i;)if(r[o]=t.charCodeAt(i),++o,++i,o==this.Ya){na(this,r),o=0;break}}else for(;e>i;)if(r[o]=t[i],++o,++i,o==this.Ya){na(this,r),o=0;break}}this.ac=o,this.Pd+=e}};var Da={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\x0B":"\\u000b"},Ea=/\uffff/.test("￿")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g,v;t:{var Fa=n.navigator;if(Fa){var Ga=Fa.userAgent;if(Ga){v=Ga;break t}}v=""}ka(Ha,Error),Ha.prototype.name="CustomError";var w=Array.prototype,Ia=w.indexOf?function(t,e,n){return w.indexOf.call(t,e,n)}:function(t,e,n){if(n=null==n?0:0>n?Math.max(0,t.length+n):n,q(t))return q(e)&&1==e.length?t.indexOf(e,n):-1;for(;no;o++)o in r&&e.call(n,r[o],o,t)},Ka=w.filter?function(t,e,n){return w.filter.call(t,e,n)}:function(t,e,n){for(var i=t.length,r=[],o=0,a=q(t)?t.split(""):t,s=0;i>s;s++)if(s in a){var u=a[s];e.call(n,u,s,t)&&(r[o++]=u)}return r},La=w.map?function(t,e,n){return w.map.call(t,e,n)}:function(t,e,n){for(var i=t.length,r=Array(i),o=q(t)?t.split(""):t,a=0;i>a;a++)a in o&&(r[a]=e.call(n,o[a],a,t));return r},Ma=w.reduce?function(t,e,n,i){for(var o=[],a=1,s=arguments.length;s>a;a++)o.push(arguments[a]);return i&&(o[0]=r(e,i)),w.reduce.apply(t,o)}:function(t,e,n,i){var r=n;return Ja(t,function(n,o){r=e.call(i,r,n,o,t)}),r},Na=w.every?function(t,e,n){return w.every.call(t,e,n)}:function(t,e,n){for(var i=t.length,r=q(t)?t.split(""):t,o=0;i>o;o++)if(o in r&&!e.call(n,r[o],o,t))return!1;return!0},Ua=-1!=v.indexOf("Opera")||-1!=v.indexOf("OPR"),Va=-1!=v.indexOf("Trident")||-1!=v.indexOf("MSIE"),Wa=-1!=v.indexOf("Gecko")&&-1==v.toLowerCase().indexOf("webkit")&&!(-1!=v.indexOf("Trident")||-1!=v.indexOf("MSIE")),Xa=-1!=v.toLowerCase().indexOf("webkit");!function(){var t,e="";return Ua&&n.opera?(e=n.opera.version,ga(e)?e():e):(Wa?t=/rv\:([^\);]+)(\)|;)/:Va?t=/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/:Xa&&(t=/WebKit\/(\S+)/),t&&(e=(e=t.exec(v))?e[1]:""),Va&&(t=(t=n.document)?t.documentMode:void 0,t>parseFloat(e))?String(t):e)}();var Ya=null,Za=null,$a=null,db,gb,ib=!1,jb=[];[].push(function(){ib=!1,jb=[]});var nb=0,qb=2,sb=3;mb.prototype.then=function(t,e,n){return tb(this,ga(t)?t:null,ga(e)?e:null,n)},mb.prototype.then=mb.prototype.then,mb.prototype.$goog_Thenable=!0,g=mb.prototype,g.xg=function(t,e){return tb(this,null,t,e)},g.cancel=function(t){this.L==nb&&fb(function(){var e=new rb(t);ub(this,e)},this)},g.Af=function(t){this.L=nb,pb(this,qb,t)},g.Bf=function(t){this.L=nb,pb(this,sb,t)},g.Sf=function(){for(;this.Ca&&this.Ca.length;){var t=this.Ca;this.Ca=null;for(var e=0;e"),t},ic.prototype.pf=function(){var t,e=this.Vc.get(),n={},i=!1;for(t in e)0=t.length){var e=Number(t);if(!isNaN(e)){r.Ee=e,r.frames=[],t=null;break t}}r.Ee=1,r.frames=[]}null!==t&&vd(r,t)}},this.La.onerror=function(t){r.f("WebSocket error. Closing connection."),(t=t.message||t.data)&&r.f(t),r.fb()}},rd.prototype.start=function(){},rd.isAvailable=function(){var t=!1;if("undefined"!=typeof navigator&&navigator.userAgent){var e=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);e&&1parseFloat(e[1])&&(t=!0)}return!t&&null!==qd&&!td},rd.responsesRequiredToBeHealthy=2,rd.healthyTimeout=3e4,g=rd.prototype,g.sd=function(){Xb.remove("previous_websocket_failure")},g.send=function(t){ud(this),t=B(t),this.rb+=t.length,lc(this.Xa,"bytes_sent",t.length),t=kd(t,16384),1=this.g.compare(this.Uc,t)&&0>=this.g.compare(t,this.wc)},g.F=function(t,e,n,i,r,o){return this.matches(new K(e,n))||(n=F),this.he.F(t,e,n,i,r,o)},g.za=function(t,e,n){e.J()&&(e=F);var i=e.ob(this.g),i=i.ga(F),r=this;return e.P(N,function(t,e){r.matches(new K(t,e))||(i=i.U(t,F))}),this.he.za(t,i,n)},g.ga=function(t){return t},g.Qa=function(){return!0},g.Vb=function(){return this.he},g=he.prototype,g.F=function(t,e,n,i,r,o){return this.sa.matches(new K(e,n))||(n=F),t.R(e).ca(n)?t:t.Fb()=this.g.compare(this.sa.Uc,a):0>=this.g.compare(a,this.sa.wc)))break;i=i.U(a.name,a.S),r++}}else{i=e.ob(this.g),i=i.ga(F);var s,u,l;if(this.Jb){e=i.Ye(this.g),s=this.sa.wc,u=this.sa.Uc;var c=ke(this.g);l=function(t,e){return c(e,t)}}else e=i.Xb(this.g),s=this.sa.Uc,u=this.sa.wc,l=ke(this.g);for(var r=0,h=!1;0=l(s,a)&&(h=!0),(o=h&&r=l(a,u))?r++:i=i.U(a.name,F)}return this.sa.Vb().za(t,i,n)},g.ga=function(t){return t},g.Qa=function(){return!0},g.Vb=function(){return this.sa.Vb()};var oe=["object","boolean","number","string"];g=Uc.prototype,g.J=function(){return!0},g.C=function(){return this.aa},g.ga=function(t){return new Uc(this.B,t)},g.R=function(t){return".priority"===t?this.aa:F},g.Q=function(t){return t.e()?this:".priority"===J(t)?this.aa:F},g.Fa=function(){return!1},g.Xe=function(){return null},g.U=function(t,e){return".priority"===t?this.ga(e):e.e()&&".priority"!==t?this:F.U(t,e).ga(this.aa)},g.F=function(t,e){var n=J(t);return null===n?e:e.e()&&".priority"!==n?this:(H(".priority"!==n||1===Wd(t),".priority must be the last token in a path"),this.U(n,F.F(D(t),e)))},g.e=function(){return!1},g.Fb=function(){return 0},g.P=function(){return!1},g.H=function(t){return t&&!this.C().e()?{".value":this.Ea(),".priority":this.C().H()}:this.Ea()},g.hash=function(){if(null===this.Eb){var t="";this.aa.e()||(t+="priority:"+pe(this.aa.H())+":");var e=typeof this.B,t=t+(e+":"),t="number"===e?t+md(this.B):t+this.B;this.Eb=Yc(t)}return this.Eb},g.Ea=function(){return this.B},g.tc=function(t){if(t===F)return 1;if(t instanceof P)return-1;H(t.J(),"Unknown node type");var e=typeof t.B,n=typeof this.B,i=Ia(oe,e),r=Ia(oe,n);return H(i>=0,"Unknown leaf type: "+e),H(r>=0,"Unknown leaf type: "+n),i===r?"object"===n?0:this.B=this.o.length)return null;for(var t=[],e=this.Z;e=this.o.length},g.ca=function(t){if(Wd(this)!==Wd(t))return!1;for(var e=this.Z,n=t.Z;e<=this.o.length;e++,n++)if(this.o[e]!==t.o[n])return!1;return!0},g.contains=function(t){var e=this.Z,n=t.Z;if(Wd(this)>Wd(t))return!1;for(;e0){for(var r=Array(i),o=0;i>o;o++)r[o]=n[o];n=r}else n=[];for(i=0;i=0;o--)r[o]="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(n%64),n=Math.floor(n/64);if(H(0===n,"Cannot push at time == 0"),n=r.join(""),i){for(o=11;o>=0&&63===e[o];o--)e[o]=0;e[o]++}else for(o=0;12>o;o++)e[o]=Math.floor(64*Math.random());for(o=0;12>o;o++)n+="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(e[o]);return H(20===n.length,"nextPushId: Length should be 20."),n}}();g=Rf.prototype,g.Ra=function(t,e){return new Rf(this.Oa,this.ba.Ra(t,e,this.Oa).Y(null,null,!1,null,null))},g.remove=function(t){return new Rf(this.Oa,this.ba.remove(t,this.Oa).Y(null,null,!1,null,null))},g.get=function(t){for(var e,n=this.ba;!n.e();){if(e=this.Oa(t,n.key),0===e)return n.value;0>e?n=n.left:e>0&&(n=n.right)}return null},g.e=function(){return this.ba.e()},g.count=function(){return this.ba.count()},g.Hc=function(){return this.ba.Hc()},g.fc=function(){return this.ba.fc()},g.ia=function(t){return this.ba.ia(t)},g.Xb=function(t){return new Uf(this.ba,null,this.Oa,!1,t)},g.Yb=function(t,e){return new Uf(this.ba,t,this.Oa,!1,e)},g.$b=function(t,e){return new Uf(this.ba,t,this.Oa,!0,e)},g.Ye=function(t){return new Uf(this.ba,null,this.Oa,!0,t)},g=Wf.prototype,g.Y=function(t,e,n,i,r){return new Wf(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=i?i:this.left,null!=r?r:this.right)},g.count=function(){return this.left.count()+1+this.right.count()},g.e=function(){return!1},g.ia=function(t){return this.left.ia(t)||t(this.key,this.value)||this.right.ia(t)},g.Hc=function(){return Xf(this).key},g.fc=function(){return this.right.e()?this.key:this.right.fc()},g.Ra=function(t,e,n){var i,r;return r=this,i=n(t,r.key),r=0>i?r.Y(null,null,null,r.left.Ra(t,e,n),null):0===i?r.Y(null,e,null,null,null):r.Y(null,null,null,null,r.right.Ra(t,e,n)),Yf(r)},g.remove=function(t,e){var n,i;if(n=this,0>e(t,n.key))n.left.e()||n.left.fa()||n.left.left.fa()||(n=$f(n)),n=n.Y(null,null,null,n.left.remove(t,e),null);else{if(n.left.fa()&&(n=ag(n)),n.right.e()||n.right.fa()||n.right.left.fa()||(n=bg(n),n.left.left.fa()&&(n=ag(n),n=bg(n))),0===e(t,n.key)){if(n.right.e())return Sf;i=Xf(n.right),n=n.Y(i.key,i.value,null,null,Zf(n.right))}n=n.Y(null,null,null,null,n.right.remove(t,e))}return Yf(n)},g.fa=function(){return this.color},g=dg.prototype,g.Y=function(){return this},g.Ra=function(t,e){return new Wf(t,e,null)},g.remove=function(){return this},g.count=function(){return 0},g.e=function(){return!0},g.ia=function(){return!1},g.Hc=function(){return null},g.fc=function(){return null},g.fa=function(){return!1};var Sf=new dg;g=P.prototype,g.J=function(){return!1},g.C=function(){return this.aa||F},g.ga=function(t){return this.k.e()?this:new P(this.k,t,this.zb)},g.R=function(t){return".priority"===t?this.C():(t=this.k.get(t),null===t?F:t)},g.Q=function(t){var e=J(t);return null===e?this:this.R(e).Q(D(t))},g.Fa=function(t){return null!==this.k.get(t)},g.U=function(t,e){if(H(e,"We should always be passing snapshot nodes"),".priority"===t)return this.ga(e);var n,i,r=new K(t,e);return e.e()?(n=this.k.remove(t),r=Ie(this.zb,r,this.k)):(n=this.k.Ra(t,e),r=Ge(this.zb,r,this.k)),i=n.e()?F:this.aa,new P(n,i,r)},g.F=function(t,e){var n=J(t);if(null===n)return e;H(".priority"!==J(t)||1===Wd(t),".priority must be the last token in a path");var i=this.R(n).F(D(t),e);return this.U(n,i)},g.e=function(){return this.k.e()},g.Fb=function(){return this.k.count()};var eg=/^(0|[1-9]\d*)$/;g=P.prototype,g.H=function(t){if(this.e())return null;var e={},n=0,i=0,r=!0;if(this.P(N,function(o,a){e[o]=a.H(t),n++,r&&eg.test(o)?i=Math.max(i,Number(o)):r=!1}),!t&&r&&2*n>i){var o,a=[];for(o in e)a[o]=e[o];return a}return t&&!this.C().e()&&(e[".priority"]=this.C().H()),e},g.hash=function(){if(null===this.Eb){var t="";this.C().e()||(t+="priority:"+pe(this.C().H())+":"),this.P(N,function(e,n){var i=n.hash();""!==i&&(t+=":"+e+":"+i)}),this.Eb=""===t?"":Yc(t)}return this.Eb},g.Xe=function(t,e,n){return(n=fg(this,n))?(t=Tf(n,new K(t,e)))?t.name:null:Tf(this.k,t)},g.P=function(t,e){var n=fg(this,t);return n?n.ia(function(t){return e(t.name,t.S)}):this.k.ia(e)},g.Xb=function(t){return this.Yb(t.Ic(),t)},g.Yb=function(t,e){var n=fg(this,e);if(n)return n.Yb(t,function(t){return t});for(var n=this.k.Yb(t.name,Nc),i=Vf(n);null!=i&&0>e.compare(i,t);)R(n),i=Vf(n);return n},g.Ye=function(t){return this.$b(t.Gc(),t)},g.$b=function(t,e){var n=fg(this,e);if(n)return n.$b(t,function(t){return t});for(var n=this.k.$b(t.name,Nc),i=Vf(n);null!=i&&0=t)throw Error("Query.limitToFirst: First argument must be a positive integer.");if(this.n.xa)throw Error("Query.limitToFirst: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new X(this.w,this.path,this.n.me(t),this.Oc)},g.ne=function(t){if(y("Query.limitToLast",1,1,arguments.length),!fa(t)||Math.floor(t)!==t||0>=t)throw Error("Query.limitToLast: First argument must be a positive integer.");if(this.n.xa)throw Error("Query.limitToLast: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new X(this.w,this.path,this.n.ne(t),this.Oc)},g.jg=function(t){if(y("Query.orderByChild",1,1,arguments.length),"$key"===t)throw Error('Query.orderByChild: "$key" is invalid. Use Query.orderByKey() instead.');if("$priority"===t)throw Error('Query.orderByChild: "$priority" is invalid. Use Query.orderByPriority() instead.');if("$value"===t)throw Error('Query.orderByChild: "$value" is invalid. Use Query.orderByValue() instead.');Hf("Query.orderByChild",t),sg(this,"Query.orderByChild");var e=new L(t);if(e.e())throw Error("Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead.");return e=new te(e),e=De(this.n,e),qg(e),new X(this.w,this.path,e,!0)},g.kg=function(){y("Query.orderByKey",0,0,arguments.length),sg(this,"Query.orderByKey");var t=De(this.n,ae);return qg(t),new X(this.w,this.path,t,!0)},g.lg=function(){y("Query.orderByPriority",0,0,arguments.length),sg(this,"Query.orderByPriority");var t=De(this.n,N);return qg(t),new X(this.w,this.path,t,!0)},g.mg=function(){y("Query.orderByValue",0,0,arguments.length),sg(this,"Query.orderByValue");var t=De(this.n,ze);return qg(t),new X(this.w,this.path,t,!0)},g.Nd=function(t,e){y("Query.startAt",0,2,arguments.length),Af("Query.startAt",t,this.path,!0),Gf("Query.startAt",e);var n=this.n.Nd(t,e);if(rg(n),qg(n),this.n.ka)throw Error("Query.startAt: Starting point was already set (by another call to startAt or equalTo).");return p(t)||(e=t=null),new X(this.w,this.path,n,this.Oc)},g.fd=function(t,e){y("Query.endAt",0,2,arguments.length),Af("Query.endAt",t,this.path,!0),Gf("Query.endAt",e);var n=this.n.fd(t,e);if(rg(n),qg(n),this.n.na)throw Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new X(this.w,this.path,n,this.Oc)},g.Pf=function(t,e){if(y("Query.equalTo",1,2,arguments.length),Af("Query.equalTo",t,this.path,!1),Gf("Query.equalTo",e),this.n.ka)throw Error("Query.equalTo: Starting point was already set (by another call to endAt or equalTo).");if(this.n.na)throw Error("Query.equalTo: Ending point was already set (by another call to endAt or equalTo).");return this.Nd(t,e).fd(t,e)},g.toString=function(){y("Query.toString",0,0,arguments.length);for(var t=this.path,e="",n=t.Z;nt?-1:1});g=vg.prototype,g.e=function(){return null===this.value&&this.children.e()},g.subtree=function(t){if(t.e())return this;var e=this.children.get(J(t));return null!==e?e.subtree(D(t)):Q},g.set=function(t,e){if(t.e())return new vg(e,this.children);var n=J(t),i=(this.children.get(n)||Q).set(D(t),e),n=this.children.Ra(n,i);return new vg(this.value,n)},g.remove=function(t){if(t.e())return this.children.e()?Q:new vg(null,this.children);var e=J(t),n=this.children.get(e);return n?(t=n.remove(D(t)),e=t.e()?this.children.remove(e):this.children.Ra(e,t),null===this.value&&e.e()?Q:new vg(this.value,e)):this},g.get=function(t){if(t.e())return this.value;var e=this.children.get(J(t));return e?e.get(D(t)):null};var Q=new vg(null);vg.prototype.toString=function(){var t={};return Yd(this,function(e,n){t[e.toString()]=n.toString()}),B(t)},Ig.prototype.Nc=function(t){return this.path.e()?null!=this.Pb.value?(H(this.Pb.children.e(),"affectedTree should not have overlapping affected paths."),this):(t=this.Pb.subtree(new L(t)),new Ig(C,t,this.Id)):(H(J(this.path)===t,"operationForChild called for unrelated child."),new Ig(D(this.path),this.Pb,this.Id))},Ig.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" ack write revert="+this.Id+" affectedTree="+this.Pb+")"};var $b=0,Dd=1,Qd=2,bc=3,Jg=new Kg(!0,!1,null,!1),Lg=new Kg(!1,!0,null,!1);Kg.prototype.toString=function(){return this.ee?"user":this.De?"server(queryID="+this.Ib+")":"server"};var Ng=new Mg(new vg(null));Mg.prototype.Ed=function(t){return t.e()?Ng:(t=$d(this.X,t,Q),new Mg(t))},Mg.prototype.e=function(){return this.X.e()},Mg.prototype.apply=function(t){return Tg(C,this.X,t)},g=Ug.prototype,g.e=function(){return xa(this.Aa)},g.gb=function(e,n,i){var r=e.source.Ib;if(null!==r)return r=x(this.Aa,r),H(null!=r,"SyncTree gave us an op for an invalid query."),r.gb(e,n,i);var o=[];return t(this.Aa,function(t){o=o.concat(t.gb(e,n,i))}),o},g.Ob=function(t,e,n,i,r){var o=t.ya(),a=x(this.Aa,o);if(!a){var a=n.Ba(r?i:null),s=!1;a?s=!0:(a=i instanceof P?n.sc(i):F,s=!1),a=new kg(t,new Ud(new Dc(a,s,!1),new Dc(i,r,!1))),this.Aa[o]=a}return a.Ob(e),ng(a,e)},g.mb=function(e,n,i){var r=e.ya(),o=[],a=[],s=null!=Vg(this);if("default"===r){var u=this;t(this.Aa,function(t,e){a=a.concat(t.mb(n,i)),t.e()&&(delete u.Aa[e],S(t.W.n)||o.push(t.W))})}else{var l=x(this.Aa,r);l&&(a=a.concat(l.mb(n,i)),l.e()&&(delete this.Aa[r],S(l.W.n)||o.push(l.W)))}return s&&null==Vg(this)&&o.push(new U(e.w,e.path)),{qg:o,Rf:a}},g.jb=function(e){var n=null;return t(this.Aa,function(t){n=n||t.jb(e)}),n},g=Yg.prototype,g.Ed=function(e){var n=Pa(this.la,function(t){return t.Zc===e});H(n>=0,"removeWrite called with nonexistent writeId.");var i=this.la[n];this.la.splice(n,1);for(var r=i.visible,o=!1,a=this.la.length-1;r&&a>=0;){var s=this.la[a];s.visible&&(a>=n&&$g(s,i.path)?r=!1:i.path.contains(s.path)&&(o=!0)),a--}if(r){if(o)this.T=ah(this.la,bh,C),this.Cc=0r;r++)e+=" ";console.log(e+i)}}},g.Be=function(t){lc(this.Xa,t),this.wg.xf[t]=!0},g.f=function(t){var e="";this.Ua&&(e=this.Ua.id+":"),E(e,arguments)},uf.prototype.eb=function(){for(var t in this.nb)this.nb[t].eb()},uf.prototype.lc=function(){for(var t in this.nb)this.nb[t].lc()},uf.prototype.ce=function(t){this.Df=t},ba(uf),uf.prototype.interrupt=uf.prototype.eb,uf.prototype.resume=uf.prototype.lc;var Z={};if(Z.pc=kh,Z.DataConnection=Z.pc,kh.prototype.vg=function(t,e){this.ua("q",{p:t},e)},Z.pc.prototype.simpleListen=Z.pc.prototype.vg,kh.prototype.Of=function(t,e){this.ua("echo",{d:t},e)},Z.pc.prototype.echo=Z.pc.prototype.Of,kh.prototype.interrupt=kh.prototype.eb,Z.Gf=Ye,Z.RealTimeConnection=Z.Gf,Ye.prototype.sendRequest=Ye.prototype.ua,Ye.prototype.close=Ye.prototype.close,Z.$f=function(t){var e=kh.prototype.put;return kh.prototype.put=function(n,i,r,o){p(o)&&(o=t()),e.call(this,n,i,r,o)},function(){kh.prototype.put=e}},Z.hijackHash=Z.$f,Z.Ff=fc,Z.ConnectionTarget=Z.Ff,Z.ya=function(t){return t.ya()},Z.queryIdentifier=Z.ya,Z.cg=function(t){return t.w.Ua.$},Z.listens=Z.cg,Z.ce=function(t){uf.Wb().ce(t)},Z.forceRestClient=Z.ce,Z.Context=uf,ka(U,X),g=U.prototype,g.getKey=function(){return y("Firebase.key",0,0,arguments.length),this.path.e()?null:Xd(this.path)},g.m=function(t){if(y("Firebase.child",1,1,arguments.length),fa(t))t=String(t);else if(!(t instanceof L))if(null===J(this.path)){var e=t;e&&(e=e.replace(/^\/*\.info(\/|$)/,"/")),Hf("Firebase.child",e)}else Hf("Firebase.child",t);return new U(this.w,this.path.m(t))},g.getParent=function(){y("Firebase.parent",0,0,arguments.length);var t=this.path.parent();return null===t?null:new U(this.w,t)},g.Xf=function(){y("Firebase.ref",0,0,arguments.length);for(var t=this;null!==t.getParent();)t=t.getParent();return t},g.Nf=function(){return this.w.$a},g.set=function(t,e){y("Firebase.set",1,2,arguments.length),If("Firebase.set",this.path),Af("Firebase.set",t,this.path,!1),A("Firebase.set",2,e,!0);var n=new Hb;return this.w.Kb(this.path,t,null,Ib(n,e)),n.ra},g.update=function(t,e){if(y("Firebase.update",1,2,arguments.length),If("Firebase.update",this.path),da(t)){for(var n={},i=0;i>>0),h=0,f=function(t,e,n){return t.call.apply(t.bind,arguments)},d=function(t,e,n){if(!t)throw Error();if(2s&&(s*=2);var n;1===c?(c=2,n=0):n=1e3*(s+Math.random()),r(n)}}function a(t){f||(f=!0,h||(null!==u?(t||(c=2),clearTimeout(u),r(0)):t||(c=1)))}var s=1,u=null,l=!1,c=0,h=!1,f=!1;return r(0),setTimeout(function(){l=!0,a(!0)},n),a},b="https://firebasestorage.googleapis.com",y=function(t,e){this.code="storage/"+t,this.message="Firebase Storage: "+e,this.serverResponse=null,this.name="FirebaseError"};v(y,Error);var q=function(){return new y("unknown","An unknown error occurred, please check the error payload for server response.")},w=function(){return new y("unauthenticated","User is not authenticated, please authenticate using Firebase Authentication and try again.")},x=function(t){return new y("unauthorized","User does not have permission to access '"+t+"'.")},E=function(){return new y("canceled","User canceled the upload/download.")},k=function(t,e,n){return new y("invalid-argument","Invalid argument in `"+e+"` at index "+t+": "+n)},T=function(){return new y("app-deleted","The Firebase app was deleted.")},A=function(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])},S=function(t){var e={};return A(t,function(t,n){e[t]=n}),e},_=function(t,e,n,i){this.l=t,this.f={},this.i=e,this.b={},this.c="",this.N=n,this.g=this.a=null,this.h=[200],this.j=i},I={STATE_CHANGED:"state_changed"},R={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"},M=function(t){switch(t){case"running":case"pausing":case"canceling":return"running";case"paused":return"paused";case"success":return"success";case"canceled":return"canceled";case"error":return"error";default:return"error"}},O=function(t){return i(t)&&null!==t},F=function(t){return"string"==typeof t||t instanceof String},C=function(t,e,n){this.f=n,this.c=t,this.g=e,this.b=0,this.a=null};C.prototype.get=function(){var t;return 0t?-1:t>e?1:0},J=function(t,e){this.a=t,this.b=e};J.prototype.clone=function(){return new J(this.a,this.b)};var Y=function(t,e){this.bucket=t,this.path=e},Z=function(t){var e=encodeURIComponent;return"/b/"+e(t.bucket)+"/o/"+e(t.path)},$=function(t){for(var e=null,n=[{ja:/^gs:\/\/([A-Za-z0-9.\-]+)(\/(.*))?$/i,aa:{bucket:1,path:3},ia:function(t){"/"===t.path.charAt(t.path.length-1)&&(t.path=t.path.slice(0,-1))}},{ja:/^https?:\/\/firebasestorage\.googleapis\.com\/v[A-Za-z0-9_]+\/b\/([A-Za-z0-9.\-]+)\/o(\/([^?#]*).*)?$/i,aa:{bucket:1,path:3},ia:function(t){t.path=decodeURIComponent(t.path)}}],i=0;in?Math.max(0,t.length+n):n,s(t))return s(e)&&1==e.length?t.indexOf(e,n):-1;for(;no;o++)o in r&&e.call(n,r[o],o,t)},yt=Array.prototype.filter?function(t,e,n){return ot(null!=t.length),Array.prototype.filter.call(t,e,n)}:function(t,e,n){for(var i=t.length,r=[],o=0,a=s(t)?t.split(""):t,u=0;i>u;u++)if(u in a){var l=a[u];e.call(n,l,u,t)&&(r[o++]=l)}return r},qt=Array.prototype.map?function(t,e,n){return ot(null!=t.length),Array.prototype.map.call(t,e,n)}:function(t,e,n){for(var i=t.length,r=Array(i),o=s(t)?t.split(""):t,a=0;i>a;a++)a in o&&(r[a]=e.call(n,o[a],a,t));return r},wt=Array.prototype.some?function(t,e,n){return ot(null!=t.length),Array.prototype.some.call(t,e,n)}:function(t,e,n){for(var i=t.length,r=s(t)?t.split(""):t,o=0;i>o;o++)if(o in r&&e.call(n,r[o],o,t))return!0;return!1},xt=function(t){var e;t:{e=Hn;for(var n=t.length,i=s(t)?t.split(""):t,r=0;n>r;r++)if(r in i&&e.call(void 0,i[r],r,t)){e=r;break t}e=-1}return 0>e?null:s(t)?t.charAt(e):t[e]},Et=function(t){if("array"!=o(t))for(var e=t.length-1;e>=0;e--)delete t[e];t.length=0},kt=function(t,e){e=mt(t,e);var n;return(n=e>=0)&&(ot(null!=t.length),Array.prototype.splice.call(t,e,1)),n},Tt=function(t){var e=t.length;if(e>0){for(var n=Array(e),i=0;e>i;i++)n[i]=t[i];return n}return[]},At=new C(function(){return new _t},function(t){t.reset()},100),St=function(){var t=we,e=null;return t.a&&(e=t.a,t.a=t.a.next,t.a||(t.b=null),e.next=null),e},_t=function(){this.next=this.b=this.a=null};_t.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null},_t.prototype.reset=function(){this.next=this.b=this.a=null};var It=function(t,e){this.type=t,this.a=this.target=e,this.ka=!0};It.prototype.b=function(){this.ka=!1};var Rt,Mt=function(t,e,n,i,r){this.listener=t,this.a=null,this.src=e,this.type=n,this.U=!!i,this.N=r,++ht,this.O=this.T=!1},Ot=function(t){t.O=!0,t.listener=null,t.a=null,t.src=null,t.N=null},Ft=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/,Ct=function(t,e){return e=yt(e.split("/"),function(t){return 0-1?(t=e[s],i||(t.T=!1)):(t=new Mt(n,t.src,a,!!r,o),t.T=i,e.push(t)),t},jt=function(t,e){var n=e.type;n in t.a&&kt(t.a[n],e)&&(Ot(e),0==t.a[n].length&&(delete t.a[n],t.b--))},Dt=function(t,e,n,i){for(var r=0;r=this.o()){for(var n=this.a,i=0;i0&&(i=e-1>>1,t[i].a>n.a);)t[e]=t[i],e=i;t[e]=n};t=Bt.prototype,t.w=function(){for(var t=this.a,e=[],n=t.length,i=0;n>i;i++)e.push(t[i].b);return e},t.D=function(){for(var t=this.a,e=[],n=t.length,i=0;n>i;i++)e.push(t[i].a);return e},t.clone=function(){return new Bt(this)},t.o=function(){return this.a.length},t.F=function(){return 0==this.a.length},t.clear=function(){Et(this.a)};var Xt=function(){this.b=[],this.a=[]},Vt=function(t){return 0==t.b.length&&(t.b=t.a,t.b.reverse(),t.a=[]),t.b.pop()};Xt.prototype.o=function(){return this.b.length+this.a.length},Xt.prototype.F=function(){return 0==this.b.length&&0==this.a.length},Xt.prototype.clear=function(){this.b=[],this.a=[]},Xt.prototype.w=function(){for(var t=[],e=this.b.length-1;e>=0;--e)t.push(this.b[e]);for(var n=this.a.length,e=0;n>e;++e)t.push(this.a[e]);return t};var Qt,zt=function(t){if(t.w&&"function"==typeof t.w)return t.w();if(s(t))return t.split("");if(a(t)){for(var e=[],n=t.length,i=0;n>i;i++)e.push(t[i]);return e}return D(t)},Gt=function(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(a(t)||s(t))bt(t,e,void 0);else{var n;if(t.D&&"function"==typeof t.D)n=t.D();else if(t.w&&"function"==typeof t.w)n=void 0;else if(a(t)||s(t)){n=[];for(var i=t.length,r=0;i>r;r++)n.push(r)}else n=U(t);for(var i=zt(t),r=i.length,o=0;r>o;o++)e.call(void 0,i[o],n&&n[o],t)}},Jt=function(t){n.setTimeout(function(){throw t},0)},Yt=function(){var t=n.MessageChannel;if("undefined"==typeof t&&"undefined"!=typeof window&&window.postMessage&&window.addEventListener&&!pt("Presto")&&(t=function(){var t=document.createElement("IFRAME");t.style.display="none",t.src="",document.documentElement.appendChild(t);var e=t.contentWindow,t=e.document;t.open(),t.write(""),t.close();var n="callImmediate"+Math.random(),i="file:"==e.location.protocol?"*":e.location.protocol+"//"+e.location.host,t=p(function(t){"*"!=i&&t.origin!=i||t.data!=n||this.port1.onmessage()},this);e.addEventListener("message",t,!1),this.port1={},this.port2={postMessage:function(){e.postMessage(n,i)}}}),"undefined"!=typeof t&&!pt("Trident")&&!pt("MSIE")){var e=new t,r={},o=r;return e.port1.onmessage=function(){if(i(r.next)){r=r.next;var t=r.ea;r.ea=null,t()}},function(t){o.next={ea:t},o=o.next,e.port2.postMessage(0)}}return"undefined"!=typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(t){var e=document.createElement("SCRIPT");e.onreadystatechange=function(){e.onreadystatechange=null,e.parentNode.removeChild(e),e=null,t(),t=null},document.documentElement.appendChild(e)}:function(t){n.setTimeout(t,0)}},Zt="StopIteration"in n?n.StopIteration:{message:"StopIteration",stack:""},$t=function(){};$t.prototype.next=function(){throw Zt},$t.prototype.X=function(){return this};var te=function(){Bt.call(this)};v(te,Bt);var ee,ne=pt("Opera"),ie=pt("Trident")||pt("MSIE"),re=pt("Edge"),oe=pt("Gecko")&&!(-1!=lt.toLowerCase().indexOf("webkit")&&!pt("Edge"))&&!(pt("Trident")||pt("MSIE"))&&!pt("Edge"),ae=-1!=lt.toLowerCase().indexOf("webkit")&&!pt("Edge"),se=function(){var t=n.document;return t?t.documentMode:void 0};t:{var ue="",le=function(){var t=lt;return oe?/rv\:([^\);]+)(\)|;)/.exec(t):re?/Edge\/([\d\.]+)/.exec(t):ie?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(t):ae?/WebKit\/(\S+)/.exec(t):ne?/(?:Version)[ \/]?(\S+)/.exec(t):void 0}();if(le&&(ue=le?le[1]:""),ie){var ce=se();if(null!=ce&&ce>parseFloat(ue)){ee=String(ce);break t}}ee=ue}var he,fe,de=ee,pe={},ge=function(t){var e;if(!(e=pe[t])){e=0;for(var n=z(String(de)).split("."),i=z(String(t)).split("."),r=Math.max(n.length,i.length),o=0;0==e&&r>o;o++){var a=n[o]||"",s=i[o]||"",u=/(\d*)(\D*)/g,l=/(\d*)(\D*)/g;do{var c=u.exec(a)||["","",""],h=l.exec(s)||["","",""];if(0==c[0].length&&0==h[0].length)break;e=G(0==c[1].length?0:parseInt(c[1],10),0==h[1].length?0:parseInt(h[1],10))||G(0==c[2].length,0==h[2].length)||G(c[2],h[2])}while(0==e)}e=pe[t]=e>=0}return e},ve=n.document,me=ve&&ie?se()||("CSS1Compat"==ve.compatMode?parseInt(de,10):5):void 0,be=function(t,e){he||ye(),qe||(he(),qe=!0);var n=we,i=At.get();i.set(t,e),n.b?n.b.next=i:(ot(!n.a),n.a=i),n.b=i},ye=function(){if(n.Promise&&n.Promise.resolve){var t=n.Promise.resolve(void 0);he=function(){t.then(xe)}}else he=function(){var t=xe;!u(n.setImmediate)||n.Window&&n.Window.prototype&&!pt("Edge")&&n.Window.prototype.setImmediate==n.setImmediate?(Qt||(Qt=Yt()),Qt(t)):n.setImmediate(t)}},qe=!1,we=new function(){this.b=this.a=null},xe=function(){for(var t;t=St();){try{t.a.call(t.b)}catch(e){Jt(e)}P(At,t)}qe=!1};(fe=!ie)||(fe=9<=Number(me));var Ee=fe,ke=ie&&!ge("9");!ae||ge("528"),oe&&ge("1.9b")||ie&&ge("8")||ne&&ge("9.5")||ae&&ge("528"),oe&&!ge("8")||ie&&ge("9");var Te=function(t,e){this.b={},this.a=[],this.f=this.c=0;var n=arguments.length;if(n>1){if(n%2)throw Error("Uneven number of arguments");for(var i=0;n>i;i+=2)this.set(arguments[i],arguments[i+1])}else if(t){t instanceof Te?(n=t.D(),i=t.w()):(n=U(t),i=D(t));for(var r=0;r2*t.c&&Se(t),!0):!1},Se=function(t){if(t.c!=t.a.length){for(var e=0,n=0;e=i.a.length)throw Zt;var r=i.a[e++];return t?r:i.b[r]},r};var _e=function(t,e){if(It.call(this,t?t.type:""),this.c=this.a=this.target=null,t){if(this.type=t.type,this.target=t.target||t.srcElement,this.a=e,(e=t.relatedTarget)&&oe)try{V(e.nodeName); -}catch(n){}this.c=t,t.defaultPrevented&&this.b()}};v(_e,It),_e.prototype.b=function(){_e.G.b.call(this);var t=this.c;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,ke)try{(t.ctrlKey||112<=t.keyCode&&123>=t.keyCode)&&(t.keyCode=-1)}catch(e){}};var Ie=function(t,e){if(this.a=0,this.i=void 0,this.c=this.b=this.f=null,this.g=this.h=!1,t!=r)try{var n=this;t.call(e,function(t){Ne(n,2,t)},function(t){try{if(t instanceof Error)throw t;throw Error("Promise rejected.")}catch(e){}Ne(n,3,t)})}catch(i){Ne(this,3,i)}},Re=function(){this.next=this.f=this.c=this.a=this.b=null,this.g=!1};Re.prototype.reset=function(){this.f=this.c=this.a=this.b=null,this.g=!1};var Me=new C(function(){return new Re},function(t){t.reset()},100),Oe=function(t,e,n){var i=Me.get();return i.a=t,i.c=e,i.f=n,i},Fe=function(t){if(t instanceof Ie)return t;var e=new Ie(r);return Ne(e,2,t),e},Ce=function(t){return new Ie(function(e,n){n(t)})};Ie.prototype.then=function(t,e,n){return null!=t&&st(t,"opt_onFulfilled should be a function."),null!=e&&st(e,"opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?"),Le(this,u(t)?t:null,u(e)?e:null,n)},K(Ie),Ie.prototype.l=function(t,e){return Le(this,null,t,e)};var Pe=function(t,e){t.b||2!=t.a&&3!=t.a||De(t),ot(null!=e.a),t.c?t.c.next=e:t.b=e,t.c=e},Le=function(t,e,n,i){var r=Oe(null,null,null);return r.b=new Ie(function(t,o){r.a=e?function(n){try{var r=e.call(i,n);t(r)}catch(a){o(a)}}:t,r.c=n?function(e){try{var r=n.call(i,e);t(r)}catch(a){o(a)}}:o}),r.b.f=t,Pe(t,r),r.b};Ie.prototype.s=function(t){ot(1==this.a),this.a=0,Ne(this,2,t)},Ie.prototype.m=function(t){ot(1==this.a),this.a=0,Ne(this,3,t)};var Ne=function(t,e,n){if(0==t.a){t==n&&(e=3,n=new TypeError("Promise cannot resolve to itself")),t.a=1;var i;t:{var o=n,a=t.s,s=t.m;if(o instanceof Ie)null!=a&&st(a,"opt_onFulfilled should be a function."),null!=s&&st(s,"opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?"),Pe(o,Oe(a||r,s||null,t)),i=!0;else if(X(o))o.then(a,s,t),i=!0;else{if(l(o))try{var c=o.then;if(u(c)){je(o,c,a,s,t),i=!0;break t}}catch(h){s.call(t,h),i=!0;break t}i=!1}}i||(t.i=n,t.a=e,t.f=null,De(t),3!=e||We(t,n))}},je=function(t,e,n,i,r){var o=!1,a=function(t){o||(o=!0,n.call(r,t))},s=function(t){o||(o=!0,i.call(r,t))};try{e.call(t,a,s)}catch(u){s(u)}},De=function(t){t.h||(t.h=!0,be(t.j,t))},Ue=function(t){var e=null;return t.b&&(e=t.b,t.b=e.next,e.next=null),t.b||(t.c=null),null!=e&&ot(null!=e.a),e};Ie.prototype.j=function(){for(var t;t=Ue(this);){var e=this.a,n=this.i;if(3==e&&t.c&&!t.g){var i;for(i=this;i&&i.g;i=i.f)i.g=!1}if(t.b)t.b.f=null,He(t,e,n);else try{t.g?t.a.call(t.f):He(t,e,n)}catch(r){Be.call(null,r)}P(Me,t)}this.h=!1};var He=function(t,e,n){2==e?t.a.call(t.f,n):t.c&&t.c.call(t.f,n)},We=function(t,e){t.g=!0,be(function(){t.g&&Be.call(null,e)})},Be=Jt,Ke=function(t){if(this.a=new Te,t){t=zt(t);for(var e=t.length,n=0;e>n;n++){var i=t[n];this.a.set(Xe(i),i)}}},Xe=function(t){var e=typeof t;return"object"==e&&t||"function"==e?"o"+(t[c]||(t[c]=++h)):e.substr(0,1)+t};t=Ke.prototype,t.o=function(){return this.a.o()},t.clear=function(){this.a.clear()},t.F=function(){return this.a.F()},t.w=function(){return this.a.w()},t.clone=function(){return new Ke(this)},t.X=function(){return this.a.X(!1)};var Ve=function(t){return function(){var e=[];Array.prototype.push.apply(e,arguments),Fe(!0).then(function(){t.apply(null,e)})}},Qe="closure_lm_"+(1e6*Math.random()|0),ze={},Ge=0,Je=function(t,e,n,i,r){if("array"==o(e)){for(var a=0;a-1&&(Ot(a[n]),ot(null!=a.length),Array.prototype.splice.call(a,n,1),0==a.length&&(delete t.a[e],t.b--)))):t&&(t=sn(t))&&(e=t.a[e.toString()],t=-1,e&&(t=Dt(e,n,!!i,r)),(n=t>-1?e[t]:null)&&en(n))},en=function(t){if("number"!=typeof t&&t&&!t.O){var e=t.src;if(e&&e[ct])jt(e.b,t);else{var n=t.type,i=t.a;e.removeEventListener?e.removeEventListener(n,i,t.U):e.detachEvent&&e.detachEvent(nn(n),i),Ge--,(n=sn(e))?(jt(n,t),0==n.b&&(n.src=null,e[Qe]=null)):Ot(t)}}},nn=function(t){return t in ze?ze[t]:ze[t]="on"+t},rn=function(t,e,n,i){var r=!0;if((t=sn(t))&&(e=t.a[e.toString()]))for(e=e.concat(),t=0;ti.keyCode||void 0!=i.returnValue)){t:{var o=!1;if(0==i.keyCode)try{i.keyCode=-1;break t}catch(a){o=!0}(o||void 0==i.returnValue)&&(i.returnValue=!0)}for(i=[],o=e.a;o;o=o.parentNode)i.push(o);for(t=t.type,o=i.length-1;o>=0;o--){e.a=i[o];var s=rn(i[o],t,!0,e),r=r&&s}for(o=0;o>>0),ln=function(t){return ot(t,"Listener can not be null."),u(t)?t:(ot(t.handleEvent,"An object listener must have handleEvent method."),t[un]||(t[un]=function(e){return t.handleEvent(e)}),t[un])},cn=function(t,e){if(ut.call(this),this.l=t||0,this.c=e||10,this.l>this.c)throw Error("[goog.structs.Pool] Min can not be greater than max");this.a=new Xt,this.b=new Ke,this.i=null,this.S()};v(cn,ut),cn.prototype.W=function(){var t=g();if(!(null!=this.i&&0>t-this.i)){for(var e;0this.c&&0=kn(this).value)for(u(e)&&(e=e()),t=new N(t,String(e),this.f),i&&(t.a=i),i="log:"+t.b,n.console&&(n.console.timeStamp?n.console.timeStamp(i):n.console.markTimeline&&n.console.markTimeline(i)),n.msWriteProfilerMark&&n.msWriteProfilerMark(i),i=this;i;)i=i.a};var Tn={},An=null,Sn=function(t){An||(An=new yn(""),Tn[""]=An,An.c=xn);var e;if(!(e=Tn[t])){e=new yn(t);var n=t.lastIndexOf("."),i=t.substr(n+1),n=Sn(t.substr(0,n));n.b||(n.b={}),n.b[i]=e,e.a=n,Tn[t]=e}return e},_n=function(){ut.call(this),this.b=new Lt(this),this.ma=this,this.I=null};v(_n,ut),_n.prototype[ct]=!0,_n.prototype.removeEventListener=function(t,e,n,i){tn(this,t,e,n,i)};var In=function(t,e){Mn(t);var n,i=t.I;if(i){n=[];for(var r=1;i;i=i.I)n.push(i),ot(1e3>++r,"infinite loop")}t=t.ma,i=e.type||e,s(e)?e=new It(e,t):e instanceof It?e.target=e.target||t:(r=e,e=new It(i,t),B(e,r));var o,r=!0;if(n)for(var a=n.length-1;a>=0;a--)o=e.a=n[a],r=Rn(o,i,!0,e)&&r;if(o=e.a=t,r=Rn(o,i,!0,e)&&r,r=Rn(o,i,!1,e)&&r,n)for(a=0;a=o)n=void 0;else{if(1==o)Et(r);else{r[0]=r.pop();for(var r=0,i=i.a,o=i.length,a=i[r];o>>1>r;){var s=2*r+1,u=2*r+2,s=o>u&&i[u].aa.a)break;i[r]=i[s],r=s}i[r]=a}n=n.b}n.apply(this,[e])}},t.Y=function(t){On.G.Y.call(this,t),this.$()},t.S=function(){On.G.S.call(this),this.$()},t.A=function(){On.G.A.call(this),n.clearTimeout(void 0),this.f.clear(),this.f=null};var Fn=function(t,e){t&&t.log(En,e,void 0)},Cn=function(t,e,i){if(u(t))i&&(t=p(t,i));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=p(t.handleEvent,t)}return 2147483647=500&&600>o||429===o?(i=7===e.J,hn(e),t(!1,new ri(!1,null,i))):(i=0<=mt(r.I,o),t(!0,new ri(i,e)))})})}function n(t,e){var n=r.l;t=r.s;var o=e.c;if(e.b)try{var a=r.v(o,Zn(o));i(a)?n(a):n()}catch(s){t(s)}else null!==o?(e=q(),a=Zn(o),e.serverResponse=a,t(r.j?r.j(o,e):e)):(e=e.a?r.h?T():E():new y("retry-limit-exceeded","Max retry time for operation exceeded, please try again."),t(e));hn(o)}var r=t;t.i?n(0,new ri(!1,null,!0)):t.f=m(e,n,t.K)};ii.prototype.a=function(){return this.C},ii.prototype.b=function(t){this.i=!0,this.h=t||!1,null!==this.f&&(0,this.f)(!1),null!==this.c&&Kn(this.c)};var ai=function(t,e,n){var i=et(t.f),i=t.l+i,r=t.b?S(t.b):{};return null!==e&&0e&&(e+=t.size),0>e&&(e=0),0>n&&(n+=t.size),e>n&&(n=e),t.slice(e,n-e)):t.slice(e,n):null},li=function(t){this.c=Ce(t)};li.prototype.a=function(){return this.c},li.prototype.b=function(){};var ci=function(){this.a={},this.b=Number.MIN_SAFE_INTEGER},hi=function(t,e){function n(){delete r.a[i]}var i=t.b;t.b++,t.a[i]=e;var r=t;e.a().then(n,n)};ci.prototype.clear=function(){A(this.a,function(t,e){e&&e.b(!0)}),this.a={}};var fi=function(t,e,n,i){this.a=t,this.f=null,null!==this.a&&(t=this.a.options,O(t)?this.f=t.storageBucket||null:this.f=null),this.l=e,this.j=n,this.i=i,this.c=12e4,this.b=6e4,this.h=new ci,this.g=!1},di=function(t){return null!==t.a&&O(t.a.INTERNAL)&&O(t.a.INTERNAL.getToken)?t.a.INTERNAL.getToken().then(function(t){return O(t)?t.accessToken:null},function(){return null}):Fe(null)};fi.prototype.bucket=function(){if(this.g)throw T();return this.f};var pi=function(t,e,n){return t.g?new li(T()):(e=t.j(e,n,null===t.a),hi(t.h,e),e)},gi=function(t,e){return e},vi=function(t,e,n,i){this.c=t,this.b=e||t,this.f=!!n,this.a=i||gi},mi=null,bi=function(){if(mi)return mi;var t=[];t.push(new vi("bucket")),t.push(new vi("generation")),t.push(new vi("metageneration")),t.push(new vi("name","fullPath",!0));var e=new vi("name");return e.a=function(t,e){return!F(e)||2>e.length?e:Pt(e)},t.push(e),e=new vi("size"),e.a=function(t,e){return O(e)?+e:e},t.push(e),t.push(new vi("timeCreated")),t.push(new vi("updated")),t.push(new vi("md5Hash",null,!0)),t.push(new vi("cacheControl",null,!0)),t.push(new vi("contentDisposition",null,!0)),t.push(new vi("contentEncoding",null,!0)),t.push(new vi("contentLanguage",null,!0)),t.push(new vi("contentType",null,!0)),t.push(new vi("metadata","customMetadata",!0)),t.push(new vi("downloadTokens","downloadURLs",!1,function(t,e){if(!(F(e)&&0r;r++){var o=e[r];o.f&&(n[o.c]=t[o.b])}return JSON.stringify(n)},wi=function(t){if(!t||"object"!=typeof t)throw"Expected Metadata object.";for(var e in t){var n=t[e];if("customMetadata"===e&&"object"!=typeof n)throw"Expected object for 'customMetadata' mapping."}},xi=function(t,e,n){for(var i=e.length,r=e.length,o=0;o=0))throw"Expected a number 0 or greater."})},_i=function(t,e){return new Ei(function(e){if(!(null===e||O(e)&&e instanceof Object))throw"Expected an Object.";O(t)&&t(e)},e)},Ii=function(){return new Ei(function(t){if(null!==t&&!u(t))throw"Expected a Function."},!0)},Ri=function(t){if(!t)throw q()},Mi=function(t,e){return function(n,i){t:{var r;try{r=JSON.parse(i)}catch(o){n=null;break t}n=l(r)?r:null}if(null===n)n=null;else{i={type:"file"},r=e.length;for(var a=0;r>a;a++){var s=e[a];i[s.b]=s.a(i,n[s.c])}yi(i,t),n=i}return Ri(null!==n),n}},Oi=function(t){return function(e,n){return e=404===Yn(e)?new y("object-not-found","Object '"+t.path+"' does not exist."):401===Yn(e)?w():403===Yn(e)?x(t.path):n,e.serverResponse=n.serverResponse,e}},Fi=function(t){return function(e,n){return e=401===Yn(e)?w():403===Yn(e)?x(t.path):n,e.serverResponse=n.serverResponse,e}},Ci=function(t,e,n){var i=Z(e);return t=new _(b+"/v0"+i,"GET",Mi(t,n),t.c),t.a=Oi(e),t},Pi=function(t,e){var n=Z(e);return t=new _(b+"/v0"+n,"DELETE",function(){},t.c),t.h=[200,204],t.a=Oi(e),t},Li=function(t,e,n){return n=n?S(n):{},n.fullPath=t.path,n.size=e.size,n.contentType||(n.contentType=e&&e.type||"application/octet-stream"),n},Ni=function(t,e,n,i,r){var o,a="/b/"+encodeURIComponent(e.bucket)+"/o",s={"X-Goog-Upload-Protocol":"multipart"};o="";for(var u=0;2>u;u++)o+=Math.random().toString().slice(2);return s["Content-Type"]="multipart/related; boundary="+o,r=Li(e,i,r),u=qi(r,n),i=si("--"+o+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+u+"\r\n--"+o+"\r\nContent-Type: "+r.contentType+"\r\n\r\n",i,"\r\n--"+o+"--"),t=new _(b+"/v0"+a,"POST",Mi(t,n),t.b),t.f={name:r.fullPath},t.b=s,t.c=i,t.a=Fi(e),t},ji=function(t,e,n,i){this.a=t,this.total=e,this.b=!!n,this.c=i||null},Di=function(t,e){var n;try{n=$n(t,"X-Goog-Upload-Status")}catch(i){Ri(!1)}return t=0<=mt(e||["active"],n),Ri(t),n},Ui=function(t,e,n,i,r){var o="/b/"+encodeURIComponent(e.bucket)+"/o",a=Li(e,i,r);return r={name:a.fullPath},o=b+"/v0"+o,i={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":i.size,"X-Goog-Upload-Header-Content-Type":a.contentType,"Content-Type":"application/json; charset=utf-8"},n=qi(a,n),t=new _(o,"POST",function(t){Di(t);var e;try{e=$n(t,"X-Goog-Upload-URL")}catch(n){Ri(!1)}return Ri(F(e)),e},t.b),t.f=r,t.b=i,t.c=n,t.a=Fi(e),t},Hi=function(t,e,n,i){return t=new _(n,"POST",function(t){var e,n=Di(t,["active","final"]);try{e=$n(t,"X-Goog-Upload-Size-Received")}catch(r){Ri(!1)}return t=e,isFinite(t)&&(t=String(t)),t=s(t)?/^\s*-?0x/i.test(t)?parseInt(t,16):parseInt(t,10):NaN,Ri(!isNaN(t)),new ji(t,i.size,"final"===n)},t.b),t.b={"X-Goog-Upload-Command":"query"},t.a=Fi(e),t},Wi=function(t,e,n,i,r,o){var a=new ji(0,0);if(o?(a.a=o.a,a.total=o.total):(a.a=0,a.total=i.size),i.size!==a.total)throw new y("server-file-wrong-size","Server recorded incorrect upload file size, please retry the upload.");var s=o=a.total-a.a,s=Math.min(s,262144),u=a.a;if(o={"X-Goog-Upload-Command":s===o?"upload, finalize":"upload","X-Goog-Upload-Offset":a.a},u=ui(i,u,u+s),null===u)throw new y("cannot-slice-blob","Cannot slice blob for upload. Please retry the upload.");return n=new _(n,"POST",function(t,n){var o,u=Di(t,["active","final"]),l=a.a+s,c=i.size;return o="final"===u?Mi(e,r)(t,n):null,new ji(l,c,"final"===u,o)},e.b),n.b=o,n.c=u,n.g=null,n.a=Fi(t),n},Bi=function(t,e,n,i,r,o){this.K=t,this.c=e,this.i=n,this.f=r,this.h=o||null,this.l=i,this.j=0,this.B=this.s=!1,this.v=[],this.R=262144n&&er(t)},Zi=function(t,e){if(t.b!==e)switch(e){case"canceling":t.b=e,null!==t.a&&t.a.b();break;case"pausing":t.b=e,null!==t.a&&t.a.b();break;case"running":var n="paused"===t.b;t.b=e,n&&(er(t),Ki(t));break;case"paused":t.b=e,er(t);break;case"canceled":t.g=E(),t.b=e,er(t);break;case"error":t.b=e,er(t);break;case"success":t.b=e,er(t)}},$i=function(t){switch(t.b){case"pausing":Zi(t,"paused");break;case"canceling":Zi(t,"canceled");break;case"running":Ki(t)}};Bi.prototype.C=function(){return new nt(this.j,this.f.size,M(this.b),this.h,this,this.K)},Bi.prototype.I=function(t,e,n,r){function o(t){try{return void s(t)}catch(e){}try{if(u(t),!(i(t.next)||i(t.error)||i(t.complete)))throw""}catch(e){throw"Expected a function or an Object with one of `next`, `error`, `complete` properties."}}function a(t){return function(e,n,i){null!==t&&xi("on",t,arguments);var r=new tt(e,n,i);return tr(l,r),function(){kt(l.v,r)}}}var s=Ii().a,u=_i(null,!0).a;xi("on",[Ti(function(){if("state_changed"!==t)throw"Expected one of the event types: [state_changed]."}),_i(o,!0),Ii(),Ii()],arguments);var l=this,c=[_i(function(t){if(null===t)throw"Expected a function or an Object with one of `next`, `error`, `complete` properties.";o(t)}),Ii(),Ii()];return i(e)||i(n)||i(r)?a(null)(e,n,r):a(c)};var tr=function(t,e){t.v.push(e),nr(t,e)},er=function(t){var e=Tt(t.v);bt(e,function(e){nr(t,e)})},nr=function(t,e){switch(M(t.b)){case"running":case"paused":null!==e.next&&Ve(e.next.bind(e,t.C()))();break;case"success":null!==e.a&&Ve(e.a.bind(e))();break;case"canceled":case"error":null!==e.error&&Ve(e.error.bind(e,t.g))();break;default:null!==e.error&&Ve(e.error.bind(e,t.g))()}};Bi.prototype.M=function(){xi("resume",[],arguments);var t="paused"===this.b||"pausing"===this.b;return t&&Zi(this,"running"),t},Bi.prototype.L=function(){xi("pause",[],arguments);var t="running"===this.b;return t&&Zi(this,"pausing"),t},Bi.prototype.H=function(){xi("cancel",[],arguments);var t="running"===this.b||"pausing"===this.b;return t&&Zi(this,"canceling"),t};var ir=function(t,e){if(this.b=t,e)this.a=e instanceof Y?e:$(e);else{if(t=t.bucket(),null===t)throw new y("no-default-bucket","No default bucket found. Did you set the 'storageBucket' property when initializing the app?");this.a=new Y(t,"")}};ir.prototype.toString=function(){return xi("toString",[],arguments),"gs://"+this.a.bucket+"/"+this.a.path};var rr=function(t,e){return new ir(t,e)};t=ir.prototype,t.ga=function(t){xi("child",[Ti()],arguments);var e=Ct(this.a.path,t);return rr(this.b,new Y(this.a.bucket,e))},t.Fa=function(){var t;if(t=this.a.path,0==t.length)t=null;else{var e=t.lastIndexOf("/");t=-1===e?"":t.slice(0,e)}return null===t?null:rr(this.b,new Y(this.a.bucket,t))},t.Ha=function(){return rr(this.b,new Y(this.a.bucket,""))},t.pa=function(){return this.a.bucket},t.Aa=function(){return this.a.path},t.Ea=function(){return Pt(this.a.path)},t.Ja=function(){return this.b.i},t.ua=function(t,e){return xi("put",[Ai(),new Ei(wi,!0)],arguments),or(this,"put"),new Bi(this,this.b,this.a,bi(),t,e)},t["delete"]=function(){xi("delete",[],arguments),or(this,"delete");var t=this;return di(this.b).then(function(e){var n=Pi(t.b,t.a);return pi(t.b,n,e).a()})},t.ha=function(){xi("getMetadata",[],arguments),or(this,"getMetadata");var t=this;return di(this.b).then(function(e){var n=Ci(t.b,t.a,bi());return pi(t.b,n,e).a()})},t.va=function(t){xi("updateMetadata",[new Ei(wi,void 0)],arguments),or(this,"updateMetadata");var e=this;return di(this.b).then(function(n){var i=e.b,r=e.a,o=t,a=bi(),s=Z(r),s=b+"/v0"+s,o=qi(o,a),i=new _(s,"PATCH",Mi(i,a),i.c);return i.b={"Content-Type":"application/json; charset=utf-8"},i.c=o,i.a=Oi(r),pi(e.b,i,n).a()})},t.ta=function(){return xi("getDownloadURL",[],arguments),or(this,"getDownloadURL"),this.ha().then(function(t){if(t=t.downloadURLs[0],O(t))return t;throw new y("no-download-url","The given file does not have any download URLs.")})};var or=function(t,e){if(""===t.a.path)throw new y("invalid-root-operation","The operation '"+e+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")},ar=function(t){this.a=new fi(t,function(t,e){return new ir(t,e)},ai,this),this.b=t,this.c=new sr(this)};t=ar.prototype,t.wa=function(t){xi("ref",[Ti(function(t){if(/^[A-Za-z]+:\/\//.test(t))throw"Expected child path but got a URL, use refFromURL instead."},!0)],arguments);var e=new ir(this.a);return i(t)?e.ga(t):e},t.xa=function(t){return xi("refFromURL",[Ti(function(t){if(!/^[A-Za-z]+:\/\//.test(t))throw"Expected full URL but got a child path, use ref instead.";try{$(t)}catch(e){throw"Expected valid full URL but got an invalid one."}},!1)],arguments),new ir(this.a,t)},t.Ca=function(){return this.a.b},t.za=function(t){xi("setMaxUploadRetryTime",[Si()],arguments),this.a.b=t},t.Ba=function(){return this.a.c},t.ya=function(t){xi("setMaxOperationRetryTime",[Si()],arguments),this.a.c=t},t.oa=function(){return this.b},t.la=function(){return this.c};var sr=function(t){this.a=t};sr.prototype["delete"]=function(){var t=this.a.a;t.g=!0,t.a=null,t.h.clear()};var ur=function(t,e,n){Object.defineProperty(t,e,{get:n})};ir.prototype.toString=ir.prototype.toString,ir.prototype.child=ir.prototype.ga,ir.prototype.put=ir.prototype.ua,ir.prototype["delete"]=ir.prototype["delete"],ir.prototype.getMetadata=ir.prototype.ha,ir.prototype.updateMetadata=ir.prototype.va,ir.prototype.getDownloadURL=ir.prototype.ta,ur(ir.prototype,"parent",ir.prototype.Fa),ur(ir.prototype,"root",ir.prototype.Ha),ur(ir.prototype,"bucket",ir.prototype.pa),ur(ir.prototype,"fullPath",ir.prototype.Aa),ur(ir.prototype,"name",ir.prototype.Ea),ur(ir.prototype,"storage",ir.prototype.Ja),ar.prototype.ref=ar.prototype.wa,ar.prototype.refFromURL=ar.prototype.xa,ur(ar.prototype,"maxOperationRetryTime",ar.prototype.Ba),ar.prototype.setMaxOperationRetryTime=ar.prototype.ya,ur(ar.prototype,"maxUploadRetryTime",ar.prototype.Ca),ar.prototype.setMaxUploadRetryTime=ar.prototype.za,ur(ar.prototype,"app",ar.prototype.oa), -ur(ar.prototype,"INTERNAL",ar.prototype.la),sr.prototype["delete"]=sr.prototype["delete"],ar.prototype.capi_=function(t){b=t},Bi.prototype.on=Bi.prototype.I,Bi.prototype.resume=Bi.prototype.M,Bi.prototype.pause=Bi.prototype.L,Bi.prototype.cancel=Bi.prototype.H,ur(Bi.prototype,"snapshot",Bi.prototype.C),ur(nt.prototype,"bytesTransferred",nt.prototype.qa),ur(nt.prototype,"totalBytes",nt.prototype.La),ur(nt.prototype,"state",nt.prototype.Ia),ur(nt.prototype,"metadata",nt.prototype.Da),ur(nt.prototype,"downloadURL",nt.prototype.sa),ur(nt.prototype,"task",nt.prototype.Ka),ur(nt.prototype,"ref",nt.prototype.Ga),I.STATE_CHANGED="state_changed",R.RUNNING="running",R.PAUSED="paused",R.SUCCESS="success",R.CANCELED="canceled",R.ERROR="error",Ie.prototype["catch"]=Ie.prototype.l,Ie.prototype.then=Ie.prototype.then,function(){function t(t){return new ar(t)}var e={TaskState:R,TaskEvent:I,Storage:ar,Reference:ir};if(!(window.firebase&&firebase.INTERNAL&&firebase.INTERNAL.registerService))throw Error("Cannot install Firebase Storage - be sure to load firebase-app.js first.");firebase.INTERNAL.registerService("storage",t,e)}()}()}).call(exports,function(){return this}())},function(t,e){function n(t,e,n){for(var i=[],r=Math.ceil(e/t.columns),o=0;r>o;o++)for(var a=0;ar;r++){var o=r*(2*Math.PI)/e;i.push([n.x+t.radius*Math.cos(o),n.y,n.z+t.radius*Math.sin(o)])}return i}function r(t,e,i){return t.columns=e,n(t,e,i)}function o(t,e,n){return u([[1,0,0],[0,1,0],[0,0,1],[-1,0,0],[0,-1,0],[0,0,-1]],n,t.radius/2)}function a(t,e,n){var i=(1+Math.sqrt(5))/2,r=1/i,o=2-i,a=-1*r,s=-1*o;return u([[-1,o,0],[-1,s,0],[0,-1,o],[0,-1,s],[0,1,o],[0,1,s],[1,o,0],[1,s,0],[r,r,r],[r,r,a],[r,a,r],[r,a,a],[o,0,1],[o,0,-1],[a,r,r],[a,r,a],[a,a,r],[a,a,a],[s,0,1],[s,0,-1]],n,t.radius/2)}function s(t,e,n){var i=Math.sqrt(3),r=-1/Math.sqrt(3),o=2*Math.sqrt(2/3);return u([[0,0,i+r],[-1,0,r],[1,0,r],[0,o,0]],n,t.radius/2)}function u(t,e,n){return e=[e.x,e.y,e.z],t.map(function(t){return t.map(function(t,i){return t*n+e[i]})})}function l(t,e){t.forEach(function(t,n){var i=e[n];t.setAttribute("position",{x:i[0],y:i[1],z:i[2]})})}AFRAME.registerComponent("layout",{schema:{columns:{"default":1,min:0,"if":{type:["box"]}},margin:{"default":1,min:0,"if":{type:["box","line"]}},radius:{"default":1,min:0,"if":{type:["circle","cube","dodecahedron","pyramid"]}},type:{"default":"line",oneOf:["box","circle","cube","dodecahedron","line","pyramid"]}},init:function(){var t=this,e=this.el,n=n=[];this.children=e.getChildEntities(),this.children.forEach(function(t){n.push(t.getComputedAttribute("position"))}),e.addEventListener("child-attached",function(e){t.children.push(e.detail.el),t.update()})},update:function(t){var e,u,c=this.children,h=this.data,f=this.el,d=c.length,p=f.getComputedAttribute("position");switch(h.type){case"box":e=n;break;case"circle":e=i;break;case"cube":e=o;break;case"dodecahedron":e=a;break;case"pyramid":e=s;break;default:e=r}u=e(h,d,p),l(c,u)},remove:function(){el.removeEventListener("child-attached",this.childAttachedCallback),l(children,this.initialPositions)}}),t.exports.getBoxPositions=n,t.exports.getCirclePositions=i,t.exports.getLinePositions=r,t.exports.getCubePositions=o,t.exports.getDodecahedronPositions=a,t.exports.getPyramidPositions=s},function(t,e){var n=AFRAME.utils.debug,i=AFRAME.utils.coordinates,r=n("components:look-at:warn"),o=i.isCoordinate;AFRAME.registerComponent("look-at",{schema:{"default":"",parse:function(t){return o(t)||"object"==typeof t?i.parse(t):t},stringify:function(t){return"object"==typeof t?i.stringify(t):t}},init:function(){this.target3D=null,this.vector=new THREE.Vector3},update:function(){var t,e=this,n=e.data,i=e.el.object3D;return!n||"object"==typeof n&&!Object.keys(n).length?e.remove():"object"==typeof n?i.lookAt(new THREE.Vector3(n.x,n.y,n.z)):(t=e.el.sceneEl.querySelector(n),t?t.hasLoaded?e.beginTracking(t):t.addEventListener("loaded",function(){e.beginTracking(t)}):void r('"'+n+'" does not point to a valid entity to look-at'))},tick:function(t){var e=this.target3D;return e?this.el.object3D.lookAt(this.vector.setFromMatrixPosition(e.matrixWorld)):void 0},beginTracking:function(t){this.target3D=t.object3D}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("random-color",{schema:{min:{"default":{x:0,y:0,z:0},type:"vec3"},max:{"default":{x:1,y:1,z:1},type:"vec3"}},update:function(){var t=this.data,e=t.max,n=t.min;this.el.setAttribute("material","color","#"+new THREE.Color(Math.random()*e.x+n.x,Math.random()*e.y+n.y,Math.random()*e.z+n.z).getHexString())}}),AFRAME.registerComponent("random-position",{schema:{min:{"default":{x:-10,y:-10,z:-10},type:"vec3"},max:{"default":{x:10,y:10,z:10},type:"vec3"}},update:function(){var t=this.data,e=t.max,n=t.min;this.el.setAttribute("position",{x:Math.random()*(e.x-n.x)+n.x,y:Math.random()*(e.y-n.y)+n.y,z:Math.random()*(e.z-n.z)+n.z})}}),AFRAME.registerComponent("random-spherical-position",{schema:{radius:{"default":10},startX:{"default":0},lengthX:{"default":360},startY:{"default":0},lengthY:{"default":360},startZ:{"default":0},lengthZ:{"default":360}},update:function(){var t=this.data,e=THREE.Math.degToRad(Math.random()*t.lengthX+t.startX),n=THREE.Math.degToRad(Math.random()*t.lengthY+t.startY);THREE.Math.degToRad(Math.random()*t.lengthZ+t.startZ);this.el.setAttribute("position",{x:t.radius*Math.cos(e)*Math.sin(n),y:t.radius*Math.sin(e)*Math.sin(n),z:t.radius*Math.cos(n)})}}),AFRAME.registerComponent("random-rotation",{schema:{min:{"default":{x:0,y:0,z:0},type:"vec3"},max:{"default":{x:360,y:360,z:360},type:"vec3"}},update:function(){var t=this.data,e=t.max,n=t.min;this.el.setAttribute("rotation",{x:Math.random()*e.x+n.x,y:Math.random()*e.y+n.y,z:Math.random()*e.z+n.z})}}),AFRAME.registerComponent("random-scale",{schema:{min:{"default":{x:0,y:0,z:0},type:"vec3"},max:{"default":{x:2,y:2,z:2},type:"vec3"}},update:function(){var t=this.data,e=t.max,n=t.min;this.el.setAttribute("scale",{x:Math.random()*e.x+n.x,y:Math.random()*e.y+n.y,z:Math.random()*e.z+n.z})}})},function(t,e){function n(t,e,n){return new Promise(function(i){c(e).then(function(){d[t]={template:a(e)(n.trim()),type:e},i(d[t])})})}function i(t,e,n){switch(e){case v:return t(n);case m:return t(n);case b:return Mustache.render(t,n);case y:return t.render(n);default:return t}}function r(t,e){var i=document.querySelector(t),r=i.getAttribute("type"),o=i.innerHTML;if(!e){if(!r)throw new Error("Must provide `type` attribute for '),t=""+t+"";try{this.Ga.ib.open(),this.Ga.ib.write(t),this.Ga.ib.close()}catch(o){E("frame writing exception"),o.stack&&E(o.stack),E(o)}}function Se(t){if(t.Ud&&t.Kd&&t.ue.count()<(0=t.Qc[0].Qe.length+30+n.length;){var r=t.Qc.shift(),n=n+"&seg"+i+"="+r.sg+"&ts"+i+"="+r.yg+"&d"+i+"="+r.Qe;i++}return Te(t,e+n,t.$d),!0}return!1}function Te(t,e,n){function i(){t.ue.remove(n),Se(t)}t.ue.add(n,1);var r=setTimeout(i,Math.floor(25e3));Re(t,e,function(){clearTimeout(r),i()})}function Re(t,e,n){setTimeout(function(){try{if(t.Kd){var i=t.Ga.ib.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.onload=i.onreadystatechange=function(){var t=i.readyState;t&&"loaded"!==t&&"complete"!==t||(i.onload=i.onreadystatechange=null,i.parentNode&&i.parentNode.removeChild(i),n())},i.onerror=function(){E("Long-poll script failed to load: "+e),t.Kd=!1,t.close()},t.Ga.ib.body.appendChild(i)}}catch(r){}},Math.floor(1))}function Ue(t){Ve(this,t)}function Ve(t,e){var n=rd&&rd.isAvailable(),i=n&&!(Xb.af||!0===Xb.get("previous_websocket_failure"));if(e.zg&&(n||O("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),i=!0),i)t.Wc=[rd];else{var r=t.Wc=[];ld(We,function(t,e){e&&e.isAvailable()&&r.push(e)})}}function Xe(t){if(00&&(t.md=setTimeout(function(){t.md=null,t.Cb||(t.I&&102400=t.uf?(t.f("Secondary connection is healthy."),t.Cb=!0,t.D.sd(),t.D.start(),t.f("sending client ack on secondary"),t.D.send({t:"c",d:{t:"a",d:{}}}),t.f("Ending transmission on primary"),t.I.send({t:"c",d:{t:"n",d:{}}}),t.Xc=t.D,df(t)):(t.f("sending ping on secondary."),t.D.send({t:"c",d:{t:"p",d:{}}}))}function ff(t){t.Cb||(t.we--,0>=t.we&&(t.f("Primary connection is healthy."),t.Cb=!0,t.I.sd()))}function cf(t,e){t.D=new e("c:"+t.id+":"+t.Me++,t.M,t.wf),t.uf=e.responsesRequiredToBeHealthy||0,t.D.open($e(t,t.D),af(t,t.D)),setTimeout(function(){t.D&&(t.f("Timed out trying to upgrade."),t.D.close())},Math.floor(6e4))}function bf(t,e,n){t.f("Realtime connection established."),t.I=e,t.L=1,t.Mc&&(t.Mc(n,t.wf),t.Mc=null),0===t.we?(t.f("Primary connection is healthy."),t.Cb=!0):setTimeout(function(){gf(t)},Math.floor(5e3))}function gf(t){t.Cb||1!==t.L||(t.f("sending ping on primary."),jf(t,{t:"c",d:{t:"p",d:{}}}))}function jf(t,e){if(1!==t.L)throw"Connection is not connected";t.Xc.send(e)}function ef(t){t.f("Shutting down all connections"),t.I&&(t.I.close(),t.I=null),t.D&&(t.D.close(),t.D=null),t.md&&(clearTimeout(t.md),t.md=null)}function L(t,e){if(1==arguments.length){this.o=t.split("/");for(var n=0,i=0;i=t.o.length?null:t.o[t.Z]}function Wd(t){return t.o.length-t.Z}function D(t){var e=t.Z;return e10485760/3&&10485760n?i=i.left:n>0&&(r=i,i=i.right)}throw Error("Attempted to find predecessor key for a nonexistent key. What gives?")}function Uf(t,e,n,i,r){for(this.Hd=r||null,this.ke=i,this.Sa=[],r=1;!t.e();)if(r=e?n(t.key,e):1,i&&(r*=-1),0>r)t=this.ke?t.left:t.right;else{if(0===r){this.Sa.push(t);break}this.Sa.push(t),t=this.ke?t.right:t.left}}function R(t){if(0===t.Sa.length)return null;var e,n=t.Sa.pop();if(e=t.Hd?t.Hd(n.key,n.value):{key:n.key,value:n.value},t.ke)for(n=n.left;!n.e();)t.Sa.push(n),n=n.right;else for(n=n.right;!n.e();)t.Sa.push(n),n=n.left;return e}function Vf(t){if(0===t.Sa.length)return null;var e;return e=t.Sa,e=e[e.length-1],t.Hd?t.Hd(e.key,e.value):{key:e.key,value:e.value}}function Wf(t,e,n,i,r){this.key=t,this.value=e,this.color=null!=n?n:!0,this.left=null!=i?i:Sf,this.right=null!=r?r:Sf}function Xf(t){return t.left.e()?t:Xf(t.left)}function Zf(t){return t.left.e()?Sf:(t.left.fa()||t.left.left.fa()||(t=$f(t)),t=t.Y(null,null,null,Zf(t.left),null),Yf(t))}function Yf(t){return t.right.fa()&&!t.left.fa()&&(t=cg(t)),t.left.fa()&&t.left.left.fa()&&(t=ag(t)),t.left.fa()&&t.right.fa()&&(t=bg(t)),t}function $f(t){return t=bg(t),t.right.left.fa()&&(t=t.Y(null,null,null,null,ag(t.right)),t=cg(t),t=bg(t)),t}function cg(t){return t.right.Y(null,null,t.color,t.Y(null,null,!0,null,t.right.left),null)}function ag(t){return t.left.Y(null,null,t.color,null,t.Y(null,null,!0,t.left.right,null))}function bg(t){return t.Y(null,null,!t.color,t.left.Y(null,null,!t.left.color,null,null),t.right.Y(null,null,!t.right.color,null,null))}function dg(){}function P(t,e,n){this.k=t,(this.aa=e)&&ne(this.aa),t.e()&&H(!this.aa||this.aa.e(),"An empty node cannot have a priority"),this.zb=n,this.Eb=null}function le(t,e){var n;return n=(n=fg(t,e))?(n=n.Hc())&&n.name:t.k.Hc(),n?new K(n,t.k.get(n)):null}function me(t,e){var n;return n=(n=fg(t,e))?(n=n.fc())&&n.name:t.k.fc(),n?new K(n,t.k.get(n)):null}function fg(t,e){return e===ae?null:t.zb.get(e.toString())}function M(e,n){if(null===e)return F;var i=null;if("object"==typeof e&&".priority"in e?i=e[".priority"]:"undefined"!=typeof n&&(i=n),H(null===i||"string"==typeof i||"number"==typeof i||"object"==typeof i&&".sv"in i,"Invalid priority type found: "+typeof i),"object"==typeof e&&".value"in e&&null!==e[".value"]&&(e=e[".value"]),"object"!=typeof e||".sv"in e)return new Uc(e,M(i));if(e instanceof Array){var r=F,o=e;return t(o,function(t,e){if(Bb(o,e)&&"."!==e.substring(0,1)){var n=M(t);!n.J()&&n.e()||(r=r.U(e,n))}}),r.ga(M(i))}var a=[],s=!1,l=e;if(Cb(l,function(t){if("string"!=typeof t||"."!==t.substring(0,1)){var e=M(l[t]);e.e()||(s=s||!e.C().e(),a.push(new K(t,e)))}}),0==a.length)return F; +var u=He(a,Kc,function(t){return t.name},Mc);if(s){var c=He(a,ke(N));return new P(u,M(i),new Fe({".priority":c},{".priority":N}))}return new P(u,M(i),Je)}function hg(t){this.count=parseInt(Math.log(t+1)/gg,10),this.Pe=this.count-1,this.Jf=t+1&parseInt(Array(this.count+1).join("1"),2)}function ig(t){var e=!(t.Jf&1<o.Cc,"Stacking an older write on top of newer ones"),p(a)||(a=!0),o.la.push({path:e,Ja:n,Zc:i,visible:a}),a&&(o.T=Og(o.T,e,n)),o.Cc=i,r?Bh(t,new Zb(Jg,e,n)):[]}function Ch(t,e,n,i){var r=t.lb;return H(i>r.Cc,"Stacking an older merge on top of newer ones"),r.la.push({path:e,children:n,Zc:i,visible:!0}),r.T=Pg(r.T,e,n),r.Cc=i,n=xg(n),Bh(t,new Cd(Jg,e,n))}function Dh(t,e,n){n=n||!1;var i=Zg(t.lb,e);if(t.lb.Ed(e)){var r=Q;return null!=i.Ja?r=r.set(C,!0):Cb(i.children,function(t,e){r=r.set(new L(t),e)}),Bh(t,new Ig(i.path,r,n))}return[]}function Eh(t,e,n){return n=xg(n),Bh(t,new Cd(Lg,e,n))}function Fh(t,e,n,i){if(i=Gh(t,i),null!=i){var r=Hh(i);return i=r.path,r=r.Ib,e=T(i,e),n=new Zb(new Kg(!1,!0,r,!0),e,n),Ih(t,i,n)}return[]}function Jh(t,e,n,i){if(i=Gh(t,i)){var r=Hh(i);return i=r.path,r=r.Ib,e=T(i,e),n=xg(n),n=new Cd(new Kg(!1,!0,r,!0),e,n),Ih(t,i,n)}return[]}function Nh(e){return Ag(e,function(e,n,i){if(n&&null!=Vg(n))return[Vg(n)];var r=[];return n&&(r=Wg(n)),t(i,function(t){r=r.concat(t)}),r})}function Rh(t,e){for(var n=0;ni;){if(0==o)for(;n>=i;)na(this,t,i),i+=this.Ya;if(q(t)){for(;e>i;)if(r[o]=t.charCodeAt(i),++o,++i,o==this.Ya){na(this,r),o=0;break}}else for(;e>i;)if(r[o]=t[i],++o,++i,o==this.Ya){na(this,r),o=0;break}}this.ac=o,this.Pd+=e}};var Da={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\x0B":"\\u000b"},Ea=/\uffff/.test("￿")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g,v;t:{var Fa=n.navigator;if(Fa){var Ga=Fa.userAgent;if(Ga){v=Ga;break t}}v=""}ka(Ha,Error),Ha.prototype.name="CustomError";var w=Array.prototype,Ia=w.indexOf?function(t,e,n){return w.indexOf.call(t,e,n)}:function(t,e,n){if(n=null==n?0:0>n?Math.max(0,t.length+n):n,q(t))return q(e)&&1==e.length?t.indexOf(e,n):-1;for(;no;o++)o in r&&e.call(n,r[o],o,t)},Ka=w.filter?function(t,e,n){return w.filter.call(t,e,n)}:function(t,e,n){for(var i=t.length,r=[],o=0,a=q(t)?t.split(""):t,s=0;i>s;s++)if(s in a){var l=a[s];e.call(n,l,s,t)&&(r[o++]=l)}return r},La=w.map?function(t,e,n){return w.map.call(t,e,n)}:function(t,e,n){for(var i=t.length,r=Array(i),o=q(t)?t.split(""):t,a=0;i>a;a++)a in o&&(r[a]=e.call(n,o[a],a,t));return r},Ma=w.reduce?function(t,e,n,i){for(var o=[],a=1,s=arguments.length;s>a;a++)o.push(arguments[a]);return i&&(o[0]=r(e,i)),w.reduce.apply(t,o)}:function(t,e,n,i){var r=n;return Ja(t,function(n,o){r=e.call(i,r,n,o,t)}),r},Na=w.every?function(t,e,n){return w.every.call(t,e,n)}:function(t,e,n){for(var i=t.length,r=q(t)?t.split(""):t,o=0;i>o;o++)if(o in r&&!e.call(n,r[o],o,t))return!1;return!0},Ua=-1!=v.indexOf("Opera")||-1!=v.indexOf("OPR"),Va=-1!=v.indexOf("Trident")||-1!=v.indexOf("MSIE"),Wa=-1!=v.indexOf("Gecko")&&-1==v.toLowerCase().indexOf("webkit")&&!(-1!=v.indexOf("Trident")||-1!=v.indexOf("MSIE")),Xa=-1!=v.toLowerCase().indexOf("webkit");!function(){var t,e="";return Ua&&n.opera?(e=n.opera.version,ga(e)?e():e):(Wa?t=/rv\:([^\);]+)(\)|;)/:Va?t=/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/:Xa&&(t=/WebKit\/(\S+)/),t&&(e=(e=t.exec(v))?e[1]:""),Va&&(t=(t=n.document)?t.documentMode:void 0,t>parseFloat(e))?String(t):e)}();var Ya=null,Za=null,$a=null,db,gb,ib=!1,jb=[];[].push(function(){ib=!1,jb=[]});var nb=0,qb=2,sb=3;mb.prototype.then=function(t,e,n){return tb(this,ga(t)?t:null,ga(e)?e:null,n)},mb.prototype.then=mb.prototype.then,mb.prototype.$goog_Thenable=!0,g=mb.prototype,g.xg=function(t,e){return tb(this,null,t,e)},g.cancel=function(t){this.L==nb&&fb(function(){var e=new rb(t);ub(this,e)},this)},g.Af=function(t){this.L=nb,pb(this,qb,t)},g.Bf=function(t){this.L=nb,pb(this,sb,t)},g.Sf=function(){for(;this.Ca&&this.Ca.length;){var t=this.Ca;this.Ca=null;for(var e=0;e"),t},ic.prototype.pf=function(){var t,e=this.Vc.get(),n={},i=!1;for(t in e)0=t.length){var e=Number(t);if(!isNaN(e)){r.Ee=e,r.frames=[],t=null;break t}}r.Ee=1,r.frames=[]}null!==t&&vd(r,t)}},this.La.onerror=function(t){r.f("WebSocket error. Closing connection."),(t=t.message||t.data)&&r.f(t),r.fb()}},rd.prototype.start=function(){},rd.isAvailable=function(){var t=!1;if("undefined"!=typeof navigator&&navigator.userAgent){var e=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);e&&1parseFloat(e[1])&&(t=!0)}return!t&&null!==qd&&!td},rd.responsesRequiredToBeHealthy=2,rd.healthyTimeout=3e4,g=rd.prototype,g.sd=function(){Xb.remove("previous_websocket_failure")},g.send=function(t){ud(this),t=B(t),this.rb+=t.length,lc(this.Xa,"bytes_sent",t.length),t=kd(t,16384),1=this.g.compare(this.Uc,t)&&0>=this.g.compare(t,this.wc)},g.F=function(t,e,n,i,r,o){return this.matches(new K(e,n))||(n=F),this.he.F(t,e,n,i,r,o)},g.za=function(t,e,n){e.J()&&(e=F);var i=e.ob(this.g),i=i.ga(F),r=this;return e.P(N,function(t,e){r.matches(new K(t,e))||(i=i.U(t,F))}),this.he.za(t,i,n)},g.ga=function(t){return t},g.Qa=function(){return!0},g.Vb=function(){return this.he},g=he.prototype,g.F=function(t,e,n,i,r,o){return this.sa.matches(new K(e,n))||(n=F),t.R(e).ca(n)?t:t.Fb()=this.g.compare(this.sa.Uc,a):0>=this.g.compare(a,this.sa.wc)))break;i=i.U(a.name,a.S),r++}}else{i=e.ob(this.g),i=i.ga(F);var s,l,u;if(this.Jb){e=i.Ye(this.g),s=this.sa.wc,l=this.sa.Uc;var c=ke(this.g);u=function(t,e){return c(e,t)}}else e=i.Xb(this.g),s=this.sa.Uc,l=this.sa.wc,u=ke(this.g);for(var r=0,h=!1;0=u(s,a)&&(h=!0),(o=h&&r=u(a,l))?r++:i=i.U(a.name,F)}return this.sa.Vb().za(t,i,n)},g.ga=function(t){return t},g.Qa=function(){return!0},g.Vb=function(){return this.sa.Vb()};var oe=["object","boolean","number","string"];g=Uc.prototype,g.J=function(){return!0},g.C=function(){return this.aa},g.ga=function(t){return new Uc(this.B,t)},g.R=function(t){return".priority"===t?this.aa:F},g.Q=function(t){return t.e()?this:".priority"===J(t)?this.aa:F},g.Fa=function(){return!1},g.Xe=function(){return null},g.U=function(t,e){return".priority"===t?this.ga(e):e.e()&&".priority"!==t?this:F.U(t,e).ga(this.aa)},g.F=function(t,e){var n=J(t);return null===n?e:e.e()&&".priority"!==n?this:(H(".priority"!==n||1===Wd(t),".priority must be the last token in a path"),this.U(n,F.F(D(t),e)))},g.e=function(){return!1},g.Fb=function(){return 0},g.P=function(){return!1},g.H=function(t){return t&&!this.C().e()?{".value":this.Ea(),".priority":this.C().H()}:this.Ea()},g.hash=function(){if(null===this.Eb){var t="";this.aa.e()||(t+="priority:"+pe(this.aa.H())+":");var e=typeof this.B,t=t+(e+":"),t="number"===e?t+md(this.B):t+this.B;this.Eb=Yc(t)}return this.Eb},g.Ea=function(){return this.B},g.tc=function(t){if(t===F)return 1;if(t instanceof P)return-1;H(t.J(),"Unknown node type");var e=typeof t.B,n=typeof this.B,i=Ia(oe,e),r=Ia(oe,n);return H(i>=0,"Unknown leaf type: "+e),H(r>=0,"Unknown leaf type: "+n),i===r?"object"===n?0:this.B=this.o.length)return null;for(var t=[],e=this.Z;e=this.o.length},g.ca=function(t){if(Wd(this)!==Wd(t))return!1;for(var e=this.Z,n=t.Z;e<=this.o.length;e++,n++)if(this.o[e]!==t.o[n])return!1;return!0},g.contains=function(t){var e=this.Z,n=t.Z;if(Wd(this)>Wd(t))return!1;for(;e0){for(var r=Array(i),o=0;i>o;o++)r[o]=n[o];n=r}else n=[];for(i=0;i=0;o--)r[o]="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(n%64),n=Math.floor(n/64);if(H(0===n,"Cannot push at time == 0"),n=r.join(""),i){for(o=11;o>=0&&63===e[o];o--)e[o]=0;e[o]++}else for(o=0;12>o;o++)e[o]=Math.floor(64*Math.random());for(o=0;12>o;o++)n+="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(e[o]);return H(20===n.length,"nextPushId: Length should be 20."),n}}();g=Rf.prototype,g.Ra=function(t,e){return new Rf(this.Oa,this.ba.Ra(t,e,this.Oa).Y(null,null,!1,null,null))},g.remove=function(t){return new Rf(this.Oa,this.ba.remove(t,this.Oa).Y(null,null,!1,null,null))},g.get=function(t){for(var e,n=this.ba;!n.e();){if(e=this.Oa(t,n.key),0===e)return n.value;0>e?n=n.left:e>0&&(n=n.right)}return null},g.e=function(){return this.ba.e()},g.count=function(){return this.ba.count()},g.Hc=function(){return this.ba.Hc()},g.fc=function(){return this.ba.fc()},g.ia=function(t){return this.ba.ia(t)},g.Xb=function(t){return new Uf(this.ba,null,this.Oa,!1,t)},g.Yb=function(t,e){return new Uf(this.ba,t,this.Oa,!1,e)},g.$b=function(t,e){return new Uf(this.ba,t,this.Oa,!0,e)},g.Ye=function(t){return new Uf(this.ba,null,this.Oa,!0,t)},g=Wf.prototype,g.Y=function(t,e,n,i,r){return new Wf(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=i?i:this.left,null!=r?r:this.right)},g.count=function(){return this.left.count()+1+this.right.count()},g.e=function(){return!1},g.ia=function(t){return this.left.ia(t)||t(this.key,this.value)||this.right.ia(t)},g.Hc=function(){return Xf(this).key},g.fc=function(){return this.right.e()?this.key:this.right.fc()},g.Ra=function(t,e,n){var i,r;return r=this,i=n(t,r.key),r=0>i?r.Y(null,null,null,r.left.Ra(t,e,n),null):0===i?r.Y(null,e,null,null,null):r.Y(null,null,null,null,r.right.Ra(t,e,n)),Yf(r)},g.remove=function(t,e){var n,i;if(n=this,0>e(t,n.key))n.left.e()||n.left.fa()||n.left.left.fa()||(n=$f(n)),n=n.Y(null,null,null,n.left.remove(t,e),null);else{if(n.left.fa()&&(n=ag(n)),n.right.e()||n.right.fa()||n.right.left.fa()||(n=bg(n),n.left.left.fa()&&(n=ag(n),n=bg(n))),0===e(t,n.key)){if(n.right.e())return Sf;i=Xf(n.right),n=n.Y(i.key,i.value,null,null,Zf(n.right))}n=n.Y(null,null,null,null,n.right.remove(t,e))}return Yf(n)},g.fa=function(){return this.color},g=dg.prototype,g.Y=function(){return this},g.Ra=function(t,e){return new Wf(t,e,null)},g.remove=function(){return this},g.count=function(){return 0},g.e=function(){return!0},g.ia=function(){return!1},g.Hc=function(){return null},g.fc=function(){return null},g.fa=function(){return!1};var Sf=new dg;g=P.prototype,g.J=function(){return!1},g.C=function(){return this.aa||F},g.ga=function(t){return this.k.e()?this:new P(this.k,t,this.zb)},g.R=function(t){return".priority"===t?this.C():(t=this.k.get(t),null===t?F:t)},g.Q=function(t){var e=J(t);return null===e?this:this.R(e).Q(D(t))},g.Fa=function(t){return null!==this.k.get(t)},g.U=function(t,e){if(H(e,"We should always be passing snapshot nodes"),".priority"===t)return this.ga(e);var n,i,r=new K(t,e);return e.e()?(n=this.k.remove(t),r=Ie(this.zb,r,this.k)):(n=this.k.Ra(t,e),r=Ge(this.zb,r,this.k)),i=n.e()?F:this.aa,new P(n,i,r)},g.F=function(t,e){var n=J(t);if(null===n)return e;H(".priority"!==J(t)||1===Wd(t),".priority must be the last token in a path");var i=this.R(n).F(D(t),e);return this.U(n,i)},g.e=function(){return this.k.e()},g.Fb=function(){return this.k.count()};var eg=/^(0|[1-9]\d*)$/;g=P.prototype,g.H=function(t){if(this.e())return null;var e={},n=0,i=0,r=!0;if(this.P(N,function(o,a){e[o]=a.H(t),n++,r&&eg.test(o)?i=Math.max(i,Number(o)):r=!1}),!t&&r&&2*n>i){var o,a=[];for(o in e)a[o]=e[o];return a}return t&&!this.C().e()&&(e[".priority"]=this.C().H()),e},g.hash=function(){if(null===this.Eb){var t="";this.C().e()||(t+="priority:"+pe(this.C().H())+":"),this.P(N,function(e,n){var i=n.hash();""!==i&&(t+=":"+e+":"+i)}),this.Eb=""===t?"":Yc(t)}return this.Eb},g.Xe=function(t,e,n){return(n=fg(this,n))?(t=Tf(n,new K(t,e)))?t.name:null:Tf(this.k,t)},g.P=function(t,e){var n=fg(this,t);return n?n.ia(function(t){return e(t.name,t.S)}):this.k.ia(e)},g.Xb=function(t){return this.Yb(t.Ic(),t)},g.Yb=function(t,e){var n=fg(this,e);if(n)return n.Yb(t,function(t){return t});for(var n=this.k.Yb(t.name,Nc),i=Vf(n);null!=i&&0>e.compare(i,t);)R(n),i=Vf(n);return n},g.Ye=function(t){return this.$b(t.Gc(),t)},g.$b=function(t,e){var n=fg(this,e);if(n)return n.$b(t,function(t){return t});for(var n=this.k.$b(t.name,Nc),i=Vf(n);null!=i&&0=t)throw Error("Query.limitToFirst: First argument must be a positive integer.");if(this.n.xa)throw Error("Query.limitToFirst: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new X(this.w,this.path,this.n.me(t),this.Oc)},g.ne=function(t){if(y("Query.limitToLast",1,1,arguments.length),!fa(t)||Math.floor(t)!==t||0>=t)throw Error("Query.limitToLast: First argument must be a positive integer.");if(this.n.xa)throw Error("Query.limitToLast: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new X(this.w,this.path,this.n.ne(t),this.Oc)},g.jg=function(t){if(y("Query.orderByChild",1,1,arguments.length),"$key"===t)throw Error('Query.orderByChild: "$key" is invalid. Use Query.orderByKey() instead.');if("$priority"===t)throw Error('Query.orderByChild: "$priority" is invalid. Use Query.orderByPriority() instead.');if("$value"===t)throw Error('Query.orderByChild: "$value" is invalid. Use Query.orderByValue() instead.');Hf("Query.orderByChild",t),sg(this,"Query.orderByChild");var e=new L(t);if(e.e())throw Error("Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead.");return e=new te(e),e=De(this.n,e),qg(e),new X(this.w,this.path,e,!0)},g.kg=function(){y("Query.orderByKey",0,0,arguments.length),sg(this,"Query.orderByKey");var t=De(this.n,ae);return qg(t),new X(this.w,this.path,t,!0)},g.lg=function(){y("Query.orderByPriority",0,0,arguments.length),sg(this,"Query.orderByPriority");var t=De(this.n,N);return qg(t),new X(this.w,this.path,t,!0)},g.mg=function(){y("Query.orderByValue",0,0,arguments.length),sg(this,"Query.orderByValue");var t=De(this.n,ze);return qg(t),new X(this.w,this.path,t,!0)},g.Nd=function(t,e){y("Query.startAt",0,2,arguments.length),Af("Query.startAt",t,this.path,!0),Gf("Query.startAt",e);var n=this.n.Nd(t,e);if(rg(n),qg(n),this.n.ka)throw Error("Query.startAt: Starting point was already set (by another call to startAt or equalTo).");return p(t)||(e=t=null),new X(this.w,this.path,n,this.Oc)},g.fd=function(t,e){y("Query.endAt",0,2,arguments.length),Af("Query.endAt",t,this.path,!0),Gf("Query.endAt",e);var n=this.n.fd(t,e);if(rg(n),qg(n),this.n.na)throw Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new X(this.w,this.path,n,this.Oc)},g.Pf=function(t,e){if(y("Query.equalTo",1,2,arguments.length),Af("Query.equalTo",t,this.path,!1),Gf("Query.equalTo",e),this.n.ka)throw Error("Query.equalTo: Starting point was already set (by another call to endAt or equalTo).");if(this.n.na)throw Error("Query.equalTo: Ending point was already set (by another call to endAt or equalTo).");return this.Nd(t,e).fd(t,e)},g.toString=function(){y("Query.toString",0,0,arguments.length);for(var t=this.path,e="",n=t.Z;nt?-1:1});g=vg.prototype,g.e=function(){return null===this.value&&this.children.e()},g.subtree=function(t){if(t.e())return this;var e=this.children.get(J(t));return null!==e?e.subtree(D(t)):Q},g.set=function(t,e){if(t.e())return new vg(e,this.children);var n=J(t),i=(this.children.get(n)||Q).set(D(t),e),n=this.children.Ra(n,i);return new vg(this.value,n)},g.remove=function(t){if(t.e())return this.children.e()?Q:new vg(null,this.children);var e=J(t),n=this.children.get(e);return n?(t=n.remove(D(t)),e=t.e()?this.children.remove(e):this.children.Ra(e,t),null===this.value&&e.e()?Q:new vg(this.value,e)):this},g.get=function(t){if(t.e())return this.value;var e=this.children.get(J(t));return e?e.get(D(t)):null};var Q=new vg(null);vg.prototype.toString=function(){var t={};return Yd(this,function(e,n){t[e.toString()]=n.toString()}),B(t)},Ig.prototype.Nc=function(t){return this.path.e()?null!=this.Pb.value?(H(this.Pb.children.e(),"affectedTree should not have overlapping affected paths."),this):(t=this.Pb.subtree(new L(t)),new Ig(C,t,this.Id)):(H(J(this.path)===t,"operationForChild called for unrelated child."),new Ig(D(this.path),this.Pb,this.Id))},Ig.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" ack write revert="+this.Id+" affectedTree="+this.Pb+")"};var $b=0,Dd=1,Qd=2,bc=3,Jg=new Kg(!0,!1,null,!1),Lg=new Kg(!1,!0,null,!1);Kg.prototype.toString=function(){return this.ee?"user":this.De?"server(queryID="+this.Ib+")":"server"};var Ng=new Mg(new vg(null));Mg.prototype.Ed=function(t){return t.e()?Ng:(t=$d(this.X,t,Q),new Mg(t))},Mg.prototype.e=function(){return this.X.e()},Mg.prototype.apply=function(t){return Tg(C,this.X,t)},g=Ug.prototype,g.e=function(){return xa(this.Aa)},g.gb=function(e,n,i){var r=e.source.Ib;if(null!==r)return r=x(this.Aa,r),H(null!=r,"SyncTree gave us an op for an invalid query."),r.gb(e,n,i);var o=[];return t(this.Aa,function(t){o=o.concat(t.gb(e,n,i))}),o},g.Ob=function(t,e,n,i,r){var o=t.ya(),a=x(this.Aa,o);if(!a){var a=n.Ba(r?i:null),s=!1;a?s=!0:(a=i instanceof P?n.sc(i):F,s=!1),a=new kg(t,new Ud(new Dc(a,s,!1),new Dc(i,r,!1))),this.Aa[o]=a}return a.Ob(e),ng(a,e)},g.mb=function(e,n,i){var r=e.ya(),o=[],a=[],s=null!=Vg(this);if("default"===r){var l=this;t(this.Aa,function(t,e){a=a.concat(t.mb(n,i)),t.e()&&(delete l.Aa[e],S(t.W.n)||o.push(t.W))})}else{var u=x(this.Aa,r);u&&(a=a.concat(u.mb(n,i)),u.e()&&(delete this.Aa[r],S(u.W.n)||o.push(u.W)))}return s&&null==Vg(this)&&o.push(new U(e.w,e.path)),{qg:o,Rf:a}},g.jb=function(e){var n=null;return t(this.Aa,function(t){n=n||t.jb(e)}),n},g=Yg.prototype,g.Ed=function(e){var n=Pa(this.la,function(t){return t.Zc===e});H(n>=0,"removeWrite called with nonexistent writeId.");var i=this.la[n];this.la.splice(n,1);for(var r=i.visible,o=!1,a=this.la.length-1;r&&a>=0;){var s=this.la[a];s.visible&&(a>=n&&$g(s,i.path)?r=!1:i.path.contains(s.path)&&(o=!0)),a--}if(r){if(o)this.T=ah(this.la,bh,C),this.Cc=0r;r++)e+=" ";console.log(e+i)}}},g.Be=function(t){lc(this.Xa,t),this.wg.xf[t]=!0},g.f=function(t){var e="";this.Ua&&(e=this.Ua.id+":"),E(e,arguments)},uf.prototype.eb=function(){for(var t in this.nb)this.nb[t].eb()},uf.prototype.lc=function(){for(var t in this.nb)this.nb[t].lc()},uf.prototype.ce=function(t){this.Df=t},ba(uf),uf.prototype.interrupt=uf.prototype.eb,uf.prototype.resume=uf.prototype.lc;var Z={};if(Z.pc=kh,Z.DataConnection=Z.pc,kh.prototype.vg=function(t,e){this.ua("q",{p:t},e)},Z.pc.prototype.simpleListen=Z.pc.prototype.vg,kh.prototype.Of=function(t,e){this.ua("echo",{d:t},e)},Z.pc.prototype.echo=Z.pc.prototype.Of,kh.prototype.interrupt=kh.prototype.eb,Z.Gf=Ye,Z.RealTimeConnection=Z.Gf,Ye.prototype.sendRequest=Ye.prototype.ua,Ye.prototype.close=Ye.prototype.close,Z.$f=function(t){var e=kh.prototype.put;return kh.prototype.put=function(n,i,r,o){p(o)&&(o=t()),e.call(this,n,i,r,o)},function(){kh.prototype.put=e}},Z.hijackHash=Z.$f,Z.Ff=fc,Z.ConnectionTarget=Z.Ff,Z.ya=function(t){return t.ya()},Z.queryIdentifier=Z.ya,Z.cg=function(t){return t.w.Ua.$},Z.listens=Z.cg,Z.ce=function(t){uf.Wb().ce(t)},Z.forceRestClient=Z.ce,Z.Context=uf,ka(U,X),g=U.prototype,g.getKey=function(){return y("Firebase.key",0,0,arguments.length),this.path.e()?null:Xd(this.path)},g.m=function(t){if(y("Firebase.child",1,1,arguments.length),fa(t))t=String(t);else if(!(t instanceof L))if(null===J(this.path)){var e=t;e&&(e=e.replace(/^\/*\.info(\/|$)/,"/")),Hf("Firebase.child",e)}else Hf("Firebase.child",t);return new U(this.w,this.path.m(t))},g.getParent=function(){y("Firebase.parent",0,0,arguments.length);var t=this.path.parent();return null===t?null:new U(this.w,t)},g.Xf=function(){y("Firebase.ref",0,0,arguments.length);for(var t=this;null!==t.getParent();)t=t.getParent();return t},g.Nf=function(){return this.w.$a},g.set=function(t,e){y("Firebase.set",1,2,arguments.length),If("Firebase.set",this.path),Af("Firebase.set",t,this.path,!1),A("Firebase.set",2,e,!0);var n=new Hb;return this.w.Kb(this.path,t,null,Ib(n,e)),n.ra},g.update=function(t,e){if(y("Firebase.update",1,2,arguments.length),If("Firebase.update",this.path),da(t)){for(var n={},i=0;i>>0),h=0,f=function(t,e,n){return t.call.apply(t.bind,arguments)},d=function(t,e,n){if(!t)throw Error();if(2s&&(s*=2);var n;1===c?(c=2,n=0):n=1e3*(s+Math.random()),r(n)}}function a(t){f||(f=!0,h||(null!==l?(t||(c=2),clearTimeout(l),r(0)):t||(c=1)))}var s=1,l=null,u=!1,c=0,h=!1,f=!1;return r(0),setTimeout(function(){u=!0,a(!0)},n),a},b="https://firebasestorage.googleapis.com",y=function(t,e){this.code="storage/"+t,this.message="Firebase Storage: "+e,this.serverResponse=null,this.name="FirebaseError"};v(y,Error);var q=function(){return new y("unknown","An unknown error occurred, please check the error payload for server response.")},w=function(){return new y("unauthenticated","User is not authenticated, please authenticate using Firebase Authentication and try again.")},x=function(t){return new y("unauthorized","User does not have permission to access '"+t+"'.")},E=function(){return new y("canceled","User canceled the upload/download.")},k=function(t,e,n){return new y("invalid-argument","Invalid argument in `"+e+"` at index "+t+": "+n)},T=function(){return new y("app-deleted","The Firebase app was deleted.")},A=function(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])},S=function(t){var e={};return A(t,function(t,n){e[t]=n}),e},_=function(t,e,n,i){this.l=t,this.f={},this.i=e,this.b={},this.c="",this.N=n,this.g=this.a=null,this.h=[200],this.j=i},I={STATE_CHANGED:"state_changed"},R={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"},O=function(t){switch(t){case"running":case"pausing":case"canceling":return"running";case"paused":return"paused";case"success":return"success";case"canceled":return"canceled";case"error":return"error";default:return"error"}},C=function(t){return i(t)&&null!==t},M=function(t){return"string"==typeof t||t instanceof String},F=function(t,e,n){this.f=n,this.c=t,this.g=e,this.b=0,this.a=null};F.prototype.get=function(){var t;return 0t?-1:t>e?1:0},J=function(t,e){this.a=t,this.b=e};J.prototype.clone=function(){return new J(this.a,this.b)};var Y=function(t,e){this.bucket=t,this.path=e},Z=function(t){var e=encodeURIComponent;return"/b/"+e(t.bucket)+"/o/"+e(t.path)},$=function(t){for(var e=null,n=[{ja:/^gs:\/\/([A-Za-z0-9.\-]+)(\/(.*))?$/i,aa:{bucket:1,path:3},ia:function(t){"/"===t.path.charAt(t.path.length-1)&&(t.path=t.path.slice(0,-1))}},{ja:/^https?:\/\/firebasestorage\.googleapis\.com\/v[A-Za-z0-9_]+\/b\/([A-Za-z0-9.\-]+)\/o(\/([^?#]*).*)?$/i,aa:{bucket:1,path:3},ia:function(t){t.path=decodeURIComponent(t.path)}}],i=0;in?Math.max(0,t.length+n):n,s(t))return s(e)&&1==e.length?t.indexOf(e,n):-1;for(;no;o++)o in r&&e.call(n,r[o],o,t)},yt=Array.prototype.filter?function(t,e,n){return ot(null!=t.length),Array.prototype.filter.call(t,e,n)}:function(t,e,n){for(var i=t.length,r=[],o=0,a=s(t)?t.split(""):t,l=0;i>l;l++)if(l in a){var u=a[l];e.call(n,u,l,t)&&(r[o++]=u)}return r},qt=Array.prototype.map?function(t,e,n){return ot(null!=t.length),Array.prototype.map.call(t,e,n)}:function(t,e,n){for(var i=t.length,r=Array(i),o=s(t)?t.split(""):t,a=0;i>a;a++)a in o&&(r[a]=e.call(n,o[a],a,t));return r},wt=Array.prototype.some?function(t,e,n){return ot(null!=t.length),Array.prototype.some.call(t,e,n)}:function(t,e,n){for(var i=t.length,r=s(t)?t.split(""):t,o=0;i>o;o++)if(o in r&&e.call(n,r[o],o,t))return!0;return!1},xt=function(t){var e;t:{e=Hn;for(var n=t.length,i=s(t)?t.split(""):t,r=0;n>r;r++)if(r in i&&e.call(void 0,i[r],r,t)){e=r;break t}e=-1}return 0>e?null:s(t)?t.charAt(e):t[e]},Et=function(t){if("array"!=o(t))for(var e=t.length-1;e>=0;e--)delete t[e];t.length=0},kt=function(t,e){e=mt(t,e);var n;return(n=e>=0)&&(ot(null!=t.length),Array.prototype.splice.call(t,e,1)),n},Tt=function(t){var e=t.length;if(e>0){for(var n=Array(e),i=0;e>i;i++)n[i]=t[i];return n}return[]},At=new F(function(){return new _t},function(t){t.reset()},100),St=function(){var t=we,e=null;return t.a&&(e=t.a,t.a=t.a.next,t.a||(t.b=null),e.next=null),e},_t=function(){this.next=this.b=this.a=null};_t.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null},_t.prototype.reset=function(){this.next=this.b=this.a=null};var It=function(t,e){this.type=t,this.a=this.target=e,this.ka=!0};It.prototype.b=function(){this.ka=!1};var Rt,Ot=function(t,e,n,i,r){this.listener=t,this.a=null,this.src=e,this.type=n,this.U=!!i,this.N=r,++ht,this.O=this.T=!1},Ct=function(t){t.O=!0,t.listener=null,t.a=null,t.src=null,t.N=null},Mt=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/,Ft=function(t,e){return e=yt(e.split("/"),function(t){return 0-1?(t=e[s],i||(t.T=!1)):(t=new Ot(n,t.src,a,!!r,o),t.T=i,e.push(t)),t},jt=function(t,e){var n=e.type;n in t.a&&kt(t.a[n],e)&&(Ct(e),0==t.a[n].length&&(delete t.a[n],t.b--))},Dt=function(t,e,n,i){for(var r=0;r=this.o()){for(var n=this.a,i=0;i0&&(i=e-1>>1,t[i].a>n.a);)t[e]=t[i],e=i;t[e]=n};t=Bt.prototype,t.w=function(){for(var t=this.a,e=[],n=t.length,i=0;n>i;i++)e.push(t[i].b);return e},t.D=function(){for(var t=this.a,e=[],n=t.length,i=0;n>i;i++)e.push(t[i].a);return e},t.clone=function(){return new Bt(this)},t.o=function(){return this.a.length},t.F=function(){return 0==this.a.length},t.clear=function(){Et(this.a)};var Kt=function(){this.b=[],this.a=[]},Qt=function(t){return 0==t.b.length&&(t.b=t.a,t.b.reverse(),t.a=[]),t.b.pop()};Kt.prototype.o=function(){return this.b.length+this.a.length},Kt.prototype.F=function(){return 0==this.b.length&&0==this.a.length},Kt.prototype.clear=function(){this.b=[],this.a=[]},Kt.prototype.w=function(){for(var t=[],e=this.b.length-1;e>=0;--e)t.push(this.b[e]);for(var n=this.a.length,e=0;n>e;++e)t.push(this.a[e]);return t};var Vt,zt=function(t){if(t.w&&"function"==typeof t.w)return t.w();if(s(t))return t.split("");if(a(t)){for(var e=[],n=t.length,i=0;n>i;i++)e.push(t[i]);return e}return D(t)},Gt=function(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(a(t)||s(t))bt(t,e,void 0);else{var n;if(t.D&&"function"==typeof t.D)n=t.D();else if(t.w&&"function"==typeof t.w)n=void 0;else if(a(t)||s(t)){n=[];for(var i=t.length,r=0;i>r;r++)n.push(r)}else n=U(t);for(var i=zt(t),r=i.length,o=0;r>o;o++)e.call(void 0,i[o],n&&n[o],t)}},Jt=function(t){n.setTimeout(function(){throw t},0)},Yt=function(){var t=n.MessageChannel;if("undefined"==typeof t&&"undefined"!=typeof window&&window.postMessage&&window.addEventListener&&!pt("Presto")&&(t=function(){var t=document.createElement("IFRAME");t.style.display="none",t.src="",document.documentElement.appendChild(t);var e=t.contentWindow,t=e.document;t.open(),t.write(""),t.close();var n="callImmediate"+Math.random(),i="file:"==e.location.protocol?"*":e.location.protocol+"//"+e.location.host,t=p(function(t){"*"!=i&&t.origin!=i||t.data!=n||this.port1.onmessage()},this);e.addEventListener("message",t,!1),this.port1={},this.port2={postMessage:function(){e.postMessage(n,i)}}}),"undefined"!=typeof t&&!pt("Trident")&&!pt("MSIE")){var e=new t,r={},o=r;return e.port1.onmessage=function(){if(i(r.next)){r=r.next;var t=r.ea;r.ea=null,t()}},function(t){o.next={ea:t},o=o.next,e.port2.postMessage(0)}}return"undefined"!=typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(t){var e=document.createElement("SCRIPT");e.onreadystatechange=function(){e.onreadystatechange=null,e.parentNode.removeChild(e),e=null,t(),t=null},document.documentElement.appendChild(e)}:function(t){n.setTimeout(t,0)}},Zt="StopIteration"in n?n.StopIteration:{message:"StopIteration",stack:""},$t=function(){};$t.prototype.next=function(){throw Zt},$t.prototype.X=function(){return this};var te=function(){Bt.call(this)};v(te,Bt);var ee,ne=pt("Opera"),ie=pt("Trident")||pt("MSIE"),re=pt("Edge"),oe=pt("Gecko")&&!(-1!=ut.toLowerCase().indexOf("webkit")&&!pt("Edge"))&&!(pt("Trident")||pt("MSIE"))&&!pt("Edge"),ae=-1!=ut.toLowerCase().indexOf("webkit")&&!pt("Edge"),se=function(){var t=n.document;return t?t.documentMode:void 0};t:{var le="",ue=function(){var t=ut;return oe?/rv\:([^\);]+)(\)|;)/.exec(t):re?/Edge\/([\d\.]+)/.exec(t):ie?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(t):ae?/WebKit\/(\S+)/.exec(t):ne?/(?:Version)[ \/]?(\S+)/.exec(t):void 0}();if(ue&&(le=ue?ue[1]:""),ie){var ce=se();if(null!=ce&&ce>parseFloat(le)){ee=String(ce);break t}}ee=le}var he,fe,de=ee,pe={},ge=function(t){var e;if(!(e=pe[t])){e=0;for(var n=z(String(de)).split("."),i=z(String(t)).split("."),r=Math.max(n.length,i.length),o=0;0==e&&r>o;o++){var a=n[o]||"",s=i[o]||"",l=/(\d*)(\D*)/g,u=/(\d*)(\D*)/g;do{var c=l.exec(a)||["","",""],h=u.exec(s)||["","",""];if(0==c[0].length&&0==h[0].length)break;e=G(0==c[1].length?0:parseInt(c[1],10),0==h[1].length?0:parseInt(h[1],10))||G(0==c[2].length,0==h[2].length)||G(c[2],h[2])}while(0==e)}e=pe[t]=e>=0}return e},ve=n.document,me=ve&&ie?se()||("CSS1Compat"==ve.compatMode?parseInt(de,10):5):void 0,be=function(t,e){he||ye(),qe||(he(),qe=!0);var n=we,i=At.get();i.set(t,e),n.b?n.b.next=i:(ot(!n.a),n.a=i),n.b=i},ye=function(){if(n.Promise&&n.Promise.resolve){var t=n.Promise.resolve(void 0);he=function(){t.then(xe)}}else he=function(){var t=xe;!l(n.setImmediate)||n.Window&&n.Window.prototype&&!pt("Edge")&&n.Window.prototype.setImmediate==n.setImmediate?(Vt||(Vt=Yt()),Vt(t)):n.setImmediate(t)}},qe=!1,we=new function(){this.b=this.a=null},xe=function(){for(var t;t=St();){try{t.a.call(t.b)}catch(e){Jt(e)}P(At,t)}qe=!1};(fe=!ie)||(fe=9<=Number(me));var Ee=fe,ke=ie&&!ge("9");!ae||ge("528"),oe&&ge("1.9b")||ie&&ge("8")||ne&&ge("9.5")||ae&&ge("528"),oe&&!ge("8")||ie&&ge("9");var Te=function(t,e){this.b={},this.a=[],this.f=this.c=0;var n=arguments.length;if(n>1){if(n%2)throw Error("Uneven number of arguments");for(var i=0;n>i;i+=2)this.set(arguments[i],arguments[i+1])}else if(t){t instanceof Te?(n=t.D(),i=t.w()):(n=U(t),i=D(t));for(var r=0;r2*t.c&&Se(t),!0):!1},Se=function(t){if(t.c!=t.a.length){for(var e=0,n=0;e=i.a.length)throw Zt;var r=i.a[e++];return t?r:i.b[r]},r};var _e=function(t,e){if(It.call(this,t?t.type:""),this.c=this.a=this.target=null,t){if(this.type=t.type,this.target=t.target||t.srcElement,this.a=e,(e=t.relatedTarget)&&oe)try{Q(e.nodeName); +}catch(n){}this.c=t,t.defaultPrevented&&this.b()}};v(_e,It),_e.prototype.b=function(){_e.G.b.call(this);var t=this.c;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,ke)try{(t.ctrlKey||112<=t.keyCode&&123>=t.keyCode)&&(t.keyCode=-1)}catch(e){}};var Ie=function(t,e){if(this.a=0,this.i=void 0,this.c=this.b=this.f=null,this.g=this.h=!1,t!=r)try{var n=this;t.call(e,function(t){Le(n,2,t)},function(t){try{if(t instanceof Error)throw t;throw Error("Promise rejected.")}catch(e){}Le(n,3,t)})}catch(i){Le(this,3,i)}},Re=function(){this.next=this.f=this.c=this.a=this.b=null,this.g=!1};Re.prototype.reset=function(){this.f=this.c=this.a=this.b=null,this.g=!1};var Oe=new F(function(){return new Re},function(t){t.reset()},100),Ce=function(t,e,n){var i=Oe.get();return i.a=t,i.c=e,i.f=n,i},Me=function(t){if(t instanceof Ie)return t;var e=new Ie(r);return Le(e,2,t),e},Fe=function(t){return new Ie(function(e,n){n(t)})};Ie.prototype.then=function(t,e,n){return null!=t&&st(t,"opt_onFulfilled should be a function."),null!=e&&st(e,"opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?"),Ne(this,l(t)?t:null,l(e)?e:null,n)},X(Ie),Ie.prototype.l=function(t,e){return Ne(this,null,t,e)};var Pe=function(t,e){t.b||2!=t.a&&3!=t.a||De(t),ot(null!=e.a),t.c?t.c.next=e:t.b=e,t.c=e},Ne=function(t,e,n,i){var r=Ce(null,null,null);return r.b=new Ie(function(t,o){r.a=e?function(n){try{var r=e.call(i,n);t(r)}catch(a){o(a)}}:t,r.c=n?function(e){try{var r=n.call(i,e);t(r)}catch(a){o(a)}}:o}),r.b.f=t,Pe(t,r),r.b};Ie.prototype.s=function(t){ot(1==this.a),this.a=0,Le(this,2,t)},Ie.prototype.m=function(t){ot(1==this.a),this.a=0,Le(this,3,t)};var Le=function(t,e,n){if(0==t.a){t==n&&(e=3,n=new TypeError("Promise cannot resolve to itself")),t.a=1;var i;t:{var o=n,a=t.s,s=t.m;if(o instanceof Ie)null!=a&&st(a,"opt_onFulfilled should be a function."),null!=s&&st(s,"opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?"),Pe(o,Ce(a||r,s||null,t)),i=!0;else if(K(o))o.then(a,s,t),i=!0;else{if(u(o))try{var c=o.then;if(l(c)){je(o,c,a,s,t),i=!0;break t}}catch(h){s.call(t,h),i=!0;break t}i=!1}}i||(t.i=n,t.a=e,t.f=null,De(t),3!=e||We(t,n))}},je=function(t,e,n,i,r){var o=!1,a=function(t){o||(o=!0,n.call(r,t))},s=function(t){o||(o=!0,i.call(r,t))};try{e.call(t,a,s)}catch(l){s(l)}},De=function(t){t.h||(t.h=!0,be(t.j,t))},Ue=function(t){var e=null;return t.b&&(e=t.b,t.b=e.next,e.next=null),t.b||(t.c=null),null!=e&&ot(null!=e.a),e};Ie.prototype.j=function(){for(var t;t=Ue(this);){var e=this.a,n=this.i;if(3==e&&t.c&&!t.g){var i;for(i=this;i&&i.g;i=i.f)i.g=!1}if(t.b)t.b.f=null,He(t,e,n);else try{t.g?t.a.call(t.f):He(t,e,n)}catch(r){Be.call(null,r)}P(Oe,t)}this.h=!1};var He=function(t,e,n){2==e?t.a.call(t.f,n):t.c&&t.c.call(t.f,n)},We=function(t,e){t.g=!0,be(function(){t.g&&Be.call(null,e)})},Be=Jt,Xe=function(t){if(this.a=new Te,t){t=zt(t);for(var e=t.length,n=0;e>n;n++){var i=t[n];this.a.set(Ke(i),i)}}},Ke=function(t){var e=typeof t;return"object"==e&&t||"function"==e?"o"+(t[c]||(t[c]=++h)):e.substr(0,1)+t};t=Xe.prototype,t.o=function(){return this.a.o()},t.clear=function(){this.a.clear()},t.F=function(){return this.a.F()},t.w=function(){return this.a.w()},t.clone=function(){return new Xe(this)},t.X=function(){return this.a.X(!1)};var Qe=function(t){return function(){var e=[];Array.prototype.push.apply(e,arguments),Me(!0).then(function(){t.apply(null,e)})}},Ve="closure_lm_"+(1e6*Math.random()|0),ze={},Ge=0,Je=function(t,e,n,i,r){if("array"==o(e)){for(var a=0;a-1&&(Ct(a[n]),ot(null!=a.length),Array.prototype.splice.call(a,n,1),0==a.length&&(delete t.a[e],t.b--)))):t&&(t=sn(t))&&(e=t.a[e.toString()],t=-1,e&&(t=Dt(e,n,!!i,r)),(n=t>-1?e[t]:null)&&en(n))},en=function(t){if("number"!=typeof t&&t&&!t.O){var e=t.src;if(e&&e[ct])jt(e.b,t);else{var n=t.type,i=t.a;e.removeEventListener?e.removeEventListener(n,i,t.U):e.detachEvent&&e.detachEvent(nn(n),i),Ge--,(n=sn(e))?(jt(n,t),0==n.b&&(n.src=null,e[Ve]=null)):Ct(t)}}},nn=function(t){return t in ze?ze[t]:ze[t]="on"+t},rn=function(t,e,n,i){var r=!0;if((t=sn(t))&&(e=t.a[e.toString()]))for(e=e.concat(),t=0;ti.keyCode||void 0!=i.returnValue)){t:{var o=!1;if(0==i.keyCode)try{i.keyCode=-1;break t}catch(a){o=!0}(o||void 0==i.returnValue)&&(i.returnValue=!0)}for(i=[],o=e.a;o;o=o.parentNode)i.push(o);for(t=t.type,o=i.length-1;o>=0;o--){e.a=i[o];var s=rn(i[o],t,!0,e),r=r&&s}for(o=0;o>>0),un=function(t){return ot(t,"Listener can not be null."),l(t)?t:(ot(t.handleEvent,"An object listener must have handleEvent method."),t[ln]||(t[ln]=function(e){return t.handleEvent(e)}),t[ln])},cn=function(t,e){if(lt.call(this),this.l=t||0,this.c=e||10,this.l>this.c)throw Error("[goog.structs.Pool] Min can not be greater than max");this.a=new Kt,this.b=new Xe,this.i=null,this.S()};v(cn,lt),cn.prototype.W=function(){var t=g();if(!(null!=this.i&&0>t-this.i)){for(var e;0this.c&&0=kn(this).value)for(l(e)&&(e=e()),t=new L(t,String(e),this.f),i&&(t.a=i),i="log:"+t.b,n.console&&(n.console.timeStamp?n.console.timeStamp(i):n.console.markTimeline&&n.console.markTimeline(i)),n.msWriteProfilerMark&&n.msWriteProfilerMark(i),i=this;i;)i=i.a};var Tn={},An=null,Sn=function(t){An||(An=new yn(""),Tn[""]=An,An.c=xn);var e;if(!(e=Tn[t])){e=new yn(t);var n=t.lastIndexOf("."),i=t.substr(n+1),n=Sn(t.substr(0,n));n.b||(n.b={}),n.b[i]=e,e.a=n,Tn[t]=e}return e},_n=function(){lt.call(this),this.b=new Nt(this),this.ma=this,this.I=null};v(_n,lt),_n.prototype[ct]=!0,_n.prototype.removeEventListener=function(t,e,n,i){tn(this,t,e,n,i)};var In=function(t,e){On(t);var n,i=t.I;if(i){n=[];for(var r=1;i;i=i.I)n.push(i),ot(1e3>++r,"infinite loop")}t=t.ma,i=e.type||e,s(e)?e=new It(e,t):e instanceof It?e.target=e.target||t:(r=e,e=new It(i,t),B(e,r));var o,r=!0;if(n)for(var a=n.length-1;a>=0;a--)o=e.a=n[a],r=Rn(o,i,!0,e)&&r;if(o=e.a=t,r=Rn(o,i,!0,e)&&r,r=Rn(o,i,!1,e)&&r,n)for(a=0;a=o)n=void 0;else{if(1==o)Et(r);else{r[0]=r.pop();for(var r=0,i=i.a,o=i.length,a=i[r];o>>1>r;){var s=2*r+1,l=2*r+2,s=o>l&&i[l].aa.a)break;i[r]=i[s],r=s}i[r]=a}n=n.b}n.apply(this,[e])}},t.Y=function(t){Cn.G.Y.call(this,t),this.$()},t.S=function(){Cn.G.S.call(this),this.$()},t.A=function(){Cn.G.A.call(this),n.clearTimeout(void 0),this.f.clear(),this.f=null};var Mn=function(t,e){t&&t.log(En,e,void 0)},Fn=function(t,e,i){if(l(t))i&&(t=p(t,i));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=p(t.handleEvent,t)}return 2147483647=500&&600>o||429===o?(i=7===e.J,hn(e),t(!1,new ri(!1,null,i))):(i=0<=mt(r.I,o),t(!0,new ri(i,e)))})})}function n(t,e){var n=r.l;t=r.s;var o=e.c;if(e.b)try{var a=r.v(o,Zn(o));i(a)?n(a):n()}catch(s){t(s)}else null!==o?(e=q(),a=Zn(o),e.serverResponse=a,t(r.j?r.j(o,e):e)):(e=e.a?r.h?T():E():new y("retry-limit-exceeded","Max retry time for operation exceeded, please try again."),t(e));hn(o)}var r=t;t.i?n(0,new ri(!1,null,!0)):t.f=m(e,n,t.K)};ii.prototype.a=function(){return this.C},ii.prototype.b=function(t){this.i=!0,this.h=t||!1,null!==this.f&&(0,this.f)(!1),null!==this.c&&Xn(this.c)};var ai=function(t,e,n){var i=et(t.f),i=t.l+i,r=t.b?S(t.b):{};return null!==e&&0e&&(e+=t.size),0>e&&(e=0),0>n&&(n+=t.size),e>n&&(n=e),t.slice(e,n-e)):t.slice(e,n):null},ui=function(t){this.c=Fe(t)};ui.prototype.a=function(){return this.c},ui.prototype.b=function(){};var ci=function(){this.a={},this.b=Number.MIN_SAFE_INTEGER},hi=function(t,e){function n(){delete r.a[i]}var i=t.b;t.b++,t.a[i]=e;var r=t;e.a().then(n,n)};ci.prototype.clear=function(){A(this.a,function(t,e){e&&e.b(!0)}),this.a={}};var fi=function(t,e,n,i){this.a=t,this.f=null,null!==this.a&&(t=this.a.options,C(t)?this.f=t.storageBucket||null:this.f=null),this.l=e,this.j=n,this.i=i,this.c=12e4,this.b=6e4,this.h=new ci,this.g=!1},di=function(t){return null!==t.a&&C(t.a.INTERNAL)&&C(t.a.INTERNAL.getToken)?t.a.INTERNAL.getToken().then(function(t){return C(t)?t.accessToken:null},function(){return null}):Me(null)};fi.prototype.bucket=function(){if(this.g)throw T();return this.f};var pi=function(t,e,n){return t.g?new ui(T()):(e=t.j(e,n,null===t.a),hi(t.h,e),e)},gi=function(t,e){return e},vi=function(t,e,n,i){this.c=t,this.b=e||t,this.f=!!n,this.a=i||gi},mi=null,bi=function(){if(mi)return mi;var t=[];t.push(new vi("bucket")),t.push(new vi("generation")),t.push(new vi("metageneration")),t.push(new vi("name","fullPath",!0));var e=new vi("name");return e.a=function(t,e){return!M(e)||2>e.length?e:Pt(e)},t.push(e),e=new vi("size"),e.a=function(t,e){return C(e)?+e:e},t.push(e),t.push(new vi("timeCreated")),t.push(new vi("updated")),t.push(new vi("md5Hash",null,!0)),t.push(new vi("cacheControl",null,!0)),t.push(new vi("contentDisposition",null,!0)),t.push(new vi("contentEncoding",null,!0)),t.push(new vi("contentLanguage",null,!0)),t.push(new vi("contentType",null,!0)),t.push(new vi("metadata","customMetadata",!0)),t.push(new vi("downloadTokens","downloadURLs",!1,function(t,e){if(!(M(e)&&0r;r++){var o=e[r];o.f&&(n[o.c]=t[o.b])}return JSON.stringify(n)},wi=function(t){if(!t||"object"!=typeof t)throw"Expected Metadata object.";for(var e in t){var n=t[e];if("customMetadata"===e&&"object"!=typeof n)throw"Expected object for 'customMetadata' mapping."}},xi=function(t,e,n){for(var i=e.length,r=e.length,o=0;o=0))throw"Expected a number 0 or greater."})},_i=function(t,e){return new Ei(function(e){if(!(null===e||C(e)&&e instanceof Object))throw"Expected an Object.";C(t)&&t(e)},e)},Ii=function(){return new Ei(function(t){if(null!==t&&!l(t))throw"Expected a Function."},!0)},Ri=function(t){if(!t)throw q()},Oi=function(t,e){return function(n,i){t:{var r;try{r=JSON.parse(i)}catch(o){n=null;break t}n=u(r)?r:null}if(null===n)n=null;else{i={type:"file"},r=e.length;for(var a=0;r>a;a++){var s=e[a];i[s.b]=s.a(i,n[s.c])}yi(i,t),n=i}return Ri(null!==n),n}},Ci=function(t){return function(e,n){return e=404===Yn(e)?new y("object-not-found","Object '"+t.path+"' does not exist."):401===Yn(e)?w():403===Yn(e)?x(t.path):n,e.serverResponse=n.serverResponse,e}},Mi=function(t){return function(e,n){return e=401===Yn(e)?w():403===Yn(e)?x(t.path):n,e.serverResponse=n.serverResponse,e}},Fi=function(t,e,n){var i=Z(e);return t=new _(b+"/v0"+i,"GET",Oi(t,n),t.c),t.a=Ci(e),t},Pi=function(t,e){var n=Z(e);return t=new _(b+"/v0"+n,"DELETE",function(){},t.c),t.h=[200,204],t.a=Ci(e),t},Ni=function(t,e,n){return n=n?S(n):{},n.fullPath=t.path,n.size=e.size,n.contentType||(n.contentType=e&&e.type||"application/octet-stream"),n},Li=function(t,e,n,i,r){var o,a="/b/"+encodeURIComponent(e.bucket)+"/o",s={"X-Goog-Upload-Protocol":"multipart"};o="";for(var l=0;2>l;l++)o+=Math.random().toString().slice(2);return s["Content-Type"]="multipart/related; boundary="+o,r=Ni(e,i,r),l=qi(r,n),i=si("--"+o+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+l+"\r\n--"+o+"\r\nContent-Type: "+r.contentType+"\r\n\r\n",i,"\r\n--"+o+"--"),t=new _(b+"/v0"+a,"POST",Oi(t,n),t.b),t.f={name:r.fullPath},t.b=s,t.c=i,t.a=Mi(e),t},ji=function(t,e,n,i){this.a=t,this.total=e,this.b=!!n,this.c=i||null},Di=function(t,e){var n;try{n=$n(t,"X-Goog-Upload-Status")}catch(i){Ri(!1)}return t=0<=mt(e||["active"],n),Ri(t),n},Ui=function(t,e,n,i,r){var o="/b/"+encodeURIComponent(e.bucket)+"/o",a=Ni(e,i,r);return r={name:a.fullPath},o=b+"/v0"+o,i={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":i.size,"X-Goog-Upload-Header-Content-Type":a.contentType,"Content-Type":"application/json; charset=utf-8"},n=qi(a,n),t=new _(o,"POST",function(t){Di(t);var e;try{e=$n(t,"X-Goog-Upload-URL")}catch(n){Ri(!1)}return Ri(M(e)),e},t.b),t.f=r,t.b=i,t.c=n,t.a=Mi(e),t},Hi=function(t,e,n,i){return t=new _(n,"POST",function(t){var e,n=Di(t,["active","final"]);try{e=$n(t,"X-Goog-Upload-Size-Received")}catch(r){Ri(!1)}return t=e,isFinite(t)&&(t=String(t)),t=s(t)?/^\s*-?0x/i.test(t)?parseInt(t,16):parseInt(t,10):NaN,Ri(!isNaN(t)),new ji(t,i.size,"final"===n)},t.b),t.b={"X-Goog-Upload-Command":"query"},t.a=Mi(e),t},Wi=function(t,e,n,i,r,o){var a=new ji(0,0);if(o?(a.a=o.a,a.total=o.total):(a.a=0,a.total=i.size),i.size!==a.total)throw new y("server-file-wrong-size","Server recorded incorrect upload file size, please retry the upload.");var s=o=a.total-a.a,s=Math.min(s,262144),l=a.a;if(o={"X-Goog-Upload-Command":s===o?"upload, finalize":"upload","X-Goog-Upload-Offset":a.a},l=li(i,l,l+s),null===l)throw new y("cannot-slice-blob","Cannot slice blob for upload. Please retry the upload.");return n=new _(n,"POST",function(t,n){var o,l=Di(t,["active","final"]),u=a.a+s,c=i.size;return o="final"===l?Oi(e,r)(t,n):null,new ji(u,c,"final"===l,o)},e.b),n.b=o,n.c=l,n.g=null,n.a=Mi(t),n},Bi=function(t,e,n,i,r,o){this.K=t,this.c=e,this.i=n,this.f=r,this.h=o||null,this.l=i,this.j=0,this.B=this.s=!1,this.v=[],this.R=262144n&&er(t)},Zi=function(t,e){if(t.b!==e)switch(e){case"canceling":t.b=e,null!==t.a&&t.a.b();break;case"pausing":t.b=e,null!==t.a&&t.a.b();break;case"running":var n="paused"===t.b;t.b=e,n&&(er(t),Xi(t));break;case"paused":t.b=e,er(t);break;case"canceled":t.g=E(),t.b=e,er(t);break;case"error":t.b=e,er(t);break;case"success":t.b=e,er(t)}},$i=function(t){switch(t.b){case"pausing":Zi(t,"paused");break;case"canceling":Zi(t,"canceled");break;case"running":Xi(t)}};Bi.prototype.C=function(){return new nt(this.j,this.f.size,O(this.b),this.h,this,this.K)},Bi.prototype.I=function(t,e,n,r){function o(t){try{return void s(t)}catch(e){}try{if(l(t),!(i(t.next)||i(t.error)||i(t.complete)))throw""}catch(e){throw"Expected a function or an Object with one of `next`, `error`, `complete` properties."}}function a(t){return function(e,n,i){null!==t&&xi("on",t,arguments);var r=new tt(e,n,i);return tr(u,r),function(){kt(u.v,r)}}}var s=Ii().a,l=_i(null,!0).a;xi("on",[Ti(function(){if("state_changed"!==t)throw"Expected one of the event types: [state_changed]."}),_i(o,!0),Ii(),Ii()],arguments);var u=this,c=[_i(function(t){if(null===t)throw"Expected a function or an Object with one of `next`, `error`, `complete` properties.";o(t)}),Ii(),Ii()];return i(e)||i(n)||i(r)?a(null)(e,n,r):a(c)};var tr=function(t,e){t.v.push(e),nr(t,e)},er=function(t){var e=Tt(t.v);bt(e,function(e){nr(t,e)})},nr=function(t,e){switch(O(t.b)){case"running":case"paused":null!==e.next&&Qe(e.next.bind(e,t.C()))();break;case"success":null!==e.a&&Qe(e.a.bind(e))();break;case"canceled":case"error":null!==e.error&&Qe(e.error.bind(e,t.g))();break;default:null!==e.error&&Qe(e.error.bind(e,t.g))()}};Bi.prototype.M=function(){xi("resume",[],arguments);var t="paused"===this.b||"pausing"===this.b;return t&&Zi(this,"running"),t},Bi.prototype.L=function(){xi("pause",[],arguments);var t="running"===this.b;return t&&Zi(this,"pausing"),t},Bi.prototype.H=function(){xi("cancel",[],arguments);var t="running"===this.b||"pausing"===this.b;return t&&Zi(this,"canceling"),t};var ir=function(t,e){if(this.b=t,e)this.a=e instanceof Y?e:$(e);else{if(t=t.bucket(),null===t)throw new y("no-default-bucket","No default bucket found. Did you set the 'storageBucket' property when initializing the app?");this.a=new Y(t,"")}};ir.prototype.toString=function(){return xi("toString",[],arguments),"gs://"+this.a.bucket+"/"+this.a.path};var rr=function(t,e){return new ir(t,e)};t=ir.prototype,t.ga=function(t){xi("child",[Ti()],arguments);var e=Ft(this.a.path,t);return rr(this.b,new Y(this.a.bucket,e))},t.Fa=function(){var t;if(t=this.a.path,0==t.length)t=null;else{var e=t.lastIndexOf("/");t=-1===e?"":t.slice(0,e)}return null===t?null:rr(this.b,new Y(this.a.bucket,t))},t.Ha=function(){return rr(this.b,new Y(this.a.bucket,""))},t.pa=function(){return this.a.bucket},t.Aa=function(){return this.a.path},t.Ea=function(){return Pt(this.a.path)},t.Ja=function(){return this.b.i},t.ua=function(t,e){return xi("put",[Ai(),new Ei(wi,!0)],arguments),or(this,"put"),new Bi(this,this.b,this.a,bi(),t,e)},t["delete"]=function(){xi("delete",[],arguments),or(this,"delete");var t=this;return di(this.b).then(function(e){var n=Pi(t.b,t.a);return pi(t.b,n,e).a()})},t.ha=function(){xi("getMetadata",[],arguments),or(this,"getMetadata");var t=this;return di(this.b).then(function(e){var n=Fi(t.b,t.a,bi());return pi(t.b,n,e).a()})},t.va=function(t){xi("updateMetadata",[new Ei(wi,void 0)],arguments),or(this,"updateMetadata");var e=this;return di(this.b).then(function(n){var i=e.b,r=e.a,o=t,a=bi(),s=Z(r),s=b+"/v0"+s,o=qi(o,a),i=new _(s,"PATCH",Oi(i,a),i.c);return i.b={"Content-Type":"application/json; charset=utf-8"},i.c=o,i.a=Ci(r),pi(e.b,i,n).a()})},t.ta=function(){return xi("getDownloadURL",[],arguments),or(this,"getDownloadURL"),this.ha().then(function(t){if(t=t.downloadURLs[0],C(t))return t;throw new y("no-download-url","The given file does not have any download URLs.")})};var or=function(t,e){if(""===t.a.path)throw new y("invalid-root-operation","The operation '"+e+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")},ar=function(t){this.a=new fi(t,function(t,e){return new ir(t,e)},ai,this),this.b=t,this.c=new sr(this)};t=ar.prototype,t.wa=function(t){xi("ref",[Ti(function(t){if(/^[A-Za-z]+:\/\//.test(t))throw"Expected child path but got a URL, use refFromURL instead."},!0)],arguments);var e=new ir(this.a);return i(t)?e.ga(t):e},t.xa=function(t){return xi("refFromURL",[Ti(function(t){if(!/^[A-Za-z]+:\/\//.test(t))throw"Expected full URL but got a child path, use ref instead.";try{$(t)}catch(e){throw"Expected valid full URL but got an invalid one."}},!1)],arguments),new ir(this.a,t)},t.Ca=function(){return this.a.b},t.za=function(t){xi("setMaxUploadRetryTime",[Si()],arguments),this.a.b=t},t.Ba=function(){return this.a.c},t.ya=function(t){xi("setMaxOperationRetryTime",[Si()],arguments),this.a.c=t},t.oa=function(){return this.b},t.la=function(){return this.c};var sr=function(t){this.a=t};sr.prototype["delete"]=function(){var t=this.a.a;t.g=!0,t.a=null,t.h.clear()};var lr=function(t,e,n){Object.defineProperty(t,e,{get:n})};ir.prototype.toString=ir.prototype.toString,ir.prototype.child=ir.prototype.ga,ir.prototype.put=ir.prototype.ua,ir.prototype["delete"]=ir.prototype["delete"],ir.prototype.getMetadata=ir.prototype.ha,ir.prototype.updateMetadata=ir.prototype.va,ir.prototype.getDownloadURL=ir.prototype.ta,lr(ir.prototype,"parent",ir.prototype.Fa),lr(ir.prototype,"root",ir.prototype.Ha),lr(ir.prototype,"bucket",ir.prototype.pa),lr(ir.prototype,"fullPath",ir.prototype.Aa),lr(ir.prototype,"name",ir.prototype.Ea),lr(ir.prototype,"storage",ir.prototype.Ja),ar.prototype.ref=ar.prototype.wa,ar.prototype.refFromURL=ar.prototype.xa,lr(ar.prototype,"maxOperationRetryTime",ar.prototype.Ba),ar.prototype.setMaxOperationRetryTime=ar.prototype.ya,lr(ar.prototype,"maxUploadRetryTime",ar.prototype.Ca),ar.prototype.setMaxUploadRetryTime=ar.prototype.za,lr(ar.prototype,"app",ar.prototype.oa), +lr(ar.prototype,"INTERNAL",ar.prototype.la),sr.prototype["delete"]=sr.prototype["delete"],ar.prototype.capi_=function(t){b=t},Bi.prototype.on=Bi.prototype.I,Bi.prototype.resume=Bi.prototype.M,Bi.prototype.pause=Bi.prototype.L,Bi.prototype.cancel=Bi.prototype.H,lr(Bi.prototype,"snapshot",Bi.prototype.C),lr(nt.prototype,"bytesTransferred",nt.prototype.qa),lr(nt.prototype,"totalBytes",nt.prototype.La),lr(nt.prototype,"state",nt.prototype.Ia),lr(nt.prototype,"metadata",nt.prototype.Da),lr(nt.prototype,"downloadURL",nt.prototype.sa),lr(nt.prototype,"task",nt.prototype.Ka),lr(nt.prototype,"ref",nt.prototype.Ga),I.STATE_CHANGED="state_changed",R.RUNNING="running",R.PAUSED="paused",R.SUCCESS="success",R.CANCELED="canceled",R.ERROR="error",Ie.prototype["catch"]=Ie.prototype.l,Ie.prototype.then=Ie.prototype.then,function(){function t(t){return new ar(t)}var e={TaskState:R,TaskEvent:I,Storage:ar,Reference:ir};if(!(window.firebase&&firebase.INTERNAL&&firebase.INTERNAL.registerService))throw Error("Cannot install Firebase Storage - be sure to load firebase-app.js first.");firebase.INTERNAL.registerService("storage",t,e)}()}()}).call(exports,function(){return this}())},function(t,e){function n(t,e,n){for(var i=[],r=Math.ceil(e/t.columns),o=0;r>o;o++)for(var a=0;ar;r++){var o=r*(2*Math.PI)/e;i.push([n.x+t.radius*Math.cos(o),n.y,n.z+t.radius*Math.sin(o)])}return i}function r(t,e,i){return t.columns=e,n(t,e,i)}function o(t,e,n){return l([[1,0,0],[0,1,0],[0,0,1],[-1,0,0],[0,-1,0],[0,0,-1]],n,t.radius/2)}function a(t,e,n){var i=(1+Math.sqrt(5))/2,r=1/i,o=2-i,a=-1*r,s=-1*o;return l([[-1,o,0],[-1,s,0],[0,-1,o],[0,-1,s],[0,1,o],[0,1,s],[1,o,0],[1,s,0],[r,r,r],[r,r,a],[r,a,r],[r,a,a],[o,0,1],[o,0,-1],[a,r,r],[a,r,a],[a,a,r],[a,a,a],[s,0,1],[s,0,-1]],n,t.radius/2)}function s(t,e,n){var i=Math.sqrt(3),r=-1/Math.sqrt(3),o=2*Math.sqrt(2/3);return l([[0,0,i+r],[-1,0,r],[1,0,r],[0,o,0]],n,t.radius/2)}function l(t,e,n){return e=[e.x,e.y,e.z],t.map(function(t){return t.map(function(t,i){return t*n+e[i]})})}function u(t,e){t.forEach(function(t,n){var i=e[n];t.setAttribute("position",{x:i[0],y:i[1],z:i[2]})})}AFRAME.registerComponent("layout",{schema:{columns:{"default":1,min:0,"if":{type:["box"]}},margin:{"default":1,min:0,"if":{type:["box","line"]}},radius:{"default":1,min:0,"if":{type:["circle","cube","dodecahedron","pyramid"]}},type:{"default":"line",oneOf:["box","circle","cube","dodecahedron","line","pyramid"]}},init:function(){var t=this,e=this.el,n=n=[];this.children=e.getChildEntities(),this.children.forEach(function(t){n.push(t.getComputedAttribute("position"))}),e.addEventListener("child-attached",function(e){t.children.push(e.detail.el),t.update()})},update:function(t){var e,l,c=this.children,h=this.data,f=this.el,d=c.length,p=f.getComputedAttribute("position");switch(h.type){case"box":e=n;break;case"circle":e=i;break;case"cube":e=o;break;case"dodecahedron":e=a;break;case"pyramid":e=s;break;default:e=r}l=e(h,d,p),u(c,l)},remove:function(){el.removeEventListener("child-attached",this.childAttachedCallback),u(children,this.initialPositions)}}),t.exports.getBoxPositions=n,t.exports.getCirclePositions=i,t.exports.getLinePositions=r,t.exports.getCubePositions=o,t.exports.getDodecahedronPositions=a,t.exports.getPyramidPositions=s},function(t,e){var n=AFRAME.utils.debug,i=AFRAME.utils.coordinates,r=n("components:look-at:warn"),o=i.isCoordinate;AFRAME.registerComponent("look-at",{schema:{"default":"",parse:function(t){return o(t)||"object"==typeof t?i.parse(t):t},stringify:function(t){return"object"==typeof t?i.stringify(t):t}},init:function(){this.target3D=null,this.vector=new THREE.Vector3},update:function(){var t,e=this,n=e.data,i=e.el.object3D;return!n||"object"==typeof n&&!Object.keys(n).length?e.remove():"object"==typeof n?i.lookAt(new THREE.Vector3(n.x,n.y,n.z)):(t=e.el.sceneEl.querySelector(n),t?t.hasLoaded?e.beginTracking(t):t.addEventListener("loaded",function(){e.beginTracking(t)}):void r('"'+n+'" does not point to a valid entity to look-at'))},tick:function(t){var e=this.target3D;return e?this.el.object3D.lookAt(this.vector.setFromMatrixPosition(e.matrixWorld)):void 0},beginTracking:function(t){this.target3D=t.object3D}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("random-color",{schema:{min:{"default":{x:0,y:0,z:0},type:"vec3"},max:{"default":{x:1,y:1,z:1},type:"vec3"}},update:function(){var t=this.data,e=t.max,n=t.min;this.el.setAttribute("material","color","#"+new THREE.Color(Math.random()*e.x+n.x,Math.random()*e.y+n.y,Math.random()*e.z+n.z).getHexString())}}),AFRAME.registerComponent("random-position",{schema:{min:{"default":{x:-10,y:-10,z:-10},type:"vec3"},max:{"default":{x:10,y:10,z:10},type:"vec3"}},update:function(){var t=this.data,e=t.max,n=t.min;this.el.setAttribute("position",{x:Math.random()*(e.x-n.x)+n.x,y:Math.random()*(e.y-n.y)+n.y,z:Math.random()*(e.z-n.z)+n.z})}}),AFRAME.registerComponent("random-spherical-position",{schema:{radius:{"default":10},startX:{"default":0},lengthX:{"default":360},startY:{"default":0},lengthY:{"default":360},startZ:{"default":0},lengthZ:{"default":360}},update:function(){var t=this.data,e=THREE.Math.degToRad(Math.random()*t.lengthX+t.startX),n=THREE.Math.degToRad(Math.random()*t.lengthY+t.startY);THREE.Math.degToRad(Math.random()*t.lengthZ+t.startZ);this.el.setAttribute("position",{x:t.radius*Math.cos(e)*Math.sin(n),y:t.radius*Math.sin(e)*Math.sin(n),z:t.radius*Math.cos(n)})}}),AFRAME.registerComponent("random-rotation",{schema:{min:{"default":{x:0,y:0,z:0},type:"vec3"},max:{"default":{x:360,y:360,z:360},type:"vec3"}},update:function(){var t=this.data,e=t.max,n=t.min;this.el.setAttribute("rotation",{x:Math.random()*e.x+n.x,y:Math.random()*e.y+n.y,z:Math.random()*e.z+n.z})}}),AFRAME.registerComponent("random-scale",{schema:{min:{"default":{x:0,y:0,z:0},type:"vec3"},max:{"default":{x:2,y:2,z:2},type:"vec3"}},update:function(){var t=this.data,e=t.max,n=t.min;this.el.setAttribute("scale",{x:Math.random()*e.x+n.x,y:Math.random()*e.y+n.y,z:Math.random()*e.z+n.z})}})},function(t,e){function n(t,e,n){return new Promise(function(i){c(e).then(function(){d[t]={template:a(e)(n.trim()),type:e},i(d[t])})})}function i(t,e,n){switch(e){case v:return t(n);case m:return t(n);case b:return Mustache.render(t,n);case y:return t.render(n);default:return t}}function r(t,e){var i=document.querySelector(t),r=i.getAttribute("type"),o=i.innerHTML;if(!e){if(!r)throw new Error("Must provide `type` attribute for