From 8c43840572fcf05a9405c0821062c4d3b2d73427 Mon Sep 17 00:00:00 2001 From: Sebastian Kupke Date: Fri, 22 Mar 2019 14:26:44 +0100 Subject: [PATCH] Create 3rd party libraries with node instead of Python. --- README.md | 10 +- dist/iwmlib.3rdparty.js | 32027 +++++++++++++------------- dist/iwmlib.3rdparty.min.js | 2 +- dist/iwmlib.3rdparty.preload.js | 10945 +++++++++ dist/iwmlib.3rdparty.preload.min.js | 1 + gulpfile.js | 39 +- lib/3rdparty/3rdparty.js | 45 - lib/3rdparty/create_all_js.py | 82 - lib/3rdparty/create_preload_js.py | 68 - package-lock.json | 28 + package.json | 4 +- 11 files changed, 27026 insertions(+), 16225 deletions(-) create mode 100644 dist/iwmlib.3rdparty.preload.js create mode 100644 dist/iwmlib.3rdparty.preload.min.js delete mode 100644 lib/3rdparty/3rdparty.js delete mode 100755 lib/3rdparty/create_all_js.py delete mode 100755 lib/3rdparty/create_preload_js.py diff --git a/README.md b/README.md index e85e54d..2fe7a26 100644 --- a/README.md +++ b/README.md @@ -10,24 +10,16 @@ and some dependencies locally `npm i` -Be sure that Python 3 is installed on your system (for building the 3rd party library). - ## Build To build the two iwmlib files type `npm run build` -The files will be generated in the dist folder (iwmlib.js and iwmlib.pixi.js). If you want to watch the files for a continuously build type +The files will be generated in the dist folder (iwmlib.js and iwmlib.pixi.js). If you want to watch the files for a continuously build type `npm run watch` To build the 3rd party library type `npm run 3rdparty` - -To create the minified version of the 3rd party library type - -`npm run minify` - - diff --git a/dist/iwmlib.3rdparty.js b/dist/iwmlib.3rdparty.js index eda2d7b..e5fe59f 100644 --- a/dist/iwmlib.3rdparty.js +++ b/dist/iwmlib.3rdparty.js @@ -1,4 +1,3 @@ - /*! * jQuery JavaScript Library v3.3.1 * https://jquery.com/ @@ -98408,1913 +98407,1913 @@ var __filters=function(e,t){"use strict";var n="attribute vec2 aVertexPosition;\ * pixi-particles is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pixiParticles = f()}})(function(){var define,module,exports;return (function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 0) { - this.elapsed += delta; - if (this.elapsed > this.duration) { - //loop elapsed back around - if (this.loop) - this.elapsed = this.elapsed % this.duration; - else - this.elapsed = this.duration - 0.000001; - } - var frame = (this.elapsed * this.framerate + 0.0000001) | 0; - this.texture = this.textures[frame] || PIXI.Texture.EMPTY; - } - return lerp; - }; - /** - * Destroys the particle, removing references and preventing future use. - * @method PIXI.particles.AnimatedParticle#destroy - */ - AnimatedParticle.prototype.destroy = function () { - this.Particle_destroy(); - this.textures = null; - }; - /** - * Checks over the art that was passed to the Emitter's init() function, to do any special - * modifications to prepare it ahead of time. - * @method PIXI.particles.AnimatedParticle.parseArt - * @static - * @param {Array} art The array of art data, properly formatted for AnimatedParticle. - * @return {Array} The art, after any needed modifications. - */ - AnimatedParticle.parseArt = function (art) { - var data, output, textures, tex, outTextures; - var outArr = []; - for (var i = 0; i < art.length; ++i) { - data = art[i]; - outArr[i] = output = {}; - output.textures = outTextures = []; - textures = data.textures; - for (var j = 0; j < textures.length; ++j) { - tex = textures[j]; - if (typeof tex == "string") - outTextures.push(Texture.fromImage(tex)); - else if (tex instanceof Texture) - outTextures.push(tex); - else { - var dupe = tex.count || 1; - if (typeof tex.texture == "string") - tex = Texture.fromImage(tex.texture); - else - tex = tex.texture; - for (; dupe > 0; --dupe) { - outTextures.push(tex); - } - } - } - //use these values to signify that the animation should match the particle life time. - if (data.framerate == "matchLife") { - //-1 means that it should be calculated - output.framerate = -1; - output.duration = 0; - output.loop = false; - } - else { - //determine if the animation should loop - output.loop = !!data.loop; - //get the framerate, default to 60 - output.framerate = data.framerate > 0 ? data.framerate : 60; - //determine the duration - output.duration = outTextures.length / output.framerate; - } - } - return outArr; - }; - return AnimatedParticle; -}(Particle_1.default)); -exports.default = AnimatedParticle; - -},{"./Particle":3}],2:[function(_dereq_,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var ParticleUtils_1 = _dereq_("./ParticleUtils"); -var Particle_1 = _dereq_("./Particle"); -var PropertyNode_1 = _dereq_("./PropertyNode"); -var ticker = PIXI.ticker.shared; -var helperPoint = new PIXI.Point(); -/** - * A particle emitter. - * @memberof PIXI.particles - * @class Emitter - * @constructor - * @param {PIXI.Container} particleParent The container to add the - * particles to. - * @param {Array|PIXI.Texture|String} [particleImages] A texture or array of textures to use - * for the particles. Strings will be turned - * into textures via Texture.fromImage(). - * @param {Object} [config] A configuration object containing settings for the emitter. - * @param {Boolean} [config.emit=true] If config.emit is explicitly passed as false, the Emitter - * will start disabled. - * @param {Boolean} [config.autoUpdate=false] If config.emit is explicitly passed as true, the Emitter - * will automatically call update via the PIXI shared ticker. - */ -var Emitter = /** @class */ (function () { - function Emitter(particleParent, particleImages, config) { - this._particleConstructor = Particle_1.default; - //properties for individual particles - this.particleImages = null; - this.startAlpha = null; - this.startSpeed = null; - this.minimumSpeedMultiplier = 1; - this.acceleration = null; - this.maxSpeed = NaN; - this.startScale = null; - this.minimumScaleMultiplier = 1; - this.startColor = null; - this.minLifetime = 0; - this.maxLifetime = 0; - this.minStartRotation = 0; - this.maxStartRotation = 0; - this.noRotation = false; - this.minRotationSpeed = 0; - this.maxRotationSpeed = 0; - this.particleBlendMode = 0; - this.customEase = null; - this.extraData = null; - //properties for spawning particles - this._frequency = 1; - this.spawnChance = 1; - this.maxParticles = 1000; - this.emitterLifetime = -1; - this.spawnPos = null; - this.spawnType = null; - this._spawnFunc = null; - this.spawnRect = null; - this.spawnCircle = null; - this.particlesPerWave = 1; - this.particleSpacing = 0; - this.angleStart = 0; - //emitter properties - this.rotation = 0; - this.ownerPos = null; - this._prevEmitterPos = null; - this._prevPosIsValid = false; - this._posChanged = false; - this._parent = null; - this.addAtBack = false; - this.particleCount = 0; - this._emit = false; - this._spawnTimer = 0; - this._emitterLife = -1; - this._activeParticlesFirst = null; - this._activeParticlesLast = null; - this._poolFirst = null; - this._origConfig = null; - this._origArt = null; - this._autoUpdate = false; - this._destroyWhenComplete = false; - this._completeCallback = null; - //set the initial parent - this.parent = particleParent; - if (particleImages && config) - this.init(particleImages, config); - //save often used functions on the instance instead of the prototype for better speed - this.recycle = this.recycle; - this.update = this.update; - this.rotate = this.rotate; - this.updateSpawnPos = this.updateSpawnPos; - this.updateOwnerPos = this.updateOwnerPos; - } - Object.defineProperty(Emitter.prototype, "frequency", { - /** - * Time between particle spawns in seconds. If this value is not a number greater than 0, - * it will be set to 1 (particle per second) to prevent infinite loops. - * @member {Number} PIXI.particles.Emitter#frequency - */ - get: function () { return this._frequency; }, - set: function (value) { - //do some error checking to prevent infinite loops - if (typeof value == "number" && value > 0) - this._frequency = value; - else - this._frequency = 1; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Emitter.prototype, "particleConstructor", { - /** - * The constructor used to create new particles. The default is - * the built in Particle class. Setting this will dump any active or - * pooled particles, if the emitter has already been used. - * @member {Function} PIXI.particles.Emitter#particleConstructor - */ - get: function () { return this._particleConstructor; }, - set: function (value) { - if (value != this._particleConstructor) { - this._particleConstructor = value; - //clean up existing particles - this.cleanup(); - //scrap all the particles - for (var particle = this._poolFirst; particle; particle = particle.next) { - particle.destroy(); - } - this._poolFirst = null; - //re-initialize the emitter so that the new constructor can do anything it needs to - if (this._origConfig && this._origArt) - this.init(this._origArt, this._origConfig); - } - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Emitter.prototype, "parent", { - /** - * The container to add particles to. Settings this will dump any active particles. - * @member {PIXI.Container} PIXI.particles.Emitter#parent - */ - get: function () { return this._parent; }, - set: function (value) { - this.cleanup(); - this._parent = value; - }, - enumerable: true, - configurable: true - }); - /** - * Sets up the emitter based on the config settings. - * @method PIXI.particles.Emitter#init - * @param {Array|PIXI.Texture} art A texture or array of textures to use for the particles. - * @param {Object} config A configuration object containing settings for the emitter. - */ - Emitter.prototype.init = function (art, config) { - if (!art || !config) - return; - //clean up any existing particles - this.cleanup(); - //store the original config and particle images, in case we need to re-initialize - //when the particle constructor is changed - this._origConfig = config; - this._origArt = art; - //set up the array of data, also ensuring that it is an array - art = Array.isArray(art) ? art.slice() : [art]; - //run the art through the particle class's parsing function - var partClass = this._particleConstructor; - this.particleImages = partClass.parseArt ? partClass.parseArt(art) : art; - /////////////////////////// - // Particle Properties // - /////////////////////////// - //set up the alpha - if (config.alpha) { - this.startAlpha = PropertyNode_1.default.createList(config.alpha); - } - else - this.startAlpha = new PropertyNode_1.default(1, 0); - //set up the speed - if (config.speed) { - this.startSpeed = PropertyNode_1.default.createList(config.speed); - this.minimumSpeedMultiplier = config.speed.minimumSpeedMultiplier || 1; - } - else { - this.minimumSpeedMultiplier = 1; - this.startSpeed = new PropertyNode_1.default(0, 0); - } - //set up acceleration - var acceleration = config.acceleration; - if (acceleration && (acceleration.x || acceleration.y)) { - //make sure we disable speed interpolation - this.startSpeed.next = null; - this.acceleration = new PIXI.Point(acceleration.x, acceleration.y); - this.maxSpeed = config.maxSpeed || NaN; - } - else - this.acceleration = new PIXI.Point(); - //set up the scale - if (config.scale) { - this.startScale = PropertyNode_1.default.createList(config.scale); - this.minimumScaleMultiplier = config.scale.minimumScaleMultiplier || 1; - } - else { - this.startScale = new PropertyNode_1.default(1, 0); - this.minimumScaleMultiplier = 1; - } - //set up the color - if (config.color) { - this.startColor = PropertyNode_1.default.createList(config.color); - } - else { - this.startColor = new PropertyNode_1.default({ r: 0xFF, g: 0xFF, b: 0xFF }, 0); - } - //set up the start rotation - if (config.startRotation) { - this.minStartRotation = config.startRotation.min; - this.maxStartRotation = config.startRotation.max; - } - else - this.minStartRotation = this.maxStartRotation = 0; - if (config.noRotation && - (this.minStartRotation || this.maxStartRotation)) { - this.noRotation = !!config.noRotation; - } - else - this.noRotation = false; - //set up the rotation speed - if (config.rotationSpeed) { - this.minRotationSpeed = config.rotationSpeed.min; - this.maxRotationSpeed = config.rotationSpeed.max; - } - else - this.minRotationSpeed = this.maxRotationSpeed = 0; - //set up the lifetime - this.minLifetime = config.lifetime.min; - this.maxLifetime = config.lifetime.max; - //get the blend mode - this.particleBlendMode = ParticleUtils_1.default.getBlendMode(config.blendMode); - //use the custom ease if provided - if (config.ease) { - this.customEase = typeof config.ease == "function" ? - config.ease : - ParticleUtils_1.default.generateEase(config.ease); - } - else - this.customEase = null; - //set up the extra data, running it through the particle class's parseData function. - if (partClass.parseData) - this.extraData = partClass.parseData(config.extraData); - else - this.extraData = config.extraData || null; - ////////////////////////// - // Emitter Properties // - ////////////////////////// - //reset spawn type specific settings - this.spawnRect = this.spawnCircle = null; - this.particlesPerWave = 1; - if (config.particlesPerWave && config.particlesPerWave > 1) - this.particlesPerWave = config.particlesPerWave; - this.particleSpacing = 0; - this.angleStart = 0; - var spawnCircle; - //determine the spawn function to use - switch (config.spawnType) { - case "rect": - this.spawnType = "rect"; - this._spawnFunc = this._spawnRect; - var spawnRect = config.spawnRect; - this.spawnRect = new PIXI.Rectangle(spawnRect.x, spawnRect.y, spawnRect.w, spawnRect.h); - break; - case "circle": - this.spawnType = "circle"; - this._spawnFunc = this._spawnCircle; - spawnCircle = config.spawnCircle; - this.spawnCircle = new PIXI.Circle(spawnCircle.x, spawnCircle.y, spawnCircle.r); - break; - case "ring": - this.spawnType = "ring"; - this._spawnFunc = this._spawnRing; - spawnCircle = config.spawnCircle; - this.spawnCircle = new PIXI.Circle(spawnCircle.x, spawnCircle.y, spawnCircle.r); - this.spawnCircle.minRadius = spawnCircle.minR; - break; - case "burst": - this.spawnType = "burst"; - this._spawnFunc = this._spawnBurst; - this.particleSpacing = config.particleSpacing; - this.angleStart = config.angleStart ? config.angleStart : 0; - break; - case "point": - this.spawnType = "point"; - this._spawnFunc = this._spawnPoint; - break; - default: - this.spawnType = "point"; - this._spawnFunc = this._spawnPoint; - break; - } - //set the spawning frequency - this.frequency = config.frequency; - this.spawnChance = (typeof config.spawnChance === 'number' && config.spawnChance > 0) ? config.spawnChance : 1; - //set the emitter lifetime - this.emitterLifetime = config.emitterLifetime || -1; - //set the max particles - this.maxParticles = config.maxParticles > 0 ? config.maxParticles : 1000; - //determine if we should add the particle at the back of the list or not - this.addAtBack = !!config.addAtBack; - //reset the emitter position and rotation variables - this.rotation = 0; - this.ownerPos = new PIXI.Point(); - this.spawnPos = new PIXI.Point(config.pos.x, config.pos.y); - this._prevEmitterPos = this.spawnPos.clone(); - //previous emitter position is invalid and should not be used for interpolation - this._prevPosIsValid = false; - //start emitting - this._spawnTimer = 0; - this.emit = config.emit === undefined ? true : !!config.emit; - this.autoUpdate = config.autoUpdate === undefined ? false : !!config.autoUpdate; - }; - /** - * Recycles an individual particle. - * @method PIXI.particles.Emitter#recycle - * @param {Particle} particle The particle to recycle. - * @private - */ - Emitter.prototype.recycle = function (particle) { - if (particle.next) - particle.next.prev = particle.prev; - if (particle.prev) - particle.prev.next = particle.next; - if (particle == this._activeParticlesLast) - this._activeParticlesLast = particle.prev; - if (particle == this._activeParticlesFirst) - this._activeParticlesFirst = particle.next; - //add to pool - particle.prev = null; - particle.next = this._poolFirst; - this._poolFirst = particle; - //remove child from display, or make it invisible if it is in a ParticleContainer - if (particle.parent) - particle.parent.removeChild(particle); - //decrease count - --this.particleCount; - }; - /** - * Sets the rotation of the emitter to a new value. - * @method PIXI.particles.Emitter#rotate - * @param {Number} newRot The new rotation, in degrees. - */ - Emitter.prototype.rotate = function (newRot) { - if (this.rotation == newRot) - return; - //caclulate the difference in rotation for rotating spawnPos - var diff = newRot - this.rotation; - this.rotation = newRot; - //rotate spawnPos - ParticleUtils_1.default.rotatePoint(diff, this.spawnPos); - //mark the position as having changed - this._posChanged = true; - }; - /** - * Changes the spawn position of the emitter. - * @method PIXI.particles.Emitter#updateSpawnPos - * @param {Number} x The new x value of the spawn position for the emitter. - * @param {Number} y The new y value of the spawn position for the emitter. - */ - Emitter.prototype.updateSpawnPos = function (x, y) { - this._posChanged = true; - this.spawnPos.x = x; - this.spawnPos.y = y; - }; - /** - * Changes the position of the emitter's owner. You should call this if you are adding - * particles to the world container that your emitter's owner is moving around in. - * @method PIXI.particles.Emitter#updateOwnerPos - * @param {Number} x The new x value of the emitter's owner. - * @param {Number} y The new y value of the emitter's owner. - */ - Emitter.prototype.updateOwnerPos = function (x, y) { - this._posChanged = true; - this.ownerPos.x = x; - this.ownerPos.y = y; - }; - /** - * Prevents emitter position interpolation in the next update. - * This should be used if you made a major position change of your emitter's owner - * that was not normal movement. - * @method PIXI.particles.Emitter#resetPositionTracking - */ - Emitter.prototype.resetPositionTracking = function () { - this._prevPosIsValid = false; - }; - Object.defineProperty(Emitter.prototype, "emit", { - /** - * If particles should be emitted during update() calls. Setting this to false - * stops new particles from being created, but allows existing ones to die out. - * @member {Boolean} PIXI.particles.Emitter#emit - */ - get: function () { return this._emit; }, - set: function (value) { - this._emit = !!value; - this._emitterLife = this.emitterLifetime; - }, - enumerable: true, - configurable: true - }); - ; - Object.defineProperty(Emitter.prototype, "autoUpdate", { - /** - * If the update function is called automatically from the shared ticker. - * Setting this to false requires calling the update function manually. - * @member {Boolean} PIXI.particles.Emitter#autoUpdate - */ - get: function () { return this._autoUpdate; }, - set: function (value) { - if (this._autoUpdate && !value) { - ticker.remove(this.update, this); - } - else if (!this._autoUpdate && value) { - ticker.add(this.update, this); - } - this._autoUpdate = !!value; - }, - enumerable: true, - configurable: true - }); - /** - * Starts emitting particles, sets autoUpdate to true, and sets up the Emitter to destroy itself - * when particle emission is complete. - * @method PIXI.particles.Emitter#playOnceAndDestroy - * @param {Function} [callback] Callback for when emission is complete (all particles have died off) - */ - Emitter.prototype.playOnceAndDestroy = function (callback) { - this.autoUpdate = true; - this.emit = true; - this._destroyWhenComplete = true; - this._completeCallback = callback; - }; - /** - * Starts emitting particles and optionally calls a callback when particle emission is complete. - * @method PIXI.particles.Emitter#playOnce - * @param {Function} [callback] Callback for when emission is complete (all particles have died off) - */ - Emitter.prototype.playOnce = function (callback) { - this.emit = true; - this._completeCallback = callback; - }; - /** - * Updates all particles spawned by this emitter and emits new ones. - * @method PIXI.particles.Emitter#update - * @param {Number} delta Time elapsed since the previous frame, in __seconds__. - */ - Emitter.prototype.update = function (delta) { - if (this._autoUpdate) { - delta = delta / PIXI.settings.TARGET_FPMS / 1000; - } - //if we don't have a parent to add particles to, then don't do anything. - //this also works as a isDestroyed check - if (!this._parent) - return; - //update existing particles - var i, particle, next; - for (particle = this._activeParticlesFirst; particle; particle = next) { - next = particle.next; - particle.update(delta); - } - var prevX, prevY; - //if the previous position is valid, store these for later interpolation - if (this._prevPosIsValid) { - prevX = this._prevEmitterPos.x; - prevY = this._prevEmitterPos.y; - } - //store current position of the emitter as local variables - var curX = this.ownerPos.x + this.spawnPos.x; - var curY = this.ownerPos.y + this.spawnPos.y; - //spawn new particles - if (this._emit) { - //decrease spawn timer - this._spawnTimer -= delta < 0 ? 0 : delta; - //while _spawnTimer < 0, we have particles to spawn - while (this._spawnTimer <= 0) { - //determine if the emitter should stop spawning - if (this._emitterLife > 0) { - this._emitterLife -= this._frequency; - if (this._emitterLife <= 0) { - this._spawnTimer = 0; - this._emitterLife = 0; - this.emit = false; - break; - } - } - //determine if we have hit the particle limit - if (this.particleCount >= this.maxParticles) { - this._spawnTimer += this._frequency; - continue; - } - //determine the particle lifetime - var lifetime = void 0; - if (this.minLifetime == this.maxLifetime) - lifetime = this.minLifetime; - else - lifetime = Math.random() * (this.maxLifetime - this.minLifetime) + this.minLifetime; - //only make the particle if it wouldn't immediately destroy itself - if (-this._spawnTimer < lifetime) { - //If the position has changed and this isn't the first spawn, - //interpolate the spawn position - var emitPosX = void 0, emitPosY = void 0; - if (this._prevPosIsValid && this._posChanged) { - //1 - _spawnTimer / delta, but _spawnTimer is negative - var lerp = 1 + this._spawnTimer / delta; - emitPosX = (curX - prevX) * lerp + prevX; - emitPosY = (curY - prevY) * lerp + prevY; - } - else { - emitPosX = curX; - emitPosY = curY; - } - //create enough particles to fill the wave (non-burst types have a wave of 1) - i = 0; - for (var len = Math.min(this.particlesPerWave, this.maxParticles - this.particleCount); i < len; ++i) { - //see if we actually spawn one - if (this.spawnChance < 1 && Math.random() >= this.spawnChance) - continue; - //create particle - var p = void 0; - if (this._poolFirst) { - p = this._poolFirst; - this._poolFirst = this._poolFirst.next; - p.next = null; - } - else { - p = new this.particleConstructor(this); - } - //set a random texture if we have more than one - if (this.particleImages.length > 1) { - p.applyArt(this.particleImages[Math.floor(Math.random() * this.particleImages.length)]); - } - else { - //if they are actually the same texture, a standard particle - //will quit early from the texture setting in setTexture(). - p.applyArt(this.particleImages[0]); - } - //set up the start and end values - p.alphaList.reset(this.startAlpha); - if (this.minimumSpeedMultiplier != 1) { - p.speedMultiplier = Math.random() * (1 - this.minimumSpeedMultiplier) + this.minimumSpeedMultiplier; - } - p.speedList.reset(this.startSpeed); - p.acceleration.x = this.acceleration.x; - p.acceleration.y = this.acceleration.y; - p.maxSpeed = this.maxSpeed; - if (this.minimumScaleMultiplier != 1) { - p.scaleMultiplier = Math.random() * (1 - this.minimumScaleMultiplier) + this.minimumScaleMultiplier; - } - p.scaleList.reset(this.startScale); - p.colorList.reset(this.startColor); - //randomize the rotation speed - if (this.minRotationSpeed == this.maxRotationSpeed) - p.rotationSpeed = this.minRotationSpeed; - else - p.rotationSpeed = Math.random() * (this.maxRotationSpeed - this.minRotationSpeed) + this.minRotationSpeed; - p.noRotation = this.noRotation; - //set up the lifetime - p.maxLife = lifetime; - //set the blend mode - p.blendMode = this.particleBlendMode; - //set the custom ease, if any - p.ease = this.customEase; - //set the extra data, if any - p.extraData = this.extraData; - //call the proper function to handle rotation and position of particle - this._spawnFunc(p, emitPosX, emitPosY, i); - //initialize particle - p.init(); - //update the particle by the time passed, so the particles are spread out properly - p.update(-this._spawnTimer); //we want a positive delta, because a negative delta messes things up - //add the particle to the display list - if (!p.parent) { - if (this.addAtBack) - this._parent.addChildAt(p, 0); - else - this._parent.addChild(p); - } - else { - //kind of hacky, but performance friendly - //shuffle children to correct place - var children = this._parent.children; - //avoid using splice if possible - if (children[0] == p) - children.shift(); - else if (children[children.length - 1] == p) - children.pop(); - else { - var index = children.indexOf(p); - children.splice(index, 1); - } - if (this.addAtBack) - children.unshift(p); - else - children.push(p); - } - //add particle to list of active particles - if (this._activeParticlesLast) { - this._activeParticlesLast.next = p; - p.prev = this._activeParticlesLast; - this._activeParticlesLast = p; - } - else { - this._activeParticlesLast = this._activeParticlesFirst = p; - } - ++this.particleCount; - } - } - //increase timer and continue on to any other particles that need to be created - this._spawnTimer += this._frequency; - } - } - //if the position changed before this update, then keep track of that - if (this._posChanged) { - this._prevEmitterPos.x = curX; - this._prevEmitterPos.y = curY; - this._prevPosIsValid = true; - this._posChanged = false; - } - //if we are all done and should destroy ourselves, take care of that - if (!this._emit && !this._activeParticlesFirst) { - if (this._completeCallback) { - this._completeCallback(); - } - if (this._destroyWhenComplete) { - this.destroy(); - } - } - }; - /** - * Positions a particle for a point type emitter. - * @method PIXI.particles.Emitter#_spawnPoint - * @private - * @param {Particle} p The particle to position and rotate. - * @param {Number} emitPosX The emitter's x position - * @param {Number} emitPosY The emitter's y position - * @param {int} i The particle number in the current wave. Not used for this function. - */ - Emitter.prototype._spawnPoint = function (p, emitPosX, emitPosY) { - //set the initial rotation/direction of the particle based on - //starting particle angle and rotation of emitter - if (this.minStartRotation == this.maxStartRotation) - p.rotation = this.minStartRotation + this.rotation; - else - p.rotation = Math.random() * (this.maxStartRotation - this.minStartRotation) + this.minStartRotation + this.rotation; - //drop the particle at the emitter's position - p.position.x = emitPosX; - p.position.y = emitPosY; - }; - /** - * Positions a particle for a rectangle type emitter. - * @method PIXI.particles.Emitter#_spawnRect - * @private - * @param {Particle} p The particle to position and rotate. - * @param {Number} emitPosX The emitter's x position - * @param {Number} emitPosY The emitter's y position - * @param {int} i The particle number in the current wave. Not used for this function. - */ - Emitter.prototype._spawnRect = function (p, emitPosX, emitPosY) { - //set the initial rotation/direction of the particle based on starting - //particle angle and rotation of emitter - if (this.minStartRotation == this.maxStartRotation) - p.rotation = this.minStartRotation + this.rotation; - else - p.rotation = Math.random() * (this.maxStartRotation - this.minStartRotation) + this.minStartRotation + this.rotation; - //place the particle at a random point in the rectangle - helperPoint.x = Math.random() * this.spawnRect.width + this.spawnRect.x; - helperPoint.y = Math.random() * this.spawnRect.height + this.spawnRect.y; - if (this.rotation !== 0) - ParticleUtils_1.default.rotatePoint(this.rotation, helperPoint); - p.position.x = emitPosX + helperPoint.x; - p.position.y = emitPosY + helperPoint.y; - }; - /** - * Positions a particle for a circle type emitter. - * @method PIXI.particles.Emitter#_spawnCircle - * @private - * @param {Particle} p The particle to position and rotate. - * @param {Number} emitPosX The emitter's x position - * @param {Number} emitPosY The emitter's y position - * @param {int} i The particle number in the current wave. Not used for this function. - */ - Emitter.prototype._spawnCircle = function (p, emitPosX, emitPosY) { - //set the initial rotation/direction of the particle based on starting - //particle angle and rotation of emitter - if (this.minStartRotation == this.maxStartRotation) - p.rotation = this.minStartRotation + this.rotation; - else - p.rotation = Math.random() * (this.maxStartRotation - this.minStartRotation) + - this.minStartRotation + this.rotation; - //place the particle at a random radius in the circle - helperPoint.x = Math.random() * this.spawnCircle.radius; - helperPoint.y = 0; - //rotate the point to a random angle in the circle - ParticleUtils_1.default.rotatePoint(Math.random() * 360, helperPoint); - //offset by the circle's center - helperPoint.x += this.spawnCircle.x; - helperPoint.y += this.spawnCircle.y; - //rotate the point by the emitter's rotation - if (this.rotation !== 0) - ParticleUtils_1.default.rotatePoint(this.rotation, helperPoint); - //set the position, offset by the emitter's position - p.position.x = emitPosX + helperPoint.x; - p.position.y = emitPosY + helperPoint.y; - }; - /** - * Positions a particle for a ring type emitter. - * @method PIXI.particles.Emitter#_spawnRing - * @private - * @param {Particle} p The particle to position and rotate. - * @param {Number} emitPosX The emitter's x position - * @param {Number} emitPosY The emitter's y position - * @param {int} i The particle number in the current wave. Not used for this function. - */ - Emitter.prototype._spawnRing = function (p, emitPosX, emitPosY) { - var spawnCircle = this.spawnCircle; - //set the initial rotation/direction of the particle based on starting - //particle angle and rotation of emitter - if (this.minStartRotation == this.maxStartRotation) - p.rotation = this.minStartRotation + this.rotation; - else - p.rotation = Math.random() * (this.maxStartRotation - this.minStartRotation) + - this.minStartRotation + this.rotation; - //place the particle at a random radius in the ring - if (spawnCircle.minRadius !== spawnCircle.radius) { - helperPoint.x = Math.random() * (spawnCircle.radius - spawnCircle.minRadius) + - spawnCircle.minRadius; - } - else - helperPoint.x = spawnCircle.radius; - helperPoint.y = 0; - //rotate the point to a random angle in the circle - var angle = Math.random() * 360; - p.rotation += angle; - ParticleUtils_1.default.rotatePoint(angle, helperPoint); - //offset by the circle's center - helperPoint.x += this.spawnCircle.x; - helperPoint.y += this.spawnCircle.y; - //rotate the point by the emitter's rotation - if (this.rotation !== 0) - ParticleUtils_1.default.rotatePoint(this.rotation, helperPoint); - //set the position, offset by the emitter's position - p.position.x = emitPosX + helperPoint.x; - p.position.y = emitPosY + helperPoint.y; - }; - /** - * Positions a particle for a burst type emitter. - * @method PIXI.particles.Emitter#_spawnBurst - * @private - * @param {Particle} p The particle to position and rotate. - * @param {Number} emitPosX The emitter's x position - * @param {Number} emitPosY The emitter's y position - * @param {int} i The particle number in the current wave. - */ - Emitter.prototype._spawnBurst = function (p, emitPosX, emitPosY, i) { - //set the initial rotation/direction of the particle based on spawn - //angle and rotation of emitter - if (this.particleSpacing === 0) - p.rotation = Math.random() * 360; - else - p.rotation = this.angleStart + (this.particleSpacing * i) + this.rotation; - //drop the particle at the emitter's position - p.position.x = emitPosX; - p.position.y = emitPosY; - }; - /** - * Kills all active particles immediately. - * @method PIXI.particles.Emitter#cleanup - */ - Emitter.prototype.cleanup = function () { - var particle, next; - for (particle = this._activeParticlesFirst; particle; particle = next) { - next = particle.next; - this.recycle(particle); - if (particle.parent) - particle.parent.removeChild(particle); - } - this._activeParticlesFirst = this._activeParticlesLast = null; - this.particleCount = 0; - }; - /** - * Destroys the emitter and all of its particles. - * @method PIXI.particles.Emitter#destroy - */ - Emitter.prototype.destroy = function () { - //make sure we aren't still listening to any tickers - this.autoUpdate = false; - //puts all active particles in the pool, and removes them from the particle parent - this.cleanup(); - //wipe the pool clean - var next; - for (var particle = this._poolFirst; particle; particle = next) { - //store next value so we don't lose it in our destroy call - next = particle.next; - particle.destroy(); - } - this._poolFirst = this._parent = this.particleImages = this.spawnPos = this.ownerPos = - this.startColor = this.startScale = this.startAlpha = this.startSpeed = - this.customEase = this._completeCallback = null; - }; - return Emitter; -}()); -exports.default = Emitter; - -},{"./Particle":3,"./ParticleUtils":4,"./PropertyNode":7}],3:[function(_dereq_,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var ParticleUtils_1 = _dereq_("./ParticleUtils"); -var PropertyList_1 = _dereq_("./PropertyList"); -var Sprite = PIXI.Sprite; -/** - * An individual particle image. You shouldn't have to deal with these. - * @memberof PIXI.particles - * @class Particle - * @extends PIXI.Sprite - * @constructor - * @param {PIXI.particles.Emitter} emitter The emitter that controls this particle. - */ -var Particle = /** @class */ (function (_super) { - __extends(Particle, _super); - function Particle(emitter) { - var _this = - //start off the sprite with a blank texture, since we are going to replace it - //later when the particle is initialized. - _super.call(this) || this; - _this.emitter = emitter; - //particles should be centered - _this.anchor.x = _this.anchor.y = 0.5; - _this.velocity = new PIXI.Point(); - _this.maxLife = 0; - _this.age = 0; - _this.ease = null; - _this.extraData = null; - _this.alphaList = new PropertyList_1.default(); - _this.speedList = new PropertyList_1.default(); - _this.speedMultiplier = 1; - /** - * Acceleration to apply to the particle. - * @property {PIXI.Point} accleration - */ - _this.acceleration = new PIXI.Point(); - /** - * The maximum speed allowed for accelerating particles. Negative values, values of 0 or NaN - * will disable the maximum speed. - * @property {Number} maxSpeed - * @default NaN - */ - _this.maxSpeed = NaN; - /** - * The scale of the particle throughout its life. - * @property {PIXI.particles.PropertyList} scaleList - */ - _this.scaleList = new PropertyList_1.default(); - /** - * A multiplier from 0-1 applied to the scale of the particle at all times. - * @property {number} scaleMultiplier - */ - _this.scaleMultiplier = 1; - /** - * The tint of the particle throughout its life. - * @property {PIXI.particles.PropertyList} colorList - */ - _this.colorList = new PropertyList_1.default(true); - /** - * If alpha should be interpolated at all. - * @property {Boolean} _doAlpha - * @private - */ - _this._doAlpha = false; - /** - * If scale should be interpolated at all. - * @property {Boolean} _doScale - * @private - */ - _this._doScale = false; - /** - * If speed should be interpolated at all. - * @property {Boolean} _doSpeed - * @private - */ - _this._doSpeed = false; - /** - * If acceleration should be handled at all. _doSpeed is mutually exclusive with this, - * and _doSpeed gets priority. - * @property {Boolean} _doAcceleration - * @private - */ - _this._doAcceleration = false; - /** - * If color should be interpolated at all. - * @property {Boolean} _doColor - * @private - */ - _this._doColor = false; - /** - * If normal movement should be handled. Subclasses wishing to override movement - * can set this to false in init(). - * @property {Boolean} _doNormalMovement - * @private - */ - _this._doNormalMovement = false; - /** - * One divided by the max life of the particle, saved for slightly faster math. - * @property {Number} _oneOverLife - * @private - */ - _this._oneOverLife = 0; - /** - * Reference to the next particle in the list. - * @property {Particle} next - * @private - */ - _this.next = null; - /** - * Reference to the previous particle in the list. - * @property {Particle} prev - * @private - */ - _this.prev = null; - //save often used functions on the instance instead of the prototype for better speed - _this.init = _this.init; - _this.Particle_init = Particle.prototype.init; - _this.update = _this.update; - _this.Particle_update = Particle.prototype.update; - _this.Sprite_destroy = _super.prototype.destroy; - _this.Particle_destroy = Particle.prototype.destroy; - _this.applyArt = _this.applyArt; - _this.kill = _this.kill; - return _this; - } - /** - * Initializes the particle for use, based on the properties that have to - * have been set already on the particle. - * @method PIXI.particles.Particle#init - */ - Particle.prototype.init = function () { - //reset the age - this.age = 0; - //set up the velocity based on the start speed and rotation - this.velocity.x = this.speedList.current.value * this.speedMultiplier; - this.velocity.y = 0; - ParticleUtils_1.default.rotatePoint(this.rotation, this.velocity); - if (this.noRotation) { - this.rotation = 0; - } - else { - //convert rotation to Radians from Degrees - this.rotation *= ParticleUtils_1.default.DEG_TO_RADS; - } - //convert rotation speed to Radians from Degrees - this.rotationSpeed *= ParticleUtils_1.default.DEG_TO_RADS; - //set alpha to inital alpha - this.alpha = this.alphaList.current.value; - //set scale to initial scale - this.scale.x = this.scale.y = this.scaleList.current.value; - //figure out what we need to interpolate - this._doAlpha = !!this.alphaList.current.next; - this._doSpeed = !!this.speedList.current.next; - this._doScale = !!this.scaleList.current.next; - this._doColor = !!this.colorList.current.next; - this._doAcceleration = this.acceleration.x !== 0 || this.acceleration.y !== 0; - //_doNormalMovement can be cancelled by subclasses - this._doNormalMovement = this._doSpeed || this.speedList.current.value !== 0 || this._doAcceleration; - //save our lerp helper - this._oneOverLife = 1 / this.maxLife; - //set the inital color - var color = this.colorList.current.value; - this.tint = ParticleUtils_1.default.combineRGBComponents(color.r, color.g, color.b); - //ensure visibility - this.visible = true; - }; - /** - * Sets the texture for the particle. This can be overridden to allow - * for an animated particle. - * @method PIXI.particles.Particle#applyArt - * @param {PIXI.Texture} art The texture to set. - */ - Particle.prototype.applyArt = function (art) { - this.texture = art || PIXI.Texture.EMPTY; - }; - /** - * Updates the particle. - * @method PIXI.particles.Particle#update - * @param {Number} delta Time elapsed since the previous frame, in __seconds__. - * @return {Number} The standard interpolation multiplier (0-1) used for all relevant particle - * properties. A value of -1 means the particle died of old age instead. - */ - Particle.prototype.update = function (delta) { - //increase age - this.age += delta; - //recycle particle if it is too old - if (this.age >= this.maxLife || this.age < 0) { - this.kill(); - return -1; - } - //determine our interpolation value - var lerp = this.age * this._oneOverLife; //lifetime / maxLife; - if (this.ease) { - if (this.ease.length == 4) { - //the t, b, c, d parameters that some tween libraries use - //(time, initial value, end value, duration) - lerp = this.ease(lerp, 0, 1, 1); - } - else { - //the simplified version that we like that takes - //one parameter, time from 0-1. TweenJS eases provide this usage. - lerp = this.ease(lerp); - } - } - //interpolate alpha - if (this._doAlpha) - this.alpha = this.alphaList.interpolate(lerp); - //interpolate scale - if (this._doScale) { - var scale = this.scaleList.interpolate(lerp) * this.scaleMultiplier; - this.scale.x = this.scale.y = scale; - } - //handle movement - if (this._doNormalMovement) { - //interpolate speed - if (this._doSpeed) { - var speed = this.speedList.interpolate(lerp) * this.speedMultiplier; - ParticleUtils_1.default.normalize(this.velocity); - ParticleUtils_1.default.scaleBy(this.velocity, speed); - } - else if (this._doAcceleration) { - this.velocity.x += this.acceleration.x * delta; - this.velocity.y += this.acceleration.y * delta; - if (this.maxSpeed) { - var currentSpeed = ParticleUtils_1.default.length(this.velocity); - //if we are going faster than we should, clamp at the max speed - //DO NOT recalculate vector length - if (currentSpeed > this.maxSpeed) { - ParticleUtils_1.default.scaleBy(this.velocity, this.maxSpeed / currentSpeed); - } - } - } - //adjust position based on velocity - this.position.x += this.velocity.x * delta; - this.position.y += this.velocity.y * delta; - } - //interpolate color - if (this._doColor) { - this.tint = this.colorList.interpolate(lerp); - } - //update rotation - if (this.rotationSpeed !== 0) { - this.rotation += this.rotationSpeed * delta; - } - else if (this.acceleration && !this.noRotation) { - this.rotation = Math.atan2(this.velocity.y, this.velocity.x); // + Math.PI / 2; - } - return lerp; - }; - /** - * Kills the particle, removing it from the display list - * and telling the emitter to recycle it. - * @method PIXI.particles.Particle#kill - */ - Particle.prototype.kill = function () { - this.emitter.recycle(this); - }; - /** - * Destroys the particle, removing references and preventing future use. - * @method PIXI.particles.Particle#destroy - */ - Particle.prototype.destroy = function () { - if (this.parent) - this.parent.removeChild(this); - this.Sprite_destroy(); - this.emitter = this.velocity = this.colorList = this.scaleList = this.alphaList = - this.speedList = this.ease = this.next = this.prev = null; - }; - /** - * Checks over the art that was passed to the Emitter's init() function, to do any special - * modifications to prepare it ahead of time. - * @method PIXI.particles.Particle.parseArt - * @static - * @param {Array} art The array of art data. For Particle, it should be an array of Textures. - * Any strings in the array will be converted to Textures via - * Texture.fromImage(). - * @return {Array} The art, after any needed modifications. - */ - Particle.parseArt = function (art) { - //convert any strings to Textures. - var i; - for (i = art.length; i >= 0; --i) { - if (typeof art[i] == "string") - art[i] = PIXI.Texture.fromImage(art[i]); - } - //particles from different base textures will be slower in WebGL than if they - //were from one spritesheet - if (ParticleUtils_1.default.verbose) { - for (i = art.length - 1; i > 0; --i) { - if (art[i].baseTexture != art[i - 1].baseTexture) { - if (window.console) - console.warn("PixiParticles: using particle textures from different images may hinder performance in WebGL"); - break; - } - } - } - return art; - }; - /** - * Parses extra emitter data to ensure it is set up for this particle class. - * Particle does nothing to the extra data. - * @method PIXI.particles.Particle.parseData - * @static - * @param {Object} extraData The extra data from the particle config. - * @return {Object} The parsed extra data. - */ - Particle.parseData = function (extraData) { - return extraData; - }; - return Particle; -}(Sprite)); -exports.default = Particle; - -},{"./ParticleUtils":4,"./PropertyList":6}],4:[function(_dereq_,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var BLEND_MODES = PIXI.BLEND_MODES; -var PropertyNode_1 = _dereq_("./PropertyNode"); -/** - * Contains helper functions for particles and emitters to use. - * @memberof PIXI.particles - * @class ParticleUtils - * @static - */ -var ParticleUtils = { - /** - * If errors and warnings should be logged within the library. - * @name PIXI.particles.ParticleUtils.verbose - * @default false - * @static - */ - verbose: false, - DEG_TO_RADS: Math.PI / 180, - /** - * Rotates a point by a given angle. - * @method PIXI.particles.ParticleUtils.rotatePoint - * @param {Number} angle The angle to rotate by in degrees - * @param {PIXI.Point} p The point to rotate around 0,0. - * @static - */ - rotatePoint: function (angle, p) { - if (!angle) - return; - angle *= ParticleUtils.DEG_TO_RADS; - var s = Math.sin(angle); - var c = Math.cos(angle); - var xnew = p.x * c - p.y * s; - var ynew = p.x * s + p.y * c; - p.x = xnew; - p.y = ynew; - }, - /** - * Combines separate color components (0-255) into a single uint color. - * @method PIXI.particles.ParticleUtils.combineRGBComponents - * @param {uint} r The red value of the color - * @param {uint} g The green value of the color - * @param {uint} b The blue value of the color - * @return {uint} The color in the form of 0xRRGGBB - * @static - */ - combineRGBComponents: function (r, g, b /*, a*/) { - return /*a << 24 |*/ r << 16 | g << 8 | b; - }, - /** - * Reduces the point to a length of 1. - * @method PIXI.particles.ParticleUtils.normalize - * @static - * @param {PIXI.Point} point The point to normalize - */ - normalize: function (point) { - var oneOverLen = 1 / ParticleUtils.length(point); - point.x *= oneOverLen; - point.y *= oneOverLen; - }, - /** - * Multiplies the x and y values of this point by a value. - * @method PIXI.particles.ParticleUtils.scaleBy - * @static - * @param {PIXI.Point} point The point to scaleBy - * @param {number} value The value to scale by. - */ - scaleBy: function (point, value) { - point.x *= value; - point.y *= value; - }, - /** - * Returns the length (or magnitude) of this point. - * @method PIXI.particles.ParticleUtils.length - * @static - * @param {PIXI.Point} point The point to measure length - * @return The length of this point. - */ - length: function (point) { - return Math.sqrt(point.x * point.x + point.y * point.y); - }, - /** - * Converts a hex string from "#AARRGGBB", "#RRGGBB", "0xAARRGGBB", "0xRRGGBB", - * "AARRGGBB", or "RRGGBB" to an object of ints of 0-255, as - * {r, g, b, (a)}. - * @method PIXI.particles.ParticleUtils.hexToRGB - * @param {string} color The input color string. - * @param {Object} [output] An object to put the output in. If omitted, a new object is created. - * @return The object with r, g, and b properties, possibly with an a property. - * @static - */ - hexToRGB: function (color, output) { - if (!output) - output = {}; - if (color.charAt(0) == "#") - color = color.substr(1); - else if (color.indexOf("0x") === 0) - color = color.substr(2); - var alpha; - if (color.length == 8) { - alpha = color.substr(0, 2); - color = color.substr(2); - } - output.r = parseInt(color.substr(0, 2), 16); //Red - output.g = parseInt(color.substr(2, 2), 16); //Green - output.b = parseInt(color.substr(4, 2), 16); //Blue - if (alpha) - output.a = parseInt(alpha, 16); - return output; - }, - /** - * Generates a custom ease function, based on the GreenSock custom ease, as demonstrated - * by the related tool at http://www.greensock.com/customease/. - * @method PIXI.particles.ParticleUtils.generateEase - * @param {Array} segments An array of segments, as created by - * http://www.greensock.com/customease/. - * @return {Function} A function that calculates the percentage of change at - * a given point in time (0-1 inclusive). - * @static - */ - generateEase: function (segments) { - var qty = segments.length; - var oneOverQty = 1 / qty; - /* - * Calculates the percentage of change at a given point in time (0-1 inclusive). - * @param {Number} time The time of the ease, 0-1 inclusive. - * @return {Number} The percentage of the change, 0-1 inclusive (unless your - * ease goes outside those bounds). - */ - return function (time) { - var t, s; - var i = (qty * time) | 0; //do a quick floor operation - t = (time - (i * oneOverQty)) * qty; - s = segments[i] || segments[qty - 1]; - return (s.s + t * (2 * (1 - t) * (s.cp - s.s) + t * (s.e - s.s))); - }; - }, - /** - * Gets a blend mode, ensuring that it is valid. - * @method PIXI.particles.ParticleUtils.getBlendMode - * @param {string} name The name of the blend mode to get. - * @return {int} The blend mode as specified in the PIXI.BLEND_MODES enumeration. - * @static - */ - getBlendMode: function (name) { - if (!name) - return BLEND_MODES.NORMAL; - name = name.toUpperCase(); - while (name.indexOf(" ") >= 0) - name = name.replace(" ", "_"); - return BLEND_MODES[name] || BLEND_MODES.NORMAL; - }, - /** - * Converts a list of {value, time} objects starting at time 0 and ending at time 1 into an evenly - * spaced stepped list of PropertyNodes for color values. This is primarily to handle conversion of - * linear gradients to fewer colors, allowing for some optimization for Canvas2d fallbacks. - * @method PIXI.particles.ParticleUtils.createSteppedGradient - * @param {Array} list The list of data to convert. - * @param {number} [numSteps=10] The number of steps to use. - * @return {PIXI.particles.PropertyNode} The blend mode as specified in the PIXI.blendModes enumeration. - * @static - */ - createSteppedGradient: function (list, numSteps) { - if (numSteps === void 0) { numSteps = 10; } - if (typeof numSteps !== 'number' || numSteps <= 0) - numSteps = 10; - var first = new PropertyNode_1.default(list[0].value, list[0].time); - first.isStepped = true; - var currentNode = first; - var current = list[0]; - var nextIndex = 1; - var next = list[nextIndex]; - for (var i = 1; i < numSteps; ++i) { - var lerp = i / numSteps; - //ensure we are on the right segment, if multiple - while (lerp > next.time) { - current = next; - next = list[++nextIndex]; - } - //convert the lerp value to the segment range - lerp = (lerp - current.time) / (next.time - current.time); - var curVal = ParticleUtils.hexToRGB(current.value); - var nextVal = ParticleUtils.hexToRGB(next.value); - var output = {}; - output.r = (nextVal.r - curVal.r) * lerp + curVal.r; - output.g = (nextVal.g - curVal.g) * lerp + curVal.g; - output.b = (nextVal.b - curVal.b) * lerp + curVal.b; - currentNode.next = new PropertyNode_1.default(output, i / numSteps); - currentNode = currentNode.next; - } - //we don't need to have a PropertyNode for time of 1, because in a stepped version at that point - //the particle has died of old age - return first; - } -}; -exports.default = ParticleUtils; - -},{"./PropertyNode":7}],5:[function(_dereq_,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var ParticleUtils_1 = _dereq_("./ParticleUtils"); -var Particle_1 = _dereq_("./Particle"); -/** - * A helper point for math things. - * @private - */ -var helperPoint = new PIXI.Point(); -//a hand picked list of Math functions (and a couple properties) that are allowable. -//they should be used without the preceding "Math." -var MATH_FUNCS = [ - "pow", - "sqrt", - "abs", - "floor", - "round", - "ceil", - "E", - "PI", - "sin", - "cos", - "tan", - "asin", - "acos", - "atan", - "atan2", - "log" -]; -//create an actual regular expression object from the string -var WHITELISTER = new RegExp([ - //Allow the 4 basic operations, parentheses and all numbers/decimals, as well - //as 'x', for the variable usage. - "[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]", -].concat(MATH_FUNCS).join("|"), "g"); -/** - * Parses a string into a function for path following. - * This involves whitelisting the string for safety, inserting "Math." to math function - * names, and using `new Function()` to generate a function. - * @method PIXI.particles.PathParticle~parsePath - * @private - * @static - * @param {String} pathString The string to parse. - * @return {Function} The path function - takes x, outputs y. - */ -var parsePath = function (pathString) { - var matches = pathString.match(WHITELISTER); - for (var i = matches.length - 1; i >= 0; --i) { - if (MATH_FUNCS.indexOf(matches[i]) >= 0) - matches[i] = "Math." + matches[i]; - } - pathString = matches.join(""); - return new Function("x", "return " + pathString + ";"); -}; -/** - * An particle that follows a path defined by an algebraic expression, e.g. "sin(x)" or - * "5x + 3". - * To use this class, the particle config must have a "path" string in the - * "extraData" parameter. This string should have "x" in it to represent movement (from the - * speed settings of the particle). It may have numbers, parentheses, the four basic - * operations, and the following Math functions or properties (without the preceding "Math."): - * "pow", "sqrt", "abs", "floor", "round", "ceil", "E", "PI", "sin", "cos", "tan", "asin", - * "acos", "atan", "atan2", "log". - * The overall movement of the particle and the expression value become x and y positions for - * the particle, respectively. The final position is rotated by the spawn rotation/angle of - * the particle. - * - * Some example paths: - * - * "sin(x/10) * 20" // A sine wave path. - * "cos(x/100) * 30" // Particles curve counterclockwise (for medium speed/low lifetime particles) - * "pow(x/10, 2) / 2" // Particles curve clockwise (remember, +y is down). - * - * @memberof PIXI.particles - * @class PathParticle - * @extends PIXI.particles.Particle - * @constructor - * @param {PIXI.particles.Emitter} emitter The emitter that controls this PathParticle. - */ -var PathParticle = /** @class */ (function (_super) { - __extends(PathParticle, _super); - function PathParticle(emitter) { - var _this = _super.call(this, emitter) || this; - _this.path = null; - _this.initialRotation = 0; - _this.initialPosition = new PIXI.Point(); - _this.movement = 0; - return _this; - } - /** - * Initializes the particle for use, based on the properties that have to - * have been set already on the particle. - * @method PIXI.particles.PathParticle#init - */ - PathParticle.prototype.init = function () { - //get initial rotation before it is converted to radians - this.initialRotation = this.rotation; - //standard init - this.Particle_init(); - //set the path for the particle - this.path = this.extraData.path; - //cancel the normal movement behavior - this._doNormalMovement = !this.path; - //reset movement - this.movement = 0; - //grab position - this.initialPosition.x = this.position.x; - this.initialPosition.y = this.position.y; - }; - /** - * Updates the particle. - * @method PIXI.particles.PathParticle#update - * @param {Number} delta Time elapsed since the previous frame, in __seconds__. - */ - PathParticle.prototype.update = function (delta) { - var lerp = this.Particle_update(delta); - //if the particle died during the update, then don't bother - if (lerp >= 0 && this.path) { - //increase linear movement based on speed - var speed = this.speedList.interpolate(lerp) * this.speedMultiplier; - this.movement += speed * delta; - //set up the helper point for rotation - helperPoint.x = this.movement; - helperPoint.y = this.path(this.movement); - ParticleUtils_1.default.rotatePoint(this.initialRotation, helperPoint); - this.position.x = this.initialPosition.x + helperPoint.x; - this.position.y = this.initialPosition.y + helperPoint.y; - } - return lerp; - }; - /** - * Destroys the particle, removing references and preventing future use. - * @method PIXI.particles.PathParticle#destroy - */ - PathParticle.prototype.destroy = function () { - this.Particle_destroy(); - this.path = this.initialPosition = null; - }; - /** - * Checks over the art that was passed to the Emitter's init() function, to do any special - * modifications to prepare it ahead of time. This just runs Particle.parseArt(). - * @method PIXI.particles.PathParticle.parseArt - * @static - * @param {Array} art The array of art data. For Particle, it should be an array of Textures. - * Any strings in the array will be converted to Textures via - * Texture.fromImage(). - * @return {Array} The art, after any needed modifications. - */ - PathParticle.parseArt = function (art) { - return Particle_1.default.parseArt(art); - }; - /** - * Parses extra emitter data to ensure it is set up for this particle class. - * PathParticle checks for the existence of path data, and parses the path data for use - * by particle instances. - * @method PIXI.particles.PathParticle.parseData - * @static - * @param {Object} extraData The extra data from the particle config. - * @return {Object} The parsed extra data. - */ - PathParticle.parseData = function (extraData) { - var output = {}; - if (extraData && extraData.path) { - try { - output.path = parsePath(extraData.path); - } - catch (e) { - if (ParticleUtils_1.default.verbose) - console.error("PathParticle: error in parsing path expression"); - output.path = null; - } - } - else { - if (ParticleUtils_1.default.verbose) - console.error("PathParticle requires a path string in extraData!"); - output.path = null; - } - return output; - }; - return PathParticle; -}(Particle_1.default)); -exports.default = PathParticle; - -},{"./Particle":3,"./ParticleUtils":4}],6:[function(_dereq_,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var ParticleUtils_1 = _dereq_("./ParticleUtils"); -/** - * Singly linked list container for keeping track of interpolated properties for particles. - * Each Particle will have one of these for each interpolated property. - * @memberof PIXI.particles - * @class PropertyList - * @constructor - * @param {boolean} isColor If this list handles color values - */ -var PropertyList = /** @class */ (function () { - function PropertyList(isColor) { - if (isColor === void 0) { isColor = false; } - this.current = null; - this.next = null; - this.isColor = !!isColor; - this.interpolate = null; - this.ease = null; - } - /** - * Resets the list for use. - * @method interpolate - * @param {PIXI.particles.PropertyNode} first The first node in the list. - * @param {boolean} [isStepped=false] If the values should be stepped instead of interpolated linearly. - */ - PropertyList.prototype.reset = function (first) { - this.current = first; - this.next = first.next; - var isSimple = this.next && this.next.time >= 1; - if (isSimple) { - this.interpolate = this.isColor ? intColorSimple : intValueSimple; - } - else if (first.isStepped) { - this.interpolate = this.isColor ? intColorStepped : intValueStepped; - } - else { - this.interpolate = this.isColor ? intColorComplex : intValueComplex; - } - this.ease = this.current.ease; - }; - return PropertyList; -}()); -exports.default = PropertyList; -function intValueSimple(lerp) { - if (this.ease) - lerp = this.ease(lerp); - return (this.next.value - this.current.value) * lerp + this.current.value; -} -function intColorSimple(lerp) { - if (this.ease) - lerp = this.ease(lerp); - var curVal = this.current.value, nextVal = this.next.value; - var r = (nextVal.r - curVal.r) * lerp + curVal.r; - var g = (nextVal.g - curVal.g) * lerp + curVal.g; - var b = (nextVal.b - curVal.b) * lerp + curVal.b; - return ParticleUtils_1.default.combineRGBComponents(r, g, b); -} -function intValueComplex(lerp) { - if (this.ease) - lerp = this.ease(lerp); - //make sure we are on the right segment - while (lerp > this.next.time) { - this.current = this.next; - this.next = this.next.next; - } - //convert the lerp value to the segment range - lerp = (lerp - this.current.time) / (this.next.time - this.current.time); - return (this.next.value - this.current.value) * lerp + this.current.value; -} -function intColorComplex(lerp) { - if (this.ease) - lerp = this.ease(lerp); - //make sure we are on the right segment - while (lerp > this.next.time) { - this.current = this.next; - this.next = this.next.next; - } - //convert the lerp value to the segment range - lerp = (lerp - this.current.time) / (this.next.time - this.current.time); - var curVal = this.current.value, nextVal = this.next.value; - var r = (nextVal.r - curVal.r) * lerp + curVal.r; - var g = (nextVal.g - curVal.g) * lerp + curVal.g; - var b = (nextVal.b - curVal.b) * lerp + curVal.b; - return ParticleUtils_1.default.combineRGBComponents(r, g, b); -} -function intValueStepped(lerp) { - if (this.ease) - lerp = this.ease(lerp); - //make sure we are on the right segment - while (this.next && lerp > this.next.time) { - this.current = this.next; - this.next = this.next.next; - } - return this.current.value; -} -function intColorStepped(lerp) { - if (this.ease) - lerp = this.ease(lerp); - //make sure we are on the right segment - while (this.next && lerp > this.next.time) { - this.current = this.next; - this.next = this.next.next; - } - var curVal = this.current.value; - return ParticleUtils_1.default.combineRGBComponents(curVal.r, curVal.g, curVal.b); -} - -},{"./ParticleUtils":4}],7:[function(_dereq_,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var ParticleUtils_1 = _dereq_("./ParticleUtils"); -/** - * A single node in a PropertyList. - * @memberof PIXI.particles - * @class PropertyNode - * @constructor - * @param {number|string} value The value for this node - * @param {number} time The time for this node, between 0-1 - * @param {Function|Array} [ease] Custom ease for this list. Only relevant for the first node. - */ -var PropertyNode = /** @class */ (function () { - function PropertyNode(value, time, ease) { - this.value = typeof value == "string" ? ParticleUtils_1.default.hexToRGB(value) : value; - this.time = time; - this.next = null; - this.isStepped = false; - if (ease) { - this.ease = typeof ease == "function" ? ease : ParticleUtils_1.default.generateEase(ease); - } - else { - this.ease = null; - } - } - /** - * Creates a list of property values from a data object {list, isStepped} with a list of objects in - * the form {value, time}. Alternatively, the data object can be in the deprecated form of - * {start, end}. - * @method PIXI.particles.PropertyNode.createListFromArray - * @static - * @param {Object} data The data for the list. - * @param {Array} data.list The array of value and time objects. - * @param {boolean} [data.isStepped] If the list is stepped rather than interpolated. - * @param {Function|Array} [data.ease] Custom ease for this list. - * @return {PIXI.particles.PropertyNode} The first node in the list - */ - PropertyNode.createList = function (data) { - if (Array.isArray(data.list)) { - var array = data.list; - var node = void 0, first = void 0; - first = node = new PropertyNode(array[0].value, array[0].time, data.ease); - //only set up subsequent nodes if there are a bunch or the 2nd one is different from the first - if (array.length > 2 || (array.length === 2 && array[1].value !== array[0].value)) { - for (var i = 1; i < array.length; ++i) { - node.next = new PropertyNode(array[i].value, array[i].time); - node = node.next; - } - } - first.isStepped = !!data.isStepped; - return first; - } - else { - //Handle deprecated version here - var start = new PropertyNode(data.start, 0); - //only set up a next value if it is different from the starting value - if (data.end !== data.start) - start.next = new PropertyNode(data.end, 1); - return start; - } - }; - return PropertyNode; -}()); -exports.default = PropertyNode; - -},{"./ParticleUtils":4}],8:[function(_dereq_,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var ParticleUtils_js_1 = _dereq_("./ParticleUtils.js"); -exports.ParticleUtils = ParticleUtils_js_1.default; -var Particle_js_1 = _dereq_("./Particle.js"); -exports.Particle = Particle_js_1.default; -var Emitter_js_1 = _dereq_("./Emitter.js"); -exports.Emitter = Emitter_js_1.default; -var PathParticle_js_1 = _dereq_("./PathParticle.js"); -exports.PathParticle = PathParticle_js_1.default; -var AnimatedParticle_js_1 = _dereq_("./AnimatedParticle.js"); -exports.AnimatedParticle = AnimatedParticle_js_1.default; - -},{"./AnimatedParticle.js":1,"./Emitter.js":2,"./Particle.js":3,"./ParticleUtils.js":4,"./PathParticle.js":5}],9:[function(_dereq_,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// If we're in the browser make sure PIXI is available -if (typeof PIXI === 'undefined') { - throw "pixi-particles requires pixi.js to be loaded first"; -} -//ensure that the particles namespace exist - PIXI 4 creates it itself, PIXI 3 does not -if (!PIXI.particles) { - PIXI.particles = {}; -} -// get the library itself -var particles = _dereq_("./particles"); -// insert the library into the particles namespace on PIXI -for (var prop in particles) { - PIXI.particles[prop] = particles[prop]; -} -if (typeof module !== "undefined" && module.exports) { - module.exports = particles; -} - -},{"./particles":8}]},{},[9])(9) -}); - +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pixiParticles = f()}})(function(){var define,module,exports;return (function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 0) { + this.elapsed += delta; + if (this.elapsed > this.duration) { + //loop elapsed back around + if (this.loop) + this.elapsed = this.elapsed % this.duration; + else + this.elapsed = this.duration - 0.000001; + } + var frame = (this.elapsed * this.framerate + 0.0000001) | 0; + this.texture = this.textures[frame] || PIXI.Texture.EMPTY; + } + return lerp; + }; + /** + * Destroys the particle, removing references and preventing future use. + * @method PIXI.particles.AnimatedParticle#destroy + */ + AnimatedParticle.prototype.destroy = function () { + this.Particle_destroy(); + this.textures = null; + }; + /** + * Checks over the art that was passed to the Emitter's init() function, to do any special + * modifications to prepare it ahead of time. + * @method PIXI.particles.AnimatedParticle.parseArt + * @static + * @param {Array} art The array of art data, properly formatted for AnimatedParticle. + * @return {Array} The art, after any needed modifications. + */ + AnimatedParticle.parseArt = function (art) { + var data, output, textures, tex, outTextures; + var outArr = []; + for (var i = 0; i < art.length; ++i) { + data = art[i]; + outArr[i] = output = {}; + output.textures = outTextures = []; + textures = data.textures; + for (var j = 0; j < textures.length; ++j) { + tex = textures[j]; + if (typeof tex == "string") + outTextures.push(Texture.fromImage(tex)); + else if (tex instanceof Texture) + outTextures.push(tex); + else { + var dupe = tex.count || 1; + if (typeof tex.texture == "string") + tex = Texture.fromImage(tex.texture); + else + tex = tex.texture; + for (; dupe > 0; --dupe) { + outTextures.push(tex); + } + } + } + //use these values to signify that the animation should match the particle life time. + if (data.framerate == "matchLife") { + //-1 means that it should be calculated + output.framerate = -1; + output.duration = 0; + output.loop = false; + } + else { + //determine if the animation should loop + output.loop = !!data.loop; + //get the framerate, default to 60 + output.framerate = data.framerate > 0 ? data.framerate : 60; + //determine the duration + output.duration = outTextures.length / output.framerate; + } + } + return outArr; + }; + return AnimatedParticle; +}(Particle_1.default)); +exports.default = AnimatedParticle; + +},{"./Particle":3}],2:[function(_dereq_,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var ParticleUtils_1 = _dereq_("./ParticleUtils"); +var Particle_1 = _dereq_("./Particle"); +var PropertyNode_1 = _dereq_("./PropertyNode"); +var ticker = PIXI.ticker.shared; +var helperPoint = new PIXI.Point(); +/** + * A particle emitter. + * @memberof PIXI.particles + * @class Emitter + * @constructor + * @param {PIXI.Container} particleParent The container to add the + * particles to. + * @param {Array|PIXI.Texture|String} [particleImages] A texture or array of textures to use + * for the particles. Strings will be turned + * into textures via Texture.fromImage(). + * @param {Object} [config] A configuration object containing settings for the emitter. + * @param {Boolean} [config.emit=true] If config.emit is explicitly passed as false, the Emitter + * will start disabled. + * @param {Boolean} [config.autoUpdate=false] If config.emit is explicitly passed as true, the Emitter + * will automatically call update via the PIXI shared ticker. + */ +var Emitter = /** @class */ (function () { + function Emitter(particleParent, particleImages, config) { + this._particleConstructor = Particle_1.default; + //properties for individual particles + this.particleImages = null; + this.startAlpha = null; + this.startSpeed = null; + this.minimumSpeedMultiplier = 1; + this.acceleration = null; + this.maxSpeed = NaN; + this.startScale = null; + this.minimumScaleMultiplier = 1; + this.startColor = null; + this.minLifetime = 0; + this.maxLifetime = 0; + this.minStartRotation = 0; + this.maxStartRotation = 0; + this.noRotation = false; + this.minRotationSpeed = 0; + this.maxRotationSpeed = 0; + this.particleBlendMode = 0; + this.customEase = null; + this.extraData = null; + //properties for spawning particles + this._frequency = 1; + this.spawnChance = 1; + this.maxParticles = 1000; + this.emitterLifetime = -1; + this.spawnPos = null; + this.spawnType = null; + this._spawnFunc = null; + this.spawnRect = null; + this.spawnCircle = null; + this.particlesPerWave = 1; + this.particleSpacing = 0; + this.angleStart = 0; + //emitter properties + this.rotation = 0; + this.ownerPos = null; + this._prevEmitterPos = null; + this._prevPosIsValid = false; + this._posChanged = false; + this._parent = null; + this.addAtBack = false; + this.particleCount = 0; + this._emit = false; + this._spawnTimer = 0; + this._emitterLife = -1; + this._activeParticlesFirst = null; + this._activeParticlesLast = null; + this._poolFirst = null; + this._origConfig = null; + this._origArt = null; + this._autoUpdate = false; + this._destroyWhenComplete = false; + this._completeCallback = null; + //set the initial parent + this.parent = particleParent; + if (particleImages && config) + this.init(particleImages, config); + //save often used functions on the instance instead of the prototype for better speed + this.recycle = this.recycle; + this.update = this.update; + this.rotate = this.rotate; + this.updateSpawnPos = this.updateSpawnPos; + this.updateOwnerPos = this.updateOwnerPos; + } + Object.defineProperty(Emitter.prototype, "frequency", { + /** + * Time between particle spawns in seconds. If this value is not a number greater than 0, + * it will be set to 1 (particle per second) to prevent infinite loops. + * @member {Number} PIXI.particles.Emitter#frequency + */ + get: function () { return this._frequency; }, + set: function (value) { + //do some error checking to prevent infinite loops + if (typeof value == "number" && value > 0) + this._frequency = value; + else + this._frequency = 1; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Emitter.prototype, "particleConstructor", { + /** + * The constructor used to create new particles. The default is + * the built in Particle class. Setting this will dump any active or + * pooled particles, if the emitter has already been used. + * @member {Function} PIXI.particles.Emitter#particleConstructor + */ + get: function () { return this._particleConstructor; }, + set: function (value) { + if (value != this._particleConstructor) { + this._particleConstructor = value; + //clean up existing particles + this.cleanup(); + //scrap all the particles + for (var particle = this._poolFirst; particle; particle = particle.next) { + particle.destroy(); + } + this._poolFirst = null; + //re-initialize the emitter so that the new constructor can do anything it needs to + if (this._origConfig && this._origArt) + this.init(this._origArt, this._origConfig); + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Emitter.prototype, "parent", { + /** + * The container to add particles to. Settings this will dump any active particles. + * @member {PIXI.Container} PIXI.particles.Emitter#parent + */ + get: function () { return this._parent; }, + set: function (value) { + this.cleanup(); + this._parent = value; + }, + enumerable: true, + configurable: true + }); + /** + * Sets up the emitter based on the config settings. + * @method PIXI.particles.Emitter#init + * @param {Array|PIXI.Texture} art A texture or array of textures to use for the particles. + * @param {Object} config A configuration object containing settings for the emitter. + */ + Emitter.prototype.init = function (art, config) { + if (!art || !config) + return; + //clean up any existing particles + this.cleanup(); + //store the original config and particle images, in case we need to re-initialize + //when the particle constructor is changed + this._origConfig = config; + this._origArt = art; + //set up the array of data, also ensuring that it is an array + art = Array.isArray(art) ? art.slice() : [art]; + //run the art through the particle class's parsing function + var partClass = this._particleConstructor; + this.particleImages = partClass.parseArt ? partClass.parseArt(art) : art; + /////////////////////////// + // Particle Properties // + /////////////////////////// + //set up the alpha + if (config.alpha) { + this.startAlpha = PropertyNode_1.default.createList(config.alpha); + } + else + this.startAlpha = new PropertyNode_1.default(1, 0); + //set up the speed + if (config.speed) { + this.startSpeed = PropertyNode_1.default.createList(config.speed); + this.minimumSpeedMultiplier = config.speed.minimumSpeedMultiplier || 1; + } + else { + this.minimumSpeedMultiplier = 1; + this.startSpeed = new PropertyNode_1.default(0, 0); + } + //set up acceleration + var acceleration = config.acceleration; + if (acceleration && (acceleration.x || acceleration.y)) { + //make sure we disable speed interpolation + this.startSpeed.next = null; + this.acceleration = new PIXI.Point(acceleration.x, acceleration.y); + this.maxSpeed = config.maxSpeed || NaN; + } + else + this.acceleration = new PIXI.Point(); + //set up the scale + if (config.scale) { + this.startScale = PropertyNode_1.default.createList(config.scale); + this.minimumScaleMultiplier = config.scale.minimumScaleMultiplier || 1; + } + else { + this.startScale = new PropertyNode_1.default(1, 0); + this.minimumScaleMultiplier = 1; + } + //set up the color + if (config.color) { + this.startColor = PropertyNode_1.default.createList(config.color); + } + else { + this.startColor = new PropertyNode_1.default({ r: 0xFF, g: 0xFF, b: 0xFF }, 0); + } + //set up the start rotation + if (config.startRotation) { + this.minStartRotation = config.startRotation.min; + this.maxStartRotation = config.startRotation.max; + } + else + this.minStartRotation = this.maxStartRotation = 0; + if (config.noRotation && + (this.minStartRotation || this.maxStartRotation)) { + this.noRotation = !!config.noRotation; + } + else + this.noRotation = false; + //set up the rotation speed + if (config.rotationSpeed) { + this.minRotationSpeed = config.rotationSpeed.min; + this.maxRotationSpeed = config.rotationSpeed.max; + } + else + this.minRotationSpeed = this.maxRotationSpeed = 0; + //set up the lifetime + this.minLifetime = config.lifetime.min; + this.maxLifetime = config.lifetime.max; + //get the blend mode + this.particleBlendMode = ParticleUtils_1.default.getBlendMode(config.blendMode); + //use the custom ease if provided + if (config.ease) { + this.customEase = typeof config.ease == "function" ? + config.ease : + ParticleUtils_1.default.generateEase(config.ease); + } + else + this.customEase = null; + //set up the extra data, running it through the particle class's parseData function. + if (partClass.parseData) + this.extraData = partClass.parseData(config.extraData); + else + this.extraData = config.extraData || null; + ////////////////////////// + // Emitter Properties // + ////////////////////////// + //reset spawn type specific settings + this.spawnRect = this.spawnCircle = null; + this.particlesPerWave = 1; + if (config.particlesPerWave && config.particlesPerWave > 1) + this.particlesPerWave = config.particlesPerWave; + this.particleSpacing = 0; + this.angleStart = 0; + var spawnCircle; + //determine the spawn function to use + switch (config.spawnType) { + case "rect": + this.spawnType = "rect"; + this._spawnFunc = this._spawnRect; + var spawnRect = config.spawnRect; + this.spawnRect = new PIXI.Rectangle(spawnRect.x, spawnRect.y, spawnRect.w, spawnRect.h); + break; + case "circle": + this.spawnType = "circle"; + this._spawnFunc = this._spawnCircle; + spawnCircle = config.spawnCircle; + this.spawnCircle = new PIXI.Circle(spawnCircle.x, spawnCircle.y, spawnCircle.r); + break; + case "ring": + this.spawnType = "ring"; + this._spawnFunc = this._spawnRing; + spawnCircle = config.spawnCircle; + this.spawnCircle = new PIXI.Circle(spawnCircle.x, spawnCircle.y, spawnCircle.r); + this.spawnCircle.minRadius = spawnCircle.minR; + break; + case "burst": + this.spawnType = "burst"; + this._spawnFunc = this._spawnBurst; + this.particleSpacing = config.particleSpacing; + this.angleStart = config.angleStart ? config.angleStart : 0; + break; + case "point": + this.spawnType = "point"; + this._spawnFunc = this._spawnPoint; + break; + default: + this.spawnType = "point"; + this._spawnFunc = this._spawnPoint; + break; + } + //set the spawning frequency + this.frequency = config.frequency; + this.spawnChance = (typeof config.spawnChance === 'number' && config.spawnChance > 0) ? config.spawnChance : 1; + //set the emitter lifetime + this.emitterLifetime = config.emitterLifetime || -1; + //set the max particles + this.maxParticles = config.maxParticles > 0 ? config.maxParticles : 1000; + //determine if we should add the particle at the back of the list or not + this.addAtBack = !!config.addAtBack; + //reset the emitter position and rotation variables + this.rotation = 0; + this.ownerPos = new PIXI.Point(); + this.spawnPos = new PIXI.Point(config.pos.x, config.pos.y); + this._prevEmitterPos = this.spawnPos.clone(); + //previous emitter position is invalid and should not be used for interpolation + this._prevPosIsValid = false; + //start emitting + this._spawnTimer = 0; + this.emit = config.emit === undefined ? true : !!config.emit; + this.autoUpdate = config.autoUpdate === undefined ? false : !!config.autoUpdate; + }; + /** + * Recycles an individual particle. + * @method PIXI.particles.Emitter#recycle + * @param {Particle} particle The particle to recycle. + * @private + */ + Emitter.prototype.recycle = function (particle) { + if (particle.next) + particle.next.prev = particle.prev; + if (particle.prev) + particle.prev.next = particle.next; + if (particle == this._activeParticlesLast) + this._activeParticlesLast = particle.prev; + if (particle == this._activeParticlesFirst) + this._activeParticlesFirst = particle.next; + //add to pool + particle.prev = null; + particle.next = this._poolFirst; + this._poolFirst = particle; + //remove child from display, or make it invisible if it is in a ParticleContainer + if (particle.parent) + particle.parent.removeChild(particle); + //decrease count + --this.particleCount; + }; + /** + * Sets the rotation of the emitter to a new value. + * @method PIXI.particles.Emitter#rotate + * @param {Number} newRot The new rotation, in degrees. + */ + Emitter.prototype.rotate = function (newRot) { + if (this.rotation == newRot) + return; + //caclulate the difference in rotation for rotating spawnPos + var diff = newRot - this.rotation; + this.rotation = newRot; + //rotate spawnPos + ParticleUtils_1.default.rotatePoint(diff, this.spawnPos); + //mark the position as having changed + this._posChanged = true; + }; + /** + * Changes the spawn position of the emitter. + * @method PIXI.particles.Emitter#updateSpawnPos + * @param {Number} x The new x value of the spawn position for the emitter. + * @param {Number} y The new y value of the spawn position for the emitter. + */ + Emitter.prototype.updateSpawnPos = function (x, y) { + this._posChanged = true; + this.spawnPos.x = x; + this.spawnPos.y = y; + }; + /** + * Changes the position of the emitter's owner. You should call this if you are adding + * particles to the world container that your emitter's owner is moving around in. + * @method PIXI.particles.Emitter#updateOwnerPos + * @param {Number} x The new x value of the emitter's owner. + * @param {Number} y The new y value of the emitter's owner. + */ + Emitter.prototype.updateOwnerPos = function (x, y) { + this._posChanged = true; + this.ownerPos.x = x; + this.ownerPos.y = y; + }; + /** + * Prevents emitter position interpolation in the next update. + * This should be used if you made a major position change of your emitter's owner + * that was not normal movement. + * @method PIXI.particles.Emitter#resetPositionTracking + */ + Emitter.prototype.resetPositionTracking = function () { + this._prevPosIsValid = false; + }; + Object.defineProperty(Emitter.prototype, "emit", { + /** + * If particles should be emitted during update() calls. Setting this to false + * stops new particles from being created, but allows existing ones to die out. + * @member {Boolean} PIXI.particles.Emitter#emit + */ + get: function () { return this._emit; }, + set: function (value) { + this._emit = !!value; + this._emitterLife = this.emitterLifetime; + }, + enumerable: true, + configurable: true + }); + ; + Object.defineProperty(Emitter.prototype, "autoUpdate", { + /** + * If the update function is called automatically from the shared ticker. + * Setting this to false requires calling the update function manually. + * @member {Boolean} PIXI.particles.Emitter#autoUpdate + */ + get: function () { return this._autoUpdate; }, + set: function (value) { + if (this._autoUpdate && !value) { + ticker.remove(this.update, this); + } + else if (!this._autoUpdate && value) { + ticker.add(this.update, this); + } + this._autoUpdate = !!value; + }, + enumerable: true, + configurable: true + }); + /** + * Starts emitting particles, sets autoUpdate to true, and sets up the Emitter to destroy itself + * when particle emission is complete. + * @method PIXI.particles.Emitter#playOnceAndDestroy + * @param {Function} [callback] Callback for when emission is complete (all particles have died off) + */ + Emitter.prototype.playOnceAndDestroy = function (callback) { + this.autoUpdate = true; + this.emit = true; + this._destroyWhenComplete = true; + this._completeCallback = callback; + }; + /** + * Starts emitting particles and optionally calls a callback when particle emission is complete. + * @method PIXI.particles.Emitter#playOnce + * @param {Function} [callback] Callback for when emission is complete (all particles have died off) + */ + Emitter.prototype.playOnce = function (callback) { + this.emit = true; + this._completeCallback = callback; + }; + /** + * Updates all particles spawned by this emitter and emits new ones. + * @method PIXI.particles.Emitter#update + * @param {Number} delta Time elapsed since the previous frame, in __seconds__. + */ + Emitter.prototype.update = function (delta) { + if (this._autoUpdate) { + delta = delta / PIXI.settings.TARGET_FPMS / 1000; + } + //if we don't have a parent to add particles to, then don't do anything. + //this also works as a isDestroyed check + if (!this._parent) + return; + //update existing particles + var i, particle, next; + for (particle = this._activeParticlesFirst; particle; particle = next) { + next = particle.next; + particle.update(delta); + } + var prevX, prevY; + //if the previous position is valid, store these for later interpolation + if (this._prevPosIsValid) { + prevX = this._prevEmitterPos.x; + prevY = this._prevEmitterPos.y; + } + //store current position of the emitter as local variables + var curX = this.ownerPos.x + this.spawnPos.x; + var curY = this.ownerPos.y + this.spawnPos.y; + //spawn new particles + if (this._emit) { + //decrease spawn timer + this._spawnTimer -= delta < 0 ? 0 : delta; + //while _spawnTimer < 0, we have particles to spawn + while (this._spawnTimer <= 0) { + //determine if the emitter should stop spawning + if (this._emitterLife > 0) { + this._emitterLife -= this._frequency; + if (this._emitterLife <= 0) { + this._spawnTimer = 0; + this._emitterLife = 0; + this.emit = false; + break; + } + } + //determine if we have hit the particle limit + if (this.particleCount >= this.maxParticles) { + this._spawnTimer += this._frequency; + continue; + } + //determine the particle lifetime + var lifetime = void 0; + if (this.minLifetime == this.maxLifetime) + lifetime = this.minLifetime; + else + lifetime = Math.random() * (this.maxLifetime - this.minLifetime) + this.minLifetime; + //only make the particle if it wouldn't immediately destroy itself + if (-this._spawnTimer < lifetime) { + //If the position has changed and this isn't the first spawn, + //interpolate the spawn position + var emitPosX = void 0, emitPosY = void 0; + if (this._prevPosIsValid && this._posChanged) { + //1 - _spawnTimer / delta, but _spawnTimer is negative + var lerp = 1 + this._spawnTimer / delta; + emitPosX = (curX - prevX) * lerp + prevX; + emitPosY = (curY - prevY) * lerp + prevY; + } + else { + emitPosX = curX; + emitPosY = curY; + } + //create enough particles to fill the wave (non-burst types have a wave of 1) + i = 0; + for (var len = Math.min(this.particlesPerWave, this.maxParticles - this.particleCount); i < len; ++i) { + //see if we actually spawn one + if (this.spawnChance < 1 && Math.random() >= this.spawnChance) + continue; + //create particle + var p = void 0; + if (this._poolFirst) { + p = this._poolFirst; + this._poolFirst = this._poolFirst.next; + p.next = null; + } + else { + p = new this.particleConstructor(this); + } + //set a random texture if we have more than one + if (this.particleImages.length > 1) { + p.applyArt(this.particleImages[Math.floor(Math.random() * this.particleImages.length)]); + } + else { + //if they are actually the same texture, a standard particle + //will quit early from the texture setting in setTexture(). + p.applyArt(this.particleImages[0]); + } + //set up the start and end values + p.alphaList.reset(this.startAlpha); + if (this.minimumSpeedMultiplier != 1) { + p.speedMultiplier = Math.random() * (1 - this.minimumSpeedMultiplier) + this.minimumSpeedMultiplier; + } + p.speedList.reset(this.startSpeed); + p.acceleration.x = this.acceleration.x; + p.acceleration.y = this.acceleration.y; + p.maxSpeed = this.maxSpeed; + if (this.minimumScaleMultiplier != 1) { + p.scaleMultiplier = Math.random() * (1 - this.minimumScaleMultiplier) + this.minimumScaleMultiplier; + } + p.scaleList.reset(this.startScale); + p.colorList.reset(this.startColor); + //randomize the rotation speed + if (this.minRotationSpeed == this.maxRotationSpeed) + p.rotationSpeed = this.minRotationSpeed; + else + p.rotationSpeed = Math.random() * (this.maxRotationSpeed - this.minRotationSpeed) + this.minRotationSpeed; + p.noRotation = this.noRotation; + //set up the lifetime + p.maxLife = lifetime; + //set the blend mode + p.blendMode = this.particleBlendMode; + //set the custom ease, if any + p.ease = this.customEase; + //set the extra data, if any + p.extraData = this.extraData; + //call the proper function to handle rotation and position of particle + this._spawnFunc(p, emitPosX, emitPosY, i); + //initialize particle + p.init(); + //update the particle by the time passed, so the particles are spread out properly + p.update(-this._spawnTimer); //we want a positive delta, because a negative delta messes things up + //add the particle to the display list + if (!p.parent) { + if (this.addAtBack) + this._parent.addChildAt(p, 0); + else + this._parent.addChild(p); + } + else { + //kind of hacky, but performance friendly + //shuffle children to correct place + var children = this._parent.children; + //avoid using splice if possible + if (children[0] == p) + children.shift(); + else if (children[children.length - 1] == p) + children.pop(); + else { + var index = children.indexOf(p); + children.splice(index, 1); + } + if (this.addAtBack) + children.unshift(p); + else + children.push(p); + } + //add particle to list of active particles + if (this._activeParticlesLast) { + this._activeParticlesLast.next = p; + p.prev = this._activeParticlesLast; + this._activeParticlesLast = p; + } + else { + this._activeParticlesLast = this._activeParticlesFirst = p; + } + ++this.particleCount; + } + } + //increase timer and continue on to any other particles that need to be created + this._spawnTimer += this._frequency; + } + } + //if the position changed before this update, then keep track of that + if (this._posChanged) { + this._prevEmitterPos.x = curX; + this._prevEmitterPos.y = curY; + this._prevPosIsValid = true; + this._posChanged = false; + } + //if we are all done and should destroy ourselves, take care of that + if (!this._emit && !this._activeParticlesFirst) { + if (this._completeCallback) { + this._completeCallback(); + } + if (this._destroyWhenComplete) { + this.destroy(); + } + } + }; + /** + * Positions a particle for a point type emitter. + * @method PIXI.particles.Emitter#_spawnPoint + * @private + * @param {Particle} p The particle to position and rotate. + * @param {Number} emitPosX The emitter's x position + * @param {Number} emitPosY The emitter's y position + * @param {int} i The particle number in the current wave. Not used for this function. + */ + Emitter.prototype._spawnPoint = function (p, emitPosX, emitPosY) { + //set the initial rotation/direction of the particle based on + //starting particle angle and rotation of emitter + if (this.minStartRotation == this.maxStartRotation) + p.rotation = this.minStartRotation + this.rotation; + else + p.rotation = Math.random() * (this.maxStartRotation - this.minStartRotation) + this.minStartRotation + this.rotation; + //drop the particle at the emitter's position + p.position.x = emitPosX; + p.position.y = emitPosY; + }; + /** + * Positions a particle for a rectangle type emitter. + * @method PIXI.particles.Emitter#_spawnRect + * @private + * @param {Particle} p The particle to position and rotate. + * @param {Number} emitPosX The emitter's x position + * @param {Number} emitPosY The emitter's y position + * @param {int} i The particle number in the current wave. Not used for this function. + */ + Emitter.prototype._spawnRect = function (p, emitPosX, emitPosY) { + //set the initial rotation/direction of the particle based on starting + //particle angle and rotation of emitter + if (this.minStartRotation == this.maxStartRotation) + p.rotation = this.minStartRotation + this.rotation; + else + p.rotation = Math.random() * (this.maxStartRotation - this.minStartRotation) + this.minStartRotation + this.rotation; + //place the particle at a random point in the rectangle + helperPoint.x = Math.random() * this.spawnRect.width + this.spawnRect.x; + helperPoint.y = Math.random() * this.spawnRect.height + this.spawnRect.y; + if (this.rotation !== 0) + ParticleUtils_1.default.rotatePoint(this.rotation, helperPoint); + p.position.x = emitPosX + helperPoint.x; + p.position.y = emitPosY + helperPoint.y; + }; + /** + * Positions a particle for a circle type emitter. + * @method PIXI.particles.Emitter#_spawnCircle + * @private + * @param {Particle} p The particle to position and rotate. + * @param {Number} emitPosX The emitter's x position + * @param {Number} emitPosY The emitter's y position + * @param {int} i The particle number in the current wave. Not used for this function. + */ + Emitter.prototype._spawnCircle = function (p, emitPosX, emitPosY) { + //set the initial rotation/direction of the particle based on starting + //particle angle and rotation of emitter + if (this.minStartRotation == this.maxStartRotation) + p.rotation = this.minStartRotation + this.rotation; + else + p.rotation = Math.random() * (this.maxStartRotation - this.minStartRotation) + + this.minStartRotation + this.rotation; + //place the particle at a random radius in the circle + helperPoint.x = Math.random() * this.spawnCircle.radius; + helperPoint.y = 0; + //rotate the point to a random angle in the circle + ParticleUtils_1.default.rotatePoint(Math.random() * 360, helperPoint); + //offset by the circle's center + helperPoint.x += this.spawnCircle.x; + helperPoint.y += this.spawnCircle.y; + //rotate the point by the emitter's rotation + if (this.rotation !== 0) + ParticleUtils_1.default.rotatePoint(this.rotation, helperPoint); + //set the position, offset by the emitter's position + p.position.x = emitPosX + helperPoint.x; + p.position.y = emitPosY + helperPoint.y; + }; + /** + * Positions a particle for a ring type emitter. + * @method PIXI.particles.Emitter#_spawnRing + * @private + * @param {Particle} p The particle to position and rotate. + * @param {Number} emitPosX The emitter's x position + * @param {Number} emitPosY The emitter's y position + * @param {int} i The particle number in the current wave. Not used for this function. + */ + Emitter.prototype._spawnRing = function (p, emitPosX, emitPosY) { + var spawnCircle = this.spawnCircle; + //set the initial rotation/direction of the particle based on starting + //particle angle and rotation of emitter + if (this.minStartRotation == this.maxStartRotation) + p.rotation = this.minStartRotation + this.rotation; + else + p.rotation = Math.random() * (this.maxStartRotation - this.minStartRotation) + + this.minStartRotation + this.rotation; + //place the particle at a random radius in the ring + if (spawnCircle.minRadius !== spawnCircle.radius) { + helperPoint.x = Math.random() * (spawnCircle.radius - spawnCircle.minRadius) + + spawnCircle.minRadius; + } + else + helperPoint.x = spawnCircle.radius; + helperPoint.y = 0; + //rotate the point to a random angle in the circle + var angle = Math.random() * 360; + p.rotation += angle; + ParticleUtils_1.default.rotatePoint(angle, helperPoint); + //offset by the circle's center + helperPoint.x += this.spawnCircle.x; + helperPoint.y += this.spawnCircle.y; + //rotate the point by the emitter's rotation + if (this.rotation !== 0) + ParticleUtils_1.default.rotatePoint(this.rotation, helperPoint); + //set the position, offset by the emitter's position + p.position.x = emitPosX + helperPoint.x; + p.position.y = emitPosY + helperPoint.y; + }; + /** + * Positions a particle for a burst type emitter. + * @method PIXI.particles.Emitter#_spawnBurst + * @private + * @param {Particle} p The particle to position and rotate. + * @param {Number} emitPosX The emitter's x position + * @param {Number} emitPosY The emitter's y position + * @param {int} i The particle number in the current wave. + */ + Emitter.prototype._spawnBurst = function (p, emitPosX, emitPosY, i) { + //set the initial rotation/direction of the particle based on spawn + //angle and rotation of emitter + if (this.particleSpacing === 0) + p.rotation = Math.random() * 360; + else + p.rotation = this.angleStart + (this.particleSpacing * i) + this.rotation; + //drop the particle at the emitter's position + p.position.x = emitPosX; + p.position.y = emitPosY; + }; + /** + * Kills all active particles immediately. + * @method PIXI.particles.Emitter#cleanup + */ + Emitter.prototype.cleanup = function () { + var particle, next; + for (particle = this._activeParticlesFirst; particle; particle = next) { + next = particle.next; + this.recycle(particle); + if (particle.parent) + particle.parent.removeChild(particle); + } + this._activeParticlesFirst = this._activeParticlesLast = null; + this.particleCount = 0; + }; + /** + * Destroys the emitter and all of its particles. + * @method PIXI.particles.Emitter#destroy + */ + Emitter.prototype.destroy = function () { + //make sure we aren't still listening to any tickers + this.autoUpdate = false; + //puts all active particles in the pool, and removes them from the particle parent + this.cleanup(); + //wipe the pool clean + var next; + for (var particle = this._poolFirst; particle; particle = next) { + //store next value so we don't lose it in our destroy call + next = particle.next; + particle.destroy(); + } + this._poolFirst = this._parent = this.particleImages = this.spawnPos = this.ownerPos = + this.startColor = this.startScale = this.startAlpha = this.startSpeed = + this.customEase = this._completeCallback = null; + }; + return Emitter; +}()); +exports.default = Emitter; + +},{"./Particle":3,"./ParticleUtils":4,"./PropertyNode":7}],3:[function(_dereq_,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var ParticleUtils_1 = _dereq_("./ParticleUtils"); +var PropertyList_1 = _dereq_("./PropertyList"); +var Sprite = PIXI.Sprite; +/** + * An individual particle image. You shouldn't have to deal with these. + * @memberof PIXI.particles + * @class Particle + * @extends PIXI.Sprite + * @constructor + * @param {PIXI.particles.Emitter} emitter The emitter that controls this particle. + */ +var Particle = /** @class */ (function (_super) { + __extends(Particle, _super); + function Particle(emitter) { + var _this = + //start off the sprite with a blank texture, since we are going to replace it + //later when the particle is initialized. + _super.call(this) || this; + _this.emitter = emitter; + //particles should be centered + _this.anchor.x = _this.anchor.y = 0.5; + _this.velocity = new PIXI.Point(); + _this.maxLife = 0; + _this.age = 0; + _this.ease = null; + _this.extraData = null; + _this.alphaList = new PropertyList_1.default(); + _this.speedList = new PropertyList_1.default(); + _this.speedMultiplier = 1; + /** + * Acceleration to apply to the particle. + * @property {PIXI.Point} accleration + */ + _this.acceleration = new PIXI.Point(); + /** + * The maximum speed allowed for accelerating particles. Negative values, values of 0 or NaN + * will disable the maximum speed. + * @property {Number} maxSpeed + * @default NaN + */ + _this.maxSpeed = NaN; + /** + * The scale of the particle throughout its life. + * @property {PIXI.particles.PropertyList} scaleList + */ + _this.scaleList = new PropertyList_1.default(); + /** + * A multiplier from 0-1 applied to the scale of the particle at all times. + * @property {number} scaleMultiplier + */ + _this.scaleMultiplier = 1; + /** + * The tint of the particle throughout its life. + * @property {PIXI.particles.PropertyList} colorList + */ + _this.colorList = new PropertyList_1.default(true); + /** + * If alpha should be interpolated at all. + * @property {Boolean} _doAlpha + * @private + */ + _this._doAlpha = false; + /** + * If scale should be interpolated at all. + * @property {Boolean} _doScale + * @private + */ + _this._doScale = false; + /** + * If speed should be interpolated at all. + * @property {Boolean} _doSpeed + * @private + */ + _this._doSpeed = false; + /** + * If acceleration should be handled at all. _doSpeed is mutually exclusive with this, + * and _doSpeed gets priority. + * @property {Boolean} _doAcceleration + * @private + */ + _this._doAcceleration = false; + /** + * If color should be interpolated at all. + * @property {Boolean} _doColor + * @private + */ + _this._doColor = false; + /** + * If normal movement should be handled. Subclasses wishing to override movement + * can set this to false in init(). + * @property {Boolean} _doNormalMovement + * @private + */ + _this._doNormalMovement = false; + /** + * One divided by the max life of the particle, saved for slightly faster math. + * @property {Number} _oneOverLife + * @private + */ + _this._oneOverLife = 0; + /** + * Reference to the next particle in the list. + * @property {Particle} next + * @private + */ + _this.next = null; + /** + * Reference to the previous particle in the list. + * @property {Particle} prev + * @private + */ + _this.prev = null; + //save often used functions on the instance instead of the prototype for better speed + _this.init = _this.init; + _this.Particle_init = Particle.prototype.init; + _this.update = _this.update; + _this.Particle_update = Particle.prototype.update; + _this.Sprite_destroy = _super.prototype.destroy; + _this.Particle_destroy = Particle.prototype.destroy; + _this.applyArt = _this.applyArt; + _this.kill = _this.kill; + return _this; + } + /** + * Initializes the particle for use, based on the properties that have to + * have been set already on the particle. + * @method PIXI.particles.Particle#init + */ + Particle.prototype.init = function () { + //reset the age + this.age = 0; + //set up the velocity based on the start speed and rotation + this.velocity.x = this.speedList.current.value * this.speedMultiplier; + this.velocity.y = 0; + ParticleUtils_1.default.rotatePoint(this.rotation, this.velocity); + if (this.noRotation) { + this.rotation = 0; + } + else { + //convert rotation to Radians from Degrees + this.rotation *= ParticleUtils_1.default.DEG_TO_RADS; + } + //convert rotation speed to Radians from Degrees + this.rotationSpeed *= ParticleUtils_1.default.DEG_TO_RADS; + //set alpha to inital alpha + this.alpha = this.alphaList.current.value; + //set scale to initial scale + this.scale.x = this.scale.y = this.scaleList.current.value; + //figure out what we need to interpolate + this._doAlpha = !!this.alphaList.current.next; + this._doSpeed = !!this.speedList.current.next; + this._doScale = !!this.scaleList.current.next; + this._doColor = !!this.colorList.current.next; + this._doAcceleration = this.acceleration.x !== 0 || this.acceleration.y !== 0; + //_doNormalMovement can be cancelled by subclasses + this._doNormalMovement = this._doSpeed || this.speedList.current.value !== 0 || this._doAcceleration; + //save our lerp helper + this._oneOverLife = 1 / this.maxLife; + //set the inital color + var color = this.colorList.current.value; + this.tint = ParticleUtils_1.default.combineRGBComponents(color.r, color.g, color.b); + //ensure visibility + this.visible = true; + }; + /** + * Sets the texture for the particle. This can be overridden to allow + * for an animated particle. + * @method PIXI.particles.Particle#applyArt + * @param {PIXI.Texture} art The texture to set. + */ + Particle.prototype.applyArt = function (art) { + this.texture = art || PIXI.Texture.EMPTY; + }; + /** + * Updates the particle. + * @method PIXI.particles.Particle#update + * @param {Number} delta Time elapsed since the previous frame, in __seconds__. + * @return {Number} The standard interpolation multiplier (0-1) used for all relevant particle + * properties. A value of -1 means the particle died of old age instead. + */ + Particle.prototype.update = function (delta) { + //increase age + this.age += delta; + //recycle particle if it is too old + if (this.age >= this.maxLife || this.age < 0) { + this.kill(); + return -1; + } + //determine our interpolation value + var lerp = this.age * this._oneOverLife; //lifetime / maxLife; + if (this.ease) { + if (this.ease.length == 4) { + //the t, b, c, d parameters that some tween libraries use + //(time, initial value, end value, duration) + lerp = this.ease(lerp, 0, 1, 1); + } + else { + //the simplified version that we like that takes + //one parameter, time from 0-1. TweenJS eases provide this usage. + lerp = this.ease(lerp); + } + } + //interpolate alpha + if (this._doAlpha) + this.alpha = this.alphaList.interpolate(lerp); + //interpolate scale + if (this._doScale) { + var scale = this.scaleList.interpolate(lerp) * this.scaleMultiplier; + this.scale.x = this.scale.y = scale; + } + //handle movement + if (this._doNormalMovement) { + //interpolate speed + if (this._doSpeed) { + var speed = this.speedList.interpolate(lerp) * this.speedMultiplier; + ParticleUtils_1.default.normalize(this.velocity); + ParticleUtils_1.default.scaleBy(this.velocity, speed); + } + else if (this._doAcceleration) { + this.velocity.x += this.acceleration.x * delta; + this.velocity.y += this.acceleration.y * delta; + if (this.maxSpeed) { + var currentSpeed = ParticleUtils_1.default.length(this.velocity); + //if we are going faster than we should, clamp at the max speed + //DO NOT recalculate vector length + if (currentSpeed > this.maxSpeed) { + ParticleUtils_1.default.scaleBy(this.velocity, this.maxSpeed / currentSpeed); + } + } + } + //adjust position based on velocity + this.position.x += this.velocity.x * delta; + this.position.y += this.velocity.y * delta; + } + //interpolate color + if (this._doColor) { + this.tint = this.colorList.interpolate(lerp); + } + //update rotation + if (this.rotationSpeed !== 0) { + this.rotation += this.rotationSpeed * delta; + } + else if (this.acceleration && !this.noRotation) { + this.rotation = Math.atan2(this.velocity.y, this.velocity.x); // + Math.PI / 2; + } + return lerp; + }; + /** + * Kills the particle, removing it from the display list + * and telling the emitter to recycle it. + * @method PIXI.particles.Particle#kill + */ + Particle.prototype.kill = function () { + this.emitter.recycle(this); + }; + /** + * Destroys the particle, removing references and preventing future use. + * @method PIXI.particles.Particle#destroy + */ + Particle.prototype.destroy = function () { + if (this.parent) + this.parent.removeChild(this); + this.Sprite_destroy(); + this.emitter = this.velocity = this.colorList = this.scaleList = this.alphaList = + this.speedList = this.ease = this.next = this.prev = null; + }; + /** + * Checks over the art that was passed to the Emitter's init() function, to do any special + * modifications to prepare it ahead of time. + * @method PIXI.particles.Particle.parseArt + * @static + * @param {Array} art The array of art data. For Particle, it should be an array of Textures. + * Any strings in the array will be converted to Textures via + * Texture.fromImage(). + * @return {Array} The art, after any needed modifications. + */ + Particle.parseArt = function (art) { + //convert any strings to Textures. + var i; + for (i = art.length; i >= 0; --i) { + if (typeof art[i] == "string") + art[i] = PIXI.Texture.fromImage(art[i]); + } + //particles from different base textures will be slower in WebGL than if they + //were from one spritesheet + if (ParticleUtils_1.default.verbose) { + for (i = art.length - 1; i > 0; --i) { + if (art[i].baseTexture != art[i - 1].baseTexture) { + if (window.console) + console.warn("PixiParticles: using particle textures from different images may hinder performance in WebGL"); + break; + } + } + } + return art; + }; + /** + * Parses extra emitter data to ensure it is set up for this particle class. + * Particle does nothing to the extra data. + * @method PIXI.particles.Particle.parseData + * @static + * @param {Object} extraData The extra data from the particle config. + * @return {Object} The parsed extra data. + */ + Particle.parseData = function (extraData) { + return extraData; + }; + return Particle; +}(Sprite)); +exports.default = Particle; + +},{"./ParticleUtils":4,"./PropertyList":6}],4:[function(_dereq_,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var BLEND_MODES = PIXI.BLEND_MODES; +var PropertyNode_1 = _dereq_("./PropertyNode"); +/** + * Contains helper functions for particles and emitters to use. + * @memberof PIXI.particles + * @class ParticleUtils + * @static + */ +var ParticleUtils = { + /** + * If errors and warnings should be logged within the library. + * @name PIXI.particles.ParticleUtils.verbose + * @default false + * @static + */ + verbose: false, + DEG_TO_RADS: Math.PI / 180, + /** + * Rotates a point by a given angle. + * @method PIXI.particles.ParticleUtils.rotatePoint + * @param {Number} angle The angle to rotate by in degrees + * @param {PIXI.Point} p The point to rotate around 0,0. + * @static + */ + rotatePoint: function (angle, p) { + if (!angle) + return; + angle *= ParticleUtils.DEG_TO_RADS; + var s = Math.sin(angle); + var c = Math.cos(angle); + var xnew = p.x * c - p.y * s; + var ynew = p.x * s + p.y * c; + p.x = xnew; + p.y = ynew; + }, + /** + * Combines separate color components (0-255) into a single uint color. + * @method PIXI.particles.ParticleUtils.combineRGBComponents + * @param {uint} r The red value of the color + * @param {uint} g The green value of the color + * @param {uint} b The blue value of the color + * @return {uint} The color in the form of 0xRRGGBB + * @static + */ + combineRGBComponents: function (r, g, b /*, a*/) { + return /*a << 24 |*/ r << 16 | g << 8 | b; + }, + /** + * Reduces the point to a length of 1. + * @method PIXI.particles.ParticleUtils.normalize + * @static + * @param {PIXI.Point} point The point to normalize + */ + normalize: function (point) { + var oneOverLen = 1 / ParticleUtils.length(point); + point.x *= oneOverLen; + point.y *= oneOverLen; + }, + /** + * Multiplies the x and y values of this point by a value. + * @method PIXI.particles.ParticleUtils.scaleBy + * @static + * @param {PIXI.Point} point The point to scaleBy + * @param {number} value The value to scale by. + */ + scaleBy: function (point, value) { + point.x *= value; + point.y *= value; + }, + /** + * Returns the length (or magnitude) of this point. + * @method PIXI.particles.ParticleUtils.length + * @static + * @param {PIXI.Point} point The point to measure length + * @return The length of this point. + */ + length: function (point) { + return Math.sqrt(point.x * point.x + point.y * point.y); + }, + /** + * Converts a hex string from "#AARRGGBB", "#RRGGBB", "0xAARRGGBB", "0xRRGGBB", + * "AARRGGBB", or "RRGGBB" to an object of ints of 0-255, as + * {r, g, b, (a)}. + * @method PIXI.particles.ParticleUtils.hexToRGB + * @param {string} color The input color string. + * @param {Object} [output] An object to put the output in. If omitted, a new object is created. + * @return The object with r, g, and b properties, possibly with an a property. + * @static + */ + hexToRGB: function (color, output) { + if (!output) + output = {}; + if (color.charAt(0) == "#") + color = color.substr(1); + else if (color.indexOf("0x") === 0) + color = color.substr(2); + var alpha; + if (color.length == 8) { + alpha = color.substr(0, 2); + color = color.substr(2); + } + output.r = parseInt(color.substr(0, 2), 16); //Red + output.g = parseInt(color.substr(2, 2), 16); //Green + output.b = parseInt(color.substr(4, 2), 16); //Blue + if (alpha) + output.a = parseInt(alpha, 16); + return output; + }, + /** + * Generates a custom ease function, based on the GreenSock custom ease, as demonstrated + * by the related tool at http://www.greensock.com/customease/. + * @method PIXI.particles.ParticleUtils.generateEase + * @param {Array} segments An array of segments, as created by + * http://www.greensock.com/customease/. + * @return {Function} A function that calculates the percentage of change at + * a given point in time (0-1 inclusive). + * @static + */ + generateEase: function (segments) { + var qty = segments.length; + var oneOverQty = 1 / qty; + /* + * Calculates the percentage of change at a given point in time (0-1 inclusive). + * @param {Number} time The time of the ease, 0-1 inclusive. + * @return {Number} The percentage of the change, 0-1 inclusive (unless your + * ease goes outside those bounds). + */ + return function (time) { + var t, s; + var i = (qty * time) | 0; //do a quick floor operation + t = (time - (i * oneOverQty)) * qty; + s = segments[i] || segments[qty - 1]; + return (s.s + t * (2 * (1 - t) * (s.cp - s.s) + t * (s.e - s.s))); + }; + }, + /** + * Gets a blend mode, ensuring that it is valid. + * @method PIXI.particles.ParticleUtils.getBlendMode + * @param {string} name The name of the blend mode to get. + * @return {int} The blend mode as specified in the PIXI.BLEND_MODES enumeration. + * @static + */ + getBlendMode: function (name) { + if (!name) + return BLEND_MODES.NORMAL; + name = name.toUpperCase(); + while (name.indexOf(" ") >= 0) + name = name.replace(" ", "_"); + return BLEND_MODES[name] || BLEND_MODES.NORMAL; + }, + /** + * Converts a list of {value, time} objects starting at time 0 and ending at time 1 into an evenly + * spaced stepped list of PropertyNodes for color values. This is primarily to handle conversion of + * linear gradients to fewer colors, allowing for some optimization for Canvas2d fallbacks. + * @method PIXI.particles.ParticleUtils.createSteppedGradient + * @param {Array} list The list of data to convert. + * @param {number} [numSteps=10] The number of steps to use. + * @return {PIXI.particles.PropertyNode} The blend mode as specified in the PIXI.blendModes enumeration. + * @static + */ + createSteppedGradient: function (list, numSteps) { + if (numSteps === void 0) { numSteps = 10; } + if (typeof numSteps !== 'number' || numSteps <= 0) + numSteps = 10; + var first = new PropertyNode_1.default(list[0].value, list[0].time); + first.isStepped = true; + var currentNode = first; + var current = list[0]; + var nextIndex = 1; + var next = list[nextIndex]; + for (var i = 1; i < numSteps; ++i) { + var lerp = i / numSteps; + //ensure we are on the right segment, if multiple + while (lerp > next.time) { + current = next; + next = list[++nextIndex]; + } + //convert the lerp value to the segment range + lerp = (lerp - current.time) / (next.time - current.time); + var curVal = ParticleUtils.hexToRGB(current.value); + var nextVal = ParticleUtils.hexToRGB(next.value); + var output = {}; + output.r = (nextVal.r - curVal.r) * lerp + curVal.r; + output.g = (nextVal.g - curVal.g) * lerp + curVal.g; + output.b = (nextVal.b - curVal.b) * lerp + curVal.b; + currentNode.next = new PropertyNode_1.default(output, i / numSteps); + currentNode = currentNode.next; + } + //we don't need to have a PropertyNode for time of 1, because in a stepped version at that point + //the particle has died of old age + return first; + } +}; +exports.default = ParticleUtils; + +},{"./PropertyNode":7}],5:[function(_dereq_,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var ParticleUtils_1 = _dereq_("./ParticleUtils"); +var Particle_1 = _dereq_("./Particle"); +/** + * A helper point for math things. + * @private + */ +var helperPoint = new PIXI.Point(); +//a hand picked list of Math functions (and a couple properties) that are allowable. +//they should be used without the preceding "Math." +var MATH_FUNCS = [ + "pow", + "sqrt", + "abs", + "floor", + "round", + "ceil", + "E", + "PI", + "sin", + "cos", + "tan", + "asin", + "acos", + "atan", + "atan2", + "log" +]; +//create an actual regular expression object from the string +var WHITELISTER = new RegExp([ + //Allow the 4 basic operations, parentheses and all numbers/decimals, as well + //as 'x', for the variable usage. + "[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]", +].concat(MATH_FUNCS).join("|"), "g"); +/** + * Parses a string into a function for path following. + * This involves whitelisting the string for safety, inserting "Math." to math function + * names, and using `new Function()` to generate a function. + * @method PIXI.particles.PathParticle~parsePath + * @private + * @static + * @param {String} pathString The string to parse. + * @return {Function} The path function - takes x, outputs y. + */ +var parsePath = function (pathString) { + var matches = pathString.match(WHITELISTER); + for (var i = matches.length - 1; i >= 0; --i) { + if (MATH_FUNCS.indexOf(matches[i]) >= 0) + matches[i] = "Math." + matches[i]; + } + pathString = matches.join(""); + return new Function("x", "return " + pathString + ";"); +}; +/** + * An particle that follows a path defined by an algebraic expression, e.g. "sin(x)" or + * "5x + 3". + * To use this class, the particle config must have a "path" string in the + * "extraData" parameter. This string should have "x" in it to represent movement (from the + * speed settings of the particle). It may have numbers, parentheses, the four basic + * operations, and the following Math functions or properties (without the preceding "Math."): + * "pow", "sqrt", "abs", "floor", "round", "ceil", "E", "PI", "sin", "cos", "tan", "asin", + * "acos", "atan", "atan2", "log". + * The overall movement of the particle and the expression value become x and y positions for + * the particle, respectively. The final position is rotated by the spawn rotation/angle of + * the particle. + * + * Some example paths: + * + * "sin(x/10) * 20" // A sine wave path. + * "cos(x/100) * 30" // Particles curve counterclockwise (for medium speed/low lifetime particles) + * "pow(x/10, 2) / 2" // Particles curve clockwise (remember, +y is down). + * + * @memberof PIXI.particles + * @class PathParticle + * @extends PIXI.particles.Particle + * @constructor + * @param {PIXI.particles.Emitter} emitter The emitter that controls this PathParticle. + */ +var PathParticle = /** @class */ (function (_super) { + __extends(PathParticle, _super); + function PathParticle(emitter) { + var _this = _super.call(this, emitter) || this; + _this.path = null; + _this.initialRotation = 0; + _this.initialPosition = new PIXI.Point(); + _this.movement = 0; + return _this; + } + /** + * Initializes the particle for use, based on the properties that have to + * have been set already on the particle. + * @method PIXI.particles.PathParticle#init + */ + PathParticle.prototype.init = function () { + //get initial rotation before it is converted to radians + this.initialRotation = this.rotation; + //standard init + this.Particle_init(); + //set the path for the particle + this.path = this.extraData.path; + //cancel the normal movement behavior + this._doNormalMovement = !this.path; + //reset movement + this.movement = 0; + //grab position + this.initialPosition.x = this.position.x; + this.initialPosition.y = this.position.y; + }; + /** + * Updates the particle. + * @method PIXI.particles.PathParticle#update + * @param {Number} delta Time elapsed since the previous frame, in __seconds__. + */ + PathParticle.prototype.update = function (delta) { + var lerp = this.Particle_update(delta); + //if the particle died during the update, then don't bother + if (lerp >= 0 && this.path) { + //increase linear movement based on speed + var speed = this.speedList.interpolate(lerp) * this.speedMultiplier; + this.movement += speed * delta; + //set up the helper point for rotation + helperPoint.x = this.movement; + helperPoint.y = this.path(this.movement); + ParticleUtils_1.default.rotatePoint(this.initialRotation, helperPoint); + this.position.x = this.initialPosition.x + helperPoint.x; + this.position.y = this.initialPosition.y + helperPoint.y; + } + return lerp; + }; + /** + * Destroys the particle, removing references and preventing future use. + * @method PIXI.particles.PathParticle#destroy + */ + PathParticle.prototype.destroy = function () { + this.Particle_destroy(); + this.path = this.initialPosition = null; + }; + /** + * Checks over the art that was passed to the Emitter's init() function, to do any special + * modifications to prepare it ahead of time. This just runs Particle.parseArt(). + * @method PIXI.particles.PathParticle.parseArt + * @static + * @param {Array} art The array of art data. For Particle, it should be an array of Textures. + * Any strings in the array will be converted to Textures via + * Texture.fromImage(). + * @return {Array} The art, after any needed modifications. + */ + PathParticle.parseArt = function (art) { + return Particle_1.default.parseArt(art); + }; + /** + * Parses extra emitter data to ensure it is set up for this particle class. + * PathParticle checks for the existence of path data, and parses the path data for use + * by particle instances. + * @method PIXI.particles.PathParticle.parseData + * @static + * @param {Object} extraData The extra data from the particle config. + * @return {Object} The parsed extra data. + */ + PathParticle.parseData = function (extraData) { + var output = {}; + if (extraData && extraData.path) { + try { + output.path = parsePath(extraData.path); + } + catch (e) { + if (ParticleUtils_1.default.verbose) + console.error("PathParticle: error in parsing path expression"); + output.path = null; + } + } + else { + if (ParticleUtils_1.default.verbose) + console.error("PathParticle requires a path string in extraData!"); + output.path = null; + } + return output; + }; + return PathParticle; +}(Particle_1.default)); +exports.default = PathParticle; + +},{"./Particle":3,"./ParticleUtils":4}],6:[function(_dereq_,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var ParticleUtils_1 = _dereq_("./ParticleUtils"); +/** + * Singly linked list container for keeping track of interpolated properties for particles. + * Each Particle will have one of these for each interpolated property. + * @memberof PIXI.particles + * @class PropertyList + * @constructor + * @param {boolean} isColor If this list handles color values + */ +var PropertyList = /** @class */ (function () { + function PropertyList(isColor) { + if (isColor === void 0) { isColor = false; } + this.current = null; + this.next = null; + this.isColor = !!isColor; + this.interpolate = null; + this.ease = null; + } + /** + * Resets the list for use. + * @method interpolate + * @param {PIXI.particles.PropertyNode} first The first node in the list. + * @param {boolean} [isStepped=false] If the values should be stepped instead of interpolated linearly. + */ + PropertyList.prototype.reset = function (first) { + this.current = first; + this.next = first.next; + var isSimple = this.next && this.next.time >= 1; + if (isSimple) { + this.interpolate = this.isColor ? intColorSimple : intValueSimple; + } + else if (first.isStepped) { + this.interpolate = this.isColor ? intColorStepped : intValueStepped; + } + else { + this.interpolate = this.isColor ? intColorComplex : intValueComplex; + } + this.ease = this.current.ease; + }; + return PropertyList; +}()); +exports.default = PropertyList; +function intValueSimple(lerp) { + if (this.ease) + lerp = this.ease(lerp); + return (this.next.value - this.current.value) * lerp + this.current.value; +} +function intColorSimple(lerp) { + if (this.ease) + lerp = this.ease(lerp); + var curVal = this.current.value, nextVal = this.next.value; + var r = (nextVal.r - curVal.r) * lerp + curVal.r; + var g = (nextVal.g - curVal.g) * lerp + curVal.g; + var b = (nextVal.b - curVal.b) * lerp + curVal.b; + return ParticleUtils_1.default.combineRGBComponents(r, g, b); +} +function intValueComplex(lerp) { + if (this.ease) + lerp = this.ease(lerp); + //make sure we are on the right segment + while (lerp > this.next.time) { + this.current = this.next; + this.next = this.next.next; + } + //convert the lerp value to the segment range + lerp = (lerp - this.current.time) / (this.next.time - this.current.time); + return (this.next.value - this.current.value) * lerp + this.current.value; +} +function intColorComplex(lerp) { + if (this.ease) + lerp = this.ease(lerp); + //make sure we are on the right segment + while (lerp > this.next.time) { + this.current = this.next; + this.next = this.next.next; + } + //convert the lerp value to the segment range + lerp = (lerp - this.current.time) / (this.next.time - this.current.time); + var curVal = this.current.value, nextVal = this.next.value; + var r = (nextVal.r - curVal.r) * lerp + curVal.r; + var g = (nextVal.g - curVal.g) * lerp + curVal.g; + var b = (nextVal.b - curVal.b) * lerp + curVal.b; + return ParticleUtils_1.default.combineRGBComponents(r, g, b); +} +function intValueStepped(lerp) { + if (this.ease) + lerp = this.ease(lerp); + //make sure we are on the right segment + while (this.next && lerp > this.next.time) { + this.current = this.next; + this.next = this.next.next; + } + return this.current.value; +} +function intColorStepped(lerp) { + if (this.ease) + lerp = this.ease(lerp); + //make sure we are on the right segment + while (this.next && lerp > this.next.time) { + this.current = this.next; + this.next = this.next.next; + } + var curVal = this.current.value; + return ParticleUtils_1.default.combineRGBComponents(curVal.r, curVal.g, curVal.b); +} + +},{"./ParticleUtils":4}],7:[function(_dereq_,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var ParticleUtils_1 = _dereq_("./ParticleUtils"); +/** + * A single node in a PropertyList. + * @memberof PIXI.particles + * @class PropertyNode + * @constructor + * @param {number|string} value The value for this node + * @param {number} time The time for this node, between 0-1 + * @param {Function|Array} [ease] Custom ease for this list. Only relevant for the first node. + */ +var PropertyNode = /** @class */ (function () { + function PropertyNode(value, time, ease) { + this.value = typeof value == "string" ? ParticleUtils_1.default.hexToRGB(value) : value; + this.time = time; + this.next = null; + this.isStepped = false; + if (ease) { + this.ease = typeof ease == "function" ? ease : ParticleUtils_1.default.generateEase(ease); + } + else { + this.ease = null; + } + } + /** + * Creates a list of property values from a data object {list, isStepped} with a list of objects in + * the form {value, time}. Alternatively, the data object can be in the deprecated form of + * {start, end}. + * @method PIXI.particles.PropertyNode.createListFromArray + * @static + * @param {Object} data The data for the list. + * @param {Array} data.list The array of value and time objects. + * @param {boolean} [data.isStepped] If the list is stepped rather than interpolated. + * @param {Function|Array} [data.ease] Custom ease for this list. + * @return {PIXI.particles.PropertyNode} The first node in the list + */ + PropertyNode.createList = function (data) { + if (Array.isArray(data.list)) { + var array = data.list; + var node = void 0, first = void 0; + first = node = new PropertyNode(array[0].value, array[0].time, data.ease); + //only set up subsequent nodes if there are a bunch or the 2nd one is different from the first + if (array.length > 2 || (array.length === 2 && array[1].value !== array[0].value)) { + for (var i = 1; i < array.length; ++i) { + node.next = new PropertyNode(array[i].value, array[i].time); + node = node.next; + } + } + first.isStepped = !!data.isStepped; + return first; + } + else { + //Handle deprecated version here + var start = new PropertyNode(data.start, 0); + //only set up a next value if it is different from the starting value + if (data.end !== data.start) + start.next = new PropertyNode(data.end, 1); + return start; + } + }; + return PropertyNode; +}()); +exports.default = PropertyNode; + +},{"./ParticleUtils":4}],8:[function(_dereq_,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var ParticleUtils_js_1 = _dereq_("./ParticleUtils.js"); +exports.ParticleUtils = ParticleUtils_js_1.default; +var Particle_js_1 = _dereq_("./Particle.js"); +exports.Particle = Particle_js_1.default; +var Emitter_js_1 = _dereq_("./Emitter.js"); +exports.Emitter = Emitter_js_1.default; +var PathParticle_js_1 = _dereq_("./PathParticle.js"); +exports.PathParticle = PathParticle_js_1.default; +var AnimatedParticle_js_1 = _dereq_("./AnimatedParticle.js"); +exports.AnimatedParticle = AnimatedParticle_js_1.default; + +},{"./AnimatedParticle.js":1,"./Emitter.js":2,"./Particle.js":3,"./ParticleUtils.js":4,"./PathParticle.js":5}],9:[function(_dereq_,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// If we're in the browser make sure PIXI is available +if (typeof PIXI === 'undefined') { + throw "pixi-particles requires pixi.js to be loaded first"; +} +//ensure that the particles namespace exist - PIXI 4 creates it itself, PIXI 3 does not +if (!PIXI.particles) { + PIXI.particles = {}; +} +// get the library itself +var particles = _dereq_("./particles"); +// insert the library into the particles namespace on PIXI +for (var prop in particles) { + PIXI.particles[prop] = particles[prop]; +} +if (typeof module !== "undefined" && module.exports) { + module.exports = particles; +} + +},{"./particles":8}]},{},[9])(9) +}); + var pixi_projection; (function (pixi_projection) { @@ -104248,189 +104247,4191 @@ var pixi_projection; })(pixi_projection || (pixi_projection = {})); /*! - * VERSION: 0.1.13 - * DATE: 2018-08-27 - * UPDATES AND DOCS AT: http://greensock.com/jquery-gsap-plugin/ + * VERSION: 2.1.0 + * DATE: 2019-02-15 + * UPDATES AND DOCS AT: http://greensock.com * - * Requires TweenLite version 1.8.0 or higher and CSSPlugin. - * - * @license Copyright (c) 2013-2019, GreenSock. All rights reserved. + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. * This work is subject to the terms at http://greensock.com/standard-license or for * Club GreenSock members, the software agreement that was issued with your membership. - * + * * @author: Jack Doyle, jack@greensock.com */ /* eslint-disable */ -(function($) { +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + "use strict"; - var _animate = $.fn.animate, - _stop = $.fn.stop, - _enabled = true, - TweenLite, CSSPlugin, _warned, - _copy = function(o) { - var copy = {}, - p; - for (p in o) { - copy[p] = o[p]; - } - return copy; - }, - _reserved = {overwrite:1, delay:1, useFrames:1, runBackwards:1, easeParams:1, yoyo:1, immediateRender:1, repeat:1, repeatDelay:1, autoCSS:1}, - _defaultLegacyProps = ",scrollTop,scrollLeft,show,hide,toggle,", - _legacyProps = _defaultLegacyProps, - _copyCriticalReserved = function(main, sub) { - for (var p in _reserved) { - if (_reserved[p] && main[p] !== undefined) { - sub[p] = main[p]; + _gsScope._gsDefine("TimelineLite", ["core.Animation","core.SimpleTimeline","TweenLite"], function(Animation, SimpleTimeline, TweenLite) { + + var TimelineLite = function(vars) { + SimpleTimeline.call(this, vars); + var self = this, + v = self.vars, + val, p; + self._labels = {}; + self.autoRemoveChildren = !!v.autoRemoveChildren; + self.smoothChildTiming = !!v.smoothChildTiming; + self._sortChildren = true; + self._onUpdate = v.onUpdate; + for (p in v) { + val = v[p]; + if (_isArray(val)) if (val.join("").indexOf("{self}") !== -1) { + v[p] = self._swapSelfInParams(val); + } } - } - }, - _createEase = function(ease) { - return function(p) { - return ease.getRatio(p); - }; - }, - _easeMap = {}, - _init = function() { - var globals = window.GreenSockGlobals || window, - p; - TweenLite = globals.TweenMax || globals.TweenLite; //we prioritize TweenMax if it's loaded so that we can accommodate special features like repeat, yoyo, repeatDelay, etc. - if (TweenLite) { - globals = globals.com.greensock; - CSSPlugin = globals.plugins.CSSPlugin; - _easeMap = globals.easing.Ease.map || {}; //don't do just window.Ease or window.CSSPlugin because some other libraries like EaselJS/TweenJS use those same names and there could be a collision. - } - if (!TweenLite || !CSSPlugin) { - TweenLite = null; - if (!_warned && window.console) { - window.console.log("The jquery.gsap.js plugin requires the TweenMax (or at least TweenLite and CSSPlugin) JavaScript file(s)."); - _warned = true; + if (_isArray(v.tweens)) { + self.add(v.tweens, 0, v.align, v.stagger); } - return; - } - if ($.easing) { - for (p in _easeMap) { - $.easing[p] = _createEase(_easeMap[p]); + }, + _tinyNum = 0.00000001, + TweenLiteInternals = TweenLite._internals, + _internals = TimelineLite._internals = {}, + _isSelector = TweenLiteInternals.isSelector, + _isArray = TweenLiteInternals.isArray, + _lazyTweens = TweenLiteInternals.lazyTweens, + _lazyRender = TweenLiteInternals.lazyRender, + _globals = _gsScope._gsDefine.globals, + _copy = function(vars) { + var copy = {}, p; + for (p in vars) { + copy[p] = vars[p]; } - _init = false; + return copy; + }, + _applyCycle = function(vars, targets, i) { + var alt = vars.cycle, + p, val; + for (p in alt) { + val = alt[p]; + vars[p] = (typeof(val) === "function") ? val(i, targets[i], targets) : val[i % val.length]; + } + delete vars.cycle; + }, + _pauseCallback = _internals.pauseCallback = function() {}, + _slice = function(a) { //don't use [].slice because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll() + var b = [], + l = a.length, + i; + for (i = 0; i !== l; b.push(a[i++])); + return b; + }, + _defaultImmediateRender = function(tl, toVars, fromVars, defaultFalse) { //default to immediateRender:true unless otherwise set in toVars, fromVars or if defaultFalse is passed in as true + var ir = "immediateRender"; + if (!(ir in toVars)) { + toVars[ir] = !(tl._paused || (fromVars && fromVars[ir] === false) || defaultFalse); + } + return toVars; + }, + //for distributing values across an array. Can accept a number, a function or (most commonly) a function which can contain the following properties: {base, amount, from, ease, grid, axis, length}. Returns a function that expects the following parameters: index, target, array. Recognizes the following + _distribute = function(v) { + if (typeof(v) === "function") { + return v; + } + var vars = isNaN(v) ? v : {n:1, from:(v < 0) ? ((v = -v) && "end") : 0}, //n:1 is just to indicate v was a number; we leverage that later to set v according to the length we get. If a number is passed in, we treat it like the old stagger value where 0.1, for example, would mean that things would be distributed with 0.1 between each element in the array rather than a total "amount" that's chunked out among them all. + ease = vars.ease, + from = vars.from || 0, + base = vars.base || 0, + cache = {}, + isFromKeyword = isNaN(from), + axis = vars.axis, + ratio = {center:0.5, end:1}[from] || 0; + return function(i, target, a) { + var l = (a || vars).length, + distances = cache[l], + originX, originY, x, y, d, j, max, min, wrap; + if (!distances) { + wrap = (vars.grid === "auto") ? 0 : (vars.grid || [Infinity])[0]; + if (!wrap) { + max = -Infinity; + while (max < (max = a[wrap++].getBoundingClientRect().left) && wrap < l) { } + wrap--; + } + distances = cache[l] = []; + originX = isFromKeyword ? (Math.min(wrap, l) * ratio) - 0.5 : from % wrap; + originY = isFromKeyword ? l * ratio / wrap - 0.5 : (from / wrap) | 0; + max = 0; + min = Infinity; + for (j = 0; j < l; j++) { + x = (j % wrap) - originX; + y = originY - ((j / wrap) | 0); + distances[j] = d = !axis ? Math.sqrt(x * x + y * y) : Math.abs((axis === "y") ? y : x); + if (d > max) { + max = d; + } + if (d < min) { + min = d; + } + } + distances.max = max - min; + distances.min = min; + distances.v = vars.n ? l * (v || 0) : vars.amount; + } + l = (distances[i] - distances.min) / distances.max; + return base + (ease ? ease.getRatio(l) : l) * distances.v; + }; + }, + p = TimelineLite.prototype = new SimpleTimeline(); + + TimelineLite.version = "2.1.0"; + TimelineLite.distribute = _distribute; + p.constructor = TimelineLite; + p.kill()._gc = p._forcingPlayhead = p._hasPause = false; + + /* might use later... + //translates a local time inside an animation to the corresponding time on the root/global timeline, factoring in all nesting and timeScales. + function localToGlobal(time, animation) { + while (animation) { + time = (time / animation._timeScale) + animation._startTime; + animation = animation.timeline; } + return time; + } + + //translates the supplied time on the root/global timeline into the corresponding local time inside a particular animation, factoring in all nesting and timeScales + function globalToLocal(time, animation) { + var scale = 1; + time -= localToGlobal(0, animation); + while (animation) { + scale *= animation._timeScale; + animation = animation.timeline; + } + return time * scale; + } + */ + + p.to = function(target, duration, vars, position) { + var Engine = (vars.repeat && _globals.TweenMax) || TweenLite; + return duration ? this.add( new Engine(target, duration, vars), position) : this.set(target, vars, position); }; - $.fn.animate = function(prop, speed, easing, callback) { - prop = prop || {}; - if (_init) { - _init(); - if (!TweenLite || !CSSPlugin) { - return _animate.call(this, prop, speed, easing, callback); - } - } - if (!_enabled || prop.skipGSAP === true || (typeof(speed) === "object" && typeof(speed.step) === "function")) { //we don't support the "step" feature because it's too costly performance-wise, so fall back to the native animate() call if we sense one. Same with scrollTop and scrollLeft which are handled in a special way in jQuery. - return _animate.call(this, prop, speed, easing, callback); - } - var config = $.speed(speed, easing, callback), - vars = {ease:(_easeMap[config.easing] || ((config.easing === false) ? _easeMap.linear : _easeMap.swing))}, - obj = this, - specEasing = (typeof(speed) === "object") ? speed.specialEasing : null, - val, p, doAnimation, specEasingVars; - - for (p in prop) { - val = prop[p]; - if (val instanceof Array && _easeMap[val[1]]) { - specEasing = specEasing || {}; - specEasing[p] = val[1]; - val = val[0]; - } - if (val === "show" || val === "hide" || val === "toggle" || (_legacyProps.indexOf(p) !== -1 && _legacyProps.indexOf("," + p + ",") !== -1)) { //note: slideUp() and slideDown() pass in opacity:"show" or opacity:"hide" - return _animate.call(this, prop, speed, easing, callback); - } else { - vars[(p.indexOf("-") === -1) ? p : $.camelCase(p)] = val; - } - } - - if (specEasing) { - vars = _copy(vars); - specEasingVars = []; - for (p in specEasing) { - val = specEasingVars[specEasingVars.length] = {}; - _copyCriticalReserved(vars, val); - val.ease = (_easeMap[specEasing[p]] || vars.ease); - if (p.indexOf("-") !== -1) { - p = $.camelCase(p); - } - val[p] = vars[p]; - delete vars[p]; - } - if (specEasingVars.length === 0) { - specEasingVars = null; - } - } - - doAnimation = function(next) { - var varsCopy = _copy(vars), - i; - if (specEasingVars) { - i = specEasingVars.length; - while (--i > -1) { - TweenLite.to(this, $.fx.off ? 0 : config.duration / 1000, specEasingVars[i]); - } - } - varsCopy.onComplete = function() { - if (next) { - next(); - } else if (config.old) { - $(this).each(config.old); - } - }; - TweenLite.to(this, $.fx.off ? 0 : config.duration / 1000, varsCopy); + p.from = function(target, duration, vars, position) { + return this.add( ((vars.repeat && _globals.TweenMax) || TweenLite).from(target, duration, _defaultImmediateRender(this, vars)), position); }; - if (config.queue !== false) { - obj.queue(config.queue, doAnimation); //note: the queued function will get called once for each element in the jQuery collection. - if (typeof(config.old) === "function") { - $(obj[obj.length-1]).queue(config.queue, function(next) { - config.old.call(obj); - next(); - }); + p.fromTo = function(target, duration, fromVars, toVars, position) { + var Engine = (toVars.repeat && _globals.TweenMax) || TweenLite; + toVars = _defaultImmediateRender(this, toVars, fromVars); + return duration ? this.add( Engine.fromTo(target, duration, fromVars, toVars), position) : this.set(target, toVars, position); + }; + + p.staggerTo = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) { + var tl = new TimelineLite({onComplete:onCompleteAll, onCompleteParams:onCompleteAllParams, callbackScope:onCompleteAllScope, smoothChildTiming:this.smoothChildTiming}), + staggerFunc = _distribute(vars.stagger || stagger), + startAt = vars.startAt, + cycle = vars.cycle, + copy, i; + if (typeof(targets) === "string") { + targets = TweenLite.selector(targets) || targets; } - } else { - doAnimation.call(obj); - } + targets = targets || []; + if (_isSelector(targets)) { //if the targets object is a selector, translate it into an array. + targets = _slice(targets); + } + for (i = 0; i < targets.length; i++) { + copy = _copy(vars); + if (startAt) { + copy.startAt = _copy(startAt); + if (startAt.cycle) { + _applyCycle(copy.startAt, targets, i); + } + } + if (cycle) { + _applyCycle(copy, targets, i); + if (copy.duration != null) { + duration = copy.duration; + delete copy.duration; + } + } + tl.to(targets[i], duration, copy, staggerFunc(i, targets[i], targets)); + } + return this.add(tl, position); + }; - return obj; - }; + p.staggerFrom = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) { + vars.runBackwards = true; + return this.staggerTo(targets, duration, _defaultImmediateRender(this, vars), stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope); + }; + p.staggerFromTo = function(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) { + toVars.startAt = fromVars; + return this.staggerTo(targets, duration, _defaultImmediateRender(this, toVars, fromVars), stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope); + }; - $.fn.stop = function(clearQueue, gotoEnd) { - _stop.call(this, clearQueue, gotoEnd); - if (TweenLite) { - if (gotoEnd) { - var tweens = TweenLite.getTweensOf(this), - i = tweens.length, - progress; + p.call = function(callback, params, scope, position) { + return this.add( TweenLite.delayedCall(0, callback, params, scope), position); + }; + + p.set = function(target, vars, position) { + return this.add( new TweenLite(target, 0, _defaultImmediateRender(this, vars, null, true)), position); + }; + + TimelineLite.exportRoot = function(vars, ignoreDelayedCalls) { + vars = vars || {}; + if (vars.smoothChildTiming == null) { + vars.smoothChildTiming = true; + } + var tl = new TimelineLite(vars), + root = tl._timeline, + hasNegativeStart, time, tween, next; + if (ignoreDelayedCalls == null) { + ignoreDelayedCalls = true; + } + root._remove(tl, true); + tl._startTime = 0; + tl._rawPrevTime = tl._time = tl._totalTime = root._time; + tween = root._first; + while (tween) { + next = tween._next; + if (!ignoreDelayedCalls || !(tween instanceof TweenLite && tween.target === tween.vars.onComplete)) { + time = tween._startTime - tween._delay; + if (time < 0) { + hasNegativeStart = 1; + } + tl.add(tween, time); + } + tween = next; + } + root.add(tl, 0); + if (hasNegativeStart) { //calling totalDuration() will force the adjustment necessary to shift the children forward so none of them start before zero, and moves the timeline backwards the same amount, so the playhead is still aligned where it should be globally, but the timeline doesn't have illegal children that start before zero. + tl.totalDuration(); + } + return tl; + }; + + p.add = function(value, position, align, stagger) { + var self = this, + curTime, l, i, child, tl, beforeRawTime; + if (typeof(position) !== "number") { + position = self._parseTimeOrLabel(position, 0, true, value); + } + if (!(value instanceof Animation)) { + if ((value instanceof Array) || (value && value.push && _isArray(value))) { + align = align || "normal"; + stagger = stagger || 0; + curTime = position; + l = value.length; + for (i = 0; i < l; i++) { + if (_isArray(child = value[i])) { + child = new TimelineLite({tweens:child}); + } + self.add(child, curTime); + if (typeof(child) !== "string" && typeof(child) !== "function") { + if (align === "sequence") { + curTime = child._startTime + (child.totalDuration() / child._timeScale); + } else if (align === "start") { + child._startTime -= child.delay(); + } + } + curTime += stagger; + } + return self._uncache(true); + } else if (typeof(value) === "string") { + return self.addLabel(value, position); + } else if (typeof(value) === "function") { + value = TweenLite.delayedCall(0, value); + } else { + throw("Cannot add " + value + " into the timeline; it is not a tween, timeline, function, or string."); + } + } + + SimpleTimeline.prototype.add.call(self, value, position); + + if (value._time || (!value._duration && value._initted)) { //in case, for example, the _startTime is moved on a tween that has already rendered. Imagine it's at its end state, then the startTime is moved WAY later (after the end of this timeline), it should render at its beginning. + curTime = (self.rawTime() - value._startTime) * value._timeScale; + if (!value._duration || Math.abs(Math.max(0, Math.min(value.totalDuration(), curTime))) - value._totalTime > 0.00001) { + value.render(curTime, false, false); + } + } + + //if the timeline has already ended but the inserted tween/timeline extends the duration, we should enable this timeline again so that it renders properly. We should also align the playhead with the parent timeline's when appropriate. + if (self._gc || self._time === self._duration) if (!self._paused) if (self._duration < self.duration()) { + //in case any of the ancestors had completed but should now be enabled... + tl = self; + beforeRawTime = (tl.rawTime() > value._startTime); //if the tween is placed on the timeline so that it starts BEFORE the current rawTime, we should align the playhead (move the timeline). This is because sometimes users will create a timeline, let it finish, and much later append a tween and expect it to run instead of jumping to its end state. While technically one could argue that it should jump to its end state, that's not what users intuitively expect. + while (tl._timeline) { + if (beforeRawTime && tl._timeline.smoothChildTiming) { + tl.totalTime(tl._totalTime, true); //moves the timeline (shifts its startTime) if necessary, and also enables it. + } else if (tl._gc) { + tl._enabled(true, false); + } + tl = tl._timeline; + } + } + + return self; + }; + + p.remove = function(value) { + if (value instanceof Animation) { + this._remove(value, false); + var tl = value._timeline = value.vars.useFrames ? Animation._rootFramesTimeline : Animation._rootTimeline; //now that it's removed, default it to the root timeline so that if it gets played again, it doesn't jump back into this timeline. + value._startTime = (value._paused ? value._pauseTime : tl._time) - ((!value._reversed ? value._totalTime : value.totalDuration() - value._totalTime) / value._timeScale); //ensure that if it gets played again, the timing is correct. + return this; + } else if (value instanceof Array || (value && value.push && _isArray(value))) { + var i = value.length; while (--i > -1) { - progress = tweens[i].totalTime() / tweens[i].totalDuration(); - if (progress > 0 && progress < 1) { - tweens[i].seek(tweens[i].totalDuration()); + this.remove(value[i]); + } + return this; + } else if (typeof(value) === "string") { + return this.removeLabel(value); + } + return this.kill(null, value); + }; + + p._remove = function(tween, skipDisable) { + SimpleTimeline.prototype._remove.call(this, tween, skipDisable); + var last = this._last; + if (!last) { + this._time = this._totalTime = this._duration = this._totalDuration = 0; + } else if (this._time > this.duration()) { + this._time = this._duration; + this._totalTime = this._totalDuration; + } + return this; + }; + + p.append = function(value, offsetOrLabel) { + return this.add(value, this._parseTimeOrLabel(null, offsetOrLabel, true, value)); + }; + + p.insert = p.insertMultiple = function(value, position, align, stagger) { + return this.add(value, position || 0, align, stagger); + }; + + p.appendMultiple = function(tweens, offsetOrLabel, align, stagger) { + return this.add(tweens, this._parseTimeOrLabel(null, offsetOrLabel, true, tweens), align, stagger); + }; + + p.addLabel = function(label, position) { + this._labels[label] = this._parseTimeOrLabel(position); + return this; + }; + + p.addPause = function(position, callback, params, scope) { + var t = TweenLite.delayedCall(0, _pauseCallback, params, scope || this); + t.vars.onComplete = t.vars.onReverseComplete = callback; + t.data = "isPause"; + this._hasPause = true; + return this.add(t, position); + }; + + p.removeLabel = function(label) { + delete this._labels[label]; + return this; + }; + + p.getLabelTime = function(label) { + return (this._labels[label] != null) ? this._labels[label] : -1; + }; + + p._parseTimeOrLabel = function(timeOrLabel, offsetOrLabel, appendIfAbsent, ignore) { + var clippedDuration, i; + //if we're about to add a tween/timeline (or an array of them) that's already a child of this timeline, we should remove it first so that it doesn't contaminate the duration(). + if (ignore instanceof Animation && ignore.timeline === this) { + this.remove(ignore); + } else if (ignore && ((ignore instanceof Array) || (ignore.push && _isArray(ignore)))) { + i = ignore.length; + while (--i > -1) { + if (ignore[i] instanceof Animation && ignore[i].timeline === this) { + this.remove(ignore[i]); } } } - TweenLite.killTweensOf(this); - } - return this; - }; + clippedDuration = (typeof(timeOrLabel) === "number" && !offsetOrLabel) ? 0 : (this.duration() > 99999999999) ? this.recent().endTime(false) : this._duration; //in case there's a child that infinitely repeats, users almost never intend for the insertion point of a new child to be based on a SUPER long value like that so we clip it and assume the most recently-added child's endTime should be used instead. + if (typeof(offsetOrLabel) === "string") { + return this._parseTimeOrLabel(offsetOrLabel, (appendIfAbsent && typeof(timeOrLabel) === "number" && this._labels[offsetOrLabel] == null) ? timeOrLabel - clippedDuration : 0, appendIfAbsent); + } + offsetOrLabel = offsetOrLabel || 0; + if (typeof(timeOrLabel) === "string" && (isNaN(timeOrLabel) || this._labels[timeOrLabel] != null)) { //if the string is a number like "1", check to see if there's a label with that name, otherwise interpret it as a number (absolute value). + i = timeOrLabel.indexOf("="); + if (i === -1) { + if (this._labels[timeOrLabel] == null) { + return appendIfAbsent ? (this._labels[timeOrLabel] = clippedDuration + offsetOrLabel) : offsetOrLabel; + } + return this._labels[timeOrLabel] + offsetOrLabel; + } + offsetOrLabel = parseInt(timeOrLabel.charAt(i-1) + "1", 10) * Number(timeOrLabel.substr(i+1)); + timeOrLabel = (i > 1) ? this._parseTimeOrLabel(timeOrLabel.substr(0, i-1), 0, appendIfAbsent) : clippedDuration; + } else if (timeOrLabel == null) { + timeOrLabel = clippedDuration; + } + return Number(timeOrLabel) + offsetOrLabel; + }; - $.gsap = { - enabled:function(value) { - _enabled = value; - }, - version:"0.1.13", - legacyProps:function(value) { - _legacyProps = _defaultLegacyProps + value + ","; - } - }; + p.seek = function(position, suppressEvents) { + return this.totalTime((typeof(position) === "number") ? position : this._parseTimeOrLabel(position), (suppressEvents !== false)); + }; -}(jQuery)); + p.stop = function() { + return this.paused(true); + }; + + p.gotoAndPlay = function(position, suppressEvents) { + return this.play(position, suppressEvents); + }; + + p.gotoAndStop = function(position, suppressEvents) { + return this.pause(position, suppressEvents); + }; + + p.render = function(time, suppressEvents, force) { + if (this._gc) { + this._enabled(true, false); + } + var self = this, + prevTime = self._time, + totalDur = (!self._dirty) ? self._totalDuration : self.totalDuration(), + prevStart = self._startTime, + prevTimeScale = self._timeScale, + prevPaused = self._paused, + tween, isComplete, next, callback, internalForce, pauseTween, curTime, pauseTime; + if (prevTime !== self._time) { //if totalDuration() finds a child with a negative startTime and smoothChildTiming is true, things get shifted around internally so we need to adjust the time accordingly. For example, if a tween starts at -30 we must shift EVERYTHING forward 30 seconds and move this timeline's startTime backward by 30 seconds so that things align with the playhead (no jump). + time += self._time - prevTime; + } + if (time >= totalDur - _tinyNum && time >= 0) { //to work around occasional floating point math artifacts. + self._totalTime = self._time = totalDur; + if (!self._reversed) if (!self._hasPausedChild()) { + isComplete = true; + callback = "onComplete"; + internalForce = !!self._timeline.autoRemoveChildren; //otherwise, if the animation is unpaused/activated after it's already finished, it doesn't get removed from the parent timeline. + if (self._duration === 0) if ((time <= 0 && time >= -_tinyNum) || self._rawPrevTime < 0 || self._rawPrevTime === _tinyNum) if (self._rawPrevTime !== time && self._first) { + internalForce = true; + if (self._rawPrevTime > _tinyNum) { + callback = "onReverseComplete"; + } + } + } + self._rawPrevTime = (self._duration || !suppressEvents || time || self._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient. + time = totalDur + 0.0001; //to avoid occasional floating point rounding errors - sometimes child tweens/timelines were not being fully completed (their progress might be 0.999999999999998 instead of 1 because when _time - tween._startTime is performed, floating point errors would return a value that was SLIGHTLY off). Try (999999999999.7 - 999999999999) * 1 = 0.699951171875 instead of 0.7. + + } else if (time < _tinyNum) { //to work around occasional floating point math artifacts, round super small values to 0. + self._totalTime = self._time = 0; + if (time > -_tinyNum) { + time = 0; + } + if (prevTime !== 0 || (self._duration === 0 && self._rawPrevTime !== _tinyNum && (self._rawPrevTime > 0 || (time < 0 && self._rawPrevTime >= 0)))) { + callback = "onReverseComplete"; + isComplete = self._reversed; + } + if (time < 0) { + self._active = false; + if (self._timeline.autoRemoveChildren && self._reversed) { //ensures proper GC if a timeline is resumed after it's finished reversing. + internalForce = isComplete = true; + callback = "onReverseComplete"; + } else if (self._rawPrevTime >= 0 && self._first) { //when going back beyond the start, force a render so that zero-duration tweens that sit at the very beginning render their start values properly. Otherwise, if the parent timeline's playhead lands exactly at this timeline's startTime, and then moves backwards, the zero-duration tweens at the beginning would still be at their end state. + internalForce = true; + } + self._rawPrevTime = time; + } else { + self._rawPrevTime = (self._duration || !suppressEvents || time || self._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient. + if (time === 0 && isComplete) { //if there's a zero-duration tween at the very beginning of a timeline and the playhead lands EXACTLY at time 0, that tween will correctly render its end values, but we need to keep the timeline alive for one more render so that the beginning values render properly as the parent's playhead keeps moving beyond the begining. Imagine obj.x starts at 0 and then we do tl.set(obj, {x:100}).to(obj, 1, {x:200}) and then later we tl.reverse()...the goal is to have obj.x revert to 0. If the playhead happens to land on exactly 0, without this chunk of code, it'd complete the timeline and remove it from the rendering queue (not good). + tween = self._first; + while (tween && tween._startTime === 0) { + if (!tween._duration) { + isComplete = false; + } + tween = tween._next; + } + } + time = 0; //to avoid occasional floating point rounding errors (could cause problems especially with zero-duration tweens at the very beginning of the timeline) + if (!self._initted) { + internalForce = true; + } + } + + } else { + + if (self._hasPause && !self._forcingPlayhead && !suppressEvents) { + if (time >= prevTime) { + tween = self._first; + while (tween && tween._startTime <= time && !pauseTween) { + if (!tween._duration) if (tween.data === "isPause" && !tween.ratio && !(tween._startTime === 0 && self._rawPrevTime === 0)) { + pauseTween = tween; + } + tween = tween._next; + } + } else { + tween = self._last; + while (tween && tween._startTime >= time && !pauseTween) { + if (!tween._duration) if (tween.data === "isPause" && tween._rawPrevTime > 0) { + pauseTween = tween; + } + tween = tween._prev; + } + } + if (pauseTween) { + self._time = self._totalTime = time = pauseTween._startTime; + pauseTime = self._startTime + (time / self._timeScale); + } + } + + self._totalTime = self._time = self._rawPrevTime = time; + } + if ((self._time === prevTime || !self._first) && !force && !internalForce && !pauseTween) { + return; + } else if (!self._initted) { + self._initted = true; + } + + if (!self._active) if (!self._paused && self._time !== prevTime && time > 0) { + self._active = true; //so that if the user renders the timeline (as opposed to the parent timeline rendering it), it is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the timeline already finished but the user manually re-renders it as halfway done, for example. + } + + if (prevTime === 0) if (self.vars.onStart) if (self._time !== 0 || !self._duration) if (!suppressEvents) { + self._callback("onStart"); + } + + curTime = self._time; + if (curTime >= prevTime) { + tween = self._first; + while (tween) { + next = tween._next; //record it here because the value could change after rendering... + if (curTime !== self._time || (self._paused && !prevPaused)) { //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete + break; + } else if (tween._active || (tween._startTime <= curTime && !tween._paused && !tween._gc)) { + if (pauseTween === tween) { + self.pause(); + self._pauseTime = pauseTime; //so that when we resume(), it's starting from exactly the right spot (the pause() method uses the rawTime for the parent, but that may be a bit too far ahead) + } + if (!tween._reversed) { + tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force); + } else { + tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force); + } + } + tween = next; + } + } else { + tween = self._last; + while (tween) { + next = tween._prev; //record it here because the value could change after rendering... + if (curTime !== self._time || (self._paused && !prevPaused)) { //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete + break; + } else if (tween._active || (tween._startTime <= prevTime && !tween._paused && !tween._gc)) { + if (pauseTween === tween) { + pauseTween = tween._prev; //the linked list is organized by _startTime, thus it's possible that a tween could start BEFORE the pause and end after it, in which case it would be positioned before the pause tween in the linked list, but we should render it before we pause() the timeline and cease rendering. This is only a concern when going in reverse. + while (pauseTween && pauseTween.endTime() > self._time) { + pauseTween.render( (pauseTween._reversed ? pauseTween.totalDuration() - ((time - pauseTween._startTime) * pauseTween._timeScale) : (time - pauseTween._startTime) * pauseTween._timeScale), suppressEvents, force); + pauseTween = pauseTween._prev; + } + pauseTween = null; + self.pause(); + self._pauseTime = pauseTime; //so that when we resume(), it's starting from exactly the right spot (the pause() method uses the rawTime for the parent, but that may be a bit too far ahead) + } + if (!tween._reversed) { + tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force); + } else { + tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force); + } + } + tween = next; + } + } + + if (self._onUpdate) if (!suppressEvents) { + if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onUpdate on a timeline that reports/checks tweened values. + _lazyRender(); + } + self._callback("onUpdate"); + } + + if (callback) if (!self._gc) if (prevStart === self._startTime || prevTimeScale !== self._timeScale) if (self._time === 0 || totalDur >= self.totalDuration()) { //if one of the tweens that was rendered altered this timeline's startTime (like if an onComplete reversed the timeline), it probably isn't complete. If it is, don't worry, because whatever call altered the startTime would complete if it was necessary at the new time. The only exception is the timeScale property. Also check _gc because there's a chance that kill() could be called in an onUpdate + if (isComplete) { + if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onComplete on a timeline that reports/checks tweened values. + _lazyRender(); + } + if (self._timeline.autoRemoveChildren) { + self._enabled(false, false); + } + self._active = false; + } + if (!suppressEvents && self.vars[callback]) { + self._callback(callback); + } + } + }; + + p._hasPausedChild = function() { + var tween = this._first; + while (tween) { + if (tween._paused || ((tween instanceof TimelineLite) && tween._hasPausedChild())) { + return true; + } + tween = tween._next; + } + return false; + }; + + p.getChildren = function(nested, tweens, timelines, ignoreBeforeTime) { + ignoreBeforeTime = ignoreBeforeTime || -9999999999; + var a = [], + tween = this._first, + cnt = 0; + while (tween) { + if (tween._startTime < ignoreBeforeTime) { + //do nothing + } else if (tween instanceof TweenLite) { + if (tweens !== false) { + a[cnt++] = tween; + } + } else { + if (timelines !== false) { + a[cnt++] = tween; + } + if (nested !== false) { + a = a.concat(tween.getChildren(true, tweens, timelines)); + cnt = a.length; + } + } + tween = tween._next; + } + return a; + }; + + p.getTweensOf = function(target, nested) { + var disabled = this._gc, + a = [], + cnt = 0, + tweens, i; + if (disabled) { + this._enabled(true, true); //getTweensOf() filters out disabled tweens, and we have to mark them as _gc = true when the timeline completes in order to allow clean garbage collection, so temporarily re-enable the timeline here. + } + tweens = TweenLite.getTweensOf(target); + i = tweens.length; + while (--i > -1) { + if (tweens[i].timeline === this || (nested && this._contains(tweens[i]))) { + a[cnt++] = tweens[i]; + } + } + if (disabled) { + this._enabled(false, true); + } + return a; + }; + + p.recent = function() { + return this._recent; + }; + + p._contains = function(tween) { + var tl = tween.timeline; + while (tl) { + if (tl === this) { + return true; + } + tl = tl.timeline; + } + return false; + }; + + p.shiftChildren = function(amount, adjustLabels, ignoreBeforeTime) { + ignoreBeforeTime = ignoreBeforeTime || 0; + var tween = this._first, + labels = this._labels, + p; + while (tween) { + if (tween._startTime >= ignoreBeforeTime) { + tween._startTime += amount; + } + tween = tween._next; + } + if (adjustLabels) { + for (p in labels) { + if (labels[p] >= ignoreBeforeTime) { + labels[p] += amount; + } + } + } + return this._uncache(true); + }; + + p._kill = function(vars, target) { + if (!vars && !target) { + return this._enabled(false, false); + } + var tweens = (!target) ? this.getChildren(true, true, false) : this.getTweensOf(target), + i = tweens.length, + changed = false; + while (--i > -1) { + if (tweens[i]._kill(vars, target)) { + changed = true; + } + } + return changed; + }; + + p.clear = function(labels) { + var tweens = this.getChildren(false, true, true), + i = tweens.length; + this._time = this._totalTime = 0; + while (--i > -1) { + tweens[i]._enabled(false, false); + } + if (labels !== false) { + this._labels = {}; + } + return this._uncache(true); + }; + + p.invalidate = function() { + var tween = this._first; + while (tween) { + tween.invalidate(); + tween = tween._next; + } + return Animation.prototype.invalidate.call(this);; + }; + + p._enabled = function(enabled, ignoreTimeline) { + if (enabled === this._gc) { + var tween = this._first; + while (tween) { + tween._enabled(enabled, true); + tween = tween._next; + } + } + return SimpleTimeline.prototype._enabled.call(this, enabled, ignoreTimeline); + }; + + p.totalTime = function(time, suppressEvents, uncapped) { + this._forcingPlayhead = true; + var val = Animation.prototype.totalTime.apply(this, arguments); + this._forcingPlayhead = false; + return val; + }; + + p.duration = function(value) { + if (!arguments.length) { + if (this._dirty) { + this.totalDuration(); //just triggers recalculation + } + return this._duration; + } + if (this.duration() !== 0 && value !== 0) { + this.timeScale(this._duration / value); + } + return this; + }; + + p.totalDuration = function(value) { + if (!arguments.length) { + if (this._dirty) { + var max = 0, + self = this, + tween = self._last, + prevStart = 999999999999, + prev, end; + while (tween) { + prev = tween._prev; //record it here in case the tween changes position in the sequence... + if (tween._dirty) { + tween.totalDuration(); //could change the tween._startTime, so make sure the tween's cache is clean before analyzing it. + } + if (tween._startTime > prevStart && self._sortChildren && !tween._paused && !self._calculatingDuration) { //in case one of the tweens shifted out of order, it needs to be re-inserted into the correct position in the sequence + self._calculatingDuration = 1; //prevent endless recursive calls - there are methods that get triggered that check duration/totalDuration when we add(), like _parseTimeOrLabel(). + self.add(tween, tween._startTime - tween._delay); + self._calculatingDuration = 0; + } else { + prevStart = tween._startTime; + } + if (tween._startTime < 0 && !tween._paused) { //children aren't allowed to have negative startTimes unless smoothChildTiming is true, so adjust here if one is found. + max -= tween._startTime; + if (self._timeline.smoothChildTiming) { + self._startTime += tween._startTime / self._timeScale; + self._time -= tween._startTime; + self._totalTime -= tween._startTime; + self._rawPrevTime -= tween._startTime; + } + self.shiftChildren(-tween._startTime, false, -9999999999); + prevStart = 0; + } + end = tween._startTime + (tween._totalDuration / tween._timeScale); + if (end > max) { + max = end; + } + tween = prev; + } + self._duration = self._totalDuration = max; + self._dirty = false; + } + return this._totalDuration; + } + return (value && this.totalDuration()) ? this.timeScale(this._totalDuration / value) : this; + }; + + p.paused = function(value) { + if (value === false && this._paused) { //if there's a pause directly at the spot from where we're unpausing, skip it. + var tween = this._first; + while (tween) { + if (tween._startTime === this._time && tween.data === "isPause") { + tween._rawPrevTime = 0; //remember, _rawPrevTime is how zero-duration tweens/callbacks sense directionality and determine whether or not to fire. If _rawPrevTime is the same as _startTime on the next render, it won't fire. + } + tween = tween._next; + } + } + return Animation.prototype.paused.apply(this, arguments); + }; + + p.usesFrames = function() { + var tl = this._timeline; + while (tl._timeline) { + tl = tl._timeline; + } + return (tl === Animation._rootFramesTimeline); + }; + + p.rawTime = function(wrapRepeats) { + return (wrapRepeats && (this._paused || (this._repeat && this.time() > 0 && this.totalProgress() < 1))) ? this._totalTime % (this._duration + this._repeatDelay) : this._paused ? this._totalTime : (this._timeline.rawTime(wrapRepeats) - this._startTime) * this._timeScale; + }; + + return TimelineLite; + + }, true); + + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("./TweenLite.js"); //dependency + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("TimelineLite")); + +/*! + * VERSION: 2.1.0 + * DATE: 2019-02-11 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + _gsScope._gsDefine("TimelineMax", ["TimelineLite","TweenLite","easing.Ease"], function(TimelineLite, TweenLite, Ease) { + + var TimelineMax = function(vars) { + TimelineLite.call(this, vars); + this._repeat = this.vars.repeat || 0; + this._repeatDelay = this.vars.repeatDelay || 0; + this._cycle = 0; + this._yoyo = !!this.vars.yoyo; + this._dirty = true; + }, + _tinyNum = 0.00000001, + TweenLiteInternals = TweenLite._internals, + _lazyTweens = TweenLiteInternals.lazyTweens, + _lazyRender = TweenLiteInternals.lazyRender, + _globals = _gsScope._gsDefine.globals, + _easeNone = new Ease(null, null, 1, 0), + p = TimelineMax.prototype = new TimelineLite(); + + p.constructor = TimelineMax; + p.kill()._gc = false; + TimelineMax.version = "2.1.0"; + + p.invalidate = function() { + this._yoyo = !!this.vars.yoyo; + this._repeat = this.vars.repeat || 0; + this._repeatDelay = this.vars.repeatDelay || 0; + this._uncache(true); + return TimelineLite.prototype.invalidate.call(this); + }; + + p.addCallback = function(callback, position, params, scope) { + return this.add( TweenLite.delayedCall(0, callback, params, scope), position); + }; + + p.removeCallback = function(callback, position) { + if (callback) { + if (position == null) { + this._kill(null, callback); + } else { + var a = this.getTweensOf(callback, false), + i = a.length, + time = this._parseTimeOrLabel(position); + while (--i > -1) { + if (a[i]._startTime === time) { + a[i]._enabled(false, false); + } + } + } + } + return this; + }; + + p.removePause = function(position) { + return this.removeCallback(TimelineLite._internals.pauseCallback, position); + }; + + p.tweenTo = function(position, vars) { + vars = vars || {}; + var copy = {ease:_easeNone, useFrames:this.usesFrames(), immediateRender:false, lazy:false}, + Engine = (vars.repeat && _globals.TweenMax) || TweenLite, + duration, p, t; + for (p in vars) { + copy[p] = vars[p]; + } + copy.time = this._parseTimeOrLabel(position); + duration = (Math.abs(Number(copy.time) - this._time) / this._timeScale) || 0.001; + t = new Engine(this, duration, copy); + copy.onStart = function() { + t.target.paused(true); + if (t.vars.time !== t.target.time() && duration === t.duration() && !t.isFromTo) { //don't make the duration zero - if it's supposed to be zero, don't worry because it's already initting the tween and will complete immediately, effectively making the duration zero anyway. If we make duration zero, the tween won't run at all. + t.duration( Math.abs( t.vars.time - t.target.time()) / t.target._timeScale ).render(t.time(), true, true); //render() right away to ensure that things look right, especially in the case of .tweenTo(0). + } + if (vars.onStart) { //in case the user had an onStart in the vars - we don't want to overwrite it. + vars.onStart.apply(vars.onStartScope || vars.callbackScope || t, vars.onStartParams || []); //don't use t._callback("onStart") or it'll point to the copy.onStart and we'll get a recursion error. + } + }; + return t; + }; + + p.tweenFromTo = function(fromPosition, toPosition, vars) { + vars = vars || {}; + fromPosition = this._parseTimeOrLabel(fromPosition); + vars.startAt = {onComplete:this.seek, onCompleteParams:[fromPosition], callbackScope:this}; + vars.immediateRender = (vars.immediateRender !== false); + var t = this.tweenTo(toPosition, vars); + t.isFromTo = 1; //to ensure we don't mess with the duration in the onStart (we've got the start and end values here, so lock it in) + return t.duration((Math.abs( t.vars.time - fromPosition) / this._timeScale) || 0.001); + }; + + p.render = function(time, suppressEvents, force) { + if (this._gc) { + this._enabled(true, false); + } + var self = this, + prevTime = self._time, + totalDur = (!self._dirty) ? self._totalDuration : self.totalDuration(), + dur = self._duration, + prevTotalTime = self._totalTime, + prevStart = self._startTime, + prevTimeScale = self._timeScale, + prevRawPrevTime = self._rawPrevTime, + prevPaused = self._paused, + prevCycle = self._cycle, + tween, isComplete, next, callback, internalForce, cycleDuration, pauseTween, curTime, pauseTime; + if (prevTime !== self._time) { //if totalDuration() finds a child with a negative startTime and smoothChildTiming is true, things get shifted around internally so we need to adjust the time accordingly. For example, if a tween starts at -30 we must shift EVERYTHING forward 30 seconds and move this timeline's startTime backward by 30 seconds so that things align with the playhead (no jump). + time += self._time - prevTime; + } + if (time >= totalDur - _tinyNum && time >= 0) { //to work around occasional floating point math artifacts. + if (!self._locked) { + self._totalTime = totalDur; + self._cycle = self._repeat; + } + if (!self._reversed) if (!self._hasPausedChild()) { + isComplete = true; + callback = "onComplete"; + internalForce = !!self._timeline.autoRemoveChildren; //otherwise, if the animation is unpaused/activated after it's already finished, it doesn't get removed from the parent timeline. + if (self._duration === 0) if ((time <= 0 && time >= -_tinyNum) || prevRawPrevTime < 0 || prevRawPrevTime === _tinyNum) if (prevRawPrevTime !== time && self._first) { + internalForce = true; + if (prevRawPrevTime > _tinyNum) { + callback = "onReverseComplete"; + } + } + } + self._rawPrevTime = (self._duration || !suppressEvents || time || self._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient. + if (self._yoyo && (self._cycle & 1)) { + self._time = time = 0; + } else { + self._time = dur; + time = dur + 0.0001; //to avoid occasional floating point rounding errors - sometimes child tweens/timelines were not being fully completed (their progress might be 0.999999999999998 instead of 1 because when _time - tween._startTime is performed, floating point errors would return a value that was SLIGHTLY off). Try (999999999999.7 - 999999999999) * 1 = 0.699951171875 instead of 0.7. We cannot do less then 0.0001 because the same issue can occur when the duration is extremely large like 999999999999 in which case adding 0.00000001, for example, causes it to act like nothing was added. + } + + } else if (time < _tinyNum) { //to work around occasional floating point math artifacts, round super small values to 0. + if (!self._locked) { + self._totalTime = self._cycle = 0; + } + self._time = 0; + if (time > -_tinyNum) { + time = 0; + } + if (prevTime !== 0 || (dur === 0 && prevRawPrevTime !== _tinyNum && (prevRawPrevTime > 0 || (time < 0 && prevRawPrevTime >= 0)) && !self._locked)) { //edge case for checking time < 0 && prevRawPrevTime >= 0: a zero-duration fromTo() tween inside a zero-duration timeline (yeah, very rare) + callback = "onReverseComplete"; + isComplete = self._reversed; + } + if (time < 0) { + self._active = false; + if (self._timeline.autoRemoveChildren && self._reversed) { + internalForce = isComplete = true; + callback = "onReverseComplete"; + } else if (prevRawPrevTime >= 0 && self._first) { //when going back beyond the start, force a render so that zero-duration tweens that sit at the very beginning render their start values properly. Otherwise, if the parent timeline's playhead lands exactly at this timeline's startTime, and then moves backwards, the zero-duration tweens at the beginning would still be at their end state. + internalForce = true; + } + self._rawPrevTime = time; + } else { + self._rawPrevTime = (dur || !suppressEvents || time || self._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient. + if (time === 0 && isComplete) { //if there's a zero-duration tween at the very beginning of a timeline and the playhead lands EXACTLY at time 0, that tween will correctly render its end values, but we need to keep the timeline alive for one more render so that the beginning values render properly as the parent's playhead keeps moving beyond the begining. Imagine obj.x starts at 0 and then we do tl.set(obj, {x:100}).to(obj, 1, {x:200}) and then later we tl.reverse()...the goal is to have obj.x revert to 0. If the playhead happens to land on exactly 0, without this chunk of code, it'd complete the timeline and remove it from the rendering queue (not good). + tween = self._first; + while (tween && tween._startTime === 0) { + if (!tween._duration) { + isComplete = false; + } + tween = tween._next; + } + } + time = 0; //to avoid occasional floating point rounding errors (could cause problems especially with zero-duration tweens at the very beginning of the timeline) + if (!self._initted) { + internalForce = true; + } + } + + } else { + if (dur === 0 && prevRawPrevTime < 0) { //without this, zero-duration repeating timelines (like with a simple callback nested at the very beginning and a repeatDelay) wouldn't render the first time through. + internalForce = true; + } + self._time = self._rawPrevTime = time; + if (!self._locked) { + self._totalTime = time; + if (self._repeat !== 0) { + cycleDuration = dur + self._repeatDelay; + self._cycle = (self._totalTime / cycleDuration) >> 0; //originally _totalTime % cycleDuration but floating point errors caused problems, so I normalized it. (4 % 0.8 should be 0 but it gets reported as 0.79999999!) + if (self._cycle) if (self._cycle === self._totalTime / cycleDuration && prevTotalTime <= time) { + self._cycle--; //otherwise when rendered exactly at the end time, it will act as though it is repeating (at the beginning) + } + self._time = self._totalTime - (self._cycle * cycleDuration); + if (self._yoyo) if (self._cycle & 1) { + self._time = dur - self._time; + } + if (self._time > dur) { + self._time = dur; + time = dur + 0.0001; //to avoid occasional floating point rounding error + } else if (self._time < 0) { + self._time = time = 0; + } else { + time = self._time; + } + } + } + + if (self._hasPause && !self._forcingPlayhead && !suppressEvents) { + time = self._time; + if (time >= prevTime || (self._repeat && prevCycle !== self._cycle)) { + tween = self._first; + while (tween && tween._startTime <= time && !pauseTween) { + if (!tween._duration) if (tween.data === "isPause" && !tween.ratio && !(tween._startTime === 0 && self._rawPrevTime === 0)) { + pauseTween = tween; + } + tween = tween._next; + } + } else { + tween = self._last; + while (tween && tween._startTime >= time && !pauseTween) { + if (!tween._duration) if (tween.data === "isPause" && tween._rawPrevTime > 0) { + pauseTween = tween; + } + tween = tween._prev; + } + } + if (pauseTween) { + pauseTime = self._startTime + (pauseTween._startTime / self._timeScale); + if (pauseTween._startTime < dur) { + self._time = self._rawPrevTime = time = pauseTween._startTime; + self._totalTime = time + (self._cycle * (self._totalDuration + self._repeatDelay)); + } + } + } + + } + + if (self._cycle !== prevCycle) if (!self._locked) { + /* + make sure children at the end/beginning of the timeline are rendered properly. If, for example, + a 3-second long timeline rendered at 2.9 seconds previously, and now renders at 3.2 seconds (which + would get translated to 2.8 seconds if the timeline yoyos or 0.2 seconds if it just repeats), there + could be a callback or a short tween that's at 2.95 or 3 seconds in which wouldn't render. So + we need to push the timeline to the end (and/or beginning depending on its yoyo value). Also we must + ensure that zero-duration tweens at the very beginning or end of the TimelineMax work. + */ + var backwards = (self._yoyo && (prevCycle & 1) !== 0), + wrap = (backwards === (self._yoyo && (self._cycle & 1) !== 0)), + recTotalTime = self._totalTime, + recCycle = self._cycle, + recRawPrevTime = self._rawPrevTime, + recTime = self._time; + + self._totalTime = prevCycle * dur; + if (self._cycle < prevCycle) { + backwards = !backwards; + } else { + self._totalTime += dur; + } + self._time = prevTime; //temporarily revert _time so that render() renders the children in the correct order. Without this, tweens won't rewind correctly. We could arhictect things in a "cleaner" way by splitting out the rendering queue into a separate method but for performance reasons, we kept it all inside this method. + + self._rawPrevTime = (dur === 0) ? prevRawPrevTime - 0.0001 : prevRawPrevTime; + self._cycle = prevCycle; + self._locked = true; //prevents changes to totalTime and skips repeat/yoyo behavior when we recursively call render() + prevTime = (backwards) ? 0 : dur; + self.render(prevTime, suppressEvents, (dur === 0)); + if (!suppressEvents) if (!self._gc) { + if (self.vars.onRepeat) { + self._cycle = recCycle; //in case the onRepeat alters the playhead or invalidates(), we shouldn't stay locked or use the previous cycle. + self._locked = false; + self._callback("onRepeat"); + } + } + if (prevTime !== self._time) { //in case there's a callback like onComplete in a nested tween/timeline that changes the playhead position, like via seek(), we should just abort. + return; + } + if (wrap) { + self._cycle = prevCycle; //if there's an onRepeat, we reverted this above, so make sure it's set properly again. We also unlocked in that scenario, so reset that too. + self._locked = true; + prevTime = (backwards) ? dur + 0.0001 : -0.0001; + self.render(prevTime, true, false); + } + self._locked = false; + if (self._paused && !prevPaused) { //if the render() triggered callback that paused this timeline, we should abort (very rare, but possible) + return; + } + self._time = recTime; + self._totalTime = recTotalTime; + self._cycle = recCycle; + self._rawPrevTime = recRawPrevTime; + } + + if ((self._time === prevTime || !self._first) && !force && !internalForce && !pauseTween) { + if (prevTotalTime !== self._totalTime) if (self._onUpdate) if (!suppressEvents) { //so that onUpdate fires even during the repeatDelay - as long as the totalTime changed, we should trigger onUpdate. + self._callback("onUpdate"); + } + return; + } else if (!self._initted) { + self._initted = true; + } + + if (!self._active) if (!self._paused && self._totalTime !== prevTotalTime && time > 0) { + self._active = true; //so that if the user renders the timeline (as opposed to the parent timeline rendering it), it is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the timeline already finished but the user manually re-renders it as halfway done, for example. + } + + if (prevTotalTime === 0) if (self.vars.onStart) if (self._totalTime !== 0 || !self._totalDuration) if (!suppressEvents) { + self._callback("onStart"); + } + + curTime = self._time; + if (curTime >= prevTime) { + tween = self._first; + while (tween) { + next = tween._next; //record it here because the value could change after rendering... + if (curTime !== self._time || (self._paused && !prevPaused)) { //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete + break; + } else if (tween._active || (tween._startTime <= self._time && !tween._paused && !tween._gc)) { + if (pauseTween === tween) { + self.pause(); + self._pauseTime = pauseTime; //so that when we resume(), it's starting from exactly the right spot (the pause() method uses the rawTime for the parent, but that may be a bit too far ahead) + } + if (!tween._reversed) { + tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force); + } else { + tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force); + } + } + tween = next; + } + } else { + tween = self._last; + while (tween) { + next = tween._prev; //record it here because the value could change after rendering... + if (curTime !== self._time || (self._paused && !prevPaused)) { //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete + break; + } else if (tween._active || (tween._startTime <= prevTime && !tween._paused && !tween._gc)) { + if (pauseTween === tween) { + pauseTween = tween._prev; //the linked list is organized by _startTime, thus it's possible that a tween could start BEFORE the pause and end after it, in which case it would be positioned before the pause tween in the linked list, but we should render it before we pause() the timeline and cease rendering. This is only a concern when going in reverse. + while (pauseTween && pauseTween.endTime() > self._time) { + pauseTween.render( (pauseTween._reversed ? pauseTween.totalDuration() - ((time - pauseTween._startTime) * pauseTween._timeScale) : (time - pauseTween._startTime) * pauseTween._timeScale), suppressEvents, force); + pauseTween = pauseTween._prev; + } + pauseTween = null; + self.pause(); + self._pauseTime = pauseTime; //so that when we resume(), it's starting from exactly the right spot (the pause() method uses the rawTime for the parent, but that may be a bit too far ahead) + } + if (!tween._reversed) { + tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force); + } else { + tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force); + } + } + tween = next; + } + } + + if (self._onUpdate) if (!suppressEvents) { + if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onUpdate on a timeline that reports/checks tweened values. + _lazyRender(); + } + self._callback("onUpdate"); + } + if (callback) if (!self._locked) if (!self._gc) if (prevStart === self._startTime || prevTimeScale !== self._timeScale) if (self._time === 0 || totalDur >= self.totalDuration()) { //if one of the tweens that was rendered altered this timeline's startTime (like if an onComplete reversed the timeline), it probably isn't complete. If it is, don't worry, because whatever call altered the startTime would complete if it was necessary at the new time. The only exception is the timeScale property. Also check _gc because there's a chance that kill() could be called in an onUpdate + if (isComplete) { + if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onComplete on a timeline that reports/checks tweened values. + _lazyRender(); + } + if (self._timeline.autoRemoveChildren) { + self._enabled(false, false); + } + self._active = false; + } + if (!suppressEvents && self.vars[callback]) { + self._callback(callback); + } + } + }; + + p.getActive = function(nested, tweens, timelines) { + var a = [], + all = this.getChildren(nested || (nested == null), tweens || (nested == null), !!timelines), + cnt = 0, + l = all.length, + i, tween; + for (i = 0; i < l; i++) { + tween = all[i]; + if (tween.isActive()) { + a[cnt++] = tween; + } + } + return a; + }; + + + p.getLabelAfter = function(time) { + if (!time) if (time !== 0) { //faster than isNan() + time = this._time; + } + var labels = this.getLabelsArray(), + l = labels.length, + i; + for (i = 0; i < l; i++) { + if (labels[i].time > time) { + return labels[i].name; + } + } + return null; + }; + + p.getLabelBefore = function(time) { + if (time == null) { + time = this._time; + } + var labels = this.getLabelsArray(), + i = labels.length; + while (--i > -1) { + if (labels[i].time < time) { + return labels[i].name; + } + } + return null; + }; + + p.getLabelsArray = function() { + var a = [], + cnt = 0, + p; + for (p in this._labels) { + a[cnt++] = {time:this._labels[p], name:p}; + } + a.sort(function(a,b) { + return a.time - b.time; + }); + return a; + }; + + p.invalidate = function() { + this._locked = false; //unlock and set cycle in case invalidate() is called from inside an onRepeat + return TimelineLite.prototype.invalidate.call(this); + }; + + +//---- GETTERS / SETTERS ------------------------------------------------------------------------------------------------------- + + p.progress = function(value, suppressEvents) { + return (!arguments.length) ? (this._time / this.duration()) || 0 : this.totalTime( this.duration() * ((this._yoyo && (this._cycle & 1) !== 0) ? 1 - value : value) + (this._cycle * (this._duration + this._repeatDelay)), suppressEvents); + }; + + p.totalProgress = function(value, suppressEvents) { + return (!arguments.length) ? (this._totalTime / this.totalDuration()) || 0 : this.totalTime( this.totalDuration() * value, suppressEvents); + }; + + p.totalDuration = function(value) { + if (!arguments.length) { + if (this._dirty) { + TimelineLite.prototype.totalDuration.call(this); //just forces refresh + //Instead of Infinity, we use 999999999999 so that we can accommodate reverses. + this._totalDuration = (this._repeat === -1) ? 999999999999 : this._duration * (this._repeat + 1) + (this._repeatDelay * this._repeat); + } + return this._totalDuration; + } + return (this._repeat === -1 || !value) ? this : this.timeScale( this.totalDuration() / value ); + }; + + p.time = function(value, suppressEvents) { + if (!arguments.length) { + return this._time; + } + if (this._dirty) { + this.totalDuration(); + } + var duration = this._duration, + cycle = this._cycle, + cycleDur = cycle * (duration * this._repeatDelay); + if (value > duration) { + value = duration; + } + return this.totalTime((this._yoyo && (cycle & 1)) ? duration - value + cycleDur : this._repeat ? value + cycleDur : value, suppressEvents); + }; + + p.repeat = function(value) { + if (!arguments.length) { + return this._repeat; + } + this._repeat = value; + return this._uncache(true); + }; + + p.repeatDelay = function(value) { + if (!arguments.length) { + return this._repeatDelay; + } + this._repeatDelay = value; + return this._uncache(true); + }; + + p.yoyo = function(value) { + if (!arguments.length) { + return this._yoyo; + } + this._yoyo = value; + return this; + }; + + p.currentLabel = function(value) { + if (!arguments.length) { + return this.getLabelBefore(this._time + _tinyNum); + } + return this.seek(value, true); + }; + + return TimelineMax; + + }, true); + + + + + + + +/* + * ---------------------------------------------------------------- + * TimelineLite + * ---------------------------------------------------------------- + */ + + _gsScope._gsDefine("TimelineLite", ["core.Animation","core.SimpleTimeline","TweenLite"], function(Animation, SimpleTimeline, TweenLite) { + + var TimelineLite = function(vars) { + SimpleTimeline.call(this, vars); + var self = this, + v = self.vars, + val, p; + self._labels = {}; + self.autoRemoveChildren = !!v.autoRemoveChildren; + self.smoothChildTiming = !!v.smoothChildTiming; + self._sortChildren = true; + self._onUpdate = v.onUpdate; + for (p in v) { + val = v[p]; + if (_isArray(val)) if (val.join("").indexOf("{self}") !== -1) { + v[p] = self._swapSelfInParams(val); + } + } + if (_isArray(v.tweens)) { + self.add(v.tweens, 0, v.align, v.stagger); + } + }, + _tinyNum = 0.00000001, + TweenLiteInternals = TweenLite._internals, + _internals = TimelineLite._internals = {}, + _isSelector = TweenLiteInternals.isSelector, + _isArray = TweenLiteInternals.isArray, + _lazyTweens = TweenLiteInternals.lazyTweens, + _lazyRender = TweenLiteInternals.lazyRender, + _globals = _gsScope._gsDefine.globals, + _copy = function(vars) { + var copy = {}, p; + for (p in vars) { + copy[p] = vars[p]; + } + return copy; + }, + _applyCycle = function(vars, targets, i) { + var alt = vars.cycle, + p, val; + for (p in alt) { + val = alt[p]; + vars[p] = (typeof(val) === "function") ? val(i, targets[i], targets) : val[i % val.length]; + } + delete vars.cycle; + }, + _pauseCallback = _internals.pauseCallback = function() {}, + _slice = function(a) { //don't use [].slice because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll() + var b = [], + l = a.length, + i; + for (i = 0; i !== l; b.push(a[i++])); + return b; + }, + _defaultImmediateRender = function(tl, toVars, fromVars, defaultFalse) { //default to immediateRender:true unless otherwise set in toVars, fromVars or if defaultFalse is passed in as true + var ir = "immediateRender"; + if (!(ir in toVars)) { + toVars[ir] = !(tl._paused || (fromVars && fromVars[ir] === false) || defaultFalse); + } + return toVars; + }, + //for distributing values across an array. Can accept a number, a function or (most commonly) a function which can contain the following properties: {base, amount, from, ease, grid, axis, length}. Returns a function that expects the following parameters: index, target, array. Recognizes the following + _distribute = function(v) { + if (typeof(v) === "function") { + return v; + } + var vars = isNaN(v) ? v : {n:1, from:(v < 0) ? ((v = -v) && "end") : 0}, //n:1 is just to indicate v was a number; we leverage that later to set v according to the length we get. If a number is passed in, we treat it like the old stagger value where 0.1, for example, would mean that things would be distributed with 0.1 between each element in the array rather than a total "amount" that's chunked out among them all. + ease = vars.ease, + from = vars.from || 0, + base = vars.base || 0, + cache = {}, + isFromKeyword = isNaN(from), + axis = vars.axis, + ratio = {center:0.5, end:1}[from] || 0; + return function(i, target, a) { + var l = (a || vars).length, + distances = cache[l], + originX, originY, x, y, d, j, max, min, wrap; + if (!distances) { + wrap = (vars.grid === "auto") ? 0 : (vars.grid || [Infinity])[0]; + if (!wrap) { + max = -Infinity; + while (max < (max = a[wrap++].getBoundingClientRect().left) && wrap < l) { } + wrap--; + } + distances = cache[l] = []; + originX = isFromKeyword ? (Math.min(wrap, l) * ratio) - 0.5 : from % wrap; + originY = isFromKeyword ? l * ratio / wrap - 0.5 : (from / wrap) | 0; + max = 0; + min = Infinity; + for (j = 0; j < l; j++) { + x = (j % wrap) - originX; + y = originY - ((j / wrap) | 0); + distances[j] = d = !axis ? Math.sqrt(x * x + y * y) : Math.abs((axis === "y") ? y : x); + if (d > max) { + max = d; + } + if (d < min) { + min = d; + } + } + distances.max = max - min; + distances.min = min; + distances.v = vars.n ? l * (v || 0) : vars.amount; + } + l = (distances[i] - distances.min) / distances.max; + return base + (ease ? ease.getRatio(l) : l) * distances.v; + }; + }, + p = TimelineLite.prototype = new SimpleTimeline(); + + TimelineLite.version = "2.1.0"; + TimelineLite.distribute = _distribute; + p.constructor = TimelineLite; + p.kill()._gc = p._forcingPlayhead = p._hasPause = false; + + /* might use later... + //translates a local time inside an animation to the corresponding time on the root/global timeline, factoring in all nesting and timeScales. + function localToGlobal(time, animation) { + while (animation) { + time = (time / animation._timeScale) + animation._startTime; + animation = animation.timeline; + } + return time; + } + + //translates the supplied time on the root/global timeline into the corresponding local time inside a particular animation, factoring in all nesting and timeScales + function globalToLocal(time, animation) { + var scale = 1; + time -= localToGlobal(0, animation); + while (animation) { + scale *= animation._timeScale; + animation = animation.timeline; + } + return time * scale; + } + */ + + p.to = function(target, duration, vars, position) { + var Engine = (vars.repeat && _globals.TweenMax) || TweenLite; + return duration ? this.add( new Engine(target, duration, vars), position) : this.set(target, vars, position); + }; + + p.from = function(target, duration, vars, position) { + return this.add( ((vars.repeat && _globals.TweenMax) || TweenLite).from(target, duration, _defaultImmediateRender(this, vars)), position); + }; + + p.fromTo = function(target, duration, fromVars, toVars, position) { + var Engine = (toVars.repeat && _globals.TweenMax) || TweenLite; + toVars = _defaultImmediateRender(this, toVars, fromVars); + return duration ? this.add( Engine.fromTo(target, duration, fromVars, toVars), position) : this.set(target, toVars, position); + }; + + p.staggerTo = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) { + var tl = new TimelineLite({onComplete:onCompleteAll, onCompleteParams:onCompleteAllParams, callbackScope:onCompleteAllScope, smoothChildTiming:this.smoothChildTiming}), + staggerFunc = _distribute(vars.stagger || stagger), + startAt = vars.startAt, + cycle = vars.cycle, + copy, i; + if (typeof(targets) === "string") { + targets = TweenLite.selector(targets) || targets; + } + targets = targets || []; + if (_isSelector(targets)) { //if the targets object is a selector, translate it into an array. + targets = _slice(targets); + } + for (i = 0; i < targets.length; i++) { + copy = _copy(vars); + if (startAt) { + copy.startAt = _copy(startAt); + if (startAt.cycle) { + _applyCycle(copy.startAt, targets, i); + } + } + if (cycle) { + _applyCycle(copy, targets, i); + if (copy.duration != null) { + duration = copy.duration; + delete copy.duration; + } + } + tl.to(targets[i], duration, copy, staggerFunc(i, targets[i], targets)); + } + return this.add(tl, position); + }; + + p.staggerFrom = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) { + vars.runBackwards = true; + return this.staggerTo(targets, duration, _defaultImmediateRender(this, vars), stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope); + }; + + p.staggerFromTo = function(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) { + toVars.startAt = fromVars; + return this.staggerTo(targets, duration, _defaultImmediateRender(this, toVars, fromVars), stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope); + }; + + p.call = function(callback, params, scope, position) { + return this.add( TweenLite.delayedCall(0, callback, params, scope), position); + }; + + p.set = function(target, vars, position) { + return this.add( new TweenLite(target, 0, _defaultImmediateRender(this, vars, null, true)), position); + }; + + TimelineLite.exportRoot = function(vars, ignoreDelayedCalls) { + vars = vars || {}; + if (vars.smoothChildTiming == null) { + vars.smoothChildTiming = true; + } + var tl = new TimelineLite(vars), + root = tl._timeline, + hasNegativeStart, time, tween, next; + if (ignoreDelayedCalls == null) { + ignoreDelayedCalls = true; + } + root._remove(tl, true); + tl._startTime = 0; + tl._rawPrevTime = tl._time = tl._totalTime = root._time; + tween = root._first; + while (tween) { + next = tween._next; + if (!ignoreDelayedCalls || !(tween instanceof TweenLite && tween.target === tween.vars.onComplete)) { + time = tween._startTime - tween._delay; + if (time < 0) { + hasNegativeStart = 1; + } + tl.add(tween, time); + } + tween = next; + } + root.add(tl, 0); + if (hasNegativeStart) { //calling totalDuration() will force the adjustment necessary to shift the children forward so none of them start before zero, and moves the timeline backwards the same amount, so the playhead is still aligned where it should be globally, but the timeline doesn't have illegal children that start before zero. + tl.totalDuration(); + } + return tl; + }; + + p.add = function(value, position, align, stagger) { + var self = this, + curTime, l, i, child, tl, beforeRawTime; + if (typeof(position) !== "number") { + position = self._parseTimeOrLabel(position, 0, true, value); + } + if (!(value instanceof Animation)) { + if ((value instanceof Array) || (value && value.push && _isArray(value))) { + align = align || "normal"; + stagger = stagger || 0; + curTime = position; + l = value.length; + for (i = 0; i < l; i++) { + if (_isArray(child = value[i])) { + child = new TimelineLite({tweens:child}); + } + self.add(child, curTime); + if (typeof(child) !== "string" && typeof(child) !== "function") { + if (align === "sequence") { + curTime = child._startTime + (child.totalDuration() / child._timeScale); + } else if (align === "start") { + child._startTime -= child.delay(); + } + } + curTime += stagger; + } + return self._uncache(true); + } else if (typeof(value) === "string") { + return self.addLabel(value, position); + } else if (typeof(value) === "function") { + value = TweenLite.delayedCall(0, value); + } else { + throw("Cannot add " + value + " into the timeline; it is not a tween, timeline, function, or string."); + } + } + + SimpleTimeline.prototype.add.call(self, value, position); + + if (value._time || (!value._duration && value._initted)) { //in case, for example, the _startTime is moved on a tween that has already rendered. Imagine it's at its end state, then the startTime is moved WAY later (after the end of this timeline), it should render at its beginning. + curTime = (self.rawTime() - value._startTime) * value._timeScale; + if (!value._duration || Math.abs(Math.max(0, Math.min(value.totalDuration(), curTime))) - value._totalTime > 0.00001) { + value.render(curTime, false, false); + } + } + + //if the timeline has already ended but the inserted tween/timeline extends the duration, we should enable this timeline again so that it renders properly. We should also align the playhead with the parent timeline's when appropriate. + if (self._gc || self._time === self._duration) if (!self._paused) if (self._duration < self.duration()) { + //in case any of the ancestors had completed but should now be enabled... + tl = self; + beforeRawTime = (tl.rawTime() > value._startTime); //if the tween is placed on the timeline so that it starts BEFORE the current rawTime, we should align the playhead (move the timeline). This is because sometimes users will create a timeline, let it finish, and much later append a tween and expect it to run instead of jumping to its end state. While technically one could argue that it should jump to its end state, that's not what users intuitively expect. + while (tl._timeline) { + if (beforeRawTime && tl._timeline.smoothChildTiming) { + tl.totalTime(tl._totalTime, true); //moves the timeline (shifts its startTime) if necessary, and also enables it. + } else if (tl._gc) { + tl._enabled(true, false); + } + tl = tl._timeline; + } + } + + return self; + }; + + p.remove = function(value) { + if (value instanceof Animation) { + this._remove(value, false); + var tl = value._timeline = value.vars.useFrames ? Animation._rootFramesTimeline : Animation._rootTimeline; //now that it's removed, default it to the root timeline so that if it gets played again, it doesn't jump back into this timeline. + value._startTime = (value._paused ? value._pauseTime : tl._time) - ((!value._reversed ? value._totalTime : value.totalDuration() - value._totalTime) / value._timeScale); //ensure that if it gets played again, the timing is correct. + return this; + } else if (value instanceof Array || (value && value.push && _isArray(value))) { + var i = value.length; + while (--i > -1) { + this.remove(value[i]); + } + return this; + } else if (typeof(value) === "string") { + return this.removeLabel(value); + } + return this.kill(null, value); + }; + + p._remove = function(tween, skipDisable) { + SimpleTimeline.prototype._remove.call(this, tween, skipDisable); + var last = this._last; + if (!last) { + this._time = this._totalTime = this._duration = this._totalDuration = 0; + } else if (this._time > this.duration()) { + this._time = this._duration; + this._totalTime = this._totalDuration; + } + return this; + }; + + p.append = function(value, offsetOrLabel) { + return this.add(value, this._parseTimeOrLabel(null, offsetOrLabel, true, value)); + }; + + p.insert = p.insertMultiple = function(value, position, align, stagger) { + return this.add(value, position || 0, align, stagger); + }; + + p.appendMultiple = function(tweens, offsetOrLabel, align, stagger) { + return this.add(tweens, this._parseTimeOrLabel(null, offsetOrLabel, true, tweens), align, stagger); + }; + + p.addLabel = function(label, position) { + this._labels[label] = this._parseTimeOrLabel(position); + return this; + }; + + p.addPause = function(position, callback, params, scope) { + var t = TweenLite.delayedCall(0, _pauseCallback, params, scope || this); + t.vars.onComplete = t.vars.onReverseComplete = callback; + t.data = "isPause"; + this._hasPause = true; + return this.add(t, position); + }; + + p.removeLabel = function(label) { + delete this._labels[label]; + return this; + }; + + p.getLabelTime = function(label) { + return (this._labels[label] != null) ? this._labels[label] : -1; + }; + + p._parseTimeOrLabel = function(timeOrLabel, offsetOrLabel, appendIfAbsent, ignore) { + var clippedDuration, i; + //if we're about to add a tween/timeline (or an array of them) that's already a child of this timeline, we should remove it first so that it doesn't contaminate the duration(). + if (ignore instanceof Animation && ignore.timeline === this) { + this.remove(ignore); + } else if (ignore && ((ignore instanceof Array) || (ignore.push && _isArray(ignore)))) { + i = ignore.length; + while (--i > -1) { + if (ignore[i] instanceof Animation && ignore[i].timeline === this) { + this.remove(ignore[i]); + } + } + } + clippedDuration = (typeof(timeOrLabel) === "number" && !offsetOrLabel) ? 0 : (this.duration() > 99999999999) ? this.recent().endTime(false) : this._duration; //in case there's a child that infinitely repeats, users almost never intend for the insertion point of a new child to be based on a SUPER long value like that so we clip it and assume the most recently-added child's endTime should be used instead. + if (typeof(offsetOrLabel) === "string") { + return this._parseTimeOrLabel(offsetOrLabel, (appendIfAbsent && typeof(timeOrLabel) === "number" && this._labels[offsetOrLabel] == null) ? timeOrLabel - clippedDuration : 0, appendIfAbsent); + } + offsetOrLabel = offsetOrLabel || 0; + if (typeof(timeOrLabel) === "string" && (isNaN(timeOrLabel) || this._labels[timeOrLabel] != null)) { //if the string is a number like "1", check to see if there's a label with that name, otherwise interpret it as a number (absolute value). + i = timeOrLabel.indexOf("="); + if (i === -1) { + if (this._labels[timeOrLabel] == null) { + return appendIfAbsent ? (this._labels[timeOrLabel] = clippedDuration + offsetOrLabel) : offsetOrLabel; + } + return this._labels[timeOrLabel] + offsetOrLabel; + } + offsetOrLabel = parseInt(timeOrLabel.charAt(i-1) + "1", 10) * Number(timeOrLabel.substr(i+1)); + timeOrLabel = (i > 1) ? this._parseTimeOrLabel(timeOrLabel.substr(0, i-1), 0, appendIfAbsent) : clippedDuration; + } else if (timeOrLabel == null) { + timeOrLabel = clippedDuration; + } + return Number(timeOrLabel) + offsetOrLabel; + }; + + p.seek = function(position, suppressEvents) { + return this.totalTime((typeof(position) === "number") ? position : this._parseTimeOrLabel(position), (suppressEvents !== false)); + }; + + p.stop = function() { + return this.paused(true); + }; + + p.gotoAndPlay = function(position, suppressEvents) { + return this.play(position, suppressEvents); + }; + + p.gotoAndStop = function(position, suppressEvents) { + return this.pause(position, suppressEvents); + }; + + p.render = function(time, suppressEvents, force) { + if (this._gc) { + this._enabled(true, false); + } + var self = this, + prevTime = self._time, + totalDur = (!self._dirty) ? self._totalDuration : self.totalDuration(), + prevStart = self._startTime, + prevTimeScale = self._timeScale, + prevPaused = self._paused, + tween, isComplete, next, callback, internalForce, pauseTween, curTime, pauseTime; + if (prevTime !== self._time) { //if totalDuration() finds a child with a negative startTime and smoothChildTiming is true, things get shifted around internally so we need to adjust the time accordingly. For example, if a tween starts at -30 we must shift EVERYTHING forward 30 seconds and move this timeline's startTime backward by 30 seconds so that things align with the playhead (no jump). + time += self._time - prevTime; + } + if (time >= totalDur - _tinyNum && time >= 0) { //to work around occasional floating point math artifacts. + self._totalTime = self._time = totalDur; + if (!self._reversed) if (!self._hasPausedChild()) { + isComplete = true; + callback = "onComplete"; + internalForce = !!self._timeline.autoRemoveChildren; //otherwise, if the animation is unpaused/activated after it's already finished, it doesn't get removed from the parent timeline. + if (self._duration === 0) if ((time <= 0 && time >= -_tinyNum) || self._rawPrevTime < 0 || self._rawPrevTime === _tinyNum) if (self._rawPrevTime !== time && self._first) { + internalForce = true; + if (self._rawPrevTime > _tinyNum) { + callback = "onReverseComplete"; + } + } + } + self._rawPrevTime = (self._duration || !suppressEvents || time || self._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient. + time = totalDur + 0.0001; //to avoid occasional floating point rounding errors - sometimes child tweens/timelines were not being fully completed (their progress might be 0.999999999999998 instead of 1 because when _time - tween._startTime is performed, floating point errors would return a value that was SLIGHTLY off). Try (999999999999.7 - 999999999999) * 1 = 0.699951171875 instead of 0.7. + + } else if (time < _tinyNum) { //to work around occasional floating point math artifacts, round super small values to 0. + self._totalTime = self._time = 0; + if (time > -_tinyNum) { + time = 0; + } + if (prevTime !== 0 || (self._duration === 0 && self._rawPrevTime !== _tinyNum && (self._rawPrevTime > 0 || (time < 0 && self._rawPrevTime >= 0)))) { + callback = "onReverseComplete"; + isComplete = self._reversed; + } + if (time < 0) { + self._active = false; + if (self._timeline.autoRemoveChildren && self._reversed) { //ensures proper GC if a timeline is resumed after it's finished reversing. + internalForce = isComplete = true; + callback = "onReverseComplete"; + } else if (self._rawPrevTime >= 0 && self._first) { //when going back beyond the start, force a render so that zero-duration tweens that sit at the very beginning render their start values properly. Otherwise, if the parent timeline's playhead lands exactly at this timeline's startTime, and then moves backwards, the zero-duration tweens at the beginning would still be at their end state. + internalForce = true; + } + self._rawPrevTime = time; + } else { + self._rawPrevTime = (self._duration || !suppressEvents || time || self._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient. + if (time === 0 && isComplete) { //if there's a zero-duration tween at the very beginning of a timeline and the playhead lands EXACTLY at time 0, that tween will correctly render its end values, but we need to keep the timeline alive for one more render so that the beginning values render properly as the parent's playhead keeps moving beyond the begining. Imagine obj.x starts at 0 and then we do tl.set(obj, {x:100}).to(obj, 1, {x:200}) and then later we tl.reverse()...the goal is to have obj.x revert to 0. If the playhead happens to land on exactly 0, without this chunk of code, it'd complete the timeline and remove it from the rendering queue (not good). + tween = self._first; + while (tween && tween._startTime === 0) { + if (!tween._duration) { + isComplete = false; + } + tween = tween._next; + } + } + time = 0; //to avoid occasional floating point rounding errors (could cause problems especially with zero-duration tweens at the very beginning of the timeline) + if (!self._initted) { + internalForce = true; + } + } + + } else { + + if (self._hasPause && !self._forcingPlayhead && !suppressEvents) { + if (time >= prevTime) { + tween = self._first; + while (tween && tween._startTime <= time && !pauseTween) { + if (!tween._duration) if (tween.data === "isPause" && !tween.ratio && !(tween._startTime === 0 && self._rawPrevTime === 0)) { + pauseTween = tween; + } + tween = tween._next; + } + } else { + tween = self._last; + while (tween && tween._startTime >= time && !pauseTween) { + if (!tween._duration) if (tween.data === "isPause" && tween._rawPrevTime > 0) { + pauseTween = tween; + } + tween = tween._prev; + } + } + if (pauseTween) { + self._time = self._totalTime = time = pauseTween._startTime; + pauseTime = self._startTime + (time / self._timeScale); + } + } + + self._totalTime = self._time = self._rawPrevTime = time; + } + if ((self._time === prevTime || !self._first) && !force && !internalForce && !pauseTween) { + return; + } else if (!self._initted) { + self._initted = true; + } + + if (!self._active) if (!self._paused && self._time !== prevTime && time > 0) { + self._active = true; //so that if the user renders the timeline (as opposed to the parent timeline rendering it), it is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the timeline already finished but the user manually re-renders it as halfway done, for example. + } + + if (prevTime === 0) if (self.vars.onStart) if (self._time !== 0 || !self._duration) if (!suppressEvents) { + self._callback("onStart"); + } + + curTime = self._time; + if (curTime >= prevTime) { + tween = self._first; + while (tween) { + next = tween._next; //record it here because the value could change after rendering... + if (curTime !== self._time || (self._paused && !prevPaused)) { //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete + break; + } else if (tween._active || (tween._startTime <= curTime && !tween._paused && !tween._gc)) { + if (pauseTween === tween) { + self.pause(); + self._pauseTime = pauseTime; //so that when we resume(), it's starting from exactly the right spot (the pause() method uses the rawTime for the parent, but that may be a bit too far ahead) + } + if (!tween._reversed) { + tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force); + } else { + tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force); + } + } + tween = next; + } + } else { + tween = self._last; + while (tween) { + next = tween._prev; //record it here because the value could change after rendering... + if (curTime !== self._time || (self._paused && !prevPaused)) { //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete + break; + } else if (tween._active || (tween._startTime <= prevTime && !tween._paused && !tween._gc)) { + if (pauseTween === tween) { + pauseTween = tween._prev; //the linked list is organized by _startTime, thus it's possible that a tween could start BEFORE the pause and end after it, in which case it would be positioned before the pause tween in the linked list, but we should render it before we pause() the timeline and cease rendering. This is only a concern when going in reverse. + while (pauseTween && pauseTween.endTime() > self._time) { + pauseTween.render( (pauseTween._reversed ? pauseTween.totalDuration() - ((time - pauseTween._startTime) * pauseTween._timeScale) : (time - pauseTween._startTime) * pauseTween._timeScale), suppressEvents, force); + pauseTween = pauseTween._prev; + } + pauseTween = null; + self.pause(); + self._pauseTime = pauseTime; //so that when we resume(), it's starting from exactly the right spot (the pause() method uses the rawTime for the parent, but that may be a bit too far ahead) + } + if (!tween._reversed) { + tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force); + } else { + tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force); + } + } + tween = next; + } + } + + if (self._onUpdate) if (!suppressEvents) { + if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onUpdate on a timeline that reports/checks tweened values. + _lazyRender(); + } + self._callback("onUpdate"); + } + + if (callback) if (!self._gc) if (prevStart === self._startTime || prevTimeScale !== self._timeScale) if (self._time === 0 || totalDur >= self.totalDuration()) { //if one of the tweens that was rendered altered this timeline's startTime (like if an onComplete reversed the timeline), it probably isn't complete. If it is, don't worry, because whatever call altered the startTime would complete if it was necessary at the new time. The only exception is the timeScale property. Also check _gc because there's a chance that kill() could be called in an onUpdate + if (isComplete) { + if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onComplete on a timeline that reports/checks tweened values. + _lazyRender(); + } + if (self._timeline.autoRemoveChildren) { + self._enabled(false, false); + } + self._active = false; + } + if (!suppressEvents && self.vars[callback]) { + self._callback(callback); + } + } + }; + + p._hasPausedChild = function() { + var tween = this._first; + while (tween) { + if (tween._paused || ((tween instanceof TimelineLite) && tween._hasPausedChild())) { + return true; + } + tween = tween._next; + } + return false; + }; + + p.getChildren = function(nested, tweens, timelines, ignoreBeforeTime) { + ignoreBeforeTime = ignoreBeforeTime || -9999999999; + var a = [], + tween = this._first, + cnt = 0; + while (tween) { + if (tween._startTime < ignoreBeforeTime) { + //do nothing + } else if (tween instanceof TweenLite) { + if (tweens !== false) { + a[cnt++] = tween; + } + } else { + if (timelines !== false) { + a[cnt++] = tween; + } + if (nested !== false) { + a = a.concat(tween.getChildren(true, tweens, timelines)); + cnt = a.length; + } + } + tween = tween._next; + } + return a; + }; + + p.getTweensOf = function(target, nested) { + var disabled = this._gc, + a = [], + cnt = 0, + tweens, i; + if (disabled) { + this._enabled(true, true); //getTweensOf() filters out disabled tweens, and we have to mark them as _gc = true when the timeline completes in order to allow clean garbage collection, so temporarily re-enable the timeline here. + } + tweens = TweenLite.getTweensOf(target); + i = tweens.length; + while (--i > -1) { + if (tweens[i].timeline === this || (nested && this._contains(tweens[i]))) { + a[cnt++] = tweens[i]; + } + } + if (disabled) { + this._enabled(false, true); + } + return a; + }; + + p.recent = function() { + return this._recent; + }; + + p._contains = function(tween) { + var tl = tween.timeline; + while (tl) { + if (tl === this) { + return true; + } + tl = tl.timeline; + } + return false; + }; + + p.shiftChildren = function(amount, adjustLabels, ignoreBeforeTime) { + ignoreBeforeTime = ignoreBeforeTime || 0; + var tween = this._first, + labels = this._labels, + p; + while (tween) { + if (tween._startTime >= ignoreBeforeTime) { + tween._startTime += amount; + } + tween = tween._next; + } + if (adjustLabels) { + for (p in labels) { + if (labels[p] >= ignoreBeforeTime) { + labels[p] += amount; + } + } + } + return this._uncache(true); + }; + + p._kill = function(vars, target) { + if (!vars && !target) { + return this._enabled(false, false); + } + var tweens = (!target) ? this.getChildren(true, true, false) : this.getTweensOf(target), + i = tweens.length, + changed = false; + while (--i > -1) { + if (tweens[i]._kill(vars, target)) { + changed = true; + } + } + return changed; + }; + + p.clear = function(labels) { + var tweens = this.getChildren(false, true, true), + i = tweens.length; + this._time = this._totalTime = 0; + while (--i > -1) { + tweens[i]._enabled(false, false); + } + if (labels !== false) { + this._labels = {}; + } + return this._uncache(true); + }; + + p.invalidate = function() { + var tween = this._first; + while (tween) { + tween.invalidate(); + tween = tween._next; + } + return Animation.prototype.invalidate.call(this);; + }; + + p._enabled = function(enabled, ignoreTimeline) { + if (enabled === this._gc) { + var tween = this._first; + while (tween) { + tween._enabled(enabled, true); + tween = tween._next; + } + } + return SimpleTimeline.prototype._enabled.call(this, enabled, ignoreTimeline); + }; + + p.totalTime = function(time, suppressEvents, uncapped) { + this._forcingPlayhead = true; + var val = Animation.prototype.totalTime.apply(this, arguments); + this._forcingPlayhead = false; + return val; + }; + + p.duration = function(value) { + if (!arguments.length) { + if (this._dirty) { + this.totalDuration(); //just triggers recalculation + } + return this._duration; + } + if (this.duration() !== 0 && value !== 0) { + this.timeScale(this._duration / value); + } + return this; + }; + + p.totalDuration = function(value) { + if (!arguments.length) { + if (this._dirty) { + var max = 0, + self = this, + tween = self._last, + prevStart = 999999999999, + prev, end; + while (tween) { + prev = tween._prev; //record it here in case the tween changes position in the sequence... + if (tween._dirty) { + tween.totalDuration(); //could change the tween._startTime, so make sure the tween's cache is clean before analyzing it. + } + if (tween._startTime > prevStart && self._sortChildren && !tween._paused && !self._calculatingDuration) { //in case one of the tweens shifted out of order, it needs to be re-inserted into the correct position in the sequence + self._calculatingDuration = 1; //prevent endless recursive calls - there are methods that get triggered that check duration/totalDuration when we add(), like _parseTimeOrLabel(). + self.add(tween, tween._startTime - tween._delay); + self._calculatingDuration = 0; + } else { + prevStart = tween._startTime; + } + if (tween._startTime < 0 && !tween._paused) { //children aren't allowed to have negative startTimes unless smoothChildTiming is true, so adjust here if one is found. + max -= tween._startTime; + if (self._timeline.smoothChildTiming) { + self._startTime += tween._startTime / self._timeScale; + self._time -= tween._startTime; + self._totalTime -= tween._startTime; + self._rawPrevTime -= tween._startTime; + } + self.shiftChildren(-tween._startTime, false, -9999999999); + prevStart = 0; + } + end = tween._startTime + (tween._totalDuration / tween._timeScale); + if (end > max) { + max = end; + } + tween = prev; + } + self._duration = self._totalDuration = max; + self._dirty = false; + } + return this._totalDuration; + } + return (value && this.totalDuration()) ? this.timeScale(this._totalDuration / value) : this; + }; + + p.paused = function(value) { + if (value === false && this._paused) { //if there's a pause directly at the spot from where we're unpausing, skip it. + var tween = this._first; + while (tween) { + if (tween._startTime === this._time && tween.data === "isPause") { + tween._rawPrevTime = 0; //remember, _rawPrevTime is how zero-duration tweens/callbacks sense directionality and determine whether or not to fire. If _rawPrevTime is the same as _startTime on the next render, it won't fire. + } + tween = tween._next; + } + } + return Animation.prototype.paused.apply(this, arguments); + }; + + p.usesFrames = function() { + var tl = this._timeline; + while (tl._timeline) { + tl = tl._timeline; + } + return (tl === Animation._rootFramesTimeline); + }; + + p.rawTime = function(wrapRepeats) { + return (wrapRepeats && (this._paused || (this._repeat && this.time() > 0 && this.totalProgress() < 1))) ? this._totalTime % (this._duration + this._repeatDelay) : this._paused ? this._totalTime : (this._timeline.rawTime(wrapRepeats) - this._startTime) * this._timeScale; + }; + + return TimelineLite; + + }, true); + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("./TweenLite.js"); //dependency + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("TimelineMax")); +/*! + * VERSION: 2.1.0 + * DATE: 2019-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +(function(window, moduleName) { + + "use strict"; + var _exports = {}, + _doc = window.document, + _globals = window.GreenSockGlobals = window.GreenSockGlobals || window, + existingModule = _globals[moduleName]; + if (existingModule) { + if (typeof(module) !== "undefined" && module.exports) { //node + module.exports = existingModule; + } + return existingModule; //in case the core set of classes is already loaded, don't instantiate twice. + } + var _namespace = function(ns) { + var a = ns.split("."), + p = _globals, i; + for (i = 0; i < a.length; i++) { + p[a[i]] = p = p[a[i]] || {}; + } + return p; + }, + gs = _namespace("com.greensock"), + _tinyNum = 0.00000001, + _slice = function(a) { //don't use Array.prototype.slice.call(target, 0) because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll() + var b = [], + l = a.length, + i; + for (i = 0; i !== l; b.push(a[i++])) {} + return b; + }, + _emptyFunc = function() {}, + _isArray = (function() { //works around issues in iframe environments where the Array global isn't shared, thus if the object originates in a different window/iframe, "(obj instanceof Array)" will evaluate false. We added some speed optimizations to avoid Object.prototype.toString.call() unless it's absolutely necessary because it's VERY slow (like 20x slower) + var toString = Object.prototype.toString, + array = toString.call([]); + return function(obj) { + return obj != null && (obj instanceof Array || (typeof(obj) === "object" && !!obj.push && toString.call(obj) === array)); + }; + }()), + a, i, p, _ticker, _tickerActive, + _defLookup = {}, + + /** + * @constructor + * Defines a GreenSock class, optionally with an array of dependencies that must be instantiated first and passed into the definition. + * This allows users to load GreenSock JS files in any order even if they have interdependencies (like CSSPlugin extends TweenPlugin which is + * inside TweenLite.js, but if CSSPlugin is loaded first, it should wait to run its code until TweenLite.js loads and instantiates TweenPlugin + * and then pass TweenPlugin to CSSPlugin's definition). This is all done automatically and internally. + * + * Every definition will be added to a "com.greensock" global object (typically window, but if a window.GreenSockGlobals object is found, + * it will go there as of v1.7). For example, TweenLite will be found at window.com.greensock.TweenLite and since it's a global class that should be available anywhere, + * it is ALSO referenced at window.TweenLite. However some classes aren't considered global, like the base com.greensock.core.Animation class, so + * those will only be at the package like window.com.greensock.core.Animation. Again, if you define a GreenSockGlobals object on the window, everything + * gets tucked neatly inside there instead of on the window directly. This allows you to do advanced things like load multiple versions of GreenSock + * files and put them into distinct objects (imagine a banner ad uses a newer version but the main site uses an older one). In that case, you could + * sandbox the banner one like: + * + * + * + * + * + * + * + * @param {!string} ns The namespace of the class definition, leaving off "com.greensock." as that's assumed. For example, "TweenLite" or "plugins.CSSPlugin" or "easing.Back". + * @param {!Array.} dependencies An array of dependencies (described as their namespaces minus "com.greensock." prefix). For example ["TweenLite","plugins.TweenPlugin","core.Animation"] + * @param {!function():Object} func The function that should be called and passed the resolved dependencies which will return the actual class for this definition. + * @param {boolean=} global If true, the class will be added to the global scope (typically window unless you define a window.GreenSockGlobals object) + */ + Definition = function(ns, dependencies, func, global) { + this.sc = (_defLookup[ns]) ? _defLookup[ns].sc : []; //subclasses + _defLookup[ns] = this; + this.gsClass = null; + this.func = func; + var _classes = []; + this.check = function(init) { + var i = dependencies.length, + missing = i, + cur, a, n, cl; + while (--i > -1) { + if ((cur = _defLookup[dependencies[i]] || new Definition(dependencies[i], [])).gsClass) { + _classes[i] = cur.gsClass; + missing--; + } else if (init) { + cur.sc.push(this); + } + } + if (missing === 0 && func) { + a = ("com.greensock." + ns).split("."); + n = a.pop(); + cl = _namespace(a.join("."))[n] = this.gsClass = func.apply(func, _classes); + + //exports to multiple environments + if (global) { + _globals[n] = _exports[n] = cl; //provides a way to avoid global namespace pollution. By default, the main classes like TweenLite, Power1, Strong, etc. are added to window unless a GreenSockGlobals is defined. So if you want to have things added to a custom object instead, just do something like window.GreenSockGlobals = {} before loading any GreenSock files. You can even set up an alias like window.GreenSockGlobals = windows.gs = {} so that you can access everything like gs.TweenLite. Also remember that ALL classes are added to the window.com.greensock object (in their respective packages, like com.greensock.easing.Power1, com.greensock.TweenLite, etc.) + if (typeof(module) !== "undefined" && module.exports) { //node + if (ns === moduleName) { + module.exports = _exports[moduleName] = cl; + for (i in _exports) { + cl[i] = _exports[i]; + } + } else if (_exports[moduleName]) { + _exports[moduleName][n] = cl; + } + } else if (typeof(define) === "function" && define.amd){ //AMD + define((window.GreenSockAMDPath ? window.GreenSockAMDPath + "/" : "") + ns.split(".").pop(), [], function() { return cl; }); + } + } + for (i = 0; i < this.sc.length; i++) { + this.sc[i].check(); + } + } + }; + this.check(true); + }, + + //used to create Definition instances (which basically registers a class that has dependencies). + _gsDefine = window._gsDefine = function(ns, dependencies, func, global) { + return new Definition(ns, dependencies, func, global); + }, + + //a quick way to create a class that doesn't have any dependencies. Returns the class, but first registers it in the GreenSock namespace so that other classes can grab it (other classes might be dependent on the class). + _class = gs._class = function(ns, func, global) { + func = func || function() {}; + _gsDefine(ns, [], function(){ return func; }, global); + return func; + }; + + _gsDefine.globals = _globals; + + + +/* + * ---------------------------------------------------------------- + * Ease + * ---------------------------------------------------------------- + */ + var _baseParams = [0, 0, 1, 1], + Ease = _class("easing.Ease", function(func, extraParams, type, power) { + this._func = func; + this._type = type || 0; + this._power = power || 0; + this._params = extraParams ? _baseParams.concat(extraParams) : _baseParams; + }, true), + _easeMap = Ease.map = {}, + _easeReg = Ease.register = function(ease, names, types, create) { + var na = names.split(","), + i = na.length, + ta = (types || "easeIn,easeOut,easeInOut").split(","), + e, name, j, type; + while (--i > -1) { + name = na[i]; + e = create ? _class("easing."+name, null, true) : gs.easing[name] || {}; + j = ta.length; + while (--j > -1) { + type = ta[j]; + _easeMap[name + "." + type] = _easeMap[type + name] = e[type] = ease.getRatio ? ease : ease[type] || new ease(); + } + } + }; + + p = Ease.prototype; + p._calcEnd = false; + p.getRatio = function(p) { + if (this._func) { + this._params[0] = p; + return this._func.apply(null, this._params); + } + var t = this._type, + pw = this._power, + r = (t === 1) ? 1 - p : (t === 2) ? p : (p < 0.5) ? p * 2 : (1 - p) * 2; + if (pw === 1) { + r *= r; + } else if (pw === 2) { + r *= r * r; + } else if (pw === 3) { + r *= r * r * r; + } else if (pw === 4) { + r *= r * r * r * r; + } + return (t === 1) ? 1 - r : (t === 2) ? r : (p < 0.5) ? r / 2 : 1 - (r / 2); + }; + + //create all the standard eases like Linear, Quad, Cubic, Quart, Quint, Strong, Power0, Power1, Power2, Power3, and Power4 (each with easeIn, easeOut, and easeInOut) + a = ["Linear","Quad","Cubic","Quart","Quint,Strong"]; + i = a.length; + while (--i > -1) { + p = a[i]+",Power"+i; + _easeReg(new Ease(null,null,1,i), p, "easeOut", true); + _easeReg(new Ease(null,null,2,i), p, "easeIn" + ((i === 0) ? ",easeNone" : "")); + _easeReg(new Ease(null,null,3,i), p, "easeInOut"); + } + _easeMap.linear = gs.easing.Linear.easeIn; + _easeMap.swing = gs.easing.Quad.easeInOut; //for jQuery folks + + +/* + * ---------------------------------------------------------------- + * EventDispatcher + * ---------------------------------------------------------------- + */ + var EventDispatcher = _class("events.EventDispatcher", function(target) { + this._listeners = {}; + this._eventTarget = target || this; + }); + p = EventDispatcher.prototype; + + p.addEventListener = function(type, callback, scope, useParam, priority) { + priority = priority || 0; + var list = this._listeners[type], + index = 0, + listener, i; + if (this === _ticker && !_tickerActive) { + _ticker.wake(); + } + if (list == null) { + this._listeners[type] = list = []; + } + i = list.length; + while (--i > -1) { + listener = list[i]; + if (listener.c === callback && listener.s === scope) { + list.splice(i, 1); + } else if (index === 0 && listener.pr < priority) { + index = i + 1; + } + } + list.splice(index, 0, {c:callback, s:scope, up:useParam, pr:priority}); + }; + + p.removeEventListener = function(type, callback) { + var list = this._listeners[type], i; + if (list) { + i = list.length; + while (--i > -1) { + if (list[i].c === callback) { + list.splice(i, 1); + return; + } + } + } + }; + + p.dispatchEvent = function(type) { + var list = this._listeners[type], + i, t, listener; + if (list) { + i = list.length; + if (i > 1) { + list = list.slice(0); //in case addEventListener() is called from within a listener/callback (otherwise the index could change, resulting in a skip) + } + t = this._eventTarget; + while (--i > -1) { + listener = list[i]; + if (listener) { + if (listener.up) { + listener.c.call(listener.s || t, {type:type, target:t}); + } else { + listener.c.call(listener.s || t); + } + } + } + } + }; + + +/* + * ---------------------------------------------------------------- + * Ticker + * ---------------------------------------------------------------- + */ + var _reqAnimFrame = window.requestAnimationFrame, + _cancelAnimFrame = window.cancelAnimationFrame, + _getTime = Date.now || function() {return new Date().getTime();}, + _lastUpdate = _getTime(); + + //now try to determine the requestAnimationFrame and cancelAnimationFrame functions and if none are found, we'll use a setTimeout()/clearTimeout() polyfill. + a = ["ms","moz","webkit","o"]; + i = a.length; + while (--i > -1 && !_reqAnimFrame) { + _reqAnimFrame = window[a[i] + "RequestAnimationFrame"]; + _cancelAnimFrame = window[a[i] + "CancelAnimationFrame"] || window[a[i] + "CancelRequestAnimationFrame"]; + } + + _class("Ticker", function(fps, useRAF) { + var _self = this, + _startTime = _getTime(), + _useRAF = (useRAF !== false && _reqAnimFrame) ? "auto" : false, + _lagThreshold = 500, + _adjustedLag = 33, + _tickWord = "tick", //helps reduce gc burden + _fps, _req, _id, _gap, _nextTime, + _tick = function(manual) { + var elapsed = _getTime() - _lastUpdate, + overlap, dispatch; + if (elapsed > _lagThreshold) { + _startTime += elapsed - _adjustedLag; + } + _lastUpdate += elapsed; + _self.time = (_lastUpdate - _startTime) / 1000; + overlap = _self.time - _nextTime; + if (!_fps || overlap > 0 || manual === true) { + _self.frame++; + _nextTime += overlap + (overlap >= _gap ? 0.004 : _gap - overlap); + dispatch = true; + } + if (manual !== true) { //make sure the request is made before we dispatch the "tick" event so that timing is maintained. Otherwise, if processing the "tick" requires a bunch of time (like 15ms) and we're using a setTimeout() that's based on 16.7ms, it'd technically take 31.7ms between frames otherwise. + _id = _req(_tick); + } + if (dispatch) { + _self.dispatchEvent(_tickWord); + } + }; + + EventDispatcher.call(_self); + _self.time = _self.frame = 0; + _self.tick = function() { + _tick(true); + }; + + _self.lagSmoothing = function(threshold, adjustedLag) { + if (!arguments.length) { //if lagSmoothing() is called with no arguments, treat it like a getter that returns a boolean indicating if it's enabled or not. This is purposely undocumented and is for internal use. + return (_lagThreshold < 1 / _tinyNum); + } + _lagThreshold = threshold || (1 / _tinyNum); //zero should be interpreted as basically unlimited + _adjustedLag = Math.min(adjustedLag, _lagThreshold, 0); + }; + + _self.sleep = function() { + if (_id == null) { + return; + } + if (!_useRAF || !_cancelAnimFrame) { + clearTimeout(_id); + } else { + _cancelAnimFrame(_id); + } + _req = _emptyFunc; + _id = null; + if (_self === _ticker) { + _tickerActive = false; + } + }; + + _self.wake = function(seamless) { + if (_id !== null) { + _self.sleep(); + } else if (seamless) { + _startTime += -_lastUpdate + (_lastUpdate = _getTime()); + } else if (_self.frame > 10) { //don't trigger lagSmoothing if we're just waking up, and make sure that at least 10 frames have elapsed because of the iOS bug that we work around below with the 1.5-second setTimout(). + _lastUpdate = _getTime() - _lagThreshold + 5; + } + _req = (_fps === 0) ? _emptyFunc : (!_useRAF || !_reqAnimFrame) ? function(f) { return setTimeout(f, ((_nextTime - _self.time) * 1000 + 1) | 0); } : _reqAnimFrame; + if (_self === _ticker) { + _tickerActive = true; + } + _tick(2); + }; + + _self.fps = function(value) { + if (!arguments.length) { + return _fps; + } + _fps = value; + _gap = 1 / (_fps || 60); + _nextTime = this.time + _gap; + _self.wake(); + }; + + _self.useRAF = function(value) { + if (!arguments.length) { + return _useRAF; + } + _self.sleep(); + _useRAF = value; + _self.fps(_fps); + }; + _self.fps(fps); + + //a bug in iOS 6 Safari occasionally prevents the requestAnimationFrame from working initially, so we use a 1.5-second timeout that automatically falls back to setTimeout() if it senses this condition. + setTimeout(function() { + if (_useRAF === "auto" && _self.frame < 5 && (_doc || {}).visibilityState !== "hidden") { + _self.useRAF(false); + } + }, 1500); + }); + + p = gs.Ticker.prototype = new gs.events.EventDispatcher(); + p.constructor = gs.Ticker; + + +/* + * ---------------------------------------------------------------- + * Animation + * ---------------------------------------------------------------- + */ + var Animation = _class("core.Animation", function(duration, vars) { + this.vars = vars = vars || {}; + this._duration = this._totalDuration = duration || 0; + this._delay = Number(vars.delay) || 0; + this._timeScale = 1; + this._active = !!vars.immediateRender; + this.data = vars.data; + this._reversed = !!vars.reversed; + + if (!_rootTimeline) { + return; + } + if (!_tickerActive) { //some browsers (like iOS 6 Safari) shut down JavaScript execution when the tab is disabled and they [occasionally] neglect to start up requestAnimationFrame again when returning - this code ensures that the engine starts up again properly. + _ticker.wake(); + } + + var tl = this.vars.useFrames ? _rootFramesTimeline : _rootTimeline; + tl.add(this, tl._time); + + if (this.vars.paused) { + this.paused(true); + } + }); + + _ticker = Animation.ticker = new gs.Ticker(); + p = Animation.prototype; + p._dirty = p._gc = p._initted = p._paused = false; + p._totalTime = p._time = 0; + p._rawPrevTime = -1; + p._next = p._last = p._onUpdate = p._timeline = p.timeline = null; + p._paused = false; + + + //some browsers (like iOS) occasionally drop the requestAnimationFrame event when the user switches to a different tab and then comes back again, so we use a 2-second setTimeout() to sense if/when that condition occurs and then wake() the ticker. + var _checkTimeout = function() { + if (_tickerActive && _getTime() - _lastUpdate > 2000 && ((_doc || {}).visibilityState !== "hidden" || !_ticker.lagSmoothing())) { //note: if the tab is hidden, we should still wake if lagSmoothing has been disabled. + _ticker.wake(); + } + var t = setTimeout(_checkTimeout, 2000); + if (t.unref) { + // allows a node process to exit even if the timeout’s callback hasn't been invoked. Without it, the node process could hang as this function is called every two seconds. + t.unref(); + } + }; + _checkTimeout(); + + + p.play = function(from, suppressEvents) { + if (from != null) { + this.seek(from, suppressEvents); + } + return this.reversed(false).paused(false); + }; + + p.pause = function(atTime, suppressEvents) { + if (atTime != null) { + this.seek(atTime, suppressEvents); + } + return this.paused(true); + }; + + p.resume = function(from, suppressEvents) { + if (from != null) { + this.seek(from, suppressEvents); + } + return this.paused(false); + }; + + p.seek = function(time, suppressEvents) { + return this.totalTime(Number(time), suppressEvents !== false); + }; + + p.restart = function(includeDelay, suppressEvents) { + return this.reversed(false).paused(false).totalTime(includeDelay ? -this._delay : 0, (suppressEvents !== false), true); + }; + + p.reverse = function(from, suppressEvents) { + if (from != null) { + this.seek((from || this.totalDuration()), suppressEvents); + } + return this.reversed(true).paused(false); + }; + + p.render = function(time, suppressEvents, force) { + //stub - we override this method in subclasses. + }; + + p.invalidate = function() { + this._time = this._totalTime = 0; + this._initted = this._gc = false; + this._rawPrevTime = -1; + if (this._gc || !this.timeline) { + this._enabled(true); + } + return this; + }; + + p.isActive = function() { + var tl = this._timeline, //the 2 root timelines won't have a _timeline; they're always active. + startTime = this._startTime, + rawTime; + return (!tl || (!this._gc && !this._paused && tl.isActive() && (rawTime = tl.rawTime(true)) >= startTime && rawTime < startTime + this.totalDuration() / this._timeScale - _tinyNum)); + }; + + p._enabled = function (enabled, ignoreTimeline) { + if (!_tickerActive) { + _ticker.wake(); + } + this._gc = !enabled; + this._active = this.isActive(); + if (ignoreTimeline !== true) { + if (enabled && !this.timeline) { + this._timeline.add(this, this._startTime - this._delay); + } else if (!enabled && this.timeline) { + this._timeline._remove(this, true); + } + } + return false; + }; + + + p._kill = function(vars, target) { + return this._enabled(false, false); + }; + + p.kill = function(vars, target) { + this._kill(vars, target); + return this; + }; + + p._uncache = function(includeSelf) { + var tween = includeSelf ? this : this.timeline; + while (tween) { + tween._dirty = true; + tween = tween.timeline; + } + return this; + }; + + p._swapSelfInParams = function(params) { + var i = params.length, + copy = params.concat(); + while (--i > -1) { + if (params[i] === "{self}") { + copy[i] = this; + } + } + return copy; + }; + + p._callback = function(type) { + var v = this.vars, + callback = v[type], + params = v[type + "Params"], + scope = v[type + "Scope"] || v.callbackScope || this, + l = params ? params.length : 0; + switch (l) { //speed optimization; call() is faster than apply() so use it when there are only a few parameters (which is by far most common). Previously we simply did var v = this.vars; v[type].apply(v[type + "Scope"] || v.callbackScope || this, v[type + "Params"] || _blankArray); + case 0: callback.call(scope); break; + case 1: callback.call(scope, params[0]); break; + case 2: callback.call(scope, params[0], params[1]); break; + default: callback.apply(scope, params); + } + }; + +//----Animation getters/setters -------------------------------------------------------- + + p.eventCallback = function(type, callback, params, scope) { + if ((type || "").substr(0,2) === "on") { + var v = this.vars; + if (arguments.length === 1) { + return v[type]; + } + if (callback == null) { + delete v[type]; + } else { + v[type] = callback; + v[type + "Params"] = (_isArray(params) && params.join("").indexOf("{self}") !== -1) ? this._swapSelfInParams(params) : params; + v[type + "Scope"] = scope; + } + if (type === "onUpdate") { + this._onUpdate = callback; + } + } + return this; + }; + + p.delay = function(value) { + if (!arguments.length) { + return this._delay; + } + if (this._timeline.smoothChildTiming) { + this.startTime( this._startTime + value - this._delay ); + } + this._delay = value; + return this; + }; + + p.duration = function(value) { + if (!arguments.length) { + this._dirty = false; + return this._duration; + } + this._duration = this._totalDuration = value; + this._uncache(true); //true in case it's a TweenMax or TimelineMax that has a repeat - we'll need to refresh the totalDuration. + if (this._timeline.smoothChildTiming) if (this._time > 0) if (this._time < this._duration) if (value !== 0) { + this.totalTime(this._totalTime * (value / this._duration), true); + } + return this; + }; + + p.totalDuration = function(value) { + this._dirty = false; + return (!arguments.length) ? this._totalDuration : this.duration(value); + }; + + p.time = function(value, suppressEvents) { + if (!arguments.length) { + return this._time; + } + if (this._dirty) { + this.totalDuration(); + } + return this.totalTime((value > this._duration) ? this._duration : value, suppressEvents); + }; + + p.totalTime = function(time, suppressEvents, uncapped) { + if (!_tickerActive) { + _ticker.wake(); + } + if (!arguments.length) { + return this._totalTime; + } + if (this._timeline) { + if (time < 0 && !uncapped) { + time += this.totalDuration(); + } + if (this._timeline.smoothChildTiming) { + if (this._dirty) { + this.totalDuration(); + } + var totalDuration = this._totalDuration, + tl = this._timeline; + if (time > totalDuration && !uncapped) { + time = totalDuration; + } + this._startTime = (this._paused ? this._pauseTime : tl._time) - ((!this._reversed ? time : totalDuration - time) / this._timeScale); + if (!tl._dirty) { //for performance improvement. If the parent's cache is already dirty, it already took care of marking the ancestors as dirty too, so skip the function call here. + this._uncache(false); + } + //in case any of the ancestor timelines had completed but should now be enabled, we should reset their totalTime() which will also ensure that they're lined up properly and enabled. Skip for animations that are on the root (wasteful). Example: a TimelineLite.exportRoot() is performed when there's a paused tween on the root, the export will not complete until that tween is unpaused, but imagine a child gets restarted later, after all [unpaused] tweens have completed. The startTime of that child would get pushed out, but one of the ancestors may have completed. + if (tl._timeline) { + while (tl._timeline) { + if (tl._timeline._time !== (tl._startTime + tl._totalTime) / tl._timeScale) { + tl.totalTime(tl._totalTime, true); + } + tl = tl._timeline; + } + } + } + if (this._gc) { + this._enabled(true, false); + } + if (this._totalTime !== time || this._duration === 0) { + if (_lazyTweens.length) { + _lazyRender(); + } + this.render(time, suppressEvents, false); + if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when someone calls seek() or time() or progress(), they expect an immediate render. + _lazyRender(); + } + } + } + return this; + }; + + p.progress = p.totalProgress = function(value, suppressEvents) { + var duration = this.duration(); + return (!arguments.length) ? (duration ? this._time / duration : this.ratio) : this.totalTime(duration * value, suppressEvents); + }; + + p.startTime = function(value) { + if (!arguments.length) { + return this._startTime; + } + if (value !== this._startTime) { + this._startTime = value; + if (this.timeline) if (this.timeline._sortChildren) { + this.timeline.add(this, value - this._delay); //ensures that any necessary re-sequencing of Animations in the timeline occurs to make sure the rendering order is correct. + } + } + return this; + }; + + p.endTime = function(includeRepeats) { + return this._startTime + ((includeRepeats != false) ? this.totalDuration() : this.duration()) / this._timeScale; + }; + + p.timeScale = function(value) { + if (!arguments.length) { + return this._timeScale; + } + var pauseTime, t; + value = value || _tinyNum; //can't allow zero because it'll throw the math off + if (this._timeline && this._timeline.smoothChildTiming) { + pauseTime = this._pauseTime; + t = (pauseTime || pauseTime === 0) ? pauseTime : this._timeline.totalTime(); + this._startTime = t - ((t - this._startTime) * this._timeScale / value); + } + this._timeScale = value; + t = this.timeline; + while (t && t.timeline) { //must update the duration/totalDuration of all ancestor timelines immediately in case in the middle of a render loop, one tween alters another tween's timeScale which shoves its startTime before 0, forcing the parent timeline to shift around and shiftChildren() which could affect that next tween's render (startTime). Doesn't matter for the root timeline though. + t._dirty = true; + t.totalDuration(); + t = t.timeline; + } + return this; + }; + + p.reversed = function(value) { + if (!arguments.length) { + return this._reversed; + } + if (value != this._reversed) { + this._reversed = value; + this.totalTime(((this._timeline && !this._timeline.smoothChildTiming) ? this.totalDuration() - this._totalTime : this._totalTime), true); + } + return this; + }; + + p.paused = function(value) { + if (!arguments.length) { + return this._paused; + } + var tl = this._timeline, + raw, elapsed; + if (value != this._paused) if (tl) { + if (!_tickerActive && !value) { + _ticker.wake(); + } + raw = tl.rawTime(); + elapsed = raw - this._pauseTime; + if (!value && tl.smoothChildTiming) { + this._startTime += elapsed; + this._uncache(false); + } + this._pauseTime = value ? raw : null; + this._paused = value; + this._active = this.isActive(); + if (!value && elapsed !== 0 && this._initted && this.duration()) { + raw = tl.smoothChildTiming ? this._totalTime : (raw - this._startTime) / this._timeScale; + this.render(raw, (raw === this._totalTime), true); //in case the target's properties changed via some other tween or manual update by the user, we should force a render. + } + } + if (this._gc && !value) { + this._enabled(true, false); + } + return this; + }; + + +/* + * ---------------------------------------------------------------- + * SimpleTimeline + * ---------------------------------------------------------------- + */ + var SimpleTimeline = _class("core.SimpleTimeline", function(vars) { + Animation.call(this, 0, vars); + this.autoRemoveChildren = this.smoothChildTiming = true; + }); + + p = SimpleTimeline.prototype = new Animation(); + p.constructor = SimpleTimeline; + p.kill()._gc = false; + p._first = p._last = p._recent = null; + p._sortChildren = false; + + p.add = p.insert = function(child, position, align, stagger) { + var prevTween, st; + child._startTime = Number(position || 0) + child._delay; + if (child._paused) if (this !== child._timeline) { //we only adjust the _pauseTime if it wasn't in this timeline already. Remember, sometimes a tween will be inserted again into the same timeline when its startTime is changed so that the tweens in the TimelineLite/Max are re-ordered properly in the linked list (so everything renders in the proper order). + child._pauseTime = this.rawTime() - (child._timeline.rawTime() - child._pauseTime); + } + if (child.timeline) { + child.timeline._remove(child, true); //removes from existing timeline so that it can be properly added to this one. + } + child.timeline = child._timeline = this; + if (child._gc) { + child._enabled(true, true); + } + prevTween = this._last; + if (this._sortChildren) { + st = child._startTime; + while (prevTween && prevTween._startTime > st) { + prevTween = prevTween._prev; + } + } + if (prevTween) { + child._next = prevTween._next; + prevTween._next = child; + } else { + child._next = this._first; + this._first = child; + } + if (child._next) { + child._next._prev = child; + } else { + this._last = child; + } + child._prev = prevTween; + this._recent = child; + if (this._timeline) { + this._uncache(true); + } + return this; + }; + + p._remove = function(tween, skipDisable) { + if (tween.timeline === this) { + if (!skipDisable) { + tween._enabled(false, true); + } + + if (tween._prev) { + tween._prev._next = tween._next; + } else if (this._first === tween) { + this._first = tween._next; + } + if (tween._next) { + tween._next._prev = tween._prev; + } else if (this._last === tween) { + this._last = tween._prev; + } + tween._next = tween._prev = tween.timeline = null; + if (tween === this._recent) { + this._recent = this._last; + } + + if (this._timeline) { + this._uncache(true); + } + } + return this; + }; + + p.render = function(time, suppressEvents, force) { + var tween = this._first, + next; + this._totalTime = this._time = this._rawPrevTime = time; + while (tween) { + next = tween._next; //record it here because the value could change after rendering... + if (tween._active || (time >= tween._startTime && !tween._paused && !tween._gc)) { + if (!tween._reversed) { + tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force); + } else { + tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force); + } + } + tween = next; + } + }; + + p.rawTime = function() { + if (!_tickerActive) { + _ticker.wake(); + } + return this._totalTime; + }; + +/* + * ---------------------------------------------------------------- + * TweenLite + * ---------------------------------------------------------------- + */ + var TweenLite = _class("TweenLite", function(target, duration, vars) { + Animation.call(this, duration, vars); + this.render = TweenLite.prototype.render; //speed optimization (avoid prototype lookup on this "hot" method) + + if (target == null) { + throw "Cannot tween a null target."; + } + + this.target = target = (typeof(target) !== "string") ? target : TweenLite.selector(target) || target; + + var isSelector = (target.jquery || (target.length && target !== window && target[0] && (target[0] === window || (target[0].nodeType && target[0].style && !target.nodeType)))), + overwrite = this.vars.overwrite, + i, targ, targets; + + this._overwrite = overwrite = (overwrite == null) ? _overwriteLookup[TweenLite.defaultOverwrite] : (typeof(overwrite) === "number") ? overwrite >> 0 : _overwriteLookup[overwrite]; + + if ((isSelector || target instanceof Array || (target.push && _isArray(target))) && typeof(target[0]) !== "number") { + this._targets = targets = _slice(target); //don't use Array.prototype.slice.call(target, 0) because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll() + this._propLookup = []; + this._siblings = []; + for (i = 0; i < targets.length; i++) { + targ = targets[i]; + if (!targ) { + targets.splice(i--, 1); + continue; + } else if (typeof(targ) === "string") { + targ = targets[i--] = TweenLite.selector(targ); //in case it's an array of strings + if (typeof(targ) === "string") { + targets.splice(i+1, 1); //to avoid an endless loop (can't imagine why the selector would return a string, but just in case) + } + continue; + } else if (targ.length && targ !== window && targ[0] && (targ[0] === window || (targ[0].nodeType && targ[0].style && !targ.nodeType))) { //in case the user is passing in an array of selector objects (like jQuery objects), we need to check one more level and pull things out if necessary. Also note that elements pass all the criteria regarding length and the first child having style, so we must also check to ensure the target isn't an HTML node itself. - targets.splice(i--, 1); - this._targets = targets = targets.concat(_slice(targ)); - continue; - } - this._siblings[i] = _register(targ, this, false); - if (overwrite === 1) if (this._siblings[i].length > 1) { - _applyOverwrite(targ, this, null, 1, this._siblings[i]); - } - } - - } else { - this._propLookup = {}; - this._siblings = _register(target, this, false); - if (overwrite === 1) if (this._siblings.length > 1) { - _applyOverwrite(target, this, null, 1, this._siblings); - } - } - if (this.vars.immediateRender || (duration === 0 && this._delay === 0 && this.vars.immediateRender !== false)) { - this._time = -_tinyNum; //forces a render without having to set the render() "force" parameter to true because we want to allow lazying by default (using the "force" parameter always forces an immediate full render) - this.render(Math.min(0, -this._delay)); //in case delay is negative - } - }, true), - _isSelector = function(v) { - return (v && v.length && v !== window && v[0] && (v[0] === window || (v[0].nodeType && v[0].style && !v.nodeType))); //we cannot check "nodeType" if the target is window from within an iframe, otherwise it will trigger a security error in some browsers like Firefox. - }, - _autoCSS = function(vars, target) { - var css = {}, - p; - for (p in vars) { - if (!_reservedProps[p] && (!(p in target) || p === "transform" || p === "x" || p === "y" || p === "width" || p === "height" || p === "className" || p === "border") && (!_plugins[p] || (_plugins[p] && _plugins[p]._autoCSS))) { //note: elements contain read-only "x" and "y" properties. We should also prioritize editing css width/height rather than the element's properties. - css[p] = vars[p]; - delete vars[p]; - } - } - vars.css = css; + }, + _createEase = function(ease) { + return function(p) { + return ease.getRatio(p); }; - - p = TweenLite.prototype = new Animation(); - p.constructor = TweenLite; - p.kill()._gc = false; - -//----TweenLite defaults, overwrite management, and root updates ---------------------------------------------------- - - p.ratio = 0; - p._firstPT = p._targets = p._overwrittenProps = p._startAt = null; - p._notifyPluginsOfEnabled = p._lazy = false; - - TweenLite.version = "2.1.0"; - TweenLite.defaultEase = p._ease = new Ease(null, null, 1, 1); - TweenLite.defaultOverwrite = "auto"; - TweenLite.ticker = _ticker; - TweenLite.autoSleep = 120; - TweenLite.lagSmoothing = function(threshold, adjustedLag) { - _ticker.lagSmoothing(threshold, adjustedLag); - }; - - TweenLite.selector = window.$ || window.jQuery || function(e) { - var selector = window.$ || window.jQuery; - if (selector) { - TweenLite.selector = selector; - return selector(e); + }, + _easeMap = {}, + _init = function() { + var globals = window.GreenSockGlobals || window, + p; + TweenLite = globals.TweenMax || globals.TweenLite; //we prioritize TweenMax if it's loaded so that we can accommodate special features like repeat, yoyo, repeatDelay, etc. + if (TweenLite) { + globals = globals.com.greensock; + CSSPlugin = globals.plugins.CSSPlugin; + _easeMap = globals.easing.Ease.map || {}; //don't do just window.Ease or window.CSSPlugin because some other libraries like EaselJS/TweenJS use those same names and there could be a collision. } - if (!_doc) { //in some dev environments (like Angular 6), GSAP gets loaded before the document is defined! So re-query it here if/when necessary. - _doc = window.document; - } - return (!_doc) ? e : (_doc.querySelectorAll ? _doc.querySelectorAll(e) : _doc.getElementById((e.charAt(0) === "#") ? e.substr(1) : e)); - }; - - var _lazyTweens = [], - _lazyLookup = {}, - _numbersExp = /(?:(-|-=|\+=)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig, - _relExp = /[\+-]=-?[\.\d]/, - //_nonNumbersExp = /(?:([\-+](?!(\d|=)))|[^\d\-+=e]|(e(?![\-+][\d])))+/ig, - _setRatio = function(v) { - var pt = this._firstPT, - min = 0.000001, - val; - while (pt) { - val = !pt.blob ? pt.c * v + pt.s : (v === 1 && this.end != null) ? this.end : v ? this.join("") : this.start; - if (pt.m) { - val = pt.m.call(this._tween, val, this._target || pt.t, this._tween); - } else if (val < min) if (val > -min && !pt.blob) { //prevents issues with converting very small numbers to strings in the browser - val = 0; - } - if (!pt.f) { - pt.t[pt.p] = val; - } else if (pt.fp) { - pt.t[pt.p](pt.fp, val); - } else { - pt.t[pt.p](val); - } - pt = pt._next; + if (!TweenLite || !CSSPlugin) { + TweenLite = null; + if (!_warned && window.console) { + window.console.log("The jquery.gsap.js plugin requires the TweenMax (or at least TweenLite and CSSPlugin) JavaScript file(s)."); + _warned = true; } - }, - _blobRound = function(v) { - return (((v * 1000) | 0) / 1000) + ""; - }, - //compares two strings (start/end), finds the numbers that are different and spits back an array representing the whole value but with the changing values isolated as elements. For example, "rgb(0,0,0)" and "rgb(100,50,0)" would become ["rgb(", 0, ",", 50, ",0)"]. Notice it merges the parts that are identical (performance optimization). The array also has a linked list of PropTweens attached starting with _firstPT that contain the tweening data (t, p, s, c, f, etc.). It also stores the starting value as a "start" property so that we can revert to it if/when necessary, like when a tween rewinds fully. If the quantity of numbers differs between the start and end, it will always prioritize the end value(s). The pt parameter is optional - it's for a PropTween that will be appended to the end of the linked list and is typically for actually setting the value after all of the elements have been updated (with array.join("")). - _blobDif = function(start, end, filter, pt) { - var a = [], - charIndex = 0, - s = "", - color = 0, - startNums, endNums, num, i, l, nonNumbers, currentNum; - a.start = start; - a.end = end; - start = a[0] = start + ""; //ensure values are strings - end = a[1] = end + ""; - if (filter) { - filter(a); //pass an array with the starting and ending values and let the filter do whatever it needs to the values. - start = a[0]; - end = a[1]; - } - a.length = 0; - startNums = start.match(_numbersExp) || []; - endNums = end.match(_numbersExp) || []; - if (pt) { - pt._next = null; - pt.blob = 1; - a._firstPT = a._applyPT = pt; //apply last in the linked list (which means inserting it first) - } - l = endNums.length; - for (i = 0; i < l; i++) { - currentNum = endNums[i]; - nonNumbers = end.substr(charIndex, end.indexOf(currentNum, charIndex)-charIndex); - s += (nonNumbers || !i) ? nonNumbers : ","; //note: SVG spec allows omission of comma/space when a negative sign is wedged between two numbers, like 2.5-5.3 instead of 2.5,-5.3 but when tweening, the negative value may switch to positive, so we insert the comma just in case. - charIndex += nonNumbers.length; - if (color) { //sense rgba() values and round them. - color = (color + 1) % 5; - } else if (nonNumbers.substr(-5) === "rgba(") { - color = 1; - } - if (currentNum === startNums[i] || startNums.length <= i) { - s += currentNum; - } else { - if (s) { - a.push(s); - s = ""; - } - num = parseFloat(startNums[i]); - a.push(num); - a._firstPT = {_next: a._firstPT, t:a, p: a.length-1, s:num, c:((currentNum.charAt(1) === "=") ? parseInt(currentNum.charAt(0) + "1", 10) * parseFloat(currentNum.substr(2)) : (parseFloat(currentNum) - num)) || 0, f:0, m:(color && color < 4) ? Math.round : _blobRound}; //limiting to 3 decimal places and casting as a string can really help performance when array.join() is called! - //note: we don't set _prev because we'll never need to remove individual PropTweens from this list. - } - charIndex += currentNum.length; - } - s += end.substr(charIndex); - if (s) { - a.push(s); - } - a.setRatio = _setRatio; - if (_relExp.test(end)) { //if the end string contains relative values, delete it so that on the final render (in _setRatio()), we don't actually set it to the string with += or -= characters (forces it to use the calculated value). - a.end = null; - } - return a; - }, - //note: "funcParam" is only necessary for function-based getters/setters that require an extra parameter like getAttribute("width") and setAttribute("width", value). In this example, funcParam would be "width". Used by AttrPlugin for example. - _addPropTween = function(target, prop, start, end, overwriteProp, mod, funcParam, stringFilter, index) { - if (typeof(end) === "function") { - end = end(index || 0, target); - } - var type = typeof(target[prop]), - getterName = (type !== "function") ? "" : ((prop.indexOf("set") || typeof(target["get" + prop.substr(3)]) !== "function") ? prop : "get" + prop.substr(3)), - s = (start !== "get") ? start : !getterName ? target[prop] : funcParam ? target[getterName](funcParam) : target[getterName](), - isRelative = (typeof(end) === "string" && end.charAt(1) === "="), - pt = {t:target, p:prop, s:s, f:(type === "function"), pg:0, n:overwriteProp || prop, m:(!mod ? 0 : (typeof(mod) === "function") ? mod : Math.round), pr:0, c:isRelative ? parseInt(end.charAt(0) + "1", 10) * parseFloat(end.substr(2)) : (parseFloat(end) - s) || 0}, - blob; - - if (typeof(s) !== "number" || (typeof(end) !== "number" && !isRelative)) { - if (funcParam || isNaN(s) || (!isRelative && isNaN(end)) || typeof(s) === "boolean" || typeof(end) === "boolean") { - //a blob (string that has multiple numbers in it) - pt.fp = funcParam; - blob = _blobDif(s, (isRelative ? (parseFloat(pt.s) + pt.c) + (pt.s + "").replace(/[0-9\-\.]/g, "") : end), stringFilter || TweenLite.defaultStringFilter, pt); - pt = {t: blob, p: "setRatio", s: 0, c: 1, f: 2, pg: 0, n: overwriteProp || prop, pr: 0, m: 0}; //"2" indicates it's a Blob property tween. Needed for RoundPropsPlugin for example. - } else { - pt.s = parseFloat(s); - if (!isRelative) { - pt.c = (parseFloat(end) - pt.s) || 0; - } - } - } - if (pt.c) { //only add it to the linked list if there's a change. - if ((pt._next = this._firstPT)) { - pt._next._prev = pt; - } - this._firstPT = pt; - return pt; - } - }, - _internals = TweenLite._internals = {isArray:_isArray, isSelector:_isSelector, lazyTweens:_lazyTweens, blobDif:_blobDif}, //gives us a way to expose certain private values to other GreenSock classes without contaminating tha main TweenLite object. - _plugins = TweenLite._plugins = {}, - _tweenLookup = _internals.tweenLookup = {}, - _tweenLookupNum = 0, - _reservedProps = _internals.reservedProps = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, onCompleteScope:1, useFrames:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, onUpdateScope:1, onStart:1, onStartParams:1, onStartScope:1, onReverseComplete:1, onReverseCompleteParams:1, onReverseCompleteScope:1, onRepeat:1, onRepeatParams:1, onRepeatScope:1, easeParams:1, yoyo:1, immediateRender:1, repeat:1, repeatDelay:1, data:1, paused:1, reversed:1, autoCSS:1, lazy:1, onOverwrite:1, callbackScope:1, stringFilter:1, id:1, yoyoEase:1, stagger:1}, - _overwriteLookup = {none:0, all:1, auto:2, concurrent:3, allOnStart:4, preexisting:5, "true":1, "false":0}, - _rootFramesTimeline = Animation._rootFramesTimeline = new SimpleTimeline(), - _rootTimeline = Animation._rootTimeline = new SimpleTimeline(), - _nextGCFrame = 30, - _lazyRender = _internals.lazyRender = function() { - var l = _lazyTweens.length, - i, tween; - _lazyLookup = {}; - for (i = 0; i < l; i++) { - tween = _lazyTweens[i]; - if (tween && tween._lazy !== false) { - tween.render(tween._lazy[0], tween._lazy[1], true); - tween._lazy = false; - } - } - _lazyTweens.length = 0; - }; - - _rootTimeline._startTime = _ticker.time; - _rootFramesTimeline._startTime = _ticker.frame; - _rootTimeline._active = _rootFramesTimeline._active = true; - setTimeout(_lazyRender, 1); //on some mobile devices, there isn't a "tick" before code runs which means any lazy renders wouldn't run before the next official "tick". - - Animation._updateRoot = TweenLite.render = function() { - var i, a, p; - if (_lazyTweens.length) { //if code is run outside of the requestAnimationFrame loop, there may be tweens queued AFTER the engine refreshed, so we need to ensure any pending renders occur before we refresh again. - _lazyRender(); - } - _rootTimeline.render((_ticker.time - _rootTimeline._startTime) * _rootTimeline._timeScale, false, false); - _rootFramesTimeline.render((_ticker.frame - _rootFramesTimeline._startTime) * _rootFramesTimeline._timeScale, false, false); - if (_lazyTweens.length) { - _lazyRender(); - } - if (_ticker.frame >= _nextGCFrame) { //dump garbage every 120 frames or whatever the user sets TweenLite.autoSleep to - _nextGCFrame = _ticker.frame + (parseInt(TweenLite.autoSleep, 10) || 120); - for (p in _tweenLookup) { - a = _tweenLookup[p].tweens; - i = a.length; - while (--i > -1) { - if (a[i]._gc) { - a.splice(i, 1); - } - } - if (a.length === 0) { - delete _tweenLookup[p]; - } - } - //if there are no more tweens in the root timelines, or if they're all paused, make the _timer sleep to reduce load on the CPU slightly - p = _rootTimeline._first; - if (!p || p._paused) if (TweenLite.autoSleep && !_rootFramesTimeline._first && _ticker._listeners.tick.length === 1) { - while (p && p._paused) { - p = p._next; - } - if (!p) { - _ticker.sleep(); - } - } - } - }; - - _ticker.addEventListener("tick", Animation._updateRoot); - - var _register = function(target, tween, scrub) { - var id = target._gsTweenID, a, i; - if (!_tweenLookup[id || (target._gsTweenID = id = "t" + (_tweenLookupNum++))]) { - _tweenLookup[id] = {target:target, tweens:[]}; - } - if (tween) { - a = _tweenLookup[id].tweens; - a[(i = a.length)] = tween; - if (scrub) { - while (--i > -1) { - if (a[i] === tween) { - a.splice(i, 1); - } - } - } - } - return _tweenLookup[id].tweens; - }, - _onOverwrite = function(overwrittenTween, overwritingTween, target, killedProps) { - var func = overwrittenTween.vars.onOverwrite, r1, r2; - if (func) { - r1 = func(overwrittenTween, overwritingTween, target, killedProps); - } - func = TweenLite.onOverwrite; - if (func) { - r2 = func(overwrittenTween, overwritingTween, target, killedProps); - } - return (r1 !== false && r2 !== false); - }, - _applyOverwrite = function(target, tween, props, mode, siblings) { - var i, changed, curTween, l; - if (mode === 1 || mode >= 4) { - l = siblings.length; - for (i = 0; i < l; i++) { - if ((curTween = siblings[i]) !== tween) { - if (!curTween._gc) { - if (curTween._kill(null, target, tween)) { - changed = true; - } - } - } else if (mode === 5) { - break; - } - } - return changed; - } - //NOTE: Add tiny amount to overcome floating point errors that can cause the startTime to be VERY slightly off (when a tween's time() is set for example) - var startTime = tween._startTime + _tinyNum, - overlaps = [], - oCount = 0, - zeroDur = (tween._duration === 0), - globalStart; - i = siblings.length; - while (--i > -1) { - if ((curTween = siblings[i]) === tween || curTween._gc || curTween._paused) { - //ignore - } else if (curTween._timeline !== tween._timeline) { - globalStart = globalStart || _checkOverlap(tween, 0, zeroDur); - if (_checkOverlap(curTween, globalStart, zeroDur) === 0) { - overlaps[oCount++] = curTween; - } - } else if (curTween._startTime <= startTime) if (curTween._startTime + curTween.totalDuration() / curTween._timeScale > startTime) if (!((zeroDur || !curTween._initted) && startTime - curTween._startTime <= _tinyNum * 2)) { - overlaps[oCount++] = curTween; - } - } - - i = oCount; - while (--i > -1) { - curTween = overlaps[i]; - l = curTween._firstPT; //we need to discern if there were property tweens originally; if they all get removed in the next line's _kill() call, the tween should be killed. See https://github.com/greensock/GreenSock-JS/issues/278 - if (mode === 2) if (curTween._kill(props, target, tween)) { - changed = true; - } - if (mode !== 2 || (!curTween._firstPT && curTween._initted && l)) { - if (mode !== 2 && !_onOverwrite(curTween, tween)) { - continue; - } - if (curTween._enabled(false, false)) { //if all property tweens have been overwritten, kill the tween. - changed = true; - } - } - } - return changed; - }, - _checkOverlap = function(tween, reference, zeroDur) { - var tl = tween._timeline, - ts = tl._timeScale, - t = tween._startTime; - while (tl._timeline) { - t += tl._startTime; - ts *= tl._timeScale; - if (tl._paused) { - return -100; - } - tl = tl._timeline; - } - t /= ts; - return (t > reference) ? t - reference : ((zeroDur && t === reference) || (!tween._initted && t - reference < 2 * _tinyNum)) ? _tinyNum : ((t += tween.totalDuration() / tween._timeScale / ts) > reference + _tinyNum) ? 0 : t - reference - _tinyNum; - }; - - -//---- TweenLite instance methods ----------------------------------------------------------------------------- - - p._init = function() { - var v = this.vars, - op = this._overwrittenProps, - dur = this._duration, - immediate = !!v.immediateRender, - ease = v.ease, - startAt = this._startAt, - i, initPlugins, pt, p, startVars, l; - if (v.startAt) { - if (startAt) { - startAt.render(-1, true); //if we've run a startAt previously (when the tween instantiated), we should revert it so that the values re-instantiate correctly particularly for relative tweens. Without this, a TweenLite.fromTo(obj, 1, {x:"+=100"}, {x:"-=100"}), for example, would actually jump to +=200 because the startAt would run twice, doubling the relative change. - startAt.kill(); - } - startVars = {}; - for (p in v.startAt) { //copy the properties/values into a new object to avoid collisions, like var to = {x:0}, from = {x:500}; timeline.fromTo(e, 1, from, to).fromTo(e, 1, to, from); - startVars[p] = v.startAt[p]; - } - startVars.data = "isStart"; - startVars.overwrite = false; - startVars.immediateRender = true; - startVars.lazy = (immediate && v.lazy !== false); - startVars.startAt = startVars.delay = null; //no nesting of startAt objects allowed (otherwise it could cause an infinite loop). - startVars.onUpdate = v.onUpdate; - startVars.onUpdateParams = v.onUpdateParams; - startVars.onUpdateScope = v.onUpdateScope || v.callbackScope || this; - this._startAt = TweenLite.to(this.target || {}, 0, startVars); - if (immediate) { - if (this._time > 0) { - this._startAt = null; //tweens that render immediately (like most from() and fromTo() tweens) shouldn't revert when their parent timeline's playhead goes backward past the startTime because the initial render could have happened anytime and it shouldn't be directly correlated to this tween's startTime. Imagine setting up a complex animation where the beginning states of various objects are rendered immediately but the tween doesn't happen for quite some time - if we revert to the starting values as soon as the playhead goes backward past the tween's startTime, it will throw things off visually. Reversion should only happen in TimelineLite/Max instances where immediateRender was false (which is the default in the convenience methods like from()). - } else if (dur !== 0) { - return; //we skip initialization here so that overwriting doesn't occur until the tween actually begins. Otherwise, if you create several immediateRender:true tweens of the same target/properties to drop into a TimelineLite or TimelineMax, the last one created would overwrite the first ones because they didn't get placed into the timeline yet before the first render occurs and kicks in overwriting. - } - } - } else if (v.runBackwards && dur !== 0) { - //from() tweens must be handled uniquely: their beginning values must be rendered but we don't want overwriting to occur yet (when time is still 0). Wait until the tween actually begins before doing all the routines like overwriting. At that time, we should render at the END of the tween to ensure that things initialize correctly (remember, from() tweens go backwards) - if (startAt) { - startAt.render(-1, true); - startAt.kill(); - this._startAt = null; - } else { - if (this._time !== 0) { //in rare cases (like if a from() tween runs and then is invalidate()-ed), immediateRender could be true but the initial forced-render gets skipped, so there's no need to force the render in this context when the _time is greater than 0 - immediate = false; - } - pt = {}; - for (p in v) { //copy props into a new object and skip any reserved props, otherwise onComplete or onUpdate or onStart could fire. We should, however, permit autoCSS to go through. - if (!_reservedProps[p] || p === "autoCSS") { - pt[p] = v[p]; - } - } - pt.overwrite = 0; - pt.data = "isFromStart"; //we tag the tween with as "isFromStart" so that if [inside a plugin] we need to only do something at the very END of a tween, we have a way of identifying this tween as merely the one that's setting the beginning values for a "from()" tween. For example, clearProps in CSSPlugin should only get applied at the very END of a tween and without this tag, from(...{height:100, clearProps:"height", delay:1}) would wipe the height at the beginning of the tween and after 1 second, it'd kick back in. - pt.lazy = (immediate && v.lazy !== false); - pt.immediateRender = immediate; //zero-duration tweens render immediately by default, but if we're not specifically instructed to render this tween immediately, we should skip this and merely _init() to record the starting values (rendering them immediately would push them to completion which is wasteful in that case - we'd have to render(-1) immediately after) - this._startAt = TweenLite.to(this.target, 0, pt); - if (!immediate) { - this._startAt._init(); //ensures that the initial values are recorded - this._startAt._enabled(false); //no need to have the tween render on the next cycle. Disable it because we'll always manually control the renders of the _startAt tween. - if (this.vars.immediateRender) { - this._startAt = null; - } - } else if (this._time === 0) { - return; - } - } - } - this._ease = ease = (!ease) ? TweenLite.defaultEase : (ease instanceof Ease) ? ease : (typeof(ease) === "function") ? new Ease(ease, v.easeParams) : _easeMap[ease] || TweenLite.defaultEase; - if (v.easeParams instanceof Array && ease.config) { - this._ease = ease.config.apply(ease, v.easeParams); - } - this._easeType = this._ease._type; - this._easePower = this._ease._power; - this._firstPT = null; - - if (this._targets) { - l = this._targets.length; - for (i = 0; i < l; i++) { - if ( this._initProps( this._targets[i], (this._propLookup[i] = {}), this._siblings[i], (op ? op[i] : null), i) ) { - initPlugins = true; - } - } - } else { - initPlugins = this._initProps(this.target, this._propLookup, this._siblings, op, 0); - } - - if (initPlugins) { - TweenLite._onPluginEvent("_onInitAllProps", this); //reorders the array in order of priority. Uses a static TweenPlugin method in order to minimize file size in TweenLite - } - if (op) if (!this._firstPT) if (typeof(this.target) !== "function") { //if all tweening properties have been overwritten, kill the tween. If the target is a function, it's probably a delayedCall so let it live. - this._enabled(false, false); - } - if (v.runBackwards) { - pt = this._firstPT; - while (pt) { - pt.s += pt.c; - pt.c = -pt.c; - pt = pt._next; - } - } - this._onUpdate = v.onUpdate; - this._initted = true; - }; - - p._initProps = function(target, propLookup, siblings, overwrittenProps, index) { - var p, i, initPlugins, plugin, pt, v; - if (target == null) { - return false; - } - if (_lazyLookup[target._gsTweenID]) { - _lazyRender(); //if other tweens of the same target have recently initted but haven't rendered yet, we've got to force the render so that the starting values are correct (imagine populating a timeline with a bunch of sequential tweens and then jumping to the end) - } - - if (!this.vars.css) if (target.style) if (target !== window && target.nodeType) if (_plugins.css) if (this.vars.autoCSS !== false) { //it's so common to use TweenLite/Max to animate the css of DOM elements, we assume that if the target is a DOM element, that's what is intended (a convenience so that users don't have to wrap things in css:{}, although we still recommend it for a slight performance boost and better specificity). Note: we cannot check "nodeType" on the window inside an iframe. - _autoCSS(this.vars, target); - } - for (p in this.vars) { - v = this.vars[p]; - if (_reservedProps[p]) { - if (v) if ((v instanceof Array) || (v.push && _isArray(v))) if (v.join("").indexOf("{self}") !== -1) { - this.vars[p] = v = this._swapSelfInParams(v, this); - } - - } else if (_plugins[p] && (plugin = new _plugins[p]())._onInitTween(target, this.vars[p], this, index)) { - - //t - target [object] - //p - property [string] - //s - start [number] - //c - change [number] - //f - isFunction [boolean] - //n - name [string] - //pg - isPlugin [boolean] - //pr - priority [number] - //m - mod [function | 0] - this._firstPT = pt = {_next:this._firstPT, t:plugin, p:"setRatio", s:0, c:1, f:1, n:p, pg:1, pr:plugin._priority, m:0}; - i = plugin._overwriteProps.length; - while (--i > -1) { - propLookup[plugin._overwriteProps[i]] = this._firstPT; - } - if (plugin._priority || plugin._onInitAllProps) { - initPlugins = true; - } - if (plugin._onDisable || plugin._onEnable) { - this._notifyPluginsOfEnabled = true; - } - if (pt._next) { - pt._next._prev = pt; - } - - } else { - propLookup[p] = _addPropTween.call(this, target, p, "get", v, p, 0, null, this.vars.stringFilter, index); - } - } - - if (overwrittenProps) if (this._kill(overwrittenProps, target)) { //another tween may have tried to overwrite properties of this tween before init() was called (like if two tweens start at the same time, the one created second will run first) - return this._initProps(target, propLookup, siblings, overwrittenProps, index); - } - if (this._overwrite > 1) if (this._firstPT) if (siblings.length > 1) if (_applyOverwrite(target, this, propLookup, this._overwrite, siblings)) { - this._kill(propLookup, target); - return this._initProps(target, propLookup, siblings, overwrittenProps, index); - } - if (this._firstPT) if ((this.vars.lazy !== false && this._duration) || (this.vars.lazy && !this._duration)) { //zero duration tweens don't lazy render by default; everything else does. - _lazyLookup[target._gsTweenID] = true; - } - return initPlugins; - }; - - p.render = function(time, suppressEvents, force) { - var self = this, - prevTime = self._time, - duration = self._duration, - prevRawPrevTime = self._rawPrevTime, - isComplete, callback, pt, rawPrevTime; - if (time >= duration - _tinyNum && time >= 0) { //to work around occasional floating point math artifacts. - self._totalTime = self._time = duration; - self.ratio = self._ease._calcEnd ? self._ease.getRatio(1) : 1; - if (!self._reversed ) { - isComplete = true; - callback = "onComplete"; - force = (force || self._timeline.autoRemoveChildren); //otherwise, if the animation is unpaused/activated after it's already finished, it doesn't get removed from the parent timeline. - } - if (duration === 0) if (self._initted || !self.vars.lazy || force) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered. - if (self._startTime === self._timeline._duration) { //if a zero-duration tween is at the VERY end of a timeline and that timeline renders at its end, it will typically add a tiny bit of cushion to the render time to prevent rounding errors from getting in the way of tweens rendering their VERY end. If we then reverse() that timeline, the zero-duration tween will trigger its onReverseComplete even though technically the playhead didn't pass over it again. It's a very specific edge case we must accommodate. - time = 0; - } - if (prevRawPrevTime < 0 || (time <= 0 && time >= -_tinyNum) || (prevRawPrevTime === _tinyNum && self.data !== "isPause")) if (prevRawPrevTime !== time) { //note: when this.data is "isPause", it's a callback added by addPause() on a timeline that we should not be triggered when LEAVING its exact start time. In other words, tl.addPause(1).play(1) shouldn't pause. - force = true; - if (prevRawPrevTime > _tinyNum) { - callback = "onReverseComplete"; - } - } - self._rawPrevTime = rawPrevTime = (!suppressEvents || time || prevRawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient. - } - - } else if (time < _tinyNum) { //to work around occasional floating point math artifacts, round super small values to 0. - self._totalTime = self._time = 0; - self.ratio = self._ease._calcEnd ? self._ease.getRatio(0) : 0; - if (prevTime !== 0 || (duration === 0 && prevRawPrevTime > 0)) { - callback = "onReverseComplete"; - isComplete = self._reversed; - } - if (time > -_tinyNum) { - time = 0; - } else if (time < 0) { - self._active = false; - if (duration === 0) if (self._initted || !self.vars.lazy || force) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered. - if (prevRawPrevTime >= 0 && !(prevRawPrevTime === _tinyNum && self.data === "isPause")) { - force = true; - } - self._rawPrevTime = rawPrevTime = (!suppressEvents || time || prevRawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient. - } - } - if (!self._initted || (self._startAt && self._startAt.progress())) { //if we render the very beginning (time == 0) of a fromTo(), we must force the render (normal tweens wouldn't need to render at a time of 0 when the prevTime was also 0). This is also mandatory to make sure overwriting kicks in immediately. Also, we check progress() because if startAt has already rendered at its end, we should force a render at its beginning. Otherwise, if you put the playhead directly on top of where a fromTo({immediateRender:false}) starts, and then move it backwards, the from() won't revert its values. - force = true; - } - } else { - self._totalTime = self._time = time; - - if (self._easeType) { - var r = time / duration, type = self._easeType, pow = self._easePower; - if (type === 1 || (type === 3 && r >= 0.5)) { - r = 1 - r; - } - if (type === 3) { - r *= 2; - } - if (pow === 1) { - r *= r; - } else if (pow === 2) { - r *= r * r; - } else if (pow === 3) { - r *= r * r * r; - } else if (pow === 4) { - r *= r * r * r * r; - } - self.ratio = (type === 1) ? 1 - r : (type === 2) ? r : (time / duration < 0.5) ? r / 2 : 1 - (r / 2); - } else { - self.ratio = self._ease.getRatio(time / duration); - } - } - - if (self._time === prevTime && !force) { return; - } else if (!self._initted) { - self._init(); - if (!self._initted || self._gc) { //immediateRender tweens typically won't initialize until the playhead advances (_time is greater than 0) in order to ensure that overwriting occurs properly. Also, if all of the tweening properties have been overwritten (which would cause _gc to be true, as set in _init()), we shouldn't continue otherwise an onStart callback could be called for example. - return; - } else if (!force && self._firstPT && ((self.vars.lazy !== false && self._duration) || (self.vars.lazy && !self._duration))) { - self._time = self._totalTime = prevTime; - self._rawPrevTime = prevRawPrevTime; - _lazyTweens.push(self); - self._lazy = [time, suppressEvents]; - return; - } - //_ease is initially set to defaultEase, so now that init() has run, _ease is set properly and we need to recalculate the ratio. Overall this is faster than using conditional logic earlier in the method to avoid having to set ratio twice because we only init() once but renderTime() gets called VERY frequently. - if (self._time && !isComplete) { - self.ratio = self._ease.getRatio(self._time / duration); - } else if (isComplete && self._ease._calcEnd) { - self.ratio = self._ease.getRatio((self._time === 0) ? 0 : 1); - } } - if (self._lazy !== false) { //in case a lazy render is pending, we should flush it because the new render is occurring now (imagine a lazy tween instantiating and then immediately the user calls tween.seek(tween.duration()), skipping to the end - the end render would be forced, and then if we didn't flush the lazy render, it'd fire AFTER the seek(), rendering it at the wrong time. - self._lazy = false; - } - if (!self._active) if (!self._paused && self._time !== prevTime && time >= 0) { - self._active = true; //so that if the user renders a tween (as opposed to the timeline rendering it), the timeline is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the tween already finished but the user manually re-renders it as halfway done. - } - if (prevTime === 0) { - if (self._startAt) { - if (time >= 0) { - self._startAt.render(time, true, force); - } else if (!callback) { - callback = "_dummyGS"; //if no callback is defined, use a dummy value just so that the condition at the end evaluates as true because _startAt should render AFTER the normal render loop when the time is negative. We could handle this in a more intuitive way, of course, but the render loop is the MOST important thing to optimize, so this technique allows us to avoid adding extra conditional logic in a high-frequency area. - } - } - if (self.vars.onStart) if (self._time !== 0 || duration === 0) if (!suppressEvents) { - self._callback("onStart"); - } - } - pt = self._firstPT; - while (pt) { - if (pt.f) { - pt.t[pt.p](pt.c * self.ratio + pt.s); - } else { - pt.t[pt.p] = pt.c * self.ratio + pt.s; - } - pt = pt._next; - } - - if (self._onUpdate) { - if (time < 0) if (self._startAt && time !== -0.0001) { //if the tween is positioned at the VERY beginning (_startTime 0) of its parent timeline, it's illegal for the playhead to go back further, so we should not render the recorded startAt values. - self._startAt.render(time, true, force); //note: for performance reasons, we tuck this conditional logic inside less traveled areas (most tweens don't have an onUpdate). We'd just have it at the end before the onComplete, but the values should be updated before any onUpdate is called, so we ALSO put it here and then if it's not called, we do so later near the onComplete. - } - if (!suppressEvents) if (self._time !== prevTime || isComplete || force) { - self._callback("onUpdate"); - } - } - if (callback) if (!self._gc || force) { //check _gc because there's a chance that kill() could be called in an onUpdate - if (time < 0 && self._startAt && !self._onUpdate && time !== -0.0001) { //-0.0001 is a special value that we use when looping back to the beginning of a repeated TimelineMax, in which case we shouldn't render the _startAt values. - self._startAt.render(time, true, force); - } - if (isComplete) { - if (self._timeline.autoRemoveChildren) { - self._enabled(false, false); - } - self._active = false; - } - if (!suppressEvents && self.vars[callback]) { - self._callback(callback); - } - if (duration === 0 && self._rawPrevTime === _tinyNum && rawPrevTime !== _tinyNum) { //the onComplete or onReverseComplete could trigger movement of the playhead and for zero-duration tweens (which must discern direction) that land directly back on their start time, we don't want to fire again on the next render. Think of several addPause()'s in a timeline that forces the playhead to a certain spot, but what if it's already paused and another tween is tweening the "time" of the timeline? Each time it moves [forward] past that spot, it would move back, and since suppressEvents is true, it'd reset _rawPrevTime to _tinyNum so that when it begins again, the callback would fire (so ultimately it could bounce back and forth during that tween). Again, this is a very uncommon scenario, but possible nonetheless. - self._rawPrevTime = 0; + if ($.easing) { + for (p in _easeMap) { + $.easing[p] = _createEase(_easeMap[p]); } + _init = false; } }; - p._kill = function(vars, target, overwritingTween) { - if (vars === "all") { - vars = null; + $.fn.animate = function(prop, speed, easing, callback) { + prop = prop || {}; + if (_init) { + _init(); + if (!TweenLite || !CSSPlugin) { + return _animate.call(this, prop, speed, easing, callback); } - if (vars == null) if (target == null || target === this.target) { - this._lazy = false; - return this._enabled(false, false); + } + if (!_enabled || prop.skipGSAP === true || (typeof(speed) === "object" && typeof(speed.step) === "function")) { //we don't support the "step" feature because it's too costly performance-wise, so fall back to the native animate() call if we sense one. Same with scrollTop and scrollLeft which are handled in a special way in jQuery. + return _animate.call(this, prop, speed, easing, callback); + } + var config = $.speed(speed, easing, callback), + vars = {ease:(_easeMap[config.easing] || ((config.easing === false) ? _easeMap.linear : _easeMap.swing))}, + obj = this, + specEasing = (typeof(speed) === "object") ? speed.specialEasing : null, + val, p, doAnimation, specEasingVars; + + for (p in prop) { + val = prop[p]; + if (val instanceof Array && _easeMap[val[1]]) { + specEasing = specEasing || {}; + specEasing[p] = val[1]; + val = val[0]; } - target = (typeof(target) !== "string") ? (target || this._targets || this.target) : TweenLite.selector(target) || target; - var simultaneousOverwrite = (overwritingTween && this._time && overwritingTween._startTime === this._startTime && this._timeline === overwritingTween._timeline), - firstPT = this._firstPT, - i, overwrittenProps, p, pt, propLookup, changed, killProps, record, killed; - if ((_isArray(target) || _isSelector(target)) && typeof(target[0]) !== "number") { - i = target.length; - while (--i > -1) { - if (this._kill(vars, target[i], overwritingTween)) { - changed = true; - } - } + if (val === "show" || val === "hide" || val === "toggle" || (_legacyProps.indexOf(p) !== -1 && _legacyProps.indexOf("," + p + ",") !== -1)) { //note: slideUp() and slideDown() pass in opacity:"show" or opacity:"hide" + return _animate.call(this, prop, speed, easing, callback); } else { - if (this._targets) { - i = this._targets.length; - while (--i > -1) { - if (target === this._targets[i]) { - propLookup = this._propLookup[i] || {}; - this._overwrittenProps = this._overwrittenProps || []; - overwrittenProps = this._overwrittenProps[i] = vars ? this._overwrittenProps[i] || {} : "all"; - break; - } - } - } else if (target !== this.target) { - return false; - } else { - propLookup = this._propLookup; - overwrittenProps = this._overwrittenProps = vars ? this._overwrittenProps || {} : "all"; - } - - if (propLookup) { - killProps = vars || propLookup; - record = (vars !== overwrittenProps && overwrittenProps !== "all" && vars !== propLookup && (typeof(vars) !== "object" || !vars._tempKill)); //_tempKill is a super-secret way to delete a particular tweening property but NOT have it remembered as an official overwritten property (like in BezierPlugin) - if (overwritingTween && (TweenLite.onOverwrite || this.vars.onOverwrite)) { - for (p in killProps) { - if (propLookup[p]) { - if (!killed) { - killed = []; - } - killed.push(p); - } - } - if ((killed || !vars) && !_onOverwrite(this, overwritingTween, target, killed)) { //if the onOverwrite returned false, that means the user wants to override the overwriting (cancel it). - return false; - } - } - - for (p in killProps) { - if ((pt = propLookup[p])) { - if (simultaneousOverwrite) { //if another tween overwrites this one and they both start at exactly the same time, yet this tween has already rendered once (for example, at 0.001) because it's first in the queue, we should revert the values to where they were at 0 so that the starting values aren't contaminated on the overwriting tween. - if (pt.f) { - pt.t[pt.p](pt.s); - } else { - pt.t[pt.p] = pt.s; - } - changed = true; - } - if (pt.pg && pt.t._kill(killProps)) { - changed = true; //some plugins need to be notified so they can perform cleanup tasks first - } - if (!pt.pg || pt.t._overwriteProps.length === 0) { - if (pt._prev) { - pt._prev._next = pt._next; - } else if (pt === this._firstPT) { - this._firstPT = pt._next; - } - if (pt._next) { - pt._next._prev = pt._prev; - } - pt._next = pt._prev = null; - } - delete propLookup[p]; - } - if (record) { - overwrittenProps[p] = 1; - } - } - if (!this._firstPT && this._initted && firstPT) { //if all tweening properties are killed, kill the tween. Without this line, if there's a tween with multiple targets and then you killTweensOf() each target individually, the tween would technically still remain active and fire its onComplete even though there aren't any more properties tweening. - this._enabled(false, false); - } - } - } - return changed; - }; - - p.invalidate = function() { - if (this._notifyPluginsOfEnabled) { - TweenLite._onPluginEvent("_onDisable", this); - } - var t = this._time; - this._firstPT = this._overwrittenProps = this._startAt = this._onUpdate = null; - this._notifyPluginsOfEnabled = this._active = this._lazy = false; - this._propLookup = (this._targets) ? {} : []; - Animation.prototype.invalidate.call(this); - if (this.vars.immediateRender) { - this._time = -_tinyNum; //forces a render without having to set the render() "force" parameter to true because we want to allow lazying by default (using the "force" parameter always forces an immediate full render) - this.render(t, false, this.vars.lazy !== false); - } - return this; - }; - - p._enabled = function(enabled, ignoreTimeline) { - if (!_tickerActive) { - _ticker.wake(); - } - if (enabled && this._gc) { - var targets = this._targets, - i; - if (targets) { - i = targets.length; - while (--i > -1) { - this._siblings[i] = _register(targets[i], this, true); - } - } else { - this._siblings = _register(this.target, this, true); - } - } - Animation.prototype._enabled.call(this, enabled, ignoreTimeline); - if (this._notifyPluginsOfEnabled) if (this._firstPT) { - return TweenLite._onPluginEvent((enabled ? "_onEnable" : "_onDisable"), this); - } - return false; - }; - - -//----TweenLite static methods ----------------------------------------------------- - - TweenLite.to = function(target, duration, vars) { - return new TweenLite(target, duration, vars); - }; - - TweenLite.from = function(target, duration, vars) { - vars.runBackwards = true; - vars.immediateRender = (vars.immediateRender != false); - return new TweenLite(target, duration, vars); - }; - - TweenLite.fromTo = function(target, duration, fromVars, toVars) { - toVars.startAt = fromVars; - toVars.immediateRender = (toVars.immediateRender != false && fromVars.immediateRender != false); - return new TweenLite(target, duration, toVars); - }; - - TweenLite.delayedCall = function(delay, callback, params, scope, useFrames) { - return new TweenLite(callback, 0, {delay:delay, onComplete:callback, onCompleteParams:params, callbackScope:scope, onReverseComplete:callback, onReverseCompleteParams:params, immediateRender:false, lazy:false, useFrames:useFrames, overwrite:0}); - }; - - TweenLite.set = function(target, vars) { - return new TweenLite(target, 0, vars); - }; - - TweenLite.getTweensOf = function(target, onlyActive) { - if (target == null) { return []; } - target = (typeof(target) !== "string") ? target : TweenLite.selector(target) || target; - var i, a, j, t; - if ((_isArray(target) || _isSelector(target)) && typeof(target[0]) !== "number") { - i = target.length; - a = []; - while (--i > -1) { - a = a.concat(TweenLite.getTweensOf(target[i], onlyActive)); - } - i = a.length; - //now get rid of any duplicates (tweens of arrays of objects could cause duplicates) - while (--i > -1) { - t = a[i]; - j = i; - while (--j > -1) { - if (t === a[j]) { - a.splice(i, 1); - } - } - } - } else if (target._gsTweenID) { - a = _register(target).concat(); - i = a.length; - while (--i > -1) { - if (a[i]._gc || (onlyActive && !a[i].isActive())) { - a.splice(i, 1); - } - } - } - return a || []; - }; - - TweenLite.killTweensOf = TweenLite.killDelayedCallsTo = function(target, onlyActive, vars) { - if (typeof(onlyActive) === "object") { - vars = onlyActive; //for backwards compatibility (before "onlyActive" parameter was inserted) - onlyActive = false; - } - var a = TweenLite.getTweensOf(target, onlyActive), - i = a.length; - while (--i > -1) { - a[i]._kill(vars, target); - } - }; - - - -/* - * ---------------------------------------------------------------- - * TweenPlugin (could easily be split out as a separate file/class, but included for ease of use (so that people don't need to include another script call before loading plugins which is easy to forget) - * ---------------------------------------------------------------- - */ - var TweenPlugin = _class("plugins.TweenPlugin", function(props, priority) { - this._overwriteProps = (props || "").split(","); - this._propName = this._overwriteProps[0]; - this._priority = priority || 0; - this._super = TweenPlugin.prototype; - }, true); - - p = TweenPlugin.prototype; - TweenPlugin.version = "1.19.0"; - TweenPlugin.API = 2; - p._firstPT = null; - p._addTween = _addPropTween; - p.setRatio = _setRatio; - - p._kill = function(lookup) { - var a = this._overwriteProps, - pt = this._firstPT, - i; - if (lookup[this._propName] != null) { - this._overwriteProps = []; - } else { - i = a.length; - while (--i > -1) { - if (lookup[a[i]] != null) { - a.splice(i, 1); - } - } - } - while (pt) { - if (lookup[pt.n] != null) { - if (pt._next) { - pt._next._prev = pt._prev; - } - if (pt._prev) { - pt._prev._next = pt._next; - pt._prev = null; - } else if (this._firstPT === pt) { - this._firstPT = pt._next; - } - } - pt = pt._next; - } - return false; - }; - - p._mod = p._roundProps = function(lookup) { - var pt = this._firstPT, - val; - while (pt) { - val = lookup[this._propName] || (pt.n != null && lookup[ pt.n.split(this._propName + "_").join("") ]); - if (val && typeof(val) === "function") { //some properties that are very plugin-specific add a prefix named after the _propName plus an underscore, so we need to ignore that extra stuff here. - if (pt.f === 2) { - pt.t._applyPT.m = val; - } else { - pt.m = val; - } - } - pt = pt._next; - } - }; - - TweenLite._onPluginEvent = function(type, tween) { - var pt = tween._firstPT, - changed, pt2, first, last, next; - if (type === "_onInitAllProps") { - //sorts the PropTween linked list in order of priority because some plugins need to render earlier/later than others, like MotionBlurPlugin applies its effects after all x/y/alpha tweens have rendered on each frame. - while (pt) { - next = pt._next; - pt2 = first; - while (pt2 && pt2.pr > pt.pr) { - pt2 = pt2._next; - } - if ((pt._prev = pt2 ? pt2._prev : last)) { - pt._prev._next = pt; - } else { - first = pt; - } - if ((pt._next = pt2)) { - pt2._prev = pt; - } else { - last = pt; - } - pt = next; - } - pt = tween._firstPT = first; - } - while (pt) { - if (pt.pg) if (typeof(pt.t[type]) === "function") if (pt.t[type]()) { - changed = true; - } - pt = pt._next; - } - return changed; - }; - - TweenPlugin.activate = function(plugins) { - var i = plugins.length; - while (--i > -1) { - if (plugins[i].API === TweenPlugin.API) { - _plugins[(new plugins[i]())._propName] = plugins[i]; - } - } - return true; - }; - - //provides a more concise way to define plugins that have no dependencies besides TweenPlugin and TweenLite, wrapping common boilerplate stuff into one function (added in 1.9.0). You don't NEED to use this to define a plugin - the old way still works and can be useful in certain (rare) situations. - _gsDefine.plugin = function(config) { - if (!config || !config.propName || !config.init || !config.API) { throw "illegal plugin definition."; } - var propName = config.propName, - priority = config.priority || 0, - overwriteProps = config.overwriteProps, - map = {init:"_onInitTween", set:"setRatio", kill:"_kill", round:"_mod", mod:"_mod", initAll:"_onInitAllProps"}, - Plugin = _class("plugins." + propName.charAt(0).toUpperCase() + propName.substr(1) + "Plugin", - function() { - TweenPlugin.call(this, propName, priority); - this._overwriteProps = overwriteProps || []; - }, (config.global === true)), - p = Plugin.prototype = new TweenPlugin(propName), - prop; - p.constructor = Plugin; - Plugin.API = config.API; - for (prop in map) { - if (typeof(config[prop]) === "function") { - p[map[prop]] = config[prop]; - } - } - Plugin.version = config.version; - TweenPlugin.activate([Plugin]); - return Plugin; - }; - - - //now run through all the dependencies discovered and if any are missing, log that to the console as a warning. This is why it's best to have TweenLite load last - it can check all the dependencies for you. - a = window._gsQueue; - if (a) { - for (i = 0; i < a.length; i++) { - a[i](); - } - for (p in _defLookup) { - if (!_defLookup[p].func) { - window.console.log("GSAP encountered missing dependency: " + p); - } + vars[(p.indexOf("-") === -1) ? p : $.camelCase(p)] = val; } } - _tickerActive = false; //ensures that the first official animation forces a ticker.tick() to update the time when it is instantiated + if (specEasing) { + vars = _copy(vars); + specEasingVars = []; + for (p in specEasing) { + val = specEasingVars[specEasingVars.length] = {}; + _copyCriticalReserved(vars, val); + val.ease = (_easeMap[specEasing[p]] || vars.ease); + if (p.indexOf("-") !== -1) { + p = $.camelCase(p); + } + val[p] = vars[p]; + delete vars[p]; + } + if (specEasingVars.length === 0) { + specEasingVars = null; + } + } -})((typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window, "TweenLite"); -/*! - * VERSION: 1.16.0 - * DATE: 2018-02-15 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * This work is subject to the terms at http://greensock.com/standard-license or for - * Club GreenSock members, the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - **/ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - _gsScope._gsDefine("easing.Back", ["easing.Ease"], function(Ease) { - - var w = (_gsScope.GreenSockGlobals || _gsScope), - gs = w.com.greensock, - _2PI = Math.PI * 2, - _HALF_PI = Math.PI / 2, - _class = gs._class, - _create = function(n, f) { - var C = _class("easing." + n, function(){}, true), - p = C.prototype = new Ease(); - p.constructor = C; - p.getRatio = f; - return C; - }, - _easeReg = Ease.register || function(){}, //put an empty function in place just as a safety measure in case someone loads an OLD version of TweenLite.js where Ease.register doesn't exist. - _wrap = function(name, EaseOut, EaseIn, EaseInOut, aliases) { - var C = _class("easing."+name, { - easeOut:new EaseOut(), - easeIn:new EaseIn(), - easeInOut:new EaseInOut() - }, true); - _easeReg(C, name); - return C; - }, - EasePoint = function(time, value, next) { - this.t = time; - this.v = value; + doAnimation = function(next) { + var varsCopy = _copy(vars), + i; + if (specEasingVars) { + i = specEasingVars.length; + while (--i > -1) { + TweenLite.to(this, $.fx.off ? 0 : config.duration / 1000, specEasingVars[i]); + } + } + varsCopy.onComplete = function() { if (next) { - this.next = next; - next.prev = this; - this.c = next.v - value; - this.gap = next.t - time; + next(); + } else if (config.old) { + $(this).each(config.old); } - }, + }; + TweenLite.to(this, $.fx.off ? 0 : config.duration / 1000, varsCopy); + }; - //Back - _createBack = function(n, f) { - var C = _class("easing." + n, function(overshoot) { - this._p1 = (overshoot || overshoot === 0) ? overshoot : 1.70158; - this._p2 = this._p1 * 1.525; - }, true), - p = C.prototype = new Ease(); - p.constructor = C; - p.getRatio = f; - p.config = function(overshoot) { - return new C(overshoot); - }; - return C; - }, - - Back = _wrap("Back", - _createBack("BackOut", function(p) { - return ((p = p - 1) * p * ((this._p1 + 1) * p + this._p1) + 1); - }), - _createBack("BackIn", function(p) { - return p * p * ((this._p1 + 1) * p - this._p1); - }), - _createBack("BackInOut", function(p) { - return ((p *= 2) < 1) ? 0.5 * p * p * ((this._p2 + 1) * p - this._p2) : 0.5 * ((p -= 2) * p * ((this._p2 + 1) * p + this._p2) + 2); - }) - ), - - - //SlowMo - SlowMo = _class("easing.SlowMo", function(linearRatio, power, yoyoMode) { - power = (power || power === 0) ? power : 0.7; - if (linearRatio == null) { - linearRatio = 0.7; - } else if (linearRatio > 1) { - linearRatio = 1; - } - this._p = (linearRatio !== 1) ? power : 0; - this._p1 = (1 - linearRatio) / 2; - this._p2 = linearRatio; - this._p3 = this._p1 + this._p2; - this._calcEnd = (yoyoMode === true); - }, true), - p = SlowMo.prototype = new Ease(), - SteppedEase, ExpoScaleEase, RoughEase, _createElastic; - - p.constructor = SlowMo; - p.getRatio = function(p) { - var r = p + (0.5 - p) * this._p; - if (p < this._p1) { - return this._calcEnd ? 1 - ((p = 1 - (p / this._p1)) * p) : r - ((p = 1 - (p / this._p1)) * p * p * p * r); - } else if (p > this._p3) { - return this._calcEnd ? (p === 1 ? 0 : 1 - (p = (p - this._p3) / this._p1) * p) : r + ((p - r) * (p = (p - this._p3) / this._p1) * p * p * p); //added p === 1 ? 0 to avoid floating point rounding errors from affecting the final value, like 1 - 0.7 = 0.30000000000000004 instead of 0.3 + if (config.queue !== false) { + obj.queue(config.queue, doAnimation); //note: the queued function will get called once for each element in the jQuery collection. + if (typeof(config.old) === "function") { + $(obj[obj.length-1]).queue(config.queue, function(next) { + config.old.call(obj); + next(); + }); } - return this._calcEnd ? 1 : r; - }; - SlowMo.ease = new SlowMo(0.7, 0.7); - - p.config = SlowMo.config = function(linearRatio, power, yoyoMode) { - return new SlowMo(linearRatio, power, yoyoMode); - }; + } else { + doAnimation.call(obj); + } + + return obj; + }; - //SteppedEase - SteppedEase = _class("easing.SteppedEase", function(steps, immediateStart) { - steps = steps || 1; - this._p1 = 1 / steps; - this._p2 = steps + (immediateStart ? 0 : 1); - this._p3 = immediateStart ? 1 : 0; - }, true); - p = SteppedEase.prototype = new Ease(); - p.constructor = SteppedEase; - p.getRatio = function(p) { - if (p < 0) { - p = 0; - } else if (p >= 1) { - p = 0.999999999; - } - return (((this._p2 * p) | 0) + this._p3) * this._p1; - }; - p.config = SteppedEase.config = function(steps, immediateStart) { - return new SteppedEase(steps, immediateStart); - }; - - - //ExpoScaleEase - ExpoScaleEase = _class("easing.ExpoScaleEase", function(start, end, ease) { - this._p1 = Math.log(end / start); - this._p2 = end - start; - this._p3 = start; - this._ease = ease; - }, true); - p = ExpoScaleEase.prototype = new Ease(); - p.constructor = ExpoScaleEase; - p.getRatio = function(p) { - if (this._ease) { - p = this._ease.getRatio(p); - } - return (this._p3 * Math.exp(this._p1 * p) - this._p3) / this._p2; - }; - p.config = ExpoScaleEase.config = function(start, end, ease) { - return new ExpoScaleEase(start, end, ease); - }; - - - //RoughEase - RoughEase = _class("easing.RoughEase", function(vars) { - vars = vars || {}; - var taper = vars.taper || "none", - a = [], - cnt = 0, - points = (vars.points || 20) | 0, - i = points, - randomize = (vars.randomize !== false), - clamp = (vars.clamp === true), - template = (vars.template instanceof Ease) ? vars.template : null, - strength = (typeof(vars.strength) === "number") ? vars.strength * 0.4 : 0.4, - x, y, bump, invX, obj, pnt; - while (--i > -1) { - x = randomize ? Math.random() : (1 / points) * i; - y = template ? template.getRatio(x) : x; - if (taper === "none") { - bump = strength; - } else if (taper === "out") { - invX = 1 - x; - bump = invX * invX * strength; - } else if (taper === "in") { - bump = x * x * strength; - } else if (x < 0.5) { //"both" (start) - invX = x * 2; - bump = invX * invX * 0.5 * strength; - } else { //"both" (end) - invX = (1 - x) * 2; - bump = invX * invX * 0.5 * strength; - } - if (randomize) { - y += (Math.random() * bump) - (bump * 0.5); - } else if (i % 2) { - y += bump * 0.5; - } else { - y -= bump * 0.5; - } - if (clamp) { - if (y > 1) { - y = 1; - } else if (y < 0) { - y = 0; + $.fn.stop = function(clearQueue, gotoEnd) { + _stop.call(this, clearQueue, gotoEnd); + if (TweenLite) { + if (gotoEnd) { + var tweens = TweenLite.getTweensOf(this), + i = tweens.length, + progress; + while (--i > -1) { + progress = tweens[i].totalTime() / tweens[i].totalDuration(); + if (progress > 0 && progress < 1) { + tweens[i].seek(tweens[i].totalDuration()); } } - a[cnt++] = {x:x, y:y}; } - a.sort(function(a, b) { - return a.x - b.x; - }); - - pnt = new EasePoint(1, 1, null); - i = points; - while (--i > -1) { - obj = a[i]; - pnt = new EasePoint(obj.x, obj.y, pnt); - } - - this._prev = new EasePoint(0, 0, (pnt.t !== 0) ? pnt : pnt.next); - }, true); - p = RoughEase.prototype = new Ease(); - p.constructor = RoughEase; - p.getRatio = function(p) { - var pnt = this._prev; - if (p > pnt.t) { - while (pnt.next && p >= pnt.t) { - pnt = pnt.next; - } - pnt = pnt.prev; - } else { - while (pnt.prev && p <= pnt.t) { - pnt = pnt.prev; - } - } - this._prev = pnt; - return (pnt.v + ((p - pnt.t) / pnt.gap) * pnt.c); - }; - p.config = function(vars) { - return new RoughEase(vars); - }; - RoughEase.ease = new RoughEase(); - - - //Bounce - _wrap("Bounce", - _create("BounceOut", function(p) { - if (p < 1 / 2.75) { - return 7.5625 * p * p; - } else if (p < 2 / 2.75) { - return 7.5625 * (p -= 1.5 / 2.75) * p + 0.75; - } else if (p < 2.5 / 2.75) { - return 7.5625 * (p -= 2.25 / 2.75) * p + 0.9375; - } - return 7.5625 * (p -= 2.625 / 2.75) * p + 0.984375; - }), - _create("BounceIn", function(p) { - if ((p = 1 - p) < 1 / 2.75) { - return 1 - (7.5625 * p * p); - } else if (p < 2 / 2.75) { - return 1 - (7.5625 * (p -= 1.5 / 2.75) * p + 0.75); - } else if (p < 2.5 / 2.75) { - return 1 - (7.5625 * (p -= 2.25 / 2.75) * p + 0.9375); - } - return 1 - (7.5625 * (p -= 2.625 / 2.75) * p + 0.984375); - }), - _create("BounceInOut", function(p) { - var invert = (p < 0.5); - if (invert) { - p = 1 - (p * 2); - } else { - p = (p * 2) - 1; - } - if (p < 1 / 2.75) { - p = 7.5625 * p * p; - } else if (p < 2 / 2.75) { - p = 7.5625 * (p -= 1.5 / 2.75) * p + 0.75; - } else if (p < 2.5 / 2.75) { - p = 7.5625 * (p -= 2.25 / 2.75) * p + 0.9375; - } else { - p = 7.5625 * (p -= 2.625 / 2.75) * p + 0.984375; - } - return invert ? (1 - p) * 0.5 : p * 0.5 + 0.5; - }) - ); - - - //CIRC - _wrap("Circ", - _create("CircOut", function(p) { - return Math.sqrt(1 - (p = p - 1) * p); - }), - _create("CircIn", function(p) { - return -(Math.sqrt(1 - (p * p)) - 1); - }), - _create("CircInOut", function(p) { - return ((p*=2) < 1) ? -0.5 * (Math.sqrt(1 - p * p) - 1) : 0.5 * (Math.sqrt(1 - (p -= 2) * p) + 1); - }) - ); - - - //Elastic - _createElastic = function(n, f, def) { - var C = _class("easing." + n, function(amplitude, period) { - this._p1 = (amplitude >= 1) ? amplitude : 1; //note: if amplitude is < 1, we simply adjust the period for a more natural feel. Otherwise the math doesn't work right and the curve starts at 1. - this._p2 = (period || def) / (amplitude < 1 ? amplitude : 1); - this._p3 = this._p2 / _2PI * (Math.asin(1 / this._p1) || 0); - this._p2 = _2PI / this._p2; //precalculate to optimize - }, true), - p = C.prototype = new Ease(); - p.constructor = C; - p.getRatio = f; - p.config = function(amplitude, period) { - return new C(amplitude, period); - }; - return C; - }; - _wrap("Elastic", - _createElastic("ElasticOut", function(p) { - return this._p1 * Math.pow(2, -10 * p) * Math.sin( (p - this._p3) * this._p2 ) + 1; - }, 0.3), - _createElastic("ElasticIn", function(p) { - return -(this._p1 * Math.pow(2, 10 * (p -= 1)) * Math.sin( (p - this._p3) * this._p2 )); - }, 0.3), - _createElastic("ElasticInOut", function(p) { - return ((p *= 2) < 1) ? -0.5 * (this._p1 * Math.pow(2, 10 * (p -= 1)) * Math.sin( (p - this._p3) * this._p2)) : this._p1 * Math.pow(2, -10 *(p -= 1)) * Math.sin( (p - this._p3) * this._p2 ) * 0.5 + 1; - }, 0.45) - ); - - - //Expo - _wrap("Expo", - _create("ExpoOut", function(p) { - return 1 - Math.pow(2, -10 * p); - }), - _create("ExpoIn", function(p) { - return Math.pow(2, 10 * (p - 1)) - 0.001; - }), - _create("ExpoInOut", function(p) { - return ((p *= 2) < 1) ? 0.5 * Math.pow(2, 10 * (p - 1)) : 0.5 * (2 - Math.pow(2, -10 * (p - 1))); - }) - ); - - - //Sine - _wrap("Sine", - _create("SineOut", function(p) { - return Math.sin(p * _HALF_PI); - }), - _create("SineIn", function(p) { - return -Math.cos(p * _HALF_PI) + 1; - }), - _create("SineInOut", function(p) { - return -0.5 * (Math.cos(Math.PI * p) - 1); - }) - ); - - _class("easing.EaseLookup", { - find:function(s) { - return Ease.map[s]; - } - }, true); - - //register the non-standard eases - _easeReg(w.SlowMo, "SlowMo", "ease,"); - _easeReg(RoughEase, "RoughEase", "ease,"); - _easeReg(SteppedEase, "SteppedEase", "ease,"); - - return Back; - - }, true); - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } - -//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function() { - "use strict"; - var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope); + TweenLite.killTweensOf(this); + } + return this; }; - if (typeof(module) !== "undefined" && module.exports) { //node - require("../TweenLite.js"); - module.exports = getGlobal(); - } else if (typeof(define) === "function" && define.amd) { //AMD - define(["TweenLite"], getGlobal); - } -}()); + + $.gsap = { + enabled:function(value) { + _enabled = value; + }, + version:"0.1.13", + legacyProps:function(value) { + _legacyProps = _defaultLegacyProps + value + ","; + } + }; + +}(jQuery)); /*! * VERSION: 0.2.1 * DATE: 2018-02-15 @@ -117794,7 +117412,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa } }("CustomWiggle")); /*! - * VERSION: 0.3.1 + * VERSION: 1.16.0 * DATE: 2018-02-15 * UPDATES AND DOCS AT: http://greensock.com * @@ -117810,8892 +117428,362 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa "use strict"; - _gsScope._gsDefine.plugin({ - propName: "directionalRotation", - version: "0.3.1", - API: 2, - - //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. - init: function(target, value, tween, index) { - if (typeof(value) !== "object") { - value = {rotation:value}; - } - this.finals = {}; - var cap = (value.useRadians === true) ? Math.PI * 2 : 360, - min = 0.000001, - p, v, start, end, dif, split; - for (p in value) { - if (p !== "useRadians") { - end = value[p]; - if (typeof(end) === "function") { - end = end(index, target); - } - split = (end + "").split("_"); - v = split[0]; - start = parseFloat( (typeof(target[p]) !== "function") ? target[p] : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() ); - end = this.finals[p] = (typeof(v) === "string" && v.charAt(1) === "=") ? start + parseInt(v.charAt(0) + "1", 10) * Number(v.substr(2)) : Number(v) || 0; - dif = end - start; - if (split.length) { - v = split.join("_"); - if (v.indexOf("short") !== -1) { - dif = dif % cap; - if (dif !== dif % (cap / 2)) { - dif = (dif < 0) ? dif + cap : dif - cap; - } - } - if (v.indexOf("_cw") !== -1 && dif < 0) { - dif = ((dif + cap * 9999999999) % cap) - ((dif / cap) | 0) * cap; - } else if (v.indexOf("ccw") !== -1 && dif > 0) { - dif = ((dif - cap * 9999999999) % cap) - ((dif / cap) | 0) * cap; - } - } - if (dif > min || dif < -min) { - this._addTween(target, p, start, start + dif, p); - this._overwriteProps.push(p); - } - } - } - return true; - }, - - //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) - set: function(ratio) { - var pt; - if (ratio !== 1) { - this._super.setRatio.call(this, ratio); - } else { - pt = this._firstPT; - while (pt) { - if (pt.f) { - pt.t[pt.p](this.finals[pt.p]); - } else { - pt.t[pt.p] = this.finals[pt.p]; - } - pt = pt._next; - } - } - } - - })._autoCSS = true; - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } - -//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function(name) { - "use strict"; - var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope)[name]; - }; - if (typeof(module) !== "undefined" && module.exports) { //node - require("../TweenLite.js"); - module.exports = getGlobal(); - } else if (typeof(define) === "function" && define.amd) { //AMD - define(["TweenLite"], getGlobal); - } -}("DirectionalRotationPlugin")); -/*! - * VERSION: 0.2.1 - * DATE: 2018-02-15 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * PhysicsPropsPlugin is a Club GreenSock membership benefit; You must have a valid membership to use - * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. - * This work is subject to the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - */ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - var PhysicsProp = function(target, p, velocity, acceleration, friction, stepsPerTimeUnit) { - this.p = p; - this.f = (typeof(target[p]) === "function"); - this.start = this.value = (!this.f) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ](); - this.velocity = velocity || 0; - this.v = this.velocity / stepsPerTimeUnit; - if (acceleration || acceleration == 0) { - this.acceleration = acceleration; - this.a = this.acceleration / (stepsPerTimeUnit * stepsPerTimeUnit); - } else { - this.acceleration = this.a = 0; - } - this.friction = 1 - (friction || 0) ; + _gsScope._gsDefine("easing.Back", ["easing.Ease"], function(Ease) { + + var w = (_gsScope.GreenSockGlobals || _gsScope), + gs = w.com.greensock, + _2PI = Math.PI * 2, + _HALF_PI = Math.PI / 2, + _class = gs._class, + _create = function(n, f) { + var C = _class("easing." + n, function(){}, true), + p = C.prototype = new Ease(); + p.constructor = C; + p.getRatio = f; + return C; }, - _random = Math.random(), - _globals = _gsScope._gsDefine.globals, - _rootFramesTimeline = _globals.com.greensock.core.Animation._rootFramesTimeline, - - PhysicsPropsPlugin = _gsScope._gsDefine.plugin({ - propName: "physicsProps", - version: "0.2.1", - API: 2, - - //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. - init: function(target, value, tween, index) { - if (typeof(value) === "function") { - value = value(target); - } - this._target = target; - this._tween = tween; - this._runBackwards = (tween.vars.runBackwards === true); - this._step = 0; - var tl = tween._timeline, - cnt = 0, - p, curProp; - while (tl._timeline) { - tl = tl._timeline; - } - this._stepsPerTimeUnit = (tl === _rootFramesTimeline) ? 1 : 30; - this._props = []; - for (p in value) { - curProp = value[p]; - if (typeof(curProp) === "function") { - curProp = curProp(index, target); - } - if (curProp.velocity || curProp.acceleration) { - this._props[cnt++] = new PhysicsProp(target, p, curProp.velocity, curProp.acceleration, curProp.friction, this._stepsPerTimeUnit); - this._overwriteProps[cnt] = p; - if (curProp.friction) { - this._hasFriction = true; - } - } - } - return true; - }, - - //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) - set: function(ratio) { - var i = this._props.length, - time = this._tween._time, - target = this._target, - curProp, val, steps, remainder, j, tt; - if (this._runBackwards) { - time = this._tween._duration - time; - } - if (this._hasFriction) { - time *= this._stepsPerTimeUnit; - steps = (time | 0) - this._step; - remainder = time % 1; - if (steps >= 0) { //going forward - while (--i > -1) { - curProp = this._props[i]; - j = steps; - while (--j > -1) { - curProp.v += curProp.a; - curProp.v *= curProp.friction; - curProp.value += curProp.v; - } - val = curProp.value + (curProp.v * remainder); - if (curProp.m) { - val = curProp.m(val, target); - } - if (curProp.f) { - target[curProp.p](val); - } else { - target[curProp.p] = val; - } - } - - } else { //going backwards - while (--i > -1) { - curProp = this._props[i]; - j = -steps; - while (--j > -1) { - curProp.value -= curProp.v; - curProp.v /= curProp.friction; - curProp.v -= curProp.a; - } - val = curProp.value + (curProp.v * remainder); - if (curProp.m) { - val = curProp.m(val, target); - } - if (curProp.f) { - target[curProp.p](val); - } else { - target[curProp.p] = val; - } - } - } - this._step += steps; - - } else { - tt = time * time * 0.5; - while (--i > -1) { - curProp = this._props[i]; - val = curProp.start + ((curProp.velocity * time) + (curProp.acceleration * tt)); - if (curProp.m) { - val = curProp.m(val, target); - } - if (curProp.f) { - target[curProp.p](val); - } else { - target[curProp.p] = val; - } - } - } - } - - }), - p = PhysicsPropsPlugin.prototype; - - p._kill = function(lookup) { - var i = this._props.length; - while (--i > -1) { - if (this._props[i].p in lookup) { - this._props.splice(i, 1); - } - } - return this._super._kill.call(this, lookup); - }; - - p._mod = function(lookup) { - var i = this._props.length, - val; - while (--i > -1) { - val = lookup[this._props[i].p] || lookup.physicsProps; - if (typeof(val) === "function") { - this._props[i].m = val; - } - } - }; - - PhysicsPropsPlugin._autoCSS = true; //indicates that this plugin can be inserted into the "css" object using the autoCSS feature of TweenLite - PhysicsPropsPlugin._cssRegister = function() { - var CSSPlugin = _globals.CSSPlugin; - if (!CSSPlugin) { - return; - } - var _internals = CSSPlugin._internals, - _parseToProxy = _internals._parseToProxy, - _setPluginRatio = _internals._setPluginRatio, - CSSPropTween = _internals.CSSPropTween; - _internals._registerComplexSpecialProp("physicsProps", {parser:function(t, e, prop, cssp, pt, plugin) { - plugin = new PhysicsPropsPlugin(); - var vars = {}, - p, data; - if (e.scale) { - e.scaleX = e.scaleY = e.scale; - delete e.scale; - } - for (p in e) { - vars[p] = _random++; //doesn't really matter what values we put here because the plugin will determine end values, but it'd be best of the values don't match the current ones so that CSSPlugin doesn't skip creating a CSSPropTween. - } - data = _parseToProxy(t, vars, cssp, pt, plugin); - pt = new CSSPropTween(t, "physicsProps", 0, 0, data.pt, 2); - pt.data = data; - pt.plugin = plugin; - pt.setRatio = _setPluginRatio; - plugin._onInitTween(data.proxy, e, cssp._tween); - return pt; - }}); - }; - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } -//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function(name) { - "use strict"; - var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope)[name]; - }; - if (typeof(module) !== "undefined" && module.exports) { //node - require("../TweenLite.js"); - module.exports = getGlobal(); - } else if (typeof(define) === "function" && define.amd) { //AMD - define(["TweenLite"], getGlobal); - } -}("PhysicsPropsPlugin")); -/*! - * VERSION: 1.2.0 - * DATE: 2018-02-15 - * UPDATES AND DOCS AT: http://greensock.com - * - * This file is to be used as a simple template for writing your own plugin. See the - * TweenPlugin docs for more details. - * - * You can start by doing a search for "yourCustomProperty" and replace it with whatever the name - * of your property is. This way of defining a plugin was introduced in version 1.9.0 - previous versions - * of TweenLite won't work with this. - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * This work is subject to the terms at http://greensock.com/standard-license or for - * Club GreenSock members, the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - **/ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - //ignore the line above this and at the very end - those are for ensuring things load in the proper order - "use strict"; - - _gsScope._gsDefine.plugin({ - propName: "yourCustomProperty", //the name of the property that will get intercepted and handled by this plugin (obviously change it to whatever you want, typically it is camelCase starting with lowercase). - priority: 0, //the priority in the rendering pipeline (0 by default). A priority of -1 would mean this plugin will run after all those with 0 or greater. A priority of 1 would get run before 0, etc. This only matters when a plugin relies on other plugins finishing their work before it runs (or visa-versa) - API: 2, //the API should stay 2 - it just gives us a way to know the method/property structure so that if in the future we change to a different TweenPlugin architecture, we can identify this plugin's structure. - version: "1.0.0", //your plugin's version number - overwriteProps: ["yourCustomProperty"], //an array of property names whose tweens should be overwritten by this plugin. For example, if you create a "scale" plugin that handles both "scaleX" and "scaleY", the overwriteProps would be ["scaleX","scaleY"] so that if there's a scaleX or scaleY tween in-progress when a new "scale" tween starts (using this plugin), it would overwrite the scaleX or scaleY tween. - - /* - * The init function is called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. It receives 3 parameters: - * 1) target [object] - the target of the tween. In cases where the tween's original target is an array (or jQuery object), this target will be the individual object inside that array (a new plugin instance is created for each target in the array). For example, TweenLite.to([obj1, obj2, obj3], 1, {x:100}) the target will be obj1 or obj2 or obj3 rather than the array containing them. - * 2) value [*] - whatever value is passed as the special property value. For example, TweenLite.to(element, 1, {yourCustomProperty:3}) the value would be 3. Or for TweenLite.to(element, 1, {yourCustomProperty:{subProp1:3, subProp2:"whatever"}});, value would be {subProp1:3, subProp2:"whatever"}. - * 3) tween [TweenLite] - the TweenLite (or TweenMax) instance that is managing this plugin instance. This can be useful if you need to check certain state-related properties on the tween (maybe in the set method) like its duration or time. Most of the time, however, you don't need to do anything with the tween. It is provided just in case you want to reference it. - * 4) index [integer] - the index number of the target in the tween. For example, if an array is passed in as the target (or selector text), this would be 0 for the first one, 1 for the second, 2 for the third, etc. This was introduced in GSAP 1.19.0 - * - * This function should return true unless you want to have TweenLite/Max skip the plugin altogether and instead treat the property/value like a normal tween (as if the plugin wasn't activated). This is rarely useful, so you should almost always return true. - */ - init: function(target, value, tween, index) { - this._target = target; //we record the target so that we can refer to it in the set method when doing updates. - - /* Next, we create a property tween for "scaleX" and "scaleY" properties of our target - * (we're just using them as a examples of how to set up a property tween with a name, start, and end value). - * the _addTween() method accepts the following parameters: - * 1) target [object] - target object whose property this tween will control. - * 2) property [string] - the name of the property, like "scaleX" or "scaleY" - * 3) start [number] - The starting value of the property. For example, if you're tweening from 0 to 100, start would be 0. - * 4) end [number] - the ending value of the property. For example, if you're tweening from 0 to 100, end would be 100. - * 5) overwriteProperty [string] - the name that gets registered as the overwrite property so that if another concurrent tween of the same target gets created and it is tweening a property with this name, this one will be overwritten. Typically this is the same as "property". - * 6) round [boolean] - if true, the updated value on each update will be rounded to the nearest integer. [false by default] - * You do NOT need to use _addTween() at all. It is merely a convenience. You can record your own values internally or whatever you want. - */ - this._addTween(target, "scaleX", target.scaleX, value, "scaleX", false); - this._addTween(target, "scaleY", target.scaleY, value, "scaleY", false); - - //now, just for kicks, we'll record the starting "alpha" value and amount of change so that we can manage this manually rather than _addTween() (again, totally fictitious, just for an example) - this._alphaStart = target.alpha; - this._alphaChange = value.alpha - target.alpha; - - //always return true unless we want to scrap the plugin and have the value treated as a normal property tween (very uncommon) - return true; - }, - - //[optional] - called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.). If you're using this._super._addTween() for all your tweens and you don't need to do anything special on each frame besides updating those values, you can omit this "set" function altogether. - set: function(ratio) { - //since we used _addTween() inside init function, it created some property tweens that we'll update by calling the parent prototype's setRatio() (otherwise, the property tweens wouldn't get their values updated). this._super refers to the TweenPlugin prototype from which the plugin inherits (not that you need to worry about that). - this._super.setRatio.call(this, ratio); - - //now manually set the alpha - this._target.alpha = this._alphaStart + this._alphaChange * ratio; - } - - }); - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } -/*! - * VERSION: 1.9.2 - * DATE: 2019-02-07 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * This work is subject to the terms at http://greensock.com/standard-license or for - * Club GreenSock members, the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - **/ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - var _doc = (_gsScope.document || {}).documentElement, - _window = _gsScope, - _max = function(element, axis) { - var dim = (axis === "x") ? "Width" : "Height", - scroll = "scroll" + dim, - client = "client" + dim, - body = document.body; - return (element === _window || element === _doc || element === body) ? Math.max(_doc[scroll], body[scroll]) - (_window["inner" + dim] || _doc[client] || body[client]) : element[scroll] - element["offset" + dim]; - }, - _unwrapElement = function(value) { - if (typeof(value) === "string") { - value = TweenLite.selector(value); - } - if (value.length && value !== _window && value[0] && value[0].style && !value.nodeType) { - value = value[0]; - } - return (value === _window || (value.nodeType && value.style)) ? value : null; - }, - _buildGetter = function(e, axis) { //pass in an element and an axis ("x" or "y") and it'll return a getter function for the scroll position of that element (like scrollTop or scrollLeft, although if the element is the window, it'll use the pageXOffset/pageYOffset or the documentElement's scrollTop/scrollLeft or document.body's. Basically this streamlines things and makes a very fast getter across browsers. - var p = "scroll" + ((axis === "x") ? "Left" : "Top"); - if (e === _window) { - if (e.pageXOffset != null) { - p = "page" + axis.toUpperCase() + "Offset"; - } else if (_doc[p] != null) { - e = _doc; - } else { - e = document.body; - } - } - return function() { - return e[p]; - }; - }, - _getOffset = function(element, container) { - var rect = _unwrapElement(element).getBoundingClientRect(), - b = document.body, - isRoot = (!container || container === _window || container === b), - cRect = isRoot ? {top:_doc.clientTop - (window.pageYOffset || _doc.scrollTop || b.scrollTop || 0), left:_doc.clientLeft - (window.pageXOffset || _doc.scrollLeft || b.scrollLeft || 0)} : container.getBoundingClientRect(), - offsets = {x: rect.left - cRect.left, y: rect.top - cRect.top}; - if (!isRoot && container) { //only add the current scroll position if it's not the window/body. - offsets.x += _buildGetter(container, "x")(); - offsets.y += _buildGetter(container, "y")(); - } - return offsets; - /* PREVIOUS - var rect = _unwrapElement(element).getBoundingClientRect(), - isRoot = (!container || container === _window || container === document.body), - cRect = (isRoot ? _doc : container).getBoundingClientRect(), - offsets = {x: rect.left - cRect.left, y: rect.top - cRect.top}; - if (!isRoot && container) { //only add the current scroll position if it's not the window/body. - offsets.x += _buildGetter(container, "x")(); - offsets.y += _buildGetter(container, "y")(); - } - return offsets; - */ - }, - _parseVal = function(value, target, axis, currentVal) { - var type = typeof(value); - return !isNaN(value) ? parseFloat(value) : (type === "string" && value.charAt(1) === "=") ? parseInt(value.charAt(0) + "1", 10) * parseFloat(value.substr(2)) + currentVal : (value === "max") ? _max(target, axis) : Math.min(_max(target, axis), _getOffset(value, target)[axis]); - }, - - ScrollToPlugin = _gsScope._gsDefine.plugin({ - propName: "scrollTo", - API: 2, - global: true, - version:"1.9.2", - - //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. - init: function(target, value, tween) { - this._wdw = (target === _window); - this._target = target; - this._tween = tween; - if (typeof(value) !== "object") { - value = {y:value}; //if we don't receive an object as the parameter, assume the user intends "y". - if (typeof(value.y) === "string" && value.y !== "max" && value.y.charAt(1) !== "=") { - value.x = value.y; - } - } else if (value.nodeType) { - value = {y:value, x:value}; - } - this.vars = value; - this._autoKill = (value.autoKill !== false); - this.getX = _buildGetter(target, "x"); - this.getY = _buildGetter(target, "y"); - this.x = this.xPrev = this.getX(); - this.y = this.yPrev = this.getY(); - if (value.x != null) { - this._addTween(this, "x", this.x, _parseVal(value.x, target, "x", this.x) - (value.offsetX || 0), "scrollTo_x", true); - this._overwriteProps.push("scrollTo_x"); - } else { - this.skipX = true; - } - if (value.y != null) { - this._addTween(this, "y", this.y, _parseVal(value.y, target, "y", this.y) - (value.offsetY || 0), "scrollTo_y", true); - this._overwriteProps.push("scrollTo_y"); - } else { - this.skipY = true; - } - return true; + _easeReg = Ease.register || function(){}, //put an empty function in place just as a safety measure in case someone loads an OLD version of TweenLite.js where Ease.register doesn't exist. + _wrap = function(name, EaseOut, EaseIn, EaseInOut, aliases) { + var C = _class("easing."+name, { + easeOut:new EaseOut(), + easeIn:new EaseIn(), + easeInOut:new EaseInOut() + }, true); + _easeReg(C, name); + return C; }, - - //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) - set: function(v) { - this._super.setRatio.call(this, v); - - var x = (this._wdw || !this.skipX) ? this.getX() : this.xPrev, - y = (this._wdw || !this.skipY) ? this.getY() : this.yPrev, - yDif = y - this.yPrev, - xDif = x - this.xPrev, - threshold = ScrollToPlugin.autoKillThreshold; - - if (this.x < 0) { //can't scroll to a position less than 0! Might happen if someone uses a Back.easeOut or Elastic.easeOut when scrolling back to the top of the page (for example) - this.x = 0; - } - if (this.y < 0) { - this.y = 0; - } - if (this._autoKill) { - //note: iOS has a bug that throws off the scroll by several pixels, so we need to check if it's within 7 pixels of the previous one that we set instead of just looking for an exact match. - if (!this.skipX && (xDif > threshold || xDif < -threshold) && x < _max(this._target, "x")) { - this.skipX = true; //if the user scrolls separately, we should stop tweening! - } - if (!this.skipY && (yDif > threshold || yDif < -threshold) && y < _max(this._target, "y")) { - this.skipY = true; //if the user scrolls separately, we should stop tweening! - } - if (this.skipX && this.skipY) { - this._tween.kill(); - if (this.vars.onAutoKill) { - this.vars.onAutoKill.apply(this.vars.onAutoKillScope || this._tween, this.vars.onAutoKillParams || []); - } - } - } - if (this._wdw) { - _window.scrollTo((!this.skipX) ? this.x : x, (!this.skipY) ? this.y : y); - } else { - if (!this.skipY) { - this._target.scrollTop = this.y; - } - if (!this.skipX) { - this._target.scrollLeft = this.x; - } - } - this.xPrev = this.x; - this.yPrev = this.y; - } - - }), - p = ScrollToPlugin.prototype; - - ScrollToPlugin.max = _max; - ScrollToPlugin.getOffset = _getOffset; - ScrollToPlugin.buildGetter = _buildGetter; - ScrollToPlugin.autoKillThreshold = 7; - - p._kill = function(lookup) { - if (lookup.scrollTo_x) { - this.skipX = true; - } - if (lookup.scrollTo_y) { - this.skipY = true; - } - return this._super._kill.call(this, lookup); - }; - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } - -//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function(name) { - "use strict"; - var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope)[name]; - }; - if (typeof(module) !== "undefined" && module.exports) { //node - require("../TweenLite.js"); - module.exports = getGlobal(); - } else if (typeof(define) === "function" && define.amd) { //AMD - define(["TweenLite"], getGlobal); - } -}("ScrollToPlugin")); -/*! - * VERSION: 0.6.1 - * DATE: 2018-02-15 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * This work is subject to the terms at http://greensock.com/standard-license or for - * Club GreenSock members, the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - */ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - _gsScope._gsDefine.plugin({ - propName: "attr", - API: 2, - version: "0.6.1", - - //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. - init: function(target, value, tween, index) { - var p, end; - if (typeof(target.setAttribute) !== "function") { - return false; - } - for (p in value) { - end = value[p]; - if (typeof(end) === "function") { - end = end(index, target); - } - this._addTween(target, "setAttribute", target.getAttribute(p) + "", end + "", p, false, p); - this._overwriteProps.push(p); - } - return true; - } - - }); - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } - -//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function(name) { - "use strict"; - var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope)[name]; - }; - if (typeof(module) !== "undefined" && module.exports) { //node - require("../TweenLite.js"); - module.exports = getGlobal(); - } else if (typeof(define) === "function" && define.amd) { //AMD - define(["TweenLite"], getGlobal); - } -}("AttrPlugin")); -/*! - * VERSION: 0.6.2 - * DATE: 2018-02-15 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * This work is subject to the terms at http://greensock.com/standard-license or for - * Club GreenSock members, the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - */ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - var _getText = function(e) { - var type = e.nodeType, - result = ""; - if (type === 1 || type === 9 || type === 11) { - if (typeof(e.textContent) === "string") { - return e.textContent; - } else { - for ( e = e.firstChild; e; e = e.nextSibling ) { - result += _getText(e); - } - } - } else if (type === 3 || type === 4) { - return e.nodeValue; - } - return result; - }, - _emoji = "[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2694-\u2697]|\uD83E[\uDD10-\uDD5D]|[\uD800-\uDBFF][\uDC00-\uDFFF]", - _emojiExp = new RegExp(_emoji), - _emojiAndCharsExp = new RegExp(_emoji + "|.", "g"), - _emojiSafeSplit = function(text, delimiter) { - return ((delimiter === "" || !delimiter) && _emojiExp.test(text)) ? text.match(_emojiAndCharsExp) : text.split(delimiter || ""); - }, - /* //previous emoji-related splitting. New method above is faster and more concise. - _emojiStart = 0xD800, - _emojiEnd = 0xDBFF, - _emojiLowStart = 0xDC00, - _emojiRegionStart = 0x1F1E6, - _emojiRegionEnd = 0x1F1FF, - _emojiModStart = 0x1f3fb, - _emojiModEnd = 0x1f3ff, - _emojiPairCode = function(s) { - return ((s.charCodeAt(0) - _emojiStart) << 10) + (s.charCodeAt(1) - _emojiLowStart) + 0x10000; - }, - _emojiSafeSplit = function(text, delimiter) { //like calling String.split(delimiter) except that it keeps emoji characters together. - if (delimiter !== "") { - return text.split(delimiter); - } - var l = text.length, - a = [], - character, i, emojiPair1, emojiPair2, j; - for (i = 0; i < l; i++) { - character = text.charAt(i); - if ((character.charCodeAt(0) >= _emojiStart && character.charCodeAt(0) <= _emojiEnd) || (text.charCodeAt(i+1) >= 0xFE00 && text.charCodeAt(i+1) <= 0xFE0F)) { //special emoji characters use 2 or 4 unicode characters that we must keep together. - emojiPair1 = _emojiPairCode(text.substr(i, 2)); - emojiPair2 = _emojiPairCode(text.substr(i + 2, 2)); - j = ((emojiPair1 >= _emojiRegionStart && emojiPair1 <= _emojiRegionEnd && emojiPair2 >= _emojiRegionStart && emojiPair2 <= _emojiRegionEnd) || (emojiPair2 >= _emojiModStart && emojiPair2 <= _emojiModEnd)) ? 4 : 2; - a.push(text.substr(i, j)); - i += j - 1; - } else { - a.push(character); - } - } - return a; - }, - */ - TextPlugin = _gsScope._gsDefine.plugin({ - propName: "text", - API: 2, - version:"0.6.2", - - //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. - init: function(target, value, tween, index) { - var i = target.nodeName.toUpperCase(), - shrt; - if (typeof(value) === "function") { - value = value(index, target); - } - this._svg = (target.getBBox && (i === "TEXT" || i === "TSPAN")); - if (!("innerHTML" in target) && !this._svg) { - return false; - } - this._target = target; - if (typeof(value) !== "object") { - value = {value:value}; - } - if (value.value === undefined) { - this._text = this._original = [""]; - return true; - } - this._delimiter = value.delimiter || ""; - this._original = _emojiSafeSplit(_getText(target).replace(/\s+/g, " "), this._delimiter); - this._text = _emojiSafeSplit(value.value.replace(/\s+/g, " "), this._delimiter); - this._runBackwards = (tween.vars.runBackwards === true); - if (this._runBackwards) { - i = this._original; - this._original = this._text; - this._text = i; - } - if (typeof(value.newClass) === "string") { - this._newClass = value.newClass; - this._hasClass = true; - } - if (typeof(value.oldClass) === "string") { - this._oldClass = value.oldClass; - this._hasClass = true; - } - i = this._original.length - this._text.length; - shrt = (i < 0) ? this._original : this._text; - this._fillChar = value.fillChar || (value.padSpace ? " " : ""); - if (i < 0) { - i = -i; - } - while (--i > -1) { - shrt.push(this._fillChar); - } - return true; - }, - - //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) - set: function(ratio) { - if (ratio > 1) { - ratio = 1; - } else if (ratio < 0) { - ratio = 0; - } - if (this._runBackwards) { - ratio = 1 - ratio; - } - var l = this._text.length, - i = (ratio * l + 0.5) | 0, - applyNew, applyOld, str; - if (this._hasClass) { - applyNew = (this._newClass && i !== 0); - applyOld = (this._oldClass && i !== l); - str = (applyNew ? "" : "") + this._text.slice(0, i).join(this._delimiter) + (applyNew ? "" : "") + (applyOld ? "" : "") + this._delimiter + this._original.slice(i).join(this._delimiter) + (applyOld ? "" : ""); - } else { - str = this._text.slice(0, i).join(this._delimiter) + this._delimiter + this._original.slice(i).join(this._delimiter); - } - if (this._svg) { //SVG text elements don't have an "innerHTML" in Microsoft browsers. - this._target.textContent = str; - } else { - this._target.innerHTML = (this._fillChar === " " && str.indexOf(" ") !== -1) ? str.split(" ").join("  ") : str; - } - } - - }), - p = TextPlugin.prototype; - - p._newClass = p._oldClass = p._delimiter = ""; - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } - -//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function(name) { - "use strict"; - var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope)[name]; - }; - if (typeof(module) !== "undefined" && module.exports) { //node - require("../TweenLite.js"); - module.exports = getGlobal(); - } else if (typeof(define) === "function" && define.amd) { //AMD - define(["TweenLite"], getGlobal); - } -}("TextPlugin")); -/*! - * VERSION: 0.1.3 - * DATE: 2018-02-15 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * This work is subject to the terms at http://greensock.com/standard-license or for - * Club GreenSock members, the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - */ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - _gsScope._gsDefine.plugin({ - propName: "endArray", - API: 2, - version: "0.1.3", - - //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. - init: function(target, value, tween) { - var i = value.length, - a = this.a = [], - start, end; - this.target = target; - this._mod = 0; - if (!i) { - return false; - } - while (--i > -1) { - start = target[i]; - end = value[i]; - if (start !== end) { - a.push({i:i, s:start, c:end - start}); - } - } - return true; - }, - - mod: function(lookup) { - if (typeof(lookup.endArray) === "function") { - this._mod = lookup.endArray; - } - }, - - //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) - set: function(ratio) { - var target = this.target, - a = this.a, - i = a.length, - mod = this._mod, - e, val; - if (mod) { - while (--i > -1) { - e = a[i]; - target[e.i] = mod(e.s + e.c * ratio, target); - } - } else { - while (--i > -1) { - e = a[i]; - val = e.s + e.c * ratio; - target[e.i] = (val < 0.000001 && val > -0.000001) ? 0 : val; - } - } - } - - }); - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } -/*! - * VERSION: 0.5.2 - * DATE: 2019-02-07 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * ScrambleTextPlugin is a Club GreenSock membership benefit; You must have a valid membership to use - * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. - * This work is subject to the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - */ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - var _trimExp = /(^\s+|\s+$)/g, - _spacesExp = /\s+/g, - _getText = function(e) { - var type = e.nodeType, - result = ""; - if (type === 1 || type === 9 || type === 11) { - if (typeof(e.textContent) === "string") { - return e.textContent; - } else { - for (e = e.firstChild; e; e = e.nextSibling ) { - result += _getText(e); - } - } - } else if (type === 3 || type === 4) { - return e.nodeValue; - } - return result; - }, - _scrambleText = function(length, chars) { - var l = chars.length, - s = ""; - while (--length > -1) { - s += chars[ ((Math.random() * l) | 0) ]; - } - return s; - }, - CharSet = function(chars) { - this.chars = _emojiSafeSplit(chars); - this.sets = []; - this.length = 50; - var i; - for (i = 0; i < 20; i++) { - this.sets[i] = _scrambleText(80, this.chars); //we create 20 strings that are 80 characters long, randomly chosen and pack them into an array. We then randomly choose the scrambled text from this array in order to greatly improve efficiency compared to creating new randomized text from scratch each and every time it's needed. This is a simple lookup whereas the other technique requires looping through as many times as there are characters needed, and calling Math.random() each time through the loop, building the string, etc. - } - this.grow = function(newLength) { //if we encounter a tween that has more than 80 characters, we'll need to add to the character sets accordingly. Once it's cached, it'll only need to grow again if we exceed that new length. Again, this is an efficiency tactic. - for (i = 0; i < 20; i++) { - this.sets[i] += _scrambleText(newLength - this.length, this.chars); - } - this.length = newLength; - }; - }, - _emoji = "[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2694-\u2697]|\uD83E[\uDD10-\uDD5D]|[\uD800-\uDBFF][\uDC00-\uDFFF]", - _emojiExp = new RegExp(_emoji), - _emojiAndCharsExp = new RegExp(_emoji + "|.", "g"), - _emojiSafeSplit = function(text, delimiter, trim) { - if (trim) { - text = text.replace(_trimExp, ""); - } - return ((delimiter === "" || !delimiter) && _emojiExp.test(text)) ? text.match(_emojiAndCharsExp) : text.split(delimiter || ""); - }, - _upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - _lower = _upper.toLowerCase(), - _charsLookup = { - upperCase: new CharSet(_upper), - lowerCase: new CharSet(_lower), - upperAndLowerCase: new CharSet(_upper + _lower) - }, - - - - ScrambleTextPlugin = _gsScope._gsDefine.plugin({ - propName: "scrambleText", - version: "0.5.2", - API: 2, - overwriteProps:["scrambleText","text"], - - //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. - init: function(target, value, tween, index) { - this._prop = ("innerHTML" in target) ? "innerHTML" : ("textContent" in target) ? "textContent" : 0; // SVG text in IE doesn't have innerHTML, but it does have textContent. - if (!this._prop) { - return false; - } - if (typeof(value) === "function") { - value = value(index, target); - } - this._target = target; - if (typeof(value) !== "object") { - value = {text:value}; - } - var text = value.text || value.value, - trim = (value.trim !== false), - delim, maxLength, charset, splitByChars; - this._delimiter = delim = value.delimiter || ""; - this._original = _emojiSafeSplit(_getText(target).replace(_spacesExp, " ").split(" ").join(""), delim, trim); - if (text === "{original}" || text === true || text == null) { - text = this._original.join(delim); - } - this._text = _emojiSafeSplit((text || "").replace(_spacesExp, " "), delim, trim); - this._hasClass = false; - if (typeof(value.newClass) === "string") { - this._newClass = value.newClass; - this._hasClass = true; - } - if (typeof(value.oldClass) === "string") { - this._oldClass = value.oldClass; - this._hasClass = true; - } - splitByChars = (delim === ""); - this._textHasEmoji = (_emojiExp.test(this._text.join(delim)) && splitByChars); - this._charsHaveEmoji = !!value.chars && _emojiExp.test(value.chars); - this._length = splitByChars ? this._original.length : this._original.join(delim).length; - this._lengthDif = (splitByChars ? this._text.length : this._text.join(delim).length) - this._length; - this._fillChar = value.fillChar || (value.chars && value.chars.indexOf(" ") !== -1) ? " " : ""; - this._charSet = charset = _charsLookup[(value.chars || "upperCase")] || new CharSet(value.chars); - this._speed = 0.016 / (value.speed || 1); - this._prevScrambleTime = 0; - this._setIndex = (Math.random() * 20) | 0; - maxLength = this._length + Math.max(this._lengthDif, 0); - if (maxLength > charset.length) { - charset.grow(maxLength); - } - this._chars = charset.sets[this._setIndex]; - this._revealDelay = value.revealDelay || 0; - this._tweenLength = (value.tweenLength !== false); - this._tween = tween; - this._rightToLeft = !!value.rightToLeft; - return true; - }, - - //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) - set: function(ratio) { - var l = this._text.length, - delim = this._delimiter, - time = this._tween._time, - timeDif = time - this._prevScrambleTime, - i, i2, startText, endText, applyNew, applyOld, str, startClass, endClass; - if (this._revealDelay) { - if (this._tween.vars.runBackwards) { - time = this._tween._duration - time; //invert the time for from() tweens - } - ratio = (time === 0) ? 0 : (time < this._revealDelay) ? 0.000001 : (time === this._tween._duration) ? 1 : this._tween._ease.getRatio((time - this._revealDelay) / (this._tween._duration - this._revealDelay)); - } - if (ratio < 0) { - ratio = 0; - } else if (ratio > 1) { - ratio = 1; - } - if (this._rightToLeft) { - ratio = 1 - ratio; - } - i = (ratio * l + 0.5) | 0; - if (ratio) { - if (timeDif > this._speed || timeDif < -this._speed) { - this._setIndex = (this._setIndex + ((Math.random() * 19) | 0)) % 20; - this._chars = this._charSet.sets[this._setIndex]; - this._prevScrambleTime += timeDif; - } - endText = this._chars; - } else { - endText = this._original.join(delim); - } - - if (this._rightToLeft) { - if (ratio === 1 && (this._tween.vars.runBackwards || this._tween.data === "isFromStart")) { //special case for from() tweens - startText = ""; - endText = this._original.join(delim); - } else { - str = this._text.slice(i).join(delim); - if (this._charsHaveEmoji) { - startText = _emojiSafeSplit(endText).slice(0, ((this._length + (this._tweenLength ? 1 - (ratio * ratio * ratio) : 1) * this._lengthDif) - ((this._textHasEmoji ? _emojiSafeSplit(str) : str).length) + 0.5) | 0).join(""); - } else { - startText = endText.substr(0, ((this._length + (this._tweenLength ? 1 - (ratio * ratio * ratio) : 1) * this._lengthDif) - ((this._textHasEmoji ? _emojiSafeSplit(str) : str).length) + 0.5) | 0); - } - endText = str; - } - - } else { - startText = this._text.slice(0, i).join(delim); - i2 = (this._textHasEmoji ? _emojiSafeSplit(startText) : startText).length; - if (this._charsHaveEmoji) { - endText = _emojiSafeSplit(endText).slice(i2, ((this._length + (this._tweenLength ? 1 - ((ratio = 1 - ratio) * ratio * ratio * ratio) : 1) * this._lengthDif) + 0.5) | 0).join(""); - } else { - endText = endText.substr(i2, ((this._length + (this._tweenLength ? 1 - ((ratio = 1 - ratio) * ratio * ratio * ratio) : 1) * this._lengthDif) - i2 + 0.5) | 0); - } - } - - if (this._hasClass) { - startClass = this._rightToLeft ? this._oldClass : this._newClass; - endClass = this._rightToLeft ? this._newClass : this._oldClass; - applyNew = (startClass && i !== 0); - applyOld = (endClass && i !== l); - str = (applyNew ? "" : "") + startText + (applyNew ? "" : "") + (applyOld ? "" : "") + delim + endText + (applyOld ? "" : ""); - } else { - str = startText + delim + endText; - } - this._target[this._prop] = (this._fillChar === " " && str.indexOf(" ") !== -1) ? str.split(" ").join("  ") : str; - } - - }), - p = ScrambleTextPlugin.prototype; - - p._newClass = p._oldClass = ""; - for (p in _charsLookup) { - _charsLookup[p.toLowerCase()] = _charsLookup[p]; - _charsLookup[p.toUpperCase()] = _charsLookup[p]; - } - - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } - -//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function(name) { - "use strict"; - var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope)[name]; - }; - if (typeof(module) !== "undefined" && module.exports) { //node - require("../TweenLite.js"); - module.exports = getGlobal(); - } else if (typeof(define) === "function" && define.amd) { //AMD - define(["TweenLite"], getGlobal); - } -}("ScrambleTextPlugin")); -/*! - * VERSION: 0.2.1 - * DATE: 2018-02-15 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * PixiPlugin is subject to the terms at http://greensock.com/standard-license or for - * Club GreenSock members, the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - */ -/* eslint-disable */ -var _gsScope = (typeof module !== "undefined" && module.exports && typeof global !== "undefined") ? global : this || window; -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push(function () { - "use strict"; - - var _numExp = /(\d|\.)+/g, - _relNumExp = /(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g, - _colorLookup = {aqua:[0,255,255], - lime:[0,255,0], - silver:[192,192,192], - black:[0,0,0], - maroon:[128,0,0], - teal:[0,128,128], - blue:[0,0,255], - navy:[0,0,128], - white:[255,255,255], - fuchsia:[255,0,255], - olive:[128,128,0], - yellow:[255,255,0], - orange:[255,165,0], - gray:[128,128,128], - purple:[128,0,128], - green:[0,128,0], - red:[255,0,0], - pink:[255,192,203], - cyan:[0,255,255], - transparent:[255,255,255,0]}, - _hue = function(h, m1, m2) { - h = (h < 0) ? h + 1 : (h > 1) ? h - 1 : h; - return ((((h * 6 < 1) ? m1 + (m2 - m1) * h * 6 : (h < 0.5) ? m2 : (h * 3 < 2) ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * 255) + 0.5) | 0; - }, - /** - * @private Parses a color (like #9F0, #FF9900, rgb(255,51,153) or hsl(108, 50%, 10%)) into an array with 3 elements for red, green, and blue or if "format" parameter is "hsl", it will populate the array with hue, saturation, and lightness values. Or if "format" is "number", it'll return a number like 0xFF0000 instead of an array. If a relative value is found in an hsl() or hsla() string, it will preserve those relative prefixes and all the values in the array will be strings instead of numbers (in all other cases it will be populated with numbers). - * @param {(string|number)} v The value the should be parsed which could be a string like #9F0 or rgb(255,102,51) or rgba(255,0,0,0.5) or it could be a number like 0xFF00CC or even a named color like red, blue, purple, etc. - * @param {(string)} format If "hsl", an hsl() or hsla() value will be returned instead of rgb() or rgba(). Or if "number", then a numeric value will be returned, like 0xFF0000. Default is rgb. - * @return {(array|number)} An array containing red, green, and blue (and optionally alpha) in that order, or if the format parameter was "hsl", the array will contain hue, saturation and lightness (and optionally alpha) in that order. Or if "format" is defined as "number", it'll return a number like 0xFF0000. Always numbers unless there's a relative prefix found in an hsl() or hsla() string and "format" is "hsl". - */ - _parseColor = function(v, format) { - var toHSL = (format === "hsl"), - a, r, g, b, h, s, l, max, min, d, wasHSL; - if (!v) { - a = _colorLookup.black; - } else if (typeof(v) === "number") { - a = [v >> 16, (v >> 8) & 255, v & 255]; - } else { - if (v.charAt(v.length - 1) === ",") { //sometimes a trailing comma is included and we should chop it off (typically from a comma-delimited list of values like a textShadow:"2px 2px 2px blue, 5px 5px 5px rgb(255,0,0)" - in this example "blue," has a trailing comma. We could strip it out inside parseComplex() but we'd need to do it to the beginning and ending values plus it wouldn't provide protection from other potential scenarios like if the user passes in a similar value. - v = v.substr(0, v.length - 1); - } - if (_colorLookup[v]) { - a = _colorLookup[v]; - } else if (v.charAt(0) === "#") { - if (v.length === 4) { //for shorthand like #9F0 - r = v.charAt(1); - g = v.charAt(2); - b = v.charAt(3); - v = "#" + r + r + g + g + b + b; - } - v = parseInt(v.substr(1), 16); - a = [v >> 16, (v >> 8) & 255, v & 255]; - } else if (v.substr(0, 3) === "hsl") { - a = wasHSL = v.match(_numExp); - if (!toHSL) { - h = (Number(a[0]) % 360) / 360; - s = Number(a[1]) / 100; - l = Number(a[2]) / 100; - g = (l <= 0.5) ? l * (s + 1) : l + s - l * s; - r = l * 2 - g; - if (a.length > 3) { - a[3] = Number(v[3]); - } - a[0] = _hue(h + 1 / 3, r, g); - a[1] = _hue(h, r, g); - a[2] = _hue(h - 1 / 3, r, g); - } else if (v.indexOf("=") !== -1) { //if relative values are found, just return the raw strings with the relative prefixes in place. - return v.match(_relNumExp); - } - } else { - a = v.match(_numExp) || _colorLookup.transparent; - } - a[0] = Number(a[0]); - a[1] = Number(a[1]); - a[2] = Number(a[2]); - if (a.length > 3) { - a[3] = Number(a[3]); - } - } - if (toHSL && !wasHSL) { - r = a[0] / 255; - g = a[1] / 255; - b = a[2] / 255; - max = Math.max(r, g, b); - min = Math.min(r, g, b); - l = (max + min) / 2; - if (max === min) { - h = s = 0; - } else { - d = max - min; - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - h = (max === r) ? (g - b) / d + (g < b ? 6 : 0) : (max === g) ? (b - r) / d + 2 : (r - g) / d + 4; - h *= 60; - } - a[0] = (h + 0.5) | 0; - a[1] = (s * 100 + 0.5) | 0; - a[2] = (l * 100 + 0.5) | 0; - } - return (format === "number") ? (a[0] << 16 | a[1] << 8 | a[2]) : a; - }, - _formatColors = function(s, toHSL) { - var colors = (s + "").match(_colorExp) || [], - charIndex = 0, - parsed = "", - i, color, temp; - if (!colors.length) { - return s; - } - for (i = 0; i < colors.length; i++) { - color = colors[i]; - temp = s.substr(charIndex, s.indexOf(color, charIndex)-charIndex); - charIndex += temp.length + color.length; - color = _parseColor(color, (toHSL ? "hsl" : "rgb")); - if (color.length === 3) { - color.push(1); - } - parsed += temp + (toHSL ? "hsla(" + color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : "rgba(" + color.join(",")) + ")"; - } - return parsed + s.substr(charIndex); - }, _colorStringFilter, - TweenLite = (_gsScope.GreenSockGlobals || _gsScope).TweenLite, - _colorExp = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3}){1,2}\\b", //we'll dynamically build this Regular Expression to conserve file size. After building it, it will be able to find rgb(), rgba(), # (hexadecimal), and named color values like red, blue, purple, etc. - - _idMatrix = [1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0], - _lumR = 0.212671, - _lumG = 0.715160, - _lumB = 0.072169, - - _applyMatrix = function(m, m2) { - var temp = [], - i = 0, - z = 0, - y, x; - for (y = 0; y < 4; y++) { - for (x = 0; x < 5; x++) { - z = (x === 4) ? m[i + 4] : 0; - temp[i + x] = m[i] * m2[x] + m[i+1] * m2[x + 5] + m[i+2] * m2[x + 10] + m[i+3] * m2[x + 15] + z; - } - i += 5; - } - return temp; - }, - - _setSaturation = function(m, n) { - var inv = 1 - n, - r = inv * _lumR, - g = inv * _lumG, - b = inv * _lumB; - return _applyMatrix([r + n, g, b, 0, 0, r, g + n, b, 0, 0, r, g, b + n, 0, 0, 0, 0, 0, 1, 0], m); - }, - - _colorize = function(m, color, amount) { - var c = _parseColor(color), - r = c[0] / 255, - g = c[1] / 255, - b = c[2] / 255, - inv = 1 - amount; - return _applyMatrix([inv + amount * r * _lumR, amount * r * _lumG, amount * r * _lumB, 0, 0, amount * g * _lumR, inv + amount * g * _lumG, amount * g * _lumB, 0, 0, amount * b * _lumR, amount * b * _lumG, inv + amount * b * _lumB, 0, 0, 0, 0, 0, 1, 0], m); - }, - - _setHue = function(m, n) { - n *= Math.PI / 180; - var c = Math.cos(n), - s = Math.sin(n); - return _applyMatrix([(_lumR + (c * (1 - _lumR))) + (s * (-_lumR)), (_lumG + (c * (-_lumG))) + (s * (-_lumG)), (_lumB + (c * (-_lumB))) + (s * (1 - _lumB)), 0, 0, (_lumR + (c * (-_lumR))) + (s * 0.143), (_lumG + (c * (1 - _lumG))) + (s * 0.14), (_lumB + (c * (-_lumB))) + (s * -0.283), 0, 0, (_lumR + (c * (-_lumR))) + (s * (-(1 - _lumR))), (_lumG + (c * (-_lumG))) + (s * _lumG), (_lumB + (c * (1 - _lumB))) + (s * _lumB), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], m); - }, - - _setContrast = function(m, n) { - return _applyMatrix([n,0,0,0,0.5 * (1 - n), 0,n,0,0,0.5 * (1 - n), 0,0,n,0,0.5 * (1 - n), 0,0,0,1,0], m); - }, - - _getFilter = function(t, type) { - var filterClass = _gsScope.PIXI.filters[type], - filters = t.filters || [], - i = filters.length, - filter; - if (!filterClass) { - throw("PixiPlugin error: " + type + " isn't present."); - } - while (--i > -1) { - if (filters[i] instanceof filterClass) { - return filters[i]; - } - } - filter = new filterClass(); - if (type === "BlurFilter") { - filter.blur = 0; - } - filters.push(filter); - t.filters = filters; - return filter; - }, - - _addColorMatrixFilterCacheTween = function(p, pg, cache, vars) { //we cache the ColorMatrixFilter components in a _gsColorMatrixFilter object attached to the target object so that it's easy to grab the current value at any time. - pg._addTween(cache, p, cache[p], vars[p], p); - pg._overwriteProps.push(p); - }, - - _applyBrightnessToMatrix = function(brightness, matrix) { - var temp = new _gsScope.PIXI.filters.ColorMatrixFilter(); - temp.matrix = matrix; - temp.brightness(brightness, true); - return temp.matrix; - }, - - _CMFdefaults = {contrast:1, saturation:1, colorizeAmount:0, colorize:"rgb(255,255,255)", hue:0, brightness:1}, - - _parseColorMatrixFilter = function(t, v, pg) { - var filter = _getFilter(t, "ColorMatrixFilter"), - cache = t._gsColorMatrixFilter = t._gsColorMatrixFilter || {contrast:1, saturation:1, colorizeAmount:0, colorize:"rgb(255,255,255)", hue:0, brightness:1}, - combine = v.combineCMF && !("colorMatrixFilter" in v && !v.colorMatrixFilter), - i, matrix, startMatrix; - startMatrix = filter.matrix; - if (v.resolution) { - filter.resolution = v.resolution; - } - if (v.matrix && v.matrix.length === startMatrix.length) { - matrix = v.matrix; - if (cache.contrast !== 1) { - _addColorMatrixFilterCacheTween("contrast", pg, cache, _CMFdefaults); - } - if (cache.hue) { - _addColorMatrixFilterCacheTween("hue", pg, cache, _CMFdefaults); - } - if (cache.brightness !== 1) { - _addColorMatrixFilterCacheTween("brightness", pg, cache, _CMFdefaults); - } - if (cache.colorizeAmount) { - _addColorMatrixFilterCacheTween("colorize", pg, cache, _CMFdefaults); - _addColorMatrixFilterCacheTween("colorizeAmount", pg, cache, _CMFdefaults); - } - if (cache.saturation !== 1) { - _addColorMatrixFilterCacheTween("saturation", pg, cache, _CMFdefaults); - } - - } else { - matrix = _idMatrix.slice(); - if (v.contrast != null) { - matrix = _setContrast(matrix, Number(v.contrast)); - _addColorMatrixFilterCacheTween("contrast", pg, cache, v); - } else if (cache.contrast !== 1) { - if (combine) { - matrix = _setContrast(matrix, cache.contrast); - } else { - _addColorMatrixFilterCacheTween("contrast", pg, cache, _CMFdefaults); - } - } - if (v.hue != null) { - matrix = _setHue(matrix, Number(v.hue)); - _addColorMatrixFilterCacheTween("hue", pg, cache, v); - } else if (cache.hue) { - if (combine) { - matrix = _setHue(matrix, cache.hue); - } else { - _addColorMatrixFilterCacheTween("hue", pg, cache, _CMFdefaults); - } - } - if (v.brightness != null) { - matrix = _applyBrightnessToMatrix(Number(v.brightness), matrix); - _addColorMatrixFilterCacheTween("brightness", pg, cache, v); - } else if (cache.brightness !== 1) { - if (combine) { - matrix = _applyBrightnessToMatrix(cache.brightness, matrix); - } else { - _addColorMatrixFilterCacheTween("brightness", pg, cache, _CMFdefaults); - } - } - if (v.colorize != null) { - v.colorizeAmount = ("colorizeAmount" in v) ? Number(v.colorizeAmount) : 1; - matrix = _colorize(matrix, v.colorize, v.colorizeAmount); - _addColorMatrixFilterCacheTween("colorize", pg, cache, v); - _addColorMatrixFilterCacheTween("colorizeAmount", pg, cache, v); - } else if (cache.colorizeAmount) { - if (combine) { - matrix = _colorize(matrix, cache.colorize, cache.colorizeAmount); - } else { - _addColorMatrixFilterCacheTween("colorize", pg, cache, _CMFdefaults); - _addColorMatrixFilterCacheTween("colorizeAmount", pg, cache, _CMFdefaults); - } - } - if (v.saturation != null) { - matrix = _setSaturation(matrix, Number(v.saturation)); - _addColorMatrixFilterCacheTween("saturation", pg, cache, v); - } else if (cache.saturation !== 1) { - if (combine) { - matrix = _setSaturation(matrix, cache.saturation); - } else { - _addColorMatrixFilterCacheTween("saturation", pg, cache, _CMFdefaults); - } - } - } - i = matrix.length; - while (--i > -1) { - if (matrix[i] !== startMatrix[i]) { - pg._addTween(startMatrix, i, startMatrix[i], matrix[i], "colorMatrixFilter"); - } - } - pg._overwriteProps.push("colorMatrixFilter"); - }, - - _addColorTween = function(target, p, value, colorSetter, plugin) { - var pt = colorSetter._firstPT = {_next:colorSetter._firstPT, t:target, p:p, proxy:{}, f:(typeof(target[p]) === "function")}; - pt.proxy[p] = "rgb(" + _parseColor(!pt.f ? target[p] : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]()).join(",") + ")"; - plugin._addTween(pt.proxy, p, "get", ((typeof(value) === "number") ? "rgb(" + _parseColor(value, false).join(",") + ")" : value), p, null, null, _colorStringFilter); - }, - - //to improve performance, when a color is sensed, we hijack the setRatio() method of the plugin instance with a new function that this method spits back. This is a special method that handles parsing color values on-the-fly and turns them into numeric values which PixiJS requires. In other words, instead of "rgb(255, 0, 0)", PixiJS wants 0xFF0000. This also works with hsl() values. - _buildColorSetter = function(tween, plugin) { - var setRatio = plugin.setRatio, //save the original (super) setRatio() function - func = function(v) { - var pt = func._firstPT, - val; - setRatio.call(plugin, v); - while (pt) { - val = _parseColor(pt.proxy[pt.p], "number"); - if (pt.f) { - pt.t[pt.p](val); - } else { - pt.t[pt.p] = val; - } - pt = pt._next; - } - if (func.graphics) { //in order for PixiJS to actually redraw GraphicsData, we've gotta increment the "dirty" and "clearDirty" values. If we don't do this, the values will be tween properly, but not rendered. - func.graphics.dirty++; - func.graphics.clearDirty++; - } - }; - plugin.setRatio = func; - return func; - }, - - - _colorProps = {tint:1, lineColor:1, fillColor:1}, - _xyContexts = "position,scale,skew,pivot,anchor,tilePosition,tileScale".split(","), - _contexts = {x:"position", y:"position", tileX:"tilePosition", tileY:"tilePosition"}, - _colorMatrixFilterProps = {colorMatrixFilter:1, saturation:1, contrast:1, hue:1, colorize:1, colorizeAmount:1, brightness:1, combineCMF:1}, - _DEG2RAD = Math.PI / 180, - _degreesToRadians = function(value) { - return (typeof(value) === "string" && value.charAt(1) === "=") ? value.substr(0, 2) + (parseFloat(value.substr(2)) * _DEG2RAD) : value * _DEG2RAD; - }, i, p; - - //context setup... - for (i = 0; i < _xyContexts.length; i++) { - p = _xyContexts[i]; - _contexts[p + "X"] = p; - _contexts[p + "Y"] = p; - } - - //color parsing setup... - for (p in _colorLookup) { - _colorExp += "|" + p + "\\b"; - } - _colorExp = new RegExp(_colorExp+")", "gi"); - _colorStringFilter = function(a) { - var combined = a[0] + " " + a[1], - toHSL; - _colorExp.lastIndex = 0; - if (_colorExp.test(combined)) { - toHSL = (combined.indexOf("hsl(") !== -1 || combined.indexOf("hsla(") !== -1); - a[0] = _formatColors(a[0], toHSL); - a[1] = _formatColors(a[1], toHSL); - } - }; - - if (!TweenLite.defaultStringFilter) { - TweenLite.defaultStringFilter = _colorStringFilter; - } - - var PixiPlugin = _gsScope._gsDefine.plugin({ - propName: "pixi", - priority: 0, - API: 2, - global: true, - version: "0.2.1", - - init: function (target, values, tween, index) { - if (!target instanceof _gsScope.PIXI.DisplayObject) { - return false; - } - var context, axis, value, colorMatrix, filter, p, padding, colorSetter, i, data, pt; - for (p in values) { - context = _contexts[p]; - value = values[p]; - if (typeof(value) === "function") { - value = value(index || 0, target); - } - if (context) { - axis = (p.charAt(p.length-1).toLowerCase().indexOf("x") !== -1) ? "x" : "y"; - this._addTween(target[context], axis, target[context][axis], (context === "skew") ? _degreesToRadians(value) : value, p); - } else if (p === "scale" || p === "anchor" || p === "pivot" || p === "tileScale") { - this._addTween(target[p], "x", target[p].x, value, p + "X"); - this._addTween(target[p], "y", target[p].y, value, p + "Y"); - } else if (p === "rotation") { //PIXI expects rotation in radians, but as a convenience we let folks define it in degrees and we do the conversion. - this._addTween(target, p, target.rotation, _degreesToRadians(value), p); - - } else if (_colorMatrixFilterProps[p]) { - if (!colorMatrix) { - _parseColorMatrixFilter(target, values.colorMatrixFilter || values, this); - colorMatrix = true; - } - } else if (p === "blur" || p === "blurX" || p === "blurY" || p === "blurPadding") { - filter = _getFilter(target, "BlurFilter"); - this._addTween(filter, p, filter[p], value, p); - if (values.blurPadding !== 0) { - padding = values.blurPadding || Math.max(filter[p], value) * 2; - i = target.filters.length; - while (--i > -1) { - target.filters[i].padding = Math.max(target.filters[i].padding, padding); //if we don't expand the padding on all the filters, it can look clipped. - } - } - } else if (_colorProps[p]) { - if (!colorSetter) { - colorSetter = _buildColorSetter(tween, this); - } - if ((p === "lineColor" || p === "fillColor") && target instanceof _gsScope.PIXI.Graphics) { - data = target.graphicsData; - i = data.length; - while (--i > -1) { - _addColorTween(data[i], p, value, colorSetter, this); - } - colorSetter.graphics = target; - } else { - _addColorTween(target, p, value, colorSetter, this); - } - } else if (p === "autoAlpha") { - this._firstPT = pt = {t: {setRatio:function() { target.visible = !!target.alpha; }}, p: "setRatio", s: 0, c: 1, f: 1, pg: 0, n: "visible", pr: 0, m: 0, _next:this._firstPT}; - if (pt._next) { - pt._next._prev = pt; - } - this._addTween(target, "alpha", target.alpha, value, "alpha"); - this._overwriteProps.push("alpha", "visible"); - } else { - this._addTween(target, p, target[p], value, p); - } - this._overwriteProps.push(p); - } - return true; - } - }); - - PixiPlugin.colorProps = _colorProps; - PixiPlugin.parseColor = _parseColor; - PixiPlugin.formatColors = _formatColors; - PixiPlugin.colorStringFilter = _colorStringFilter; - - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } - -//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function(name) { - "use strict"; - var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope)[name]; - }; - if (typeof(module) !== "undefined" && module.exports) { //node - require("../TweenLite.js"); - module.exports = getGlobal(); - } else if (typeof(define) === "function" && define.amd) { //AMD - define(["TweenLite"], getGlobal); - } -}("PixiPlugin")); -/*! - * VERSION: 1.5.3 - * DATE: 2018-02-15 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * This work is subject to the terms at http://greensock.com/standard-license or for - * Club GreenSock members, the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - **/ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - var _numExp = /(\d|\.)+/g, - _relNumExp = /(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g, - _colorLookup = {aqua:[0,255,255], - lime:[0,255,0], - silver:[192,192,192], - black:[0,0,0], - maroon:[128,0,0], - teal:[0,128,128], - blue:[0,0,255], - navy:[0,0,128], - white:[255,255,255], - fuchsia:[255,0,255], - olive:[128,128,0], - yellow:[255,255,0], - orange:[255,165,0], - gray:[128,128,128], - purple:[128,0,128], - green:[0,128,0], - red:[255,0,0], - pink:[255,192,203], - cyan:[0,255,255], - transparent:[255,255,255,0]}, - _hue = function(h, m1, m2) { - h = (h < 0) ? h + 1 : (h > 1) ? h - 1 : h; - return ((((h * 6 < 1) ? m1 + (m2 - m1) * h * 6 : (h < 0.5) ? m2 : (h * 3 < 2) ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * 255) + 0.5) | 0; - }, - /** - * @private Parses a color (like #9F0, #FF9900, rgb(255,51,153) or hsl(108, 50%, 10%)) into an array with 3 elements for red, green, and blue or if toHSL parameter is true, it will populate the array with hue, saturation, and lightness values. If a relative value is found in an hsl() or hsla() string, it will preserve those relative prefixes and all the values in the array will be strings instead of numbers (in all other cases it will be populated with numbers). - * @param {(string|number)} v The value the should be parsed which could be a string like #9F0 or rgb(255,102,51) or rgba(255,0,0,0.5) or it could be a number like 0xFF00CC or even a named color like red, blue, purple, etc. - * @param {(boolean)} toHSL If true, an hsl() or hsla() value will be returned instead of rgb() or rgba() - * @return {Array.} An array containing red, green, and blue (and optionally alpha) in that order, or if the toHSL parameter was true, the array will contain hue, saturation and lightness (and optionally alpha) in that order. Always numbers unless there's a relative prefix found in an hsl() or hsla() string and toHSL is true. - */ - _parseColor = function(v, toHSL) { - var a, r, g, b, h, s, l, max, min, d, wasHSL; - if (!v) { - a = _colorLookup.black; - } else if (typeof(v) === "number") { - a = [v >> 16, (v >> 8) & 255, v & 255]; - } else { - if (v.charAt(v.length - 1) === ",") { //sometimes a trailing comma is included and we should chop it off (typically from a comma-delimited list of values like a textShadow:"2px 2px 2px blue, 5px 5px 5px rgb(255,0,0)" - in this example "blue," has a trailing comma. We could strip it out inside parseComplex() but we'd need to do it to the beginning and ending values plus it wouldn't provide protection from other potential scenarios like if the user passes in a similar value. - v = v.substr(0, v.length - 1); - } - if (_colorLookup[v]) { - a = _colorLookup[v]; - } else if (v.charAt(0) === "#") { - if (v.length === 4) { //for shorthand like #9F0 - r = v.charAt(1); - g = v.charAt(2); - b = v.charAt(3); - v = "#" + r + r + g + g + b + b; - } - v = parseInt(v.substr(1), 16); - a = [v >> 16, (v >> 8) & 255, v & 255]; - } else if (v.substr(0, 3) === "hsl") { - a = wasHSL = v.match(_numExp); - if (!toHSL) { - h = (Number(a[0]) % 360) / 360; - s = Number(a[1]) / 100; - l = Number(a[2]) / 100; - g = (l <= 0.5) ? l * (s + 1) : l + s - l * s; - r = l * 2 - g; - if (a.length > 3) { - a[3] = Number(a[3]); - } - a[0] = _hue(h + 1 / 3, r, g); - a[1] = _hue(h, r, g); - a[2] = _hue(h - 1 / 3, r, g); - } else if (v.indexOf("=") !== -1) { //if relative values are found, just return the raw strings with the relative prefixes in place. - return v.match(_relNumExp); - } - } else { - a = v.match(_numExp) || _colorLookup.transparent; - } - a[0] = Number(a[0]); - a[1] = Number(a[1]); - a[2] = Number(a[2]); - if (a.length > 3) { - a[3] = Number(a[3]); - } - } - if (toHSL && !wasHSL) { - r = a[0] / 255; - g = a[1] / 255; - b = a[2] / 255; - max = Math.max(r, g, b); - min = Math.min(r, g, b); - l = (max + min) / 2; - if (max === min) { - h = s = 0; - } else { - d = max - min; - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - h = (max === r) ? (g - b) / d + (g < b ? 6 : 0) : (max === g) ? (b - r) / d + 2 : (r - g) / d + 4; - h *= 60; - } - a[0] = (h + 0.5) | 0; - a[1] = (s * 100 + 0.5) | 0; - a[2] = (l * 100 + 0.5) | 0; - } - return a; - }, - _formatColors = function(s, toHSL) { - var colors = (s + "").match(_colorExp) || [], - charIndex = 0, - parsed = "", - i, color, temp; - if (!colors.length) { - return s; - } - for (i = 0; i < colors.length; i++) { - color = colors[i]; - temp = s.substr(charIndex, s.indexOf(color, charIndex)-charIndex); - charIndex += temp.length + color.length; - color = _parseColor(color, toHSL); - if (color.length === 3) { - color.push(1); - } - parsed += temp + (toHSL ? "hsla(" + color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : "rgba(" + color.join(",")) + ")"; - } - return parsed + s.substr(charIndex); - }, p, _colorStringFilter, - TweenLite = (_gsScope.GreenSockGlobals || _gsScope).TweenLite, - _colorExp = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3}){1,2}\\b", //we'll dynamically build this Regular Expression to conserve file size. After building it, it will be able to find rgb(), rgba(), # (hexadecimal), and named color values like red, blue, purple, etc. - - ColorPropsPlugin = _gsScope._gsDefine.plugin({ - propName: "colorProps", - version: "1.5.3", - priority: -1, - API: 2, - global: true, - - //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. - init: function(target, value, tween, index) { - var p, proxy, pt, val; - this._target = target; - this._proxy = proxy = ((value.format + "").toUpperCase() === "NUMBER") ? {} : 0; - for (p in value) { - if (p !== "format") { - if (proxy) { - this._firstNumPT = pt = {_next:this._firstNumPT, t:target, p:p, f:(typeof(target[p]) === "function")}; - proxy[p] = "rgb(" + _parseColor(!pt.f ? target[p] : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]()).join(",") + ")"; - val = value[p]; - if (typeof(val) === "function") { - val = val(index, target); - } - this._addTween(proxy, p, "get", ((typeof(val) === "number") ? "rgb(" + _parseColor(val, false).join(",") + ")" : val), p, null, null, _colorStringFilter); - } else { - this._addTween(target, p, "get", value[p], p, null, null, _colorStringFilter, index); - } - - } - } - return true; - }, - - //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) - set: function(v) { - var pt = this._firstNumPT, - val; - this._super.setRatio.call(this, v); - while (pt) { - val = _parseColor(this._proxy[pt.p], false); - val = val[0] << 16 | val[1] << 8 | val[2]; - if (pt.f) { - this._target[pt.p](val); - } else { - this._target[pt.p] = val; - } - pt = pt._next; - } - } - }); - - for (p in _colorLookup) { - _colorExp += "|" + p + "\\b"; - } - _colorExp = new RegExp(_colorExp+")", "gi"); - ColorPropsPlugin.colorStringFilter = _colorStringFilter = function(a) { - var combined = a[0] + " " + a[1], - toHSL; - _colorExp.lastIndex = 0; - if (_colorExp.test(combined)) { - toHSL = (combined.indexOf("hsl(") !== -1 || combined.indexOf("hsla(") !== -1); - a[0] = _formatColors(a[0], toHSL); - a[1] = _formatColors(a[1], toHSL); - } - }; - - if (!TweenLite.defaultStringFilter) { - TweenLite.defaultStringFilter = ColorPropsPlugin.colorStringFilter; - } - - ColorPropsPlugin.parseColor = _parseColor; - p = ColorPropsPlugin.prototype; - p._firstNumPT = null; - p._kill = function(lookup) { - var pt = this._firstNumPT, - prev; - while (pt) { - if (pt.p in lookup) { - if (pt === p._firstNumPT) { - this._firstNumPT = pt._next; - } - if (prev) { - prev._next = pt._next; - } - } else { - prev = pt; - } - pt = pt._next; - } - return this._super._kill(lookup); - }; - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } - -//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function(name) { - "use strict"; - var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope)[name]; - }; - if (typeof(module) !== "undefined" && module.exports) { //node - require("../TweenLite.js"); - module.exports = getGlobal(); - } else if (typeof(define) === "function" && define.amd) { //AMD - define(["TweenLite"], getGlobal); - } -}("ColorPropsPlugin")); -/*! - * VERSION: 2.1.0 - * DATE: 2019-02-15 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * This work is subject to the terms at http://greensock.com/standard-license or for - * Club GreenSock members, the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - */ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - _gsScope._gsDefine("plugins.CSSPlugin", ["plugins.TweenPlugin","TweenLite"], function(TweenPlugin, TweenLite) { - - /** @constructor **/ - var CSSPlugin = function() { - TweenPlugin.call(this, "css"); - this._overwriteProps.length = 0; - this.setRatio = CSSPlugin.prototype.setRatio; //speed optimization (avoid prototype lookup on this "hot" method) - }, - _globals = _gsScope._gsDefine.globals, - _hasPriority, //turns true whenever a CSSPropTween instance is created that has a priority other than 0. This helps us discern whether or not we should spend the time organizing the linked list or not after a CSSPlugin's _onInitTween() method is called. - _suffixMap, //we set this in _onInitTween() each time as a way to have a persistent variable we can use in other methods like _parse() without having to pass it around as a parameter and we keep _parse() decoupled from a particular CSSPlugin instance - _cs, //computed style (we store this in a shared variable to conserve memory and make minification tighter - _overwriteProps, //alias to the currently instantiating CSSPlugin's _overwriteProps array. We use this closure in order to avoid having to pass a reference around from method to method and aid in minification. - _specialProps = {}, - p = CSSPlugin.prototype = new TweenPlugin("css"); - - p.constructor = CSSPlugin; - CSSPlugin.version = "2.1.0"; - CSSPlugin.API = 2; - CSSPlugin.defaultTransformPerspective = 0; - CSSPlugin.defaultSkewType = "compensated"; - CSSPlugin.defaultSmoothOrigin = true; - p = "px"; //we'll reuse the "p" variable to keep file size down - CSSPlugin.suffixMap = {top:p, right:p, bottom:p, left:p, width:p, height:p, fontSize:p, padding:p, margin:p, perspective:p, lineHeight:""}; - - - var _numExp = /(?:\-|\.|\b)(\d|\.|e\-)+/g, - _relNumExp = /(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g, - _valuesExp = /(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi, //finds all the values that begin with numbers or += or -= and then a number. Includes suffixes. We use this to split complex values apart like "1px 5px 20px rgb(255,102,51)" - _NaNExp = /(?![+-]?\d*\.?\d+|[+-]|e[+-]\d+)[^0-9]/g, //also allows scientific notation and doesn't kill the leading -/+ in -= and += - _suffixExp = /(?:\d|\-|\+|=|#|\.)*/g, - _opacityExp = /opacity *= *([^)]*)/i, - _opacityValExp = /opacity:([^;]*)/i, - _alphaFilterExp = /alpha\(opacity *=.+?\)/i, - _rgbhslExp = /^(rgb|hsl)/, - _capsExp = /([A-Z])/g, - _camelExp = /-([a-z])/gi, - _urlExp = /(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi, //for pulling out urls from url(...) or url("...") strings (some browsers wrap urls in quotes, some don't when reporting things like backgroundImage) - _camelFunc = function(s, g) { return g.toUpperCase(); }, - _horizExp = /(?:Left|Right|Width)/i, - _ieGetMatrixExp = /(M11|M12|M21|M22)=[\d\-\.e]+/gi, - _ieSetMatrixExp = /progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i, - _commasOutsideParenExp = /,(?=[^\)]*(?:\(|$))/gi, //finds any commas that are not within parenthesis - _complexExp = /[\s,\(]/i, //for testing a string to find if it has a space, comma, or open parenthesis (clues that it's a complex value) - _DEG2RAD = Math.PI / 180, - _RAD2DEG = 180 / Math.PI, - _forcePT = {}, - _dummyElement = {style:{}}, - _doc = _gsScope.document || {createElement: function() {return _dummyElement;}}, - _createElement = function(type, ns) { - return (ns && _doc.createElementNS) ? _doc.createElementNS(ns, type) : _doc.createElement(type); - }, - _tempDiv = _createElement("div"), - _tempImg = _createElement("img"), - _internals = CSSPlugin._internals = {_specialProps:_specialProps}, //provides a hook to a few internal methods that we need to access from inside other plugins - _agent = (_gsScope.navigator || {}).userAgent || "", - _autoRound, - _reqSafariFix, //we won't apply the Safari transform fix until we actually come across a tween that affects a transform property (to maintain best performance). - - _isSafari, - _isFirefox, //Firefox has a bug that causes 3D transformed elements to randomly disappear unless a repaint is forced after each update on each element. - _isSafariLT6, //Safari (and Android 4 which uses a flavor of Safari) has a bug that prevents changes to "top" and "left" properties from rendering properly if changed on the same frame as a transform UNLESS we set the element's WebkitBackfaceVisibility to hidden (weird, I know). Doing this for Android 3 and earlier seems to actually cause other problems, though (fun!) - _ieVers, - _supportsOpacity = (function() { //we set _isSafari, _ieVers, _isFirefox, and _supportsOpacity all in one function here to reduce file size slightly, especially in the minified version. - var i = _agent.indexOf("Android"), - a = _createElement("a"); - _isSafari = (_agent.indexOf("Safari") !== -1 && _agent.indexOf("Chrome") === -1 && (i === -1 || parseFloat(_agent.substr(i+8, 2)) > 3)); - _isSafariLT6 = (_isSafari && (parseFloat(_agent.substr(_agent.indexOf("Version/")+8, 2)) < 6)); - _isFirefox = (_agent.indexOf("Firefox") !== -1); - if ((/MSIE ([0-9]{1,}[\.0-9]{0,})/).exec(_agent) || (/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/).exec(_agent)) { - _ieVers = parseFloat( RegExp.$1 ); - } - if (!a) { - return false; - } - a.style.cssText = "top:1px;opacity:.55;"; - return /^0.55/.test(a.style.opacity); - }()), - _getIEOpacity = function(v) { - return (_opacityExp.test( ((typeof(v) === "string") ? v : (v.currentStyle ? v.currentStyle.filter : v.style.filter) || "") ) ? ( parseFloat( RegExp.$1 ) / 100 ) : 1); - }, - _log = function(s) {//for logging messages, but in a way that won't throw errors in old versions of IE. - if (_gsScope.console) { - console.log(s); - } - }, - _target, //when initting a CSSPlugin, we set this variable so that we can access it from within many other functions without having to pass it around as params - _index, //when initting a CSSPlugin, we set this variable so that we can access it from within many other functions without having to pass it around as params - - _prefixCSS = "", //the non-camelCase vendor prefix like "-o-", "-moz-", "-ms-", or "-webkit-" - _prefix = "", //camelCase vendor prefix like "O", "ms", "Webkit", or "Moz". - - // @private feed in a camelCase property name like "transform" and it will check to see if it is valid as-is or if it needs a vendor prefix. It returns the corrected camelCase property name (i.e. "WebkitTransform" or "MozTransform" or "transform" or null if no such property is found, like if the browser is IE8 or before, "transform" won't be found at all) - _checkPropPrefix = function(p, e) { - e = e || _tempDiv; - var s = e.style, - a, i; - if (s[p] !== undefined) { - return p; - } - p = p.charAt(0).toUpperCase() + p.substr(1); - a = ["O","Moz","ms","Ms","Webkit"]; - i = 5; - while (--i > -1 && s[a[i]+p] === undefined) { } - if (i >= 0) { - _prefix = (i === 3) ? "ms" : a[i]; - _prefixCSS = "-" + _prefix.toLowerCase() + "-"; - return _prefix + p; - } - return null; - }, - - _computedStyleScope = (typeof(window) !== "undefined" ? window : _doc.defaultView || {getComputedStyle:function() {}}), - _getComputedStyle = function(e) { - return _computedStyleScope.getComputedStyle(e); //to avoid errors in Microsoft Edge, we need to call getComputedStyle() from a specific scope, typically window. - }, - - /** - * @private Returns the css style for a particular property of an element. For example, to get whatever the current "left" css value for an element with an ID of "myElement", you could do: - * var currentLeft = CSSPlugin.getStyle( document.getElementById("myElement"), "left"); - * - * @param {!Object} t Target element whose style property you want to query - * @param {!string} p Property name (like "left" or "top" or "marginTop", etc.) - * @param {Object=} cs Computed style object. This just provides a way to speed processing if you're going to get several properties on the same element in quick succession - you can reuse the result of the getComputedStyle() call. - * @param {boolean=} calc If true, the value will not be read directly from the element's "style" property (if it exists there), but instead the getComputedStyle() result will be used. This can be useful when you want to ensure that the browser itself is interpreting the value. - * @param {string=} dflt Default value that should be returned in the place of null, "none", "auto" or "auto auto". - * @return {?string} The current property value - */ - _getStyle = CSSPlugin.getStyle = function(t, p, cs, calc, dflt) { - var rv; - if (!_supportsOpacity) if (p === "opacity") { //several versions of IE don't use the standard "opacity" property - they use things like filter:alpha(opacity=50), so we parse that here. - return _getIEOpacity(t); - } - if (!calc && t.style[p]) { - rv = t.style[p]; - } else if ((cs = cs || _getComputedStyle(t))) { - rv = cs[p] || cs.getPropertyValue(p) || cs.getPropertyValue(p.replace(_capsExp, "-$1").toLowerCase()); - } else if (t.currentStyle) { - rv = t.currentStyle[p]; - } - return (dflt != null && (!rv || rv === "none" || rv === "auto" || rv === "auto auto")) ? dflt : rv; - }, - - /** - * @private Pass the target element, the property name, the numeric value, and the suffix (like "%", "em", "px", etc.) and it will spit back the equivalent pixel number. - * @param {!Object} t Target element - * @param {!string} p Property name (like "left", "top", "marginLeft", etc.) - * @param {!number} v Value - * @param {string=} sfx Suffix (like "px" or "%" or "em") - * @param {boolean=} recurse If true, the call is a recursive one. In some browsers (like IE7/8), occasionally the value isn't accurately reported initially, but if we run the function again it will take effect. - * @return {number} value in pixels - */ - _convertToPixels = _internals.convertToPixels = function(t, p, v, sfx, recurse) { - if (sfx === "px" || (!sfx && p !== "lineHeight")) { return v; } - if (sfx === "auto" || !v) { return 0; } - var horiz = _horizExp.test(p), - node = t, - style = _tempDiv.style, - neg = (v < 0), - precise = (v === 1), - pix, cache, time; - if (neg) { - v = -v; - } - if (precise) { - v *= 100; - } - if (p === "lineHeight" && !sfx) { //special case of when a simple lineHeight (without a unit) is used. Set it to the value, read back the computed value, and then revert. - cache = _getComputedStyle(t).lineHeight; - t.style.lineHeight = v; - pix = parseFloat(_getComputedStyle(t).lineHeight); - t.style.lineHeight = cache; - } else if (sfx === "%" && p.indexOf("border") !== -1) { - pix = (v / 100) * (horiz ? t.clientWidth : t.clientHeight); - } else { - style.cssText = "border:0 solid red;position:" + _getStyle(t, "position") + ";line-height:0;"; - if (sfx === "%" || !node.appendChild || sfx.charAt(0) === "v" || sfx === "rem") { - node = t.parentNode || _doc.body; - if (_getStyle(node, "display").indexOf("flex") !== -1) { //Edge and IE11 have a bug that causes offsetWidth to report as 0 if the container has display:flex and the child is position:relative. Switching to position: absolute solves it. - style.position = "absolute"; - } - cache = node._gsCache; - time = TweenLite.ticker.frame; - if (cache && horiz && cache.time === time) { //performance optimization: we record the width of elements along with the ticker frame so that we can quickly get it again on the same tick (seems relatively safe to assume it wouldn't change on the same tick) - return cache.width * v / 100; - } - style[(horiz ? "width" : "height")] = v + sfx; - } else { - style[(horiz ? "borderLeftWidth" : "borderTopWidth")] = v + sfx; - } - node.appendChild(_tempDiv); - pix = parseFloat(_tempDiv[(horiz ? "offsetWidth" : "offsetHeight")]); - node.removeChild(_tempDiv); - if (horiz && sfx === "%" && CSSPlugin.cacheWidths !== false) { - cache = node._gsCache = node._gsCache || {}; - cache.time = time; - cache.width = pix / v * 100; - } - if (pix === 0 && !recurse) { - pix = _convertToPixels(t, p, v, sfx, true); - } - } - if (precise) { - pix /= 100; - } - return neg ? -pix : pix; - }, - _calculateOffset = _internals.calculateOffset = function(t, p, cs) { //for figuring out "top" or "left" in px when it's "auto". We need to factor in margin with the offsetLeft/offsetTop - if (_getStyle(t, "position", cs) !== "absolute") { return 0; } - var dim = ((p === "left") ? "Left" : "Top"), - v = _getStyle(t, "margin" + dim, cs); - return t["offset" + dim] - (_convertToPixels(t, p, parseFloat(v), v.replace(_suffixExp, "")) || 0); - }, - - // @private returns at object containing ALL of the style properties in camelCase and their associated values. - _getAllStyles = function(t, cs) { - var s = {}, - i, tr, p; - if ((cs = cs || _getComputedStyle(t, null))) { - if ((i = cs.length)) { - while (--i > -1) { - p = cs[i]; - if (p.indexOf("-transform") === -1 || _transformPropCSS === p) { //Some webkit browsers duplicate transform values, one non-prefixed and one prefixed ("transform" and "WebkitTransform"), so we must weed out the extra one here. - s[p.replace(_camelExp, _camelFunc)] = cs.getPropertyValue(p); - } - } - } else { //some browsers behave differently - cs.length is always 0, so we must do a for...in loop. - for (i in cs) { - if (i.indexOf("Transform") === -1 || _transformProp === i) { //Some webkit browsers duplicate transform values, one non-prefixed and one prefixed ("transform" and "WebkitTransform"), so we must weed out the extra one here. - s[i] = cs[i]; - } - } - } - } else if ((cs = t.currentStyle || t.style)) { - for (i in cs) { - if (typeof(i) === "string" && s[i] === undefined) { - s[i.replace(_camelExp, _camelFunc)] = cs[i]; - } - } - } - if (!_supportsOpacity) { - s.opacity = _getIEOpacity(t); - } - tr = _getTransform(t, cs, false); - s.rotation = tr.rotation; - s.skewX = tr.skewX; - s.scaleX = tr.scaleX; - s.scaleY = tr.scaleY; - s.x = tr.x; - s.y = tr.y; - if (_supports3D) { - s.z = tr.z; - s.rotationX = tr.rotationX; - s.rotationY = tr.rotationY; - s.scaleZ = tr.scaleZ; - } - if (s.filters) { - delete s.filters; - } - return s; - }, - - // @private analyzes two style objects (as returned by _getAllStyles()) and only looks for differences between them that contain tweenable values (like a number or color). It returns an object with a "difs" property which refers to an object containing only those isolated properties and values for tweening, and a "firstMPT" property which refers to the first MiniPropTween instance in a linked list that recorded all the starting values of the different properties so that we can revert to them at the end or beginning of the tween - we don't want the cascading to get messed up. The forceLookup parameter is an optional generic object with properties that should be forced into the results - this is necessary for className tweens that are overwriting others because imagine a scenario where a rollover/rollout adds/removes a class and the user swipes the mouse over the target SUPER fast, thus nothing actually changed yet and the subsequent comparison of the properties would indicate they match (especially when px rounding is taken into consideration), thus no tweening is necessary even though it SHOULD tween and remove those properties after the tween (otherwise the inline styles will contaminate things). See the className SpecialProp code for details. - _cssDif = function(t, s1, s2, vars, forceLookup) { - var difs = {}, - style = t.style, - val, p, mpt; - for (p in s2) { - if (p !== "cssText") if (p !== "length") if (isNaN(p)) if (s1[p] !== (val = s2[p]) || (forceLookup && forceLookup[p])) if (p.indexOf("Origin") === -1) if (typeof(val) === "number" || typeof(val) === "string") { - difs[p] = (val === "auto" && (p === "left" || p === "top")) ? _calculateOffset(t, p) : ((val === "" || val === "auto" || val === "none") && typeof(s1[p]) === "string" && s1[p].replace(_NaNExp, "") !== "") ? 0 : val; //if the ending value is defaulting ("" or "auto"), we check the starting value and if it can be parsed into a number (a string which could have a suffix too, like 700px), then we swap in 0 for "" or "auto" so that things actually tween. - if (style[p] !== undefined) { //for className tweens, we must remember which properties already existed inline - the ones that didn't should be removed when the tween isn't in progress because they were only introduced to facilitate the transition between classes. - mpt = new MiniPropTween(style, p, style[p], mpt); - } - } - } - if (vars) { - for (p in vars) { //copy properties (except className) - if (p !== "className") { - difs[p] = vars[p]; - } - } - } - return {difs:difs, firstMPT:mpt}; - }, - _dimensions = {width:["Left","Right"], height:["Top","Bottom"]}, - _margins = ["marginLeft","marginRight","marginTop","marginBottom"], - - /** - * @private Gets the width or height of an element - * @param {!Object} t Target element - * @param {!string} p Property name ("width" or "height") - * @param {Object=} cs Computed style object (if one exists). Just a speed optimization. - * @return {number} Dimension (in pixels) - */ - _getDimension = function(t, p, cs) { - if ((t.nodeName + "").toLowerCase() === "svg") { //Chrome no longer supports offsetWidth/offsetHeight on SVG elements. - return (cs || _getComputedStyle(t))[p] || 0; - } else if (t.getCTM && _isSVG(t)) { - return t.getBBox()[p] || 0; - } - var v = parseFloat((p === "width") ? t.offsetWidth : t.offsetHeight), - a = _dimensions[p], - i = a.length; - cs = cs || _getComputedStyle(t, null); - while (--i > -1) { - v -= parseFloat( _getStyle(t, "padding" + a[i], cs, true) ) || 0; - v -= parseFloat( _getStyle(t, "border" + a[i] + "Width", cs, true) ) || 0; - } - return v; - }, - - // @private Parses position-related complex strings like "top left" or "50px 10px" or "70% 20%", etc. which are used for things like transformOrigin or backgroundPosition. Optionally decorates a supplied object (recObj) with the following properties: "ox" (offsetX), "oy" (offsetY), "oxp" (if true, "ox" is a percentage not a pixel value), and "oxy" (if true, "oy" is a percentage not a pixel value) - _parsePosition = function(v, recObj) { - if (v === "contain" || v === "auto" || v === "auto auto") { //note: Firefox uses "auto auto" as default whereas Chrome uses "auto". - return v + " "; - } - if (v == null || v === "") { - v = "0 0"; - } - var a = v.split(" "), - x = (v.indexOf("left") !== -1) ? "0%" : (v.indexOf("right") !== -1) ? "100%" : a[0], - y = (v.indexOf("top") !== -1) ? "0%" : (v.indexOf("bottom") !== -1) ? "100%" : a[1], - i; - if (a.length > 3 && !recObj) { //multiple positions - a = v.split(", ").join(",").split(","); - v = []; - for (i = 0; i < a.length; i++) { - v.push(_parsePosition(a[i])); - } - return v.join(","); - } - if (y == null) { - y = (x === "center") ? "50%" : "0"; - } else if (y === "center") { - y = "50%"; - } - if (x === "center" || (isNaN(parseFloat(x)) && (x + "").indexOf("=") === -1)) { //remember, the user could flip-flop the values and say "bottom center" or "center bottom", etc. "center" is ambiguous because it could be used to describe horizontal or vertical, hence the isNaN(). If there's an "=" sign in the value, it's relative. - x = "50%"; - } - v = x + " " + y + ((a.length > 2) ? " " + a[2] : ""); - if (recObj) { - recObj.oxp = (x.indexOf("%") !== -1); - recObj.oyp = (y.indexOf("%") !== -1); - recObj.oxr = (x.charAt(1) === "="); - recObj.oyr = (y.charAt(1) === "="); - recObj.ox = parseFloat(x.replace(_NaNExp, "")); - recObj.oy = parseFloat(y.replace(_NaNExp, "")); - recObj.v = v; - } - return recObj || v; - }, - - /** - * @private Takes an ending value (typically a string, but can be a number) and a starting value and returns the change between the two, looking for relative value indicators like += and -= and it also ignores suffixes (but make sure the ending value starts with a number or +=/-= and that the starting value is a NUMBER!) - * @param {(number|string)} e End value which is typically a string, but could be a number - * @param {(number|string)} b Beginning value which is typically a string but could be a number - * @return {number} Amount of change between the beginning and ending values (relative values that have a "+=" or "-=" are recognized) - */ - _parseChange = function(e, b) { - if (typeof(e) === "function") { - e = e(_index, _target); - } - return (typeof(e) === "string" && e.charAt(1) === "=") ? parseInt(e.charAt(0) + "1", 10) * parseFloat(e.substr(2)) : (parseFloat(e) - parseFloat(b)) || 0; - }, - - /** - * @private Takes a value and a default number, checks if the value is relative, null, or numeric and spits back a normalized number accordingly. Primarily used in the _parseTransform() function. - * @param {Object} v Value to be parsed - * @param {!number} d Default value (which is also used for relative calculations if "+=" or "-=" is found in the first parameter) - * @return {number} Parsed value - */ - _parseVal = function(v, d) { - if (typeof(v) === "function") { - v = v(_index, _target); - } - var isRelative = (typeof(v) === "string" && v.charAt(1) === "="); - if (typeof(v) === "string" && v.charAt(v.length - 2) === "v") { //convert vw and vh into px-equivalents. - v = (isRelative ? v.substr(0, 2) : 0) + (window["inner" + ((v.substr(-2) === "vh") ? "Height" : "Width")] * (parseFloat(isRelative ? v.substr(2) : v) / 100)); - } - return (v == null) ? d : isRelative ? parseInt(v.charAt(0) + "1", 10) * parseFloat(v.substr(2)) + d : parseFloat(v) || 0; - }, - - /** - * @private Translates strings like "40deg" or "40" or 40rad" or "+=40deg" or "270_short" or "-90_cw" or "+=45_ccw" to a numeric radian angle. Of course a starting/default value must be fed in too so that relative values can be calculated properly. - * @param {Object} v Value to be parsed - * @param {!number} d Default value (which is also used for relative calculations if "+=" or "-=" is found in the first parameter) - * @param {string=} p property name for directionalEnd (optional - only used when the parsed value is directional ("_short", "_cw", or "_ccw" suffix). We need a way to store the uncompensated value so that at the end of the tween, we set it to exactly what was requested with no directional compensation). Property name would be "rotation", "rotationX", or "rotationY" - * @param {Object=} directionalEnd An object that will store the raw end values for directional angles ("_short", "_cw", or "_ccw" suffix). We need a way to store the uncompensated value so that at the end of the tween, we set it to exactly what was requested with no directional compensation. - * @return {number} parsed angle in radians - */ - _parseAngle = function(v, d, p, directionalEnd) { - var min = 0.000001, - cap, split, dif, result, isRelative; - if (typeof(v) === "function") { - v = v(_index, _target); - } - if (v == null) { - result = d; - } else if (typeof(v) === "number") { - result = v; - } else { - cap = 360; - split = v.split("_"); - isRelative = (v.charAt(1) === "="); - dif = (isRelative ? parseInt(v.charAt(0) + "1", 10) * parseFloat(split[0].substr(2)) : parseFloat(split[0])) * ((v.indexOf("rad") === -1) ? 1 : _RAD2DEG) - (isRelative ? 0 : d); - if (split.length) { - if (directionalEnd) { - directionalEnd[p] = d + dif; - } - if (v.indexOf("short") !== -1) { - dif = dif % cap; - if (dif !== dif % (cap / 2)) { - dif = (dif < 0) ? dif + cap : dif - cap; - } - } - if (v.indexOf("_cw") !== -1 && dif < 0) { - dif = ((dif + cap * 9999999999) % cap) - ((dif / cap) | 0) * cap; - } else if (v.indexOf("ccw") !== -1 && dif > 0) { - dif = ((dif - cap * 9999999999) % cap) - ((dif / cap) | 0) * cap; - } - } - result = d + dif; - } - if (result < min && result > -min) { - result = 0; - } - return result; - }, - - _colorLookup = {aqua:[0,255,255], - lime:[0,255,0], - silver:[192,192,192], - black:[0,0,0], - maroon:[128,0,0], - teal:[0,128,128], - blue:[0,0,255], - navy:[0,0,128], - white:[255,255,255], - fuchsia:[255,0,255], - olive:[128,128,0], - yellow:[255,255,0], - orange:[255,165,0], - gray:[128,128,128], - purple:[128,0,128], - green:[0,128,0], - red:[255,0,0], - pink:[255,192,203], - cyan:[0,255,255], - transparent:[255,255,255,0]}, - - _hue = function(h, m1, m2) { - h = (h < 0) ? h + 1 : (h > 1) ? h - 1 : h; - return ((((h * 6 < 1) ? m1 + (m2 - m1) * h * 6 : (h < 0.5) ? m2 : (h * 3 < 2) ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * 255) + 0.5) | 0; - }, - - /** - * @private Parses a color (like #9F0, #FF9900, rgb(255,51,153) or hsl(108, 50%, 10%)) into an array with 3 elements for red, green, and blue or if toHSL parameter is true, it will populate the array with hue, saturation, and lightness values. If a relative value is found in an hsl() or hsla() string, it will preserve those relative prefixes and all the values in the array will be strings instead of numbers (in all other cases it will be populated with numbers). - * @param {(string|number)} v The value the should be parsed which could be a string like #9F0 or rgb(255,102,51) or rgba(255,0,0,0.5) or it could be a number like 0xFF00CC or even a named color like red, blue, purple, etc. - * @param {(boolean)} toHSL If true, an hsl() or hsla() value will be returned instead of rgb() or rgba() - * @return {Array.} An array containing red, green, and blue (and optionally alpha) in that order, or if the toHSL parameter was true, the array will contain hue, saturation and lightness (and optionally alpha) in that order. Always numbers unless there's a relative prefix found in an hsl() or hsla() string and toHSL is true. - */ - _parseColor = CSSPlugin.parseColor = function(v, toHSL) { - var a, r, g, b, h, s, l, max, min, d, wasHSL; - if (!v) { - a = _colorLookup.black; - } else if (typeof(v) === "number") { - a = [v >> 16, (v >> 8) & 255, v & 255]; - } else { - if (v.charAt(v.length - 1) === ",") { //sometimes a trailing comma is included and we should chop it off (typically from a comma-delimited list of values like a textShadow:"2px 2px 2px blue, 5px 5px 5px rgb(255,0,0)" - in this example "blue," has a trailing comma. We could strip it out inside parseComplex() but we'd need to do it to the beginning and ending values plus it wouldn't provide protection from other potential scenarios like if the user passes in a similar value. - v = v.substr(0, v.length - 1); - } - if (_colorLookup[v]) { - a = _colorLookup[v]; - } else if (v.charAt(0) === "#") { - if (v.length === 4) { //for shorthand like #9F0 - r = v.charAt(1); - g = v.charAt(2); - b = v.charAt(3); - v = "#" + r + r + g + g + b + b; - } - v = parseInt(v.substr(1), 16); - a = [v >> 16, (v >> 8) & 255, v & 255]; - } else if (v.substr(0, 3) === "hsl") { - a = wasHSL = v.match(_numExp); - if (!toHSL) { - h = (Number(a[0]) % 360) / 360; - s = Number(a[1]) / 100; - l = Number(a[2]) / 100; - g = (l <= 0.5) ? l * (s + 1) : l + s - l * s; - r = l * 2 - g; - if (a.length > 3) { - a[3] = Number(a[3]); - } - a[0] = _hue(h + 1 / 3, r, g); - a[1] = _hue(h, r, g); - a[2] = _hue(h - 1 / 3, r, g); - } else if (v.indexOf("=") !== -1) { //if relative values are found, just return the raw strings with the relative prefixes in place. - return v.match(_relNumExp); - } - } else { - a = v.match(_numExp) || _colorLookup.transparent; - } - a[0] = Number(a[0]); - a[1] = Number(a[1]); - a[2] = Number(a[2]); - if (a.length > 3) { - a[3] = Number(a[3]); - } - } - if (toHSL && !wasHSL) { - r = a[0] / 255; - g = a[1] / 255; - b = a[2] / 255; - max = Math.max(r, g, b); - min = Math.min(r, g, b); - l = (max + min) / 2; - if (max === min) { - h = s = 0; - } else { - d = max - min; - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - h = (max === r) ? (g - b) / d + (g < b ? 6 : 0) : (max === g) ? (b - r) / d + 2 : (r - g) / d + 4; - h *= 60; - } - a[0] = (h + 0.5) | 0; - a[1] = (s * 100 + 0.5) | 0; - a[2] = (l * 100 + 0.5) | 0; - } - return a; - }, - _formatColors = function(s, toHSL) { - var colors = s.match(_colorExp) || [], - charIndex = 0, - parsed = "", - i, color, temp; - if (!colors.length) { - return s; - } - for (i = 0; i < colors.length; i++) { - color = colors[i]; - temp = s.substr(charIndex, s.indexOf(color, charIndex)-charIndex); - charIndex += temp.length + color.length; - color = _parseColor(color, toHSL); - if (color.length === 3) { - color.push(1); - } - parsed += temp + (toHSL ? "hsla(" + color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : "rgba(" + color.join(",")) + ")"; - } - return parsed + s.substr(charIndex); - }, - _colorExp = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3}){1,2}\\b"; //we'll dynamically build this Regular Expression to conserve file size. After building it, it will be able to find rgb(), rgba(), # (hexadecimal), and named color values like red, blue, purple, etc. - - for (p in _colorLookup) { - _colorExp += "|" + p + "\\b"; - } - _colorExp = new RegExp(_colorExp+")", "gi"); - - CSSPlugin.colorStringFilter = function(a) { - var combined = a[0] + " " + a[1], - toHSL; - if (_colorExp.test(combined)) { - toHSL = (combined.indexOf("hsl(") !== -1 || combined.indexOf("hsla(") !== -1); - a[0] = _formatColors(a[0], toHSL); - a[1] = _formatColors(a[1], toHSL); - } - _colorExp.lastIndex = 0; - }; - - if (!TweenLite.defaultStringFilter) { - TweenLite.defaultStringFilter = CSSPlugin.colorStringFilter; - } - - /** - * @private Returns a formatter function that handles taking a string (or number in some cases) and returning a consistently formatted one in terms of delimiters, quantity of values, etc. For example, we may get boxShadow values defined as "0px red" or "0px 0px 10px rgb(255,0,0)" or "0px 0px 20px 20px #F00" and we need to ensure that what we get back is described with 4 numbers and a color. This allows us to feed it into the _parseComplex() method and split the values up appropriately. The neat thing about this _getFormatter() function is that the dflt defines a pattern as well as a default, so for example, _getFormatter("0px 0px 0px 0px #777", true) not only sets the default as 0px for all distances and #777 for the color, but also sets the pattern such that 4 numbers and a color will always get returned. - * @param {!string} dflt The default value and pattern to follow. So "0px 0px 0px 0px #777" will ensure that 4 numbers and a color will always get returned. - * @param {boolean=} clr If true, the values should be searched for color-related data. For example, boxShadow values typically contain a color whereas borderRadius don't. - * @param {boolean=} collapsible If true, the value is a top/left/right/bottom style one that acts like margin or padding, where if only one value is received, it's used for all 4; if 2 are received, the first is duplicated for 3rd (bottom) and the 2nd is duplicated for the 4th spot (left), etc. - * @return {Function} formatter function - */ - var _getFormatter = function(dflt, clr, collapsible, multi) { - if (dflt == null) { - return function(v) {return v;}; - } - var dColor = clr ? (dflt.match(_colorExp) || [""])[0] : "", - dVals = dflt.split(dColor).join("").match(_valuesExp) || [], - pfx = dflt.substr(0, dflt.indexOf(dVals[0])), - sfx = (dflt.charAt(dflt.length - 1) === ")") ? ")" : "", - delim = (dflt.indexOf(" ") !== -1) ? " " : ",", - numVals = dVals.length, - dSfx = (numVals > 0) ? dVals[0].replace(_numExp, "") : "", - formatter; - if (!numVals) { - return function(v) {return v;}; - } - if (clr) { - formatter = function(v) { - var color, vals, i, a; - if (typeof(v) === "number") { - v += dSfx; - } else if (multi && _commasOutsideParenExp.test(v)) { - a = v.replace(_commasOutsideParenExp, "|").split("|"); - for (i = 0; i < a.length; i++) { - a[i] = formatter(a[i]); - } - return a.join(","); - } - color = (v.match(_colorExp) || [dColor])[0]; - vals = v.split(color).join("").match(_valuesExp) || []; - i = vals.length; - if (numVals > i--) { - while (++i < numVals) { - vals[i] = collapsible ? vals[(((i - 1) / 2) | 0)] : dVals[i]; - } - } - return pfx + vals.join(delim) + delim + color + sfx + (v.indexOf("inset") !== -1 ? " inset" : ""); - }; - return formatter; - - } - formatter = function(v) { - var vals, a, i; - if (typeof(v) === "number") { - v += dSfx; - } else if (multi && _commasOutsideParenExp.test(v)) { - a = v.replace(_commasOutsideParenExp, "|").split("|"); - for (i = 0; i < a.length; i++) { - a[i] = formatter(a[i]); - } - return a.join(","); - } - vals = v.match(_valuesExp) || []; - i = vals.length; - if (numVals > i--) { - while (++i < numVals) { - vals[i] = collapsible ? vals[(((i - 1) / 2) | 0)] : dVals[i]; - } - } - return pfx + vals.join(delim) + sfx; - }; - return formatter; - }, - - /** - * @private returns a formatter function that's used for edge-related values like marginTop, marginLeft, paddingBottom, paddingRight, etc. Just pass a comma-delimited list of property names related to the edges. - * @param {!string} props a comma-delimited list of property names in order from top to left, like "marginTop,marginRight,marginBottom,marginLeft" - * @return {Function} a formatter function - */ - _getEdgeParser = function(props) { - props = props.split(","); - return function(t, e, p, cssp, pt, plugin, vars) { - var a = (e + "").split(" "), - i; - vars = {}; - for (i = 0; i < 4; i++) { - vars[props[i]] = a[i] = a[i] || a[(((i - 1) / 2) >> 0)]; - } - return cssp.parse(t, vars, pt, plugin); - }; - }, - - // @private used when other plugins must tween values first, like BezierPlugin or ThrowPropsPlugin, etc. That plugin's setRatio() gets called first so that the values are updated, and then we loop through the MiniPropTweens which handle copying the values into their appropriate slots so that they can then be applied correctly in the main CSSPlugin setRatio() method. Remember, we typically create a proxy object that has a bunch of uniquely-named properties that we feed to the sub-plugin and it does its magic normally, and then we must interpret those values and apply them to the css because often numbers must get combined/concatenated, suffixes added, etc. to work with css, like boxShadow could have 4 values plus a color. - _setPluginRatio = _internals._setPluginRatio = function(v) { - this.plugin.setRatio(v); - var d = this.data, - proxy = d.proxy, - mpt = d.firstMPT, - min = 0.000001, - val, pt, i, str, p; - while (mpt) { - val = proxy[mpt.v]; - if (mpt.r) { - val = mpt.r(val); - } else if (val < min && val > -min) { - val = 0; - } - mpt.t[mpt.p] = val; - mpt = mpt._next; - } - if (d.autoRotate) { - d.autoRotate.rotation = d.mod ? d.mod.call(this._tween, proxy.rotation, this.t, this._tween) : proxy.rotation; //special case for ModifyPlugin to hook into an auto-rotating bezier - } - //at the end, we must set the CSSPropTween's "e" (end) value dynamically here because that's what is used in the final setRatio() method. Same for "b" at the beginning. - if (v === 1 || v === 0) { - mpt = d.firstMPT; - p = (v === 1) ? "e" : "b"; - while (mpt) { - pt = mpt.t; - if (!pt.type) { - pt[p] = pt.s + pt.xs0; - } else if (pt.type === 1) { - str = pt.xs0 + pt.s + pt.xs1; - for (i = 1; i < pt.l; i++) { - str += pt["xn"+i] + pt["xs"+(i+1)]; - } - pt[p] = str; - } - mpt = mpt._next; - } - } - }, - - /** - * @private @constructor Used by a few SpecialProps to hold important values for proxies. For example, _parseToProxy() creates a MiniPropTween instance for each property that must get tweened on the proxy, and we record the original property name as well as the unique one we create for the proxy, plus whether or not the value needs to be rounded plus the original value. - * @param {!Object} t target object whose property we're tweening (often a CSSPropTween) - * @param {!string} p property name - * @param {(number|string|object)} v value - * @param {MiniPropTween=} next next MiniPropTween in the linked list - * @param {boolean=} r if true, the tweened value should be rounded to the nearest integer - */ - MiniPropTween = function(t, p, v, next, r) { - this.t = t; - this.p = p; - this.v = v; - this.r = r; + EasePoint = function(time, value, next) { + this.t = time; + this.v = value; if (next) { - next._prev = this; - this._next = next; + this.next = next; + next.prev = this; + this.c = next.v - value; + this.gap = next.t - time; } }, - /** - * @private Most other plugins (like BezierPlugin and ThrowPropsPlugin and others) can only tween numeric values, but CSSPlugin must accommodate special values that have a bunch of extra data (like a suffix or strings between numeric values, etc.). For example, boxShadow has values like "10px 10px 20px 30px rgb(255,0,0)" which would utterly confuse other plugins. This method allows us to split that data apart and grab only the numeric data and attach it to uniquely-named properties of a generic proxy object ({}) so that we can feed that to virtually any plugin to have the numbers tweened. However, we must also keep track of which properties from the proxy go with which CSSPropTween values and instances. So we create a linked list of MiniPropTweens. Each one records a target (the original CSSPropTween), property (like "s" or "xn1" or "xn2") that we're tweening and the unique property name that was used for the proxy (like "boxShadow_xn1" and "boxShadow_xn2") and whether or not they need to be rounded. That way, in the _setPluginRatio() method we can simply copy the values over from the proxy to the CSSPropTween instance(s). Then, when the main CSSPlugin setRatio() method runs and applies the CSSPropTween values accordingly, they're updated nicely. So the external plugin tweens the numbers, _setPluginRatio() copies them over, and setRatio() acts normally, applying css-specific values to the element. - * This method returns an object that has the following properties: - * - proxy: a generic object containing the starting values for all the properties that will be tweened by the external plugin. This is what we feed to the external _onInitTween() as the target - * - end: a generic object containing the ending values for all the properties that will be tweened by the external plugin. This is what we feed to the external plugin's _onInitTween() as the destination values - * - firstMPT: the first MiniPropTween in the linked list - * - pt: the first CSSPropTween in the linked list that was created when parsing. If shallow is true, this linked list will NOT attach to the one passed into the _parseToProxy() as the "pt" (4th) parameter. - * @param {!Object} t target object to be tweened - * @param {!(Object|string)} vars the object containing the information about the tweening values (typically the end/destination values) that should be parsed - * @param {!CSSPlugin} cssp The CSSPlugin instance - * @param {CSSPropTween=} pt the next CSSPropTween in the linked list - * @param {TweenPlugin=} plugin the external TweenPlugin instance that will be handling tweening the numeric values - * @param {boolean=} shallow if true, the resulting linked list from the parse will NOT be attached to the CSSPropTween that was passed in as the "pt" (4th) parameter. - * @return An object containing the following properties: proxy, end, firstMPT, and pt (see above for descriptions) - */ - _parseToProxy = _internals._parseToProxy = function(t, vars, cssp, pt, plugin, shallow) { - var bpt = pt, - start = {}, - end = {}, - transform = cssp._transform, - oldForce = _forcePT, - i, p, xp, mpt, firstPT; - cssp._transform = null; - _forcePT = vars; - pt = firstPT = cssp.parse(t, vars, pt, plugin); - _forcePT = oldForce; - //break off from the linked list so the new ones are isolated. - if (shallow) { - cssp._transform = transform; - if (bpt) { - bpt._prev = null; - if (bpt._prev) { - bpt._prev._next = null; - } - } - } - while (pt && pt !== bpt) { - if (pt.type <= 1) { - p = pt.p; - end[p] = pt.s + pt.c; - start[p] = pt.s; - if (!shallow) { - mpt = new MiniPropTween(pt, "s", p, mpt, pt.r); - pt.c = 0; - } - if (pt.type === 1) { - i = pt.l; - while (--i > 0) { - xp = "xn" + i; - p = pt.p + "_" + xp; - end[p] = pt.data[xp]; - start[p] = pt[xp]; - if (!shallow) { - mpt = new MiniPropTween(pt, xp, p, mpt, pt.rxp[xp]); - } - } - } - } - pt = pt._next; - } - return {proxy:start, end:end, firstMPT:mpt, pt:firstPT}; - }, - - - - /** - * @constructor Each property that is tweened has at least one CSSPropTween associated with it. These instances store important information like the target, property, starting value, amount of change, etc. They can also optionally have a number of "extra" strings and numeric values named xs1, xn1, xs2, xn2, xs3, xn3, etc. where "s" indicates string and "n" indicates number. These can be pieced together in a complex-value tween (type:1) that has alternating types of data like a string, number, string, number, etc. For example, boxShadow could be "5px 5px 8px rgb(102, 102, 51)". In that value, there are 6 numbers that may need to tween and then pieced back together into a string again with spaces, suffixes, etc. xs0 is special in that it stores the suffix for standard (type:0) tweens, -OR- the first string (prefix) in a complex-value (type:1) CSSPropTween -OR- it can be the non-tweening value in a type:-1 CSSPropTween. We do this to conserve memory. - * CSSPropTweens have the following optional properties as well (not defined through the constructor): - * - l: Length in terms of the number of extra properties that the CSSPropTween has (default: 0). For example, for a boxShadow we may need to tween 5 numbers in which case l would be 5; Keep in mind that the start/end values for the first number that's tweened are always stored in the s and c properties to conserve memory. All additional values thereafter are stored in xn1, xn2, etc. - * - xfirst: The first instance of any sub-CSSPropTweens that are tweening properties of this instance. For example, we may split up a boxShadow tween so that there's a main CSSPropTween of type:1 that has various xs* and xn* values associated with the h-shadow, v-shadow, blur, color, etc. Then we spawn a CSSPropTween for each of those that has a higher priority and runs BEFORE the main CSSPropTween so that the values are all set by the time it needs to re-assemble them. The xfirst gives us an easy way to identify the first one in that chain which typically ends at the main one (because they're all prepende to the linked list) - * - plugin: The TweenPlugin instance that will handle the tweening of any complex values. For example, sometimes we don't want to use normal subtweens (like xfirst refers to) to tween the values - we might want ThrowPropsPlugin or BezierPlugin some other plugin to do the actual tweening, so we create a plugin instance and store a reference here. We need this reference so that if we get a request to round values or disable a tween, we can pass along that request. - * - data: Arbitrary data that needs to be stored with the CSSPropTween. Typically if we're going to have a plugin handle the tweening of a complex-value tween, we create a generic object that stores the END values that we're tweening to and the CSSPropTween's xs1, xs2, etc. have the starting values. We store that object as data. That way, we can simply pass that object to the plugin and use the CSSPropTween as the target. - * - setRatio: Only used for type:2 tweens that require custom functionality. In this case, we call the CSSPropTween's setRatio() method and pass the ratio each time the tween updates. This isn't quite as efficient as doing things directly in the CSSPlugin's setRatio() method, but it's very convenient and flexible. - * @param {!Object} t Target object whose property will be tweened. Often a DOM element, but not always. It could be anything. - * @param {string} p Property to tween (name). For example, to tween element.width, p would be "width". - * @param {number} s Starting numeric value - * @param {number} c Change in numeric value over the course of the entire tween. For example, if element.width starts at 5 and should end at 100, c would be 95. - * @param {CSSPropTween=} next The next CSSPropTween in the linked list. If one is defined, we will define its _prev as the new instance, and the new instance's _next will be pointed at it. - * @param {number=} type The type of CSSPropTween where -1 = a non-tweening value, 0 = a standard simple tween, 1 = a complex value (like one that has multiple numbers in a comma- or space-delimited string like border:"1px solid red"), and 2 = one that uses a custom setRatio function that does all of the work of applying the values on each update. - * @param {string=} n Name of the property that should be used for overwriting purposes which is typically the same as p but not always. For example, we may need to create a subtween for the 2nd part of a "clip:rect(...)" tween in which case "p" might be xs1 but "n" is still "clip" - * @param {boolean=} r If true, the value(s) should be rounded - * @param {number=} pr Priority in the linked list order. Higher priority CSSPropTweens will be updated before lower priority ones. The default priority is 0. - * @param {string=} b Beginning value. We store this to ensure that it is EXACTLY what it was when the tween began without any risk of interpretation issues. - * @param {string=} e Ending value. We store this to ensure that it is EXACTLY what the user defined at the end of the tween without any risk of interpretation issues. - */ - CSSPropTween = _internals.CSSPropTween = function(t, p, s, c, next, type, n, r, pr, b, e) { - this.t = t; //target - this.p = p; //property - this.s = s; //starting value - this.c = c; //change value - this.n = n || p; //name that this CSSPropTween should be associated to (usually the same as p, but not always - n is what overwriting looks at) - if (!(t instanceof CSSPropTween)) { - _overwriteProps.push(this.n); - } - this.r = !r ? r : (typeof(r) === "function") ? r : Math.round; //round (boolean) - this.type = type || 0; //0 = normal tween, -1 = non-tweening (in which case xs0 will be applied to the target's property, like tp.t[tp.p] = tp.xs0), 1 = complex-value SpecialProp, 2 = custom setRatio() that does all the work - if (pr) { - this.pr = pr; - _hasPriority = true; - } - this.b = (b === undefined) ? s : b; - this.e = (e === undefined) ? s + c : e; - if (next) { - this._next = next; - next._prev = this; - } - }, - - _addNonTweeningNumericPT = function(target, prop, start, end, next, overwriteProp) { //cleans up some code redundancies and helps minification. Just a fast way to add a NUMERIC non-tweening CSSPropTween - var pt = new CSSPropTween(target, prop, start, end - start, next, -1, overwriteProp); - pt.b = start; - pt.e = pt.xs0 = end; - return pt; - }, - - /** - * Takes a target, the beginning value and ending value (as strings) and parses them into a CSSPropTween (possibly with child CSSPropTweens) that accommodates multiple numbers, colors, comma-delimited values, etc. For example: - * sp.parseComplex(element, "boxShadow", "5px 10px 20px rgb(255,102,51)", "0px 0px 0px red", true, "0px 0px 0px rgb(0,0,0,0)", pt); - * It will walk through the beginning and ending values (which should be in the same format with the same number and type of values) and figure out which parts are numbers, what strings separate the numeric/tweenable values, and then create the CSSPropTweens accordingly. If a plugin is defined, no child CSSPropTweens will be created. Instead, the ending values will be stored in the "data" property of the returned CSSPropTween like: {s:-5, xn1:-10, xn2:-20, xn3:255, xn4:0, xn5:0} so that it can be fed to any other plugin and it'll be plain numeric tweens but the recomposition of the complex value will be handled inside CSSPlugin's setRatio(). - * If a setRatio is defined, the type of the CSSPropTween will be set to 2 and recomposition of the values will be the responsibility of that method. - * - * @param {!Object} t Target whose property will be tweened - * @param {!string} p Property that will be tweened (its name, like "left" or "backgroundColor" or "boxShadow") - * @param {string} b Beginning value - * @param {string} e Ending value - * @param {boolean} clrs If true, the value could contain a color value like "rgb(255,0,0)" or "#F00" or "red". The default is false, so no colors will be recognized (a performance optimization) - * @param {(string|number|Object)} dflt The default beginning value that should be used if no valid beginning value is defined or if the number of values inside the complex beginning and ending values don't match - * @param {?CSSPropTween} pt CSSPropTween instance that is the current head of the linked list (we'll prepend to this). - * @param {number=} pr Priority in the linked list order. Higher priority properties will be updated before lower priority ones. The default priority is 0. - * @param {TweenPlugin=} plugin If a plugin should handle the tweening of extra properties, pass the plugin instance here. If one is defined, then NO subtweens will be created for any extra properties (the properties will be created - just not additional CSSPropTween instances to tween them) because the plugin is expected to do so. However, the end values WILL be populated in the "data" property, like {s:100, xn1:50, xn2:300} - * @param {function(number)=} setRatio If values should be set in a custom function instead of being pieced together in a type:1 (complex-value) CSSPropTween, define that custom function here. - * @return {CSSPropTween} The first CSSPropTween in the linked list which includes the new one(s) added by the parseComplex() call. - */ - _parseComplex = CSSPlugin.parseComplex = function(t, p, b, e, clrs, dflt, pt, pr, plugin, setRatio) { - //DEBUG: _log("parseComplex: "+p+", b: "+b+", e: "+e); - b = b || dflt || ""; - if (typeof(e) === "function") { - e = e(_index, _target); - } - pt = new CSSPropTween(t, p, 0, 0, pt, (setRatio ? 2 : 1), null, false, pr, b, e); - e += ""; //ensures it's a string - if (clrs && _colorExp.test(e + b)) { //if colors are found, normalize the formatting to rgba() or hsla(). - e = [b, e]; - CSSPlugin.colorStringFilter(e); - b = e[0]; - e = e[1]; - } - var ba = b.split(", ").join(",").split(" "), //beginning array - ea = e.split(", ").join(",").split(" "), //ending array - l = ba.length, - autoRound = (_autoRound !== false), - i, xi, ni, bv, ev, bnums, enums, bn, hasAlpha, temp, cv, str, useHSL; - if (e.indexOf(",") !== -1 || b.indexOf(",") !== -1) { - if ((e + b).indexOf("rgb") !== -1 || (e + b).indexOf("hsl") !== -1) { //keep rgb(), rgba(), hsl(), and hsla() values together! (remember, we're splitting on spaces) - ba = ba.join(" ").replace(_commasOutsideParenExp, ", ").split(" "); - ea = ea.join(" ").replace(_commasOutsideParenExp, ", ").split(" "); - } else { - ba = ba.join(" ").split(",").join(", ").split(" "); - ea = ea.join(" ").split(",").join(", ").split(" "); - } - l = ba.length; - } - if (l !== ea.length) { - //DEBUG: _log("mismatched formatting detected on " + p + " (" + b + " vs " + e + ")"); - ba = (dflt || "").split(" "); - l = ba.length; - } - pt.plugin = plugin; - pt.setRatio = setRatio; - _colorExp.lastIndex = 0; - for (i = 0; i < l; i++) { - bv = ba[i]; - ev = ea[i] + ""; - bn = parseFloat(bv); - //if the value begins with a number (most common). It's fine if it has a suffix like px - if (bn || bn === 0) { - pt.appendXtra("", bn, _parseChange(ev, bn), ev.replace(_relNumExp, ""), (autoRound && ev.indexOf("px") !== -1) ? Math.round : false, true); - - //if the value is a color - } else if (clrs && _colorExp.test(bv)) { - str = ev.indexOf(")") + 1; - str = ")" + (str ? ev.substr(str) : ""); //if there's a comma or ) at the end, retain it. - useHSL = (ev.indexOf("hsl") !== -1 && _supportsOpacity); - temp = ev; //original string value so we can look for any prefix later. - bv = _parseColor(bv, useHSL); - ev = _parseColor(ev, useHSL); - hasAlpha = (bv.length + ev.length > 6); - if (hasAlpha && !_supportsOpacity && ev[3] === 0) { //older versions of IE don't support rgba(), so if the destination alpha is 0, just use "transparent" for the end color - pt["xs" + pt.l] += pt.l ? " transparent" : "transparent"; - pt.e = pt.e.split(ea[i]).join("transparent"); - } else { - if (!_supportsOpacity) { //old versions of IE don't support rgba(). - hasAlpha = false; - } - if (useHSL) { - pt.appendXtra(temp.substr(0, temp.indexOf("hsl")) + (hasAlpha ? "hsla(" : "hsl("), bv[0], _parseChange(ev[0], bv[0]), ",", false, true) - .appendXtra("", bv[1], _parseChange(ev[1], bv[1]), "%,", false) - .appendXtra("", bv[2], _parseChange(ev[2], bv[2]), (hasAlpha ? "%," : "%" + str), false); - } else { - pt.appendXtra(temp.substr(0, temp.indexOf("rgb")) + (hasAlpha ? "rgba(" : "rgb("), bv[0], ev[0] - bv[0], ",", Math.round, true) - .appendXtra("", bv[1], ev[1] - bv[1], ",", Math.round) - .appendXtra("", bv[2], ev[2] - bv[2], (hasAlpha ? "," : str), Math.round); - } - - if (hasAlpha) { - bv = (bv.length < 4) ? 1 : bv[3]; - pt.appendXtra("", bv, ((ev.length < 4) ? 1 : ev[3]) - bv, str, false); - } - } - _colorExp.lastIndex = 0; //otherwise the test() on the RegExp could move the lastIndex and taint future results. - - } else { - bnums = bv.match(_numExp); //gets each group of numbers in the beginning value string and drops them into an array - - //if no number is found, treat it as a non-tweening value and just append the string to the current xs. - if (!bnums) { - pt["xs" + pt.l] += (pt.l || pt["xs" + pt.l]) ? " " + ev : ev; - - //loop through all the numbers that are found and construct the extra values on the pt. - } else { - enums = ev.match(_relNumExp); //get each group of numbers in the end value string and drop them into an array. We allow relative values too, like +=50 or -=.5 - if (!enums || enums.length !== bnums.length) { - //DEBUG: _log("mismatched formatting detected on " + p + " (" + b + " vs " + e + ")"); - return pt; - } - ni = 0; - for (xi = 0; xi < bnums.length; xi++) { - cv = bnums[xi]; - temp = bv.indexOf(cv, ni); - pt.appendXtra(bv.substr(ni, temp - ni), Number(cv), _parseChange(enums[xi], cv), "", (autoRound && bv.substr(temp + cv.length, 2) === "px") ? Math.round : false, (xi === 0)); - ni = temp + cv.length; - } - pt["xs" + pt.l] += bv.substr(ni); - } - } - } - //if there are relative values ("+=" or "-=" prefix), we need to adjust the ending value to eliminate the prefixes and combine the values properly. - if (e.indexOf("=") !== -1) if (pt.data) { - str = pt.xs0 + pt.data.s; - for (i = 1; i < pt.l; i++) { - str += pt["xs" + i] + pt.data["xn" + i]; - } - pt.e = str + pt["xs" + i]; - } - if (!pt.l) { - pt.type = -1; - pt.xs0 = pt.e; - } - return pt.xfirst || pt; - }, - i = 9; - - - p = CSSPropTween.prototype; - p.l = p.pr = 0; //length (number of extra properties like xn1, xn2, xn3, etc. - while (--i > 0) { - p["xn" + i] = 0; - p["xs" + i] = ""; - } - p.xs0 = ""; - p._next = p._prev = p.xfirst = p.data = p.plugin = p.setRatio = p.rxp = null; - - - /** - * Appends and extra tweening value to a CSSPropTween and automatically manages any prefix and suffix strings. The first extra value is stored in the s and c of the main CSSPropTween instance, but thereafter any extras are stored in the xn1, xn2, xn3, etc. The prefixes and suffixes are stored in the xs0, xs1, xs2, etc. properties. For example, if I walk through a clip value like "rect(10px, 5px, 0px, 20px)", the values would be stored like this: - * xs0:"rect(", s:10, xs1:"px, ", xn1:5, xs2:"px, ", xn2:0, xs3:"px, ", xn3:20, xn4:"px)" - * And they'd all get joined together when the CSSPlugin renders (in the setRatio() method). - * @param {string=} pfx Prefix (if any) - * @param {!number} s Starting value - * @param {!number} c Change in numeric value over the course of the entire tween. For example, if the start is 5 and the end is 100, the change would be 95. - * @param {string=} sfx Suffix (if any) - * @param {boolean=} r Round (if true). - * @param {boolean=} pad If true, this extra value should be separated by the previous one by a space. If there is no previous extra and pad is true, it will automatically drop the space. - * @return {CSSPropTween} returns itself so that multiple methods can be chained together. - */ - p.appendXtra = function(pfx, s, c, sfx, r, pad) { - var pt = this, - l = pt.l; - pt["xs" + l] += (pad && (l || pt["xs" + l])) ? " " + pfx : pfx || ""; - if (!c) if (l !== 0 && !pt.plugin) { //typically we'll combine non-changing values right into the xs to optimize performance, but we don't combine them when there's a plugin that will be tweening the values because it may depend on the values being split apart, like for a bezier, if a value doesn't change between the first and second iteration but then it does on the 3rd, we'll run into trouble because there's no xn slot for that value! - pt["xs" + l] += s + (sfx || ""); - return pt; - } - pt.l++; - pt.type = pt.setRatio ? 2 : 1; - pt["xs" + pt.l] = sfx || ""; - if (l > 0) { - pt.data["xn" + l] = s + c; - pt.rxp["xn" + l] = r; //round extra property (we need to tap into this in the _parseToProxy() method) - pt["xn" + l] = s; - if (!pt.plugin) { - pt.xfirst = new CSSPropTween(pt, "xn" + l, s, c, pt.xfirst || pt, 0, pt.n, r, pt.pr); - pt.xfirst.xs0 = 0; //just to ensure that the property stays numeric which helps modern browsers speed up processing. Remember, in the setRatio() method, we do pt.t[pt.p] = val + pt.xs0 so if pt.xs0 is "" (the default), it'll cast the end value as a string. When a property is a number sometimes and a string sometimes, it prevents the compiler from locking in the data type, slowing things down slightly. - } - return pt; - } - pt.data = {s:s + c}; - pt.rxp = {}; - pt.s = s; - pt.c = c; - pt.r = r; - return pt; - }; - - /** - * @constructor A SpecialProp is basically a css property that needs to be treated in a non-standard way, like if it may contain a complex value like boxShadow:"5px 10px 15px rgb(255, 102, 51)" or if it is associated with another plugin like ThrowPropsPlugin or BezierPlugin. Every SpecialProp is associated with a particular property name like "boxShadow" or "throwProps" or "bezier" and it will intercept those values in the vars object that's passed to the CSSPlugin and handle them accordingly. - * @param {!string} p Property name (like "boxShadow" or "throwProps") - * @param {Object=} options An object containing any of the following configuration options: - * - defaultValue: the default value - * - parser: A function that should be called when the associated property name is found in the vars. This function should return a CSSPropTween instance and it should ensure that it is properly inserted into the linked list. It will receive 4 paramters: 1) The target, 2) The value defined in the vars, 3) The CSSPlugin instance (whose _firstPT should be used for the linked list), and 4) A computed style object if one was calculated (this is a speed optimization that allows retrieval of starting values quicker) - * - formatter: a function that formats any value received for this special property (for example, boxShadow could take "5px 5px red" and format it to "5px 5px 0px 0px red" so that both the beginning and ending values have a common order and quantity of values.) - * - prefix: if true, we'll determine whether or not this property requires a vendor prefix (like Webkit or Moz or ms or O) - * - color: set this to true if the value for this SpecialProp may contain color-related values like rgb(), rgba(), etc. - * - priority: priority in the linked list order. Higher priority SpecialProps will be updated before lower priority ones. The default priority is 0. - * - multi: if true, the formatter should accommodate a comma-delimited list of values, like boxShadow could have multiple boxShadows listed out. - * - collapsible: if true, the formatter should treat the value like it's a top/right/bottom/left value that could be collapsed, like "5px" would apply to all, "5px, 10px" would use 5px for top/bottom and 10px for right/left, etc. - * - keyword: a special keyword that can [optionally] be found inside the value (like "inset" for boxShadow). This allows us to validate beginning/ending values to make sure they match (if the keyword is found in one, it'll be added to the other for consistency by default). - */ - var SpecialProp = function(p, options) { - options = options || {}; - this.p = options.prefix ? _checkPropPrefix(p) || p : p; - _specialProps[p] = _specialProps[this.p] = this; - this.format = options.formatter || _getFormatter(options.defaultValue, options.color, options.collapsible, options.multi); - if (options.parser) { - this.parse = options.parser; - } - this.clrs = options.color; - this.multi = options.multi; - this.keyword = options.keyword; - this.dflt = options.defaultValue; - this.allowFunc = options.allowFunc; - this.pr = options.priority || 0; - }, - - //shortcut for creating a new SpecialProp that can accept multiple properties as a comma-delimited list (helps minification). dflt can be an array for multiple values (we don't do a comma-delimited list because the default value may contain commas, like rect(0px,0px,0px,0px)). We attach this method to the SpecialProp class/object instead of using a private _createSpecialProp() method so that we can tap into it externally if necessary, like from another plugin. - _registerComplexSpecialProp = _internals._registerComplexSpecialProp = function(p, options, defaults) { - if (typeof(options) !== "object") { - options = {parser:defaults}; //to make backwards compatible with older versions of BezierPlugin and ThrowPropsPlugin - } - var a = p.split(","), - d = options.defaultValue, - i, temp; - defaults = defaults || [d]; - for (i = 0; i < a.length; i++) { - options.prefix = (i === 0 && options.prefix); - options.defaultValue = defaults[i] || d; - temp = new SpecialProp(a[i], options); - } - }, - - //creates a placeholder special prop for a plugin so that the property gets caught the first time a tween of it is attempted, and at that time it makes the plugin register itself, thus taking over for all future tweens of that property. This allows us to not mandate that things load in a particular order and it also allows us to log() an error that informs the user when they attempt to tween an external plugin-related property without loading its .js file. - _registerPluginProp = _internals._registerPluginProp = function(p) { - if (!_specialProps[p]) { - var pluginName = p.charAt(0).toUpperCase() + p.substr(1) + "Plugin"; - _registerComplexSpecialProp(p, {parser:function(t, e, p, cssp, pt, plugin, vars) { - var pluginClass = _globals.com.greensock.plugins[pluginName]; - if (!pluginClass) { - _log("Error: " + pluginName + " js file not loaded."); - return pt; - } - pluginClass._cssRegister(); - return _specialProps[p].parse(t, e, p, cssp, pt, plugin, vars); - }}); - } - }; - - - p = SpecialProp.prototype; - - /** - * Alias for _parseComplex() that automatically plugs in certain values for this SpecialProp, like its property name, whether or not colors should be sensed, the default value, and priority. It also looks for any keyword that the SpecialProp defines (like "inset" for boxShadow) and ensures that the beginning and ending values have the same number of values for SpecialProps where multi is true (like boxShadow and textShadow can have a comma-delimited list) - * @param {!Object} t target element - * @param {(string|number|object)} b beginning value - * @param {(string|number|object)} e ending (destination) value - * @param {CSSPropTween=} pt next CSSPropTween in the linked list - * @param {TweenPlugin=} plugin If another plugin will be tweening the complex value, that TweenPlugin instance goes here. - * @param {function=} setRatio If a custom setRatio() method should be used to handle this complex value, that goes here. - * @return {CSSPropTween=} First CSSPropTween in the linked list - */ - p.parseComplex = function(t, b, e, pt, plugin, setRatio) { - var kwd = this.keyword, - i, ba, ea, l, bi, ei; - //if this SpecialProp's value can contain a comma-delimited list of values (like boxShadow or textShadow), we must parse them in a special way, and look for a keyword (like "inset" for boxShadow) and ensure that the beginning and ending BOTH have it if the end defines it as such. We also must ensure that there are an equal number of values specified (we can't tween 1 boxShadow to 3 for example) - if (this.multi) if (_commasOutsideParenExp.test(e) || _commasOutsideParenExp.test(b)) { - ba = b.replace(_commasOutsideParenExp, "|").split("|"); - ea = e.replace(_commasOutsideParenExp, "|").split("|"); - } else if (kwd) { - ba = [b]; - ea = [e]; - } - if (ea) { - l = (ea.length > ba.length) ? ea.length : ba.length; - for (i = 0; i < l; i++) { - b = ba[i] = ba[i] || this.dflt; - e = ea[i] = ea[i] || this.dflt; - if (kwd) { - bi = b.indexOf(kwd); - ei = e.indexOf(kwd); - if (bi !== ei) { - if (ei === -1) { //if the keyword isn't in the end value, remove it from the beginning one. - ba[i] = ba[i].split(kwd).join(""); - } else if (bi === -1) { //if the keyword isn't in the beginning, add it. - ba[i] += " " + kwd; - } - } - } - } - b = ba.join(", "); - e = ea.join(", "); - } - return _parseComplex(t, this.p, b, e, this.clrs, this.dflt, pt, this.pr, plugin, setRatio); - }; - - /** - * Accepts a target and end value and spits back a CSSPropTween that has been inserted into the CSSPlugin's linked list and conforms with all the conventions we use internally, like type:-1, 0, 1, or 2, setting up any extra property tweens, priority, etc. For example, if we have a boxShadow SpecialProp and call: - * this._firstPT = sp.parse(element, "5px 10px 20px rgb(2550,102,51)", "boxShadow", this); - * It should figure out the starting value of the element's boxShadow, compare it to the provided end value and create all the necessary CSSPropTweens of the appropriate types to tween the boxShadow. The CSSPropTween that gets spit back should already be inserted into the linked list (the 4th parameter is the current head, so prepend to that). - * @param {!Object} t Target object whose property is being tweened - * @param {Object} e End value as provided in the vars object (typically a string, but not always - like a throwProps would be an object). - * @param {!string} p Property name - * @param {!CSSPlugin} cssp The CSSPlugin instance that should be associated with this tween. - * @param {?CSSPropTween} pt The CSSPropTween that is the current head of the linked list (we'll prepend to it) - * @param {TweenPlugin=} plugin If a plugin will be used to tween the parsed value, this is the plugin instance. - * @param {Object=} vars Original vars object that contains the data for parsing. - * @return {CSSPropTween} The first CSSPropTween in the linked list which includes the new one(s) added by the parse() call. - */ - p.parse = function(t, e, p, cssp, pt, plugin, vars) { - return this.parseComplex(t.style, this.format(_getStyle(t, this.p, _cs, false, this.dflt)), this.format(e), pt, plugin); - }; - - /** - * Registers a special property that should be intercepted from any "css" objects defined in tweens. This allows you to handle them however you want without CSSPlugin doing it for you. The 2nd parameter should be a function that accepts 3 parameters: - * 1) Target object whose property should be tweened (typically a DOM element) - * 2) The end/destination value (could be a string, number, object, or whatever you want) - * 3) The tween instance (you probably don't need to worry about this, but it can be useful for looking up information like the duration) - * - * Then, your function should return a function which will be called each time the tween gets rendered, passing a numeric "ratio" parameter to your function that indicates the change factor (usually between 0 and 1). For example: - * - * CSSPlugin.registerSpecialProp("myCustomProp", function(target, value, tween) { - * var start = target.style.width; - * return function(ratio) { - * target.style.width = (start + value * ratio) + "px"; - * console.log("set width to " + target.style.width); - * } - * }, 0); - * - * Then, when I do this tween, it will trigger my special property: - * - * TweenLite.to(element, 1, {css:{myCustomProp:100}}); - * - * In the example, of course, we're just changing the width, but you can do anything you want. - * - * @param {!string} name Property name (or comma-delimited list of property names) that should be intercepted and handled by your function. For example, if I define "myCustomProp", then it would handle that portion of the following tween: TweenLite.to(element, 1, {css:{myCustomProp:100}}) - * @param {!function(Object, Object, Object, string):function(number)} onInitTween The function that will be called when a tween of this special property is performed. The function will receive 4 parameters: 1) Target object that should be tweened, 2) Value that was passed to the tween, 3) The tween instance itself (rarely used), and 4) The property name that's being tweened. Your function should return a function that should be called on every update of the tween. That function will receive a single parameter that is a "change factor" value (typically between 0 and 1) indicating the amount of change as a ratio. You can use this to determine how to set the values appropriately in your function. - * @param {number=} priority Priority that helps the engine determine the order in which to set the properties (default: 0). Higher priority properties will be updated before lower priority ones. - */ - CSSPlugin.registerSpecialProp = function(name, onInitTween, priority) { - _registerComplexSpecialProp(name, {parser:function(t, e, p, cssp, pt, plugin, vars) { - var rv = new CSSPropTween(t, p, 0, 0, pt, 2, p, false, priority); - rv.plugin = plugin; - rv.setRatio = onInitTween(t, e, cssp._tween, p); - return rv; - }, priority:priority}); - }; - - - - - - - //transform-related methods and properties - CSSPlugin.useSVGTransformAttr = true; //Safari and Firefox both have some rendering bugs when applying CSS transforms to SVG elements, so default to using the "transform" attribute instead (users can override this). - var _transformProps = ("scaleX,scaleY,scaleZ,x,y,z,skewX,skewY,rotation,rotationX,rotationY,perspective,xPercent,yPercent").split(","), - _transformProp = _checkPropPrefix("transform"), //the Javascript (camelCase) transform property, like msTransform, WebkitTransform, MozTransform, or OTransform. - _transformPropCSS = _prefixCSS + "transform", - _transformOriginProp = _checkPropPrefix("transformOrigin"), - _supports3D = (_checkPropPrefix("perspective") !== null), - Transform = _internals.Transform = function() { - this.perspective = parseFloat(CSSPlugin.defaultTransformPerspective) || 0; - this.force3D = (CSSPlugin.defaultForce3D === false || !_supports3D) ? false : CSSPlugin.defaultForce3D || "auto"; - }, - _SVGElement = _gsScope.SVGElement, - _useSVGTransformAttr, - //Some browsers (like Firefox and IE) don't honor transform-origin properly in SVG elements, so we need to manually adjust the matrix accordingly. We feature detect here rather than always doing the conversion for certain browsers because they may fix the problem at some point in the future. - - _createSVG = function(type, container, attributes) { - var element = _doc.createElementNS("http://www.w3.org/2000/svg", type), - reg = /([a-z])([A-Z])/g, - p; - for (p in attributes) { - element.setAttributeNS(null, p.replace(reg, "$1-$2").toLowerCase(), attributes[p]); - } - container.appendChild(element); - return element; - }, - _docElement = _doc.documentElement || {}, - _forceSVGTransformAttr = (function() { - //IE and Android stock don't support CSS transforms on SVG elements, so we must write them to the "transform" attribute. We populate this variable in the _parseTransform() method, and only if/when we come across an SVG element - var force = _ieVers || (/Android/i.test(_agent) && !_gsScope.chrome), - svg, rect, width; - if (_doc.createElementNS && !force) { //IE8 and earlier doesn't support SVG anyway - svg = _createSVG("svg", _docElement); - rect = _createSVG("rect", svg, {width:100, height:50, x:100}); - width = rect.getBoundingClientRect().width; - rect.style[_transformOriginProp] = "50% 50%"; - rect.style[_transformProp] = "scaleX(0.5)"; - force = (width === rect.getBoundingClientRect().width && !(_isFirefox && _supports3D)); //note: Firefox fails the test even though it does support CSS transforms in 3D. Since we can't push 3D stuff into the transform attribute, we force Firefox to pass the test here (as long as it does truly support 3D). - _docElement.removeChild(svg); - } - return force; - })(), - _parseSVGOrigin = function(e, local, decoratee, absolute, smoothOrigin, skipRecord) { - var tm = e._gsTransform, - m = _getMatrix(e, true), - v, x, y, xOrigin, yOrigin, a, b, c, d, tx, ty, determinant, xOriginOld, yOriginOld; - if (tm) { - xOriginOld = tm.xOrigin; //record the original values before we alter them. - yOriginOld = tm.yOrigin; - } - if (!absolute || (v = absolute.split(" ")).length < 2) { - b = e.getBBox(); - if (b.x === 0 && b.y === 0 && b.width + b.height === 0) { //some browsers (like Firefox) misreport the bounds if the element has zero width and height (it just assumes it's at x:0, y:0), thus we need to manually grab the position in that case. - b = {x: parseFloat(e.hasAttribute("x") ? e.getAttribute("x") : e.hasAttribute("cx") ? e.getAttribute("cx") : 0) || 0, y: parseFloat(e.hasAttribute("y") ? e.getAttribute("y") : e.hasAttribute("cy") ? e.getAttribute("cy") : 0) || 0, width:0, height:0}; - } - local = _parsePosition(local).split(" "); - v = [(local[0].indexOf("%") !== -1 ? parseFloat(local[0]) / 100 * b.width : parseFloat(local[0])) + b.x, - (local[1].indexOf("%") !== -1 ? parseFloat(local[1]) / 100 * b.height : parseFloat(local[1])) + b.y]; - } - decoratee.xOrigin = xOrigin = parseFloat(v[0]); - decoratee.yOrigin = yOrigin = parseFloat(v[1]); - if (absolute && m !== _identity2DMatrix) { //if svgOrigin is being set, we must invert the matrix and determine where the absolute point is, factoring in the current transforms. Otherwise, the svgOrigin would be based on the element's non-transformed position on the canvas. - a = m[0]; - b = m[1]; - c = m[2]; - d = m[3]; - tx = m[4]; - ty = m[5]; - determinant = (a * d - b * c); - if (determinant) { //if it's zero (like if scaleX and scaleY are zero), skip it to avoid errors with dividing by zero. - x = xOrigin * (d / determinant) + yOrigin * (-c / determinant) + ((c * ty - d * tx) / determinant); - y = xOrigin * (-b / determinant) + yOrigin * (a / determinant) - ((a * ty - b * tx) / determinant); - xOrigin = decoratee.xOrigin = v[0] = x; - yOrigin = decoratee.yOrigin = v[1] = y; - } - } - if (tm) { //avoid jump when transformOrigin is changed - adjust the x/y values accordingly - if (skipRecord) { - decoratee.xOffset = tm.xOffset; - decoratee.yOffset = tm.yOffset; - tm = decoratee; - } - if (smoothOrigin || (smoothOrigin !== false && CSSPlugin.defaultSmoothOrigin !== false)) { - x = xOrigin - xOriginOld; - y = yOrigin - yOriginOld; - //originally, we simply adjusted the x and y values, but that would cause problems if, for example, you created a rotational tween part-way through an x/y tween. Managing the offset in a separate variable gives us ultimate flexibility. - //tm.x -= x - (x * m[0] + y * m[2]); - //tm.y -= y - (x * m[1] + y * m[3]); - tm.xOffset += (x * m[0] + y * m[2]) - x; - tm.yOffset += (x * m[1] + y * m[3]) - y; - } else { - tm.xOffset = tm.yOffset = 0; - } - } - if (!skipRecord) { - e.setAttribute("data-svg-origin", v.join(" ")); - } - }, - _getBBoxHack = function(swapIfPossible) { //works around issues in some browsers (like Firefox) that don't correctly report getBBox() on SVG elements inside a element and/or . We try creating an SVG, adding it to the documentElement and toss the element in there so that it's definitely part of the rendering tree, then grab the bbox and if it works, we actually swap out the original getBBox() method for our own that does these extra steps whenever getBBox is needed. This helps ensure that performance is optimal (only do all these extra steps when absolutely necessary...most elements don't need it). - var svg = _createElement("svg", (this.ownerSVGElement && this.ownerSVGElement.getAttribute("xmlns")) || "http://www.w3.org/2000/svg"), - oldParent = this.parentNode, - oldSibling = this.nextSibling, - oldCSS = this.style.cssText, - bbox; - _docElement.appendChild(svg); - svg.appendChild(this); - this.style.display = "block"; - if (swapIfPossible) { - try { - bbox = this.getBBox(); - this._originalGetBBox = this.getBBox; - this.getBBox = _getBBoxHack; - } catch (e) { } - } else if (this._originalGetBBox) { - bbox = this._originalGetBBox(); - } - if (oldSibling) { - oldParent.insertBefore(this, oldSibling); - } else { - oldParent.appendChild(this); - } - _docElement.removeChild(svg); - this.style.cssText = oldCSS; - return bbox; - }, - _getBBox = function(e) { - try { - return e.getBBox(); //Firefox throws errors if you try calling getBBox() on an SVG element that's not rendered (like in a or ). https://bugzilla.mozilla.org/show_bug.cgi?id=612118 - } catch (error) { - return _getBBoxHack.call(e, true); - } - }, - _isSVG = function(e) { //reports if the element is an SVG on which getBBox() actually works - return !!(_SVGElement && e.getCTM && (!e.parentNode || e.ownerSVGElement) && _getBBox(e)); - }, - _identity2DMatrix = [1,0,0,1,0,0], - _getMatrix = function(e, force2D) { - var tm = e._gsTransform || new Transform(), - rnd = 100000, - style = e.style, - isDefault, s, m, n, dec, nextSibling, parent; - if (_transformProp) { - s = _getStyle(e, _transformPropCSS, null, true); - } else if (e.currentStyle) { - //for older versions of IE, we need to interpret the filter portion that is in the format: progid:DXImageTransform.Microsoft.Matrix(M11=6.123233995736766e-17, M12=-1, M21=1, M22=6.123233995736766e-17, sizingMethod='auto expand') Notice that we need to swap b and c compared to a normal matrix. - s = e.currentStyle.filter.match(_ieGetMatrixExp); - s = (s && s.length === 4) ? [s[0].substr(4), Number(s[2].substr(4)), Number(s[1].substr(4)), s[3].substr(4), (tm.x || 0), (tm.y || 0)].join(",") : ""; - } - isDefault = (!s || s === "none" || s === "matrix(1, 0, 0, 1, 0, 0)"); - if (_transformProp && isDefault && !e.offsetParent) { //note: if offsetParent is null, that means the element isn't in the normal document flow, like if it has display:none or one of its ancestors has display:none). Firefox returns null for getComputedStyle() if the element is in an iframe that has display:none. https://bugzilla.mozilla.org/show_bug.cgi?id=548397 - //browsers don't report transforms accurately unless the element is in the DOM and has a display value that's not "none". Firefox and Microsoft browsers have a partial bug where they'll report transforms even if display:none BUT not any percentage-based values like translate(-50%, 8px) will be reported as if it's translate(0, 8px). - n = style.display; - style.display = "block"; - parent = e.parentNode; - if (!parent || !e.offsetParent) { - dec = 1; //flag - nextSibling = e.nextSibling; - _docElement.appendChild(e); //we must add it to the DOM in order to get values properly - } - s = _getStyle(e, _transformPropCSS, null, true); - isDefault = (!s || s === "none" || s === "matrix(1, 0, 0, 1, 0, 0)"); - if (n) { - style.display = n; - } else { - _removeProp(style, "display"); - } - if (dec) { - if (nextSibling) { - parent.insertBefore(e, nextSibling); - } else if (parent) { - parent.appendChild(e); - } else { - _docElement.removeChild(e); - } - } - } - if (tm.svg || (e.getCTM && _isSVG(e))) { - if (isDefault && (style[_transformProp] + "").indexOf("matrix") !== -1) { //some browsers (like Chrome 40) don't correctly report transforms that are applied inline on an SVG element (they don't get included in the computed style), so we double-check here and accept matrix values - s = style[_transformProp]; - isDefault = 0; - } - m = e.getAttribute("transform"); - if (isDefault && m) { - m = e.transform.baseVal.consolidate().matrix; //ensures that even complex values like "translate(50,60) rotate(135,0,0)" are parsed because it mashes it into a matrix. - s = "matrix(" + m.a + "," + m.b + "," + m.c + "," + m.d + "," + m.e + "," + m.f + ")"; - isDefault = 0; - } - } - if (isDefault) { - return _identity2DMatrix; - } - //split the matrix values out into an array (m for matrix) - m = (s || "").match(_numExp) || []; - i = m.length; - while (--i > -1) { - n = Number(m[i]); - m[i] = (dec = n - (n |= 0)) ? ((dec * rnd + (dec < 0 ? -0.5 : 0.5)) | 0) / rnd + n : n; //convert strings to Numbers and round to 5 decimal places to avoid issues with tiny numbers. Roughly 20x faster than Number.toFixed(). We also must make sure to round before dividing so that values like 0.9999999999 become 1 to avoid glitches in browser rendering and interpretation of flipped/rotated 3D matrices. And don't just multiply the number by rnd, floor it, and then divide by rnd because the bitwise operations max out at a 32-bit signed integer, thus it could get clipped at a relatively low value (like 22,000.00000 for example). - } - return (force2D && m.length > 6) ? [m[0], m[1], m[4], m[5], m[12], m[13]] : m; - }, - - /** - * Parses the transform values for an element, returning an object with x, y, z, scaleX, scaleY, scaleZ, rotation, rotationX, rotationY, skewX, and skewY properties. Note: by default (for performance reasons), all skewing is combined into skewX and rotation but skewY still has a place in the transform object so that we can record how much of the skew is attributed to skewX vs skewY. Remember, a skewY of 10 looks the same as a rotation of 10 and skewX of -10. - * @param {!Object} t target element - * @param {Object=} cs computed style object (optional) - * @param {boolean=} rec if true, the transform values will be recorded to the target element's _gsTransform object, like target._gsTransform = {x:0, y:0, z:0, scaleX:1...} - * @param {boolean=} parse if true, we'll ignore any _gsTransform values that already exist on the element, and force a reparsing of the css (calculated style) - * @return {object} object containing all of the transform properties/values like {x:0, y:0, z:0, scaleX:1...} - */ - _getTransform = _internals.getTransform = function(t, cs, rec, parse) { - if (t._gsTransform && rec && !parse) { - return t._gsTransform; //if the element already has a _gsTransform, use that. Note: some browsers don't accurately return the calculated style for the transform (particularly for SVG), so it's almost always safest to just use the values we've already applied rather than re-parsing things. - } - var tm = rec ? t._gsTransform || new Transform() : new Transform(), - invX = (tm.scaleX < 0), //in order to interpret things properly, we need to know if the user applied a negative scaleX previously so that we can adjust the rotation and skewX accordingly. Otherwise, if we always interpret a flipped matrix as affecting scaleY and the user only wants to tween the scaleX on multiple sequential tweens, it would keep the negative scaleY without that being the user's intent. - min = 0.00002, - rnd = 100000, - zOrigin = _supports3D ? parseFloat(_getStyle(t, _transformOriginProp, cs, false, "0 0 0").split(" ")[2]) || tm.zOrigin || 0 : 0, - defaultTransformPerspective = parseFloat(CSSPlugin.defaultTransformPerspective) || 0, - m, i, scaleX, scaleY, rotation, skewX; - - tm.svg = !!(t.getCTM && _isSVG(t)); - if (tm.svg) { - _parseSVGOrigin(t, _getStyle(t, _transformOriginProp, cs, false, "50% 50%") + "", tm, t.getAttribute("data-svg-origin")); - _useSVGTransformAttr = CSSPlugin.useSVGTransformAttr || _forceSVGTransformAttr; - } - m = _getMatrix(t); - if (m !== _identity2DMatrix) { - - if (m.length === 16) { - //we'll only look at these position-related 6 variables first because if x/y/z all match, it's relatively safe to assume we don't need to re-parse everything which risks losing important rotational information (like rotationX:180 plus rotationY:180 would look the same as rotation:180 - there's no way to know for sure which direction was taken based solely on the matrix3d() values) - var a11 = m[0], a21 = m[1], a31 = m[2], a41 = m[3], - a12 = m[4], a22 = m[5], a32 = m[6], a42 = m[7], - a13 = m[8], a23 = m[9], a33 = m[10], - a14 = m[12], a24 = m[13], a34 = m[14], - a43 = m[11], - angle = Math.atan2(a32, a33), - t1, t2, t3, t4, cos, sin; - //we manually compensate for non-zero z component of transformOrigin to work around bugs in Safari - if (tm.zOrigin) { - a34 = -tm.zOrigin; - a14 = a13*a34-m[12]; - a24 = a23*a34-m[13]; - a34 = a33*a34+tm.zOrigin-m[14]; - } - //note for possible future consolidation: rotationX: Math.atan2(a32, a33), rotationY: Math.atan2(-a31, Math.sqrt(a33 * a33 + a32 * a32)), rotation: Math.atan2(a21, a11), skew: Math.atan2(a12, a22). However, it doesn't seem to be quite as reliable as the full-on backwards rotation procedure. - tm.rotationX = angle * _RAD2DEG; - //rotationX - if (angle) { - cos = Math.cos(-angle); - sin = Math.sin(-angle); - t1 = a12*cos+a13*sin; - t2 = a22*cos+a23*sin; - t3 = a32*cos+a33*sin; - a13 = a12*-sin+a13*cos; - a23 = a22*-sin+a23*cos; - a33 = a32*-sin+a33*cos; - a43 = a42*-sin+a43*cos; - a12 = t1; - a22 = t2; - a32 = t3; - } - //rotationY - angle = Math.atan2(-a31, a33); - tm.rotationY = angle * _RAD2DEG; - if (angle) { - cos = Math.cos(-angle); - sin = Math.sin(-angle); - t1 = a11*cos-a13*sin; - t2 = a21*cos-a23*sin; - t3 = a31*cos-a33*sin; - a23 = a21*sin+a23*cos; - a33 = a31*sin+a33*cos; - a43 = a41*sin+a43*cos; - a11 = t1; - a21 = t2; - a31 = t3; - } - //rotationZ - angle = Math.atan2(a21, a11); - tm.rotation = angle * _RAD2DEG; - if (angle) { - cos = Math.cos(angle); - sin = Math.sin(angle); - t1 = a11*cos+a21*sin; - t2 = a12*cos+a22*sin; - t3 = a13*cos+a23*sin; - a21 = a21*cos-a11*sin; - a22 = a22*cos-a12*sin; - a23 = a23*cos-a13*sin; - a11 = t1; - a12 = t2; - a13 = t3; - } - - if (tm.rotationX && Math.abs(tm.rotationX) + Math.abs(tm.rotation) > 359.9) { //when rotationY is set, it will often be parsed as 180 degrees different than it should be, and rotationX and rotation both being 180 (it looks the same), so we adjust for that here. - tm.rotationX = tm.rotation = 0; - tm.rotationY = 180 - tm.rotationY; - } - - //skewX - angle = Math.atan2(a12, a22); - - //scales - tm.scaleX = ((Math.sqrt(a11 * a11 + a21 * a21 + a31 * a31) * rnd + 0.5) | 0) / rnd; - tm.scaleY = ((Math.sqrt(a22 * a22 + a32 * a32) * rnd + 0.5) | 0) / rnd; - tm.scaleZ = ((Math.sqrt(a13 * a13 + a23 * a23 + a33 * a33) * rnd + 0.5) | 0) / rnd; - a11 /= tm.scaleX; - a12 /= tm.scaleY; - a21 /= tm.scaleX; - a22 /= tm.scaleY; - if (Math.abs(angle) > min) { - tm.skewX = angle * _RAD2DEG; - a12 = 0; //unskews - if (tm.skewType !== "simple") { - tm.scaleY *= 1 / Math.cos(angle); //by default, we compensate the scale based on the skew so that the element maintains a similar proportion when skewed, so we have to alter the scaleY here accordingly to match the default (non-adjusted) skewing that CSS does (stretching more and more as it skews). - } - - } else { - tm.skewX = 0; - } - - /* //for testing purposes - var transform = "matrix3d(", - comma = ",", - zero = "0"; - a13 /= tm.scaleZ; - a23 /= tm.scaleZ; - a31 /= tm.scaleX; - a32 /= tm.scaleY; - a33 /= tm.scaleZ; - transform += ((a11 < min && a11 > -min) ? zero : a11) + comma + ((a21 < min && a21 > -min) ? zero : a21) + comma + ((a31 < min && a31 > -min) ? zero : a31); - transform += comma + ((a41 < min && a41 > -min) ? zero : a41) + comma + ((a12 < min && a12 > -min) ? zero : a12) + comma + ((a22 < min && a22 > -min) ? zero : a22); - transform += comma + ((a32 < min && a32 > -min) ? zero : a32) + comma + ((a42 < min && a42 > -min) ? zero : a42) + comma + ((a13 < min && a13 > -min) ? zero : a13); - transform += comma + ((a23 < min && a23 > -min) ? zero : a23) + comma + ((a33 < min && a33 > -min) ? zero : a33) + comma + ((a43 < min && a43 > -min) ? zero : a43) + comma; - transform += a14 + comma + a24 + comma + a34 + comma + (tm.perspective ? (1 + (-a34 / tm.perspective)) : 1) + ")"; - console.log(transform); - document.querySelector(".test").style[_transformProp] = transform; - */ - - tm.perspective = a43 ? 1 / ((a43 < 0) ? -a43 : a43) : 0; - tm.x = a14; - tm.y = a24; - tm.z = a34; - if (tm.svg) { - tm.x -= tm.xOrigin - (tm.xOrigin * a11 - tm.yOrigin * a12); - tm.y -= tm.yOrigin - (tm.yOrigin * a21 - tm.xOrigin * a22); - } - - } else if ((!_supports3D || parse || !m.length || tm.x !== m[4] || tm.y !== m[5] || (!tm.rotationX && !tm.rotationY))) { //sometimes a 6-element matrix is returned even when we performed 3D transforms, like if rotationX and rotationY are 180. In cases like this, we still need to honor the 3D transforms. If we just rely on the 2D info, it could affect how the data is interpreted, like scaleY might get set to -1 or rotation could get offset by 180 degrees. For example, do a TweenLite.to(element, 1, {css:{rotationX:180, rotationY:180}}) and then later, TweenLite.to(element, 1, {css:{rotationX:0}}) and without this conditional logic in place, it'd jump to a state of being unrotated when the 2nd tween starts. Then again, we need to honor the fact that the user COULD alter the transforms outside of CSSPlugin, like by manually applying new css, so we try to sense that by looking at x and y because if those changed, we know the changes were made outside CSSPlugin and we force a reinterpretation of the matrix values. Also, in Webkit browsers, if the element's "display" is "none", its calculated style value will always return empty, so if we've already recorded the values in the _gsTransform object, we'll just rely on those. - var k = (m.length >= 6), - a = k ? m[0] : 1, - b = m[1] || 0, - c = m[2] || 0, - d = k ? m[3] : 1; - tm.x = m[4] || 0; - tm.y = m[5] || 0; - scaleX = Math.sqrt(a * a + b * b); - scaleY = Math.sqrt(d * d + c * c); - rotation = (a || b) ? Math.atan2(b, a) * _RAD2DEG : tm.rotation || 0; //note: if scaleX is 0, we cannot accurately measure rotation. Same for skewX with a scaleY of 0. Therefore, we default to the previously recorded value (or zero if that doesn't exist). - skewX = (c || d) ? Math.atan2(c, d) * _RAD2DEG + rotation : tm.skewX || 0; - tm.scaleX = scaleX; - tm.scaleY = scaleY; - tm.rotation = rotation; - tm.skewX = skewX; - if (_supports3D) { - tm.rotationX = tm.rotationY = tm.z = 0; - tm.perspective = defaultTransformPerspective; - tm.scaleZ = 1; - } - if (tm.svg) { - tm.x -= tm.xOrigin - (tm.xOrigin * a + tm.yOrigin * c); - tm.y -= tm.yOrigin - (tm.xOrigin * b + tm.yOrigin * d); - } - } - if (Math.abs(tm.skewX) > 90 && Math.abs(tm.skewX) < 270) { - if (invX) { - tm.scaleX *= -1; - tm.skewX += (tm.rotation <= 0) ? 180 : -180; - tm.rotation += (tm.rotation <= 0) ? 180 : -180; - } else { - tm.scaleY *= -1; - tm.skewX += (tm.skewX <= 0) ? 180 : -180; - } - } - tm.zOrigin = zOrigin; - //some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 0 in these cases. The conditional logic here is faster than calling Math.abs(). Also, browsers tend to render a SLIGHTLY rotated object in a fuzzy way, so we need to snap to exactly 0 when appropriate. - for (i in tm) { - if (tm[i] < min) if (tm[i] > -min) { - tm[i] = 0; - } - } - } - //DEBUG: _log("parsed rotation of " + t.getAttribute("id")+": "+(tm.rotationX)+", "+(tm.rotationY)+", "+(tm.rotation)+", scale: "+tm.scaleX+", "+tm.scaleY+", "+tm.scaleZ+", position: "+tm.x+", "+tm.y+", "+tm.z+", perspective: "+tm.perspective+ ", origin: "+ tm.xOrigin+ ","+ tm.yOrigin); - if (rec) { - t._gsTransform = tm; //record to the object's _gsTransform which we use so that tweens can control individual properties independently (we need all the properties to accurately recompose the matrix in the setRatio() method) - if (tm.svg) { //if we're supposed to apply transforms to the SVG element's "transform" attribute, make sure there aren't any CSS transforms applied or they'll override the attribute ones. Also clear the transform attribute if we're using CSS, just to be clean. - if (_useSVGTransformAttr && t.style[_transformProp]) { - TweenLite.delayedCall(0.001, function(){ //if we apply this right away (before anything has rendered), we risk there being no transforms for a brief moment and it also interferes with adjusting the transformOrigin in a tween with immediateRender:true (it'd try reading the matrix and it wouldn't have the appropriate data in place because we just removed it). - _removeProp(t.style, _transformProp); - }); - } else if (!_useSVGTransformAttr && t.getAttribute("transform")) { - TweenLite.delayedCall(0.001, function(){ - t.removeAttribute("transform"); - }); - } - } - } - return tm; - }, - - //for setting 2D transforms in IE6, IE7, and IE8 (must use a "filter" to emulate the behavior of modern day browser transforms) - _setIETransformRatio = function(v) { - var t = this.data, //refers to the element's _gsTransform object - ang = -t.rotation * _DEG2RAD, - skew = ang + t.skewX * _DEG2RAD, - rnd = 100000, - a = ((Math.cos(ang) * t.scaleX * rnd) | 0) / rnd, - b = ((Math.sin(ang) * t.scaleX * rnd) | 0) / rnd, - c = ((Math.sin(skew) * -t.scaleY * rnd) | 0) / rnd, - d = ((Math.cos(skew) * t.scaleY * rnd) | 0) / rnd, - style = this.t.style, - cs = this.t.currentStyle, - filters, val; - if (!cs) { - return; - } - val = b; //just for swapping the variables an inverting them (reused "val" to avoid creating another variable in memory). IE's filter matrix uses a non-standard matrix configuration (angle goes the opposite way, and b and c are reversed and inverted) - b = -c; - c = -val; - filters = cs.filter; - style.filter = ""; //remove filters so that we can accurately measure offsetWidth/offsetHeight - var w = this.t.offsetWidth, - h = this.t.offsetHeight, - clip = (cs.position !== "absolute"), - m = "progid:DXImageTransform.Microsoft.Matrix(M11=" + a + ", M12=" + b + ", M21=" + c + ", M22=" + d, - ox = t.x + (w * t.xPercent / 100), - oy = t.y + (h * t.yPercent / 100), - dx, dy; - - //if transformOrigin is being used, adjust the offset x and y - if (t.ox != null) { - dx = ((t.oxp) ? w * t.ox * 0.01 : t.ox) - w / 2; - dy = ((t.oyp) ? h * t.oy * 0.01 : t.oy) - h / 2; - ox += dx - (dx * a + dy * b); - oy += dy - (dx * c + dy * d); - } - - if (!clip) { - m += ", sizingMethod='auto expand')"; - } else { - dx = (w / 2); - dy = (h / 2); - //translate to ensure that transformations occur around the correct origin (default is center). - m += ", Dx=" + (dx - (dx * a + dy * b) + ox) + ", Dy=" + (dy - (dx * c + dy * d) + oy) + ")"; - } - if (filters.indexOf("DXImageTransform.Microsoft.Matrix(") !== -1) { - style.filter = filters.replace(_ieSetMatrixExp, m); - } else { - style.filter = m + " " + filters; //we must always put the transform/matrix FIRST (before alpha(opacity=xx)) to avoid an IE bug that slices part of the object when rotation is applied with alpha. - } - - //at the end or beginning of the tween, if the matrix is normal (1, 0, 0, 1) and opacity is 100 (or doesn't exist), remove the filter to improve browser performance. - if (v === 0 || v === 1) if (a === 1) if (b === 0) if (c === 0) if (d === 1) if (!clip || m.indexOf("Dx=0, Dy=0") !== -1) if (!_opacityExp.test(filters) || parseFloat(RegExp.$1) === 100) if (filters.indexOf("gradient(" && filters.indexOf("Alpha")) === -1) { - style.removeAttribute("filter"); - } - - //we must set the margins AFTER applying the filter in order to avoid some bugs in IE8 that could (in rare scenarios) cause them to be ignored intermittently (vibration). - if (!clip) { - var mult = (_ieVers < 8) ? 1 : -1, //in Internet Explorer 7 and before, the box model is broken, causing the browser to treat the width/height of the actual rotated filtered image as the width/height of the box itself, but Microsoft corrected that in IE8. We must use a negative offset in IE8 on the right/bottom - marg, prop, dif; - dx = t.ieOffsetX || 0; - dy = t.ieOffsetY || 0; - t.ieOffsetX = Math.round((w - ((a < 0 ? -a : a) * w + (b < 0 ? -b : b) * h)) / 2 + ox); - t.ieOffsetY = Math.round((h - ((d < 0 ? -d : d) * h + (c < 0 ? -c : c) * w)) / 2 + oy); - for (i = 0; i < 4; i++) { - prop = _margins[i]; - marg = cs[prop]; - //we need to get the current margin in case it is being tweened separately (we want to respect that tween's changes) - val = (marg.indexOf("px") !== -1) ? parseFloat(marg) : _convertToPixels(this.t, prop, parseFloat(marg), marg.replace(_suffixExp, "")) || 0; - if (val !== t[prop]) { - dif = (i < 2) ? -t.ieOffsetX : -t.ieOffsetY; //if another tween is controlling a margin, we cannot only apply the difference in the ieOffsets, so we essentially zero-out the dx and dy here in that case. We record the margin(s) later so that we can keep comparing them, making this code very flexible. - } else { - dif = (i < 2) ? dx - t.ieOffsetX : dy - t.ieOffsetY; - } - style[prop] = (t[prop] = Math.round( val - dif * ((i === 0 || i === 2) ? 1 : mult) )) + "px"; - } - } - }, - - /* translates a super small decimal to a string WITHOUT scientific notation - _safeDecimal = function(n) { - var s = (n < 0 ? -n : n) + "", - a = s.split("e-"); - return (n < 0 ? "-0." : "0.") + new Array(parseInt(a[1], 10) || 0).join("0") + a[0].split(".").join(""); - }, - */ - - _setTransformRatio = _internals.set3DTransformRatio = _internals.setTransformRatio = function(v) { - var t = this.data, //refers to the element's _gsTransform object - style = this.t.style, - angle = t.rotation, - rotationX = t.rotationX, - rotationY = t.rotationY, - sx = t.scaleX, - sy = t.scaleY, - sz = t.scaleZ, - x = t.x, - y = t.y, - z = t.z, - isSVG = t.svg, - perspective = t.perspective, - force3D = t.force3D, - skewY = t.skewY, - skewX = t.skewX, - t1, a11, a12, a13, a21, a22, a23, a31, a32, a33, a41, a42, a43, - zOrigin, min, cos, sin, t2, transform, comma, zero, skew, rnd; - if (skewY) { //for performance reasons, we combine all skewing into the skewX and rotation values. Remember, a skewY of 10 degrees looks the same as a rotation of 10 degrees plus a skewX of 10 degrees. - skewX += skewY; - angle += skewY; - } - - //check to see if we should render as 2D (and SVGs must use 2D when _useSVGTransformAttr is true) - if (((((v === 1 || v === 0) && force3D === "auto" && (this.tween._totalTime === this.tween._totalDuration || !this.tween._totalTime)) || !force3D) && !z && !perspective && !rotationY && !rotationX && sz === 1) || (_useSVGTransformAttr && isSVG) || !_supports3D) { //on the final render (which could be 0 for a from tween), if there are no 3D aspects, render in 2D to free up memory and improve performance especially on mobile devices. Check the tween's totalTime/totalDuration too in order to make sure it doesn't happen between repeats if it's a repeating tween. - - //2D - if (angle || skewX || isSVG) { - angle *= _DEG2RAD; - skew = skewX * _DEG2RAD; - rnd = 100000; - a11 = Math.cos(angle) * sx; - a21 = Math.sin(angle) * sx; - a12 = Math.sin(angle - skew) * -sy; - a22 = Math.cos(angle - skew) * sy; - if (skew && t.skewType === "simple") { //by default, we compensate skewing on the other axis to make it look more natural, but you can set the skewType to "simple" to use the uncompensated skewing that CSS does - t1 = Math.tan(skew - skewY * _DEG2RAD); - t1 = Math.sqrt(1 + t1 * t1); - a12 *= t1; - a22 *= t1; - if (skewY) { - t1 = Math.tan(skewY * _DEG2RAD); - t1 = Math.sqrt(1 + t1 * t1); - a11 *= t1; - a21 *= t1; - } - } - if (isSVG) { - x += t.xOrigin - (t.xOrigin * a11 + t.yOrigin * a12) + t.xOffset; - y += t.yOrigin - (t.xOrigin * a21 + t.yOrigin * a22) + t.yOffset; - if (_useSVGTransformAttr && (t.xPercent || t.yPercent)) { //The SVG spec doesn't support percentage-based translation in the "transform" attribute, so we merge it into the matrix to simulate it. - min = this.t.getBBox(); - x += t.xPercent * 0.01 * min.width; - y += t.yPercent * 0.01 * min.height; - } - min = 0.000001; - if (x < min) if (x > -min) { - x = 0; - } - if (y < min) if (y > -min) { - y = 0; - } - } - transform = (((a11 * rnd) | 0) / rnd) + "," + (((a21 * rnd) | 0) / rnd) + "," + (((a12 * rnd) | 0) / rnd) + "," + (((a22 * rnd) | 0) / rnd) + "," + x + "," + y + ")"; - if (isSVG && _useSVGTransformAttr) { - this.t.setAttribute("transform", "matrix(" + transform); - } else { - //some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 5 decimal places. - style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix(" : "matrix(") + transform; - } - } else { - style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix(" : "matrix(") + sx + ",0,0," + sy + "," + x + "," + y + ")"; - } - return; - - } - if (_isFirefox) { //Firefox has a bug (at least in v25) that causes it to render the transparent part of 32-bit PNG images as black when displayed inside an iframe and the 3D scale is very small and doesn't change sufficiently enough between renders (like if you use a Power4.easeInOut to scale from 0 to 1 where the beginning values only change a tiny amount to begin the tween before accelerating). In this case, we force the scale to be 0.00002 instead which is visually the same but works around the Firefox issue. - min = 0.0001; - if (sx < min && sx > -min) { - sx = sz = 0.00002; - } - if (sy < min && sy > -min) { - sy = sz = 0.00002; - } - if (perspective && !t.z && !t.rotationX && !t.rotationY) { //Firefox has a bug that causes elements to have an odd super-thin, broken/dotted black border on elements that have a perspective set but aren't utilizing 3D space (no rotationX, rotationY, or z). - perspective = 0; - } - } - if (angle || skewX) { - angle *= _DEG2RAD; - cos = a11 = Math.cos(angle); - sin = a21 = Math.sin(angle); - if (skewX) { - angle -= skewX * _DEG2RAD; - cos = Math.cos(angle); - sin = Math.sin(angle); - if (t.skewType === "simple") { //by default, we compensate skewing on the other axis to make it look more natural, but you can set the skewType to "simple" to use the uncompensated skewing that CSS does - t1 = Math.tan((skewX - skewY) * _DEG2RAD); - t1 = Math.sqrt(1 + t1 * t1); - cos *= t1; - sin *= t1; - if (t.skewY) { - t1 = Math.tan(skewY * _DEG2RAD); - t1 = Math.sqrt(1 + t1 * t1); - a11 *= t1; - a21 *= t1; - } - } - } - a12 = -sin; - a22 = cos; - - } else if (!rotationY && !rotationX && sz === 1 && !perspective && !isSVG) { //if we're only translating and/or 2D scaling, this is faster... - style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) translate3d(" : "translate3d(") + x + "px," + y + "px," + z +"px)" + ((sx !== 1 || sy !== 1) ? " scale(" + sx + "," + sy + ")" : ""); - return; - } else { - a11 = a22 = 1; - a12 = a21 = 0; - } - // KEY INDEX AFFECTS a[row][column] - // a11 0 rotation, rotationY, scaleX - // a21 1 rotation, rotationY, scaleX - // a31 2 rotationY, scaleX - // a41 3 rotationY, scaleX - // a12 4 rotation, skewX, rotationX, scaleY - // a22 5 rotation, skewX, rotationX, scaleY - // a32 6 rotationX, scaleY - // a42 7 rotationX, scaleY - // a13 8 rotationY, rotationX, scaleZ - // a23 9 rotationY, rotationX, scaleZ - // a33 10 rotationY, rotationX, scaleZ - // a43 11 rotationY, rotationX, perspective, scaleZ - // a14 12 x, zOrigin, svgOrigin - // a24 13 y, zOrigin, svgOrigin - // a34 14 z, zOrigin - // a44 15 - // rotation: Math.atan2(a21, a11) - // rotationY: Math.atan2(a13, a33) (or Math.atan2(a13, a11)) - // rotationX: Math.atan2(a32, a33) - a33 = 1; - a13 = a23 = a31 = a32 = a41 = a42 = 0; - a43 = (perspective) ? -1 / perspective : 0; - zOrigin = t.zOrigin; - min = 0.000001; //threshold below which browsers use scientific notation which won't work. - comma = ","; - zero = "0"; - angle = rotationY * _DEG2RAD; - if (angle) { - cos = Math.cos(angle); - sin = Math.sin(angle); - a31 = -sin; - a41 = a43*-sin; - a13 = a11*sin; - a23 = a21*sin; - a33 = cos; - a43 *= cos; - a11 *= cos; - a21 *= cos; - } - angle = rotationX * _DEG2RAD; - if (angle) { - cos = Math.cos(angle); - sin = Math.sin(angle); - t1 = a12*cos+a13*sin; - t2 = a22*cos+a23*sin; - a32 = a33*sin; - a42 = a43*sin; - a13 = a12*-sin+a13*cos; - a23 = a22*-sin+a23*cos; - a33 = a33*cos; - a43 = a43*cos; - a12 = t1; - a22 = t2; - } - if (sz !== 1) { - a13*=sz; - a23*=sz; - a33*=sz; - a43*=sz; - } - if (sy !== 1) { - a12*=sy; - a22*=sy; - a32*=sy; - a42*=sy; - } - if (sx !== 1) { - a11*=sx; - a21*=sx; - a31*=sx; - a41*=sx; - } - - if (zOrigin || isSVG) { - if (zOrigin) { - x += a13*-zOrigin; - y += a23*-zOrigin; - z += a33*-zOrigin+zOrigin; - } - if (isSVG) { //due to bugs in some browsers, we need to manage the transform-origin of SVG manually - x += t.xOrigin - (t.xOrigin * a11 + t.yOrigin * a12) + t.xOffset; - y += t.yOrigin - (t.xOrigin * a21 + t.yOrigin * a22) + t.yOffset; - } - if (x < min && x > -min) { - x = zero; - } - if (y < min && y > -min) { - y = zero; - } - if (z < min && z > -min) { - z = 0; //don't use string because we calculate perspective later and need the number. - } - } - - //optimized way of concatenating all the values into a string. If we do it all in one shot, it's slower because of the way browsers have to create temp strings and the way it affects memory. If we do it piece-by-piece with +=, it's a bit slower too. We found that doing it in these sized chunks works best overall: - transform = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix3d(" : "matrix3d("); - transform += ((a11 < min && a11 > -min) ? zero : a11) + comma + ((a21 < min && a21 > -min) ? zero : a21) + comma + ((a31 < min && a31 > -min) ? zero : a31); - transform += comma + ((a41 < min && a41 > -min) ? zero : a41) + comma + ((a12 < min && a12 > -min) ? zero : a12) + comma + ((a22 < min && a22 > -min) ? zero : a22); - if (rotationX || rotationY || sz !== 1) { //performance optimization (often there's no rotationX or rotationY, so we can skip these calculations) - transform += comma + ((a32 < min && a32 > -min) ? zero : a32) + comma + ((a42 < min && a42 > -min) ? zero : a42) + comma + ((a13 < min && a13 > -min) ? zero : a13); - transform += comma + ((a23 < min && a23 > -min) ? zero : a23) + comma + ((a33 < min && a33 > -min) ? zero : a33) + comma + ((a43 < min && a43 > -min) ? zero : a43) + comma; - } else { - transform += ",0,0,0,0,1,0,"; - } - transform += x + comma + y + comma + z + comma + (perspective ? (1 + (-z / perspective)) : 1) + ")"; - - style[_transformProp] = transform; - }; - - p = Transform.prototype; - p.x = p.y = p.z = p.skewX = p.skewY = p.rotation = p.rotationX = p.rotationY = p.zOrigin = p.xPercent = p.yPercent = p.xOffset = p.yOffset = 0; - p.scaleX = p.scaleY = p.scaleZ = 1; - - _registerComplexSpecialProp("transform,scale,scaleX,scaleY,scaleZ,x,y,z,rotation,rotationX,rotationY,rotationZ,skewX,skewY,shortRotation,shortRotationX,shortRotationY,shortRotationZ,transformOrigin,svgOrigin,transformPerspective,directionalRotation,parseTransform,force3D,skewType,xPercent,yPercent,smoothOrigin", {parser:function(t, e, parsingProp, cssp, pt, plugin, vars) { - if (cssp._lastParsedTransform === vars) { return pt; } //only need to parse the transform once, and only if the browser supports it. - cssp._lastParsedTransform = vars; - var scaleFunc = (vars.scale && typeof(vars.scale) === "function") ? vars.scale : 0; //if there's a function-based "scale" value, swap in the resulting numeric value temporarily. Otherwise, if it's called for both scaleX and scaleY independently, they may not match (like if the function uses Math.random()). - if (scaleFunc) { - vars.scale = scaleFunc(_index, t); - } - var originalGSTransform = t._gsTransform, - style = t.style, - min = 0.000001, - i = _transformProps.length, - v = vars, - endRotations = {}, - transformOriginString = "transformOrigin", - m1 = _getTransform(t, _cs, true, v.parseTransform), - orig = v.transform && ((typeof(v.transform) === "function") ? v.transform(_index, _target) : v.transform), - m2, copy, has3D, hasChange, dr, x, y, matrix, p; - m1.skewType = v.skewType || m1.skewType || CSSPlugin.defaultSkewType; - cssp._transform = m1; - if ("rotationZ" in v) { - v.rotation = v.rotationZ; - } - if (orig && typeof(orig) === "string" && _transformProp) { //for values like transform:"rotate(60deg) scale(0.5, 0.8)" - copy = _tempDiv.style; //don't use the original target because it might be SVG in which case some browsers don't report computed style correctly. - copy[_transformProp] = orig; - copy.display = "block"; //if display is "none", the browser often refuses to report the transform properties correctly. - copy.position = "absolute"; - if (orig.indexOf("%") !== -1) { //%-based translations will fail unless we set the width/height to match the original target... - copy.width = _getStyle(t, "width"); - copy.height = _getStyle(t, "height"); - } - _doc.body.appendChild(_tempDiv); - m2 = _getTransform(_tempDiv, null, false); - if (m1.skewType === "simple") { //the default _getTransform() reports the skewX/scaleY as if skewType is "compensated", thus we need to adjust that here if skewType is "simple". - m2.scaleY *= Math.cos(m2.skewX * _DEG2RAD); - } - if (m1.svg) { //if it's an SVG element, x/y part of the matrix will be affected by whatever we use as the origin and the offsets, so compensate here... - x = m1.xOrigin; - y = m1.yOrigin; - m2.x -= m1.xOffset; - m2.y -= m1.yOffset; - if (v.transformOrigin || v.svgOrigin) { //if this tween is altering the origin, we must factor that in here. The actual work of recording the transformOrigin values and setting up the PropTween is done later (still inside this function) so we cannot leave the changes intact here - we only want to update the x/y accordingly. - orig = {}; - _parseSVGOrigin(t, _parsePosition(v.transformOrigin), orig, v.svgOrigin, v.smoothOrigin, true); - x = orig.xOrigin; - y = orig.yOrigin; - m2.x -= orig.xOffset - m1.xOffset; - m2.y -= orig.yOffset - m1.yOffset; - } - if (x || y) { - matrix = _getMatrix(_tempDiv, true); - m2.x -= x - (x * matrix[0] + y * matrix[2]); - m2.y -= y - (x * matrix[1] + y * matrix[3]); - } - } - _doc.body.removeChild(_tempDiv); - if (!m2.perspective) { - m2.perspective = m1.perspective; //tweening to no perspective gives very unintuitive results - just keep the same perspective in that case. - } - if (v.xPercent != null) { - m2.xPercent = _parseVal(v.xPercent, m1.xPercent); - } - if (v.yPercent != null) { - m2.yPercent = _parseVal(v.yPercent, m1.yPercent); - } - } else if (typeof(v) === "object") { //for values like scaleX, scaleY, rotation, x, y, skewX, and skewY or transform:{...} (object) - m2 = {scaleX:_parseVal((v.scaleX != null) ? v.scaleX : v.scale, m1.scaleX), - scaleY:_parseVal((v.scaleY != null) ? v.scaleY : v.scale, m1.scaleY), - scaleZ:_parseVal(v.scaleZ, m1.scaleZ), - x:_parseVal(v.x, m1.x), - y:_parseVal(v.y, m1.y), - z:_parseVal(v.z, m1.z), - xPercent:_parseVal(v.xPercent, m1.xPercent), - yPercent:_parseVal(v.yPercent, m1.yPercent), - perspective:_parseVal(v.transformPerspective, m1.perspective)}; - dr = v.directionalRotation; - if (dr != null) { - if (typeof(dr) === "object") { - for (copy in dr) { - v[copy] = dr[copy]; - } - } else { - v.rotation = dr; - } - } - if (typeof(v.x) === "string" && v.x.indexOf("%") !== -1) { - m2.x = 0; - m2.xPercent = _parseVal(v.x, m1.xPercent); - } - if (typeof(v.y) === "string" && v.y.indexOf("%") !== -1) { - m2.y = 0; - m2.yPercent = _parseVal(v.y, m1.yPercent); - } - - m2.rotation = _parseAngle(("rotation" in v) ? v.rotation : ("shortRotation" in v) ? v.shortRotation + "_short" : m1.rotation, m1.rotation, "rotation", endRotations); - if (_supports3D) { - m2.rotationX = _parseAngle(("rotationX" in v) ? v.rotationX : ("shortRotationX" in v) ? v.shortRotationX + "_short" : m1.rotationX || 0, m1.rotationX, "rotationX", endRotations); - m2.rotationY = _parseAngle(("rotationY" in v) ? v.rotationY : ("shortRotationY" in v) ? v.shortRotationY + "_short" : m1.rotationY || 0, m1.rotationY, "rotationY", endRotations); - } - m2.skewX = _parseAngle(v.skewX, m1.skewX); - m2.skewY = _parseAngle(v.skewY, m1.skewY); - } - if (_supports3D && v.force3D != null) { - m1.force3D = v.force3D; - hasChange = true; - } - - has3D = (m1.force3D || m1.z || m1.rotationX || m1.rotationY || m2.z || m2.rotationX || m2.rotationY || m2.perspective); - if (!has3D && v.scale != null) { - m2.scaleZ = 1; //no need to tween scaleZ. - } - - while (--i > -1) { - p = _transformProps[i]; - orig = m2[p] - m1[p]; - if (orig > min || orig < -min || v[p] != null || _forcePT[p] != null) { - hasChange = true; - pt = new CSSPropTween(m1, p, m1[p], orig, pt); - if (p in endRotations) { - pt.e = endRotations[p]; //directional rotations typically have compensated values during the tween, but we need to make sure they end at exactly what the user requested - } - pt.xs0 = 0; //ensures the value stays numeric in setRatio() - pt.plugin = plugin; - cssp._overwriteProps.push(pt.n); - } - } - - orig = (typeof(v.transformOrigin) === "function") ? v.transformOrigin(_index, _target) : v.transformOrigin; - if (m1.svg && (orig || v.svgOrigin)) { - x = m1.xOffset; //when we change the origin, in order to prevent things from jumping we adjust the x/y so we must record those here so that we can create PropTweens for them and flip them at the same time as the origin - y = m1.yOffset; - _parseSVGOrigin(t, _parsePosition(orig), m2, v.svgOrigin, v.smoothOrigin); - pt = _addNonTweeningNumericPT(m1, "xOrigin", (originalGSTransform ? m1 : m2).xOrigin, m2.xOrigin, pt, transformOriginString); //note: if there wasn't a transformOrigin defined yet, just start with the destination one; it's wasteful otherwise, and it causes problems with fromTo() tweens. For example, TweenLite.to("#wheel", 3, {rotation:180, transformOrigin:"50% 50%", delay:1}); TweenLite.fromTo("#wheel", 3, {scale:0.5, transformOrigin:"50% 50%"}, {scale:1, delay:2}); would cause a jump when the from values revert at the beginning of the 2nd tween. - pt = _addNonTweeningNumericPT(m1, "yOrigin", (originalGSTransform ? m1 : m2).yOrigin, m2.yOrigin, pt, transformOriginString); - if (x !== m1.xOffset || y !== m1.yOffset) { - pt = _addNonTweeningNumericPT(m1, "xOffset", (originalGSTransform ? x : m1.xOffset), m1.xOffset, pt, transformOriginString); - pt = _addNonTweeningNumericPT(m1, "yOffset", (originalGSTransform ? y : m1.yOffset), m1.yOffset, pt, transformOriginString); - } - orig = "0px 0px"; //certain browsers (like firefox) completely botch transform-origin, so we must remove it to prevent it from contaminating transforms. We manage it ourselves with xOrigin and yOrigin - } - if (orig || (_supports3D && has3D && m1.zOrigin)) { //if anything 3D is happening and there's a transformOrigin with a z component that's non-zero, we must ensure that the transformOrigin's z-component is set to 0 so that we can manually do those calculations to get around Safari bugs. Even if the user didn't specifically define a "transformOrigin" in this particular tween (maybe they did it via css directly). - if (_transformProp) { - hasChange = true; - p = _transformOriginProp; - if (!orig) { - orig = (_getStyle(t, p, _cs, false, "50% 50%") + "").split(" "); - orig = orig[0] + " " + orig[1] + " " + m1.zOrigin + "px"; - } - orig += ""; - pt = new CSSPropTween(style, p, 0, 0, pt, -1, transformOriginString); - pt.b = style[p]; - pt.plugin = plugin; - if (_supports3D) { - copy = m1.zOrigin; - orig = orig.split(" "); - m1.zOrigin = ((orig.length > 2) ? parseFloat(orig[2]) : copy) || 0; //Safari doesn't handle the z part of transformOrigin correctly, so we'll manually handle it in the _set3DTransformRatio() method. - pt.xs0 = pt.e = orig[0] + " " + (orig[1] || "50%") + " 0px"; //we must define a z value of 0px specifically otherwise iOS 5 Safari will stick with the old one (if one was defined)! - pt = new CSSPropTween(m1, "zOrigin", 0, 0, pt, -1, pt.n); //we must create a CSSPropTween for the _gsTransform.zOrigin so that it gets reset properly at the beginning if the tween runs backward (as opposed to just setting m1.zOrigin here) - pt.b = copy; - pt.xs0 = pt.e = m1.zOrigin; - } else { - pt.xs0 = pt.e = orig; - } - - //for older versions of IE (6-8), we need to manually calculate things inside the setRatio() function. We record origin x and y (ox and oy) and whether or not the values are percentages (oxp and oyp). - } else { - _parsePosition(orig + "", m1); - } - } - if (hasChange) { - cssp._transformType = (!(m1.svg && _useSVGTransformAttr) && (has3D || this._transformType === 3)) ? 3 : 2; //quicker than calling cssp._enableTransforms(); - } - if (scaleFunc) { - vars.scale = scaleFunc; - } - return pt; - }, allowFunc:true, prefix:true}); - - _registerComplexSpecialProp("boxShadow", {defaultValue:"0px 0px 0px 0px #999", prefix:true, color:true, multi:true, keyword:"inset"}); - _registerComplexSpecialProp("clipPath", {defaultValue:"inset(0px)", prefix:true, multi:true, formatter:_getFormatter("inset(0px 0px 0px 0px)", false, true)}); - - _registerComplexSpecialProp("borderRadius", {defaultValue:"0px", parser:function(t, e, p, cssp, pt, plugin) { - e = this.format(e); - var props = ["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"], - style = t.style, - ea1, i, es2, bs2, bs, es, bn, en, w, h, esfx, bsfx, rel, hn, vn, em; - w = parseFloat(t.offsetWidth); - h = parseFloat(t.offsetHeight); - ea1 = e.split(" "); - for (i = 0; i < props.length; i++) { //if we're dealing with percentages, we must convert things separately for the horizontal and vertical axis! - if (this.p.indexOf("border")) { //older browsers used a prefix - props[i] = _checkPropPrefix(props[i]); - } - bs = bs2 = _getStyle(t, props[i], _cs, false, "0px"); - if (bs.indexOf(" ") !== -1) { - bs2 = bs.split(" "); - bs = bs2[0]; - bs2 = bs2[1]; - } - es = es2 = ea1[i]; - bn = parseFloat(bs); - bsfx = bs.substr((bn + "").length); - rel = (es.charAt(1) === "="); - if (rel) { - en = parseInt(es.charAt(0)+"1", 10); - es = es.substr(2); - en *= parseFloat(es); - esfx = es.substr((en + "").length - (en < 0 ? 1 : 0)) || ""; - } else { - en = parseFloat(es); - esfx = es.substr((en + "").length); - } - if (esfx === "") { - esfx = _suffixMap[p] || bsfx; - } - if (esfx !== bsfx) { - hn = _convertToPixels(t, "borderLeft", bn, bsfx); //horizontal number (we use a bogus "borderLeft" property just because the _convertToPixels() method searches for the keywords "Left", "Right", "Top", and "Bottom" to determine of it's a horizontal or vertical property, and we need "border" in the name so that it knows it should measure relative to the element itself, not its parent. - vn = _convertToPixels(t, "borderTop", bn, bsfx); //vertical number - if (esfx === "%") { - bs = (hn / w * 100) + "%"; - bs2 = (vn / h * 100) + "%"; - } else if (esfx === "em") { - em = _convertToPixels(t, "borderLeft", 1, "em"); - bs = (hn / em) + "em"; - bs2 = (vn / em) + "em"; - } else { - bs = hn + "px"; - bs2 = vn + "px"; - } - if (rel) { - es = (parseFloat(bs) + en) + esfx; - es2 = (parseFloat(bs2) + en) + esfx; - } - } - pt = _parseComplex(style, props[i], bs + " " + bs2, es + " " + es2, false, "0px", pt); - } - return pt; - }, prefix:true, formatter:_getFormatter("0px 0px 0px 0px", false, true)}); - _registerComplexSpecialProp("borderBottomLeftRadius,borderBottomRightRadius,borderTopLeftRadius,borderTopRightRadius", {defaultValue:"0px", parser:function(t, e, p, cssp, pt, plugin) { - return _parseComplex(t.style, p, this.format(_getStyle(t, p, _cs, false, "0px 0px")), this.format(e), false, "0px", pt); - }, prefix:true, formatter:_getFormatter("0px 0px", false, true)}); - _registerComplexSpecialProp("backgroundPosition", {defaultValue:"0 0", parser:function(t, e, p, cssp, pt, plugin) { - var bp = "background-position", - cs = (_cs || _getComputedStyle(t, null)), - bs = this.format( ((cs) ? _ieVers ? cs.getPropertyValue(bp + "-x") + " " + cs.getPropertyValue(bp + "-y") : cs.getPropertyValue(bp) : t.currentStyle.backgroundPositionX + " " + t.currentStyle.backgroundPositionY) || "0 0"), //Internet Explorer doesn't report background-position correctly - we must query background-position-x and background-position-y and combine them (even in IE10). Before IE9, we must do the same with the currentStyle object and use camelCase - es = this.format(e), - ba, ea, i, pct, overlap, src; - if ((bs.indexOf("%") !== -1) !== (es.indexOf("%") !== -1) && es.split(",").length < 2) { - src = _getStyle(t, "backgroundImage").replace(_urlExp, ""); - if (src && src !== "none") { - ba = bs.split(" "); - ea = es.split(" "); - _tempImg.setAttribute("src", src); //set the temp IMG's src to the background-image so that we can measure its width/height - i = 2; - while (--i > -1) { - bs = ba[i]; - pct = (bs.indexOf("%") !== -1); - if (pct !== (ea[i].indexOf("%") !== -1)) { - overlap = (i === 0) ? t.offsetWidth - _tempImg.width : t.offsetHeight - _tempImg.height; - ba[i] = pct ? (parseFloat(bs) / 100 * overlap) + "px" : (parseFloat(bs) / overlap * 100) + "%"; - } - } - bs = ba.join(" "); - } - } - return this.parseComplex(t.style, bs, es, pt, plugin); - }, formatter:_parsePosition}); - _registerComplexSpecialProp("backgroundSize", {defaultValue:"0 0", formatter:function(v) { - v += ""; //ensure it's a string - return (v.substr(0,2) === "co") ? v : _parsePosition(v.indexOf(" ") === -1 ? v + " " + v : v); //if set to something like "100% 100%", Safari typically reports the computed style as just "100%" (no 2nd value), but we should ensure that there are two values, so copy the first one. Otherwise, it'd be interpreted as "100% 0" (wrong). Also remember that it could be "cover" or "contain" which we can't tween but should be able to set. - }}); - _registerComplexSpecialProp("perspective", {defaultValue:"0px", prefix:true}); - _registerComplexSpecialProp("perspectiveOrigin", {defaultValue:"50% 50%", prefix:true}); - _registerComplexSpecialProp("transformStyle", {prefix:true}); - _registerComplexSpecialProp("backfaceVisibility", {prefix:true}); - _registerComplexSpecialProp("userSelect", {prefix:true}); - _registerComplexSpecialProp("margin", {parser:_getEdgeParser("marginTop,marginRight,marginBottom,marginLeft")}); - _registerComplexSpecialProp("padding", {parser:_getEdgeParser("paddingTop,paddingRight,paddingBottom,paddingLeft")}); - _registerComplexSpecialProp("clip", {defaultValue:"rect(0px,0px,0px,0px)", parser:function(t, e, p, cssp, pt, plugin){ - var b, cs, delim; - if (_ieVers < 9) { //IE8 and earlier don't report a "clip" value in the currentStyle - instead, the values are split apart into clipTop, clipRight, clipBottom, and clipLeft. Also, in IE7 and earlier, the values inside rect() are space-delimited, not comma-delimited. - cs = t.currentStyle; - delim = _ieVers < 8 ? " " : ","; - b = "rect(" + cs.clipTop + delim + cs.clipRight + delim + cs.clipBottom + delim + cs.clipLeft + ")"; - e = this.format(e).split(",").join(delim); - } else { - b = this.format(_getStyle(t, this.p, _cs, false, this.dflt)); - e = this.format(e); - } - return this.parseComplex(t.style, b, e, pt, plugin); - }}); - _registerComplexSpecialProp("textShadow", {defaultValue:"0px 0px 0px #999", color:true, multi:true}); - _registerComplexSpecialProp("autoRound,strictUnits", {parser:function(t, e, p, cssp, pt) {return pt;}}); //just so that we can ignore these properties (not tween them) - _registerComplexSpecialProp("border", {defaultValue:"0px solid #000", parser:function(t, e, p, cssp, pt, plugin) { - var bw = _getStyle(t, "borderTopWidth", _cs, false, "0px"), - end = this.format(e).split(" "), - esfx = end[0].replace(_suffixExp, ""); - if (esfx !== "px") { //if we're animating to a non-px value, we need to convert the beginning width to that unit. - bw = (parseFloat(bw) / _convertToPixels(t, "borderTopWidth", 1, esfx)) + esfx; - } - return this.parseComplex(t.style, this.format(bw + " " + _getStyle(t, "borderTopStyle", _cs, false, "solid") + " " + _getStyle(t, "borderTopColor", _cs, false, "#000")), end.join(" "), pt, plugin); - }, color:true, formatter:function(v) { - var a = v.split(" "); - return a[0] + " " + (a[1] || "solid") + " " + (v.match(_colorExp) || ["#000"])[0]; - }}); - _registerComplexSpecialProp("borderWidth", {parser:_getEdgeParser("borderTopWidth,borderRightWidth,borderBottomWidth,borderLeftWidth")}); //Firefox doesn't pick up on borderWidth set in style sheets (only inline). - _registerComplexSpecialProp("float,cssFloat,styleFloat", {parser:function(t, e, p, cssp, pt, plugin) { - var s = t.style, - prop = ("cssFloat" in s) ? "cssFloat" : "styleFloat"; - return new CSSPropTween(s, prop, 0, 0, pt, -1, p, false, 0, s[prop], e); - }}); - - //opacity-related - var _setIEOpacityRatio = function(v) { - var t = this.t, //refers to the element's style property - filters = t.filter || _getStyle(this.data, "filter") || "", - val = (this.s + this.c * v) | 0, - skip; - if (val === 100) { //for older versions of IE that need to use a filter to apply opacity, we should remove the filter if opacity hits 1 in order to improve performance, but make sure there isn't a transform (matrix) or gradient in the filters. - if (filters.indexOf("atrix(") === -1 && filters.indexOf("radient(") === -1 && filters.indexOf("oader(") === -1) { - t.removeAttribute("filter"); - skip = (!_getStyle(this.data, "filter")); //if a class is applied that has an alpha filter, it will take effect (we don't want that), so re-apply our alpha filter in that case. We must first remove it and then check. - } else { - t.filter = filters.replace(_alphaFilterExp, ""); - skip = true; - } - } - if (!skip) { - if (this.xn1) { - t.filter = filters = filters || ("alpha(opacity=" + val + ")"); //works around bug in IE7/8 that prevents changes to "visibility" from being applied properly if the filter is changed to a different alpha on the same frame. - } - if (filters.indexOf("pacity") === -1) { //only used if browser doesn't support the standard opacity style property (IE 7 and 8). We omit the "O" to avoid case-sensitivity issues - if (val !== 0 || !this.xn1) { //bugs in IE7/8 won't render the filter properly if opacity is ADDED on the same frame/render as "visibility" changes (this.xn1 is 1 if this tween is an "autoAlpha" tween) - t.filter = filters + " alpha(opacity=" + val + ")"; //we round the value because otherwise, bugs in IE7/8 can prevent "visibility" changes from being applied properly. - } - } else { - t.filter = filters.replace(_opacityExp, "opacity=" + val); - } - } - }; - _registerComplexSpecialProp("opacity,alpha,autoAlpha", {defaultValue:"1", parser:function(t, e, p, cssp, pt, plugin) { - var b = parseFloat(_getStyle(t, "opacity", _cs, false, "1")), - style = t.style, - isAutoAlpha = (p === "autoAlpha"); - if (typeof(e) === "string" && e.charAt(1) === "=") { - e = ((e.charAt(0) === "-") ? -1 : 1) * parseFloat(e.substr(2)) + b; - } - if (isAutoAlpha && b === 1 && _getStyle(t, "visibility", _cs) === "hidden" && e !== 0) { //if visibility is initially set to "hidden", we should interpret that as intent to make opacity 0 (a convenience) - b = 0; - } - if (_supportsOpacity) { - pt = new CSSPropTween(style, "opacity", b, e - b, pt); - } else { - pt = new CSSPropTween(style, "opacity", b * 100, (e - b) * 100, pt); - pt.xn1 = isAutoAlpha ? 1 : 0; //we need to record whether or not this is an autoAlpha so that in the setRatio(), we know to duplicate the setting of the alpha in order to work around a bug in IE7 and IE8 that prevents changes to "visibility" from taking effect if the filter is changed to a different alpha(opacity) at the same time. Setting it to the SAME value first, then the new value works around the IE7/8 bug. - style.zoom = 1; //helps correct an IE issue. - pt.type = 2; - pt.b = "alpha(opacity=" + pt.s + ")"; - pt.e = "alpha(opacity=" + (pt.s + pt.c) + ")"; - pt.data = t; - pt.plugin = plugin; - pt.setRatio = _setIEOpacityRatio; - } - if (isAutoAlpha) { //we have to create the "visibility" PropTween after the opacity one in the linked list so that they run in the order that works properly in IE8 and earlier - pt = new CSSPropTween(style, "visibility", 0, 0, pt, -1, null, false, 0, ((b !== 0) ? "inherit" : "hidden"), ((e === 0) ? "hidden" : "inherit")); - pt.xs0 = "inherit"; - cssp._overwriteProps.push(pt.n); - cssp._overwriteProps.push(p); - } - return pt; - }}); - - - var _removeProp = function(s, p) { - if (p) { - if (s.removeProperty) { - if (p.substr(0,2) === "ms" || p.substr(0,6) === "webkit") { //Microsoft and some Webkit browsers don't conform to the standard of capitalizing the first prefix character, so we adjust so that when we prefix the caps with a dash, it's correct (otherwise it'd be "ms-transform" instead of "-ms-transform" for IE9, for example) - p = "-" + p; - } - s.removeProperty(p.replace(_capsExp, "-$1").toLowerCase()); - } else { //note: old versions of IE use "removeAttribute()" instead of "removeProperty()" - s.removeAttribute(p); - } - } - }, - _setClassNameRatio = function(v) { - this.t._gsClassPT = this; - if (v === 1 || v === 0) { - this.t.setAttribute("class", (v === 0) ? this.b : this.e); - var mpt = this.data, //first MiniPropTween - s = this.t.style; - while (mpt) { - if (!mpt.v) { - _removeProp(s, mpt.p); - } else { - s[mpt.p] = mpt.v; - } - mpt = mpt._next; - } - if (v === 1 && this.t._gsClassPT === this) { - this.t._gsClassPT = null; - } - } else if (this.t.getAttribute("class") !== this.e) { - this.t.setAttribute("class", this.e); - } - }; - _registerComplexSpecialProp("className", {parser:function(t, e, p, cssp, pt, plugin, vars) { - var b = t.getAttribute("class") || "", //don't use t.className because it doesn't work consistently on SVG elements; getAttribute("class") and setAttribute("class", value") is more reliable. - cssText = t.style.cssText, - difData, bs, cnpt, cnptLookup, mpt; - pt = cssp._classNamePT = new CSSPropTween(t, p, 0, 0, pt, 2); - pt.setRatio = _setClassNameRatio; - pt.pr = -11; - _hasPriority = true; - pt.b = b; - bs = _getAllStyles(t, _cs); - //if there's a className tween already operating on the target, force it to its end so that the necessary inline styles are removed and the class name is applied before we determine the end state (we don't want inline styles interfering that were there just for class-specific values) - cnpt = t._gsClassPT; - if (cnpt) { - cnptLookup = {}; - mpt = cnpt.data; //first MiniPropTween which stores the inline styles - we need to force these so that the inline styles don't contaminate things. Otherwise, there's a small chance that a tween could start and the inline values match the destination values and they never get cleaned. - while (mpt) { - cnptLookup[mpt.p] = 1; - mpt = mpt._next; - } - cnpt.setRatio(1); - } - t._gsClassPT = pt; - pt.e = (e.charAt(1) !== "=") ? e : b.replace(new RegExp("(?:\\s|^)" + e.substr(2) + "(?![\\w-])"), "") + ((e.charAt(0) === "+") ? " " + e.substr(2) : ""); - t.setAttribute("class", pt.e); - difData = _cssDif(t, bs, _getAllStyles(t), vars, cnptLookup); - t.setAttribute("class", b); - pt.data = difData.firstMPT; - t.style.cssText = cssText; //we recorded cssText before we swapped classes and ran _getAllStyles() because in cases when a className tween is overwritten, we remove all the related tweening properties from that class change (otherwise class-specific stuff can't override properties we've directly set on the target's style object due to specificity). - pt = pt.xfirst = cssp.parse(t, difData.difs, pt, plugin); //we record the CSSPropTween as the xfirst so that we can handle overwriting propertly (if "className" gets overwritten, we must kill all the properties associated with the className part of the tween, so we can loop through from xfirst to the pt itself) - return pt; - }}); - - - var _setClearPropsRatio = function(v) { - if (v === 1 || v === 0) if (this.data._totalTime === this.data._totalDuration && this.data.data !== "isFromStart") { //this.data refers to the tween. Only clear at the END of the tween (remember, from() tweens make the ratio go from 1 to 0, so we can't just check that and if the tween is the zero-duration one that's created internally to render the starting values in a from() tween, ignore that because otherwise, for example, from(...{height:100, clearProps:"height", delay:1}) would wipe the height at the beginning of the tween and after 1 second, it'd kick back in). - var s = this.t.style, - transformParse = _specialProps.transform.parse, - a, p, i, clearTransform, transform; - if (this.e === "all") { - s.cssText = ""; - clearTransform = true; - } else { - a = this.e.split(" ").join("").split(","); - i = a.length; - while (--i > -1) { - p = a[i]; - if (_specialProps[p]) { - if (_specialProps[p].parse === transformParse) { - clearTransform = true; - } else { - p = (p === "transformOrigin") ? _transformOriginProp : _specialProps[p].p; //ensures that special properties use the proper browser-specific property name, like "scaleX" might be "-webkit-transform" or "boxShadow" might be "-moz-box-shadow" - } - } - _removeProp(s, p); - } - } - if (clearTransform) { - _removeProp(s, _transformProp); - transform = this.t._gsTransform; - if (transform) { - if (transform.svg) { - this.t.removeAttribute("data-svg-origin"); - this.t.removeAttribute("transform"); - } - delete this.t._gsTransform; - } - } - - } - }; - _registerComplexSpecialProp("clearProps", {parser:function(t, e, p, cssp, pt) { - pt = new CSSPropTween(t, p, 0, 0, pt, 2); - pt.setRatio = _setClearPropsRatio; - pt.e = e; - pt.pr = -10; - pt.data = cssp._tween; - _hasPriority = true; - return pt; - }}); - - p = "bezier,throwProps,physicsProps,physics2D".split(","); - i = p.length; - while (i--) { - _registerPluginProp(p[i]); - } - - - - - - - - - p = CSSPlugin.prototype; - p._firstPT = p._lastParsedTransform = p._transform = null; - - //gets called when the tween renders for the first time. This kicks everything off, recording start/end values, etc. - p._onInitTween = function(target, vars, tween, index) { - if (!target.nodeType) { //css is only for dom elements - return false; - } - this._target = _target = target; - this._tween = tween; - this._vars = vars; - _index = index; - _autoRound = vars.autoRound; - _hasPriority = false; - _suffixMap = vars.suffixMap || CSSPlugin.suffixMap; - _cs = _getComputedStyle(target, ""); - _overwriteProps = this._overwriteProps; - var style = target.style, - v, pt, pt2, first, last, next, zIndex, tpt, threeD; - if (_reqSafariFix) if (style.zIndex === "") { - v = _getStyle(target, "zIndex", _cs); - if (v === "auto" || v === "") { - //corrects a bug in [non-Android] Safari that prevents it from repainting elements in their new positions if they don't have a zIndex set. We also can't just apply this inside _parseTransform() because anything that's moved in any way (like using "left" or "top" instead of transforms like "x" and "y") can be affected, so it is best to ensure that anything that's tweening has a z-index. Setting "WebkitPerspective" to a non-zero value worked too except that on iOS Safari things would flicker randomly. Plus zIndex is less memory-intensive. - this._addLazySet(style, "zIndex", 0); - } - } - - if (typeof(vars) === "string") { - first = style.cssText; - v = _getAllStyles(target, _cs); - style.cssText = first + ";" + vars; - v = _cssDif(target, v, _getAllStyles(target)).difs; - if (!_supportsOpacity && _opacityValExp.test(vars)) { - v.opacity = parseFloat( RegExp.$1 ); - } - vars = v; - style.cssText = first; - } - - if (vars.className) { //className tweens will combine any differences they find in the css with the vars that are passed in, so {className:"myClass", scale:0.5, left:20} would work. - this._firstPT = pt = _specialProps.className.parse(target, vars.className, "className", this, null, null, vars); - } else { - this._firstPT = pt = this.parse(target, vars, null); - } - - if (this._transformType) { - threeD = (this._transformType === 3); - if (!_transformProp) { - style.zoom = 1; //helps correct an IE issue. - } else if (_isSafari) { - _reqSafariFix = true; - //if zIndex isn't set, iOS Safari doesn't repaint things correctly sometimes (seemingly at random). - if (style.zIndex === "") { - zIndex = _getStyle(target, "zIndex", _cs); - if (zIndex === "auto" || zIndex === "") { - this._addLazySet(style, "zIndex", 0); - } - } - //Setting WebkitBackfaceVisibility corrects 3 bugs: - // 1) [non-Android] Safari skips rendering changes to "top" and "left" that are made on the same frame/render as a transform update. - // 2) iOS Safari sometimes neglects to repaint elements in their new positions. Setting "WebkitPerspective" to a non-zero value worked too except that on iOS Safari things would flicker randomly. - // 3) Safari sometimes displayed odd artifacts when tweening the transform (or WebkitTransform) property, like ghosts of the edges of the element remained. Definitely a browser bug. - //Note: we allow the user to override the auto-setting by defining WebkitBackfaceVisibility in the vars of the tween. - if (_isSafariLT6) { - this._addLazySet(style, "WebkitBackfaceVisibility", this._vars.WebkitBackfaceVisibility || (threeD ? "visible" : "hidden")); - } - } - pt2 = pt; - while (pt2 && pt2._next) { - pt2 = pt2._next; - } - tpt = new CSSPropTween(target, "transform", 0, 0, null, 2); - this._linkCSSP(tpt, null, pt2); - tpt.setRatio = _transformProp ? _setTransformRatio : _setIETransformRatio; - tpt.data = this._transform || _getTransform(target, _cs, true); - tpt.tween = tween; - tpt.pr = -1; //ensures that the transforms get applied after the components are updated. - _overwriteProps.pop(); //we don't want to force the overwrite of all "transform" tweens of the target - we only care about individual transform properties like scaleX, rotation, etc. The CSSPropTween constructor automatically adds the property to _overwriteProps which is why we need to pop() here. - } - - if (_hasPriority) { - //reorders the linked list in order of pr (priority) - while (pt) { - next = pt._next; - pt2 = first; - while (pt2 && pt2.pr > pt.pr) { - pt2 = pt2._next; - } - if ((pt._prev = pt2 ? pt2._prev : last)) { - pt._prev._next = pt; - } else { - first = pt; - } - if ((pt._next = pt2)) { - pt2._prev = pt; - } else { - last = pt; - } - pt = next; - } - this._firstPT = first; - } - return true; - }; - - - p.parse = function(target, vars, pt, plugin) { - var style = target.style, - p, sp, bn, en, bs, es, bsfx, esfx, isStr, rel; - for (p in vars) { - es = vars[p]; //ending value string - sp = _specialProps[p]; //SpecialProp lookup. - if (typeof(es) === "function" && !(sp && sp.allowFunc)) { - es = es(_index, _target); - } - if (sp) { - pt = sp.parse(target, es, p, this, pt, plugin, vars); - } else if (p.substr(0,2) === "--") { //for tweening CSS variables (which always start with "--"). To maximize performance and simplicity, we bypass CSSPlugin altogether and just add a normal property tween to the tween instance itself. - this._tween._propLookup[p] = this._addTween.call(this._tween, target.style, "setProperty", _getComputedStyle(target).getPropertyValue(p) + "", es + "", p, false, p); - continue; - } else { - bs = _getStyle(target, p, _cs) + ""; - isStr = (typeof(es) === "string"); - if (p === "color" || p === "fill" || p === "stroke" || p.indexOf("Color") !== -1 || (isStr && _rgbhslExp.test(es))) { //Opera uses background: to define color sometimes in addition to backgroundColor: - if (!isStr) { - es = _parseColor(es); - es = ((es.length > 3) ? "rgba(" : "rgb(") + es.join(",") + ")"; - } - pt = _parseComplex(style, p, bs, es, true, "transparent", pt, 0, plugin); - - } else if (isStr && _complexExp.test(es)) { - pt = _parseComplex(style, p, bs, es, true, null, pt, 0, plugin); - - } else { - bn = parseFloat(bs); - bsfx = (bn || bn === 0) ? bs.substr((bn + "").length) : ""; //remember, bs could be non-numeric like "normal" for fontWeight, so we should default to a blank suffix in that case. - - if (bs === "" || bs === "auto") { - if (p === "width" || p === "height") { - bn = _getDimension(target, p, _cs); - bsfx = "px"; - } else if (p === "left" || p === "top") { - bn = _calculateOffset(target, p, _cs); - bsfx = "px"; - } else { - bn = (p !== "opacity") ? 0 : 1; - bsfx = ""; - } - } - - rel = (isStr && es.charAt(1) === "="); - if (rel) { - en = parseInt(es.charAt(0) + "1", 10); - es = es.substr(2); - en *= parseFloat(es); - esfx = es.replace(_suffixExp, ""); - } else { - en = parseFloat(es); - esfx = isStr ? es.replace(_suffixExp, "") : ""; - } - - if (esfx === "") { - esfx = (p in _suffixMap) ? _suffixMap[p] : bsfx; //populate the end suffix, prioritizing the map, then if none is found, use the beginning suffix. - } - - es = (en || en === 0) ? (rel ? en + bn : en) + esfx : vars[p]; //ensures that any += or -= prefixes are taken care of. Record the end value before normalizing the suffix because we always want to end the tween on exactly what they intended even if it doesn't match the beginning value's suffix. - //if the beginning/ending suffixes don't match, normalize them... - if (bsfx !== esfx) if (esfx !== "" || p === "lineHeight") if (en || en === 0) if (bn) { //note: if the beginning value (bn) is 0, we don't need to convert units! - bn = _convertToPixels(target, p, bn, bsfx); - if (esfx === "%") { - bn /= _convertToPixels(target, p, 100, "%") / 100; - if (vars.strictUnits !== true) { //some browsers report only "px" values instead of allowing "%" with getComputedStyle(), so we assume that if we're tweening to a %, we should start there too unless strictUnits:true is defined. This approach is particularly useful for responsive designs that use from() tweens. - bs = bn + "%"; - } - - } else if (esfx === "em" || esfx === "rem" || esfx === "vw" || esfx === "vh") { - bn /= _convertToPixels(target, p, 1, esfx); - - //otherwise convert to pixels. - } else if (esfx !== "px") { - en = _convertToPixels(target, p, en, esfx); - esfx = "px"; //we don't use bsfx after this, so we don't need to set it to px too. - } - if (rel) if (en || en === 0) { - es = (en + bn) + esfx; //the changes we made affect relative calculations, so adjust the end value here. - } - } - - if (rel) { - en += bn; - } - - if ((bn || bn === 0) && (en || en === 0)) { //faster than isNaN(). Also, previously we required en !== bn but that doesn't really gain much performance and it prevents _parseToProxy() from working properly if beginning and ending values match but need to get tweened by an external plugin anyway. For example, a bezier tween where the target starts at left:0 and has these points: [{left:50},{left:0}] wouldn't work properly because when parsing the last point, it'd match the first (current) one and a non-tweening CSSPropTween would be recorded when we actually need a normal tween (type:0) so that things get updated during the tween properly. - pt = new CSSPropTween(style, p, bn, en - bn, pt, 0, p, (_autoRound !== false && (esfx === "px" || p === "zIndex")), 0, bs, es); - pt.xs0 = esfx; - //DEBUG: _log("tween "+p+" from "+pt.b+" ("+bn+esfx+") to "+pt.e+" with suffix: "+pt.xs0); - } else if (style[p] === undefined || !es && (es + "" === "NaN" || es == null)) { - _log("invalid " + p + " tween value: " + vars[p]); - } else { - pt = new CSSPropTween(style, p, en || bn || 0, 0, pt, -1, p, false, 0, bs, es); - pt.xs0 = (es === "none" && (p === "display" || p.indexOf("Style") !== -1)) ? bs : es; //intermediate value should typically be set immediately (end value) except for "display" or things like borderTopStyle, borderBottomStyle, etc. which should use the beginning value during the tween. - //DEBUG: _log("non-tweening value "+p+": "+pt.xs0); - } - } - } - if (plugin) if (pt && !pt.plugin) { - pt.plugin = plugin; - } - } - return pt; - }; - - - //gets called every time the tween updates, passing the new ratio (typically a value between 0 and 1, but not always (for example, if an Elastic.easeOut is used, the value can jump above 1 mid-tween). It will always start and 0 and end at 1. - p.setRatio = function(v) { - var pt = this._firstPT, - min = 0.000001, - val, str, i; - //at the end of the tween, we set the values to exactly what we received in order to make sure non-tweening values (like "position" or "float" or whatever) are set and so that if the beginning/ending suffixes (units) didn't match and we normalized to px, the value that the user passed in is used here. We check to see if the tween is at its beginning in case it's a from() tween in which case the ratio will actually go from 1 to 0 over the course of the tween (backwards). - if (v === 1 && (this._tween._time === this._tween._duration || this._tween._time === 0)) { - while (pt) { - if (pt.type !== 2) { - if (pt.r && pt.type !== -1) { - val = pt.r(pt.s + pt.c); - if (!pt.type) { - pt.t[pt.p] = val + pt.xs0; - } else if (pt.type === 1) { //complex value (one that typically has multiple numbers inside a string, like "rect(5px,10px,20px,25px)" - i = pt.l; - str = pt.xs0 + val + pt.xs1; - for (i = 1; i < pt.l; i++) { - str += pt["xn"+i] + pt["xs"+(i+1)]; - } - pt.t[pt.p] = str; - } - } else { - pt.t[pt.p] = pt.e; - } - } else { - pt.setRatio(v); - } - pt = pt._next; - } - - } else if (v || !(this._tween._time === this._tween._duration || this._tween._time === 0) || this._tween._rawPrevTime === -0.000001) { - while (pt) { - val = pt.c * v + pt.s; - if (pt.r) { - val = pt.r(val); - } else if (val < min) if (val > -min) { - val = 0; - } - if (!pt.type) { - pt.t[pt.p] = val + pt.xs0; - } else if (pt.type === 1) { //complex value (one that typically has multiple numbers inside a string, like "rect(5px,10px,20px,25px)" - i = pt.l; - if (i === 2) { - pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2; - } else if (i === 3) { - pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2 + pt.xn2 + pt.xs3; - } else if (i === 4) { - pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2 + pt.xn2 + pt.xs3 + pt.xn3 + pt.xs4; - } else if (i === 5) { - pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2 + pt.xn2 + pt.xs3 + pt.xn3 + pt.xs4 + pt.xn4 + pt.xs5; - } else { - str = pt.xs0 + val + pt.xs1; - for (i = 1; i < pt.l; i++) { - str += pt["xn"+i] + pt["xs"+(i+1)]; - } - pt.t[pt.p] = str; - } - - } else if (pt.type === -1) { //non-tweening value - pt.t[pt.p] = pt.xs0; - - } else if (pt.setRatio) { //custom setRatio() for things like SpecialProps, external plugins, etc. - pt.setRatio(v); - } - pt = pt._next; - } - - //if the tween is reversed all the way back to the beginning, we need to restore the original values which may have different units (like % instead of px or em or whatever). - } else { - while (pt) { - if (pt.type !== 2) { - pt.t[pt.p] = pt.b; - } else { - pt.setRatio(v); - } - pt = pt._next; - } - } - }; - - /** - * @private - * Forces rendering of the target's transforms (rotation, scale, etc.) whenever the CSSPlugin's setRatio() is called. - * Basically, this tells the CSSPlugin to create a CSSPropTween (type 2) after instantiation that runs last in the linked - * list and calls the appropriate (3D or 2D) rendering function. We separate this into its own method so that we can call - * it from other plugins like BezierPlugin if, for example, it needs to apply an autoRotation and this CSSPlugin - * doesn't have any transform-related properties of its own. You can call this method as many times as you - * want and it won't create duplicate CSSPropTweens. - * - * @param {boolean} threeD if true, it should apply 3D tweens (otherwise, just 2D ones are fine and typically faster) - */ - p._enableTransforms = function(threeD) { - this._transform = this._transform || _getTransform(this._target, _cs, true); //ensures that the element has a _gsTransform property with the appropriate values. - this._transformType = (!(this._transform.svg && _useSVGTransformAttr) && (threeD || this._transformType === 3)) ? 3 : 2; - }; - - var lazySet = function(v) { - this.t[this.p] = this.e; - this.data._linkCSSP(this, this._next, null, true); //we purposefully keep this._next even though it'd make sense to null it, but this is a performance optimization, as this happens during the while (pt) {} loop in setRatio() at the bottom of which it sets pt = pt._next, so if we null it, the linked list will be broken in that loop. - }; - /** @private Gives us a way to set a value on the first render (and only the first render). **/ - p._addLazySet = function(t, p, v) { - var pt = this._firstPT = new CSSPropTween(t, p, 0, 0, this._firstPT, 2); - pt.e = v; - pt.setRatio = lazySet; - pt.data = this; - }; - - /** @private **/ - p._linkCSSP = function(pt, next, prev, remove) { - if (pt) { - if (next) { - next._prev = pt; - } - if (pt._next) { - pt._next._prev = pt._prev; - } - if (pt._prev) { - pt._prev._next = pt._next; - } else if (this._firstPT === pt) { - this._firstPT = pt._next; - remove = true; //just to prevent resetting this._firstPT 5 lines down in case pt._next is null. (optimized for speed) - } - if (prev) { - prev._next = pt; - } else if (!remove && this._firstPT === null) { - this._firstPT = pt; - } - pt._next = next; - pt._prev = prev; - } - return pt; - }; - - p._mod = function(lookup) { - var pt = this._firstPT; - while (pt) { - if (typeof(lookup[pt.p]) === "function") { //only gets called by RoundPropsPlugin (ModifyPlugin manages all the rendering internally for CSSPlugin properties that need modification). Remember, we handle rounding a bit differently in this plugin for performance reasons, leveraging "r" as an indicator that the value should be rounded internally. - pt.r = lookup[pt.p]; - } - pt = pt._next; - } - }; - - //we need to make sure that if alpha or autoAlpha is killed, opacity is too. And autoAlpha affects the "visibility" property. - p._kill = function(lookup) { - var copy = lookup, - pt, p, xfirst; - if (lookup.autoAlpha || lookup.alpha) { - copy = {}; - for (p in lookup) { //copy the lookup so that we're not changing the original which may be passed elsewhere. - copy[p] = lookup[p]; - } - copy.opacity = 1; - if (copy.autoAlpha) { - copy.visibility = 1; - } - } - if (lookup.className && (pt = this._classNamePT)) { //for className tweens, we need to kill any associated CSSPropTweens too; a linked list starts at the className's "xfirst". - xfirst = pt.xfirst; - if (xfirst && xfirst._prev) { - this._linkCSSP(xfirst._prev, pt._next, xfirst._prev._prev); //break off the prev - } else if (xfirst === this._firstPT) { - this._firstPT = pt._next; - } - if (pt._next) { - this._linkCSSP(pt._next, pt._next._next, xfirst._prev); - } - this._classNamePT = null; - } - pt = this._firstPT; - while (pt) { - if (pt.plugin && pt.plugin !== p && pt.plugin._kill) { //for plugins that are registered with CSSPlugin, we should notify them of the kill. - pt.plugin._kill(lookup); - p = pt.plugin; - } - pt = pt._next; - } - return TweenPlugin.prototype._kill.call(this, copy); - }; - - - - //used by cascadeTo() for gathering all the style properties of each child element into an array for comparison. - var _getChildStyles = function(e, props, targets) { - var children, i, child, type; - if (e.slice) { - i = e.length; - while (--i > -1) { - _getChildStyles(e[i], props, targets); - } - return; - } - children = e.childNodes; - i = children.length; - while (--i > -1) { - child = children[i]; - type = child.type; - if (child.style) { - props.push(_getAllStyles(child)); - if (targets) { - targets.push(child); - } - } - if ((type === 1 || type === 9 || type === 11) && child.childNodes.length) { - _getChildStyles(child, props, targets); - } - } - }; - - /** - * Typically only useful for className tweens that may affect child elements, this method creates a TweenLite - * and then compares the style properties of all the target's child elements at the tween's start and end, and - * if any are different, it also creates tweens for those and returns an array containing ALL of the resulting - * tweens (so that you can easily add() them to a TimelineLite, for example). The reason this functionality is - * wrapped into a separate static method of CSSPlugin instead of being integrated into all regular className tweens - * is because it creates entirely new tweens that may have completely different targets than the original tween, - * so if they were all lumped into the original tween instance, it would be inconsistent with the rest of the API - * and it would create other problems. For example: - * - If I create a tween of elementA, that tween instance may suddenly change its target to include 50 other elements (unintuitive if I specifically defined the target I wanted) - * - We can't just create new independent tweens because otherwise, what happens if the original/parent tween is reversed or pause or dropped into a TimelineLite for tight control? You'd expect that tween's behavior to affect all the others. - * - Analyzing every style property of every child before and after the tween is an expensive operation when there are many children, so this behavior shouldn't be imposed on all className tweens by default, especially since it's probably rare that this extra functionality is needed. - * - * @param {Object} target object to be tweened - * @param {number} Duration in seconds (or frames for frames-based tweens) - * @param {Object} Object containing the end values, like {className:"newClass", ease:Linear.easeNone} - * @return {Array} An array of TweenLite instances - */ - CSSPlugin.cascadeTo = function(target, duration, vars) { - var tween = TweenLite.to(target, duration, vars), - results = [tween], - b = [], - e = [], - targets = [], - _reservedProps = TweenLite._internals.reservedProps, - i, difs, p, from; - target = tween._targets || tween.target; - _getChildStyles(target, b, targets); - tween.render(duration, true, true); - _getChildStyles(target, e); - tween.render(0, true, true); - tween._enabled(true); - i = targets.length; - while (--i > -1) { - difs = _cssDif(targets[i], b[i], e[i]); - if (difs.firstMPT) { - difs = difs.difs; - for (p in vars) { - if (_reservedProps[p]) { - difs[p] = vars[p]; - } - } - from = {}; - for (p in difs) { - from[p] = b[i][p]; - } - results.push(TweenLite.fromTo(targets[i], duration, from, difs)); - } - } - return results; - }; - - TweenPlugin.activate([CSSPlugin]); - return CSSPlugin; - - }, true); - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } - -//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function(name) { - "use strict"; - var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope)[name]; - }; - if (typeof(module) !== "undefined" && module.exports) { //node - require("../TweenLite.js"); - module.exports = getGlobal(); - } else if (typeof(define) === "function" && define.amd) { //AMD - define(["TweenLite"], getGlobal); - } -}("CSSPlugin")); - -/*! - * VERSION: 1.3.8 - * DATE: 2018-02-15 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * This work is subject to the terms at http://greensock.com/standard-license or for - * Club GreenSock members, the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - **/ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - var _RAD2DEG = 180 / Math.PI, - _r1 = [], - _r2 = [], - _r3 = [], - _corProps = {}, - _globals = _gsScope._gsDefine.globals, - Segment = function(a, b, c, d) { - if (c === d) { //if c and d match, the final autoRotate value could lock at -90 degrees, so differentiate them slightly. - c = d - (d - b) / 1000000; - } - if (a === b) { //if a and b match, the starting autoRotate value could lock at -90 degrees, so differentiate them slightly. - b = a + (c - a) / 1000000; - } - this.a = a; - this.b = b; - this.c = c; - this.d = d; - this.da = d - a; - this.ca = c - a; - this.ba = b - a; - }, - _correlate = ",x,y,z,left,top,right,bottom,marginTop,marginLeft,marginRight,marginBottom,paddingLeft,paddingTop,paddingRight,paddingBottom,backgroundPosition,backgroundPosition_y,", - cubicToQuadratic = function(a, b, c, d) { - var q1 = {a:a}, - q2 = {}, - q3 = {}, - q4 = {c:d}, - mab = (a + b) / 2, - mbc = (b + c) / 2, - mcd = (c + d) / 2, - mabc = (mab + mbc) / 2, - mbcd = (mbc + mcd) / 2, - m8 = (mbcd - mabc) / 8; - q1.b = mab + (a - mab) / 4; - q2.b = mabc + m8; - q1.c = q2.a = (q1.b + q2.b) / 2; - q2.c = q3.a = (mabc + mbcd) / 2; - q3.b = mbcd - m8; - q4.b = mcd + (d - mcd) / 4; - q3.c = q4.a = (q3.b + q4.b) / 2; - return [q1, q2, q3, q4]; - }, - _calculateControlPoints = function(a, curviness, quad, basic, correlate) { - var l = a.length - 1, - ii = 0, - cp1 = a[0].a, - i, p1, p2, p3, seg, m1, m2, mm, cp2, qb, r1, r2, tl; - for (i = 0; i < l; i++) { - seg = a[ii]; - p1 = seg.a; - p2 = seg.d; - p3 = a[ii+1].d; - - if (correlate) { - r1 = _r1[i]; - r2 = _r2[i]; - tl = ((r2 + r1) * curviness * 0.25) / (basic ? 0.5 : _r3[i] || 0.5); - m1 = p2 - (p2 - p1) * (basic ? curviness * 0.5 : (r1 !== 0 ? tl / r1 : 0)); - m2 = p2 + (p3 - p2) * (basic ? curviness * 0.5 : (r2 !== 0 ? tl / r2 : 0)); - mm = p2 - (m1 + (((m2 - m1) * ((r1 * 3 / (r1 + r2)) + 0.5) / 4) || 0)); - } else { - m1 = p2 - (p2 - p1) * curviness * 0.5; - m2 = p2 + (p3 - p2) * curviness * 0.5; - mm = p2 - (m1 + m2) / 2; - } - m1 += mm; - m2 += mm; - - seg.c = cp2 = m1; - if (i !== 0) { - seg.b = cp1; - } else { - seg.b = cp1 = seg.a + (seg.c - seg.a) * 0.6; //instead of placing b on a exactly, we move it inline with c so that if the user specifies an ease like Back.easeIn or Elastic.easeIn which goes BEYOND the beginning, it will do so smoothly. - } - - seg.da = p2 - p1; - seg.ca = cp2 - p1; - seg.ba = cp1 - p1; - - if (quad) { - qb = cubicToQuadratic(p1, cp1, cp2, p2); - a.splice(ii, 1, qb[0], qb[1], qb[2], qb[3]); - ii += 4; - } else { - ii++; - } - - cp1 = m2; - } - seg = a[ii]; - seg.b = cp1; - seg.c = cp1 + (seg.d - cp1) * 0.4; //instead of placing c on d exactly, we move it inline with b so that if the user specifies an ease like Back.easeOut or Elastic.easeOut which goes BEYOND the end, it will do so smoothly. - seg.da = seg.d - seg.a; - seg.ca = seg.c - seg.a; - seg.ba = cp1 - seg.a; - if (quad) { - qb = cubicToQuadratic(seg.a, cp1, seg.c, seg.d); - a.splice(ii, 1, qb[0], qb[1], qb[2], qb[3]); - } - }, - _parseAnchors = function(values, p, correlate, prepend) { - var a = [], - l, i, p1, p2, p3, tmp; - if (prepend) { - values = [prepend].concat(values); - i = values.length; - while (--i > -1) { - if (typeof( (tmp = values[i][p]) ) === "string") if (tmp.charAt(1) === "=") { - values[i][p] = prepend[p] + Number(tmp.charAt(0) + tmp.substr(2)); //accommodate relative values. Do it inline instead of breaking it out into a function for speed reasons - } - } - } - l = values.length - 2; - if (l < 0) { - a[0] = new Segment(values[0][p], 0, 0, values[0][p]); - return a; - } - for (i = 0; i < l; i++) { - p1 = values[i][p]; - p2 = values[i+1][p]; - a[i] = new Segment(p1, 0, 0, p2); - if (correlate) { - p3 = values[i+2][p]; - _r1[i] = (_r1[i] || 0) + (p2 - p1) * (p2 - p1); - _r2[i] = (_r2[i] || 0) + (p3 - p2) * (p3 - p2); - } - } - a[i] = new Segment(values[i][p], 0, 0, values[i+1][p]); - return a; - }, - bezierThrough = function(values, curviness, quadratic, basic, correlate, prepend) { - var obj = {}, - props = [], - first = prepend || values[0], - i, p, a, j, r, l, seamless, last; - correlate = (typeof(correlate) === "string") ? ","+correlate+"," : _correlate; - if (curviness == null) { - curviness = 1; - } - for (p in values[0]) { - props.push(p); - } - //check to see if the last and first values are identical (well, within 0.05). If so, make seamless by appending the second element to the very end of the values array and the 2nd-to-last element to the very beginning (we'll remove those segments later) - if (values.length > 1) { - last = values[values.length - 1]; - seamless = true; - i = props.length; - while (--i > -1) { - p = props[i]; - if (Math.abs(first[p] - last[p]) > 0.05) { //build in a tolerance of +/-0.05 to accommodate rounding errors. - seamless = false; - break; - } - } - if (seamless) { - values = values.concat(); //duplicate the array to avoid contaminating the original which the user may be reusing for other tweens - if (prepend) { - values.unshift(prepend); - } - values.push(values[1]); - prepend = values[values.length - 3]; - } - } - _r1.length = _r2.length = _r3.length = 0; - i = props.length; - while (--i > -1) { - p = props[i]; - _corProps[p] = (correlate.indexOf(","+p+",") !== -1); - obj[p] = _parseAnchors(values, p, _corProps[p], prepend); - } - i = _r1.length; - while (--i > -1) { - _r1[i] = Math.sqrt(_r1[i]); - _r2[i] = Math.sqrt(_r2[i]); - } - if (!basic) { - i = props.length; - while (--i > -1) { - if (_corProps[p]) { - a = obj[props[i]]; - l = a.length - 1; - for (j = 0; j < l; j++) { - r = (a[j+1].da / _r2[j] + a[j].da / _r1[j]) || 0; - _r3[j] = (_r3[j] || 0) + r * r; - } - } - } - i = _r3.length; - while (--i > -1) { - _r3[i] = Math.sqrt(_r3[i]); - } - } - i = props.length; - j = quadratic ? 4 : 1; - while (--i > -1) { - p = props[i]; - a = obj[p]; - _calculateControlPoints(a, curviness, quadratic, basic, _corProps[p]); //this method requires that _parseAnchors() and _setSegmentRatios() ran first so that _r1, _r2, and _r3 values are populated for all properties - if (seamless) { - a.splice(0, j); - a.splice(a.length - j, j); - } - } - return obj; - }, - _parseBezierData = function(values, type, prepend) { - type = type || "soft"; - var obj = {}, - inc = (type === "cubic") ? 3 : 2, - soft = (type === "soft"), - props = [], - a, b, c, d, cur, i, j, l, p, cnt, tmp; - if (soft && prepend) { - values = [prepend].concat(values); - } - if (values == null || values.length < inc + 1) { throw "invalid Bezier data"; } - for (p in values[0]) { - props.push(p); - } - i = props.length; - while (--i > -1) { - p = props[i]; - obj[p] = cur = []; - cnt = 0; - l = values.length; - for (j = 0; j < l; j++) { - a = (prepend == null) ? values[j][p] : (typeof( (tmp = values[j][p]) ) === "string" && tmp.charAt(1) === "=") ? prepend[p] + Number(tmp.charAt(0) + tmp.substr(2)) : Number(tmp); - if (soft) if (j > 1) if (j < l - 1) { - cur[cnt++] = (a + cur[cnt-2]) / 2; - } - cur[cnt++] = a; - } - l = cnt - inc + 1; - cnt = 0; - for (j = 0; j < l; j += inc) { - a = cur[j]; - b = cur[j+1]; - c = cur[j+2]; - d = (inc === 2) ? 0 : cur[j+3]; - cur[cnt++] = tmp = (inc === 3) ? new Segment(a, b, c, d) : new Segment(a, (2 * b + a) / 3, (2 * b + c) / 3, c); - } - cur.length = cnt; - } - return obj; - }, - _addCubicLengths = function(a, steps, resolution) { - var inc = 1 / resolution, - j = a.length, - d, d1, s, da, ca, ba, p, i, inv, bez, index; - while (--j > -1) { - bez = a[j]; - s = bez.a; - da = bez.d - s; - ca = bez.c - s; - ba = bez.b - s; - d = d1 = 0; - for (i = 1; i <= resolution; i++) { - p = inc * i; - inv = 1 - p; - d = d1 - (d1 = (p * p * da + 3 * inv * (p * ca + inv * ba)) * p); - index = j * resolution + i - 1; - steps[index] = (steps[index] || 0) + d * d; - } - } - }, - _parseLengthData = function(obj, resolution) { - resolution = resolution >> 0 || 6; - var a = [], - lengths = [], - d = 0, - total = 0, - threshold = resolution - 1, - segments = [], - curLS = [], //current length segments array - p, i, l, index; - for (p in obj) { - _addCubicLengths(obj[p], a, resolution); - } - l = a.length; - for (i = 0; i < l; i++) { - d += Math.sqrt(a[i]); - index = i % resolution; - curLS[index] = d; - if (index === threshold) { - total += d; - index = (i / resolution) >> 0; - segments[index] = curLS; - lengths[index] = total; - d = 0; - curLS = []; - } - } - return {length:total, lengths:lengths, segments:segments}; - }, - - - - BezierPlugin = _gsScope._gsDefine.plugin({ - propName: "bezier", - priority: -1, - version: "1.3.8", - API: 2, - global:true, - - //gets called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. - init: function(target, vars, tween) { - this._target = target; - if (vars instanceof Array) { - vars = {values:vars}; - } - this._func = {}; - this._mod = {}; - this._props = []; - this._timeRes = (vars.timeResolution == null) ? 6 : parseInt(vars.timeResolution, 10); - var values = vars.values || [], - first = {}, - second = values[0], - autoRotate = vars.autoRotate || tween.vars.orientToBezier, - p, isFunc, i, j, prepend; - - this._autoRotate = autoRotate ? (autoRotate instanceof Array) ? autoRotate : [["x","y","rotation",((autoRotate === true) ? 0 : Number(autoRotate) || 0)]] : null; - for (p in second) { - this._props.push(p); - } - - i = this._props.length; - while (--i > -1) { - p = this._props[i]; - - this._overwriteProps.push(p); - isFunc = this._func[p] = (typeof(target[p]) === "function"); - first[p] = (!isFunc) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ](); - if (!prepend) if (first[p] !== values[0][p]) { - prepend = first; - } - } - this._beziers = (vars.type !== "cubic" && vars.type !== "quadratic" && vars.type !== "soft") ? bezierThrough(values, isNaN(vars.curviness) ? 1 : vars.curviness, false, (vars.type === "thruBasic"), vars.correlate, prepend) : _parseBezierData(values, vars.type, first); - this._segCount = this._beziers[p].length; - - if (this._timeRes) { - var ld = _parseLengthData(this._beziers, this._timeRes); - this._length = ld.length; - this._lengths = ld.lengths; - this._segments = ld.segments; - this._l1 = this._li = this._s1 = this._si = 0; - this._l2 = this._lengths[0]; - this._curSeg = this._segments[0]; - this._s2 = this._curSeg[0]; - this._prec = 1 / this._curSeg.length; - } - - if ((autoRotate = this._autoRotate)) { - this._initialRotations = []; - if (!(autoRotate[0] instanceof Array)) { - this._autoRotate = autoRotate = [autoRotate]; - } - i = autoRotate.length; - while (--i > -1) { - for (j = 0; j < 3; j++) { - p = autoRotate[i][j]; - this._func[p] = (typeof(target[p]) === "function") ? target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ] : false; - } - p = autoRotate[i][2]; - this._initialRotations[i] = (this._func[p] ? this._func[p].call(this._target) : this._target[p]) || 0; - this._overwriteProps.push(p); - } - } - this._startRatio = tween.vars.runBackwards ? 1 : 0; //we determine the starting ratio when the tween inits which is always 0 unless the tween has runBackwards:true (indicating it's a from() tween) in which case it's 1. - return true; - }, - - //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) - set: function(v) { - var segments = this._segCount, - func = this._func, - target = this._target, - notStart = (v !== this._startRatio), - curIndex, inv, i, p, b, t, val, l, lengths, curSeg; - if (!this._timeRes) { - curIndex = (v < 0) ? 0 : (v >= 1) ? segments - 1 : (segments * v) >> 0; - t = (v - (curIndex * (1 / segments))) * segments; - } else { - lengths = this._lengths; - curSeg = this._curSeg; - v *= this._length; - i = this._li; - //find the appropriate segment (if the currently cached one isn't correct) - if (v > this._l2 && i < segments - 1) { - l = segments - 1; - while (i < l && (this._l2 = lengths[++i]) <= v) { } - this._l1 = lengths[i-1]; - this._li = i; - this._curSeg = curSeg = this._segments[i]; - this._s2 = curSeg[(this._s1 = this._si = 0)]; - } else if (v < this._l1 && i > 0) { - while (i > 0 && (this._l1 = lengths[--i]) >= v) { } - if (i === 0 && v < this._l1) { - this._l1 = 0; - } else { - i++; - } - this._l2 = lengths[i]; - this._li = i; - this._curSeg = curSeg = this._segments[i]; - this._s1 = curSeg[(this._si = curSeg.length - 1) - 1] || 0; - this._s2 = curSeg[this._si]; - } - curIndex = i; - //now find the appropriate sub-segment (we split it into the number of pieces that was defined by "precision" and measured each one) - v -= this._l1; - i = this._si; - if (v > this._s2 && i < curSeg.length - 1) { - l = curSeg.length - 1; - while (i < l && (this._s2 = curSeg[++i]) <= v) { } - this._s1 = curSeg[i-1]; - this._si = i; - } else if (v < this._s1 && i > 0) { - while (i > 0 && (this._s1 = curSeg[--i]) >= v) { } - if (i === 0 && v < this._s1) { - this._s1 = 0; - } else { - i++; - } - this._s2 = curSeg[i]; - this._si = i; - } - t = ((i + (v - this._s1) / (this._s2 - this._s1)) * this._prec) || 0; - } - inv = 1 - t; - - i = this._props.length; - while (--i > -1) { - p = this._props[i]; - b = this._beziers[p][curIndex]; - val = (t * t * b.da + 3 * inv * (t * b.ca + inv * b.ba)) * t + b.a; - if (this._mod[p]) { - val = this._mod[p](val, target); - } - if (func[p]) { - target[p](val); - } else { - target[p] = val; - } - } - - if (this._autoRotate) { - var ar = this._autoRotate, - b2, x1, y1, x2, y2, add, conv; - i = ar.length; - while (--i > -1) { - p = ar[i][2]; - add = ar[i][3] || 0; - conv = (ar[i][4] === true) ? 1 : _RAD2DEG; - b = this._beziers[ar[i][0]]; - b2 = this._beziers[ar[i][1]]; - - if (b && b2) { //in case one of the properties got overwritten. - b = b[curIndex]; - b2 = b2[curIndex]; - - x1 = b.a + (b.b - b.a) * t; - x2 = b.b + (b.c - b.b) * t; - x1 += (x2 - x1) * t; - x2 += ((b.c + (b.d - b.c) * t) - x2) * t; - - y1 = b2.a + (b2.b - b2.a) * t; - y2 = b2.b + (b2.c - b2.b) * t; - y1 += (y2 - y1) * t; - y2 += ((b2.c + (b2.d - b2.c) * t) - y2) * t; - - val = notStart ? Math.atan2(y2 - y1, x2 - x1) * conv + add : this._initialRotations[i]; - - if (this._mod[p]) { - val = this._mod[p](val, target); //for modProps - } - - if (func[p]) { - target[p](val); - } else { - target[p] = val; - } - } - } - } - } - }), - p = BezierPlugin.prototype; - - - BezierPlugin.bezierThrough = bezierThrough; - BezierPlugin.cubicToQuadratic = cubicToQuadratic; - BezierPlugin._autoCSS = true; //indicates that this plugin can be inserted into the "css" object using the autoCSS feature of TweenLite - BezierPlugin.quadraticToCubic = function(a, b, c) { - return new Segment(a, (2 * b + a) / 3, (2 * b + c) / 3, c); - }; - - BezierPlugin._cssRegister = function() { - var CSSPlugin = _globals.CSSPlugin; - if (!CSSPlugin) { - return; - } - var _internals = CSSPlugin._internals, - _parseToProxy = _internals._parseToProxy, - _setPluginRatio = _internals._setPluginRatio, - CSSPropTween = _internals.CSSPropTween; - _internals._registerComplexSpecialProp("bezier", {parser:function(t, e, prop, cssp, pt, plugin) { - if (e instanceof Array) { - e = {values:e}; - } - plugin = new BezierPlugin(); - var values = e.values, - l = values.length - 1, - pluginValues = [], - v = {}, - i, p, data; - if (l < 0) { - return pt; - } - for (i = 0; i <= l; i++) { - data = _parseToProxy(t, values[i], cssp, pt, plugin, (l !== i)); - pluginValues[i] = data.end; - } - for (p in e) { - v[p] = e[p]; //duplicate the vars object because we need to alter some things which would cause problems if the user plans to reuse the same vars object for another tween. - } - v.values = pluginValues; - pt = new CSSPropTween(t, "bezier", 0, 0, data.pt, 2); - pt.data = data; - pt.plugin = plugin; - pt.setRatio = _setPluginRatio; - if (v.autoRotate === 0) { - v.autoRotate = true; - } - if (v.autoRotate && !(v.autoRotate instanceof Array)) { - i = (v.autoRotate === true) ? 0 : Number(v.autoRotate); - v.autoRotate = (data.end.left != null) ? [["left","top","rotation",i,false]] : (data.end.x != null) ? [["x","y","rotation",i,false]] : false; - } - if (v.autoRotate) { - if (!cssp._transform) { - cssp._enableTransforms(false); - } - data.autoRotate = cssp._target._gsTransform; - data.proxy.rotation = data.autoRotate.rotation || 0; - cssp._overwriteProps.push("rotation"); - } - plugin._onInitTween(data.proxy, v, cssp._tween); - return pt; - }}); - }; - - p._mod = function(lookup) { - var op = this._overwriteProps, - i = op.length, - val; - while (--i > -1) { - val = lookup[op[i]]; - if (val && typeof(val) === "function") { - this._mod[op[i]] = val; - } - } - }; - - p._kill = function(lookup) { - var a = this._props, - p, i; - for (p in this._beziers) { - if (p in lookup) { - delete this._beziers[p]; - delete this._func[p]; - i = a.length; - while (--i > -1) { - if (a[i] === p) { - a.splice(i, 1); - } - } - } - } - a = this._autoRotate; - if (a) { - i = a.length; - while (--i > -1) { - if (lookup[a[i][2]]) { - a.splice(i, 1); - } - } - } - return this._super._kill.call(this, lookup); - }; - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } - -//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function(name) { - "use strict"; - var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope)[name]; - }; - if (typeof(module) !== "undefined" && module.exports) { //node - require("../TweenLite.js"); - module.exports = getGlobal(); - } else if (typeof(define) === "function" && define.amd) { //AMD - define(["TweenLite"], getGlobal); - } -}("BezierPlugin")); - -/*! - * VERSION: 0.2.1 - * DATE: 2019-02-07 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * DrawSVGPlugin is a Club GreenSock membership benefit; You must have a valid membership to use - * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. - * This work is subject to the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - */ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - var _doc = _gsScope.document, - _computedStyleScope = (typeof(window) !== "undefined" ? window : _doc.defaultView || {getComputedStyle:function() {}}), - _getComputedStyle = function(e) { - return _computedStyleScope.getComputedStyle(e); //to avoid errors in Microsoft Edge, we need to call getComputedStyle() from a specific scope, typically window. - }, - _numbersExp = /(?:(-|-=|\+=)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig, - _isEdge = (((_gsScope.navigator || {}).userAgent || "").indexOf("Edge") !== -1), //Microsoft Edge has a bug that causes it not to redraw the path correctly if the stroke-linecap is anything other than "butt" (like "round") and it doesn't match the stroke-linejoin. A way to trigger it is to change the stroke-miterlimit, so we'll only do that if/when we have to (to maximize performance) - _types = {rect:["width","height"], circle:["r","r"], ellipse:["rx","ry"], line:["x2","y2"]}, - DrawSVGPlugin; - - function getDistance(x1, y1, x2, y2, scaleX, scaleY) { - x2 = (parseFloat(x2 || 0) - parseFloat(x1 || 0)) * scaleX; - y2 = (parseFloat(y2 || 0) - parseFloat(y1 || 0)) * scaleY; - return Math.sqrt(x2 * x2 + y2 * y2); - } - - function unwrap(element) { - if (typeof(element) === "string" || !element.nodeType) { - element = _gsScope.TweenLite.selector(element); - if (element.length) { - element = element[0]; - } - } - return element; - } - - //accepts values like "100%" or "20% 80%" or "20 50" and parses it into an absolute start and end position on the line/stroke based on its length. Returns an an array with the start and end values, like [0, 243] - function parse(value, length, defaultStart) { - var i = value.indexOf(" "), - s, e; - if (i === -1) { - s = defaultStart !== undefined ? defaultStart + "" : value; - e = value; - } else { - s = value.substr(0, i); - e = value.substr(i+1); - } - s = (s.indexOf("%") !== -1) ? (parseFloat(s) / 100) * length : parseFloat(s); - e = (e.indexOf("%") !== -1) ? (parseFloat(e) / 100) * length : parseFloat(e); - return (s > e) ? [e, s] : [s, e]; - } - - function getLength(element) { - if (!element) { - return 0; - } - element = unwrap(element); - var type = element.tagName.toLowerCase(), - scaleX = 1, - scaleY = 1, - length, bbox, points, prevPoint, i, rx, ry; - if (element.getAttribute("vector-effect") === "non-scaling-stroke") { //non-scaling-stroke basically scales the shape and then strokes it at the screen-level (after transforms), thus we need to adjust the length accordingly. - scaleY = element.getScreenCTM(); - scaleX = Math.sqrt(scaleY.a * scaleY.a + scaleY.b * scaleY.b); - scaleY = Math.sqrt(scaleY.d * scaleY.d + scaleY.c * scaleY.c); - } - try { //IE bug: calling .getTotalLength() locks the repaint area of the stroke to whatever its current dimensions are on that frame/tick. To work around that, we must call getBBox() to force IE to recalculate things. - bbox = element.getBBox(); //solely for fixing bug in IE - we don't actually use the bbox. - } catch (e) { - //firefox has a bug that throws an error if the element isn't visible. - console.log("Error: Some browsers like Firefox won't report measurements of invisible elements (like display:none or masks inside defs)."); - } - if ((!bbox || (!bbox.width && !bbox.height)) && _types[type]) { //if the element isn't visible, try to discern width/height using its attributes. - bbox = { - width: parseFloat( element.getAttribute(_types[type][0]) ), - height: parseFloat( element.getAttribute(_types[type][1]) ) - }; - if (type !== "rect" && type !== "line") { //double the radius for circles and ellipses - bbox.width *= 2; - bbox.height *= 2; - } - if (type === "line") { - bbox.x = parseFloat( element.getAttribute("x1") ); - bbox.y = parseFloat( element.getAttribute("y1") ); - bbox.width = Math.abs(bbox.width - bbox.x); - bbox.height = Math.abs(bbox.height - bbox.y); - } - } - if (type === "path") { - prevPoint = element.style.strokeDasharray; - element.style.strokeDasharray = "none"; - length = element.getTotalLength() || 0; - if (scaleX !== scaleY) { - console.log("Warning: length cannot be measured accurately when vector-effect is non-scaling-stroke and the element isn't proportionally scaled."); - } - length *= (scaleX + scaleY) / 2; - element.style.strokeDasharray = prevPoint; - } else if (type === "rect") { - length = bbox.width * 2 * scaleX + bbox.height * 2 * scaleY; - } else if (type === "line") { - length = getDistance(bbox.x, bbox.y, bbox.x + bbox.width, bbox.y + bbox.height, scaleX, scaleY); - } else if (type === "polyline" || type === "polygon") { - points = element.getAttribute("points").match(_numbersExp) || []; - if (type === "polygon") { - points.push(points[0], points[1]); - } - length = 0; - for (i = 2; i < points.length; i+=2) { - length += getDistance(points[i-2], points[i-1], points[i], points[i+1], scaleX, scaleY) || 0; - } - } else if (type === "circle" || type === "ellipse") { - rx = (bbox.width / 2) * scaleX; - ry = (bbox.height / 2) * scaleY; - length = Math.PI * ( 3 * (rx + ry) - Math.sqrt((3 * rx + ry) * (rx + 3 * ry)) ); - } - return length || 0; - } - - function getPosition(element, length) { - if (!element) { - return [0, 0]; - } - element = unwrap(element); - length = length || (getLength(element) + 1); - var cs = _getComputedStyle(element), - dash = cs.strokeDasharray || "", - offset = parseFloat(cs.strokeDashoffset), - i = dash.indexOf(","); - if (i < 0) { - i = dash.indexOf(" "); - } - dash = (i < 0) ? length : parseFloat(dash.substr(0, i)) || 0.00001; - if (dash > length) { - dash = length; - } - return [Math.max(0, -offset), Math.max(0, dash - offset)]; - } - - DrawSVGPlugin = _gsScope._gsDefine.plugin({ - propName: "drawSVG", - API: 2, - version: "0.2.1", - global: true, - overwriteProps: ["drawSVG"], - - init: function(target, value, tween, index) { - if (!target.getBBox) { - return false; - } - var length = getLength(target) + 1, - start, end, overage, cs; - this._style = target.style; - this._target = target; - if (typeof(value) === "function") { - value = value(index, target); - } - if (value === true || value === "true") { - value = "0 100%"; - } else if (!value) { - value = "0 0"; - } else if ((value + "").indexOf(" ") === -1) { - value = "0 " + value; - } - start = getPosition(target, length); - end = parse(value, length, start[0]); - this._length = length + 10; - if (start[0] === 0 && end[0] === 0) { - overage = Math.max(0.00001, end[1] - length); //allow people to go past the end, like values of 105% because for some paths, Firefox doesn't return an accurate getTotalLength(), so it could end up coming up short. - this._dash = length + overage; - this._offset = length - start[1] + overage; - this._offsetPT = this._addTween(this, "_offset", this._offset, length - end[1] + overage, "drawSVG"); - } else { - this._dash = (start[1] - start[0]) || 0.000001; //some browsers render artifacts if dash is 0, so we use a very small number in that case. - this._offset = -start[0]; - this._dashPT = this._addTween(this, "_dash", this._dash, (end[1] - end[0]) || 0.00001, "drawSVG"); - this._offsetPT = this._addTween(this, "_offset", this._offset, -end[0], "drawSVG"); - } - if (_isEdge) { //to work around a bug in Microsoft Edge, animate the stroke-miterlimit by 0.0001 just to trigger the repaint (unnecessary if it's "round" and stroke-linejoin is also "round"). Imperceptible, relatively high-performance, and effective. Another option was to set the "d" attribute to its current value on every tick, but that seems like it'd be much less performant. - cs = _getComputedStyle(target); - if (cs.strokeLinecap !== cs.strokeLinejoin) { - end = parseFloat(cs.strokeMiterlimit); - this._addTween(target.style, "strokeMiterlimit", end, end + 0.0001, "strokeMiterlimit"); - } - } - this._live = (target.getAttribute("vector-effect") === "non-scaling-stroke" || (value + "").indexOf("live") !== -1); - return true; - }, - - //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) - set: function(ratio) { - if (this._firstPT) { - //when the element has vector-effect="non-scaling-stroke" and the SVG is resized (like on a window resize), it actually changes the length of the stroke! So we must sense that and make the proper adjustments. - if (this._live) { - var length = getLength(this._target) + 11, - lengthRatio; - if (length !== this._length) { - lengthRatio = length / this._length; - this._length = length; - this._offsetPT.s *= lengthRatio; - this._offsetPT.c *= lengthRatio; - if (this._dashPT) { - this._dashPT.s *= lengthRatio; - this._dashPT.c *= lengthRatio; - } else { - this._dash *= lengthRatio; - } - } - } - this._super.setRatio.call(this, ratio); - this._style.strokeDashoffset = this._offset; - if (ratio === 1 || ratio === 0) { - this._style.strokeDasharray = (this._offset < 0.001 && this._length - this._dash <= 10) ? "none" : (this._offset === this._dash) ? "0px, 999999px" : this._dash + "px," + this._length + "px"; - } else { - this._style.strokeDasharray = this._dash + "px," + this._length + "px"; - } - } - } - - }); - - DrawSVGPlugin.getLength = getLength; - DrawSVGPlugin.getPosition = getPosition; - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } -//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function(name) { - "use strict"; - var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope)[name]; - }; - if (typeof(module) !== "undefined" && module.exports) { //node - require("../TweenLite.js"); - module.exports = getGlobal(); - } else if (typeof(define) === "function" && define.amd) { //AMD - define(["TweenLite"], getGlobal); - } -}("DrawSVGPlugin")); -/*! - * VERSION: 1.7.0 - * DATE: 2018-05-21 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * This work is subject to the terms at http://greensock.com/standard-license or for - * Club GreenSock members, the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - **/ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - var RoundPropsPlugin = _gsScope._gsDefine.plugin({ - propName: "roundProps", - version: "1.7.0", - priority: -1, - API: 2, - - //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. - init: function(target, value, tween) { - this._tween = tween; - return true; - } - - }), - _getRoundFunc = function(v) { //pass in 0.1 get a function that'll round to the nearest tenth, or 5 to round to the closest 5, or 0.001 to the closest 1000th, etc. - var p = v < 1 ? Math.pow(10, (v + "").length - 2) : 1; //to avoid floating point math errors (like 24 * 0.1 == 2.4000000000000004), we chop off at a specific number of decimal places (much faster than toFixed() - return function(n) { - return ((Math.round(n / v) * v * p) | 0) / p; + //Back + _createBack = function(n, f) { + var C = _class("easing." + n, function(overshoot) { + this._p1 = (overshoot || overshoot === 0) ? overshoot : 1.70158; + this._p2 = this._p1 * 1.525; + }, true), + p = C.prototype = new Ease(); + p.constructor = C; + p.getRatio = f; + p.config = function(overshoot) { + return new C(overshoot); }; - }, - _roundLinkedList = function(node, mod) { - while (node) { - if (!node.f && !node.blob) { - node.m = mod || Math.round; - } - node = node._next; - } - }, - p = RoundPropsPlugin.prototype; - - p._onInitAllProps = function() { - var tween = this._tween, - rp = tween.vars.roundProps, - lookup = {}, - rpt = tween._propLookup.roundProps, - pt, next, i, p; - if (typeof(rp) === "object" && !rp.push) { - for (p in rp) { - lookup[p] = _getRoundFunc(rp[p]); - } - } else { - if (typeof(rp) === "string") { - rp = rp.split(","); - } - i = rp.length; - while (--i > -1) { - lookup[rp[i]] = Math.round; - } - } - - for (p in lookup) { - pt = tween._firstPT; - while (pt) { - next = pt._next; //record here, because it may get removed - if (pt.pg) { - pt.t._mod(lookup); - } else if (pt.n === p) { - if (pt.f === 2 && pt.t) { //a blob (text containing multiple numeric values) - _roundLinkedList(pt.t._firstPT, lookup[p]); - } else { - this._add(pt.t, p, pt.s, pt.c, lookup[p]); - //remove from linked list - if (next) { - next._prev = pt._prev; - } - if (pt._prev) { - pt._prev._next = next; - } else if (tween._firstPT === pt) { - tween._firstPT = next; - } - pt._next = pt._prev = null; - tween._propLookup[p] = rpt; - } - } - pt = next; - } - } - return false; - }; - - p._add = function(target, p, s, c, mod) { - this._addTween(target, p, s, s + c, p, mod || Math.round); - this._overwriteProps.push(p); - }; - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } -/*! - * VERSION: 0.2.2 - * DATE: 2018-02-15 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * This work is subject to the terms at http://greensock.com/standard-license or for - * Club GreenSock members, the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - */ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - var _NaNExp = /[^\d\-\.]/g, - _DEG2RAD = Math.PI / 180, - _numExp = /(\d|\.)+/g, - _colorLookup = {aqua:[0,255,255], - lime:[0,255,0], - silver:[192,192,192], - black:[0,0,0], - maroon:[128,0,0], - teal:[0,128,128], - blue:[0,0,255], - navy:[0,0,128], - white:[255,255,255], - fuchsia:[255,0,255], - olive:[128,128,0], - yellow:[255,255,0], - orange:[255,165,0], - gray:[128,128,128], - purple:[128,0,128], - green:[0,128,0], - red:[255,0,0], - pink:[255,192,203], - cyan:[0,255,255], - transparent:[255,255,255,0]}, - //parses a color (like #9F0, #FF9900, or rgb(255,51,153)) into an array with 3 elements for red, green, and blue. Also handles rgba() values (splits into array of 4 elements of course) - _parseColor = function(color) { - if (typeof(color) === "number") { - return [color >> 16, (color >> 8) & 255, color & 255]; - } else if (color === "" || color == null || color === "none" || typeof(color) !== "string") { - return _colorLookup.transparent; - } else if (_colorLookup[color]) { - return _colorLookup[color]; - } else if (color.charAt(0) === "#") { - if (color.length === 4) { //for shorthand like #9F0 - color = "#" + color.charAt(1) + color.charAt(1) + color.charAt(2) + color.charAt(2) + color.charAt(3) + color.charAt(3); - } - color = parseInt(color.substr(1), 16); - return [color >> 16, (color >> 8) & 255, color & 255]; - } - return color.match(_numExp) || _colorLookup.transparent; - }, - - _transformMap = {scaleX:1, scaleY:1, tx:1, ty:1, rotation:1, shortRotation:1, skewX:1, skewY:1, scale:1}, - - //parses the transform values for an element, returning an object with x, y, scaleX, scaleY, rotation, skewX, and skewY properties. Note: by default (for performance reasons), all skewing is combined into skewX and rotation but skewY still has a place in the transform object so that we can record how much of the skew is attributed to skewX vs skewY. Remember, a skewY of 10 looks the same as a rotation of 10 and skewX of -10. - _getTransform = function(t, rec) { - var s = t.matrix, - min = 0.000001, - a = s.a, - b = s.b, - c = s.c, - d = s.d, - m = rec ? t._gsTransform || {skewY:0} : {skewY:0}, - invX = (m.scaleX < 0); //in order to interpret things properly, we need to know if the user applied a negative scaleX previously so that we can adjust the rotation and skewX accordingly. Otherwise, if we always interpret a flipped matrix as affecting scaleY and the user only wants to tween the scaleX on multiple sequential tweens, it would keep the negative scaleY without that being the user's intent. - - m.tx = s.e - (m.ox || 0); //ox is the offset x that we record in setRatio() whenever we apply a custom transform that might use a pivot point. Remember, s.e and s.f get affected by things like scale. For example, imagine an object whose top left corner is at 100,100 and then we scale it up to 300% using the center as the pivot point - that corner would now be very different even though to the user, they didn't intend to change/tween the x/y position per se. Therefore, we record whatever offsets we make so that we can compensate when reading the values back. - m.ty = s.f - (m.oy || 0); //oy is the offset y (see note above) - m.scaleX = Math.sqrt(a * a + b * b); - m.scaleY = Math.sqrt(d * d + c * c); - m.rotation = (a || b) ? Math.atan2(b, a) : m.rotation || 0; //note: if scaleX is 0, we cannot accurately measure rotation. Same for skewX with a scaleY of 0. Therefore, we default to the previously recorded value (or zero if that doesn't exist). - m.skewX = (c || d) ? Math.atan2(c, d) + m.rotation : m.skewX || 0; - if (Math.abs(m.skewX) > Math.PI / 2) { - if (invX) { - m.scaleX *= -1; - m.skewX += (m.rotation <= 0) ? Math.PI : -Math.PI; - m.rotation += (m.rotation <= 0) ? Math.PI : -Math.PI; - } else { - m.scaleY *= -1; - m.skewX += (m.skewX <= 0) ? Math.PI : -Math.PI; - } - } - //some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 0 in these cases. The conditional logic here is faster than calling Math.abs(). - if (m.rotation < min) if (m.rotation > -min) if (a || b) { - m.rotation = 0; - } - if (m.skewX < min) if (m.skewX > -min) if (b || c) { - m.skewX = 0; - } - if (rec) { - t._gsTransform = m; //record to the object's _gsTransform which we use so that tweens can control individual properties independently (we need all the properties to accurately recompose the matrix in the setRatio() method) - } - return m; - }, - - //takes a value and a default number, checks if the value is relative, null, or numeric and spits back a normalized number accordingly. Primarily used in the _parseTransform() function. - _parseVal = function(v, d) { - return (v == null) ? d : (typeof(v) === "string" && v.indexOf("=") === 1) ? parseInt(v.charAt(0)+"1", 10) * Number(v.substr(2)) + d : Number(v); - }, - - //translates strings like "40deg" or "40" or 40rad" or "+=40deg" to a numeric radian angle, optionally relative to a default value (if "+=" or "-=" prefix is found) - _parseAngle = function(v, d) { - var m = (v.indexOf("rad") === -1) ? _DEG2RAD : 1, - r = (v.indexOf("=") === 1); - v = Number(v.replace(_NaNExp, "")) * m; - return r ? v + d : v; - }, - - - RaphaelPlugin = _gsScope._gsDefine.plugin({ - propName: "raphael", - version: "0.2.2", - API: 2, - - //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. - init: function(target, value, tween) { - if (!target.attr) { //raphael must have attr() method - return false; - } - this._target = target; - this._tween = tween; - this._props = target._gsProps = target._gsProps || {}; - var p, s, v, pt, clr1, clr2, rel; - - for (p in value) { - - v = value[p]; - - if (p === "transform") { - this._parseTransform(target, v); - continue; - } else if (_transformMap[p] || p === "pivot") { - this._parseTransform(target, value); - continue; - } - - s = target.attr(p); - - //Some of these properties are in place in order to conform with the standard PropTweens in TweenPlugins so that overwriting and roundProps occur properly. For example, f and r may seem unnecessary here, but they enable other functionality. - //_next:* next linked list node [object] - //t: * target [object] - //p: * property (camelCase) [string] - //s: * starting value [number] - //c: * change value [number] - //f: * is function [boolean] - //n: * name (for overwriting) [string] - //b: beginning value [string] - //i: intermediate value [string] - //e: ending value [string] - //r: * round [boolean] - //type: 0=normal, 1=color, 2=rgba, -1=non-tweening prop [number] - this._firstPT = pt = {_next:this._firstPT, - t:this._props, - p:p, - b:s, - f:false, - n:"raphael_" + p, - r:false, - type:0}; - - //color values must be split apart into their R, G, B (and sometimes alpha) values and tweened independently. - if (p === "fill" || p === "stroke") { - clr1 = _parseColor(s); - clr2 = _parseColor(v); - pt.e = v; - pt.s = Number(clr1[0]); //red starting value - pt.c = Number(clr2[0]) - pt.s; //red change - pt.gs = Number(clr1[1]); //green starting value - pt.gc = Number(clr2[1]) - pt.gs; //green change - pt.bs = Number(clr1[2]); //blue starting value - pt.bc = Number(clr2[2]) - pt.bs; //blue change - if (clr1.length > 3 || clr2.length > 3) { //detect an rgba() value - pt.as = (clr1.length < 4) ? 1 : Number(clr1[3]); - pt.ac = ((clr2.length < 4) ? 1 : Number(clr2[3])) - pt.as; - pt.type = 2; //2 = rgba() tween - } else { - pt.type = 1; //1 = color tween, -1 = no tween, just set the value at the end because there's no changes - } - - } else { - - s = (typeof(s) === "string") ? parseFloat(s.replace(_NaNExp, "")) : Number(s); - - if (typeof(v) === "string") { - rel = (v.charAt(1) === "="); - v = parseFloat(v.replace(_NaNExp, "")); - } else { - rel = false; - } - - pt.e = (v || v === 0) ? (rel ? v + s : v) : value[p]; //ensures that any += or -= prefixes are taken care of. - - if ((s || s === 0) && (v || v === 0) && (pt.c = (rel ? v : v - s))) { //faster than isNaN(). Also, we set pt.c (change) here because if it's 0, we'll just treat it like a non-tweening value. can't do (v !== start) because if it's a relative value and the CHANGE is identical to the START, the condition will fail unnecessarily. - pt.s = s; - } else { - pt.type = -1; - pt.i = value[p]; //intermediate value is typically the same as the end value. - pt.s = pt.c = 0; - } - - } - - this._overwriteProps.push("raphael_" + p); - if (pt._next) { - pt._next._prev = pt; - } - } - - return true; + return C; }, - //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) - set: function(v) { - var pt = this._firstPT, val; - - while (pt) { - val = pt.c * v + pt.s; - if (pt.r) { - val = Math.round(val); - } - if (!pt.type) { - pt.t[pt.p] = val; - } else if (pt.type === 1) { //rgb() - pt.t[pt.p] = "rgb(" + (val >> 0) + ", " + ((pt.gs + (v * pt.gc)) >> 0) + ", " + ((pt.bs + (v * pt.bc)) >> 0) + ")"; - } else if (pt.type === 2) { //rgba() - pt.t[pt.p] = "rgba(" + (val >> 0) + ", " + ((pt.gs + (v * pt.gc)) >> 0) + ", " + ((pt.bs + (v * pt.bc)) >> 0) + ", " + (pt.as + (v * pt.ac)) + ")"; - } else if (pt.type === -1) { //non-tweening - pt.t[pt.p] = pt.i; - } - pt = pt._next; - } - - this._target.attr(this._props); - - //apply transform values like x, y, scaleX, scaleY, rotation, skewX, or skewY. We do these after looping through all the PropTweens because those are where the changes are made to scaleX/scaleY/rotation/skewX/skewY/x/y. - if (this._transform) { - pt = this._transform; //to improve speed and reduce size, reuse the pt variable as an alias to the _transform property - var ang = pt.rotation, - skew = ang - pt.skewX, - a = Math.cos(ang) * pt.scaleX, - b = Math.sin(ang) * pt.scaleX, - c = Math.sin(skew) * -pt.scaleY, - d = Math.cos(skew) * pt.scaleY, - min = 0.000001, - pxl = this._pxl, - pyl = this._pyl; - - //some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 0 in these cases for both b and c. The conditional logic here is faster than calling Math.abs(). - if (b < min) if (b > -min) { - b = 0; - } - if (c < min) if (c > -min) { - c = 0; - } - pt.ox = this._pxg - (pxl * a + pyl * c); //we must record the offset x/y that we're making from the regular tx/ty (matrix.e and f) so that we can correctly interpret positional data in _getTransform(). See note there on tx and ox. - pt.oy = this._pyg - (pxl * b + pyl * d); - this._target.transform("m" + a + "," + b + "," + c + "," + d + "," + (pt.tx + pt.ox) + "," + (pt.ty + pt.oy)); - } - - } - - }), - p = RaphaelPlugin.prototype; - - //compares the beginning x, y, scaleX, scaleY, rotation, and skewX properties with the ending ones and adds PropTweens accordingly wherever necessary. We must tween them individually (rather than just tweening the matrix values) so that elgant overwriting can occur, like if one tween is controlling scaleX, scaleY, and rotation and then another one starts mid-tween that is trying to control the scaleX only - this tween should continue tweening scaleY and rotation. - p._parseTransform = function(t, v) { - if (this._transform) { return; } //only need to parse the transform once, and only if the browser supports it. - - var m1 = this._transform = _getTransform(t, true), - min = 0.000001, - m2, skewY, p, pt, copy, dx, dy, mtx, pivot; - - if (typeof(v) === "object") { //for values like scaleX, scaleY, rotation, x, y, skewX, and skewY or transform:{...} (object) - - m2 = {scaleX:_parseVal((v.scaleX != null) ? v.scaleX : v.scale, m1.scaleX), - scaleY:_parseVal((v.scaleY != null) ? v.scaleY : v.scale, m1.scaleY), - tx:_parseVal(v.tx, m1.tx), - ty:_parseVal(v.ty, m1.ty)}; - - if (v.shortRotation != null) { - m2.rotation = (typeof(v.shortRotation) === "number") ? v.shortRotation * _DEG2RAD : _parseAngle(v.shortRotation, m1.rotation); - var dif = (m2.rotation - m1.rotation) % (Math.PI * 2); - if (dif !== dif % Math.PI) { - dif += Math.PI * ((dif < 0) ? 2 : -2); - } - m2.rotation = m1.rotation + dif; - - } else { - m2.rotation = (v.rotation == null) ? m1.rotation : (typeof(v.rotation) === "number") ? v.rotation * _DEG2RAD : _parseAngle(v.rotation, m1.rotation); - } - m2.skewX = (v.skewX == null) ? m1.skewX : (typeof(v.skewX) === "number") ? v.skewX * _DEG2RAD : _parseAngle(v.skewX, m1.skewX); - - //note: for performance reasons, we combine all skewing into the skewX and rotation values, ignoring skewY but we must still record it so that we can discern how much of the overall skew is attributed to skewX vs. skewY. Otherwise, if the skewY would always act relative (tween skewY to 10deg, for example, multiple times and if we always combine things into skewX, we can't remember that skewY was 10 from last time). Remember, a skewY of 10 degrees looks the same as a rotation of 10 degrees plus a skewX of -10 degrees. - m2.skewY = (v.skewY == null) ? m1.skewY : (typeof(v.skewY) === "number") ? v.skewY * _DEG2RAD : _parseAngle(v.skewY, m1.skewY); - if ((skewY = m2.skewY - m1.skewY)) { - m2.skewX += skewY; - m2.rotation += skewY; - } - //don't allow rotation/skew values to be a SUPER small decimal because when they're translated back to strings for setting the css property, the browser reports them in a funky way, like 1-e7. Of course we could use toFixed() to resolve that issue but that hurts performance quite a bit with all those function calls on every frame, plus it is virtually impossible to discern values that small visually (nobody will notice changing a rotation of 0.0000001 to 0, so the performance improvement is well worth it). - if (m2.skewY < min) if (m2.skewY > -min) { - m2.skewY = 0; - } - if (m2.skewX < min) if (m2.skewX > -min) { - m2.skewX = 0; - } - if (m2.rotation < min) if (m2.rotation > -min) { - m2.rotation = 0; - } - - pivot = v.localPivot || v.globalPivot; - - if (typeof(pivot) === "string") { - copy = pivot.split(","); - dx = Number(copy[0]); - dy = Number(copy[1]); - } else if (typeof(pivot) === "object") { - dx = Number(pivot.x); - dy = Number(pivot.y); - } else if (v.localPivot) { - copy = t.getBBox(true); - dx = copy.width / 2; - dy = copy.height / 2; - } else { - copy = t.getBBox(); - dx = copy.x + copy.width / 2; - dy = copy.y + copy.height / 2; - } - - if (v.localPivot) { - mtx = t.matrix; - dx += t.attr("x"); - dy += t.attr("y"); - this._pxl = dx; - this._pyl = dy; - this._pxg = dx * mtx.a + dy * mtx.c + mtx.e - m1.tx; - this._pyg = dx * mtx.b + dy * mtx.d + mtx.f - m1.ty; - } else { - mtx = t.matrix.invert(); - this._pxl = dx * mtx.a + dy * mtx.c + mtx.e; - this._pyl = dx * mtx.b + dy * mtx.d + mtx.f; - this._pxg = dx - m1.tx; - this._pyg = dy - m1.ty; - } - - } else if (typeof(v) === "string") { //for values like transform:"rotate(60deg) scale(0.5, 0.8)" - copy = this._target.transform(); - t.transform(v); - m2 = _getTransform(t, false); - t.transform(copy); - } else { - return; - } - - for (p in _transformMap) { - if (m1[p] !== m2[p]) if (p !== "shortRotation") if (p !== "scale") { - this._firstPT = pt = {_next:this._firstPT, t:m1, p:p, s:m1[p], c:m2[p] - m1[p], n:p, f:false, r:false, b:m1[p], e:m2[p], type:0}; - if (pt._next) { - pt._next._prev = pt; - } - this._overwriteProps.push("raphael_" + p); - } - } - }; - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } -/*! - * VERSION: 0.2.2 - * DATE: 2018-02-15 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * This work is subject to the terms at http://greensock.com/standard-license or for - * Club GreenSock members, the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - **/ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - var _numExp = /(\d|\.)+/g, - _ColorFilter, _ColorMatrixFilter, - _colorProps = ["redMultiplier","greenMultiplier","blueMultiplier","alphaMultiplier","redOffset","greenOffset","blueOffset","alphaOffset"], - _colorLookup = {aqua:[0,255,255], - lime:[0,255,0], - silver:[192,192,192], - black:[0,0,0], - maroon:[128,0,0], - teal:[0,128,128], - blue:[0,0,255], - navy:[0,0,128], - white:[255,255,255], - fuchsia:[255,0,255], - olive:[128,128,0], - yellow:[255,255,0], - orange:[255,165,0], - gray:[128,128,128], - purple:[128,0,128], - green:[0,128,0], - red:[255,0,0], - pink:[255,192,203], - cyan:[0,255,255], - transparent:[255,255,255,0]}, - _parseColor = function(color) { - if (color === "" || color == null || color === "none") { - return _colorLookup.transparent; - } else if (_colorLookup[color]) { - return _colorLookup[color]; - } else if (typeof(color) === "number") { - return [color >> 16, (color >> 8) & 255, color & 255]; - } else if (color.charAt(0) === "#") { - if (color.length === 4) { //for shorthand like #9F0 - color = "#" + color.charAt(1) + color.charAt(1) + color.charAt(2) + color.charAt(2) + color.charAt(3) + color.charAt(3); - } - color = parseInt(color.substr(1), 16); - return [color >> 16, (color >> 8) & 255, color & 255]; - } - return color.match(_numExp) || _colorLookup.transparent; - }, - _parseColorFilter = function(t, v, pg) { - if (!_ColorFilter) { - _ColorFilter = (_gsScope.ColorFilter || _gsScope.createjs.ColorFilter); - if (!_ColorFilter) { - throw("EaselPlugin error: The EaselJS ColorFilter JavaScript file wasn't loaded."); - } - } - var filters = t.filters || [], - i = filters.length, - c, s, e, a, p; - while (--i > -1) { - if (filters[i] instanceof _ColorFilter) { - s = filters[i]; - break; - } - } - if (!s) { - s = new _ColorFilter(); - filters.push(s); - t.filters = filters; - } - e = s.clone(); - if (v.tint != null) { - c = _parseColor(v.tint); - a = (v.tintAmount != null) ? Number(v.tintAmount) : 1; - e.redOffset = Number(c[0]) * a; - e.greenOffset = Number(c[1]) * a; - e.blueOffset = Number(c[2]) * a; - e.redMultiplier = e.greenMultiplier = e.blueMultiplier = 1 - a; - } else { - for (p in v) { - if (p !== "exposure") if (p !== "brightness") { - e[p] = Number(v[p]); - } - } - } - if (v.exposure != null) { - e.redOffset = e.greenOffset = e.blueOffset = 255 * (Number(v.exposure) - 1); - e.redMultiplier = e.greenMultiplier = e.blueMultiplier = 1; - } else if (v.brightness != null) { - a = Number(v.brightness) - 1; - e.redOffset = e.greenOffset = e.blueOffset = (a > 0) ? a * 255 : 0; - e.redMultiplier = e.greenMultiplier = e.blueMultiplier = 1 - Math.abs(a); - } - i = 8; - while (--i > -1) { - p = _colorProps[i]; - if (s[p] !== e[p]) { - pg._addTween(s, p, s[p], e[p], "easel_colorFilter"); - } - } - pg._overwriteProps.push("easel_colorFilter"); - if (!t.cacheID) { - throw("EaselPlugin warning: for filters to display in EaselJS, you must call the object's cache() method first. " + t); - } - }, - - _idMatrix = [1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0], - _lumR = 0.212671, - _lumG = 0.715160, - _lumB = 0.072169, - - _applyMatrix = function(m, m2) { - if (!(m instanceof Array) || !(m2 instanceof Array)) { - return m2; - } - var temp = [], - i = 0, - z = 0, - y, x; - for (y = 0; y < 4; y++) { - for (x = 0; x < 5; x++) { - z = (x === 4) ? m[i + 4] : 0; - temp[i + x] = m[i] * m2[x] + m[i+1] * m2[x + 5] + m[i+2] * m2[x + 10] + m[i+3] * m2[x + 15] + z; - } - i += 5; - } - return temp; - }, - - _setSaturation = function(m, n) { - if (isNaN(n)) { - return m; - } - var inv = 1 - n, - r = inv * _lumR, - g = inv * _lumG, - b = inv * _lumB; - return _applyMatrix([r + n, g, b, 0, 0, r, g + n, b, 0, 0, r, g, b + n, 0, 0, 0, 0, 0, 1, 0], m); - }, - - _colorize = function(m, color, amount) { - if (isNaN(amount)) { - amount = 1; - } - var c = _parseColor(color), - r = c[0] / 255, - g = c[1] / 255, - b = c[2] / 255, - inv = 1 - amount; - return _applyMatrix([inv + amount * r * _lumR, amount * r * _lumG, amount * r * _lumB, 0, 0, amount * g * _lumR, inv + amount * g * _lumG, amount * g * _lumB, 0, 0, amount * b * _lumR, amount * b * _lumG, inv + amount * b * _lumB, 0, 0, 0, 0, 0, 1, 0], m); - }, - - _setHue = function(m, n) { - if (isNaN(n)) { - return m; - } - n *= Math.PI / 180; - var c = Math.cos(n), - s = Math.sin(n); - return _applyMatrix([(_lumR + (c * (1 - _lumR))) + (s * (-_lumR)), (_lumG + (c * (-_lumG))) + (s * (-_lumG)), (_lumB + (c * (-_lumB))) + (s * (1 - _lumB)), 0, 0, (_lumR + (c * (-_lumR))) + (s * 0.143), (_lumG + (c * (1 - _lumG))) + (s * 0.14), (_lumB + (c * (-_lumB))) + (s * -0.283), 0, 0, (_lumR + (c * (-_lumR))) + (s * (-(1 - _lumR))), (_lumG + (c * (-_lumG))) + (s * _lumG), (_lumB + (c * (1 - _lumB))) + (s * _lumB), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], m); - }, - - _setContrast = function(m, n) { - if (isNaN(n)) { - return m; - } - n += 0.01; - return _applyMatrix([n,0,0,0,128 * (1 - n), 0,n,0,0,128 * (1 - n), 0,0,n,0,128 * (1 - n), 0,0,0,1,0], m); - }, - - _parseColorMatrixFilter = function(t, v, pg) { - if (!_ColorMatrixFilter) { - _ColorMatrixFilter = (_gsScope.ColorMatrixFilter || _gsScope.createjs.ColorMatrixFilter); - if (!_ColorMatrixFilter) { - throw("EaselPlugin error: The EaselJS ColorMatrixFilter JavaScript file wasn't loaded."); - } - } - var filters = t.filters || [], - i = filters.length, - matrix, startMatrix, s; - while (--i > -1) { - if (filters[i] instanceof _ColorMatrixFilter) { - s = filters[i]; - break; - } - } - if (!s) { - s = new _ColorMatrixFilter(_idMatrix.slice()); - filters.push(s); - t.filters = filters; - } - startMatrix = s.matrix; - matrix = _idMatrix.slice(); - if (v.colorize != null) { - matrix = _colorize(matrix, v.colorize, Number(v.colorizeAmount)); - } - if (v.contrast != null) { - matrix = _setContrast(matrix, Number(v.contrast)); - } - if (v.hue != null) { - matrix = _setHue(matrix, Number(v.hue)); - } - if (v.saturation != null) { - matrix = _setSaturation(matrix, Number(v.saturation)); - } - - i = matrix.length; - while (--i > -1) { - if (matrix[i] !== startMatrix[i]) { - pg._addTween(startMatrix, i, startMatrix[i], matrix[i], "easel_colorMatrixFilter"); - } - } - - pg._overwriteProps.push("easel_colorMatrixFilter"); - if (!t.cacheID) { - throw("EaselPlugin warning: for filters to display in EaselJS, you must call the object's cache() method first. " + t); - } - - pg._matrix = startMatrix; - }; - - - var EaselPlugin = _gsScope._gsDefine.plugin({ - propName: "easel", - priority: -1, - version: "0.2.2", - API: 2, - - //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. - init: function(target, value, tween, index) { - this._target = target; - var p, pt, tint, colorMatrix, end, labels, i; - for (p in value) { - - end = value[p]; - if (typeof(end) === "function") { - end = end(index, target); - } - if (p === "colorFilter" || p === "tint" || p === "tintAmount" || p === "exposure" || p === "brightness") { - if (!tint) { - _parseColorFilter(target, value.colorFilter || value, this); - tint = true; - } - - } else if (p === "saturation" || p === "contrast" || p === "hue" || p === "colorize" || p === "colorizeAmount") { - if (!colorMatrix) { - _parseColorMatrixFilter(target, value.colorMatrixFilter || value, this); - colorMatrix = true; - } - - } else if (p === "frame") { - this._firstPT = pt = {_next:this._firstPT, t:target, p:"gotoAndStop", s:target.currentFrame, f:true, n:"frame", pr:0, type:0, m:Math.round}; - if (typeof(end) === "string" && end.charAt(1) !== "=" && (labels = target.labels)) { - for (i = 0; i < labels.length; i++) { - if (labels[i].label === end) { - end = labels[i].position; - } - } - } - pt.c = (typeof(end) === "number") ? end - pt.s : parseFloat((end+"").split("=").join("")); - if (pt._next) { - pt._next._prev = pt; - } - - } else if (target[p] != null) { - this._firstPT = pt = {_next:this._firstPT, t:target, p:p, f:(typeof(target[p]) === "function"), n:p, pr:0, type:0}; - pt.s = (!pt.f) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ](); - pt.c = (typeof(end) === "number") ? end - pt.s : (typeof(end) === "string") ? parseFloat(end.split("=").join("")) : 0; - - if (pt._next) { - pt._next._prev = pt; - } - } - - } - return true; - }, - - //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) - set: function(v) { - var pt = this._firstPT, - min = 0.000001, - val; - while (pt) { - val = pt.c * v + pt.s; - if (pt.m) { - val = pt.m(val, pt.t); - } else if (val < min && val > -min) { - val = 0; - } - if (pt.f) { - pt.t[pt.p](val); - } else { - pt.t[pt.p] = val; - } - pt = pt._next; - } - if (this._target.cacheID) { - this._target.updateCache(); - } - } - - }); - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } -//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function(name) { - "use strict"; - var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope)[name]; - }; - if (typeof(module) !== "undefined" && module.exports) { //node - require("../TweenLite.js"); - module.exports = getGlobal(); - } else if (typeof(define) === "function" && define.amd) { //AMD - define(["TweenLite"], getGlobal); - } -}("EaselPlugin")); -/*! - * VERSION: 0.0.4 - * DATE: 2018-05-21 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * This work is subject to the terms at http://greensock.com/standard-license or for - * Club GreenSock members, the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - */ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - var _cssRatioSetter = function(pt, cssp, mod) { //Takes an individual CSSPropTween and converts it into a type:2 that has a setRatio that does everything the regular CSSPlugin.setRatio() method does but applying the mod() too. We do this to keep the main CSSPlugin.setRatio() as fast as possible (the vast majority of times, no mod() will be necessary) - var type = pt.type, - oldSetRatio = pt.setRatio, - tween = cssp._tween, - target = cssp._target; - pt.type = 2; - pt.m = mod; - pt.setRatio = function(v) { - var min = 0.000001, - val, str, i; - if (v === 1 && (tween._time === tween._duration || tween._time === 0)) { - - if (type !== 2) { - if (pt.r && type !== -1) { - val = Math.round(pt.s + pt.c); - if (!type) { - pt.t[pt.p] = mod.call(tween, val + pt.xs0, target, tween); - } else if (type === 1) { - str = pt.xs0 + val + pt.xs1; - for (i = 1; i < pt.l; i++) { - str += pt["xn"+i] + pt["xs"+(i+1)]; - } - pt.t[pt.p] = mod.call(tween, str, target, tween); - } - } else { - pt.t[pt.p] = mod.call(tween, pt.e, target, tween); - } - } else { - oldSetRatio.call(pt, v); - } - - } else if (v || !(tween._time === tween._duration || tween._time === 0) || tween._rawPrevTime === -0.000001) { - val = pt.c * v + pt.s; - if (pt.r) { - val = Math.round(val); - } else if (val < min) if (val > -min) { - val = 0; - } - if (!type) { - pt.t[pt.p] = mod.call(tween, val + pt.xs0, target, tween); - } else if (type === 1) { - str = pt.xs0 + val + pt.xs1; - for (i = 1; i < pt.l; i++) { - str += pt["xn"+i] + pt["xs"+(i+1)]; - } - pt.t[pt.p] = mod.call(tween, str, target, tween); - - } else if (type === -1) { //non-tweening value - pt.t[pt.p] = mod.call(tween, pt.xs0, target, tween); - - } else if (oldSetRatio) { - oldSetRatio.call(pt, v); - } - - } else { - if (type !== 2) { - pt.t[pt.p] = mod.call(tween, pt.b, target, tween); - } else { - oldSetRatio.call(pt, v); - } - } - }; - }, - _modCSS = function(lookup, cssp) { - var pt = cssp._firstPT, - hasBezier = (lookup.rotation && cssp._overwriteProps.join("").indexOf("bezier") !== -1); //when a Bezier tween is applying autoRotation, it's a very special case we need to handle differently. - if (lookup.scale) { - lookup.scaleX = lookup.scaleY = lookup.scale; - } else if (lookup.rotationZ) { - lookup.rotation = lookup.rotationZ; - } - while (pt) { - if (typeof(lookup[pt.p]) === "function") { - _cssRatioSetter(pt, cssp, lookup[pt.p]); - } else if (hasBezier && pt.n === "bezier" && pt.plugin._overwriteProps.join("").indexOf("rotation") !== -1) { - pt.data.mod = lookup.rotation; - } - pt = pt._next; - } - }, - - ModifiersPlugin = _gsScope._gsDefine.plugin({ - propName: "modifiers", - version: "0.0.4", - API: 2, - - //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. - init: function(target, value, tween) { - this._tween = tween; - this._vars = value; - return true; - }, - - initAll: function() { - var tween = this._tween, - lookup = this._vars, - mpt = this, - pt = tween._firstPT, - val, next; - //initAll() gets called for each and every ModifiersPlugin instance in a tween, so if there are multiple targets, there will be multiple instances. Since we're ripping through the whole tween (and all the PropTweens), we only need to run this code ONCE. So we're setting a toggle on the first PropTween that just tells us if we've done it already. We don't set it on the tween instance because if it gets invalidated, we don't want to have to track this property and reset it. PropTweens get blown away when a tween is invalidated. - if (pt._modInitted) { - return false; - } else { - pt._modInitted = 1; - } - while (pt) { - next = pt._next; //record here, because it may get removed - val = lookup[pt.n]; - if (pt.pg) { - if (pt.t._propName === "css") { //handle CSSPlugin uniquely (for performance, due to the fact that the values almost always are a concatenation of numbers and strings, like suffixes, and we don't want to slow down the regular CSSPlugin setRatio() performance with conditional checks for if the value needs to be modded, so we pull any modding prop out and change it to a type:2 one that simply calls a setRatio() method where we encapsulate the modding and update all together. That way, it says in the main CSSProp linked list and just has some custom logic applied to it inside its setRatio()) - _modCSS(lookup, pt.t); - } else if (pt.t !== mpt) { //don't run modProps on modProps :) - val = lookup[pt.t._propName]; - pt.t._tween = tween; - pt.t._mod((typeof(val) === "object") ? val : lookup); - } - } else if (typeof(val) === "function") { - if (pt.f === 2 && pt.t) { //a blob (text containing multiple numeric values) - pt.t._applyPT.m = val; - pt.t._tween = tween; - } else { - this._add(pt.t, pt.p, pt.s, pt.c, val); - //remove from linked list - if (next) { - next._prev = pt._prev; - } - if (pt._prev) { - pt._prev._next = next; - } else if (tween._firstPT === pt) { - tween._firstPT = next; - } - pt._next = pt._prev = null; - tween._propLookup[pt.n] = mpt; - } - } - pt = next; - } - return false; - } - - }), - p = ModifiersPlugin.prototype; - - p._add = function(target, p, s, c, mod) { - this._addTween(target, p, s, s + c, p, mod); - this._overwriteProps.push(p); - }; - - p = _gsScope._gsDefine.globals.TweenLite.version.split("."); - if (Number(p[0]) <= 1 && Number(p[1]) < 19 && _gsScope.console) { - console.log("ModifiersPlugin requires GSAP 1.19.0 or later."); - } - - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } - -//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function(name) { - "use strict"; - var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope)[name]; - }; - if (typeof(module) !== "undefined" && module.exports) { //node - require("../TweenLite.js"); - module.exports = getGlobal(); - } else if (typeof(define) === "function" && define.amd) { //AMD - define(["TweenLite"], getGlobal); - } -}("ModifiersPlugin")); -/*! - * VERSION: 0.9.0 - * DATE: 2019-02-07 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * MorphSVGPlugin is a Club GreenSock membership benefit; You must have a valid membership to use - * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. - * This work is subject to the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - */ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - - var _PI = Math.PI, - _DEG2RAD = _PI / 180, - _svgPathExp = /[achlmqstvz]|(-?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig, - _numbersExp = /(?:(-|-=|\+=)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig, - _selectorExp = /(^[#\.][a-z]|[a-y][a-z])/gi, - _commands = /[achlmqstvz]/ig, - _scientific = /[\+\-]?\d*\.?\d+e[\+\-]?\d+/ig, - _atan2 = Math.atan2, - _cos = Math.cos, - _sin = Math.sin, - _sqrt = Math.sqrt, - _2PI = _PI * 2, - _angleMin = _PI * 0.3, - _angleMax = _PI * 0.7, - _lastLinkedAnchor, - TweenLite = _gsScope._gsDefine.globals.TweenLite, - - _log = function(message) { - if (_gsScope.console) { - console.log(message); - } - }, - - // translates SVG arc data into an array of cubic beziers - _arcToBeziers = function(lastX, lastY, rx, ry, angle, largeArcFlag, sweepFlag, x, y) { - if (lastX === x && lastY === y) { - return; - } - rx = Math.abs(rx); - ry = Math.abs(ry); - var angleRad = (angle % 360) * _DEG2RAD, - cosAngle = _cos(angleRad), - sinAngle = _sin(angleRad), - dx2 = (lastX - x) / 2, - dy2 = (lastY - y) / 2, - x1 = (cosAngle * dx2 + sinAngle * dy2), - y1 = (-sinAngle * dx2 + cosAngle * dy2), - x1_sq = x1 * x1, - y1_sq = y1 * y1, - radiiCheck = x1_sq / (rx * rx) + y1_sq / (ry * ry); - if (radiiCheck > 1) { - rx = _sqrt(radiiCheck) * rx; - ry = _sqrt(radiiCheck) * ry; - } - var rx_sq = rx * rx, - ry_sq = ry * ry, - sq = ((rx_sq * ry_sq) - (rx_sq * y1_sq) - (ry_sq * x1_sq)) / ((rx_sq * y1_sq) + (ry_sq * x1_sq)); - if (sq < 0) { - sq = 0; - } - var coef = ((largeArcFlag === sweepFlag) ? -1 : 1) * _sqrt(sq), - cx1 = coef * ((rx * y1) / ry), - cy1 = coef * -((ry * x1) / rx), - sx2 = (lastX + x) / 2, - sy2 = (lastY + y) / 2, - cx = sx2 + (cosAngle * cx1 - sinAngle * cy1), - cy = sy2 + (sinAngle * cx1 + cosAngle * cy1), - ux = (x1 - cx1) / rx, - uy = (y1 - cy1) / ry, - vx = (-x1 - cx1) / rx, - vy = (-y1 - cy1) / ry, - temp = ux * ux + uy * uy, - angleStart = ((uy < 0) ? -1 : 1) * Math.acos(ux / _sqrt(temp)), - angleExtent = ((ux * vy - uy * vx < 0) ? -1 : 1) * Math.acos((ux * vx + uy * vy) / _sqrt(temp * (vx * vx + vy * vy))); - if (!sweepFlag && angleExtent > 0) { - angleExtent -= _2PI; - } else if (sweepFlag && angleExtent < 0) { - angleExtent += _2PI; - } - angleStart %= _2PI; - angleExtent %= _2PI; - var segments = Math.ceil(Math.abs(angleExtent) / (_2PI / 4)), - rawPath = [], - angleIncrement = angleExtent / segments, - controlLength = 4 / 3 * _sin(angleIncrement / 2) / (1 + _cos(angleIncrement / 2)), - ma = cosAngle * rx, - mb = sinAngle * rx, - mc = sinAngle * -ry, - md = cosAngle * ry, - i; - for (i = 0; i < segments; i++) { - angle = angleStart + i * angleIncrement; - x1 = _cos(angle); - y1 = _sin(angle); - ux = _cos(angle += angleIncrement); - uy = _sin(angle); - rawPath.push(x1 - controlLength * y1, y1 + controlLength * x1, ux + controlLength * uy, uy - controlLength * ux, ux, uy); - } - //now transform according to the actual size of the ellipse/arc (the beziers were noramlized, between 0 and 1 on a circle). - for (i = 0; i < rawPath.length; i+=2) { - x1 = rawPath[i]; - y1 = rawPath[i+1]; - rawPath[i] = x1 * ma + y1 * mc + cx; - rawPath[i+1] = x1 * mb + y1 * md + cy; - } - rawPath[i-2] = x; //always set the end to exactly where it's supposed to be - rawPath[i-1] = y; - return rawPath; - }, - - //Spits back an array of cubic Bezier segments that use absolute coordinates. Each segment starts with a "moveTo" command (x coordinate, then y) and then 2 control points (x, y, x, y), then anchor. The goal is to minimize memory and maximize speed. - _stringToRawPath = function(d) { - var a = (d + "").replace(_scientific, function(m) { var n = +m; return (n < 0.0001 && n > -0.0001) ? 0 : n; }).match(_svgPathExp) || [], //some authoring programs spit out very small numbers in scientific notation like "1e-5", so make sure we round that down to 0 first. - path = [], - relativeX = 0, - relativeY = 0, - twoThirds = 2 / 3, - elements = a.length, - points = 0, - errorMessage = "ERROR: malformed path: " + d, - line = function(sx, sy, ex, ey) { - difX = (ex - sx) / 3; - difY = (ey - sy) / 3; - segment.push(sx + difX, sy + difY, ex - difX, ey - difY, ex, ey); - }, - i, j, x, y, command, isRelative, segment, startX, startY, difX, difY, beziers, prevCommand; - if (!d || !isNaN(a[0]) || isNaN(a[1])) { - _log(errorMessage); - return path; - } - for (i = 0; i < elements; i++) { - prevCommand = command; - if (isNaN(a[i])) { - command = a[i].toUpperCase(); - isRelative = (command !== a[i]); //lower case means relative - } else { //commands like "C" can be strung together without any new command characters between. - i--; - } - x = +a[i + 1]; - y = +a[i + 2]; - if (isRelative) { - x += relativeX; - y += relativeY; - } - if (!i) { - startX = x; - startY = y; - } - - // "M" (move) - if (command === "M") { - if (segment) { - if (segment.length < 8) { //if the path data was funky and just had a M with no actual drawing anywhere, skip it. - path.length -= 1; - } else { - points += segment.length; - } - } - relativeX = startX = x; - relativeY = startY = y; - segment = [x, y]; - path.push(segment); - i += 2; - command = "L"; //an "M" with more than 2 values gets interpreted as "lineTo" commands ("L"). - - // "C" (cubic bezier) - } else if (command === "C") { - if (!segment) { - segment = [0, 0]; - } - if (!isRelative) { - relativeX = relativeY = 0; - } - //note: "*1" is just a fast/short way to cast the value as a Number. WAAAY faster in Chrome, slightly slower in Firefox. - segment.push(x, y, relativeX + a[i + 3] * 1, relativeY + a[i + 4] * 1, (relativeX += a[i + 5] * 1), (relativeY += a[i + 6] * 1)); - i += 6; - - // "S" (continuation of cubic bezier) - } else if (command === "S") { - difX = relativeX; - difY = relativeY; - if (prevCommand === "C" || prevCommand === "S") { - difX += relativeX - segment[segment.length - 4]; - difY += relativeY - segment[segment.length - 3]; - } - if (!isRelative) { - relativeX = relativeY = 0; - } - segment.push(difX, difY, x, y, (relativeX += a[i + 3] * 1), (relativeY += a[i + 4] * 1)); - i += 4; - - // "Q" (quadratic bezier) - } else if (command === "Q") { - difX = relativeX + (x - relativeX) * twoThirds; - difY = relativeY + (y - relativeY) * twoThirds; - if (!isRelative) { - relativeX = relativeY = 0; - } - relativeX += a[i + 3] * 1; - relativeY += a[i + 4] * 1; - segment.push(difX, difY, relativeX + (x - relativeX) * twoThirds, relativeY + (y - relativeY) * twoThirds, relativeX, relativeY); - i += 4; - - // "T" (continuation of quadratic bezier) - } else if (command === "T") { - difX = relativeX - segment[segment.length - 4]; - difY = relativeY - segment[segment.length - 3]; - segment.push(relativeX + difX, relativeY + difY, x + ((relativeX + difX * 1.5) - x) * twoThirds, y + ((relativeY + difY * 1.5) - y) * twoThirds, (relativeX = x), (relativeY = y)); - i += 2; - - // "H" (horizontal line) - } else if (command === "H") { - line(relativeX, relativeY, (relativeX = x), relativeY); - i += 1; - - // "V" (vertical line) - } else if (command === "V") { - //adjust values because the first (and only one) isn't x in this case, it's y. - line(relativeX, relativeY, relativeX, (relativeY = x + (isRelative ? relativeY - relativeX : 0))); - i += 1; - - // "L" (line) or "Z" (close) - } else if (command === "L" || command === "Z") { - if (command === "Z") { - x = startX; - y = startY; - segment.closed = true; - } - if (command === "L" || Math.abs(relativeX - x) > 0.5 || Math.abs(relativeY - y) > 0.5) { - line(relativeX, relativeY, x, y); - if (command === "L") { - i += 2; - } - } - relativeX = x; - relativeY = y; - - // "A" (arc) - } else if (command === "A") { - beziers = _arcToBeziers(relativeX, relativeY, +a[i+1], +a[i+2], +a[i+3], +a[i+4], +a[i+5], (isRelative ? relativeX : 0) + a[i+6]*1, (isRelative ? relativeY : 0) + a[i+7]*1); - if (beziers) { - for (j = 0; j < beziers.length; j++) { - segment.push(beziers[j]); - } - } - relativeX = segment[segment.length-2]; - relativeY = segment[segment.length-1]; - i += 7; - - } else { - _log(errorMessage); - } - } - i = segment.length; - if (segment[0] === segment[i-2] && segment[1] === segment[i-1]) { - segment.closed = true; - } - path.totalPoints = points + i; - return path; - }, - - //adds a certain number of Beziers while maintaining the path shape (so that the start/end values can have a matching quantity of points to animate). Only pass in ONE segment of the Bezier at a time. Format: [xAnchor, yAnchor, xControlPoint1, yControlPoint1, xControlPoint2, yControlPoint2, xAnchor, yAnchor, xControlPoint1, etc...] - _subdivideSegment = function(segment, quantity) { - var tally = 0, - max = 0.999999, - l = segment.length, - newPointsPerSegment = quantity / ((l - 2) / 6), - ax, ay, cp1x, cp1y, cp2x, cp2y, bx, by, - x1, y1, x2, y2, i, t; - for (i = 2; i < l; i += 6) { - tally += newPointsPerSegment; - while (tally > max) { //compare with 0.99999 instead of 1 in order to prevent rounding errors - ax = segment[i-2]; - ay = segment[i-1]; - cp1x = segment[i]; - cp1y = segment[i+1]; - cp2x = segment[i+2]; - cp2y = segment[i+3]; - bx = segment[i+4]; - by = segment[i+5]; - t = 1 / ((Math.floor(tally) || 1) + 1); //progress along the bezier (value between 0 and 1) - x1 = ax + (cp1x - ax) * t; - x2 = cp1x + (cp2x - cp1x) * t; - x1 += (x2 - x1) * t; - x2 += ((cp2x + (bx - cp2x) * t) - x2) * t; - - y1 = ay + (cp1y - ay) * t; - y2 = cp1y + (cp2y - cp1y) * t; - y1 += (y2 - y1) * t; - y2 += ((cp2y + (by - cp2y) * t) - y2) * t; - - segment.splice(i, 4, - ax + (cp1x - ax) * t, //first control point - ay + (cp1y - ay) * t, - x1, //second control point - y1, - x1 + (x2 - x1) * t, //new fabricated anchor on line - y1 + (y2 - y1) * t, - x2, //third control point - y2, - cp2x + (bx - cp2x) * t, //fourth control point - cp2y + (by - cp2y) * t - ); - i += 6; - l += 6; - tally--; - } - } - return segment; - }, - _rawPathToString = function(rawPath, precision) { - var s = "", - space = " ", - l = rawPath.length, - rnd = Math.pow(10, precision || 2), - i, j, segment; - for (j = 0; j < rawPath.length; j++) { - segment = rawPath[j]; - l = segment.length; - s += "M" + (((segment[0] * rnd) | 0) / rnd) + space + (((segment[1] * rnd) | 0) / rnd) + " C"; - for (i = 2; i < l; i++) { //this is actually faster than just doing a join() on the array, possibly because the numbers have so many decimal places - s += (((segment[i] * rnd) | 0) / rnd) + space; - } - if (segment.closed) { - s += "z"; - } - } - return s; - }, - _reverseBezier = function(segment) { - var a = [], - i = segment.length - 1, - l = 0; - while (--i > -1) { - a[l++] = segment[i]; - a[l++] = segment[i+1]; - i--; - } - for (i = 0; i < l; i++) { - segment[i] = a[i]; - } - segment.reversed = !segment.reversed; - }, - _getAverageXY = function(segment) { - var l = segment.length, - x = 0, - y = 0, - i; - for (i = 0; i < l; i++) { - x += segment[i++]; - y += segment[i]; - } - return [x / (l / 2), y / (l / 2)]; - }, - _getSize = function(segment) { //rough estimate of the bounding box (based solely on the anchors) of a single segment. sets "size", "centerX", and "centerY" properties on the bezier array itself, and returns the size (width * height) - var l = segment.length, - xMax = segment[0], - xMin = xMax, - yMax = segment[1], - yMin = yMax, - x, y, i; - for (i = 6; i < l; i+=6) { - x = segment[i]; - y = segment[i+1]; - if (x > xMax) { - xMax = x; - } else if (x < xMin) { - xMin = x; - } - if (y > yMax) { - yMax = y; - } else if (y < yMin) { - yMin = y; - } - } - segment.centerX = (xMax + xMin) / 2; - segment.centerY = (yMax + yMin) / 2; - return (segment.size = (xMax - xMin) * (yMax - yMin)); - }, - _getTotalSize = function(rawPath, samplesPerBezier) { //rough estimate of the bounding box of the entire list of Bezier segments (based solely on the anchors). sets "size", "centerX", and "centerY" properties on the bezier array itself, and returns the size (width * height) - samplesPerBezier = samplesPerBezier || 3; - var j = rawPath.length, - xMax = rawPath[0][0], - xMin = xMax, - yMax = rawPath[0][1], - yMin = yMax, - inc = 1 / samplesPerBezier, - l, x, y, i, segment, k, t, inv, x1, y1, x2, x3, x4, y2, y3, y4; - while (--j > -1) { - segment = rawPath[j]; - l = segment.length; - for (i = 6; i < l; i+=6) { - x1 = segment[i]; - y1 = segment[i+1]; - x2 = segment[i+2] - x1; - y2 = segment[i+3] - y1; - x3 = segment[i+4] - x1; - y3 = segment[i+5] - y1; - x4 = segment[i+6] - x1; - y4 = segment[i+7] - y1; - k = samplesPerBezier; - while (--k > -1) { - t = inc * k; - inv = 1 - t; - x = (t * t * x4 + 3 * inv * (t * x3 + inv * x2)) * t + x1; - y = (t * t * y4 + 3 * inv * (t * y3 + inv * y2)) * t + y1; - if (x > xMax) { - xMax = x; - } else if (x < xMin) { - xMin = x; - } - if (y > yMax) { - yMax = y; - } else if (y < yMin) { - yMin = y; - } - } - } - } - rawPath.centerX = (xMax + xMin) / 2; - rawPath.centerY = (yMax + yMin) / 2; - rawPath.left = xMin; - rawPath.width = (xMax - xMin); - rawPath.top = yMin; - rawPath.height = (yMax - yMin); - return (rawPath.size = (xMax - xMin) * (yMax - yMin)); - }, - _sortByComplexity = function(a, b) { - return b.length - a.length; - }, - _sortBySize = function(a, b) { - var sizeA = a.size || _getSize(a), - sizeB = b.size || _getSize(b); - return (Math.abs(sizeB - sizeA) < (sizeA + sizeB) / 20) ? (b.centerX - a.centerX) || (b.centerY - a.centerY) : sizeB - sizeA; //if the size is within 10% of each other, prioritize position from left to right, then top to bottom. - }, - _offsetSegment = function(segment, shapeIndex) { - var a = segment.slice(0), - l = segment.length, - wrap = l - 2, - i, index; - shapeIndex = shapeIndex | 0; - for (i = 0; i < l; i++) { - index = (i + shapeIndex) % wrap; - segment[i++] = a[index]; - segment[i] = a[index+1]; - } - }, - _getTotalMovement = function(sb, eb, shapeIndex, offsetX, offsetY) { - var l = sb.length, - d = 0, - wrap = l - 2, - index, i, x, y; - shapeIndex *= 6; - for (i = 0; i < l; i += 6) { - index = (i + shapeIndex) % wrap; - y = sb[index] - (eb[i] - offsetX); - x = sb[index+1] - (eb[i+1] - offsetY); - d += _sqrt(x * x + y * y); - } - return d; - }, - _getClosestShapeIndex = function(sb, eb, checkReverse) { //finds the index in a closed cubic bezier array that's closest to the angle provided (angle measured from the center or average x/y). - var l = sb.length, - sCenter = _getAverageXY(sb), //when comparing distances, adjust the coordinates as if the shapes are centered with each other. - eCenter = _getAverageXY(eb), - offsetX = eCenter[0] - sCenter[0], - offsetY = eCenter[1] - sCenter[1], - min = _getTotalMovement(sb, eb, 0, offsetX, offsetY), - minIndex = 0, - copy, d, i; - for (i = 6; i < l; i += 6) { - d = _getTotalMovement(sb, eb, i / 6, offsetX, offsetY); - if (d < min) { - min = d; - minIndex = i; - } - } - if (checkReverse) { - copy = sb.slice(0); - _reverseBezier(copy); - for (i = 6; i < l; i += 6) { - d = _getTotalMovement(copy, eb, i / 6, offsetX, offsetY); - if (d < min) { - min = d; - minIndex = -i; - } - } - } - return minIndex / 6; - }, - _getClosestAnchor = function(bezier, x, y) { //finds the x/y of the anchor that's closest to the provided x/y coordinate (returns an array, like [x, y]). The bezier should be the top-level type that contains an array for each segment. - var j = bezier.length, - closestDistance = 99999999999, - closestX = 0, - closestY = 0, - b, dx, dy, d, i, l; - while (--j > -1) { - b = bezier[j]; - l = b.length; - for (i = 0; i < l; i += 6) { - dx = b[i] - x; - dy = b[i+1] - y; - d = _sqrt(dx * dx + dy * dy); - if (d < closestDistance) { - closestDistance = d; - closestX = b[i]; - closestY = b[i+1]; - } - } - } - return [closestX, closestY]; - }, - _getClosestSegment = function(bezier, pool, startIndex, sortRatio, offsetX, offsetY) { //matches the bezier to the closest one in a pool (array) of beziers, assuming they are in order of size and we shouldn't drop more than 20% of the size, otherwise prioritizing location (total distance to the center). Extracts the segment out of the pool array and returns it. - var l = pool.length, - index = 0, - minSize = Math.min(bezier.size || _getSize(bezier), pool[startIndex].size || _getSize(pool[startIndex])) * sortRatio, //limit things based on a percentage of the size of either the bezier or the next element in the array, whichever is smaller. - min = 999999999999, - cx = bezier.centerX + offsetX, - cy = bezier.centerY + offsetY, - size, i, dx, dy, d; - for (i = startIndex; i < l; i++) { - size = pool[i].size || _getSize(pool[i]); - if (size < minSize) { - break; - } - dx = pool[i].centerX - cx; - dy = pool[i].centerY - cy; - d = _sqrt(dx * dx + dy * dy); - if (d < min) { - index = i; - min = d; - } - } - d = pool[index]; - pool.splice(index, 1); - return d; - }, - _equalizeSegmentQuantity = function(start, end, shapeIndex, map, fillSafe) { //returns an array of shape indexes, 1 for each segment. - var dif = end.length - start.length, - longer = dif > 0 ? end : start, - shorter = dif > 0 ? start : end, - added = 0, - sortMethod = (map === "complexity") ? _sortByComplexity : _sortBySize, - sortRatio = (map === "position") ? 0 : (typeof(map) === "number") ? map : 0.8, - i = shorter.length, - shapeIndices = (typeof(shapeIndex) === "object" && shapeIndex.push) ? shapeIndex.slice(0) : [shapeIndex], - reverse = (shapeIndices[0] === "reverse" || shapeIndices[0] < 0), - log = (shapeIndex === "log"), - eb, sb, b, x, y, offsetX, offsetY; - if (!shorter[0]) { - return; - } - if (longer.length > 1) { - start.sort(sortMethod); - end.sort(sortMethod); - offsetX = longer.size || _getTotalSize(longer); //ensures centerX and centerY are defined (used below). - offsetX = shorter.size || _getTotalSize(shorter); - offsetX = longer.centerX - shorter.centerX; - offsetY = longer.centerY - shorter.centerY; - if (sortMethod === _sortBySize) { - for (i = 0; i < shorter.length; i++) { - longer.splice(i, 0, _getClosestSegment(shorter[i], longer, i, sortRatio, offsetX, offsetY)); - } - } - } - if (dif) { - if (dif < 0) { - dif = -dif; - } - if (longer[0].length > shorter[0].length) { //since we use shorter[0] as the one to map the origination point of any brand new fabricated segments, do any subdividing first so that there are more points to choose from (if necessary) - _subdivideSegment(shorter[0], ((longer[0].length - shorter[0].length)/6) | 0); - } - i = shorter.length; - while (added < dif) { - x = longer[i].size || _getSize(longer[i]); //just to ensure centerX and centerY are calculated which we use on the next line. - b = _getClosestAnchor(shorter, longer[i].centerX, longer[i].centerY); - x = b[0]; - y = b[1]; - shorter[i++] = [x, y, x, y, x, y, x, y]; - shorter.totalPoints += 8; - added++; - } - } - for (i = 0; i < start.length; i++) { - eb = end[i]; - sb = start[i]; - dif = eb.length - sb.length; - if (dif < 0) { - _subdivideSegment(eb, (-dif/6) | 0); - } else if (dif > 0) { - _subdivideSegment(sb, (dif/6) | 0); - } - if (reverse && fillSafe !== false && !sb.reversed) { - _reverseBezier(sb); - } - shapeIndex = (shapeIndices[i] || shapeIndices[i] === 0) ? shapeIndices[i] : "auto"; - if (shapeIndex) { - //if start shape is closed, find the closest point to the start/end, and re-organize the bezier points accordingly so that the shape morphs in a more intuitive way. - if (sb.closed || (Math.abs(sb[0] - sb[sb.length - 2]) < 0.5 && Math.abs(sb[1] - sb[sb.length - 1]) < 0.5)) { - if (shapeIndex === "auto" || shapeIndex === "log") { - shapeIndices[i] = shapeIndex = _getClosestShapeIndex(sb, eb, (!i || fillSafe === false)); - if (shapeIndex < 0) { - reverse = true; - _reverseBezier(sb); - shapeIndex = -shapeIndex; - } - _offsetSegment(sb, shapeIndex * 6); - - } else if (shapeIndex !== "reverse") { - if (i && shapeIndex < 0) { //only happens if an array is passed as shapeIndex and a negative value is defined for an index beyond 0. Very rare, but helpful sometimes. - _reverseBezier(sb); - } - _offsetSegment(sb, (shapeIndex < 0 ? -shapeIndex : shapeIndex) * 6); - } - //otherwise, if it's not a closed shape, consider reversing it if that would make the overall travel less - } else if (!reverse && (shapeIndex === "auto" && (Math.abs(eb[0] - sb[0]) + Math.abs(eb[1] - sb[1]) + Math.abs(eb[eb.length - 2] - sb[sb.length - 2]) + Math.abs(eb[eb.length - 1] - sb[sb.length - 1]) > Math.abs(eb[0] - sb[sb.length - 2]) + Math.abs(eb[1] - sb[sb.length - 1]) + Math.abs(eb[eb.length - 2] - sb[0]) + Math.abs(eb[eb.length - 1] - sb[1])) || (shapeIndex % 2))) { - _reverseBezier(sb); - shapeIndices[i] = -1; - reverse = true; - } else if (shapeIndex === "auto") { - shapeIndices[i] = 0; - } else if (shapeIndex === "reverse") { - shapeIndices[i] = -1; - } - if (sb.closed !== eb.closed) { //if one is closed and one isn't, don't close either one otherwise the tweening will look weird (but remember, the beginning and final states will honor the actual values, so this only affects the inbetween state) - sb.closed = eb.closed = false; - } - } - } - if (log) { - _log("shapeIndex:[" + shapeIndices.join(",") + "]"); - } - start.shapeIndex = shapeIndices; - return shapeIndices; - }, - _pathFilter = function(a, shapeIndex, map, precompile, fillSafe) { - var start = _stringToRawPath(a[0]), - end = _stringToRawPath(a[1]); - if (!_equalizeSegmentQuantity(start, end, (shapeIndex || shapeIndex === 0) ? shapeIndex : "auto", map, fillSafe)) { - return; //malformed path data or null target - } - a[0] = _rawPathToString(start); - a[1] = _rawPathToString(end); - if (precompile === "log" || precompile === true) { - _log('precompile:["' + a[0] + '","' + a[1] + '"]'); - } - }, - /* - _buildPathFilter = function(shapeIndex, map, precompile) { - return (map || precompile || shapeIndex || shapeIndex === 0) ? function(a) { - _pathFilter(a, shapeIndex, map, precompile); - } : _pathFilter; - }, - */ - _offsetPoints = function(text, offset) { - if (!offset) { - return text; - } - var a = text.match(_numbersExp) || [], - l = a.length, - s = "", - inc, i, j; - if (offset === "reverse") { - i = l-1; - inc = -2; - } else { - i = (((parseInt(offset, 10) || 0) * 2 + 1) + l * 100) % l; - inc = 2; - } - for (j = 0; j < l; j += 2) { - s += a[i-1] + "," + a[i] + " "; - i = (i + inc) % l; - } - return s; - }, - //adds a certain number of points while maintaining the polygon/polyline shape (so that the start/end values can have a matching quantity of points to animate). Returns the revised string. - _equalizePointQuantity = function(a, quantity) { - var tally = 0, - x = parseFloat(a[0]), - y = parseFloat(a[1]), - s = x + "," + y + " ", - max = 0.999999, - newPointsPerSegment, i, l, j, factor, nextX, nextY; - l = a.length; - newPointsPerSegment = quantity * 0.5 / (l * 0.5 - 1); - for (i = 0; i < l-2; i += 2) { - tally += newPointsPerSegment; - nextX = parseFloat(a[i+2]); - nextY = parseFloat(a[i+3]); - if (tally > max) { //compare with 0.99999 instead of 1 in order to prevent rounding errors - factor = 1 / (Math.floor(tally) + 1); - j = 1; - while (tally > max) { - s += (x + (nextX - x) * factor * j).toFixed(2) + "," + (y + (nextY - y) * factor * j).toFixed(2) + " "; - tally--; - j++; - } - } - s += nextX + "," + nextY + " "; - x = nextX; - y = nextY; - } - return s; - }, - _pointsFilter = function(a) { - var startNums = a[0].match(_numbersExp) || [], - endNums = a[1].match(_numbersExp) || [], - dif = endNums.length - startNums.length; - if (dif > 0) { - a[0] = _equalizePointQuantity(startNums, dif); - } else { - a[1] = _equalizePointQuantity(endNums, -dif); - } - }, - _buildPointsFilter = function(shapeIndex) { - return !isNaN(shapeIndex) ? function(a) { - _pointsFilter(a); - a[1] = _offsetPoints(a[1], parseInt(shapeIndex, 10)); - } : _pointsFilter; - }, - _createPath = function(e, ignore) { - var path = _gsScope.document.createElementNS("http://www.w3.org/2000/svg", "path"), - attr = Array.prototype.slice.call(e.attributes), - i = attr.length, - name; - ignore = "," + ignore + ","; - while (--i > -1) { - name = attr[i].nodeName.toLowerCase(); //in Microsoft Edge, if you don't set the attribute with a lowercase name, it doesn't render correctly! Super weird. - if (ignore.indexOf("," + name + ",") === -1) { - path.setAttributeNS(null, name, attr[i].nodeValue); - } - } - return path; - }, - _typeAttrs = { - rect:"rx,ry,x,y,width,height", - circle:"r,cx,cy", - ellipse:"rx,ry,cx,cy", - line:"x1,x2,y1,y2" - }, - _attrToObj = function(e, attrs) { - var props = attrs ? attrs.split(",") : [], - obj = {}, - i = props.length; - while (--i > -1) { - obj[props[i]] = +e.getAttribute(props[i]) || 0; - } - return obj; - }, - _convertToPath = function(e, swap) { - var type = e.tagName.toLowerCase(), - circ = 0.552284749831, - data, x, y, r, ry, path, rcirc, rycirc, points, w, h, x2, x3, x4, x5, x6, y2, y3, y4, y5, y6, attr; - if (type === "path" || !e.getBBox) { - return e; - } - path = _createPath(e, "x,y,width,height,cx,cy,rx,ry,r,x1,x2,y1,y2,points"); - attr = _attrToObj(e, _typeAttrs[type]); - if (type === "rect") { - r = attr.rx; - ry = attr.ry; - x = attr.x; - y = attr.y; - w = attr.width - r * 2; - h = attr.height - ry * 2; - if (r || ry) { //if there are rounded corners, render cubic beziers - x2 = x + r * (1 - circ); - x3 = x + r; - x4 = x3 + w; - x5 = x4 + r * circ; - x6 = x4 + r; - y2 = y + ry * (1 - circ); - y3 = y + ry; - y4 = y3 + h; - y5 = y4 + ry * circ; - y6 = y4 + ry; - data = "M" + x6 + "," + y3 + " V" + y4 + " C" + [x6, y5, x5, y6, x4, y6, x4 - (x4 - x3) / 3, y6, x3 + (x4 - x3) / 3, y6, x3, y6, x2, y6, x, y5, x, y4, x, y4 - (y4 - y3) / 3, x, y3 + (y4 - y3) / 3, x, y3, x, y2, x2, y, x3, y, x3 + (x4 - x3) / 3, y, x4 - (x4 - x3) / 3, y, x4, y, x5, y, x6, y2, x6, y3].join(",") + "z"; - } else { - data = "M" + (x + w) + "," + y + " v" + h + " h" + (-w) + " v" + (-h) + " h" + w + "z"; - } - - } else if (type === "circle" || type === "ellipse") { - if (type === "circle") { - r = ry = attr.r; - rycirc = r * circ; - } else { - r = attr.rx; - ry = attr.ry; - rycirc = ry * circ; - } - x = attr.cx; - y = attr.cy; - rcirc = r * circ; - data = "M" + (x+r) + "," + y + " C" + [x+r, y + rycirc, x + rcirc, y + ry, x, y + ry, x - rcirc, y + ry, x - r, y + rycirc, x - r, y, x - r, y - rycirc, x - rcirc, y - ry, x, y - ry, x + rcirc, y - ry, x + r, y - rycirc, x + r, y].join(",") + "z"; - } else if (type === "line") { - data = "M" + attr.x1 + "," + attr.y1 + " L" + attr.x2 + "," + attr.y2; //previously, we just converted to "Mx,y Lx,y" but Safari has bugs that cause that not to render properly when using a stroke-dasharray that's not fully visible! Using a cubic bezier fixes that issue. - } else if (type === "polyline" || type === "polygon") { - points = (e.getAttribute("points") + "").match(_numbersExp) || []; - x = points.shift(); - y = points.shift(); - data = "M" + x + "," + y + " L" + points.join(","); - if (type === "polygon") { - data += "," + x + "," + y + "z"; - } - } - path.setAttribute("d", _rawPathToString(path._gsRawPath = _stringToRawPath(data))); - if (swap && e.parentNode) { - e.parentNode.insertBefore(path, e); - e.parentNode.removeChild(e); - } - - return path; - }, - _parseShape = function(shape, forcePath, target) { - var isString = typeof(shape) === "string", - e, type; - if (!isString || _selectorExp.test(shape) || (shape.match(_numbersExp) || []).length < 3) { - e = isString ? TweenLite.selector(shape) : (shape && shape[0]) ? shape : [shape]; //allow array-like objects like jQuery objects. - if (e && e[0]) { - e = e[0]; - type = (e.nodeName + "").toUpperCase(); - if (forcePath && type !== "PATH") { //if we were passed an element (or selector text for an element) that isn't a path, convert it. - e = _convertToPath(e, false); - type = "PATH"; - } - shape = e.getAttribute(type === "PATH" ? "d" : "points") || ""; - if (e === target) { //if the shape matches the target element, the user wants to revert to the original which should have been stored in the data-original attribute - shape = e.getAttributeNS(null, "data-original") || shape; - } - } else { - _log("WARNING: invalid morph to: " + shape); - shape = false; - } - } - return shape; - }, - //adds an "isSmooth" array to each segment and populates it with a boolean value indicating whether or not it's smooth (the control points have basically the same slope). For any smooth control points, it converts the coordinates into angle (x, in radians) and length (y) and puts them into the same index value in a smoothData array. - _populateSmoothData = function(rawPath, tolerance) { - var j = rawPath.length, - limit = 0.2 * (tolerance || 1), - smooth, segment, x, y, x2, y2, i, l, a, a2, isSmooth, smoothData; - while (--j > -1) { - segment = rawPath[j]; - isSmooth = segment.isSmooth = segment.isSmooth || [0, 0, 0, 0]; - smoothData = segment.smoothData = segment.smoothData || [0, 0, 0, 0]; - isSmooth.length = 4; - l = segment.length - 2; - for (i = 6; i < l; i += 6) { - x = segment[i] - segment[i - 2]; - y = segment[i + 1] - segment[i - 1]; - x2 = segment[i + 2] - segment[i]; - y2 = segment[i + 3] - segment[i + 1]; - a = _atan2(y, x); - a2 = _atan2(y2, x2); - smooth = (Math.abs(a - a2) < limit); - if (smooth) { - smoothData[i - 2] = a; - smoothData[i + 2] = a2; - smoothData[i - 1] = _sqrt(x * x + y * y); - smoothData[i + 3] = _sqrt(x2 * x2 + y2 * y2); - } - isSmooth.push(smooth, smooth, 0, 0, smooth, smooth); - } - //if the first and last points are identical, check to see if there's a smooth transition. We must handle this a bit differently due to their positions in the array. - if (segment[l] === segment[0] && segment[l+1] === segment[1]) { - x = segment[0] - segment[l-2]; - y = segment[1] - segment[l-1]; - x2 = segment[2] - segment[0]; - y2 = segment[3] - segment[1]; - a = _atan2(y, x); - a2 = _atan2(y2, x2); - if (Math.abs(a - a2) < limit) { - smoothData[l-2] = a; - smoothData[2] = a2; - smoothData[l-1] = _sqrt(x * x + y * y); - smoothData[3] = _sqrt(x2 * x2 + y2 * y2); - isSmooth[l-2] = isSmooth[l-1] = true; //don't change indexes 2 and 3 because we'll trigger everything from the END, and this will optimize file size a bit. - } - } - } - return rawPath; - }, - _parseOriginFactors = function(v) { - var a = v.trim().split(" "), - x = (v.indexOf("left") >= 0) ? 0 : (v.indexOf("right") >= 0) ? 100 : isNaN(parseFloat(a[0])) ? 50 : parseFloat(a[0]), - y = (v.indexOf("top") >= 0) ? 0 : (v.indexOf("bottom") >= 0) ? 100 : isNaN(parseFloat(a[1])) ? 50 : parseFloat(a[1]); - return {x:x / 100, y:y / 100}; - }, - _shortAngle = function(dif) { - return (dif !== dif % _PI) ? dif + ((dif < 0) ? _2PI : -_2PI) : dif; - }, - _morphMessage = "Use MorphSVGPlugin.convertToPath(elementOrSelectorText) to convert to a path before morphing.", - - - - MorphSVGPlugin = _gsScope._gsDefine.plugin({ - propName: "morphSVG", - API: 2, - global: true, - version: "0.9.0", - overwriteProps: ["morphSVG"], - - //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. - init: function(target, value, tween, index) { - var cs = window.getComputedStyle(target), - fill = cs.fill + "", - fillSafe = !(fill === "none" || (fill.match(_numbersExp) || [])[3] === "0" || cs.fillRule === "evenodd"), - origins = (value.origin || "50 50").split(","), - type, p, pt, shape, isPoly, shapeIndex, map, startSmooth, endSmooth, start, end, i, j, l, startSeg, endSeg, precompiled, sData, eData, originFactors, useRotation, offset; - if (typeof(value) === "function") { - value = value(index, target); - } - type = (target.nodeName + "").toUpperCase(); - isPoly = (type === "POLYLINE" || type === "POLYGON"); - if (type !== "PATH" && !isPoly && !value.prop) { - _log("WARNING: cannot morph a <" + type + "> element. " + _morphMessage); - return false; - } - p = (type === "PATH") ? "d" : "points"; - if (typeof(value) === "string" || value.getBBox || value[0]) { - value = {shape:value}; - } - if (!value.prop && typeof(target.setAttribute) !== "function") { - return false; - } - shape = _parseShape(value.shape || value.d || value.points || "", (p === "d"), target); - if (isPoly && _commands.test(shape)) { - _log("WARNING: a <" + type + "> cannot accept path data. " + _morphMessage); - return false; - } - shapeIndex = (value.shapeIndex || value.shapeIndex === 0) ? value.shapeIndex : "auto"; - map = value.map || MorphSVGPlugin.defaultMap; - this._prop = value.prop; - this._render = value.render || MorphSVGPlugin.defaultRender; - this._apply = ("updateTarget" in value) ? value.updateTarget : MorphSVGPlugin.defaultUpdateTarget; - this._rnd = Math.pow(10, isNaN(value.precision) ? 2 : +value.precision); - this._tween = tween; - if (shape) { - this._target = target; - precompiled = (typeof(value.precompile) === "object"); - start = this._prop ? target[this._prop] : target.getAttribute(p); - if (!this._prop && !target.getAttributeNS(null, "data-original")) { - target.setAttributeNS(null, "data-original", start); //record the original state in a data-original attribute so that we can revert to it later. - } - if (p === "d" || this._prop) { - start = _stringToRawPath(precompiled ? value.precompile[0] : start); - end = _stringToRawPath(precompiled ? value.precompile[1] : shape); - if (!precompiled && !_equalizeSegmentQuantity(start, end, shapeIndex, map, fillSafe)) { - return false; //malformed path data or null target - } - if (value.precompile === "log" || value.precompile === true) { - _log('precompile:["' + _rawPathToString(start) + '","' + _rawPathToString(end) + '"]'); - } - - useRotation = (value.type || MorphSVGPlugin.defaultType) !== "linear"; - - if (useRotation) { - start = _populateSmoothData(start, value.smoothTolerance); - end = _populateSmoothData(end, value.smoothTolerance ); - if (!start.size) { - _getTotalSize(start); //adds top/left/width/height values - } - if (!end.size) { - _getTotalSize(end); - } - originFactors = _parseOriginFactors(origins[0]); - this._origin = start.origin = {x:start.left + originFactors.x * start.width, y:start.top + originFactors.y * start.height}; - if (origins[1]) { - originFactors = _parseOriginFactors(origins[1]); - } - this._eOrigin = {x:end.left + originFactors.x * end.width, y:end.top + originFactors.y * end.height}; - } - - this._rawPath = target._gsRawPath = start; - - j = start.length; - while (--j > -1) { - startSeg = start[j]; - endSeg = end[j]; - startSmooth = startSeg.isSmooth || []; - endSmooth = endSeg.isSmooth || []; - l = startSeg.length; - _lastLinkedAnchor = 0; //reset; we use _lastLinkedAnchor in the _tweenRotation() method to help make sure that close points don't get ripped apart and rotate opposite directions. Typically we want to go the shortest direction, but if the previous anchor is going a different direction, we override this logic (within certain thresholds) - for (i = 0; i < l; i+=2) { - if (endSeg[i] !== startSeg[i] || endSeg[i+1] !== startSeg[i+1]) { - if (useRotation) { - if (startSmooth[i] && endSmooth[i]) { //if BOTH starting and ending values are smooth (meaning control points have basically the same slope), interpolate the rotation and length instead of the coordinates (this is what makes things smooth). - sData = startSeg.smoothData; - eData = endSeg.smoothData; - offset = i + ((i === l - 4) ? 7 - l : 5); //helps us accommodate wrapping (like if the end and start anchors are identical and the control points are smooth). - this._controlPT = {_next:this._controlPT, i:i, j:j, l1s:sData[i+1], l1c:eData[i+1] - sData[i+1], l2s:sData[offset], l2c:eData[offset] - sData[offset]}; - pt = this._tweenRotation(startSeg, endSeg, i+2); - this._tweenRotation(startSeg, endSeg, i, pt); - this._tweenRotation(startSeg, endSeg, offset-1, pt); - i+=4; - } else { - this._tweenRotation(startSeg, endSeg, i); - } - } else { - this._addTween(startSeg, i, startSeg[i], endSeg[i]); - pt = this._addTween(startSeg, i+1, startSeg[i+1], endSeg[i+1]); - } - } - } - } - } else { - pt = this._addTween(target, "setAttribute", target.getAttribute(p) + "", shape + "", "morphSVG", false, p, _buildPointsFilter(shapeIndex)); - } - - if (useRotation) { - this._addTween(this._origin, "x", this._origin.x, this._eOrigin.x); - pt = this._addTween(this._origin, "y", this._origin.y, this._eOrigin.y); - } - - if (pt) { - this._overwriteProps.push("morphSVG"); - pt.end = shape; - pt.endProp = p; - } - } - return true; - }, - - set: function(ratio) { - var rawPath = this._rawPath, - controlPT = this._controlPT, - anchorPT = this._anchorPT, - rnd = this._rnd, - target = this._target, - s, space, easeInOut, pt, segment, l, angle, i, j, x, y, sin, cos, offset; - this._super.setRatio.call(this, ratio); - if (ratio === 1 && this._apply) { - pt = this._firstPT; - while (pt) { - if (pt.end) { - if (this._prop) { - target[this._prop] = pt.end; - } else { - target.setAttribute(pt.endProp, pt.end); //make sure the end value is exactly as specified (in case we had to add fabricated points during the tween) - } - } - pt = pt._next; - } - } else if (rawPath) { - - //rotationally position the anchors - while (anchorPT) { - angle = anchorPT.sa + ratio * anchorPT.ca; - l = anchorPT.sl + ratio * anchorPT.cl; //length - anchorPT.t[anchorPT.i] = this._origin.x + _cos(angle) * l; - anchorPT.t[anchorPT.i + 1] = this._origin.y + _sin(angle) * l; - anchorPT = anchorPT._next; - } - - //smooth out the control points - easeInOut = ratio < 0.5 ? 2 * ratio * ratio : (4 - 2 * ratio) * ratio - 1; - while (controlPT) { - i = controlPT.i; - segment = rawPath[controlPT.j]; - offset = i + ((i === segment.length - 4) ? 7 - segment.length : 5); //accommodates wrapping around of smooth points, like if the start and end anchors are on top of each other and their handles are smooth. - angle = _atan2(segment[offset] - segment[i+1], segment[offset-1] - segment[i]); //average the angles - sin = _sin(angle); - cos = _cos(angle); - x = segment[i+2]; - y = segment[i+3]; - l = controlPT.l1s + easeInOut * controlPT.l1c; //length - segment[i] = x - cos * l; - segment[i+1] = y - sin * l; - l = controlPT.l2s + easeInOut * controlPT.l2c; - segment[offset-1] = x + cos * l; - segment[offset] = y + sin * l; - controlPT = controlPT._next; - } - - target._gsRawPath = rawPath; - - if (this._apply) { - s = ""; - space = " "; - for (j = 0; j < rawPath.length; j++) { - segment = rawPath[j]; - l = segment.length; - s += "M" + (((segment[0] * rnd) | 0) / rnd) + space + (((segment[1] * rnd) | 0) / rnd) + " C"; - for (i = 2; i < l; i++) { //this is actually faster than just doing a join() on the array, possibly because the numbers have so many decimal places - s += (((segment[i] * rnd) | 0) / rnd) + space; - } - } - if (this._prop) { - target[this._prop] = s; - } else { - target.setAttribute("d", s); - } - } - } - if (this._render && rawPath) { - this._render.call(this._tween, rawPath, target); - } - } - }); - - - MorphSVGPlugin.prototype._tweenRotation = function(start, end, i, linkedPT) { - var so = this._origin, //starting origin - eo = this._eOrigin, //ending origin - dx = start[i] - so.x, - dy = start[i+1] - so.y, - d = _sqrt(dx * dx + dy * dy), //length from starting origin to starting point - sa = _atan2(dy, dx), - angleDif, short; - dx = end[i] - eo.x; - dy = end[i+1] - eo.y; - angleDif = _atan2(dy, dx) - sa; - short = _shortAngle(angleDif); - //in the case of control points, we ALWAYS link them to their anchor so that they don't get torn apart and rotate the opposite direction. If it's not a control point, we look at the most recently linked point as long as they're within a certain rotational range of each other. - if (!linkedPT && _lastLinkedAnchor && Math.abs(short + _lastLinkedAnchor.ca) < _angleMin) { - linkedPT = _lastLinkedAnchor; - } - return (this._anchorPT = _lastLinkedAnchor = { - _next:this._anchorPT, - t:start, - sa:sa, //starting angle - ca:(linkedPT && short * linkedPT.ca < 0 && Math.abs(short) > _angleMax) ? angleDif : short, //change in angle - sl:d, //starting length - cl:_sqrt(dx * dx + dy * dy) - d, //change in length - i:i - }); - }; - - MorphSVGPlugin.pathFilter = _pathFilter; - MorphSVGPlugin.pointsFilter = _pointsFilter; - MorphSVGPlugin.getTotalSize = _getTotalSize; - MorphSVGPlugin.subdivideRawBezier = MorphSVGPlugin.subdivideSegment = _subdivideSegment; - MorphSVGPlugin.rawPathToString = _rawPathToString; - MorphSVGPlugin.defaultType = "linear"; - MorphSVGPlugin.defaultUpdateTarget = true; - MorphSVGPlugin.defaultMap = "size"; - MorphSVGPlugin.stringToRawPath = MorphSVGPlugin.pathDataToRawBezier = function(data) { - return _stringToRawPath(_parseShape(data, true)); - }; - MorphSVGPlugin.equalizeSegmentQuantity = _equalizeSegmentQuantity; - - MorphSVGPlugin.convertToPath = function(targets, swap) { - if (typeof(targets) === "string") { - targets = TweenLite.selector(targets); - } - var a = (!targets || targets.length === 0) ? [] : (targets.length && targets[0] && targets[0].nodeType) ? Array.prototype.slice.call(targets, 0) : [targets], - i = a.length; - while (--i > -1) { - a[i] = _convertToPath(a[i], (swap !== false)); - } - return a; - }; - - MorphSVGPlugin.pathDataToBezier = function(data, vars) { //converts SVG path data into an array of {x, y} objects that can be plugged directly into a bezier tween. You can optionally pass in a 2D matrix like [a, b, c, d, tx, ty] containing numbers that should transform each point. - var bezier = _stringToRawPath(_parseShape(data, true))[0] || [], - prefix = 0, - a, i, l, matrix, offsetX, offsetY, bbox, e; - vars = vars || {}; - e = vars.align || vars.relative; - matrix = vars.matrix || [1,0,0,1,0,0]; - offsetX = vars.offsetX || 0; - offsetY = vars.offsetY || 0; - if (e === "relative" || e === true) { - offsetX -= bezier[0] * matrix[0] + bezier[1] * matrix[2]; - offsetY -= bezier[0] * matrix[1] + bezier[1] * matrix[3]; - prefix = "+="; - } else { - offsetX += matrix[4]; - offsetY += matrix[5]; - if (e) { - e = (typeof(e) === "string") ? TweenLite.selector(e) : (e && e[0]) ? e : [e]; //allow array-like objects like jQuery objects. - if (e && e[0]) { - bbox = e[0].getBBox() || {x:0, y:0}; - offsetX -= bbox.x; - offsetY -= bbox.y; - } - } - } - a = []; - l = bezier.length; - if (matrix && matrix.join(",") !== "1,0,0,1,0,0") { - for (i = 0; i < l; i+=2) { - a.push({x:prefix + (bezier[i] * matrix[0] + bezier[i+1] * matrix[2] + offsetX), y:prefix + (bezier[i] * matrix[1] + bezier[i+1] * matrix[3] + offsetY)}); - } - } else { - for (i = 0; i < l; i+=2) { - a.push({x:prefix + (bezier[i] + offsetX), y:prefix + (bezier[i+1] + offsetY)}); - } - } - return a; - }; - - - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } -//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function(name) { - "use strict"; - var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope)[name]; - }; - if (typeof(module) !== "undefined" && module.exports) { //node - require("../TweenLite.js"); - module.exports = getGlobal(); - } else if (typeof(define) === "function" && define.amd) { //AMD - define(["TweenLite"], getGlobal); - } -}("MorphSVGPlugin")); -/*! - * VERSION: 0.6.6 - * DATE: 2018-02-15 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * This work is subject to the terms at http://greensock.com/standard-license or for - * Club GreenSock members, the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - */ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - _gsScope._gsDefine("plugins.CSSRulePlugin", ["plugins.TweenPlugin","TweenLite","plugins.CSSPlugin"], function(TweenPlugin, TweenLite, CSSPlugin) { - - /** @constructor **/ - var CSSRulePlugin = function() { - TweenPlugin.call(this, "cssRule"); - this._overwriteProps.length = 0; - }, - _doc = _gsScope.document, - _superSetRatio = CSSPlugin.prototype.setRatio, - p = CSSRulePlugin.prototype = new CSSPlugin(); - - p._propName = "cssRule"; - p.constructor = CSSRulePlugin; - CSSRulePlugin.version = "0.6.6"; - CSSRulePlugin.API = 2; - - /** - * Searches the style sheets in the document for a particular selector like ".myClass" or "a" or "a:hover" or ":after" and - * returns a reference to that style sheet (or an array of them in the case of a pseudo selector like ":after"). Then you - * can animate the individual properties of the style sheet. - * - * @param {!string} selector a string describing the selector, like ".myClass" or "a" or "a:hover" or ":after" - * @return a reference to the style sheet (or an array of them in the case of a pseudo selector). If none was found, null is returned (or an empty array for a pseudo selector) - */ - CSSRulePlugin.getRule = function(selector) { - var ruleProp = _doc.all ? "rules" : "cssRules", - ss = _doc.styleSheets, - i = ss.length, - pseudo = (selector.charAt(0) === ":"), - j, curSS, cs, a; - selector = (pseudo ? "" : ",") + selector.split("::").join(":").toLowerCase() + ","; //note: old versions of IE report tag name selectors as upper case, so we just change everything to lowercase. - if (pseudo) { - a = []; - } - while (--i > -1) { - //Firefox may throw insecure operation errors when css is loaded from other domains, so try/catch. - try { - curSS = ss[i][ruleProp]; - if (!curSS) { - continue; - } - j = curSS.length; - } catch (e) { - console.log(e); - continue; - } - while (--j > -1) { - cs = curSS[j]; - if (cs.selectorText && ("," + cs.selectorText.split("::").join(":").toLowerCase() + ",").indexOf(selector) !== -1) { //note: IE adds an extra ":" to pseudo selectors, so .myClass:after becomes .myClass::after, so we need to strip the extra one out. - if (pseudo) { - a.push(cs.style); - } else { - return cs.style; - } - } - } - } - return a; - }; - - - // @private gets called when the tween renders for the first time. This kicks everything off, recording start/end values, etc. - p._onInitTween = function(target, value, tween) { - if (target.cssText === undefined) { - return false; - } - var div = target._gsProxy = target._gsProxy || _doc.createElement("div"); - this._ss = target; - this._proxy = div.style; - div.style.cssText = target.cssText; - CSSPlugin.prototype._onInitTween.call(this, div, value, tween); //we just offload all the work to the regular CSSPlugin and then copy the cssText back over to the rule in the setRatio() method. This allows us to have all of the updates to CSSPlugin automatically flow through to CSSRulePlugin instead of having to maintain both - return true; - }; - - - - // @private gets called every time the tween updates, passing the new ratio (typically a value between 0 and 1, but not always (for example, if an Elastic.easeOut is used, the value can jump above 1 mid-tween). It will always start and 0 and end at 1. - p.setRatio = function(v) { - _superSetRatio.call(this, v); - this._ss.cssText = this._proxy.cssText; - }; - - - TweenPlugin.activate([CSSRulePlugin]); - return CSSRulePlugin; - - }, true); - -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } - -//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function(name) { - "use strict"; - var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope)[name]; - }; - if (typeof(module) !== "undefined" && module.exports) { //node - require("../TweenLite.js"); - module.exports = getGlobal(); - } else if (typeof(define) === "function" && define.amd) { //AMD - define(["TweenLite"], getGlobal); - } -}("CSSRulePlugin")); -/*! - * VERSION: 0.11.2 - * DATE: 2019-02-07 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * ThrowPropsPlugin is a Club GreenSock membership benefit; You must have a valid membership to use - * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. - * This work is subject to the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - */ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - _gsScope._gsDefine("plugins.ThrowPropsPlugin", ["plugins.TweenPlugin", "TweenLite", "easing.Ease", "utils.VelocityTracker"], function(TweenPlugin, TweenLite, Ease, VelocityTracker) { - - var ThrowPropsPlugin = function(props, priority) { - TweenPlugin.call(this, "throwProps"); - this._overwriteProps.length = 0; - }, - _max = 999999999999999, - _min = 0.0000000001, - _globals = _gsScope._gsDefine.globals, - _recordEndMode = false,//in a typical throwProps css tween that has an "end" defined as a function, it grabs that value initially when the tween is rendered, then again when we calculate the necessary duration, and then a 3rd time after we invalidate() the tween, so we toggle _recordEndMode to true when we're about to begin such a tween which tells the engine to grab the end value(s) once and record them as "max" and "min" on the throwProps object, thus we can skip those extra calls. Then we set it back to false when we're done with our fancy initialization routine. - _transforms = {x:1,y:1,z:2,scale:1,scaleX:1,scaleY:1,rotation:1,rotationZ:1,rotationX:2,rotationY:2,skewX:1,skewY:1,xPercent:1,yPercent:1}, - _getClosest = function(n, values, max, min, radius) { - var i = values.length, - closest = 0, - absDif = _max, - val, dif, p, dist; - if (typeof(n) === "object") { - while (--i > -1) { - val = values[i]; - dif = 0; - for (p in n) { - dist = val[p] - n[p]; - dif += dist * dist; - } - if (dif < absDif) { - closest = i; - absDif = dif; - } - } - if ((radius || _max) < _max && radius < Math.sqrt(absDif)) { - return n; - } - } else { - while (--i > -1) { - val = values[i]; - dif = val - n; - if (dif < 0) { - dif = -dif; - } - if (dif < absDif && val >= min && val <= max) { - closest = i; - absDif = dif; - } - } - } - return values[closest]; - }, - _parseEnd = function(curProp, end, max, min, name, radius) { - if (curProp.end === "auto") { - return curProp; - } - var endVar = curProp.end, - adjustedEnd, p; - max = isNaN(max) ? _max : max; - min = isNaN(min) ? -_max : min; - if (typeof(end) === "object") { //for objects, like {x, y} where they're linked and we must pass an object to the function or find the closest value in an array. - adjustedEnd = end.calculated ? end : ((typeof(endVar) === "function") ? endVar(end) : _getClosest(end, endVar, max, min, radius)) || end; - if (!end.calculated) { - for (p in adjustedEnd) { - end[p] = adjustedEnd[p]; - } - end.calculated = true; - } - adjustedEnd = adjustedEnd[name]; - } else { - adjustedEnd = (typeof(endVar) === "function") ? endVar(end) : (endVar instanceof Array) ? _getClosest(end, endVar, max, min, radius) : Number(endVar); - } - if (adjustedEnd > max) { - adjustedEnd = max; - } else if (adjustedEnd < min) { - adjustedEnd = min; - } - return {max:adjustedEnd, min:adjustedEnd, unitFactor:curProp.unitFactor}; - }, - _extend = function(decoratee, extras, exclude) { - for (var p in extras) { - if (decoratee[p] === undefined && p !== exclude) { - decoratee[p] = extras[p]; - } - } - return decoratee; - }, - _calculateChange = ThrowPropsPlugin.calculateChange = function(velocity, ease, duration, checkpoint) { - if (checkpoint == null) { - checkpoint = 0.05; - } - var e = (ease instanceof Ease) ? ease : (!ease) ? TweenLite.defaultEase : new Ease(ease); - return (duration * checkpoint * velocity) / e.getRatio(checkpoint); - }, - _calculateDuration = ThrowPropsPlugin.calculateDuration = function(start, end, velocity, ease, checkpoint) { - checkpoint = checkpoint || 0.05; - var e = (ease instanceof Ease) ? ease : (!ease) ? TweenLite.defaultEase : new Ease(ease); - return Math.abs( (end - start) * e.getRatio(checkpoint) / velocity / checkpoint ); - }, - _calculateTweenDuration = ThrowPropsPlugin.calculateTweenDuration = function(target, vars, maxDuration, minDuration, overshootTolerance, recordEnd) { - if (typeof(target) === "string") { - target = TweenLite.selector(target); - } - if (!target) { - return 0; - } - if (maxDuration == null) { - maxDuration = 10; - } - if (minDuration == null) { - minDuration = 0.2; - } - if (overshootTolerance == null) { - overshootTolerance = 1; - } - if (target.length) { - target = target[0] || target; - } - var duration = 0, - clippedDuration = 9999999999, - throwPropsVars = vars.throwProps || vars, - ease = (vars.ease instanceof Ease) ? vars.ease : (!vars.ease) ? TweenLite.defaultEase : new Ease(vars.ease), - checkpoint = isNaN(throwPropsVars.checkpoint) ? 0.05 : Number(throwPropsVars.checkpoint), - resistance = isNaN(throwPropsVars.resistance) ? ThrowPropsPlugin.defaultResistance : Number(throwPropsVars.resistance), - p, curProp, curDuration, curVelocity, curResistance, curVal, end, curClippedDuration, tracker, unitFactor, - linkedProps, linkedPropNames, i; - - if (throwPropsVars.linkedProps) { //when there are linkedProps (typically "x,y" where snapping has to factor in multiple properties, we must first populate an object with all of those end values, then feed it to the function that make any necessary alterations. So the point of this first loop is to simply build an object (like {x:100, y:204.5}) for feeding into that function which we'll do later in the "real" loop. - linkedPropNames = throwPropsVars.linkedProps.split(","); - linkedProps = {}; - for (i = 0; i < linkedPropNames.length; i++) { - p = linkedPropNames[i]; - curProp = throwPropsVars[p]; - if (curProp) { - if (curProp.velocity !== undefined && typeof(curProp.velocity) === "number") { - curVelocity = Number(curProp.velocity) || 0; - } else { - tracker = tracker || VelocityTracker.getByTarget(target); - curVelocity = (tracker && tracker.isTrackingProp(p)) ? tracker.getVelocity(p) : 0; - } - curResistance = isNaN(curProp.resistance) ? resistance : Number(curProp.resistance); - curDuration = (curVelocity * curResistance > 0) ? curVelocity / curResistance : curVelocity / -curResistance; - curVal = (typeof(target[p]) === "function") ? target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() : target[p] || 0; - linkedProps[p] = curVal + _calculateChange(curVelocity, ease, curDuration, checkpoint); - } - } - } - - for (p in throwPropsVars) { - - if (p !== "resistance" && p !== "checkpoint" && p !== "preventOvershoot" && p !== "linkedProps" && p !== "radius") { - curProp = throwPropsVars[p]; - if (typeof(curProp) !== "object") { - tracker = tracker || VelocityTracker.getByTarget(target); - if (tracker && tracker.isTrackingProp(p)) { - curProp = (typeof(curProp) === "number") ? {velocity:curProp} : {velocity:tracker.getVelocity(p)}; //if we're tracking this property, we should use the tracking velocity and then use the numeric value that was passed in as the min and max so that it tweens exactly there. - } else { - curVelocity = Number(curProp) || 0; - curDuration = (curVelocity * resistance > 0) ? curVelocity / resistance : curVelocity / -resistance; - } - } - if (typeof(curProp) === "object") { - - if (curProp.velocity !== undefined && typeof(curProp.velocity) === "number") { - curVelocity = Number(curProp.velocity) || 0; - } else { - tracker = tracker || VelocityTracker.getByTarget(target); - curVelocity = (tracker && tracker.isTrackingProp(p)) ? tracker.getVelocity(p) : 0; - } - curResistance = isNaN(curProp.resistance) ? resistance : Number(curProp.resistance); - curDuration = (curVelocity * curResistance > 0) ? curVelocity / curResistance : curVelocity / -curResistance; - curVal = (typeof(target[p]) === "function") ? target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() : target[p] || 0; - end = curVal + _calculateChange(curVelocity, ease, curDuration, checkpoint); - if (curProp.end !== undefined) { - curProp = _parseEnd(curProp, (linkedProps && p in linkedProps) ? linkedProps : end, curProp.max, curProp.min, p, throwPropsVars.radius); - if (recordEnd || _recordEndMode) { - throwPropsVars[p] = _extend(curProp, throwPropsVars[p], "end"); - } - } - if (curProp.max !== undefined && end > Number(curProp.max) + _min) { - unitFactor = curProp.unitFactor || ThrowPropsPlugin.defaultUnitFactors[p] || 1; //some values are measured in special units like radians in which case our thresholds need to be adjusted accordingly. - //if the value is already exceeding the max or the velocity is too low, the duration can end up being uncomfortably long but in most situations, users want the snapping to occur relatively quickly (0.75 seconds), so we implement a cap here to make things more intuitive. If the max and min match, it means we're animating to a particular value and we don't want to shorten the time unless the velocity is really slow. Example: a rotation where the start and natural end value are less than the snapping spot, but the natural end is pretty close to the snap. - curClippedDuration = ((curVal > curProp.max && curProp.min !== curProp.max) || (curVelocity * unitFactor > -15 && curVelocity * unitFactor < 45)) ? (minDuration + (maxDuration - minDuration) * 0.1) : _calculateDuration(curVal, curProp.max, curVelocity, ease, checkpoint); - if (curClippedDuration + overshootTolerance < clippedDuration) { - clippedDuration = curClippedDuration + overshootTolerance; - } - - } else if (curProp.min !== undefined && end < Number(curProp.min) - _min) { - unitFactor = curProp.unitFactor || ThrowPropsPlugin.defaultUnitFactors[p] || 1; //some values are measured in special units like radians in which case our thresholds need to be adjusted accordingly. - //if the value is already exceeding the min or if the velocity is too low, the duration can end up being uncomfortably long but in most situations, users want the snapping to occur relatively quickly (0.75 seconds), so we implement a cap here to make things more intuitive. - curClippedDuration = ((curVal < curProp.min && curProp.min !== curProp.max) || (curVelocity * unitFactor > -45 && curVelocity * unitFactor < 15)) ? (minDuration + (maxDuration - minDuration) * 0.1) : _calculateDuration(curVal, curProp.min, curVelocity, ease, checkpoint); - if (curClippedDuration + overshootTolerance < clippedDuration) { - clippedDuration = curClippedDuration + overshootTolerance; - } - } - - if (curClippedDuration > duration) { - duration = curClippedDuration; - } - } - - if (curDuration > duration) { - duration = curDuration; - } - - } - } - if (duration > clippedDuration) { - duration = clippedDuration; - } - if (duration > maxDuration) { - return maxDuration; - } else if (duration < minDuration) { - return minDuration; - } - return duration; - }, - p = ThrowPropsPlugin.prototype = new TweenPlugin("throwProps"), - _cssProxy, _cssVars, _last, _lastValue; //these serve as a cache of sorts, recording the last css-related proxy and the throwProps vars that get calculated in the _cssRegister() method. This allows us to grab them in the ThrowPropsPlugin.to() function and calculate the duration. Of course we could have structured things in a more "clean" fashion, but performance is of paramount importance. + Back = _wrap("Back", + _createBack("BackOut", function(p) { + return ((p = p - 1) * p * ((this._p1 + 1) * p + this._p1) + 1); + }), + _createBack("BackIn", function(p) { + return p * p * ((this._p1 + 1) * p - this._p1); + }), + _createBack("BackInOut", function(p) { + return ((p *= 2) < 1) ? 0.5 * p * p * ((this._p2 + 1) * p - this._p2) : 0.5 * ((p -= 2) * p * ((this._p2 + 1) * p + this._p2) + 2); + }) + ), + + + //SlowMo + SlowMo = _class("easing.SlowMo", function(linearRatio, power, yoyoMode) { + power = (power || power === 0) ? power : 0.7; + if (linearRatio == null) { + linearRatio = 0.7; + } else if (linearRatio > 1) { + linearRatio = 1; + } + this._p = (linearRatio !== 1) ? power : 0; + this._p1 = (1 - linearRatio) / 2; + this._p2 = linearRatio; + this._p3 = this._p1 + this._p2; + this._calcEnd = (yoyoMode === true); + }, true), + p = SlowMo.prototype = new Ease(), + SteppedEase, ExpoScaleEase, RoughEase, _createElastic; - - - p.constructor = ThrowPropsPlugin; - ThrowPropsPlugin.version = "0.11.2"; - ThrowPropsPlugin.API = 2; - ThrowPropsPlugin._autoCSS = true; //indicates that this plugin can be inserted into the "css" object using the autoCSS feature of TweenLite - ThrowPropsPlugin.defaultResistance = 100; - ThrowPropsPlugin.defaultUnitFactors = {time:1000, totalTime:1000}; //setting the unitFactor to a higher value (default is 1) reduces the chance of the auto-accelerating behavior kicking in when determining durations when the initial velocity is adequately low - imagine dragging something past a boundary and then letting go - snapping back relatively quickly should be prioritized over matching the initial velocity (at least that's the behavior most people consider intuitive). But in some situations when the units are very low (like "time" of a timeline or rotation when using radians), it can kick in too frequently so this allows tweaking. - - ThrowPropsPlugin.track = function(target, props, types) { - return VelocityTracker.track(target, props, types); - }; - - ThrowPropsPlugin.untrack = function(target, props) { - VelocityTracker.untrack(target, props); - }; - - ThrowPropsPlugin.isTracking = function(target, prop) { - return VelocityTracker.isTracking(target, prop); - }; - - ThrowPropsPlugin.getVelocity = function(target, prop) { - var vt = VelocityTracker.getByTarget(target); - return vt ? vt.getVelocity(prop) : NaN; - }; - - ThrowPropsPlugin._cssRegister = function() { - var CSSPlugin = _globals.com.greensock.plugins.CSSPlugin; - if (!CSSPlugin) { - return; + p.constructor = SlowMo; + p.getRatio = function(p) { + var r = p + (0.5 - p) * this._p; + if (p < this._p1) { + return this._calcEnd ? 1 - ((p = 1 - (p / this._p1)) * p) : r - ((p = 1 - (p / this._p1)) * p * p * p * r); + } else if (p > this._p3) { + return this._calcEnd ? (p === 1 ? 0 : 1 - (p = (p - this._p3) / this._p1) * p) : r + ((p - r) * (p = (p - this._p3) / this._p1) * p * p * p); //added p === 1 ? 0 to avoid floating point rounding errors from affecting the final value, like 1 - 0.7 = 0.30000000000000004 instead of 0.3 } - var _internals = CSSPlugin._internals, - _parseToProxy = _internals._parseToProxy, - _setPluginRatio = _internals._setPluginRatio, - CSSPropTween = _internals.CSSPropTween; - _internals._registerComplexSpecialProp("throwProps", {parser:function(t, e, prop, cssp, pt, plugin) { - plugin = new ThrowPropsPlugin(); - var velocities = {}, - min = {}, - max = {}, - end = {}, - res = {}, - preventOvershoot = {}, - hasResistance, val, p, data, tracker; - _cssVars = {}; - for (p in e) { - if (p !== "resistance" && p !== "preventOvershoot" && p !== "linkedProps" && p !== "radius") { - val = e[p]; - if (typeof(val) === "object") { - if (val.velocity !== undefined && typeof(val.velocity) === "number") { - velocities[p] = Number(val.velocity) || 0; - } else { - tracker = tracker || VelocityTracker.getByTarget(t); - velocities[p] = (tracker && tracker.isTrackingProp(p)) ? tracker.getVelocity(p) : 0; //rotational values are actually converted to radians in CSSPlugin, but our tracking velocity is in radians already, so make it into degrees to avoid a funky conversion - } - if (val.end !== undefined) { - end[p] = val.end; - } - if (val.min !== undefined) { - min[p] = val.min; - } - if (val.max !== undefined) { - max[p] = val.max; - } - if (val.preventOvershoot) { - preventOvershoot[p] = true; - } - if (val.resistance !== undefined) { - hasResistance = true; - res[p] = val.resistance; - } - } else if (typeof(val) === "number") { - velocities[p] = val; - } else { - tracker = tracker || VelocityTracker.getByTarget(t); - if (tracker && tracker.isTrackingProp(p)) { - velocities[p] = tracker.getVelocity(p); - } else { - velocities[p] = val || 0; - } - } - if (_transforms[p]) { - cssp._enableTransforms((_transforms[p] === 2)); - } - } - } - data = _parseToProxy(t, velocities, cssp, pt, plugin); - _cssProxy = data.proxy; - velocities = data.end; - for (p in _cssProxy) { - _cssVars[p] = {velocity:velocities[p], min:min[p], max:max[p], end:end[p], resistance:res[p], preventOvershoot:preventOvershoot[p]}; - } - if (e.resistance != null) { - _cssVars.resistance = e.resistance; - } - if (e.linkedProps != null) { - _cssVars.linkedProps = e.linkedProps; - } - if (e.radius != null) { - _cssVars.radius = e.radius; - } - if (e.preventOvershoot) { - _cssVars.preventOvershoot = true; - } - pt = new CSSPropTween(t, "throwProps", 0, 0, data.pt, 2); - cssp._overwriteProps.pop(); //don't overwrite all other throwProps tweens. In the CSSPropTween constructor, we add the property to the _overwriteProps, so remove it here. - pt.plugin = plugin; - pt.setRatio = _setPluginRatio; - pt.data = data; - plugin._onInitTween(_cssProxy, _cssVars, cssp._tween); - return pt; - }}); + return this._calcEnd ? 1 : r; }; - + SlowMo.ease = new SlowMo(0.7, 0.7); - ThrowPropsPlugin.to = function(target, vars, maxDuration, minDuration, overshootTolerance) { - if (!vars.throwProps) { - vars = {throwProps:vars}; - } - if (overshootTolerance === 0) { - vars.throwProps.preventOvershoot = true; - } - _recordEndMode = true; //if we encounter a function-based "end" value, ThrowPropsPlugin will record it as "max" and "min" properties, replacing "end" (this is an optimization so that the function only gets called once) - var tween = new TweenLite(target, minDuration || 1, vars); - tween.render(0, true, true); //we force a render so that the CSSPlugin instantiates and populates the _cssProxy and _cssVars which we need in order to calculate the tween duration. Remember, we can't use the regular target for calculating the duration because the current values wouldn't be able to be grabbed like target["propertyName"], as css properties can be complex like boxShadow:"10px 10px 20px 30px red" or backgroundPosition:"25px 50px". The proxy is the result of breaking all that complex data down and finding just the numeric values and assigning them to a generic proxy object with unique names. THAT is what the _calculateTweenDuration() can look at. We also needed to do the same break down of any min or max or velocity data - if (tween.vars.css) { - tween.duration(_calculateTweenDuration(_cssProxy, {throwProps:_cssVars, ease:vars.ease}, maxDuration, minDuration, overshootTolerance)); - if (tween._delay && !tween.vars.immediateRender) { - tween.invalidate(); //if there's a delay, the starting values could be off, so invalidate() to force reinstantiation when the tween actually starts. - } else { - _last._onInitTween(_cssProxy, _lastValue, tween); - } - _recordEndMode = false; - return tween; - } else { - tween.kill(); - tween = new TweenLite(target, _calculateTweenDuration(target, vars, maxDuration, minDuration, overshootTolerance), vars); - _recordEndMode = false; - return tween; - } + p.config = SlowMo.config = function(linearRatio, power, yoyoMode) { + return new SlowMo(linearRatio, power, yoyoMode); }; - - p._onInitTween = function(target, value, tween, index) { - this.target = target; - this._props = []; - _last = this; - _lastValue = value; - var ease = tween._ease, - checkpoint = isNaN(value.checkpoint) ? 0.05 : Number(value.checkpoint), - duration = tween._duration, - preventOvershoot = value.preventOvershoot, + + + //SteppedEase + SteppedEase = _class("easing.SteppedEase", function(steps, immediateStart) { + steps = steps || 1; + this._p1 = 1 / steps; + this._p2 = steps + (immediateStart ? 0 : 1); + this._p3 = immediateStart ? 1 : 0; + }, true); + p = SteppedEase.prototype = new Ease(); + p.constructor = SteppedEase; + p.getRatio = function(p) { + if (p < 0) { + p = 0; + } else if (p >= 1) { + p = 0.999999999; + } + return (((this._p2 * p) | 0) + this._p3) * this._p1; + }; + p.config = SteppedEase.config = function(steps, immediateStart) { + return new SteppedEase(steps, immediateStart); + }; + + + //ExpoScaleEase + ExpoScaleEase = _class("easing.ExpoScaleEase", function(start, end, ease) { + this._p1 = Math.log(end / start); + this._p2 = end - start; + this._p3 = start; + this._ease = ease; + }, true); + p = ExpoScaleEase.prototype = new Ease(); + p.constructor = ExpoScaleEase; + p.getRatio = function(p) { + if (this._ease) { + p = this._ease.getRatio(p); + } + return (this._p3 * Math.exp(this._p1 * p) - this._p3) / this._p2; + }; + p.config = ExpoScaleEase.config = function(start, end, ease) { + return new ExpoScaleEase(start, end, ease); + }; + + + //RoughEase + RoughEase = _class("easing.RoughEase", function(vars) { + vars = vars || {}; + var taper = vars.taper || "none", + a = [], cnt = 0, - p, curProp, curVal, isFunc, velocity, change1, end, change2, tracker, - linkedProps, linkedPropNames, i; - - if (value.linkedProps) { //when there are linkedProps (typically "x,y" where snapping has to factor in multiple properties, we must first populate an object with all of those end values, then feed it to the function that make any necessary alterations. So the point of this first loop is to simply build an object (like {x:100, y:204.5}) for feeding into that function which we'll do later in the "real" loop. - linkedPropNames = value.linkedProps.split(","); - linkedProps = {}; - for (i = 0; i < linkedPropNames.length; i++) { - p = linkedPropNames[i]; - curProp = value[p]; - if (curProp) { - if (curProp.velocity !== undefined && typeof(curProp.velocity) === "number") { - velocity = Number(curProp.velocity) || 0; - } else { - tracker = tracker || VelocityTracker.getByTarget(target); - velocity = (tracker && tracker.isTrackingProp(p)) ? tracker.getVelocity(p) : 0; - } - curVal = (typeof(target[p]) === "function") ? target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() : target[p] || 0; - linkedProps[p] = curVal + _calculateChange(velocity, ease, duration, checkpoint); - } - } - } - - for (p in value) { - if (p !== "resistance" && p !== "checkpoint" && p !== "preventOvershoot" && p !== "linkedProps" && p !== "radius") { - curProp = value[p]; - if (typeof(curProp) === "function") { - curProp = curProp(index, target); - } - if (typeof(curProp) === "number") { - velocity = Number(curProp) || 0; - } else if (typeof(curProp) === "object" && !isNaN(curProp.velocity)) { - velocity = Number(curProp.velocity); - } else { - tracker = tracker || VelocityTracker.getByTarget(target); - if (tracker && tracker.isTrackingProp(p)) { - velocity = tracker.getVelocity(p); - } else { - throw("ERROR: No velocity was defined in the throwProps tween of " + target + " property: " + p); - } - } - change1 = _calculateChange(velocity, ease, duration, checkpoint); - change2 = 0; - isFunc = (typeof(target[p]) === "function"); - curVal = (isFunc) ? target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() : target[p]; - if (typeof(curProp) === "object") { - end = curVal + change1; - if (curProp.end !== undefined) { - curProp = _parseEnd(curProp, (linkedProps && p in linkedProps) ? linkedProps : end, curProp.max, curProp.min, p, value.radius); - if (_recordEndMode) { - value[p] = _extend(curProp, value[p], "end"); - } - } - if (curProp.max !== undefined && Number(curProp.max) < end) { - if (preventOvershoot || curProp.preventOvershoot) { - change1 = curProp.max - curVal; - } else { - change2 = (curProp.max - curVal) - change1; - } - } else if (curProp.min !== undefined && Number(curProp.min) > end) { - if (preventOvershoot || curProp.preventOvershoot) { - change1 = curProp.min - curVal; - } else { - change2 = (curProp.min - curVal) - change1; - } - } - } - this._overwriteProps[cnt] = p; - this._props[cnt++] = {p:p, s:curVal, c1:change1, c2:change2, f:isFunc, r:false}; - } - } - return true; - }; - - p._kill = function(lookup) { - var i = this._props.length; + points = (vars.points || 20) | 0, + i = points, + randomize = (vars.randomize !== false), + clamp = (vars.clamp === true), + template = (vars.template instanceof Ease) ? vars.template : null, + strength = (typeof(vars.strength) === "number") ? vars.strength * 0.4 : 0.4, + x, y, bump, invX, obj, pnt; while (--i > -1) { - if (lookup[this._props[i].p] != null) { - this._props.splice(i, 1); + x = randomize ? Math.random() : (1 / points) * i; + y = template ? template.getRatio(x) : x; + if (taper === "none") { + bump = strength; + } else if (taper === "out") { + invX = 1 - x; + bump = invX * invX * strength; + } else if (taper === "in") { + bump = x * x * strength; + } else if (x < 0.5) { //"both" (start) + invX = x * 2; + bump = invX * invX * 0.5 * strength; + } else { //"both" (end) + invX = (1 - x) * 2; + bump = invX * invX * 0.5 * strength; } - } - return TweenPlugin.prototype._kill.call(this, lookup); - }; - - p._mod = function(lookup) { - var p = this._props, - i = p.length, - val; - while (--i > -1) { - val = lookup[p[i].p] || lookup.throwProps; - if (typeof(val) === "function") { - p[i].m = val; - } - } - }; - - p.setRatio = function(v) { - var i = this._props.length, - cp, val; - while (--i > -1) { - cp = this._props[i]; - val = cp.s + cp.c1 * v + cp.c2 * v * v; - if (cp.m) { - val = cp.m(val, this.target); - } else if (v === 1) { - val = ((val * 10000 + (val < 0 ? -0.5 : 0.5)) | 0) / 10000; //if we don't round things at the very end, binary math issues can creep in and cause snapping not to be exact (like landing on 20.000000000001 instead of 20). - } - if (cp.f) { - this.target[cp.p](val); + if (randomize) { + y += (Math.random() * bump) - (bump * 0.5); + } else if (i % 2) { + y += bump * 0.5; } else { - this.target[cp.p] = val; + y -= bump * 0.5; } - } - }; - - TweenPlugin.activate([ThrowPropsPlugin]); - - return ThrowPropsPlugin; - - }, true); - - - -/* - * ---------------------------------------------------------------- - * VelocityTracker - * ---------------------------------------------------------------- - */ - _gsScope._gsDefine("utils.VelocityTracker", ["TweenLite"], function(TweenLite) { - - var _first, _initted, _time1, _time2, - _capsExp = /([A-Z])/g, - _empty = {}, - _doc = _gsScope.document, - _transforms = {x:1,y:1,z:2,scale:1,scaleX:1,scaleY:1,rotation:1,rotationZ:1,rotationX:2,rotationY:2,skewX:1,skewY:1,xPercent:1,yPercent:1}, - _computedStyleScope = (typeof(window) !== "undefined" ? window : _doc.defaultView || {getComputedStyle:function() {}}), - _getComputedStyle = function(e) { - return _computedStyleScope.getComputedStyle(e); //to avoid errors in Microsoft Edge, we need to call getComputedStyle() from a specific scope, typically window. - }, - _getStyle = function(t, p, cs) { - var rv = (t._gsTransform || _empty)[p]; - if (rv || rv === 0) { - return rv; - } else if (t.style[p]) { - rv = t.style[p]; - } else if ((cs = cs || _getComputedStyle(t, null))) { - rv = cs[p] || cs.getPropertyValue(p) || cs.getPropertyValue(p.replace(_capsExp, "-$1").toLowerCase()); - } else if (t.currentStyle) { - rv = t.currentStyle[p]; - } - return parseFloat(rv) || 0; - }, - _ticker = TweenLite.ticker, - VelocityProp = function(p, isFunc, next) { - this.p = p; - this.f = isFunc; - this.v1 = this.v2 = 0; - this.t1 = this.t2 = _ticker.time; - this.css = false; - this.type = ""; - this._prev = null; - if (next) { - this._next = next; - next._prev = this; - } - }, - _update = function() { - var vt = _first, - t = _ticker.time, - val, vp; - //if the frame rate is too high, we won't be able to track the velocity as well, so only update the values about 33 times per second - if (t - _time1 >= 0.03) { - _time2 = _time1; - _time1 = t; - while (vt) { - vp = vt._firstVP; - while (vp) { - val = vp.css ? _getStyle(vt.target, vp.p) : vp.f ? vt.target[vp.p]() : vt.target[vp.p]; - if (val !== vp.v1 || t - vp.t1 > 0.15) { //use a threshold of 0.15 seconds for zeroing-out velocity. If we only use 0.03 and things update slightly slower, like some Android devices dispatch "touchmove" events sluggishly so 2 or 3 ticks of the TweenLite.ticker may elapse inbetween, thus it may appear like the object is not moving but it actually is but it's not updating as frequently. A threshold of 0.15 seconds seems to be a good balance. We want to update things frequently (0.03 seconds) when they're moving so that we can respond to fast motions accurately, but we want to be more resistant to go back to a zero velocity. - vp.v2 = vp.v1; - vp.v1 = val; - vp.t2 = vp.t1; - vp.t1 = t; - } - vp = vp._next; - } - vt = vt._next; + if (clamp) { + if (y > 1) { + y = 1; + } else if (y < 0) { + y = 0; } } - }, - VelocityTracker = function(target) { - this._lookup = {}; - this.target = target; - this.elem = (target.style && target.nodeType) ? true : false; - if (!_initted) { - _ticker.addEventListener("tick", _update, null, false, -100); - _time1 = _time2 = _ticker.time; - _initted = true; - } - if (_first) { - this._next = _first; - _first._prev = this; - } - _first = this; - }, - getByTarget = VelocityTracker.getByTarget = function(target) { - var vt = _first; - while (vt) { - if (vt.target === target) { - return vt; - } - vt = vt._next; - } - }, - p = VelocityTracker.prototype; + a[cnt++] = {x:x, y:y}; + } + a.sort(function(a, b) { + return a.x - b.x; + }); - p.addProp = function(prop, type) { - if (!this._lookup[prop]) { - var t = this.target, - isFunc = (typeof(t[prop]) === "function"), - alt = isFunc ? this._altProp(prop) : prop, - vp = this._firstVP; - this._firstVP = this._lookup[prop] = this._lookup[alt] = vp = new VelocityProp((alt !== prop && prop.indexOf("set") === 0) ? alt : prop, isFunc, vp); - vp.css = (this.elem && (this.target.style[vp.p] !== undefined || _transforms[vp.p])); - if (vp.css && _transforms[vp.p] && !t._gsTransform) { - TweenLite.set(t, {x:"+=0", overwrite:false}); //just forces CSSPlugin to create a _gsTransform for the element if it doesn't exist - } - vp.type = type || (vp.css && prop.indexOf("rotation") === 0) ? "deg" : ""; - vp.v1 = vp.v2 = vp.css ? _getStyle(t, vp.p) : isFunc ? t[vp.p]() : t[vp.p]; - } - }; - - p.removeProp = function(prop) { - var vp = this._lookup[prop]; - if (vp) { - if (vp._prev) { - vp._prev._next = vp._next; - } else if (vp === this._firstVP) { - this._firstVP = vp._next; - } - if (vp._next) { - vp._next._prev = vp._prev; - } - this._lookup[prop] = 0; - if (vp.f) { - this._lookup[this._altProp(prop)] = 0; //if it's a getter/setter, we should remove the matching counterpart (if one exists) - } - } - }; - - p.isTrackingProp = function(prop) { - return (this._lookup[prop] instanceof VelocityProp); - }; - - p.getVelocity = function(prop) { - var vp = this._lookup[prop], - target = this.target, - val, dif, rotationCap; - if (!vp) { - throw "The velocity of " + prop + " is not being tracked."; - } - val = vp.css ? _getStyle(target, vp.p) : vp.f ? target[vp.p]() : target[vp.p]; - dif = (val - vp.v2); - if (vp.type === "rad" || vp.type === "deg") { //rotational values need special interpretation so that if, for example, they go from 179 to -178 degrees it is interpreted as a change of 3 instead of -357. - rotationCap = (vp.type === "rad") ? Math.PI * 2 : 360; - dif = dif % rotationCap; - if (dif !== dif % (rotationCap / 2)) { - dif = (dif < 0) ? dif + rotationCap : dif - rotationCap; - } - } - return dif / (_ticker.time - vp.t2); - }; - - p._altProp = function(p) { //for getters/setters like getCustomProp() and setCustomProp() - we should accommodate both - var pre = p.substr(0, 3), - alt = ((pre === "get") ? "set" : (pre === "set") ? "get" : pre) + p.substr(3); - return (typeof(this.target[alt]) === "function") ? alt : p; - }; - - VelocityTracker.getByTarget = function(target) { - var vt = _first; - if (typeof(target) === "string") { - target = TweenLite.selector(target); - } - if (target.length && target !== window && target[0] && target[0].style && !target.nodeType) { - target = target[0]; - } - while (vt) { - if (vt.target === target) { - return vt; - } - vt = vt._next; - } - }; - - VelocityTracker.track = function(target, props, types) { - var vt = getByTarget(target), - a = props.split(","), - i = a.length; - types = (types || "").split(","); - if (!vt) { - vt = new VelocityTracker(target); - } + pnt = new EasePoint(1, 1, null); + i = points; while (--i > -1) { - vt.addProp(a[i], types[i] || types[0]); + obj = a[i]; + pnt = new EasePoint(obj.x, obj.y, pnt); } - return vt; + + this._prev = new EasePoint(0, 0, (pnt.t !== 0) ? pnt : pnt.next); + }, true); + p = RoughEase.prototype = new Ease(); + p.constructor = RoughEase; + p.getRatio = function(p) { + var pnt = this._prev; + if (p > pnt.t) { + while (pnt.next && p >= pnt.t) { + pnt = pnt.next; + } + pnt = pnt.prev; + } else { + while (pnt.prev && p <= pnt.t) { + pnt = pnt.prev; + } + } + this._prev = pnt; + return (pnt.v + ((p - pnt.t) / pnt.gap) * pnt.c); }; - - VelocityTracker.untrack = function(target, props) { - var vt = getByTarget(target), - a = (props || "").split(","), - i = a.length; - if (!vt) { - return; - } - while (--i > -1) { - vt.removeProp(a[i]); - } - if (!vt._firstVP || !props) { - if (vt._prev) { - vt._prev._next = vt._next; - } else if (vt === _first) { - _first = vt._next; - } - if (vt._next) { - vt._next._prev = vt._prev; - } - } + p.config = function(vars) { + return new RoughEase(vars); }; - - VelocityTracker.isTracking = function(target, prop) { - var vt = getByTarget(target); - return (!vt) ? false : (!prop && vt._firstVP) ? true : vt.isTrackingProp(prop); - }; - - return VelocityTracker; - - }, true); + RoughEase.ease = new RoughEase(); -}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } - -//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function(name) { - "use strict"; - var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope)[name]; - }; - if (typeof(module) !== "undefined" && module.exports) { //node - require("../TweenLite.js"); - module.exports = getGlobal(); - } else if (typeof(define) === "function" && define.amd) { //AMD - define(["TweenLite"], getGlobal); - } -}("ThrowPropsPlugin")); -/*! - * VERSION: 0.2.1 - * DATE: 2018-02-15 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * Physics2DPlugin is a Club GreenSock membership benefit; You must have a valid membership to use - * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. - * This work is subject to the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - */ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { - - "use strict"; - - var _DEG2RAD = Math.PI / 180, - Physics2DProp = function(target, p, velocity, acceleration, stepsPerTimeUnit) { - this.p = p; - this.f = (typeof(target[p]) === "function"); - this.start = this.value = (!this.f) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ](); - this.velocity = velocity || 0; - this.v = this.velocity / stepsPerTimeUnit; - if (acceleration || acceleration === 0) { - this.acceleration = acceleration; - this.a = this.acceleration / (stepsPerTimeUnit * stepsPerTimeUnit); - } else { - this.acceleration = this.a = 0; + //Bounce + _wrap("Bounce", + _create("BounceOut", function(p) { + if (p < 1 / 2.75) { + return 7.5625 * p * p; + } else if (p < 2 / 2.75) { + return 7.5625 * (p -= 1.5 / 2.75) * p + 0.75; + } else if (p < 2.5 / 2.75) { + return 7.5625 * (p -= 2.25 / 2.75) * p + 0.9375; } - }, - _random = Math.random(), - _globals = _gsScope._gsDefine.globals, - _rootFramesTimeline = _globals.com.greensock.core.Animation._rootFramesTimeline, - - Physics2DPlugin = _gsScope._gsDefine.plugin({ - propName: "physics2D", - version: "0.2.1", - API: 2, - - //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. - init: function(target, value, tween, index) { - if (typeof(value) === "function") { - value = value(index, target); - } - this._target = target; - this._tween = tween; - this._runBackwards = (tween.vars.runBackwards === true); - this._step = 0; - var tl = tween._timeline, - angle = Number(value.angle) || 0, - velocity = Number(value.velocity) || 0, - acceleration = Number(value.acceleration) || 0, - xProp = value.xProp || "x", - yProp = value.yProp || "y", - aAngle = (value.accelerationAngle || value.accelerationAngle === 0) ? Number(value.accelerationAngle) : angle, - stepsPerTimeUnit; - while (tl._timeline) { - tl = tl._timeline; - } - this._stepsPerTimeUnit = stepsPerTimeUnit = (tl === _rootFramesTimeline) ? 1 : 30; - if (value.gravity) { - acceleration = Number(value.gravity); - aAngle = 90; - } - angle *= _DEG2RAD; - aAngle *= _DEG2RAD; - this._friction = 1 - Number(value.friction || 0); - this._overwriteProps.push(xProp); - this._overwriteProps.push(yProp); - - this._x = new Physics2DProp(target, xProp, Math.cos(angle) * velocity, Math.cos(aAngle) * acceleration, stepsPerTimeUnit); - this._y = new Physics2DProp(target, yProp, Math.sin(angle) * velocity, Math.sin(aAngle) * acceleration, stepsPerTimeUnit); - this._skipX = this._skipY = false; - return true; - }, - - //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) - set: function(ratio) { - var time = this._tween._time, - xp = this._x, - yp = this._y, - x, y, tt, steps, remainder, i; - if (this._runBackwards === true) { - time = this._tween._duration - time; - } - if (this._friction === 1) { - tt = time * time * 0.5; - x = xp.start + ((xp.velocity * time) + (xp.acceleration * tt)); - y = yp.start + ((yp.velocity * time) + (yp.acceleration * tt)); - } else { - time *= this._stepsPerTimeUnit; - steps = i = (time | 0) - this._step; - remainder = (time % 1); - if (i >= 0) { //going forward - while (--i > -1) { - xp.v += xp.a; - yp.v += yp.a; - xp.v *= this._friction; - yp.v *= this._friction; - xp.value += xp.v; - yp.value += yp.v; - } - - } else { //going backwards - i = -i; - while (--i > -1) { - xp.value -= xp.v; - yp.value -= yp.v; - xp.v /= this._friction; - yp.v /= this._friction; - xp.v -= xp.a; - yp.v -= yp.a; - } - } - x = xp.value + (xp.v * remainder); - y = yp.value + (yp.v * remainder); - this._step += steps; - } - if (!this._skipX) { - if (xp.m) { - x = xp.m(x, this._target); - } - if (xp.f) { - this._target[xp.p](x); - } else { - this._target[xp.p] = x; - } - } - if (!this._skipY) { - if (yp.m) { - y = yp.m(y, this._target); - } - if (yp.f) { - this._target[yp.p](y); - } else { - this._target[yp.p] = y; - } - } - } - + return 7.5625 * (p -= 2.625 / 2.75) * p + 0.984375; }), - p = Physics2DPlugin.prototype; + _create("BounceIn", function(p) { + if ((p = 1 - p) < 1 / 2.75) { + return 1 - (7.5625 * p * p); + } else if (p < 2 / 2.75) { + return 1 - (7.5625 * (p -= 1.5 / 2.75) * p + 0.75); + } else if (p < 2.5 / 2.75) { + return 1 - (7.5625 * (p -= 2.25 / 2.75) * p + 0.9375); + } + return 1 - (7.5625 * (p -= 2.625 / 2.75) * p + 0.984375); + }), + _create("BounceInOut", function(p) { + var invert = (p < 0.5); + if (invert) { + p = 1 - (p * 2); + } else { + p = (p * 2) - 1; + } + if (p < 1 / 2.75) { + p = 7.5625 * p * p; + } else if (p < 2 / 2.75) { + p = 7.5625 * (p -= 1.5 / 2.75) * p + 0.75; + } else if (p < 2.5 / 2.75) { + p = 7.5625 * (p -= 2.25 / 2.75) * p + 0.9375; + } else { + p = 7.5625 * (p -= 2.625 / 2.75) * p + 0.984375; + } + return invert ? (1 - p) * 0.5 : p * 0.5 + 0.5; + }) + ); - p._kill = function(lookup) { - if (lookup[this._x.p] != null) { - this._skipX = true; - } - if (lookup[this._y.p] != null) { - this._skipY = true; - } - return this._super._kill.call(this, lookup); - }; - p._mod = function(lookup) { - var val = lookup[this._x.p] || lookup.physics2D; - if (val && typeof(val) === "function") { - this._x.m = val; - } - val = lookup[this._y.p] || lookup.physics2D; - if (val && typeof(val) === "function") { - this._y.m = val; - } - }; + //CIRC + _wrap("Circ", + _create("CircOut", function(p) { + return Math.sqrt(1 - (p = p - 1) * p); + }), + _create("CircIn", function(p) { + return -(Math.sqrt(1 - (p * p)) - 1); + }), + _create("CircInOut", function(p) { + return ((p*=2) < 1) ? -0.5 * (Math.sqrt(1 - p * p) - 1) : 0.5 * (Math.sqrt(1 - (p -= 2) * p) + 1); + }) + ); - Physics2DPlugin._autoCSS = true; //indicates that this plugin can be inserted into the "css" object using the autoCSS feature of TweenLite - Physics2DPlugin._cssRegister = function() { - var CSSPlugin = _globals.CSSPlugin; - if (!CSSPlugin) { - return; - } - var _internals = CSSPlugin._internals, - _parseToProxy = _internals._parseToProxy, - _setPluginRatio = _internals._setPluginRatio, - CSSPropTween = _internals.CSSPropTween; - _internals._registerComplexSpecialProp("physics2D", {parser:function(t, e, prop, cssp, pt, plugin) { - plugin = new Physics2DPlugin(); - var xProp = e.xProp || "x", - yProp = e.yProp || "y", - vars = {}, - data; - vars[xProp] = vars[yProp] = _random++; //doesn't really matter what values we put here because the plugin will determine end values, but it'd be best of the values don't match the current ones so that CSSPlugin doesn't skip creating a CSSPropTween. - data = _parseToProxy(t, vars, cssp, pt, plugin); - pt = new CSSPropTween(t, "physics2D", 0, 0, data.pt, 2); - pt.data = data; - pt.plugin = plugin; - pt.setRatio = _setPluginRatio; - plugin._onInitTween(data.proxy, e, cssp._tween); - return pt; - }}); + + //Elastic + _createElastic = function(n, f, def) { + var C = _class("easing." + n, function(amplitude, period) { + this._p1 = (amplitude >= 1) ? amplitude : 1; //note: if amplitude is < 1, we simply adjust the period for a more natural feel. Otherwise the math doesn't work right and the curve starts at 1. + this._p2 = (period || def) / (amplitude < 1 ? amplitude : 1); + this._p3 = this._p2 / _2PI * (Math.asin(1 / this._p1) || 0); + this._p2 = _2PI / this._p2; //precalculate to optimize + }, true), + p = C.prototype = new Ease(); + p.constructor = C; + p.getRatio = f; + p.config = function(amplitude, period) { + return new C(amplitude, period); + }; + return C; }; + _wrap("Elastic", + _createElastic("ElasticOut", function(p) { + return this._p1 * Math.pow(2, -10 * p) * Math.sin( (p - this._p3) * this._p2 ) + 1; + }, 0.3), + _createElastic("ElasticIn", function(p) { + return -(this._p1 * Math.pow(2, 10 * (p -= 1)) * Math.sin( (p - this._p3) * this._p2 )); + }, 0.3), + _createElastic("ElasticInOut", function(p) { + return ((p *= 2) < 1) ? -0.5 * (this._p1 * Math.pow(2, 10 * (p -= 1)) * Math.sin( (p - this._p3) * this._p2)) : this._p1 * Math.pow(2, -10 *(p -= 1)) * Math.sin( (p - this._p3) * this._p2 ) * 0.5 + 1; + }, 0.45) + ); + + + //Expo + _wrap("Expo", + _create("ExpoOut", function(p) { + return 1 - Math.pow(2, -10 * p); + }), + _create("ExpoIn", function(p) { + return Math.pow(2, 10 * (p - 1)) - 0.001; + }), + _create("ExpoInOut", function(p) { + return ((p *= 2) < 1) ? 0.5 * Math.pow(2, 10 * (p - 1)) : 0.5 * (2 - Math.pow(2, -10 * (p - 1))); + }) + ); + + + //Sine + _wrap("Sine", + _create("SineOut", function(p) { + return Math.sin(p * _HALF_PI); + }), + _create("SineIn", function(p) { + return -Math.cos(p * _HALF_PI) + 1; + }), + _create("SineInOut", function(p) { + return -0.5 * (Math.cos(Math.PI * p) - 1); + }) + ); + + _class("easing.EaseLookup", { + find:function(s) { + return Ease.map[s]; + } + }, true); + + //register the non-standard eases + _easeReg(w.SlowMo, "SlowMo", "ease,"); + _easeReg(RoughEase, "RoughEase", "ease,"); + _easeReg(SteppedEase, "SteppedEase", "ease,"); + + return Back; + + }, true); }); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + //export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function(name) { +(function() { "use strict"; var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope)[name]; + return (_gsScope.GreenSockGlobals || _gsScope); }; if (typeof(module) !== "undefined" && module.exports) { //node require("../TweenLite.js"); @@ -126703,580 +117791,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa } else if (typeof(define) === "function" && define.amd) { //AMD define(["TweenLite"], getGlobal); } -}("Physics2DPlugin")); -/*! - * VERSION: 0.7.0 - * DATE: 2019-02-07 - * UPDATES AND DOCS AT: http://greensock.com - * - * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. - * SplitText is a Club GreenSock membership benefit; You must have a valid membership to use - * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. - * This work is subject to the software agreement that was issued with your membership. - * - * @author: Jack Doyle, jack@greensock.com - */ -/* eslint-disable */ -var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node -(function(window) { - - "use strict"; - var _globals = window.GreenSockGlobals || window, - _namespace = function(ns) { - var a = ns.split("."), - p = _globals, i; - for (i = 0; i < a.length; i++) { - p[a[i]] = p = p[a[i]] || {}; - } - return p; - }, - pkg = _namespace("com.greensock.utils"), - _getText = function(e) { - var type = e.nodeType, - result = ""; - if (type === 1 || type === 9 || type === 11) { - if (typeof(e.textContent) === "string") { - return e.textContent; - } else { - for ( e = e.firstChild; e; e = e.nextSibling ) { - result += _getText(e); - } - } - } else if (type === 3 || type === 4) { - return e.nodeValue; - } - return result; - }, - _doc = _gsScope.document || {}, - _computedStyleScope = (typeof(window) !== "undefined" ? window : _doc.defaultView || {getComputedStyle:function() {}}), - _getComputedStyle = function(e) { - return _computedStyleScope.getComputedStyle(e); //to avoid errors in Microsoft Edge, we need to call getComputedStyle() from a specific scope, typically window. - }, - _capsExp = /([A-Z])/g, - _getStyle = function(t, p, cs, str) { - var result; - if ((cs = cs || _getComputedStyle(t, null))) { - t = cs.getPropertyValue(p.replace(_capsExp, "-$1").toLowerCase()); - result = (t || cs.length) ? t : cs[p]; //Opera behaves VERY strangely - length is usually 0 and cs[p] is the only way to get accurate results EXCEPT when checking for -o-transform which only works with cs.getPropertyValue()! - } else if (t.currentStyle) { - cs = t.currentStyle; - result = cs[p]; - } - return str ? result : parseInt(result, 10) || 0; - }, - _isArrayLike = function(e) { - return (e.length && e[0] && ((e[0].nodeType && e[0].style && !e.nodeType) || (e[0].length && e[0][0]))) ? true : false; //could be an array of jQuery objects too, so accommodate that. - }, - _flattenArray = function(a) { - var result = [], - l = a.length, - i, e, j; - for (i = 0; i < l; i++) { - e = a[i]; - if (_isArrayLike(e)) { - j = e.length; - for (j = 0; j < e.length; j++) { - result.push(e[j]); - } - } else { - result.push(e); - } - } - return result; - }, - //some characters are combining marks (think diacritics/accents in European languages) which involve 2 or 4 characters that combine in the browser to form a single character. Pass in the remaining text and an array of the special characters to search for and if the text starts with one of those special characters, it'll spit back the number of characters to retain (often 2 or 4). Used in the specialChars features that was introduced in 0.6.0. - _findSpecialChars = function(text, chars) { - var i = chars.length, - s; - while (--i > -1) { - s = chars[i]; - if (text.substr(0, s.length) === s) { - return s.length; - } - } - }, - _stripExp = /(?:\r|\n|\t\t)/g, //find carriage returns, new line feeds and double-tabs. - _multipleSpacesExp = /(?:\s\s+)/g, - _emojiStart = 0xD800, - _emojiEnd = 0xDBFF, - _emojiLowStart = 0xDC00, - _emojiRegionStart = 0x1F1E6, - _emojiRegionEnd = 0x1F1FF, - _emojiModStart = 0x1f3fb, - _emojiModEnd = 0x1f3ff, - _emojiPairCode = function(s) { - return ((s.charCodeAt(0) - _emojiStart) << 10) + (s.charCodeAt(1) - _emojiLowStart) + 0x10000; - }, - _isOldIE = (_doc.all && !_doc.addEventListener), - _divStart = " style='position:relative;display:inline-block;" + (_isOldIE ? "*display:inline;*zoom:1;'" : "'"), //note: we must use both display:inline-block and *display:inline for IE8 and earlier, otherwise it won't flow correctly (and if we only use display:inline, IE won't render most of the property tweens - very odd). - _cssClassFunc = function(cssClass, tag) { - cssClass = cssClass || ""; - var iterate = (cssClass.indexOf("++") !== -1), - num = 1; - if (iterate) { - cssClass = cssClass.split("++").join(""); - } - return function() { - return "<" + tag + _divStart + (cssClass ? " class='" + cssClass + (iterate ? num++ : "") + "'>" : ">"); - }; - }, - SplitText = pkg.SplitText = _globals.SplitText = function(element, vars) { - if (typeof(element) === "string") { - element = SplitText.selector(element); - } - if (!element) { - throw("cannot split a null element."); - } - this.elements = _isArrayLike(element) ? _flattenArray(element) : [element]; - this.chars = []; - this.words = []; - this.lines = []; - this._originals = []; - this.vars = vars || {}; - this.split(vars); - }, - _swapText = function(element, oldText, newText) { - var type = element.nodeType; - if (type === 1 || type === 9 || type === 11) { - for (element = element.firstChild; element; element = element.nextSibling) { - _swapText(element, oldText, newText); - } - } else if (type === 3 || type === 4) { - element.nodeValue = element.nodeValue.split(oldText).join(newText); - } - }, - _pushReversed = function(a, merge) { - var i = merge.length; - while (--i > -1) { - a.push(merge[i]); - } - }, - _slice = function(a) { //don't use Array.prototype.slice.call(target, 0) because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll() - var b = [], - l = a.length, - i; - for (i = 0; i !== l; b.push(a[i++])) {} - return b; - }, - _isBeforeWordDelimiter = function(e, root, wordDelimiter) { - var next; - while (e && e !== root) { - next = e._next || e.nextSibling; - if (next) { - return next.textContent.charAt(0) === wordDelimiter; - } - e = e.parentNode || e._parent; - } - return false; - }, - _deWordify = function(e) { - var children = _slice(e.childNodes), - l = children.length, - i, child; - for (i = 0; i < l; i++) { - child = children[i]; - if (child._isSplit) { - _deWordify(child); - } else { - if (i && child.previousSibling.nodeType === 3) { - child.previousSibling.nodeValue += (child.nodeType === 3) ? child.nodeValue : child.firstChild.nodeValue; - } else if (child.nodeType !== 3) { - e.insertBefore(child.firstChild, child); - } - e.removeChild(child); - } - } - }, - _setPositionsAfterSplit = function(element, vars, allChars, allWords, allLines, origWidth, origHeight) { - var cs = _getComputedStyle(element), - paddingLeft = _getStyle(element, "paddingLeft", cs), - lineOffsetY = -999, - borderTopAndBottom = _getStyle(element, "borderBottomWidth", cs) + _getStyle(element, "borderTopWidth", cs), - borderLeftAndRight = _getStyle(element, "borderLeftWidth", cs) + _getStyle(element, "borderRightWidth", cs), - padTopAndBottom = _getStyle(element, "paddingTop", cs) + _getStyle(element, "paddingBottom", cs), - padLeftAndRight = _getStyle(element, "paddingLeft", cs) + _getStyle(element, "paddingRight", cs), - lineThreshold = _getStyle(element, "fontSize") * 0.2, - textAlign = _getStyle(element, "textAlign", cs, true), - charArray = [], - wordArray = [], - lineArray = [], - wordDelimiter = vars.wordDelimiter || " ", - tag = vars.tag ? vars.tag : (vars.span ? "span" : "div"), - types = vars.type || vars.split || "chars,words,lines", - lines = (allLines && types.indexOf("lines") !== -1) ? [] : null, - words = (types.indexOf("words") !== -1), - chars = (types.indexOf("chars") !== -1), - absolute = (vars.position === "absolute" || vars.absolute === true), - linesClass = vars.linesClass, - iterateLine = ((linesClass || "").indexOf("++") !== -1), - spaceNodesToRemove = [], - i, j, l, node, nodes, isChild, curLine, addWordSpaces, style, lineNode, lineWidth, offset; - if (iterateLine) { - linesClass = linesClass.split("++").join(""); - } - - //copy all the descendant nodes into an array (we can't use a regular nodeList because it's live and we may need to renest things) - j = element.getElementsByTagName("*"); - l = j.length; - nodes = []; - for (i = 0; i < l; i++) { - nodes[i] = j[i]; - } - - //for absolute positioning, we need to record the x/y offsets and width/height for every
. And even if we're not positioning things absolutely, in order to accommodate lines, we must figure out where the y offset changes so that we can sense where the lines break, and we populate the lines array. - if (lines || absolute) { - for (i = 0; i < l; i++) { - node = nodes[i]; - isChild = (node.parentNode === element); - if (isChild || absolute || (chars && !words)) { - offset = node.offsetTop; - if (lines && isChild && Math.abs(offset - lineOffsetY) > lineThreshold && (node.nodeName !== "BR" || i === 0)) { //we found some rare occasions where a certain character like ‑ could cause the offsetTop to be off by 1 pixel, so we build in a threshold. - curLine = []; - lines.push(curLine); - lineOffsetY = offset; - } - if (absolute) { //record offset x and y, as well as width and height so that we can access them later for positioning. Grabbing them at once ensures we don't trigger a browser paint & we maximize performance. - node._x = node.offsetLeft; - node._y = offset; - node._w = node.offsetWidth; - node._h = node.offsetHeight; - } - if (lines) { - if ((node._isSplit && isChild) || (!chars && isChild) || (words && isChild) || (!words && node.parentNode.parentNode === element && !node.parentNode._isSplit)) { - curLine.push(node); - node._x -= paddingLeft; - if (_isBeforeWordDelimiter(node, element, wordDelimiter)) { - node._wordEnd = true; - } - } - if (node.nodeName === "BR" && ((node.nextSibling && node.nextSibling.nodeName === "BR") || i === 0)) { //two consecutive
tags signify a new [empty] line. Also, if the entire block of content STARTS with a
, add a line. - lines.push([]); - } - } - } - } - } - - for (i = 0; i < l; i++) { - node = nodes[i]; - isChild = (node.parentNode === element); - if (node.nodeName === "BR") { - if (lines || absolute) { - if (node.parentNode) { - node.parentNode.removeChild(node); - } - nodes.splice(i--, 1); - l--; - } else if (!words) { - element.appendChild(node); - } - continue; - } - - if (absolute) { - style = node.style; - if (!words && !isChild) { - node._x += node.parentNode._x; - node._y += node.parentNode._y; - } - style.left = node._x + "px"; - style.top = node._y + "px"; - style.position = "absolute"; - style.display = "block"; - //if we don't set the width/height, things collapse in older versions of IE and the origin for transforms is thrown off in all browsers. - style.width = (node._w + 1) + "px"; //IE is 1px short sometimes. Avoid wrapping - style.height = node._h + "px"; - } - - if (!words && chars) { - //we always start out wrapping words in their own
so that line breaks happen correctly, but here we'll remove those
tags if necessary and renest the characters directly into the element rather than inside the word
- if (node._isSplit) { - node._next = node.nextSibling; - node.parentNode.appendChild(node); //put it at the end to keep the order correct. - - } else if (node.parentNode._isSplit) { - node._parent = node.parentNode; - if (!node.previousSibling && node.firstChild) { - node.firstChild._isFirst = true; - } - if (node.nextSibling && node.nextSibling.textContent === " " && !node.nextSibling.nextSibling) { //if the last node inside a nested element is just a space (like Tnested ), remove it otherwise it'll get placed in the wrong order. Don't remove it right away, though, because we need to sense when words/characters are before a space like _isBeforeWordDelimiter(). Removing it now would make that a false negative. - spaceNodesToRemove.push(node.nextSibling); - } - node._next = (node.nextSibling && node.nextSibling._isFirst) ? null : node.nextSibling; - node.parentNode.removeChild(node); - nodes.splice(i--, 1); - l--; - } else if (!isChild) { - offset = (!node.nextSibling && _isBeforeWordDelimiter(node.parentNode, element, wordDelimiter)); //if this is the last letter in the word (and we're not breaking by lines and not positioning things absolutely), we need to add a space afterwards so that the characters don't just mash together - if (node.parentNode._parent) { - node.parentNode._parent.appendChild(node); - } - if (offset) { - node.parentNode.appendChild(_doc.createTextNode(" ")); - } - if (tag === "span") { - node.style.display = "inline"; //so that word breaks are honored properly. - } - charArray.push(node); - } - } else if (node.parentNode._isSplit && !node._isSplit && node.innerHTML !== "") { - wordArray.push(node); - } else if (chars && !node._isSplit) { - if (tag === "span") { - node.style.display = "inline"; - } - charArray.push(node); - } - } - - i = spaceNodesToRemove.length; - while (--i > -1) { - spaceNodesToRemove[i].parentNode.removeChild(spaceNodesToRemove[i]); - } - - if (lines) { - //the next 7 lines just give us the line width in the most reliable way and figure out the left offset (if position isn't relative or absolute). We must set the width along with text-align to ensure everything works properly for various alignments. - if (absolute) { - lineNode = _doc.createElement(tag); - element.appendChild(lineNode); - lineWidth = lineNode.offsetWidth + "px"; - offset = (lineNode.offsetParent === element) ? 0 : element.offsetLeft; - element.removeChild(lineNode); - } - style = element.style.cssText; - element.style.cssText = "display:none;"; //to improve performance, set display:none on the element so that the browser doesn't have to worry about reflowing or rendering while we're renesting things. We'll revert the cssText later. - //we can't use element.innerHTML = "" because that causes IE to literally delete all the nodes and their content even though we've stored them in an array! So we must loop through the children and remove them. - while (element.firstChild) { - element.removeChild(element.firstChild); - } - addWordSpaces = (wordDelimiter === " " && (!absolute || (!words && !chars))); - for (i = 0; i < lines.length; i++) { - curLine = lines[i]; - lineNode = _doc.createElement(tag); - lineNode.style.cssText = "display:block;text-align:" + textAlign + ";position:" + (absolute ? "absolute;" : "relative;"); - if (linesClass) { - lineNode.className = linesClass + (iterateLine ? i+1 : ""); - } - lineArray.push(lineNode); - l = curLine.length; - for (j = 0; j < l; j++) { - if (curLine[j].nodeName !== "BR") { - node = curLine[j]; - lineNode.appendChild(node); - if (addWordSpaces && node._wordEnd) { - lineNode.appendChild(_doc.createTextNode(" ")); - } - if (absolute) { - if (j === 0) { - lineNode.style.top = (node._y) + "px"; - lineNode.style.left = (paddingLeft + offset) + "px"; - } - node.style.top = "0px"; - if (offset) { - node.style.left = (node._x - offset) + "px"; - } - } - } - } - if (l === 0) { //if there are no nodes in the line (typically meaning there were two consecutive
tags, just add a non-breaking space so that things display properly. - lineNode.innerHTML = " "; - } else if (!words && !chars) { - _deWordify(lineNode); - _swapText(lineNode, String.fromCharCode(160), " "); - } - if (absolute) { - lineNode.style.width = lineWidth; - lineNode.style.height = node._h + "px"; - } - element.appendChild(lineNode); - } - element.style.cssText = style; - } - - //if everything shifts to being position:absolute, the container can collapse in terms of height or width, so fix that here. - if (absolute) { - if (origHeight > element.clientHeight) { - element.style.height = (origHeight - padTopAndBottom) + "px"; - if (element.clientHeight < origHeight) { //IE8 and earlier use a different box model - we must include padding and borders - element.style.height = (origHeight + borderTopAndBottom)+ "px"; - } - } - if (origWidth > element.clientWidth) { - element.style.width = (origWidth - padLeftAndRight) + "px"; - if (element.clientWidth < origWidth) { //IE8 and earlier use a different box model - we must include padding and borders - element.style.width = (origWidth + borderLeftAndRight)+ "px"; - } - } - } - _pushReversed(allChars, charArray); - if (words) { - _pushReversed(allWords, wordArray); - } - _pushReversed(allLines, lineArray); - }, - _splitRawText = function(element, vars, wordStart, charStart) { - var tag = vars.tag ? vars.tag : (vars.span ? "span" : "div"), - types = vars.type || vars.split || "chars,words,lines", - //words = (types.indexOf("words") !== -1), - chars = (types.indexOf("chars") !== -1), - absolute = (vars.position === "absolute" || vars.absolute === true), - wordDelimiter = vars.wordDelimiter || " ", - space = wordDelimiter !== " " ? "" : (absolute ? "­ " : " "), - wordEnd = "", - wordIsOpen = true, - specialChars = vars.specialChars ? (typeof(vars.specialChars) === "function" ? vars.specialChars : _findSpecialChars) : null, //specialChars can be an array or a function. For performance reasons, we always set this local "specialChars" to a function to which we pass the remaining text and whatever the original vars.specialChars was so that if it's an array, it works with the _findSpecialChars() function. - text, splitText, i, j, l, character, hasTagStart, emojiPair1, emojiPair2, testResult, - container = _doc.createElement("div"), - parent = element.parentNode; - - parent.insertBefore(container, element); - container.textContent = element.nodeValue; - parent.removeChild(element); - element = container; - text = _getText(element); - hasTagStart = text.indexOf("<") !== -1; - - if (vars.reduceWhiteSpace !== false) { - text = text.replace(_multipleSpacesExp, " ").replace(_stripExp, ""); - } - if (hasTagStart) { - text = text.split("<").join("{{LT}}"); //we can't leave "<" in the string, or when we set the innerHTML, it can be interpreted as a node - } - l = text.length; - splitText = ((text.charAt(0) === " ") ? space : "") + wordStart(); - for (i = 0; i < l; i++) { - character = text.charAt(i); - if (specialChars && (testResult = specialChars(text.substr(i), vars.specialChars))) { // look for any specialChars that were declared. Remember, they can be passed in like {specialChars:["मी", "पा", "है"]} or a function could be defined instead. Either way, the function should return the number of characters that should be grouped together for this "character". - character = text.substr(i, testResult || 1); - splitText += (chars && character !== " ") ? charStart() + character + "" : character; - i += testResult - 1; - - } else if (character === wordDelimiter && text.charAt(i-1) !== wordDelimiter && i) { - splitText += wordIsOpen ? wordEnd : ""; - wordIsOpen = false; - while (text.charAt(i + 1) === wordDelimiter) { //skip over empty spaces (to avoid making them words) - splitText += space; - i++; - } - if (i === l-1) { - splitText += space; - } else if (text.charAt(i + 1) !== ")") { - splitText += space + wordStart(); - wordIsOpen = true; - } - - } else if (character === "{" && text.substr(i, 6) === "{{LT}}") { - splitText += chars ? charStart() + "{{LT}}" + "" : "{{LT}}"; - i += 5; - - } else if ((character.charCodeAt(0) >= _emojiStart && character.charCodeAt(0) <= _emojiEnd) || (text.charCodeAt(i+1) >= 0xFE00 && text.charCodeAt(i+1) <= 0xFE0F)) { //special emoji characters use 2 or 4 unicode characters that we must keep together. - emojiPair1 = _emojiPairCode(text.substr(i, 2)); - emojiPair2 = _emojiPairCode(text.substr(i + 2, 2)); - j = ((emojiPair1 >= _emojiRegionStart && emojiPair1 <= _emojiRegionEnd && emojiPair2 >= _emojiRegionStart && emojiPair2 <= _emojiRegionEnd) || (emojiPair2 >= _emojiModStart && emojiPair2 <= _emojiModEnd)) ? 4 : 2; - splitText += (chars && character !== " ") ? charStart() + text.substr(i, j) + "" : text.substr(i, j); - i += j - 1; - } else { - splitText += (chars && character !== " ") ? charStart() + character + "" : character; - } - } - element.outerHTML = splitText + (wordIsOpen ? wordEnd : ""); - if (hasTagStart) { - _swapText(parent, "{{LT}}", "<"); //note: don't perform this on "element" because that gets replaced with all new elements when we set element.outerHTML. - } - }, - _split = function(element, vars, wordStart, charStart) { - var children = _slice(element.childNodes), - l = children.length, - absolute = (vars.position === "absolute" || vars.absolute === true), - i, child; - if (element.nodeType !== 3 || l > 1) { - vars.absolute = false; - for (i = 0; i < l; i++) { - child = children[i]; - if (child.nodeType !== 3 || /\S+/.test(child.nodeValue)) { - if (absolute && child.nodeType !== 3 && _getStyle(child, "display", null, true) === "inline") { //if there's a child node that's display:inline, switch it to inline-block so that absolute positioning works properly (most browsers don't report offsetTop/offsetLeft properly inside a for example) - child.style.display = "inline-block"; - child.style.position = "relative"; - } - child._isSplit = true; - _split(child, vars, wordStart, charStart); //don't split lines on child elements - } - } - vars.absolute = absolute; - element._isSplit = true; - return; - } - _splitRawText(element, vars, wordStart, charStart); - - }, - p = SplitText.prototype; - - p.split = function(vars) { - if (this.isSplit) { - this.revert(); - } - this.vars = vars = vars || this.vars; - this._originals.length = this.chars.length = this.words.length = this.lines.length = 0; - var i = this.elements.length, - tag = vars.tag ? vars.tag : (vars.span ? "span" : "div"), - wordStart = _cssClassFunc(vars.wordsClass, tag), - charStart = _cssClassFunc(vars.charsClass, tag), - origHeight, origWidth, e; - //we split in reversed order so that if/when we position:absolute elements, they don't affect the position of the ones after them in the document flow (shifting them up as they're taken out of the document flow). - while (--i > -1) { - e = this.elements[i]; - this._originals[i] = e.innerHTML; - origHeight = e.clientHeight; - origWidth = e.clientWidth; - _split(e, vars, wordStart, charStart); - _setPositionsAfterSplit(e, vars, this.chars, this.words, this.lines, origWidth, origHeight); - } - this.chars.reverse(); - this.words.reverse(); - this.lines.reverse(); - this.isSplit = true; - return this; - }; - - p.revert = function() { - if (!this._originals) { - throw("revert() call wasn't scoped properly."); - } - var i = this._originals.length; - while (--i > -1) { - this.elements[i].innerHTML = this._originals[i]; - } - this.chars = []; - this.words = []; - this.lines = []; - this.isSplit = false; - return this; - }; - - SplitText.selector = window.$ || window.jQuery || function(e) { - var selector = window.$ || window.jQuery; - if (selector) { - SplitText.selector = selector; - return selector(e); - } - return (typeof(document) === "undefined") ? e : (document.querySelectorAll ? document.querySelectorAll(e) : document.getElementById((e.charAt(0) === "#") ? e.substr(1) : e)); - }; - SplitText.version = "0.7.0"; - -})(_gsScope); - -//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) -(function(name) { - "use strict"; - var getGlobal = function() { - return (_gsScope.GreenSockGlobals || _gsScope)[name]; - }; - if (typeof(module) !== "undefined" && module.exports) { //node - module.exports = getGlobal(); - } else if (typeof(define) === "function" && define.amd) { //AMD - define([], getGlobal); - } -}("SplitText")); +}()); /*! * VERSION: 0.17.0 * DATE: 2019-02-12 @@ -133615,6 +124130,9490 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa define(["TweenLite", "TimelineLite", "CSSPlugin"], getGlobal); } }("GSDevTools")); +/*! + * VERSION: 0.7.0 + * DATE: 2019-02-07 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * SplitText is a Club GreenSock membership benefit; You must have a valid membership to use + * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. + * This work is subject to the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(function(window) { + + "use strict"; + var _globals = window.GreenSockGlobals || window, + _namespace = function(ns) { + var a = ns.split("."), + p = _globals, i; + for (i = 0; i < a.length; i++) { + p[a[i]] = p = p[a[i]] || {}; + } + return p; + }, + pkg = _namespace("com.greensock.utils"), + _getText = function(e) { + var type = e.nodeType, + result = ""; + if (type === 1 || type === 9 || type === 11) { + if (typeof(e.textContent) === "string") { + return e.textContent; + } else { + for ( e = e.firstChild; e; e = e.nextSibling ) { + result += _getText(e); + } + } + } else if (type === 3 || type === 4) { + return e.nodeValue; + } + return result; + }, + _doc = _gsScope.document || {}, + _computedStyleScope = (typeof(window) !== "undefined" ? window : _doc.defaultView || {getComputedStyle:function() {}}), + _getComputedStyle = function(e) { + return _computedStyleScope.getComputedStyle(e); //to avoid errors in Microsoft Edge, we need to call getComputedStyle() from a specific scope, typically window. + }, + _capsExp = /([A-Z])/g, + _getStyle = function(t, p, cs, str) { + var result; + if ((cs = cs || _getComputedStyle(t, null))) { + t = cs.getPropertyValue(p.replace(_capsExp, "-$1").toLowerCase()); + result = (t || cs.length) ? t : cs[p]; //Opera behaves VERY strangely - length is usually 0 and cs[p] is the only way to get accurate results EXCEPT when checking for -o-transform which only works with cs.getPropertyValue()! + } else if (t.currentStyle) { + cs = t.currentStyle; + result = cs[p]; + } + return str ? result : parseInt(result, 10) || 0; + }, + _isArrayLike = function(e) { + return (e.length && e[0] && ((e[0].nodeType && e[0].style && !e.nodeType) || (e[0].length && e[0][0]))) ? true : false; //could be an array of jQuery objects too, so accommodate that. + }, + _flattenArray = function(a) { + var result = [], + l = a.length, + i, e, j; + for (i = 0; i < l; i++) { + e = a[i]; + if (_isArrayLike(e)) { + j = e.length; + for (j = 0; j < e.length; j++) { + result.push(e[j]); + } + } else { + result.push(e); + } + } + return result; + }, + //some characters are combining marks (think diacritics/accents in European languages) which involve 2 or 4 characters that combine in the browser to form a single character. Pass in the remaining text and an array of the special characters to search for and if the text starts with one of those special characters, it'll spit back the number of characters to retain (often 2 or 4). Used in the specialChars features that was introduced in 0.6.0. + _findSpecialChars = function(text, chars) { + var i = chars.length, + s; + while (--i > -1) { + s = chars[i]; + if (text.substr(0, s.length) === s) { + return s.length; + } + } + }, + _stripExp = /(?:\r|\n|\t\t)/g, //find carriage returns, new line feeds and double-tabs. + _multipleSpacesExp = /(?:\s\s+)/g, + _emojiStart = 0xD800, + _emojiEnd = 0xDBFF, + _emojiLowStart = 0xDC00, + _emojiRegionStart = 0x1F1E6, + _emojiRegionEnd = 0x1F1FF, + _emojiModStart = 0x1f3fb, + _emojiModEnd = 0x1f3ff, + _emojiPairCode = function(s) { + return ((s.charCodeAt(0) - _emojiStart) << 10) + (s.charCodeAt(1) - _emojiLowStart) + 0x10000; + }, + _isOldIE = (_doc.all && !_doc.addEventListener), + _divStart = " style='position:relative;display:inline-block;" + (_isOldIE ? "*display:inline;*zoom:1;'" : "'"), //note: we must use both display:inline-block and *display:inline for IE8 and earlier, otherwise it won't flow correctly (and if we only use display:inline, IE won't render most of the property tweens - very odd). + _cssClassFunc = function(cssClass, tag) { + cssClass = cssClass || ""; + var iterate = (cssClass.indexOf("++") !== -1), + num = 1; + if (iterate) { + cssClass = cssClass.split("++").join(""); + } + return function() { + return "<" + tag + _divStart + (cssClass ? " class='" + cssClass + (iterate ? num++ : "") + "'>" : ">"); + }; + }, + SplitText = pkg.SplitText = _globals.SplitText = function(element, vars) { + if (typeof(element) === "string") { + element = SplitText.selector(element); + } + if (!element) { + throw("cannot split a null element."); + } + this.elements = _isArrayLike(element) ? _flattenArray(element) : [element]; + this.chars = []; + this.words = []; + this.lines = []; + this._originals = []; + this.vars = vars || {}; + this.split(vars); + }, + _swapText = function(element, oldText, newText) { + var type = element.nodeType; + if (type === 1 || type === 9 || type === 11) { + for (element = element.firstChild; element; element = element.nextSibling) { + _swapText(element, oldText, newText); + } + } else if (type === 3 || type === 4) { + element.nodeValue = element.nodeValue.split(oldText).join(newText); + } + }, + _pushReversed = function(a, merge) { + var i = merge.length; + while (--i > -1) { + a.push(merge[i]); + } + }, + _slice = function(a) { //don't use Array.prototype.slice.call(target, 0) because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll() + var b = [], + l = a.length, + i; + for (i = 0; i !== l; b.push(a[i++])) {} + return b; + }, + _isBeforeWordDelimiter = function(e, root, wordDelimiter) { + var next; + while (e && e !== root) { + next = e._next || e.nextSibling; + if (next) { + return next.textContent.charAt(0) === wordDelimiter; + } + e = e.parentNode || e._parent; + } + return false; + }, + _deWordify = function(e) { + var children = _slice(e.childNodes), + l = children.length, + i, child; + for (i = 0; i < l; i++) { + child = children[i]; + if (child._isSplit) { + _deWordify(child); + } else { + if (i && child.previousSibling.nodeType === 3) { + child.previousSibling.nodeValue += (child.nodeType === 3) ? child.nodeValue : child.firstChild.nodeValue; + } else if (child.nodeType !== 3) { + e.insertBefore(child.firstChild, child); + } + e.removeChild(child); + } + } + }, + _setPositionsAfterSplit = function(element, vars, allChars, allWords, allLines, origWidth, origHeight) { + var cs = _getComputedStyle(element), + paddingLeft = _getStyle(element, "paddingLeft", cs), + lineOffsetY = -999, + borderTopAndBottom = _getStyle(element, "borderBottomWidth", cs) + _getStyle(element, "borderTopWidth", cs), + borderLeftAndRight = _getStyle(element, "borderLeftWidth", cs) + _getStyle(element, "borderRightWidth", cs), + padTopAndBottom = _getStyle(element, "paddingTop", cs) + _getStyle(element, "paddingBottom", cs), + padLeftAndRight = _getStyle(element, "paddingLeft", cs) + _getStyle(element, "paddingRight", cs), + lineThreshold = _getStyle(element, "fontSize") * 0.2, + textAlign = _getStyle(element, "textAlign", cs, true), + charArray = [], + wordArray = [], + lineArray = [], + wordDelimiter = vars.wordDelimiter || " ", + tag = vars.tag ? vars.tag : (vars.span ? "span" : "div"), + types = vars.type || vars.split || "chars,words,lines", + lines = (allLines && types.indexOf("lines") !== -1) ? [] : null, + words = (types.indexOf("words") !== -1), + chars = (types.indexOf("chars") !== -1), + absolute = (vars.position === "absolute" || vars.absolute === true), + linesClass = vars.linesClass, + iterateLine = ((linesClass || "").indexOf("++") !== -1), + spaceNodesToRemove = [], + i, j, l, node, nodes, isChild, curLine, addWordSpaces, style, lineNode, lineWidth, offset; + if (iterateLine) { + linesClass = linesClass.split("++").join(""); + } + + //copy all the descendant nodes into an array (we can't use a regular nodeList because it's live and we may need to renest things) + j = element.getElementsByTagName("*"); + l = j.length; + nodes = []; + for (i = 0; i < l; i++) { + nodes[i] = j[i]; + } + + //for absolute positioning, we need to record the x/y offsets and width/height for every
. And even if we're not positioning things absolutely, in order to accommodate lines, we must figure out where the y offset changes so that we can sense where the lines break, and we populate the lines array. + if (lines || absolute) { + for (i = 0; i < l; i++) { + node = nodes[i]; + isChild = (node.parentNode === element); + if (isChild || absolute || (chars && !words)) { + offset = node.offsetTop; + if (lines && isChild && Math.abs(offset - lineOffsetY) > lineThreshold && (node.nodeName !== "BR" || i === 0)) { //we found some rare occasions where a certain character like ‑ could cause the offsetTop to be off by 1 pixel, so we build in a threshold. + curLine = []; + lines.push(curLine); + lineOffsetY = offset; + } + if (absolute) { //record offset x and y, as well as width and height so that we can access them later for positioning. Grabbing them at once ensures we don't trigger a browser paint & we maximize performance. + node._x = node.offsetLeft; + node._y = offset; + node._w = node.offsetWidth; + node._h = node.offsetHeight; + } + if (lines) { + if ((node._isSplit && isChild) || (!chars && isChild) || (words && isChild) || (!words && node.parentNode.parentNode === element && !node.parentNode._isSplit)) { + curLine.push(node); + node._x -= paddingLeft; + if (_isBeforeWordDelimiter(node, element, wordDelimiter)) { + node._wordEnd = true; + } + } + if (node.nodeName === "BR" && ((node.nextSibling && node.nextSibling.nodeName === "BR") || i === 0)) { //two consecutive
tags signify a new [empty] line. Also, if the entire block of content STARTS with a
, add a line. + lines.push([]); + } + } + } + } + } + + for (i = 0; i < l; i++) { + node = nodes[i]; + isChild = (node.parentNode === element); + if (node.nodeName === "BR") { + if (lines || absolute) { + if (node.parentNode) { + node.parentNode.removeChild(node); + } + nodes.splice(i--, 1); + l--; + } else if (!words) { + element.appendChild(node); + } + continue; + } + + if (absolute) { + style = node.style; + if (!words && !isChild) { + node._x += node.parentNode._x; + node._y += node.parentNode._y; + } + style.left = node._x + "px"; + style.top = node._y + "px"; + style.position = "absolute"; + style.display = "block"; + //if we don't set the width/height, things collapse in older versions of IE and the origin for transforms is thrown off in all browsers. + style.width = (node._w + 1) + "px"; //IE is 1px short sometimes. Avoid wrapping + style.height = node._h + "px"; + } + + if (!words && chars) { + //we always start out wrapping words in their own
so that line breaks happen correctly, but here we'll remove those
tags if necessary and renest the characters directly into the element rather than inside the word
+ if (node._isSplit) { + node._next = node.nextSibling; + node.parentNode.appendChild(node); //put it at the end to keep the order correct. + + } else if (node.parentNode._isSplit) { + node._parent = node.parentNode; + if (!node.previousSibling && node.firstChild) { + node.firstChild._isFirst = true; + } + if (node.nextSibling && node.nextSibling.textContent === " " && !node.nextSibling.nextSibling) { //if the last node inside a nested element is just a space (like Tnested ), remove it otherwise it'll get placed in the wrong order. Don't remove it right away, though, because we need to sense when words/characters are before a space like _isBeforeWordDelimiter(). Removing it now would make that a false negative. + spaceNodesToRemove.push(node.nextSibling); + } + node._next = (node.nextSibling && node.nextSibling._isFirst) ? null : node.nextSibling; + node.parentNode.removeChild(node); + nodes.splice(i--, 1); + l--; + } else if (!isChild) { + offset = (!node.nextSibling && _isBeforeWordDelimiter(node.parentNode, element, wordDelimiter)); //if this is the last letter in the word (and we're not breaking by lines and not positioning things absolutely), we need to add a space afterwards so that the characters don't just mash together + if (node.parentNode._parent) { + node.parentNode._parent.appendChild(node); + } + if (offset) { + node.parentNode.appendChild(_doc.createTextNode(" ")); + } + if (tag === "span") { + node.style.display = "inline"; //so that word breaks are honored properly. + } + charArray.push(node); + } + } else if (node.parentNode._isSplit && !node._isSplit && node.innerHTML !== "") { + wordArray.push(node); + } else if (chars && !node._isSplit) { + if (tag === "span") { + node.style.display = "inline"; + } + charArray.push(node); + } + } + + i = spaceNodesToRemove.length; + while (--i > -1) { + spaceNodesToRemove[i].parentNode.removeChild(spaceNodesToRemove[i]); + } + + if (lines) { + //the next 7 lines just give us the line width in the most reliable way and figure out the left offset (if position isn't relative or absolute). We must set the width along with text-align to ensure everything works properly for various alignments. + if (absolute) { + lineNode = _doc.createElement(tag); + element.appendChild(lineNode); + lineWidth = lineNode.offsetWidth + "px"; + offset = (lineNode.offsetParent === element) ? 0 : element.offsetLeft; + element.removeChild(lineNode); + } + style = element.style.cssText; + element.style.cssText = "display:none;"; //to improve performance, set display:none on the element so that the browser doesn't have to worry about reflowing or rendering while we're renesting things. We'll revert the cssText later. + //we can't use element.innerHTML = "" because that causes IE to literally delete all the nodes and their content even though we've stored them in an array! So we must loop through the children and remove them. + while (element.firstChild) { + element.removeChild(element.firstChild); + } + addWordSpaces = (wordDelimiter === " " && (!absolute || (!words && !chars))); + for (i = 0; i < lines.length; i++) { + curLine = lines[i]; + lineNode = _doc.createElement(tag); + lineNode.style.cssText = "display:block;text-align:" + textAlign + ";position:" + (absolute ? "absolute;" : "relative;"); + if (linesClass) { + lineNode.className = linesClass + (iterateLine ? i+1 : ""); + } + lineArray.push(lineNode); + l = curLine.length; + for (j = 0; j < l; j++) { + if (curLine[j].nodeName !== "BR") { + node = curLine[j]; + lineNode.appendChild(node); + if (addWordSpaces && node._wordEnd) { + lineNode.appendChild(_doc.createTextNode(" ")); + } + if (absolute) { + if (j === 0) { + lineNode.style.top = (node._y) + "px"; + lineNode.style.left = (paddingLeft + offset) + "px"; + } + node.style.top = "0px"; + if (offset) { + node.style.left = (node._x - offset) + "px"; + } + } + } + } + if (l === 0) { //if there are no nodes in the line (typically meaning there were two consecutive
tags, just add a non-breaking space so that things display properly. + lineNode.innerHTML = " "; + } else if (!words && !chars) { + _deWordify(lineNode); + _swapText(lineNode, String.fromCharCode(160), " "); + } + if (absolute) { + lineNode.style.width = lineWidth; + lineNode.style.height = node._h + "px"; + } + element.appendChild(lineNode); + } + element.style.cssText = style; + } + + //if everything shifts to being position:absolute, the container can collapse in terms of height or width, so fix that here. + if (absolute) { + if (origHeight > element.clientHeight) { + element.style.height = (origHeight - padTopAndBottom) + "px"; + if (element.clientHeight < origHeight) { //IE8 and earlier use a different box model - we must include padding and borders + element.style.height = (origHeight + borderTopAndBottom)+ "px"; + } + } + if (origWidth > element.clientWidth) { + element.style.width = (origWidth - padLeftAndRight) + "px"; + if (element.clientWidth < origWidth) { //IE8 and earlier use a different box model - we must include padding and borders + element.style.width = (origWidth + borderLeftAndRight)+ "px"; + } + } + } + _pushReversed(allChars, charArray); + if (words) { + _pushReversed(allWords, wordArray); + } + _pushReversed(allLines, lineArray); + }, + _splitRawText = function(element, vars, wordStart, charStart) { + var tag = vars.tag ? vars.tag : (vars.span ? "span" : "div"), + types = vars.type || vars.split || "chars,words,lines", + //words = (types.indexOf("words") !== -1), + chars = (types.indexOf("chars") !== -1), + absolute = (vars.position === "absolute" || vars.absolute === true), + wordDelimiter = vars.wordDelimiter || " ", + space = wordDelimiter !== " " ? "" : (absolute ? "­ " : " "), + wordEnd = "", + wordIsOpen = true, + specialChars = vars.specialChars ? (typeof(vars.specialChars) === "function" ? vars.specialChars : _findSpecialChars) : null, //specialChars can be an array or a function. For performance reasons, we always set this local "specialChars" to a function to which we pass the remaining text and whatever the original vars.specialChars was so that if it's an array, it works with the _findSpecialChars() function. + text, splitText, i, j, l, character, hasTagStart, emojiPair1, emojiPair2, testResult, + container = _doc.createElement("div"), + parent = element.parentNode; + + parent.insertBefore(container, element); + container.textContent = element.nodeValue; + parent.removeChild(element); + element = container; + text = _getText(element); + hasTagStart = text.indexOf("<") !== -1; + + if (vars.reduceWhiteSpace !== false) { + text = text.replace(_multipleSpacesExp, " ").replace(_stripExp, ""); + } + if (hasTagStart) { + text = text.split("<").join("{{LT}}"); //we can't leave "<" in the string, or when we set the innerHTML, it can be interpreted as a node + } + l = text.length; + splitText = ((text.charAt(0) === " ") ? space : "") + wordStart(); + for (i = 0; i < l; i++) { + character = text.charAt(i); + if (specialChars && (testResult = specialChars(text.substr(i), vars.specialChars))) { // look for any specialChars that were declared. Remember, they can be passed in like {specialChars:["मी", "पा", "है"]} or a function could be defined instead. Either way, the function should return the number of characters that should be grouped together for this "character". + character = text.substr(i, testResult || 1); + splitText += (chars && character !== " ") ? charStart() + character + "" : character; + i += testResult - 1; + + } else if (character === wordDelimiter && text.charAt(i-1) !== wordDelimiter && i) { + splitText += wordIsOpen ? wordEnd : ""; + wordIsOpen = false; + while (text.charAt(i + 1) === wordDelimiter) { //skip over empty spaces (to avoid making them words) + splitText += space; + i++; + } + if (i === l-1) { + splitText += space; + } else if (text.charAt(i + 1) !== ")") { + splitText += space + wordStart(); + wordIsOpen = true; + } + + } else if (character === "{" && text.substr(i, 6) === "{{LT}}") { + splitText += chars ? charStart() + "{{LT}}" + "" : "{{LT}}"; + i += 5; + + } else if ((character.charCodeAt(0) >= _emojiStart && character.charCodeAt(0) <= _emojiEnd) || (text.charCodeAt(i+1) >= 0xFE00 && text.charCodeAt(i+1) <= 0xFE0F)) { //special emoji characters use 2 or 4 unicode characters that we must keep together. + emojiPair1 = _emojiPairCode(text.substr(i, 2)); + emojiPair2 = _emojiPairCode(text.substr(i + 2, 2)); + j = ((emojiPair1 >= _emojiRegionStart && emojiPair1 <= _emojiRegionEnd && emojiPair2 >= _emojiRegionStart && emojiPair2 <= _emojiRegionEnd) || (emojiPair2 >= _emojiModStart && emojiPair2 <= _emojiModEnd)) ? 4 : 2; + splitText += (chars && character !== " ") ? charStart() + text.substr(i, j) + "" : text.substr(i, j); + i += j - 1; + } else { + splitText += (chars && character !== " ") ? charStart() + character + "" : character; + } + } + element.outerHTML = splitText + (wordIsOpen ? wordEnd : ""); + if (hasTagStart) { + _swapText(parent, "{{LT}}", "<"); //note: don't perform this on "element" because that gets replaced with all new elements when we set element.outerHTML. + } + }, + _split = function(element, vars, wordStart, charStart) { + var children = _slice(element.childNodes), + l = children.length, + absolute = (vars.position === "absolute" || vars.absolute === true), + i, child; + if (element.nodeType !== 3 || l > 1) { + vars.absolute = false; + for (i = 0; i < l; i++) { + child = children[i]; + if (child.nodeType !== 3 || /\S+/.test(child.nodeValue)) { + if (absolute && child.nodeType !== 3 && _getStyle(child, "display", null, true) === "inline") { //if there's a child node that's display:inline, switch it to inline-block so that absolute positioning works properly (most browsers don't report offsetTop/offsetLeft properly inside a for example) + child.style.display = "inline-block"; + child.style.position = "relative"; + } + child._isSplit = true; + _split(child, vars, wordStart, charStart); //don't split lines on child elements + } + } + vars.absolute = absolute; + element._isSplit = true; + return; + } + _splitRawText(element, vars, wordStart, charStart); + + }, + p = SplitText.prototype; + + p.split = function(vars) { + if (this.isSplit) { + this.revert(); + } + this.vars = vars = vars || this.vars; + this._originals.length = this.chars.length = this.words.length = this.lines.length = 0; + var i = this.elements.length, + tag = vars.tag ? vars.tag : (vars.span ? "span" : "div"), + wordStart = _cssClassFunc(vars.wordsClass, tag), + charStart = _cssClassFunc(vars.charsClass, tag), + origHeight, origWidth, e; + //we split in reversed order so that if/when we position:absolute elements, they don't affect the position of the ones after them in the document flow (shifting them up as they're taken out of the document flow). + while (--i > -1) { + e = this.elements[i]; + this._originals[i] = e.innerHTML; + origHeight = e.clientHeight; + origWidth = e.clientWidth; + _split(e, vars, wordStart, charStart); + _setPositionsAfterSplit(e, vars, this.chars, this.words, this.lines, origWidth, origHeight); + } + this.chars.reverse(); + this.words.reverse(); + this.lines.reverse(); + this.isSplit = true; + return this; + }; + + p.revert = function() { + if (!this._originals) { + throw("revert() call wasn't scoped properly."); + } + var i = this._originals.length; + while (--i > -1) { + this.elements[i].innerHTML = this._originals[i]; + } + this.chars = []; + this.words = []; + this.lines = []; + this.isSplit = false; + return this; + }; + + SplitText.selector = window.$ || window.jQuery || function(e) { + var selector = window.$ || window.jQuery; + if (selector) { + SplitText.selector = selector; + return selector(e); + } + return (typeof(document) === "undefined") ? e : (document.querySelectorAll ? document.querySelectorAll(e) : document.getElementById((e.charAt(0) === "#") ? e.substr(1) : e)); + }; + SplitText.version = "0.7.0"; + +})(_gsScope); + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define([], getGlobal); + } +}("SplitText")); +/*! + * VERSION: 0.6.1 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + _gsScope._gsDefine.plugin({ + propName: "attr", + API: 2, + version: "0.6.1", + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween, index) { + var p, end; + if (typeof(target.setAttribute) !== "function") { + return false; + } + for (p in value) { + end = value[p]; + if (typeof(end) === "function") { + end = end(index, target); + } + this._addTween(target, "setAttribute", target.getAttribute(p) + "", end + "", p, false, p); + this._overwriteProps.push(p); + } + return true; + } + + }); + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("AttrPlugin")); +/*! + * VERSION: 1.3.8 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + **/ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _RAD2DEG = 180 / Math.PI, + _r1 = [], + _r2 = [], + _r3 = [], + _corProps = {}, + _globals = _gsScope._gsDefine.globals, + Segment = function(a, b, c, d) { + if (c === d) { //if c and d match, the final autoRotate value could lock at -90 degrees, so differentiate them slightly. + c = d - (d - b) / 1000000; + } + if (a === b) { //if a and b match, the starting autoRotate value could lock at -90 degrees, so differentiate them slightly. + b = a + (c - a) / 1000000; + } + this.a = a; + this.b = b; + this.c = c; + this.d = d; + this.da = d - a; + this.ca = c - a; + this.ba = b - a; + }, + _correlate = ",x,y,z,left,top,right,bottom,marginTop,marginLeft,marginRight,marginBottom,paddingLeft,paddingTop,paddingRight,paddingBottom,backgroundPosition,backgroundPosition_y,", + cubicToQuadratic = function(a, b, c, d) { + var q1 = {a:a}, + q2 = {}, + q3 = {}, + q4 = {c:d}, + mab = (a + b) / 2, + mbc = (b + c) / 2, + mcd = (c + d) / 2, + mabc = (mab + mbc) / 2, + mbcd = (mbc + mcd) / 2, + m8 = (mbcd - mabc) / 8; + q1.b = mab + (a - mab) / 4; + q2.b = mabc + m8; + q1.c = q2.a = (q1.b + q2.b) / 2; + q2.c = q3.a = (mabc + mbcd) / 2; + q3.b = mbcd - m8; + q4.b = mcd + (d - mcd) / 4; + q3.c = q4.a = (q3.b + q4.b) / 2; + return [q1, q2, q3, q4]; + }, + _calculateControlPoints = function(a, curviness, quad, basic, correlate) { + var l = a.length - 1, + ii = 0, + cp1 = a[0].a, + i, p1, p2, p3, seg, m1, m2, mm, cp2, qb, r1, r2, tl; + for (i = 0; i < l; i++) { + seg = a[ii]; + p1 = seg.a; + p2 = seg.d; + p3 = a[ii+1].d; + + if (correlate) { + r1 = _r1[i]; + r2 = _r2[i]; + tl = ((r2 + r1) * curviness * 0.25) / (basic ? 0.5 : _r3[i] || 0.5); + m1 = p2 - (p2 - p1) * (basic ? curviness * 0.5 : (r1 !== 0 ? tl / r1 : 0)); + m2 = p2 + (p3 - p2) * (basic ? curviness * 0.5 : (r2 !== 0 ? tl / r2 : 0)); + mm = p2 - (m1 + (((m2 - m1) * ((r1 * 3 / (r1 + r2)) + 0.5) / 4) || 0)); + } else { + m1 = p2 - (p2 - p1) * curviness * 0.5; + m2 = p2 + (p3 - p2) * curviness * 0.5; + mm = p2 - (m1 + m2) / 2; + } + m1 += mm; + m2 += mm; + + seg.c = cp2 = m1; + if (i !== 0) { + seg.b = cp1; + } else { + seg.b = cp1 = seg.a + (seg.c - seg.a) * 0.6; //instead of placing b on a exactly, we move it inline with c so that if the user specifies an ease like Back.easeIn or Elastic.easeIn which goes BEYOND the beginning, it will do so smoothly. + } + + seg.da = p2 - p1; + seg.ca = cp2 - p1; + seg.ba = cp1 - p1; + + if (quad) { + qb = cubicToQuadratic(p1, cp1, cp2, p2); + a.splice(ii, 1, qb[0], qb[1], qb[2], qb[3]); + ii += 4; + } else { + ii++; + } + + cp1 = m2; + } + seg = a[ii]; + seg.b = cp1; + seg.c = cp1 + (seg.d - cp1) * 0.4; //instead of placing c on d exactly, we move it inline with b so that if the user specifies an ease like Back.easeOut or Elastic.easeOut which goes BEYOND the end, it will do so smoothly. + seg.da = seg.d - seg.a; + seg.ca = seg.c - seg.a; + seg.ba = cp1 - seg.a; + if (quad) { + qb = cubicToQuadratic(seg.a, cp1, seg.c, seg.d); + a.splice(ii, 1, qb[0], qb[1], qb[2], qb[3]); + } + }, + _parseAnchors = function(values, p, correlate, prepend) { + var a = [], + l, i, p1, p2, p3, tmp; + if (prepend) { + values = [prepend].concat(values); + i = values.length; + while (--i > -1) { + if (typeof( (tmp = values[i][p]) ) === "string") if (tmp.charAt(1) === "=") { + values[i][p] = prepend[p] + Number(tmp.charAt(0) + tmp.substr(2)); //accommodate relative values. Do it inline instead of breaking it out into a function for speed reasons + } + } + } + l = values.length - 2; + if (l < 0) { + a[0] = new Segment(values[0][p], 0, 0, values[0][p]); + return a; + } + for (i = 0; i < l; i++) { + p1 = values[i][p]; + p2 = values[i+1][p]; + a[i] = new Segment(p1, 0, 0, p2); + if (correlate) { + p3 = values[i+2][p]; + _r1[i] = (_r1[i] || 0) + (p2 - p1) * (p2 - p1); + _r2[i] = (_r2[i] || 0) + (p3 - p2) * (p3 - p2); + } + } + a[i] = new Segment(values[i][p], 0, 0, values[i+1][p]); + return a; + }, + bezierThrough = function(values, curviness, quadratic, basic, correlate, prepend) { + var obj = {}, + props = [], + first = prepend || values[0], + i, p, a, j, r, l, seamless, last; + correlate = (typeof(correlate) === "string") ? ","+correlate+"," : _correlate; + if (curviness == null) { + curviness = 1; + } + for (p in values[0]) { + props.push(p); + } + //check to see if the last and first values are identical (well, within 0.05). If so, make seamless by appending the second element to the very end of the values array and the 2nd-to-last element to the very beginning (we'll remove those segments later) + if (values.length > 1) { + last = values[values.length - 1]; + seamless = true; + i = props.length; + while (--i > -1) { + p = props[i]; + if (Math.abs(first[p] - last[p]) > 0.05) { //build in a tolerance of +/-0.05 to accommodate rounding errors. + seamless = false; + break; + } + } + if (seamless) { + values = values.concat(); //duplicate the array to avoid contaminating the original which the user may be reusing for other tweens + if (prepend) { + values.unshift(prepend); + } + values.push(values[1]); + prepend = values[values.length - 3]; + } + } + _r1.length = _r2.length = _r3.length = 0; + i = props.length; + while (--i > -1) { + p = props[i]; + _corProps[p] = (correlate.indexOf(","+p+",") !== -1); + obj[p] = _parseAnchors(values, p, _corProps[p], prepend); + } + i = _r1.length; + while (--i > -1) { + _r1[i] = Math.sqrt(_r1[i]); + _r2[i] = Math.sqrt(_r2[i]); + } + if (!basic) { + i = props.length; + while (--i > -1) { + if (_corProps[p]) { + a = obj[props[i]]; + l = a.length - 1; + for (j = 0; j < l; j++) { + r = (a[j+1].da / _r2[j] + a[j].da / _r1[j]) || 0; + _r3[j] = (_r3[j] || 0) + r * r; + } + } + } + i = _r3.length; + while (--i > -1) { + _r3[i] = Math.sqrt(_r3[i]); + } + } + i = props.length; + j = quadratic ? 4 : 1; + while (--i > -1) { + p = props[i]; + a = obj[p]; + _calculateControlPoints(a, curviness, quadratic, basic, _corProps[p]); //this method requires that _parseAnchors() and _setSegmentRatios() ran first so that _r1, _r2, and _r3 values are populated for all properties + if (seamless) { + a.splice(0, j); + a.splice(a.length - j, j); + } + } + return obj; + }, + _parseBezierData = function(values, type, prepend) { + type = type || "soft"; + var obj = {}, + inc = (type === "cubic") ? 3 : 2, + soft = (type === "soft"), + props = [], + a, b, c, d, cur, i, j, l, p, cnt, tmp; + if (soft && prepend) { + values = [prepend].concat(values); + } + if (values == null || values.length < inc + 1) { throw "invalid Bezier data"; } + for (p in values[0]) { + props.push(p); + } + i = props.length; + while (--i > -1) { + p = props[i]; + obj[p] = cur = []; + cnt = 0; + l = values.length; + for (j = 0; j < l; j++) { + a = (prepend == null) ? values[j][p] : (typeof( (tmp = values[j][p]) ) === "string" && tmp.charAt(1) === "=") ? prepend[p] + Number(tmp.charAt(0) + tmp.substr(2)) : Number(tmp); + if (soft) if (j > 1) if (j < l - 1) { + cur[cnt++] = (a + cur[cnt-2]) / 2; + } + cur[cnt++] = a; + } + l = cnt - inc + 1; + cnt = 0; + for (j = 0; j < l; j += inc) { + a = cur[j]; + b = cur[j+1]; + c = cur[j+2]; + d = (inc === 2) ? 0 : cur[j+3]; + cur[cnt++] = tmp = (inc === 3) ? new Segment(a, b, c, d) : new Segment(a, (2 * b + a) / 3, (2 * b + c) / 3, c); + } + cur.length = cnt; + } + return obj; + }, + _addCubicLengths = function(a, steps, resolution) { + var inc = 1 / resolution, + j = a.length, + d, d1, s, da, ca, ba, p, i, inv, bez, index; + while (--j > -1) { + bez = a[j]; + s = bez.a; + da = bez.d - s; + ca = bez.c - s; + ba = bez.b - s; + d = d1 = 0; + for (i = 1; i <= resolution; i++) { + p = inc * i; + inv = 1 - p; + d = d1 - (d1 = (p * p * da + 3 * inv * (p * ca + inv * ba)) * p); + index = j * resolution + i - 1; + steps[index] = (steps[index] || 0) + d * d; + } + } + }, + _parseLengthData = function(obj, resolution) { + resolution = resolution >> 0 || 6; + var a = [], + lengths = [], + d = 0, + total = 0, + threshold = resolution - 1, + segments = [], + curLS = [], //current length segments array + p, i, l, index; + for (p in obj) { + _addCubicLengths(obj[p], a, resolution); + } + l = a.length; + for (i = 0; i < l; i++) { + d += Math.sqrt(a[i]); + index = i % resolution; + curLS[index] = d; + if (index === threshold) { + total += d; + index = (i / resolution) >> 0; + segments[index] = curLS; + lengths[index] = total; + d = 0; + curLS = []; + } + } + return {length:total, lengths:lengths, segments:segments}; + }, + + + + BezierPlugin = _gsScope._gsDefine.plugin({ + propName: "bezier", + priority: -1, + version: "1.3.8", + API: 2, + global:true, + + //gets called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, vars, tween) { + this._target = target; + if (vars instanceof Array) { + vars = {values:vars}; + } + this._func = {}; + this._mod = {}; + this._props = []; + this._timeRes = (vars.timeResolution == null) ? 6 : parseInt(vars.timeResolution, 10); + var values = vars.values || [], + first = {}, + second = values[0], + autoRotate = vars.autoRotate || tween.vars.orientToBezier, + p, isFunc, i, j, prepend; + + this._autoRotate = autoRotate ? (autoRotate instanceof Array) ? autoRotate : [["x","y","rotation",((autoRotate === true) ? 0 : Number(autoRotate) || 0)]] : null; + for (p in second) { + this._props.push(p); + } + + i = this._props.length; + while (--i > -1) { + p = this._props[i]; + + this._overwriteProps.push(p); + isFunc = this._func[p] = (typeof(target[p]) === "function"); + first[p] = (!isFunc) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ](); + if (!prepend) if (first[p] !== values[0][p]) { + prepend = first; + } + } + this._beziers = (vars.type !== "cubic" && vars.type !== "quadratic" && vars.type !== "soft") ? bezierThrough(values, isNaN(vars.curviness) ? 1 : vars.curviness, false, (vars.type === "thruBasic"), vars.correlate, prepend) : _parseBezierData(values, vars.type, first); + this._segCount = this._beziers[p].length; + + if (this._timeRes) { + var ld = _parseLengthData(this._beziers, this._timeRes); + this._length = ld.length; + this._lengths = ld.lengths; + this._segments = ld.segments; + this._l1 = this._li = this._s1 = this._si = 0; + this._l2 = this._lengths[0]; + this._curSeg = this._segments[0]; + this._s2 = this._curSeg[0]; + this._prec = 1 / this._curSeg.length; + } + + if ((autoRotate = this._autoRotate)) { + this._initialRotations = []; + if (!(autoRotate[0] instanceof Array)) { + this._autoRotate = autoRotate = [autoRotate]; + } + i = autoRotate.length; + while (--i > -1) { + for (j = 0; j < 3; j++) { + p = autoRotate[i][j]; + this._func[p] = (typeof(target[p]) === "function") ? target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ] : false; + } + p = autoRotate[i][2]; + this._initialRotations[i] = (this._func[p] ? this._func[p].call(this._target) : this._target[p]) || 0; + this._overwriteProps.push(p); + } + } + this._startRatio = tween.vars.runBackwards ? 1 : 0; //we determine the starting ratio when the tween inits which is always 0 unless the tween has runBackwards:true (indicating it's a from() tween) in which case it's 1. + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(v) { + var segments = this._segCount, + func = this._func, + target = this._target, + notStart = (v !== this._startRatio), + curIndex, inv, i, p, b, t, val, l, lengths, curSeg; + if (!this._timeRes) { + curIndex = (v < 0) ? 0 : (v >= 1) ? segments - 1 : (segments * v) >> 0; + t = (v - (curIndex * (1 / segments))) * segments; + } else { + lengths = this._lengths; + curSeg = this._curSeg; + v *= this._length; + i = this._li; + //find the appropriate segment (if the currently cached one isn't correct) + if (v > this._l2 && i < segments - 1) { + l = segments - 1; + while (i < l && (this._l2 = lengths[++i]) <= v) { } + this._l1 = lengths[i-1]; + this._li = i; + this._curSeg = curSeg = this._segments[i]; + this._s2 = curSeg[(this._s1 = this._si = 0)]; + } else if (v < this._l1 && i > 0) { + while (i > 0 && (this._l1 = lengths[--i]) >= v) { } + if (i === 0 && v < this._l1) { + this._l1 = 0; + } else { + i++; + } + this._l2 = lengths[i]; + this._li = i; + this._curSeg = curSeg = this._segments[i]; + this._s1 = curSeg[(this._si = curSeg.length - 1) - 1] || 0; + this._s2 = curSeg[this._si]; + } + curIndex = i; + //now find the appropriate sub-segment (we split it into the number of pieces that was defined by "precision" and measured each one) + v -= this._l1; + i = this._si; + if (v > this._s2 && i < curSeg.length - 1) { + l = curSeg.length - 1; + while (i < l && (this._s2 = curSeg[++i]) <= v) { } + this._s1 = curSeg[i-1]; + this._si = i; + } else if (v < this._s1 && i > 0) { + while (i > 0 && (this._s1 = curSeg[--i]) >= v) { } + if (i === 0 && v < this._s1) { + this._s1 = 0; + } else { + i++; + } + this._s2 = curSeg[i]; + this._si = i; + } + t = ((i + (v - this._s1) / (this._s2 - this._s1)) * this._prec) || 0; + } + inv = 1 - t; + + i = this._props.length; + while (--i > -1) { + p = this._props[i]; + b = this._beziers[p][curIndex]; + val = (t * t * b.da + 3 * inv * (t * b.ca + inv * b.ba)) * t + b.a; + if (this._mod[p]) { + val = this._mod[p](val, target); + } + if (func[p]) { + target[p](val); + } else { + target[p] = val; + } + } + + if (this._autoRotate) { + var ar = this._autoRotate, + b2, x1, y1, x2, y2, add, conv; + i = ar.length; + while (--i > -1) { + p = ar[i][2]; + add = ar[i][3] || 0; + conv = (ar[i][4] === true) ? 1 : _RAD2DEG; + b = this._beziers[ar[i][0]]; + b2 = this._beziers[ar[i][1]]; + + if (b && b2) { //in case one of the properties got overwritten. + b = b[curIndex]; + b2 = b2[curIndex]; + + x1 = b.a + (b.b - b.a) * t; + x2 = b.b + (b.c - b.b) * t; + x1 += (x2 - x1) * t; + x2 += ((b.c + (b.d - b.c) * t) - x2) * t; + + y1 = b2.a + (b2.b - b2.a) * t; + y2 = b2.b + (b2.c - b2.b) * t; + y1 += (y2 - y1) * t; + y2 += ((b2.c + (b2.d - b2.c) * t) - y2) * t; + + val = notStart ? Math.atan2(y2 - y1, x2 - x1) * conv + add : this._initialRotations[i]; + + if (this._mod[p]) { + val = this._mod[p](val, target); //for modProps + } + + if (func[p]) { + target[p](val); + } else { + target[p] = val; + } + } + } + } + } + }), + p = BezierPlugin.prototype; + + + BezierPlugin.bezierThrough = bezierThrough; + BezierPlugin.cubicToQuadratic = cubicToQuadratic; + BezierPlugin._autoCSS = true; //indicates that this plugin can be inserted into the "css" object using the autoCSS feature of TweenLite + BezierPlugin.quadraticToCubic = function(a, b, c) { + return new Segment(a, (2 * b + a) / 3, (2 * b + c) / 3, c); + }; + + BezierPlugin._cssRegister = function() { + var CSSPlugin = _globals.CSSPlugin; + if (!CSSPlugin) { + return; + } + var _internals = CSSPlugin._internals, + _parseToProxy = _internals._parseToProxy, + _setPluginRatio = _internals._setPluginRatio, + CSSPropTween = _internals.CSSPropTween; + _internals._registerComplexSpecialProp("bezier", {parser:function(t, e, prop, cssp, pt, plugin) { + if (e instanceof Array) { + e = {values:e}; + } + plugin = new BezierPlugin(); + var values = e.values, + l = values.length - 1, + pluginValues = [], + v = {}, + i, p, data; + if (l < 0) { + return pt; + } + for (i = 0; i <= l; i++) { + data = _parseToProxy(t, values[i], cssp, pt, plugin, (l !== i)); + pluginValues[i] = data.end; + } + for (p in e) { + v[p] = e[p]; //duplicate the vars object because we need to alter some things which would cause problems if the user plans to reuse the same vars object for another tween. + } + v.values = pluginValues; + pt = new CSSPropTween(t, "bezier", 0, 0, data.pt, 2); + pt.data = data; + pt.plugin = plugin; + pt.setRatio = _setPluginRatio; + if (v.autoRotate === 0) { + v.autoRotate = true; + } + if (v.autoRotate && !(v.autoRotate instanceof Array)) { + i = (v.autoRotate === true) ? 0 : Number(v.autoRotate); + v.autoRotate = (data.end.left != null) ? [["left","top","rotation",i,false]] : (data.end.x != null) ? [["x","y","rotation",i,false]] : false; + } + if (v.autoRotate) { + if (!cssp._transform) { + cssp._enableTransforms(false); + } + data.autoRotate = cssp._target._gsTransform; + data.proxy.rotation = data.autoRotate.rotation || 0; + cssp._overwriteProps.push("rotation"); + } + plugin._onInitTween(data.proxy, v, cssp._tween); + return pt; + }}); + }; + + p._mod = function(lookup) { + var op = this._overwriteProps, + i = op.length, + val; + while (--i > -1) { + val = lookup[op[i]]; + if (val && typeof(val) === "function") { + this._mod[op[i]] = val; + } + } + }; + + p._kill = function(lookup) { + var a = this._props, + p, i; + for (p in this._beziers) { + if (p in lookup) { + delete this._beziers[p]; + delete this._func[p]; + i = a.length; + while (--i > -1) { + if (a[i] === p) { + a.splice(i, 1); + } + } + } + } + a = this._autoRotate; + if (a) { + i = a.length; + while (--i > -1) { + if (lookup[a[i][2]]) { + a.splice(i, 1); + } + } + } + return this._super._kill.call(this, lookup); + }; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("BezierPlugin")); + +/*! + * VERSION: 2.1.0 + * DATE: 2019-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + _gsScope._gsDefine("plugins.CSSPlugin", ["plugins.TweenPlugin","TweenLite"], function(TweenPlugin, TweenLite) { + + /** @constructor **/ + var CSSPlugin = function() { + TweenPlugin.call(this, "css"); + this._overwriteProps.length = 0; + this.setRatio = CSSPlugin.prototype.setRatio; //speed optimization (avoid prototype lookup on this "hot" method) + }, + _globals = _gsScope._gsDefine.globals, + _hasPriority, //turns true whenever a CSSPropTween instance is created that has a priority other than 0. This helps us discern whether or not we should spend the time organizing the linked list or not after a CSSPlugin's _onInitTween() method is called. + _suffixMap, //we set this in _onInitTween() each time as a way to have a persistent variable we can use in other methods like _parse() without having to pass it around as a parameter and we keep _parse() decoupled from a particular CSSPlugin instance + _cs, //computed style (we store this in a shared variable to conserve memory and make minification tighter + _overwriteProps, //alias to the currently instantiating CSSPlugin's _overwriteProps array. We use this closure in order to avoid having to pass a reference around from method to method and aid in minification. + _specialProps = {}, + p = CSSPlugin.prototype = new TweenPlugin("css"); + + p.constructor = CSSPlugin; + CSSPlugin.version = "2.1.0"; + CSSPlugin.API = 2; + CSSPlugin.defaultTransformPerspective = 0; + CSSPlugin.defaultSkewType = "compensated"; + CSSPlugin.defaultSmoothOrigin = true; + p = "px"; //we'll reuse the "p" variable to keep file size down + CSSPlugin.suffixMap = {top:p, right:p, bottom:p, left:p, width:p, height:p, fontSize:p, padding:p, margin:p, perspective:p, lineHeight:""}; + + + var _numExp = /(?:\-|\.|\b)(\d|\.|e\-)+/g, + _relNumExp = /(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g, + _valuesExp = /(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi, //finds all the values that begin with numbers or += or -= and then a number. Includes suffixes. We use this to split complex values apart like "1px 5px 20px rgb(255,102,51)" + _NaNExp = /(?![+-]?\d*\.?\d+|[+-]|e[+-]\d+)[^0-9]/g, //also allows scientific notation and doesn't kill the leading -/+ in -= and += + _suffixExp = /(?:\d|\-|\+|=|#|\.)*/g, + _opacityExp = /opacity *= *([^)]*)/i, + _opacityValExp = /opacity:([^;]*)/i, + _alphaFilterExp = /alpha\(opacity *=.+?\)/i, + _rgbhslExp = /^(rgb|hsl)/, + _capsExp = /([A-Z])/g, + _camelExp = /-([a-z])/gi, + _urlExp = /(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi, //for pulling out urls from url(...) or url("...") strings (some browsers wrap urls in quotes, some don't when reporting things like backgroundImage) + _camelFunc = function(s, g) { return g.toUpperCase(); }, + _horizExp = /(?:Left|Right|Width)/i, + _ieGetMatrixExp = /(M11|M12|M21|M22)=[\d\-\.e]+/gi, + _ieSetMatrixExp = /progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i, + _commasOutsideParenExp = /,(?=[^\)]*(?:\(|$))/gi, //finds any commas that are not within parenthesis + _complexExp = /[\s,\(]/i, //for testing a string to find if it has a space, comma, or open parenthesis (clues that it's a complex value) + _DEG2RAD = Math.PI / 180, + _RAD2DEG = 180 / Math.PI, + _forcePT = {}, + _dummyElement = {style:{}}, + _doc = _gsScope.document || {createElement: function() {return _dummyElement;}}, + _createElement = function(type, ns) { + return (ns && _doc.createElementNS) ? _doc.createElementNS(ns, type) : _doc.createElement(type); + }, + _tempDiv = _createElement("div"), + _tempImg = _createElement("img"), + _internals = CSSPlugin._internals = {_specialProps:_specialProps}, //provides a hook to a few internal methods that we need to access from inside other plugins + _agent = (_gsScope.navigator || {}).userAgent || "", + _autoRound, + _reqSafariFix, //we won't apply the Safari transform fix until we actually come across a tween that affects a transform property (to maintain best performance). + + _isSafari, + _isFirefox, //Firefox has a bug that causes 3D transformed elements to randomly disappear unless a repaint is forced after each update on each element. + _isSafariLT6, //Safari (and Android 4 which uses a flavor of Safari) has a bug that prevents changes to "top" and "left" properties from rendering properly if changed on the same frame as a transform UNLESS we set the element's WebkitBackfaceVisibility to hidden (weird, I know). Doing this for Android 3 and earlier seems to actually cause other problems, though (fun!) + _ieVers, + _supportsOpacity = (function() { //we set _isSafari, _ieVers, _isFirefox, and _supportsOpacity all in one function here to reduce file size slightly, especially in the minified version. + var i = _agent.indexOf("Android"), + a = _createElement("a"); + _isSafari = (_agent.indexOf("Safari") !== -1 && _agent.indexOf("Chrome") === -1 && (i === -1 || parseFloat(_agent.substr(i+8, 2)) > 3)); + _isSafariLT6 = (_isSafari && (parseFloat(_agent.substr(_agent.indexOf("Version/")+8, 2)) < 6)); + _isFirefox = (_agent.indexOf("Firefox") !== -1); + if ((/MSIE ([0-9]{1,}[\.0-9]{0,})/).exec(_agent) || (/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/).exec(_agent)) { + _ieVers = parseFloat( RegExp.$1 ); + } + if (!a) { + return false; + } + a.style.cssText = "top:1px;opacity:.55;"; + return /^0.55/.test(a.style.opacity); + }()), + _getIEOpacity = function(v) { + return (_opacityExp.test( ((typeof(v) === "string") ? v : (v.currentStyle ? v.currentStyle.filter : v.style.filter) || "") ) ? ( parseFloat( RegExp.$1 ) / 100 ) : 1); + }, + _log = function(s) {//for logging messages, but in a way that won't throw errors in old versions of IE. + if (_gsScope.console) { + console.log(s); + } + }, + _target, //when initting a CSSPlugin, we set this variable so that we can access it from within many other functions without having to pass it around as params + _index, //when initting a CSSPlugin, we set this variable so that we can access it from within many other functions without having to pass it around as params + + _prefixCSS = "", //the non-camelCase vendor prefix like "-o-", "-moz-", "-ms-", or "-webkit-" + _prefix = "", //camelCase vendor prefix like "O", "ms", "Webkit", or "Moz". + + // @private feed in a camelCase property name like "transform" and it will check to see if it is valid as-is or if it needs a vendor prefix. It returns the corrected camelCase property name (i.e. "WebkitTransform" or "MozTransform" or "transform" or null if no such property is found, like if the browser is IE8 or before, "transform" won't be found at all) + _checkPropPrefix = function(p, e) { + e = e || _tempDiv; + var s = e.style, + a, i; + if (s[p] !== undefined) { + return p; + } + p = p.charAt(0).toUpperCase() + p.substr(1); + a = ["O","Moz","ms","Ms","Webkit"]; + i = 5; + while (--i > -1 && s[a[i]+p] === undefined) { } + if (i >= 0) { + _prefix = (i === 3) ? "ms" : a[i]; + _prefixCSS = "-" + _prefix.toLowerCase() + "-"; + return _prefix + p; + } + return null; + }, + + _computedStyleScope = (typeof(window) !== "undefined" ? window : _doc.defaultView || {getComputedStyle:function() {}}), + _getComputedStyle = function(e) { + return _computedStyleScope.getComputedStyle(e); //to avoid errors in Microsoft Edge, we need to call getComputedStyle() from a specific scope, typically window. + }, + + /** + * @private Returns the css style for a particular property of an element. For example, to get whatever the current "left" css value for an element with an ID of "myElement", you could do: + * var currentLeft = CSSPlugin.getStyle( document.getElementById("myElement"), "left"); + * + * @param {!Object} t Target element whose style property you want to query + * @param {!string} p Property name (like "left" or "top" or "marginTop", etc.) + * @param {Object=} cs Computed style object. This just provides a way to speed processing if you're going to get several properties on the same element in quick succession - you can reuse the result of the getComputedStyle() call. + * @param {boolean=} calc If true, the value will not be read directly from the element's "style" property (if it exists there), but instead the getComputedStyle() result will be used. This can be useful when you want to ensure that the browser itself is interpreting the value. + * @param {string=} dflt Default value that should be returned in the place of null, "none", "auto" or "auto auto". + * @return {?string} The current property value + */ + _getStyle = CSSPlugin.getStyle = function(t, p, cs, calc, dflt) { + var rv; + if (!_supportsOpacity) if (p === "opacity") { //several versions of IE don't use the standard "opacity" property - they use things like filter:alpha(opacity=50), so we parse that here. + return _getIEOpacity(t); + } + if (!calc && t.style[p]) { + rv = t.style[p]; + } else if ((cs = cs || _getComputedStyle(t))) { + rv = cs[p] || cs.getPropertyValue(p) || cs.getPropertyValue(p.replace(_capsExp, "-$1").toLowerCase()); + } else if (t.currentStyle) { + rv = t.currentStyle[p]; + } + return (dflt != null && (!rv || rv === "none" || rv === "auto" || rv === "auto auto")) ? dflt : rv; + }, + + /** + * @private Pass the target element, the property name, the numeric value, and the suffix (like "%", "em", "px", etc.) and it will spit back the equivalent pixel number. + * @param {!Object} t Target element + * @param {!string} p Property name (like "left", "top", "marginLeft", etc.) + * @param {!number} v Value + * @param {string=} sfx Suffix (like "px" or "%" or "em") + * @param {boolean=} recurse If true, the call is a recursive one. In some browsers (like IE7/8), occasionally the value isn't accurately reported initially, but if we run the function again it will take effect. + * @return {number} value in pixels + */ + _convertToPixels = _internals.convertToPixels = function(t, p, v, sfx, recurse) { + if (sfx === "px" || (!sfx && p !== "lineHeight")) { return v; } + if (sfx === "auto" || !v) { return 0; } + var horiz = _horizExp.test(p), + node = t, + style = _tempDiv.style, + neg = (v < 0), + precise = (v === 1), + pix, cache, time; + if (neg) { + v = -v; + } + if (precise) { + v *= 100; + } + if (p === "lineHeight" && !sfx) { //special case of when a simple lineHeight (without a unit) is used. Set it to the value, read back the computed value, and then revert. + cache = _getComputedStyle(t).lineHeight; + t.style.lineHeight = v; + pix = parseFloat(_getComputedStyle(t).lineHeight); + t.style.lineHeight = cache; + } else if (sfx === "%" && p.indexOf("border") !== -1) { + pix = (v / 100) * (horiz ? t.clientWidth : t.clientHeight); + } else { + style.cssText = "border:0 solid red;position:" + _getStyle(t, "position") + ";line-height:0;"; + if (sfx === "%" || !node.appendChild || sfx.charAt(0) === "v" || sfx === "rem") { + node = t.parentNode || _doc.body; + if (_getStyle(node, "display").indexOf("flex") !== -1) { //Edge and IE11 have a bug that causes offsetWidth to report as 0 if the container has display:flex and the child is position:relative. Switching to position: absolute solves it. + style.position = "absolute"; + } + cache = node._gsCache; + time = TweenLite.ticker.frame; + if (cache && horiz && cache.time === time) { //performance optimization: we record the width of elements along with the ticker frame so that we can quickly get it again on the same tick (seems relatively safe to assume it wouldn't change on the same tick) + return cache.width * v / 100; + } + style[(horiz ? "width" : "height")] = v + sfx; + } else { + style[(horiz ? "borderLeftWidth" : "borderTopWidth")] = v + sfx; + } + node.appendChild(_tempDiv); + pix = parseFloat(_tempDiv[(horiz ? "offsetWidth" : "offsetHeight")]); + node.removeChild(_tempDiv); + if (horiz && sfx === "%" && CSSPlugin.cacheWidths !== false) { + cache = node._gsCache = node._gsCache || {}; + cache.time = time; + cache.width = pix / v * 100; + } + if (pix === 0 && !recurse) { + pix = _convertToPixels(t, p, v, sfx, true); + } + } + if (precise) { + pix /= 100; + } + return neg ? -pix : pix; + }, + _calculateOffset = _internals.calculateOffset = function(t, p, cs) { //for figuring out "top" or "left" in px when it's "auto". We need to factor in margin with the offsetLeft/offsetTop + if (_getStyle(t, "position", cs) !== "absolute") { return 0; } + var dim = ((p === "left") ? "Left" : "Top"), + v = _getStyle(t, "margin" + dim, cs); + return t["offset" + dim] - (_convertToPixels(t, p, parseFloat(v), v.replace(_suffixExp, "")) || 0); + }, + + // @private returns at object containing ALL of the style properties in camelCase and their associated values. + _getAllStyles = function(t, cs) { + var s = {}, + i, tr, p; + if ((cs = cs || _getComputedStyle(t, null))) { + if ((i = cs.length)) { + while (--i > -1) { + p = cs[i]; + if (p.indexOf("-transform") === -1 || _transformPropCSS === p) { //Some webkit browsers duplicate transform values, one non-prefixed and one prefixed ("transform" and "WebkitTransform"), so we must weed out the extra one here. + s[p.replace(_camelExp, _camelFunc)] = cs.getPropertyValue(p); + } + } + } else { //some browsers behave differently - cs.length is always 0, so we must do a for...in loop. + for (i in cs) { + if (i.indexOf("Transform") === -1 || _transformProp === i) { //Some webkit browsers duplicate transform values, one non-prefixed and one prefixed ("transform" and "WebkitTransform"), so we must weed out the extra one here. + s[i] = cs[i]; + } + } + } + } else if ((cs = t.currentStyle || t.style)) { + for (i in cs) { + if (typeof(i) === "string" && s[i] === undefined) { + s[i.replace(_camelExp, _camelFunc)] = cs[i]; + } + } + } + if (!_supportsOpacity) { + s.opacity = _getIEOpacity(t); + } + tr = _getTransform(t, cs, false); + s.rotation = tr.rotation; + s.skewX = tr.skewX; + s.scaleX = tr.scaleX; + s.scaleY = tr.scaleY; + s.x = tr.x; + s.y = tr.y; + if (_supports3D) { + s.z = tr.z; + s.rotationX = tr.rotationX; + s.rotationY = tr.rotationY; + s.scaleZ = tr.scaleZ; + } + if (s.filters) { + delete s.filters; + } + return s; + }, + + // @private analyzes two style objects (as returned by _getAllStyles()) and only looks for differences between them that contain tweenable values (like a number or color). It returns an object with a "difs" property which refers to an object containing only those isolated properties and values for tweening, and a "firstMPT" property which refers to the first MiniPropTween instance in a linked list that recorded all the starting values of the different properties so that we can revert to them at the end or beginning of the tween - we don't want the cascading to get messed up. The forceLookup parameter is an optional generic object with properties that should be forced into the results - this is necessary for className tweens that are overwriting others because imagine a scenario where a rollover/rollout adds/removes a class and the user swipes the mouse over the target SUPER fast, thus nothing actually changed yet and the subsequent comparison of the properties would indicate they match (especially when px rounding is taken into consideration), thus no tweening is necessary even though it SHOULD tween and remove those properties after the tween (otherwise the inline styles will contaminate things). See the className SpecialProp code for details. + _cssDif = function(t, s1, s2, vars, forceLookup) { + var difs = {}, + style = t.style, + val, p, mpt; + for (p in s2) { + if (p !== "cssText") if (p !== "length") if (isNaN(p)) if (s1[p] !== (val = s2[p]) || (forceLookup && forceLookup[p])) if (p.indexOf("Origin") === -1) if (typeof(val) === "number" || typeof(val) === "string") { + difs[p] = (val === "auto" && (p === "left" || p === "top")) ? _calculateOffset(t, p) : ((val === "" || val === "auto" || val === "none") && typeof(s1[p]) === "string" && s1[p].replace(_NaNExp, "") !== "") ? 0 : val; //if the ending value is defaulting ("" or "auto"), we check the starting value and if it can be parsed into a number (a string which could have a suffix too, like 700px), then we swap in 0 for "" or "auto" so that things actually tween. + if (style[p] !== undefined) { //for className tweens, we must remember which properties already existed inline - the ones that didn't should be removed when the tween isn't in progress because they were only introduced to facilitate the transition between classes. + mpt = new MiniPropTween(style, p, style[p], mpt); + } + } + } + if (vars) { + for (p in vars) { //copy properties (except className) + if (p !== "className") { + difs[p] = vars[p]; + } + } + } + return {difs:difs, firstMPT:mpt}; + }, + _dimensions = {width:["Left","Right"], height:["Top","Bottom"]}, + _margins = ["marginLeft","marginRight","marginTop","marginBottom"], + + /** + * @private Gets the width or height of an element + * @param {!Object} t Target element + * @param {!string} p Property name ("width" or "height") + * @param {Object=} cs Computed style object (if one exists). Just a speed optimization. + * @return {number} Dimension (in pixels) + */ + _getDimension = function(t, p, cs) { + if ((t.nodeName + "").toLowerCase() === "svg") { //Chrome no longer supports offsetWidth/offsetHeight on SVG elements. + return (cs || _getComputedStyle(t))[p] || 0; + } else if (t.getCTM && _isSVG(t)) { + return t.getBBox()[p] || 0; + } + var v = parseFloat((p === "width") ? t.offsetWidth : t.offsetHeight), + a = _dimensions[p], + i = a.length; + cs = cs || _getComputedStyle(t, null); + while (--i > -1) { + v -= parseFloat( _getStyle(t, "padding" + a[i], cs, true) ) || 0; + v -= parseFloat( _getStyle(t, "border" + a[i] + "Width", cs, true) ) || 0; + } + return v; + }, + + // @private Parses position-related complex strings like "top left" or "50px 10px" or "70% 20%", etc. which are used for things like transformOrigin or backgroundPosition. Optionally decorates a supplied object (recObj) with the following properties: "ox" (offsetX), "oy" (offsetY), "oxp" (if true, "ox" is a percentage not a pixel value), and "oxy" (if true, "oy" is a percentage not a pixel value) + _parsePosition = function(v, recObj) { + if (v === "contain" || v === "auto" || v === "auto auto") { //note: Firefox uses "auto auto" as default whereas Chrome uses "auto". + return v + " "; + } + if (v == null || v === "") { + v = "0 0"; + } + var a = v.split(" "), + x = (v.indexOf("left") !== -1) ? "0%" : (v.indexOf("right") !== -1) ? "100%" : a[0], + y = (v.indexOf("top") !== -1) ? "0%" : (v.indexOf("bottom") !== -1) ? "100%" : a[1], + i; + if (a.length > 3 && !recObj) { //multiple positions + a = v.split(", ").join(",").split(","); + v = []; + for (i = 0; i < a.length; i++) { + v.push(_parsePosition(a[i])); + } + return v.join(","); + } + if (y == null) { + y = (x === "center") ? "50%" : "0"; + } else if (y === "center") { + y = "50%"; + } + if (x === "center" || (isNaN(parseFloat(x)) && (x + "").indexOf("=") === -1)) { //remember, the user could flip-flop the values and say "bottom center" or "center bottom", etc. "center" is ambiguous because it could be used to describe horizontal or vertical, hence the isNaN(). If there's an "=" sign in the value, it's relative. + x = "50%"; + } + v = x + " " + y + ((a.length > 2) ? " " + a[2] : ""); + if (recObj) { + recObj.oxp = (x.indexOf("%") !== -1); + recObj.oyp = (y.indexOf("%") !== -1); + recObj.oxr = (x.charAt(1) === "="); + recObj.oyr = (y.charAt(1) === "="); + recObj.ox = parseFloat(x.replace(_NaNExp, "")); + recObj.oy = parseFloat(y.replace(_NaNExp, "")); + recObj.v = v; + } + return recObj || v; + }, + + /** + * @private Takes an ending value (typically a string, but can be a number) and a starting value and returns the change between the two, looking for relative value indicators like += and -= and it also ignores suffixes (but make sure the ending value starts with a number or +=/-= and that the starting value is a NUMBER!) + * @param {(number|string)} e End value which is typically a string, but could be a number + * @param {(number|string)} b Beginning value which is typically a string but could be a number + * @return {number} Amount of change between the beginning and ending values (relative values that have a "+=" or "-=" are recognized) + */ + _parseChange = function(e, b) { + if (typeof(e) === "function") { + e = e(_index, _target); + } + return (typeof(e) === "string" && e.charAt(1) === "=") ? parseInt(e.charAt(0) + "1", 10) * parseFloat(e.substr(2)) : (parseFloat(e) - parseFloat(b)) || 0; + }, + + /** + * @private Takes a value and a default number, checks if the value is relative, null, or numeric and spits back a normalized number accordingly. Primarily used in the _parseTransform() function. + * @param {Object} v Value to be parsed + * @param {!number} d Default value (which is also used for relative calculations if "+=" or "-=" is found in the first parameter) + * @return {number} Parsed value + */ + _parseVal = function(v, d) { + if (typeof(v) === "function") { + v = v(_index, _target); + } + var isRelative = (typeof(v) === "string" && v.charAt(1) === "="); + if (typeof(v) === "string" && v.charAt(v.length - 2) === "v") { //convert vw and vh into px-equivalents. + v = (isRelative ? v.substr(0, 2) : 0) + (window["inner" + ((v.substr(-2) === "vh") ? "Height" : "Width")] * (parseFloat(isRelative ? v.substr(2) : v) / 100)); + } + return (v == null) ? d : isRelative ? parseInt(v.charAt(0) + "1", 10) * parseFloat(v.substr(2)) + d : parseFloat(v) || 0; + }, + + /** + * @private Translates strings like "40deg" or "40" or 40rad" or "+=40deg" or "270_short" or "-90_cw" or "+=45_ccw" to a numeric radian angle. Of course a starting/default value must be fed in too so that relative values can be calculated properly. + * @param {Object} v Value to be parsed + * @param {!number} d Default value (which is also used for relative calculations if "+=" or "-=" is found in the first parameter) + * @param {string=} p property name for directionalEnd (optional - only used when the parsed value is directional ("_short", "_cw", or "_ccw" suffix). We need a way to store the uncompensated value so that at the end of the tween, we set it to exactly what was requested with no directional compensation). Property name would be "rotation", "rotationX", or "rotationY" + * @param {Object=} directionalEnd An object that will store the raw end values for directional angles ("_short", "_cw", or "_ccw" suffix). We need a way to store the uncompensated value so that at the end of the tween, we set it to exactly what was requested with no directional compensation. + * @return {number} parsed angle in radians + */ + _parseAngle = function(v, d, p, directionalEnd) { + var min = 0.000001, + cap, split, dif, result, isRelative; + if (typeof(v) === "function") { + v = v(_index, _target); + } + if (v == null) { + result = d; + } else if (typeof(v) === "number") { + result = v; + } else { + cap = 360; + split = v.split("_"); + isRelative = (v.charAt(1) === "="); + dif = (isRelative ? parseInt(v.charAt(0) + "1", 10) * parseFloat(split[0].substr(2)) : parseFloat(split[0])) * ((v.indexOf("rad") === -1) ? 1 : _RAD2DEG) - (isRelative ? 0 : d); + if (split.length) { + if (directionalEnd) { + directionalEnd[p] = d + dif; + } + if (v.indexOf("short") !== -1) { + dif = dif % cap; + if (dif !== dif % (cap / 2)) { + dif = (dif < 0) ? dif + cap : dif - cap; + } + } + if (v.indexOf("_cw") !== -1 && dif < 0) { + dif = ((dif + cap * 9999999999) % cap) - ((dif / cap) | 0) * cap; + } else if (v.indexOf("ccw") !== -1 && dif > 0) { + dif = ((dif - cap * 9999999999) % cap) - ((dif / cap) | 0) * cap; + } + } + result = d + dif; + } + if (result < min && result > -min) { + result = 0; + } + return result; + }, + + _colorLookup = {aqua:[0,255,255], + lime:[0,255,0], + silver:[192,192,192], + black:[0,0,0], + maroon:[128,0,0], + teal:[0,128,128], + blue:[0,0,255], + navy:[0,0,128], + white:[255,255,255], + fuchsia:[255,0,255], + olive:[128,128,0], + yellow:[255,255,0], + orange:[255,165,0], + gray:[128,128,128], + purple:[128,0,128], + green:[0,128,0], + red:[255,0,0], + pink:[255,192,203], + cyan:[0,255,255], + transparent:[255,255,255,0]}, + + _hue = function(h, m1, m2) { + h = (h < 0) ? h + 1 : (h > 1) ? h - 1 : h; + return ((((h * 6 < 1) ? m1 + (m2 - m1) * h * 6 : (h < 0.5) ? m2 : (h * 3 < 2) ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * 255) + 0.5) | 0; + }, + + /** + * @private Parses a color (like #9F0, #FF9900, rgb(255,51,153) or hsl(108, 50%, 10%)) into an array with 3 elements for red, green, and blue or if toHSL parameter is true, it will populate the array with hue, saturation, and lightness values. If a relative value is found in an hsl() or hsla() string, it will preserve those relative prefixes and all the values in the array will be strings instead of numbers (in all other cases it will be populated with numbers). + * @param {(string|number)} v The value the should be parsed which could be a string like #9F0 or rgb(255,102,51) or rgba(255,0,0,0.5) or it could be a number like 0xFF00CC or even a named color like red, blue, purple, etc. + * @param {(boolean)} toHSL If true, an hsl() or hsla() value will be returned instead of rgb() or rgba() + * @return {Array.} An array containing red, green, and blue (and optionally alpha) in that order, or if the toHSL parameter was true, the array will contain hue, saturation and lightness (and optionally alpha) in that order. Always numbers unless there's a relative prefix found in an hsl() or hsla() string and toHSL is true. + */ + _parseColor = CSSPlugin.parseColor = function(v, toHSL) { + var a, r, g, b, h, s, l, max, min, d, wasHSL; + if (!v) { + a = _colorLookup.black; + } else if (typeof(v) === "number") { + a = [v >> 16, (v >> 8) & 255, v & 255]; + } else { + if (v.charAt(v.length - 1) === ",") { //sometimes a trailing comma is included and we should chop it off (typically from a comma-delimited list of values like a textShadow:"2px 2px 2px blue, 5px 5px 5px rgb(255,0,0)" - in this example "blue," has a trailing comma. We could strip it out inside parseComplex() but we'd need to do it to the beginning and ending values plus it wouldn't provide protection from other potential scenarios like if the user passes in a similar value. + v = v.substr(0, v.length - 1); + } + if (_colorLookup[v]) { + a = _colorLookup[v]; + } else if (v.charAt(0) === "#") { + if (v.length === 4) { //for shorthand like #9F0 + r = v.charAt(1); + g = v.charAt(2); + b = v.charAt(3); + v = "#" + r + r + g + g + b + b; + } + v = parseInt(v.substr(1), 16); + a = [v >> 16, (v >> 8) & 255, v & 255]; + } else if (v.substr(0, 3) === "hsl") { + a = wasHSL = v.match(_numExp); + if (!toHSL) { + h = (Number(a[0]) % 360) / 360; + s = Number(a[1]) / 100; + l = Number(a[2]) / 100; + g = (l <= 0.5) ? l * (s + 1) : l + s - l * s; + r = l * 2 - g; + if (a.length > 3) { + a[3] = Number(a[3]); + } + a[0] = _hue(h + 1 / 3, r, g); + a[1] = _hue(h, r, g); + a[2] = _hue(h - 1 / 3, r, g); + } else if (v.indexOf("=") !== -1) { //if relative values are found, just return the raw strings with the relative prefixes in place. + return v.match(_relNumExp); + } + } else { + a = v.match(_numExp) || _colorLookup.transparent; + } + a[0] = Number(a[0]); + a[1] = Number(a[1]); + a[2] = Number(a[2]); + if (a.length > 3) { + a[3] = Number(a[3]); + } + } + if (toHSL && !wasHSL) { + r = a[0] / 255; + g = a[1] / 255; + b = a[2] / 255; + max = Math.max(r, g, b); + min = Math.min(r, g, b); + l = (max + min) / 2; + if (max === min) { + h = s = 0; + } else { + d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + h = (max === r) ? (g - b) / d + (g < b ? 6 : 0) : (max === g) ? (b - r) / d + 2 : (r - g) / d + 4; + h *= 60; + } + a[0] = (h + 0.5) | 0; + a[1] = (s * 100 + 0.5) | 0; + a[2] = (l * 100 + 0.5) | 0; + } + return a; + }, + _formatColors = function(s, toHSL) { + var colors = s.match(_colorExp) || [], + charIndex = 0, + parsed = "", + i, color, temp; + if (!colors.length) { + return s; + } + for (i = 0; i < colors.length; i++) { + color = colors[i]; + temp = s.substr(charIndex, s.indexOf(color, charIndex)-charIndex); + charIndex += temp.length + color.length; + color = _parseColor(color, toHSL); + if (color.length === 3) { + color.push(1); + } + parsed += temp + (toHSL ? "hsla(" + color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : "rgba(" + color.join(",")) + ")"; + } + return parsed + s.substr(charIndex); + }, + _colorExp = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3}){1,2}\\b"; //we'll dynamically build this Regular Expression to conserve file size. After building it, it will be able to find rgb(), rgba(), # (hexadecimal), and named color values like red, blue, purple, etc. + + for (p in _colorLookup) { + _colorExp += "|" + p + "\\b"; + } + _colorExp = new RegExp(_colorExp+")", "gi"); + + CSSPlugin.colorStringFilter = function(a) { + var combined = a[0] + " " + a[1], + toHSL; + if (_colorExp.test(combined)) { + toHSL = (combined.indexOf("hsl(") !== -1 || combined.indexOf("hsla(") !== -1); + a[0] = _formatColors(a[0], toHSL); + a[1] = _formatColors(a[1], toHSL); + } + _colorExp.lastIndex = 0; + }; + + if (!TweenLite.defaultStringFilter) { + TweenLite.defaultStringFilter = CSSPlugin.colorStringFilter; + } + + /** + * @private Returns a formatter function that handles taking a string (or number in some cases) and returning a consistently formatted one in terms of delimiters, quantity of values, etc. For example, we may get boxShadow values defined as "0px red" or "0px 0px 10px rgb(255,0,0)" or "0px 0px 20px 20px #F00" and we need to ensure that what we get back is described with 4 numbers and a color. This allows us to feed it into the _parseComplex() method and split the values up appropriately. The neat thing about this _getFormatter() function is that the dflt defines a pattern as well as a default, so for example, _getFormatter("0px 0px 0px 0px #777", true) not only sets the default as 0px for all distances and #777 for the color, but also sets the pattern such that 4 numbers and a color will always get returned. + * @param {!string} dflt The default value and pattern to follow. So "0px 0px 0px 0px #777" will ensure that 4 numbers and a color will always get returned. + * @param {boolean=} clr If true, the values should be searched for color-related data. For example, boxShadow values typically contain a color whereas borderRadius don't. + * @param {boolean=} collapsible If true, the value is a top/left/right/bottom style one that acts like margin or padding, where if only one value is received, it's used for all 4; if 2 are received, the first is duplicated for 3rd (bottom) and the 2nd is duplicated for the 4th spot (left), etc. + * @return {Function} formatter function + */ + var _getFormatter = function(dflt, clr, collapsible, multi) { + if (dflt == null) { + return function(v) {return v;}; + } + var dColor = clr ? (dflt.match(_colorExp) || [""])[0] : "", + dVals = dflt.split(dColor).join("").match(_valuesExp) || [], + pfx = dflt.substr(0, dflt.indexOf(dVals[0])), + sfx = (dflt.charAt(dflt.length - 1) === ")") ? ")" : "", + delim = (dflt.indexOf(" ") !== -1) ? " " : ",", + numVals = dVals.length, + dSfx = (numVals > 0) ? dVals[0].replace(_numExp, "") : "", + formatter; + if (!numVals) { + return function(v) {return v;}; + } + if (clr) { + formatter = function(v) { + var color, vals, i, a; + if (typeof(v) === "number") { + v += dSfx; + } else if (multi && _commasOutsideParenExp.test(v)) { + a = v.replace(_commasOutsideParenExp, "|").split("|"); + for (i = 0; i < a.length; i++) { + a[i] = formatter(a[i]); + } + return a.join(","); + } + color = (v.match(_colorExp) || [dColor])[0]; + vals = v.split(color).join("").match(_valuesExp) || []; + i = vals.length; + if (numVals > i--) { + while (++i < numVals) { + vals[i] = collapsible ? vals[(((i - 1) / 2) | 0)] : dVals[i]; + } + } + return pfx + vals.join(delim) + delim + color + sfx + (v.indexOf("inset") !== -1 ? " inset" : ""); + }; + return formatter; + + } + formatter = function(v) { + var vals, a, i; + if (typeof(v) === "number") { + v += dSfx; + } else if (multi && _commasOutsideParenExp.test(v)) { + a = v.replace(_commasOutsideParenExp, "|").split("|"); + for (i = 0; i < a.length; i++) { + a[i] = formatter(a[i]); + } + return a.join(","); + } + vals = v.match(_valuesExp) || []; + i = vals.length; + if (numVals > i--) { + while (++i < numVals) { + vals[i] = collapsible ? vals[(((i - 1) / 2) | 0)] : dVals[i]; + } + } + return pfx + vals.join(delim) + sfx; + }; + return formatter; + }, + + /** + * @private returns a formatter function that's used for edge-related values like marginTop, marginLeft, paddingBottom, paddingRight, etc. Just pass a comma-delimited list of property names related to the edges. + * @param {!string} props a comma-delimited list of property names in order from top to left, like "marginTop,marginRight,marginBottom,marginLeft" + * @return {Function} a formatter function + */ + _getEdgeParser = function(props) { + props = props.split(","); + return function(t, e, p, cssp, pt, plugin, vars) { + var a = (e + "").split(" "), + i; + vars = {}; + for (i = 0; i < 4; i++) { + vars[props[i]] = a[i] = a[i] || a[(((i - 1) / 2) >> 0)]; + } + return cssp.parse(t, vars, pt, plugin); + }; + }, + + // @private used when other plugins must tween values first, like BezierPlugin or ThrowPropsPlugin, etc. That plugin's setRatio() gets called first so that the values are updated, and then we loop through the MiniPropTweens which handle copying the values into their appropriate slots so that they can then be applied correctly in the main CSSPlugin setRatio() method. Remember, we typically create a proxy object that has a bunch of uniquely-named properties that we feed to the sub-plugin and it does its magic normally, and then we must interpret those values and apply them to the css because often numbers must get combined/concatenated, suffixes added, etc. to work with css, like boxShadow could have 4 values plus a color. + _setPluginRatio = _internals._setPluginRatio = function(v) { + this.plugin.setRatio(v); + var d = this.data, + proxy = d.proxy, + mpt = d.firstMPT, + min = 0.000001, + val, pt, i, str, p; + while (mpt) { + val = proxy[mpt.v]; + if (mpt.r) { + val = mpt.r(val); + } else if (val < min && val > -min) { + val = 0; + } + mpt.t[mpt.p] = val; + mpt = mpt._next; + } + if (d.autoRotate) { + d.autoRotate.rotation = d.mod ? d.mod.call(this._tween, proxy.rotation, this.t, this._tween) : proxy.rotation; //special case for ModifyPlugin to hook into an auto-rotating bezier + } + //at the end, we must set the CSSPropTween's "e" (end) value dynamically here because that's what is used in the final setRatio() method. Same for "b" at the beginning. + if (v === 1 || v === 0) { + mpt = d.firstMPT; + p = (v === 1) ? "e" : "b"; + while (mpt) { + pt = mpt.t; + if (!pt.type) { + pt[p] = pt.s + pt.xs0; + } else if (pt.type === 1) { + str = pt.xs0 + pt.s + pt.xs1; + for (i = 1; i < pt.l; i++) { + str += pt["xn"+i] + pt["xs"+(i+1)]; + } + pt[p] = str; + } + mpt = mpt._next; + } + } + }, + + /** + * @private @constructor Used by a few SpecialProps to hold important values for proxies. For example, _parseToProxy() creates a MiniPropTween instance for each property that must get tweened on the proxy, and we record the original property name as well as the unique one we create for the proxy, plus whether or not the value needs to be rounded plus the original value. + * @param {!Object} t target object whose property we're tweening (often a CSSPropTween) + * @param {!string} p property name + * @param {(number|string|object)} v value + * @param {MiniPropTween=} next next MiniPropTween in the linked list + * @param {boolean=} r if true, the tweened value should be rounded to the nearest integer + */ + MiniPropTween = function(t, p, v, next, r) { + this.t = t; + this.p = p; + this.v = v; + this.r = r; + if (next) { + next._prev = this; + this._next = next; + } + }, + + /** + * @private Most other plugins (like BezierPlugin and ThrowPropsPlugin and others) can only tween numeric values, but CSSPlugin must accommodate special values that have a bunch of extra data (like a suffix or strings between numeric values, etc.). For example, boxShadow has values like "10px 10px 20px 30px rgb(255,0,0)" which would utterly confuse other plugins. This method allows us to split that data apart and grab only the numeric data and attach it to uniquely-named properties of a generic proxy object ({}) so that we can feed that to virtually any plugin to have the numbers tweened. However, we must also keep track of which properties from the proxy go with which CSSPropTween values and instances. So we create a linked list of MiniPropTweens. Each one records a target (the original CSSPropTween), property (like "s" or "xn1" or "xn2") that we're tweening and the unique property name that was used for the proxy (like "boxShadow_xn1" and "boxShadow_xn2") and whether or not they need to be rounded. That way, in the _setPluginRatio() method we can simply copy the values over from the proxy to the CSSPropTween instance(s). Then, when the main CSSPlugin setRatio() method runs and applies the CSSPropTween values accordingly, they're updated nicely. So the external plugin tweens the numbers, _setPluginRatio() copies them over, and setRatio() acts normally, applying css-specific values to the element. + * This method returns an object that has the following properties: + * - proxy: a generic object containing the starting values for all the properties that will be tweened by the external plugin. This is what we feed to the external _onInitTween() as the target + * - end: a generic object containing the ending values for all the properties that will be tweened by the external plugin. This is what we feed to the external plugin's _onInitTween() as the destination values + * - firstMPT: the first MiniPropTween in the linked list + * - pt: the first CSSPropTween in the linked list that was created when parsing. If shallow is true, this linked list will NOT attach to the one passed into the _parseToProxy() as the "pt" (4th) parameter. + * @param {!Object} t target object to be tweened + * @param {!(Object|string)} vars the object containing the information about the tweening values (typically the end/destination values) that should be parsed + * @param {!CSSPlugin} cssp The CSSPlugin instance + * @param {CSSPropTween=} pt the next CSSPropTween in the linked list + * @param {TweenPlugin=} plugin the external TweenPlugin instance that will be handling tweening the numeric values + * @param {boolean=} shallow if true, the resulting linked list from the parse will NOT be attached to the CSSPropTween that was passed in as the "pt" (4th) parameter. + * @return An object containing the following properties: proxy, end, firstMPT, and pt (see above for descriptions) + */ + _parseToProxy = _internals._parseToProxy = function(t, vars, cssp, pt, plugin, shallow) { + var bpt = pt, + start = {}, + end = {}, + transform = cssp._transform, + oldForce = _forcePT, + i, p, xp, mpt, firstPT; + cssp._transform = null; + _forcePT = vars; + pt = firstPT = cssp.parse(t, vars, pt, plugin); + _forcePT = oldForce; + //break off from the linked list so the new ones are isolated. + if (shallow) { + cssp._transform = transform; + if (bpt) { + bpt._prev = null; + if (bpt._prev) { + bpt._prev._next = null; + } + } + } + while (pt && pt !== bpt) { + if (pt.type <= 1) { + p = pt.p; + end[p] = pt.s + pt.c; + start[p] = pt.s; + if (!shallow) { + mpt = new MiniPropTween(pt, "s", p, mpt, pt.r); + pt.c = 0; + } + if (pt.type === 1) { + i = pt.l; + while (--i > 0) { + xp = "xn" + i; + p = pt.p + "_" + xp; + end[p] = pt.data[xp]; + start[p] = pt[xp]; + if (!shallow) { + mpt = new MiniPropTween(pt, xp, p, mpt, pt.rxp[xp]); + } + } + } + } + pt = pt._next; + } + return {proxy:start, end:end, firstMPT:mpt, pt:firstPT}; + }, + + + + /** + * @constructor Each property that is tweened has at least one CSSPropTween associated with it. These instances store important information like the target, property, starting value, amount of change, etc. They can also optionally have a number of "extra" strings and numeric values named xs1, xn1, xs2, xn2, xs3, xn3, etc. where "s" indicates string and "n" indicates number. These can be pieced together in a complex-value tween (type:1) that has alternating types of data like a string, number, string, number, etc. For example, boxShadow could be "5px 5px 8px rgb(102, 102, 51)". In that value, there are 6 numbers that may need to tween and then pieced back together into a string again with spaces, suffixes, etc. xs0 is special in that it stores the suffix for standard (type:0) tweens, -OR- the first string (prefix) in a complex-value (type:1) CSSPropTween -OR- it can be the non-tweening value in a type:-1 CSSPropTween. We do this to conserve memory. + * CSSPropTweens have the following optional properties as well (not defined through the constructor): + * - l: Length in terms of the number of extra properties that the CSSPropTween has (default: 0). For example, for a boxShadow we may need to tween 5 numbers in which case l would be 5; Keep in mind that the start/end values for the first number that's tweened are always stored in the s and c properties to conserve memory. All additional values thereafter are stored in xn1, xn2, etc. + * - xfirst: The first instance of any sub-CSSPropTweens that are tweening properties of this instance. For example, we may split up a boxShadow tween so that there's a main CSSPropTween of type:1 that has various xs* and xn* values associated with the h-shadow, v-shadow, blur, color, etc. Then we spawn a CSSPropTween for each of those that has a higher priority and runs BEFORE the main CSSPropTween so that the values are all set by the time it needs to re-assemble them. The xfirst gives us an easy way to identify the first one in that chain which typically ends at the main one (because they're all prepende to the linked list) + * - plugin: The TweenPlugin instance that will handle the tweening of any complex values. For example, sometimes we don't want to use normal subtweens (like xfirst refers to) to tween the values - we might want ThrowPropsPlugin or BezierPlugin some other plugin to do the actual tweening, so we create a plugin instance and store a reference here. We need this reference so that if we get a request to round values or disable a tween, we can pass along that request. + * - data: Arbitrary data that needs to be stored with the CSSPropTween. Typically if we're going to have a plugin handle the tweening of a complex-value tween, we create a generic object that stores the END values that we're tweening to and the CSSPropTween's xs1, xs2, etc. have the starting values. We store that object as data. That way, we can simply pass that object to the plugin and use the CSSPropTween as the target. + * - setRatio: Only used for type:2 tweens that require custom functionality. In this case, we call the CSSPropTween's setRatio() method and pass the ratio each time the tween updates. This isn't quite as efficient as doing things directly in the CSSPlugin's setRatio() method, but it's very convenient and flexible. + * @param {!Object} t Target object whose property will be tweened. Often a DOM element, but not always. It could be anything. + * @param {string} p Property to tween (name). For example, to tween element.width, p would be "width". + * @param {number} s Starting numeric value + * @param {number} c Change in numeric value over the course of the entire tween. For example, if element.width starts at 5 and should end at 100, c would be 95. + * @param {CSSPropTween=} next The next CSSPropTween in the linked list. If one is defined, we will define its _prev as the new instance, and the new instance's _next will be pointed at it. + * @param {number=} type The type of CSSPropTween where -1 = a non-tweening value, 0 = a standard simple tween, 1 = a complex value (like one that has multiple numbers in a comma- or space-delimited string like border:"1px solid red"), and 2 = one that uses a custom setRatio function that does all of the work of applying the values on each update. + * @param {string=} n Name of the property that should be used for overwriting purposes which is typically the same as p but not always. For example, we may need to create a subtween for the 2nd part of a "clip:rect(...)" tween in which case "p" might be xs1 but "n" is still "clip" + * @param {boolean=} r If true, the value(s) should be rounded + * @param {number=} pr Priority in the linked list order. Higher priority CSSPropTweens will be updated before lower priority ones. The default priority is 0. + * @param {string=} b Beginning value. We store this to ensure that it is EXACTLY what it was when the tween began without any risk of interpretation issues. + * @param {string=} e Ending value. We store this to ensure that it is EXACTLY what the user defined at the end of the tween without any risk of interpretation issues. + */ + CSSPropTween = _internals.CSSPropTween = function(t, p, s, c, next, type, n, r, pr, b, e) { + this.t = t; //target + this.p = p; //property + this.s = s; //starting value + this.c = c; //change value + this.n = n || p; //name that this CSSPropTween should be associated to (usually the same as p, but not always - n is what overwriting looks at) + if (!(t instanceof CSSPropTween)) { + _overwriteProps.push(this.n); + } + this.r = !r ? r : (typeof(r) === "function") ? r : Math.round; //round (boolean) + this.type = type || 0; //0 = normal tween, -1 = non-tweening (in which case xs0 will be applied to the target's property, like tp.t[tp.p] = tp.xs0), 1 = complex-value SpecialProp, 2 = custom setRatio() that does all the work + if (pr) { + this.pr = pr; + _hasPriority = true; + } + this.b = (b === undefined) ? s : b; + this.e = (e === undefined) ? s + c : e; + if (next) { + this._next = next; + next._prev = this; + } + }, + + _addNonTweeningNumericPT = function(target, prop, start, end, next, overwriteProp) { //cleans up some code redundancies and helps minification. Just a fast way to add a NUMERIC non-tweening CSSPropTween + var pt = new CSSPropTween(target, prop, start, end - start, next, -1, overwriteProp); + pt.b = start; + pt.e = pt.xs0 = end; + return pt; + }, + + /** + * Takes a target, the beginning value and ending value (as strings) and parses them into a CSSPropTween (possibly with child CSSPropTweens) that accommodates multiple numbers, colors, comma-delimited values, etc. For example: + * sp.parseComplex(element, "boxShadow", "5px 10px 20px rgb(255,102,51)", "0px 0px 0px red", true, "0px 0px 0px rgb(0,0,0,0)", pt); + * It will walk through the beginning and ending values (which should be in the same format with the same number and type of values) and figure out which parts are numbers, what strings separate the numeric/tweenable values, and then create the CSSPropTweens accordingly. If a plugin is defined, no child CSSPropTweens will be created. Instead, the ending values will be stored in the "data" property of the returned CSSPropTween like: {s:-5, xn1:-10, xn2:-20, xn3:255, xn4:0, xn5:0} so that it can be fed to any other plugin and it'll be plain numeric tweens but the recomposition of the complex value will be handled inside CSSPlugin's setRatio(). + * If a setRatio is defined, the type of the CSSPropTween will be set to 2 and recomposition of the values will be the responsibility of that method. + * + * @param {!Object} t Target whose property will be tweened + * @param {!string} p Property that will be tweened (its name, like "left" or "backgroundColor" or "boxShadow") + * @param {string} b Beginning value + * @param {string} e Ending value + * @param {boolean} clrs If true, the value could contain a color value like "rgb(255,0,0)" or "#F00" or "red". The default is false, so no colors will be recognized (a performance optimization) + * @param {(string|number|Object)} dflt The default beginning value that should be used if no valid beginning value is defined or if the number of values inside the complex beginning and ending values don't match + * @param {?CSSPropTween} pt CSSPropTween instance that is the current head of the linked list (we'll prepend to this). + * @param {number=} pr Priority in the linked list order. Higher priority properties will be updated before lower priority ones. The default priority is 0. + * @param {TweenPlugin=} plugin If a plugin should handle the tweening of extra properties, pass the plugin instance here. If one is defined, then NO subtweens will be created for any extra properties (the properties will be created - just not additional CSSPropTween instances to tween them) because the plugin is expected to do so. However, the end values WILL be populated in the "data" property, like {s:100, xn1:50, xn2:300} + * @param {function(number)=} setRatio If values should be set in a custom function instead of being pieced together in a type:1 (complex-value) CSSPropTween, define that custom function here. + * @return {CSSPropTween} The first CSSPropTween in the linked list which includes the new one(s) added by the parseComplex() call. + */ + _parseComplex = CSSPlugin.parseComplex = function(t, p, b, e, clrs, dflt, pt, pr, plugin, setRatio) { + //DEBUG: _log("parseComplex: "+p+", b: "+b+", e: "+e); + b = b || dflt || ""; + if (typeof(e) === "function") { + e = e(_index, _target); + } + pt = new CSSPropTween(t, p, 0, 0, pt, (setRatio ? 2 : 1), null, false, pr, b, e); + e += ""; //ensures it's a string + if (clrs && _colorExp.test(e + b)) { //if colors are found, normalize the formatting to rgba() or hsla(). + e = [b, e]; + CSSPlugin.colorStringFilter(e); + b = e[0]; + e = e[1]; + } + var ba = b.split(", ").join(",").split(" "), //beginning array + ea = e.split(", ").join(",").split(" "), //ending array + l = ba.length, + autoRound = (_autoRound !== false), + i, xi, ni, bv, ev, bnums, enums, bn, hasAlpha, temp, cv, str, useHSL; + if (e.indexOf(",") !== -1 || b.indexOf(",") !== -1) { + if ((e + b).indexOf("rgb") !== -1 || (e + b).indexOf("hsl") !== -1) { //keep rgb(), rgba(), hsl(), and hsla() values together! (remember, we're splitting on spaces) + ba = ba.join(" ").replace(_commasOutsideParenExp, ", ").split(" "); + ea = ea.join(" ").replace(_commasOutsideParenExp, ", ").split(" "); + } else { + ba = ba.join(" ").split(",").join(", ").split(" "); + ea = ea.join(" ").split(",").join(", ").split(" "); + } + l = ba.length; + } + if (l !== ea.length) { + //DEBUG: _log("mismatched formatting detected on " + p + " (" + b + " vs " + e + ")"); + ba = (dflt || "").split(" "); + l = ba.length; + } + pt.plugin = plugin; + pt.setRatio = setRatio; + _colorExp.lastIndex = 0; + for (i = 0; i < l; i++) { + bv = ba[i]; + ev = ea[i] + ""; + bn = parseFloat(bv); + //if the value begins with a number (most common). It's fine if it has a suffix like px + if (bn || bn === 0) { + pt.appendXtra("", bn, _parseChange(ev, bn), ev.replace(_relNumExp, ""), (autoRound && ev.indexOf("px") !== -1) ? Math.round : false, true); + + //if the value is a color + } else if (clrs && _colorExp.test(bv)) { + str = ev.indexOf(")") + 1; + str = ")" + (str ? ev.substr(str) : ""); //if there's a comma or ) at the end, retain it. + useHSL = (ev.indexOf("hsl") !== -1 && _supportsOpacity); + temp = ev; //original string value so we can look for any prefix later. + bv = _parseColor(bv, useHSL); + ev = _parseColor(ev, useHSL); + hasAlpha = (bv.length + ev.length > 6); + if (hasAlpha && !_supportsOpacity && ev[3] === 0) { //older versions of IE don't support rgba(), so if the destination alpha is 0, just use "transparent" for the end color + pt["xs" + pt.l] += pt.l ? " transparent" : "transparent"; + pt.e = pt.e.split(ea[i]).join("transparent"); + } else { + if (!_supportsOpacity) { //old versions of IE don't support rgba(). + hasAlpha = false; + } + if (useHSL) { + pt.appendXtra(temp.substr(0, temp.indexOf("hsl")) + (hasAlpha ? "hsla(" : "hsl("), bv[0], _parseChange(ev[0], bv[0]), ",", false, true) + .appendXtra("", bv[1], _parseChange(ev[1], bv[1]), "%,", false) + .appendXtra("", bv[2], _parseChange(ev[2], bv[2]), (hasAlpha ? "%," : "%" + str), false); + } else { + pt.appendXtra(temp.substr(0, temp.indexOf("rgb")) + (hasAlpha ? "rgba(" : "rgb("), bv[0], ev[0] - bv[0], ",", Math.round, true) + .appendXtra("", bv[1], ev[1] - bv[1], ",", Math.round) + .appendXtra("", bv[2], ev[2] - bv[2], (hasAlpha ? "," : str), Math.round); + } + + if (hasAlpha) { + bv = (bv.length < 4) ? 1 : bv[3]; + pt.appendXtra("", bv, ((ev.length < 4) ? 1 : ev[3]) - bv, str, false); + } + } + _colorExp.lastIndex = 0; //otherwise the test() on the RegExp could move the lastIndex and taint future results. + + } else { + bnums = bv.match(_numExp); //gets each group of numbers in the beginning value string and drops them into an array + + //if no number is found, treat it as a non-tweening value and just append the string to the current xs. + if (!bnums) { + pt["xs" + pt.l] += (pt.l || pt["xs" + pt.l]) ? " " + ev : ev; + + //loop through all the numbers that are found and construct the extra values on the pt. + } else { + enums = ev.match(_relNumExp); //get each group of numbers in the end value string and drop them into an array. We allow relative values too, like +=50 or -=.5 + if (!enums || enums.length !== bnums.length) { + //DEBUG: _log("mismatched formatting detected on " + p + " (" + b + " vs " + e + ")"); + return pt; + } + ni = 0; + for (xi = 0; xi < bnums.length; xi++) { + cv = bnums[xi]; + temp = bv.indexOf(cv, ni); + pt.appendXtra(bv.substr(ni, temp - ni), Number(cv), _parseChange(enums[xi], cv), "", (autoRound && bv.substr(temp + cv.length, 2) === "px") ? Math.round : false, (xi === 0)); + ni = temp + cv.length; + } + pt["xs" + pt.l] += bv.substr(ni); + } + } + } + //if there are relative values ("+=" or "-=" prefix), we need to adjust the ending value to eliminate the prefixes and combine the values properly. + if (e.indexOf("=") !== -1) if (pt.data) { + str = pt.xs0 + pt.data.s; + for (i = 1; i < pt.l; i++) { + str += pt["xs" + i] + pt.data["xn" + i]; + } + pt.e = str + pt["xs" + i]; + } + if (!pt.l) { + pt.type = -1; + pt.xs0 = pt.e; + } + return pt.xfirst || pt; + }, + i = 9; + + + p = CSSPropTween.prototype; + p.l = p.pr = 0; //length (number of extra properties like xn1, xn2, xn3, etc. + while (--i > 0) { + p["xn" + i] = 0; + p["xs" + i] = ""; + } + p.xs0 = ""; + p._next = p._prev = p.xfirst = p.data = p.plugin = p.setRatio = p.rxp = null; + + + /** + * Appends and extra tweening value to a CSSPropTween and automatically manages any prefix and suffix strings. The first extra value is stored in the s and c of the main CSSPropTween instance, but thereafter any extras are stored in the xn1, xn2, xn3, etc. The prefixes and suffixes are stored in the xs0, xs1, xs2, etc. properties. For example, if I walk through a clip value like "rect(10px, 5px, 0px, 20px)", the values would be stored like this: + * xs0:"rect(", s:10, xs1:"px, ", xn1:5, xs2:"px, ", xn2:0, xs3:"px, ", xn3:20, xn4:"px)" + * And they'd all get joined together when the CSSPlugin renders (in the setRatio() method). + * @param {string=} pfx Prefix (if any) + * @param {!number} s Starting value + * @param {!number} c Change in numeric value over the course of the entire tween. For example, if the start is 5 and the end is 100, the change would be 95. + * @param {string=} sfx Suffix (if any) + * @param {boolean=} r Round (if true). + * @param {boolean=} pad If true, this extra value should be separated by the previous one by a space. If there is no previous extra and pad is true, it will automatically drop the space. + * @return {CSSPropTween} returns itself so that multiple methods can be chained together. + */ + p.appendXtra = function(pfx, s, c, sfx, r, pad) { + var pt = this, + l = pt.l; + pt["xs" + l] += (pad && (l || pt["xs" + l])) ? " " + pfx : pfx || ""; + if (!c) if (l !== 0 && !pt.plugin) { //typically we'll combine non-changing values right into the xs to optimize performance, but we don't combine them when there's a plugin that will be tweening the values because it may depend on the values being split apart, like for a bezier, if a value doesn't change between the first and second iteration but then it does on the 3rd, we'll run into trouble because there's no xn slot for that value! + pt["xs" + l] += s + (sfx || ""); + return pt; + } + pt.l++; + pt.type = pt.setRatio ? 2 : 1; + pt["xs" + pt.l] = sfx || ""; + if (l > 0) { + pt.data["xn" + l] = s + c; + pt.rxp["xn" + l] = r; //round extra property (we need to tap into this in the _parseToProxy() method) + pt["xn" + l] = s; + if (!pt.plugin) { + pt.xfirst = new CSSPropTween(pt, "xn" + l, s, c, pt.xfirst || pt, 0, pt.n, r, pt.pr); + pt.xfirst.xs0 = 0; //just to ensure that the property stays numeric which helps modern browsers speed up processing. Remember, in the setRatio() method, we do pt.t[pt.p] = val + pt.xs0 so if pt.xs0 is "" (the default), it'll cast the end value as a string. When a property is a number sometimes and a string sometimes, it prevents the compiler from locking in the data type, slowing things down slightly. + } + return pt; + } + pt.data = {s:s + c}; + pt.rxp = {}; + pt.s = s; + pt.c = c; + pt.r = r; + return pt; + }; + + /** + * @constructor A SpecialProp is basically a css property that needs to be treated in a non-standard way, like if it may contain a complex value like boxShadow:"5px 10px 15px rgb(255, 102, 51)" or if it is associated with another plugin like ThrowPropsPlugin or BezierPlugin. Every SpecialProp is associated with a particular property name like "boxShadow" or "throwProps" or "bezier" and it will intercept those values in the vars object that's passed to the CSSPlugin and handle them accordingly. + * @param {!string} p Property name (like "boxShadow" or "throwProps") + * @param {Object=} options An object containing any of the following configuration options: + * - defaultValue: the default value + * - parser: A function that should be called when the associated property name is found in the vars. This function should return a CSSPropTween instance and it should ensure that it is properly inserted into the linked list. It will receive 4 paramters: 1) The target, 2) The value defined in the vars, 3) The CSSPlugin instance (whose _firstPT should be used for the linked list), and 4) A computed style object if one was calculated (this is a speed optimization that allows retrieval of starting values quicker) + * - formatter: a function that formats any value received for this special property (for example, boxShadow could take "5px 5px red" and format it to "5px 5px 0px 0px red" so that both the beginning and ending values have a common order and quantity of values.) + * - prefix: if true, we'll determine whether or not this property requires a vendor prefix (like Webkit or Moz or ms or O) + * - color: set this to true if the value for this SpecialProp may contain color-related values like rgb(), rgba(), etc. + * - priority: priority in the linked list order. Higher priority SpecialProps will be updated before lower priority ones. The default priority is 0. + * - multi: if true, the formatter should accommodate a comma-delimited list of values, like boxShadow could have multiple boxShadows listed out. + * - collapsible: if true, the formatter should treat the value like it's a top/right/bottom/left value that could be collapsed, like "5px" would apply to all, "5px, 10px" would use 5px for top/bottom and 10px for right/left, etc. + * - keyword: a special keyword that can [optionally] be found inside the value (like "inset" for boxShadow). This allows us to validate beginning/ending values to make sure they match (if the keyword is found in one, it'll be added to the other for consistency by default). + */ + var SpecialProp = function(p, options) { + options = options || {}; + this.p = options.prefix ? _checkPropPrefix(p) || p : p; + _specialProps[p] = _specialProps[this.p] = this; + this.format = options.formatter || _getFormatter(options.defaultValue, options.color, options.collapsible, options.multi); + if (options.parser) { + this.parse = options.parser; + } + this.clrs = options.color; + this.multi = options.multi; + this.keyword = options.keyword; + this.dflt = options.defaultValue; + this.allowFunc = options.allowFunc; + this.pr = options.priority || 0; + }, + + //shortcut for creating a new SpecialProp that can accept multiple properties as a comma-delimited list (helps minification). dflt can be an array for multiple values (we don't do a comma-delimited list because the default value may contain commas, like rect(0px,0px,0px,0px)). We attach this method to the SpecialProp class/object instead of using a private _createSpecialProp() method so that we can tap into it externally if necessary, like from another plugin. + _registerComplexSpecialProp = _internals._registerComplexSpecialProp = function(p, options, defaults) { + if (typeof(options) !== "object") { + options = {parser:defaults}; //to make backwards compatible with older versions of BezierPlugin and ThrowPropsPlugin + } + var a = p.split(","), + d = options.defaultValue, + i, temp; + defaults = defaults || [d]; + for (i = 0; i < a.length; i++) { + options.prefix = (i === 0 && options.prefix); + options.defaultValue = defaults[i] || d; + temp = new SpecialProp(a[i], options); + } + }, + + //creates a placeholder special prop for a plugin so that the property gets caught the first time a tween of it is attempted, and at that time it makes the plugin register itself, thus taking over for all future tweens of that property. This allows us to not mandate that things load in a particular order and it also allows us to log() an error that informs the user when they attempt to tween an external plugin-related property without loading its .js file. + _registerPluginProp = _internals._registerPluginProp = function(p) { + if (!_specialProps[p]) { + var pluginName = p.charAt(0).toUpperCase() + p.substr(1) + "Plugin"; + _registerComplexSpecialProp(p, {parser:function(t, e, p, cssp, pt, plugin, vars) { + var pluginClass = _globals.com.greensock.plugins[pluginName]; + if (!pluginClass) { + _log("Error: " + pluginName + " js file not loaded."); + return pt; + } + pluginClass._cssRegister(); + return _specialProps[p].parse(t, e, p, cssp, pt, plugin, vars); + }}); + } + }; + + + p = SpecialProp.prototype; + + /** + * Alias for _parseComplex() that automatically plugs in certain values for this SpecialProp, like its property name, whether or not colors should be sensed, the default value, and priority. It also looks for any keyword that the SpecialProp defines (like "inset" for boxShadow) and ensures that the beginning and ending values have the same number of values for SpecialProps where multi is true (like boxShadow and textShadow can have a comma-delimited list) + * @param {!Object} t target element + * @param {(string|number|object)} b beginning value + * @param {(string|number|object)} e ending (destination) value + * @param {CSSPropTween=} pt next CSSPropTween in the linked list + * @param {TweenPlugin=} plugin If another plugin will be tweening the complex value, that TweenPlugin instance goes here. + * @param {function=} setRatio If a custom setRatio() method should be used to handle this complex value, that goes here. + * @return {CSSPropTween=} First CSSPropTween in the linked list + */ + p.parseComplex = function(t, b, e, pt, plugin, setRatio) { + var kwd = this.keyword, + i, ba, ea, l, bi, ei; + //if this SpecialProp's value can contain a comma-delimited list of values (like boxShadow or textShadow), we must parse them in a special way, and look for a keyword (like "inset" for boxShadow) and ensure that the beginning and ending BOTH have it if the end defines it as such. We also must ensure that there are an equal number of values specified (we can't tween 1 boxShadow to 3 for example) + if (this.multi) if (_commasOutsideParenExp.test(e) || _commasOutsideParenExp.test(b)) { + ba = b.replace(_commasOutsideParenExp, "|").split("|"); + ea = e.replace(_commasOutsideParenExp, "|").split("|"); + } else if (kwd) { + ba = [b]; + ea = [e]; + } + if (ea) { + l = (ea.length > ba.length) ? ea.length : ba.length; + for (i = 0; i < l; i++) { + b = ba[i] = ba[i] || this.dflt; + e = ea[i] = ea[i] || this.dflt; + if (kwd) { + bi = b.indexOf(kwd); + ei = e.indexOf(kwd); + if (bi !== ei) { + if (ei === -1) { //if the keyword isn't in the end value, remove it from the beginning one. + ba[i] = ba[i].split(kwd).join(""); + } else if (bi === -1) { //if the keyword isn't in the beginning, add it. + ba[i] += " " + kwd; + } + } + } + } + b = ba.join(", "); + e = ea.join(", "); + } + return _parseComplex(t, this.p, b, e, this.clrs, this.dflt, pt, this.pr, plugin, setRatio); + }; + + /** + * Accepts a target and end value and spits back a CSSPropTween that has been inserted into the CSSPlugin's linked list and conforms with all the conventions we use internally, like type:-1, 0, 1, or 2, setting up any extra property tweens, priority, etc. For example, if we have a boxShadow SpecialProp and call: + * this._firstPT = sp.parse(element, "5px 10px 20px rgb(2550,102,51)", "boxShadow", this); + * It should figure out the starting value of the element's boxShadow, compare it to the provided end value and create all the necessary CSSPropTweens of the appropriate types to tween the boxShadow. The CSSPropTween that gets spit back should already be inserted into the linked list (the 4th parameter is the current head, so prepend to that). + * @param {!Object} t Target object whose property is being tweened + * @param {Object} e End value as provided in the vars object (typically a string, but not always - like a throwProps would be an object). + * @param {!string} p Property name + * @param {!CSSPlugin} cssp The CSSPlugin instance that should be associated with this tween. + * @param {?CSSPropTween} pt The CSSPropTween that is the current head of the linked list (we'll prepend to it) + * @param {TweenPlugin=} plugin If a plugin will be used to tween the parsed value, this is the plugin instance. + * @param {Object=} vars Original vars object that contains the data for parsing. + * @return {CSSPropTween} The first CSSPropTween in the linked list which includes the new one(s) added by the parse() call. + */ + p.parse = function(t, e, p, cssp, pt, plugin, vars) { + return this.parseComplex(t.style, this.format(_getStyle(t, this.p, _cs, false, this.dflt)), this.format(e), pt, plugin); + }; + + /** + * Registers a special property that should be intercepted from any "css" objects defined in tweens. This allows you to handle them however you want without CSSPlugin doing it for you. The 2nd parameter should be a function that accepts 3 parameters: + * 1) Target object whose property should be tweened (typically a DOM element) + * 2) The end/destination value (could be a string, number, object, or whatever you want) + * 3) The tween instance (you probably don't need to worry about this, but it can be useful for looking up information like the duration) + * + * Then, your function should return a function which will be called each time the tween gets rendered, passing a numeric "ratio" parameter to your function that indicates the change factor (usually between 0 and 1). For example: + * + * CSSPlugin.registerSpecialProp("myCustomProp", function(target, value, tween) { + * var start = target.style.width; + * return function(ratio) { + * target.style.width = (start + value * ratio) + "px"; + * console.log("set width to " + target.style.width); + * } + * }, 0); + * + * Then, when I do this tween, it will trigger my special property: + * + * TweenLite.to(element, 1, {css:{myCustomProp:100}}); + * + * In the example, of course, we're just changing the width, but you can do anything you want. + * + * @param {!string} name Property name (or comma-delimited list of property names) that should be intercepted and handled by your function. For example, if I define "myCustomProp", then it would handle that portion of the following tween: TweenLite.to(element, 1, {css:{myCustomProp:100}}) + * @param {!function(Object, Object, Object, string):function(number)} onInitTween The function that will be called when a tween of this special property is performed. The function will receive 4 parameters: 1) Target object that should be tweened, 2) Value that was passed to the tween, 3) The tween instance itself (rarely used), and 4) The property name that's being tweened. Your function should return a function that should be called on every update of the tween. That function will receive a single parameter that is a "change factor" value (typically between 0 and 1) indicating the amount of change as a ratio. You can use this to determine how to set the values appropriately in your function. + * @param {number=} priority Priority that helps the engine determine the order in which to set the properties (default: 0). Higher priority properties will be updated before lower priority ones. + */ + CSSPlugin.registerSpecialProp = function(name, onInitTween, priority) { + _registerComplexSpecialProp(name, {parser:function(t, e, p, cssp, pt, plugin, vars) { + var rv = new CSSPropTween(t, p, 0, 0, pt, 2, p, false, priority); + rv.plugin = plugin; + rv.setRatio = onInitTween(t, e, cssp._tween, p); + return rv; + }, priority:priority}); + }; + + + + + + + //transform-related methods and properties + CSSPlugin.useSVGTransformAttr = true; //Safari and Firefox both have some rendering bugs when applying CSS transforms to SVG elements, so default to using the "transform" attribute instead (users can override this). + var _transformProps = ("scaleX,scaleY,scaleZ,x,y,z,skewX,skewY,rotation,rotationX,rotationY,perspective,xPercent,yPercent").split(","), + _transformProp = _checkPropPrefix("transform"), //the Javascript (camelCase) transform property, like msTransform, WebkitTransform, MozTransform, or OTransform. + _transformPropCSS = _prefixCSS + "transform", + _transformOriginProp = _checkPropPrefix("transformOrigin"), + _supports3D = (_checkPropPrefix("perspective") !== null), + Transform = _internals.Transform = function() { + this.perspective = parseFloat(CSSPlugin.defaultTransformPerspective) || 0; + this.force3D = (CSSPlugin.defaultForce3D === false || !_supports3D) ? false : CSSPlugin.defaultForce3D || "auto"; + }, + _SVGElement = _gsScope.SVGElement, + _useSVGTransformAttr, + //Some browsers (like Firefox and IE) don't honor transform-origin properly in SVG elements, so we need to manually adjust the matrix accordingly. We feature detect here rather than always doing the conversion for certain browsers because they may fix the problem at some point in the future. + + _createSVG = function(type, container, attributes) { + var element = _doc.createElementNS("http://www.w3.org/2000/svg", type), + reg = /([a-z])([A-Z])/g, + p; + for (p in attributes) { + element.setAttributeNS(null, p.replace(reg, "$1-$2").toLowerCase(), attributes[p]); + } + container.appendChild(element); + return element; + }, + _docElement = _doc.documentElement || {}, + _forceSVGTransformAttr = (function() { + //IE and Android stock don't support CSS transforms on SVG elements, so we must write them to the "transform" attribute. We populate this variable in the _parseTransform() method, and only if/when we come across an SVG element + var force = _ieVers || (/Android/i.test(_agent) && !_gsScope.chrome), + svg, rect, width; + if (_doc.createElementNS && !force) { //IE8 and earlier doesn't support SVG anyway + svg = _createSVG("svg", _docElement); + rect = _createSVG("rect", svg, {width:100, height:50, x:100}); + width = rect.getBoundingClientRect().width; + rect.style[_transformOriginProp] = "50% 50%"; + rect.style[_transformProp] = "scaleX(0.5)"; + force = (width === rect.getBoundingClientRect().width && !(_isFirefox && _supports3D)); //note: Firefox fails the test even though it does support CSS transforms in 3D. Since we can't push 3D stuff into the transform attribute, we force Firefox to pass the test here (as long as it does truly support 3D). + _docElement.removeChild(svg); + } + return force; + })(), + _parseSVGOrigin = function(e, local, decoratee, absolute, smoothOrigin, skipRecord) { + var tm = e._gsTransform, + m = _getMatrix(e, true), + v, x, y, xOrigin, yOrigin, a, b, c, d, tx, ty, determinant, xOriginOld, yOriginOld; + if (tm) { + xOriginOld = tm.xOrigin; //record the original values before we alter them. + yOriginOld = tm.yOrigin; + } + if (!absolute || (v = absolute.split(" ")).length < 2) { + b = e.getBBox(); + if (b.x === 0 && b.y === 0 && b.width + b.height === 0) { //some browsers (like Firefox) misreport the bounds if the element has zero width and height (it just assumes it's at x:0, y:0), thus we need to manually grab the position in that case. + b = {x: parseFloat(e.hasAttribute("x") ? e.getAttribute("x") : e.hasAttribute("cx") ? e.getAttribute("cx") : 0) || 0, y: parseFloat(e.hasAttribute("y") ? e.getAttribute("y") : e.hasAttribute("cy") ? e.getAttribute("cy") : 0) || 0, width:0, height:0}; + } + local = _parsePosition(local).split(" "); + v = [(local[0].indexOf("%") !== -1 ? parseFloat(local[0]) / 100 * b.width : parseFloat(local[0])) + b.x, + (local[1].indexOf("%") !== -1 ? parseFloat(local[1]) / 100 * b.height : parseFloat(local[1])) + b.y]; + } + decoratee.xOrigin = xOrigin = parseFloat(v[0]); + decoratee.yOrigin = yOrigin = parseFloat(v[1]); + if (absolute && m !== _identity2DMatrix) { //if svgOrigin is being set, we must invert the matrix and determine where the absolute point is, factoring in the current transforms. Otherwise, the svgOrigin would be based on the element's non-transformed position on the canvas. + a = m[0]; + b = m[1]; + c = m[2]; + d = m[3]; + tx = m[4]; + ty = m[5]; + determinant = (a * d - b * c); + if (determinant) { //if it's zero (like if scaleX and scaleY are zero), skip it to avoid errors with dividing by zero. + x = xOrigin * (d / determinant) + yOrigin * (-c / determinant) + ((c * ty - d * tx) / determinant); + y = xOrigin * (-b / determinant) + yOrigin * (a / determinant) - ((a * ty - b * tx) / determinant); + xOrigin = decoratee.xOrigin = v[0] = x; + yOrigin = decoratee.yOrigin = v[1] = y; + } + } + if (tm) { //avoid jump when transformOrigin is changed - adjust the x/y values accordingly + if (skipRecord) { + decoratee.xOffset = tm.xOffset; + decoratee.yOffset = tm.yOffset; + tm = decoratee; + } + if (smoothOrigin || (smoothOrigin !== false && CSSPlugin.defaultSmoothOrigin !== false)) { + x = xOrigin - xOriginOld; + y = yOrigin - yOriginOld; + //originally, we simply adjusted the x and y values, but that would cause problems if, for example, you created a rotational tween part-way through an x/y tween. Managing the offset in a separate variable gives us ultimate flexibility. + //tm.x -= x - (x * m[0] + y * m[2]); + //tm.y -= y - (x * m[1] + y * m[3]); + tm.xOffset += (x * m[0] + y * m[2]) - x; + tm.yOffset += (x * m[1] + y * m[3]) - y; + } else { + tm.xOffset = tm.yOffset = 0; + } + } + if (!skipRecord) { + e.setAttribute("data-svg-origin", v.join(" ")); + } + }, + _getBBoxHack = function(swapIfPossible) { //works around issues in some browsers (like Firefox) that don't correctly report getBBox() on SVG elements inside a element and/or . We try creating an SVG, adding it to the documentElement and toss the element in there so that it's definitely part of the rendering tree, then grab the bbox and if it works, we actually swap out the original getBBox() method for our own that does these extra steps whenever getBBox is needed. This helps ensure that performance is optimal (only do all these extra steps when absolutely necessary...most elements don't need it). + var svg = _createElement("svg", (this.ownerSVGElement && this.ownerSVGElement.getAttribute("xmlns")) || "http://www.w3.org/2000/svg"), + oldParent = this.parentNode, + oldSibling = this.nextSibling, + oldCSS = this.style.cssText, + bbox; + _docElement.appendChild(svg); + svg.appendChild(this); + this.style.display = "block"; + if (swapIfPossible) { + try { + bbox = this.getBBox(); + this._originalGetBBox = this.getBBox; + this.getBBox = _getBBoxHack; + } catch (e) { } + } else if (this._originalGetBBox) { + bbox = this._originalGetBBox(); + } + if (oldSibling) { + oldParent.insertBefore(this, oldSibling); + } else { + oldParent.appendChild(this); + } + _docElement.removeChild(svg); + this.style.cssText = oldCSS; + return bbox; + }, + _getBBox = function(e) { + try { + return e.getBBox(); //Firefox throws errors if you try calling getBBox() on an SVG element that's not rendered (like in a or ). https://bugzilla.mozilla.org/show_bug.cgi?id=612118 + } catch (error) { + return _getBBoxHack.call(e, true); + } + }, + _isSVG = function(e) { //reports if the element is an SVG on which getBBox() actually works + return !!(_SVGElement && e.getCTM && (!e.parentNode || e.ownerSVGElement) && _getBBox(e)); + }, + _identity2DMatrix = [1,0,0,1,0,0], + _getMatrix = function(e, force2D) { + var tm = e._gsTransform || new Transform(), + rnd = 100000, + style = e.style, + isDefault, s, m, n, dec, nextSibling, parent; + if (_transformProp) { + s = _getStyle(e, _transformPropCSS, null, true); + } else if (e.currentStyle) { + //for older versions of IE, we need to interpret the filter portion that is in the format: progid:DXImageTransform.Microsoft.Matrix(M11=6.123233995736766e-17, M12=-1, M21=1, M22=6.123233995736766e-17, sizingMethod='auto expand') Notice that we need to swap b and c compared to a normal matrix. + s = e.currentStyle.filter.match(_ieGetMatrixExp); + s = (s && s.length === 4) ? [s[0].substr(4), Number(s[2].substr(4)), Number(s[1].substr(4)), s[3].substr(4), (tm.x || 0), (tm.y || 0)].join(",") : ""; + } + isDefault = (!s || s === "none" || s === "matrix(1, 0, 0, 1, 0, 0)"); + if (_transformProp && isDefault && !e.offsetParent) { //note: if offsetParent is null, that means the element isn't in the normal document flow, like if it has display:none or one of its ancestors has display:none). Firefox returns null for getComputedStyle() if the element is in an iframe that has display:none. https://bugzilla.mozilla.org/show_bug.cgi?id=548397 + //browsers don't report transforms accurately unless the element is in the DOM and has a display value that's not "none". Firefox and Microsoft browsers have a partial bug where they'll report transforms even if display:none BUT not any percentage-based values like translate(-50%, 8px) will be reported as if it's translate(0, 8px). + n = style.display; + style.display = "block"; + parent = e.parentNode; + if (!parent || !e.offsetParent) { + dec = 1; //flag + nextSibling = e.nextSibling; + _docElement.appendChild(e); //we must add it to the DOM in order to get values properly + } + s = _getStyle(e, _transformPropCSS, null, true); + isDefault = (!s || s === "none" || s === "matrix(1, 0, 0, 1, 0, 0)"); + if (n) { + style.display = n; + } else { + _removeProp(style, "display"); + } + if (dec) { + if (nextSibling) { + parent.insertBefore(e, nextSibling); + } else if (parent) { + parent.appendChild(e); + } else { + _docElement.removeChild(e); + } + } + } + if (tm.svg || (e.getCTM && _isSVG(e))) { + if (isDefault && (style[_transformProp] + "").indexOf("matrix") !== -1) { //some browsers (like Chrome 40) don't correctly report transforms that are applied inline on an SVG element (they don't get included in the computed style), so we double-check here and accept matrix values + s = style[_transformProp]; + isDefault = 0; + } + m = e.getAttribute("transform"); + if (isDefault && m) { + m = e.transform.baseVal.consolidate().matrix; //ensures that even complex values like "translate(50,60) rotate(135,0,0)" are parsed because it mashes it into a matrix. + s = "matrix(" + m.a + "," + m.b + "," + m.c + "," + m.d + "," + m.e + "," + m.f + ")"; + isDefault = 0; + } + } + if (isDefault) { + return _identity2DMatrix; + } + //split the matrix values out into an array (m for matrix) + m = (s || "").match(_numExp) || []; + i = m.length; + while (--i > -1) { + n = Number(m[i]); + m[i] = (dec = n - (n |= 0)) ? ((dec * rnd + (dec < 0 ? -0.5 : 0.5)) | 0) / rnd + n : n; //convert strings to Numbers and round to 5 decimal places to avoid issues with tiny numbers. Roughly 20x faster than Number.toFixed(). We also must make sure to round before dividing so that values like 0.9999999999 become 1 to avoid glitches in browser rendering and interpretation of flipped/rotated 3D matrices. And don't just multiply the number by rnd, floor it, and then divide by rnd because the bitwise operations max out at a 32-bit signed integer, thus it could get clipped at a relatively low value (like 22,000.00000 for example). + } + return (force2D && m.length > 6) ? [m[0], m[1], m[4], m[5], m[12], m[13]] : m; + }, + + /** + * Parses the transform values for an element, returning an object with x, y, z, scaleX, scaleY, scaleZ, rotation, rotationX, rotationY, skewX, and skewY properties. Note: by default (for performance reasons), all skewing is combined into skewX and rotation but skewY still has a place in the transform object so that we can record how much of the skew is attributed to skewX vs skewY. Remember, a skewY of 10 looks the same as a rotation of 10 and skewX of -10. + * @param {!Object} t target element + * @param {Object=} cs computed style object (optional) + * @param {boolean=} rec if true, the transform values will be recorded to the target element's _gsTransform object, like target._gsTransform = {x:0, y:0, z:0, scaleX:1...} + * @param {boolean=} parse if true, we'll ignore any _gsTransform values that already exist on the element, and force a reparsing of the css (calculated style) + * @return {object} object containing all of the transform properties/values like {x:0, y:0, z:0, scaleX:1...} + */ + _getTransform = _internals.getTransform = function(t, cs, rec, parse) { + if (t._gsTransform && rec && !parse) { + return t._gsTransform; //if the element already has a _gsTransform, use that. Note: some browsers don't accurately return the calculated style for the transform (particularly for SVG), so it's almost always safest to just use the values we've already applied rather than re-parsing things. + } + var tm = rec ? t._gsTransform || new Transform() : new Transform(), + invX = (tm.scaleX < 0), //in order to interpret things properly, we need to know if the user applied a negative scaleX previously so that we can adjust the rotation and skewX accordingly. Otherwise, if we always interpret a flipped matrix as affecting scaleY and the user only wants to tween the scaleX on multiple sequential tweens, it would keep the negative scaleY without that being the user's intent. + min = 0.00002, + rnd = 100000, + zOrigin = _supports3D ? parseFloat(_getStyle(t, _transformOriginProp, cs, false, "0 0 0").split(" ")[2]) || tm.zOrigin || 0 : 0, + defaultTransformPerspective = parseFloat(CSSPlugin.defaultTransformPerspective) || 0, + m, i, scaleX, scaleY, rotation, skewX; + + tm.svg = !!(t.getCTM && _isSVG(t)); + if (tm.svg) { + _parseSVGOrigin(t, _getStyle(t, _transformOriginProp, cs, false, "50% 50%") + "", tm, t.getAttribute("data-svg-origin")); + _useSVGTransformAttr = CSSPlugin.useSVGTransformAttr || _forceSVGTransformAttr; + } + m = _getMatrix(t); + if (m !== _identity2DMatrix) { + + if (m.length === 16) { + //we'll only look at these position-related 6 variables first because if x/y/z all match, it's relatively safe to assume we don't need to re-parse everything which risks losing important rotational information (like rotationX:180 plus rotationY:180 would look the same as rotation:180 - there's no way to know for sure which direction was taken based solely on the matrix3d() values) + var a11 = m[0], a21 = m[1], a31 = m[2], a41 = m[3], + a12 = m[4], a22 = m[5], a32 = m[6], a42 = m[7], + a13 = m[8], a23 = m[9], a33 = m[10], + a14 = m[12], a24 = m[13], a34 = m[14], + a43 = m[11], + angle = Math.atan2(a32, a33), + t1, t2, t3, t4, cos, sin; + //we manually compensate for non-zero z component of transformOrigin to work around bugs in Safari + if (tm.zOrigin) { + a34 = -tm.zOrigin; + a14 = a13*a34-m[12]; + a24 = a23*a34-m[13]; + a34 = a33*a34+tm.zOrigin-m[14]; + } + //note for possible future consolidation: rotationX: Math.atan2(a32, a33), rotationY: Math.atan2(-a31, Math.sqrt(a33 * a33 + a32 * a32)), rotation: Math.atan2(a21, a11), skew: Math.atan2(a12, a22). However, it doesn't seem to be quite as reliable as the full-on backwards rotation procedure. + tm.rotationX = angle * _RAD2DEG; + //rotationX + if (angle) { + cos = Math.cos(-angle); + sin = Math.sin(-angle); + t1 = a12*cos+a13*sin; + t2 = a22*cos+a23*sin; + t3 = a32*cos+a33*sin; + a13 = a12*-sin+a13*cos; + a23 = a22*-sin+a23*cos; + a33 = a32*-sin+a33*cos; + a43 = a42*-sin+a43*cos; + a12 = t1; + a22 = t2; + a32 = t3; + } + //rotationY + angle = Math.atan2(-a31, a33); + tm.rotationY = angle * _RAD2DEG; + if (angle) { + cos = Math.cos(-angle); + sin = Math.sin(-angle); + t1 = a11*cos-a13*sin; + t2 = a21*cos-a23*sin; + t3 = a31*cos-a33*sin; + a23 = a21*sin+a23*cos; + a33 = a31*sin+a33*cos; + a43 = a41*sin+a43*cos; + a11 = t1; + a21 = t2; + a31 = t3; + } + //rotationZ + angle = Math.atan2(a21, a11); + tm.rotation = angle * _RAD2DEG; + if (angle) { + cos = Math.cos(angle); + sin = Math.sin(angle); + t1 = a11*cos+a21*sin; + t2 = a12*cos+a22*sin; + t3 = a13*cos+a23*sin; + a21 = a21*cos-a11*sin; + a22 = a22*cos-a12*sin; + a23 = a23*cos-a13*sin; + a11 = t1; + a12 = t2; + a13 = t3; + } + + if (tm.rotationX && Math.abs(tm.rotationX) + Math.abs(tm.rotation) > 359.9) { //when rotationY is set, it will often be parsed as 180 degrees different than it should be, and rotationX and rotation both being 180 (it looks the same), so we adjust for that here. + tm.rotationX = tm.rotation = 0; + tm.rotationY = 180 - tm.rotationY; + } + + //skewX + angle = Math.atan2(a12, a22); + + //scales + tm.scaleX = ((Math.sqrt(a11 * a11 + a21 * a21 + a31 * a31) * rnd + 0.5) | 0) / rnd; + tm.scaleY = ((Math.sqrt(a22 * a22 + a32 * a32) * rnd + 0.5) | 0) / rnd; + tm.scaleZ = ((Math.sqrt(a13 * a13 + a23 * a23 + a33 * a33) * rnd + 0.5) | 0) / rnd; + a11 /= tm.scaleX; + a12 /= tm.scaleY; + a21 /= tm.scaleX; + a22 /= tm.scaleY; + if (Math.abs(angle) > min) { + tm.skewX = angle * _RAD2DEG; + a12 = 0; //unskews + if (tm.skewType !== "simple") { + tm.scaleY *= 1 / Math.cos(angle); //by default, we compensate the scale based on the skew so that the element maintains a similar proportion when skewed, so we have to alter the scaleY here accordingly to match the default (non-adjusted) skewing that CSS does (stretching more and more as it skews). + } + + } else { + tm.skewX = 0; + } + + /* //for testing purposes + var transform = "matrix3d(", + comma = ",", + zero = "0"; + a13 /= tm.scaleZ; + a23 /= tm.scaleZ; + a31 /= tm.scaleX; + a32 /= tm.scaleY; + a33 /= tm.scaleZ; + transform += ((a11 < min && a11 > -min) ? zero : a11) + comma + ((a21 < min && a21 > -min) ? zero : a21) + comma + ((a31 < min && a31 > -min) ? zero : a31); + transform += comma + ((a41 < min && a41 > -min) ? zero : a41) + comma + ((a12 < min && a12 > -min) ? zero : a12) + comma + ((a22 < min && a22 > -min) ? zero : a22); + transform += comma + ((a32 < min && a32 > -min) ? zero : a32) + comma + ((a42 < min && a42 > -min) ? zero : a42) + comma + ((a13 < min && a13 > -min) ? zero : a13); + transform += comma + ((a23 < min && a23 > -min) ? zero : a23) + comma + ((a33 < min && a33 > -min) ? zero : a33) + comma + ((a43 < min && a43 > -min) ? zero : a43) + comma; + transform += a14 + comma + a24 + comma + a34 + comma + (tm.perspective ? (1 + (-a34 / tm.perspective)) : 1) + ")"; + console.log(transform); + document.querySelector(".test").style[_transformProp] = transform; + */ + + tm.perspective = a43 ? 1 / ((a43 < 0) ? -a43 : a43) : 0; + tm.x = a14; + tm.y = a24; + tm.z = a34; + if (tm.svg) { + tm.x -= tm.xOrigin - (tm.xOrigin * a11 - tm.yOrigin * a12); + tm.y -= tm.yOrigin - (tm.yOrigin * a21 - tm.xOrigin * a22); + } + + } else if ((!_supports3D || parse || !m.length || tm.x !== m[4] || tm.y !== m[5] || (!tm.rotationX && !tm.rotationY))) { //sometimes a 6-element matrix is returned even when we performed 3D transforms, like if rotationX and rotationY are 180. In cases like this, we still need to honor the 3D transforms. If we just rely on the 2D info, it could affect how the data is interpreted, like scaleY might get set to -1 or rotation could get offset by 180 degrees. For example, do a TweenLite.to(element, 1, {css:{rotationX:180, rotationY:180}}) and then later, TweenLite.to(element, 1, {css:{rotationX:0}}) and without this conditional logic in place, it'd jump to a state of being unrotated when the 2nd tween starts. Then again, we need to honor the fact that the user COULD alter the transforms outside of CSSPlugin, like by manually applying new css, so we try to sense that by looking at x and y because if those changed, we know the changes were made outside CSSPlugin and we force a reinterpretation of the matrix values. Also, in Webkit browsers, if the element's "display" is "none", its calculated style value will always return empty, so if we've already recorded the values in the _gsTransform object, we'll just rely on those. + var k = (m.length >= 6), + a = k ? m[0] : 1, + b = m[1] || 0, + c = m[2] || 0, + d = k ? m[3] : 1; + tm.x = m[4] || 0; + tm.y = m[5] || 0; + scaleX = Math.sqrt(a * a + b * b); + scaleY = Math.sqrt(d * d + c * c); + rotation = (a || b) ? Math.atan2(b, a) * _RAD2DEG : tm.rotation || 0; //note: if scaleX is 0, we cannot accurately measure rotation. Same for skewX with a scaleY of 0. Therefore, we default to the previously recorded value (or zero if that doesn't exist). + skewX = (c || d) ? Math.atan2(c, d) * _RAD2DEG + rotation : tm.skewX || 0; + tm.scaleX = scaleX; + tm.scaleY = scaleY; + tm.rotation = rotation; + tm.skewX = skewX; + if (_supports3D) { + tm.rotationX = tm.rotationY = tm.z = 0; + tm.perspective = defaultTransformPerspective; + tm.scaleZ = 1; + } + if (tm.svg) { + tm.x -= tm.xOrigin - (tm.xOrigin * a + tm.yOrigin * c); + tm.y -= tm.yOrigin - (tm.xOrigin * b + tm.yOrigin * d); + } + } + if (Math.abs(tm.skewX) > 90 && Math.abs(tm.skewX) < 270) { + if (invX) { + tm.scaleX *= -1; + tm.skewX += (tm.rotation <= 0) ? 180 : -180; + tm.rotation += (tm.rotation <= 0) ? 180 : -180; + } else { + tm.scaleY *= -1; + tm.skewX += (tm.skewX <= 0) ? 180 : -180; + } + } + tm.zOrigin = zOrigin; + //some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 0 in these cases. The conditional logic here is faster than calling Math.abs(). Also, browsers tend to render a SLIGHTLY rotated object in a fuzzy way, so we need to snap to exactly 0 when appropriate. + for (i in tm) { + if (tm[i] < min) if (tm[i] > -min) { + tm[i] = 0; + } + } + } + //DEBUG: _log("parsed rotation of " + t.getAttribute("id")+": "+(tm.rotationX)+", "+(tm.rotationY)+", "+(tm.rotation)+", scale: "+tm.scaleX+", "+tm.scaleY+", "+tm.scaleZ+", position: "+tm.x+", "+tm.y+", "+tm.z+", perspective: "+tm.perspective+ ", origin: "+ tm.xOrigin+ ","+ tm.yOrigin); + if (rec) { + t._gsTransform = tm; //record to the object's _gsTransform which we use so that tweens can control individual properties independently (we need all the properties to accurately recompose the matrix in the setRatio() method) + if (tm.svg) { //if we're supposed to apply transforms to the SVG element's "transform" attribute, make sure there aren't any CSS transforms applied or they'll override the attribute ones. Also clear the transform attribute if we're using CSS, just to be clean. + if (_useSVGTransformAttr && t.style[_transformProp]) { + TweenLite.delayedCall(0.001, function(){ //if we apply this right away (before anything has rendered), we risk there being no transforms for a brief moment and it also interferes with adjusting the transformOrigin in a tween with immediateRender:true (it'd try reading the matrix and it wouldn't have the appropriate data in place because we just removed it). + _removeProp(t.style, _transformProp); + }); + } else if (!_useSVGTransformAttr && t.getAttribute("transform")) { + TweenLite.delayedCall(0.001, function(){ + t.removeAttribute("transform"); + }); + } + } + } + return tm; + }, + + //for setting 2D transforms in IE6, IE7, and IE8 (must use a "filter" to emulate the behavior of modern day browser transforms) + _setIETransformRatio = function(v) { + var t = this.data, //refers to the element's _gsTransform object + ang = -t.rotation * _DEG2RAD, + skew = ang + t.skewX * _DEG2RAD, + rnd = 100000, + a = ((Math.cos(ang) * t.scaleX * rnd) | 0) / rnd, + b = ((Math.sin(ang) * t.scaleX * rnd) | 0) / rnd, + c = ((Math.sin(skew) * -t.scaleY * rnd) | 0) / rnd, + d = ((Math.cos(skew) * t.scaleY * rnd) | 0) / rnd, + style = this.t.style, + cs = this.t.currentStyle, + filters, val; + if (!cs) { + return; + } + val = b; //just for swapping the variables an inverting them (reused "val" to avoid creating another variable in memory). IE's filter matrix uses a non-standard matrix configuration (angle goes the opposite way, and b and c are reversed and inverted) + b = -c; + c = -val; + filters = cs.filter; + style.filter = ""; //remove filters so that we can accurately measure offsetWidth/offsetHeight + var w = this.t.offsetWidth, + h = this.t.offsetHeight, + clip = (cs.position !== "absolute"), + m = "progid:DXImageTransform.Microsoft.Matrix(M11=" + a + ", M12=" + b + ", M21=" + c + ", M22=" + d, + ox = t.x + (w * t.xPercent / 100), + oy = t.y + (h * t.yPercent / 100), + dx, dy; + + //if transformOrigin is being used, adjust the offset x and y + if (t.ox != null) { + dx = ((t.oxp) ? w * t.ox * 0.01 : t.ox) - w / 2; + dy = ((t.oyp) ? h * t.oy * 0.01 : t.oy) - h / 2; + ox += dx - (dx * a + dy * b); + oy += dy - (dx * c + dy * d); + } + + if (!clip) { + m += ", sizingMethod='auto expand')"; + } else { + dx = (w / 2); + dy = (h / 2); + //translate to ensure that transformations occur around the correct origin (default is center). + m += ", Dx=" + (dx - (dx * a + dy * b) + ox) + ", Dy=" + (dy - (dx * c + dy * d) + oy) + ")"; + } + if (filters.indexOf("DXImageTransform.Microsoft.Matrix(") !== -1) { + style.filter = filters.replace(_ieSetMatrixExp, m); + } else { + style.filter = m + " " + filters; //we must always put the transform/matrix FIRST (before alpha(opacity=xx)) to avoid an IE bug that slices part of the object when rotation is applied with alpha. + } + + //at the end or beginning of the tween, if the matrix is normal (1, 0, 0, 1) and opacity is 100 (or doesn't exist), remove the filter to improve browser performance. + if (v === 0 || v === 1) if (a === 1) if (b === 0) if (c === 0) if (d === 1) if (!clip || m.indexOf("Dx=0, Dy=0") !== -1) if (!_opacityExp.test(filters) || parseFloat(RegExp.$1) === 100) if (filters.indexOf("gradient(" && filters.indexOf("Alpha")) === -1) { + style.removeAttribute("filter"); + } + + //we must set the margins AFTER applying the filter in order to avoid some bugs in IE8 that could (in rare scenarios) cause them to be ignored intermittently (vibration). + if (!clip) { + var mult = (_ieVers < 8) ? 1 : -1, //in Internet Explorer 7 and before, the box model is broken, causing the browser to treat the width/height of the actual rotated filtered image as the width/height of the box itself, but Microsoft corrected that in IE8. We must use a negative offset in IE8 on the right/bottom + marg, prop, dif; + dx = t.ieOffsetX || 0; + dy = t.ieOffsetY || 0; + t.ieOffsetX = Math.round((w - ((a < 0 ? -a : a) * w + (b < 0 ? -b : b) * h)) / 2 + ox); + t.ieOffsetY = Math.round((h - ((d < 0 ? -d : d) * h + (c < 0 ? -c : c) * w)) / 2 + oy); + for (i = 0; i < 4; i++) { + prop = _margins[i]; + marg = cs[prop]; + //we need to get the current margin in case it is being tweened separately (we want to respect that tween's changes) + val = (marg.indexOf("px") !== -1) ? parseFloat(marg) : _convertToPixels(this.t, prop, parseFloat(marg), marg.replace(_suffixExp, "")) || 0; + if (val !== t[prop]) { + dif = (i < 2) ? -t.ieOffsetX : -t.ieOffsetY; //if another tween is controlling a margin, we cannot only apply the difference in the ieOffsets, so we essentially zero-out the dx and dy here in that case. We record the margin(s) later so that we can keep comparing them, making this code very flexible. + } else { + dif = (i < 2) ? dx - t.ieOffsetX : dy - t.ieOffsetY; + } + style[prop] = (t[prop] = Math.round( val - dif * ((i === 0 || i === 2) ? 1 : mult) )) + "px"; + } + } + }, + + /* translates a super small decimal to a string WITHOUT scientific notation + _safeDecimal = function(n) { + var s = (n < 0 ? -n : n) + "", + a = s.split("e-"); + return (n < 0 ? "-0." : "0.") + new Array(parseInt(a[1], 10) || 0).join("0") + a[0].split(".").join(""); + }, + */ + + _setTransformRatio = _internals.set3DTransformRatio = _internals.setTransformRatio = function(v) { + var t = this.data, //refers to the element's _gsTransform object + style = this.t.style, + angle = t.rotation, + rotationX = t.rotationX, + rotationY = t.rotationY, + sx = t.scaleX, + sy = t.scaleY, + sz = t.scaleZ, + x = t.x, + y = t.y, + z = t.z, + isSVG = t.svg, + perspective = t.perspective, + force3D = t.force3D, + skewY = t.skewY, + skewX = t.skewX, + t1, a11, a12, a13, a21, a22, a23, a31, a32, a33, a41, a42, a43, + zOrigin, min, cos, sin, t2, transform, comma, zero, skew, rnd; + if (skewY) { //for performance reasons, we combine all skewing into the skewX and rotation values. Remember, a skewY of 10 degrees looks the same as a rotation of 10 degrees plus a skewX of 10 degrees. + skewX += skewY; + angle += skewY; + } + + //check to see if we should render as 2D (and SVGs must use 2D when _useSVGTransformAttr is true) + if (((((v === 1 || v === 0) && force3D === "auto" && (this.tween._totalTime === this.tween._totalDuration || !this.tween._totalTime)) || !force3D) && !z && !perspective && !rotationY && !rotationX && sz === 1) || (_useSVGTransformAttr && isSVG) || !_supports3D) { //on the final render (which could be 0 for a from tween), if there are no 3D aspects, render in 2D to free up memory and improve performance especially on mobile devices. Check the tween's totalTime/totalDuration too in order to make sure it doesn't happen between repeats if it's a repeating tween. + + //2D + if (angle || skewX || isSVG) { + angle *= _DEG2RAD; + skew = skewX * _DEG2RAD; + rnd = 100000; + a11 = Math.cos(angle) * sx; + a21 = Math.sin(angle) * sx; + a12 = Math.sin(angle - skew) * -sy; + a22 = Math.cos(angle - skew) * sy; + if (skew && t.skewType === "simple") { //by default, we compensate skewing on the other axis to make it look more natural, but you can set the skewType to "simple" to use the uncompensated skewing that CSS does + t1 = Math.tan(skew - skewY * _DEG2RAD); + t1 = Math.sqrt(1 + t1 * t1); + a12 *= t1; + a22 *= t1; + if (skewY) { + t1 = Math.tan(skewY * _DEG2RAD); + t1 = Math.sqrt(1 + t1 * t1); + a11 *= t1; + a21 *= t1; + } + } + if (isSVG) { + x += t.xOrigin - (t.xOrigin * a11 + t.yOrigin * a12) + t.xOffset; + y += t.yOrigin - (t.xOrigin * a21 + t.yOrigin * a22) + t.yOffset; + if (_useSVGTransformAttr && (t.xPercent || t.yPercent)) { //The SVG spec doesn't support percentage-based translation in the "transform" attribute, so we merge it into the matrix to simulate it. + min = this.t.getBBox(); + x += t.xPercent * 0.01 * min.width; + y += t.yPercent * 0.01 * min.height; + } + min = 0.000001; + if (x < min) if (x > -min) { + x = 0; + } + if (y < min) if (y > -min) { + y = 0; + } + } + transform = (((a11 * rnd) | 0) / rnd) + "," + (((a21 * rnd) | 0) / rnd) + "," + (((a12 * rnd) | 0) / rnd) + "," + (((a22 * rnd) | 0) / rnd) + "," + x + "," + y + ")"; + if (isSVG && _useSVGTransformAttr) { + this.t.setAttribute("transform", "matrix(" + transform); + } else { + //some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 5 decimal places. + style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix(" : "matrix(") + transform; + } + } else { + style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix(" : "matrix(") + sx + ",0,0," + sy + "," + x + "," + y + ")"; + } + return; + + } + if (_isFirefox) { //Firefox has a bug (at least in v25) that causes it to render the transparent part of 32-bit PNG images as black when displayed inside an iframe and the 3D scale is very small and doesn't change sufficiently enough between renders (like if you use a Power4.easeInOut to scale from 0 to 1 where the beginning values only change a tiny amount to begin the tween before accelerating). In this case, we force the scale to be 0.00002 instead which is visually the same but works around the Firefox issue. + min = 0.0001; + if (sx < min && sx > -min) { + sx = sz = 0.00002; + } + if (sy < min && sy > -min) { + sy = sz = 0.00002; + } + if (perspective && !t.z && !t.rotationX && !t.rotationY) { //Firefox has a bug that causes elements to have an odd super-thin, broken/dotted black border on elements that have a perspective set but aren't utilizing 3D space (no rotationX, rotationY, or z). + perspective = 0; + } + } + if (angle || skewX) { + angle *= _DEG2RAD; + cos = a11 = Math.cos(angle); + sin = a21 = Math.sin(angle); + if (skewX) { + angle -= skewX * _DEG2RAD; + cos = Math.cos(angle); + sin = Math.sin(angle); + if (t.skewType === "simple") { //by default, we compensate skewing on the other axis to make it look more natural, but you can set the skewType to "simple" to use the uncompensated skewing that CSS does + t1 = Math.tan((skewX - skewY) * _DEG2RAD); + t1 = Math.sqrt(1 + t1 * t1); + cos *= t1; + sin *= t1; + if (t.skewY) { + t1 = Math.tan(skewY * _DEG2RAD); + t1 = Math.sqrt(1 + t1 * t1); + a11 *= t1; + a21 *= t1; + } + } + } + a12 = -sin; + a22 = cos; + + } else if (!rotationY && !rotationX && sz === 1 && !perspective && !isSVG) { //if we're only translating and/or 2D scaling, this is faster... + style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) translate3d(" : "translate3d(") + x + "px," + y + "px," + z +"px)" + ((sx !== 1 || sy !== 1) ? " scale(" + sx + "," + sy + ")" : ""); + return; + } else { + a11 = a22 = 1; + a12 = a21 = 0; + } + // KEY INDEX AFFECTS a[row][column] + // a11 0 rotation, rotationY, scaleX + // a21 1 rotation, rotationY, scaleX + // a31 2 rotationY, scaleX + // a41 3 rotationY, scaleX + // a12 4 rotation, skewX, rotationX, scaleY + // a22 5 rotation, skewX, rotationX, scaleY + // a32 6 rotationX, scaleY + // a42 7 rotationX, scaleY + // a13 8 rotationY, rotationX, scaleZ + // a23 9 rotationY, rotationX, scaleZ + // a33 10 rotationY, rotationX, scaleZ + // a43 11 rotationY, rotationX, perspective, scaleZ + // a14 12 x, zOrigin, svgOrigin + // a24 13 y, zOrigin, svgOrigin + // a34 14 z, zOrigin + // a44 15 + // rotation: Math.atan2(a21, a11) + // rotationY: Math.atan2(a13, a33) (or Math.atan2(a13, a11)) + // rotationX: Math.atan2(a32, a33) + a33 = 1; + a13 = a23 = a31 = a32 = a41 = a42 = 0; + a43 = (perspective) ? -1 / perspective : 0; + zOrigin = t.zOrigin; + min = 0.000001; //threshold below which browsers use scientific notation which won't work. + comma = ","; + zero = "0"; + angle = rotationY * _DEG2RAD; + if (angle) { + cos = Math.cos(angle); + sin = Math.sin(angle); + a31 = -sin; + a41 = a43*-sin; + a13 = a11*sin; + a23 = a21*sin; + a33 = cos; + a43 *= cos; + a11 *= cos; + a21 *= cos; + } + angle = rotationX * _DEG2RAD; + if (angle) { + cos = Math.cos(angle); + sin = Math.sin(angle); + t1 = a12*cos+a13*sin; + t2 = a22*cos+a23*sin; + a32 = a33*sin; + a42 = a43*sin; + a13 = a12*-sin+a13*cos; + a23 = a22*-sin+a23*cos; + a33 = a33*cos; + a43 = a43*cos; + a12 = t1; + a22 = t2; + } + if (sz !== 1) { + a13*=sz; + a23*=sz; + a33*=sz; + a43*=sz; + } + if (sy !== 1) { + a12*=sy; + a22*=sy; + a32*=sy; + a42*=sy; + } + if (sx !== 1) { + a11*=sx; + a21*=sx; + a31*=sx; + a41*=sx; + } + + if (zOrigin || isSVG) { + if (zOrigin) { + x += a13*-zOrigin; + y += a23*-zOrigin; + z += a33*-zOrigin+zOrigin; + } + if (isSVG) { //due to bugs in some browsers, we need to manage the transform-origin of SVG manually + x += t.xOrigin - (t.xOrigin * a11 + t.yOrigin * a12) + t.xOffset; + y += t.yOrigin - (t.xOrigin * a21 + t.yOrigin * a22) + t.yOffset; + } + if (x < min && x > -min) { + x = zero; + } + if (y < min && y > -min) { + y = zero; + } + if (z < min && z > -min) { + z = 0; //don't use string because we calculate perspective later and need the number. + } + } + + //optimized way of concatenating all the values into a string. If we do it all in one shot, it's slower because of the way browsers have to create temp strings and the way it affects memory. If we do it piece-by-piece with +=, it's a bit slower too. We found that doing it in these sized chunks works best overall: + transform = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix3d(" : "matrix3d("); + transform += ((a11 < min && a11 > -min) ? zero : a11) + comma + ((a21 < min && a21 > -min) ? zero : a21) + comma + ((a31 < min && a31 > -min) ? zero : a31); + transform += comma + ((a41 < min && a41 > -min) ? zero : a41) + comma + ((a12 < min && a12 > -min) ? zero : a12) + comma + ((a22 < min && a22 > -min) ? zero : a22); + if (rotationX || rotationY || sz !== 1) { //performance optimization (often there's no rotationX or rotationY, so we can skip these calculations) + transform += comma + ((a32 < min && a32 > -min) ? zero : a32) + comma + ((a42 < min && a42 > -min) ? zero : a42) + comma + ((a13 < min && a13 > -min) ? zero : a13); + transform += comma + ((a23 < min && a23 > -min) ? zero : a23) + comma + ((a33 < min && a33 > -min) ? zero : a33) + comma + ((a43 < min && a43 > -min) ? zero : a43) + comma; + } else { + transform += ",0,0,0,0,1,0,"; + } + transform += x + comma + y + comma + z + comma + (perspective ? (1 + (-z / perspective)) : 1) + ")"; + + style[_transformProp] = transform; + }; + + p = Transform.prototype; + p.x = p.y = p.z = p.skewX = p.skewY = p.rotation = p.rotationX = p.rotationY = p.zOrigin = p.xPercent = p.yPercent = p.xOffset = p.yOffset = 0; + p.scaleX = p.scaleY = p.scaleZ = 1; + + _registerComplexSpecialProp("transform,scale,scaleX,scaleY,scaleZ,x,y,z,rotation,rotationX,rotationY,rotationZ,skewX,skewY,shortRotation,shortRotationX,shortRotationY,shortRotationZ,transformOrigin,svgOrigin,transformPerspective,directionalRotation,parseTransform,force3D,skewType,xPercent,yPercent,smoothOrigin", {parser:function(t, e, parsingProp, cssp, pt, plugin, vars) { + if (cssp._lastParsedTransform === vars) { return pt; } //only need to parse the transform once, and only if the browser supports it. + cssp._lastParsedTransform = vars; + var scaleFunc = (vars.scale && typeof(vars.scale) === "function") ? vars.scale : 0; //if there's a function-based "scale" value, swap in the resulting numeric value temporarily. Otherwise, if it's called for both scaleX and scaleY independently, they may not match (like if the function uses Math.random()). + if (scaleFunc) { + vars.scale = scaleFunc(_index, t); + } + var originalGSTransform = t._gsTransform, + style = t.style, + min = 0.000001, + i = _transformProps.length, + v = vars, + endRotations = {}, + transformOriginString = "transformOrigin", + m1 = _getTransform(t, _cs, true, v.parseTransform), + orig = v.transform && ((typeof(v.transform) === "function") ? v.transform(_index, _target) : v.transform), + m2, copy, has3D, hasChange, dr, x, y, matrix, p; + m1.skewType = v.skewType || m1.skewType || CSSPlugin.defaultSkewType; + cssp._transform = m1; + if ("rotationZ" in v) { + v.rotation = v.rotationZ; + } + if (orig && typeof(orig) === "string" && _transformProp) { //for values like transform:"rotate(60deg) scale(0.5, 0.8)" + copy = _tempDiv.style; //don't use the original target because it might be SVG in which case some browsers don't report computed style correctly. + copy[_transformProp] = orig; + copy.display = "block"; //if display is "none", the browser often refuses to report the transform properties correctly. + copy.position = "absolute"; + if (orig.indexOf("%") !== -1) { //%-based translations will fail unless we set the width/height to match the original target... + copy.width = _getStyle(t, "width"); + copy.height = _getStyle(t, "height"); + } + _doc.body.appendChild(_tempDiv); + m2 = _getTransform(_tempDiv, null, false); + if (m1.skewType === "simple") { //the default _getTransform() reports the skewX/scaleY as if skewType is "compensated", thus we need to adjust that here if skewType is "simple". + m2.scaleY *= Math.cos(m2.skewX * _DEG2RAD); + } + if (m1.svg) { //if it's an SVG element, x/y part of the matrix will be affected by whatever we use as the origin and the offsets, so compensate here... + x = m1.xOrigin; + y = m1.yOrigin; + m2.x -= m1.xOffset; + m2.y -= m1.yOffset; + if (v.transformOrigin || v.svgOrigin) { //if this tween is altering the origin, we must factor that in here. The actual work of recording the transformOrigin values and setting up the PropTween is done later (still inside this function) so we cannot leave the changes intact here - we only want to update the x/y accordingly. + orig = {}; + _parseSVGOrigin(t, _parsePosition(v.transformOrigin), orig, v.svgOrigin, v.smoothOrigin, true); + x = orig.xOrigin; + y = orig.yOrigin; + m2.x -= orig.xOffset - m1.xOffset; + m2.y -= orig.yOffset - m1.yOffset; + } + if (x || y) { + matrix = _getMatrix(_tempDiv, true); + m2.x -= x - (x * matrix[0] + y * matrix[2]); + m2.y -= y - (x * matrix[1] + y * matrix[3]); + } + } + _doc.body.removeChild(_tempDiv); + if (!m2.perspective) { + m2.perspective = m1.perspective; //tweening to no perspective gives very unintuitive results - just keep the same perspective in that case. + } + if (v.xPercent != null) { + m2.xPercent = _parseVal(v.xPercent, m1.xPercent); + } + if (v.yPercent != null) { + m2.yPercent = _parseVal(v.yPercent, m1.yPercent); + } + } else if (typeof(v) === "object") { //for values like scaleX, scaleY, rotation, x, y, skewX, and skewY or transform:{...} (object) + m2 = {scaleX:_parseVal((v.scaleX != null) ? v.scaleX : v.scale, m1.scaleX), + scaleY:_parseVal((v.scaleY != null) ? v.scaleY : v.scale, m1.scaleY), + scaleZ:_parseVal(v.scaleZ, m1.scaleZ), + x:_parseVal(v.x, m1.x), + y:_parseVal(v.y, m1.y), + z:_parseVal(v.z, m1.z), + xPercent:_parseVal(v.xPercent, m1.xPercent), + yPercent:_parseVal(v.yPercent, m1.yPercent), + perspective:_parseVal(v.transformPerspective, m1.perspective)}; + dr = v.directionalRotation; + if (dr != null) { + if (typeof(dr) === "object") { + for (copy in dr) { + v[copy] = dr[copy]; + } + } else { + v.rotation = dr; + } + } + if (typeof(v.x) === "string" && v.x.indexOf("%") !== -1) { + m2.x = 0; + m2.xPercent = _parseVal(v.x, m1.xPercent); + } + if (typeof(v.y) === "string" && v.y.indexOf("%") !== -1) { + m2.y = 0; + m2.yPercent = _parseVal(v.y, m1.yPercent); + } + + m2.rotation = _parseAngle(("rotation" in v) ? v.rotation : ("shortRotation" in v) ? v.shortRotation + "_short" : m1.rotation, m1.rotation, "rotation", endRotations); + if (_supports3D) { + m2.rotationX = _parseAngle(("rotationX" in v) ? v.rotationX : ("shortRotationX" in v) ? v.shortRotationX + "_short" : m1.rotationX || 0, m1.rotationX, "rotationX", endRotations); + m2.rotationY = _parseAngle(("rotationY" in v) ? v.rotationY : ("shortRotationY" in v) ? v.shortRotationY + "_short" : m1.rotationY || 0, m1.rotationY, "rotationY", endRotations); + } + m2.skewX = _parseAngle(v.skewX, m1.skewX); + m2.skewY = _parseAngle(v.skewY, m1.skewY); + } + if (_supports3D && v.force3D != null) { + m1.force3D = v.force3D; + hasChange = true; + } + + has3D = (m1.force3D || m1.z || m1.rotationX || m1.rotationY || m2.z || m2.rotationX || m2.rotationY || m2.perspective); + if (!has3D && v.scale != null) { + m2.scaleZ = 1; //no need to tween scaleZ. + } + + while (--i > -1) { + p = _transformProps[i]; + orig = m2[p] - m1[p]; + if (orig > min || orig < -min || v[p] != null || _forcePT[p] != null) { + hasChange = true; + pt = new CSSPropTween(m1, p, m1[p], orig, pt); + if (p in endRotations) { + pt.e = endRotations[p]; //directional rotations typically have compensated values during the tween, but we need to make sure they end at exactly what the user requested + } + pt.xs0 = 0; //ensures the value stays numeric in setRatio() + pt.plugin = plugin; + cssp._overwriteProps.push(pt.n); + } + } + + orig = (typeof(v.transformOrigin) === "function") ? v.transformOrigin(_index, _target) : v.transformOrigin; + if (m1.svg && (orig || v.svgOrigin)) { + x = m1.xOffset; //when we change the origin, in order to prevent things from jumping we adjust the x/y so we must record those here so that we can create PropTweens for them and flip them at the same time as the origin + y = m1.yOffset; + _parseSVGOrigin(t, _parsePosition(orig), m2, v.svgOrigin, v.smoothOrigin); + pt = _addNonTweeningNumericPT(m1, "xOrigin", (originalGSTransform ? m1 : m2).xOrigin, m2.xOrigin, pt, transformOriginString); //note: if there wasn't a transformOrigin defined yet, just start with the destination one; it's wasteful otherwise, and it causes problems with fromTo() tweens. For example, TweenLite.to("#wheel", 3, {rotation:180, transformOrigin:"50% 50%", delay:1}); TweenLite.fromTo("#wheel", 3, {scale:0.5, transformOrigin:"50% 50%"}, {scale:1, delay:2}); would cause a jump when the from values revert at the beginning of the 2nd tween. + pt = _addNonTweeningNumericPT(m1, "yOrigin", (originalGSTransform ? m1 : m2).yOrigin, m2.yOrigin, pt, transformOriginString); + if (x !== m1.xOffset || y !== m1.yOffset) { + pt = _addNonTweeningNumericPT(m1, "xOffset", (originalGSTransform ? x : m1.xOffset), m1.xOffset, pt, transformOriginString); + pt = _addNonTweeningNumericPT(m1, "yOffset", (originalGSTransform ? y : m1.yOffset), m1.yOffset, pt, transformOriginString); + } + orig = "0px 0px"; //certain browsers (like firefox) completely botch transform-origin, so we must remove it to prevent it from contaminating transforms. We manage it ourselves with xOrigin and yOrigin + } + if (orig || (_supports3D && has3D && m1.zOrigin)) { //if anything 3D is happening and there's a transformOrigin with a z component that's non-zero, we must ensure that the transformOrigin's z-component is set to 0 so that we can manually do those calculations to get around Safari bugs. Even if the user didn't specifically define a "transformOrigin" in this particular tween (maybe they did it via css directly). + if (_transformProp) { + hasChange = true; + p = _transformOriginProp; + if (!orig) { + orig = (_getStyle(t, p, _cs, false, "50% 50%") + "").split(" "); + orig = orig[0] + " " + orig[1] + " " + m1.zOrigin + "px"; + } + orig += ""; + pt = new CSSPropTween(style, p, 0, 0, pt, -1, transformOriginString); + pt.b = style[p]; + pt.plugin = plugin; + if (_supports3D) { + copy = m1.zOrigin; + orig = orig.split(" "); + m1.zOrigin = ((orig.length > 2) ? parseFloat(orig[2]) : copy) || 0; //Safari doesn't handle the z part of transformOrigin correctly, so we'll manually handle it in the _set3DTransformRatio() method. + pt.xs0 = pt.e = orig[0] + " " + (orig[1] || "50%") + " 0px"; //we must define a z value of 0px specifically otherwise iOS 5 Safari will stick with the old one (if one was defined)! + pt = new CSSPropTween(m1, "zOrigin", 0, 0, pt, -1, pt.n); //we must create a CSSPropTween for the _gsTransform.zOrigin so that it gets reset properly at the beginning if the tween runs backward (as opposed to just setting m1.zOrigin here) + pt.b = copy; + pt.xs0 = pt.e = m1.zOrigin; + } else { + pt.xs0 = pt.e = orig; + } + + //for older versions of IE (6-8), we need to manually calculate things inside the setRatio() function. We record origin x and y (ox and oy) and whether or not the values are percentages (oxp and oyp). + } else { + _parsePosition(orig + "", m1); + } + } + if (hasChange) { + cssp._transformType = (!(m1.svg && _useSVGTransformAttr) && (has3D || this._transformType === 3)) ? 3 : 2; //quicker than calling cssp._enableTransforms(); + } + if (scaleFunc) { + vars.scale = scaleFunc; + } + return pt; + }, allowFunc:true, prefix:true}); + + _registerComplexSpecialProp("boxShadow", {defaultValue:"0px 0px 0px 0px #999", prefix:true, color:true, multi:true, keyword:"inset"}); + _registerComplexSpecialProp("clipPath", {defaultValue:"inset(0px)", prefix:true, multi:true, formatter:_getFormatter("inset(0px 0px 0px 0px)", false, true)}); + + _registerComplexSpecialProp("borderRadius", {defaultValue:"0px", parser:function(t, e, p, cssp, pt, plugin) { + e = this.format(e); + var props = ["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"], + style = t.style, + ea1, i, es2, bs2, bs, es, bn, en, w, h, esfx, bsfx, rel, hn, vn, em; + w = parseFloat(t.offsetWidth); + h = parseFloat(t.offsetHeight); + ea1 = e.split(" "); + for (i = 0; i < props.length; i++) { //if we're dealing with percentages, we must convert things separately for the horizontal and vertical axis! + if (this.p.indexOf("border")) { //older browsers used a prefix + props[i] = _checkPropPrefix(props[i]); + } + bs = bs2 = _getStyle(t, props[i], _cs, false, "0px"); + if (bs.indexOf(" ") !== -1) { + bs2 = bs.split(" "); + bs = bs2[0]; + bs2 = bs2[1]; + } + es = es2 = ea1[i]; + bn = parseFloat(bs); + bsfx = bs.substr((bn + "").length); + rel = (es.charAt(1) === "="); + if (rel) { + en = parseInt(es.charAt(0)+"1", 10); + es = es.substr(2); + en *= parseFloat(es); + esfx = es.substr((en + "").length - (en < 0 ? 1 : 0)) || ""; + } else { + en = parseFloat(es); + esfx = es.substr((en + "").length); + } + if (esfx === "") { + esfx = _suffixMap[p] || bsfx; + } + if (esfx !== bsfx) { + hn = _convertToPixels(t, "borderLeft", bn, bsfx); //horizontal number (we use a bogus "borderLeft" property just because the _convertToPixels() method searches for the keywords "Left", "Right", "Top", and "Bottom" to determine of it's a horizontal or vertical property, and we need "border" in the name so that it knows it should measure relative to the element itself, not its parent. + vn = _convertToPixels(t, "borderTop", bn, bsfx); //vertical number + if (esfx === "%") { + bs = (hn / w * 100) + "%"; + bs2 = (vn / h * 100) + "%"; + } else if (esfx === "em") { + em = _convertToPixels(t, "borderLeft", 1, "em"); + bs = (hn / em) + "em"; + bs2 = (vn / em) + "em"; + } else { + bs = hn + "px"; + bs2 = vn + "px"; + } + if (rel) { + es = (parseFloat(bs) + en) + esfx; + es2 = (parseFloat(bs2) + en) + esfx; + } + } + pt = _parseComplex(style, props[i], bs + " " + bs2, es + " " + es2, false, "0px", pt); + } + return pt; + }, prefix:true, formatter:_getFormatter("0px 0px 0px 0px", false, true)}); + _registerComplexSpecialProp("borderBottomLeftRadius,borderBottomRightRadius,borderTopLeftRadius,borderTopRightRadius", {defaultValue:"0px", parser:function(t, e, p, cssp, pt, plugin) { + return _parseComplex(t.style, p, this.format(_getStyle(t, p, _cs, false, "0px 0px")), this.format(e), false, "0px", pt); + }, prefix:true, formatter:_getFormatter("0px 0px", false, true)}); + _registerComplexSpecialProp("backgroundPosition", {defaultValue:"0 0", parser:function(t, e, p, cssp, pt, plugin) { + var bp = "background-position", + cs = (_cs || _getComputedStyle(t, null)), + bs = this.format( ((cs) ? _ieVers ? cs.getPropertyValue(bp + "-x") + " " + cs.getPropertyValue(bp + "-y") : cs.getPropertyValue(bp) : t.currentStyle.backgroundPositionX + " " + t.currentStyle.backgroundPositionY) || "0 0"), //Internet Explorer doesn't report background-position correctly - we must query background-position-x and background-position-y and combine them (even in IE10). Before IE9, we must do the same with the currentStyle object and use camelCase + es = this.format(e), + ba, ea, i, pct, overlap, src; + if ((bs.indexOf("%") !== -1) !== (es.indexOf("%") !== -1) && es.split(",").length < 2) { + src = _getStyle(t, "backgroundImage").replace(_urlExp, ""); + if (src && src !== "none") { + ba = bs.split(" "); + ea = es.split(" "); + _tempImg.setAttribute("src", src); //set the temp IMG's src to the background-image so that we can measure its width/height + i = 2; + while (--i > -1) { + bs = ba[i]; + pct = (bs.indexOf("%") !== -1); + if (pct !== (ea[i].indexOf("%") !== -1)) { + overlap = (i === 0) ? t.offsetWidth - _tempImg.width : t.offsetHeight - _tempImg.height; + ba[i] = pct ? (parseFloat(bs) / 100 * overlap) + "px" : (parseFloat(bs) / overlap * 100) + "%"; + } + } + bs = ba.join(" "); + } + } + return this.parseComplex(t.style, bs, es, pt, plugin); + }, formatter:_parsePosition}); + _registerComplexSpecialProp("backgroundSize", {defaultValue:"0 0", formatter:function(v) { + v += ""; //ensure it's a string + return (v.substr(0,2) === "co") ? v : _parsePosition(v.indexOf(" ") === -1 ? v + " " + v : v); //if set to something like "100% 100%", Safari typically reports the computed style as just "100%" (no 2nd value), but we should ensure that there are two values, so copy the first one. Otherwise, it'd be interpreted as "100% 0" (wrong). Also remember that it could be "cover" or "contain" which we can't tween but should be able to set. + }}); + _registerComplexSpecialProp("perspective", {defaultValue:"0px", prefix:true}); + _registerComplexSpecialProp("perspectiveOrigin", {defaultValue:"50% 50%", prefix:true}); + _registerComplexSpecialProp("transformStyle", {prefix:true}); + _registerComplexSpecialProp("backfaceVisibility", {prefix:true}); + _registerComplexSpecialProp("userSelect", {prefix:true}); + _registerComplexSpecialProp("margin", {parser:_getEdgeParser("marginTop,marginRight,marginBottom,marginLeft")}); + _registerComplexSpecialProp("padding", {parser:_getEdgeParser("paddingTop,paddingRight,paddingBottom,paddingLeft")}); + _registerComplexSpecialProp("clip", {defaultValue:"rect(0px,0px,0px,0px)", parser:function(t, e, p, cssp, pt, plugin){ + var b, cs, delim; + if (_ieVers < 9) { //IE8 and earlier don't report a "clip" value in the currentStyle - instead, the values are split apart into clipTop, clipRight, clipBottom, and clipLeft. Also, in IE7 and earlier, the values inside rect() are space-delimited, not comma-delimited. + cs = t.currentStyle; + delim = _ieVers < 8 ? " " : ","; + b = "rect(" + cs.clipTop + delim + cs.clipRight + delim + cs.clipBottom + delim + cs.clipLeft + ")"; + e = this.format(e).split(",").join(delim); + } else { + b = this.format(_getStyle(t, this.p, _cs, false, this.dflt)); + e = this.format(e); + } + return this.parseComplex(t.style, b, e, pt, plugin); + }}); + _registerComplexSpecialProp("textShadow", {defaultValue:"0px 0px 0px #999", color:true, multi:true}); + _registerComplexSpecialProp("autoRound,strictUnits", {parser:function(t, e, p, cssp, pt) {return pt;}}); //just so that we can ignore these properties (not tween them) + _registerComplexSpecialProp("border", {defaultValue:"0px solid #000", parser:function(t, e, p, cssp, pt, plugin) { + var bw = _getStyle(t, "borderTopWidth", _cs, false, "0px"), + end = this.format(e).split(" "), + esfx = end[0].replace(_suffixExp, ""); + if (esfx !== "px") { //if we're animating to a non-px value, we need to convert the beginning width to that unit. + bw = (parseFloat(bw) / _convertToPixels(t, "borderTopWidth", 1, esfx)) + esfx; + } + return this.parseComplex(t.style, this.format(bw + " " + _getStyle(t, "borderTopStyle", _cs, false, "solid") + " " + _getStyle(t, "borderTopColor", _cs, false, "#000")), end.join(" "), pt, plugin); + }, color:true, formatter:function(v) { + var a = v.split(" "); + return a[0] + " " + (a[1] || "solid") + " " + (v.match(_colorExp) || ["#000"])[0]; + }}); + _registerComplexSpecialProp("borderWidth", {parser:_getEdgeParser("borderTopWidth,borderRightWidth,borderBottomWidth,borderLeftWidth")}); //Firefox doesn't pick up on borderWidth set in style sheets (only inline). + _registerComplexSpecialProp("float,cssFloat,styleFloat", {parser:function(t, e, p, cssp, pt, plugin) { + var s = t.style, + prop = ("cssFloat" in s) ? "cssFloat" : "styleFloat"; + return new CSSPropTween(s, prop, 0, 0, pt, -1, p, false, 0, s[prop], e); + }}); + + //opacity-related + var _setIEOpacityRatio = function(v) { + var t = this.t, //refers to the element's style property + filters = t.filter || _getStyle(this.data, "filter") || "", + val = (this.s + this.c * v) | 0, + skip; + if (val === 100) { //for older versions of IE that need to use a filter to apply opacity, we should remove the filter if opacity hits 1 in order to improve performance, but make sure there isn't a transform (matrix) or gradient in the filters. + if (filters.indexOf("atrix(") === -1 && filters.indexOf("radient(") === -1 && filters.indexOf("oader(") === -1) { + t.removeAttribute("filter"); + skip = (!_getStyle(this.data, "filter")); //if a class is applied that has an alpha filter, it will take effect (we don't want that), so re-apply our alpha filter in that case. We must first remove it and then check. + } else { + t.filter = filters.replace(_alphaFilterExp, ""); + skip = true; + } + } + if (!skip) { + if (this.xn1) { + t.filter = filters = filters || ("alpha(opacity=" + val + ")"); //works around bug in IE7/8 that prevents changes to "visibility" from being applied properly if the filter is changed to a different alpha on the same frame. + } + if (filters.indexOf("pacity") === -1) { //only used if browser doesn't support the standard opacity style property (IE 7 and 8). We omit the "O" to avoid case-sensitivity issues + if (val !== 0 || !this.xn1) { //bugs in IE7/8 won't render the filter properly if opacity is ADDED on the same frame/render as "visibility" changes (this.xn1 is 1 if this tween is an "autoAlpha" tween) + t.filter = filters + " alpha(opacity=" + val + ")"; //we round the value because otherwise, bugs in IE7/8 can prevent "visibility" changes from being applied properly. + } + } else { + t.filter = filters.replace(_opacityExp, "opacity=" + val); + } + } + }; + _registerComplexSpecialProp("opacity,alpha,autoAlpha", {defaultValue:"1", parser:function(t, e, p, cssp, pt, plugin) { + var b = parseFloat(_getStyle(t, "opacity", _cs, false, "1")), + style = t.style, + isAutoAlpha = (p === "autoAlpha"); + if (typeof(e) === "string" && e.charAt(1) === "=") { + e = ((e.charAt(0) === "-") ? -1 : 1) * parseFloat(e.substr(2)) + b; + } + if (isAutoAlpha && b === 1 && _getStyle(t, "visibility", _cs) === "hidden" && e !== 0) { //if visibility is initially set to "hidden", we should interpret that as intent to make opacity 0 (a convenience) + b = 0; + } + if (_supportsOpacity) { + pt = new CSSPropTween(style, "opacity", b, e - b, pt); + } else { + pt = new CSSPropTween(style, "opacity", b * 100, (e - b) * 100, pt); + pt.xn1 = isAutoAlpha ? 1 : 0; //we need to record whether or not this is an autoAlpha so that in the setRatio(), we know to duplicate the setting of the alpha in order to work around a bug in IE7 and IE8 that prevents changes to "visibility" from taking effect if the filter is changed to a different alpha(opacity) at the same time. Setting it to the SAME value first, then the new value works around the IE7/8 bug. + style.zoom = 1; //helps correct an IE issue. + pt.type = 2; + pt.b = "alpha(opacity=" + pt.s + ")"; + pt.e = "alpha(opacity=" + (pt.s + pt.c) + ")"; + pt.data = t; + pt.plugin = plugin; + pt.setRatio = _setIEOpacityRatio; + } + if (isAutoAlpha) { //we have to create the "visibility" PropTween after the opacity one in the linked list so that they run in the order that works properly in IE8 and earlier + pt = new CSSPropTween(style, "visibility", 0, 0, pt, -1, null, false, 0, ((b !== 0) ? "inherit" : "hidden"), ((e === 0) ? "hidden" : "inherit")); + pt.xs0 = "inherit"; + cssp._overwriteProps.push(pt.n); + cssp._overwriteProps.push(p); + } + return pt; + }}); + + + var _removeProp = function(s, p) { + if (p) { + if (s.removeProperty) { + if (p.substr(0,2) === "ms" || p.substr(0,6) === "webkit") { //Microsoft and some Webkit browsers don't conform to the standard of capitalizing the first prefix character, so we adjust so that when we prefix the caps with a dash, it's correct (otherwise it'd be "ms-transform" instead of "-ms-transform" for IE9, for example) + p = "-" + p; + } + s.removeProperty(p.replace(_capsExp, "-$1").toLowerCase()); + } else { //note: old versions of IE use "removeAttribute()" instead of "removeProperty()" + s.removeAttribute(p); + } + } + }, + _setClassNameRatio = function(v) { + this.t._gsClassPT = this; + if (v === 1 || v === 0) { + this.t.setAttribute("class", (v === 0) ? this.b : this.e); + var mpt = this.data, //first MiniPropTween + s = this.t.style; + while (mpt) { + if (!mpt.v) { + _removeProp(s, mpt.p); + } else { + s[mpt.p] = mpt.v; + } + mpt = mpt._next; + } + if (v === 1 && this.t._gsClassPT === this) { + this.t._gsClassPT = null; + } + } else if (this.t.getAttribute("class") !== this.e) { + this.t.setAttribute("class", this.e); + } + }; + _registerComplexSpecialProp("className", {parser:function(t, e, p, cssp, pt, plugin, vars) { + var b = t.getAttribute("class") || "", //don't use t.className because it doesn't work consistently on SVG elements; getAttribute("class") and setAttribute("class", value") is more reliable. + cssText = t.style.cssText, + difData, bs, cnpt, cnptLookup, mpt; + pt = cssp._classNamePT = new CSSPropTween(t, p, 0, 0, pt, 2); + pt.setRatio = _setClassNameRatio; + pt.pr = -11; + _hasPriority = true; + pt.b = b; + bs = _getAllStyles(t, _cs); + //if there's a className tween already operating on the target, force it to its end so that the necessary inline styles are removed and the class name is applied before we determine the end state (we don't want inline styles interfering that were there just for class-specific values) + cnpt = t._gsClassPT; + if (cnpt) { + cnptLookup = {}; + mpt = cnpt.data; //first MiniPropTween which stores the inline styles - we need to force these so that the inline styles don't contaminate things. Otherwise, there's a small chance that a tween could start and the inline values match the destination values and they never get cleaned. + while (mpt) { + cnptLookup[mpt.p] = 1; + mpt = mpt._next; + } + cnpt.setRatio(1); + } + t._gsClassPT = pt; + pt.e = (e.charAt(1) !== "=") ? e : b.replace(new RegExp("(?:\\s|^)" + e.substr(2) + "(?![\\w-])"), "") + ((e.charAt(0) === "+") ? " " + e.substr(2) : ""); + t.setAttribute("class", pt.e); + difData = _cssDif(t, bs, _getAllStyles(t), vars, cnptLookup); + t.setAttribute("class", b); + pt.data = difData.firstMPT; + t.style.cssText = cssText; //we recorded cssText before we swapped classes and ran _getAllStyles() because in cases when a className tween is overwritten, we remove all the related tweening properties from that class change (otherwise class-specific stuff can't override properties we've directly set on the target's style object due to specificity). + pt = pt.xfirst = cssp.parse(t, difData.difs, pt, plugin); //we record the CSSPropTween as the xfirst so that we can handle overwriting propertly (if "className" gets overwritten, we must kill all the properties associated with the className part of the tween, so we can loop through from xfirst to the pt itself) + return pt; + }}); + + + var _setClearPropsRatio = function(v) { + if (v === 1 || v === 0) if (this.data._totalTime === this.data._totalDuration && this.data.data !== "isFromStart") { //this.data refers to the tween. Only clear at the END of the tween (remember, from() tweens make the ratio go from 1 to 0, so we can't just check that and if the tween is the zero-duration one that's created internally to render the starting values in a from() tween, ignore that because otherwise, for example, from(...{height:100, clearProps:"height", delay:1}) would wipe the height at the beginning of the tween and after 1 second, it'd kick back in). + var s = this.t.style, + transformParse = _specialProps.transform.parse, + a, p, i, clearTransform, transform; + if (this.e === "all") { + s.cssText = ""; + clearTransform = true; + } else { + a = this.e.split(" ").join("").split(","); + i = a.length; + while (--i > -1) { + p = a[i]; + if (_specialProps[p]) { + if (_specialProps[p].parse === transformParse) { + clearTransform = true; + } else { + p = (p === "transformOrigin") ? _transformOriginProp : _specialProps[p].p; //ensures that special properties use the proper browser-specific property name, like "scaleX" might be "-webkit-transform" or "boxShadow" might be "-moz-box-shadow" + } + } + _removeProp(s, p); + } + } + if (clearTransform) { + _removeProp(s, _transformProp); + transform = this.t._gsTransform; + if (transform) { + if (transform.svg) { + this.t.removeAttribute("data-svg-origin"); + this.t.removeAttribute("transform"); + } + delete this.t._gsTransform; + } + } + + } + }; + _registerComplexSpecialProp("clearProps", {parser:function(t, e, p, cssp, pt) { + pt = new CSSPropTween(t, p, 0, 0, pt, 2); + pt.setRatio = _setClearPropsRatio; + pt.e = e; + pt.pr = -10; + pt.data = cssp._tween; + _hasPriority = true; + return pt; + }}); + + p = "bezier,throwProps,physicsProps,physics2D".split(","); + i = p.length; + while (i--) { + _registerPluginProp(p[i]); + } + + + + + + + + + p = CSSPlugin.prototype; + p._firstPT = p._lastParsedTransform = p._transform = null; + + //gets called when the tween renders for the first time. This kicks everything off, recording start/end values, etc. + p._onInitTween = function(target, vars, tween, index) { + if (!target.nodeType) { //css is only for dom elements + return false; + } + this._target = _target = target; + this._tween = tween; + this._vars = vars; + _index = index; + _autoRound = vars.autoRound; + _hasPriority = false; + _suffixMap = vars.suffixMap || CSSPlugin.suffixMap; + _cs = _getComputedStyle(target, ""); + _overwriteProps = this._overwriteProps; + var style = target.style, + v, pt, pt2, first, last, next, zIndex, tpt, threeD; + if (_reqSafariFix) if (style.zIndex === "") { + v = _getStyle(target, "zIndex", _cs); + if (v === "auto" || v === "") { + //corrects a bug in [non-Android] Safari that prevents it from repainting elements in their new positions if they don't have a zIndex set. We also can't just apply this inside _parseTransform() because anything that's moved in any way (like using "left" or "top" instead of transforms like "x" and "y") can be affected, so it is best to ensure that anything that's tweening has a z-index. Setting "WebkitPerspective" to a non-zero value worked too except that on iOS Safari things would flicker randomly. Plus zIndex is less memory-intensive. + this._addLazySet(style, "zIndex", 0); + } + } + + if (typeof(vars) === "string") { + first = style.cssText; + v = _getAllStyles(target, _cs); + style.cssText = first + ";" + vars; + v = _cssDif(target, v, _getAllStyles(target)).difs; + if (!_supportsOpacity && _opacityValExp.test(vars)) { + v.opacity = parseFloat( RegExp.$1 ); + } + vars = v; + style.cssText = first; + } + + if (vars.className) { //className tweens will combine any differences they find in the css with the vars that are passed in, so {className:"myClass", scale:0.5, left:20} would work. + this._firstPT = pt = _specialProps.className.parse(target, vars.className, "className", this, null, null, vars); + } else { + this._firstPT = pt = this.parse(target, vars, null); + } + + if (this._transformType) { + threeD = (this._transformType === 3); + if (!_transformProp) { + style.zoom = 1; //helps correct an IE issue. + } else if (_isSafari) { + _reqSafariFix = true; + //if zIndex isn't set, iOS Safari doesn't repaint things correctly sometimes (seemingly at random). + if (style.zIndex === "") { + zIndex = _getStyle(target, "zIndex", _cs); + if (zIndex === "auto" || zIndex === "") { + this._addLazySet(style, "zIndex", 0); + } + } + //Setting WebkitBackfaceVisibility corrects 3 bugs: + // 1) [non-Android] Safari skips rendering changes to "top" and "left" that are made on the same frame/render as a transform update. + // 2) iOS Safari sometimes neglects to repaint elements in their new positions. Setting "WebkitPerspective" to a non-zero value worked too except that on iOS Safari things would flicker randomly. + // 3) Safari sometimes displayed odd artifacts when tweening the transform (or WebkitTransform) property, like ghosts of the edges of the element remained. Definitely a browser bug. + //Note: we allow the user to override the auto-setting by defining WebkitBackfaceVisibility in the vars of the tween. + if (_isSafariLT6) { + this._addLazySet(style, "WebkitBackfaceVisibility", this._vars.WebkitBackfaceVisibility || (threeD ? "visible" : "hidden")); + } + } + pt2 = pt; + while (pt2 && pt2._next) { + pt2 = pt2._next; + } + tpt = new CSSPropTween(target, "transform", 0, 0, null, 2); + this._linkCSSP(tpt, null, pt2); + tpt.setRatio = _transformProp ? _setTransformRatio : _setIETransformRatio; + tpt.data = this._transform || _getTransform(target, _cs, true); + tpt.tween = tween; + tpt.pr = -1; //ensures that the transforms get applied after the components are updated. + _overwriteProps.pop(); //we don't want to force the overwrite of all "transform" tweens of the target - we only care about individual transform properties like scaleX, rotation, etc. The CSSPropTween constructor automatically adds the property to _overwriteProps which is why we need to pop() here. + } + + if (_hasPriority) { + //reorders the linked list in order of pr (priority) + while (pt) { + next = pt._next; + pt2 = first; + while (pt2 && pt2.pr > pt.pr) { + pt2 = pt2._next; + } + if ((pt._prev = pt2 ? pt2._prev : last)) { + pt._prev._next = pt; + } else { + first = pt; + } + if ((pt._next = pt2)) { + pt2._prev = pt; + } else { + last = pt; + } + pt = next; + } + this._firstPT = first; + } + return true; + }; + + + p.parse = function(target, vars, pt, plugin) { + var style = target.style, + p, sp, bn, en, bs, es, bsfx, esfx, isStr, rel; + for (p in vars) { + es = vars[p]; //ending value string + sp = _specialProps[p]; //SpecialProp lookup. + if (typeof(es) === "function" && !(sp && sp.allowFunc)) { + es = es(_index, _target); + } + if (sp) { + pt = sp.parse(target, es, p, this, pt, plugin, vars); + } else if (p.substr(0,2) === "--") { //for tweening CSS variables (which always start with "--"). To maximize performance and simplicity, we bypass CSSPlugin altogether and just add a normal property tween to the tween instance itself. + this._tween._propLookup[p] = this._addTween.call(this._tween, target.style, "setProperty", _getComputedStyle(target).getPropertyValue(p) + "", es + "", p, false, p); + continue; + } else { + bs = _getStyle(target, p, _cs) + ""; + isStr = (typeof(es) === "string"); + if (p === "color" || p === "fill" || p === "stroke" || p.indexOf("Color") !== -1 || (isStr && _rgbhslExp.test(es))) { //Opera uses background: to define color sometimes in addition to backgroundColor: + if (!isStr) { + es = _parseColor(es); + es = ((es.length > 3) ? "rgba(" : "rgb(") + es.join(",") + ")"; + } + pt = _parseComplex(style, p, bs, es, true, "transparent", pt, 0, plugin); + + } else if (isStr && _complexExp.test(es)) { + pt = _parseComplex(style, p, bs, es, true, null, pt, 0, plugin); + + } else { + bn = parseFloat(bs); + bsfx = (bn || bn === 0) ? bs.substr((bn + "").length) : ""; //remember, bs could be non-numeric like "normal" for fontWeight, so we should default to a blank suffix in that case. + + if (bs === "" || bs === "auto") { + if (p === "width" || p === "height") { + bn = _getDimension(target, p, _cs); + bsfx = "px"; + } else if (p === "left" || p === "top") { + bn = _calculateOffset(target, p, _cs); + bsfx = "px"; + } else { + bn = (p !== "opacity") ? 0 : 1; + bsfx = ""; + } + } + + rel = (isStr && es.charAt(1) === "="); + if (rel) { + en = parseInt(es.charAt(0) + "1", 10); + es = es.substr(2); + en *= parseFloat(es); + esfx = es.replace(_suffixExp, ""); + } else { + en = parseFloat(es); + esfx = isStr ? es.replace(_suffixExp, "") : ""; + } + + if (esfx === "") { + esfx = (p in _suffixMap) ? _suffixMap[p] : bsfx; //populate the end suffix, prioritizing the map, then if none is found, use the beginning suffix. + } + + es = (en || en === 0) ? (rel ? en + bn : en) + esfx : vars[p]; //ensures that any += or -= prefixes are taken care of. Record the end value before normalizing the suffix because we always want to end the tween on exactly what they intended even if it doesn't match the beginning value's suffix. + //if the beginning/ending suffixes don't match, normalize them... + if (bsfx !== esfx) if (esfx !== "" || p === "lineHeight") if (en || en === 0) if (bn) { //note: if the beginning value (bn) is 0, we don't need to convert units! + bn = _convertToPixels(target, p, bn, bsfx); + if (esfx === "%") { + bn /= _convertToPixels(target, p, 100, "%") / 100; + if (vars.strictUnits !== true) { //some browsers report only "px" values instead of allowing "%" with getComputedStyle(), so we assume that if we're tweening to a %, we should start there too unless strictUnits:true is defined. This approach is particularly useful for responsive designs that use from() tweens. + bs = bn + "%"; + } + + } else if (esfx === "em" || esfx === "rem" || esfx === "vw" || esfx === "vh") { + bn /= _convertToPixels(target, p, 1, esfx); + + //otherwise convert to pixels. + } else if (esfx !== "px") { + en = _convertToPixels(target, p, en, esfx); + esfx = "px"; //we don't use bsfx after this, so we don't need to set it to px too. + } + if (rel) if (en || en === 0) { + es = (en + bn) + esfx; //the changes we made affect relative calculations, so adjust the end value here. + } + } + + if (rel) { + en += bn; + } + + if ((bn || bn === 0) && (en || en === 0)) { //faster than isNaN(). Also, previously we required en !== bn but that doesn't really gain much performance and it prevents _parseToProxy() from working properly if beginning and ending values match but need to get tweened by an external plugin anyway. For example, a bezier tween where the target starts at left:0 and has these points: [{left:50},{left:0}] wouldn't work properly because when parsing the last point, it'd match the first (current) one and a non-tweening CSSPropTween would be recorded when we actually need a normal tween (type:0) so that things get updated during the tween properly. + pt = new CSSPropTween(style, p, bn, en - bn, pt, 0, p, (_autoRound !== false && (esfx === "px" || p === "zIndex")), 0, bs, es); + pt.xs0 = esfx; + //DEBUG: _log("tween "+p+" from "+pt.b+" ("+bn+esfx+") to "+pt.e+" with suffix: "+pt.xs0); + } else if (style[p] === undefined || !es && (es + "" === "NaN" || es == null)) { + _log("invalid " + p + " tween value: " + vars[p]); + } else { + pt = new CSSPropTween(style, p, en || bn || 0, 0, pt, -1, p, false, 0, bs, es); + pt.xs0 = (es === "none" && (p === "display" || p.indexOf("Style") !== -1)) ? bs : es; //intermediate value should typically be set immediately (end value) except for "display" or things like borderTopStyle, borderBottomStyle, etc. which should use the beginning value during the tween. + //DEBUG: _log("non-tweening value "+p+": "+pt.xs0); + } + } + } + if (plugin) if (pt && !pt.plugin) { + pt.plugin = plugin; + } + } + return pt; + }; + + + //gets called every time the tween updates, passing the new ratio (typically a value between 0 and 1, but not always (for example, if an Elastic.easeOut is used, the value can jump above 1 mid-tween). It will always start and 0 and end at 1. + p.setRatio = function(v) { + var pt = this._firstPT, + min = 0.000001, + val, str, i; + //at the end of the tween, we set the values to exactly what we received in order to make sure non-tweening values (like "position" or "float" or whatever) are set and so that if the beginning/ending suffixes (units) didn't match and we normalized to px, the value that the user passed in is used here. We check to see if the tween is at its beginning in case it's a from() tween in which case the ratio will actually go from 1 to 0 over the course of the tween (backwards). + if (v === 1 && (this._tween._time === this._tween._duration || this._tween._time === 0)) { + while (pt) { + if (pt.type !== 2) { + if (pt.r && pt.type !== -1) { + val = pt.r(pt.s + pt.c); + if (!pt.type) { + pt.t[pt.p] = val + pt.xs0; + } else if (pt.type === 1) { //complex value (one that typically has multiple numbers inside a string, like "rect(5px,10px,20px,25px)" + i = pt.l; + str = pt.xs0 + val + pt.xs1; + for (i = 1; i < pt.l; i++) { + str += pt["xn"+i] + pt["xs"+(i+1)]; + } + pt.t[pt.p] = str; + } + } else { + pt.t[pt.p] = pt.e; + } + } else { + pt.setRatio(v); + } + pt = pt._next; + } + + } else if (v || !(this._tween._time === this._tween._duration || this._tween._time === 0) || this._tween._rawPrevTime === -0.000001) { + while (pt) { + val = pt.c * v + pt.s; + if (pt.r) { + val = pt.r(val); + } else if (val < min) if (val > -min) { + val = 0; + } + if (!pt.type) { + pt.t[pt.p] = val + pt.xs0; + } else if (pt.type === 1) { //complex value (one that typically has multiple numbers inside a string, like "rect(5px,10px,20px,25px)" + i = pt.l; + if (i === 2) { + pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2; + } else if (i === 3) { + pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2 + pt.xn2 + pt.xs3; + } else if (i === 4) { + pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2 + pt.xn2 + pt.xs3 + pt.xn3 + pt.xs4; + } else if (i === 5) { + pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2 + pt.xn2 + pt.xs3 + pt.xn3 + pt.xs4 + pt.xn4 + pt.xs5; + } else { + str = pt.xs0 + val + pt.xs1; + for (i = 1; i < pt.l; i++) { + str += pt["xn"+i] + pt["xs"+(i+1)]; + } + pt.t[pt.p] = str; + } + + } else if (pt.type === -1) { //non-tweening value + pt.t[pt.p] = pt.xs0; + + } else if (pt.setRatio) { //custom setRatio() for things like SpecialProps, external plugins, etc. + pt.setRatio(v); + } + pt = pt._next; + } + + //if the tween is reversed all the way back to the beginning, we need to restore the original values which may have different units (like % instead of px or em or whatever). + } else { + while (pt) { + if (pt.type !== 2) { + pt.t[pt.p] = pt.b; + } else { + pt.setRatio(v); + } + pt = pt._next; + } + } + }; + + /** + * @private + * Forces rendering of the target's transforms (rotation, scale, etc.) whenever the CSSPlugin's setRatio() is called. + * Basically, this tells the CSSPlugin to create a CSSPropTween (type 2) after instantiation that runs last in the linked + * list and calls the appropriate (3D or 2D) rendering function. We separate this into its own method so that we can call + * it from other plugins like BezierPlugin if, for example, it needs to apply an autoRotation and this CSSPlugin + * doesn't have any transform-related properties of its own. You can call this method as many times as you + * want and it won't create duplicate CSSPropTweens. + * + * @param {boolean} threeD if true, it should apply 3D tweens (otherwise, just 2D ones are fine and typically faster) + */ + p._enableTransforms = function(threeD) { + this._transform = this._transform || _getTransform(this._target, _cs, true); //ensures that the element has a _gsTransform property with the appropriate values. + this._transformType = (!(this._transform.svg && _useSVGTransformAttr) && (threeD || this._transformType === 3)) ? 3 : 2; + }; + + var lazySet = function(v) { + this.t[this.p] = this.e; + this.data._linkCSSP(this, this._next, null, true); //we purposefully keep this._next even though it'd make sense to null it, but this is a performance optimization, as this happens during the while (pt) {} loop in setRatio() at the bottom of which it sets pt = pt._next, so if we null it, the linked list will be broken in that loop. + }; + /** @private Gives us a way to set a value on the first render (and only the first render). **/ + p._addLazySet = function(t, p, v) { + var pt = this._firstPT = new CSSPropTween(t, p, 0, 0, this._firstPT, 2); + pt.e = v; + pt.setRatio = lazySet; + pt.data = this; + }; + + /** @private **/ + p._linkCSSP = function(pt, next, prev, remove) { + if (pt) { + if (next) { + next._prev = pt; + } + if (pt._next) { + pt._next._prev = pt._prev; + } + if (pt._prev) { + pt._prev._next = pt._next; + } else if (this._firstPT === pt) { + this._firstPT = pt._next; + remove = true; //just to prevent resetting this._firstPT 5 lines down in case pt._next is null. (optimized for speed) + } + if (prev) { + prev._next = pt; + } else if (!remove && this._firstPT === null) { + this._firstPT = pt; + } + pt._next = next; + pt._prev = prev; + } + return pt; + }; + + p._mod = function(lookup) { + var pt = this._firstPT; + while (pt) { + if (typeof(lookup[pt.p]) === "function") { //only gets called by RoundPropsPlugin (ModifyPlugin manages all the rendering internally for CSSPlugin properties that need modification). Remember, we handle rounding a bit differently in this plugin for performance reasons, leveraging "r" as an indicator that the value should be rounded internally. + pt.r = lookup[pt.p]; + } + pt = pt._next; + } + }; + + //we need to make sure that if alpha or autoAlpha is killed, opacity is too. And autoAlpha affects the "visibility" property. + p._kill = function(lookup) { + var copy = lookup, + pt, p, xfirst; + if (lookup.autoAlpha || lookup.alpha) { + copy = {}; + for (p in lookup) { //copy the lookup so that we're not changing the original which may be passed elsewhere. + copy[p] = lookup[p]; + } + copy.opacity = 1; + if (copy.autoAlpha) { + copy.visibility = 1; + } + } + if (lookup.className && (pt = this._classNamePT)) { //for className tweens, we need to kill any associated CSSPropTweens too; a linked list starts at the className's "xfirst". + xfirst = pt.xfirst; + if (xfirst && xfirst._prev) { + this._linkCSSP(xfirst._prev, pt._next, xfirst._prev._prev); //break off the prev + } else if (xfirst === this._firstPT) { + this._firstPT = pt._next; + } + if (pt._next) { + this._linkCSSP(pt._next, pt._next._next, xfirst._prev); + } + this._classNamePT = null; + } + pt = this._firstPT; + while (pt) { + if (pt.plugin && pt.plugin !== p && pt.plugin._kill) { //for plugins that are registered with CSSPlugin, we should notify them of the kill. + pt.plugin._kill(lookup); + p = pt.plugin; + } + pt = pt._next; + } + return TweenPlugin.prototype._kill.call(this, copy); + }; + + + + //used by cascadeTo() for gathering all the style properties of each child element into an array for comparison. + var _getChildStyles = function(e, props, targets) { + var children, i, child, type; + if (e.slice) { + i = e.length; + while (--i > -1) { + _getChildStyles(e[i], props, targets); + } + return; + } + children = e.childNodes; + i = children.length; + while (--i > -1) { + child = children[i]; + type = child.type; + if (child.style) { + props.push(_getAllStyles(child)); + if (targets) { + targets.push(child); + } + } + if ((type === 1 || type === 9 || type === 11) && child.childNodes.length) { + _getChildStyles(child, props, targets); + } + } + }; + + /** + * Typically only useful for className tweens that may affect child elements, this method creates a TweenLite + * and then compares the style properties of all the target's child elements at the tween's start and end, and + * if any are different, it also creates tweens for those and returns an array containing ALL of the resulting + * tweens (so that you can easily add() them to a TimelineLite, for example). The reason this functionality is + * wrapped into a separate static method of CSSPlugin instead of being integrated into all regular className tweens + * is because it creates entirely new tweens that may have completely different targets than the original tween, + * so if they were all lumped into the original tween instance, it would be inconsistent with the rest of the API + * and it would create other problems. For example: + * - If I create a tween of elementA, that tween instance may suddenly change its target to include 50 other elements (unintuitive if I specifically defined the target I wanted) + * - We can't just create new independent tweens because otherwise, what happens if the original/parent tween is reversed or pause or dropped into a TimelineLite for tight control? You'd expect that tween's behavior to affect all the others. + * - Analyzing every style property of every child before and after the tween is an expensive operation when there are many children, so this behavior shouldn't be imposed on all className tweens by default, especially since it's probably rare that this extra functionality is needed. + * + * @param {Object} target object to be tweened + * @param {number} Duration in seconds (or frames for frames-based tweens) + * @param {Object} Object containing the end values, like {className:"newClass", ease:Linear.easeNone} + * @return {Array} An array of TweenLite instances + */ + CSSPlugin.cascadeTo = function(target, duration, vars) { + var tween = TweenLite.to(target, duration, vars), + results = [tween], + b = [], + e = [], + targets = [], + _reservedProps = TweenLite._internals.reservedProps, + i, difs, p, from; + target = tween._targets || tween.target; + _getChildStyles(target, b, targets); + tween.render(duration, true, true); + _getChildStyles(target, e); + tween.render(0, true, true); + tween._enabled(true); + i = targets.length; + while (--i > -1) { + difs = _cssDif(targets[i], b[i], e[i]); + if (difs.firstMPT) { + difs = difs.difs; + for (p in vars) { + if (_reservedProps[p]) { + difs[p] = vars[p]; + } + } + from = {}; + for (p in difs) { + from[p] = b[i][p]; + } + results.push(TweenLite.fromTo(targets[i], duration, from, difs)); + } + } + return results; + }; + + TweenPlugin.activate([CSSPlugin]); + return CSSPlugin; + + }, true); + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("CSSPlugin")); + +/*! + * VERSION: 0.6.6 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + _gsScope._gsDefine("plugins.CSSRulePlugin", ["plugins.TweenPlugin","TweenLite","plugins.CSSPlugin"], function(TweenPlugin, TweenLite, CSSPlugin) { + + /** @constructor **/ + var CSSRulePlugin = function() { + TweenPlugin.call(this, "cssRule"); + this._overwriteProps.length = 0; + }, + _doc = _gsScope.document, + _superSetRatio = CSSPlugin.prototype.setRatio, + p = CSSRulePlugin.prototype = new CSSPlugin(); + + p._propName = "cssRule"; + p.constructor = CSSRulePlugin; + CSSRulePlugin.version = "0.6.6"; + CSSRulePlugin.API = 2; + + /** + * Searches the style sheets in the document for a particular selector like ".myClass" or "a" or "a:hover" or ":after" and + * returns a reference to that style sheet (or an array of them in the case of a pseudo selector like ":after"). Then you + * can animate the individual properties of the style sheet. + * + * @param {!string} selector a string describing the selector, like ".myClass" or "a" or "a:hover" or ":after" + * @return a reference to the style sheet (or an array of them in the case of a pseudo selector). If none was found, null is returned (or an empty array for a pseudo selector) + */ + CSSRulePlugin.getRule = function(selector) { + var ruleProp = _doc.all ? "rules" : "cssRules", + ss = _doc.styleSheets, + i = ss.length, + pseudo = (selector.charAt(0) === ":"), + j, curSS, cs, a; + selector = (pseudo ? "" : ",") + selector.split("::").join(":").toLowerCase() + ","; //note: old versions of IE report tag name selectors as upper case, so we just change everything to lowercase. + if (pseudo) { + a = []; + } + while (--i > -1) { + //Firefox may throw insecure operation errors when css is loaded from other domains, so try/catch. + try { + curSS = ss[i][ruleProp]; + if (!curSS) { + continue; + } + j = curSS.length; + } catch (e) { + console.log(e); + continue; + } + while (--j > -1) { + cs = curSS[j]; + if (cs.selectorText && ("," + cs.selectorText.split("::").join(":").toLowerCase() + ",").indexOf(selector) !== -1) { //note: IE adds an extra ":" to pseudo selectors, so .myClass:after becomes .myClass::after, so we need to strip the extra one out. + if (pseudo) { + a.push(cs.style); + } else { + return cs.style; + } + } + } + } + return a; + }; + + + // @private gets called when the tween renders for the first time. This kicks everything off, recording start/end values, etc. + p._onInitTween = function(target, value, tween) { + if (target.cssText === undefined) { + return false; + } + var div = target._gsProxy = target._gsProxy || _doc.createElement("div"); + this._ss = target; + this._proxy = div.style; + div.style.cssText = target.cssText; + CSSPlugin.prototype._onInitTween.call(this, div, value, tween); //we just offload all the work to the regular CSSPlugin and then copy the cssText back over to the rule in the setRatio() method. This allows us to have all of the updates to CSSPlugin automatically flow through to CSSRulePlugin instead of having to maintain both + return true; + }; + + + + // @private gets called every time the tween updates, passing the new ratio (typically a value between 0 and 1, but not always (for example, if an Elastic.easeOut is used, the value can jump above 1 mid-tween). It will always start and 0 and end at 1. + p.setRatio = function(v) { + _superSetRatio.call(this, v); + this._ss.cssText = this._proxy.cssText; + }; + + + TweenPlugin.activate([CSSRulePlugin]); + return CSSRulePlugin; + + }, true); + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("CSSRulePlugin")); +/*! + * VERSION: 1.5.3 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + **/ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _numExp = /(\d|\.)+/g, + _relNumExp = /(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g, + _colorLookup = {aqua:[0,255,255], + lime:[0,255,0], + silver:[192,192,192], + black:[0,0,0], + maroon:[128,0,0], + teal:[0,128,128], + blue:[0,0,255], + navy:[0,0,128], + white:[255,255,255], + fuchsia:[255,0,255], + olive:[128,128,0], + yellow:[255,255,0], + orange:[255,165,0], + gray:[128,128,128], + purple:[128,0,128], + green:[0,128,0], + red:[255,0,0], + pink:[255,192,203], + cyan:[0,255,255], + transparent:[255,255,255,0]}, + _hue = function(h, m1, m2) { + h = (h < 0) ? h + 1 : (h > 1) ? h - 1 : h; + return ((((h * 6 < 1) ? m1 + (m2 - m1) * h * 6 : (h < 0.5) ? m2 : (h * 3 < 2) ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * 255) + 0.5) | 0; + }, + /** + * @private Parses a color (like #9F0, #FF9900, rgb(255,51,153) or hsl(108, 50%, 10%)) into an array with 3 elements for red, green, and blue or if toHSL parameter is true, it will populate the array with hue, saturation, and lightness values. If a relative value is found in an hsl() or hsla() string, it will preserve those relative prefixes and all the values in the array will be strings instead of numbers (in all other cases it will be populated with numbers). + * @param {(string|number)} v The value the should be parsed which could be a string like #9F0 or rgb(255,102,51) or rgba(255,0,0,0.5) or it could be a number like 0xFF00CC or even a named color like red, blue, purple, etc. + * @param {(boolean)} toHSL If true, an hsl() or hsla() value will be returned instead of rgb() or rgba() + * @return {Array.} An array containing red, green, and blue (and optionally alpha) in that order, or if the toHSL parameter was true, the array will contain hue, saturation and lightness (and optionally alpha) in that order. Always numbers unless there's a relative prefix found in an hsl() or hsla() string and toHSL is true. + */ + _parseColor = function(v, toHSL) { + var a, r, g, b, h, s, l, max, min, d, wasHSL; + if (!v) { + a = _colorLookup.black; + } else if (typeof(v) === "number") { + a = [v >> 16, (v >> 8) & 255, v & 255]; + } else { + if (v.charAt(v.length - 1) === ",") { //sometimes a trailing comma is included and we should chop it off (typically from a comma-delimited list of values like a textShadow:"2px 2px 2px blue, 5px 5px 5px rgb(255,0,0)" - in this example "blue," has a trailing comma. We could strip it out inside parseComplex() but we'd need to do it to the beginning and ending values plus it wouldn't provide protection from other potential scenarios like if the user passes in a similar value. + v = v.substr(0, v.length - 1); + } + if (_colorLookup[v]) { + a = _colorLookup[v]; + } else if (v.charAt(0) === "#") { + if (v.length === 4) { //for shorthand like #9F0 + r = v.charAt(1); + g = v.charAt(2); + b = v.charAt(3); + v = "#" + r + r + g + g + b + b; + } + v = parseInt(v.substr(1), 16); + a = [v >> 16, (v >> 8) & 255, v & 255]; + } else if (v.substr(0, 3) === "hsl") { + a = wasHSL = v.match(_numExp); + if (!toHSL) { + h = (Number(a[0]) % 360) / 360; + s = Number(a[1]) / 100; + l = Number(a[2]) / 100; + g = (l <= 0.5) ? l * (s + 1) : l + s - l * s; + r = l * 2 - g; + if (a.length > 3) { + a[3] = Number(a[3]); + } + a[0] = _hue(h + 1 / 3, r, g); + a[1] = _hue(h, r, g); + a[2] = _hue(h - 1 / 3, r, g); + } else if (v.indexOf("=") !== -1) { //if relative values are found, just return the raw strings with the relative prefixes in place. + return v.match(_relNumExp); + } + } else { + a = v.match(_numExp) || _colorLookup.transparent; + } + a[0] = Number(a[0]); + a[1] = Number(a[1]); + a[2] = Number(a[2]); + if (a.length > 3) { + a[3] = Number(a[3]); + } + } + if (toHSL && !wasHSL) { + r = a[0] / 255; + g = a[1] / 255; + b = a[2] / 255; + max = Math.max(r, g, b); + min = Math.min(r, g, b); + l = (max + min) / 2; + if (max === min) { + h = s = 0; + } else { + d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + h = (max === r) ? (g - b) / d + (g < b ? 6 : 0) : (max === g) ? (b - r) / d + 2 : (r - g) / d + 4; + h *= 60; + } + a[0] = (h + 0.5) | 0; + a[1] = (s * 100 + 0.5) | 0; + a[2] = (l * 100 + 0.5) | 0; + } + return a; + }, + _formatColors = function(s, toHSL) { + var colors = (s + "").match(_colorExp) || [], + charIndex = 0, + parsed = "", + i, color, temp; + if (!colors.length) { + return s; + } + for (i = 0; i < colors.length; i++) { + color = colors[i]; + temp = s.substr(charIndex, s.indexOf(color, charIndex)-charIndex); + charIndex += temp.length + color.length; + color = _parseColor(color, toHSL); + if (color.length === 3) { + color.push(1); + } + parsed += temp + (toHSL ? "hsla(" + color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : "rgba(" + color.join(",")) + ")"; + } + return parsed + s.substr(charIndex); + }, p, _colorStringFilter, + TweenLite = (_gsScope.GreenSockGlobals || _gsScope).TweenLite, + _colorExp = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3}){1,2}\\b", //we'll dynamically build this Regular Expression to conserve file size. After building it, it will be able to find rgb(), rgba(), # (hexadecimal), and named color values like red, blue, purple, etc. + + ColorPropsPlugin = _gsScope._gsDefine.plugin({ + propName: "colorProps", + version: "1.5.3", + priority: -1, + API: 2, + global: true, + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween, index) { + var p, proxy, pt, val; + this._target = target; + this._proxy = proxy = ((value.format + "").toUpperCase() === "NUMBER") ? {} : 0; + for (p in value) { + if (p !== "format") { + if (proxy) { + this._firstNumPT = pt = {_next:this._firstNumPT, t:target, p:p, f:(typeof(target[p]) === "function")}; + proxy[p] = "rgb(" + _parseColor(!pt.f ? target[p] : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]()).join(",") + ")"; + val = value[p]; + if (typeof(val) === "function") { + val = val(index, target); + } + this._addTween(proxy, p, "get", ((typeof(val) === "number") ? "rgb(" + _parseColor(val, false).join(",") + ")" : val), p, null, null, _colorStringFilter); + } else { + this._addTween(target, p, "get", value[p], p, null, null, _colorStringFilter, index); + } + + } + } + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(v) { + var pt = this._firstNumPT, + val; + this._super.setRatio.call(this, v); + while (pt) { + val = _parseColor(this._proxy[pt.p], false); + val = val[0] << 16 | val[1] << 8 | val[2]; + if (pt.f) { + this._target[pt.p](val); + } else { + this._target[pt.p] = val; + } + pt = pt._next; + } + } + }); + + for (p in _colorLookup) { + _colorExp += "|" + p + "\\b"; + } + _colorExp = new RegExp(_colorExp+")", "gi"); + ColorPropsPlugin.colorStringFilter = _colorStringFilter = function(a) { + var combined = a[0] + " " + a[1], + toHSL; + _colorExp.lastIndex = 0; + if (_colorExp.test(combined)) { + toHSL = (combined.indexOf("hsl(") !== -1 || combined.indexOf("hsla(") !== -1); + a[0] = _formatColors(a[0], toHSL); + a[1] = _formatColors(a[1], toHSL); + } + }; + + if (!TweenLite.defaultStringFilter) { + TweenLite.defaultStringFilter = ColorPropsPlugin.colorStringFilter; + } + + ColorPropsPlugin.parseColor = _parseColor; + p = ColorPropsPlugin.prototype; + p._firstNumPT = null; + p._kill = function(lookup) { + var pt = this._firstNumPT, + prev; + while (pt) { + if (pt.p in lookup) { + if (pt === p._firstNumPT) { + this._firstNumPT = pt._next; + } + if (prev) { + prev._next = pt._next; + } + } else { + prev = pt; + } + pt = pt._next; + } + return this._super._kill(lookup); + }; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("ColorPropsPlugin")); +/*! + * VERSION: 0.3.1 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + **/ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + _gsScope._gsDefine.plugin({ + propName: "directionalRotation", + version: "0.3.1", + API: 2, + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween, index) { + if (typeof(value) !== "object") { + value = {rotation:value}; + } + this.finals = {}; + var cap = (value.useRadians === true) ? Math.PI * 2 : 360, + min = 0.000001, + p, v, start, end, dif, split; + for (p in value) { + if (p !== "useRadians") { + end = value[p]; + if (typeof(end) === "function") { + end = end(index, target); + } + split = (end + "").split("_"); + v = split[0]; + start = parseFloat( (typeof(target[p]) !== "function") ? target[p] : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() ); + end = this.finals[p] = (typeof(v) === "string" && v.charAt(1) === "=") ? start + parseInt(v.charAt(0) + "1", 10) * Number(v.substr(2)) : Number(v) || 0; + dif = end - start; + if (split.length) { + v = split.join("_"); + if (v.indexOf("short") !== -1) { + dif = dif % cap; + if (dif !== dif % (cap / 2)) { + dif = (dif < 0) ? dif + cap : dif - cap; + } + } + if (v.indexOf("_cw") !== -1 && dif < 0) { + dif = ((dif + cap * 9999999999) % cap) - ((dif / cap) | 0) * cap; + } else if (v.indexOf("ccw") !== -1 && dif > 0) { + dif = ((dif - cap * 9999999999) % cap) - ((dif / cap) | 0) * cap; + } + } + if (dif > min || dif < -min) { + this._addTween(target, p, start, start + dif, p); + this._overwriteProps.push(p); + } + } + } + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(ratio) { + var pt; + if (ratio !== 1) { + this._super.setRatio.call(this, ratio); + } else { + pt = this._firstPT; + while (pt) { + if (pt.f) { + pt.t[pt.p](this.finals[pt.p]); + } else { + pt.t[pt.p] = this.finals[pt.p]; + } + pt = pt._next; + } + } + } + + })._autoCSS = true; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("DirectionalRotationPlugin")); +/*! + * VERSION: 0.2.1 + * DATE: 2019-02-07 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * DrawSVGPlugin is a Club GreenSock membership benefit; You must have a valid membership to use + * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. + * This work is subject to the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _doc = _gsScope.document, + _computedStyleScope = (typeof(window) !== "undefined" ? window : _doc.defaultView || {getComputedStyle:function() {}}), + _getComputedStyle = function(e) { + return _computedStyleScope.getComputedStyle(e); //to avoid errors in Microsoft Edge, we need to call getComputedStyle() from a specific scope, typically window. + }, + _numbersExp = /(?:(-|-=|\+=)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig, + _isEdge = (((_gsScope.navigator || {}).userAgent || "").indexOf("Edge") !== -1), //Microsoft Edge has a bug that causes it not to redraw the path correctly if the stroke-linecap is anything other than "butt" (like "round") and it doesn't match the stroke-linejoin. A way to trigger it is to change the stroke-miterlimit, so we'll only do that if/when we have to (to maximize performance) + _types = {rect:["width","height"], circle:["r","r"], ellipse:["rx","ry"], line:["x2","y2"]}, + DrawSVGPlugin; + + function getDistance(x1, y1, x2, y2, scaleX, scaleY) { + x2 = (parseFloat(x2 || 0) - parseFloat(x1 || 0)) * scaleX; + y2 = (parseFloat(y2 || 0) - parseFloat(y1 || 0)) * scaleY; + return Math.sqrt(x2 * x2 + y2 * y2); + } + + function unwrap(element) { + if (typeof(element) === "string" || !element.nodeType) { + element = _gsScope.TweenLite.selector(element); + if (element.length) { + element = element[0]; + } + } + return element; + } + + //accepts values like "100%" or "20% 80%" or "20 50" and parses it into an absolute start and end position on the line/stroke based on its length. Returns an an array with the start and end values, like [0, 243] + function parse(value, length, defaultStart) { + var i = value.indexOf(" "), + s, e; + if (i === -1) { + s = defaultStart !== undefined ? defaultStart + "" : value; + e = value; + } else { + s = value.substr(0, i); + e = value.substr(i+1); + } + s = (s.indexOf("%") !== -1) ? (parseFloat(s) / 100) * length : parseFloat(s); + e = (e.indexOf("%") !== -1) ? (parseFloat(e) / 100) * length : parseFloat(e); + return (s > e) ? [e, s] : [s, e]; + } + + function getLength(element) { + if (!element) { + return 0; + } + element = unwrap(element); + var type = element.tagName.toLowerCase(), + scaleX = 1, + scaleY = 1, + length, bbox, points, prevPoint, i, rx, ry; + if (element.getAttribute("vector-effect") === "non-scaling-stroke") { //non-scaling-stroke basically scales the shape and then strokes it at the screen-level (after transforms), thus we need to adjust the length accordingly. + scaleY = element.getScreenCTM(); + scaleX = Math.sqrt(scaleY.a * scaleY.a + scaleY.b * scaleY.b); + scaleY = Math.sqrt(scaleY.d * scaleY.d + scaleY.c * scaleY.c); + } + try { //IE bug: calling .getTotalLength() locks the repaint area of the stroke to whatever its current dimensions are on that frame/tick. To work around that, we must call getBBox() to force IE to recalculate things. + bbox = element.getBBox(); //solely for fixing bug in IE - we don't actually use the bbox. + } catch (e) { + //firefox has a bug that throws an error if the element isn't visible. + console.log("Error: Some browsers like Firefox won't report measurements of invisible elements (like display:none or masks inside defs)."); + } + if ((!bbox || (!bbox.width && !bbox.height)) && _types[type]) { //if the element isn't visible, try to discern width/height using its attributes. + bbox = { + width: parseFloat( element.getAttribute(_types[type][0]) ), + height: parseFloat( element.getAttribute(_types[type][1]) ) + }; + if (type !== "rect" && type !== "line") { //double the radius for circles and ellipses + bbox.width *= 2; + bbox.height *= 2; + } + if (type === "line") { + bbox.x = parseFloat( element.getAttribute("x1") ); + bbox.y = parseFloat( element.getAttribute("y1") ); + bbox.width = Math.abs(bbox.width - bbox.x); + bbox.height = Math.abs(bbox.height - bbox.y); + } + } + if (type === "path") { + prevPoint = element.style.strokeDasharray; + element.style.strokeDasharray = "none"; + length = element.getTotalLength() || 0; + if (scaleX !== scaleY) { + console.log("Warning: length cannot be measured accurately when vector-effect is non-scaling-stroke and the element isn't proportionally scaled."); + } + length *= (scaleX + scaleY) / 2; + element.style.strokeDasharray = prevPoint; + } else if (type === "rect") { + length = bbox.width * 2 * scaleX + bbox.height * 2 * scaleY; + } else if (type === "line") { + length = getDistance(bbox.x, bbox.y, bbox.x + bbox.width, bbox.y + bbox.height, scaleX, scaleY); + } else if (type === "polyline" || type === "polygon") { + points = element.getAttribute("points").match(_numbersExp) || []; + if (type === "polygon") { + points.push(points[0], points[1]); + } + length = 0; + for (i = 2; i < points.length; i+=2) { + length += getDistance(points[i-2], points[i-1], points[i], points[i+1], scaleX, scaleY) || 0; + } + } else if (type === "circle" || type === "ellipse") { + rx = (bbox.width / 2) * scaleX; + ry = (bbox.height / 2) * scaleY; + length = Math.PI * ( 3 * (rx + ry) - Math.sqrt((3 * rx + ry) * (rx + 3 * ry)) ); + } + return length || 0; + } + + function getPosition(element, length) { + if (!element) { + return [0, 0]; + } + element = unwrap(element); + length = length || (getLength(element) + 1); + var cs = _getComputedStyle(element), + dash = cs.strokeDasharray || "", + offset = parseFloat(cs.strokeDashoffset), + i = dash.indexOf(","); + if (i < 0) { + i = dash.indexOf(" "); + } + dash = (i < 0) ? length : parseFloat(dash.substr(0, i)) || 0.00001; + if (dash > length) { + dash = length; + } + return [Math.max(0, -offset), Math.max(0, dash - offset)]; + } + + DrawSVGPlugin = _gsScope._gsDefine.plugin({ + propName: "drawSVG", + API: 2, + version: "0.2.1", + global: true, + overwriteProps: ["drawSVG"], + + init: function(target, value, tween, index) { + if (!target.getBBox) { + return false; + } + var length = getLength(target) + 1, + start, end, overage, cs; + this._style = target.style; + this._target = target; + if (typeof(value) === "function") { + value = value(index, target); + } + if (value === true || value === "true") { + value = "0 100%"; + } else if (!value) { + value = "0 0"; + } else if ((value + "").indexOf(" ") === -1) { + value = "0 " + value; + } + start = getPosition(target, length); + end = parse(value, length, start[0]); + this._length = length + 10; + if (start[0] === 0 && end[0] === 0) { + overage = Math.max(0.00001, end[1] - length); //allow people to go past the end, like values of 105% because for some paths, Firefox doesn't return an accurate getTotalLength(), so it could end up coming up short. + this._dash = length + overage; + this._offset = length - start[1] + overage; + this._offsetPT = this._addTween(this, "_offset", this._offset, length - end[1] + overage, "drawSVG"); + } else { + this._dash = (start[1] - start[0]) || 0.000001; //some browsers render artifacts if dash is 0, so we use a very small number in that case. + this._offset = -start[0]; + this._dashPT = this._addTween(this, "_dash", this._dash, (end[1] - end[0]) || 0.00001, "drawSVG"); + this._offsetPT = this._addTween(this, "_offset", this._offset, -end[0], "drawSVG"); + } + if (_isEdge) { //to work around a bug in Microsoft Edge, animate the stroke-miterlimit by 0.0001 just to trigger the repaint (unnecessary if it's "round" and stroke-linejoin is also "round"). Imperceptible, relatively high-performance, and effective. Another option was to set the "d" attribute to its current value on every tick, but that seems like it'd be much less performant. + cs = _getComputedStyle(target); + if (cs.strokeLinecap !== cs.strokeLinejoin) { + end = parseFloat(cs.strokeMiterlimit); + this._addTween(target.style, "strokeMiterlimit", end, end + 0.0001, "strokeMiterlimit"); + } + } + this._live = (target.getAttribute("vector-effect") === "non-scaling-stroke" || (value + "").indexOf("live") !== -1); + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(ratio) { + if (this._firstPT) { + //when the element has vector-effect="non-scaling-stroke" and the SVG is resized (like on a window resize), it actually changes the length of the stroke! So we must sense that and make the proper adjustments. + if (this._live) { + var length = getLength(this._target) + 11, + lengthRatio; + if (length !== this._length) { + lengthRatio = length / this._length; + this._length = length; + this._offsetPT.s *= lengthRatio; + this._offsetPT.c *= lengthRatio; + if (this._dashPT) { + this._dashPT.s *= lengthRatio; + this._dashPT.c *= lengthRatio; + } else { + this._dash *= lengthRatio; + } + } + } + this._super.setRatio.call(this, ratio); + this._style.strokeDashoffset = this._offset; + if (ratio === 1 || ratio === 0) { + this._style.strokeDasharray = (this._offset < 0.001 && this._length - this._dash <= 10) ? "none" : (this._offset === this._dash) ? "0px, 999999px" : this._dash + "px," + this._length + "px"; + } else { + this._style.strokeDasharray = this._dash + "px," + this._length + "px"; + } + } + } + + }); + + DrawSVGPlugin.getLength = getLength; + DrawSVGPlugin.getPosition = getPosition; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("DrawSVGPlugin")); +/*! + * VERSION: 0.2.2 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + **/ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _numExp = /(\d|\.)+/g, + _ColorFilter, _ColorMatrixFilter, + _colorProps = ["redMultiplier","greenMultiplier","blueMultiplier","alphaMultiplier","redOffset","greenOffset","blueOffset","alphaOffset"], + _colorLookup = {aqua:[0,255,255], + lime:[0,255,0], + silver:[192,192,192], + black:[0,0,0], + maroon:[128,0,0], + teal:[0,128,128], + blue:[0,0,255], + navy:[0,0,128], + white:[255,255,255], + fuchsia:[255,0,255], + olive:[128,128,0], + yellow:[255,255,0], + orange:[255,165,0], + gray:[128,128,128], + purple:[128,0,128], + green:[0,128,0], + red:[255,0,0], + pink:[255,192,203], + cyan:[0,255,255], + transparent:[255,255,255,0]}, + _parseColor = function(color) { + if (color === "" || color == null || color === "none") { + return _colorLookup.transparent; + } else if (_colorLookup[color]) { + return _colorLookup[color]; + } else if (typeof(color) === "number") { + return [color >> 16, (color >> 8) & 255, color & 255]; + } else if (color.charAt(0) === "#") { + if (color.length === 4) { //for shorthand like #9F0 + color = "#" + color.charAt(1) + color.charAt(1) + color.charAt(2) + color.charAt(2) + color.charAt(3) + color.charAt(3); + } + color = parseInt(color.substr(1), 16); + return [color >> 16, (color >> 8) & 255, color & 255]; + } + return color.match(_numExp) || _colorLookup.transparent; + }, + _parseColorFilter = function(t, v, pg) { + if (!_ColorFilter) { + _ColorFilter = (_gsScope.ColorFilter || _gsScope.createjs.ColorFilter); + if (!_ColorFilter) { + throw("EaselPlugin error: The EaselJS ColorFilter JavaScript file wasn't loaded."); + } + } + var filters = t.filters || [], + i = filters.length, + c, s, e, a, p; + while (--i > -1) { + if (filters[i] instanceof _ColorFilter) { + s = filters[i]; + break; + } + } + if (!s) { + s = new _ColorFilter(); + filters.push(s); + t.filters = filters; + } + e = s.clone(); + if (v.tint != null) { + c = _parseColor(v.tint); + a = (v.tintAmount != null) ? Number(v.tintAmount) : 1; + e.redOffset = Number(c[0]) * a; + e.greenOffset = Number(c[1]) * a; + e.blueOffset = Number(c[2]) * a; + e.redMultiplier = e.greenMultiplier = e.blueMultiplier = 1 - a; + } else { + for (p in v) { + if (p !== "exposure") if (p !== "brightness") { + e[p] = Number(v[p]); + } + } + } + if (v.exposure != null) { + e.redOffset = e.greenOffset = e.blueOffset = 255 * (Number(v.exposure) - 1); + e.redMultiplier = e.greenMultiplier = e.blueMultiplier = 1; + } else if (v.brightness != null) { + a = Number(v.brightness) - 1; + e.redOffset = e.greenOffset = e.blueOffset = (a > 0) ? a * 255 : 0; + e.redMultiplier = e.greenMultiplier = e.blueMultiplier = 1 - Math.abs(a); + } + i = 8; + while (--i > -1) { + p = _colorProps[i]; + if (s[p] !== e[p]) { + pg._addTween(s, p, s[p], e[p], "easel_colorFilter"); + } + } + pg._overwriteProps.push("easel_colorFilter"); + if (!t.cacheID) { + throw("EaselPlugin warning: for filters to display in EaselJS, you must call the object's cache() method first. " + t); + } + }, + + _idMatrix = [1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0], + _lumR = 0.212671, + _lumG = 0.715160, + _lumB = 0.072169, + + _applyMatrix = function(m, m2) { + if (!(m instanceof Array) || !(m2 instanceof Array)) { + return m2; + } + var temp = [], + i = 0, + z = 0, + y, x; + for (y = 0; y < 4; y++) { + for (x = 0; x < 5; x++) { + z = (x === 4) ? m[i + 4] : 0; + temp[i + x] = m[i] * m2[x] + m[i+1] * m2[x + 5] + m[i+2] * m2[x + 10] + m[i+3] * m2[x + 15] + z; + } + i += 5; + } + return temp; + }, + + _setSaturation = function(m, n) { + if (isNaN(n)) { + return m; + } + var inv = 1 - n, + r = inv * _lumR, + g = inv * _lumG, + b = inv * _lumB; + return _applyMatrix([r + n, g, b, 0, 0, r, g + n, b, 0, 0, r, g, b + n, 0, 0, 0, 0, 0, 1, 0], m); + }, + + _colorize = function(m, color, amount) { + if (isNaN(amount)) { + amount = 1; + } + var c = _parseColor(color), + r = c[0] / 255, + g = c[1] / 255, + b = c[2] / 255, + inv = 1 - amount; + return _applyMatrix([inv + amount * r * _lumR, amount * r * _lumG, amount * r * _lumB, 0, 0, amount * g * _lumR, inv + amount * g * _lumG, amount * g * _lumB, 0, 0, amount * b * _lumR, amount * b * _lumG, inv + amount * b * _lumB, 0, 0, 0, 0, 0, 1, 0], m); + }, + + _setHue = function(m, n) { + if (isNaN(n)) { + return m; + } + n *= Math.PI / 180; + var c = Math.cos(n), + s = Math.sin(n); + return _applyMatrix([(_lumR + (c * (1 - _lumR))) + (s * (-_lumR)), (_lumG + (c * (-_lumG))) + (s * (-_lumG)), (_lumB + (c * (-_lumB))) + (s * (1 - _lumB)), 0, 0, (_lumR + (c * (-_lumR))) + (s * 0.143), (_lumG + (c * (1 - _lumG))) + (s * 0.14), (_lumB + (c * (-_lumB))) + (s * -0.283), 0, 0, (_lumR + (c * (-_lumR))) + (s * (-(1 - _lumR))), (_lumG + (c * (-_lumG))) + (s * _lumG), (_lumB + (c * (1 - _lumB))) + (s * _lumB), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], m); + }, + + _setContrast = function(m, n) { + if (isNaN(n)) { + return m; + } + n += 0.01; + return _applyMatrix([n,0,0,0,128 * (1 - n), 0,n,0,0,128 * (1 - n), 0,0,n,0,128 * (1 - n), 0,0,0,1,0], m); + }, + + _parseColorMatrixFilter = function(t, v, pg) { + if (!_ColorMatrixFilter) { + _ColorMatrixFilter = (_gsScope.ColorMatrixFilter || _gsScope.createjs.ColorMatrixFilter); + if (!_ColorMatrixFilter) { + throw("EaselPlugin error: The EaselJS ColorMatrixFilter JavaScript file wasn't loaded."); + } + } + var filters = t.filters || [], + i = filters.length, + matrix, startMatrix, s; + while (--i > -1) { + if (filters[i] instanceof _ColorMatrixFilter) { + s = filters[i]; + break; + } + } + if (!s) { + s = new _ColorMatrixFilter(_idMatrix.slice()); + filters.push(s); + t.filters = filters; + } + startMatrix = s.matrix; + matrix = _idMatrix.slice(); + if (v.colorize != null) { + matrix = _colorize(matrix, v.colorize, Number(v.colorizeAmount)); + } + if (v.contrast != null) { + matrix = _setContrast(matrix, Number(v.contrast)); + } + if (v.hue != null) { + matrix = _setHue(matrix, Number(v.hue)); + } + if (v.saturation != null) { + matrix = _setSaturation(matrix, Number(v.saturation)); + } + + i = matrix.length; + while (--i > -1) { + if (matrix[i] !== startMatrix[i]) { + pg._addTween(startMatrix, i, startMatrix[i], matrix[i], "easel_colorMatrixFilter"); + } + } + + pg._overwriteProps.push("easel_colorMatrixFilter"); + if (!t.cacheID) { + throw("EaselPlugin warning: for filters to display in EaselJS, you must call the object's cache() method first. " + t); + } + + pg._matrix = startMatrix; + }; + + + var EaselPlugin = _gsScope._gsDefine.plugin({ + propName: "easel", + priority: -1, + version: "0.2.2", + API: 2, + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween, index) { + this._target = target; + var p, pt, tint, colorMatrix, end, labels, i; + for (p in value) { + + end = value[p]; + if (typeof(end) === "function") { + end = end(index, target); + } + if (p === "colorFilter" || p === "tint" || p === "tintAmount" || p === "exposure" || p === "brightness") { + if (!tint) { + _parseColorFilter(target, value.colorFilter || value, this); + tint = true; + } + + } else if (p === "saturation" || p === "contrast" || p === "hue" || p === "colorize" || p === "colorizeAmount") { + if (!colorMatrix) { + _parseColorMatrixFilter(target, value.colorMatrixFilter || value, this); + colorMatrix = true; + } + + } else if (p === "frame") { + this._firstPT = pt = {_next:this._firstPT, t:target, p:"gotoAndStop", s:target.currentFrame, f:true, n:"frame", pr:0, type:0, m:Math.round}; + if (typeof(end) === "string" && end.charAt(1) !== "=" && (labels = target.labels)) { + for (i = 0; i < labels.length; i++) { + if (labels[i].label === end) { + end = labels[i].position; + } + } + } + pt.c = (typeof(end) === "number") ? end - pt.s : parseFloat((end+"").split("=").join("")); + if (pt._next) { + pt._next._prev = pt; + } + + } else if (target[p] != null) { + this._firstPT = pt = {_next:this._firstPT, t:target, p:p, f:(typeof(target[p]) === "function"), n:p, pr:0, type:0}; + pt.s = (!pt.f) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ](); + pt.c = (typeof(end) === "number") ? end - pt.s : (typeof(end) === "string") ? parseFloat(end.split("=").join("")) : 0; + + if (pt._next) { + pt._next._prev = pt; + } + } + + } + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(v) { + var pt = this._firstPT, + min = 0.000001, + val; + while (pt) { + val = pt.c * v + pt.s; + if (pt.m) { + val = pt.m(val, pt.t); + } else if (val < min && val > -min) { + val = 0; + } + if (pt.f) { + pt.t[pt.p](val); + } else { + pt.t[pt.p] = val; + } + pt = pt._next; + } + if (this._target.cacheID) { + this._target.updateCache(); + } + } + + }); + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("EaselPlugin")); +/*! + * VERSION: 0.1.3 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + _gsScope._gsDefine.plugin({ + propName: "endArray", + API: 2, + version: "0.1.3", + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween) { + var i = value.length, + a = this.a = [], + start, end; + this.target = target; + this._mod = 0; + if (!i) { + return false; + } + while (--i > -1) { + start = target[i]; + end = value[i]; + if (start !== end) { + a.push({i:i, s:start, c:end - start}); + } + } + return true; + }, + + mod: function(lookup) { + if (typeof(lookup.endArray) === "function") { + this._mod = lookup.endArray; + } + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(ratio) { + var target = this.target, + a = this.a, + i = a.length, + mod = this._mod, + e, val; + if (mod) { + while (--i > -1) { + e = a[i]; + target[e.i] = mod(e.s + e.c * ratio, target); + } + } else { + while (--i > -1) { + e = a[i]; + val = e.s + e.c * ratio; + target[e.i] = (val < 0.000001 && val > -0.000001) ? 0 : val; + } + } + } + + }); + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } +/*! + * VERSION: 0.0.4 + * DATE: 2018-05-21 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _cssRatioSetter = function(pt, cssp, mod) { //Takes an individual CSSPropTween and converts it into a type:2 that has a setRatio that does everything the regular CSSPlugin.setRatio() method does but applying the mod() too. We do this to keep the main CSSPlugin.setRatio() as fast as possible (the vast majority of times, no mod() will be necessary) + var type = pt.type, + oldSetRatio = pt.setRatio, + tween = cssp._tween, + target = cssp._target; + pt.type = 2; + pt.m = mod; + pt.setRatio = function(v) { + var min = 0.000001, + val, str, i; + if (v === 1 && (tween._time === tween._duration || tween._time === 0)) { + + if (type !== 2) { + if (pt.r && type !== -1) { + val = Math.round(pt.s + pt.c); + if (!type) { + pt.t[pt.p] = mod.call(tween, val + pt.xs0, target, tween); + } else if (type === 1) { + str = pt.xs0 + val + pt.xs1; + for (i = 1; i < pt.l; i++) { + str += pt["xn"+i] + pt["xs"+(i+1)]; + } + pt.t[pt.p] = mod.call(tween, str, target, tween); + } + } else { + pt.t[pt.p] = mod.call(tween, pt.e, target, tween); + } + } else { + oldSetRatio.call(pt, v); + } + + } else if (v || !(tween._time === tween._duration || tween._time === 0) || tween._rawPrevTime === -0.000001) { + val = pt.c * v + pt.s; + if (pt.r) { + val = Math.round(val); + } else if (val < min) if (val > -min) { + val = 0; + } + if (!type) { + pt.t[pt.p] = mod.call(tween, val + pt.xs0, target, tween); + } else if (type === 1) { + str = pt.xs0 + val + pt.xs1; + for (i = 1; i < pt.l; i++) { + str += pt["xn"+i] + pt["xs"+(i+1)]; + } + pt.t[pt.p] = mod.call(tween, str, target, tween); + + } else if (type === -1) { //non-tweening value + pt.t[pt.p] = mod.call(tween, pt.xs0, target, tween); + + } else if (oldSetRatio) { + oldSetRatio.call(pt, v); + } + + } else { + if (type !== 2) { + pt.t[pt.p] = mod.call(tween, pt.b, target, tween); + } else { + oldSetRatio.call(pt, v); + } + } + }; + }, + _modCSS = function(lookup, cssp) { + var pt = cssp._firstPT, + hasBezier = (lookup.rotation && cssp._overwriteProps.join("").indexOf("bezier") !== -1); //when a Bezier tween is applying autoRotation, it's a very special case we need to handle differently. + if (lookup.scale) { + lookup.scaleX = lookup.scaleY = lookup.scale; + } else if (lookup.rotationZ) { + lookup.rotation = lookup.rotationZ; + } + while (pt) { + if (typeof(lookup[pt.p]) === "function") { + _cssRatioSetter(pt, cssp, lookup[pt.p]); + } else if (hasBezier && pt.n === "bezier" && pt.plugin._overwriteProps.join("").indexOf("rotation") !== -1) { + pt.data.mod = lookup.rotation; + } + pt = pt._next; + } + }, + + ModifiersPlugin = _gsScope._gsDefine.plugin({ + propName: "modifiers", + version: "0.0.4", + API: 2, + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween) { + this._tween = tween; + this._vars = value; + return true; + }, + + initAll: function() { + var tween = this._tween, + lookup = this._vars, + mpt = this, + pt = tween._firstPT, + val, next; + //initAll() gets called for each and every ModifiersPlugin instance in a tween, so if there are multiple targets, there will be multiple instances. Since we're ripping through the whole tween (and all the PropTweens), we only need to run this code ONCE. So we're setting a toggle on the first PropTween that just tells us if we've done it already. We don't set it on the tween instance because if it gets invalidated, we don't want to have to track this property and reset it. PropTweens get blown away when a tween is invalidated. + if (pt._modInitted) { + return false; + } else { + pt._modInitted = 1; + } + while (pt) { + next = pt._next; //record here, because it may get removed + val = lookup[pt.n]; + if (pt.pg) { + if (pt.t._propName === "css") { //handle CSSPlugin uniquely (for performance, due to the fact that the values almost always are a concatenation of numbers and strings, like suffixes, and we don't want to slow down the regular CSSPlugin setRatio() performance with conditional checks for if the value needs to be modded, so we pull any modding prop out and change it to a type:2 one that simply calls a setRatio() method where we encapsulate the modding and update all together. That way, it says in the main CSSProp linked list and just has some custom logic applied to it inside its setRatio()) + _modCSS(lookup, pt.t); + } else if (pt.t !== mpt) { //don't run modProps on modProps :) + val = lookup[pt.t._propName]; + pt.t._tween = tween; + pt.t._mod((typeof(val) === "object") ? val : lookup); + } + } else if (typeof(val) === "function") { + if (pt.f === 2 && pt.t) { //a blob (text containing multiple numeric values) + pt.t._applyPT.m = val; + pt.t._tween = tween; + } else { + this._add(pt.t, pt.p, pt.s, pt.c, val); + //remove from linked list + if (next) { + next._prev = pt._prev; + } + if (pt._prev) { + pt._prev._next = next; + } else if (tween._firstPT === pt) { + tween._firstPT = next; + } + pt._next = pt._prev = null; + tween._propLookup[pt.n] = mpt; + } + } + pt = next; + } + return false; + } + + }), + p = ModifiersPlugin.prototype; + + p._add = function(target, p, s, c, mod) { + this._addTween(target, p, s, s + c, p, mod); + this._overwriteProps.push(p); + }; + + p = _gsScope._gsDefine.globals.TweenLite.version.split("."); + if (Number(p[0]) <= 1 && Number(p[1]) < 19 && _gsScope.console) { + console.log("ModifiersPlugin requires GSAP 1.19.0 or later."); + } + + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("ModifiersPlugin")); +/*! + * VERSION: 0.9.0 + * DATE: 2019-02-07 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * MorphSVGPlugin is a Club GreenSock membership benefit; You must have a valid membership to use + * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. + * This work is subject to the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + + var _PI = Math.PI, + _DEG2RAD = _PI / 180, + _svgPathExp = /[achlmqstvz]|(-?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig, + _numbersExp = /(?:(-|-=|\+=)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig, + _selectorExp = /(^[#\.][a-z]|[a-y][a-z])/gi, + _commands = /[achlmqstvz]/ig, + _scientific = /[\+\-]?\d*\.?\d+e[\+\-]?\d+/ig, + _atan2 = Math.atan2, + _cos = Math.cos, + _sin = Math.sin, + _sqrt = Math.sqrt, + _2PI = _PI * 2, + _angleMin = _PI * 0.3, + _angleMax = _PI * 0.7, + _lastLinkedAnchor, + TweenLite = _gsScope._gsDefine.globals.TweenLite, + + _log = function(message) { + if (_gsScope.console) { + console.log(message); + } + }, + + // translates SVG arc data into an array of cubic beziers + _arcToBeziers = function(lastX, lastY, rx, ry, angle, largeArcFlag, sweepFlag, x, y) { + if (lastX === x && lastY === y) { + return; + } + rx = Math.abs(rx); + ry = Math.abs(ry); + var angleRad = (angle % 360) * _DEG2RAD, + cosAngle = _cos(angleRad), + sinAngle = _sin(angleRad), + dx2 = (lastX - x) / 2, + dy2 = (lastY - y) / 2, + x1 = (cosAngle * dx2 + sinAngle * dy2), + y1 = (-sinAngle * dx2 + cosAngle * dy2), + x1_sq = x1 * x1, + y1_sq = y1 * y1, + radiiCheck = x1_sq / (rx * rx) + y1_sq / (ry * ry); + if (radiiCheck > 1) { + rx = _sqrt(radiiCheck) * rx; + ry = _sqrt(radiiCheck) * ry; + } + var rx_sq = rx * rx, + ry_sq = ry * ry, + sq = ((rx_sq * ry_sq) - (rx_sq * y1_sq) - (ry_sq * x1_sq)) / ((rx_sq * y1_sq) + (ry_sq * x1_sq)); + if (sq < 0) { + sq = 0; + } + var coef = ((largeArcFlag === sweepFlag) ? -1 : 1) * _sqrt(sq), + cx1 = coef * ((rx * y1) / ry), + cy1 = coef * -((ry * x1) / rx), + sx2 = (lastX + x) / 2, + sy2 = (lastY + y) / 2, + cx = sx2 + (cosAngle * cx1 - sinAngle * cy1), + cy = sy2 + (sinAngle * cx1 + cosAngle * cy1), + ux = (x1 - cx1) / rx, + uy = (y1 - cy1) / ry, + vx = (-x1 - cx1) / rx, + vy = (-y1 - cy1) / ry, + temp = ux * ux + uy * uy, + angleStart = ((uy < 0) ? -1 : 1) * Math.acos(ux / _sqrt(temp)), + angleExtent = ((ux * vy - uy * vx < 0) ? -1 : 1) * Math.acos((ux * vx + uy * vy) / _sqrt(temp * (vx * vx + vy * vy))); + if (!sweepFlag && angleExtent > 0) { + angleExtent -= _2PI; + } else if (sweepFlag && angleExtent < 0) { + angleExtent += _2PI; + } + angleStart %= _2PI; + angleExtent %= _2PI; + var segments = Math.ceil(Math.abs(angleExtent) / (_2PI / 4)), + rawPath = [], + angleIncrement = angleExtent / segments, + controlLength = 4 / 3 * _sin(angleIncrement / 2) / (1 + _cos(angleIncrement / 2)), + ma = cosAngle * rx, + mb = sinAngle * rx, + mc = sinAngle * -ry, + md = cosAngle * ry, + i; + for (i = 0; i < segments; i++) { + angle = angleStart + i * angleIncrement; + x1 = _cos(angle); + y1 = _sin(angle); + ux = _cos(angle += angleIncrement); + uy = _sin(angle); + rawPath.push(x1 - controlLength * y1, y1 + controlLength * x1, ux + controlLength * uy, uy - controlLength * ux, ux, uy); + } + //now transform according to the actual size of the ellipse/arc (the beziers were noramlized, between 0 and 1 on a circle). + for (i = 0; i < rawPath.length; i+=2) { + x1 = rawPath[i]; + y1 = rawPath[i+1]; + rawPath[i] = x1 * ma + y1 * mc + cx; + rawPath[i+1] = x1 * mb + y1 * md + cy; + } + rawPath[i-2] = x; //always set the end to exactly where it's supposed to be + rawPath[i-1] = y; + return rawPath; + }, + + //Spits back an array of cubic Bezier segments that use absolute coordinates. Each segment starts with a "moveTo" command (x coordinate, then y) and then 2 control points (x, y, x, y), then anchor. The goal is to minimize memory and maximize speed. + _stringToRawPath = function(d) { + var a = (d + "").replace(_scientific, function(m) { var n = +m; return (n < 0.0001 && n > -0.0001) ? 0 : n; }).match(_svgPathExp) || [], //some authoring programs spit out very small numbers in scientific notation like "1e-5", so make sure we round that down to 0 first. + path = [], + relativeX = 0, + relativeY = 0, + twoThirds = 2 / 3, + elements = a.length, + points = 0, + errorMessage = "ERROR: malformed path: " + d, + line = function(sx, sy, ex, ey) { + difX = (ex - sx) / 3; + difY = (ey - sy) / 3; + segment.push(sx + difX, sy + difY, ex - difX, ey - difY, ex, ey); + }, + i, j, x, y, command, isRelative, segment, startX, startY, difX, difY, beziers, prevCommand; + if (!d || !isNaN(a[0]) || isNaN(a[1])) { + _log(errorMessage); + return path; + } + for (i = 0; i < elements; i++) { + prevCommand = command; + if (isNaN(a[i])) { + command = a[i].toUpperCase(); + isRelative = (command !== a[i]); //lower case means relative + } else { //commands like "C" can be strung together without any new command characters between. + i--; + } + x = +a[i + 1]; + y = +a[i + 2]; + if (isRelative) { + x += relativeX; + y += relativeY; + } + if (!i) { + startX = x; + startY = y; + } + + // "M" (move) + if (command === "M") { + if (segment) { + if (segment.length < 8) { //if the path data was funky and just had a M with no actual drawing anywhere, skip it. + path.length -= 1; + } else { + points += segment.length; + } + } + relativeX = startX = x; + relativeY = startY = y; + segment = [x, y]; + path.push(segment); + i += 2; + command = "L"; //an "M" with more than 2 values gets interpreted as "lineTo" commands ("L"). + + // "C" (cubic bezier) + } else if (command === "C") { + if (!segment) { + segment = [0, 0]; + } + if (!isRelative) { + relativeX = relativeY = 0; + } + //note: "*1" is just a fast/short way to cast the value as a Number. WAAAY faster in Chrome, slightly slower in Firefox. + segment.push(x, y, relativeX + a[i + 3] * 1, relativeY + a[i + 4] * 1, (relativeX += a[i + 5] * 1), (relativeY += a[i + 6] * 1)); + i += 6; + + // "S" (continuation of cubic bezier) + } else if (command === "S") { + difX = relativeX; + difY = relativeY; + if (prevCommand === "C" || prevCommand === "S") { + difX += relativeX - segment[segment.length - 4]; + difY += relativeY - segment[segment.length - 3]; + } + if (!isRelative) { + relativeX = relativeY = 0; + } + segment.push(difX, difY, x, y, (relativeX += a[i + 3] * 1), (relativeY += a[i + 4] * 1)); + i += 4; + + // "Q" (quadratic bezier) + } else if (command === "Q") { + difX = relativeX + (x - relativeX) * twoThirds; + difY = relativeY + (y - relativeY) * twoThirds; + if (!isRelative) { + relativeX = relativeY = 0; + } + relativeX += a[i + 3] * 1; + relativeY += a[i + 4] * 1; + segment.push(difX, difY, relativeX + (x - relativeX) * twoThirds, relativeY + (y - relativeY) * twoThirds, relativeX, relativeY); + i += 4; + + // "T" (continuation of quadratic bezier) + } else if (command === "T") { + difX = relativeX - segment[segment.length - 4]; + difY = relativeY - segment[segment.length - 3]; + segment.push(relativeX + difX, relativeY + difY, x + ((relativeX + difX * 1.5) - x) * twoThirds, y + ((relativeY + difY * 1.5) - y) * twoThirds, (relativeX = x), (relativeY = y)); + i += 2; + + // "H" (horizontal line) + } else if (command === "H") { + line(relativeX, relativeY, (relativeX = x), relativeY); + i += 1; + + // "V" (vertical line) + } else if (command === "V") { + //adjust values because the first (and only one) isn't x in this case, it's y. + line(relativeX, relativeY, relativeX, (relativeY = x + (isRelative ? relativeY - relativeX : 0))); + i += 1; + + // "L" (line) or "Z" (close) + } else if (command === "L" || command === "Z") { + if (command === "Z") { + x = startX; + y = startY; + segment.closed = true; + } + if (command === "L" || Math.abs(relativeX - x) > 0.5 || Math.abs(relativeY - y) > 0.5) { + line(relativeX, relativeY, x, y); + if (command === "L") { + i += 2; + } + } + relativeX = x; + relativeY = y; + + // "A" (arc) + } else if (command === "A") { + beziers = _arcToBeziers(relativeX, relativeY, +a[i+1], +a[i+2], +a[i+3], +a[i+4], +a[i+5], (isRelative ? relativeX : 0) + a[i+6]*1, (isRelative ? relativeY : 0) + a[i+7]*1); + if (beziers) { + for (j = 0; j < beziers.length; j++) { + segment.push(beziers[j]); + } + } + relativeX = segment[segment.length-2]; + relativeY = segment[segment.length-1]; + i += 7; + + } else { + _log(errorMessage); + } + } + i = segment.length; + if (segment[0] === segment[i-2] && segment[1] === segment[i-1]) { + segment.closed = true; + } + path.totalPoints = points + i; + return path; + }, + + //adds a certain number of Beziers while maintaining the path shape (so that the start/end values can have a matching quantity of points to animate). Only pass in ONE segment of the Bezier at a time. Format: [xAnchor, yAnchor, xControlPoint1, yControlPoint1, xControlPoint2, yControlPoint2, xAnchor, yAnchor, xControlPoint1, etc...] + _subdivideSegment = function(segment, quantity) { + var tally = 0, + max = 0.999999, + l = segment.length, + newPointsPerSegment = quantity / ((l - 2) / 6), + ax, ay, cp1x, cp1y, cp2x, cp2y, bx, by, + x1, y1, x2, y2, i, t; + for (i = 2; i < l; i += 6) { + tally += newPointsPerSegment; + while (tally > max) { //compare with 0.99999 instead of 1 in order to prevent rounding errors + ax = segment[i-2]; + ay = segment[i-1]; + cp1x = segment[i]; + cp1y = segment[i+1]; + cp2x = segment[i+2]; + cp2y = segment[i+3]; + bx = segment[i+4]; + by = segment[i+5]; + t = 1 / ((Math.floor(tally) || 1) + 1); //progress along the bezier (value between 0 and 1) + x1 = ax + (cp1x - ax) * t; + x2 = cp1x + (cp2x - cp1x) * t; + x1 += (x2 - x1) * t; + x2 += ((cp2x + (bx - cp2x) * t) - x2) * t; + + y1 = ay + (cp1y - ay) * t; + y2 = cp1y + (cp2y - cp1y) * t; + y1 += (y2 - y1) * t; + y2 += ((cp2y + (by - cp2y) * t) - y2) * t; + + segment.splice(i, 4, + ax + (cp1x - ax) * t, //first control point + ay + (cp1y - ay) * t, + x1, //second control point + y1, + x1 + (x2 - x1) * t, //new fabricated anchor on line + y1 + (y2 - y1) * t, + x2, //third control point + y2, + cp2x + (bx - cp2x) * t, //fourth control point + cp2y + (by - cp2y) * t + ); + i += 6; + l += 6; + tally--; + } + } + return segment; + }, + _rawPathToString = function(rawPath, precision) { + var s = "", + space = " ", + l = rawPath.length, + rnd = Math.pow(10, precision || 2), + i, j, segment; + for (j = 0; j < rawPath.length; j++) { + segment = rawPath[j]; + l = segment.length; + s += "M" + (((segment[0] * rnd) | 0) / rnd) + space + (((segment[1] * rnd) | 0) / rnd) + " C"; + for (i = 2; i < l; i++) { //this is actually faster than just doing a join() on the array, possibly because the numbers have so many decimal places + s += (((segment[i] * rnd) | 0) / rnd) + space; + } + if (segment.closed) { + s += "z"; + } + } + return s; + }, + _reverseBezier = function(segment) { + var a = [], + i = segment.length - 1, + l = 0; + while (--i > -1) { + a[l++] = segment[i]; + a[l++] = segment[i+1]; + i--; + } + for (i = 0; i < l; i++) { + segment[i] = a[i]; + } + segment.reversed = !segment.reversed; + }, + _getAverageXY = function(segment) { + var l = segment.length, + x = 0, + y = 0, + i; + for (i = 0; i < l; i++) { + x += segment[i++]; + y += segment[i]; + } + return [x / (l / 2), y / (l / 2)]; + }, + _getSize = function(segment) { //rough estimate of the bounding box (based solely on the anchors) of a single segment. sets "size", "centerX", and "centerY" properties on the bezier array itself, and returns the size (width * height) + var l = segment.length, + xMax = segment[0], + xMin = xMax, + yMax = segment[1], + yMin = yMax, + x, y, i; + for (i = 6; i < l; i+=6) { + x = segment[i]; + y = segment[i+1]; + if (x > xMax) { + xMax = x; + } else if (x < xMin) { + xMin = x; + } + if (y > yMax) { + yMax = y; + } else if (y < yMin) { + yMin = y; + } + } + segment.centerX = (xMax + xMin) / 2; + segment.centerY = (yMax + yMin) / 2; + return (segment.size = (xMax - xMin) * (yMax - yMin)); + }, + _getTotalSize = function(rawPath, samplesPerBezier) { //rough estimate of the bounding box of the entire list of Bezier segments (based solely on the anchors). sets "size", "centerX", and "centerY" properties on the bezier array itself, and returns the size (width * height) + samplesPerBezier = samplesPerBezier || 3; + var j = rawPath.length, + xMax = rawPath[0][0], + xMin = xMax, + yMax = rawPath[0][1], + yMin = yMax, + inc = 1 / samplesPerBezier, + l, x, y, i, segment, k, t, inv, x1, y1, x2, x3, x4, y2, y3, y4; + while (--j > -1) { + segment = rawPath[j]; + l = segment.length; + for (i = 6; i < l; i+=6) { + x1 = segment[i]; + y1 = segment[i+1]; + x2 = segment[i+2] - x1; + y2 = segment[i+3] - y1; + x3 = segment[i+4] - x1; + y3 = segment[i+5] - y1; + x4 = segment[i+6] - x1; + y4 = segment[i+7] - y1; + k = samplesPerBezier; + while (--k > -1) { + t = inc * k; + inv = 1 - t; + x = (t * t * x4 + 3 * inv * (t * x3 + inv * x2)) * t + x1; + y = (t * t * y4 + 3 * inv * (t * y3 + inv * y2)) * t + y1; + if (x > xMax) { + xMax = x; + } else if (x < xMin) { + xMin = x; + } + if (y > yMax) { + yMax = y; + } else if (y < yMin) { + yMin = y; + } + } + } + } + rawPath.centerX = (xMax + xMin) / 2; + rawPath.centerY = (yMax + yMin) / 2; + rawPath.left = xMin; + rawPath.width = (xMax - xMin); + rawPath.top = yMin; + rawPath.height = (yMax - yMin); + return (rawPath.size = (xMax - xMin) * (yMax - yMin)); + }, + _sortByComplexity = function(a, b) { + return b.length - a.length; + }, + _sortBySize = function(a, b) { + var sizeA = a.size || _getSize(a), + sizeB = b.size || _getSize(b); + return (Math.abs(sizeB - sizeA) < (sizeA + sizeB) / 20) ? (b.centerX - a.centerX) || (b.centerY - a.centerY) : sizeB - sizeA; //if the size is within 10% of each other, prioritize position from left to right, then top to bottom. + }, + _offsetSegment = function(segment, shapeIndex) { + var a = segment.slice(0), + l = segment.length, + wrap = l - 2, + i, index; + shapeIndex = shapeIndex | 0; + for (i = 0; i < l; i++) { + index = (i + shapeIndex) % wrap; + segment[i++] = a[index]; + segment[i] = a[index+1]; + } + }, + _getTotalMovement = function(sb, eb, shapeIndex, offsetX, offsetY) { + var l = sb.length, + d = 0, + wrap = l - 2, + index, i, x, y; + shapeIndex *= 6; + for (i = 0; i < l; i += 6) { + index = (i + shapeIndex) % wrap; + y = sb[index] - (eb[i] - offsetX); + x = sb[index+1] - (eb[i+1] - offsetY); + d += _sqrt(x * x + y * y); + } + return d; + }, + _getClosestShapeIndex = function(sb, eb, checkReverse) { //finds the index in a closed cubic bezier array that's closest to the angle provided (angle measured from the center or average x/y). + var l = sb.length, + sCenter = _getAverageXY(sb), //when comparing distances, adjust the coordinates as if the shapes are centered with each other. + eCenter = _getAverageXY(eb), + offsetX = eCenter[0] - sCenter[0], + offsetY = eCenter[1] - sCenter[1], + min = _getTotalMovement(sb, eb, 0, offsetX, offsetY), + minIndex = 0, + copy, d, i; + for (i = 6; i < l; i += 6) { + d = _getTotalMovement(sb, eb, i / 6, offsetX, offsetY); + if (d < min) { + min = d; + minIndex = i; + } + } + if (checkReverse) { + copy = sb.slice(0); + _reverseBezier(copy); + for (i = 6; i < l; i += 6) { + d = _getTotalMovement(copy, eb, i / 6, offsetX, offsetY); + if (d < min) { + min = d; + minIndex = -i; + } + } + } + return minIndex / 6; + }, + _getClosestAnchor = function(bezier, x, y) { //finds the x/y of the anchor that's closest to the provided x/y coordinate (returns an array, like [x, y]). The bezier should be the top-level type that contains an array for each segment. + var j = bezier.length, + closestDistance = 99999999999, + closestX = 0, + closestY = 0, + b, dx, dy, d, i, l; + while (--j > -1) { + b = bezier[j]; + l = b.length; + for (i = 0; i < l; i += 6) { + dx = b[i] - x; + dy = b[i+1] - y; + d = _sqrt(dx * dx + dy * dy); + if (d < closestDistance) { + closestDistance = d; + closestX = b[i]; + closestY = b[i+1]; + } + } + } + return [closestX, closestY]; + }, + _getClosestSegment = function(bezier, pool, startIndex, sortRatio, offsetX, offsetY) { //matches the bezier to the closest one in a pool (array) of beziers, assuming they are in order of size and we shouldn't drop more than 20% of the size, otherwise prioritizing location (total distance to the center). Extracts the segment out of the pool array and returns it. + var l = pool.length, + index = 0, + minSize = Math.min(bezier.size || _getSize(bezier), pool[startIndex].size || _getSize(pool[startIndex])) * sortRatio, //limit things based on a percentage of the size of either the bezier or the next element in the array, whichever is smaller. + min = 999999999999, + cx = bezier.centerX + offsetX, + cy = bezier.centerY + offsetY, + size, i, dx, dy, d; + for (i = startIndex; i < l; i++) { + size = pool[i].size || _getSize(pool[i]); + if (size < minSize) { + break; + } + dx = pool[i].centerX - cx; + dy = pool[i].centerY - cy; + d = _sqrt(dx * dx + dy * dy); + if (d < min) { + index = i; + min = d; + } + } + d = pool[index]; + pool.splice(index, 1); + return d; + }, + _equalizeSegmentQuantity = function(start, end, shapeIndex, map, fillSafe) { //returns an array of shape indexes, 1 for each segment. + var dif = end.length - start.length, + longer = dif > 0 ? end : start, + shorter = dif > 0 ? start : end, + added = 0, + sortMethod = (map === "complexity") ? _sortByComplexity : _sortBySize, + sortRatio = (map === "position") ? 0 : (typeof(map) === "number") ? map : 0.8, + i = shorter.length, + shapeIndices = (typeof(shapeIndex) === "object" && shapeIndex.push) ? shapeIndex.slice(0) : [shapeIndex], + reverse = (shapeIndices[0] === "reverse" || shapeIndices[0] < 0), + log = (shapeIndex === "log"), + eb, sb, b, x, y, offsetX, offsetY; + if (!shorter[0]) { + return; + } + if (longer.length > 1) { + start.sort(sortMethod); + end.sort(sortMethod); + offsetX = longer.size || _getTotalSize(longer); //ensures centerX and centerY are defined (used below). + offsetX = shorter.size || _getTotalSize(shorter); + offsetX = longer.centerX - shorter.centerX; + offsetY = longer.centerY - shorter.centerY; + if (sortMethod === _sortBySize) { + for (i = 0; i < shorter.length; i++) { + longer.splice(i, 0, _getClosestSegment(shorter[i], longer, i, sortRatio, offsetX, offsetY)); + } + } + } + if (dif) { + if (dif < 0) { + dif = -dif; + } + if (longer[0].length > shorter[0].length) { //since we use shorter[0] as the one to map the origination point of any brand new fabricated segments, do any subdividing first so that there are more points to choose from (if necessary) + _subdivideSegment(shorter[0], ((longer[0].length - shorter[0].length)/6) | 0); + } + i = shorter.length; + while (added < dif) { + x = longer[i].size || _getSize(longer[i]); //just to ensure centerX and centerY are calculated which we use on the next line. + b = _getClosestAnchor(shorter, longer[i].centerX, longer[i].centerY); + x = b[0]; + y = b[1]; + shorter[i++] = [x, y, x, y, x, y, x, y]; + shorter.totalPoints += 8; + added++; + } + } + for (i = 0; i < start.length; i++) { + eb = end[i]; + sb = start[i]; + dif = eb.length - sb.length; + if (dif < 0) { + _subdivideSegment(eb, (-dif/6) | 0); + } else if (dif > 0) { + _subdivideSegment(sb, (dif/6) | 0); + } + if (reverse && fillSafe !== false && !sb.reversed) { + _reverseBezier(sb); + } + shapeIndex = (shapeIndices[i] || shapeIndices[i] === 0) ? shapeIndices[i] : "auto"; + if (shapeIndex) { + //if start shape is closed, find the closest point to the start/end, and re-organize the bezier points accordingly so that the shape morphs in a more intuitive way. + if (sb.closed || (Math.abs(sb[0] - sb[sb.length - 2]) < 0.5 && Math.abs(sb[1] - sb[sb.length - 1]) < 0.5)) { + if (shapeIndex === "auto" || shapeIndex === "log") { + shapeIndices[i] = shapeIndex = _getClosestShapeIndex(sb, eb, (!i || fillSafe === false)); + if (shapeIndex < 0) { + reverse = true; + _reverseBezier(sb); + shapeIndex = -shapeIndex; + } + _offsetSegment(sb, shapeIndex * 6); + + } else if (shapeIndex !== "reverse") { + if (i && shapeIndex < 0) { //only happens if an array is passed as shapeIndex and a negative value is defined for an index beyond 0. Very rare, but helpful sometimes. + _reverseBezier(sb); + } + _offsetSegment(sb, (shapeIndex < 0 ? -shapeIndex : shapeIndex) * 6); + } + //otherwise, if it's not a closed shape, consider reversing it if that would make the overall travel less + } else if (!reverse && (shapeIndex === "auto" && (Math.abs(eb[0] - sb[0]) + Math.abs(eb[1] - sb[1]) + Math.abs(eb[eb.length - 2] - sb[sb.length - 2]) + Math.abs(eb[eb.length - 1] - sb[sb.length - 1]) > Math.abs(eb[0] - sb[sb.length - 2]) + Math.abs(eb[1] - sb[sb.length - 1]) + Math.abs(eb[eb.length - 2] - sb[0]) + Math.abs(eb[eb.length - 1] - sb[1])) || (shapeIndex % 2))) { + _reverseBezier(sb); + shapeIndices[i] = -1; + reverse = true; + } else if (shapeIndex === "auto") { + shapeIndices[i] = 0; + } else if (shapeIndex === "reverse") { + shapeIndices[i] = -1; + } + if (sb.closed !== eb.closed) { //if one is closed and one isn't, don't close either one otherwise the tweening will look weird (but remember, the beginning and final states will honor the actual values, so this only affects the inbetween state) + sb.closed = eb.closed = false; + } + } + } + if (log) { + _log("shapeIndex:[" + shapeIndices.join(",") + "]"); + } + start.shapeIndex = shapeIndices; + return shapeIndices; + }, + _pathFilter = function(a, shapeIndex, map, precompile, fillSafe) { + var start = _stringToRawPath(a[0]), + end = _stringToRawPath(a[1]); + if (!_equalizeSegmentQuantity(start, end, (shapeIndex || shapeIndex === 0) ? shapeIndex : "auto", map, fillSafe)) { + return; //malformed path data or null target + } + a[0] = _rawPathToString(start); + a[1] = _rawPathToString(end); + if (precompile === "log" || precompile === true) { + _log('precompile:["' + a[0] + '","' + a[1] + '"]'); + } + }, + /* + _buildPathFilter = function(shapeIndex, map, precompile) { + return (map || precompile || shapeIndex || shapeIndex === 0) ? function(a) { + _pathFilter(a, shapeIndex, map, precompile); + } : _pathFilter; + }, + */ + _offsetPoints = function(text, offset) { + if (!offset) { + return text; + } + var a = text.match(_numbersExp) || [], + l = a.length, + s = "", + inc, i, j; + if (offset === "reverse") { + i = l-1; + inc = -2; + } else { + i = (((parseInt(offset, 10) || 0) * 2 + 1) + l * 100) % l; + inc = 2; + } + for (j = 0; j < l; j += 2) { + s += a[i-1] + "," + a[i] + " "; + i = (i + inc) % l; + } + return s; + }, + //adds a certain number of points while maintaining the polygon/polyline shape (so that the start/end values can have a matching quantity of points to animate). Returns the revised string. + _equalizePointQuantity = function(a, quantity) { + var tally = 0, + x = parseFloat(a[0]), + y = parseFloat(a[1]), + s = x + "," + y + " ", + max = 0.999999, + newPointsPerSegment, i, l, j, factor, nextX, nextY; + l = a.length; + newPointsPerSegment = quantity * 0.5 / (l * 0.5 - 1); + for (i = 0; i < l-2; i += 2) { + tally += newPointsPerSegment; + nextX = parseFloat(a[i+2]); + nextY = parseFloat(a[i+3]); + if (tally > max) { //compare with 0.99999 instead of 1 in order to prevent rounding errors + factor = 1 / (Math.floor(tally) + 1); + j = 1; + while (tally > max) { + s += (x + (nextX - x) * factor * j).toFixed(2) + "," + (y + (nextY - y) * factor * j).toFixed(2) + " "; + tally--; + j++; + } + } + s += nextX + "," + nextY + " "; + x = nextX; + y = nextY; + } + return s; + }, + _pointsFilter = function(a) { + var startNums = a[0].match(_numbersExp) || [], + endNums = a[1].match(_numbersExp) || [], + dif = endNums.length - startNums.length; + if (dif > 0) { + a[0] = _equalizePointQuantity(startNums, dif); + } else { + a[1] = _equalizePointQuantity(endNums, -dif); + } + }, + _buildPointsFilter = function(shapeIndex) { + return !isNaN(shapeIndex) ? function(a) { + _pointsFilter(a); + a[1] = _offsetPoints(a[1], parseInt(shapeIndex, 10)); + } : _pointsFilter; + }, + _createPath = function(e, ignore) { + var path = _gsScope.document.createElementNS("http://www.w3.org/2000/svg", "path"), + attr = Array.prototype.slice.call(e.attributes), + i = attr.length, + name; + ignore = "," + ignore + ","; + while (--i > -1) { + name = attr[i].nodeName.toLowerCase(); //in Microsoft Edge, if you don't set the attribute with a lowercase name, it doesn't render correctly! Super weird. + if (ignore.indexOf("," + name + ",") === -1) { + path.setAttributeNS(null, name, attr[i].nodeValue); + } + } + return path; + }, + _typeAttrs = { + rect:"rx,ry,x,y,width,height", + circle:"r,cx,cy", + ellipse:"rx,ry,cx,cy", + line:"x1,x2,y1,y2" + }, + _attrToObj = function(e, attrs) { + var props = attrs ? attrs.split(",") : [], + obj = {}, + i = props.length; + while (--i > -1) { + obj[props[i]] = +e.getAttribute(props[i]) || 0; + } + return obj; + }, + _convertToPath = function(e, swap) { + var type = e.tagName.toLowerCase(), + circ = 0.552284749831, + data, x, y, r, ry, path, rcirc, rycirc, points, w, h, x2, x3, x4, x5, x6, y2, y3, y4, y5, y6, attr; + if (type === "path" || !e.getBBox) { + return e; + } + path = _createPath(e, "x,y,width,height,cx,cy,rx,ry,r,x1,x2,y1,y2,points"); + attr = _attrToObj(e, _typeAttrs[type]); + if (type === "rect") { + r = attr.rx; + ry = attr.ry; + x = attr.x; + y = attr.y; + w = attr.width - r * 2; + h = attr.height - ry * 2; + if (r || ry) { //if there are rounded corners, render cubic beziers + x2 = x + r * (1 - circ); + x3 = x + r; + x4 = x3 + w; + x5 = x4 + r * circ; + x6 = x4 + r; + y2 = y + ry * (1 - circ); + y3 = y + ry; + y4 = y3 + h; + y5 = y4 + ry * circ; + y6 = y4 + ry; + data = "M" + x6 + "," + y3 + " V" + y4 + " C" + [x6, y5, x5, y6, x4, y6, x4 - (x4 - x3) / 3, y6, x3 + (x4 - x3) / 3, y6, x3, y6, x2, y6, x, y5, x, y4, x, y4 - (y4 - y3) / 3, x, y3 + (y4 - y3) / 3, x, y3, x, y2, x2, y, x3, y, x3 + (x4 - x3) / 3, y, x4 - (x4 - x3) / 3, y, x4, y, x5, y, x6, y2, x6, y3].join(",") + "z"; + } else { + data = "M" + (x + w) + "," + y + " v" + h + " h" + (-w) + " v" + (-h) + " h" + w + "z"; + } + + } else if (type === "circle" || type === "ellipse") { + if (type === "circle") { + r = ry = attr.r; + rycirc = r * circ; + } else { + r = attr.rx; + ry = attr.ry; + rycirc = ry * circ; + } + x = attr.cx; + y = attr.cy; + rcirc = r * circ; + data = "M" + (x+r) + "," + y + " C" + [x+r, y + rycirc, x + rcirc, y + ry, x, y + ry, x - rcirc, y + ry, x - r, y + rycirc, x - r, y, x - r, y - rycirc, x - rcirc, y - ry, x, y - ry, x + rcirc, y - ry, x + r, y - rycirc, x + r, y].join(",") + "z"; + } else if (type === "line") { + data = "M" + attr.x1 + "," + attr.y1 + " L" + attr.x2 + "," + attr.y2; //previously, we just converted to "Mx,y Lx,y" but Safari has bugs that cause that not to render properly when using a stroke-dasharray that's not fully visible! Using a cubic bezier fixes that issue. + } else if (type === "polyline" || type === "polygon") { + points = (e.getAttribute("points") + "").match(_numbersExp) || []; + x = points.shift(); + y = points.shift(); + data = "M" + x + "," + y + " L" + points.join(","); + if (type === "polygon") { + data += "," + x + "," + y + "z"; + } + } + path.setAttribute("d", _rawPathToString(path._gsRawPath = _stringToRawPath(data))); + if (swap && e.parentNode) { + e.parentNode.insertBefore(path, e); + e.parentNode.removeChild(e); + } + + return path; + }, + _parseShape = function(shape, forcePath, target) { + var isString = typeof(shape) === "string", + e, type; + if (!isString || _selectorExp.test(shape) || (shape.match(_numbersExp) || []).length < 3) { + e = isString ? TweenLite.selector(shape) : (shape && shape[0]) ? shape : [shape]; //allow array-like objects like jQuery objects. + if (e && e[0]) { + e = e[0]; + type = (e.nodeName + "").toUpperCase(); + if (forcePath && type !== "PATH") { //if we were passed an element (or selector text for an element) that isn't a path, convert it. + e = _convertToPath(e, false); + type = "PATH"; + } + shape = e.getAttribute(type === "PATH" ? "d" : "points") || ""; + if (e === target) { //if the shape matches the target element, the user wants to revert to the original which should have been stored in the data-original attribute + shape = e.getAttributeNS(null, "data-original") || shape; + } + } else { + _log("WARNING: invalid morph to: " + shape); + shape = false; + } + } + return shape; + }, + //adds an "isSmooth" array to each segment and populates it with a boolean value indicating whether or not it's smooth (the control points have basically the same slope). For any smooth control points, it converts the coordinates into angle (x, in radians) and length (y) and puts them into the same index value in a smoothData array. + _populateSmoothData = function(rawPath, tolerance) { + var j = rawPath.length, + limit = 0.2 * (tolerance || 1), + smooth, segment, x, y, x2, y2, i, l, a, a2, isSmooth, smoothData; + while (--j > -1) { + segment = rawPath[j]; + isSmooth = segment.isSmooth = segment.isSmooth || [0, 0, 0, 0]; + smoothData = segment.smoothData = segment.smoothData || [0, 0, 0, 0]; + isSmooth.length = 4; + l = segment.length - 2; + for (i = 6; i < l; i += 6) { + x = segment[i] - segment[i - 2]; + y = segment[i + 1] - segment[i - 1]; + x2 = segment[i + 2] - segment[i]; + y2 = segment[i + 3] - segment[i + 1]; + a = _atan2(y, x); + a2 = _atan2(y2, x2); + smooth = (Math.abs(a - a2) < limit); + if (smooth) { + smoothData[i - 2] = a; + smoothData[i + 2] = a2; + smoothData[i - 1] = _sqrt(x * x + y * y); + smoothData[i + 3] = _sqrt(x2 * x2 + y2 * y2); + } + isSmooth.push(smooth, smooth, 0, 0, smooth, smooth); + } + //if the first and last points are identical, check to see if there's a smooth transition. We must handle this a bit differently due to their positions in the array. + if (segment[l] === segment[0] && segment[l+1] === segment[1]) { + x = segment[0] - segment[l-2]; + y = segment[1] - segment[l-1]; + x2 = segment[2] - segment[0]; + y2 = segment[3] - segment[1]; + a = _atan2(y, x); + a2 = _atan2(y2, x2); + if (Math.abs(a - a2) < limit) { + smoothData[l-2] = a; + smoothData[2] = a2; + smoothData[l-1] = _sqrt(x * x + y * y); + smoothData[3] = _sqrt(x2 * x2 + y2 * y2); + isSmooth[l-2] = isSmooth[l-1] = true; //don't change indexes 2 and 3 because we'll trigger everything from the END, and this will optimize file size a bit. + } + } + } + return rawPath; + }, + _parseOriginFactors = function(v) { + var a = v.trim().split(" "), + x = (v.indexOf("left") >= 0) ? 0 : (v.indexOf("right") >= 0) ? 100 : isNaN(parseFloat(a[0])) ? 50 : parseFloat(a[0]), + y = (v.indexOf("top") >= 0) ? 0 : (v.indexOf("bottom") >= 0) ? 100 : isNaN(parseFloat(a[1])) ? 50 : parseFloat(a[1]); + return {x:x / 100, y:y / 100}; + }, + _shortAngle = function(dif) { + return (dif !== dif % _PI) ? dif + ((dif < 0) ? _2PI : -_2PI) : dif; + }, + _morphMessage = "Use MorphSVGPlugin.convertToPath(elementOrSelectorText) to convert to a path before morphing.", + + + + MorphSVGPlugin = _gsScope._gsDefine.plugin({ + propName: "morphSVG", + API: 2, + global: true, + version: "0.9.0", + overwriteProps: ["morphSVG"], + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween, index) { + var cs = window.getComputedStyle(target), + fill = cs.fill + "", + fillSafe = !(fill === "none" || (fill.match(_numbersExp) || [])[3] === "0" || cs.fillRule === "evenodd"), + origins = (value.origin || "50 50").split(","), + type, p, pt, shape, isPoly, shapeIndex, map, startSmooth, endSmooth, start, end, i, j, l, startSeg, endSeg, precompiled, sData, eData, originFactors, useRotation, offset; + if (typeof(value) === "function") { + value = value(index, target); + } + type = (target.nodeName + "").toUpperCase(); + isPoly = (type === "POLYLINE" || type === "POLYGON"); + if (type !== "PATH" && !isPoly && !value.prop) { + _log("WARNING: cannot morph a <" + type + "> element. " + _morphMessage); + return false; + } + p = (type === "PATH") ? "d" : "points"; + if (typeof(value) === "string" || value.getBBox || value[0]) { + value = {shape:value}; + } + if (!value.prop && typeof(target.setAttribute) !== "function") { + return false; + } + shape = _parseShape(value.shape || value.d || value.points || "", (p === "d"), target); + if (isPoly && _commands.test(shape)) { + _log("WARNING: a <" + type + "> cannot accept path data. " + _morphMessage); + return false; + } + shapeIndex = (value.shapeIndex || value.shapeIndex === 0) ? value.shapeIndex : "auto"; + map = value.map || MorphSVGPlugin.defaultMap; + this._prop = value.prop; + this._render = value.render || MorphSVGPlugin.defaultRender; + this._apply = ("updateTarget" in value) ? value.updateTarget : MorphSVGPlugin.defaultUpdateTarget; + this._rnd = Math.pow(10, isNaN(value.precision) ? 2 : +value.precision); + this._tween = tween; + if (shape) { + this._target = target; + precompiled = (typeof(value.precompile) === "object"); + start = this._prop ? target[this._prop] : target.getAttribute(p); + if (!this._prop && !target.getAttributeNS(null, "data-original")) { + target.setAttributeNS(null, "data-original", start); //record the original state in a data-original attribute so that we can revert to it later. + } + if (p === "d" || this._prop) { + start = _stringToRawPath(precompiled ? value.precompile[0] : start); + end = _stringToRawPath(precompiled ? value.precompile[1] : shape); + if (!precompiled && !_equalizeSegmentQuantity(start, end, shapeIndex, map, fillSafe)) { + return false; //malformed path data or null target + } + if (value.precompile === "log" || value.precompile === true) { + _log('precompile:["' + _rawPathToString(start) + '","' + _rawPathToString(end) + '"]'); + } + + useRotation = (value.type || MorphSVGPlugin.defaultType) !== "linear"; + + if (useRotation) { + start = _populateSmoothData(start, value.smoothTolerance); + end = _populateSmoothData(end, value.smoothTolerance ); + if (!start.size) { + _getTotalSize(start); //adds top/left/width/height values + } + if (!end.size) { + _getTotalSize(end); + } + originFactors = _parseOriginFactors(origins[0]); + this._origin = start.origin = {x:start.left + originFactors.x * start.width, y:start.top + originFactors.y * start.height}; + if (origins[1]) { + originFactors = _parseOriginFactors(origins[1]); + } + this._eOrigin = {x:end.left + originFactors.x * end.width, y:end.top + originFactors.y * end.height}; + } + + this._rawPath = target._gsRawPath = start; + + j = start.length; + while (--j > -1) { + startSeg = start[j]; + endSeg = end[j]; + startSmooth = startSeg.isSmooth || []; + endSmooth = endSeg.isSmooth || []; + l = startSeg.length; + _lastLinkedAnchor = 0; //reset; we use _lastLinkedAnchor in the _tweenRotation() method to help make sure that close points don't get ripped apart and rotate opposite directions. Typically we want to go the shortest direction, but if the previous anchor is going a different direction, we override this logic (within certain thresholds) + for (i = 0; i < l; i+=2) { + if (endSeg[i] !== startSeg[i] || endSeg[i+1] !== startSeg[i+1]) { + if (useRotation) { + if (startSmooth[i] && endSmooth[i]) { //if BOTH starting and ending values are smooth (meaning control points have basically the same slope), interpolate the rotation and length instead of the coordinates (this is what makes things smooth). + sData = startSeg.smoothData; + eData = endSeg.smoothData; + offset = i + ((i === l - 4) ? 7 - l : 5); //helps us accommodate wrapping (like if the end and start anchors are identical and the control points are smooth). + this._controlPT = {_next:this._controlPT, i:i, j:j, l1s:sData[i+1], l1c:eData[i+1] - sData[i+1], l2s:sData[offset], l2c:eData[offset] - sData[offset]}; + pt = this._tweenRotation(startSeg, endSeg, i+2); + this._tweenRotation(startSeg, endSeg, i, pt); + this._tweenRotation(startSeg, endSeg, offset-1, pt); + i+=4; + } else { + this._tweenRotation(startSeg, endSeg, i); + } + } else { + this._addTween(startSeg, i, startSeg[i], endSeg[i]); + pt = this._addTween(startSeg, i+1, startSeg[i+1], endSeg[i+1]); + } + } + } + } + } else { + pt = this._addTween(target, "setAttribute", target.getAttribute(p) + "", shape + "", "morphSVG", false, p, _buildPointsFilter(shapeIndex)); + } + + if (useRotation) { + this._addTween(this._origin, "x", this._origin.x, this._eOrigin.x); + pt = this._addTween(this._origin, "y", this._origin.y, this._eOrigin.y); + } + + if (pt) { + this._overwriteProps.push("morphSVG"); + pt.end = shape; + pt.endProp = p; + } + } + return true; + }, + + set: function(ratio) { + var rawPath = this._rawPath, + controlPT = this._controlPT, + anchorPT = this._anchorPT, + rnd = this._rnd, + target = this._target, + s, space, easeInOut, pt, segment, l, angle, i, j, x, y, sin, cos, offset; + this._super.setRatio.call(this, ratio); + if (ratio === 1 && this._apply) { + pt = this._firstPT; + while (pt) { + if (pt.end) { + if (this._prop) { + target[this._prop] = pt.end; + } else { + target.setAttribute(pt.endProp, pt.end); //make sure the end value is exactly as specified (in case we had to add fabricated points during the tween) + } + } + pt = pt._next; + } + } else if (rawPath) { + + //rotationally position the anchors + while (anchorPT) { + angle = anchorPT.sa + ratio * anchorPT.ca; + l = anchorPT.sl + ratio * anchorPT.cl; //length + anchorPT.t[anchorPT.i] = this._origin.x + _cos(angle) * l; + anchorPT.t[anchorPT.i + 1] = this._origin.y + _sin(angle) * l; + anchorPT = anchorPT._next; + } + + //smooth out the control points + easeInOut = ratio < 0.5 ? 2 * ratio * ratio : (4 - 2 * ratio) * ratio - 1; + while (controlPT) { + i = controlPT.i; + segment = rawPath[controlPT.j]; + offset = i + ((i === segment.length - 4) ? 7 - segment.length : 5); //accommodates wrapping around of smooth points, like if the start and end anchors are on top of each other and their handles are smooth. + angle = _atan2(segment[offset] - segment[i+1], segment[offset-1] - segment[i]); //average the angles + sin = _sin(angle); + cos = _cos(angle); + x = segment[i+2]; + y = segment[i+3]; + l = controlPT.l1s + easeInOut * controlPT.l1c; //length + segment[i] = x - cos * l; + segment[i+1] = y - sin * l; + l = controlPT.l2s + easeInOut * controlPT.l2c; + segment[offset-1] = x + cos * l; + segment[offset] = y + sin * l; + controlPT = controlPT._next; + } + + target._gsRawPath = rawPath; + + if (this._apply) { + s = ""; + space = " "; + for (j = 0; j < rawPath.length; j++) { + segment = rawPath[j]; + l = segment.length; + s += "M" + (((segment[0] * rnd) | 0) / rnd) + space + (((segment[1] * rnd) | 0) / rnd) + " C"; + for (i = 2; i < l; i++) { //this is actually faster than just doing a join() on the array, possibly because the numbers have so many decimal places + s += (((segment[i] * rnd) | 0) / rnd) + space; + } + } + if (this._prop) { + target[this._prop] = s; + } else { + target.setAttribute("d", s); + } + } + } + if (this._render && rawPath) { + this._render.call(this._tween, rawPath, target); + } + } + }); + + + MorphSVGPlugin.prototype._tweenRotation = function(start, end, i, linkedPT) { + var so = this._origin, //starting origin + eo = this._eOrigin, //ending origin + dx = start[i] - so.x, + dy = start[i+1] - so.y, + d = _sqrt(dx * dx + dy * dy), //length from starting origin to starting point + sa = _atan2(dy, dx), + angleDif, short; + dx = end[i] - eo.x; + dy = end[i+1] - eo.y; + angleDif = _atan2(dy, dx) - sa; + short = _shortAngle(angleDif); + //in the case of control points, we ALWAYS link them to their anchor so that they don't get torn apart and rotate the opposite direction. If it's not a control point, we look at the most recently linked point as long as they're within a certain rotational range of each other. + if (!linkedPT && _lastLinkedAnchor && Math.abs(short + _lastLinkedAnchor.ca) < _angleMin) { + linkedPT = _lastLinkedAnchor; + } + return (this._anchorPT = _lastLinkedAnchor = { + _next:this._anchorPT, + t:start, + sa:sa, //starting angle + ca:(linkedPT && short * linkedPT.ca < 0 && Math.abs(short) > _angleMax) ? angleDif : short, //change in angle + sl:d, //starting length + cl:_sqrt(dx * dx + dy * dy) - d, //change in length + i:i + }); + }; + + MorphSVGPlugin.pathFilter = _pathFilter; + MorphSVGPlugin.pointsFilter = _pointsFilter; + MorphSVGPlugin.getTotalSize = _getTotalSize; + MorphSVGPlugin.subdivideRawBezier = MorphSVGPlugin.subdivideSegment = _subdivideSegment; + MorphSVGPlugin.rawPathToString = _rawPathToString; + MorphSVGPlugin.defaultType = "linear"; + MorphSVGPlugin.defaultUpdateTarget = true; + MorphSVGPlugin.defaultMap = "size"; + MorphSVGPlugin.stringToRawPath = MorphSVGPlugin.pathDataToRawBezier = function(data) { + return _stringToRawPath(_parseShape(data, true)); + }; + MorphSVGPlugin.equalizeSegmentQuantity = _equalizeSegmentQuantity; + + MorphSVGPlugin.convertToPath = function(targets, swap) { + if (typeof(targets) === "string") { + targets = TweenLite.selector(targets); + } + var a = (!targets || targets.length === 0) ? [] : (targets.length && targets[0] && targets[0].nodeType) ? Array.prototype.slice.call(targets, 0) : [targets], + i = a.length; + while (--i > -1) { + a[i] = _convertToPath(a[i], (swap !== false)); + } + return a; + }; + + MorphSVGPlugin.pathDataToBezier = function(data, vars) { //converts SVG path data into an array of {x, y} objects that can be plugged directly into a bezier tween. You can optionally pass in a 2D matrix like [a, b, c, d, tx, ty] containing numbers that should transform each point. + var bezier = _stringToRawPath(_parseShape(data, true))[0] || [], + prefix = 0, + a, i, l, matrix, offsetX, offsetY, bbox, e; + vars = vars || {}; + e = vars.align || vars.relative; + matrix = vars.matrix || [1,0,0,1,0,0]; + offsetX = vars.offsetX || 0; + offsetY = vars.offsetY || 0; + if (e === "relative" || e === true) { + offsetX -= bezier[0] * matrix[0] + bezier[1] * matrix[2]; + offsetY -= bezier[0] * matrix[1] + bezier[1] * matrix[3]; + prefix = "+="; + } else { + offsetX += matrix[4]; + offsetY += matrix[5]; + if (e) { + e = (typeof(e) === "string") ? TweenLite.selector(e) : (e && e[0]) ? e : [e]; //allow array-like objects like jQuery objects. + if (e && e[0]) { + bbox = e[0].getBBox() || {x:0, y:0}; + offsetX -= bbox.x; + offsetY -= bbox.y; + } + } + } + a = []; + l = bezier.length; + if (matrix && matrix.join(",") !== "1,0,0,1,0,0") { + for (i = 0; i < l; i+=2) { + a.push({x:prefix + (bezier[i] * matrix[0] + bezier[i+1] * matrix[2] + offsetX), y:prefix + (bezier[i] * matrix[1] + bezier[i+1] * matrix[3] + offsetY)}); + } + } else { + for (i = 0; i < l; i+=2) { + a.push({x:prefix + (bezier[i] + offsetX), y:prefix + (bezier[i+1] + offsetY)}); + } + } + return a; + }; + + + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("MorphSVGPlugin")); +/*! + * VERSION: 0.2.1 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * Physics2DPlugin is a Club GreenSock membership benefit; You must have a valid membership to use + * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. + * This work is subject to the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _DEG2RAD = Math.PI / 180, + Physics2DProp = function(target, p, velocity, acceleration, stepsPerTimeUnit) { + this.p = p; + this.f = (typeof(target[p]) === "function"); + this.start = this.value = (!this.f) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ](); + this.velocity = velocity || 0; + this.v = this.velocity / stepsPerTimeUnit; + if (acceleration || acceleration === 0) { + this.acceleration = acceleration; + this.a = this.acceleration / (stepsPerTimeUnit * stepsPerTimeUnit); + } else { + this.acceleration = this.a = 0; + } + }, + _random = Math.random(), + _globals = _gsScope._gsDefine.globals, + _rootFramesTimeline = _globals.com.greensock.core.Animation._rootFramesTimeline, + + Physics2DPlugin = _gsScope._gsDefine.plugin({ + propName: "physics2D", + version: "0.2.1", + API: 2, + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween, index) { + if (typeof(value) === "function") { + value = value(index, target); + } + this._target = target; + this._tween = tween; + this._runBackwards = (tween.vars.runBackwards === true); + this._step = 0; + var tl = tween._timeline, + angle = Number(value.angle) || 0, + velocity = Number(value.velocity) || 0, + acceleration = Number(value.acceleration) || 0, + xProp = value.xProp || "x", + yProp = value.yProp || "y", + aAngle = (value.accelerationAngle || value.accelerationAngle === 0) ? Number(value.accelerationAngle) : angle, + stepsPerTimeUnit; + while (tl._timeline) { + tl = tl._timeline; + } + this._stepsPerTimeUnit = stepsPerTimeUnit = (tl === _rootFramesTimeline) ? 1 : 30; + if (value.gravity) { + acceleration = Number(value.gravity); + aAngle = 90; + } + angle *= _DEG2RAD; + aAngle *= _DEG2RAD; + this._friction = 1 - Number(value.friction || 0); + this._overwriteProps.push(xProp); + this._overwriteProps.push(yProp); + + this._x = new Physics2DProp(target, xProp, Math.cos(angle) * velocity, Math.cos(aAngle) * acceleration, stepsPerTimeUnit); + this._y = new Physics2DProp(target, yProp, Math.sin(angle) * velocity, Math.sin(aAngle) * acceleration, stepsPerTimeUnit); + this._skipX = this._skipY = false; + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(ratio) { + var time = this._tween._time, + xp = this._x, + yp = this._y, + x, y, tt, steps, remainder, i; + if (this._runBackwards === true) { + time = this._tween._duration - time; + } + if (this._friction === 1) { + tt = time * time * 0.5; + x = xp.start + ((xp.velocity * time) + (xp.acceleration * tt)); + y = yp.start + ((yp.velocity * time) + (yp.acceleration * tt)); + } else { + time *= this._stepsPerTimeUnit; + steps = i = (time | 0) - this._step; + remainder = (time % 1); + if (i >= 0) { //going forward + while (--i > -1) { + xp.v += xp.a; + yp.v += yp.a; + xp.v *= this._friction; + yp.v *= this._friction; + xp.value += xp.v; + yp.value += yp.v; + } + + } else { //going backwards + i = -i; + while (--i > -1) { + xp.value -= xp.v; + yp.value -= yp.v; + xp.v /= this._friction; + yp.v /= this._friction; + xp.v -= xp.a; + yp.v -= yp.a; + } + } + x = xp.value + (xp.v * remainder); + y = yp.value + (yp.v * remainder); + this._step += steps; + } + if (!this._skipX) { + if (xp.m) { + x = xp.m(x, this._target); + } + if (xp.f) { + this._target[xp.p](x); + } else { + this._target[xp.p] = x; + } + } + if (!this._skipY) { + if (yp.m) { + y = yp.m(y, this._target); + } + if (yp.f) { + this._target[yp.p](y); + } else { + this._target[yp.p] = y; + } + } + } + + }), + p = Physics2DPlugin.prototype; + + p._kill = function(lookup) { + if (lookup[this._x.p] != null) { + this._skipX = true; + } + if (lookup[this._y.p] != null) { + this._skipY = true; + } + return this._super._kill.call(this, lookup); + }; + + p._mod = function(lookup) { + var val = lookup[this._x.p] || lookup.physics2D; + if (val && typeof(val) === "function") { + this._x.m = val; + } + val = lookup[this._y.p] || lookup.physics2D; + if (val && typeof(val) === "function") { + this._y.m = val; + } + }; + + Physics2DPlugin._autoCSS = true; //indicates that this plugin can be inserted into the "css" object using the autoCSS feature of TweenLite + Physics2DPlugin._cssRegister = function() { + var CSSPlugin = _globals.CSSPlugin; + if (!CSSPlugin) { + return; + } + var _internals = CSSPlugin._internals, + _parseToProxy = _internals._parseToProxy, + _setPluginRatio = _internals._setPluginRatio, + CSSPropTween = _internals.CSSPropTween; + _internals._registerComplexSpecialProp("physics2D", {parser:function(t, e, prop, cssp, pt, plugin) { + plugin = new Physics2DPlugin(); + var xProp = e.xProp || "x", + yProp = e.yProp || "y", + vars = {}, + data; + vars[xProp] = vars[yProp] = _random++; //doesn't really matter what values we put here because the plugin will determine end values, but it'd be best of the values don't match the current ones so that CSSPlugin doesn't skip creating a CSSPropTween. + data = _parseToProxy(t, vars, cssp, pt, plugin); + pt = new CSSPropTween(t, "physics2D", 0, 0, data.pt, 2); + pt.data = data; + pt.plugin = plugin; + pt.setRatio = _setPluginRatio; + plugin._onInitTween(data.proxy, e, cssp._tween); + return pt; + }}); + }; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("Physics2DPlugin")); +/*! + * VERSION: 0.2.1 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * PhysicsPropsPlugin is a Club GreenSock membership benefit; You must have a valid membership to use + * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. + * This work is subject to the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var PhysicsProp = function(target, p, velocity, acceleration, friction, stepsPerTimeUnit) { + this.p = p; + this.f = (typeof(target[p]) === "function"); + this.start = this.value = (!this.f) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ](); + this.velocity = velocity || 0; + this.v = this.velocity / stepsPerTimeUnit; + if (acceleration || acceleration == 0) { + this.acceleration = acceleration; + this.a = this.acceleration / (stepsPerTimeUnit * stepsPerTimeUnit); + } else { + this.acceleration = this.a = 0; + } + this.friction = 1 - (friction || 0) ; + }, + _random = Math.random(), + _globals = _gsScope._gsDefine.globals, + _rootFramesTimeline = _globals.com.greensock.core.Animation._rootFramesTimeline, + + PhysicsPropsPlugin = _gsScope._gsDefine.plugin({ + propName: "physicsProps", + version: "0.2.1", + API: 2, + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween, index) { + if (typeof(value) === "function") { + value = value(target); + } + this._target = target; + this._tween = tween; + this._runBackwards = (tween.vars.runBackwards === true); + this._step = 0; + var tl = tween._timeline, + cnt = 0, + p, curProp; + while (tl._timeline) { + tl = tl._timeline; + } + this._stepsPerTimeUnit = (tl === _rootFramesTimeline) ? 1 : 30; + this._props = []; + for (p in value) { + curProp = value[p]; + if (typeof(curProp) === "function") { + curProp = curProp(index, target); + } + if (curProp.velocity || curProp.acceleration) { + this._props[cnt++] = new PhysicsProp(target, p, curProp.velocity, curProp.acceleration, curProp.friction, this._stepsPerTimeUnit); + this._overwriteProps[cnt] = p; + if (curProp.friction) { + this._hasFriction = true; + } + } + } + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(ratio) { + var i = this._props.length, + time = this._tween._time, + target = this._target, + curProp, val, steps, remainder, j, tt; + if (this._runBackwards) { + time = this._tween._duration - time; + } + if (this._hasFriction) { + time *= this._stepsPerTimeUnit; + steps = (time | 0) - this._step; + remainder = time % 1; + if (steps >= 0) { //going forward + while (--i > -1) { + curProp = this._props[i]; + j = steps; + while (--j > -1) { + curProp.v += curProp.a; + curProp.v *= curProp.friction; + curProp.value += curProp.v; + } + val = curProp.value + (curProp.v * remainder); + if (curProp.m) { + val = curProp.m(val, target); + } + if (curProp.f) { + target[curProp.p](val); + } else { + target[curProp.p] = val; + } + } + + } else { //going backwards + while (--i > -1) { + curProp = this._props[i]; + j = -steps; + while (--j > -1) { + curProp.value -= curProp.v; + curProp.v /= curProp.friction; + curProp.v -= curProp.a; + } + val = curProp.value + (curProp.v * remainder); + if (curProp.m) { + val = curProp.m(val, target); + } + if (curProp.f) { + target[curProp.p](val); + } else { + target[curProp.p] = val; + } + } + } + this._step += steps; + + } else { + tt = time * time * 0.5; + while (--i > -1) { + curProp = this._props[i]; + val = curProp.start + ((curProp.velocity * time) + (curProp.acceleration * tt)); + if (curProp.m) { + val = curProp.m(val, target); + } + if (curProp.f) { + target[curProp.p](val); + } else { + target[curProp.p] = val; + } + } + } + } + + }), + p = PhysicsPropsPlugin.prototype; + + p._kill = function(lookup) { + var i = this._props.length; + while (--i > -1) { + if (this._props[i].p in lookup) { + this._props.splice(i, 1); + } + } + return this._super._kill.call(this, lookup); + }; + + p._mod = function(lookup) { + var i = this._props.length, + val; + while (--i > -1) { + val = lookup[this._props[i].p] || lookup.physicsProps; + if (typeof(val) === "function") { + this._props[i].m = val; + } + } + }; + + PhysicsPropsPlugin._autoCSS = true; //indicates that this plugin can be inserted into the "css" object using the autoCSS feature of TweenLite + PhysicsPropsPlugin._cssRegister = function() { + var CSSPlugin = _globals.CSSPlugin; + if (!CSSPlugin) { + return; + } + var _internals = CSSPlugin._internals, + _parseToProxy = _internals._parseToProxy, + _setPluginRatio = _internals._setPluginRatio, + CSSPropTween = _internals.CSSPropTween; + _internals._registerComplexSpecialProp("physicsProps", {parser:function(t, e, prop, cssp, pt, plugin) { + plugin = new PhysicsPropsPlugin(); + var vars = {}, + p, data; + if (e.scale) { + e.scaleX = e.scaleY = e.scale; + delete e.scale; + } + for (p in e) { + vars[p] = _random++; //doesn't really matter what values we put here because the plugin will determine end values, but it'd be best of the values don't match the current ones so that CSSPlugin doesn't skip creating a CSSPropTween. + } + data = _parseToProxy(t, vars, cssp, pt, plugin); + pt = new CSSPropTween(t, "physicsProps", 0, 0, data.pt, 2); + pt.data = data; + pt.plugin = plugin; + pt.setRatio = _setPluginRatio; + plugin._onInitTween(data.proxy, e, cssp._tween); + return pt; + }}); + }; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("PhysicsPropsPlugin")); +/*! + * VERSION: 0.2.1 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * PixiPlugin is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof module !== "undefined" && module.exports && typeof global !== "undefined") ? global : this || window; +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push(function () { + "use strict"; + + var _numExp = /(\d|\.)+/g, + _relNumExp = /(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g, + _colorLookup = {aqua:[0,255,255], + lime:[0,255,0], + silver:[192,192,192], + black:[0,0,0], + maroon:[128,0,0], + teal:[0,128,128], + blue:[0,0,255], + navy:[0,0,128], + white:[255,255,255], + fuchsia:[255,0,255], + olive:[128,128,0], + yellow:[255,255,0], + orange:[255,165,0], + gray:[128,128,128], + purple:[128,0,128], + green:[0,128,0], + red:[255,0,0], + pink:[255,192,203], + cyan:[0,255,255], + transparent:[255,255,255,0]}, + _hue = function(h, m1, m2) { + h = (h < 0) ? h + 1 : (h > 1) ? h - 1 : h; + return ((((h * 6 < 1) ? m1 + (m2 - m1) * h * 6 : (h < 0.5) ? m2 : (h * 3 < 2) ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * 255) + 0.5) | 0; + }, + /** + * @private Parses a color (like #9F0, #FF9900, rgb(255,51,153) or hsl(108, 50%, 10%)) into an array with 3 elements for red, green, and blue or if "format" parameter is "hsl", it will populate the array with hue, saturation, and lightness values. Or if "format" is "number", it'll return a number like 0xFF0000 instead of an array. If a relative value is found in an hsl() or hsla() string, it will preserve those relative prefixes and all the values in the array will be strings instead of numbers (in all other cases it will be populated with numbers). + * @param {(string|number)} v The value the should be parsed which could be a string like #9F0 or rgb(255,102,51) or rgba(255,0,0,0.5) or it could be a number like 0xFF00CC or even a named color like red, blue, purple, etc. + * @param {(string)} format If "hsl", an hsl() or hsla() value will be returned instead of rgb() or rgba(). Or if "number", then a numeric value will be returned, like 0xFF0000. Default is rgb. + * @return {(array|number)} An array containing red, green, and blue (and optionally alpha) in that order, or if the format parameter was "hsl", the array will contain hue, saturation and lightness (and optionally alpha) in that order. Or if "format" is defined as "number", it'll return a number like 0xFF0000. Always numbers unless there's a relative prefix found in an hsl() or hsla() string and "format" is "hsl". + */ + _parseColor = function(v, format) { + var toHSL = (format === "hsl"), + a, r, g, b, h, s, l, max, min, d, wasHSL; + if (!v) { + a = _colorLookup.black; + } else if (typeof(v) === "number") { + a = [v >> 16, (v >> 8) & 255, v & 255]; + } else { + if (v.charAt(v.length - 1) === ",") { //sometimes a trailing comma is included and we should chop it off (typically from a comma-delimited list of values like a textShadow:"2px 2px 2px blue, 5px 5px 5px rgb(255,0,0)" - in this example "blue," has a trailing comma. We could strip it out inside parseComplex() but we'd need to do it to the beginning and ending values plus it wouldn't provide protection from other potential scenarios like if the user passes in a similar value. + v = v.substr(0, v.length - 1); + } + if (_colorLookup[v]) { + a = _colorLookup[v]; + } else if (v.charAt(0) === "#") { + if (v.length === 4) { //for shorthand like #9F0 + r = v.charAt(1); + g = v.charAt(2); + b = v.charAt(3); + v = "#" + r + r + g + g + b + b; + } + v = parseInt(v.substr(1), 16); + a = [v >> 16, (v >> 8) & 255, v & 255]; + } else if (v.substr(0, 3) === "hsl") { + a = wasHSL = v.match(_numExp); + if (!toHSL) { + h = (Number(a[0]) % 360) / 360; + s = Number(a[1]) / 100; + l = Number(a[2]) / 100; + g = (l <= 0.5) ? l * (s + 1) : l + s - l * s; + r = l * 2 - g; + if (a.length > 3) { + a[3] = Number(v[3]); + } + a[0] = _hue(h + 1 / 3, r, g); + a[1] = _hue(h, r, g); + a[2] = _hue(h - 1 / 3, r, g); + } else if (v.indexOf("=") !== -1) { //if relative values are found, just return the raw strings with the relative prefixes in place. + return v.match(_relNumExp); + } + } else { + a = v.match(_numExp) || _colorLookup.transparent; + } + a[0] = Number(a[0]); + a[1] = Number(a[1]); + a[2] = Number(a[2]); + if (a.length > 3) { + a[3] = Number(a[3]); + } + } + if (toHSL && !wasHSL) { + r = a[0] / 255; + g = a[1] / 255; + b = a[2] / 255; + max = Math.max(r, g, b); + min = Math.min(r, g, b); + l = (max + min) / 2; + if (max === min) { + h = s = 0; + } else { + d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + h = (max === r) ? (g - b) / d + (g < b ? 6 : 0) : (max === g) ? (b - r) / d + 2 : (r - g) / d + 4; + h *= 60; + } + a[0] = (h + 0.5) | 0; + a[1] = (s * 100 + 0.5) | 0; + a[2] = (l * 100 + 0.5) | 0; + } + return (format === "number") ? (a[0] << 16 | a[1] << 8 | a[2]) : a; + }, + _formatColors = function(s, toHSL) { + var colors = (s + "").match(_colorExp) || [], + charIndex = 0, + parsed = "", + i, color, temp; + if (!colors.length) { + return s; + } + for (i = 0; i < colors.length; i++) { + color = colors[i]; + temp = s.substr(charIndex, s.indexOf(color, charIndex)-charIndex); + charIndex += temp.length + color.length; + color = _parseColor(color, (toHSL ? "hsl" : "rgb")); + if (color.length === 3) { + color.push(1); + } + parsed += temp + (toHSL ? "hsla(" + color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : "rgba(" + color.join(",")) + ")"; + } + return parsed + s.substr(charIndex); + }, _colorStringFilter, + TweenLite = (_gsScope.GreenSockGlobals || _gsScope).TweenLite, + _colorExp = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3}){1,2}\\b", //we'll dynamically build this Regular Expression to conserve file size. After building it, it will be able to find rgb(), rgba(), # (hexadecimal), and named color values like red, blue, purple, etc. + + _idMatrix = [1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0], + _lumR = 0.212671, + _lumG = 0.715160, + _lumB = 0.072169, + + _applyMatrix = function(m, m2) { + var temp = [], + i = 0, + z = 0, + y, x; + for (y = 0; y < 4; y++) { + for (x = 0; x < 5; x++) { + z = (x === 4) ? m[i + 4] : 0; + temp[i + x] = m[i] * m2[x] + m[i+1] * m2[x + 5] + m[i+2] * m2[x + 10] + m[i+3] * m2[x + 15] + z; + } + i += 5; + } + return temp; + }, + + _setSaturation = function(m, n) { + var inv = 1 - n, + r = inv * _lumR, + g = inv * _lumG, + b = inv * _lumB; + return _applyMatrix([r + n, g, b, 0, 0, r, g + n, b, 0, 0, r, g, b + n, 0, 0, 0, 0, 0, 1, 0], m); + }, + + _colorize = function(m, color, amount) { + var c = _parseColor(color), + r = c[0] / 255, + g = c[1] / 255, + b = c[2] / 255, + inv = 1 - amount; + return _applyMatrix([inv + amount * r * _lumR, amount * r * _lumG, amount * r * _lumB, 0, 0, amount * g * _lumR, inv + amount * g * _lumG, amount * g * _lumB, 0, 0, amount * b * _lumR, amount * b * _lumG, inv + amount * b * _lumB, 0, 0, 0, 0, 0, 1, 0], m); + }, + + _setHue = function(m, n) { + n *= Math.PI / 180; + var c = Math.cos(n), + s = Math.sin(n); + return _applyMatrix([(_lumR + (c * (1 - _lumR))) + (s * (-_lumR)), (_lumG + (c * (-_lumG))) + (s * (-_lumG)), (_lumB + (c * (-_lumB))) + (s * (1 - _lumB)), 0, 0, (_lumR + (c * (-_lumR))) + (s * 0.143), (_lumG + (c * (1 - _lumG))) + (s * 0.14), (_lumB + (c * (-_lumB))) + (s * -0.283), 0, 0, (_lumR + (c * (-_lumR))) + (s * (-(1 - _lumR))), (_lumG + (c * (-_lumG))) + (s * _lumG), (_lumB + (c * (1 - _lumB))) + (s * _lumB), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], m); + }, + + _setContrast = function(m, n) { + return _applyMatrix([n,0,0,0,0.5 * (1 - n), 0,n,0,0,0.5 * (1 - n), 0,0,n,0,0.5 * (1 - n), 0,0,0,1,0], m); + }, + + _getFilter = function(t, type) { + var filterClass = _gsScope.PIXI.filters[type], + filters = t.filters || [], + i = filters.length, + filter; + if (!filterClass) { + throw("PixiPlugin error: " + type + " isn't present."); + } + while (--i > -1) { + if (filters[i] instanceof filterClass) { + return filters[i]; + } + } + filter = new filterClass(); + if (type === "BlurFilter") { + filter.blur = 0; + } + filters.push(filter); + t.filters = filters; + return filter; + }, + + _addColorMatrixFilterCacheTween = function(p, pg, cache, vars) { //we cache the ColorMatrixFilter components in a _gsColorMatrixFilter object attached to the target object so that it's easy to grab the current value at any time. + pg._addTween(cache, p, cache[p], vars[p], p); + pg._overwriteProps.push(p); + }, + + _applyBrightnessToMatrix = function(brightness, matrix) { + var temp = new _gsScope.PIXI.filters.ColorMatrixFilter(); + temp.matrix = matrix; + temp.brightness(brightness, true); + return temp.matrix; + }, + + _CMFdefaults = {contrast:1, saturation:1, colorizeAmount:0, colorize:"rgb(255,255,255)", hue:0, brightness:1}, + + _parseColorMatrixFilter = function(t, v, pg) { + var filter = _getFilter(t, "ColorMatrixFilter"), + cache = t._gsColorMatrixFilter = t._gsColorMatrixFilter || {contrast:1, saturation:1, colorizeAmount:0, colorize:"rgb(255,255,255)", hue:0, brightness:1}, + combine = v.combineCMF && !("colorMatrixFilter" in v && !v.colorMatrixFilter), + i, matrix, startMatrix; + startMatrix = filter.matrix; + if (v.resolution) { + filter.resolution = v.resolution; + } + if (v.matrix && v.matrix.length === startMatrix.length) { + matrix = v.matrix; + if (cache.contrast !== 1) { + _addColorMatrixFilterCacheTween("contrast", pg, cache, _CMFdefaults); + } + if (cache.hue) { + _addColorMatrixFilterCacheTween("hue", pg, cache, _CMFdefaults); + } + if (cache.brightness !== 1) { + _addColorMatrixFilterCacheTween("brightness", pg, cache, _CMFdefaults); + } + if (cache.colorizeAmount) { + _addColorMatrixFilterCacheTween("colorize", pg, cache, _CMFdefaults); + _addColorMatrixFilterCacheTween("colorizeAmount", pg, cache, _CMFdefaults); + } + if (cache.saturation !== 1) { + _addColorMatrixFilterCacheTween("saturation", pg, cache, _CMFdefaults); + } + + } else { + matrix = _idMatrix.slice(); + if (v.contrast != null) { + matrix = _setContrast(matrix, Number(v.contrast)); + _addColorMatrixFilterCacheTween("contrast", pg, cache, v); + } else if (cache.contrast !== 1) { + if (combine) { + matrix = _setContrast(matrix, cache.contrast); + } else { + _addColorMatrixFilterCacheTween("contrast", pg, cache, _CMFdefaults); + } + } + if (v.hue != null) { + matrix = _setHue(matrix, Number(v.hue)); + _addColorMatrixFilterCacheTween("hue", pg, cache, v); + } else if (cache.hue) { + if (combine) { + matrix = _setHue(matrix, cache.hue); + } else { + _addColorMatrixFilterCacheTween("hue", pg, cache, _CMFdefaults); + } + } + if (v.brightness != null) { + matrix = _applyBrightnessToMatrix(Number(v.brightness), matrix); + _addColorMatrixFilterCacheTween("brightness", pg, cache, v); + } else if (cache.brightness !== 1) { + if (combine) { + matrix = _applyBrightnessToMatrix(cache.brightness, matrix); + } else { + _addColorMatrixFilterCacheTween("brightness", pg, cache, _CMFdefaults); + } + } + if (v.colorize != null) { + v.colorizeAmount = ("colorizeAmount" in v) ? Number(v.colorizeAmount) : 1; + matrix = _colorize(matrix, v.colorize, v.colorizeAmount); + _addColorMatrixFilterCacheTween("colorize", pg, cache, v); + _addColorMatrixFilterCacheTween("colorizeAmount", pg, cache, v); + } else if (cache.colorizeAmount) { + if (combine) { + matrix = _colorize(matrix, cache.colorize, cache.colorizeAmount); + } else { + _addColorMatrixFilterCacheTween("colorize", pg, cache, _CMFdefaults); + _addColorMatrixFilterCacheTween("colorizeAmount", pg, cache, _CMFdefaults); + } + } + if (v.saturation != null) { + matrix = _setSaturation(matrix, Number(v.saturation)); + _addColorMatrixFilterCacheTween("saturation", pg, cache, v); + } else if (cache.saturation !== 1) { + if (combine) { + matrix = _setSaturation(matrix, cache.saturation); + } else { + _addColorMatrixFilterCacheTween("saturation", pg, cache, _CMFdefaults); + } + } + } + i = matrix.length; + while (--i > -1) { + if (matrix[i] !== startMatrix[i]) { + pg._addTween(startMatrix, i, startMatrix[i], matrix[i], "colorMatrixFilter"); + } + } + pg._overwriteProps.push("colorMatrixFilter"); + }, + + _addColorTween = function(target, p, value, colorSetter, plugin) { + var pt = colorSetter._firstPT = {_next:colorSetter._firstPT, t:target, p:p, proxy:{}, f:(typeof(target[p]) === "function")}; + pt.proxy[p] = "rgb(" + _parseColor(!pt.f ? target[p] : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]()).join(",") + ")"; + plugin._addTween(pt.proxy, p, "get", ((typeof(value) === "number") ? "rgb(" + _parseColor(value, false).join(",") + ")" : value), p, null, null, _colorStringFilter); + }, + + //to improve performance, when a color is sensed, we hijack the setRatio() method of the plugin instance with a new function that this method spits back. This is a special method that handles parsing color values on-the-fly and turns them into numeric values which PixiJS requires. In other words, instead of "rgb(255, 0, 0)", PixiJS wants 0xFF0000. This also works with hsl() values. + _buildColorSetter = function(tween, plugin) { + var setRatio = plugin.setRatio, //save the original (super) setRatio() function + func = function(v) { + var pt = func._firstPT, + val; + setRatio.call(plugin, v); + while (pt) { + val = _parseColor(pt.proxy[pt.p], "number"); + if (pt.f) { + pt.t[pt.p](val); + } else { + pt.t[pt.p] = val; + } + pt = pt._next; + } + if (func.graphics) { //in order for PixiJS to actually redraw GraphicsData, we've gotta increment the "dirty" and "clearDirty" values. If we don't do this, the values will be tween properly, but not rendered. + func.graphics.dirty++; + func.graphics.clearDirty++; + } + }; + plugin.setRatio = func; + return func; + }, + + + _colorProps = {tint:1, lineColor:1, fillColor:1}, + _xyContexts = "position,scale,skew,pivot,anchor,tilePosition,tileScale".split(","), + _contexts = {x:"position", y:"position", tileX:"tilePosition", tileY:"tilePosition"}, + _colorMatrixFilterProps = {colorMatrixFilter:1, saturation:1, contrast:1, hue:1, colorize:1, colorizeAmount:1, brightness:1, combineCMF:1}, + _DEG2RAD = Math.PI / 180, + _degreesToRadians = function(value) { + return (typeof(value) === "string" && value.charAt(1) === "=") ? value.substr(0, 2) + (parseFloat(value.substr(2)) * _DEG2RAD) : value * _DEG2RAD; + }, i, p; + + //context setup... + for (i = 0; i < _xyContexts.length; i++) { + p = _xyContexts[i]; + _contexts[p + "X"] = p; + _contexts[p + "Y"] = p; + } + + //color parsing setup... + for (p in _colorLookup) { + _colorExp += "|" + p + "\\b"; + } + _colorExp = new RegExp(_colorExp+")", "gi"); + _colorStringFilter = function(a) { + var combined = a[0] + " " + a[1], + toHSL; + _colorExp.lastIndex = 0; + if (_colorExp.test(combined)) { + toHSL = (combined.indexOf("hsl(") !== -1 || combined.indexOf("hsla(") !== -1); + a[0] = _formatColors(a[0], toHSL); + a[1] = _formatColors(a[1], toHSL); + } + }; + + if (!TweenLite.defaultStringFilter) { + TweenLite.defaultStringFilter = _colorStringFilter; + } + + var PixiPlugin = _gsScope._gsDefine.plugin({ + propName: "pixi", + priority: 0, + API: 2, + global: true, + version: "0.2.1", + + init: function (target, values, tween, index) { + if (!target instanceof _gsScope.PIXI.DisplayObject) { + return false; + } + var context, axis, value, colorMatrix, filter, p, padding, colorSetter, i, data, pt; + for (p in values) { + context = _contexts[p]; + value = values[p]; + if (typeof(value) === "function") { + value = value(index || 0, target); + } + if (context) { + axis = (p.charAt(p.length-1).toLowerCase().indexOf("x") !== -1) ? "x" : "y"; + this._addTween(target[context], axis, target[context][axis], (context === "skew") ? _degreesToRadians(value) : value, p); + } else if (p === "scale" || p === "anchor" || p === "pivot" || p === "tileScale") { + this._addTween(target[p], "x", target[p].x, value, p + "X"); + this._addTween(target[p], "y", target[p].y, value, p + "Y"); + } else if (p === "rotation") { //PIXI expects rotation in radians, but as a convenience we let folks define it in degrees and we do the conversion. + this._addTween(target, p, target.rotation, _degreesToRadians(value), p); + + } else if (_colorMatrixFilterProps[p]) { + if (!colorMatrix) { + _parseColorMatrixFilter(target, values.colorMatrixFilter || values, this); + colorMatrix = true; + } + } else if (p === "blur" || p === "blurX" || p === "blurY" || p === "blurPadding") { + filter = _getFilter(target, "BlurFilter"); + this._addTween(filter, p, filter[p], value, p); + if (values.blurPadding !== 0) { + padding = values.blurPadding || Math.max(filter[p], value) * 2; + i = target.filters.length; + while (--i > -1) { + target.filters[i].padding = Math.max(target.filters[i].padding, padding); //if we don't expand the padding on all the filters, it can look clipped. + } + } + } else if (_colorProps[p]) { + if (!colorSetter) { + colorSetter = _buildColorSetter(tween, this); + } + if ((p === "lineColor" || p === "fillColor") && target instanceof _gsScope.PIXI.Graphics) { + data = target.graphicsData; + i = data.length; + while (--i > -1) { + _addColorTween(data[i], p, value, colorSetter, this); + } + colorSetter.graphics = target; + } else { + _addColorTween(target, p, value, colorSetter, this); + } + } else if (p === "autoAlpha") { + this._firstPT = pt = {t: {setRatio:function() { target.visible = !!target.alpha; }}, p: "setRatio", s: 0, c: 1, f: 1, pg: 0, n: "visible", pr: 0, m: 0, _next:this._firstPT}; + if (pt._next) { + pt._next._prev = pt; + } + this._addTween(target, "alpha", target.alpha, value, "alpha"); + this._overwriteProps.push("alpha", "visible"); + } else { + this._addTween(target, p, target[p], value, p); + } + this._overwriteProps.push(p); + } + return true; + } + }); + + PixiPlugin.colorProps = _colorProps; + PixiPlugin.parseColor = _parseColor; + PixiPlugin.formatColors = _formatColors; + PixiPlugin.colorStringFilter = _colorStringFilter; + + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("PixiPlugin")); +/*! + * VERSION: 0.2.2 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _NaNExp = /[^\d\-\.]/g, + _DEG2RAD = Math.PI / 180, + _numExp = /(\d|\.)+/g, + _colorLookup = {aqua:[0,255,255], + lime:[0,255,0], + silver:[192,192,192], + black:[0,0,0], + maroon:[128,0,0], + teal:[0,128,128], + blue:[0,0,255], + navy:[0,0,128], + white:[255,255,255], + fuchsia:[255,0,255], + olive:[128,128,0], + yellow:[255,255,0], + orange:[255,165,0], + gray:[128,128,128], + purple:[128,0,128], + green:[0,128,0], + red:[255,0,0], + pink:[255,192,203], + cyan:[0,255,255], + transparent:[255,255,255,0]}, + //parses a color (like #9F0, #FF9900, or rgb(255,51,153)) into an array with 3 elements for red, green, and blue. Also handles rgba() values (splits into array of 4 elements of course) + _parseColor = function(color) { + if (typeof(color) === "number") { + return [color >> 16, (color >> 8) & 255, color & 255]; + } else if (color === "" || color == null || color === "none" || typeof(color) !== "string") { + return _colorLookup.transparent; + } else if (_colorLookup[color]) { + return _colorLookup[color]; + } else if (color.charAt(0) === "#") { + if (color.length === 4) { //for shorthand like #9F0 + color = "#" + color.charAt(1) + color.charAt(1) + color.charAt(2) + color.charAt(2) + color.charAt(3) + color.charAt(3); + } + color = parseInt(color.substr(1), 16); + return [color >> 16, (color >> 8) & 255, color & 255]; + } + return color.match(_numExp) || _colorLookup.transparent; + }, + + _transformMap = {scaleX:1, scaleY:1, tx:1, ty:1, rotation:1, shortRotation:1, skewX:1, skewY:1, scale:1}, + + //parses the transform values for an element, returning an object with x, y, scaleX, scaleY, rotation, skewX, and skewY properties. Note: by default (for performance reasons), all skewing is combined into skewX and rotation but skewY still has a place in the transform object so that we can record how much of the skew is attributed to skewX vs skewY. Remember, a skewY of 10 looks the same as a rotation of 10 and skewX of -10. + _getTransform = function(t, rec) { + var s = t.matrix, + min = 0.000001, + a = s.a, + b = s.b, + c = s.c, + d = s.d, + m = rec ? t._gsTransform || {skewY:0} : {skewY:0}, + invX = (m.scaleX < 0); //in order to interpret things properly, we need to know if the user applied a negative scaleX previously so that we can adjust the rotation and skewX accordingly. Otherwise, if we always interpret a flipped matrix as affecting scaleY and the user only wants to tween the scaleX on multiple sequential tweens, it would keep the negative scaleY without that being the user's intent. + + m.tx = s.e - (m.ox || 0); //ox is the offset x that we record in setRatio() whenever we apply a custom transform that might use a pivot point. Remember, s.e and s.f get affected by things like scale. For example, imagine an object whose top left corner is at 100,100 and then we scale it up to 300% using the center as the pivot point - that corner would now be very different even though to the user, they didn't intend to change/tween the x/y position per se. Therefore, we record whatever offsets we make so that we can compensate when reading the values back. + m.ty = s.f - (m.oy || 0); //oy is the offset y (see note above) + m.scaleX = Math.sqrt(a * a + b * b); + m.scaleY = Math.sqrt(d * d + c * c); + m.rotation = (a || b) ? Math.atan2(b, a) : m.rotation || 0; //note: if scaleX is 0, we cannot accurately measure rotation. Same for skewX with a scaleY of 0. Therefore, we default to the previously recorded value (or zero if that doesn't exist). + m.skewX = (c || d) ? Math.atan2(c, d) + m.rotation : m.skewX || 0; + if (Math.abs(m.skewX) > Math.PI / 2) { + if (invX) { + m.scaleX *= -1; + m.skewX += (m.rotation <= 0) ? Math.PI : -Math.PI; + m.rotation += (m.rotation <= 0) ? Math.PI : -Math.PI; + } else { + m.scaleY *= -1; + m.skewX += (m.skewX <= 0) ? Math.PI : -Math.PI; + } + } + //some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 0 in these cases. The conditional logic here is faster than calling Math.abs(). + if (m.rotation < min) if (m.rotation > -min) if (a || b) { + m.rotation = 0; + } + if (m.skewX < min) if (m.skewX > -min) if (b || c) { + m.skewX = 0; + } + if (rec) { + t._gsTransform = m; //record to the object's _gsTransform which we use so that tweens can control individual properties independently (we need all the properties to accurately recompose the matrix in the setRatio() method) + } + return m; + }, + + //takes a value and a default number, checks if the value is relative, null, or numeric and spits back a normalized number accordingly. Primarily used in the _parseTransform() function. + _parseVal = function(v, d) { + return (v == null) ? d : (typeof(v) === "string" && v.indexOf("=") === 1) ? parseInt(v.charAt(0)+"1", 10) * Number(v.substr(2)) + d : Number(v); + }, + + //translates strings like "40deg" or "40" or 40rad" or "+=40deg" to a numeric radian angle, optionally relative to a default value (if "+=" or "-=" prefix is found) + _parseAngle = function(v, d) { + var m = (v.indexOf("rad") === -1) ? _DEG2RAD : 1, + r = (v.indexOf("=") === 1); + v = Number(v.replace(_NaNExp, "")) * m; + return r ? v + d : v; + }, + + + RaphaelPlugin = _gsScope._gsDefine.plugin({ + propName: "raphael", + version: "0.2.2", + API: 2, + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween) { + if (!target.attr) { //raphael must have attr() method + return false; + } + this._target = target; + this._tween = tween; + this._props = target._gsProps = target._gsProps || {}; + var p, s, v, pt, clr1, clr2, rel; + + for (p in value) { + + v = value[p]; + + if (p === "transform") { + this._parseTransform(target, v); + continue; + } else if (_transformMap[p] || p === "pivot") { + this._parseTransform(target, value); + continue; + } + + s = target.attr(p); + + //Some of these properties are in place in order to conform with the standard PropTweens in TweenPlugins so that overwriting and roundProps occur properly. For example, f and r may seem unnecessary here, but they enable other functionality. + //_next:* next linked list node [object] + //t: * target [object] + //p: * property (camelCase) [string] + //s: * starting value [number] + //c: * change value [number] + //f: * is function [boolean] + //n: * name (for overwriting) [string] + //b: beginning value [string] + //i: intermediate value [string] + //e: ending value [string] + //r: * round [boolean] + //type: 0=normal, 1=color, 2=rgba, -1=non-tweening prop [number] + this._firstPT = pt = {_next:this._firstPT, + t:this._props, + p:p, + b:s, + f:false, + n:"raphael_" + p, + r:false, + type:0}; + + //color values must be split apart into their R, G, B (and sometimes alpha) values and tweened independently. + if (p === "fill" || p === "stroke") { + clr1 = _parseColor(s); + clr2 = _parseColor(v); + pt.e = v; + pt.s = Number(clr1[0]); //red starting value + pt.c = Number(clr2[0]) - pt.s; //red change + pt.gs = Number(clr1[1]); //green starting value + pt.gc = Number(clr2[1]) - pt.gs; //green change + pt.bs = Number(clr1[2]); //blue starting value + pt.bc = Number(clr2[2]) - pt.bs; //blue change + if (clr1.length > 3 || clr2.length > 3) { //detect an rgba() value + pt.as = (clr1.length < 4) ? 1 : Number(clr1[3]); + pt.ac = ((clr2.length < 4) ? 1 : Number(clr2[3])) - pt.as; + pt.type = 2; //2 = rgba() tween + } else { + pt.type = 1; //1 = color tween, -1 = no tween, just set the value at the end because there's no changes + } + + } else { + + s = (typeof(s) === "string") ? parseFloat(s.replace(_NaNExp, "")) : Number(s); + + if (typeof(v) === "string") { + rel = (v.charAt(1) === "="); + v = parseFloat(v.replace(_NaNExp, "")); + } else { + rel = false; + } + + pt.e = (v || v === 0) ? (rel ? v + s : v) : value[p]; //ensures that any += or -= prefixes are taken care of. + + if ((s || s === 0) && (v || v === 0) && (pt.c = (rel ? v : v - s))) { //faster than isNaN(). Also, we set pt.c (change) here because if it's 0, we'll just treat it like a non-tweening value. can't do (v !== start) because if it's a relative value and the CHANGE is identical to the START, the condition will fail unnecessarily. + pt.s = s; + } else { + pt.type = -1; + pt.i = value[p]; //intermediate value is typically the same as the end value. + pt.s = pt.c = 0; + } + + } + + this._overwriteProps.push("raphael_" + p); + if (pt._next) { + pt._next._prev = pt; + } + } + + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(v) { + var pt = this._firstPT, val; + + while (pt) { + val = pt.c * v + pt.s; + if (pt.r) { + val = Math.round(val); + } + if (!pt.type) { + pt.t[pt.p] = val; + } else if (pt.type === 1) { //rgb() + pt.t[pt.p] = "rgb(" + (val >> 0) + ", " + ((pt.gs + (v * pt.gc)) >> 0) + ", " + ((pt.bs + (v * pt.bc)) >> 0) + ")"; + } else if (pt.type === 2) { //rgba() + pt.t[pt.p] = "rgba(" + (val >> 0) + ", " + ((pt.gs + (v * pt.gc)) >> 0) + ", " + ((pt.bs + (v * pt.bc)) >> 0) + ", " + (pt.as + (v * pt.ac)) + ")"; + } else if (pt.type === -1) { //non-tweening + pt.t[pt.p] = pt.i; + } + pt = pt._next; + } + + this._target.attr(this._props); + + //apply transform values like x, y, scaleX, scaleY, rotation, skewX, or skewY. We do these after looping through all the PropTweens because those are where the changes are made to scaleX/scaleY/rotation/skewX/skewY/x/y. + if (this._transform) { + pt = this._transform; //to improve speed and reduce size, reuse the pt variable as an alias to the _transform property + var ang = pt.rotation, + skew = ang - pt.skewX, + a = Math.cos(ang) * pt.scaleX, + b = Math.sin(ang) * pt.scaleX, + c = Math.sin(skew) * -pt.scaleY, + d = Math.cos(skew) * pt.scaleY, + min = 0.000001, + pxl = this._pxl, + pyl = this._pyl; + + //some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 0 in these cases for both b and c. The conditional logic here is faster than calling Math.abs(). + if (b < min) if (b > -min) { + b = 0; + } + if (c < min) if (c > -min) { + c = 0; + } + pt.ox = this._pxg - (pxl * a + pyl * c); //we must record the offset x/y that we're making from the regular tx/ty (matrix.e and f) so that we can correctly interpret positional data in _getTransform(). See note there on tx and ox. + pt.oy = this._pyg - (pxl * b + pyl * d); + this._target.transform("m" + a + "," + b + "," + c + "," + d + "," + (pt.tx + pt.ox) + "," + (pt.ty + pt.oy)); + } + + } + + }), + p = RaphaelPlugin.prototype; + + //compares the beginning x, y, scaleX, scaleY, rotation, and skewX properties with the ending ones and adds PropTweens accordingly wherever necessary. We must tween them individually (rather than just tweening the matrix values) so that elgant overwriting can occur, like if one tween is controlling scaleX, scaleY, and rotation and then another one starts mid-tween that is trying to control the scaleX only - this tween should continue tweening scaleY and rotation. + p._parseTransform = function(t, v) { + if (this._transform) { return; } //only need to parse the transform once, and only if the browser supports it. + + var m1 = this._transform = _getTransform(t, true), + min = 0.000001, + m2, skewY, p, pt, copy, dx, dy, mtx, pivot; + + if (typeof(v) === "object") { //for values like scaleX, scaleY, rotation, x, y, skewX, and skewY or transform:{...} (object) + + m2 = {scaleX:_parseVal((v.scaleX != null) ? v.scaleX : v.scale, m1.scaleX), + scaleY:_parseVal((v.scaleY != null) ? v.scaleY : v.scale, m1.scaleY), + tx:_parseVal(v.tx, m1.tx), + ty:_parseVal(v.ty, m1.ty)}; + + if (v.shortRotation != null) { + m2.rotation = (typeof(v.shortRotation) === "number") ? v.shortRotation * _DEG2RAD : _parseAngle(v.shortRotation, m1.rotation); + var dif = (m2.rotation - m1.rotation) % (Math.PI * 2); + if (dif !== dif % Math.PI) { + dif += Math.PI * ((dif < 0) ? 2 : -2); + } + m2.rotation = m1.rotation + dif; + + } else { + m2.rotation = (v.rotation == null) ? m1.rotation : (typeof(v.rotation) === "number") ? v.rotation * _DEG2RAD : _parseAngle(v.rotation, m1.rotation); + } + m2.skewX = (v.skewX == null) ? m1.skewX : (typeof(v.skewX) === "number") ? v.skewX * _DEG2RAD : _parseAngle(v.skewX, m1.skewX); + + //note: for performance reasons, we combine all skewing into the skewX and rotation values, ignoring skewY but we must still record it so that we can discern how much of the overall skew is attributed to skewX vs. skewY. Otherwise, if the skewY would always act relative (tween skewY to 10deg, for example, multiple times and if we always combine things into skewX, we can't remember that skewY was 10 from last time). Remember, a skewY of 10 degrees looks the same as a rotation of 10 degrees plus a skewX of -10 degrees. + m2.skewY = (v.skewY == null) ? m1.skewY : (typeof(v.skewY) === "number") ? v.skewY * _DEG2RAD : _parseAngle(v.skewY, m1.skewY); + if ((skewY = m2.skewY - m1.skewY)) { + m2.skewX += skewY; + m2.rotation += skewY; + } + //don't allow rotation/skew values to be a SUPER small decimal because when they're translated back to strings for setting the css property, the browser reports them in a funky way, like 1-e7. Of course we could use toFixed() to resolve that issue but that hurts performance quite a bit with all those function calls on every frame, plus it is virtually impossible to discern values that small visually (nobody will notice changing a rotation of 0.0000001 to 0, so the performance improvement is well worth it). + if (m2.skewY < min) if (m2.skewY > -min) { + m2.skewY = 0; + } + if (m2.skewX < min) if (m2.skewX > -min) { + m2.skewX = 0; + } + if (m2.rotation < min) if (m2.rotation > -min) { + m2.rotation = 0; + } + + pivot = v.localPivot || v.globalPivot; + + if (typeof(pivot) === "string") { + copy = pivot.split(","); + dx = Number(copy[0]); + dy = Number(copy[1]); + } else if (typeof(pivot) === "object") { + dx = Number(pivot.x); + dy = Number(pivot.y); + } else if (v.localPivot) { + copy = t.getBBox(true); + dx = copy.width / 2; + dy = copy.height / 2; + } else { + copy = t.getBBox(); + dx = copy.x + copy.width / 2; + dy = copy.y + copy.height / 2; + } + + if (v.localPivot) { + mtx = t.matrix; + dx += t.attr("x"); + dy += t.attr("y"); + this._pxl = dx; + this._pyl = dy; + this._pxg = dx * mtx.a + dy * mtx.c + mtx.e - m1.tx; + this._pyg = dx * mtx.b + dy * mtx.d + mtx.f - m1.ty; + } else { + mtx = t.matrix.invert(); + this._pxl = dx * mtx.a + dy * mtx.c + mtx.e; + this._pyl = dx * mtx.b + dy * mtx.d + mtx.f; + this._pxg = dx - m1.tx; + this._pyg = dy - m1.ty; + } + + } else if (typeof(v) === "string") { //for values like transform:"rotate(60deg) scale(0.5, 0.8)" + copy = this._target.transform(); + t.transform(v); + m2 = _getTransform(t, false); + t.transform(copy); + } else { + return; + } + + for (p in _transformMap) { + if (m1[p] !== m2[p]) if (p !== "shortRotation") if (p !== "scale") { + this._firstPT = pt = {_next:this._firstPT, t:m1, p:p, s:m1[p], c:m2[p] - m1[p], n:p, f:false, r:false, b:m1[p], e:m2[p], type:0}; + if (pt._next) { + pt._next._prev = pt; + } + this._overwriteProps.push("raphael_" + p); + } + } + }; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } +/*! + * VERSION: 1.7.0 + * DATE: 2018-05-21 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + **/ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var RoundPropsPlugin = _gsScope._gsDefine.plugin({ + propName: "roundProps", + version: "1.7.0", + priority: -1, + API: 2, + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween) { + this._tween = tween; + return true; + } + + }), + _getRoundFunc = function(v) { //pass in 0.1 get a function that'll round to the nearest tenth, or 5 to round to the closest 5, or 0.001 to the closest 1000th, etc. + var p = v < 1 ? Math.pow(10, (v + "").length - 2) : 1; //to avoid floating point math errors (like 24 * 0.1 == 2.4000000000000004), we chop off at a specific number of decimal places (much faster than toFixed() + return function(n) { + return ((Math.round(n / v) * v * p) | 0) / p; + }; + }, + _roundLinkedList = function(node, mod) { + while (node) { + if (!node.f && !node.blob) { + node.m = mod || Math.round; + } + node = node._next; + } + }, + p = RoundPropsPlugin.prototype; + + p._onInitAllProps = function() { + var tween = this._tween, + rp = tween.vars.roundProps, + lookup = {}, + rpt = tween._propLookup.roundProps, + pt, next, i, p; + if (typeof(rp) === "object" && !rp.push) { + for (p in rp) { + lookup[p] = _getRoundFunc(rp[p]); + } + } else { + if (typeof(rp) === "string") { + rp = rp.split(","); + } + i = rp.length; + while (--i > -1) { + lookup[rp[i]] = Math.round; + } + } + + for (p in lookup) { + pt = tween._firstPT; + while (pt) { + next = pt._next; //record here, because it may get removed + if (pt.pg) { + pt.t._mod(lookup); + } else if (pt.n === p) { + if (pt.f === 2 && pt.t) { //a blob (text containing multiple numeric values) + _roundLinkedList(pt.t._firstPT, lookup[p]); + } else { + this._add(pt.t, p, pt.s, pt.c, lookup[p]); + //remove from linked list + if (next) { + next._prev = pt._prev; + } + if (pt._prev) { + pt._prev._next = next; + } else if (tween._firstPT === pt) { + tween._firstPT = next; + } + pt._next = pt._prev = null; + tween._propLookup[p] = rpt; + } + } + pt = next; + } + } + return false; + }; + + p._add = function(target, p, s, c, mod) { + this._addTween(target, p, s, s + c, p, mod || Math.round); + this._overwriteProps.push(p); + }; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } +/*! + * VERSION: 0.5.2 + * DATE: 2019-02-07 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * ScrambleTextPlugin is a Club GreenSock membership benefit; You must have a valid membership to use + * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. + * This work is subject to the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _trimExp = /(^\s+|\s+$)/g, + _spacesExp = /\s+/g, + _getText = function(e) { + var type = e.nodeType, + result = ""; + if (type === 1 || type === 9 || type === 11) { + if (typeof(e.textContent) === "string") { + return e.textContent; + } else { + for (e = e.firstChild; e; e = e.nextSibling ) { + result += _getText(e); + } + } + } else if (type === 3 || type === 4) { + return e.nodeValue; + } + return result; + }, + _scrambleText = function(length, chars) { + var l = chars.length, + s = ""; + while (--length > -1) { + s += chars[ ((Math.random() * l) | 0) ]; + } + return s; + }, + CharSet = function(chars) { + this.chars = _emojiSafeSplit(chars); + this.sets = []; + this.length = 50; + var i; + for (i = 0; i < 20; i++) { + this.sets[i] = _scrambleText(80, this.chars); //we create 20 strings that are 80 characters long, randomly chosen and pack them into an array. We then randomly choose the scrambled text from this array in order to greatly improve efficiency compared to creating new randomized text from scratch each and every time it's needed. This is a simple lookup whereas the other technique requires looping through as many times as there are characters needed, and calling Math.random() each time through the loop, building the string, etc. + } + this.grow = function(newLength) { //if we encounter a tween that has more than 80 characters, we'll need to add to the character sets accordingly. Once it's cached, it'll only need to grow again if we exceed that new length. Again, this is an efficiency tactic. + for (i = 0; i < 20; i++) { + this.sets[i] += _scrambleText(newLength - this.length, this.chars); + } + this.length = newLength; + }; + }, + _emoji = "[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2694-\u2697]|\uD83E[\uDD10-\uDD5D]|[\uD800-\uDBFF][\uDC00-\uDFFF]", + _emojiExp = new RegExp(_emoji), + _emojiAndCharsExp = new RegExp(_emoji + "|.", "g"), + _emojiSafeSplit = function(text, delimiter, trim) { + if (trim) { + text = text.replace(_trimExp, ""); + } + return ((delimiter === "" || !delimiter) && _emojiExp.test(text)) ? text.match(_emojiAndCharsExp) : text.split(delimiter || ""); + }, + _upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", + _lower = _upper.toLowerCase(), + _charsLookup = { + upperCase: new CharSet(_upper), + lowerCase: new CharSet(_lower), + upperAndLowerCase: new CharSet(_upper + _lower) + }, + + + + ScrambleTextPlugin = _gsScope._gsDefine.plugin({ + propName: "scrambleText", + version: "0.5.2", + API: 2, + overwriteProps:["scrambleText","text"], + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween, index) { + this._prop = ("innerHTML" in target) ? "innerHTML" : ("textContent" in target) ? "textContent" : 0; // SVG text in IE doesn't have innerHTML, but it does have textContent. + if (!this._prop) { + return false; + } + if (typeof(value) === "function") { + value = value(index, target); + } + this._target = target; + if (typeof(value) !== "object") { + value = {text:value}; + } + var text = value.text || value.value, + trim = (value.trim !== false), + delim, maxLength, charset, splitByChars; + this._delimiter = delim = value.delimiter || ""; + this._original = _emojiSafeSplit(_getText(target).replace(_spacesExp, " ").split(" ").join(""), delim, trim); + if (text === "{original}" || text === true || text == null) { + text = this._original.join(delim); + } + this._text = _emojiSafeSplit((text || "").replace(_spacesExp, " "), delim, trim); + this._hasClass = false; + if (typeof(value.newClass) === "string") { + this._newClass = value.newClass; + this._hasClass = true; + } + if (typeof(value.oldClass) === "string") { + this._oldClass = value.oldClass; + this._hasClass = true; + } + splitByChars = (delim === ""); + this._textHasEmoji = (_emojiExp.test(this._text.join(delim)) && splitByChars); + this._charsHaveEmoji = !!value.chars && _emojiExp.test(value.chars); + this._length = splitByChars ? this._original.length : this._original.join(delim).length; + this._lengthDif = (splitByChars ? this._text.length : this._text.join(delim).length) - this._length; + this._fillChar = value.fillChar || (value.chars && value.chars.indexOf(" ") !== -1) ? " " : ""; + this._charSet = charset = _charsLookup[(value.chars || "upperCase")] || new CharSet(value.chars); + this._speed = 0.016 / (value.speed || 1); + this._prevScrambleTime = 0; + this._setIndex = (Math.random() * 20) | 0; + maxLength = this._length + Math.max(this._lengthDif, 0); + if (maxLength > charset.length) { + charset.grow(maxLength); + } + this._chars = charset.sets[this._setIndex]; + this._revealDelay = value.revealDelay || 0; + this._tweenLength = (value.tweenLength !== false); + this._tween = tween; + this._rightToLeft = !!value.rightToLeft; + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(ratio) { + var l = this._text.length, + delim = this._delimiter, + time = this._tween._time, + timeDif = time - this._prevScrambleTime, + i, i2, startText, endText, applyNew, applyOld, str, startClass, endClass; + if (this._revealDelay) { + if (this._tween.vars.runBackwards) { + time = this._tween._duration - time; //invert the time for from() tweens + } + ratio = (time === 0) ? 0 : (time < this._revealDelay) ? 0.000001 : (time === this._tween._duration) ? 1 : this._tween._ease.getRatio((time - this._revealDelay) / (this._tween._duration - this._revealDelay)); + } + if (ratio < 0) { + ratio = 0; + } else if (ratio > 1) { + ratio = 1; + } + if (this._rightToLeft) { + ratio = 1 - ratio; + } + i = (ratio * l + 0.5) | 0; + if (ratio) { + if (timeDif > this._speed || timeDif < -this._speed) { + this._setIndex = (this._setIndex + ((Math.random() * 19) | 0)) % 20; + this._chars = this._charSet.sets[this._setIndex]; + this._prevScrambleTime += timeDif; + } + endText = this._chars; + } else { + endText = this._original.join(delim); + } + + if (this._rightToLeft) { + if (ratio === 1 && (this._tween.vars.runBackwards || this._tween.data === "isFromStart")) { //special case for from() tweens + startText = ""; + endText = this._original.join(delim); + } else { + str = this._text.slice(i).join(delim); + if (this._charsHaveEmoji) { + startText = _emojiSafeSplit(endText).slice(0, ((this._length + (this._tweenLength ? 1 - (ratio * ratio * ratio) : 1) * this._lengthDif) - ((this._textHasEmoji ? _emojiSafeSplit(str) : str).length) + 0.5) | 0).join(""); + } else { + startText = endText.substr(0, ((this._length + (this._tweenLength ? 1 - (ratio * ratio * ratio) : 1) * this._lengthDif) - ((this._textHasEmoji ? _emojiSafeSplit(str) : str).length) + 0.5) | 0); + } + endText = str; + } + + } else { + startText = this._text.slice(0, i).join(delim); + i2 = (this._textHasEmoji ? _emojiSafeSplit(startText) : startText).length; + if (this._charsHaveEmoji) { + endText = _emojiSafeSplit(endText).slice(i2, ((this._length + (this._tweenLength ? 1 - ((ratio = 1 - ratio) * ratio * ratio * ratio) : 1) * this._lengthDif) + 0.5) | 0).join(""); + } else { + endText = endText.substr(i2, ((this._length + (this._tweenLength ? 1 - ((ratio = 1 - ratio) * ratio * ratio * ratio) : 1) * this._lengthDif) - i2 + 0.5) | 0); + } + } + + if (this._hasClass) { + startClass = this._rightToLeft ? this._oldClass : this._newClass; + endClass = this._rightToLeft ? this._newClass : this._oldClass; + applyNew = (startClass && i !== 0); + applyOld = (endClass && i !== l); + str = (applyNew ? "" : "") + startText + (applyNew ? "" : "") + (applyOld ? "" : "") + delim + endText + (applyOld ? "" : ""); + } else { + str = startText + delim + endText; + } + this._target[this._prop] = (this._fillChar === " " && str.indexOf(" ") !== -1) ? str.split(" ").join("  ") : str; + } + + }), + p = ScrambleTextPlugin.prototype; + + p._newClass = p._oldClass = ""; + for (p in _charsLookup) { + _charsLookup[p.toLowerCase()] = _charsLookup[p]; + _charsLookup[p.toUpperCase()] = _charsLookup[p]; + } + + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("ScrambleTextPlugin")); +/*! + * VERSION: 1.9.2 + * DATE: 2019-02-07 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + **/ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _doc = (_gsScope.document || {}).documentElement, + _window = _gsScope, + _max = function(element, axis) { + var dim = (axis === "x") ? "Width" : "Height", + scroll = "scroll" + dim, + client = "client" + dim, + body = document.body; + return (element === _window || element === _doc || element === body) ? Math.max(_doc[scroll], body[scroll]) - (_window["inner" + dim] || _doc[client] || body[client]) : element[scroll] - element["offset" + dim]; + }, + _unwrapElement = function(value) { + if (typeof(value) === "string") { + value = TweenLite.selector(value); + } + if (value.length && value !== _window && value[0] && value[0].style && !value.nodeType) { + value = value[0]; + } + return (value === _window || (value.nodeType && value.style)) ? value : null; + }, + _buildGetter = function(e, axis) { //pass in an element and an axis ("x" or "y") and it'll return a getter function for the scroll position of that element (like scrollTop or scrollLeft, although if the element is the window, it'll use the pageXOffset/pageYOffset or the documentElement's scrollTop/scrollLeft or document.body's. Basically this streamlines things and makes a very fast getter across browsers. + var p = "scroll" + ((axis === "x") ? "Left" : "Top"); + if (e === _window) { + if (e.pageXOffset != null) { + p = "page" + axis.toUpperCase() + "Offset"; + } else if (_doc[p] != null) { + e = _doc; + } else { + e = document.body; + } + } + return function() { + return e[p]; + }; + }, + _getOffset = function(element, container) { + var rect = _unwrapElement(element).getBoundingClientRect(), + b = document.body, + isRoot = (!container || container === _window || container === b), + cRect = isRoot ? {top:_doc.clientTop - (window.pageYOffset || _doc.scrollTop || b.scrollTop || 0), left:_doc.clientLeft - (window.pageXOffset || _doc.scrollLeft || b.scrollLeft || 0)} : container.getBoundingClientRect(), + offsets = {x: rect.left - cRect.left, y: rect.top - cRect.top}; + if (!isRoot && container) { //only add the current scroll position if it's not the window/body. + offsets.x += _buildGetter(container, "x")(); + offsets.y += _buildGetter(container, "y")(); + } + return offsets; + /* PREVIOUS + var rect = _unwrapElement(element).getBoundingClientRect(), + isRoot = (!container || container === _window || container === document.body), + cRect = (isRoot ? _doc : container).getBoundingClientRect(), + offsets = {x: rect.left - cRect.left, y: rect.top - cRect.top}; + if (!isRoot && container) { //only add the current scroll position if it's not the window/body. + offsets.x += _buildGetter(container, "x")(); + offsets.y += _buildGetter(container, "y")(); + } + return offsets; + */ + }, + _parseVal = function(value, target, axis, currentVal) { + var type = typeof(value); + return !isNaN(value) ? parseFloat(value) : (type === "string" && value.charAt(1) === "=") ? parseInt(value.charAt(0) + "1", 10) * parseFloat(value.substr(2)) + currentVal : (value === "max") ? _max(target, axis) : Math.min(_max(target, axis), _getOffset(value, target)[axis]); + }, + + ScrollToPlugin = _gsScope._gsDefine.plugin({ + propName: "scrollTo", + API: 2, + global: true, + version:"1.9.2", + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween) { + this._wdw = (target === _window); + this._target = target; + this._tween = tween; + if (typeof(value) !== "object") { + value = {y:value}; //if we don't receive an object as the parameter, assume the user intends "y". + if (typeof(value.y) === "string" && value.y !== "max" && value.y.charAt(1) !== "=") { + value.x = value.y; + } + } else if (value.nodeType) { + value = {y:value, x:value}; + } + this.vars = value; + this._autoKill = (value.autoKill !== false); + this.getX = _buildGetter(target, "x"); + this.getY = _buildGetter(target, "y"); + this.x = this.xPrev = this.getX(); + this.y = this.yPrev = this.getY(); + if (value.x != null) { + this._addTween(this, "x", this.x, _parseVal(value.x, target, "x", this.x) - (value.offsetX || 0), "scrollTo_x", true); + this._overwriteProps.push("scrollTo_x"); + } else { + this.skipX = true; + } + if (value.y != null) { + this._addTween(this, "y", this.y, _parseVal(value.y, target, "y", this.y) - (value.offsetY || 0), "scrollTo_y", true); + this._overwriteProps.push("scrollTo_y"); + } else { + this.skipY = true; + } + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(v) { + this._super.setRatio.call(this, v); + + var x = (this._wdw || !this.skipX) ? this.getX() : this.xPrev, + y = (this._wdw || !this.skipY) ? this.getY() : this.yPrev, + yDif = y - this.yPrev, + xDif = x - this.xPrev, + threshold = ScrollToPlugin.autoKillThreshold; + + if (this.x < 0) { //can't scroll to a position less than 0! Might happen if someone uses a Back.easeOut or Elastic.easeOut when scrolling back to the top of the page (for example) + this.x = 0; + } + if (this.y < 0) { + this.y = 0; + } + if (this._autoKill) { + //note: iOS has a bug that throws off the scroll by several pixels, so we need to check if it's within 7 pixels of the previous one that we set instead of just looking for an exact match. + if (!this.skipX && (xDif > threshold || xDif < -threshold) && x < _max(this._target, "x")) { + this.skipX = true; //if the user scrolls separately, we should stop tweening! + } + if (!this.skipY && (yDif > threshold || yDif < -threshold) && y < _max(this._target, "y")) { + this.skipY = true; //if the user scrolls separately, we should stop tweening! + } + if (this.skipX && this.skipY) { + this._tween.kill(); + if (this.vars.onAutoKill) { + this.vars.onAutoKill.apply(this.vars.onAutoKillScope || this._tween, this.vars.onAutoKillParams || []); + } + } + } + if (this._wdw) { + _window.scrollTo((!this.skipX) ? this.x : x, (!this.skipY) ? this.y : y); + } else { + if (!this.skipY) { + this._target.scrollTop = this.y; + } + if (!this.skipX) { + this._target.scrollLeft = this.x; + } + } + this.xPrev = this.x; + this.yPrev = this.y; + } + + }), + p = ScrollToPlugin.prototype; + + ScrollToPlugin.max = _max; + ScrollToPlugin.getOffset = _getOffset; + ScrollToPlugin.buildGetter = _buildGetter; + ScrollToPlugin.autoKillThreshold = 7; + + p._kill = function(lookup) { + if (lookup.scrollTo_x) { + this.skipX = true; + } + if (lookup.scrollTo_y) { + this.skipY = true; + } + return this._super._kill.call(this, lookup); + }; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("ScrollToPlugin")); +/*! + * VERSION: 1.2.0 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * This file is to be used as a simple template for writing your own plugin. See the + * TweenPlugin docs for more details. + * + * You can start by doing a search for "yourCustomProperty" and replace it with whatever the name + * of your property is. This way of defining a plugin was introduced in version 1.9.0 - previous versions + * of TweenLite won't work with this. + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + **/ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + //ignore the line above this and at the very end - those are for ensuring things load in the proper order + "use strict"; + + _gsScope._gsDefine.plugin({ + propName: "yourCustomProperty", //the name of the property that will get intercepted and handled by this plugin (obviously change it to whatever you want, typically it is camelCase starting with lowercase). + priority: 0, //the priority in the rendering pipeline (0 by default). A priority of -1 would mean this plugin will run after all those with 0 or greater. A priority of 1 would get run before 0, etc. This only matters when a plugin relies on other plugins finishing their work before it runs (or visa-versa) + API: 2, //the API should stay 2 - it just gives us a way to know the method/property structure so that if in the future we change to a different TweenPlugin architecture, we can identify this plugin's structure. + version: "1.0.0", //your plugin's version number + overwriteProps: ["yourCustomProperty"], //an array of property names whose tweens should be overwritten by this plugin. For example, if you create a "scale" plugin that handles both "scaleX" and "scaleY", the overwriteProps would be ["scaleX","scaleY"] so that if there's a scaleX or scaleY tween in-progress when a new "scale" tween starts (using this plugin), it would overwrite the scaleX or scaleY tween. + + /* + * The init function is called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. It receives 3 parameters: + * 1) target [object] - the target of the tween. In cases where the tween's original target is an array (or jQuery object), this target will be the individual object inside that array (a new plugin instance is created for each target in the array). For example, TweenLite.to([obj1, obj2, obj3], 1, {x:100}) the target will be obj1 or obj2 or obj3 rather than the array containing them. + * 2) value [*] - whatever value is passed as the special property value. For example, TweenLite.to(element, 1, {yourCustomProperty:3}) the value would be 3. Or for TweenLite.to(element, 1, {yourCustomProperty:{subProp1:3, subProp2:"whatever"}});, value would be {subProp1:3, subProp2:"whatever"}. + * 3) tween [TweenLite] - the TweenLite (or TweenMax) instance that is managing this plugin instance. This can be useful if you need to check certain state-related properties on the tween (maybe in the set method) like its duration or time. Most of the time, however, you don't need to do anything with the tween. It is provided just in case you want to reference it. + * 4) index [integer] - the index number of the target in the tween. For example, if an array is passed in as the target (or selector text), this would be 0 for the first one, 1 for the second, 2 for the third, etc. This was introduced in GSAP 1.19.0 + * + * This function should return true unless you want to have TweenLite/Max skip the plugin altogether and instead treat the property/value like a normal tween (as if the plugin wasn't activated). This is rarely useful, so you should almost always return true. + */ + init: function(target, value, tween, index) { + this._target = target; //we record the target so that we can refer to it in the set method when doing updates. + + /* Next, we create a property tween for "scaleX" and "scaleY" properties of our target + * (we're just using them as a examples of how to set up a property tween with a name, start, and end value). + * the _addTween() method accepts the following parameters: + * 1) target [object] - target object whose property this tween will control. + * 2) property [string] - the name of the property, like "scaleX" or "scaleY" + * 3) start [number] - The starting value of the property. For example, if you're tweening from 0 to 100, start would be 0. + * 4) end [number] - the ending value of the property. For example, if you're tweening from 0 to 100, end would be 100. + * 5) overwriteProperty [string] - the name that gets registered as the overwrite property so that if another concurrent tween of the same target gets created and it is tweening a property with this name, this one will be overwritten. Typically this is the same as "property". + * 6) round [boolean] - if true, the updated value on each update will be rounded to the nearest integer. [false by default] + * You do NOT need to use _addTween() at all. It is merely a convenience. You can record your own values internally or whatever you want. + */ + this._addTween(target, "scaleX", target.scaleX, value, "scaleX", false); + this._addTween(target, "scaleY", target.scaleY, value, "scaleY", false); + + //now, just for kicks, we'll record the starting "alpha" value and amount of change so that we can manage this manually rather than _addTween() (again, totally fictitious, just for an example) + this._alphaStart = target.alpha; + this._alphaChange = value.alpha - target.alpha; + + //always return true unless we want to scrap the plugin and have the value treated as a normal property tween (very uncommon) + return true; + }, + + //[optional] - called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.). If you're using this._super._addTween() for all your tweens and you don't need to do anything special on each frame besides updating those values, you can omit this "set" function altogether. + set: function(ratio) { + //since we used _addTween() inside init function, it created some property tweens that we'll update by calling the parent prototype's setRatio() (otherwise, the property tweens wouldn't get their values updated). this._super refers to the TweenPlugin prototype from which the plugin inherits (not that you need to worry about that). + this._super.setRatio.call(this, ratio); + + //now manually set the alpha + this._target.alpha = this._alphaStart + this._alphaChange * ratio; + } + + }); + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } +/*! + * VERSION: 0.6.2 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _getText = function(e) { + var type = e.nodeType, + result = ""; + if (type === 1 || type === 9 || type === 11) { + if (typeof(e.textContent) === "string") { + return e.textContent; + } else { + for ( e = e.firstChild; e; e = e.nextSibling ) { + result += _getText(e); + } + } + } else if (type === 3 || type === 4) { + return e.nodeValue; + } + return result; + }, + _emoji = "[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2694-\u2697]|\uD83E[\uDD10-\uDD5D]|[\uD800-\uDBFF][\uDC00-\uDFFF]", + _emojiExp = new RegExp(_emoji), + _emojiAndCharsExp = new RegExp(_emoji + "|.", "g"), + _emojiSafeSplit = function(text, delimiter) { + return ((delimiter === "" || !delimiter) && _emojiExp.test(text)) ? text.match(_emojiAndCharsExp) : text.split(delimiter || ""); + }, + /* //previous emoji-related splitting. New method above is faster and more concise. + _emojiStart = 0xD800, + _emojiEnd = 0xDBFF, + _emojiLowStart = 0xDC00, + _emojiRegionStart = 0x1F1E6, + _emojiRegionEnd = 0x1F1FF, + _emojiModStart = 0x1f3fb, + _emojiModEnd = 0x1f3ff, + _emojiPairCode = function(s) { + return ((s.charCodeAt(0) - _emojiStart) << 10) + (s.charCodeAt(1) - _emojiLowStart) + 0x10000; + }, + _emojiSafeSplit = function(text, delimiter) { //like calling String.split(delimiter) except that it keeps emoji characters together. + if (delimiter !== "") { + return text.split(delimiter); + } + var l = text.length, + a = [], + character, i, emojiPair1, emojiPair2, j; + for (i = 0; i < l; i++) { + character = text.charAt(i); + if ((character.charCodeAt(0) >= _emojiStart && character.charCodeAt(0) <= _emojiEnd) || (text.charCodeAt(i+1) >= 0xFE00 && text.charCodeAt(i+1) <= 0xFE0F)) { //special emoji characters use 2 or 4 unicode characters that we must keep together. + emojiPair1 = _emojiPairCode(text.substr(i, 2)); + emojiPair2 = _emojiPairCode(text.substr(i + 2, 2)); + j = ((emojiPair1 >= _emojiRegionStart && emojiPair1 <= _emojiRegionEnd && emojiPair2 >= _emojiRegionStart && emojiPair2 <= _emojiRegionEnd) || (emojiPair2 >= _emojiModStart && emojiPair2 <= _emojiModEnd)) ? 4 : 2; + a.push(text.substr(i, j)); + i += j - 1; + } else { + a.push(character); + } + } + return a; + }, + */ + TextPlugin = _gsScope._gsDefine.plugin({ + propName: "text", + API: 2, + version:"0.6.2", + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween, index) { + var i = target.nodeName.toUpperCase(), + shrt; + if (typeof(value) === "function") { + value = value(index, target); + } + this._svg = (target.getBBox && (i === "TEXT" || i === "TSPAN")); + if (!("innerHTML" in target) && !this._svg) { + return false; + } + this._target = target; + if (typeof(value) !== "object") { + value = {value:value}; + } + if (value.value === undefined) { + this._text = this._original = [""]; + return true; + } + this._delimiter = value.delimiter || ""; + this._original = _emojiSafeSplit(_getText(target).replace(/\s+/g, " "), this._delimiter); + this._text = _emojiSafeSplit(value.value.replace(/\s+/g, " "), this._delimiter); + this._runBackwards = (tween.vars.runBackwards === true); + if (this._runBackwards) { + i = this._original; + this._original = this._text; + this._text = i; + } + if (typeof(value.newClass) === "string") { + this._newClass = value.newClass; + this._hasClass = true; + } + if (typeof(value.oldClass) === "string") { + this._oldClass = value.oldClass; + this._hasClass = true; + } + i = this._original.length - this._text.length; + shrt = (i < 0) ? this._original : this._text; + this._fillChar = value.fillChar || (value.padSpace ? " " : ""); + if (i < 0) { + i = -i; + } + while (--i > -1) { + shrt.push(this._fillChar); + } + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(ratio) { + if (ratio > 1) { + ratio = 1; + } else if (ratio < 0) { + ratio = 0; + } + if (this._runBackwards) { + ratio = 1 - ratio; + } + var l = this._text.length, + i = (ratio * l + 0.5) | 0, + applyNew, applyOld, str; + if (this._hasClass) { + applyNew = (this._newClass && i !== 0); + applyOld = (this._oldClass && i !== l); + str = (applyNew ? "" : "") + this._text.slice(0, i).join(this._delimiter) + (applyNew ? "" : "") + (applyOld ? "" : "") + this._delimiter + this._original.slice(i).join(this._delimiter) + (applyOld ? "" : ""); + } else { + str = this._text.slice(0, i).join(this._delimiter) + this._delimiter + this._original.slice(i).join(this._delimiter); + } + if (this._svg) { //SVG text elements don't have an "innerHTML" in Microsoft browsers. + this._target.textContent = str; + } else { + this._target.innerHTML = (this._fillChar === " " && str.indexOf(" ") !== -1) ? str.split(" ").join("  ") : str; + } + } + + }), + p = TextPlugin.prototype; + + p._newClass = p._oldClass = p._delimiter = ""; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("TextPlugin")); +/*! + * VERSION: 0.11.2 + * DATE: 2019-02-07 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * ThrowPropsPlugin is a Club GreenSock membership benefit; You must have a valid membership to use + * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. + * This work is subject to the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + _gsScope._gsDefine("plugins.ThrowPropsPlugin", ["plugins.TweenPlugin", "TweenLite", "easing.Ease", "utils.VelocityTracker"], function(TweenPlugin, TweenLite, Ease, VelocityTracker) { + + var ThrowPropsPlugin = function(props, priority) { + TweenPlugin.call(this, "throwProps"); + this._overwriteProps.length = 0; + }, + _max = 999999999999999, + _min = 0.0000000001, + _globals = _gsScope._gsDefine.globals, + _recordEndMode = false,//in a typical throwProps css tween that has an "end" defined as a function, it grabs that value initially when the tween is rendered, then again when we calculate the necessary duration, and then a 3rd time after we invalidate() the tween, so we toggle _recordEndMode to true when we're about to begin such a tween which tells the engine to grab the end value(s) once and record them as "max" and "min" on the throwProps object, thus we can skip those extra calls. Then we set it back to false when we're done with our fancy initialization routine. + _transforms = {x:1,y:1,z:2,scale:1,scaleX:1,scaleY:1,rotation:1,rotationZ:1,rotationX:2,rotationY:2,skewX:1,skewY:1,xPercent:1,yPercent:1}, + _getClosest = function(n, values, max, min, radius) { + var i = values.length, + closest = 0, + absDif = _max, + val, dif, p, dist; + if (typeof(n) === "object") { + while (--i > -1) { + val = values[i]; + dif = 0; + for (p in n) { + dist = val[p] - n[p]; + dif += dist * dist; + } + if (dif < absDif) { + closest = i; + absDif = dif; + } + } + if ((radius || _max) < _max && radius < Math.sqrt(absDif)) { + return n; + } + } else { + while (--i > -1) { + val = values[i]; + dif = val - n; + if (dif < 0) { + dif = -dif; + } + if (dif < absDif && val >= min && val <= max) { + closest = i; + absDif = dif; + } + } + } + return values[closest]; + }, + _parseEnd = function(curProp, end, max, min, name, radius) { + if (curProp.end === "auto") { + return curProp; + } + var endVar = curProp.end, + adjustedEnd, p; + max = isNaN(max) ? _max : max; + min = isNaN(min) ? -_max : min; + if (typeof(end) === "object") { //for objects, like {x, y} where they're linked and we must pass an object to the function or find the closest value in an array. + adjustedEnd = end.calculated ? end : ((typeof(endVar) === "function") ? endVar(end) : _getClosest(end, endVar, max, min, radius)) || end; + if (!end.calculated) { + for (p in adjustedEnd) { + end[p] = adjustedEnd[p]; + } + end.calculated = true; + } + adjustedEnd = adjustedEnd[name]; + } else { + adjustedEnd = (typeof(endVar) === "function") ? endVar(end) : (endVar instanceof Array) ? _getClosest(end, endVar, max, min, radius) : Number(endVar); + } + if (adjustedEnd > max) { + adjustedEnd = max; + } else if (adjustedEnd < min) { + adjustedEnd = min; + } + return {max:adjustedEnd, min:adjustedEnd, unitFactor:curProp.unitFactor}; + }, + _extend = function(decoratee, extras, exclude) { + for (var p in extras) { + if (decoratee[p] === undefined && p !== exclude) { + decoratee[p] = extras[p]; + } + } + return decoratee; + }, + _calculateChange = ThrowPropsPlugin.calculateChange = function(velocity, ease, duration, checkpoint) { + if (checkpoint == null) { + checkpoint = 0.05; + } + var e = (ease instanceof Ease) ? ease : (!ease) ? TweenLite.defaultEase : new Ease(ease); + return (duration * checkpoint * velocity) / e.getRatio(checkpoint); + }, + _calculateDuration = ThrowPropsPlugin.calculateDuration = function(start, end, velocity, ease, checkpoint) { + checkpoint = checkpoint || 0.05; + var e = (ease instanceof Ease) ? ease : (!ease) ? TweenLite.defaultEase : new Ease(ease); + return Math.abs( (end - start) * e.getRatio(checkpoint) / velocity / checkpoint ); + }, + _calculateTweenDuration = ThrowPropsPlugin.calculateTweenDuration = function(target, vars, maxDuration, minDuration, overshootTolerance, recordEnd) { + if (typeof(target) === "string") { + target = TweenLite.selector(target); + } + if (!target) { + return 0; + } + if (maxDuration == null) { + maxDuration = 10; + } + if (minDuration == null) { + minDuration = 0.2; + } + if (overshootTolerance == null) { + overshootTolerance = 1; + } + if (target.length) { + target = target[0] || target; + } + var duration = 0, + clippedDuration = 9999999999, + throwPropsVars = vars.throwProps || vars, + ease = (vars.ease instanceof Ease) ? vars.ease : (!vars.ease) ? TweenLite.defaultEase : new Ease(vars.ease), + checkpoint = isNaN(throwPropsVars.checkpoint) ? 0.05 : Number(throwPropsVars.checkpoint), + resistance = isNaN(throwPropsVars.resistance) ? ThrowPropsPlugin.defaultResistance : Number(throwPropsVars.resistance), + p, curProp, curDuration, curVelocity, curResistance, curVal, end, curClippedDuration, tracker, unitFactor, + linkedProps, linkedPropNames, i; + + if (throwPropsVars.linkedProps) { //when there are linkedProps (typically "x,y" where snapping has to factor in multiple properties, we must first populate an object with all of those end values, then feed it to the function that make any necessary alterations. So the point of this first loop is to simply build an object (like {x:100, y:204.5}) for feeding into that function which we'll do later in the "real" loop. + linkedPropNames = throwPropsVars.linkedProps.split(","); + linkedProps = {}; + for (i = 0; i < linkedPropNames.length; i++) { + p = linkedPropNames[i]; + curProp = throwPropsVars[p]; + if (curProp) { + if (curProp.velocity !== undefined && typeof(curProp.velocity) === "number") { + curVelocity = Number(curProp.velocity) || 0; + } else { + tracker = tracker || VelocityTracker.getByTarget(target); + curVelocity = (tracker && tracker.isTrackingProp(p)) ? tracker.getVelocity(p) : 0; + } + curResistance = isNaN(curProp.resistance) ? resistance : Number(curProp.resistance); + curDuration = (curVelocity * curResistance > 0) ? curVelocity / curResistance : curVelocity / -curResistance; + curVal = (typeof(target[p]) === "function") ? target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() : target[p] || 0; + linkedProps[p] = curVal + _calculateChange(curVelocity, ease, curDuration, checkpoint); + } + } + } + + for (p in throwPropsVars) { + + if (p !== "resistance" && p !== "checkpoint" && p !== "preventOvershoot" && p !== "linkedProps" && p !== "radius") { + curProp = throwPropsVars[p]; + if (typeof(curProp) !== "object") { + tracker = tracker || VelocityTracker.getByTarget(target); + if (tracker && tracker.isTrackingProp(p)) { + curProp = (typeof(curProp) === "number") ? {velocity:curProp} : {velocity:tracker.getVelocity(p)}; //if we're tracking this property, we should use the tracking velocity and then use the numeric value that was passed in as the min and max so that it tweens exactly there. + } else { + curVelocity = Number(curProp) || 0; + curDuration = (curVelocity * resistance > 0) ? curVelocity / resistance : curVelocity / -resistance; + } + } + if (typeof(curProp) === "object") { + + if (curProp.velocity !== undefined && typeof(curProp.velocity) === "number") { + curVelocity = Number(curProp.velocity) || 0; + } else { + tracker = tracker || VelocityTracker.getByTarget(target); + curVelocity = (tracker && tracker.isTrackingProp(p)) ? tracker.getVelocity(p) : 0; + } + curResistance = isNaN(curProp.resistance) ? resistance : Number(curProp.resistance); + curDuration = (curVelocity * curResistance > 0) ? curVelocity / curResistance : curVelocity / -curResistance; + curVal = (typeof(target[p]) === "function") ? target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() : target[p] || 0; + end = curVal + _calculateChange(curVelocity, ease, curDuration, checkpoint); + if (curProp.end !== undefined) { + curProp = _parseEnd(curProp, (linkedProps && p in linkedProps) ? linkedProps : end, curProp.max, curProp.min, p, throwPropsVars.radius); + if (recordEnd || _recordEndMode) { + throwPropsVars[p] = _extend(curProp, throwPropsVars[p], "end"); + } + } + if (curProp.max !== undefined && end > Number(curProp.max) + _min) { + unitFactor = curProp.unitFactor || ThrowPropsPlugin.defaultUnitFactors[p] || 1; //some values are measured in special units like radians in which case our thresholds need to be adjusted accordingly. + //if the value is already exceeding the max or the velocity is too low, the duration can end up being uncomfortably long but in most situations, users want the snapping to occur relatively quickly (0.75 seconds), so we implement a cap here to make things more intuitive. If the max and min match, it means we're animating to a particular value and we don't want to shorten the time unless the velocity is really slow. Example: a rotation where the start and natural end value are less than the snapping spot, but the natural end is pretty close to the snap. + curClippedDuration = ((curVal > curProp.max && curProp.min !== curProp.max) || (curVelocity * unitFactor > -15 && curVelocity * unitFactor < 45)) ? (minDuration + (maxDuration - minDuration) * 0.1) : _calculateDuration(curVal, curProp.max, curVelocity, ease, checkpoint); + if (curClippedDuration + overshootTolerance < clippedDuration) { + clippedDuration = curClippedDuration + overshootTolerance; + } + + } else if (curProp.min !== undefined && end < Number(curProp.min) - _min) { + unitFactor = curProp.unitFactor || ThrowPropsPlugin.defaultUnitFactors[p] || 1; //some values are measured in special units like radians in which case our thresholds need to be adjusted accordingly. + //if the value is already exceeding the min or if the velocity is too low, the duration can end up being uncomfortably long but in most situations, users want the snapping to occur relatively quickly (0.75 seconds), so we implement a cap here to make things more intuitive. + curClippedDuration = ((curVal < curProp.min && curProp.min !== curProp.max) || (curVelocity * unitFactor > -45 && curVelocity * unitFactor < 15)) ? (minDuration + (maxDuration - minDuration) * 0.1) : _calculateDuration(curVal, curProp.min, curVelocity, ease, checkpoint); + if (curClippedDuration + overshootTolerance < clippedDuration) { + clippedDuration = curClippedDuration + overshootTolerance; + } + } + + if (curClippedDuration > duration) { + duration = curClippedDuration; + } + } + + if (curDuration > duration) { + duration = curDuration; + } + + } + } + if (duration > clippedDuration) { + duration = clippedDuration; + } + if (duration > maxDuration) { + return maxDuration; + } else if (duration < minDuration) { + return minDuration; + } + return duration; + }, + p = ThrowPropsPlugin.prototype = new TweenPlugin("throwProps"), + _cssProxy, _cssVars, _last, _lastValue; //these serve as a cache of sorts, recording the last css-related proxy and the throwProps vars that get calculated in the _cssRegister() method. This allows us to grab them in the ThrowPropsPlugin.to() function and calculate the duration. Of course we could have structured things in a more "clean" fashion, but performance is of paramount importance. + + + + p.constructor = ThrowPropsPlugin; + ThrowPropsPlugin.version = "0.11.2"; + ThrowPropsPlugin.API = 2; + ThrowPropsPlugin._autoCSS = true; //indicates that this plugin can be inserted into the "css" object using the autoCSS feature of TweenLite + ThrowPropsPlugin.defaultResistance = 100; + ThrowPropsPlugin.defaultUnitFactors = {time:1000, totalTime:1000}; //setting the unitFactor to a higher value (default is 1) reduces the chance of the auto-accelerating behavior kicking in when determining durations when the initial velocity is adequately low - imagine dragging something past a boundary and then letting go - snapping back relatively quickly should be prioritized over matching the initial velocity (at least that's the behavior most people consider intuitive). But in some situations when the units are very low (like "time" of a timeline or rotation when using radians), it can kick in too frequently so this allows tweaking. + + ThrowPropsPlugin.track = function(target, props, types) { + return VelocityTracker.track(target, props, types); + }; + + ThrowPropsPlugin.untrack = function(target, props) { + VelocityTracker.untrack(target, props); + }; + + ThrowPropsPlugin.isTracking = function(target, prop) { + return VelocityTracker.isTracking(target, prop); + }; + + ThrowPropsPlugin.getVelocity = function(target, prop) { + var vt = VelocityTracker.getByTarget(target); + return vt ? vt.getVelocity(prop) : NaN; + }; + + ThrowPropsPlugin._cssRegister = function() { + var CSSPlugin = _globals.com.greensock.plugins.CSSPlugin; + if (!CSSPlugin) { + return; + } + var _internals = CSSPlugin._internals, + _parseToProxy = _internals._parseToProxy, + _setPluginRatio = _internals._setPluginRatio, + CSSPropTween = _internals.CSSPropTween; + _internals._registerComplexSpecialProp("throwProps", {parser:function(t, e, prop, cssp, pt, plugin) { + plugin = new ThrowPropsPlugin(); + var velocities = {}, + min = {}, + max = {}, + end = {}, + res = {}, + preventOvershoot = {}, + hasResistance, val, p, data, tracker; + _cssVars = {}; + for (p in e) { + if (p !== "resistance" && p !== "preventOvershoot" && p !== "linkedProps" && p !== "radius") { + val = e[p]; + if (typeof(val) === "object") { + if (val.velocity !== undefined && typeof(val.velocity) === "number") { + velocities[p] = Number(val.velocity) || 0; + } else { + tracker = tracker || VelocityTracker.getByTarget(t); + velocities[p] = (tracker && tracker.isTrackingProp(p)) ? tracker.getVelocity(p) : 0; //rotational values are actually converted to radians in CSSPlugin, but our tracking velocity is in radians already, so make it into degrees to avoid a funky conversion + } + if (val.end !== undefined) { + end[p] = val.end; + } + if (val.min !== undefined) { + min[p] = val.min; + } + if (val.max !== undefined) { + max[p] = val.max; + } + if (val.preventOvershoot) { + preventOvershoot[p] = true; + } + if (val.resistance !== undefined) { + hasResistance = true; + res[p] = val.resistance; + } + } else if (typeof(val) === "number") { + velocities[p] = val; + } else { + tracker = tracker || VelocityTracker.getByTarget(t); + if (tracker && tracker.isTrackingProp(p)) { + velocities[p] = tracker.getVelocity(p); + } else { + velocities[p] = val || 0; + } + } + if (_transforms[p]) { + cssp._enableTransforms((_transforms[p] === 2)); + } + } + } + data = _parseToProxy(t, velocities, cssp, pt, plugin); + _cssProxy = data.proxy; + velocities = data.end; + for (p in _cssProxy) { + _cssVars[p] = {velocity:velocities[p], min:min[p], max:max[p], end:end[p], resistance:res[p], preventOvershoot:preventOvershoot[p]}; + } + if (e.resistance != null) { + _cssVars.resistance = e.resistance; + } + if (e.linkedProps != null) { + _cssVars.linkedProps = e.linkedProps; + } + if (e.radius != null) { + _cssVars.radius = e.radius; + } + if (e.preventOvershoot) { + _cssVars.preventOvershoot = true; + } + pt = new CSSPropTween(t, "throwProps", 0, 0, data.pt, 2); + cssp._overwriteProps.pop(); //don't overwrite all other throwProps tweens. In the CSSPropTween constructor, we add the property to the _overwriteProps, so remove it here. + pt.plugin = plugin; + pt.setRatio = _setPluginRatio; + pt.data = data; + plugin._onInitTween(_cssProxy, _cssVars, cssp._tween); + return pt; + }}); + }; + + + ThrowPropsPlugin.to = function(target, vars, maxDuration, minDuration, overshootTolerance) { + if (!vars.throwProps) { + vars = {throwProps:vars}; + } + if (overshootTolerance === 0) { + vars.throwProps.preventOvershoot = true; + } + _recordEndMode = true; //if we encounter a function-based "end" value, ThrowPropsPlugin will record it as "max" and "min" properties, replacing "end" (this is an optimization so that the function only gets called once) + var tween = new TweenLite(target, minDuration || 1, vars); + tween.render(0, true, true); //we force a render so that the CSSPlugin instantiates and populates the _cssProxy and _cssVars which we need in order to calculate the tween duration. Remember, we can't use the regular target for calculating the duration because the current values wouldn't be able to be grabbed like target["propertyName"], as css properties can be complex like boxShadow:"10px 10px 20px 30px red" or backgroundPosition:"25px 50px". The proxy is the result of breaking all that complex data down and finding just the numeric values and assigning them to a generic proxy object with unique names. THAT is what the _calculateTweenDuration() can look at. We also needed to do the same break down of any min or max or velocity data + if (tween.vars.css) { + tween.duration(_calculateTweenDuration(_cssProxy, {throwProps:_cssVars, ease:vars.ease}, maxDuration, minDuration, overshootTolerance)); + if (tween._delay && !tween.vars.immediateRender) { + tween.invalidate(); //if there's a delay, the starting values could be off, so invalidate() to force reinstantiation when the tween actually starts. + } else { + _last._onInitTween(_cssProxy, _lastValue, tween); + } + _recordEndMode = false; + return tween; + } else { + tween.kill(); + tween = new TweenLite(target, _calculateTweenDuration(target, vars, maxDuration, minDuration, overshootTolerance), vars); + _recordEndMode = false; + return tween; + } + }; + + p._onInitTween = function(target, value, tween, index) { + this.target = target; + this._props = []; + _last = this; + _lastValue = value; + var ease = tween._ease, + checkpoint = isNaN(value.checkpoint) ? 0.05 : Number(value.checkpoint), + duration = tween._duration, + preventOvershoot = value.preventOvershoot, + cnt = 0, + p, curProp, curVal, isFunc, velocity, change1, end, change2, tracker, + linkedProps, linkedPropNames, i; + + if (value.linkedProps) { //when there are linkedProps (typically "x,y" where snapping has to factor in multiple properties, we must first populate an object with all of those end values, then feed it to the function that make any necessary alterations. So the point of this first loop is to simply build an object (like {x:100, y:204.5}) for feeding into that function which we'll do later in the "real" loop. + linkedPropNames = value.linkedProps.split(","); + linkedProps = {}; + for (i = 0; i < linkedPropNames.length; i++) { + p = linkedPropNames[i]; + curProp = value[p]; + if (curProp) { + if (curProp.velocity !== undefined && typeof(curProp.velocity) === "number") { + velocity = Number(curProp.velocity) || 0; + } else { + tracker = tracker || VelocityTracker.getByTarget(target); + velocity = (tracker && tracker.isTrackingProp(p)) ? tracker.getVelocity(p) : 0; + } + curVal = (typeof(target[p]) === "function") ? target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() : target[p] || 0; + linkedProps[p] = curVal + _calculateChange(velocity, ease, duration, checkpoint); + } + } + } + + for (p in value) { + if (p !== "resistance" && p !== "checkpoint" && p !== "preventOvershoot" && p !== "linkedProps" && p !== "radius") { + curProp = value[p]; + if (typeof(curProp) === "function") { + curProp = curProp(index, target); + } + if (typeof(curProp) === "number") { + velocity = Number(curProp) || 0; + } else if (typeof(curProp) === "object" && !isNaN(curProp.velocity)) { + velocity = Number(curProp.velocity); + } else { + tracker = tracker || VelocityTracker.getByTarget(target); + if (tracker && tracker.isTrackingProp(p)) { + velocity = tracker.getVelocity(p); + } else { + throw("ERROR: No velocity was defined in the throwProps tween of " + target + " property: " + p); + } + } + change1 = _calculateChange(velocity, ease, duration, checkpoint); + change2 = 0; + isFunc = (typeof(target[p]) === "function"); + curVal = (isFunc) ? target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() : target[p]; + if (typeof(curProp) === "object") { + end = curVal + change1; + if (curProp.end !== undefined) { + curProp = _parseEnd(curProp, (linkedProps && p in linkedProps) ? linkedProps : end, curProp.max, curProp.min, p, value.radius); + if (_recordEndMode) { + value[p] = _extend(curProp, value[p], "end"); + } + } + if (curProp.max !== undefined && Number(curProp.max) < end) { + if (preventOvershoot || curProp.preventOvershoot) { + change1 = curProp.max - curVal; + } else { + change2 = (curProp.max - curVal) - change1; + } + } else if (curProp.min !== undefined && Number(curProp.min) > end) { + if (preventOvershoot || curProp.preventOvershoot) { + change1 = curProp.min - curVal; + } else { + change2 = (curProp.min - curVal) - change1; + } + } + } + this._overwriteProps[cnt] = p; + this._props[cnt++] = {p:p, s:curVal, c1:change1, c2:change2, f:isFunc, r:false}; + } + } + return true; + }; + + p._kill = function(lookup) { + var i = this._props.length; + while (--i > -1) { + if (lookup[this._props[i].p] != null) { + this._props.splice(i, 1); + } + } + return TweenPlugin.prototype._kill.call(this, lookup); + }; + + p._mod = function(lookup) { + var p = this._props, + i = p.length, + val; + while (--i > -1) { + val = lookup[p[i].p] || lookup.throwProps; + if (typeof(val) === "function") { + p[i].m = val; + } + } + }; + + p.setRatio = function(v) { + var i = this._props.length, + cp, val; + while (--i > -1) { + cp = this._props[i]; + val = cp.s + cp.c1 * v + cp.c2 * v * v; + if (cp.m) { + val = cp.m(val, this.target); + } else if (v === 1) { + val = ((val * 10000 + (val < 0 ? -0.5 : 0.5)) | 0) / 10000; //if we don't round things at the very end, binary math issues can creep in and cause snapping not to be exact (like landing on 20.000000000001 instead of 20). + } + if (cp.f) { + this.target[cp.p](val); + } else { + this.target[cp.p] = val; + } + } + }; + + TweenPlugin.activate([ThrowPropsPlugin]); + + return ThrowPropsPlugin; + + }, true); + + + +/* + * ---------------------------------------------------------------- + * VelocityTracker + * ---------------------------------------------------------------- + */ + _gsScope._gsDefine("utils.VelocityTracker", ["TweenLite"], function(TweenLite) { + + var _first, _initted, _time1, _time2, + _capsExp = /([A-Z])/g, + _empty = {}, + _doc = _gsScope.document, + _transforms = {x:1,y:1,z:2,scale:1,scaleX:1,scaleY:1,rotation:1,rotationZ:1,rotationX:2,rotationY:2,skewX:1,skewY:1,xPercent:1,yPercent:1}, + _computedStyleScope = (typeof(window) !== "undefined" ? window : _doc.defaultView || {getComputedStyle:function() {}}), + _getComputedStyle = function(e) { + return _computedStyleScope.getComputedStyle(e); //to avoid errors in Microsoft Edge, we need to call getComputedStyle() from a specific scope, typically window. + }, + _getStyle = function(t, p, cs) { + var rv = (t._gsTransform || _empty)[p]; + if (rv || rv === 0) { + return rv; + } else if (t.style[p]) { + rv = t.style[p]; + } else if ((cs = cs || _getComputedStyle(t, null))) { + rv = cs[p] || cs.getPropertyValue(p) || cs.getPropertyValue(p.replace(_capsExp, "-$1").toLowerCase()); + } else if (t.currentStyle) { + rv = t.currentStyle[p]; + } + return parseFloat(rv) || 0; + }, + _ticker = TweenLite.ticker, + VelocityProp = function(p, isFunc, next) { + this.p = p; + this.f = isFunc; + this.v1 = this.v2 = 0; + this.t1 = this.t2 = _ticker.time; + this.css = false; + this.type = ""; + this._prev = null; + if (next) { + this._next = next; + next._prev = this; + } + }, + _update = function() { + var vt = _first, + t = _ticker.time, + val, vp; + //if the frame rate is too high, we won't be able to track the velocity as well, so only update the values about 33 times per second + if (t - _time1 >= 0.03) { + _time2 = _time1; + _time1 = t; + while (vt) { + vp = vt._firstVP; + while (vp) { + val = vp.css ? _getStyle(vt.target, vp.p) : vp.f ? vt.target[vp.p]() : vt.target[vp.p]; + if (val !== vp.v1 || t - vp.t1 > 0.15) { //use a threshold of 0.15 seconds for zeroing-out velocity. If we only use 0.03 and things update slightly slower, like some Android devices dispatch "touchmove" events sluggishly so 2 or 3 ticks of the TweenLite.ticker may elapse inbetween, thus it may appear like the object is not moving but it actually is but it's not updating as frequently. A threshold of 0.15 seconds seems to be a good balance. We want to update things frequently (0.03 seconds) when they're moving so that we can respond to fast motions accurately, but we want to be more resistant to go back to a zero velocity. + vp.v2 = vp.v1; + vp.v1 = val; + vp.t2 = vp.t1; + vp.t1 = t; + } + vp = vp._next; + } + vt = vt._next; + } + } + }, + VelocityTracker = function(target) { + this._lookup = {}; + this.target = target; + this.elem = (target.style && target.nodeType) ? true : false; + if (!_initted) { + _ticker.addEventListener("tick", _update, null, false, -100); + _time1 = _time2 = _ticker.time; + _initted = true; + } + if (_first) { + this._next = _first; + _first._prev = this; + } + _first = this; + }, + getByTarget = VelocityTracker.getByTarget = function(target) { + var vt = _first; + while (vt) { + if (vt.target === target) { + return vt; + } + vt = vt._next; + } + }, + p = VelocityTracker.prototype; + + p.addProp = function(prop, type) { + if (!this._lookup[prop]) { + var t = this.target, + isFunc = (typeof(t[prop]) === "function"), + alt = isFunc ? this._altProp(prop) : prop, + vp = this._firstVP; + this._firstVP = this._lookup[prop] = this._lookup[alt] = vp = new VelocityProp((alt !== prop && prop.indexOf("set") === 0) ? alt : prop, isFunc, vp); + vp.css = (this.elem && (this.target.style[vp.p] !== undefined || _transforms[vp.p])); + if (vp.css && _transforms[vp.p] && !t._gsTransform) { + TweenLite.set(t, {x:"+=0", overwrite:false}); //just forces CSSPlugin to create a _gsTransform for the element if it doesn't exist + } + vp.type = type || (vp.css && prop.indexOf("rotation") === 0) ? "deg" : ""; + vp.v1 = vp.v2 = vp.css ? _getStyle(t, vp.p) : isFunc ? t[vp.p]() : t[vp.p]; + } + }; + + p.removeProp = function(prop) { + var vp = this._lookup[prop]; + if (vp) { + if (vp._prev) { + vp._prev._next = vp._next; + } else if (vp === this._firstVP) { + this._firstVP = vp._next; + } + if (vp._next) { + vp._next._prev = vp._prev; + } + this._lookup[prop] = 0; + if (vp.f) { + this._lookup[this._altProp(prop)] = 0; //if it's a getter/setter, we should remove the matching counterpart (if one exists) + } + } + }; + + p.isTrackingProp = function(prop) { + return (this._lookup[prop] instanceof VelocityProp); + }; + + p.getVelocity = function(prop) { + var vp = this._lookup[prop], + target = this.target, + val, dif, rotationCap; + if (!vp) { + throw "The velocity of " + prop + " is not being tracked."; + } + val = vp.css ? _getStyle(target, vp.p) : vp.f ? target[vp.p]() : target[vp.p]; + dif = (val - vp.v2); + if (vp.type === "rad" || vp.type === "deg") { //rotational values need special interpretation so that if, for example, they go from 179 to -178 degrees it is interpreted as a change of 3 instead of -357. + rotationCap = (vp.type === "rad") ? Math.PI * 2 : 360; + dif = dif % rotationCap; + if (dif !== dif % (rotationCap / 2)) { + dif = (dif < 0) ? dif + rotationCap : dif - rotationCap; + } + } + return dif / (_ticker.time - vp.t2); + }; + + p._altProp = function(p) { //for getters/setters like getCustomProp() and setCustomProp() - we should accommodate both + var pre = p.substr(0, 3), + alt = ((pre === "get") ? "set" : (pre === "set") ? "get" : pre) + p.substr(3); + return (typeof(this.target[alt]) === "function") ? alt : p; + }; + + VelocityTracker.getByTarget = function(target) { + var vt = _first; + if (typeof(target) === "string") { + target = TweenLite.selector(target); + } + if (target.length && target !== window && target[0] && target[0].style && !target.nodeType) { + target = target[0]; + } + while (vt) { + if (vt.target === target) { + return vt; + } + vt = vt._next; + } + }; + + VelocityTracker.track = function(target, props, types) { + var vt = getByTarget(target), + a = props.split(","), + i = a.length; + types = (types || "").split(","); + if (!vt) { + vt = new VelocityTracker(target); + } + while (--i > -1) { + vt.addProp(a[i], types[i] || types[0]); + } + return vt; + }; + + VelocityTracker.untrack = function(target, props) { + var vt = getByTarget(target), + a = (props || "").split(","), + i = a.length; + if (!vt) { + return; + } + while (--i > -1) { + vt.removeProp(a[i]); + } + if (!vt._firstVP || !props) { + if (vt._prev) { + vt._prev._next = vt._next; + } else if (vt === _first) { + _first = vt._next; + } + if (vt._next) { + vt._next._prev = vt._prev; + } + } + }; + + VelocityTracker.isTracking = function(target, prop) { + var vt = getByTarget(target); + return (!vt) ? false : (!prop && vt._firstVP) ? true : vt.isTrackingProp(prop); + }; + + return VelocityTracker; + + }, true); + + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("ThrowPropsPlugin")); /*jslint plusplus: true, vars: true, indent: 2 */ /* convertPointFromPageToNode.js from diff --git a/dist/iwmlib.3rdparty.min.js b/dist/iwmlib.3rdparty.min.js index c894244..547aa6c 100644 --- a/dist/iwmlib.3rdparty.min.js +++ b/dist/iwmlib.3rdparty.min.js @@ -1 +1 @@ -var e;!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(T,e){"use strict";var t=[],S=T.document,n=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,r={},o=r.toString,m=r.hasOwnProperty,a=m.toString,l=a.call(Object),v={},_=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},y=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,noModule:!0};function b(e,t,r){var n,i=(t=t||S).createElement("script");if(i.text=e,r)for(n in c)r[n]&&(i[n]=r[n]);t.head.appendChild(i).parentNode.removeChild(i)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?r[o.call(e)]||"object":typeof e}var M=function(e,t){return new M.fn.init(e,t)},f=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function h(e){var t=!!e&&"length"in e&&e.length,r=x(e);return!_(e)&&!y(e)&&("array"===r||0===t||"number"==typeof t&&0+~]|"+N+")"+N+"*"),H=new RegExp("="+N+"*([^\\]'\"]*?)"+N+"*\\]","g"),Y=new RegExp(B),G=new RegExp("^"+j+"$"),W={ID:new RegExp("^#("+j+")"),CLASS:new RegExp("^\\.("+j+")"),TAG:new RegExp("^("+j+"|[*])"),ATTR:new RegExp("^"+F),PSEUDO:new RegExp("^"+B),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+N+"*(even|odd|(([+-]|)(\\d*)n|)"+N+"*(?:([+-]|)"+N+"*(\\d+)|))"+N+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+N+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+N+"*((?:-\\d)?\\d*)"+N+"*\\)|)(?=[^-]|$)","i")},V=/^(?:input|select|textarea|button)$/i,K=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,Q=new RegExp("\\\\([\\da-f]{1,6}"+N+"?|("+N+")|.)","ig"),ee=function(e,t,r){var n="0x"+t-65536;return n!=n||r?t:n<0?String.fromCharCode(65536+n):String.fromCharCode(n>>10|55296,1023&n|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,re=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},ne=function(){w()},ie=_e(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{R.apply(t=I.call(_.childNodes),_.childNodes),t[_.childNodes.length].nodeType}catch(e){R={apply:t.length?function(e,t){O.apply(e,I.call(t))}:function(e,t){for(var r=e.length,n=0;e[r++]=t[n++];);e.length=r-1}}}function oe(e,t,r,n){var i,o,a,s,u,l,c,f=t&&t.ownerDocument,h=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==h&&9!==h&&11!==h)return r;if(!n&&((t?t.ownerDocument||t:_)!==T&&w(t),t=t||T,S)){if(11!==h&&(u=J.exec(e)))if(i=u[1]){if(9===h){if(!(a=t.getElementById(i)))return r;if(a.id===i)return r.push(a),r}else if(f&&(a=f.getElementById(i))&&v(t,a)&&a.id===i)return r.push(a),r}else{if(u[2])return R.apply(r,t.getElementsByTagName(e)),r;if((i=u[3])&&d.getElementsByClassName&&t.getElementsByClassName)return R.apply(r,t.getElementsByClassName(i)),r}if(d.qsa&&!C[e+" "]&&(!m||!m.test(e))){if(1!==h)f=t,c=e;else if("object"!==t.nodeName.toLowerCase()){for((s=t.getAttribute("id"))?s=s.replace(te,re):t.setAttribute("id",s=M),o=(l=p(e)).length;o--;)l[o]="#"+s+" "+ve(l[o]);c=l.join(","),f=$.test(e)&&ge(t.parentNode)||t}if(c)try{return R.apply(r,f.querySelectorAll(c)),r}catch(e){}finally{s===M&&t.removeAttribute("id")}}}return g(e.replace(U,"$1"),t,r,n)}function ae(){var n=[];return function e(t,r){return n.push(t+" ")>b.cacheLength&&delete e[n.shift()],e[t+" "]=r}}function se(e){return e[M]=!0,e}function ue(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){for(var r=e.split("|"),n=r.length;n--;)b.attrHandle[r[n]]=t}function ce(e,t){var r=t&&e,n=r&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(n)return n;if(r)for(;r=r.nextSibling;)if(r===t)return-1;return e?1:-1}function fe(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(r){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===r}}function de(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ie(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function pe(a){return se(function(o){return o=+o,se(function(e,t){for(var r,n=a([],e.length,o),i=n.length;i--;)e[r=n[i]]&&(e[r]=!(t[r]=e[r]))})})}function ge(e){return e&&void 0!==e.getElementsByTagName&&e}for(e in d=oe.support={},i=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},w=oe.setDocument=function(e){var t,r,n=e?e.ownerDocument||e:_;return n!==T&&9===n.nodeType&&n.documentElement&&(a=(T=n).documentElement,S=!i(T),_!==T&&(r=T.defaultView)&&r.top!==r&&(r.addEventListener?r.addEventListener("unload",ne,!1):r.attachEvent&&r.attachEvent("onunload",ne)),d.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ue(function(e){return e.appendChild(T.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=Z.test(T.getElementsByClassName),d.getById=ue(function(e){return a.appendChild(e).id=M,!T.getElementsByName||!T.getElementsByName(M).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(Q,ee);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if(void 0!==t.getElementById&&S){var r=t.getElementById(e);return r?[r]:[]}}):(b.filter.ID=function(e){var r=e.replace(Q,ee);return function(e){var t=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===r}},b.find.ID=function(e,t){if(void 0!==t.getElementById&&S){var r,n,i,o=t.getElementById(e);if(o){if((r=o.getAttributeNode("id"))&&r.value===e)return[o];for(i=t.getElementsByName(e),n=0;o=i[n++];)if((r=o.getAttributeNode("id"))&&r.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var r,n=[],i=0,o=t.getElementsByTagName(e);if("*"!==e)return o;for(;r=o[i++];)1===r.nodeType&&n.push(r);return n},b.find.CLASS=d.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&S)return t.getElementsByClassName(e)},s=[],m=[],(d.qsa=Z.test(T.querySelectorAll))&&(ue(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+N+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+N+"*(?:value|"+L+")"),e.querySelectorAll("[id~="+M+"-]").length||m.push("~="),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+M+"+*").length||m.push(".#.+[+~]")}),ue(function(e){e.innerHTML="";var t=T.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+N+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&m.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:")})),(d.matchesSelector=Z.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ue(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",B)}),m=m.length&&new RegExp(m.join("|")),s=s.length&&new RegExp(s.join("|")),t=Z.test(a.compareDocumentPosition),v=t||Z.test(a.contains)?function(e,t){var r=9===e.nodeType?e.documentElement:e,n=t&&t.parentNode;return e===n||!(!n||1!==n.nodeType||!(r.contains?r.contains(n):e.compareDocumentPosition&&16&e.compareDocumentPosition(n)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},k=t?function(e,t){if(e===t)return l=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===r?e===T||e.ownerDocument===_&&v(_,e)?-1:t===T||t.ownerDocument===_&&v(_,t)?1:u?D(u,e)-D(u,t):0:4&r?-1:1)}:function(e,t){if(e===t)return l=!0,0;var r,n=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===T?-1:t===T?1:i?-1:o?1:u?D(u,e)-D(u,t):0;if(i===o)return ce(e,t);for(r=e;r=r.parentNode;)a.unshift(r);for(r=t;r=r.parentNode;)s.unshift(r);for(;a[n]===s[n];)n++;return n?ce(a[n],s[n]):a[n]===_?-1:s[n]===_?1:0}),T},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==T&&w(e),t=t.replace(H,"='$1']"),d.matchesSelector&&S&&!C[t+" "]&&(!s||!s.test(t))&&(!m||!m.test(t)))try{var r=c.call(e,t);if(r||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Q,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Q,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,r=!e[6]&&e[2];return W.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":r&&Y.test(r)&&(t=p(r,!0))&&(t=r.indexOf(")",r.length-t)-r.length)&&(e[0]=e[0].slice(0,t),e[2]=r.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Q,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=h[e+" "];return t||(t=new RegExp("(^|"+N+")"+e+"("+N+"|$)"))&&h(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(r,n,i){return function(e){var t=oe.attr(e,r);return null==t?"!="===n:!n||(t+="","="===n?t===i:"!="===n?t!==i:"^="===n?i&&0===t.indexOf(i):"*="===n?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function E(e,r,n){return _(r)?M.grep(e,function(e,t){return!!r.call(e,t,e)!==n}):r.nodeType?M.grep(e,function(e){return e===r!==n}):"string"!=typeof r?M.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(M.fn.init=function(e,t,r){var n,i;if(!e)return this;if(r=r||A,"string"!=typeof e)return e.nodeType?(this[0]=e,this.length=1,this):_(e)?void 0!==r.ready?r.ready(e):e(M):M.makeArray(e,this);if(!(n="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:O.exec(e))||!n[1]&&t)return!t||t.jquery?(t||r).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof M?t[0]:t,M.merge(this,M.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:S,!0)),k.test(n[1])&&M.isPlainObject(t))for(n in t)_(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}return(i=S.getElementById(n[2]))&&(this[0]=i,this.length=1),this}).prototype=M.fn,A=M(S);var R=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};function D(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}M.fn.extend({has:function(e){var t=M(e,this),r=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]+)/i,ce=/^$|^module$|\/(?:java|ecma)script/i,fe={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function he(e,t){var r;return r=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&C(e,t)?M.merge([e],r):r}function de(e,t){for(var r=0,n=e.length;rx",v.noCloneChecked=!!pe.cloneNode(!0).lastChild.defaultValue;var _e=S.documentElement,ye=/^key/,be=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,xe=/^([^.]*)(?:\.(.+)|)/;function we(){return!0}function Te(){return!1}function Se(){try{return S.activeElement}catch(e){}}function Me(e,t,r,n,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof r&&(n=n||r,r=void 0),t)Me(e,s,r,n,t[s],o);return e}if(null==n&&null==i?(i=r,n=r=void 0):null==i&&("string"==typeof r?(i=n,n=void 0):(i=n,n=r,r=void 0)),!1===i)i=Te;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return M().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=M.guid++)),e.each(function(){M.event.add(this,t,i,n,r)})}M.event={global:{},add:function(t,e,r,n,i){var o,a,s,u,l,c,f,h,d,p,g,m=K.get(t);if(m)for(r.handler&&(r=(o=r).handler,i=o.selector),i&&M.find.matchesSelector(_e,i),r.guid||(r.guid=M.guid++),(u=m.events)||(u=m.events={}),(a=m.handle)||(a=m.handle=function(e){return void 0!==M&&M.event.triggered!==e.type?M.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(L)||[""]).length;l--;)d=g=(s=xe.exec(e[l])||[])[1],p=(s[2]||"").split(".").sort(),d&&(f=M.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=M.event.special[d]||{},c=M.extend({type:d,origType:g,data:n,handler:r,guid:r.guid,selector:i,needsContext:i&&M.expr.match.needsContext.test(i),namespace:p.join(".")},o),(h=u[d])||((h=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,n,p,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=r.guid)),i?h.splice(h.delegateCount++,0,c):h.push(c),M.event.global[d]=!0)},remove:function(e,t,r,n,i){var o,a,s,u,l,c,f,h,d,p,g,m=K.hasData(e)&&K.get(e);if(m&&(u=m.events)){for(l=(t=(t||"").match(L)||[""]).length;l--;)if(d=g=(s=xe.exec(t[l])||[])[1],p=(s[2]||"").split(".").sort(),d){for(f=M.event.special[d]||{},h=u[d=(n?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=h.length;o--;)c=h[o],!i&&g!==c.origType||r&&r.guid!==c.guid||s&&!s.test(c.namespace)||n&&n!==c.selector&&("**"!==n||!c.selector)||(h.splice(o,1),c.selector&&h.delegateCount--,f.remove&&f.remove.call(e,c));a&&!h.length&&(f.teardown&&!1!==f.teardown.call(e,p,m.handle)||M.removeEvent(e,d,m.handle),delete u[d])}else for(d in u)M.event.remove(e,d+t[l],r,n,!0);M.isEmptyObject(u)&&K.remove(e,"handle events")}},dispatch:function(e){var t,r,n,i,o,a,s=M.event.fix(e),u=new Array(arguments.length),l=(K.get(this,"events")||{})[s.type]||[],c=M.event.special[s.type]||{};for(u[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,Ce=/\s*$/g;function Ae(e,t){return C(e,"table")&&C(11!==t.nodeType?t:t.firstChild,"tr")&&M(e).children("tbody")[0]||e}function Oe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Ie(e,t){var r,n,i,o,a,s,u,l;if(1===t.nodeType){if(K.hasData(e)&&(o=K.access(e),a=K.set(t,o),l=o.events))for(i in delete a.handle,a.events={},l)for(r=0,n=l[i].length;r")},clone:function(e,t,r){var n,i,o,a,s,u,l,c=e.cloneNode(!0),f=M.contains(e.ownerDocument,e);if(!(v.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||M.isXMLDoc(e)))for(a=he(c),n=0,i=(o=he(e)).length;n").prop({charset:r.scriptCharset,src:r.url}).on("load error",i=function(e){n.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),S.head.appendChild(n[0])},abort:function(){i&&i()}}});var Xt,qt=[],Ht=/(=)\?(?=&|$)|\?\?/;M.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=qt.pop()||M.expando+"_"+bt++;return this[e]=!0,e}}),M.ajaxPrefilter("json jsonp",function(e,t,r){var n,i,o,a=!1!==e.jsonp&&(Ht.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ht.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return n=e.jsonpCallback=_(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ht,"$1"+n):!1!==e.jsonp&&(e.url+=(xt.test(e.url)?"&":"?")+e.jsonp+"="+n),e.converters["script json"]=function(){return o||M.error(n+" was not called"),o[0]},e.dataTypes[0]="json",i=T[n],T[n]=function(){o=arguments},r.always(function(){void 0===i?M(T).removeProp(n):T[n]=i,e[n]&&(e.jsonpCallback=t.jsonpCallback,qt.push(n)),o&&_(i)&&i(o[0]),o=i=void 0}),"script"}),v.createHTMLDocument=((Xt=S.implementation.createHTMLDocument("").body).innerHTML="
",2===Xt.childNodes.length),M.parseHTML=function(e,t,r){return"string"!=typeof e?[]:("boolean"==typeof t&&(r=t,t=!1),t||(v.createHTMLDocument?((n=(t=S.implementation.createHTMLDocument("")).createElement("base")).href=S.location.href,t.head.appendChild(n)):t=S),o=!r&&[],(i=k.exec(e))?[t.createElement(i[1])]:(i=ve([e],t,o),o&&o.length&&M(o).remove(),M.merge([],i.childNodes)));var n,i,o},M.fn.load=function(e,t,r){var n,i,o,a=this,s=e.indexOf(" ");return-1").append(M.parseHTML(e)).find(n):e)}).always(r&&function(e,t){a.each(function(){r.apply(this,o||[e.responseText,t,e])})}),this},M.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){M.fn[t]=function(e){return this.on(t,e)}}),M.expr.pseudos.animated=function(t){return M.grep(M.timers,function(e){return t===e.elem}).length},M.offset={setOffset:function(e,t,r){var n,i,o,a,s,u,l=M.css(e,"position"),c=M(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=M.css(e,"top"),u=M.css(e,"left"),i=("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(n=c.position()).top,n.left):(a=parseFloat(o)||0,parseFloat(u)||0),_(t)&&(t=t.call(e,r,M.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},M.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){M.offset.setOffset(this,t,e)});var e,r,n=this[0];return n?n.getClientRects().length?(e=n.getBoundingClientRect(),r=n.ownerDocument.defaultView,{top:e.top+r.pageYOffset,left:e.left+r.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,r,n=this[0],i={top:0,left:0};if("fixed"===M.css(n,"position"))t=n.getBoundingClientRect();else{for(t=this.offset(),r=n.ownerDocument,e=n.offsetParent||r.documentElement;e&&(e===r.body||e===r.documentElement)&&"static"===M.css(e,"position");)e=e.parentNode;e&&e!==n&&1===e.nodeType&&((i=M(e).offset()).top+=M.css(e,"borderTopWidth",!0),i.left+=M.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-M.css(n,"marginTop",!0),left:t.left-i.left-M.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===M.css(e,"position");)e=e.offsetParent;return e||_e})}}),M.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;M.fn[t]=function(e){return X(this,function(e,t,r){var n;if(y(e)?n=e:9===e.nodeType&&(n=e.defaultView),void 0===r)return n?n[i]:e[t];n?n.scrollTo(o?n.pageXOffset:r,o?r:n.pageYOffset):e[t]=r},t,e,arguments.length)}}),M.each(["top","left"],function(e,r){M.cssHooks[r]=ze(v.pixelPosition,function(e,t){if(t)return t=Be(e,r),Ne.test(t)?M(e).position()[r]+"px":t})}),M.each({Height:"height",Width:"width"},function(a,s){M.each({padding:"inner"+a,content:s,"":"outer"+a},function(n,o){M.fn[o]=function(e,t){var r=arguments.length&&(n||"boolean"!=typeof e),i=n||(!0===e||!0===t?"margin":"border");return X(this,function(e,t,r){var n;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(n=e.documentElement,Math.max(e.body["scroll"+a],n["scroll"+a],e.body["offset"+a],n["offset"+a],n["client"+a])):void 0===r?M.css(e,t,i):M.style(e,t,r,i)},s,r?e:void 0,r)}})}),M.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,r){M.fn[r]=function(e,t){return 0@~]/g,"\\$&").replace(/\n/g,"A")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCommonAncestor=function(e){var t=(1 /g,">").split(/\s+(?=(?:(?:[^"]*"){2})*[^"]*$)/);if(n.length<2)return h("",e,"",t);var i=[n.pop()];for(;1/g,"> ").trim()};var n,i=r(3),c=(n=i)&&n.__esModule?n:{default:n},f=r(0);function h(r,n,i,o){if(r.length&&(r+=" "),i.length&&(i=" "+i),/\[*\]/.test(n)){var e=n.replace(/=.*$/,"]"),a=""+r+e+i;if(m(document.querySelectorAll(a),o))n=e;else for(var s=document.querySelectorAll(""+r+e),t=function(){var t=s[u];if(o.some(function(e){return t.contains(e)})){var e=t.tagName.toLowerCase();return a=""+r+e+i,m(document.querySelectorAll(a),o)&&(n=e),"break"}},u=0,l=s.length;u/.test(n)){var c=n.replace(/>/,"");a=""+r+c+i;m(document.querySelectorAll(a),o)&&(n=c)}if(/:nth-child/.test(n)){var f=n.replace(/nth-child/g,"nth-of-type");a=""+r+f+i;m(document.querySelectorAll(a),o)&&(n=f)}if(/\.\S+\.\S+/.test(n)){for(var h=n.trim().split(".").slice(1).map(function(e){return"."+e}).sort(function(e,t){return e.length-t.length});h.length;){var d=n.replace(h.shift(),"").trim();if(!(a=(""+r+d+i).trim()).length||">"===a.charAt(0)||">"===a.charAt(a.length-1))break;m(document.querySelectorAll(a),o)&&(n=d)}if((h=n&&n.match(/\./g))&&2/.test(s):l=function(t){return function(e){return e(t.parent)&&t.parent}};break;case/^\./.test(s):var r=s.substr(1).split(".");u=function(e){var t=e.attribs.class;return t&&r.every(function(e){return-1)(\S)/g,"$1 $2").trim()),t=n.shift(),i=n.length;return t(this).filter(function(e){for(var t=0;t\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=o.console&&(o.console.warn||o.console.log);return r&&r.call(o.console,i,t),n.apply(this,arguments)}}a="function"!=typeof Object.assign?function(e){if(e===f||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1;rt[r]}):n.sort()),n}function E(e,t){for(var r,n,i=t[0].toUpperCase()+t.slice(1),o=0;oh(l.y)?l.x:l.y,t.scale=a?function(e,t){return ne(t[0],t[1],Z)/ne(e[0],e[1],Z)}(a.pointers,n):1,t.rotation=a?function(e,t){return ie(t[1],t[0],Z)+ie(e[1],e[0],Z)}(a.pointers,n):0,t.maxPointers=r.prevInput?t.pointers.length>r.prevInput.maxPointers?t.pointers.length:r.prevInput.maxPointers:t.pointers.length,function(e,t){var r,n,i,o,a=e.lastInterval||t,s=t.timeStamp-a.timeStamp;if(t.eventType!=z&&(jh(c.y)?c.x:c.y,o=re(u,l),e.lastInterval=t}else r=a.velocity,n=a.velocityX,i=a.velocityY,o=a.direction;t.velocity=r,t.velocityX=n,t.velocityY=i,t.direction=o}(r,t);var c=e.element;T(t.srcEvent.target,c)&&(c=t.srcEvent.target);t.target=c}(e,r),e.emit("hammer.input",r),e.recognize(r),e.session.prevInput=r}function Q(e){for(var t=[],r=0;r=h(t)?e<0?X:q:t<0?H:Y}function ne(e,t,r){r||(r=K);var n=t[r[0]]-e[r[0]],i=t[r[1]]-e[r[1]];return Math.sqrt(n*n+i*i)}function ie(e,t,r){r||(r=K);var n=t[r[0]]-e[r[0]],i=t[r[1]]-e[r[1]];return 180*Math.atan2(i,n)/Math.PI}J.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(O(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(O(this.element),this.evWin,this.domHandler)}};var oe={mousedown:F,mousemove:2,mouseup:B},ae="mousedown",se="mousemove mouseup";function ue(){this.evEl=ae,this.evWin=se,this.pressed=!1,J.apply(this,arguments)}v(ue,J,{handler:function(e){var t=oe[e.type];t&F&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=B),this.pressed&&(t&B&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:N,srcEvent:e}))}});var le={pointerdown:F,pointermove:2,pointerup:B,pointercancel:z,pointerout:z},ce={2:L,3:"pen",4:N,5:"kinect"},fe="pointerdown",he="pointermove pointerup pointercancel";function de(){this.evEl=fe,this.evWin=he,J.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}o.MSPointerEvent&&!o.PointerEvent&&(fe="MSPointerDown",he="MSPointerMove MSPointerUp MSPointerCancel"),v(de,J,{handler:function(e){var t=this.store,r=!1,n=e.type.toLowerCase().replace("ms",""),i=le[n],o=ce[e.pointerType]||e.pointerType,a=o==L,s=P(t,e.pointerId,"pointerId");i&F&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):i&(B|z)&&(r=!0),s<0||(t[s]=e,this.callback(this.manager,i,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),r&&t.splice(s,1))}});var pe={touchstart:F,touchmove:2,touchend:B,touchcancel:z};function ge(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,J.apply(this,arguments)}v(ge,J,{handler:function(e){var t=pe[e.type];if(t===F&&(this.started=!0),this.started){var r=function(e,t){var r=C(e.touches),n=C(e.changedTouches);t&(B|z)&&(r=k(r.concat(n),"identifier",!0));return[r,n]}.call(this,e,t);t&(B|z)&&r[0].length-r[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:r[0],changedPointers:r[1],pointerType:L,srcEvent:e})}}});var me={touchstart:F,touchmove:2,touchend:B,touchcancel:z},ve="touchstart touchmove touchend touchcancel";function _e(){this.evTarget=ve,this.targetIds={},J.apply(this,arguments)}v(_e,J,{handler:function(e){var t=me[e.type],r=function(e,t){var r=C(e.touches),n=this.targetIds;if(t&(2|F)&&1===r.length)return n[r[0].identifier]=!0,[r,r];var i,o,a=C(e.changedTouches),s=[],u=this.target;if(o=r.filter(function(e){return T(e.target,u)}),t===F)for(i=0;it.threshold&&i&t.direction},attrTest:function(e){return Ne.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=De(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),v(Fe,Ne,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Pe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),v(Be,Re,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return["auto"]},process:function(e){var t=this.options,r=e.pointers.length===t.pointers,n=e.distancet.time;if(this._input=e,!n||!r||e.eventType&(B|z)&&!i)this.reset();else if(e.eventType&F)this.reset(),this._timer=l(function(){this.state=8,this.tryEmit()},t.time,this);else if(e.eventType&B)return 8;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&B?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=d(),this.manager.emit(this.options.event,this._input)))}}),v(ze,Ne,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Pe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),v(Ue,Ne,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:G|W,pointers:1},getTouchAction:function(){return je.prototype.getTouchAction.call(this)},attrTest:function(e){var t,r=this.options.direction;return r&(G|W)?t=e.overallVelocity:r&G?t=e.overallVelocityX:r&W&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&r&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&h(t)>this.options.velocity&&e.eventType&B},emit:function(e){var t=De(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),v(Xe,Re,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Me]},process:function(e){var t=this.options,r=e.pointers.length===t.pointers,n=e.distance>>1;o(e[i],t)<0?r=1+i:n=i}return r},right:function(e,t,r,n){for(null==r&&(r=0),null==n&&(n=e.length);r>>1;0>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):(t=it.exec(e))?dt(parseInt(t[1],16)):(t=ot.exec(e))?new vt(t[1],t[2],t[3],1):(t=at.exec(e))?new vt(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=st.exec(e))?pt(t[1],t[2],t[3],t[4]):(t=ut.exec(e))?pt(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=lt.exec(e))?yt(t[1],t[2]/100,t[3]/100,1):(t=ct.exec(e))?yt(t[1],t[2]/100,t[3]/100,t[4]):ft.hasOwnProperty(e)?dt(ft[e]):"transparent"===e?new vt(NaN,NaN,NaN,0):null}function dt(e){return new vt(e>>16&255,e>>8&255,255&e,1)}function pt(e,t,r,n){return n<=0&&(e=t=r=NaN),new vt(e,t,r,n)}function gt(e){return e instanceof $e||(e=ht(e)),e?new vt((e=e.rgb()).r,e.g,e.b,e.opacity):new vt}function mt(e,t,r,n){return 1===arguments.length?gt(e):new vt(e,t,r,null==n?1:n)}function vt(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function _t(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function yt(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||1<=r?e=t=NaN:t<=0&&(e=NaN),new xt(e,t,r,n)}function bt(e,t,r,n){return 1===arguments.length?function(e){if(e instanceof xt)return new xt(e.h,e.s,e.l,e.opacity);if(e instanceof $e||(e=ht(e)),!e)return new xt;if(e instanceof xt)return e;var t=(e=e.rgb()).r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),o=Math.max(t,r,n),a=NaN,s=o-i,u=(o+i)/2;return s?(a=t===o?(r-n)/s+6*(ro&&(i=n.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(t=t[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:fr(t,r)})),o=pr.lastIndex;return or._time&&(n=r._time),(e=r)._next):(t=r._next,r._next=null,e?e._next=t:qr=t);Hr=e,un(n)}(),Zr=0}}function sn(){var e=$r.now(),t=e-Kr;Vrhn)throw new Error("too late; already scheduled");return r}function xn(e,t){var r=wn(e,t);if(r.state>gn)throw new Error("too late; already running");return r}function wn(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function Tn(e,t){var r,n,i,o=e.__transition,a=!0;if(o){for(i in t=null==t?null:t+"",o)(r=o[i]).name===t?(n=r.state>pn&&r.stateMath.abs(e[1]-C[1])?d=!0:h=!0),C=e,f=!0,pi(),I()}function I(){var e;switch(l=C[0]-P[0],c=C[1]-P[1],m){case mi:case gi:v&&(l=Math.max(x-t,Math.min(T-o,l)),r=t+l,a=o+l),_&&(c=Math.max(w-n,Math.min(S-s,c)),i=n+c,u=s+c);break;case vi:v<0?(l=Math.max(x-t,Math.min(T-t,l)),r=t+l,a=o):0=t,ho[n<<1].forEach(a);for(;++u=t,ho[r|n<<1].forEach(a);ho[n<<0].forEach(a);for(;++l=t,i=e[l*h]>=t,ho[n<<1|i<<2].forEach(a);++u=t,o=i,i=e[l*h+u+1]>=t,ho[r|n<<1|i<<2|o<<3].forEach(a);ho[n|i<<3].forEach(a)}u=-1,i=e[l*h]>=t,ho[i<<2].forEach(a);for(;++u=t,ho[i<<2|o<<3].forEach(a);function a(e){var t,r,n=[e[0][0]+u,e[0][1]+l],i=[e[1][0]+u,e[1][1]+l],o=p(n),a=p(i);(t=f[o])?(r=c[a])?(delete f[t.end],delete c[r.start],t===r?(t.ring.push(i),s(t.ring)):c[t.start]=f[r.end]={start:t.start,end:r.end,ring:t.ring.concat(r.ring)}):(delete f[t.end],t.ring.push(i),f[t.end=a]=t):(t=c[a])?(r=f[o])?(delete c[t.start],delete f[r.end],t===r?(t.ring.push(i),s(t.ring)):c[r.start]=f[t.end]={start:r.start,end:t.end,ring:r.ring.concat(t.ring)}):(delete c[t.start],t.ring.unshift(n),c[t.start=o]=t):c[o]=f[a]={start:o,end:a,ring:[n,i]}}ho[i<<3].forEach(a)}(t,r,function(e){a(e,t,r),0=i?s=!0:(t=n.charCodeAt(o++))===To?u=!0:t===So&&(u=!0,n.charCodeAt(o)===To&&++o),n.slice(r+1,e-1).replace(/""/g,'"')}for(;o=(o=(g+v)/2))?g=o:v=o,(c=r>=(a=(m+_)/2))?m=a:_=a,!(d=(i=d)[f=c<<1|l]))return i[f]=p,e;if(s=+e._x.call(null,d.data),u=+e._y.call(null,d.data),t===s&&r===u)return p.next=d,i?i[f]=p:e._root=p,e;for(;i=i?i[f]=new Array(4):e._root=new Array(4),(l=t>=(o=(g+v)/2))?g=o:v=o,(c=r>=(a=(m+_)/2))?m=a:_=a,(f=c<<1|l)==(h=(a<=u)<<1|o<=s););return i[h]=d,i[f]=p,e}function na(e,t,r,n,i){this.node=e,this.x0=t,this.y0=r,this.x1=n,this.y1=i}function ia(e){return e[0]}function oa(e){return e[1]}function aa(e,t,r){var n=new sa(null==t?ia:t,null==r?oa:r,NaN,NaN,NaN,NaN);return null==e?n:n.addAll(e)}function sa(e,t,r,n,i,o){this._x=e,this._y=t,this._x0=r,this._y0=n,this._x1=i,this._y1=o,this._root=void 0}function ua(e){for(var t={data:e.data},r=t;e=e.next;)r=r.next={data:e.data};return t}var la=aa.prototype=sa.prototype;function ca(e){return e.x+e.vx}function fa(e){return e.y+e.vy}function ha(e){return e.index}function da(e,t){var r=e.get(t);if(!r)throw new Error("missing: "+t);return r}function pa(e){return e.x}function ga(e){return e.y}la.copy=function(){var e,t,r=new sa(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=ua(n),r;for(e=[{source:n,target:r._root=new Array(4)}];n=e.pop();)for(var i=0;i<4;++i)(t=n.source[i])&&(t.length?e.push({source:t,target:n.target[i]=new Array(4)}):n.target[i]=ua(t));return r},la.add=function(e){var t=+this._x.call(null,e),r=+this._y.call(null,e);return ra(this.cover(t,r),t,r,e)},la.addAll=function(e){var t,r,n,i,o=e.length,a=new Array(o),s=new Array(o),u=1/0,l=1/0,c=-1/0,f=-1/0;for(r=0;rh||(o=u.y0)>d||(a=u.x1)=(s=(p+m)/2))?p=s:m=s,(c=a>=(u=(g+v)/2))?g=u:v=u,!(d=(t=d)[f=c<<1|l]))return this;if(!d.length)break;(t[f+1&3]||t[f+2&3]||t[f+3&3])&&(r=t,h=f)}for(;d.data!==e;)if(!(d=(n=d).next))return this;return(i=d.next)&&delete d.next,n?i?n.next=i:delete n.next:t?(i?t[f]=i:delete t[f],(d=t[0]||t[1]||t[2]||t[3])&&d===(t[3]||t[2]||t[1]||t[0])&&!d.length&&(r?r[h]=d:this._root=d)):this._root=i,this},la.removeAll=function(e){for(var t=0,r=e.length;t=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xa(e){return new wa(e)}function wa(e){if(!(t=ba.exec(e)))throw new Error("invalid format: "+e);var t;this.fill=t[1]||" ",this.align=t[2]||">",this.sign=t[3]||"-",this.symbol=t[4]||"",this.zero=!!t[5],this.width=t[6]&&+t[6],this.comma=!!t[7],this.precision=t[8]&&+t[8].slice(1),this.trim=!!t[9],this.type=t[10]||""}function Ta(e,t){var r=va(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}xa.prototype=wa.prototype,wa.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Sa={"%":function(e,t){return(100*e).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:function(e){return Math.round(e).toString(10)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return Ta(100*e,t)},r:Ta,s:function(e,t){var r=va(e,t);if(!r)return e+"";var n=r[0],i=r[1],o=i-(ya=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=n.length;return o===a?n:at));)o=s[i=(i+1)%s.length];return n.reverse().join(u)}}(e.grouping,e.thousands):Ma,n=e.currency,T=e.decimal,S=e.numerals?function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(e.numerals):Ma,i=e.percent||"%";function a(e){var l=(e=xa(e)).fill,c=e.align,f=e.sign,t=e.symbol,h=e.zero,d=e.width,p=e.comma,g=e.precision,m=e.trim,v=e.type;"n"===v?(p=!0,v="g"):Sa[v]||(null==g&&(g=12),m=!0,v="g"),(h||"0"===l&&"="===c)&&(h=!0,l="0",c="=");var _="$"===t?n[0]:"#"===t&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",y="$"===t?n[1]:/[%p]/.test(v)?i:"",b=Sa[v],x=/[defgprs%]/.test(v);function r(e){var t,r,n,i=_,o=y;if("c"===v)o=b(e)+o,e="";else{var a=(e=+e)<0;if(e=b(Math.abs(e),g),m&&(e=function(e){e:for(var t,r=e.length,n=1,i=-1;n>1)+i+e+o+u.slice(s);break;default:e=u+i+e+o}return S(e)}return g=null==g?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),r.toString=function(){return e+""},r}return{format:a,formatPrefix:function(e,t){var r=a(((e=xa(e)).type="f",e)),n=3*Math.max(-8,Math.min(8,Math.floor(_a(t)/3))),i=Math.pow(10,-n),o=Ca[8+n/3];return function(e){return r(i*e)+o}}}}function Ea(e){return Pa=ka(e),z.format=Pa.format,z.formatPrefix=Pa.formatPrefix,Pa}function Aa(e){return Math.max(0,-_a(Math.abs(e)))}function Oa(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(_a(t)/3)))-_a(Math.abs(e)))}function Ra(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,_a(t)-_a(e))+1}function Ia(){return new Da}function Da(){this.reset()}Ea({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),Da.prototype={constructor:Da,reset:function(){this.s=this.t=0},add:function(e){Na(La,e,this.t),Na(this,La.s,this.s),this.s?this.t+=La.t:this.s=La.t},valueOf:function(){return this.s}};var La=new Da;function Na(e,t,r){var n=e.s=t+r,i=n-t,o=n-i;e.t=t-o+(r-i)}var ja=1e-6,Fa=Math.PI,Ba=Fa/2,za=Fa/4,Ua=2*Fa,Xa=180/Fa,qa=Fa/180,Ha=Math.abs,Ya=Math.atan,Ga=Math.atan2,Wa=Math.cos,Va=Math.ceil,Ka=Math.exp,Za=Math.log,Ja=Math.pow,$a=Math.sin,Qa=Math.sign||function(e){return 0hu(Os,Is)&&(Is=e):hu(e,Is)>hu(Os,Is)&&(Os=e):Os<=Is?(ehu(Os,Is)&&(Is=e):hu(e,Is)>hu(Os,Is)&&(Os=e)}else Bs.push(zs=[Os=e,Is=e]);tja&&(Os=-(Is=180)),zs[0]=Os,zs[1]=Is,Fs=null}function hu(e,t){return(t-=e)<0?t+360:t}function du(e,t){return e[0]-t[0]}function pu(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tFa?e+Math.round(-e/Ua)*Ua:e,t]}function Eu(e,t,r){return(e%=Ua)?t||r?Cu(Ou(e),Ru(t,r)):Ou(e):t||r?Ru(t,r):ku}function Au(r){return function(e,t){return[Fa<(e+=r)?e-Ua:e<-Fa?e+Ua:e,t]}}function Ou(e){var t=Au(e);return t.invert=Au(-e),t}function Ru(e,t){var s=Wa(e),u=$a(e),l=Wa(t),c=$a(t);function r(e,t){var r=Wa(t),n=Wa(e)*r,i=$a(e)*r,o=$a(t),a=o*s+n*u;return[Ga(i*l-a*c,n*s-o*u),ns(a*l+i*c)]}return r.invert=function(e,t){var r=Wa(t),n=Wa(e)*r,i=$a(e)*r,o=$a(t),a=o*l-i*c;return[Ga(i*l+o*c,n*s+a*u),ns(a*s-n*u)]},r}function Iu(t){function e(e){return(e=t(e[0]*qa,e[1]*qa))[0]*=Xa,e[1]*=Xa,e}return t=Eu(t[0]*qa,t[1]*qa,2ja?Ya(($a(t)*(o=Wa(n))*$a(r)-$a(n)*(i=Wa(t))*$a(e))/(i*o*a)):(t+n)/2}(a,s,e,t),i.point(u,s),i.lineEnd(),i.lineStart(),i.point(r,s),o=0),i.point(a=e,s=t),u=r},lineEnd:function(){i.lineEnd(),a=s=NaN},clean:function(){return 2-o}}},function(e,t,r,n){var i;if(null==e)i=r*Ba,n.point(-Fa,i),n.point(0,i),n.point(Fa,i),n.point(Fa,0),n.point(Fa,-i),n.point(0,-i),n.point(-Fa,-i),n.point(-Fa,0),n.point(-Fa,i);else if(Ha(e[0]-t[0])>ja){var o=e[0]ja;function g(e,t){return Wa(e)*Wa(t)>P}function m(e,t,r){var n=[1,0,0],i=Cs(Ms(e),Ms(t)),o=Ps(i,i),a=i[0],s=o-a*a;if(!s)return!r&&e;var u=P*o/s,l=-P*a/s,c=Cs(n,i),f=Es(n,u);ks(f,Es(i,l));var h=c,d=Ps(f,h),p=Ps(h,h),g=d*d-p*(Ps(f,f)-1);if(!(g<0)){var m=es(g),v=Es(h,(-d-m)/p);if(ks(v,f),v=Ss(v),!r)return v;var _,y=e[0],b=t[0],x=e[1],w=t[1];bja}).map(l)).concat(M(Va(a/p)*p,o,p).filter(function(e){return Ha(e%m)>ja}).map(c))}return _.lines=function(){return e().map(function(e){return{type:"LineString",coordinates:e}})},_.outline=function(){return{type:"Polygon",coordinates:[f(i).concat(h(s).slice(1),f(n).reverse().slice(1),h(u).reverse().slice(1))]}},_.extent=function(e){return arguments.length?_.extentMajor(e).extentMinor(e):_.extentMinor()},_.extentMajor=function(e){return arguments.length?(i=+e[0][0],n=+e[1][0],u=+e[0][1],s=+e[1][1],nja&&0<--i);return[e/(.8707+(o=n*n)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),n]},tf.invert=jc(ns),rf.invert=jc(function(e){return 2*Ya(e)}),nf.invert=function(e,t){return[-t,2*Ya(Ka(e))-Ba]},df.prototype=lf.prototype={constructor:df,count:function(){return this.eachAfter(uf)},each:function(e){var t,r,n,i,o=this,a=[o];do{for(t=a.reverse(),a=[];o=t.pop();)if(e(o),r=o.children)for(n=0,i=r.length;ntv){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,u=3*e._l01_a*(e._l01_a+e._l12_a);n=(n*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/u,i=(i*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/u}if(e._l23_a>tv){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,c=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*l+e._x1*e._l23_2a-t*e._l12_2a)/c,a=(a*l+e._y1*e._l23_2a-r*e._l12_2a)/c}e._context.bezierCurveTo(n,i,o,a,e._x2,e._y2)}function h_(e,t){this._context=e,this._alpha=t}h_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:f_(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var d_=function t(r){function e(e){return r?new h_(e,r):new o_(e,0)}return e.alpha=function(e){return t(+e)},e}(.5);function p_(e,t){this._context=e,this._alpha=t}p_.prototype={areaStart:Jv,areaEnd:Jv,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:f_(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var g_=function t(r){function e(e){return r?new p_(e,r):new s_(e,0)}return e.alpha=function(e){return t(+e)},e}(.5);function m_(e,t){this._context=e,this._alpha=t}m_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:f_(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var v_=function t(r){function e(e){return r?new m_(e,r):new l_(e,0)}return e.alpha=function(e){return t(+e)},e}(.5);function __(e){this._context=e}function y_(e){return e<0?-1:1}function b_(e,t,r){var n=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(n||i<0&&-0),a=(r-e._y1)/(i||n<0&&-0),s=(o*i+a*n)/(n+i);return(y_(o)+y_(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function x_(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function w_(e,t,r){var n=e._x0,i=e._y0,o=e._x1,a=e._y1,s=(o-n)/3;e._context.bezierCurveTo(n+s,i+s*t,o-s,a-s*r,o,a)}function T_(e){this._context=e}function S_(e){this._context=new M_(e)}function M_(e){this._context=e}function P_(e){this._context=e}function C_(e){var t,r,n=e.length-1,i=new Array(n),o=new Array(n),a=new Array(n);for(o[i[0]=0]=2,a[0]=e[0]+2*e[1],t=1;to&&(o=t,n=r);return n}function D_(e){var r=e.map(L_);return A_(e).sort(function(e,t){return r[e]-r[t]})}function L_(e){for(var t,r=0,n=-1,i=e.length;++n=i)return}else u=[g,r];o=[g,i]}else{if(u){if(u[1]=i)return}else u=[(r-s)/a,r];o=[(i-s)/a,i]}else{if(u){if(u[1]=n)return}else u=[t,a*t+s];o=[n,a*n+s]}else{if(u){if(u[0]dy||Math.abs(i[0][1]-i[1][1])>dy)||delete hy[o]}(a,s,u,l),function(e,t,r,n){var i,o,a,s,u,l,c,f,h,d,p,g,m,v,_=cy.length,y=!0;for(i=0;i<_;++i)if(o=cy[i]){for(a=o.site,s=(u=o.halfedges).length;s--;)hy[u[s]]||u.splice(s,1);for(s=0,l=u.length;sdy||Math.abs(g-h)>dy)&&(u.splice(s,0,hy.push(Y_(a,d,Math.abs(p-e)=r)return null;for(var n=a-u.site[0],i=s-u.site[1],f=n*n+i*i;u=l.cells[t=c],c=null,u.halfedges.forEach(function(e){var t=l.edges[e],r=t.left;if(r!==u.site&&r||(r=t.right)){var n=a-r[0],i=s-r[1],o=n*n+i*i;os;)u.pop(),--l;var c,f=new Array(l+1);for(t=0;t<=l;++t)(c=f[t]=[]).x0=0=p.length)return null!=h&&e.sort(h),null!=d?d(e):e;for(var t,o,a,s=-1,u=e.length,l=p[r++],c=$i(),f=n();++sp.length)return e;var i,o=a[n-1];return null!=d&&n>=p.length?i=e.entries():(i=[],e.each(function(e,t){i.push({key:t,values:r(e,n)})})),null!=o?i.sort(function(e,t){return o(e.key,t.key)}):i}(g(e,0,to,ro),0)},key:function(e){return p.push(e),t},sortKeys:function(e){return a[p.length-1]=e,t},sortValues:function(e){return h=e,t},rollup:function(e){return d=e,t}}},z.set=oo,z.map=$i,z.keys=function(e){var t=[];for(var r in e)t.push(r);return t},z.values=function(e){var t=[];for(var r in e)t.push(e[r]);return t},z.entries=function(e){var t=[];for(var r in e)t.push({key:r,value:e[r]});return t},z.color=ht,z.rgb=mt,z.hsl=bt,z.lab=It,z.hcl=zt,z.lch=function(e,t,r,n){return 1===arguments.length?Bt(e):new Ut(r,t,e,null==n?1:n)},z.gray=function(e,t){return new Dt(e,0,0,null==t?1:t)},z.cubehelix=Kt,z.contours=po,z.contourDensity=function(){var s=vo,u=_o,l=yo,n=960,i=500,o=20,c=2,f=3*o,h=n+2*f>>c,d=i+2*f>>c,p=uo(20);function t(e){var a=new Float32Array(h*d),t=new Float32Array(h*d);e.forEach(function(e,t,r){var n=+s(e,t,r)+f>>c,i=+u(e,t,r)+f>>c,o=+l(e,t,r);0<=n&&n>c),mo({width:h,height:d,data:t},{width:h,height:d,data:a},o>>c),go({width:h,height:d,data:a},{width:h,height:d,data:t},o>>c),mo({width:h,height:d,data:t},{width:h,height:d,data:a},o>>c),go({width:h,height:d,data:a},{width:h,height:d,data:t},o>>c),mo({width:h,height:d,data:t},{width:h,height:d,data:a},o>>c);var r=p(a);if(!Array.isArray(r)){var n=x(a);r=P(0,n,r),(r=M(0,Math.floor(n/r)*r,r)).shift()}return po().thresholds(r).size([h,d])(a).map(g)}function g(e){return e.value*=Math.pow(2,-2*c),e.coordinates.forEach(r),e}function r(e){e.forEach(a)}function a(e){e.forEach(m)}function m(e){e[0]=e[0]*Math.pow(2,c)-f,e[1]=e[1]*Math.pow(2,c)-f}function v(){return h=n+2*(f=3*o)>>c,d=i+2*f>>c,t}return t.x=function(e){return arguments.length?(s="function"==typeof e?e:uo(+e),t):s},t.y=function(e){return arguments.length?(u="function"==typeof e?e:uo(+e),t):u},t.weight=function(e){return arguments.length?(l="function"==typeof e?e:uo(+e),t):l},t.size=function(e){if(!arguments.length)return[n,i];var t=Math.ceil(e[0]),r=Math.ceil(e[1]);if(!(0<=t||0<=t))throw new Error("invalid size");return n=t,i=r,v()},t.cellSize=function(e){if(!arguments.length)return 1<f.index){var u=h-o.x-o.vx,l=d-o.y-o.vy,c=u*u+l*l;ce.r&&(e.r=e[t].r)}function r(){if(o){var e,t,r=o.length;for(a=new Array(r),e=0;ehu(n[0],n[1])&&(n[1]=i[1]),hu(i[0],n[1])>hu(n[0],n[1])&&(n[0]=i[0])):o.push(n=i);for(a=-1/0,t=0,n=o[r=o.length-1];t<=r;n=i,++t)i=o[t],(s=hu(n[1],i[0]))>a&&(a=s,Os=i[0],Is=n[1])}return Bs=zs=null,Os===1/0||Rs===1/0?[[NaN,NaN],[NaN,NaN]]:[[Os,Rs],[Is,Ds]]},z.geoCentroid=function(e){Us=Xs=qs=Hs=Ys=Gs=Ws=Vs=Ks=Zs=Js=0,fs(e,gu);var t=Ks,r=Zs,n=Js,i=t*t+r*r+n*n;return i<1e-12&&(t=Gs,r=Ws,n=Vs,Xsn.x&&(n=e),e.depth>i.depth&&(i=e)});var o=r===n?1:y(r,n)/2,a=o-r.x,s=l/(n.x+o+a),u=c/(i.depth||1);e.eachBefore(function(e){e.x=(e.x+a)*s,e.y=e.depth*u})}return e}function h(e){var t=e.children,r=e.parent.children,n=e.i?r[e.i-1]:null;if(t){!function(e){for(var t,r=0,n=0,i=e.children,o=i.length;0<=--o;)(t=i[o]).z+=r,t.m+=r,r+=t.s+(n+=t.c)}(e);var i=(t[0].z+t[t.length-1].z)/2;n?(e.z=n.z+y(e._,n._),e.m=e.z-i):e.z=i}else n&&(e.z=n.z+y(e._,n._));e.parent.A=function(e,t,r){if(t){for(var n,i=e,o=e,a=t,s=i.parent.children[0],u=i.m,l=o.m,c=a.m,f=s.m;a=qf(a),i=Xf(i),a&&i;)s=Xf(s),(o=qf(o)).a=e,0<(n=a.z+c-i.z-u+y(a._,i._))&&(v=e,_=r,h=(m=a).a.parent===v.parent?m.a:_,g=(p=n)/((d=e).i-h.i),d.c-=g,d.s+=p,h.c+=g,d.z+=p,d.m+=p,u+=n,l+=n),c+=a.m,u+=i.m,f+=s.m,l+=o.m;a&&!qf(o)&&(o.t=a,o.m+=c-l),i&&!Xf(s)&&(s.t=i,s.m+=u-f,r=e)}var h,d,p,g,m,v,_;return r}(e,n,e.parent.A||r[0])}function d(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function p(e){e.x*=l,e.y=e.depth*c}return t.separation=function(e){return arguments.length?(y=e,t):y},t.size=function(e){return arguments.length?(f=!1,l=+e[0],c=+e[1],t):f?null:[l,c]},t.nodeSize=function(e){return arguments.length?(f=!0,l=+e[0],c=+e[1],t):f?[l,c]:null},t},z.treemap=function(){var a=Vf,t=!1,r=1,n=1,s=[0],u=Ef,l=Ef,c=Ef,f=Ef,h=Ef;function i(e){return e.x0=e.y0=0,e.x1=r,e.y1=n,e.eachBefore(o),s=[0],t&&e.eachBefore(Lf),e}function o(e){var t=s[e.depth],r=e.x0+t,n=e.y0+t,i=e.x1-t,o=e.y1-t;i>>1;y[d]tv?(h+=x*=s?1:-1,d-=x):(p=0,h=d=(i+o)/2),(g-=2*w)>tv?(c+=w*=s?1:-1,f-=w):(g=0,c=f=(i+o)/2)}var T=n*Zm(c),S=n*Qm(c),M=r*Zm(d),P=r*Qm(d);if(tv<_){var C,k=n*Zm(f),E=n*Qm(f),A=r*Zm(h),O=r*Qm(h);if(adn&&r.name===t)return new En([[e]],ci,t,+n);return null},z.interrupt=Tn,z.voronoi=function(){var i=j_,o=F_,t=null;function r(n){return new my(n.map(function(e,t){var r=[Math.round(i(e,t,n)/dy)*dy,Math.round(o(e,t,n)/dy)*dy];return r.index=t,r.data=e,r}),t)}return r.polygons=function(e){return r(e).polygons()},r.links=function(e){return r(e).links()},r.triangles=function(e){return r(e).triangles()},r.x=function(e){return arguments.length?(i="function"==typeof e?e:N_(+e),r):i},r.y=function(e){return arguments.length?(o="function"==typeof e?e:N_(+e),r):o},r.extent=function(e){return arguments.length?(t=null==e?null:[[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]],r):t&&[[t[0][0],t[0][1]],[t[1][0],t[1][1]]]},r.size=function(e){return arguments.length?(t=null==e?null:[[0,0],[+e[0],+e[1]]],r):t&&[t[1][0]-t[0][0],t[1][1]-t[0][1]]},r},z.zoom=function(){var d,o,s=Sy,c=My,p=Ey,i=Cy,t=ky,a=[0,1/0],g=[[-1/0,-1/0],[1/0,1/0]],u=250,f=Ir,l=[],r=X("start","zoom","end"),h=500,m=150,v=0;function _(e){e.property("__zoom",Py).on("wheel.zoom",n).on("mousedown.zoom",M).on("dblclick.zoom",P).filter(t).on("touchstart.zoom",C).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(e,t){return(t=Math.max(a[0],Math.min(a[1],t)))===e.k?e:new yy(t,e.x,e.y)}function b(e,t,r){var n=t[0]-r[0]*e.k,i=t[1]-r[1]*e.k;return n===e.x&&i===e.y?e:new yy(e.k,n,i)}function x(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function w(e,u,l){e.on("start.zoom",function(){T(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).end()}).tween("zoom",function(){var e=arguments,n=T(this,e),t=c.apply(this,e),i=l||x(t),o=Math.max(t[1][0]-t[0][0],t[1][1]-t[0][1]),r=this.__zoom,a="function"==typeof u?u.apply(this,e):u,s=f(r.invert(i).concat(o/r.k),a.invert(i).concat(o/a.k));return function(e){if(1===e)e=a;else{var t=s(e),r=o/t[2];e=new yy(r,i[0]-t[0]*r,i[1]-t[1]*r)}n.zoom(null,e)}})}function T(e,t){for(var r,n=0,i=l.length;n]/gm,function(e){return a[e]})}function f(e){return e.nodeName.toLowerCase()}function y(e,t){var r=e&&e.exec(t);return r&&0===r.index}function s(e){return n.test(e)}function b(e,t){var r,n={};for(r in e)n[r]=e[r];if(t)for(r in t)n[r]=t[r];return n}function u(e){var i=[];return function e(t,r){for(var n=t.firstChild;n;n=n.nextSibling)3===n.nodeType?r+=n.nodeValue.length:1===n.nodeType&&(i.push({event:"start",offset:r,node:n}),r=e(n,r),f(n).match(/br|hr|img|input/)||i.push({event:"stop",offset:r,node:n}));return r}(e,0),i}function x(e,t,o,r){function s(e,t,r,n){var i='')+t+(r?"":P)}function a(){h+=null!=c.sL?function(){var e="string"==typeof c.sL;if(e&&!M[c.sL])return _(d);var t=e?x(c.sL,d,!0,f[c.sL]):w(d,c.sL.length?c.sL:void 0);return 0")+'"');return d+=t,t.length||1}var l=T(e);if(!l)throw new Error('Unknown language: "'+e+'"');!function(s){function u(e){return e&&e.source||e}function l(e,t){return new RegExp(u(e),"m"+(s.cI?"i":"")+(t?"g":""))}!function t(r,e){if(!r.compiled){if(r.compiled=!0,r.k=r.k||r.bK,r.k){var n={},i=function(r,e){s.cI&&(e=e.toLowerCase()),e.split(" ").forEach(function(e){var t=e.split("|");n[t[0]]=[r,t[1]?Number(t[1]):1]})};"string"==typeof r.k?i("keyword",r.k):S(r.k).forEach(function(e){i(e,r.k[e])}),r.k=n}r.lR=l(r.l||/\w+/,!0),e&&(r.bK&&(r.b="\\b("+r.bK.split(" ").join("|")+")\\b"),r.b||(r.b=/\B|\b/),r.bR=l(r.b),r.e||r.eW||(r.e=/\B|\b/),r.e&&(r.eR=l(r.e)),r.tE=u(r.e)||"",r.eW&&e.tE&&(r.tE+=(r.e?"|":"")+e.tE)),r.i&&(r.iR=l(r.i)),null==r.r&&(r.r=1),r.c||(r.c=[]);var o=[];r.c.forEach(function(t){t.v?t.v.forEach(function(e){o.push(b(t,e))}):o.push("self"===t?r:t)}),r.c=o,r.c.forEach(function(e){t(e,r)}),r.starts&&t(r.starts,e);var a=r.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([r.tE,r.i]).map(u).filter(Boolean);r.t=a.length?l(a.join("|"),!0):{exec:function(){return null}}}}(s)}(l);var i,c=r||l,f={},h="";for(i=c;i!==l;i=i.parent)i.cN&&(h=s(i.cN,"",!0)+h);var d="",p=0;try{for(var g,m,v=0;c.t.lastIndex=v,g=c.t.exec(t);)m=n(t.substring(v,g.index),g[0]),v=g.index+m;for(n(t.substr(v)),i=c;i.parent;i=i.parent)i.cN&&(h+=P);return{r:p,value:h,language:e,top:c}}catch(e){if(e.message&&-1!==e.message.indexOf("Illegal"))return{r:0,value:_(t)};throw e}}function w(r,e){e=e||C.languages||S(M);var n={r:0,value:_(r)},i=n;return e.filter(T).forEach(function(e){var t=x(e,r,!1);t.language=e,t.r>i.r&&(i=t),t.r>n.r&&(i=n,n=t)}),i.language&&(n.second_best=i),n}function l(e){return C.tabReplace||C.useBR?e.replace(o,function(e,t){return C.useBR&&"\n"===e?"
":C.tabReplace?t.replace(/\t/g,C.tabReplace):void 0}):e}function t(e){var t,r,n,i,o,a=function(e){var t,r,n,i,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",r=d.exec(o))return T(r[1])?r[1]:"no-highlight";for(t=0,n=(o=o.split(/\s+/)).length;t/g,"\n"):t=e,o=t.textContent,n=a?x(a,o,!0):w(o),(r=u(t)).length&&((i=document.createElementNS("http://www.w3.org/1999/xhtml","div")).innerHTML=n.value,n.value=function(e,t,r){function n(){return e.length&&t.length?e[0].offset!==t[0].offset?e[0].offset"}function o(e){u+=""}function a(e){("start"===e.event?i:o)(e.node)}for(var s=0,u="",l=[];e.length||t.length;){var c=n();if(u+=_(r.substring(s,c[0].offset)),s=c[0].offset,c===e){for(l.reverse().forEach(o);a(c.splice(0,1)[0]),(c=n())===e&&c.length&&c[0].offset===s;);l.reverse().forEach(i)}else"start"===c[0].event?l.push(c[0].node):l.pop(),a(c.splice(0,1)[0])}return u+_(r.substr(s))}(r,u(i),o)),n.value=l(n.value),e.innerHTML=n.value,e.className=function(e,t,r){var n=t?c[t]:r,i=[e.trim()];return e.match(/\bhljs\b/)||i.push("hljs"),-1===e.indexOf(n)&&i.push(n),i.join(" ").trim()}(e.className,a,n.language),e.result={language:n.language,re:n.r},n.second_best&&(e.second_best={language:n.second_best.language,re:n.second_best.r}))}function r(){if(!r.called){r.called=!0;var e=document.querySelectorAll("pre code");h.forEach.call(e,t)}}function T(e){return e=(e||"").toLowerCase(),M[e]||M[c[e]]}var h=[],S=Object.keys,M={},c={},n=/^(no-?highlight|plain|text)$/i,d=/\blang(?:uage)?-([\w-]+)\b/i,o=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,P="
",C={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},a={"&":"&","<":"<",">":">"};return i.highlight=x,i.highlightAuto=w,i.fixMarkup=l,i.highlightBlock=t,i.configure=function(e){C=b(C,e)},i.initHighlighting=r,i.initHighlightingOnLoad=function(){addEventListener("DOMContentLoaded",r,!1),addEventListener("load",r,!1)},i.registerLanguage=function(t,e){var r=M[t]=e(i);r.aliases&&r.aliases.forEach(function(e){c[e]=t})},i.listLanguages=function(){return S(M)},i.getLanguage=T,i.inherit=b,i.IR="[a-zA-Z]\\w*",i.UIR="[a-zA-Z_]\\w*",i.NR="\\b\\d+(\\.\\d+)?",i.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",i.BNR="\\b(0b[01]+)",i.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",i.BE={b:"\\\\[\\s\\S]",r:0},i.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[i.BE]},i.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[i.BE]},i.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},i.C=function(e,t,r){var n=i.inherit({cN:"comment",b:e,e:t,c:[]},r||{});return n.c.push(i.PWM),n.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),n},i.CLCM=i.C("//","$"),i.CBCM=i.C("/\\*","\\*/"),i.HCM=i.C("#","$"),i.NM={cN:"number",b:i.NR,r:0},i.CNM={cN:"number",b:i.CNR,r:0},i.BNM={cN:"number",b:i.BNR,r:0},i.CSSNM={cN:"number",b:i.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},i.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[i.BE,{b:/\[/,e:/\]/,r:0,c:[i.BE]}]},i.TM={cN:"title",b:i.IR,r:0},i.UTM={cN:"title",b:i.UIR,r:0},i.METHOD_GUARD={b:"\\.\\s*"+i.UIR,r:0},i}),hljs.registerLanguage("ini",function(e){var t={cN:"string",c:[e.BE],v:[{b:"'''",e:"'''",r:10},{b:'"""',e:'"""',r:10},{b:'"',e:'"'},{b:"'",e:"'"}]};return{aliases:["toml"],cI:!0,i:/\S/,c:[e.C(";","$"),e.HCM,{cN:"section",b:/^\s*\[+/,e:/\]+/},{b:/^[a-z0-9\[\]_-]+\s*=\s*/,e:"$",rB:!0,c:[{cN:"attr",b:/[a-z0-9\[\]_-]+/},{b:/=/,eW:!0,r:0,c:[{cN:"literal",b:/\bon|off|true|false|yes|no\b/},{cN:"variable",v:[{b:/\$[\w\d"][\w\d_]*/},{b:/\$\{(.*?)}/}]},t,{cN:"number",b:/([\+\-]+)?[\d]+_[\d_]+/},e.NM]}]}]}}),hljs.registerLanguage("diff",function(e){return{aliases:["patch"],c:[{cN:"meta",r:10,v:[{b:/^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"comment",v:[{b:/Index: /,e:/$/},{b:/={3,}/,e:/$/},{b:/^\-{3}/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+{3}/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"addition",b:"^\\!",e:"$"}]}}),hljs.registerLanguage("coffeescript",function(e){var t={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super yield import export from as default await then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",built_in:"npm require console print module global window document"},r="[A-Za-z$_][0-9A-Za-z$_]*",n={cN:"subst",b:/#\{/,e:/}/,k:t},i=[e.BNM,e.inherit(e.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'''/,e:/'''/,c:[e.BE]},{b:/'/,e:/'/,c:[e.BE]},{b:/"""/,e:/"""/,c:[e.BE,n]},{b:/"/,e:/"/,c:[e.BE,n]}]},{cN:"regexp",v:[{b:"///",e:"///",c:[n,e.HCM]},{b:"//[gim]*",r:0},{b:/\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/}]},{b:"@"+r},{sL:"javascript",eB:!0,eE:!0,v:[{b:"```",e:"```"},{b:"`",e:"`"}]}];n.c=i;var o=e.inherit(e.TM,{b:r}),a="(\\(.*\\))?\\s*\\B[-=]>",s={cN:"params",b:"\\([^\\(]",rB:!0,c:[{b:/\(/,e:/\)/,k:t,c:["self"].concat(i)}]};return{aliases:["coffee","cson","iced"],k:t,i:/\/\*/,c:i.concat([e.C("###","###"),e.HCM,{cN:"function",b:"^\\s*"+r+"\\s*=\\s*"+a,e:"[-=]>",rB:!0,c:[o,s]},{b:/[:\(,=]\s*/,r:0,c:[{cN:"function",b:a,e:"[-=]>",rB:!0,c:[s]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[o]},o]},{b:r+":",e:":",rB:!0,rE:!0,r:0}])}}),hljs.registerLanguage("cs",function(e){var t={keyword:"abstract as base bool break byte case catch char checked const continue decimal default delegate do double else enum event explicit extern finally fixed float for foreach goto if implicit in int interface internal is lock long object operator out override params private protected public readonly ref sbyte sealed short sizeof stackalloc static string struct switch this try typeof uint ulong unchecked unsafe ushort using virtual void volatile while nameof add alias ascending async await by descending dynamic equals from get global group into join let on orderby partial remove select set value var where yield",literal:"null false true"},r={cN:"string",b:'@"',e:'"',c:[{b:'""'}]},n=e.inherit(r,{i:/\n/}),i={cN:"subst",b:"{",e:"}",k:t},o=e.inherit(i,{i:/\n/}),a={cN:"string",b:/\$"/,e:'"',i:/\n/,c:[{b:"{{"},{b:"}}"},e.BE,o]},s={cN:"string",b:/\$@"/,e:'"',c:[{b:"{{"},{b:"}}"},{b:'""'},i]},u=e.inherit(s,{i:/\n/,c:[{b:"{{"},{b:"}}"},{b:'""'},o]});i.c=[s,a,r,e.ASM,e.QSM,e.CNM,e.CBCM],o.c=[u,a,n,e.ASM,e.QSM,e.CNM,e.inherit(e.CBCM,{i:/\n/})];var l={v:[s,a,r,e.ASM,e.QSM]},c=e.IR+"(<"+e.IR+"(\\s*,\\s*"+e.IR+")*>)?(\\[\\])?";return{aliases:["csharp"],k:t,i:/::/,c:[e.C("///","$",{rB:!0,c:[{cN:"doctag",v:[{b:"///",r:0},{b:"\x3c!--|--\x3e"},{b:""}]}]}),e.CLCM,e.CBCM,{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef warning error line region endregion pragma checksum"}},l,e.CNM,{bK:"class interface",e:/[{;=]/,i:/[^\s:]/,c:[e.TM,e.CLCM,e.CBCM]},{bK:"namespace",e:/[{;=]/,i:/[^\s:]/,c:[e.inherit(e.TM,{b:"[a-zA-Z](\\.?\\w)*"}),e.CLCM,e.CBCM]},{bK:"new return throw await",r:0},{cN:"function",b:"("+c+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:t,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,r:0,c:[l,e.CNM,e.CBCM]},e.CLCM,e.CBCM]}]}}),hljs.registerLanguage("sql",function(e){var t=e.C("--","$");return{cI:!0,i:/[<>{}*#]/,c:[{bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke comment",e:/;/,eW:!0,l:/[\w\.]+/,k:{keyword:"abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text varchar varying void"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t]},e.CBCM,t]}}),hljs.registerLanguage("javascript",function(e){var t="[A-Za-z$_][0-9A-Za-z$_]*",r={keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},n={cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},i={cN:"subst",b:"\\$\\{",e:"\\}",k:r,c:[]},o={cN:"string",b:"`",e:"`",c:[e.BE,i]};i.c=[e.ASM,e.QSM,o,n,e.RM];var a=i.c.concat([e.CBCM,e.CLCM]);return{aliases:["js","jsx"],k:r,c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,o,e.CLCM,e.CBCM,n,{b:/[{,]\s*/,r:0,c:[{b:t+"\\s*:",rB:!0,r:0,c:[{cN:"attr",b:t,r:0}]}]},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+t+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:t},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:r,c:a}]}]},{b://,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:t}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:a}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}}),hljs.registerLanguage("nginx",function(e){var t={cN:"variable",v:[{b:/\$\d+/},{b:/\$\{/,e:/}/},{b:"[\\$\\@]"+e.UIR}]},r={eW:!0,l:"[a-z/_]+",k:{literal:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[e.HCM,{cN:"string",c:[e.BE,t],v:[{b:/"/,e:/"/},{b:/'/,e:/'/}]},{b:"([a-z]+):/",e:"\\s",eW:!0,eE:!0,c:[t]},{cN:"regexp",c:[e.BE,t],v:[{b:"\\s\\^",e:"\\s|{|;",rE:!0},{b:"~\\*?\\s+",e:"\\s|{|;",rE:!0},{b:"\\*(\\.[a-z\\-]+)+"},{b:"([a-z\\-]+\\.)+\\*"}]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0},t]};return{aliases:["nginxconf"],c:[e.HCM,{b:e.UIR+"\\s+{",rB:!0,e:"{",c:[{cN:"section",b:e.UIR}],r:0},{b:e.UIR+"\\s",e:";|{",rB:!0,c:[{cN:"attribute",b:e.UIR,starts:r}],r:0}],i:"[^\\s\\}]"}}),hljs.registerLanguage("objectivec",function(e){var t=/[a-zA-Z@][a-zA-Z0-9_]*/,r="@interface @class @protocol @implementation";return{aliases:["mm","objc","obj-c"],k:{keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign readwrite self @synchronized id typeof nonatomic super unichar IBOutlet IBAction strong weak copy in out inout bycopy byref oneway __strong __weak __block __autoreleasing @private @protected @public @try @property @end @throw @catch @finally @autoreleasepool @synthesize @dynamic @selector @optional @required @encode @package @import @defs @compatibility_alias __bridge __bridge_transfer __bridge_retained __bridge_retain __covariant __contravariant __kindof _Nonnull _Nullable _Null_unspecified __FUNCTION__ __PRETTY_FUNCTION__ __attribute__ getter setter retain unsafe_unretained nonnull nullable null_unspecified null_resettable class instancetype NS_DESIGNATED_INITIALIZER NS_UNAVAILABLE NS_REQUIRES_SUPER NS_RETURNS_INNER_POINTER NS_INLINE NS_AVAILABLE NS_DEPRECATED NS_ENUM NS_OPTIONS NS_SWIFT_UNAVAILABLE NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_REFINED_FOR_SWIFT NS_SWIFT_NAME NS_SWIFT_NOTHROW NS_DURING NS_HANDLER NS_ENDHANDLER NS_VALUERETURN NS_VOIDRETURN",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"BOOL dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"},l:t,i:""}]}]},{cN:"class",b:"("+r.split(" ").join("|")+")\\b",e:"({|$)",eE:!0,k:r,l:t,c:[e.UTM]},{b:"\\."+e.UIR,r:0}]}}),hljs.registerLanguage("php",function(e){var t={b:"\\$+[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*"},r={cN:"meta",b:/<\?(php)?|\?>/},n={cN:"string",c:[e.BE,r],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},i={v:[e.BNM,e.CNM]};return{aliases:["php3","php4","php5","php6"],cI:!0,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[e.HCM,e.C("//","$",{c:[r]}),e.C("/\\*","\\*/",{c:[{cN:"doctag",b:"@[A-Za-z]+"}]}),e.C("__halt_compiler.+?;",!1,{eW:!0,k:"__halt_compiler",l:e.UIR}),{cN:"string",b:/<<<['"]?\w+['"]?$/,e:/^\w+;?$/,c:[e.BE,{cN:"subst",v:[{b:/\$\w+/},{b:/\{\$/,e:/\}/}]}]},r,{cN:"keyword",b:/\$this\b/},t,{b:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{cN:"function",bK:"function",e:/[;{]/,eE:!0,i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",t,e.CBCM,n,i]}]},{cN:"class",bK:"class interface",e:"{",eE:!0,i:/[:\(\$"]/,c:[{bK:"extends implements"},e.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[e.UTM]},{bK:"use",e:";",c:[e.UTM]},{b:"=>"},n,i]}}),hljs.registerLanguage("json",function(e){var t={literal:"true false null"},r=[e.QSM,e.CNM],n={e:",",eW:!0,eE:!0,c:r,k:t},i={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(n,{b:/:/})],i:"\\S"},o={b:"\\[",e:"\\]",c:[e.inherit(n)],i:"\\S"};return r.splice(r.length,0,i,o),{c:r,k:t,i:"\\S"}}),hljs.registerLanguage("cpp",function(e){var t={cN:"keyword",b:"\\b[a-z\\d_]*_t\\b"},r={cN:"string",v:[{b:'(u8?|U)?L?"',e:'"',i:"\\n",c:[e.BE]},{b:'(u8?|U)?R"',e:'"',c:[e.BE]},{b:"'\\\\?.",e:"'",i:"."}]},n={cN:"number",v:[{b:"\\b(0b[01']+)"},{b:"\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{b:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],r:0},i={cN:"meta",b:/#\s*[a-z]+\b/,e:/$/,k:{"meta-keyword":"if else elif endif define undef warning error line pragma ifdef ifndef include"},c:[{b:/\\\n/,r:0},e.inherit(r,{cN:"meta-string"}),{cN:"meta-string",b:"<",e:">",i:"\\n"},e.CLCM,e.CBCM]},o=e.IR+"\\s*\\(",a={keyword:"int float while private char catch import module export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue inline delete alignof constexpr decltype noexcept static_assert thread_local restrict _Bool complex _Complex _Imaginary atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong new throw return",built_in:"std string cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr",literal:"true false nullptr NULL"},s=[t,e.CLCM,e.CBCM,n,r];return{aliases:["c","cc","h","c++","h++","hpp"],k:a,i:"",k:a,c:["self",t]},{b:e.IR+"::",k:a},{v:[{b:/=/,e:/;/},{b:/\(/,e:/\)/},{bK:"new throw return else",e:/;/}],k:a,c:s.concat([{b:/\(/,e:/\)/,k:a,c:s.concat(["self"]),r:0}]),r:0},{cN:"function",b:"("+e.IR+"[\\*&\\s]+)+"+o,rB:!0,e:/[{;=]/,eE:!0,k:a,i:/[^\w\s\*&]/,c:[{b:o,rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:a,r:0,c:[e.CLCM,e.CBCM,r,n,t]},e.CLCM,e.CBCM,i]}]),exports:{preprocessor:i,strings:r,k:a}}}),hljs.registerLanguage("python",function(e){var t={cN:"meta",b:/^(>>>|\.\.\.) /},r={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[t],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[t],r:10},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},e.ASM,e.QSM]},n={cN:"number",r:0,v:[{b:e.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:e.CNR+"[lLjJ]?"}]},i={cN:"params",b:/\(/,e:/\)/,c:["self",t,n,r]};return{aliases:["py","gyp"],k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda async await nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)|=>/,c:[t,n,r,e.HCM,{v:[{cN:"function",bK:"def"},{cN:"class",bK:"class"}],e:/:/,i:/[${=;\n,]/,c:[e.UTM,i,{b:/->/,eW:!0,k:"None"}]},{cN:"meta",b:/^[\t ]*@/,e:/$/},{b:/\b(print|exec)\(/}]}}),hljs.registerLanguage("makefile",function(e){var t={cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]};return{aliases:["mk","mak"],c:[e.HCM,{b:/^\w+\s*\W*=/,rB:!0,r:0,starts:{e:/\s*\W*=/,eE:!0,starts:{e:/$/,r:0,c:[t]}}},{cN:"section",b:/^[\w]+:\s*$/},{cN:"meta",b:/^\.PHONY:/,e:/$/,k:{"meta-keyword":".PHONY"},l:/[\.\w]+/},{b:/^\t+/,e:/$/,r:0,c:[e.QSM,t]}]}}),hljs.registerLanguage("xml",function(e){var t={eW:!0,i:/`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},e.C("\x3c!--","--\x3e",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0}]},{cN:"tag",b:"|$)",e:">",k:{name:"style"},c:[t],starts:{e:"",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"|$)",e:">",k:{name:"script"},c:[t],starts:{e:"<\/script>",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"",c:[{cN:"name",b:/[^\/><\s]+/,r:0},t]}]}}),hljs.registerLanguage("http",function(e){var t="HTTP/[0-9\\.]+";return{aliases:["https"],i:"\\S",c:[{b:"^"+t,e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{b:"^[A-Z]+ (.*?) "+t+"$",rB:!0,e:"$",c:[{cN:"string",b:" ",e:" ",eB:!0,eE:!0},{b:t},{cN:"keyword",b:"[A-Z]+"}]},{cN:"attribute",b:"^\\w",e:": ",eE:!0,i:"\\n|\\s|=",starts:{e:"$",r:0}},{b:"\\n\\n",starts:{sL:[],eW:!0}}]}}),hljs.registerLanguage("java",function(e){var t="false synchronized int abstract float private char boolean static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private module requires exports do",r={cN:"number",b:"\\b(0[bB]([01]+[01_]+[01]+|[01]+)|0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)|(([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?|\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))([eE][-+]?\\d+)?)[lLfF]?",r:0};return{aliases:["jsp"],k:t,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return else",r:0},{cN:"function",b:"([À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*(<[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*(\\s*,\\s*[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*)*>)?\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:t,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:t,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},r,{cN:"meta",b:"@[A-Za-z]+"}]}}),hljs.registerLanguage("markdown",function(e){return{aliases:["md","mkdown","mkd"],c:[{cN:"section",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"quote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"^```w*s*$",e:"^```s*$"},{b:"`.+?`"},{b:"^( {4}|\t)",e:"$",r:0}]},{b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"string",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"symbol",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:/^\[[^\n]+\]:/,rB:!0,c:[{cN:"symbol",b:/\[/,e:/\]/,eB:!0,eE:!0},{cN:"link",b:/:\s*/,e:/$/,eB:!0}]}]}}),hljs.registerLanguage("apache",function(e){var t={cN:"number",b:"[\\$%]\\d+"};return{aliases:["apacheconf"],cI:!0,c:[e.HCM,{cN:"section",b:""},{cN:"attribute",b:/\w+/,r:0,k:{nomarkup:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"meta",b:"\\s\\[",e:"\\]$"},{cN:"variable",b:"[\\$%]\\{",e:"\\}",c:["self",t]},t,e.QSM]}}],i:/\S/}}),hljs.registerLanguage("css",function(e){var t={b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\w-]+\(/,rB:!0,c:[{cN:"built_in",b:/[\w-]+/},{b:/\(/,e:/\)/,c:[e.ASM,e.QSM]}]},e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"number",b:"#[0-9A-Fa-f]+"},{cN:"meta",b:"!important"}]}}]};return{cI:!0,i:/[=\/|'\$]/,c:[e.CBCM,{cN:"selector-id",b:/#[A-Za-z0-9_-]+/},{cN:"selector-class",b:/\.[A-Za-z0-9_-]+/},{cN:"selector-attr",b:/\[/,e:/\]/,i:"$"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{b:"@",e:"[{;]",i:/:/,c:[{cN:"keyword",b:/\w+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[e.ASM,e.QSM,e.CSSNM]}]},{cN:"selector-tag",b:"[a-zA-Z-][a-zA-Z0-9_-]*",r:0},{b:"{",e:"}",i:/\S/,c:[e.CBCM,t]}]}}),hljs.registerLanguage("ruby",function(e){var t="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",r={keyword:"and then defined module in return redo if BEGIN retry end for self when next until do begin unless END rescue else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor",literal:"true false nil"},n={cN:"doctag",b:"@[A-Za-z]+"},i={b:"#<",e:">"},o=[e.C("#","$",{c:[n]}),e.C("^\\=begin","^\\=end",{c:[n],r:10}),e.C("^__END__","\\n$")],a={cN:"subst",b:"#\\{",e:"}",k:r},s={cN:"string",c:[e.BE,a],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/`/,e:/`/},{b:"%[qQwWx]?\\(",e:"\\)"},{b:"%[qQwWx]?\\[",e:"\\]"},{b:"%[qQwWx]?{",e:"}"},{b:"%[qQwWx]?<",e:">"},{b:"%[qQwWx]?/",e:"/"},{b:"%[qQwWx]?%",e:"%"},{b:"%[qQwWx]?-",e:"-"},{b:"%[qQwWx]?\\|",e:"\\|"},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/},{b:/<<(-?)\w+$/,e:/^\s*\w+$/}]},u={cN:"params",b:"\\(",e:"\\)",endsParent:!0,k:r},l=[s,i,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{b:"<\\s*",c:[{b:"("+e.IR+"::)?"+e.IR}]}].concat(o)},{cN:"function",bK:"def",e:"$|;",c:[e.inherit(e.TM,{b:t}),u].concat(o)},{b:e.IR+"::"},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":(?!\\s)",c:[s,{b:t}],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{cN:"params",b:/\|/,e:/\|/,k:r},{b:"("+e.RSR+"|unless)\\s*",c:[i,{cN:"regexp",c:[e.BE,a],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}].concat(o),r:0}].concat(o);a.c=l;var c=[{b:/^\s*=>/,starts:{e:"$",c:u.c=l}},{cN:"meta",b:"^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+>|(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>)",starts:{e:"$",c:l}}];return{aliases:["rb","gemspec","podspec","thor","irb"],k:r,i:/\/\*/,c:o.concat(c).concat(l)}}),hljs.registerLanguage("perl",function(e){var t="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when",r={cN:"subst",b:"[$@]\\{",e:"\\}",k:t},n={b:"->{",e:"}"},i={v:[{b:/\$\d/},{b:/[\$%@](\^\w\b|#\w+(::\w+)*|{\w+}|\w+(::\w*)*)/},{b:/[\$%@][^\s\w{]/,r:0}]},o=[e.BE,r,i],a=[i,e.HCM,e.C("^\\=\\w","\\=cut",{eW:!0}),n,{cN:"string",c:o,v:[{b:"q[qwxr]?\\s*\\(",e:"\\)",r:5},{b:"q[qwxr]?\\s*\\[",e:"\\]",r:5},{b:"q[qwxr]?\\s*\\{",e:"\\}",r:5},{b:"q[qwxr]?\\s*\\|",e:"\\|",r:5},{b:"q[qwxr]?\\s*\\<",e:"\\>",r:5},{b:"qw\\s+q",e:"q",r:5},{b:"'",e:"'",c:[e.BE]},{b:'"',e:'"'},{b:"`",e:"`",c:[e.BE]},{b:"{\\w+}",c:[],r:0},{b:"-?\\w+\\s*\\=\\>",c:[],r:0}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\/\\/|"+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"function",bK:"sub",e:"(\\s*\\(.*?\\))?[;{]",eE:!0,r:5,c:[e.TM]},{b:"-\\w\\b",r:0},{b:"^__DATA__$",e:"^__END__$",sL:"mojolicious",c:[{b:"^@@.*",e:"$",cN:"comment"}]}];return r.c=a,{aliases:["pl","pm"],l:/[\w\.]+/,k:t,c:n.c=a}}),hljs.registerLanguage("bash",function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},r={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]};return{aliases:["sh","zsh"],l:/-?[a-z\._]+/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"meta",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,r,{cN:"string",b:/'/,e:/'/},t]}}),function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).PIXI=e()}}(function(){return function o(a,s,u){function l(r,e){if(!s[r]){if(!a[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(c)return c(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var i=s[r]={exports:{}};a[r][0].call(i.exports,function(e){var t=a[r][1][e];return l(t||e)},i,i.exports,o,a,s,u)}return s[r].exports}for(var c="function"==typeof require&&require,e=0;e>31;return(e^t)-t},r.min=function(e,t){return t^(e^t)&-(e>>=t))<<3,t|=r=(15<(e>>>=r))<<2,(t|=r=(3<(e>>>=r))<<1)|(e>>>=r)>>1},r.log10=function(e){return 1e9<=e?9:1e8<=e?8:1e7<=e?7:1e6<=e?6:1e5<=e?5:1e4<=e?4:1e3<=e?3:100<=e?2:10<=e?1:0},r.popCount=function(e){return 16843009*((e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(e){return e+=0===e,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1},r.prevPow2=function(e){return e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)-(e>>>1)},r.parity=function(e){return e^=e>>>16,e^=e>>>8,e^=e>>>4,27030>>>(e&=15)&1};var i=new Array(256);!function(e){for(var t=0;t<256;++t){var r=t,n=t,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;e[t]=n<>>8&255]<<16|i[e>>>16&255]<<8|i[e>>>24&255]},r.interleave2=function(e,t){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))<<1},r.deinterleave2=function(e,t){return(e=65535&((e=16711935&((e=252645135&((e=858993459&((e=e>>>t&1431655765)|e>>>1))|e>>>2))|e>>>4))|e>>>16))<<16>>16},r.interleave3=function(e,t,r){return e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2),(e|=(t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2))<<1)|(r=1227133513&((r=3272356035&((r=251719695&((r=4278190335&((r&=1023)|r<<16))|r<<8))|r<<4))|r<<2))<<2},r.deinterleave3=function(e,t){return(e=1023&((e=4278190335&((e=251719695&((e=3272356035&((e=e>>>t&1227133513)|e>>>2))|e>>>4))|e>>>8))|e>>>16))<<22>>22},r.nextCombination=function(e){var t=e|e-1;return 1+t|(~t&-~t)-1>>>n(e)+1}},{}],2:[function(e,t,r){"use strict";function n(e,t,r){r=r||2;var n,i,o,a,s,u,l,c=t&&t.length,f=c?t[0]*r:e.length,h=g(e,0,f,r,!0),d=[];if(!h||h.next===h.prev)return d;if(c&&(h=function(e,t,r,n){var i,o,a,s,u,l=[];for(i=0,o=t.length;i80*r){n=o=e[0],i=a=e[1];for(var p=r;po.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,c=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,f=b(s,u,t,r,n),h=b(l,c,t,r,n),d=e.prevZ,p=e.nextZ;d&&d.z>=f&&p&&p.z<=h;){if(d!==e.prev&&d!==e.next&&w(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&0<=T(d.prev,d,d.next))return!1;if(d=d.prevZ,p!==e.prev&&p!==e.next&&w(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&0<=T(p.prev,p,p.next))return!1;p=p.nextZ}for(;d&&d.z>=f;){if(d!==e.prev&&d!==e.next&&w(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&0<=T(d.prev,d,d.next))return!1;d=d.prevZ}for(;p&&p.z<=h;){if(p!==e.prev&&p!==e.next&&w(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&0<=T(p.prev,p,p.next))return!1;p=p.nextZ}return!0}function h(e,t,r){var n=e;do{var i=n.prev,o=n.next.next;!s(i,o)&&p(i,n,n.next,o)&&S(i,o)&&S(o,i)&&(t.push(i.i/r),t.push(n.i/r),t.push(o.i/r),P(n),P(n.next),n=e=o),n=n.next}while(n!==e);return n}function d(e,t,r,n,i,o){var a,s,u=e;do{for(var l=u.next.next;l!==u.prev;){if(u.i!==l.i&&(s=l,(a=u).next.i!==s.i&&a.prev.i!==s.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&p(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(a,s)&&S(a,s)&&S(s,a)&&function(e,t){var r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;for(;r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next,r!==e;);return n}(a,s))){var c=M(u,l);return u=m(u,u.next),c=m(c,c.next),v(u,t,r,n,i,o),void v(c,t,r,n,i,o)}l=l.next}u=u.next}while(u!==e)}function _(e,t){return e.x-t.x}function y(e,t){if(t=function(e,t){var r,n=t,i=e.x,o=e.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&a=n.x&&n.x>=c&&i!==n.x&&w(or.x)&&S(n,e)&&(r=n,h=u),n=n.next;return r}(e,t)){var r=M(t,e);m(r,r.next)}}function b(e,t,r,n,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function x(e){for(var t=e,r=e;t.x=e.byteLength?n.bufferSubData(this.type,t,e):n.bufferData(this.type,e,this.drawType),this.data=e},o.prototype.bind=function(){this.gl.bindBuffer(this.type,this.buffer)},o.createVertexBuffer=function(e,t,r){return new o(e,e.ARRAY_BUFFER,t,r)},o.createIndexBuffer=function(e,t,r){return new o(e,e.ELEMENT_ARRAY_BUFFER,t,r)},o.create=function(e,t,r,n){return new o(e,t,r,n)},o.prototype.destroy=function(){this.gl.deleteBuffer(this.buffer)},t.exports=o},{}],10:[function(e,t,r){var a=e("./GLTexture"),s=function(e,t,r){this.gl=e,this.framebuffer=e.createFramebuffer(),this.stencil=null,this.texture=null,this.width=t||100,this.height=r||100};s.prototype.enableTexture=function(e){var t=this.gl;this.texture=e||new a(t),this.texture.bind(),this.bind(),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.texture.texture,0)},s.prototype.enableStencil=function(){if(!this.stencil){var e=this.gl;this.stencil=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,this.stencil),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,this.stencil),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,this.width,this.height)}},s.prototype.clear=function(e,t,r,n){this.bind();var i=this.gl;i.clearColor(e,t,r,n),i.clear(i.COLOR_BUFFER_BIT|i.DEPTH_BUFFER_BIT)},s.prototype.bind=function(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer)},s.prototype.unbind=function(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null)},s.prototype.resize=function(e,t){var r=this.gl;this.width=e,this.height=t,this.texture&&this.texture.uploadData(null,e,t),this.stencil&&(r.bindRenderbuffer(r.RENDERBUFFER,this.stencil),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,e,t))},s.prototype.destroy=function(){var e=this.gl;this.texture&&this.texture.destroy(),e.deleteFramebuffer(this.framebuffer),this.gl=null,this.stencil=null,this.texture=null},s.createRGBA=function(e,t,r,n){var i=a.fromData(e,null,t,r);i.enableNearestScaling(),i.enableWrapClamp();var o=new s(e,t,r);return o.enableTexture(i),o.unbind(),o},s.createFloat32=function(e,t,r,n){var i=new a.fromData(e,n,t,r);i.enableNearestScaling(),i.enableWrapClamp();var o=new s(e,t,r);return o.enableTexture(i),o.unbind(),o},t.exports=s},{"./GLTexture":12}],11:[function(e,t,r){var o=e("./shader/compileProgram"),a=e("./shader/extractAttributes"),s=e("./shader/extractUniforms"),u=e("./shader/setPrecision"),l=e("./shader/generateUniformAccessObject"),n=function(e,t,r,n,i){this.gl=e,n&&(t=u(t,n),r=u(r,n)),this.program=o(e,t,r,i),this.attributes=a(e,this.program),this.uniformData=s(e,this.program),this.uniforms=l(e,this.uniformData)};n.prototype.bind=function(){return this.gl.useProgram(this.program),this},n.prototype.destroy=function(){this.attributes=null,this.uniformData=null,this.uniforms=null,this.gl.deleteProgram(this.program)},t.exports=n},{"./shader/compileProgram":17,"./shader/extractAttributes":19,"./shader/extractUniforms":20,"./shader/generateUniformAccessObject":21,"./shader/setPrecision":25}],12:[function(e,t,r){var o=function(e,t,r,n,i){this.gl=e,this.texture=e.createTexture(),this.mipmap=!1,this.premultiplyAlpha=!1,this.width=t||-1,this.height=r||-1,this.format=n||e.RGBA,this.type=i||e.UNSIGNED_BYTE},i=!(o.prototype.upload=function(e){this.bind();var t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha);var r=e.videoWidth||e.width,n=e.videoHeight||e.height;n!==this.height||r!==this.width?t.texImage2D(t.TEXTURE_2D,0,this.format,this.format,this.type,e):t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.format,this.type,e),this.width=r,this.height=n});o.prototype.uploadData=function(e,t,r){this.bind();var n=this.gl;if(e instanceof Float32Array){if(!i){if(!n.getExtension("OES_texture_float"))throw new Error("floating point textures not available");i=!0}this.type=n.FLOAT}else this.type=this.type||n.UNSIGNED_BYTE;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha),t!==this.width||r!==this.height?n.texImage2D(n.TEXTURE_2D,0,this.format,t,r,0,this.format,this.type,e||null):n.texSubImage2D(n.TEXTURE_2D,0,0,0,t,r,this.format,this.type,e||null),this.width=t,this.height=r},o.prototype.bind=function(e){var t=this.gl;void 0!==e&&t.activeTexture(t.TEXTURE0+e),t.bindTexture(t.TEXTURE_2D,this.texture)},o.prototype.unbind=function(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,null)},o.prototype.minFilter=function(e){var t=this.gl;this.bind(),this.mipmap?t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,e?t.LINEAR_MIPMAP_LINEAR:t.NEAREST_MIPMAP_NEAREST):t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,e?t.LINEAR:t.NEAREST)},o.prototype.magFilter=function(e){var t=this.gl;this.bind(),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,e?t.LINEAR:t.NEAREST)},o.prototype.enableMipmap=function(){var e=this.gl;this.bind(),this.mipmap=!0,e.generateMipmap(e.TEXTURE_2D)},o.prototype.enableLinearScaling=function(){this.minFilter(!0),this.magFilter(!0)},o.prototype.enableNearestScaling=function(){this.minFilter(!1),this.magFilter(!1)},o.prototype.enableWrapClamp=function(){var e=this.gl;this.bind(),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)},o.prototype.enableWrapRepeat=function(){var e=this.gl;this.bind(),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT)},o.prototype.enableWrapMirrorRepeat=function(){var e=this.gl;this.bind(),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.MIRRORED_REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.MIRRORED_REPEAT)},o.prototype.destroy=function(){this.gl.deleteTexture(this.texture)},o.fromSource=function(e,t,r){var n=new o(e);return n.premultiplyAlpha=r||!1,n.upload(t),n},o.fromData=function(e,t,r,n){var i=new o(e);return i.uploadData(t,r,n),i},t.exports=o},{}],13:[function(e,t,r){var i=e("./setVertexAttribArrays");function n(e,t){if(this.nativeVaoExtension=null,n.FORCE_NATIVE||(this.nativeVaoExtension=e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object")),this.nativeState=t,this.nativeVaoExtension){this.nativeVao=this.nativeVaoExtension.createVertexArrayOES();var r=e.getParameter(e.MAX_VERTEX_ATTRIBS);this.nativeState={tempAttribState:new Array(r),attribState:new Array(r)}}this.gl=e,this.attributes=[],this.indexBuffer=null,this.dirty=!1}n.prototype.constructor=n,(t.exports=n).FORCE_NATIVE=!1,n.prototype.bind=function(){if(this.nativeVao){if(this.nativeVaoExtension.bindVertexArrayOES(this.nativeVao),this.dirty)return this.dirty=!1,this.activate(),this;this.indexBuffer&&this.indexBuffer.bind()}else this.activate();return this},n.prototype.unbind=function(){return this.nativeVao&&this.nativeVaoExtension.bindVertexArrayOES(null),this},n.prototype.activate=function(){for(var e=this.gl,t=null,r=0;r= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=_-y,S=Math.floor,M=String.fromCharCode;function P(e){throw new RangeError(f[e])}function d(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function p(e,t){var r=e.split("@"),n="";return 1>>10&1023|55296),e=56320|1023&e),t+=M(e)}).join("")}function E(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function A(e,t,r){var n=0;for(e=r?S(e/s):e>>1,e+=S(e/t);h*b>>1S((v-p)/a))&&P("overflow"),p+=u*a,!(u<(l=s<=m?y:m+b<=s?b:s-m));s+=_)a>S(v/(c=_-l))&&P("overflow"),a*=c;m=A(p-o,t=h.length+1,0==o),S(p/t)>v-g&&P("overflow"),g+=S(p/t),p%=t,h.splice(p++,0,g)}return k(h)}function m(e){var t,r,n,i,o,a,s,u,l,c,f,h,d,p,g,m=[];for(h=(e=C(e)).length,t=w,o=x,a=r=0;aS((v-r)/(d=n+1))&&P("overflow"),r+=(s-t)*d,t=s,a=0;av&&P("overflow"),f==t){for(u=r,l=_;!(u<(c=l<=o?y:o+b<=l?b:l-o));l+=_)g=u-c,p=_-c,m.push(M(E(c+g%p,0))),u=S(g/p);m.push(M(E(u,0))),o=A(r,d,n==i),r=0,++n}++r,++t}return m.join("")}if(i={version:"1.4.1",ucs2:{decode:C,encode:k},decode:g,encode:m,toASCII:function(e){return p(e,function(e){return l.test(e)?"xn--"+m(e):e})},toUnicode:function(e){return p(e,function(e){return u.test(e)?g(e.slice(4).toLowerCase()):e})}},t&&r)if(R.exports==t)r.exports=i;else for(o in i)i.hasOwnProperty(o)&&(t[o]=i[o]);else e.punycode=i}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],28:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){t=t||"&",r=r||"=";var i={};if("string"!=typeof e||0===e.length)return i;var o=/\+/g;e=e.split(t);var a=1e3;n&&"number"==typeof n.maxKeys&&(a=n.maxKeys);var s,u,l=e.length;0>2,i[1]=(3&n[0])<<4|n[1]>>4,i[2]=(15&n[1])<<2|n[2]>>6,i[3]=63&n[2],r-(e.length-1)){case 2:i[3]=64,i[2]=64;break;case 1:i[3]=64}for(var a=0;a",'"',"`"," ","\r","\n","\t"]),j=["'"].concat(i),F=["%","/","?",";","#"].concat(j),B=["/","?","#"],z=/^[+a-z0-9A-Z_-]{0,63}$/,U=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,X={javascript:!0,"javascript:":!0},q={javascript:!0,"javascript:":!0},H={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Y=e("querystring");function o(e,t,r){if(e&&D.isObject(e)&&e instanceof C)return e;var n=new C;return n.parse(e,t,r),n}C.prototype.parse=function(e,t,r){if(!D.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),i=-1!==n&&nthis.renderer.width&&(e.width=this.renderer.width-e.x),e.y+e.height>this.renderer.height&&(e.height=this.renderer.height-e.y)},r.prototype.addChild=function(e){var t=this.pool.pop();t||((t=document.createElement("button")).style.width="100px",t.style.height="100px",t.style.backgroundColor=this.debug?"rgba(255,0,0,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=2,t.style.borderStyle="none",-1]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,r.SHAPES={POLY:0,RECT:1,CIRC:2,ELIP:3,RREC:4},r.PRECISION={LOW:"lowp",MEDIUM:"mediump",HIGH:"highp"},r.TRANSFORM_MODE={STATIC:0,DYNAMIC:1},r.TEXT_GRADIENT={LINEAR_VERTICAL:0,LINEAR_HORIZONTAL:1},r.UPDATE_PRIORITY={INTERACTION:50,HIGH:25,NORMAL:0,LOW:-25,UTILITY:-50}},{}],47:[function(e,t,r){"use strict";r.__esModule=!0;var n=e("../math");var i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null}return e.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},e.prototype.clear=function(){this.updateID++,this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},e.prototype.getRectangle=function(e){return this.minX>this.maxX||this.minY>this.maxY?n.Rectangle.EMPTY:((e=e||new n.Rectangle(0,0,1,1)).x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)},e.prototype.addPoint=function(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)},e.prototype.addQuad=function(e){var t=this.minX,r=this.minY,n=this.maxX,i=this.maxY,o=e[0],a=e[1];t=on?e.maxX:n,this.maxY=e.maxY>i?e.maxY:i},e.prototype.addBoundsMask=function(e,t){var r=e.minX>t.minX?e.minX:t.minX,n=e.minY>t.minY?e.minY:t.minY,i=e.maxXt.x?e.minX:t.x,n=e.minY>t.y?e.minY:t.y,i=e.maxXthis.children.length)throw new Error(e+"addChildAt: The index "+t+" supplied is out of bounds "+this.children.length);return e.parent&&e.parent.removeChild(e),e.parent=this,e.transform._parentID=-1,this.children.splice(t,0,e),this._boundsID++,this.onChildrenChange(t),e.emit("added",this),e},t.prototype.swapChildren=function(e,t){if(e!==t){var r=this.getChildIndex(e),n=this.getChildIndex(t);this.children[r]=t,this.children[n]=e,this.onChildrenChange(r=this.children.length)throw new Error("The index "+t+" supplied is out of bounds "+this.children.length);var r=this.getChildIndex(e);(0,a.removeItems)(this.children,r,1),this.children.splice(t,0,e),this.onChildrenChange(t)},t.prototype.getChildAt=function(e){if(e<0||e>=this.children.length)throw new Error("getChildAt: Index ("+e+") does not exist.");return this.children[e]},t.prototype.removeChild=function(e){var t=arguments.length;if(1T.CURVES.maxSegments&&(t=T.CURVES.maxSegments),t},T.prototype.lineStyle=function(){var e=0>16&255)/255,r=(e.tint>>8&255)/255,n=(255&e.tint)/255,i=0;i>16&255)/255*t*255<<16)+((a>>8&255)/255*r*255<<8)+(255&a)/255*n*255,o._lineTint=((s>>16&255)/255*t*255<<16)+((s>>8&255)/255*r*255<<8)+(255&s)/255*n*255}},t.prototype.renderPolygon=function(e,t,r){r.moveTo(e[0],e[1]);for(var n=1;n=this.x&&e=this.y&&t=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){if(t>=this.y+this.radius&&t<=this.y+this.height-this.radius||e>=this.x+this.radius&&e<=this.x+this.width-this.radius)return!0;var r=e-(this.x+this.radius),n=t-(this.y+this.radius),i=this.radius*this.radius;if(r*r+n*n<=i)return!0;if((r=e-(this.x+this.width-this.radius))*r+n*n<=i)return!0;if(r*r+(n=t-(this.y+this.height-this.radius))*n<=i)return!0;if((r=e-(this.x+this.radius))*r+n*n<=i)return!0}return!1},o}();r.default=n},{"../../const":46}],76:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(){function n(e,t){for(var r=0;rthis.checkCountMax&&(this.checkCount=0,this.run()))},t.prototype.run=function(){for(var e=this.renderer.textureManager,t=e._managedTextures,r=!1,n=0;nthis.maxIdle&&(e.destroyTexture(i,!0),r=!(t[n]=null))}if(r){for(var o=0,a=0;a 0.5)"," {"," color = vec4(1.0, 0.0, 0.0, 1.0);"," }"," else"," {"," color = vec4(0.0, 1.0, 0.0, 1.0);"," }"," gl_FragColor = mix(sample, masky, 0.5);"," gl_FragColor *= sample.a;","}"].join("\n")}}]),i}();r.default=c},{"../../../const":46,"../../../settings":101,"../../../utils":125,"./extractUniformsFromSrc":87}],87:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e,t,r){var n=o(e),i=o(t);return Object.assign(n,i)};var n,i=e("pixi-gl-core");var f=((n=i)&&n.__esModule?n:{default:n}).default.shader.defaultValue;function o(e){for(var t=new RegExp("^(projectionMatrix|uSampler|filterArea|filterClamp)$"),r={},n=void 0,i=e.replace(/\s+/g," ").split(/\s*;\s*/),o=0;o=n&&c.x=i&&c.y>16)+(65280&e)+((255&e)<<16)}},{key:"texture",get:function(){return this._texture},set:function(e){this._texture!==e&&(this._texture=e||u.default.EMPTY,this.cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.hasLoaded?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))}}]),n}(n.default);r.default=f},{"../const":46,"../display/Container":48,"../math":70,"../textures/Texture":115,"../utils":125}],103:[function(e,t,r){"use strict";r.__esModule=!0;var n=i(e("../../renderers/canvas/CanvasRenderer")),c=e("../../const"),f=e("../../math"),h=i(e("./CanvasTinter"));function i(e){return e&&e.__esModule?e:{default:e}}var d=new f.Matrix,o=function(){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.renderer=e}return t.prototype.render=function(e){var t=e._texture,r=this.renderer,n=t._frame.width,i=t._frame.height,o=e.transform.worldTransform,a=0,s=0;if(!(t.orig.width<=0||t.orig.height<=0)&&t.baseTexture.source&&(r.setBlendMode(e.blendMode),t.valid)){r.context.globalAlpha=e.worldAlpha;var u=t.baseTexture.scaleMode===c.SCALE_MODES.LINEAR;r.smoothProperty&&r.context[r.smoothProperty]!==u&&(r.context[r.smoothProperty]=u),s=t.trim?(a=t.trim.width/2+t.trim.x-e.anchor.x*t.orig.width,t.trim.height/2+t.trim.y-e.anchor.y*t.orig.height):(a=(.5-e.anchor.x)*t.orig.width,(.5-e.anchor.y)*t.orig.height),t.rotate&&(o.copy(d),o=d,f.GroupD8.matrixAppendRotationInv(o,t.rotate,a,s),s=a=0),a-=n/2,s-=i/2,r.roundPixels?(r.context.setTransform(o.a,o.b,o.c,o.d,o.tx*r.resolution|0,o.ty*r.resolution|0),a|=0,s|=0):r.context.setTransform(o.a,o.b,o.c,o.d,o.tx*r.resolution,o.ty*r.resolution);var l=t.baseTexture.resolution;16777215!==e.tint?(e.cachedTint===e.tint&&e.tintedTexture.tintId===e._texture._updateID||(e.cachedTint=e.tint,e.tintedTexture=h.default.getTintedTexture(e,e.tint)),r.context.drawImage(e.tintedTexture,0,0,n*l,i*l,a*r.resolution,s*r.resolution,n*r.resolution,i*r.resolution)):r.context.drawImage(t.baseTexture.source,t._frame.x*l,t._frame.y*l,n*l,i*l,a*r.resolution,s*r.resolution,n*r.resolution,i*r.resolution)}},t.prototype.destroy=function(){this.renderer=null},t}();r.default=o,n.default.registerPlugin("sprite",o)},{"../../const":46,"../../math":70,"../../renderers/canvas/CanvasRenderer":77,"./CanvasTinter":104}],104:[function(e,t,r){"use strict";r.__esModule=!0;var n,d=e("../../utils"),i=e("../../renderers/canvas/utils/canUseNewCanvasBlendModes");var s={getTintedTexture:function(e,t){var r=e._texture,n="#"+("00000"+(0|(t=s.roundColor(t))).toString(16)).substr(-6);r.tintCache=r.tintCache||{};var i=r.tintCache[n],o=void 0;if(i){if(i.tintId===r._updateID)return r.tintCache[n];o=r.tintCache[n]}else o=s.canvas||document.createElement("canvas");if(s.tintMethod(r,t,o),o.tintId=r._updateID,s.convertTintToImage){var a=new Image;a.src=o.toDataURL(),r.tintCache[n]=a}else r.tintCache[n]=o,s.canvas=null;return o},tintWithMultiply:function(e,t,r){var n=r.getContext("2d"),i=e._frame.clone(),o=e.baseTexture.resolution;i.x*=o,i.y*=o,i.width*=o,i.height*=o,r.width=Math.ceil(i.width),r.height=Math.ceil(i.height),n.save(),n.fillStyle="#"+("00000"+(0|t).toString(16)).substr(-6),n.fillRect(0,0,i.width,i.height),n.globalCompositeOperation="multiply",n.drawImage(e.baseTexture.source,i.x,i.y,i.width,i.height,0,0,i.width,i.height),n.globalCompositeOperation="destination-atop",n.drawImage(e.baseTexture.source,i.x,i.y,i.width,i.height,0,0,i.width,i.height),n.restore()},tintWithOverlay:function(e,t,r){var n=r.getContext("2d"),i=e._frame.clone(),o=e.baseTexture.resolution;i.x*=o,i.y*=o,i.width*=o,i.height*=o,r.width=Math.ceil(i.width),r.height=Math.ceil(i.height),n.save(),n.globalCompositeOperation="copy",n.fillStyle="#"+("00000"+(0|t).toString(16)).substr(-6),n.fillRect(0,0,i.width,i.height),n.globalCompositeOperation="destination-atop",n.drawImage(e.baseTexture.source,i.x,i.y,i.width,i.height,0,0,i.width,i.height),n.restore()},tintWithPerPixel:function(e,t,r){var n=r.getContext("2d"),i=e._frame.clone(),o=e.baseTexture.resolution;i.x*=o,i.y*=o,i.width*=o,i.height*=o,r.width=Math.ceil(i.width),r.height=Math.ceil(i.height),n.save(),n.globalCompositeOperation="copy",n.drawImage(e.baseTexture.source,i.x,i.y,i.width,i.height,0,0,i.width,i.height),n.restore();for(var a=(0,d.hex2rgb)(t),s=a[0],u=a[1],l=a[2],c=n.getImageData(0,0,i.width,i.height),f=c.data,h=0;h=this.size&&this.flush(),e._texture._uvs&&(this.sprites[this.currentIndex++]=e)},o.prototype.flush=function(){if(0!==this.currentIndex){var e=this.renderer.gl,t=this.MAX_TEXTURES,r=z.default.nextPow2(this.currentIndex),n=z.default.log2(r),i=this.buffers[n],o=this.sprites,a=this.groups,s=i.float32View,u=i.uint32View,l=this.boundTextures,c=this.renderer.boundTextures,f=this.renderer.textureGC.count,h=0,d=void 0,p=void 0,g=1,m=0,v=a[0],_=void 0,y=void 0,b=F.premultiplyBlendMode[o[0]._texture.baseTexture.premultipliedAlpha?1:0][o[0].blendMode];v.textureCount=0,v.start=0,v.blend=b,U++;var x=void 0;for(x=0;x=r.length)break;o=r[i++]}else{if((i=r.next()).done)break;o=i.value}var a=o;this.animations[t].push(this.textures[a])}}},f.prototype._parseComplete=function(){var e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)},f.prototype._nextBatch=function(){var e=this;this._processFrames(this._batchIndex*f.BATCH_SIZE),this._batchIndex++,setTimeout(function(){e._batchIndex*f.BATCH_SIZEthis.baseTexture.width,a=r+i>this.baseTexture.height;if(o||a){var s=o&&a?"and":"or",u="X: "+t+" + "+n+" = "+(t+n)+" > "+this.baseTexture.width,l="Y: "+r+" + "+i+" = "+(r+i)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+u+" "+s+" "+l)}this.valid=n&&i&&this.baseTexture.hasLoaded,this.trim||this.rotate||(this.orig=e),this.valid&&this._updateUvs()}},{key:"rotate",get:function(){return this._rotate},set:function(e){this._rotate=e,this.valid&&this._updateUvs()}},{key:"width",get:function(){return this.orig.width}},{key:"height",get:function(){return this.orig.height}}]),u}(s.default);function d(e){e.destroy=function(){},e.on=function(){},e.once=function(){},e.emit=function(){}}(r.default=h).EMPTY=new h(new o.default),d(h.EMPTY),d(h.EMPTY.baseTexture),h.WHITE=function(){var e=document.createElement("canvas");e.width=10,e.height=10;var t=e.getContext("2d");return t.fillStyle="white",t.fillRect(0,0,10,10),new h(new o.default(e))}(),d(h.WHITE),d(h.WHITE.baseTexture)},{"../math":70,"../settings":101,"../utils":125,"./BaseTexture":112,"./TextureUvs":117,"./VideoBaseTexture":118,eventemitter3:3}],116:[function(e,t,r){"use strict";r.__esModule=!0;var n,i=function(){function n(e,t){for(var r=0;rt.priority){e.connect(r);break}t=(r=t).next}e.previous||e.connect(r)}else e.connect(r);return this._startIfPossible(),this},e.prototype.remove=function(e,t){for(var r=this._head.next;r;)r=r.match(e,t)?r.destroy():r.next;return this._head.next||this._cancelIfNeeded(),this},e.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},e.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},e.prototype.destroy=function(){this.stop();for(var e=this._head.next;e;)e=e.destroy(!0);this._head.destroy(),this._head=null},e.prototype.update=function(){var e=0this.lastTime){(t=this.elapsedMS=e-this.lastTime)>this._maxElapsedMS&&(t=this._maxElapsedMS),this.deltaTime=t*i.default.TARGET_FPMS*this.speed;for(var r=this._head,n=r.next;n;)n=n.emit(this.deltaTime);r.next||this._cancelIfNeeded()}else this.deltaTime=this.elapsedMS=0;this.lastTime=e},n(e,[{key:"FPS",get:function(){return 1e3/this.elapsedMS}},{key:"minFPS",get:function(){return 1e3/this._maxElapsedMS},set:function(e){var t=Math.min(Math.max(0,e)/1e3,i.default.TARGET_FPMS);this._maxElapsedMS=1/t}}]),e}();r.default=u},{"../const":46,"../settings":101,"./TickerListener":120}],120:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(){function i(e){var t=1>16&255)/255,t[1]=(e>>8&255)/255,t[2]=(255&e)/255,t},r.hex2string=function(e){return e=e.toString(16),"#"+(e="000000".substr(0,6-e.length)+e)},r.rgb2hex=function(e){return(255*e[0]<<16)+(255*e[1]<<8)+(255*e[2]|0)},r.getResolutionOfUrl=function(e,t){var r=i.default.RETINA_PREFIX.exec(e);if(r)return parseFloat(r[1]);return void 0!==t?t:1},r.decomposeDataUri=function(e){var t=n.DATA_URI.exec(e);if(t)return{mediaType:t[1]?t[1].toLowerCase():void 0,subType:t[2]?t[2].toLowerCase():void 0,charset:t[3]?t[3].toLowerCase():void 0,encoding:t[4]?t[4].toLowerCase():void 0,data:t[5]};return},r.getUrlFileExtension=function(e){var t=n.URL_FILE_EXTENSION.exec(e);if(t)return t[1].toLowerCase();return},r.getSvgSize=function(e){var t=n.SVG_SIZE.exec(e),r={};t&&(r[t[1]]=Math.round(parseFloat(t[3])),r[t[5]]=Math.round(parseFloat(t[7])));return r},r.skipHello=function(){g=!0},r.sayHello=function(e){if(g)return;if(-1>16&255,n=e>>8&255,i=255&e;return(255*t<<24)+((r=r*t+.5|0)<<16)+((n=n*t+.5|0)<<8)+(i=i*t+.5|0)},r.premultiplyRgba=function(e,t,r,n){r=r||new Float32Array(4),n||void 0===n?(r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t):(r[0]=e[0],r[1]=e[1],r[2]=e[2]);return r[3]=t,r},r.premultiplyTintToRgba=function(e,t,r,n){(r=r||new Float32Array(4))[0]=(e>>16&255)/255,r[1]=(e>>8&255)/255,r[2]=(255&e)/255,(n||void 0===n)&&(r[0]*=t,r[1]*=t,r[2]*=t);return r[3]=t,r};var n=e("../const"),i=d(e("../settings")),o=d(e("eventemitter3")),a=d(e("./pluginTarget")),s=h(e("./mixin")),u=h(e("ismobilejs")),l=d(e("remove-array-items")),c=d(e("./mapPremultipliedBlendModes")),f=d(e("earcut"));function h(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function d(e){return e&&e.__esModule?e:{default:e}}var p=0,g=!1;r.isMobile=u,r.removeItems=l.default,r.EventEmitter=o.default,r.pluginTarget=a.default,r.mixins=s,r.earcut=f.default;var m=r.TextureCache=Object.create(null),v=r.BaseTextureCache=Object.create(null);var _=r.premultiplyBlendMode=(0,c.default)()},{"../const":46,"../settings":101,"./mapPremultipliedBlendModes":126,"./mixin":128,"./pluginTarget":129,earcut:2,eventemitter3:3,ismobilejs:4,"remove-array-items":31}],126:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(){for(var e=[],t=[],r=0;r<32;r++)e[r]=r,t[r]=r;e[i.BLEND_MODES.NORMAL_NPM]=i.BLEND_MODES.NORMAL,e[i.BLEND_MODES.ADD_NPM]=i.BLEND_MODES.ADD,e[i.BLEND_MODES.SCREEN_NPM]=i.BLEND_MODES.SCREEN,t[i.BLEND_MODES.NORMAL]=i.BLEND_MODES.NORMAL_NPM,t[i.BLEND_MODES.ADD]=i.BLEND_MODES.ADD_NPM,t[i.BLEND_MODES.SCREEN]=i.BLEND_MODES.SCREEN_NPM;var n=[];return n.push(t),n.push(e),n};var i=e("../const")},{"../const":46}],127:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e){if(o.default.tablet||o.default.phone)return 4;return e};var n,i=e("ismobilejs"),o=(n=i)&&n.__esModule?n:{default:n}},{ismobilejs:4}],128:[function(e,t,r){"use strict";function n(e,t){if(e&&t)for(var r=Object.keys(t),n=0;n=this._durations[this.currentFrame];)n-=this._durations[this.currentFrame]*i,this._currentTime+=i;this._currentTime+=n/this._durations[this.currentFrame]}else this._currentTime+=t;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):r!==this.currentFrame&&(this.loop&&this.onLoop&&(0r&&this.onLoop()),this.updateTexture())},i.prototype.updateTexture=function(){this._texture=this._textures[this.currentFrame],this._textureID=-1,this.cachedTint=16777215,this.updateAnchor&&this._anchor.copy(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame)},i.prototype.destroy=function(e){this.stop(),n.prototype.destroy.call(this,e)},i.fromFrames=function(e){for(var t=[],r=0;rs&&(++p,O.utils.removeItems(n,1+h-p,1+m-h),m=h,h=-1,i.push(d),c=Math.max(c,d),f++,r.x=0,r.y+=e.lineHeight,u=null))}else i.push(l),c=Math.max(c,l),++f,++p,r.x=0,r.y+=e.lineHeight,u=null}var b=o.charAt(o.length-1);"\r"!==b&&"\n"!==b&&(/(?:\s)/.test(b)&&(l=d),i.push(l),c=Math.max(c,l));for(var x=[],w=0;w<=f;w++){var T=0;"right"===this._font.align?T=c-i[w]:"center"===this._font.align&&(T=(c-i[w])/2),x.push(T)}for(var S=n.length,M=this.tint,P=0;P=n&&s.x=i&&s.y 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n"));return e.uniforms.m=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],e.alpha=1,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(r,t),r.prototype._loadMatrix=function(e){var t=e;1>16&255)/255,a=(r>>8&255)/255,s=(255&r)/255,u=((n=n||3375104)>>16&255)/255,l=(n>>8&255)/255,c=(255&n)/255,f=[.3,.59,.11,0,0,o,a,s,e=e||.2,0,u,l,c,t=t||.15,0,o-u,a-l,s-c,0,0];this._loadMatrix(f,i)},r.prototype.night=function(e,t){var r=[-2*(e=e||.1),-e,0,0,0,-e,0,e,0,0,0,e,2*e,0,0,0,0,0,1,0];this._loadMatrix(r,t)},r.prototype.predator=function(e,t){var r=[11.224130630493164*e,-4.794486999511719*e,-2.8746118545532227*e,0*e,.40342438220977783*e,-3.6330697536468506*e,9.193157196044922*e,-2.951810836791992*e,0*e,-1.316135048866272*e,-3.2184197902679443*e,-4.2375030517578125*e,7.476448059082031*e,0*e,.8044459223747253*e,0,0,0,1,0];this._loadMatrix(r,t)},r.prototype.lsd=function(e){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],e)},r.prototype.reset=function(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)},n(r,[{key:"matrix",get:function(){return this.uniforms.m},set:function(e){this.uniforms.m=e}},{key:"alpha",get:function(){return this.uniforms.uAlpha},set:function(e){this.uniforms.uAlpha=e}}]),r}(i.Filter);(r.default=o).prototype.grayscale=o.prototype.greyscale},{"../../core":65,path:8}],151:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(){function n(e,t){for(var r=0;r lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec2 fragCoord = vTextureCoord * filterArea.xy;\n\n vec4 color;\n\n color = fxaa(uSampler, fragCoord, filterArea.xy, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n'))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(n.Filter);r.default=i},{"../../core":65,path:8}],153:[function(e,t,r){"use strict";r.__esModule=!0;var n=e("./fxaa/FXAAFilter");Object.defineProperty(r,"FXAAFilter",{enumerable:!0,get:function(){return f(n).default}});var i=e("./noise/NoiseFilter");Object.defineProperty(r,"NoiseFilter",{enumerable:!0,get:function(){return f(i).default}});var o=e("./displacement/DisplacementFilter");Object.defineProperty(r,"DisplacementFilter",{enumerable:!0,get:function(){return f(o).default}});var a=e("./blur/BlurFilter");Object.defineProperty(r,"BlurFilter",{enumerable:!0,get:function(){return f(a).default}});var s=e("./blur/BlurXFilter");Object.defineProperty(r,"BlurXFilter",{enumerable:!0,get:function(){return f(s).default}});var u=e("./blur/BlurYFilter");Object.defineProperty(r,"BlurYFilter",{enumerable:!0,get:function(){return f(u).default}});var l=e("./colormatrix/ColorMatrixFilter");Object.defineProperty(r,"ColorMatrixFilter",{enumerable:!0,get:function(){return f(l).default}});var c=e("./alpha/AlphaFilter");function f(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"AlphaFilter",{enumerable:!0,get:function(){return f(c).default}})},{"./alpha/AlphaFilter":143,"./blur/BlurFilter":144,"./blur/BlurXFilter":145,"./blur/BlurYFilter":146,"./colormatrix/ColorMatrixFilter":150,"./displacement/DisplacementFilter":151,"./fxaa/FXAAFilter":152,"./noise/NoiseFilter":154}],154:[function(e,t,r){"use strict";r.__esModule=!0;var o=function(){function n(e,t){for(var r=0;r 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n"));return r.noise=e,r.seed=t,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(i,n),o(i,[{key:"noise",get:function(){return this.uniforms.uNoise},set:function(e){this.uniforms.uNoise=e}},{key:"seed",get:function(){return this.uniforms.uSeed},set:function(e){this.uniforms.uSeed=e}}]),i}(n.Filter);r.default=i},{"../../core":65,path:8}],155:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(){function n(e,t){for(var r=0;rt?1:this._height/t;e[9]=e[11]=e[13]=e[15]=this._topHeight*r,e[17]=e[19]=e[21]=e[23]=this._height-this._bottomHeight*r,e[25]=e[27]=e[29]=e[31]=this._height},s.prototype.updateVerticalVertices=function(){var e=this.vertices,t=this._leftWidth+this._rightWidth,r=this._width>t?1:this._width/t;e[2]=e[10]=e[18]=e[26]=this._leftWidth*r,e[4]=e[12]=e[20]=e[28]=this._width-this._rightWidth*r,e[6]=e[14]=e[22]=e[30]=this._width},s.prototype._renderCanvas=function(e){var t=e.context,r=this.worldTransform,n=e.resolution,i=16777215!==this.tint,o=this._texture;i&&this._cachedTint!==this.tint&&(this._cachedTint=this.tint,this._tintedTexture=x.default.getTintedTexture(this,this.tint));var a=i?this._tintedTexture:o.baseTexture.source;this._canvasUvs||(this._canvasUvs=[0,0,0,0,0,0,0,0]);var s=this.vertices,u=this._canvasUvs,l=i?0:o.frame.x,c=i?0:o.frame.y,f=l+o.frame.width,h=c+o.frame.height;u[0]=l,u[1]=l+this._leftWidth,u[2]=f-this._rightWidth,u[3]=f,u[4]=c,u[5]=c+this._topHeight,u[6]=h-this._bottomHeight,u[7]=h;for(var d=0;d<8;d++)u[d]*=o.baseTexture.resolution;t.globalAlpha=this.worldAlpha,e.setBlendMode(this.blendMode),e.roundPixels?t.setTransform(r.a*n,r.b*n,r.c*n,r.d*n,r.tx*n|0,r.ty*n|0):t.setTransform(r.a*n,r.b*n,r.c*n,r.d*n,r.tx*n,r.ty*n);for(var p=0;p<3;p++)for(var g=0;g<3;g++){var m=2*g+8*p,v=Math.max(1,u[g+1]-u[g]),_=Math.max(1,u[p+5]-u[p+4]),y=Math.max(1,s[10+m]-s[m]),b=Math.max(1,s[11+m]-s[1+m]);t.drawImage(a,u[g],u[p+4],v,_,s[m],s[1+m],y,b)}},s.prototype._refresh=function(){a.prototype._refresh.call(this);var e=this.uvs,t=this._texture;this._origWidth=t.orig.width,this._origHeight=t.orig.height;var r=1/this._origWidth,n=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=r*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-r*this._rightWidth,e[9]=e[11]=e[13]=e[15]=n*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-n*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.dirty++,this.multiplyUvs()},n(s,[{key:"width",get:function(){return this._width},set:function(e){this._width=e,this._refresh()}},{key:"height",get:function(){return this._height},set:function(e){this._height=e,this._refresh()}},{key:"leftWidth",get:function(){return this._leftWidth},set:function(e){this._leftWidth=e,this._refresh()}},{key:"rightWidth",get:function(){return this._rightWidth},set:function(e){this._rightWidth=e,this._refresh()}},{key:"topHeight",get:function(){return this._topHeight},set:function(e){this._topHeight=e,this._refresh()}},{key:"bottomHeight",get:function(){return this._bottomHeight},set:function(e){this._bottomHeight=e,this._refresh()}}]),s}(i.default);r.default=a},{"../core/sprites/canvas/CanvasTinter":104,"./Plane":168}],168:[function(e,t,r){"use strict";r.__esModule=!0;var n,i=e("./Mesh"),a=(n=i)&&n.__esModule?n:{default:n};var o=function(i){function o(e,t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,i.call(this,e));return n._ready=!0,n.verticesX=t||10,n.verticesY=r||10,n.drawMode=a.default.DRAW_MODES.TRIANGLES,n.refresh(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(o,i),o.prototype._refresh=function(){for(var e=this._texture,t=this.verticesX*this.verticesY,r=[],n=[],i=[],o=this.verticesX-1,a=this.verticesY-1,s=e.width/o,u=e.height/a,l=0;l=a.length){if(!e.autoResize)break;a.push(this._generateOneMoreBuffer(e))}var p=a[h];p.uploadDynamic(t,f,d);var g=e._bufferUpdateIDs[h]||0;(c=c||p._updateID 0) var gc = undefined");else{if(!ba&&!ca)throw"Unknown runtime environment. Where are we?";e.read=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},"undefined"!=typeof arguments&&(e.arguments=arguments),"undefined"!=typeof console?(e.print||(e.print=function(e){console.log(e)}),e.printErr||(e.printErr=function(e){console.log(e)})):e.print||(e.print=function(){}),ca&&(e.load=importScripts),void 0===e.setWindowTitle&&(e.setWindowTitle=function(e){document.title=e})}function ha(e){eval.call(null,e)}for(k in!e.load&&e.read&&(e.load=function(t){ha(e.read(t))}),e.print||(e.print=function(){}),e.printErr||(e.printErr=e.print),e.arguments||(e.arguments=[]),e.thisProgram||(e.thisProgram="./this.program"),e.print=e.print,e.W=e.printErr,e.preRun=[],e.postRun=[],aa)aa.hasOwnProperty(k)&&(e[k]=aa[k]);var n={rb:function(e){ka=e},fb:function(){return ka},ua:function(){return m},ba:function(e){m=e},Ka:function(e){switch(e){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:return"*"===e[e.length-1]?n.J:"i"===e[0]?(assert(0==(e=parseInt(e.substr(1)))%8),e/8):0}},eb:function(e){return Math.max(n.Ka(e),n.J)},ud:16,Qd:function(e,t){return"double"===t||"i64"===t?7&e&&(assert(4==(7&e)),e+=4):assert(0==(3&e)),e},Ed:function(e,t,r){return r||"i64"!=e&&"double"!=e?e?Math.min(t||(e?n.eb(e):0),n.J):Math.min(t,8):8},L:function(t,r,n){return n&&n.length?(n.splice||(n=Array.prototype.slice.call(n)),n.splice(0,0,r),e["dynCall_"+t].apply(null,n)):e["dynCall_"+t].call(null,r)},Z:[],Xa:function(e){for(var t=0;t>>0)+4294967296*+(t>>>0):+(e>>>0)+4294967296*+(0|t)},Ua:8,J:4,vd:0};e.Runtime=n,n.addFunction=n.Xa,n.removeFunction=n.nb;var na=!1,oa,pa,ka,ra,sa;function assert(e,t){e||x("Assertion failed: "+t)}function qa(a){var b=e["_"+a];if(!b)try{b=eval("_"+a)}catch(e){}return assert(b,"Cannot call unknown function "+a+" (perhaps LLVM optimizations or closure removed it?)"),b}function wa(e,t,r){switch("*"===(r=r||"i8").charAt(r.length-1)&&(r="i32"),r){case"i1":case"i8":y[e>>0]=t;break;case"i16":z[e>>1]=t;break;case"i32":C[e>>2]=t;break;case"i64":pa=[t>>>0,(oa=t,1<=+xa(oa)?0>>0:~~+Aa((oa-+(~~oa>>>0))/4294967296)>>>0:0)],C[e>>2]=pa[0],C[e+4>>2]=pa[1];break;case"float":Ba[e>>2]=t;break;case"double":Ca[e>>3]=t;break;default:x("invalid type for setValue: "+r)}}function Da(e,t){switch("*"===(t=t||"i8").charAt(t.length-1)&&(t="i32"),t){case"i1":case"i8":return y[e>>0];case"i16":return z[e>>1];case"i32":case"i64":return C[e>>2];case"float":return Ba[e>>2];case"double":return Ca[e>>3];default:x("invalid type for setValue: "+t)}return null}function D(e,t,r,i){var o,a;a="number"==typeof e?(o=!0,e):(o=!1,e.length);var s,u,l="string"==typeof t?t:null;if(r=4==r?i:[Ea,n.aa,n.Ra,n.R][void 0===r?2:r](Math.max(a,l?1:t.length)),o){for(assert(0==(3&(i=r))),e=r+(-4&a);i>2]=0;for(e=r+a;i>0]=0;return r}if("i8"===l)return e.subarray||e.slice?E.set(e,r):E.set(new Uint8Array(e),r),r;for(i=0;i>0],0!=n||r)&&(o++,!r||o!=r););if(r||(r=o),n="",i<128){for(;0>10,56320|1023&r)))):s+=String.fromCharCode(r)}}function Ka(e,t,r,n){if(!(0>6}else{if(a<=65535){if(n<=r+2)break;t[r++]=224|a>>12}else{if(a<=2097151){if(n<=r+3)break;t[r++]=240|a>>18}else{if(a<=67108863){if(n<=r+4)break;t[r++]=248|a>>24}else{if(n<=r+5)break;t[r++]=252|a>>30,t[r++]=128|a>>24&63}t[r++]=128|a>>18&63}t[r++]=128|a>>12&63}t[r++]=128|a>>6&63}t[r++]=128|63&a}}return t[r]=0,r-i}function La(e){for(var t=0,r=0;r"):o=i;e:for(;f>0];if(!r)return t;t+=String.fromCharCode(r)}},e.stringToAscii=function(e,t){return Ia(e,t,!1)},e.UTF8ArrayToString=Ja,e.UTF8ToString=function(e){return Ja(E,e)},e.stringToUTF8Array=Ka,e.stringToUTF8=function(e,t,r){return Ka(e,E,t,r)},e.lengthBytesUTF8=La,e.UTF16ToString=function(e){for(var t=0,r="";;){var n=z[e+2*t>>1];if(0==n)return r;++t,r+=String.fromCharCode(n)}},e.stringToUTF16=function(e,t,r){if(void 0===r&&(r=2147483647),r<2)return 0;var n=t;r=(r-=2)<2*e.length?r/2:e.length;for(var i=0;i>1]=e.charCodeAt(i),t+=2;return z[t>>1]=0,t-n},e.lengthBytesUTF16=function(e){return 2*e.length},e.UTF32ToString=function(e){for(var t=0,r="";;){var n=C[e+4*t>>2];if(0==n)return r;++t,65536<=n?(n-=65536,r+=String.fromCharCode(55296|n>>10,56320|1023&n)):r+=String.fromCharCode(n)}},e.stringToUTF32=function(e,t,r){if(void 0===r&&(r=2147483647),r<4)return 0;var n=t;r=n+r-4;for(var i=0;i>2]=o,r<(t+=4)+4)break}return C[t>>2]=0,t-n},e.lengthBytesUTF32=function(e){for(var t=0,r=0;r>0]=e[r],r+=1}function ta(e,t){for(var r=0;r>0]=e[r]}function Ia(e,t,r){for(var n=0;n>0]=e.charCodeAt(n);r||(y[t>>0]=0)}e.addOnPreRun=fb,e.addOnInit=function(e){cb.unshift(e)},e.addOnPreMain=function(e){db.unshift(e)},e.addOnExit=function(e){H.unshift(e)},e.addOnPostRun=gb,e.intArrayFromString=hb,e.intArrayToString=function(e){for(var t=[],r=0;r>>16)*n+r*(t>>>16)<<16)|0}),Math.Jd=Math.imul,Math.clz32||(Math.clz32=function(e){e>>>=0;for(var t=0;t<32;t++)if(e&1<<31-t)return t;return 32}),Math.Ad=Math.clz32;var xa=Math.abs,Aa=Math.ceil,za=Math.floor,ya=Math.min,I=0,ib=null,jb=null;function kb(){I++,e.monitorRunDependencies&&e.monitorRunDependencies(I)}function lb(){if(I--,e.monitorRunDependencies&&e.monitorRunDependencies(I),0==I&&(null!==ib&&(clearInterval(ib),ib=null),jb)){var t=jb;jb=null,t()}}e.addRunDependency=kb,e.removeRunDependency=lb,e.preloadedImages={},e.preloadedAudios={},Ta=8,la=Ta+5888,cb.push(),D([124,0,0,0,98,7,0,0,124,0,0,0,111,7,0,0,164,0,0,0,124,7,0,0,16,0,0,0,0,0,0,0,164,0,0,0,157,7,0,0,24,0,0,0,0,0,0,0,164,0,0,0,227,7,0,0,24,0,0,0,0,0,0,0,164,0,0,0,191,7,0,0,56,0,0,0,0,0,0,0,164,0,0,0,5,8,0,0,40,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,40,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,88,0,0,0,1,0,0,0,5,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,114,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,124,1,0,0,236,1,0,0,236,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,4,0,0,0,239,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,4,0,0,0,231,16,0,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,115,40,37,117,41,58,32,65,115,115,101,114,116,105,111,110,32,102,97,105,108,117,114,101,58,32,34,37,115,34,10,0,109,95,115,105,122,101,32,60,61,32,109,95,99,97,112,97,99,105,116,121,0,46,47,99,114,110,95,100,101,99,111,109,112,46,104,0,109,105,110,95,110,101,119,95,99,97,112,97,99,105,116,121,32,60,32,40,48,120,55,70,70,70,48,48,48,48,85,32,47,32,101,108,101,109,101,110,116,95,115,105,122,101,41,0,110,101,119,95,99,97,112,97,99,105,116,121,32,38,38,32,40,110,101,119,95,99,97,112,97,99,105,116,121,32,62,32,109,95,99,97,112,97,99,105,116,121,41,0,110,117,109,95,99,111,100,101,115,91,99,93,0,115,111,114,116,101,100,95,112,111,115,32,60,32,116,111,116,97,108,95,117,115,101,100,95,115,121,109,115,0,112,67,111,100,101,115,105,122,101,115,91,115,121,109,95,105,110,100,101,120,93,32,61,61,32,99,111,100,101,115,105,122,101,0,116,32,60,32,40,49,85,32,60,60,32,116,97,98,108,101,95,98,105,116,115,41,0,109,95,108,111,111,107,117,112,91,116,93,32,61,61,32,99,85,73,78,84,51,50,95,77,65,88,0,99,114,110,100,95,109,97,108,108,111,99,58,32,115,105,122,101,32,116,111,111,32,98,105,103,0,99,114,110,100,95,109,97,108,108,111,99,58,32,111,117,116,32,111,102,32,109,101,109,111,114,121,0,40,40,117,105,110,116,51,50,41,112,95,110,101,119,32,38,32,40,67,82,78,68,95,77,73,78,95,65,76,76,79,67,95,65,76,73,71,78,77,69,78,84,32,45,32,49,41,41,32,61,61,32,48,0,99,114,110,100,95,114,101,97,108,108,111,99,58,32,98,97,100,32,112,116,114,0,99,114,110,100,95,102,114,101,101,58,32,98,97,100,32,112,116,114,0,102,97,108,115,101,0,40,116,111,116,97,108,95,115,121,109,115,32,62,61,32,49,41,32,38,38,32,40,116,111,116,97,108,95,115,121,109,115,32,60,61,32,112,114,101,102,105,120,95,99,111,100,105,110,103,58,58,99,77,97,120,83,117,112,112,111,114,116,101,100,83,121,109,115,41,0,17,18,19,20,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15,16,48,0,110,117,109,95,98,105,116,115,32,60,61,32,51,50,85,0,109,95,98,105,116,95,99,111,117,110,116,32,60,61,32,99,66,105,116,66,117,102,83,105,122,101,0,116,32,33,61,32,99,85,73,78,84,51,50,95,77,65,88,0,109,111,100,101,108,46,109,95,99,111,100,101,95,115,105,122,101,115,91,115,121,109,93,32,61,61,32,108,101,110,0,0,2,3,1,0,2,3,4,5,6,7,1,40,108,101,110,32,62,61,32,49,41,32,38,38,32,40,108,101,110,32,60,61,32,99,77,97,120,69,120,112,101,99,116,101,100,67,111,100,101,83,105,122,101,41,0,105,32,60,32,109,95,115,105,122,101,0,110,101,120,116,95,108,101,118,101,108,95,111,102,115,32,62,32,99,117,114,95,108,101,118,101,108,95,111,102,115,0,1,2,2,3,3,3,3,4,0,0,0,0,0,0,1,1,0,1,0,1,0,0,1,2,1,2,0,0,0,1,0,2,1,0,2,0,0,1,2,3,110,117,109,32,38,38,32,40,110,117,109,32,61,61,32,126,110,117,109,95,99,104,101,99,107,41,0,83,116,57,101,120,99,101,112,116,105,111,110,0,83,116,57,116,121,112,101,95,105,110,102,111,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,54,95,95,115,104,105,109,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,57,95,95,112,111,105,110,116,101,114,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,112,98,97,115,101,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,48,95,95,115,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,112,116,104,114,101,97,100,95,111,110,99,101,32,102,97,105,108,117,114,101,32,105,110,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,95,102,97,115,116,40,41,0,116,101,114,109,105,110,97,116,101,95,104,97,110,100,108,101,114,32,117,110,101,120,112,101,99,116,101,100,108,121,32,114,101,116,117,114,110,101,100,0,99,97,110,110,111,116,32,99,114,101,97,116,101,32,112,116,104,114,101,97,100,32,107,101,121,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,99,97,110,110,111,116,32,122,101,114,111,32,111,117,116,32,116,104,114,101,97,100,32,118,97,108,117,101,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,58,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,102,111,114,101,105,103,110,32,101,120,99,101,112,116,105,111,110,0,116,101,114,109,105,110,97,116,105,110,103,0,117,110,99,97,117,103,104,116,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116,32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,46,0],"i8",4,n.Ua);var mb=n.ja(D(12,"i8",2),8);function ob(t){return e.___errno_location&&(C[e.___errno_location()>>2]=t),t}assert(0==mb%8),e._i64Subtract=nb;var J={I:1,F:2,ed:3,bc:4,H:5,Aa:6,vb:7,zc:8,ea:9,Jb:10,va:11,qd:11,Ta:12,da:13,Vb:14,Lc:15,fa:16,wa:17,rd:18,ha:19,ya:20,P:21,q:22,uc:23,Sa:24,Q:25,nd:26,Wb:27,Hc:28,ia:29,bd:30,nc:31,Vc:32,Sb:33,Zc:34,Dc:42,Zb:43,Kb:44,ec:45,fc:46,gc:47,mc:48,od:49,xc:50,dc:51,Pb:35,Ac:37,Bb:52,Eb:53,sd:54,vc:55,Fb:56,Gb:57,Qb:35,Hb:59,Jc:60,yc:61,kd:62,Ic:63,Ec:64,Fc:65,ad:66,Bc:67,yb:68,gd:69,Lb:70,Wc:71,pc:72,Tb:73,Db:74,Qc:76,Cb:77,$c:78,hc:79,ic:80,lc:81,kc:82,jc:83,Kc:38,za:39,qc:36,ga:40,Rc:95,Uc:96,Ob:104,wc:105,zb:97,Yc:91,Oc:88,Gc:92,cd:108,Nb:111,wb:98,Mb:103,tc:101,rc:100,ld:110,Xb:112,Yb:113,ac:115,Ab:114,Rb:89,oc:90,Xc:93,dd:94,xb:99,sc:102,cc:106,Mc:107,md:109,pd:87,Ub:122,hd:116,Pc:95,Cc:123,$b:84,Sc:75,Ib:125,Nc:131,Tc:130,jd:86};function pb(e,t){H.push(function(){n.L("vi",e,[t])}),pb.level=H.length}function tb(){return!!tb.p}e._memset=qb,e._bitshift64Lshr=rb,e._bitshift64Shl=sb;var ub=[],vb={};function wb(e,t){wb.p||(wb.p={}),e in wb.p||(n.L("v",t),wb.p[e]=1)}var xb={0:"Success",1:"Not super-user",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"I/O error",6:"No such device or address",7:"Arg list too long",8:"Exec format error",9:"Bad file number",10:"No children",11:"No more processes",12:"Not enough core",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Mount device busy",17:"File exists",18:"Cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",25:"Not a typewriter",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",30:"Read only file system",31:"Too many links",32:"Broken pipe",33:"Math arg out of domain of func",34:"Math result not representable",35:"File locking deadlock error",36:"File or path name too long",37:"No record locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many symbolic links",42:"No message of desired type",43:"Identifier removed",44:"Channel number out of range",45:"Level 2 not synchronized",46:"Level 3 halted",47:"Level 3 reset",48:"Link number out of range",49:"Protocol driver not attached",50:"No CSI structure available",51:"Level 2 halted",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",57:"Invalid slot",59:"Bad font file fmt",60:"Device not a stream",61:"No data (for no delay io)",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",65:"Package not installed",66:"The object is remote",67:"The link has been severed",68:"Advertise error",69:"Srmount error",70:"Communication error on send",71:"Protocol error",72:"Multihop attempted",73:"Cross mount point (not really error)",74:"Trying to read unreadable message",75:"Value too large for defined data type",76:"Given log. name not unique",77:"f.d. invalid for this operation",78:"Remote address changed",79:"Can access a needed shared lib",80:"Accessing a corrupted shared lib",81:".lib section in a.out corrupted",82:"Attempting to link in too many libs",83:"Attempting to exec a shared library",84:"Illegal byte sequence",86:"Streams pipe error",87:"Too many users",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Unknown protocol",94:"Socket type not supported",95:"Not supported",96:"Protocol family not supported",97:"Address family not supported by protocol family",98:"Address already in use",99:"Address not available",100:"Network interface is not configured",101:"Network is unreachable",102:"Connection reset by network",103:"Connection aborted",104:"Connection reset by peer",105:"No buffer space available",106:"Socket is already connected",107:"Socket is not connected",108:"Can't send after socket shutdown",109:"Too many references",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"Host is unreachable",114:"Socket already connected",115:"Connection already in progress",116:"Stale file handle",122:"Quota exceeded",123:"No medium (in tape drive)",125:"Operation canceled",130:"Previous owner died",131:"State not recoverable"};function yb(e,t){for(var r=0,n=e.length-1;0<=n;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function zb(e){var t="/"===e.charAt(0),r="/"===e.substr(-1);return(e=yb(e.split("/").filter(function(e){return!!e}),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e}function Ab(e){var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1);return e=t[0],t=t[1],e||t?(t&&(t=t.substr(0,t.length-1)),e+t):"."}function Bb(e){if("/"===e)return"/";var t=e.lastIndexOf("/");return-1===t?e:e.substr(t+1)}function Cb(){return zb(Array.prototype.slice.call(arguments,0).join("/"))}function K(e,t){return zb(e+"/"+t)}function Db(){for(var e="",t=!1,r=arguments.length-1;-1<=r&&!t;r--){if("string"!=typeof(t=0<=r?arguments[r]:"/"))throw new TypeError("Arguments to path.resolve must be strings");if(!t)return"";e=t+"/"+e,t="/"===t.charAt(0)}return(t?"/":"")+(e=yb(e.split("/").filter(function(e){return!!e}),!t).join("/"))||"."}var Eb=[];function Fb(e,t){Eb[e]={input:[],output:[],N:t},Gb(e,Hb)}var Hb={open:function(e){var t=Eb[e.g.rdev];if(!t)throw new L(J.ha);e.tty=t,e.seekable=!1},close:function(e){e.tty.N.flush(e.tty)},flush:function(e){e.tty.N.flush(e.tty)},read:function(e,t,r,n){if(!e.tty||!e.tty.N.La)throw new L(J.Aa);for(var i=0,o=0;oe.e.length&&(e.e=M.cb(e),e.o=e.e.length),!e.e||e.e.subarray){var r=e.e?e.e.buffer.byteLength:0;t<=r||(t=Math.max(t,r*(r<1048576?2:1.125)|0),0!=r&&(t=Math.max(t,256)),r=e.e,e.e=new Uint8Array(t),0t)e.e.length=t;else for(;e.e.length=e.g.o)return 0;if(assert(0<=(e=Math.min(e.g.o-i,n))),8>1)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}return t.mode},B:function(e){for(var t=[];e.parent!==e;)t.push(e.name),e=e.parent;return t.push(e.A.pa.root),t.reverse(),Cb.apply(null,t)},Ha:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},$a:function(e){if((e&=-32769)in P.Ha)return P.Ha[e];throw new L(J.q)},k:{D:function(e){var t;e=P.B(e);try{t=fs.lstatSync(e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}return P.$&&!t.K&&(t.K=4096),P.$&&!t.blocks&&(t.blocks=(t.size+t.K-1)/t.K|0),{dev:t.dev,ino:t.ino,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,size:t.size,atime:t.atime,mtime:t.mtime,ctime:t.ctime,K:t.K,blocks:t.blocks}},u:function(e,t){var r=P.B(e);try{void 0!==t.mode&&(fs.chmodSync(r,t.mode),e.mode=t.mode),void 0!==t.size&&fs.truncateSync(r,t.size)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},lookup:function(e,t){var r=K(P.B(e),t);r=P.Ja(r);return P.createNode(e,t,r)},T:function(e,t,r,n){e=P.createNode(e,t,r,n),t=P.B(e);try{N(e.mode)?fs.mkdirSync(t,e.mode):fs.writeFileSync(t,"",{mode:e.mode})}catch(e){if(!e.code)throw e;throw new L(J[e.code])}return e},rename:function(e,t,r){e=P.B(e),t=K(P.B(t),r);try{fs.renameSync(e,t)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},unlink:function(e,t){var r=K(P.B(e),t);try{fs.unlinkSync(r)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},rmdir:function(e,t){var r=K(P.B(e),t);try{fs.rmdirSync(r)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},readdir:function(e){e=P.B(e);try{return fs.readdirSync(e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},symlink:function(e,t,r){e=K(P.B(e),t);try{fs.symlinkSync(r,e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},readlink:function(e){var t=P.B(e);try{return t=fs.readlinkSync(t),t=Ob.relative(Ob.resolve(e.A.pa.root),t)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}}},n:{open:function(e){var t=P.B(e.g);try{32768==(61440&e.g.mode)&&(e.V=fs.openSync(t,P.$a(e.flags)))}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},close:function(e){try{32768==(61440&e.g.mode)&&e.V&&fs.closeSync(e.V)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},read:function(e,t,r,n,i){if(0===n)return 0;var o,a=new Buffer(n);try{o=fs.readSync(e.V,a,0,n,i)}catch(e){throw new L(J[e.code])}if(0>>0)%Q.length}function Xb(e){var t=Wb(e.parent.id,e.name);e.M=Q[t],Q[t]=e}function Nb(e,t){var r;if(r=(r=Yb(e,"x"))?r:e.k.lookup?0:J.da)throw new L(r,e);for(r=Q[Wb(e.id,t)];r;r=r.M){var n=r.name;if(r.parent.id===e.id&&n===t)return r}return e.k.lookup(e,t)}function Lb(e,t,r,n){return Zb||((Zb=function(e,t,r,n){e||(e=this),this.parent=e,this.A=e.A,this.U=null,this.id=Sb++,this.name=t,this.mode=r,this.k={},this.n={},this.rdev=n}).prototype={},Object.defineProperties(Zb.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(e){e?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(e){e?this.mode|=146:this.mode&=-147}},kb:{get:function(){return N(this.mode)}},jb:{get:function(){return 8192==(61440&this.mode)}}})),Xb(e=new Zb(e,t,r,n)),e}function N(e){return 16384==(61440&e)}var $b={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218};function Yb(e,t){return Tb?0:(-1===t.indexOf("r")||292&e.mode)&&(-1===t.indexOf("w")||146&e.mode)&&(-1===t.indexOf("x")||73&e.mode)?0:J.da}function ac(e,t){try{return Nb(e,t),J.wa}catch(e){}return Yb(e,"wx")}function bc(){for(var e=0;e<=4096;e++)if(!Rb[e])return e;throw new L(J.Sa)}function cc(e){dc||((dc=function(){}).prototype={},Object.defineProperties(dc.prototype,{object:{get:function(){return this.g},set:function(e){this.g=e}},Ld:{get:function(){return 1!=(2097155&this.flags)}},Md:{get:function(){return 0!=(2097155&this.flags)}},Kd:{get:function(){return 1024&this.flags}}}));var t,r=new dc;for(t in e)r[t]=e[t];return e=r,r=bc(),e.fd=r,Rb[r]=e}var Kb={open:function(e){e.n=Qb[e.g.rdev].n,e.n.open&&e.n.open(e)},G:function(){throw new L(J.ia)}},qc;function Gb(e,t){Qb[e]={n:t}}function ec(e,t){var r,n="/"===t,i=!t;if(n&&Pb)throw new L(J.fa);if(!n&&!i){if(t=(r=S(t,{Ia:!1})).path,(r=r.g).U)throw new L(J.fa);if(!N(r.mode))throw new L(J.ya)}i={type:e,pa:{},Oa:t,lb:[]};var o=e.A(i);(o.A=i).root=o,n?Pb=o:r&&(r.U=i,r.A&&r.A.lb.push(i))}function fc(e,t,r){var n=S(e,{parent:!0}).g;if(!(e=Bb(e))||"."===e||".."===e)throw new L(J.q);var i=ac(n,e);if(i)throw new L(i);if(!n.k.T)throw new L(J.I);return n.k.T(n,e,t,r)}function gc(e,t){return t=4095&(void 0!==t?t:438),fc(e,t|=32768,0)}function V(e,t){return t=1023&(void 0!==t?t:511),fc(e,t|=16384,0)}function hc(e,t,r){return void 0===r&&(r=t,t=438),fc(e,8192|t,r)}function ic(e,t){if(!Db(e))throw new L(J.F);var r=S(t,{parent:!0}).g;if(!r)throw new L(J.F);var n=Bb(t),i=ac(r,n);if(i)throw new L(i);if(!r.k.symlink)throw new L(J.I);return r.k.symlink(r,n,e)}function Vb(e){if(!(e=S(e).g))throw new L(J.F);if(!e.k.readlink)throw new L(J.q);return Db(T(e.parent),e.k.readlink(e))}function jc(e,t){var r;if(!(r="string"==typeof e?S(e,{la:!0}).g:e).k.u)throw new L(J.I);r.k.u(r,{mode:4095&t|-4096&r.mode,timestamp:Date.now()})}function kc(t,r){var n,i,o;if(""===t)throw new L(J.F);if("string"==typeof r){if(void 0===(i=$b[r]))throw Error("Unknown file open mode: "+r)}else i=r;if(n=64&(r=i)?4095&(void 0===n?438:n)|32768:0,"object"==typeof t)o=t;else{t=zb(t);try{o=S(t,{la:!(131072&r)}).g}catch(e){}}if(i=!1,64&r)if(o){if(128&r)throw new L(J.wa)}else o=fc(t,n,0),i=!0;if(!o)throw new L(J.F);if(8192==(61440&o.mode)&&(r&=-513),65536&r&&!N(o.mode))throw new L(J.ya);if(!i&&(n=o?40960==(61440&o.mode)?J.ga:N(o.mode)&&(0!=(2097155&r)||512&r)?J.P:(n=["r","w","rw"][3&r],512&r&&(n+="w"),Yb(o,n)):J.F))throw new L(n);if(512&r){var a;if(!(a="string"==typeof(n=o)?S(n,{la:!0}).g:n).k.u)throw new L(J.I);if(N(a.mode))throw new L(J.P);if(32768!=(61440&a.mode))throw new L(J.q);if(n=Yb(a,"w"))throw new L(n);a.k.u(a,{size:0,timestamp:Date.now()})}r&=-641,(o=cc({g:o,path:T(o),flags:r,seekable:!0,position:0,n:o.n,tb:[],error:!1})).n.open&&o.n.open(o),!e.logReadFiles||1&r||(lc||(lc={}),t in lc||(lc[t]=1,e.printErr("read file: "+t)));try{R.onOpenFile&&(a=0,1!=(2097155&r)&&(a|=1),0!=(2097155&r)&&(a|=2),R.onOpenFile(t,a))}catch(e){console.log("FS.trackingDelegate['onOpenFile']('"+t+"', flags) threw an exception: "+e.message)}return o}function mc(e){e.na&&(e.na=null);try{e.n.close&&e.n.close(e)}catch(e){throw e}finally{Rb[e.fd]=null}}function nc(e,t,r){if(!e.seekable||!e.n.G)throw new L(J.ia);e.position=e.n.G(e,t,r),e.tb=[]}function oc(e,t,r,n,i,o){if(n<0||i<0)throw new L(J.q);if(0==(2097155&e.flags))throw new L(J.ea);if(N(e.g.mode))throw new L(J.P);if(!e.n.write)throw new L(J.q);1024&e.flags&&nc(e,0,2);var a=!0;if(void 0===i)i=e.position,a=!1;else if(!e.seekable)throw new L(J.ia);t=e.n.write(e,t,r,n,i,o),a||(e.position+=t);try{e.path&&R.onWriteToFile&&R.onWriteToFile(e.path)}catch(e){console.log("FS.trackingDelegate['onWriteToFile']('"+path+"') threw an exception: "+e.message)}return t}function pc(){L||((L=function(e,t){this.g=t,this.qb=function(e){for(var t in this.S=e,J)if(J[t]===e){this.code=t;break}},this.qb(e),this.message=xb[e]}).prototype=Error(),L.prototype.constructor=L,[J.F].forEach(function(e){Mb[e]=new L(e),Mb[e].stack=""}))}function rc(e,t){var r=0;return e&&(r|=365),t&&(r|=146),r}function sc(e,t,r,n){return gc(e=K("string"==typeof e?e:T(e),t),rc(r,n))}function tc(e,t,r,n,i,o){if(i=gc(e=t?K("string"==typeof e?e:T(e),t):e,n=rc(n,i)),r){if("string"==typeof r){e=Array(r.length),t=0;for(var a=r.length;t>2]}function xc(){var e;if(e=X(),!(e=Rb[e]))throw new L(J.ea);return e}var yc={};function Ga(e){Ga.p||(r=Qa(r),Ga.p=!0,assert(n.R),Ga.bb=n.R,n.R=function(){x("cannot dynamically allocate, sbrk now has control")});var t=r;return 0==e||Ga.bb(e)?t:4294967295}e._i64Add=zc;var Ac=1;function Cc(e,t){if(Dc=e,Ec=t,!Fc)return 1;if(0==e)Y=function(){setTimeout(Gc,t)},Hc="timeout";else if(1==e)Y=function(){Ic(Gc)},Hc="rAF";else if(2==e){if(!window.setImmediate){var r=[];window.addEventListener("message",function(e){e.source===window&&"__emcc"===e.data&&(e.stopPropagation(),r.shift()())},!0),window.setImmediate=function(e){r.push(e),window.postMessage("__emcc","*")}}Y=function(){window.setImmediate(Gc)},Hc="immediate"}return 0}function Jc(a,t,r,s,i){e.noExitRuntime=!0,assert(!Fc,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters."),Fc=a,Kc=s;var u=Lc;if(Gc=function(){if(!na)if(0>r-6&63;r=r-6,e=e+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[i]}2==r?(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t)<<4],e+="=="):4==r&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t)<<2],e+="="),l.src="data:audio/x-"+a.substr(-3)+";base64,"+e,s(l)}},l.src=i,ad(function(){s(l)})}});var r=e.canvas;r&&(r.sa=r.requestPointerLock||r.mozRequestPointerLock||r.webkitRequestPointerLock||r.msRequestPointerLock||function(){},r.Fa=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||function(){},r.Fa=r.Fa.bind(document),document.addEventListener("pointerlockchange",t,!1),document.addEventListener("mozpointerlockchange",t,!1),document.addEventListener("webkitpointerlockchange",t,!1),document.addEventListener("mspointerlockchange",t,!1),e.elementPointerLock&&r.addEventListener("click",function(e){!Tc&&r.sa&&(r.sa(),e.preventDefault())},!1))}}function bd(t,r,n,i){if(r&&e.ka&&t==e.canvas)return e.ka;var o,a;if(r){if(a={antialias:!1,alpha:!1},i)for(var s in i)a[s]=i[s];(a=GL.createContext(t,a))&&(o=GL.getContext(a).td),t.style.backgroundColor="black"}else o=t.getContext("2d");return o?(n&&(r||assert("undefined"==typeof GLctx,"cannot set in module if GLctx is used, but we are a non-GL context that would replace it"),e.ka=o,r&&GL.Od(a),e.Td=r,Uc.forEach(function(e){e()}),Vc()),o):null}var cd=!1,dd=void 0,ed=void 0;function fd(t,r,n){function i(){Sc=!1;var t=o.parentNode;(document.webkitFullScreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.mozFullscreenElement||document.fullScreenElement||document.fullscreenElement||document.msFullScreenElement||document.msFullscreenElement||document.webkitCurrentFullScreenElement)===t?(o.Da=document.cancelFullScreen||document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msExitFullscreen||document.exitFullscreen||function(){},o.Da=o.Da.bind(document),dd&&o.sa(),Sc=!0,ed&&gd()):(t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),ed&&hd()),e.onFullScreen&&e.onFullScreen(Sc),id(o)}void 0===(dd=t)&&(dd=!0),void 0===(ed=r)&&(ed=!1),void 0===(jd=n)&&(jd=null);var o=e.canvas;cd||(cd=!0,document.addEventListener("fullscreenchange",i,!1),document.addEventListener("mozfullscreenchange",i,!1),document.addEventListener("webkitfullscreenchange",i,!1),document.addEventListener("MSFullscreenChange",i,!1));var a=document.createElement("div");o.parentNode.insertBefore(a,o),a.appendChild(o),a.p=a.requestFullScreen||a.mozRequestFullScreen||a.msRequestFullscreen||(a.webkitRequestFullScreen?function(){a.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}:null),n?a.p({Ud:n}):a.p()}var kd=0;function ld(e){var t=Date.now();if(0===kd)kd=t+1e3/60;else for(;kd<=t+2;)kd+=1e3/60;t=Math.max(kd-t,0),setTimeout(e,t)}function Ic(e){"undefined"==typeof window?ld(e):(window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||ld),window.requestAnimationFrame(e))}function ad(t){e.noExitRuntime=!0,setTimeout(function(){na||t()},1e4)}function $c(e){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[e.substr(e.lastIndexOf(".")+1)]}function md(e,t,r){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)}function nd(t,r,e){md(t,function(e){assert(e,'Loading data file "'+t+'" failed (no arrayBuffer).'),r(new Uint8Array(e)),lb()},function(){if(!e)throw'Loading data file "'+t+'" failed.';e()}),kb()}var od=[],Wc,Xc,Yc,Zc,jd;function pd(){var t=e.canvas;od.forEach(function(e){e(t.width,t.height)})}function gd(){if("undefined"!=typeof SDL){var e=Sa[SDL.screen+0*n.J>>2];C[SDL.screen+0*n.J>>2]=8388608|e}pd()}function hd(){if("undefined"!=typeof SDL){var e=Sa[SDL.screen+0*n.J>>2];C[SDL.screen+0*n.J>>2]=-8388609&e}pd()}function id(t,r,n){r&&n?(t.ub=r,t.hb=n):(r=t.ub,n=t.hb);var i=r,o=n;if(e.forcedAspectRatio&&0this.length-1||e<0)){var t=e%this.chunkSize;return this.gb(e/this.chunkSize|0)[t]}},a.prototype.pb=function(e){this.gb=e},a.prototype.Ca=function(){var e=new XMLHttpRequest;if(e.open("HEAD",u,!1),e.send(null),!(200<=e.status&&e.status<300||304===e.status))throw Error("Couldn't load "+u+". Status: "+e.status);var t,o=Number(e.getResponseHeader("Content-length")),a=1048576;(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t||(a=o);var s=this;s.pb(function(e){var t=e*a,r=(e+1)*a-1;r=Math.min(r,o-1);if(void 0===s.Y[e]){var n=s.Y;if(r=(e=e.g.e).length)return 0;if(assert(0<=(n=Math.min(e.length-i,n))),e.slice)for(var o=0;o>2]=0;case 21520:return r.tty?-J.q:-J.Q;case 21531:if(i=X(),!r.n.ib)throw new L(J.Q);return r.n.ib(r,n,i);default:x("bad ioctl syscall "+n)}}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},___syscall6:function(e,t){wc=t;try{return mc(xc()),0}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},_emscripten_set_main_loop_timing:Cc,__ZSt18uncaught_exceptionv:tb,___setErrNo:ob,_sbrk:Ga,___cxa_begin_catch:function(e){var t;tb.p--,ub.push(e);e:{if(e&&!vb[e])for(t in vb)if(vb[t].wd===e)break e;t=e}return t&&vb[t].Sd++,e},_emscripten_memcpy_big:function(e,t,r){return E.set(E.subarray(t,t+r),e),e},_sysconf:function(e){switch(e){case 30:return 4096;case 85:return F/4096;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"==typeof navigator&&navigator.hardwareConcurrency||1}return ob(J.q),-1},_pthread_getspecific:function(e){return yc[e]||0},_pthread_self:function(){return 0},_pthread_once:wb,_pthread_key_create:function(e){return 0==e?J.q:(C[e>>2]=Ac,yc[Ac]=0,Ac++,0)},___unlock:function(){},_emscripten_set_main_loop:Jc,_pthread_setspecific:function(e,t){return e in yc?(yc[e]=t,0):J.q},___lock:function(){},_abort:function(){e.abort()},_pthread_cleanup_push:pb,_time:function(e){var t=Date.now()/1e3|0;return e&&(C[e>>2]=t),t},___syscall140:function(e,t){wc=t;try{var r=xc(),n=X(),i=X(),o=X(),a=X();return assert(0===n),nc(r,i,a),C[o>>2]=r.position,r.na&&0===i&&0===a&&(r.na=null),0}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},___syscall146:function(e,t){wc=t;try{var r,n=xc(),i=X();e:{for(var o=X(),a=0,s=0;s>2],C[i+(8*s+4)>>2],void 0);if(u<0){r=-1;break e}a+=u}r=a}return r}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},STACKTOP:m,STACK_MAX:Va,tempDoublePtr:mb,ABORT:na,cttz_i8:qd};var Z=function(e,t,r){"use asm";var n=e.Int8Array;var i=e.Int16Array;var o=e.Int32Array;var a=e.Uint8Array;var s=e.Uint16Array;var u=e.Uint32Array;var l=e.Float32Array;var c=e.Float64Array;var de=new n(r);var Q=new i(r);var pe=new o(r);var ge=new a(r);var me=new s(r);var f=new u(r);var h=new l(r);var ee=new c(r);var d=e.byteLength;var ve=t.STACKTOP|0;var p=t.STACK_MAX|0;var te=t.tempDoublePtr|0;var g=t.ABORT|0;var m=t.cttz_i8|0;var v=0;var _=0;var y=0;var b=0;var x=e.NaN,w=e.Infinity;var T=0,S=0,M=0,P=0,C=0.0,k=0,E=0,A=0,O=0.0;var re=0;var R=0;var I=0;var D=0;var L=0;var N=0;var j=0;var F=0;var B=0;var z=0;var U=e.Math.floor;var X=e.Math.abs;var q=e.Math.sqrt;var H=e.Math.pow;var Y=e.Math.cos;var G=e.Math.sin;var W=e.Math.tan;var V=e.Math.acos;var K=e.Math.asin;var Z=e.Math.atan;var J=e.Math.atan2;var $=e.Math.exp;var ne=e.Math.log;var ie=e.Math.ceil;var _e=e.Math.imul;var oe=e.Math.min;var ae=e.Math.clz32;var se=t.abort;var ue=t.assert;var le=t.invoke_iiii;var ce=t.invoke_viiiii;var fe=t.invoke_vi;var he=t.invoke_ii;var ye=t.invoke_viii;var be=t.invoke_v;var xe=t.invoke_viiiiii;var we=t.invoke_iiiiii;var Te=t.invoke_viiii;var Se=t._pthread_cleanup_pop;var Me=t.___syscall54;var Pe=t.___syscall6;var Ce=t._emscripten_set_main_loop_timing;var ke=t.__ZSt18uncaught_exceptionv;var Ee=t.___setErrNo;var Ae=t._sbrk;var Oe=t.___cxa_begin_catch;var Re=t._emscripten_memcpy_big;var Ie=t._sysconf;var De=t._pthread_getspecific;var Le=t._pthread_self;var Ne=t._pthread_once;var je=t._pthread_key_create;var Fe=t.___unlock;var Be=t._emscripten_set_main_loop;var ze=t._pthread_setspecific;var Ue=t.___lock;var Xe=t._abort;var qe=t._pthread_cleanup_push;var He=t._time;var Ye=t.___syscall140;var Ge=t.___syscall146;var We=0.0;function Ve(e){if(d(e)&16777215||d(e)<=16777215||d(e)>2147483648)return false;de=new n(e);Q=new i(e);pe=new o(e);ge=new a(e);me=new s(e);f=new u(e);h=new l(e);ee=new c(e);r=e;return true}function Ke(e){e=e|0;var t=0;t=ve;ve=ve+e|0;ve=ve+15&-16;return t|0}function Ze(){return ve|0}function Je(e){e=e|0;ve=e}function $e(e,t){e=e|0;t=t|0;ve=e;p=t}function Qe(e,t){e=e|0;t=t|0;if(!v){v=e;_=t}}function et(e){e=e|0;de[te>>0]=de[e>>0];de[te+1>>0]=de[e+1>>0];de[te+2>>0]=de[e+2>>0];de[te+3>>0]=de[e+3>>0]}function tt(e){e=e|0;de[te>>0]=de[e>>0];de[te+1>>0]=de[e+1>>0];de[te+2>>0]=de[e+2>>0];de[te+3>>0]=de[e+3>>0];de[te+4>>0]=de[e+4>>0];de[te+5>>0]=de[e+5>>0];de[te+6>>0]=de[e+6>>0];de[te+7>>0]=de[e+7>>0]}function rt(e){e=e|0;re=e}function nt(){return re|0}function it(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0;g=ve;ve=ve+608|0;h=g+88|0;f=g+72|0;u=g+64|0;s=g+48|0;a=g+24|0;o=g;c=g+96|0;d=g+92|0;l=e+4|0;p=e+8|0;if((pe[l>>2]|0)>>>0>(pe[p>>2]|0)>>>0){pe[o>>2]=1154;pe[o+4>>2]=2120;pe[o+8>>2]=1133;br(c,1100,o)|0;yr(c,g+16|0)|0}if((2147418112/(n>>>0)|0)>>>0<=t>>>0){pe[a>>2]=1154;pe[a+4>>2]=2121;pe[a+8>>2]=1169;br(c,1100,a)|0;yr(c,g+40|0)|0}a=pe[p>>2]|0;if(a>>>0>=t>>>0){p=1;ve=g;return p|0}do{if(r){if(t){o=t+-1|0;if(!(o&t)){o=11;break}else t=o}else t=-1;t=t>>>16|t;t=t>>>8|t;t=t>>>4|t;t=t>>>2|t;t=(t>>>1|t)+1|0;o=10}else o=10}while(0);if((o|0)==10)if(!t){t=0;o=12}else o=11;if((o|0)==11)if(t>>>0<=a>>>0)o=12;if((o|0)==12){pe[s>>2]=1154;pe[s+4>>2]=2130;pe[s+8>>2]=1217;br(c,1100,s)|0;yr(c,u)|0}r=_e(t,n)|0;do{if(!i){o=ot(pe[e>>2]|0,r,d,1)|0;if(!o){p=0;ve=g;return p|0}else{pe[e>>2]=o;break}}else{a=at(r,d)|0;if(!a){p=0;ve=g;return p|0}On[i&0](a,pe[e>>2]|0,pe[l>>2]|0);o=pe[e>>2]|0;do{if(o)if(!(o&7)){Dn[pe[104>>2]&1](o,0,0,1,pe[27]|0)|0;break}else{pe[f>>2]=1154;pe[f+4>>2]=2499;pe[f+8>>2]=1516;br(c,1100,f)|0;yr(c,h)|0;break}}while(0);pe[e>>2]=a}}while(0);o=pe[d>>2]|0;if(o>>>0>r>>>0)t=(o>>>0)/(n>>>0)|0;pe[p>>2]=t;p=1;ve=g;return p|0}function ot(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0;l=ve;ve=ve+592|0;u=l+48|0;o=l+24|0;i=l;s=l+72|0;a=l+68|0;if(e&7){pe[i>>2]=1154;pe[i+4>>2]=2499;pe[i+8>>2]=1494;br(s,1100,i)|0;yr(s,l+16|0)|0;u=0;ve=l;return u|0}if(t>>>0>2147418112){pe[o>>2]=1154;pe[o+4>>2]=2499;pe[o+8>>2]=1387;br(s,1100,o)|0;yr(s,l+40|0)|0;u=0;ve=l;return u|0}pe[a>>2]=t;n=Dn[pe[104>>2]&1](e,t,a,n,pe[27]|0)|0;if(r)pe[r>>2]=pe[a>>2];if(!(n&7)){u=n;ve=l;return u|0}pe[u>>2]=1154;pe[u+4>>2]=2551;pe[u+8>>2]=1440;br(s,1100,u)|0;yr(s,l+64|0)|0;u=n;ve=l;return u|0}function at(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0;u=ve;ve=ve+592|0;a=u+48|0;s=u+24|0;r=u;o=u+72|0;i=u+68|0;n=e+3&-4;n=(n|0)!=0?n:4;if(n>>>0>2147418112){pe[r>>2]=1154;pe[r+4>>2]=2499;pe[r+8>>2]=1387;br(o,1100,r)|0;yr(o,u+16|0)|0;s=0;ve=u;return s|0}pe[i>>2]=n;r=Dn[pe[104>>2]&1](0,n,i,1,pe[27]|0)|0;e=pe[i>>2]|0;if(t)pe[t>>2]=e;if((r|0)==0|e>>>0>>0){pe[s>>2]=1154;pe[s+4>>2]=2499;pe[s+8>>2]=1413;br(o,1100,s)|0;yr(o,u+40|0)|0;s=0;ve=u;return s|0}if(!(r&7)){s=r;ve=u;return s|0}pe[a>>2]=1154;pe[a+4>>2]=2526;pe[a+8>>2]=1440;br(o,1100,a)|0;yr(o,u+64|0)|0;s=r;ve=u;return s|0}function st(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0;F=ve;ve=ve+960|0;L=F+232|0;D=F+216|0;I=F+208|0;R=F+192|0;O=F+184|0;A=F+168|0;E=F+160|0;k=F+144|0;M=F+136|0;S=F+120|0;T=F+112|0;w=F+96|0;y=F+88|0;_=F+72|0;v=F+64|0;m=F+48|0;f=F+40|0;d=F+24|0;h=F+16|0;c=F;C=F+440|0;N=F+376|0;j=F+304|0;g=F+236|0;if((t|0)==0|n>>>0>11){e=0;ve=F;return e|0}pe[e>>2]=t;i=j;o=i+68|0;do{pe[i>>2]=0;i=i+4|0}while((i|0)<(o|0));o=0;do{i=de[r+o>>0]|0;if(i<<24>>24){P=j+((i&255)<<2)|0;pe[P>>2]=(pe[P>>2]|0)+1}o=o+1|0}while((o|0)!=(t|0));o=0;l=1;a=0;s=-1;u=0;while(1){i=pe[j+(l<<2)>>2]|0;if(!i)pe[e+28+(l+-1<<2)>>2]=0;else{P=l+-1|0;pe[N+(P<<2)>>2]=o;o=i+o|0;x=16-l|0;pe[e+28+(P<<2)>>2]=(o+-1<>2]=u;pe[g+(l<<2)>>2]=u;a=a>>>0>l>>>0?a:l;s=s>>>0>>0?s:l;u=i+u|0}l=l+1|0;if((l|0)==17){P=a;break}else o=o<<1}pe[e+4>>2]=u;o=e+172|0;do{if(u>>>0>(pe[o>>2]|0)>>>0){pe[o>>2]=u;if(u){i=u+-1|0;if(i&u)p=14}else{i=-1;p=14}if((p|0)==14){x=i>>>16|i;x=x>>>8|x;x=x>>>4|x;x=x>>>2|x;x=(x>>>1|x)+1|0;pe[o>>2]=x>>>0>t>>>0?t:x}a=e+176|0;i=pe[a>>2]|0;do{if(i){x=pe[i+-4>>2]|0;i=i+-8|0;if(!((x|0)!=0?(x|0)==(~pe[i>>2]|0):0)){pe[c>>2]=1154;pe[c+4>>2]=644;pe[c+8>>2]=1863;br(C,1100,c)|0;yr(C,h)|0}if(!(i&7)){Dn[pe[104>>2]&1](i,0,0,1,pe[27]|0)|0;break}else{pe[d>>2]=1154;pe[d+4>>2]=2499;pe[d+8>>2]=1516;br(C,1100,d)|0;yr(C,f)|0;break}}}while(0);o=pe[o>>2]|0;o=(o|0)!=0?o:1;i=at((o<<1)+8|0,0)|0;if(!i){pe[a>>2]=0;i=0;break}else{pe[i+4>>2]=o;pe[i>>2]=~o;pe[a>>2]=i+8;p=25;break}}else p=25}while(0);e:do{if((p|0)==25){x=e+24|0;de[x>>0]=s;de[e+25>>0]=P;o=e+176|0;a=0;do{b=de[r+a>>0]|0;i=b&255;if(b<<24>>24){if(!(pe[j+(i<<2)>>2]|0)){pe[m>>2]=1154;pe[m+4>>2]=2273;pe[m+8>>2]=1261;br(C,1100,m)|0;yr(C,v)|0}b=g+(i<<2)|0;i=pe[b>>2]|0;pe[b>>2]=i+1;if(i>>>0>=u>>>0){pe[_>>2]=1154;pe[_+4>>2]=2277;pe[_+8>>2]=1274;br(C,1100,_)|0;yr(C,y)|0}Q[(pe[o>>2]|0)+(i<<1)>>1]=a}a=a+1|0}while((a|0)!=(t|0));i=de[x>>0]|0;y=(i&255)>>>0>>0?n:0;b=e+8|0;pe[b>>2]=y;_=(y|0)!=0;if(_){v=1<>>0>(pe[i>>2]|0)>>>0){pe[i>>2]=v;a=e+168|0;i=pe[a>>2]|0;do{if(i){m=pe[i+-4>>2]|0;i=i+-8|0;if(!((m|0)!=0?(m|0)==(~pe[i>>2]|0):0)){pe[w>>2]=1154;pe[w+4>>2]=644;pe[w+8>>2]=1863;br(C,1100,w)|0;yr(C,T)|0}if(!(i&7)){Dn[pe[104>>2]&1](i,0,0,1,pe[27]|0)|0;break}else{pe[S>>2]=1154;pe[S+4>>2]=2499;pe[S+8>>2]=1516;br(C,1100,S)|0;yr(C,M)|0;break}}}while(0);i=v<<2;o=at(i+8|0,0)|0;if(!o){pe[a>>2]=0;i=0;break e}else{M=o+8|0;pe[o+4>>2]=v;pe[o>>2]=~v;pe[a>>2]=M;o=M;break}}else{o=e+168|0;i=v<<2;a=o;o=pe[o>>2]|0}}while(0);Vr(o|0,-1,i|0)|0;p=e+176|0;m=1;do{if(pe[j+(m<<2)>>2]|0){t=y-m|0;g=1<>2]|0;if(o>>>0>=16){pe[k>>2]=1154;pe[k+4>>2]=1953;pe[k+8>>2]=1737;br(C,1100,k)|0;yr(C,E)|0}i=pe[e+28+(o<<2)>>2]|0;if(!i)d=-1;else d=(i+-1|0)>>>(16-m|0);if(s>>>0<=d>>>0){f=(pe[e+96+(o<<2)>>2]|0)-s|0;h=m<<16;do{i=me[(pe[p>>2]|0)+(f+s<<1)>>1]|0;if((ge[r+i>>0]|0|0)!=(m|0)){pe[A>>2]=1154;pe[A+4>>2]=2319;pe[A+8>>2]=1303;br(C,1100,A)|0;yr(C,O)|0}c=s<>>0>=v>>>0){pe[R>>2]=1154;pe[R+4>>2]=2325;pe[R+8>>2]=1337;br(C,1100,R)|0;yr(C,I)|0}i=pe[a>>2]|0;if((pe[i+(u<<2)>>2]|0)!=-1){pe[D>>2]=1154;pe[D+4>>2]=2327;pe[D+8>>2]=1360;br(C,1100,D)|0;yr(C,L)|0;i=pe[a>>2]|0}pe[i+(u<<2)>>2]=o;l=l+1|0}while(l>>>0>>0);s=s+1|0}while(s>>>0<=d>>>0)}}m=m+1|0}while(y>>>0>=m>>>0);i=de[x>>0]|0}o=e+96|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N>>2]|0);o=e+100|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+4>>2]|0);o=e+104|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+8>>2]|0);o=e+108|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+12>>2]|0);o=e+112|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+16>>2]|0);o=e+116|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+20>>2]|0);o=e+120|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+24>>2]|0);o=e+124|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+28>>2]|0);o=e+128|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+32>>2]|0);o=e+132|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+36>>2]|0);o=e+136|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+40>>2]|0);o=e+140|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+44>>2]|0);o=e+144|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+48>>2]|0);o=e+148|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+52>>2]|0);o=e+152|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+56>>2]|0);o=e+156|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+60>>2]|0);o=e+16|0;pe[o>>2]=0;a=e+20|0;pe[a>>2]=i&255;t:do{if(_){while(1){if(!n)break t;i=n+-1|0;if(!(pe[j+(n<<2)>>2]|0))n=i;else break}pe[o>>2]=pe[e+28+(i<<2)>>2];i=y+1|0;pe[a>>2]=i;if(i>>>0<=P>>>0){while(1){if(pe[j+(i<<2)>>2]|0)break;i=i+1|0;if(i>>>0>P>>>0)break t}pe[a>>2]=i}}}while(0);pe[e+92>>2]=-1;pe[e+160>>2]=1048575;pe[e+12>>2]=32-(pe[b>>2]|0);i=1}}while(0);e=i;ve=F;return e|0}function ut(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0;if(!e){i=zr(t)|0;if(!r){r=i;return r|0}if(!i)o=0;else o=qr(i)|0;pe[r>>2]=o;r=i;return r|0}if(!t){Ur(e);if(!r){r=0;return r|0}pe[r>>2]=0;r=0;return r|0}i=Xr(e,t)|0;o=(i|0)!=0;if(o|n^1)o=o?i:e;else{i=Xr(e,t)|0;o=(i|0)==0?e:i}if(!r){r=i;return r|0}t=qr(o)|0;pe[r>>2]=t;r=i;return r|0}function lt(e,t,r){e=e|0;t=t|0;r=r|0;var n=0;if(!((e|0)!=0&t>>>0>73&(r|0)!=0)){r=0;return r|0}if((pe[r>>2]|0)!=40|t>>>0<74){r=0;return r|0}if(((ge[e>>0]|0)<<8|(ge[e+1>>0]|0)|0)!=18552){r=0;return r|0}if(((ge[e+2>>0]|0)<<8|(ge[e+3>>0]|0))>>>0<74){r=0;return r|0}if(((ge[e+7>>0]|0)<<16|(ge[e+6>>0]|0)<<24|(ge[e+8>>0]|0)<<8|(ge[e+9>>0]|0))>>>0>t>>>0){r=0;return r|0}pe[r+4>>2]=(ge[e+12>>0]|0)<<8|(ge[e+13>>0]|0);pe[r+8>>2]=(ge[e+14>>0]|0)<<8|(ge[e+15>>0]|0);pe[r+12>>2]=ge[e+16>>0];pe[r+16>>2]=ge[e+17>>0];t=e+18|0;n=r+32|0;pe[n>>2]=ge[t>>0];pe[n+4>>2]=0;t=de[t>>0]|0;pe[r+20>>2]=t<<24>>24==0|t<<24>>24==9?8:16;pe[r+24>>2]=(ge[e+26>>0]|0)<<16|(ge[e+25>>0]|0)<<24|(ge[e+27>>0]|0)<<8|(ge[e+28>>0]|0);pe[r+28>>2]=(ge[e+30>>0]|0)<<16|(ge[e+29>>0]|0)<<24|(ge[e+31>>0]|0)<<8|(ge[e+32>>0]|0);r=1;return r|0}function ct(e){e=e|0;Oe(e|0)|0;Ut()}function ft(e){e=e|0;var t=0,r=0,n=0,i=0,o=0;o=ve;ve=ve+544|0;i=o;n=o+24|0;t=pe[e+20>>2]|0;if(t)ht(t);t=e+4|0;r=pe[t>>2]|0;if(!r){i=e+16|0;de[i>>0]=0;ve=o;return}if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[i>>2]=1154;pe[i+4>>2]=2499;pe[i+8>>2]=1516;br(n,1100,i)|0;yr(n,o+16|0)|0}pe[t>>2]=0;pe[e+8>>2]=0;pe[e+12>>2]=0;i=e+16|0;de[i>>0]=0;ve=o;return}function ht(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;d=ve;ve=ve+640|0;h=d+112|0;f=d+96|0;c=d+88|0;l=d+72|0;u=d+64|0;s=d+48|0;n=d+40|0;o=d+24|0;i=d+16|0;r=d;a=d+120|0;if(!e){ve=d;return}t=pe[e+168>>2]|0;do{if(t){p=pe[t+-4>>2]|0;t=t+-8|0;if(!((p|0)!=0?(p|0)==(~pe[t>>2]|0):0)){pe[r>>2]=1154;pe[r+4>>2]=644;pe[r+8>>2]=1863;br(a,1100,r)|0;yr(a,i)|0}if(!(t&7)){Dn[pe[104>>2]&1](t,0,0,1,pe[27]|0)|0;break}else{pe[o>>2]=1154;pe[o+4>>2]=2499;pe[o+8>>2]=1516;br(a,1100,o)|0;yr(a,n)|0;break}}}while(0);t=pe[e+176>>2]|0;do{if(t){p=pe[t+-4>>2]|0;t=t+-8|0;if(!((p|0)!=0?(p|0)==(~pe[t>>2]|0):0)){pe[s>>2]=1154;pe[s+4>>2]=644;pe[s+8>>2]=1863;br(a,1100,s)|0;yr(a,u)|0}if(!(t&7)){Dn[pe[104>>2]&1](t,0,0,1,pe[27]|0)|0;break}else{pe[l>>2]=1154;pe[l+4>>2]=2499;pe[l+8>>2]=1516;br(a,1100,l)|0;yr(a,c)|0;break}}}while(0);if(!(e&7)){Dn[pe[104>>2]&1](e,0,0,1,pe[27]|0)|0;ve=d;return}else{pe[f>>2]=1154;pe[f+4>>2]=2499;pe[f+8>>2]=1516;br(a,1100,f)|0;yr(a,h)|0;ve=d;return}}function dt(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+560|0;a=c+40|0;s=c+24|0;t=c;o=c+48|0;i=e+8|0;r=pe[i>>2]|0;if((r+-1|0)>>>0>=8192){pe[t>>2]=1154;pe[t+4>>2]=2997;pe[t+8>>2]=1541;br(o,1100,t)|0;yr(o,c+16|0)|0}pe[e>>2]=r;n=e+20|0;t=pe[n>>2]|0;if(!t){t=at(180,0)|0;if(!t)t=0;else{l=t+164|0;pe[l>>2]=0;pe[l+4>>2]=0;pe[l+8>>2]=0;pe[l+12>>2]=0}pe[n>>2]=t;l=t;u=pe[e>>2]|0}else{l=t;u=r}if(!(pe[i>>2]|0)){pe[s>>2]=1154;pe[s+4>>2]=903;pe[s+8>>2]=1781;br(o,1100,s)|0;yr(o,a)|0;o=pe[e>>2]|0}else o=u;i=pe[e+4>>2]|0;if(o>>>0>16){r=o;t=0}else{e=0;l=st(l,u,i,e)|0;ve=c;return l|0}while(1){n=t+1|0;if(r>>>0>3){r=r>>>1;t=n}else{r=n;break}}e=t+2+((r|0)!=32&1<>>0>>0&1)|0;e=e>>>0<11?e&255:11;l=st(l,u,i,e)|0;ve=c;return l|0}function pt(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0;L=ve;ve=ve+800|0;A=L+256|0;E=L+240|0;k=L+232|0;C=L+216|0;P=L+208|0;M=L+192|0;S=L+184|0;T=L+168|0;w=L+160|0;x=L+144|0;b=L+136|0;y=L+120|0;_=L+112|0;v=L+96|0;m=L+88|0;g=L+72|0;f=L+64|0;c=L+48|0;s=L+40|0;u=L+24|0;o=L+16|0;i=L;I=L+288|0;D=L+264|0;O=gt(e,14)|0;if(!O){pe[t>>2]=0;r=t+4|0;n=pe[r>>2]|0;if(n){if(!(n&7))Dn[pe[104>>2]&1](n,0,0,1,pe[27]|0)|0;else{pe[i>>2]=1154;pe[i+4>>2]=2499;pe[i+8>>2]=1516;br(I,1100,i)|0;yr(I,o)|0}pe[r>>2]=0;pe[t+8>>2]=0;pe[t+12>>2]=0}de[t+16>>0]=0;r=t+20|0;n=pe[r>>2]|0;if(!n){t=1;ve=L;return t|0}ht(n);pe[r>>2]=0;t=1;ve=L;return t|0}d=t+4|0;p=t+8|0;r=pe[p>>2]|0;if((r|0)!=(O|0)){if(r>>>0<=O>>>0){do{if((pe[t+12>>2]|0)>>>0>>0){if(it(d,O,(r+1|0)==(O|0),1,0)|0){r=pe[p>>2]|0;break}de[t+16>>0]=1;t=0;ve=L;return t|0}}while(0);Vr((pe[d>>2]|0)+r|0,0,O-r|0)|0}pe[p>>2]=O}Vr(pe[d>>2]|0,0,O|0)|0;h=e+20|0;r=pe[h>>2]|0;if((r|0)<5){o=e+4|0;a=e+8|0;i=e+16|0;do{n=pe[o>>2]|0;if((n|0)==(pe[a>>2]|0))n=0;else{pe[o>>2]=n+1;n=ge[n>>0]|0}r=r+8|0;pe[h>>2]=r;if((r|0)>=33){pe[u>>2]=1154;pe[u+4>>2]=3199;pe[u+8>>2]=1650;br(I,1100,u)|0;yr(I,s)|0;r=pe[h>>2]|0}n=n<<32-r|pe[i>>2];pe[i>>2]=n}while((r|0)<5)}else{n=e+16|0;i=n;n=pe[n>>2]|0}l=n>>>27;pe[i>>2]=n<<5;pe[h>>2]=r+-5;if((l+-1|0)>>>0>20){t=0;ve=L;return t|0}pe[D+20>>2]=0;pe[D>>2]=0;pe[D+4>>2]=0;pe[D+8>>2]=0;pe[D+12>>2]=0;de[D+16>>0]=0;r=D+4|0;n=D+8|0;e:do{if(it(r,21,0,1,0)|0){s=pe[n>>2]|0;u=pe[r>>2]|0;Vr(u+s|0,0,21-s|0)|0;pe[n>>2]=21;if(l){i=e+4|0;o=e+8|0;a=e+16|0;s=0;do{r=pe[h>>2]|0;if((r|0)<3)do{n=pe[i>>2]|0;if((n|0)==(pe[o>>2]|0))n=0;else{pe[i>>2]=n+1;n=ge[n>>0]|0}r=r+8|0;pe[h>>2]=r;if((r|0)>=33){pe[c>>2]=1154;pe[c+4>>2]=3199;pe[c+8>>2]=1650;br(I,1100,c)|0;yr(I,f)|0;r=pe[h>>2]|0}n=n<<32-r|pe[a>>2];pe[a>>2]=n}while((r|0)<3);else n=pe[a>>2]|0;pe[a>>2]=n<<3;pe[h>>2]=r+-3;de[u+(ge[1611+s>>0]|0)>>0]=n>>>29;s=s+1|0}while((s|0)!=(l|0))}if(dt(D)|0){s=e+4|0;u=e+8|0;l=e+16|0;n=0;t:while(1){a=O-n|0;r=mt(e,D)|0;r:do{if(r>>>0<17){if((pe[p>>2]|0)>>>0<=n>>>0){pe[g>>2]=1154;pe[g+4>>2]=903;pe[g+8>>2]=1781;br(I,1100,g)|0;yr(I,m)|0}de[(pe[d>>2]|0)+n>>0]=r;r=n+1|0}else switch(r|0){case 17:{r=pe[h>>2]|0;if((r|0)<3)do{i=pe[s>>2]|0;if((i|0)==(pe[u>>2]|0))i=0;else{pe[s>>2]=i+1;i=ge[i>>0]|0}r=r+8|0;pe[h>>2]=r;if((r|0)>=33){pe[v>>2]=1154;pe[v+4>>2]=3199;pe[v+8>>2]=1650;br(I,1100,v)|0;yr(I,_)|0;r=pe[h>>2]|0}i=i<<32-r|pe[l>>2];pe[l>>2]=i}while((r|0)<3);else i=pe[l>>2]|0;pe[l>>2]=i<<3;pe[h>>2]=r+-3;r=(i>>>29)+3|0;if(r>>>0>a>>>0){r=0;break e}r=r+n|0;break r}case 18:{r=pe[h>>2]|0;if((r|0)<7)do{i=pe[s>>2]|0;if((i|0)==(pe[u>>2]|0))i=0;else{pe[s>>2]=i+1;i=ge[i>>0]|0}r=r+8|0;pe[h>>2]=r;if((r|0)>=33){pe[y>>2]=1154;pe[y+4>>2]=3199;pe[y+8>>2]=1650;br(I,1100,y)|0;yr(I,b)|0;r=pe[h>>2]|0}i=i<<32-r|pe[l>>2];pe[l>>2]=i}while((r|0)<7);else i=pe[l>>2]|0;pe[l>>2]=i<<7;pe[h>>2]=r+-7;r=(i>>>25)+11|0;if(r>>>0>a>>>0){r=0;break e}r=r+n|0;break r}default:{if((r+-19|0)>>>0>=2){R=90;break t}o=pe[h>>2]|0;if((r|0)==19){if((o|0)<2){i=o;while(1){r=pe[s>>2]|0;if((r|0)==(pe[u>>2]|0))o=0;else{pe[s>>2]=r+1;o=ge[r>>0]|0}r=i+8|0;pe[h>>2]=r;if((r|0)>=33){pe[x>>2]=1154;pe[x+4>>2]=3199;pe[x+8>>2]=1650;br(I,1100,x)|0;yr(I,w)|0;r=pe[h>>2]|0}i=o<<32-r|pe[l>>2];pe[l>>2]=i;if((r|0)<2)i=r;else break}}else{i=pe[l>>2]|0;r=o}pe[l>>2]=i<<2;pe[h>>2]=r+-2;o=(i>>>30)+3|0}else{if((o|0)<6){i=o;while(1){r=pe[s>>2]|0;if((r|0)==(pe[u>>2]|0))o=0;else{pe[s>>2]=r+1;o=ge[r>>0]|0}r=i+8|0;pe[h>>2]=r;if((r|0)>=33){pe[T>>2]=1154;pe[T+4>>2]=3199;pe[T+8>>2]=1650;br(I,1100,T)|0;yr(I,S)|0;r=pe[h>>2]|0}i=o<<32-r|pe[l>>2];pe[l>>2]=i;if((r|0)<6)i=r;else break}}else{i=pe[l>>2]|0;r=o}pe[l>>2]=i<<6;pe[h>>2]=r+-6;o=(i>>>26)+7|0}if((n|0)==0|o>>>0>a>>>0){r=0;break e}r=n+-1|0;if((pe[p>>2]|0)>>>0<=r>>>0){pe[M>>2]=1154;pe[M+4>>2]=903;pe[M+8>>2]=1781;br(I,1100,M)|0;yr(I,P)|0}i=de[(pe[d>>2]|0)+r>>0]|0;if(!(i<<24>>24)){r=0;break e}r=o+n|0;if(n>>>0>=r>>>0){r=n;break r}do{if((pe[p>>2]|0)>>>0<=n>>>0){pe[C>>2]=1154;pe[C+4>>2]=903;pe[C+8>>2]=1781;br(I,1100,C)|0;yr(I,k)|0}de[(pe[d>>2]|0)+n>>0]=i;n=n+1|0}while((n|0)!=(r|0))}}}while(0);if(O>>>0>r>>>0)n=r;else break}if((R|0)==90){pe[E>>2]=1154;pe[E+4>>2]=3140;pe[E+8>>2]=1632;br(I,1100,E)|0;yr(I,A)|0;r=0;break}if((O|0)==(r|0))r=dt(t)|0;else r=0}else r=0}else{de[D+16>>0]=1;r=0}}while(0);ft(D);t=r;ve=L;return t|0}function gt(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+544|0;s=c+16|0;a=c;o=c+24|0;if(!t){l=0;ve=c;return l|0}if(t>>>0<=16){l=vt(e,t)|0;ve=c;return l|0}u=vt(e,t+-16|0)|0;l=e+20|0;t=pe[l>>2]|0;if((t|0)<16){n=e+4|0;i=e+8|0;r=e+16|0;do{e=pe[n>>2]|0;if((e|0)==(pe[i>>2]|0))e=0;else{pe[n>>2]=e+1;e=ge[e>>0]|0}t=t+8|0;pe[l>>2]=t;if((t|0)>=33){pe[a>>2]=1154;pe[a+4>>2]=3199;pe[a+8>>2]=1650;br(o,1100,a)|0;yr(o,s)|0;t=pe[l>>2]|0}e=e<<32-t|pe[r>>2];pe[r>>2]=e}while((t|0)<16)}else{e=e+16|0;r=e;e=pe[e>>2]|0}pe[r>>2]=e<<16;pe[l>>2]=t+-16;l=e>>>16|u<<16;ve=c;return l|0}function mt(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0;y=ve;ve=ve+608|0;g=y+88|0;p=y+72|0;h=y+64|0;f=y+48|0;c=y+40|0;d=y+24|0;l=y+16|0;u=y;v=y+96|0;m=pe[t+20>>2]|0;_=e+20|0;s=pe[_>>2]|0;do{if((s|0)<24){a=e+4|0;n=pe[a>>2]|0;i=pe[e+8>>2]|0;r=n>>>0>>0;if((s|0)>=16){if(r){pe[a>>2]=n+1;r=ge[n>>0]|0}else r=0;pe[_>>2]=s+8;a=e+16|0;o=r<<24-s|pe[a>>2];pe[a>>2]=o;break}if(r){o=(ge[n>>0]|0)<<8;r=n+1|0}else{o=0;r=n}if(r>>>0>>0){n=ge[r>>0]|0;r=r+1|0}else n=0;pe[a>>2]=r;pe[_>>2]=s+16;a=e+16|0;o=(n|o)<<16-s|pe[a>>2];pe[a>>2]=o}else{o=e+16|0;a=o;o=pe[o>>2]|0}}while(0);i=(o>>>16)+1|0;do{if(i>>>0<=(pe[m+16>>2]|0)>>>0){n=pe[(pe[m+168>>2]|0)+(o>>>(32-(pe[m+8>>2]|0)|0)<<2)>>2]|0;if((n|0)==-1){pe[u>>2]=1154;pe[u+4>>2]=3244;pe[u+8>>2]=1677;br(v,1100,u)|0;yr(v,l)|0}r=n&65535;n=n>>>16;if((pe[t+8>>2]|0)>>>0<=r>>>0){pe[d>>2]=1154;pe[d+4>>2]=902;pe[d+8>>2]=1781;br(v,1100,d)|0;yr(v,c)|0}if((ge[(pe[t+4>>2]|0)+r>>0]|0|0)!=(n|0)){pe[f>>2]=1154;pe[f+4>>2]=3248;pe[f+8>>2]=1694;br(v,1100,f)|0;yr(v,h)|0}}else{n=pe[m+20>>2]|0;while(1){r=n+-1|0;if(i>>>0>(pe[m+28+(r<<2)>>2]|0)>>>0)n=n+1|0;else break}r=(o>>>(32-n|0))+(pe[m+96+(r<<2)>>2]|0)|0;if(r>>>0<(pe[t>>2]|0)>>>0){r=me[(pe[m+176>>2]|0)+(r<<1)>>1]|0;break}pe[p>>2]=1154;pe[p+4>>2]=3266;pe[p+8>>2]=1632;br(v,1100,p)|0;yr(v,g)|0;_=0;ve=y;return _|0}}while(0);pe[a>>2]=pe[a>>2]<>2]=(pe[_>>2]|0)-n;_=r;ve=y;return _|0}function vt(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+560|0;s=c+40|0;u=c+24|0;r=c;a=c+48|0;if(t>>>0>=33){pe[r>>2]=1154;pe[r+4>>2]=3190;pe[r+8>>2]=1634;br(a,1100,r)|0;yr(a,c+16|0)|0}l=e+20|0;r=pe[l>>2]|0;if((r|0)>=(t|0)){o=e+16|0;a=o;o=pe[o>>2]|0;s=r;u=32-t|0;u=o>>>u;o=o<>2]=o;t=s-t|0;pe[l>>2]=t;ve=c;return u|0}i=e+4|0;o=e+8|0;n=e+16|0;do{e=pe[i>>2]|0;if((e|0)==(pe[o>>2]|0))e=0;else{pe[i>>2]=e+1;e=ge[e>>0]|0}r=r+8|0;pe[l>>2]=r;if((r|0)>=33){pe[u>>2]=1154;pe[u+4>>2]=3199;pe[u+8>>2]=1650;br(a,1100,u)|0;yr(a,s)|0;r=pe[l>>2]|0}e=e<<32-r|pe[n>>2];pe[n>>2]=e}while((r|0)<(t|0));u=32-t|0;u=e>>>u;s=e<>2]=s;t=r-t|0;pe[l>>2]=t;ve=c;return u|0}function _t(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0;p=ve;ve=ve+544|0;h=p+16|0;f=p;c=p+24|0;if((e|0)==0|t>>>0<62){d=0;ve=p;return d|0}l=at(300,0)|0;if(!l){d=0;ve=p;return d|0}pe[l>>2]=519686845;r=l+4|0;pe[r>>2]=0;n=l+8|0;pe[n>>2]=0;u=l+88|0;i=l+136|0;o=l+160|0;a=u;s=a+44|0;do{pe[a>>2]=0;a=a+4|0}while((a|0)<(s|0));de[u+44>>0]=0;g=l+184|0;a=l+208|0;s=l+232|0;m=l+252|0;pe[m>>2]=0;pe[m+4>>2]=0;pe[m+8>>2]=0;de[m+12>>0]=0;m=l+268|0;pe[m>>2]=0;pe[m+4>>2]=0;pe[m+8>>2]=0;de[m+12>>0]=0;m=l+284|0;pe[m>>2]=0;pe[m+4>>2]=0;pe[m+8>>2]=0;de[m+12>>0]=0;pe[i>>2]=0;pe[i+4>>2]=0;pe[i+8>>2]=0;pe[i+12>>2]=0;pe[i+16>>2]=0;de[i+20>>0]=0;pe[o>>2]=0;pe[o+4>>2]=0;pe[o+8>>2]=0;pe[o+12>>2]=0;pe[o+16>>2]=0;de[o+20>>0]=0;pe[g>>2]=0;pe[g+4>>2]=0;pe[g+8>>2]=0;pe[g+12>>2]=0;pe[g+16>>2]=0;de[g+20>>0]=0;pe[a>>2]=0;pe[a+4>>2]=0;pe[a+8>>2]=0;pe[a+12>>2]=0;pe[a+16>>2]=0;de[a+20>>0]=0;pe[s>>2]=0;pe[s+4>>2]=0;pe[s+8>>2]=0;pe[s+12>>2]=0;de[s+16>>0]=0;do{if(((t>>>0>=74?((ge[e>>0]|0)<<8|(ge[e+1>>0]|0)|0)==18552:0)?((ge[e+2>>0]|0)<<8|(ge[e+3>>0]|0))>>>0>=74:0)?((ge[e+7>>0]|0)<<16|(ge[e+6>>0]|0)<<24|(ge[e+8>>0]|0)<<8|(ge[e+9>>0]|0))>>>0<=t>>>0:0){pe[u>>2]=e;pe[r>>2]=e;pe[n>>2]=t;if(Ct(l)|0){r=pe[u>>2]|0;if((ge[r+39>>0]|0)<<8|(ge[r+40>>0]|0)){if(!(kt(l)|0))break;if(!(Et(l)|0))break;r=pe[u>>2]|0}if(!((ge[r+55>>0]|0)<<8|(ge[r+56>>0]|0))){m=l;ve=p;return m|0}if(At(l)|0?Ot(l)|0:0){m=l;ve=p;return m|0}}}else d=7}while(0);if((d|0)==7)pe[u>>2]=0;Nt(l);if(!(l&7)){Dn[pe[104>>2]&1](l,0,0,1,pe[27]|0)|0;m=0;ve=p;return m|0}else{pe[f>>2]=1154;pe[f+4>>2]=2499;pe[f+8>>2]=1516;br(c,1100,f)|0;yr(c,h)|0;m=0;ve=p;return m|0}return 0}function yt(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+544|0;l=c;u=c+24|0;o=pe[e+88>>2]|0;s=(ge[o+70+(i<<2)+1>>0]|0)<<16|(ge[o+70+(i<<2)>>0]|0)<<24|(ge[o+70+(i<<2)+2>>0]|0)<<8|(ge[o+70+(i<<2)+3>>0]|0);a=i+1|0;if(a>>>0<(ge[o+16>>0]|0)>>>0)o=(ge[o+70+(a<<2)+1>>0]|0)<<16|(ge[o+70+(a<<2)>>0]|0)<<24|(ge[o+70+(a<<2)+2>>0]|0)<<8|(ge[o+70+(a<<2)+3>>0]|0);else o=pe[e+8>>2]|0;if(o>>>0>s>>>0){u=e+4|0;u=pe[u>>2]|0;u=u+s|0;l=o-s|0;l=bt(e,u,l,t,r,n,i)|0;ve=c;return l|0}pe[l>>2]=1154;pe[l+4>>2]=3704;pe[l+8>>2]=1792;br(u,1100,l)|0;yr(u,c+16|0)|0;u=e+4|0;u=pe[u>>2]|0;u=u+s|0;l=o-s|0;l=bt(e,u,l,t,r,n,i)|0;ve=c;return l|0}function bt(e,t,r,n,i,o,a){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;var s=0,u=0,l=0,c=0;c=pe[e+88>>2]|0;u=((ge[c+12>>0]|0)<<8|(ge[c+13>>0]|0))>>>a;l=((ge[c+14>>0]|0)<<8|(ge[c+15>>0]|0))>>>a;u=u>>>0>1?(u+3|0)>>>2:1;l=l>>>0>1?(l+3|0)>>>2:1;c=c+18|0;a=de[c>>0]|0;a=_e(a<<24>>24==0|a<<24>>24==9?8:16,u)|0;if(o)if((o&3|0)==0&a>>>0<=o>>>0)a=o;else{e=0;return e|0}if((_e(a,l)|0)>>>0>i>>>0){e=0;return e|0}o=(u+1|0)>>>1;s=(l+1|0)>>>1;if(!r){e=0;return e|0}pe[e+92>>2]=t;pe[e+96>>2]=t;pe[e+104>>2]=r;pe[e+100>>2]=t+r;pe[e+108>>2]=0;pe[e+112>>2]=0;switch(ge[c>>0]|0|0){case 0:{Rt(e,n,i,a,u,l,o,s)|0;e=1;return e|0}case 4:case 6:case 5:case 3:case 2:{It(e,n,i,a,u,l,o,s)|0;e=1;return e|0}case 9:{Dt(e,n,i,a,u,l,o,s)|0;e=1;return e|0}case 8:case 7:{Lt(e,n,i,a,u,l,o,s)|0;e=1;return e|0}default:{e=0;return e|0}}return 0}function xt(e,t){e=e|0;t=t|0;var r=0,n=0;n=ve;ve=ve+48|0;r=n;pe[r>>2]=40;lt(e,t,r)|0;ve=n;return pe[r+4>>2]|0}function wt(e,t){e=e|0;t=t|0;var r=0,n=0;n=ve;ve=ve+48|0;r=n;pe[r>>2]=40;lt(e,t,r)|0;ve=n;return pe[r+8>>2]|0}function Tt(e,t){e=e|0;t=t|0;var r=0,n=0;n=ve;ve=ve+48|0;r=n;pe[r>>2]=40;lt(e,t,r)|0;ve=n;return pe[r+12>>2]|0}function St(e,t){e=e|0;t=t|0;var r=0,n=0;n=ve;ve=ve+48|0;r=n;pe[r>>2]=40;lt(e,t,r)|0;ve=n;return pe[r+32>>2]|0}function Mt(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0,s=0,u=0,l=0;u=ve;ve=ve+576|0;a=u+56|0;o=u+40|0;i=u+64|0;l=u;pe[l>>2]=40;lt(e,t,l)|0;n=(((pe[l+4>>2]|0)>>>r)+3|0)>>>2;t=(((pe[l+8>>2]|0)>>>r)+3|0)>>>2;r=l+32|0;e=pe[r+4>>2]|0;do{switch(pe[r>>2]|0){case 0:{if(!e)e=8;else s=13;break}case 1:{if(!e)s=12;else s=13;break}case 2:{if(!e)s=12;else s=13;break}case 3:{if(!e)s=12;else s=13;break}case 4:{if(!e)s=12;else s=13;break}case 5:{if(!e)s=12;else s=13;break}case 6:{if(!e)s=12;else s=13;break}case 7:{if(!e)s=12;else s=13;break}case 8:{if(!e)s=12;else s=13;break}case 9:{if(!e)e=8;else s=13;break}default:s=13}}while(0);if((s|0)==12)e=16;else if((s|0)==13){pe[o>>2]=1154;pe[o+4>>2]=2663;pe[o+8>>2]=1535;br(i,1100,o)|0;yr(i,a)|0;e=0}l=_e(_e(t,n)|0,e)|0;ve=u;return l|0}function Pt(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0;p=ve;ve=ve+608|0;h=p+80|0;d=p+64|0;s=p+56|0;a=p+40|0;c=p+88|0;g=p;f=p+84|0;pe[g>>2]=40;lt(e,t,g)|0;u=(((pe[g+4>>2]|0)>>>i)+3|0)>>>2;g=g+32|0;o=pe[g+4>>2]|0;do{switch(pe[g>>2]|0){case 0:{if(!o)o=8;else l=13;break}case 1:{if(!o)l=12;else l=13;break}case 2:{if(!o)l=12;else l=13;break}case 3:{if(!o)l=12;else l=13;break}case 4:{if(!o)l=12;else l=13;break}case 5:{if(!o)l=12;else l=13;break}case 6:{if(!o)l=12;else l=13;break}case 7:{if(!o)l=12;else l=13;break}case 8:{if(!o)l=12;else l=13;break}case 9:{if(!o)o=8;else l=13;break}default:l=13}}while(0);if((l|0)==12)o=16;else if((l|0)==13){pe[a>>2]=1154;pe[a+4>>2]=2663;pe[a+8>>2]=1535;br(c,1100,a)|0;yr(c,s)|0;o=0}s=_e(o,u)|0;a=_t(e,t)|0;pe[f>>2]=r;o=(a|0)==0;if(!(i>>>0>15|(n>>>0<8|o))?(pe[a>>2]|0)==519686845:0)yt(a,f,n,s,i)|0;if(o){ve=p;return}if((pe[a>>2]|0)!=519686845){ve=p;return}Nt(a);if(!(a&7)){Dn[pe[104>>2]&1](a,0,0,1,pe[27]|0)|0;ve=p;return}else{pe[d>>2]=1154;pe[d+4>>2]=2499;pe[d+8>>2]=1516;br(c,1100,d)|0;yr(c,h)|0;ve=p;return}}function Ct(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0;a=e+92|0;n=pe[e+4>>2]|0;o=e+88|0;i=pe[o>>2]|0;t=(ge[i+68>>0]|0)<<8|(ge[i+67>>0]|0)<<16|(ge[i+69>>0]|0);r=n+t|0;i=(ge[i+65>>0]|0)<<8|(ge[i+66>>0]|0);if(!i){e=0;return e|0}pe[a>>2]=r;pe[e+96>>2]=r;pe[e+104>>2]=i;pe[e+100>>2]=n+(i+t);pe[e+108>>2]=0;pe[e+112>>2]=0;if(!(pt(a,e+116|0)|0)){e=0;return e|0}t=pe[o>>2]|0;do{if(!((ge[t+39>>0]|0)<<8|(ge[t+40>>0]|0))){if(!((ge[t+55>>0]|0)<<8|(ge[t+56>>0]|0))){e=0;return e|0}}else{if(!(pt(a,e+140|0)|0)){e=0;return e|0}if(pt(a,e+188|0)|0){t=pe[o>>2]|0;break}else{e=0;return e|0}}}while(0);if((ge[t+55>>0]|0)<<8|(ge[t+56>>0]|0)){if(!(pt(a,e+164|0)|0)){e=0;return e|0}if(!(pt(a,e+212|0)|0)){e=0;return e|0}}e=1;return e|0}function kt(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;p=ve;ve=ve+592|0;u=p+16|0;s=p;a=p+72|0;d=p+24|0;n=e+88|0;t=pe[n>>2]|0;h=(ge[t+39>>0]|0)<<8|(ge[t+40>>0]|0);c=e+236|0;o=e+240|0;r=pe[o>>2]|0;if((r|0)!=(h|0)){if(r>>>0<=h>>>0){do{if((pe[e+244>>2]|0)>>>0>>0){if(it(c,h,(r+1|0)==(h|0),4,0)|0){t=pe[o>>2]|0;break}de[e+248>>0]=1;d=0;ve=p;return d|0}else t=r}while(0);Vr((pe[c>>2]|0)+(t<<2)|0,0,h-t<<2|0)|0;t=pe[n>>2]|0}pe[o>>2]=h}l=e+92|0;r=pe[e+4>>2]|0;n=(ge[t+34>>0]|0)<<8|(ge[t+33>>0]|0)<<16|(ge[t+35>>0]|0);i=r+n|0;t=(ge[t+37>>0]|0)<<8|(ge[t+36>>0]|0)<<16|(ge[t+38>>0]|0);if(!t){d=0;ve=p;return d|0}pe[l>>2]=i;pe[e+96>>2]=i;pe[e+104>>2]=t;pe[e+100>>2]=r+(t+n);pe[e+108>>2]=0;pe[e+112>>2]=0;pe[d+20>>2]=0;pe[d>>2]=0;pe[d+4>>2]=0;pe[d+8>>2]=0;pe[d+12>>2]=0;de[d+16>>0]=0;e=d+24|0;pe[d+44>>2]=0;pe[e>>2]=0;pe[e+4>>2]=0;pe[e+8>>2]=0;pe[e+12>>2]=0;de[e+16>>0]=0;if(pt(l,d)|0?(f=d+24|0,pt(l,f)|0):0){if(!(pe[o>>2]|0)){pe[s>>2]=1154;pe[s+4>>2]=903;pe[s+8>>2]=1781;br(a,1100,s)|0;yr(a,u)|0}if(!h)t=1;else{n=0;i=0;o=0;t=0;a=0;e=0;s=0;r=pe[c>>2]|0;while(1){n=(mt(l,d)|0)+n&31;i=(mt(l,f)|0)+i&63;o=(mt(l,d)|0)+o&31;t=(mt(l,d)|0)+t|0;a=(mt(l,f)|0)+a&63;e=(mt(l,d)|0)+e&31;pe[r>>2]=i<<5|n<<11|o|t<<27|a<<21|e<<16;s=s+1|0;if((s|0)==(h|0)){t=1;break}else{t=t&31;r=r+4|0}}}}else t=0;ft(d+24|0);ft(d);d=t;ve=p;return d|0}function Et(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0;M=ve;ve=ve+1024|0;s=M+16|0;a=M;o=M+504|0;S=M+480|0;w=M+284|0;T=M+88|0;x=M+24|0;i=pe[e+88>>2]|0;b=(ge[i+47>>0]|0)<<8|(ge[i+48>>0]|0);y=e+92|0;t=pe[e+4>>2]|0;r=(ge[i+42>>0]|0)<<8|(ge[i+41>>0]|0)<<16|(ge[i+43>>0]|0);n=t+r|0;i=(ge[i+45>>0]|0)<<8|(ge[i+44>>0]|0)<<16|(ge[i+46>>0]|0);if(!i){S=0;ve=M;return S|0}pe[y>>2]=n;pe[e+96>>2]=n;pe[e+104>>2]=i;pe[e+100>>2]=t+(i+r);pe[e+108>>2]=0;pe[e+112>>2]=0;pe[S+20>>2]=0;pe[S>>2]=0;pe[S+4>>2]=0;pe[S+8>>2]=0;pe[S+12>>2]=0;de[S+16>>0]=0;if(pt(y,S)|0){r=0;n=-3;i=-3;while(1){pe[w+(r<<2)>>2]=n;pe[T+(r<<2)>>2]=i;t=(n|0)>2;r=r+1|0;if((r|0)==49)break;else{n=t?-3:n+1|0;i=(t&1)+i|0}}t=x;r=t+64|0;do{pe[t>>2]=0;t=t+4|0}while((t|0)<(r|0));_=e+252|0;r=e+256|0;t=pe[r>>2]|0;e:do{if((t|0)==(b|0))u=13;else{if(t>>>0<=b>>>0){do{if((pe[e+260>>2]|0)>>>0>>0)if(it(_,b,(t+1|0)==(b|0),4,0)|0){t=pe[r>>2]|0;break}else{de[e+264>>0]=1;t=0;break e}}while(0);Vr((pe[_>>2]|0)+(t<<2)|0,0,b-t<<2|0)|0}pe[r>>2]=b;u=13}}while(0);do{if((u|0)==13){if(!b){pe[a>>2]=1154;pe[a+4>>2]=903;pe[a+8>>2]=1781;br(o,1100,a)|0;yr(o,s)|0;t=1;break}n=x+4|0;i=x+8|0;e=x+12|0;o=x+16|0;a=x+20|0;s=x+24|0;u=x+28|0;l=x+32|0;c=x+36|0;f=x+40|0;h=x+44|0;d=x+48|0;p=x+52|0;g=x+56|0;m=x+60|0;v=0;r=pe[_>>2]|0;while(1){t=0;do{P=mt(y,S)|0;_=t<<1;C=x+(_<<2)|0;pe[C>>2]=(pe[C>>2]|0)+(pe[w+(P<<2)>>2]|0)&3;_=x+((_|1)<<2)|0;pe[_>>2]=(pe[_>>2]|0)+(pe[T+(P<<2)>>2]|0)&3;t=t+1|0}while((t|0)!=8);pe[r>>2]=(ge[1725+(pe[n>>2]|0)>>0]|0)<<2|(ge[1725+(pe[x>>2]|0)>>0]|0)|(ge[1725+(pe[i>>2]|0)>>0]|0)<<4|(ge[1725+(pe[e>>2]|0)>>0]|0)<<6|(ge[1725+(pe[o>>2]|0)>>0]|0)<<8|(ge[1725+(pe[a>>2]|0)>>0]|0)<<10|(ge[1725+(pe[s>>2]|0)>>0]|0)<<12|(ge[1725+(pe[u>>2]|0)>>0]|0)<<14|(ge[1725+(pe[l>>2]|0)>>0]|0)<<16|(ge[1725+(pe[c>>2]|0)>>0]|0)<<18|(ge[1725+(pe[f>>2]|0)>>0]|0)<<20|(ge[1725+(pe[h>>2]|0)>>0]|0)<<22|(ge[1725+(pe[d>>2]|0)>>0]|0)<<24|(ge[1725+(pe[p>>2]|0)>>0]|0)<<26|(ge[1725+(pe[g>>2]|0)>>0]|0)<<28|(ge[1725+(pe[m>>2]|0)>>0]|0)<<30;v=v+1|0;if((v|0)==(b|0)){t=1;break}else r=r+4|0}}}while(0)}else t=0;ft(S);C=t;ve=M;return C|0}function At(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0;h=ve;ve=ve+560|0;u=h+16|0;s=h;a=h+48|0;f=h+24|0;i=pe[e+88>>2]|0;c=(ge[i+55>>0]|0)<<8|(ge[i+56>>0]|0);l=e+92|0;t=pe[e+4>>2]|0;r=(ge[i+50>>0]|0)<<8|(ge[i+49>>0]|0)<<16|(ge[i+51>>0]|0);n=t+r|0;i=(ge[i+53>>0]|0)<<8|(ge[i+52>>0]|0)<<16|(ge[i+54>>0]|0);if(!i){f=0;ve=h;return f|0}pe[l>>2]=n;pe[e+96>>2]=n;pe[e+104>>2]=i;pe[e+100>>2]=t+(i+r);pe[e+108>>2]=0;pe[e+112>>2]=0;pe[f+20>>2]=0;pe[f>>2]=0;pe[f+4>>2]=0;pe[f+8>>2]=0;pe[f+12>>2]=0;de[f+16>>0]=0;e:do{if(pt(l,f)|0){o=e+268|0;r=e+272|0;t=pe[r>>2]|0;if((t|0)!=(c|0)){if(t>>>0<=c>>>0){do{if((pe[e+276>>2]|0)>>>0>>0)if(it(o,c,(t+1|0)==(c|0),2,0)|0){t=pe[r>>2]|0;break}else{de[e+280>>0]=1;t=0;break e}}while(0);Vr((pe[o>>2]|0)+(t<<1)|0,0,c-t<<1|0)|0}pe[r>>2]=c}if(!c){pe[s>>2]=1154;pe[s+4>>2]=903;pe[s+8>>2]=1781;br(a,1100,s)|0;yr(a,u)|0;t=1;break}r=0;n=0;i=0;t=pe[o>>2]|0;while(1){u=mt(l,f)|0;r=u+r&255;n=(mt(l,f)|0)+n&255;Q[t>>1]=n<<8|r;i=i+1|0;if((i|0)==(c|0)){t=1;break}else t=t+2|0}}else t=0}while(0);ft(f);f=t;ve=h;return f|0}function Ot(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0;M=ve;ve=ve+2432|0;s=M+16|0;a=M;o=M+1912|0;S=M+1888|0;w=M+988|0;T=M+88|0;x=M+24|0;i=pe[e+88>>2]|0;b=(ge[i+63>>0]|0)<<8|(ge[i+64>>0]|0);y=e+92|0;t=pe[e+4>>2]|0;r=(ge[i+58>>0]|0)<<8|(ge[i+57>>0]|0)<<16|(ge[i+59>>0]|0);n=t+r|0;i=(ge[i+61>>0]|0)<<8|(ge[i+60>>0]|0)<<16|(ge[i+62>>0]|0);if(!i){S=0;ve=M;return S|0}pe[y>>2]=n;pe[e+96>>2]=n;pe[e+104>>2]=i;pe[e+100>>2]=t+(i+r);pe[e+108>>2]=0;pe[e+112>>2]=0;pe[S+20>>2]=0;pe[S>>2]=0;pe[S+4>>2]=0;pe[S+8>>2]=0;pe[S+12>>2]=0;de[S+16>>0]=0;if(pt(y,S)|0){r=0;n=-7;i=-7;while(1){pe[w+(r<<2)>>2]=n;pe[T+(r<<2)>>2]=i;t=(n|0)>6;r=r+1|0;if((r|0)==225)break;else{n=t?-7:n+1|0;i=(t&1)+i|0}}t=x;r=t+64|0;do{pe[t>>2]=0;t=t+4|0}while((t|0)<(r|0));_=e+284|0;r=b*3|0;n=e+288|0;t=pe[n>>2]|0;e:do{if((t|0)==(r|0))u=13;else{if(t>>>0<=r>>>0){do{if((pe[e+292>>2]|0)>>>0>>0)if(it(_,r,(t+1|0)==(r|0),2,0)|0){t=pe[n>>2]|0;break}else{de[e+296>>0]=1;t=0;break e}}while(0);Vr((pe[_>>2]|0)+(t<<1)|0,0,r-t<<1|0)|0}pe[n>>2]=r;u=13}}while(0);do{if((u|0)==13){if(!b){pe[a>>2]=1154;pe[a+4>>2]=903;pe[a+8>>2]=1781;br(o,1100,a)|0;yr(o,s)|0;t=1;break}n=x+4|0;i=x+8|0;e=x+12|0;o=x+16|0;a=x+20|0;s=x+24|0;u=x+28|0;l=x+32|0;c=x+36|0;f=x+40|0;h=x+44|0;d=x+48|0;p=x+52|0;g=x+56|0;m=x+60|0;v=0;r=pe[_>>2]|0;while(1){t=0;do{P=mt(y,S)|0;_=t<<1;C=x+(_<<2)|0;pe[C>>2]=(pe[C>>2]|0)+(pe[w+(P<<2)>>2]|0)&7;_=x+((_|1)<<2)|0;pe[_>>2]=(pe[_>>2]|0)+(pe[T+(P<<2)>>2]|0)&7;t=t+1|0}while((t|0)!=8);P=ge[1729+(pe[a>>2]|0)>>0]|0;Q[r>>1]=(ge[1729+(pe[n>>2]|0)>>0]|0)<<3|(ge[1729+(pe[x>>2]|0)>>0]|0)|(ge[1729+(pe[i>>2]|0)>>0]|0)<<6|(ge[1729+(pe[e>>2]|0)>>0]|0)<<9|(ge[1729+(pe[o>>2]|0)>>0]|0)<<12|P<<15;C=ge[1729+(pe[f>>2]|0)>>0]|0;Q[r+2>>1]=(ge[1729+(pe[s>>2]|0)>>0]|0)<<2|P>>>1|(ge[1729+(pe[u>>2]|0)>>0]|0)<<5|(ge[1729+(pe[l>>2]|0)>>0]|0)<<8|(ge[1729+(pe[c>>2]|0)>>0]|0)<<11|C<<14;Q[r+4>>1]=(ge[1729+(pe[h>>2]|0)>>0]|0)<<1|C>>>2|(ge[1729+(pe[d>>2]|0)>>0]|0)<<4|(ge[1729+(pe[p>>2]|0)>>0]|0)<<7|(ge[1729+(pe[g>>2]|0)>>0]|0)<<10|(ge[1729+(pe[m>>2]|0)>>0]|0)<<13;v=v+1|0;if((v|0)==(b|0)){t=1;break}else r=r+6|0}}}while(0)}else t=0;ft(S);C=t;ve=M;return C|0}function Rt(e,t,r,n,i,o,a,s){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;s=s|0;var u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0,$=0,Q=0,ee=0,te=0,re=0,ne=0,ie=0,oe=0,ae=0,se=0,ue=0,le=0,ce=0,fe=0,he=0;ce=ve;ve=ve+720|0;le=ce+184|0;se=ce+168|0;ae=ce+160|0;oe=ce+144|0;ie=ce+136|0;ne=ce+120|0;re=ce+112|0;ee=ce+96|0;Q=ce+88|0;$=ce+72|0;J=ce+64|0;Z=ce+48|0;K=ce+40|0;ue=ce+24|0;te=ce+16|0;V=ce;G=ce+208|0;W=ce+192|0;B=e+240|0;z=pe[B>>2]|0;q=e+256|0;H=pe[q>>2]|0;r=de[(pe[e+88>>2]|0)+17>>0]|0;Y=n>>>2;if(!(r<<24>>24)){ve=ce;return 1}U=(s|0)==0;X=s+-1|0;R=(o&1|0)!=0;I=n<<1;D=e+92|0;L=e+116|0;N=e+140|0;j=e+236|0;F=a+-1|0;O=(i&1|0)!=0;A=e+188|0;M=e+252|0;P=Y+1|0;C=Y+2|0;k=Y+3|0;E=F<<4;T=r&255;r=0;o=0;i=1;S=0;do{if(!U){x=pe[t+(S<<2)>>2]|0;w=0;while(1){_=w&1;u=(_|0)==0;v=(_<<5^32)+-16|0;_=(_<<1^2)+-1|0;b=u?a:-1;l=u?0:F;e=(w|0)==(X|0);y=R&e;if((l|0)!=(b|0)){m=R&e^1;g=u?x:x+E|0;while(1){if((i|0)==1)i=mt(D,L)|0|512;p=i&7;i=i>>>3;u=ge[1823+p>>0]|0;e=0;do{h=(mt(D,N)|0)+o|0;d=h-z|0;o=d>>31;o=o&h|d&~o;if((pe[B>>2]|0)>>>0<=o>>>0){pe[V>>2]=1154;pe[V+4>>2]=903;pe[V+8>>2]=1781;br(G,1100,V)|0;yr(G,te)|0}pe[W+(e<<2)>>2]=pe[(pe[j>>2]|0)+(o<<2)>>2];e=e+1|0}while(e>>>0>>0);d=O&(l|0)==(F|0);if(y|d){h=0;do{c=_e(h,n)|0;e=g+c|0;u=(h|0)==0|m;f=h<<1;he=(mt(D,A)|0)+r|0;fe=he-H|0;r=fe>>31;r=r&he|fe&~r;do{if(d){if(!u){fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;break}pe[e>>2]=pe[W+((ge[1831+(p<<2)+f>>0]|0)<<2)>>2];if((pe[q>>2]|0)>>>0<=r>>>0){pe[oe>>2]=1154;pe[oe+4>>2]=903;pe[oe+8>>2]=1781;br(G,1100,oe)|0;yr(G,ae)|0}pe[g+(c+4)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r}else{if(!u){fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;break}pe[e>>2]=pe[W+((ge[1831+(p<<2)+f>>0]|0)<<2)>>2];if((pe[q>>2]|0)>>>0<=r>>>0){pe[ne>>2]=1154;pe[ne+4>>2]=903;pe[ne+8>>2]=1781;br(G,1100,ne)|0;yr(G,ie)|0}pe[g+(c+4)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;pe[g+(c+8)>>2]=pe[W+((ge[(f|1)+(1831+(p<<2))>>0]|0)<<2)>>2];if((pe[q>>2]|0)>>>0<=r>>>0){pe[se>>2]=1154;pe[se+4>>2]=903;pe[se+8>>2]=1781;br(G,1100,se)|0;yr(G,le)|0}pe[g+(c+12)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2]}}while(0);h=h+1|0}while((h|0)!=2)}else{pe[g>>2]=pe[W+((ge[1831+(p<<2)>>0]|0)<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;if((pe[q>>2]|0)>>>0<=r>>>0){pe[ue>>2]=1154;pe[ue+4>>2]=903;pe[ue+8>>2]=1781;br(G,1100,ue)|0;yr(G,K)|0}pe[g+4>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];pe[g+8>>2]=pe[W+((ge[1831+(p<<2)+1>>0]|0)<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;if((pe[q>>2]|0)>>>0<=r>>>0){pe[Z>>2]=1154;pe[Z+4>>2]=903;pe[Z+8>>2]=1781;br(G,1100,Z)|0;yr(G,J)|0}pe[g+12>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];pe[g+(Y<<2)>>2]=pe[W+((ge[1831+(p<<2)+2>>0]|0)<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;if((pe[q>>2]|0)>>>0<=r>>>0){pe[$>>2]=1154;pe[$+4>>2]=903;pe[$+8>>2]=1781;br(G,1100,$)|0;yr(G,Q)|0}pe[g+(P<<2)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];pe[g+(C<<2)>>2]=pe[W+((ge[1831+(p<<2)+3>>0]|0)<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;if((pe[q>>2]|0)>>>0<=r>>>0){pe[ee>>2]=1154;pe[ee+4>>2]=903;pe[ee+8>>2]=1781;br(G,1100,ee)|0;yr(G,re)|0}pe[g+(k<<2)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2]}l=l+_|0;if((l|0)==(b|0))break;else g=g+v|0}}w=w+1|0;if((w|0)==(s|0))break;else x=x+I|0}}S=S+1|0}while((S|0)!=(T|0));ve=ce;return 1}function It(e,t,r,n,i,o,a,s){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;s=s|0;var u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0,$=0,Q=0,ee=0,te=0,re=0,ne=0,ie=0,oe=0,ae=0,se=0,ue=0,le=0,ce=0,fe=0,he=0;fe=ve;ve=ve+640|0;ue=fe+88|0;se=fe+72|0;ae=fe+64|0;oe=fe+48|0;ie=fe+40|0;ce=fe+24|0;le=fe+16|0;ne=fe;te=fe+128|0;re=fe+112|0;ee=fe+96|0;B=e+240|0;z=pe[B>>2]|0;q=e+256|0;J=pe[q>>2]|0;$=e+272|0;Q=pe[$>>2]|0;r=pe[e+88>>2]|0;U=(ge[r+63>>0]|0)<<8|(ge[r+64>>0]|0);r=de[r+17>>0]|0;if(!(r<<24>>24)){ve=fe;return 1}X=(s|0)==0;H=s+-1|0;Y=n<<1;G=e+92|0;W=e+116|0;V=a+-1|0;K=e+212|0;Z=e+188|0;F=(i&1|0)==0;j=(o&1|0)==0;O=e+288|0;R=e+284|0;I=e+252|0;D=e+140|0;L=e+236|0;N=e+164|0;E=e+268|0;A=V<<5;C=r&255;r=0;i=0;o=0;e=0;u=1;k=0;do{if(!X){M=pe[t+(k<<2)>>2]|0;P=0;while(1){T=P&1;l=(T|0)==0;w=(T<<6^64)+-32|0;T=(T<<1^2)+-1|0;S=l?a:-1;c=l?0:V;if((c|0)!=(S|0)){x=j|(P|0)!=(H|0);b=l?M:M+A|0;while(1){if((u|0)==1)u=mt(G,W)|0|512;y=u&7;u=u>>>3;f=ge[1823+y>>0]|0;l=0;do{v=(mt(G,N)|0)+i|0;_=v-Q|0;i=_>>31;i=i&v|_&~i;if((pe[$>>2]|0)>>>0<=i>>>0){pe[ne>>2]=1154;pe[ne+4>>2]=903;pe[ne+8>>2]=1781;br(te,1100,ne)|0;yr(te,le)|0}pe[ee+(l<<2)>>2]=me[(pe[E>>2]|0)+(i<<1)>>1];l=l+1|0}while(l>>>0>>0);l=0;do{v=(mt(G,D)|0)+e|0;_=v-z|0;e=_>>31;e=e&v|_&~e;if((pe[B>>2]|0)>>>0<=e>>>0){pe[ce>>2]=1154;pe[ce+4>>2]=903;pe[ce+8>>2]=1781;br(te,1100,ce)|0;yr(te,ie)|0}pe[re+(l<<2)>>2]=pe[(pe[L>>2]|0)+(e<<2)>>2];l=l+1|0}while(l>>>0>>0);_=F|(c|0)!=(V|0);m=0;v=b;while(1){g=x|(m|0)==0;p=m<<1;h=0;d=v;while(1){f=(mt(G,K)|0)+r|0;l=f-U|0;r=l>>31;r=r&f|l&~r;l=(mt(G,Z)|0)+o|0;f=l-J|0;o=f>>31;o=o&l|f&~o;if((_|(h|0)==0)&g){l=ge[h+p+(1831+(y<<2))>>0]|0;f=r*3|0;if((pe[O>>2]|0)>>>0<=f>>>0){pe[oe>>2]=1154;pe[oe+4>>2]=903;pe[oe+8>>2]=1781;br(te,1100,oe)|0;yr(te,ae)|0}he=pe[R>>2]|0;pe[d>>2]=(me[he+(f<<1)>>1]|0)<<16|pe[ee+(l<<2)>>2];pe[d+4>>2]=(me[he+(f+2<<1)>>1]|0)<<16|(me[he+(f+1<<1)>>1]|0);pe[d+8>>2]=pe[re+(l<<2)>>2];if((pe[q>>2]|0)>>>0<=o>>>0){pe[se>>2]=1154;pe[se+4>>2]=903;pe[se+8>>2]=1781;br(te,1100,se)|0;yr(te,ue)|0}pe[d+12>>2]=pe[(pe[I>>2]|0)+(o<<2)>>2]}h=h+1|0;if((h|0)==2)break;else d=d+16|0}m=m+1|0;if((m|0)==2)break;else v=v+n|0}c=c+T|0;if((c|0)==(S|0))break;else b=b+w|0}}P=P+1|0;if((P|0)==(s|0))break;else M=M+Y|0}}k=k+1|0}while((k|0)!=(C|0));ve=fe;return 1}function Dt(e,t,r,n,i,o,a,s){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;s=s|0;var u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0;J=ve;ve=ve+608|0;V=J+64|0;W=J+48|0;G=J+40|0;Z=J+24|0;K=J+16|0;Y=J;H=J+88|0;q=J+72|0;I=e+272|0;D=pe[I>>2]|0;r=pe[e+88>>2]|0;L=(ge[r+63>>0]|0)<<8|(ge[r+64>>0]|0);r=de[r+17>>0]|0;if(!(r<<24>>24)){ve=J;return 1}N=(s|0)==0;j=s+-1|0;F=n<<1;B=e+92|0;z=e+116|0;U=a+-1|0;X=e+212|0;R=(o&1|0)==0;E=e+288|0;A=e+284|0;O=e+164|0;C=e+268|0;k=U<<4;P=r&255;M=(i&1|0)!=0;r=0;o=0;e=1;S=0;do{if(!N){w=pe[t+(S<<2)>>2]|0;T=0;while(1){b=T&1;i=(b|0)==0;y=(b<<5^32)+-16|0;b=(b<<1^2)+-1|0;x=i?a:-1;u=i?0:U;if((u|0)!=(x|0)){_=R|(T|0)!=(j|0);v=i?w:w+k|0;while(1){if((e|0)==1)e=mt(B,z)|0|512;m=e&7;e=e>>>3;l=ge[1823+m>>0]|0;i=0;do{p=(mt(B,O)|0)+o|0;g=p-D|0;o=g>>31;o=o&p|g&~o;if((pe[I>>2]|0)>>>0<=o>>>0){pe[Y>>2]=1154;pe[Y+4>>2]=903;pe[Y+8>>2]=1781;br(H,1100,Y)|0;yr(H,K)|0}pe[q+(i<<2)>>2]=me[(pe[C>>2]|0)+(o<<1)>>1];i=i+1|0}while(i>>>0>>0);g=(u|0)==(U|0)&M;d=0;p=v;while(1){h=_|(d|0)==0;f=d<<1;i=(mt(B,X)|0)+r|0;c=i-L|0;l=c>>31;l=l&i|c&~l;if(h){r=ge[1831+(m<<2)+f>>0]|0;i=l*3|0;if((pe[E>>2]|0)>>>0<=i>>>0){pe[Z>>2]=1154;pe[Z+4>>2]=903;pe[Z+8>>2]=1781;br(H,1100,Z)|0;yr(H,G)|0}c=pe[A>>2]|0;pe[p>>2]=(me[c+(i<<1)>>1]|0)<<16|pe[q+(r<<2)>>2];pe[p+4>>2]=(me[c+(i+2<<1)>>1]|0)<<16|(me[c+(i+1<<1)>>1]|0)}c=p+8|0;i=(mt(B,X)|0)+l|0;l=i-L|0;r=l>>31;r=r&i|l&~r;if(!(g|h^1)){i=ge[(f|1)+(1831+(m<<2))>>0]|0;l=r*3|0;if((pe[E>>2]|0)>>>0<=l>>>0){pe[W>>2]=1154;pe[W+4>>2]=903;pe[W+8>>2]=1781;br(H,1100,W)|0;yr(H,V)|0}h=pe[A>>2]|0;pe[c>>2]=(me[h+(l<<1)>>1]|0)<<16|pe[q+(i<<2)>>2];pe[p+12>>2]=(me[h+(l+2<<1)>>1]|0)<<16|(me[h+(l+1<<1)>>1]|0)}d=d+1|0;if((d|0)==2)break;else p=p+n|0}u=u+b|0;if((u|0)==(x|0))break;else v=v+y|0}}T=T+1|0;if((T|0)==(s|0))break;else w=w+F|0}}S=S+1|0}while((S|0)!=(P|0));ve=J;return 1}function Lt(e,t,r,n,i,o,a,s){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;s=s|0;var u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0,$=0,Q=0,ee=0,te=0,re=0,ne=0,ie=0,oe=0,ae=0;ae=ve;ve=ve+640|0;ne=ae+88|0;re=ae+72|0;te=ae+64|0;ee=ae+48|0;Q=ae+40|0;oe=ae+24|0;ie=ae+16|0;$=ae;J=ae+128|0;K=ae+112|0;Z=ae+96|0;B=e+272|0;z=pe[B>>2]|0;r=pe[e+88>>2]|0;U=(ge[r+63>>0]|0)<<8|(ge[r+64>>0]|0);r=de[r+17>>0]|0;if(!(r<<24>>24)){ve=ae;return 1}X=(s|0)==0;q=s+-1|0;H=n<<1;Y=e+92|0;G=e+116|0;W=a+-1|0;V=e+212|0;F=(i&1|0)==0;j=(o&1|0)==0;D=e+288|0;L=e+284|0;N=e+164|0;R=e+268|0;I=W<<5;A=r&255;r=0;i=0;o=0;e=0;u=1;O=0;do{if(!X){k=pe[t+(O<<2)>>2]|0;E=0;while(1){P=E&1;l=(P|0)==0;M=(P<<6^64)+-32|0;P=(P<<1^2)+-1|0;C=l?a:-1;c=l?0:W;if((c|0)!=(C|0)){S=j|(E|0)!=(q|0);T=l?k:k+I|0;while(1){if((u|0)==1)u=mt(Y,G)|0|512;w=u&7;u=u>>>3;f=ge[1823+w>>0]|0;l=0;do{b=(mt(Y,N)|0)+e|0;x=b-z|0;e=x>>31;e=e&b|x&~e;if((pe[B>>2]|0)>>>0<=e>>>0){pe[$>>2]=1154;pe[$+4>>2]=903;pe[$+8>>2]=1781;br(J,1100,$)|0;yr(J,ie)|0}pe[K+(l<<2)>>2]=me[(pe[R>>2]|0)+(e<<1)>>1];l=l+1|0}while(l>>>0>>0);l=0;do{b=(mt(Y,N)|0)+i|0;x=b-z|0;i=x>>31;i=i&b|x&~i;if((pe[B>>2]|0)>>>0<=i>>>0){pe[oe>>2]=1154;pe[oe+4>>2]=903;pe[oe+8>>2]=1781;br(J,1100,oe)|0;yr(J,Q)|0}pe[Z+(l<<2)>>2]=me[(pe[R>>2]|0)+(i<<1)>>1];l=l+1|0}while(l>>>0>>0);x=F|(c|0)!=(W|0);y=0;b=T;while(1){_=S|(y|0)==0;v=y<<1;g=0;m=b;while(1){p=(mt(Y,V)|0)+o|0;d=p-U|0;o=d>>31;o=o&p|d&~o;d=(mt(Y,V)|0)+r|0;p=d-U|0;r=p>>31;r=r&d|p&~r;if((x|(g|0)==0)&_){d=ge[g+v+(1831+(w<<2))>>0]|0;p=o*3|0;l=pe[D>>2]|0;if(l>>>0<=p>>>0){pe[ee>>2]=1154;pe[ee+4>>2]=903;pe[ee+8>>2]=1781;br(J,1100,ee)|0;yr(J,te)|0;l=pe[D>>2]|0}f=pe[L>>2]|0;h=r*3|0;if(l>>>0>h>>>0)l=f;else{pe[re>>2]=1154;pe[re+4>>2]=903;pe[re+8>>2]=1781;br(J,1100,re)|0;yr(J,ne)|0;l=pe[L>>2]|0}pe[m>>2]=(me[f+(p<<1)>>1]|0)<<16|pe[K+(d<<2)>>2];pe[m+4>>2]=(me[f+(p+2<<1)>>1]|0)<<16|(me[f+(p+1<<1)>>1]|0);pe[m+8>>2]=(me[l+(h<<1)>>1]|0)<<16|pe[Z+(d<<2)>>2];pe[m+12>>2]=(me[l+(h+2<<1)>>1]|0)<<16|(me[l+(h+1<<1)>>1]|0)}g=g+1|0;if((g|0)==2)break;else m=m+16|0}y=y+1|0;if((y|0)==2)break;else b=b+n|0}c=c+P|0;if((c|0)==(C|0))break;else T=T+M|0}}E=E+1|0;if((E|0)==(s|0))break;else k=k+H|0}}O=O+1|0}while((O|0)!=(A|0));ve=ae;return 1}function Nt(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0;h=ve;ve=ve+608|0;f=h+88|0;c=h+72|0;u=h+64|0;s=h+48|0;o=h+40|0;a=h+24|0;i=h+16|0;n=h;l=h+96|0;pe[e>>2]=0;t=e+284|0;r=pe[t>>2]|0;if(r){if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[n>>2]=1154;pe[n+4>>2]=2499;pe[n+8>>2]=1516;br(l,1100,n)|0;yr(l,i)|0}pe[t>>2]=0;pe[e+288>>2]=0;pe[e+292>>2]=0}de[e+296>>0]=0;t=e+268|0;r=pe[t>>2]|0;if(r){if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[a>>2]=1154;pe[a+4>>2]=2499;pe[a+8>>2]=1516;br(l,1100,a)|0;yr(l,o)|0}pe[t>>2]=0;pe[e+272>>2]=0;pe[e+276>>2]=0}de[e+280>>0]=0;t=e+252|0;r=pe[t>>2]|0;if(r){if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[s>>2]=1154;pe[s+4>>2]=2499;pe[s+8>>2]=1516;br(l,1100,s)|0;yr(l,u)|0}pe[t>>2]=0;pe[e+256>>2]=0;pe[e+260>>2]=0}de[e+264>>0]=0;t=e+236|0;r=pe[t>>2]|0;if(!r){f=e+248|0;de[f>>0]=0;f=e+212|0;ft(f);f=e+188|0;ft(f);f=e+164|0;ft(f);f=e+140|0;ft(f);f=e+116|0;ft(f);ve=h;return}if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[c>>2]=1154;pe[c+4>>2]=2499;pe[c+8>>2]=1516;br(l,1100,c)|0;yr(l,f)|0}pe[t>>2]=0;pe[e+240>>2]=0;pe[e+244>>2]=0;f=e+248|0;de[f>>0]=0;f=e+212|0;ft(f);f=e+188|0;ft(f);f=e+164|0;ft(f);f=e+140|0;ft(f);f=e+116|0;ft(f);ve=h;return}function jt(e,t){e=e|0;t=t|0;var r=0;r=ve;ve=ve+16|0;pe[r>>2]=t;t=pe[63]|0;xr(t,e,r)|0;vr(10,t)|0;Xe()}function Ft(){var e=0,t=0;e=ve;ve=ve+16|0;if(!(Ne(200,2)|0)){t=De(pe[49]|0)|0;ve=e;return t|0}else jt(2090,e);return 0}function Bt(e){e=e|0;Ur(e);return}function zt(e){e=e|0;var t=0;t=ve;ve=ve+16|0;Rn[e&3]();jt(2139,t)}function Ut(){var e=0,t=0;e=Ft()|0;if(((e|0)!=0?(t=pe[e>>2]|0,(t|0)!=0):0)?(e=t+48|0,(pe[e>>2]&-256|0)==1126902528?(pe[e+4>>2]|0)==1129074247:0):0)zt(pe[t+12>>2]|0);t=pe[28]|0;pe[28]=t+0;zt(t)}function Xt(e){e=e|0;return}function qt(e){e=e|0;return}function Ht(e){e=e|0;return}function Yt(e){e=e|0;return}function Gt(e){e=e|0;Bt(e);return}function Wt(e){e=e|0;Bt(e);return}function Vt(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0;a=ve;ve=ve+64|0;o=a;if((e|0)!=(t|0))if((t|0)!=0?(i=$t(t,24,40,0)|0,(i|0)!=0):0){t=o;n=t+56|0;do{pe[t>>2]=0;t=t+4|0}while((t|0)<(n|0));pe[o>>2]=i;pe[o+8>>2]=e;pe[o+12>>2]=-1;pe[o+48>>2]=1;Ln[pe[(pe[i>>2]|0)+28>>2]&3](i,o,pe[r>>2]|0,1);if((pe[o+24>>2]|0)==1){pe[r>>2]=pe[o+16>>2];t=1}else t=0}else t=0;else t=1;ve=a;return t|0}function Kt(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0;e=t+16|0;i=pe[e>>2]|0;do{if(i){if((i|0)!=(r|0)){n=t+36|0;pe[n>>2]=(pe[n>>2]|0)+1;pe[t+24>>2]=2;de[t+54>>0]=1;break}e=t+24|0;if((pe[e>>2]|0)==2)pe[e>>2]=n}else{pe[e>>2]=r;pe[t+24>>2]=n;pe[t+36>>2]=1}}while(0);return}function Zt(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;if((e|0)==(pe[t+8>>2]|0))Kt(0,t,r,n);return}function Jt(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;if((e|0)==(pe[t+8>>2]|0))Kt(0,t,r,n);else{e=pe[e+8>>2]|0;Ln[pe[(pe[e>>2]|0)+28>>2]&3](e,t,r,n)}return}function $t(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0;d=ve;ve=ve+64|0;h=d;f=pe[e>>2]|0;c=e+(pe[f+-8>>2]|0)|0;f=pe[f+-4>>2]|0;pe[h>>2]=r;pe[h+4>>2]=e;pe[h+8>>2]=t;pe[h+12>>2]=n;n=h+16|0;e=h+20|0;t=h+24|0;i=h+28|0;o=h+32|0;a=h+40|0;s=(f|0)==(r|0);u=n;l=u+36|0;do{pe[u>>2]=0;u=u+4|0}while((u|0)<(l|0));Q[n+36>>1]=0;de[n+38>>0]=0;e:do{if(s){pe[h+48>>2]=1;In[pe[(pe[r>>2]|0)+20>>2]&3](r,h,c,c,1,0);n=(pe[t>>2]|0)==1?c:0}else{kn[pe[(pe[f>>2]|0)+24>>2]&3](f,h,c,1,0);switch(pe[h+36>>2]|0){case 0:{n=(pe[a>>2]|0)==1&(pe[i>>2]|0)==1&(pe[o>>2]|0)==1?pe[e>>2]|0:0;break e}case 1:break;default:{n=0;break e}}if((pe[t>>2]|0)!=1?!((pe[a>>2]|0)==0&(pe[i>>2]|0)==1&(pe[o>>2]|0)==1):0){n=0;break}n=pe[n>>2]|0}}while(0);ve=d;return n|0}function Qt(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;de[t+53>>0]=1;do{if((pe[t+4>>2]|0)==(n|0)){de[t+52>>0]=1;n=t+16|0;e=pe[n>>2]|0;if(!e){pe[n>>2]=r;pe[t+24>>2]=i;pe[t+36>>2]=1;if(!((i|0)==1?(pe[t+48>>2]|0)==1:0))break;de[t+54>>0]=1;break}if((e|0)!=(r|0)){i=t+36|0;pe[i>>2]=(pe[i>>2]|0)+1;de[t+54>>0]=1;break}e=t+24|0;n=pe[e>>2]|0;if((n|0)==2){pe[e>>2]=i;n=i}if((n|0)==1?(pe[t+48>>2]|0)==1:0)de[t+54>>0]=1}}while(0);return}function er(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0;e:do{if((e|0)==(pe[t+8>>2]|0)){if((pe[t+4>>2]|0)==(r|0)?(o=t+28|0,(pe[o>>2]|0)!=1):0)pe[o>>2]=n}else{if((e|0)!=(pe[t>>2]|0)){s=pe[e+8>>2]|0;kn[pe[(pe[s>>2]|0)+24>>2]&3](s,t,r,n,i);break}if((pe[t+16>>2]|0)!=(r|0)?(a=t+20|0,(pe[a>>2]|0)!=(r|0)):0){pe[t+32>>2]=n;n=t+44|0;if((pe[n>>2]|0)==4)break;o=t+52|0;de[o>>0]=0;u=t+53|0;de[u>>0]=0;e=pe[e+8>>2]|0;In[pe[(pe[e>>2]|0)+20>>2]&3](e,t,r,r,1,i);if(de[u>>0]|0){if(!(de[o>>0]|0)){o=1;s=13}}else{o=0;s=13}do{if((s|0)==13){pe[a>>2]=r;u=t+40|0;pe[u>>2]=(pe[u>>2]|0)+1;if((pe[t+36>>2]|0)==1?(pe[t+24>>2]|0)==2:0){de[t+54>>0]=1;if(o)break}else s=16;if((s|0)==16?o:0)break;pe[n>>2]=4;break e}}while(0);pe[n>>2]=3;break}if((n|0)==1)pe[t+32>>2]=1}}while(0);return}function tr(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0;do{if((e|0)==(pe[t+8>>2]|0)){if((pe[t+4>>2]|0)==(r|0)?(a=t+28|0,(pe[a>>2]|0)!=1):0)pe[a>>2]=n}else if((e|0)==(pe[t>>2]|0)){if((pe[t+16>>2]|0)!=(r|0)?(o=t+20|0,(pe[o>>2]|0)!=(r|0)):0){pe[t+32>>2]=n;pe[o>>2]=r;i=t+40|0;pe[i>>2]=(pe[i>>2]|0)+1;if((pe[t+36>>2]|0)==1?(pe[t+24>>2]|0)==2:0)de[t+54>>0]=1;pe[t+44>>2]=4;break}if((n|0)==1)pe[t+32>>2]=1}}while(0);return}function rr(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;if((e|0)==(pe[t+8>>2]|0))Qt(0,t,r,n,i);else{e=pe[e+8>>2]|0;In[pe[(pe[e>>2]|0)+20>>2]&3](e,t,r,n,i,o)}return}function nr(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;if((e|0)==(pe[t+8>>2]|0))Qt(0,t,r,n,i);return}function ir(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0;i=ve;ve=ve+16|0;n=i;pe[n>>2]=pe[r>>2];e=Cn[pe[(pe[e>>2]|0)+16>>2]&7](e,t,n)|0;if(e)pe[r>>2]=pe[n>>2];ve=i;return e&1|0}function or(e){e=e|0;if(!e)e=0;else e=($t(e,24,72,0)|0)!=0;return e&1|0}function ar(){var e=0,t=0,r=0,n=0,i=0,o=0,a=0,s=0;i=ve;ve=ve+48|0;a=i+32|0;r=i+24|0;s=i+16|0;o=i;i=i+36|0;e=Ft()|0;if((e|0)!=0?(n=pe[e>>2]|0,(n|0)!=0):0){e=n+48|0;t=pe[e>>2]|0;e=pe[e+4>>2]|0;if(!((t&-256|0)==1126902528&(e|0)==1129074247)){pe[r>>2]=pe[51];jt(2368,r)}if((t|0)==1126902529&(e|0)==1129074247)e=pe[n+44>>2]|0;else e=n+80|0;pe[i>>2]=e;n=pe[n>>2]|0;e=pe[n+4>>2]|0;if(Cn[pe[(pe[8>>2]|0)+16>>2]&7](8,n,i)|0){s=pe[i>>2]|0;i=pe[51]|0;s=An[pe[(pe[s>>2]|0)+8>>2]&1](s)|0;pe[o>>2]=i;pe[o+4>>2]=e;pe[o+8>>2]=s;jt(2282,o)}else{pe[s>>2]=pe[51];pe[s+4>>2]=e;jt(2327,s)}}jt(2406,a)}function sr(){var e=0;e=ve;ve=ve+16|0;if(!(je(196,6)|0)){ve=e;return}else jt(2179,e)}function ur(e){e=e|0;var t=0;t=ve;ve=ve+16|0;Ur(e);if(!(ze(pe[49]|0,0)|0)){ve=t;return}else jt(2229,t)}function lr(e){e=e|0;var t=0,r=0;t=0;while(1){if((ge[2427+t>>0]|0)==(e|0)){r=2;break}t=t+1|0;if((t|0)==87){t=87;e=2515;r=5;break}}if((r|0)==2)if(!t)e=2515;else{e=2515;r=5}if((r|0)==5)while(1){r=e;while(1){e=r+1|0;if(!(de[r>>0]|0))break;else r=e}t=t+-1|0;if(!t)break;else r=5}return e|0}function cr(){var e=0;if(!(pe[52]|0))e=264;else{e=(Le()|0)+60|0;e=pe[e>>2]|0}return e|0}function fr(e){e=e|0;var t=0;if(e>>>0>4294963200){t=cr()|0;pe[t>>2]=0-e;e=-1}return e|0}function hr(e,t){e=+e;t=t|0;var r=0,n=0,i=0;ee[te>>3]=e;r=pe[te>>2]|0;n=pe[te+4>>2]|0;i=Kr(r|0,n|0,52)|0;i=i&2047;switch(i|0){case 0:{if(e!=0.0){e=+hr(e*18446744073709552.0e3,t);r=(pe[t>>2]|0)+-64|0}else r=0;pe[t>>2]=r;break}case 2047:break;default:{pe[t>>2]=i+-1022;pe[te>>2]=r;pe[te+4>>2]=n&-2146435073|1071644672;e=+ee[te>>3]}}return+e}function dr(e,t){e=+e;t=t|0;return+ +hr(e,t)}function pr(e,t,r){e=e|0;t=t|0;r=r|0;do{if(e){if(t>>>0<128){de[e>>0]=t;e=1;break}if(t>>>0<2048){de[e>>0]=t>>>6|192;de[e+1>>0]=t&63|128;e=2;break}if(t>>>0<55296|(t&-8192|0)==57344){de[e>>0]=t>>>12|224;de[e+1>>0]=t>>>6&63|128;de[e+2>>0]=t&63|128;e=3;break}if((t+-65536|0)>>>0<1048576){de[e>>0]=t>>>18|240;de[e+1>>0]=t>>>12&63|128;de[e+2>>0]=t>>>6&63|128;de[e+3>>0]=t&63|128;e=4;break}else{e=cr()|0;pe[e>>2]=84;e=-1;break}}else e=1}while(0);return e|0}function gr(e,t){e=e|0;t=t|0;if(!e)e=0;else e=pr(e,t,0)|0;return e|0}function mr(e){e=e|0;var t=0,r=0;do{if(e){if((pe[e+76>>2]|0)<=-1){t=Ir(e)|0;break}r=(Sr(e)|0)==0;t=Ir(e)|0;if(!r)Mr(e)}else{if(!(pe[65]|0))t=0;else t=mr(pe[65]|0)|0;Ue(236);e=pe[58]|0;if(e)do{if((pe[e+76>>2]|0)>-1)r=Sr(e)|0;else r=0;if((pe[e+20>>2]|0)>>>0>(pe[e+28>>2]|0)>>>0)t=Ir(e)|0|t;if(r)Mr(e);e=pe[e+56>>2]|0}while((e|0)!=0);Fe(236)}}while(0);return t|0}function vr(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0;if((pe[t+76>>2]|0)>=0?(Sr(t)|0)!=0:0){if((de[t+75>>0]|0)!=(e|0)?(n=t+20|0,i=pe[n>>2]|0,i>>>0<(pe[t+16>>2]|0)>>>0):0){pe[n>>2]=i+1;de[i>>0]=e;r=e&255}else r=Pr(t,e)|0;Mr(t)}else a=3;do{if((a|0)==3){if((de[t+75>>0]|0)!=(e|0)?(o=t+20|0,r=pe[o>>2]|0,r>>>0<(pe[t+16>>2]|0)>>>0):0){pe[o>>2]=r+1;de[r>>0]=e;r=e&255;break}r=Pr(t,e)|0}}while(0);return r|0}function _r(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0;n=r+16|0;i=pe[n>>2]|0;if(!i)if(!(Or(r)|0)){i=pe[n>>2]|0;o=4}else n=0;else o=4;e:do{if((o|0)==4){a=r+20|0;o=pe[a>>2]|0;if((i-o|0)>>>0>>0){n=Cn[pe[r+36>>2]&7](r,e,t)|0;break}t:do{if((de[r+75>>0]|0)>-1){n=t;while(1){if(!n){i=o;n=0;break t}i=n+-1|0;if((de[e+i>>0]|0)==10)break;else n=i}if((Cn[pe[r+36>>2]&7](r,e,n)|0)>>>0>>0)break e;t=t-n|0;e=e+n|0;i=pe[a>>2]|0}else{i=o;n=0}}while(0);$r(i|0,e|0,t|0)|0;pe[a>>2]=(pe[a>>2]|0)+t;n=n+t|0}}while(0);return n|0}function yr(e,t){e=e|0;t=t|0;var r=0,n=0;r=ve;ve=ve+16|0;n=r;pe[n>>2]=t;t=xr(pe[64]|0,e,n)|0;ve=r;return t|0}function br(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0;n=ve;ve=ve+16|0;i=n;pe[i>>2]=r;r=Tr(e,t,i)|0;ve=n;return r|0}function xr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0;g=ve;ve=ve+224|0;f=g+120|0;p=g+80|0;d=g;h=g+136|0;n=p;i=n+40|0;do{pe[n>>2]=0;n=n+4|0}while((n|0)<(i|0));pe[f>>2]=pe[r>>2];if((Dr(0,t,f,d,p)|0)<0)r=-1;else{if((pe[e+76>>2]|0)>-1)l=Sr(e)|0;else l=0;r=pe[e>>2]|0;c=r&32;if((de[e+74>>0]|0)<1)pe[e>>2]=r&-33;r=e+48|0;if(!(pe[r>>2]|0)){i=e+44|0;o=pe[i>>2]|0;pe[i>>2]=h;a=e+28|0;pe[a>>2]=h;s=e+20|0;pe[s>>2]=h;pe[r>>2]=80;u=e+16|0;pe[u>>2]=h+80;n=Dr(e,t,f,d,p)|0;if(o){Cn[pe[e+36>>2]&7](e,0,0)|0;n=(pe[s>>2]|0)==0?-1:n;pe[i>>2]=o;pe[r>>2]=0;pe[u>>2]=0;pe[a>>2]=0;pe[s>>2]=0}}else n=Dr(e,t,f,d,p)|0;r=pe[e>>2]|0;pe[e>>2]=r|c;if(l)Mr(e);r=(r&32|0)==0?n:-1}ve=g;return r|0}function wr(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+128|0;i=c+112|0;l=c;o=l;a=268;s=o+112|0;do{pe[o>>2]=pe[a>>2];o=o+4|0;a=a+4|0}while((o|0)<(s|0));if((t+-1|0)>>>0>2147483646)if(!t){t=1;u=4}else{t=cr()|0;pe[t>>2]=75;t=-1}else{i=e;u=4}if((u|0)==4){u=-2-i|0;u=t>>>0>u>>>0?u:t;pe[l+48>>2]=u;e=l+20|0;pe[e>>2]=i;pe[l+44>>2]=i;t=i+u|0;i=l+16|0;pe[i>>2]=t;pe[l+28>>2]=t;t=xr(l,r,n)|0;if(u){r=pe[e>>2]|0;de[r+(((r|0)==(pe[i>>2]|0))<<31>>31)>>0]=0}}ve=c;return t|0}function Tr(e,t,r){e=e|0;t=t|0;r=r|0;return wr(e,2147483647,t,r)|0}function Sr(e){e=e|0;return 0}function Mr(e){e=e|0;return}function Pr(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0;u=ve;ve=ve+16|0;s=u;a=t&255;de[s>>0]=a;n=e+16|0;i=pe[n>>2]|0;if(!i)if(!(Or(e)|0)){i=pe[n>>2]|0;o=4}else r=-1;else o=4;do{if((o|0)==4){n=e+20|0;o=pe[n>>2]|0;if(o>>>0>>0?(r=t&255,(r|0)!=(de[e+75>>0]|0)):0){pe[n>>2]=o+1;de[o>>0]=a;break}if((Cn[pe[e+36>>2]&7](e,s,1)|0)==1)r=ge[s>>0]|0;else r=-1}}while(0);ve=u;return r|0}function Cr(e){e=e|0;var t=0,r=0;t=ve;ve=ve+16|0;r=t;pe[r>>2]=pe[e+60>>2];e=fr(Pe(6,r|0)|0)|0;ve=t;return e|0}function kr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0;i=ve;ve=ve+32|0;o=i;n=i+20|0;pe[o>>2]=pe[e+60>>2];pe[o+4>>2]=0;pe[o+8>>2]=t;pe[o+12>>2]=n;pe[o+16>>2]=r;if((fr(Ye(140,o|0)|0)|0)<0){pe[n>>2]=-1;e=-1}else e=pe[n>>2]|0;ve=i;return e|0}function Er(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;p=ve;ve=ve+48|0;f=p+16|0;c=p;n=p+32|0;h=e+28|0;i=pe[h>>2]|0;pe[n>>2]=i;d=e+20|0;i=(pe[d>>2]|0)-i|0;pe[n+4>>2]=i;pe[n+8>>2]=t;pe[n+12>>2]=r;u=e+60|0;l=e+44|0;t=2;i=i+r|0;while(1){if(!(pe[52]|0)){pe[f>>2]=pe[u>>2];pe[f+4>>2]=n;pe[f+8>>2]=t;a=fr(Ge(146,f|0)|0)|0}else{qe(7,e|0);pe[c>>2]=pe[u>>2];pe[c+4>>2]=n;pe[c+8>>2]=t;a=fr(Ge(146,c|0)|0)|0;Se(0)}if((i|0)==(a|0)){i=6;break}if((a|0)<0){i=8;break}i=i-a|0;o=pe[n+4>>2]|0;if(a>>>0<=o>>>0)if((t|0)==2){pe[h>>2]=(pe[h>>2]|0)+a;s=o;t=2}else s=o;else{s=pe[l>>2]|0;pe[h>>2]=s;pe[d>>2]=s;s=pe[n+12>>2]|0;a=a-o|0;n=n+8|0;t=t+-1|0}pe[n>>2]=(pe[n>>2]|0)+a;pe[n+4>>2]=s-a}if((i|0)==6){f=pe[l>>2]|0;pe[e+16>>2]=f+(pe[e+48>>2]|0);e=f;pe[h>>2]=e;pe[d>>2]=e}else if((i|0)==8){pe[e+16>>2]=0;pe[h>>2]=0;pe[d>>2]=0;pe[e>>2]=pe[e>>2]|32;if((t|0)==2)r=0;else r=r-(pe[n+4>>2]|0)|0}ve=p;return r|0}function Ar(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0;i=ve;ve=ve+80|0;n=i;pe[e+36>>2]=3;if((pe[e>>2]&64|0)==0?(pe[n>>2]=pe[e+60>>2],pe[n+4>>2]=21505,pe[n+8>>2]=i+12,(Me(54,n|0)|0)!=0):0)de[e+75>>0]=-1;n=Er(e,t,r)|0;ve=i;return n|0}function Or(e){e=e|0;var t=0,r=0;t=e+74|0;r=de[t>>0]|0;de[t>>0]=r+255|r;t=pe[e>>2]|0;if(!(t&8)){pe[e+8>>2]=0;pe[e+4>>2]=0;t=pe[e+44>>2]|0;pe[e+28>>2]=t;pe[e+20>>2]=t;pe[e+16>>2]=t+(pe[e+48>>2]|0);t=0}else{pe[e>>2]=t|32;t=-1}return t|0}function Rr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0;o=t&255;n=(r|0)!=0;e:do{if(n&(e&3|0)!=0){i=t&255;while(1){if((de[e>>0]|0)==i<<24>>24){a=6;break e}e=e+1|0;r=r+-1|0;n=(r|0)!=0;if(!(n&(e&3|0)!=0)){a=5;break}}}else a=5}while(0);if((a|0)==5)if(n)a=6;else r=0;e:do{if((a|0)==6){i=t&255;if((de[e>>0]|0)!=i<<24>>24){n=_e(o,16843009)|0;t:do{if(r>>>0>3)while(1){o=pe[e>>2]^n;if((o&-2139062144^-2139062144)&o+-16843009)break;e=e+4|0;r=r+-4|0;if(r>>>0<=3){a=11;break t}}else a=11}while(0);if((a|0)==11)if(!r){r=0;break}while(1){if((de[e>>0]|0)==i<<24>>24)break e;e=e+1|0;r=r+-1|0;if(!r){r=0;break}}}}}while(0);return((r|0)!=0?e:0)|0}function Ir(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0;t=e+20|0;o=e+28|0;if((pe[t>>2]|0)>>>0>(pe[o>>2]|0)>>>0?(Cn[pe[e+36>>2]&7](e,0,0)|0,(pe[t>>2]|0)==0):0)t=-1;else{a=e+4|0;r=pe[a>>2]|0;n=e+8|0;i=pe[n>>2]|0;if(r>>>0>>0)Cn[pe[e+40>>2]&7](e,r-i|0,1)|0;pe[e+16>>2]=0;pe[o>>2]=0;pe[t>>2]=0;pe[n>>2]=0;pe[a>>2]=0;t=0}return t|0}function Dr(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0.0,c=0,f=0,h=0,d=0,p=0.0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0,$=0;$=ve;ve=ve+624|0;W=$+24|0;K=$+16|0;V=$+588|0;X=$+576|0;G=$;B=$+536|0;J=$+8|0;Z=$+528|0;A=(e|0)!=0;O=B+40|0;F=O;B=B+39|0;z=J+4|0;U=X+12|0;X=X+11|0;q=V;H=U;Y=H-q|0;R=-2-q|0;I=H+2|0;D=W+288|0;L=V+9|0;N=L;j=V+8|0;o=0;g=t;a=0;t=0;e:while(1){do{if((o|0)>-1)if((a|0)>(2147483647-o|0)){o=cr()|0;pe[o>>2]=75;o=-1;break}else{o=a+o|0;break}}while(0);a=de[g>>0]|0;if(!(a<<24>>24)){E=245;break}else s=g;t:while(1){switch(a<<24>>24){case 37:{a=s;E=9;break t}case 0:{a=s;break t}default:{}}k=s+1|0;a=de[k>>0]|0;s=k}t:do{if((E|0)==9)while(1){E=0;if((de[a+1>>0]|0)!=37)break t;s=s+1|0;a=a+2|0;if((de[a>>0]|0)==37)E=9;else break}}while(0);v=s-g|0;if(A?(pe[e>>2]&32|0)==0:0)_r(g,v,e)|0;if((s|0)!=(g|0)){g=a;a=v;continue}c=a+1|0;s=de[c>>0]|0;u=(s<<24>>24)+-48|0;if(u>>>0<10){k=(de[a+2>>0]|0)==36;c=k?a+3|0:c;s=de[c>>0]|0;d=k?u:-1;t=k?1:t}else d=-1;a=s<<24>>24;t:do{if((a&-32|0)==32){u=0;while(1){if(!(1<>24)+-32|u;c=c+1|0;s=de[c>>0]|0;a=s<<24>>24;if((a&-32|0)!=32){f=u;a=c;break}}}else{f=0;a=c}}while(0);do{if(s<<24>>24==42){u=a+1|0;s=(de[u>>0]|0)+-48|0;if(s>>>0<10?(de[a+2>>0]|0)==36:0){pe[i+(s<<2)>>2]=10;t=1;a=a+3|0;s=pe[n+((de[u>>0]|0)+-48<<3)>>2]|0}else{if(t){o=-1;break e}if(!A){m=f;a=u;t=0;k=0;break}t=(pe[r>>2]|0)+(4-1)&~(4-1);s=pe[t>>2]|0;pe[r>>2]=t+4;t=0;a=u}if((s|0)<0){m=f|8192;k=0-s|0}else{m=f;k=s}}else{u=(s<<24>>24)+-48|0;if(u>>>0<10){s=0;do{s=(s*10|0)+u|0;a=a+1|0;u=(de[a>>0]|0)+-48|0}while(u>>>0<10);if((s|0)<0){o=-1;break e}else{m=f;k=s}}else{m=f;k=0}}}while(0);t:do{if((de[a>>0]|0)==46){u=a+1|0;s=de[u>>0]|0;if(s<<24>>24!=42){c=(s<<24>>24)+-48|0;if(c>>>0<10){a=u;s=0}else{a=u;c=0;break}while(1){s=(s*10|0)+c|0;a=a+1|0;c=(de[a>>0]|0)+-48|0;if(c>>>0>=10){c=s;break t}}}u=a+2|0;s=(de[u>>0]|0)+-48|0;if(s>>>0<10?(de[a+3>>0]|0)==36:0){pe[i+(s<<2)>>2]=10;a=a+4|0;c=pe[n+((de[u>>0]|0)+-48<<3)>>2]|0;break}if(t){o=-1;break e}if(A){a=(pe[r>>2]|0)+(4-1)&~(4-1);c=pe[a>>2]|0;pe[r>>2]=a+4;a=u}else{a=u;c=0}}else c=-1}while(0);h=0;while(1){s=(de[a>>0]|0)+-65|0;if(s>>>0>57){o=-1;break e}u=a+1|0;s=de[5359+(h*58|0)+s>>0]|0;f=s&255;if((f+-1|0)>>>0<8){a=u;h=f}else{C=u;break}}if(!(s<<24>>24)){o=-1;break}u=(d|0)>-1;do{if(s<<24>>24==19)if(u){o=-1;break e}else E=52;else{if(u){pe[i+(d<<2)>>2]=f;M=n+(d<<3)|0;P=pe[M+4>>2]|0;E=G;pe[E>>2]=pe[M>>2];pe[E+4>>2]=P;E=52;break}if(!A){o=0;break e}jr(G,f,r)}}while(0);if((E|0)==52?(E=0,!A):0){g=C;a=v;continue}d=de[a>>0]|0;d=(h|0)!=0&(d&15|0)==3?d&-33:d;u=m&-65537;P=(m&8192|0)==0?m:u;t:do{switch(d|0){case 110:switch(h|0){case 0:{pe[pe[G>>2]>>2]=o;g=C;a=v;continue e}case 1:{pe[pe[G>>2]>>2]=o;g=C;a=v;continue e}case 2:{g=pe[G>>2]|0;pe[g>>2]=o;pe[g+4>>2]=((o|0)<0)<<31>>31;g=C;a=v;continue e}case 3:{Q[pe[G>>2]>>1]=o;g=C;a=v;continue e}case 4:{de[pe[G>>2]>>0]=o;g=C;a=v;continue e}case 6:{pe[pe[G>>2]>>2]=o;g=C;a=v;continue e}case 7:{g=pe[G>>2]|0;pe[g>>2]=o;pe[g+4>>2]=((o|0)<0)<<31>>31;g=C;a=v;continue e}default:{g=C;a=v;continue e}}case 112:{h=P|8;c=c>>>0>8?c:8;d=120;E=64;break}case 88:case 120:{h=P;E=64;break}case 111:{u=G;s=pe[u>>2]|0;u=pe[u+4>>2]|0;if((s|0)==0&(u|0)==0)a=O;else{a=O;do{a=a+-1|0;de[a>>0]=s&7|48;s=Kr(s|0,u|0,3)|0;u=re}while(!((s|0)==0&(u|0)==0))}if(!(P&8)){s=P;h=0;f=5839;E=77}else{h=F-a+1|0;s=P;c=(c|0)<(h|0)?h:c;h=0;f=5839;E=77}break}case 105:case 100:{s=G;a=pe[s>>2]|0;s=pe[s+4>>2]|0;if((s|0)<0){a=Wr(0,0,a|0,s|0)|0;s=re;u=G;pe[u>>2]=a;pe[u+4>>2]=s;u=1;f=5839;E=76;break t}if(!(P&2048)){f=P&1;u=f;f=(f|0)==0?5839:5841;E=76}else{u=1;f=5840;E=76}break}case 117:{s=G;a=pe[s>>2]|0;s=pe[s+4>>2]|0;u=0;f=5839;E=76;break}case 99:{de[B>>0]=pe[G>>2];g=B;s=1;h=0;d=5839;a=O;break}case 109:{a=cr()|0;a=lr(pe[a>>2]|0)|0;E=82;break}case 115:{a=pe[G>>2]|0;a=(a|0)!=0?a:5849;E=82;break}case 67:{pe[J>>2]=pe[G>>2];pe[z>>2]=0;pe[G>>2]=J;c=-1;E=86;break}case 83:{if(!c){Br(e,32,k,0,P);a=0;E=98}else E=86;break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{l=+ee[G>>3];pe[K>>2]=0;ee[te>>3]=l;if((pe[te+4>>2]|0)>=0)if(!(P&2048)){M=P&1;S=M;M=(M|0)==0?5857:5862}else{S=1;M=5859}else{l=-l;S=1;M=5856}ee[te>>3]=l;T=pe[te+4>>2]&2146435072;do{if(T>>>0<2146435072|(T|0)==2146435072&0<0){p=+dr(l,K)*2.0;s=p!=0.0;if(s)pe[K>>2]=(pe[K>>2]|0)+-1;x=d|32;if((x|0)==97){g=d&32;v=(g|0)==0?M:M+9|0;m=S|2;a=12-c|0;do{if(!(c>>>0>11|(a|0)==0)){l=8.0;do{a=a+-1|0;l=l*16.0}while((a|0)!=0);if((de[v>>0]|0)==45){l=-(l+(-p-l));break}else{l=p+l-l;break}}else l=p}while(0);s=pe[K>>2]|0;a=(s|0)<0?0-s|0:s;a=Fr(a,((a|0)<0)<<31>>31,U)|0;if((a|0)==(U|0)){de[X>>0]=48;a=X}de[a+-1>>0]=(s>>31&2)+43;h=a+-2|0;de[h>>0]=d+15;f=(c|0)<1;u=(P&8|0)==0;s=V;while(1){M=~~l;a=s+1|0;de[s>>0]=ge[5823+M>>0]|g;l=(l-+(M|0))*16.0;do{if((a-q|0)==1){if(u&(f&l==0.0))break;de[a>>0]=46;a=s+2|0}}while(0);if(!(l!=0.0))break;else s=a}c=(c|0)!=0&(R+a|0)<(c|0)?I+c-h|0:Y-h+a|0;u=c+m|0;Br(e,32,k,u,P);if(!(pe[e>>2]&32))_r(v,m,e)|0;Br(e,48,k,u,P^65536);a=a-q|0;if(!(pe[e>>2]&32))_r(V,a,e)|0;s=H-h|0;Br(e,48,c-(a+s)|0,0,0);if(!(pe[e>>2]&32))_r(h,s,e)|0;Br(e,32,k,u,P^8192);a=(u|0)<(k|0)?k:u;break}a=(c|0)<0?6:c;if(s){s=(pe[K>>2]|0)+-28|0;pe[K>>2]=s;l=p*268435456.0}else{l=p;s=pe[K>>2]|0}T=(s|0)<0?W:D;w=T;s=T;do{b=~~l>>>0;pe[s>>2]=b;s=s+4|0;l=(l-+(b>>>0))*1.0e9}while(l!=0.0);u=s;s=pe[K>>2]|0;if((s|0)>0){f=T;while(1){h=(s|0)>29?29:s;c=u+-4|0;do{if(c>>>0>>0)c=f;else{s=0;do{b=Zr(pe[c>>2]|0,0,h|0)|0;b=Jr(b|0,re|0,s|0,0)|0;s=re;y=sn(b|0,s|0,1e9,0)|0;pe[c>>2]=y;s=an(b|0,s|0,1e9,0)|0;c=c+-4|0}while(c>>>0>=f>>>0);if(!s){c=f;break}c=f+-4|0;pe[c>>2]=s}}while(0);while(1){if(u>>>0<=c>>>0)break;s=u+-4|0;if(!(pe[s>>2]|0))u=s;else break}s=(pe[K>>2]|0)-h|0;pe[K>>2]=s;if((s|0)>0)f=c;else break}}else c=T;if((s|0)<0){v=((a+25|0)/9|0)+1|0;_=(x|0)==102;g=c;while(1){m=0-s|0;m=(m|0)>9?9:m;do{if(g>>>0>>0){s=(1<>>m;c=0;h=g;do{b=pe[h>>2]|0;pe[h>>2]=(b>>>m)+c;c=_e(b&s,f)|0;h=h+4|0}while(h>>>0>>0);s=(pe[g>>2]|0)==0?g+4|0:g;if(!c){c=s;break}pe[u>>2]=c;c=s;u=u+4|0}else c=(pe[g>>2]|0)==0?g+4|0:g}while(0);s=_?T:c;u=(u-s>>2|0)>(v|0)?s+(v<<2)|0:u;s=(pe[K>>2]|0)+m|0;pe[K>>2]=s;if((s|0)>=0){g=c;break}else g=c}}else g=c;do{if(g>>>0>>0){s=(w-g>>2)*9|0;f=pe[g>>2]|0;if(f>>>0<10)break;else c=10;do{c=c*10|0;s=s+1|0}while(f>>>0>=c>>>0)}else s=0}while(0);y=(x|0)==103;b=(a|0)!=0;c=a-((x|0)!=102?s:0)+((b&y)<<31>>31)|0;if((c|0)<(((u-w>>2)*9|0)+-9|0)){h=c+9216|0;_=(h|0)/9|0;c=T+(_+-1023<<2)|0;h=((h|0)%9|0)+1|0;if((h|0)<9){f=10;do{f=f*10|0;h=h+1|0}while((h|0)!=9)}else f=10;m=pe[c>>2]|0;v=(m>>>0)%(f>>>0)|0;if((v|0)==0?(T+(_+-1022<<2)|0)==(u|0):0)f=g;else E=163;do{if((E|0)==163){E=0;p=(((m>>>0)/(f>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;h=(f|0)/2|0;do{if(v>>>0>>0)l=.5;else{if((v|0)==(h|0)?(T+(_+-1022<<2)|0)==(u|0):0){l=1.0;break}l=1.5}}while(0);do{if(S){if((de[M>>0]|0)!=45)break;p=-p;l=-l}}while(0);h=m-v|0;pe[c>>2]=h;if(!(p+l!=p)){f=g;break}x=h+f|0;pe[c>>2]=x;if(x>>>0>999999999){s=g;while(1){f=c+-4|0;pe[c>>2]=0;if(f>>>0>>0){s=s+-4|0;pe[s>>2]=0}x=(pe[f>>2]|0)+1|0;pe[f>>2]=x;if(x>>>0>999999999)c=f;else{g=s;c=f;break}}}s=(w-g>>2)*9|0;h=pe[g>>2]|0;if(h>>>0<10){f=g;break}else f=10;do{f=f*10|0;s=s+1|0}while(h>>>0>=f>>>0);f=g}}while(0);x=c+4|0;g=f;u=u>>>0>x>>>0?x:u}v=0-s|0;while(1){if(u>>>0<=g>>>0){_=0;x=u;break}c=u+-4|0;if(!(pe[c>>2]|0))u=c;else{_=1;x=u;break}}do{if(y){a=(b&1^1)+a|0;if((a|0)>(s|0)&(s|0)>-5){d=d+-1|0;a=a+-1-s|0}else{d=d+-2|0;a=a+-1|0}u=P&8;if(u)break;do{if(_){u=pe[x+-4>>2]|0;if(!u){c=9;break}if(!((u>>>0)%10|0)){f=10;c=0}else{c=0;break}do{f=f*10|0;c=c+1|0}while(((u>>>0)%(f>>>0)|0|0)==0)}else c=9}while(0);u=((x-w>>2)*9|0)+-9|0;if((d|32|0)==102){u=u-c|0;u=(u|0)<0?0:u;a=(a|0)<(u|0)?a:u;u=0;break}else{u=u+s-c|0;u=(u|0)<0?0:u;a=(a|0)<(u|0)?a:u;u=0;break}}else u=P&8}while(0);m=a|u;f=(m|0)!=0&1;h=(d|32|0)==102;if(h){s=(s|0)>0?s:0;d=0}else{c=(s|0)<0?v:s;c=Fr(c,((c|0)<0)<<31>>31,U)|0;if((H-c|0)<2)do{c=c+-1|0;de[c>>0]=48}while((H-c|0)<2);de[c+-1>>0]=(s>>31&2)+43;w=c+-2|0;de[w>>0]=d;s=H-w|0;d=w}v=S+1+a+f+s|0;Br(e,32,k,v,P);if(!(pe[e>>2]&32))_r(M,S,e)|0;Br(e,48,k,v,P^65536);do{if(h){c=g>>>0>T>>>0?T:g;s=c;do{u=Fr(pe[s>>2]|0,0,L)|0;do{if((s|0)==(c|0)){if((u|0)!=(L|0))break;de[j>>0]=48;u=j}else{if(u>>>0<=V>>>0)break;do{u=u+-1|0;de[u>>0]=48}while(u>>>0>V>>>0)}}while(0);if(!(pe[e>>2]&32))_r(u,N-u|0,e)|0;s=s+4|0}while(s>>>0<=T>>>0);do{if(m){if(pe[e>>2]&32)break;_r(5891,1,e)|0}}while(0);if((a|0)>0&s>>>0>>0){u=s;while(1){s=Fr(pe[u>>2]|0,0,L)|0;if(s>>>0>V>>>0)do{s=s+-1|0;de[s>>0]=48}while(s>>>0>V>>>0);if(!(pe[e>>2]&32))_r(s,(a|0)>9?9:a,e)|0;u=u+4|0;s=a+-9|0;if(!((a|0)>9&u>>>0>>0)){a=s;break}else a=s}}Br(e,48,a+9|0,9,0)}else{h=_?x:g+4|0;if((a|0)>-1){f=(u|0)==0;c=g;do{s=Fr(pe[c>>2]|0,0,L)|0;if((s|0)==(L|0)){de[j>>0]=48;s=j}do{if((c|0)==(g|0)){u=s+1|0;if(!(pe[e>>2]&32))_r(s,1,e)|0;if(f&(a|0)<1){s=u;break}if(pe[e>>2]&32){s=u;break}_r(5891,1,e)|0;s=u}else{if(s>>>0<=V>>>0)break;do{s=s+-1|0;de[s>>0]=48}while(s>>>0>V>>>0)}}while(0);u=N-s|0;if(!(pe[e>>2]&32))_r(s,(a|0)>(u|0)?u:a,e)|0;a=a-u|0;c=c+4|0}while(c>>>0>>0&(a|0)>-1)}Br(e,48,a+18|0,18,0);if(pe[e>>2]&32)break;_r(d,H-d|0,e)|0}}while(0);Br(e,32,k,v,P^8192);a=(v|0)<(k|0)?k:v}else{h=(d&32|0)!=0;f=l!=l|0.0!=0.0;s=f?0:S;c=s+3|0;Br(e,32,k,c,u);a=pe[e>>2]|0;if(!(a&32)){_r(M,s,e)|0;a=pe[e>>2]|0}if(!(a&32))_r(f?h?5883:5887:h?5875:5879,3,e)|0;Br(e,32,k,c,P^8192);a=(c|0)<(k|0)?k:c}}while(0);g=C;continue e}default:{u=P;s=c;h=0;d=5839;a=O}}}while(0);t:do{if((E|0)==64){u=G;s=pe[u>>2]|0;u=pe[u+4>>2]|0;f=d&32;if(!((s|0)==0&(u|0)==0)){a=O;do{a=a+-1|0;de[a>>0]=ge[5823+(s&15)>>0]|f;s=Kr(s|0,u|0,4)|0;u=re}while(!((s|0)==0&(u|0)==0));E=G;if((h&8|0)==0|(pe[E>>2]|0)==0&(pe[E+4>>2]|0)==0){s=h;h=0;f=5839;E=77}else{s=h;h=2;f=5839+(d>>4)|0;E=77}}else{a=O;s=h;h=0;f=5839;E=77}}else if((E|0)==76){a=Fr(a,s,O)|0;s=P;h=u;E=77}else if((E|0)==82){E=0;P=Rr(a,0,c)|0;M=(P|0)==0;g=a;s=M?c:P-a|0;h=0;d=5839;a=M?a+c|0:P}else if((E|0)==86){E=0;s=0;a=0;f=pe[G>>2]|0;while(1){u=pe[f>>2]|0;if(!u)break;a=gr(Z,u)|0;if((a|0)<0|a>>>0>(c-s|0)>>>0)break;s=a+s|0;if(c>>>0>s>>>0)f=f+4|0;else break}if((a|0)<0){o=-1;break e}Br(e,32,k,s,P);if(!s){a=0;E=98}else{u=0;c=pe[G>>2]|0;while(1){a=pe[c>>2]|0;if(!a){a=s;E=98;break t}a=gr(Z,a)|0;u=a+u|0;if((u|0)>(s|0)){a=s;E=98;break t}if(!(pe[e>>2]&32))_r(Z,a,e)|0;if(u>>>0>=s>>>0){a=s;E=98;break}else c=c+4|0}}}}while(0);if((E|0)==98){E=0;Br(e,32,k,a,P^8192);g=C;a=(k|0)>(a|0)?k:a;continue}if((E|0)==77){E=0;u=(c|0)>-1?s&-65537:s;s=G;s=(pe[s>>2]|0)!=0|(pe[s+4>>2]|0)!=0;if((c|0)!=0|s){s=(s&1^1)+(F-a)|0;g=a;s=(c|0)>(s|0)?c:s;d=f;a=O}else{g=O;s=0;d=f;a=O}}f=a-g|0;s=(s|0)<(f|0)?f:s;c=h+s|0;a=(k|0)<(c|0)?c:k;Br(e,32,a,c,u);if(!(pe[e>>2]&32))_r(d,h,e)|0;Br(e,48,a,c,u^65536);Br(e,48,s,f,0);if(!(pe[e>>2]&32))_r(g,f,e)|0;Br(e,32,a,c,u^8192);g=C}e:do{if((E|0)==245)if(!e)if(t){o=1;while(1){t=pe[i+(o<<2)>>2]|0;if(!t)break;jr(n+(o<<3)|0,t,r);o=o+1|0;if((o|0)>=10){o=1;break e}}if((o|0)<10)while(1){if(pe[i+(o<<2)>>2]|0){o=-1;break e}o=o+1|0;if((o|0)>=10){o=1;break}}else o=1}else o=0}while(0);ve=$;return o|0}function Lr(e){e=e|0;if(!(pe[e+68>>2]|0))Mr(e);return}function Nr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0;n=e+20|0;i=pe[n>>2]|0;e=(pe[e+16>>2]|0)-i|0;e=e>>>0>r>>>0?r:e;$r(i|0,t|0,e|0)|0;pe[n>>2]=(pe[n>>2]|0)+e;return r|0}function jr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0.0;e:do{if(t>>>0<=20)do{switch(t|0){case 9:{n=(pe[r>>2]|0)+(4-1)&~(4-1);t=pe[n>>2]|0;pe[r>>2]=n+4;pe[e>>2]=t;break e}case 10:{n=(pe[r>>2]|0)+(4-1)&~(4-1);t=pe[n>>2]|0;pe[r>>2]=n+4;n=e;pe[n>>2]=t;pe[n+4>>2]=((t|0)<0)<<31>>31;break e}case 11:{n=(pe[r>>2]|0)+(4-1)&~(4-1);t=pe[n>>2]|0;pe[r>>2]=n+4;n=e;pe[n>>2]=t;pe[n+4>>2]=0;break e}case 12:{n=(pe[r>>2]|0)+(8-1)&~(8-1);t=n;i=pe[t>>2]|0;t=pe[t+4>>2]|0;pe[r>>2]=n+8;n=e;pe[n>>2]=i;pe[n+4>>2]=t;break e}case 13:{i=(pe[r>>2]|0)+(4-1)&~(4-1);n=pe[i>>2]|0;pe[r>>2]=i+4;n=(n&65535)<<16>>16;i=e;pe[i>>2]=n;pe[i+4>>2]=((n|0)<0)<<31>>31;break e}case 14:{i=(pe[r>>2]|0)+(4-1)&~(4-1);n=pe[i>>2]|0;pe[r>>2]=i+4;i=e;pe[i>>2]=n&65535;pe[i+4>>2]=0;break e}case 15:{i=(pe[r>>2]|0)+(4-1)&~(4-1);n=pe[i>>2]|0;pe[r>>2]=i+4;n=(n&255)<<24>>24;i=e;pe[i>>2]=n;pe[i+4>>2]=((n|0)<0)<<31>>31;break e}case 16:{i=(pe[r>>2]|0)+(4-1)&~(4-1);n=pe[i>>2]|0;pe[r>>2]=i+4;i=e;pe[i>>2]=n&255;pe[i+4>>2]=0;break e}case 17:{i=(pe[r>>2]|0)+(8-1)&~(8-1);o=+ee[i>>3];pe[r>>2]=i+8;ee[e>>3]=o;break e}case 18:{i=(pe[r>>2]|0)+(8-1)&~(8-1);o=+ee[i>>3];pe[r>>2]=i+8;ee[e>>3]=o;break e}default:break e}}while(0)}while(0);return}function Fr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0;if(t>>>0>0|(t|0)==0&e>>>0>4294967295)while(1){n=sn(e|0,t|0,10,0)|0;r=r+-1|0;de[r>>0]=n|48;n=an(e|0,t|0,10,0)|0;if(t>>>0>9|(t|0)==9&e>>>0>4294967295){e=n;t=re}else{e=n;break}}if(e)while(1){r=r+-1|0;de[r>>0]=(e>>>0)%10|0|48;if(e>>>0<10)break;else e=(e>>>0)/10|0}return r|0}function Br(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0;s=ve;ve=ve+256|0;a=s;do{if((r|0)>(n|0)&(i&73728|0)==0){i=r-n|0;Vr(a|0,t|0,(i>>>0>256?256:i)|0)|0;t=pe[e>>2]|0;o=(t&32|0)==0;if(i>>>0>255){n=r-n|0;do{if(o){_r(a,256,e)|0;t=pe[e>>2]|0}i=i+-256|0;o=(t&32|0)==0}while(i>>>0>255);if(o)i=n&255;else break}else if(!o)break;_r(a,i,e)|0}}while(0);ve=s;return}function zr(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0;do{if(e>>>0<245){d=e>>>0<11?16:e+11&-8;e=d>>>3;s=pe[151]|0;r=s>>>e;if(r&3){e=(r&1^1)+e|0;n=e<<1;r=644+(n<<2)|0;n=644+(n+2<<2)|0;i=pe[n>>2]|0;o=i+8|0;a=pe[o>>2]|0;do{if((r|0)!=(a|0)){if(a>>>0<(pe[155]|0)>>>0)Xe();t=a+12|0;if((pe[t>>2]|0)==(i|0)){pe[t>>2]=r;pe[n>>2]=a;break}else Xe()}else pe[151]=s&~(1<>2]=j|3;j=i+(j|4)|0;pe[j>>2]=pe[j>>2]|1;j=o;return j|0}a=pe[153]|0;if(d>>>0>a>>>0){if(r){n=2<>>12&16;n=n>>>u;i=n>>>5&8;n=n>>>i;o=n>>>2&4;n=n>>>o;r=n>>>1&2;n=n>>>r;e=n>>>1&1;e=(i|u|o|r|e)+(n>>>e)|0;n=e<<1;r=644+(n<<2)|0;n=644+(n+2<<2)|0;o=pe[n>>2]|0;u=o+8|0;i=pe[u>>2]|0;do{if((r|0)!=(i|0)){if(i>>>0<(pe[155]|0)>>>0)Xe();t=i+12|0;if((pe[t>>2]|0)==(o|0)){pe[t>>2]=r;pe[n>>2]=i;l=pe[153]|0;break}else Xe()}else{pe[151]=s&~(1<>2]=d|3;s=o+d|0;pe[o+(d|4)>>2]=a|1;pe[o+j>>2]=a;if(l){i=pe[156]|0;r=l>>>3;t=r<<1;n=644+(t<<2)|0;e=pe[151]|0;r=1<>2]|0;if(t>>>0<(pe[155]|0)>>>0)Xe();else{c=e;f=t}}else{pe[151]=e|r;c=644+(t+2<<2)|0;f=n}pe[c>>2]=i;pe[f+12>>2]=i;pe[i+8>>2]=f;pe[i+12>>2]=n}pe[153]=a;pe[156]=s;j=u;return j|0}e=pe[152]|0;if(e){r=(e&0-e)+-1|0;N=r>>>12&16;r=r>>>N;L=r>>>5&8;r=r>>>L;j=r>>>2&4;r=r>>>j;e=r>>>1&2;r=r>>>e;n=r>>>1&1;n=pe[908+((L|N|j|e|n)+(r>>>n)<<2)>>2]|0;r=(pe[n+4>>2]&-8)-d|0;e=n;while(1){t=pe[e+16>>2]|0;if(!t){t=pe[e+20>>2]|0;if(!t){u=r;break}}e=(pe[t+4>>2]&-8)-d|0;j=e>>>0>>0;r=j?e:r;e=t;n=j?t:n}o=pe[155]|0;if(n>>>0>>0)Xe();s=n+d|0;if(n>>>0>=s>>>0)Xe();a=pe[n+24>>2]|0;r=pe[n+12>>2]|0;do{if((r|0)==(n|0)){e=n+20|0;t=pe[e>>2]|0;if(!t){e=n+16|0;t=pe[e>>2]|0;if(!t){h=0;break}}while(1){r=t+20|0;i=pe[r>>2]|0;if(i){t=i;e=r;continue}r=t+16|0;i=pe[r>>2]|0;if(!i)break;else{t=i;e=r}}if(e>>>0>>0)Xe();else{pe[e>>2]=0;h=t;break}}else{i=pe[n+8>>2]|0;if(i>>>0>>0)Xe();t=i+12|0;if((pe[t>>2]|0)!=(n|0))Xe();e=r+8|0;if((pe[e>>2]|0)==(n|0)){pe[t>>2]=r;pe[e>>2]=i;h=r;break}else Xe()}}while(0);do{if(a){t=pe[n+28>>2]|0;e=908+(t<<2)|0;if((n|0)==(pe[e>>2]|0)){pe[e>>2]=h;if(!h){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=a+16|0;if((pe[t>>2]|0)==(n|0))pe[t>>2]=h;else pe[a+20>>2]=h;if(!h)break}e=pe[155]|0;if(h>>>0>>0)Xe();pe[h+24>>2]=a;t=pe[n+16>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{pe[h+16>>2]=t;pe[t+24>>2]=h;break}}while(0);t=pe[n+20>>2]|0;if(t)if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[h+20>>2]=t;pe[t+24>>2]=h;break}}}while(0);if(u>>>0<16){j=u+d|0;pe[n+4>>2]=j|3;j=n+(j+4)|0;pe[j>>2]=pe[j>>2]|1}else{pe[n+4>>2]=d|3;pe[n+(d|4)>>2]=u|1;pe[n+(u+d)>>2]=u;t=pe[153]|0;if(t){o=pe[156]|0;r=t>>>3;t=r<<1;i=644+(t<<2)|0;e=pe[151]|0;r=1<>2]|0;if(e>>>0<(pe[155]|0)>>>0)Xe();else{p=t;g=e}}else{pe[151]=e|r;p=644+(t+2<<2)|0;g=i}pe[p>>2]=o;pe[g+12>>2]=o;pe[o+8>>2]=g;pe[o+12>>2]=i}pe[153]=u;pe[156]=s}j=n+8|0;return j|0}else g=d}else g=d}else if(e>>>0<=4294967231){e=e+11|0;f=e&-8;c=pe[152]|0;if(c){r=0-f|0;e=e>>>8;if(e)if(f>>>0>16777215)l=31;else{g=(e+1048320|0)>>>16&8;b=e<>>16&4;b=b<>>16&2;l=14-(p|g|l)+(b<>>15)|0;l=f>>>(l+7|0)&1|l<<1}else l=0;e=pe[908+(l<<2)>>2]|0;e:do{if(!e){i=0;e=0;b=86}else{a=r;i=0;s=f<<((l|0)==31?0:25-(l>>>1)|0);u=e;e=0;while(1){o=pe[u+4>>2]&-8;r=o-f|0;if(r>>>0>>0)if((o|0)==(f|0)){o=u;e=u;b=90;break e}else e=u;else r=a;b=pe[u+20>>2]|0;u=pe[u+16+(s>>>31<<2)>>2]|0;i=(b|0)==0|(b|0)==(u|0)?i:b;if(!u){b=86;break}else{a=r;s=s<<1}}}}while(0);if((b|0)==86){if((i|0)==0&(e|0)==0){e=2<>>12&16;e=e>>>h;c=e>>>5&8;e=e>>>c;p=e>>>2&4;e=e>>>p;g=e>>>1&2;e=e>>>g;i=e>>>1&1;i=pe[908+((c|h|p|g|i)+(e>>>i)<<2)>>2]|0;e=0}if(!i){s=r;u=e}else{o=i;b=90}}if((b|0)==90)while(1){b=0;g=(pe[o+4>>2]&-8)-f|0;i=g>>>0>>0;r=i?g:r;e=i?o:e;i=pe[o+16>>2]|0;if(i){o=i;b=90;continue}o=pe[o+20>>2]|0;if(!o){s=r;u=e;break}else b=90}if((u|0)!=0?s>>>0<((pe[153]|0)-f|0)>>>0:0){i=pe[155]|0;if(u>>>0>>0)Xe();a=u+f|0;if(u>>>0>=a>>>0)Xe();o=pe[u+24>>2]|0;r=pe[u+12>>2]|0;do{if((r|0)==(u|0)){e=u+20|0;t=pe[e>>2]|0;if(!t){e=u+16|0;t=pe[e>>2]|0;if(!t){d=0;break}}while(1){r=t+20|0;n=pe[r>>2]|0;if(n){t=n;e=r;continue}r=t+16|0;n=pe[r>>2]|0;if(!n)break;else{t=n;e=r}}if(e>>>0>>0)Xe();else{pe[e>>2]=0;d=t;break}}else{n=pe[u+8>>2]|0;if(n>>>0>>0)Xe();t=n+12|0;if((pe[t>>2]|0)!=(u|0))Xe();e=r+8|0;if((pe[e>>2]|0)==(u|0)){pe[t>>2]=r;pe[e>>2]=n;d=r;break}else Xe()}}while(0);do{if(o){t=pe[u+28>>2]|0;e=908+(t<<2)|0;if((u|0)==(pe[e>>2]|0)){pe[e>>2]=d;if(!d){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=o+16|0;if((pe[t>>2]|0)==(u|0))pe[t>>2]=d;else pe[o+20>>2]=d;if(!d)break}e=pe[155]|0;if(d>>>0>>0)Xe();pe[d+24>>2]=o;t=pe[u+16>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{pe[d+16>>2]=t;pe[t+24>>2]=d;break}}while(0);t=pe[u+20>>2]|0;if(t)if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[d+20>>2]=t;pe[t+24>>2]=d;break}}}while(0);e:do{if(s>>>0>=16){pe[u+4>>2]=f|3;pe[u+(f|4)>>2]=s|1;pe[u+(s+f)>>2]=s;t=s>>>3;if(s>>>0<256){e=t<<1;n=644+(e<<2)|0;r=pe[151]|0;t=1<>2]|0;if(e>>>0<(pe[155]|0)>>>0)Xe();else{v=t;_=e}}else{pe[151]=r|t;v=644+(e+2<<2)|0;_=n}pe[v>>2]=a;pe[_+12>>2]=a;pe[u+(f+8)>>2]=_;pe[u+(f+12)>>2]=n;break}t=s>>>8;if(t)if(s>>>0>16777215)n=31;else{N=(t+1048320|0)>>>16&8;j=t<>>16&4;j=j<>>16&2;n=14-(L|N|n)+(j<>>15)|0;n=s>>>(n+7|0)&1|n<<1}else n=0;t=908+(n<<2)|0;pe[u+(f+28)>>2]=n;pe[u+(f+20)>>2]=0;pe[u+(f+16)>>2]=0;e=pe[152]|0;r=1<>2]=a;pe[u+(f+24)>>2]=t;pe[u+(f+12)>>2]=a;pe[u+(f+8)>>2]=a;break}t=pe[t>>2]|0;t:do{if((pe[t+4>>2]&-8|0)!=(s|0)){n=s<<((n|0)==31?0:25-(n>>>1)|0);while(1){e=t+16+(n>>>31<<2)|0;r=pe[e>>2]|0;if(!r)break;if((pe[r+4>>2]&-8|0)==(s|0)){T=r;break t}else{n=n<<1;t=r}}if(e>>>0<(pe[155]|0)>>>0)Xe();else{pe[e>>2]=a;pe[u+(f+24)>>2]=t;pe[u+(f+12)>>2]=a;pe[u+(f+8)>>2]=a;break e}}else T=t}while(0);t=T+8|0;e=pe[t>>2]|0;j=pe[155]|0;if(e>>>0>=j>>>0&T>>>0>=j>>>0){pe[e+12>>2]=a;pe[t>>2]=a;pe[u+(f+8)>>2]=e;pe[u+(f+12)>>2]=T;pe[u+(f+24)>>2]=0;break}else Xe()}else{j=s+f|0;pe[u+4>>2]=j|3;j=u+(j+4)|0;pe[j>>2]=pe[j>>2]|1}}while(0);j=u+8|0;return j|0}else g=f}else g=f}else g=-1}while(0);r=pe[153]|0;if(r>>>0>=g>>>0){t=r-g|0;e=pe[156]|0;if(t>>>0>15){pe[156]=e+g;pe[153]=t;pe[e+(g+4)>>2]=t|1;pe[e+r>>2]=t;pe[e+4>>2]=g|3}else{pe[153]=0;pe[156]=0;pe[e+4>>2]=r|3;j=e+(r+4)|0;pe[j>>2]=pe[j>>2]|1}j=e+8|0;return j|0}e=pe[154]|0;if(e>>>0>g>>>0){N=e-g|0;pe[154]=N;j=pe[157]|0;pe[157]=j+g;pe[j+(g+4)>>2]=N|1;pe[j+4>>2]=g|3;j=j+8|0;return j|0}do{if(!(pe[269]|0)){e=Ie(30)|0;if(!(e+-1&e)){pe[271]=e;pe[270]=e;pe[272]=-1;pe[273]=-1;pe[274]=0;pe[262]=0;T=(He(0)|0)&-16^1431655768;pe[269]=T;break}else Xe()}}while(0);u=g+48|0;s=pe[271]|0;l=g+47|0;a=s+l|0;s=0-s|0;c=a&s;if(c>>>0<=g>>>0){j=0;return j|0}e=pe[261]|0;if((e|0)!=0?(_=pe[259]|0,T=_+c|0,T>>>0<=_>>>0|T>>>0>e>>>0):0){j=0;return j|0}e:do{if(!(pe[262]&4)){e=pe[157]|0;t:do{if(e){i=1052;while(1){r=pe[i>>2]|0;if(r>>>0<=e>>>0?(m=i+4|0,(r+(pe[m>>2]|0)|0)>>>0>e>>>0):0){o=i;e=m;break}i=pe[i+8>>2]|0;if(!i){b=174;break t}}r=a-(pe[154]|0)&s;if(r>>>0<2147483647){i=Ae(r|0)|0;T=(i|0)==((pe[o>>2]|0)+(pe[e>>2]|0)|0);e=T?r:0;if(T){if((i|0)!=(-1|0)){x=i;p=e;b=194;break e}}else b=184}else e=0}else b=174}while(0);do{if((b|0)==174){o=Ae(0)|0;if((o|0)!=(-1|0)){e=o;r=pe[270]|0;i=r+-1|0;if(!(i&e))r=c;else r=c-e+(i+e&0-r)|0;e=pe[259]|0;i=e+r|0;if(r>>>0>g>>>0&r>>>0<2147483647){T=pe[261]|0;if((T|0)!=0?i>>>0<=e>>>0|i>>>0>T>>>0:0){e=0;break}i=Ae(r|0)|0;T=(i|0)==(o|0);e=T?r:0;if(T){x=o;p=e;b=194;break e}else b=184}else e=0}else e=0}}while(0);t:do{if((b|0)==184){o=0-r|0;do{if(u>>>0>r>>>0&(r>>>0<2147483647&(i|0)!=(-1|0))?(y=pe[271]|0,y=l-r+y&0-y,y>>>0<2147483647):0)if((Ae(y|0)|0)==(-1|0)){Ae(o|0)|0;break t}else{r=y+r|0;break}}while(0);if((i|0)!=(-1|0)){x=i;p=r;b=194;break e}}}while(0);pe[262]=pe[262]|4;b=191}else{e=0;b=191}}while(0);if((((b|0)==191?c>>>0<2147483647:0)?(x=Ae(c|0)|0,w=Ae(0)|0,x>>>0>>0&((x|0)!=(-1|0)&(w|0)!=(-1|0))):0)?(S=w-x|0,M=S>>>0>(g+40|0)>>>0,M):0){p=M?S:e;b=194}if((b|0)==194){e=(pe[259]|0)+p|0;pe[259]=e;if(e>>>0>(pe[260]|0)>>>0)pe[260]=e;a=pe[157]|0;e:do{if(a){o=1052;do{e=pe[o>>2]|0;r=o+4|0;i=pe[r>>2]|0;if((x|0)==(e+i|0)){P=e;C=r;k=i;E=o;b=204;break}o=pe[o+8>>2]|0}while((o|0)!=0);if(((b|0)==204?(pe[E+12>>2]&8|0)==0:0)?a>>>0>>0&a>>>0>=P>>>0:0){pe[C>>2]=k+p;j=(pe[154]|0)+p|0;N=a+8|0;N=(N&7|0)==0?0:0-N&7;L=j-N|0;pe[157]=a+N;pe[154]=L;pe[a+(N+4)>>2]=L|1;pe[a+(j+4)>>2]=40;pe[158]=pe[273];break}e=pe[155]|0;if(x>>>0>>0){pe[155]=x;e=x}r=x+p|0;o=1052;while(1){if((pe[o>>2]|0)==(r|0)){i=o;r=o;b=212;break}o=pe[o+8>>2]|0;if(!o){r=1052;break}}if((b|0)==212)if(!(pe[r+12>>2]&8)){pe[i>>2]=x;h=r+4|0;pe[h>>2]=(pe[h>>2]|0)+p;h=x+8|0;h=(h&7|0)==0?0:0-h&7;l=x+(p+8)|0;l=(l&7|0)==0?0:0-l&7;t=x+(l+p)|0;f=h+g|0;d=x+f|0;c=t-(x+h)-g|0;pe[x+(h+4)>>2]=g|3;t:do{if((t|0)!=(a|0)){if((t|0)==(pe[156]|0)){j=(pe[153]|0)+c|0;pe[153]=j;pe[156]=d;pe[x+(f+4)>>2]=j|1;pe[x+(j+f)>>2]=j;break}s=p+4|0;r=pe[x+(s+l)>>2]|0;if((r&3|0)==1){u=r&-8;o=r>>>3;r:do{if(r>>>0>=256){a=pe[x+((l|24)+p)>>2]|0;n=pe[x+(p+12+l)>>2]|0;do{if((n|0)==(t|0)){i=l|16;n=x+(s+i)|0;r=pe[n>>2]|0;if(!r){n=x+(i+p)|0;r=pe[n>>2]|0;if(!r){D=0;break}}while(1){i=r+20|0;o=pe[i>>2]|0;if(o){r=o;n=i;continue}i=r+16|0;o=pe[i>>2]|0;if(!o)break;else{r=o;n=i}}if(n>>>0>>0)Xe();else{pe[n>>2]=0;D=r;break}}else{i=pe[x+((l|8)+p)>>2]|0;if(i>>>0>>0)Xe();e=i+12|0;if((pe[e>>2]|0)!=(t|0))Xe();r=n+8|0;if((pe[r>>2]|0)==(t|0)){pe[e>>2]=n;pe[r>>2]=i;D=n;break}else Xe()}}while(0);if(!a)break;e=pe[x+(p+28+l)>>2]|0;r=908+(e<<2)|0;do{if((t|0)!=(pe[r>>2]|0)){if(a>>>0<(pe[155]|0)>>>0)Xe();e=a+16|0;if((pe[e>>2]|0)==(t|0))pe[e>>2]=D;else pe[a+20>>2]=D;if(!D)break r}else{pe[r>>2]=D;if(D)break;pe[152]=pe[152]&~(1<>>0>>0)Xe();pe[D+24>>2]=a;t=l|16;e=pe[x+(t+p)>>2]|0;do{if(e)if(e>>>0>>0)Xe();else{pe[D+16>>2]=e;pe[e+24>>2]=D;break}}while(0);t=pe[x+(s+t)>>2]|0;if(!t)break;if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[D+20>>2]=t;pe[t+24>>2]=D;break}}else{n=pe[x+((l|8)+p)>>2]|0;i=pe[x+(p+12+l)>>2]|0;r=644+(o<<1<<2)|0;do{if((n|0)!=(r|0)){if(n>>>0>>0)Xe();if((pe[n+12>>2]|0)==(t|0))break;Xe()}}while(0);if((i|0)==(n|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();e=i+8|0;if((pe[e>>2]|0)==(t|0)){A=e;break}Xe()}}while(0);pe[n+12>>2]=i;pe[A>>2]=n}}while(0);t=x+((u|l)+p)|0;i=u+c|0}else i=c;t=t+4|0;pe[t>>2]=pe[t>>2]&-2;pe[x+(f+4)>>2]=i|1;pe[x+(i+f)>>2]=i;t=i>>>3;if(i>>>0<256){e=t<<1;n=644+(e<<2)|0;r=pe[151]|0;t=1<>2]|0;if(e>>>0>=(pe[155]|0)>>>0){L=t;N=e;break}Xe()}}while(0);pe[L>>2]=d;pe[N+12>>2]=d;pe[x+(f+8)>>2]=N;pe[x+(f+12)>>2]=n;break}t=i>>>8;do{if(!t)n=0;else{if(i>>>0>16777215){n=31;break}L=(t+1048320|0)>>>16&8;N=t<>>16&4;N=N<>>16&2;n=14-(D|L|n)+(N<>>15)|0;n=i>>>(n+7|0)&1|n<<1}}while(0);t=908+(n<<2)|0;pe[x+(f+28)>>2]=n;pe[x+(f+20)>>2]=0;pe[x+(f+16)>>2]=0;e=pe[152]|0;r=1<>2]=d;pe[x+(f+24)>>2]=t;pe[x+(f+12)>>2]=d;pe[x+(f+8)>>2]=d;break}t=pe[t>>2]|0;r:do{if((pe[t+4>>2]&-8|0)!=(i|0)){n=i<<((n|0)==31?0:25-(n>>>1)|0);while(1){e=t+16+(n>>>31<<2)|0;r=pe[e>>2]|0;if(!r)break;if((pe[r+4>>2]&-8|0)==(i|0)){j=r;break r}else{n=n<<1;t=r}}if(e>>>0<(pe[155]|0)>>>0)Xe();else{pe[e>>2]=d;pe[x+(f+24)>>2]=t;pe[x+(f+12)>>2]=d;pe[x+(f+8)>>2]=d;break t}}else j=t}while(0);t=j+8|0;e=pe[t>>2]|0;N=pe[155]|0;if(e>>>0>=N>>>0&j>>>0>=N>>>0){pe[e+12>>2]=d;pe[t>>2]=d;pe[x+(f+8)>>2]=e;pe[x+(f+12)>>2]=j;pe[x+(f+24)>>2]=0;break}else Xe()}else{j=(pe[154]|0)+c|0;pe[154]=j;pe[157]=d;pe[x+(f+4)>>2]=j|1}}while(0);j=x+(h|8)|0;return j|0}else r=1052;while(1){e=pe[r>>2]|0;if(e>>>0<=a>>>0?(t=pe[r+4>>2]|0,n=e+t|0,n>>>0>a>>>0):0)break;r=pe[r+8>>2]|0}i=e+(t+-39)|0;e=e+(t+-47+((i&7|0)==0?0:0-i&7))|0;i=a+16|0;e=e>>>0>>0?a:e;t=e+8|0;r=x+8|0;r=(r&7|0)==0?0:0-r&7;j=p+-40-r|0;pe[157]=x+r;pe[154]=j;pe[x+(r+4)>>2]=j|1;pe[x+(p+-36)>>2]=40;pe[158]=pe[273];r=e+4|0;pe[r>>2]=27;pe[t>>2]=pe[263];pe[t+4>>2]=pe[264];pe[t+8>>2]=pe[265];pe[t+12>>2]=pe[266];pe[263]=x;pe[264]=p;pe[266]=0;pe[265]=t;t=e+28|0;pe[t>>2]=7;if((e+32|0)>>>0>>0)do{j=t;t=t+4|0;pe[t>>2]=7}while((j+8|0)>>>0>>0);if((e|0)!=(a|0)){o=e-a|0;pe[r>>2]=pe[r>>2]&-2;pe[a+4>>2]=o|1;pe[e>>2]=o;t=o>>>3;if(o>>>0<256){e=t<<1;n=644+(e<<2)|0;r=pe[151]|0;t=1<>2]|0;if(e>>>0<(pe[155]|0)>>>0)Xe();else{O=t;R=e}}else{pe[151]=r|t;O=644+(e+2<<2)|0;R=n}pe[O>>2]=a;pe[R+12>>2]=a;pe[a+8>>2]=R;pe[a+12>>2]=n;break}t=o>>>8;if(t)if(o>>>0>16777215)n=31;else{N=(t+1048320|0)>>>16&8;j=t<>>16&4;j=j<>>16&2;n=14-(L|N|n)+(j<>>15)|0;n=o>>>(n+7|0)&1|n<<1}else n=0;r=908+(n<<2)|0;pe[a+28>>2]=n;pe[a+20>>2]=0;pe[i>>2]=0;t=pe[152]|0;e=1<>2]=a;pe[a+24>>2]=r;pe[a+12>>2]=a;pe[a+8>>2]=a;break}t=pe[r>>2]|0;t:do{if((pe[t+4>>2]&-8|0)!=(o|0)){n=o<<((n|0)==31?0:25-(n>>>1)|0);while(1){e=t+16+(n>>>31<<2)|0;r=pe[e>>2]|0;if(!r)break;if((pe[r+4>>2]&-8|0)==(o|0)){I=r;break t}else{n=n<<1;t=r}}if(e>>>0<(pe[155]|0)>>>0)Xe();else{pe[e>>2]=a;pe[a+24>>2]=t;pe[a+12>>2]=a;pe[a+8>>2]=a;break e}}else I=t}while(0);t=I+8|0;e=pe[t>>2]|0;j=pe[155]|0;if(e>>>0>=j>>>0&I>>>0>=j>>>0){pe[e+12>>2]=a;pe[t>>2]=a;pe[a+8>>2]=e;pe[a+12>>2]=I;pe[a+24>>2]=0;break}else Xe()}}else{j=pe[155]|0;if((j|0)==0|x>>>0>>0)pe[155]=x;pe[263]=x;pe[264]=p;pe[266]=0;pe[160]=pe[269];pe[159]=-1;t=0;do{j=t<<1;N=644+(j<<2)|0;pe[644+(j+3<<2)>>2]=N;pe[644+(j+2<<2)>>2]=N;t=t+1|0}while((t|0)!=32);j=x+8|0;j=(j&7|0)==0?0:0-j&7;N=p+-40-j|0;pe[157]=x+j;pe[154]=N;pe[x+(j+4)>>2]=N|1;pe[x+(p+-36)>>2]=40;pe[158]=pe[273]}}while(0);t=pe[154]|0;if(t>>>0>g>>>0){N=t-g|0;pe[154]=N;j=pe[157]|0;pe[157]=j+g;pe[j+(g+4)>>2]=N|1;pe[j+4>>2]=g|3;j=j+8|0;return j|0}}j=cr()|0;pe[j>>2]=12;j=0;return j|0}function Ur(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0;if(!e)return;t=e+-8|0;s=pe[155]|0;if(t>>>0>>0)Xe();r=pe[e+-4>>2]|0;n=r&3;if((n|0)==1)Xe();d=r&-8;g=e+(d+-8)|0;do{if(!(r&1)){t=pe[t>>2]|0;if(!n)return;u=-8-t|0;c=e+u|0;f=t+d|0;if(c>>>0>>0)Xe();if((c|0)==(pe[156]|0)){t=e+(d+-4)|0;r=pe[t>>2]|0;if((r&3|0)!=3){y=c;o=f;break}pe[153]=f;pe[t>>2]=r&-2;pe[e+(u+4)>>2]=f|1;pe[g>>2]=f;return}i=t>>>3;if(t>>>0<256){n=pe[e+(u+8)>>2]|0;r=pe[e+(u+12)>>2]|0;t=644+(i<<1<<2)|0;if((n|0)!=(t|0)){if(n>>>0>>0)Xe();if((pe[n+12>>2]|0)!=(c|0))Xe()}if((r|0)==(n|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();t=r+8|0;if((pe[t>>2]|0)==(c|0))a=t;else Xe()}else a=r+8|0;pe[n+12>>2]=r;pe[a>>2]=n;y=c;o=f;break}a=pe[e+(u+24)>>2]|0;n=pe[e+(u+12)>>2]|0;do{if((n|0)==(c|0)){r=e+(u+20)|0;t=pe[r>>2]|0;if(!t){r=e+(u+16)|0;t=pe[r>>2]|0;if(!t){l=0;break}}while(1){n=t+20|0;i=pe[n>>2]|0;if(i){t=i;r=n;continue}n=t+16|0;i=pe[n>>2]|0;if(!i)break;else{t=i;r=n}}if(r>>>0>>0)Xe();else{pe[r>>2]=0;l=t;break}}else{i=pe[e+(u+8)>>2]|0;if(i>>>0>>0)Xe();t=i+12|0;if((pe[t>>2]|0)!=(c|0))Xe();r=n+8|0;if((pe[r>>2]|0)==(c|0)){pe[t>>2]=n;pe[r>>2]=i;l=n;break}else Xe()}}while(0);if(a){t=pe[e+(u+28)>>2]|0;r=908+(t<<2)|0;if((c|0)==(pe[r>>2]|0)){pe[r>>2]=l;if(!l){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=a+16|0;if((pe[t>>2]|0)==(c|0))pe[t>>2]=l;else pe[a+20>>2]=l;if(!l){y=c;o=f;break}}r=pe[155]|0;if(l>>>0>>0)Xe();pe[l+24>>2]=a;t=pe[e+(u+16)>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{pe[l+16>>2]=t;pe[t+24>>2]=l;break}}while(0);t=pe[e+(u+20)>>2]|0;if(t)if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[l+20>>2]=t;pe[t+24>>2]=l;y=c;o=f;break}else{y=c;o=f}}else{y=c;o=f}}else{y=t;o=d}}while(0);if(y>>>0>=g>>>0)Xe();t=e+(d+-4)|0;r=pe[t>>2]|0;if(!(r&1))Xe();if(!(r&2)){if((g|0)==(pe[157]|0)){_=(pe[154]|0)+o|0;pe[154]=_;pe[157]=y;pe[y+4>>2]=_|1;if((y|0)!=(pe[156]|0))return;pe[156]=0;pe[153]=0;return}if((g|0)==(pe[156]|0)){_=(pe[153]|0)+o|0;pe[153]=_;pe[156]=y;pe[y+4>>2]=_|1;pe[y+_>>2]=_;return}o=(r&-8)+o|0;i=r>>>3;do{if(r>>>0>=256){a=pe[e+(d+16)>>2]|0;t=pe[e+(d|4)>>2]|0;do{if((t|0)==(g|0)){r=e+(d+12)|0;t=pe[r>>2]|0;if(!t){r=e+(d+8)|0;t=pe[r>>2]|0;if(!t){p=0;break}}while(1){n=t+20|0;i=pe[n>>2]|0;if(i){t=i;r=n;continue}n=t+16|0;i=pe[n>>2]|0;if(!i)break;else{t=i;r=n}}if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[r>>2]=0;p=t;break}}else{r=pe[e+d>>2]|0;if(r>>>0<(pe[155]|0)>>>0)Xe();n=r+12|0;if((pe[n>>2]|0)!=(g|0))Xe();i=t+8|0;if((pe[i>>2]|0)==(g|0)){pe[n>>2]=t;pe[i>>2]=r;p=t;break}else Xe()}}while(0);if(a){t=pe[e+(d+20)>>2]|0;r=908+(t<<2)|0;if((g|0)==(pe[r>>2]|0)){pe[r>>2]=p;if(!p){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=a+16|0;if((pe[t>>2]|0)==(g|0))pe[t>>2]=p;else pe[a+20>>2]=p;if(!p)break}r=pe[155]|0;if(p>>>0>>0)Xe();pe[p+24>>2]=a;t=pe[e+(d+8)>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{pe[p+16>>2]=t;pe[t+24>>2]=p;break}}while(0);t=pe[e+(d+12)>>2]|0;if(t)if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[p+20>>2]=t;pe[t+24>>2]=p;break}}}else{n=pe[e+d>>2]|0;r=pe[e+(d|4)>>2]|0;t=644+(i<<1<<2)|0;if((n|0)!=(t|0)){if(n>>>0<(pe[155]|0)>>>0)Xe();if((pe[n+12>>2]|0)!=(g|0))Xe()}if((r|0)==(n|0)){pe[151]=pe[151]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=r+8|0;if((pe[t>>2]|0)==(g|0))h=t;else Xe()}else h=r+8|0;pe[n+12>>2]=r;pe[h>>2]=n}}while(0);pe[y+4>>2]=o|1;pe[y+o>>2]=o;if((y|0)==(pe[156]|0)){pe[153]=o;return}}else{pe[t>>2]=r&-2;pe[y+4>>2]=o|1;pe[y+o>>2]=o}t=o>>>3;if(o>>>0<256){r=t<<1;i=644+(r<<2)|0;n=pe[151]|0;t=1<>2]|0;if(r>>>0<(pe[155]|0)>>>0)Xe();else{m=t;v=r}}else{pe[151]=n|t;m=644+(r+2<<2)|0;v=i}pe[m>>2]=y;pe[v+12>>2]=y;pe[y+8>>2]=v;pe[y+12>>2]=i;return}t=o>>>8;if(t)if(o>>>0>16777215)i=31;else{m=(t+1048320|0)>>>16&8;v=t<>>16&4;v=v<>>16&2;i=14-(g|m|i)+(v<>>15)|0;i=o>>>(i+7|0)&1|i<<1}else i=0;t=908+(i<<2)|0;pe[y+28>>2]=i;pe[y+20>>2]=0;pe[y+16>>2]=0;r=pe[152]|0;n=1<>2]|0;t:do{if((pe[t+4>>2]&-8|0)!=(o|0)){i=o<<((i|0)==31?0:25-(i>>>1)|0);while(1){r=t+16+(i>>>31<<2)|0;n=pe[r>>2]|0;if(!n)break;if((pe[n+4>>2]&-8|0)==(o|0)){_=n;break t}else{i=i<<1;t=n}}if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[r>>2]=y;pe[y+24>>2]=t;pe[y+12>>2]=y;pe[y+8>>2]=y;break e}}else _=t}while(0);t=_+8|0;r=pe[t>>2]|0;v=pe[155]|0;if(r>>>0>=v>>>0&_>>>0>=v>>>0){pe[r+12>>2]=y;pe[t>>2]=y;pe[y+8>>2]=r;pe[y+12>>2]=_;pe[y+24>>2]=0;break}else Xe()}else{pe[152]=r|n;pe[t>>2]=y;pe[y+24>>2]=t;pe[y+12>>2]=y;pe[y+8>>2]=y}}while(0);y=(pe[159]|0)+-1|0;pe[159]=y;if(!y)t=1060;else return;while(1){t=pe[t>>2]|0;if(!t)break;else t=t+8|0}pe[159]=-1;return}function Xr(e,t){e=e|0;t=t|0;var r=0,n=0;if(!e){e=zr(t)|0;return e|0}if(t>>>0>4294967231){e=cr()|0;pe[e>>2]=12;e=0;return e|0}r=Hr(e+-8|0,t>>>0<11?16:t+11&-8)|0;if(r){e=r+8|0;return e|0}r=zr(t)|0;if(!r){e=0;return e|0}n=pe[e+-4>>2]|0;n=(n&-8)-((n&3|0)==0?8:4)|0;$r(r|0,e|0,(n>>>0>>0?n:t)|0)|0;Ur(e);e=r;return e|0}function qr(e){e=e|0;var t=0;if(!e){t=0;return t|0}e=pe[e+-4>>2]|0;t=e&3;if((t|0)==1){t=0;return t|0}t=(e&-8)-((t|0)==0?8:4)|0;return t|0}function Hr(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;d=e+4|0;p=pe[d>>2]|0;u=p&-8;c=e+u|0;s=pe[155]|0;r=p&3;if(!((r|0)!=1&e>>>0>=s>>>0&e>>>0>>0))Xe();n=e+(u|4)|0;i=pe[n>>2]|0;if(!(i&1))Xe();if(!r){if(t>>>0<256){e=0;return e|0}if(u>>>0>=(t+4|0)>>>0?(u-t|0)>>>0<=pe[271]<<1>>>0:0)return e|0;e=0;return e|0}if(u>>>0>=t>>>0){r=u-t|0;if(r>>>0<=15)return e|0;pe[d>>2]=p&1|t|2;pe[e+(t+4)>>2]=r|3;pe[n>>2]=pe[n>>2]|1;Yr(e+t|0,r);return e|0}if((c|0)==(pe[157]|0)){r=(pe[154]|0)+u|0;if(r>>>0<=t>>>0){e=0;return e|0}h=r-t|0;pe[d>>2]=p&1|t|2;pe[e+(t+4)>>2]=h|1;pe[157]=e+t;pe[154]=h;return e|0}if((c|0)==(pe[156]|0)){n=(pe[153]|0)+u|0;if(n>>>0>>0){e=0;return e|0}r=n-t|0;if(r>>>0>15){pe[d>>2]=p&1|t|2;pe[e+(t+4)>>2]=r|1;pe[e+n>>2]=r;n=e+(n+4)|0;pe[n>>2]=pe[n>>2]&-2;n=e+t|0}else{pe[d>>2]=p&1|n|2;n=e+(n+4)|0;pe[n>>2]=pe[n>>2]|1;n=0;r=0}pe[153]=r;pe[156]=n;return e|0}if(i&2){e=0;return e|0}f=(i&-8)+u|0;if(f>>>0>>0){e=0;return e|0}h=f-t|0;o=i>>>3;do{if(i>>>0>=256){a=pe[e+(u+24)>>2]|0;o=pe[e+(u+12)>>2]|0;do{if((o|0)==(c|0)){n=e+(u+20)|0;r=pe[n>>2]|0;if(!r){n=e+(u+16)|0;r=pe[n>>2]|0;if(!r){l=0;break}}while(1){i=r+20|0;o=pe[i>>2]|0;if(o){r=o;n=i;continue}i=r+16|0;o=pe[i>>2]|0;if(!o)break;else{r=o;n=i}}if(n>>>0>>0)Xe();else{pe[n>>2]=0;l=r;break}}else{i=pe[e+(u+8)>>2]|0;if(i>>>0>>0)Xe();r=i+12|0;if((pe[r>>2]|0)!=(c|0))Xe();n=o+8|0;if((pe[n>>2]|0)==(c|0)){pe[r>>2]=o;pe[n>>2]=i;l=o;break}else Xe()}}while(0);if(a){r=pe[e+(u+28)>>2]|0;n=908+(r<<2)|0;if((c|0)==(pe[n>>2]|0)){pe[n>>2]=l;if(!l){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();r=a+16|0;if((pe[r>>2]|0)==(c|0))pe[r>>2]=l;else pe[a+20>>2]=l;if(!l)break}n=pe[155]|0;if(l>>>0>>0)Xe();pe[l+24>>2]=a;r=pe[e+(u+16)>>2]|0;do{if(r)if(r>>>0>>0)Xe();else{pe[l+16>>2]=r;pe[r+24>>2]=l;break}}while(0);r=pe[e+(u+20)>>2]|0;if(r)if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[l+20>>2]=r;pe[r+24>>2]=l;break}}}else{i=pe[e+(u+8)>>2]|0;n=pe[e+(u+12)>>2]|0;r=644+(o<<1<<2)|0;if((i|0)!=(r|0)){if(i>>>0>>0)Xe();if((pe[i+12>>2]|0)!=(c|0))Xe()}if((n|0)==(i|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();r=n+8|0;if((pe[r>>2]|0)==(c|0))a=r;else Xe()}else a=n+8|0;pe[i+12>>2]=n;pe[a>>2]=i}}while(0);if(h>>>0<16){pe[d>>2]=f|p&1|2;t=e+(f|4)|0;pe[t>>2]=pe[t>>2]|1;return e|0}else{pe[d>>2]=p&1|t|2;pe[e+(t+4)>>2]=h|3;p=e+(f|4)|0;pe[p>>2]=pe[p>>2]|1;Yr(e+t|0,h);return e|0}return 0}function Yr(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0;g=e+t|0;r=pe[e+4>>2]|0;do{if(!(r&1)){l=pe[e>>2]|0;if(!(r&3))return;h=e+(0-l)|0;f=l+t|0;u=pe[155]|0;if(h>>>0>>0)Xe();if((h|0)==(pe[156]|0)){n=e+(t+4)|0;r=pe[n>>2]|0;if((r&3|0)!=3){_=h;a=f;break}pe[153]=f;pe[n>>2]=r&-2;pe[e+(4-l)>>2]=f|1;pe[g>>2]=f;return}o=l>>>3;if(l>>>0<256){i=pe[e+(8-l)>>2]|0;n=pe[e+(12-l)>>2]|0;r=644+(o<<1<<2)|0;if((i|0)!=(r|0)){if(i>>>0>>0)Xe();if((pe[i+12>>2]|0)!=(h|0))Xe()}if((n|0)==(i|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();r=n+8|0;if((pe[r>>2]|0)==(h|0))s=r;else Xe()}else s=n+8|0;pe[i+12>>2]=n;pe[s>>2]=i;_=h;a=f;break}s=pe[e+(24-l)>>2]|0;i=pe[e+(12-l)>>2]|0;do{if((i|0)==(h|0)){i=16-l|0;n=e+(i+4)|0;r=pe[n>>2]|0;if(!r){n=e+i|0;r=pe[n>>2]|0;if(!r){c=0;break}}while(1){i=r+20|0;o=pe[i>>2]|0;if(o){r=o;n=i;continue}i=r+16|0;o=pe[i>>2]|0;if(!o)break;else{r=o;n=i}}if(n>>>0>>0)Xe();else{pe[n>>2]=0;c=r;break}}else{o=pe[e+(8-l)>>2]|0;if(o>>>0>>0)Xe();r=o+12|0;if((pe[r>>2]|0)!=(h|0))Xe();n=i+8|0;if((pe[n>>2]|0)==(h|0)){pe[r>>2]=i;pe[n>>2]=o;c=i;break}else Xe()}}while(0);if(s){r=pe[e+(28-l)>>2]|0;n=908+(r<<2)|0;if((h|0)==(pe[n>>2]|0)){pe[n>>2]=c;if(!c){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();r=s+16|0;if((pe[r>>2]|0)==(h|0))pe[r>>2]=c;else pe[s+20>>2]=c;if(!c){_=h;a=f;break}}i=pe[155]|0;if(c>>>0>>0)Xe();pe[c+24>>2]=s;r=16-l|0;n=pe[e+r>>2]|0;do{if(n)if(n>>>0>>0)Xe();else{pe[c+16>>2]=n;pe[n+24>>2]=c;break}}while(0);r=pe[e+(r+4)>>2]|0;if(r)if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[c+20>>2]=r;pe[r+24>>2]=c;_=h;a=f;break}else{_=h;a=f}}else{_=h;a=f}}else{_=e;a=t}}while(0);u=pe[155]|0;if(g>>>0>>0)Xe();r=e+(t+4)|0;n=pe[r>>2]|0;if(!(n&2)){if((g|0)==(pe[157]|0)){v=(pe[154]|0)+a|0;pe[154]=v;pe[157]=_;pe[_+4>>2]=v|1;if((_|0)!=(pe[156]|0))return;pe[156]=0;pe[153]=0;return}if((g|0)==(pe[156]|0)){v=(pe[153]|0)+a|0;pe[153]=v;pe[156]=_;pe[_+4>>2]=v|1;pe[_+v>>2]=v;return}a=(n&-8)+a|0;o=n>>>3;do{if(n>>>0>=256){s=pe[e+(t+24)>>2]|0;i=pe[e+(t+12)>>2]|0;do{if((i|0)==(g|0)){n=e+(t+20)|0;r=pe[n>>2]|0;if(!r){n=e+(t+16)|0;r=pe[n>>2]|0;if(!r){p=0;break}}while(1){i=r+20|0;o=pe[i>>2]|0;if(o){r=o;n=i;continue}i=r+16|0;o=pe[i>>2]|0;if(!o)break;else{r=o;n=i}}if(n>>>0>>0)Xe();else{pe[n>>2]=0;p=r;break}}else{o=pe[e+(t+8)>>2]|0;if(o>>>0>>0)Xe();r=o+12|0;if((pe[r>>2]|0)!=(g|0))Xe();n=i+8|0;if((pe[n>>2]|0)==(g|0)){pe[r>>2]=i;pe[n>>2]=o;p=i;break}else Xe()}}while(0);if(s){r=pe[e+(t+28)>>2]|0;n=908+(r<<2)|0;if((g|0)==(pe[n>>2]|0)){pe[n>>2]=p;if(!p){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();r=s+16|0;if((pe[r>>2]|0)==(g|0))pe[r>>2]=p;else pe[s+20>>2]=p;if(!p)break}n=pe[155]|0;if(p>>>0>>0)Xe();pe[p+24>>2]=s;r=pe[e+(t+16)>>2]|0;do{if(r)if(r>>>0>>0)Xe();else{pe[p+16>>2]=r;pe[r+24>>2]=p;break}}while(0);r=pe[e+(t+20)>>2]|0;if(r)if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[p+20>>2]=r;pe[r+24>>2]=p;break}}}else{i=pe[e+(t+8)>>2]|0;n=pe[e+(t+12)>>2]|0;r=644+(o<<1<<2)|0;if((i|0)!=(r|0)){if(i>>>0>>0)Xe();if((pe[i+12>>2]|0)!=(g|0))Xe()}if((n|0)==(i|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();r=n+8|0;if((pe[r>>2]|0)==(g|0))d=r;else Xe()}else d=n+8|0;pe[i+12>>2]=n;pe[d>>2]=i}}while(0);pe[_+4>>2]=a|1;pe[_+a>>2]=a;if((_|0)==(pe[156]|0)){pe[153]=a;return}}else{pe[r>>2]=n&-2;pe[_+4>>2]=a|1;pe[_+a>>2]=a}r=a>>>3;if(a>>>0<256){n=r<<1;o=644+(n<<2)|0;i=pe[151]|0;r=1<>2]|0;if(n>>>0<(pe[155]|0)>>>0)Xe();else{m=r;v=n}}else{pe[151]=i|r;m=644+(n+2<<2)|0;v=o}pe[m>>2]=_;pe[v+12>>2]=_;pe[_+8>>2]=v;pe[_+12>>2]=o;return}r=a>>>8;if(r)if(a>>>0>16777215)o=31;else{m=(r+1048320|0)>>>16&8;v=r<>>16&4;v=v<>>16&2;o=14-(g|m|o)+(v<>>15)|0;o=a>>>(o+7|0)&1|o<<1}else o=0;r=908+(o<<2)|0;pe[_+28>>2]=o;pe[_+20>>2]=0;pe[_+16>>2]=0;n=pe[152]|0;i=1<>2]=_;pe[_+24>>2]=r;pe[_+12>>2]=_;pe[_+8>>2]=_;return}r=pe[r>>2]|0;e:do{if((pe[r+4>>2]&-8|0)!=(a|0)){o=a<<((o|0)==31?0:25-(o>>>1)|0);while(1){n=r+16+(o>>>31<<2)|0;i=pe[n>>2]|0;if(!i)break;if((pe[i+4>>2]&-8|0)==(a|0)){r=i;break e}else{o=o<<1;r=i}}if(n>>>0<(pe[155]|0)>>>0)Xe();pe[n>>2]=_;pe[_+24>>2]=r;pe[_+12>>2]=_;pe[_+8>>2]=_;return}}while(0);n=r+8|0;i=pe[n>>2]|0;v=pe[155]|0;if(!(i>>>0>=v>>>0&r>>>0>=v>>>0))Xe();pe[i+12>>2]=_;pe[n>>2]=_;pe[_+8>>2]=i;pe[_+12>>2]=r;pe[_+24>>2]=0;return}function Gr(){}function Wr(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;n=t-n-(r>>>0>e>>>0|0)>>>0;return(re=n,e-r>>>0|0)|0}function Vr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0;n=e+r|0;if((r|0)>=20){t=t&255;o=e&3;a=t|t<<8|t<<16|t<<24;i=n&~3;if(o){o=e+4-o|0;while((e|0)<(o|0)){de[e>>0]=t;e=e+1|0}}while((e|0)<(i|0)){pe[e>>2]=a;e=e+4|0}}while((e|0)<(n|0)){de[e>>0]=t;e=e+1|0}return e-r|0}function Kr(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t>>>r;return e>>>r|(t&(1<>>r-32|0}function Zr(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t<>>32-r;return e<>>0;return(re=t+n+(r>>>0>>0|0)>>>0,r|0)|0}function $r(e,t,r){e=e|0;t=t|0;r=r|0;var n=0;if((r|0)>=4096)return Re(e|0,t|0,r|0)|0;n=e|0;if((e&3)==(t&3)){while(e&3){if(!r)return n|0;de[e>>0]=de[t>>0]|0;e=e+1|0;t=t+1|0;r=r-1|0}while((r|0)>=4){pe[e>>2]=pe[t>>2];e=e+4|0;t=t+4|0;r=r-4|0}}while((r|0)>0){de[e>>0]=de[t>>0]|0;e=e+1|0;t=t+1|0;r=r-1|0}return n|0}function Qr(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t>>r;return e>>>r|(t&(1<>r-32|0}function en(e){e=e|0;var t=0;t=de[m+(e&255)>>0]|0;if((t|0)<8)return t|0;t=de[m+(e>>8&255)>>0]|0;if((t|0)<8)return t+8|0;t=de[m+(e>>16&255)>>0]|0;if((t|0)<8)return t+16|0;return(de[m+(e>>>24)>>0]|0)+24|0}function tn(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0;o=e&65535;i=t&65535;r=_e(i,o)|0;n=e>>>16;e=(r>>>16)+(_e(i,n)|0)|0;i=t>>>16;t=_e(i,o)|0;return(re=(e>>>16)+(_e(i,n)|0)+(((e&65535)+t|0)>>>16)|0,e+t<<16|r&65535|0)|0}function rn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0;l=t>>31|((t|0)<0?-1:0)<<1;u=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;o=n>>31|((n|0)<0?-1:0)<<1;i=((n|0)<0?-1:0)>>31|((n|0)<0?-1:0)<<1;s=Wr(l^e,u^t,l,u)|0;a=re;e=o^l;t=i^u;return Wr((un(s,a,Wr(o^r,i^n,o,i)|0,re,0)|0)^e,re^t,e,t)|0}function nn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0;i=ve;ve=ve+16|0;s=i|0;a=t>>31|((t|0)<0?-1:0)<<1;o=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;l=n>>31|((n|0)<0?-1:0)<<1;u=((n|0)<0?-1:0)>>31|((n|0)<0?-1:0)<<1;e=Wr(a^e,o^t,a,o)|0;t=re;un(e,t,Wr(l^r,u^n,l,u)|0,re,s)|0;n=Wr(pe[s>>2]^a,pe[s+4>>2]^o,a,o)|0;r=re;ve=i;return(re=r,n)|0}function on(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0;i=e;o=r;r=tn(i,o)|0;e=re;return(re=(_e(t,o)|0)+(_e(n,i)|0)+e|e&0,r|0|0)|0}function an(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;return un(e,t,r,n,0)|0}function sn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0;o=ve;ve=ve+16|0;i=o|0;un(e,t,r,n,i)|0;ve=o;return(re=pe[i+4>>2]|0,pe[i>>2]|0)|0}function un(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;c=e;u=t;l=u;a=r;h=n;s=h;if(!l){o=(i|0)!=0;if(!s){if(o){pe[i>>2]=(c>>>0)%(a>>>0);pe[i+4>>2]=0}h=0;i=(c>>>0)/(a>>>0)>>>0;return(re=h,i)|0}else{if(!o){h=0;i=0;return(re=h,i)|0}pe[i>>2]=e|0;pe[i+4>>2]=t&0;h=0;i=0;return(re=h,i)|0}}o=(s|0)==0;do{if(a){if(!o){o=(ae(s|0)|0)-(ae(l|0)|0)|0;if(o>>>0<=31){f=o+1|0;s=31-o|0;t=o-31>>31;a=f;e=c>>>(f>>>0)&t|l<>>(f>>>0)&t;o=0;s=c<>2]=e|0;pe[i+4>>2]=u|t&0;h=0;i=0;return(re=h,i)|0}o=a-1|0;if(o&a){s=(ae(a|0)|0)+33-(ae(l|0)|0)|0;p=64-s|0;f=32-s|0;u=f>>31;d=s-32|0;t=d>>31;a=s;e=f-1>>31&l>>>(d>>>0)|(l<>>(s>>>0))&t;t=t&l>>>(s>>>0);o=c<>>(d>>>0))&u|c<>31;break}if(i){pe[i>>2]=o&c;pe[i+4>>2]=0}if((a|0)==1){d=u|t&0;p=e|0|0;return(re=d,p)|0}else{p=en(a|0)|0;d=l>>>(p>>>0)|0;p=l<<32-p|c>>>(p>>>0)|0;return(re=d,p)|0}}else{if(o){if(i){pe[i>>2]=(l>>>0)%(a>>>0);pe[i+4>>2]=0}d=0;p=(l>>>0)/(a>>>0)>>>0;return(re=d,p)|0}if(!c){if(i){pe[i>>2]=0;pe[i+4>>2]=(l>>>0)%(s>>>0)}d=0;p=(l>>>0)/(s>>>0)>>>0;return(re=d,p)|0}o=s-1|0;if(!(o&s)){if(i){pe[i>>2]=e|0;pe[i+4>>2]=o&l|t&0}d=0;p=l>>>((en(s|0)|0)>>>0);return(re=d,p)|0}o=(ae(s|0)|0)-(ae(l|0)|0)|0;if(o>>>0<=30){t=o+1|0;s=31-o|0;a=t;e=l<>>(t>>>0);t=l>>>(t>>>0);o=0;s=c<>2]=e|0;pe[i+4>>2]=u|t&0;d=0;p=0;return(re=d,p)|0}}while(0);if(!a){l=s;u=0;s=0}else{f=r|0|0;c=h|n&0;l=Jr(f|0,c|0,-1,-1)|0;r=re;u=s;s=0;do{n=u;u=o>>>31|u<<1;o=s|o<<1;n=e<<1|n>>>31|0;h=e>>>31|t<<1|0;Wr(l,r,n,h)|0;p=re;d=p>>31|((p|0)<0?-1:0)<<1;s=d&1;e=Wr(n,h,d&f,(((p|0)<0?-1:0)>>31|((p|0)<0?-1:0)<<1)&c)|0;t=re;a=a-1|0}while((a|0)!=0);l=u;u=0}a=0;if(i){pe[i>>2]=e;pe[i+4>>2]=t}d=(o|0)>>>31|(l|a)<<1|(a<<1|o>>>31)&0|u;p=(o<<1|0>>>31)&-2|s;return(re=d,p)|0}function ln(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;return Cn[e&7](t|0,r|0,n|0)|0}function cn(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;kn[e&3](t|0,r|0,n|0,i|0,o|0)}function fn(e,t){e=e|0;t=t|0;En[e&7](t|0)}function hn(e,t){e=e|0;t=t|0;return An[e&1](t|0)|0}function dn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;On[e&0](t|0,r|0,n|0)}function pn(e){e=e|0;Rn[e&3]()}function gn(e,t,r,n,i,o,a){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;In[e&3](t|0,r|0,n|0,i|0,o|0,a|0)}function mn(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;return Dn[e&1](t|0,r|0,n|0,i|0,o|0)|0}function vn(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;Ln[e&3](t|0,r|0,n|0,i|0)}function _n(e,t,r){e=e|0;t=t|0;r=r|0;se(0);return 0}function yn(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;se(1)}function bn(e){e=e|0;se(2)}function xn(e){e=e|0;se(3);return 0}function wn(e,t,r){e=e|0;t=t|0;r=r|0;se(4)}function Tn(){se(5)}function Sn(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;se(6)}function Mn(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;se(7);return 0}function Pn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;se(8)}var Cn=[_n,Vt,Nr,Er,kr,Ar,_n,_n];var kn=[yn,tr,er,yn];var En=[bn,qt,Gt,Ht,Yt,Wt,ur,Lr];var An=[xn,Cr];var On=[wn];var Rn=[Tn,ar,sr,Tn];var In=[Sn,nr,rr,Sn];var Dn=[Mn,ut];var Ln=[Pn,Zt,Jt,Pn];return{___cxa_can_catch:ir,_crn_get_levels:Tt,_crn_get_uncompressed_size:Mt,_crn_decompress:Pt,_i64Add:Jr,_crn_get_width:xt,___cxa_is_pointer_type:or,_i64Subtract:Wr,_memset:Vr,_malloc:zr,_free:Ur,_memcpy:$r,_bitshift64Lshr:Kr,_fflush:mr,_bitshift64Shl:Zr,_crn_get_height:wt,___errno_location:cr,_crn_get_dxt_format:St,runPostSets:Gr,_emscripten_replace_memory:Ve,stackAlloc:Ke,stackSave:Ze,stackRestore:Je,establishStackSpace:$e,setThrew:Qe,setTempRet0:rt,getTempRet0:nt,dynCall_iiii:ln,dynCall_viiiii:cn,dynCall_vi:fn,dynCall_ii:hn,dynCall_viii:dn,dynCall_v:pn,dynCall_viiiiii:gn,dynCall_iiiiii:mn,dynCall_viiii:vn}}(e.Ya,e.Za,buffer);e.___cxa_can_catch=Z.___cxa_can_catch,e._crn_get_levels=Z._crn_get_levels,e.runPostSets=Z.runPostSets,e._crn_get_uncompressed_size=Z._crn_get_uncompressed_size,e._crn_decompress=Z._crn_decompress;var zc=e._i64Add=Z._i64Add;e._crn_get_height=Z._crn_get_height,e.___cxa_is_pointer_type=Z.___cxa_is_pointer_type;var nb=e._i64Subtract=Z._i64Subtract,qb=e._memset=Z._memset,Ea=e._malloc=Z._malloc,Bc=e._memcpy=Z._memcpy,Xa=e._emscripten_replace_memory=Z._emscripten_replace_memory;e._crn_get_dxt_format=Z._crn_get_dxt_format;var rb=e._bitshift64Lshr=Z._bitshift64Lshr,Na=e._free=Z._free;e._fflush=Z._fflush,e._crn_get_width=Z._crn_get_width,e.___errno_location=Z.___errno_location;var sb=e._bitshift64Shl=Z._bitshift64Shl;function ia(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}e.dynCall_iiii=Z.dynCall_iiii,e.dynCall_viiiii=Z.dynCall_viiiii,e.dynCall_vi=Z.dynCall_vi,e.dynCall_ii=Z.dynCall_ii,e.dynCall_viii=Z.dynCall_viii,e.dynCall_v=Z.dynCall_v,e.dynCall_viiiiii=Z.dynCall_viiiiii,e.dynCall_iiiiii=Z.dynCall_iiiiii,e.dynCall_viiii=Z.dynCall_viiii,n.aa=Z.stackAlloc,n.ua=Z.stackSave,n.ba=Z.stackRestore,n.Cd=Z.establishStackSpace,n.rb=Z.setTempRet0,n.fb=Z.getTempRet0,ia.prototype=Error(),ia.prototype.constructor=ia;var rd=null,jb=function t(){e.calledRun||td(),e.calledRun||(jb=t)};function td(t){function r(){if(!e.calledRun&&(e.calledRun=!0,!na)){if(Ha||(Ha=!0,ab(cb)),ab(db),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e._main&&vd&&e.callMain(t),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)gb(e.postRun.shift());ab(eb)}}if(t=t||e.arguments,null===rd&&(rd=Date.now()),!(0 0) var gc = undefined");else{if(!ba&&!ca)throw"Unknown runtime environment. Where are we?";e.read=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},void 0!==arguments&&(e.arguments=arguments),"undefined"!=typeof console?(e.print||(e.print=function(e){console.log(e)}),e.printErr||(e.printErr=function(e){console.log(e)})):e.print||(e.print=function(){}),ca&&(e.load=importScripts),void 0===e.setWindowTitle&&(e.setWindowTitle=function(e){document.title=e})}function ha(e){eval.call(null,e)}for(k in!e.load&&e.read&&(e.load=function(t){ha(e.read(t))}),e.print||(e.print=function(){}),e.printErr||(e.printErr=e.print),e.arguments||(e.arguments=[]),e.thisProgram||(e.thisProgram="./this.program"),e.print=e.print,e.W=e.printErr,e.preRun=[],e.postRun=[],aa)aa.hasOwnProperty(k)&&(e[k]=aa[k]);var n={rb:function(e){ka=e},fb:function(){return ka},ua:function(){return m},ba:function(e){m=e},Ka:function(e){switch(e){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:return"*"===e[e.length-1]?n.J:"i"===e[0]?(assert(0==(e=parseInt(e.substr(1)))%8),e/8):0}},eb:function(e){return Math.max(n.Ka(e),n.J)},ud:16,Qd:function(e,t){return"double"===t||"i64"===t?7&e&&(assert(4==(7&e)),e+=4):assert(0==(3&e)),e},Ed:function(e,t,r){return r||"i64"!=e&&"double"!=e?e?Math.min(t||(e?n.eb(e):0),n.J):Math.min(t,8):8},L:function(t,r,n){return n&&n.length?(n.splice||(n=Array.prototype.slice.call(n)),n.splice(0,0,r),e["dynCall_"+t].apply(null,n)):e["dynCall_"+t].call(null,r)},Z:[],Xa:function(e){for(var t=0;t>>0)+4294967296*+(t>>>0):+(e>>>0)+4294967296*+(0|t)},Ua:8,J:4,vd:0};e.Runtime=n,n.addFunction=n.Xa,n.removeFunction=n.nb;var na=!1,oa,pa,ka,ra,sa;function assert(e,t){e||x("Assertion failed: "+t)}function qa(a){var b=e["_"+a];if(!b)try{b=eval("_"+a)}catch(e){}return assert(b,"Cannot call unknown function "+a+" (perhaps LLVM optimizations or closure removed it?)"),b}function wa(e,t,r){switch("*"===(r=r||"i8").charAt(r.length-1)&&(r="i32"),r){case"i1":case"i8":y[e>>0]=t;break;case"i16":z[e>>1]=t;break;case"i32":C[e>>2]=t;break;case"i64":pa=[t>>>0,(oa=t,1<=+xa(oa)?0>>0:~~+Aa((oa-+(~~oa>>>0))/4294967296)>>>0:0)],C[e>>2]=pa[0],C[e+4>>2]=pa[1];break;case"float":Ba[e>>2]=t;break;case"double":Ca[e>>3]=t;break;default:x("invalid type for setValue: "+r)}}function Da(e,t){switch("*"===(t=t||"i8").charAt(t.length-1)&&(t="i32"),t){case"i1":case"i8":return y[e>>0];case"i16":return z[e>>1];case"i32":case"i64":return C[e>>2];case"float":return Ba[e>>2];case"double":return Ca[e>>3];default:x("invalid type for setValue: "+t)}return null}function D(e,t,r,i){var o,a;a="number"==typeof e?(o=!0,e):(o=!1,e.length);var s,u,l="string"==typeof t?t:null;if(r=4==r?i:[Ea,n.aa,n.Ra,n.R][void 0===r?2:r](Math.max(a,l?1:t.length)),o){for(assert(0==(3&(i=r))),e=r+(-4&a);i>2]=0;for(e=r+a;i>0]=0;return r}if("i8"===l)return e.subarray||e.slice?E.set(e,r):E.set(new Uint8Array(e),r),r;for(i=0;i>0],0!=n||r)&&(o++,!r||o!=r););if(r||(r=o),n="",i<128){for(;0>10,56320|1023&r)))):s+=String.fromCharCode(r)}}function Ka(e,t,r,n){if(!(0>6}else{if(a<=65535){if(n<=r+2)break;t[r++]=224|a>>12}else{if(a<=2097151){if(n<=r+3)break;t[r++]=240|a>>18}else{if(a<=67108863){if(n<=r+4)break;t[r++]=248|a>>24}else{if(n<=r+5)break;t[r++]=252|a>>30,t[r++]=128|a>>24&63}t[r++]=128|a>>18&63}t[r++]=128|a>>12&63}t[r++]=128|a>>6&63}t[r++]=128|63&a}}return t[r]=0,r-i}function La(e){for(var t=0,r=0;r"):o=i;e:for(;f>0];if(!r)return t;t+=String.fromCharCode(r)}},e.stringToAscii=function(e,t){return Ia(e,t,!1)},e.UTF8ArrayToString=Ja,e.UTF8ToString=function(e){return Ja(E,e)},e.stringToUTF8Array=Ka,e.stringToUTF8=function(e,t,r){return Ka(e,E,t,r)},e.lengthBytesUTF8=La,e.UTF16ToString=function(e){for(var t=0,r="";;){var n=z[e+2*t>>1];if(0==n)return r;++t,r+=String.fromCharCode(n)}},e.stringToUTF16=function(e,t,r){if(void 0===r&&(r=2147483647),r<2)return 0;var n=t;r=(r-=2)<2*e.length?r/2:e.length;for(var i=0;i>1]=e.charCodeAt(i),t+=2;return z[t>>1]=0,t-n},e.lengthBytesUTF16=function(e){return 2*e.length},e.UTF32ToString=function(e){for(var t=0,r="";;){var n=C[e+4*t>>2];if(0==n)return r;++t,65536<=n?(n-=65536,r+=String.fromCharCode(55296|n>>10,56320|1023&n)):r+=String.fromCharCode(n)}},e.stringToUTF32=function(e,t,r){if(void 0===r&&(r=2147483647),r<4)return 0;var n=t;r=n+r-4;for(var i=0;i>2]=o,r<(t+=4)+4)break}return C[t>>2]=0,t-n},e.lengthBytesUTF32=function(e){for(var t=0,r=0;r>0]=e[r],r+=1}function ta(e,t){for(var r=0;r>0]=e[r]}function Ia(e,t,r){for(var n=0;n>0]=e.charCodeAt(n);r||(y[t>>0]=0)}e.addOnPreRun=fb,e.addOnInit=function(e){cb.unshift(e)},e.addOnPreMain=function(e){db.unshift(e)},e.addOnExit=function(e){H.unshift(e)},e.addOnPostRun=gb,e.intArrayFromString=hb,e.intArrayToString=function(e){for(var t=[],r=0;r>>16)*n+r*(t>>>16)<<16)|0}),Math.Jd=Math.imul,Math.clz32||(Math.clz32=function(e){e>>>=0;for(var t=0;t<32;t++)if(e&1<<31-t)return t;return 32}),Math.Ad=Math.clz32;var xa=Math.abs,Aa=Math.ceil,za=Math.floor,ya=Math.min,I=0,ib=null,jb=null;function kb(){I++,e.monitorRunDependencies&&e.monitorRunDependencies(I)}function lb(){if(I--,e.monitorRunDependencies&&e.monitorRunDependencies(I),0==I&&(null!==ib&&(clearInterval(ib),ib=null),jb)){var t=jb;jb=null,t()}}e.addRunDependency=kb,e.removeRunDependency=lb,e.preloadedImages={},e.preloadedAudios={},Ta=8,la=Ta+5888,cb.push(),D([124,0,0,0,98,7,0,0,124,0,0,0,111,7,0,0,164,0,0,0,124,7,0,0,16,0,0,0,0,0,0,0,164,0,0,0,157,7,0,0,24,0,0,0,0,0,0,0,164,0,0,0,227,7,0,0,24,0,0,0,0,0,0,0,164,0,0,0,191,7,0,0,56,0,0,0,0,0,0,0,164,0,0,0,5,8,0,0,40,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,40,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,88,0,0,0,1,0,0,0,5,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,114,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,124,1,0,0,236,1,0,0,236,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,4,0,0,0,239,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,4,0,0,0,231,16,0,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,115,40,37,117,41,58,32,65,115,115,101,114,116,105,111,110,32,102,97,105,108,117,114,101,58,32,34,37,115,34,10,0,109,95,115,105,122,101,32,60,61,32,109,95,99,97,112,97,99,105,116,121,0,46,47,99,114,110,95,100,101,99,111,109,112,46,104,0,109,105,110,95,110,101,119,95,99,97,112,97,99,105,116,121,32,60,32,40,48,120,55,70,70,70,48,48,48,48,85,32,47,32,101,108,101,109,101,110,116,95,115,105,122,101,41,0,110,101,119,95,99,97,112,97,99,105,116,121,32,38,38,32,40,110,101,119,95,99,97,112,97,99,105,116,121,32,62,32,109,95,99,97,112,97,99,105,116,121,41,0,110,117,109,95,99,111,100,101,115,91,99,93,0,115,111,114,116,101,100,95,112,111,115,32,60,32,116,111,116,97,108,95,117,115,101,100,95,115,121,109,115,0,112,67,111,100,101,115,105,122,101,115,91,115,121,109,95,105,110,100,101,120,93,32,61,61,32,99,111,100,101,115,105,122,101,0,116,32,60,32,40,49,85,32,60,60,32,116,97,98,108,101,95,98,105,116,115,41,0,109,95,108,111,111,107,117,112,91,116,93,32,61,61,32,99,85,73,78,84,51,50,95,77,65,88,0,99,114,110,100,95,109,97,108,108,111,99,58,32,115,105,122,101,32,116,111,111,32,98,105,103,0,99,114,110,100,95,109,97,108,108,111,99,58,32,111,117,116,32,111,102,32,109,101,109,111,114,121,0,40,40,117,105,110,116,51,50,41,112,95,110,101,119,32,38,32,40,67,82,78,68,95,77,73,78,95,65,76,76,79,67,95,65,76,73,71,78,77,69,78,84,32,45,32,49,41,41,32,61,61,32,48,0,99,114,110,100,95,114,101,97,108,108,111,99,58,32,98,97,100,32,112,116,114,0,99,114,110,100,95,102,114,101,101,58,32,98,97,100,32,112,116,114,0,102,97,108,115,101,0,40,116,111,116,97,108,95,115,121,109,115,32,62,61,32,49,41,32,38,38,32,40,116,111,116,97,108,95,115,121,109,115,32,60,61,32,112,114,101,102,105,120,95,99,111,100,105,110,103,58,58,99,77,97,120,83,117,112,112,111,114,116,101,100,83,121,109,115,41,0,17,18,19,20,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15,16,48,0,110,117,109,95,98,105,116,115,32,60,61,32,51,50,85,0,109,95,98,105,116,95,99,111,117,110,116,32,60,61,32,99,66,105,116,66,117,102,83,105,122,101,0,116,32,33,61,32,99,85,73,78,84,51,50,95,77,65,88,0,109,111,100,101,108,46,109,95,99,111,100,101,95,115,105,122,101,115,91,115,121,109,93,32,61,61,32,108,101,110,0,0,2,3,1,0,2,3,4,5,6,7,1,40,108,101,110,32,62,61,32,49,41,32,38,38,32,40,108,101,110,32,60,61,32,99,77,97,120,69,120,112,101,99,116,101,100,67,111,100,101,83,105,122,101,41,0,105,32,60,32,109,95,115,105,122,101,0,110,101,120,116,95,108,101,118,101,108,95,111,102,115,32,62,32,99,117,114,95,108,101,118,101,108,95,111,102,115,0,1,2,2,3,3,3,3,4,0,0,0,0,0,0,1,1,0,1,0,1,0,0,1,2,1,2,0,0,0,1,0,2,1,0,2,0,0,1,2,3,110,117,109,32,38,38,32,40,110,117,109,32,61,61,32,126,110,117,109,95,99,104,101,99,107,41,0,83,116,57,101,120,99,101,112,116,105,111,110,0,83,116,57,116,121,112,101,95,105,110,102,111,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,54,95,95,115,104,105,109,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,57,95,95,112,111,105,110,116,101,114,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,112,98,97,115,101,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,48,95,95,115,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,112,116,104,114,101,97,100,95,111,110,99,101,32,102,97,105,108,117,114,101,32,105,110,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,95,102,97,115,116,40,41,0,116,101,114,109,105,110,97,116,101,95,104,97,110,100,108,101,114,32,117,110,101,120,112,101,99,116,101,100,108,121,32,114,101,116,117,114,110,101,100,0,99,97,110,110,111,116,32,99,114,101,97,116,101,32,112,116,104,114,101,97,100,32,107,101,121,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,99,97,110,110,111,116,32,122,101,114,111,32,111,117,116,32,116,104,114,101,97,100,32,118,97,108,117,101,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,58,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,102,111,114,101,105,103,110,32,101,120,99,101,112,116,105,111,110,0,116,101,114,109,105,110,97,116,105,110,103,0,117,110,99,97,117,103,104,116,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116,32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,46,0],"i8",4,n.Ua);var mb=n.ja(D(12,"i8",2),8);function ob(t){return e.___errno_location&&(C[e.___errno_location()>>2]=t),t}assert(0==mb%8),e._i64Subtract=nb;var J={I:1,F:2,ed:3,bc:4,H:5,Aa:6,vb:7,zc:8,ea:9,Jb:10,va:11,qd:11,Ta:12,da:13,Vb:14,Lc:15,fa:16,wa:17,rd:18,ha:19,ya:20,P:21,q:22,uc:23,Sa:24,Q:25,nd:26,Wb:27,Hc:28,ia:29,bd:30,nc:31,Vc:32,Sb:33,Zc:34,Dc:42,Zb:43,Kb:44,ec:45,fc:46,gc:47,mc:48,od:49,xc:50,dc:51,Pb:35,Ac:37,Bb:52,Eb:53,sd:54,vc:55,Fb:56,Gb:57,Qb:35,Hb:59,Jc:60,yc:61,kd:62,Ic:63,Ec:64,Fc:65,ad:66,Bc:67,yb:68,gd:69,Lb:70,Wc:71,pc:72,Tb:73,Db:74,Qc:76,Cb:77,$c:78,hc:79,ic:80,lc:81,kc:82,jc:83,Kc:38,za:39,qc:36,ga:40,Rc:95,Uc:96,Ob:104,wc:105,zb:97,Yc:91,Oc:88,Gc:92,cd:108,Nb:111,wb:98,Mb:103,tc:101,rc:100,ld:110,Xb:112,Yb:113,ac:115,Ab:114,Rb:89,oc:90,Xc:93,dd:94,xb:99,sc:102,cc:106,Mc:107,md:109,pd:87,Ub:122,hd:116,Pc:95,Cc:123,$b:84,Sc:75,Ib:125,Nc:131,Tc:130,jd:86};function pb(e,t){H.push(function(){n.L("vi",e,[t])}),pb.level=H.length}function tb(){return!!tb.p}e._memset=qb,e._bitshift64Lshr=rb,e._bitshift64Shl=sb;var ub=[],vb={};function wb(e,t){wb.p||(wb.p={}),e in wb.p||(n.L("v",t),wb.p[e]=1)}var xb={0:"Success",1:"Not super-user",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"I/O error",6:"No such device or address",7:"Arg list too long",8:"Exec format error",9:"Bad file number",10:"No children",11:"No more processes",12:"Not enough core",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Mount device busy",17:"File exists",18:"Cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",25:"Not a typewriter",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",30:"Read only file system",31:"Too many links",32:"Broken pipe",33:"Math arg out of domain of func",34:"Math result not representable",35:"File locking deadlock error",36:"File or path name too long",37:"No record locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many symbolic links",42:"No message of desired type",43:"Identifier removed",44:"Channel number out of range",45:"Level 2 not synchronized",46:"Level 3 halted",47:"Level 3 reset",48:"Link number out of range",49:"Protocol driver not attached",50:"No CSI structure available",51:"Level 2 halted",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",57:"Invalid slot",59:"Bad font file fmt",60:"Device not a stream",61:"No data (for no delay io)",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",65:"Package not installed",66:"The object is remote",67:"The link has been severed",68:"Advertise error",69:"Srmount error",70:"Communication error on send",71:"Protocol error",72:"Multihop attempted",73:"Cross mount point (not really error)",74:"Trying to read unreadable message",75:"Value too large for defined data type",76:"Given log. name not unique",77:"f.d. invalid for this operation",78:"Remote address changed",79:"Can access a needed shared lib",80:"Accessing a corrupted shared lib",81:".lib section in a.out corrupted",82:"Attempting to link in too many libs",83:"Attempting to exec a shared library",84:"Illegal byte sequence",86:"Streams pipe error",87:"Too many users",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Unknown protocol",94:"Socket type not supported",95:"Not supported",96:"Protocol family not supported",97:"Address family not supported by protocol family",98:"Address already in use",99:"Address not available",100:"Network interface is not configured",101:"Network is unreachable",102:"Connection reset by network",103:"Connection aborted",104:"Connection reset by peer",105:"No buffer space available",106:"Socket is already connected",107:"Socket is not connected",108:"Can't send after socket shutdown",109:"Too many references",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"Host is unreachable",114:"Socket already connected",115:"Connection already in progress",116:"Stale file handle",122:"Quota exceeded",123:"No medium (in tape drive)",125:"Operation canceled",130:"Previous owner died",131:"State not recoverable"};function yb(e,t){for(var r=0,n=e.length-1;0<=n;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function zb(e){var t="/"===e.charAt(0),r="/"===e.substr(-1);return(e=yb(e.split("/").filter(function(e){return!!e}),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e}function Ab(e){var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1);return e=t[0],t=t[1],e||t?(t&&(t=t.substr(0,t.length-1)),e+t):"."}function Bb(e){if("/"===e)return"/";var t=e.lastIndexOf("/");return-1===t?e:e.substr(t+1)}function Cb(){return zb(Array.prototype.slice.call(arguments,0).join("/"))}function K(e,t){return zb(e+"/"+t)}function Db(){for(var e="",t=!1,r=arguments.length-1;-1<=r&&!t;r--){if("string"!=typeof(t=0<=r?arguments[r]:"/"))throw new TypeError("Arguments to path.resolve must be strings");if(!t)return"";e=t+"/"+e,t="/"===t.charAt(0)}return(t?"/":"")+(e=yb(e.split("/").filter(function(e){return!!e}),!t).join("/"))||"."}var Eb=[];function Fb(e,t){Eb[e]={input:[],output:[],N:t},Gb(e,Hb)}var Hb={open:function(e){var t=Eb[e.g.rdev];if(!t)throw new L(J.ha);e.tty=t,e.seekable=!1},close:function(e){e.tty.N.flush(e.tty)},flush:function(e){e.tty.N.flush(e.tty)},read:function(e,t,r,n){if(!e.tty||!e.tty.N.La)throw new L(J.Aa);for(var i=0,o=0;oe.e.length&&(e.e=M.cb(e),e.o=e.e.length),!e.e||e.e.subarray){var r=e.e?e.e.buffer.byteLength:0;t<=r||(t=Math.max(t,r*(r<1048576?2:1.125)|0),0!=r&&(t=Math.max(t,256)),r=e.e,e.e=new Uint8Array(t),0t)e.e.length=t;else for(;e.e.length=e.g.o)return 0;if(assert(0<=(e=Math.min(e.g.o-i,n))),8>1)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}return t.mode},B:function(e){for(var t=[];e.parent!==e;)t.push(e.name),e=e.parent;return t.push(e.A.pa.root),t.reverse(),Cb.apply(null,t)},Ha:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},$a:function(e){if((e&=-32769)in P.Ha)return P.Ha[e];throw new L(J.q)},k:{D:function(e){var t;e=P.B(e);try{t=fs.lstatSync(e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}return P.$&&!t.K&&(t.K=4096),P.$&&!t.blocks&&(t.blocks=(t.size+t.K-1)/t.K|0),{dev:t.dev,ino:t.ino,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,size:t.size,atime:t.atime,mtime:t.mtime,ctime:t.ctime,K:t.K,blocks:t.blocks}},u:function(e,t){var r=P.B(e);try{void 0!==t.mode&&(fs.chmodSync(r,t.mode),e.mode=t.mode),void 0!==t.size&&fs.truncateSync(r,t.size)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},lookup:function(e,t){var r=K(P.B(e),t);r=P.Ja(r);return P.createNode(e,t,r)},T:function(e,t,r,n){e=P.createNode(e,t,r,n),t=P.B(e);try{N(e.mode)?fs.mkdirSync(t,e.mode):fs.writeFileSync(t,"",{mode:e.mode})}catch(e){if(!e.code)throw e;throw new L(J[e.code])}return e},rename:function(e,t,r){e=P.B(e),t=K(P.B(t),r);try{fs.renameSync(e,t)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},unlink:function(e,t){var r=K(P.B(e),t);try{fs.unlinkSync(r)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},rmdir:function(e,t){var r=K(P.B(e),t);try{fs.rmdirSync(r)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},readdir:function(e){e=P.B(e);try{return fs.readdirSync(e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},symlink:function(e,t,r){e=K(P.B(e),t);try{fs.symlinkSync(r,e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},readlink:function(e){var t=P.B(e);try{return t=fs.readlinkSync(t),t=Ob.relative(Ob.resolve(e.A.pa.root),t)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}}},n:{open:function(e){var t=P.B(e.g);try{32768==(61440&e.g.mode)&&(e.V=fs.openSync(t,P.$a(e.flags)))}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},close:function(e){try{32768==(61440&e.g.mode)&&e.V&&fs.closeSync(e.V)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},read:function(e,t,r,n,i){if(0===n)return 0;var o,a=new Buffer(n);try{o=fs.readSync(e.V,a,0,n,i)}catch(e){throw new L(J[e.code])}if(0>>0)%Q.length}function Xb(e){var t=Wb(e.parent.id,e.name);e.M=Q[t],Q[t]=e}function Nb(e,t){var r;if(r=(r=Yb(e,"x"))?r:e.k.lookup?0:J.da)throw new L(r,e);for(r=Q[Wb(e.id,t)];r;r=r.M){var n=r.name;if(r.parent.id===e.id&&n===t)return r}return e.k.lookup(e,t)}function Lb(e,t,r,n){return Zb||((Zb=function(e,t,r,n){e||(e=this),this.parent=e,this.A=e.A,this.U=null,this.id=Sb++,this.name=t,this.mode=r,this.k={},this.n={},this.rdev=n}).prototype={},Object.defineProperties(Zb.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(e){e?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(e){e?this.mode|=146:this.mode&=-147}},kb:{get:function(){return N(this.mode)}},jb:{get:function(){return 8192==(61440&this.mode)}}})),Xb(e=new Zb(e,t,r,n)),e}function N(e){return 16384==(61440&e)}var $b={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218};function Yb(e,t){return Tb?0:(-1===t.indexOf("r")||292&e.mode)&&(-1===t.indexOf("w")||146&e.mode)&&(-1===t.indexOf("x")||73&e.mode)?0:J.da}function ac(e,t){try{return Nb(e,t),J.wa}catch(e){}return Yb(e,"wx")}function bc(){for(var e=0;e<=4096;e++)if(!Rb[e])return e;throw new L(J.Sa)}function cc(e){dc||((dc=function(){}).prototype={},Object.defineProperties(dc.prototype,{object:{get:function(){return this.g},set:function(e){this.g=e}},Ld:{get:function(){return 1!=(2097155&this.flags)}},Md:{get:function(){return 0!=(2097155&this.flags)}},Kd:{get:function(){return 1024&this.flags}}}));var t,r=new dc;for(t in e)r[t]=e[t];return e=r,r=bc(),e.fd=r,Rb[r]=e}var Kb={open:function(e){e.n=Qb[e.g.rdev].n,e.n.open&&e.n.open(e)},G:function(){throw new L(J.ia)}},qc;function Gb(e,t){Qb[e]={n:t}}function ec(e,t){var r,n="/"===t,i=!t;if(n&&Pb)throw new L(J.fa);if(!n&&!i){if(t=(r=S(t,{Ia:!1})).path,(r=r.g).U)throw new L(J.fa);if(!N(r.mode))throw new L(J.ya)}i={type:e,pa:{},Oa:t,lb:[]};var o=e.A(i);(o.A=i).root=o,n?Pb=o:r&&(r.U=i,r.A&&r.A.lb.push(i))}function fc(e,t,r){var n=S(e,{parent:!0}).g;if(!(e=Bb(e))||"."===e||".."===e)throw new L(J.q);var i=ac(n,e);if(i)throw new L(i);if(!n.k.T)throw new L(J.I);return n.k.T(n,e,t,r)}function gc(e,t){return t=4095&(void 0!==t?t:438),fc(e,t|=32768,0)}function V(e,t){return t=1023&(void 0!==t?t:511),fc(e,t|=16384,0)}function hc(e,t,r){return void 0===r&&(r=t,t=438),fc(e,8192|t,r)}function ic(e,t){if(!Db(e))throw new L(J.F);var r=S(t,{parent:!0}).g;if(!r)throw new L(J.F);var n=Bb(t),i=ac(r,n);if(i)throw new L(i);if(!r.k.symlink)throw new L(J.I);return r.k.symlink(r,n,e)}function Vb(e){if(!(e=S(e).g))throw new L(J.F);if(!e.k.readlink)throw new L(J.q);return Db(T(e.parent),e.k.readlink(e))}function jc(e,t){var r;if(!(r="string"==typeof e?S(e,{la:!0}).g:e).k.u)throw new L(J.I);r.k.u(r,{mode:4095&t|-4096&r.mode,timestamp:Date.now()})}function kc(t,r){var n,i,o;if(""===t)throw new L(J.F);if("string"==typeof r){if(void 0===(i=$b[r]))throw Error("Unknown file open mode: "+r)}else i=r;if(n=64&(r=i)?4095&(void 0===n?438:n)|32768:0,"object"==typeof t)o=t;else{t=zb(t);try{o=S(t,{la:!(131072&r)}).g}catch(e){}}if(i=!1,64&r)if(o){if(128&r)throw new L(J.wa)}else o=fc(t,n,0),i=!0;if(!o)throw new L(J.F);if(8192==(61440&o.mode)&&(r&=-513),65536&r&&!N(o.mode))throw new L(J.ya);if(!i&&(n=o?40960==(61440&o.mode)?J.ga:N(o.mode)&&(0!=(2097155&r)||512&r)?J.P:(n=["r","w","rw"][3&r],512&r&&(n+="w"),Yb(o,n)):J.F))throw new L(n);if(512&r){var a;if(!(a="string"==typeof(n=o)?S(n,{la:!0}).g:n).k.u)throw new L(J.I);if(N(a.mode))throw new L(J.P);if(32768!=(61440&a.mode))throw new L(J.q);if(n=Yb(a,"w"))throw new L(n);a.k.u(a,{size:0,timestamp:Date.now()})}r&=-641,(o=cc({g:o,path:T(o),flags:r,seekable:!0,position:0,n:o.n,tb:[],error:!1})).n.open&&o.n.open(o),!e.logReadFiles||1&r||(lc||(lc={}),t in lc||(lc[t]=1,e.printErr("read file: "+t)));try{R.onOpenFile&&(a=0,1!=(2097155&r)&&(a|=1),0!=(2097155&r)&&(a|=2),R.onOpenFile(t,a))}catch(e){console.log("FS.trackingDelegate['onOpenFile']('"+t+"', flags) threw an exception: "+e.message)}return o}function mc(e){e.na&&(e.na=null);try{e.n.close&&e.n.close(e)}catch(e){throw e}finally{Rb[e.fd]=null}}function nc(e,t,r){if(!e.seekable||!e.n.G)throw new L(J.ia);e.position=e.n.G(e,t,r),e.tb=[]}function oc(e,t,r,n,i,o){if(n<0||i<0)throw new L(J.q);if(0==(2097155&e.flags))throw new L(J.ea);if(N(e.g.mode))throw new L(J.P);if(!e.n.write)throw new L(J.q);1024&e.flags&&nc(e,0,2);var a=!0;if(void 0===i)i=e.position,a=!1;else if(!e.seekable)throw new L(J.ia);t=e.n.write(e,t,r,n,i,o),a||(e.position+=t);try{e.path&&R.onWriteToFile&&R.onWriteToFile(e.path)}catch(e){console.log("FS.trackingDelegate['onWriteToFile']('"+path+"') threw an exception: "+e.message)}return t}function pc(){L||((L=function(e,t){this.g=t,this.qb=function(e){for(var t in this.S=e,J)if(J[t]===e){this.code=t;break}},this.qb(e),this.message=xb[e]}).prototype=Error(),L.prototype.constructor=L,[J.F].forEach(function(e){Mb[e]=new L(e),Mb[e].stack=""}))}function rc(e,t){var r=0;return e&&(r|=365),t&&(r|=146),r}function sc(e,t,r,n){return gc(e=K("string"==typeof e?e:T(e),t),rc(r,n))}function tc(e,t,r,n,i,o){if(i=gc(e=t?K("string"==typeof e?e:T(e),t):e,n=rc(n,i)),r){if("string"==typeof r){e=Array(r.length),t=0;for(var a=r.length;t>2]}function xc(){var e;if(e=X(),!(e=Rb[e]))throw new L(J.ea);return e}var yc={};function Ga(e){Ga.p||(r=Qa(r),Ga.p=!0,assert(n.R),Ga.bb=n.R,n.R=function(){x("cannot dynamically allocate, sbrk now has control")});var t=r;return 0==e||Ga.bb(e)?t:4294967295}e._i64Add=zc;var Ac=1;function Cc(e,t){if(Dc=e,Ec=t,!Fc)return 1;if(0==e)Y=function(){setTimeout(Gc,t)},Hc="timeout";else if(1==e)Y=function(){Ic(Gc)},Hc="rAF";else if(2==e){if(!window.setImmediate){var r=[];window.addEventListener("message",function(e){e.source===window&&"__emcc"===e.data&&(e.stopPropagation(),r.shift()())},!0),window.setImmediate=function(e){r.push(e),window.postMessage("__emcc","*")}}Y=function(){window.setImmediate(Gc)},Hc="immediate"}return 0}function Jc(a,t,r,s,i){e.noExitRuntime=!0,assert(!Fc,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters."),Fc=a,Kc=s;var u=Lc;if(Gc=function(){if(!na)if(0>r-6&63;r=r-6,e=e+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[i]}2==r?(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t)<<4],e+="=="):4==r&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t)<<2],e+="="),l.src="data:audio/x-"+a.substr(-3)+";base64,"+e,s(l)}},l.src=i,ad(function(){s(l)})}});var r=e.canvas;r&&(r.sa=r.requestPointerLock||r.mozRequestPointerLock||r.webkitRequestPointerLock||r.msRequestPointerLock||function(){},r.Fa=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||function(){},r.Fa=r.Fa.bind(document),document.addEventListener("pointerlockchange",t,!1),document.addEventListener("mozpointerlockchange",t,!1),document.addEventListener("webkitpointerlockchange",t,!1),document.addEventListener("mspointerlockchange",t,!1),e.elementPointerLock&&r.addEventListener("click",function(e){!Tc&&r.sa&&(r.sa(),e.preventDefault())},!1))}}function bd(t,r,n,i){if(r&&e.ka&&t==e.canvas)return e.ka;var o,a;if(r){if(a={antialias:!1,alpha:!1},i)for(var s in i)a[s]=i[s];(a=GL.createContext(t,a))&&(o=GL.getContext(a).td),t.style.backgroundColor="black"}else o=t.getContext("2d");return o?(n&&(r||assert("undefined"==typeof GLctx,"cannot set in module if GLctx is used, but we are a non-GL context that would replace it"),e.ka=o,r&&GL.Od(a),e.Td=r,Uc.forEach(function(e){e()}),Vc()),o):null}var cd=!1,dd=void 0,ed=void 0;function fd(t,r,n){function i(){Sc=!1;var t=o.parentNode;(document.webkitFullScreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.mozFullscreenElement||document.fullScreenElement||document.fullscreenElement||document.msFullScreenElement||document.msFullscreenElement||document.webkitCurrentFullScreenElement)===t?(o.Da=document.cancelFullScreen||document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msExitFullscreen||document.exitFullscreen||function(){},o.Da=o.Da.bind(document),dd&&o.sa(),Sc=!0,ed&&gd()):(t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),ed&&hd()),e.onFullScreen&&e.onFullScreen(Sc),id(o)}void 0===(dd=t)&&(dd=!0),void 0===(ed=r)&&(ed=!1),void 0===(jd=n)&&(jd=null);var o=e.canvas;cd||(cd=!0,document.addEventListener("fullscreenchange",i,!1),document.addEventListener("mozfullscreenchange",i,!1),document.addEventListener("webkitfullscreenchange",i,!1),document.addEventListener("MSFullscreenChange",i,!1));var a=document.createElement("div");o.parentNode.insertBefore(a,o),a.appendChild(o),a.p=a.requestFullScreen||a.mozRequestFullScreen||a.msRequestFullscreen||(a.webkitRequestFullScreen?function(){a.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}:null),n?a.p({Ud:n}):a.p()}var kd=0;function ld(e){var t=Date.now();if(0===kd)kd=t+1e3/60;else for(;kd<=t+2;)kd+=1e3/60;t=Math.max(kd-t,0),setTimeout(e,t)}function Ic(e){"undefined"==typeof window?ld(e):(window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||ld),window.requestAnimationFrame(e))}function ad(t){e.noExitRuntime=!0,setTimeout(function(){na||t()},1e4)}function $c(e){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[e.substr(e.lastIndexOf(".")+1)]}function md(e,t,r){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)}function nd(t,r,e){md(t,function(e){assert(e,'Loading data file "'+t+'" failed (no arrayBuffer).'),r(new Uint8Array(e)),lb()},function(){if(!e)throw'Loading data file "'+t+'" failed.';e()}),kb()}var od=[],Wc,Xc,Yc,Zc,jd;function pd(){var t=e.canvas;od.forEach(function(e){e(t.width,t.height)})}function gd(){if("undefined"!=typeof SDL){var e=Sa[SDL.screen+0*n.J>>2];C[SDL.screen+0*n.J>>2]=8388608|e}pd()}function hd(){if("undefined"!=typeof SDL){var e=Sa[SDL.screen+0*n.J>>2];C[SDL.screen+0*n.J>>2]=-8388609&e}pd()}function id(t,r,n){r&&n?(t.ub=r,t.hb=n):(r=t.ub,n=t.hb);var i=r,o=n;if(e.forcedAspectRatio&&0this.length-1||e<0)){var t=e%this.chunkSize;return this.gb(e/this.chunkSize|0)[t]}},a.prototype.pb=function(e){this.gb=e},a.prototype.Ca=function(){var e=new XMLHttpRequest;if(e.open("HEAD",u,!1),e.send(null),!(200<=e.status&&e.status<300||304===e.status))throw Error("Couldn't load "+u+". Status: "+e.status);var t,o=Number(e.getResponseHeader("Content-length")),a=1048576;(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t||(a=o);var s=this;s.pb(function(e){var t=e*a,r=(e+1)*a-1;r=Math.min(r,o-1);if(void 0===s.Y[e]){var n=s.Y;if(r=(e=e.g.e).length)return 0;if(assert(0<=(n=Math.min(e.length-i,n))),e.slice)for(var o=0;o>2]=0;case 21520:return r.tty?-J.q:-J.Q;case 21531:if(i=X(),!r.n.ib)throw new L(J.Q);return r.n.ib(r,n,i);default:x("bad ioctl syscall "+n)}}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},___syscall6:function(e,t){wc=t;try{return mc(xc()),0}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},_emscripten_set_main_loop_timing:Cc,__ZSt18uncaught_exceptionv:tb,___setErrNo:ob,_sbrk:Ga,___cxa_begin_catch:function(e){var t;tb.p--,ub.push(e);e:{if(e&&!vb[e])for(t in vb)if(vb[t].wd===e)break e;t=e}return t&&vb[t].Sd++,e},_emscripten_memcpy_big:function(e,t,r){return E.set(E.subarray(t,t+r),e),e},_sysconf:function(e){switch(e){case 30:return 4096;case 85:return F/4096;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"==typeof navigator&&navigator.hardwareConcurrency||1}return ob(J.q),-1},_pthread_getspecific:function(e){return yc[e]||0},_pthread_self:function(){return 0},_pthread_once:wb,_pthread_key_create:function(e){return 0==e?J.q:(C[e>>2]=Ac,yc[Ac]=0,Ac++,0)},___unlock:function(){},_emscripten_set_main_loop:Jc,_pthread_setspecific:function(e,t){return e in yc?(yc[e]=t,0):J.q},___lock:function(){},_abort:function(){e.abort()},_pthread_cleanup_push:pb,_time:function(e){var t=Date.now()/1e3|0;return e&&(C[e>>2]=t),t},___syscall140:function(e,t){wc=t;try{var r=xc(),n=X(),i=X(),o=X(),a=X();return assert(0===n),nc(r,i,a),C[o>>2]=r.position,r.na&&0===i&&0===a&&(r.na=null),0}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},___syscall146:function(e,t){wc=t;try{var r,n=xc(),i=X();e:{for(var o=X(),a=0,s=0;s>2],C[i+(8*s+4)>>2],void 0);if(u<0){r=-1;break e}a+=u}r=a}return r}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},STACKTOP:m,STACK_MAX:Va,tempDoublePtr:mb,ABORT:na,cttz_i8:qd};var Z=function(e,t,r){"use asm";var n=e.Int8Array;var i=e.Int16Array;var o=e.Int32Array;var a=e.Uint8Array;var s=e.Uint16Array;var u=e.Uint32Array;var l=e.Float32Array;var c=e.Float64Array;var de=new n(r);var Q=new i(r);var pe=new o(r);var ge=new a(r);var me=new s(r);var f=new u(r);var h=new l(r);var ee=new c(r);var d=e.byteLength;var ve=t.STACKTOP|0;var p=t.STACK_MAX|0;var te=t.tempDoublePtr|0;var g=t.ABORT|0;var m=t.cttz_i8|0;var v=0;var _=0;var y=0;var b=0;var x=e.NaN,w=e.Infinity;var T=0,S=0,M=0,P=0,C=0.0,k=0,E=0,A=0,O=0.0;var re=0;var R=0;var I=0;var D=0;var L=0;var N=0;var j=0;var F=0;var B=0;var z=0;var U=e.Math.floor;var X=e.Math.abs;var q=e.Math.sqrt;var H=e.Math.pow;var Y=e.Math.cos;var G=e.Math.sin;var W=e.Math.tan;var V=e.Math.acos;var K=e.Math.asin;var Z=e.Math.atan;var J=e.Math.atan2;var $=e.Math.exp;var ne=e.Math.log;var ie=e.Math.ceil;var _e=e.Math.imul;var oe=e.Math.min;var ae=e.Math.clz32;var se=t.abort;var ue=t.assert;var le=t.invoke_iiii;var ce=t.invoke_viiiii;var fe=t.invoke_vi;var he=t.invoke_ii;var ye=t.invoke_viii;var be=t.invoke_v;var xe=t.invoke_viiiiii;var we=t.invoke_iiiiii;var Te=t.invoke_viiii;var Se=t._pthread_cleanup_pop;var Me=t.___syscall54;var Pe=t.___syscall6;var Ce=t._emscripten_set_main_loop_timing;var ke=t.__ZSt18uncaught_exceptionv;var Ee=t.___setErrNo;var Ae=t._sbrk;var Oe=t.___cxa_begin_catch;var Re=t._emscripten_memcpy_big;var Ie=t._sysconf;var De=t._pthread_getspecific;var Le=t._pthread_self;var Ne=t._pthread_once;var je=t._pthread_key_create;var Fe=t.___unlock;var Be=t._emscripten_set_main_loop;var ze=t._pthread_setspecific;var Ue=t.___lock;var Xe=t._abort;var qe=t._pthread_cleanup_push;var He=t._time;var Ye=t.___syscall140;var Ge=t.___syscall146;var We=0.0;function Ve(e){if(d(e)&16777215||d(e)<=16777215||d(e)>2147483648)return false;de=new n(e);Q=new i(e);pe=new o(e);ge=new a(e);me=new s(e);f=new u(e);h=new l(e);ee=new c(e);r=e;return true}function Ke(e){e=e|0;var t=0;t=ve;ve=ve+e|0;ve=ve+15&-16;return t|0}function Ze(){return ve|0}function Je(e){e=e|0;ve=e}function $e(e,t){e=e|0;t=t|0;ve=e;p=t}function Qe(e,t){e=e|0;t=t|0;if(!v){v=e;_=t}}function et(e){e=e|0;de[te>>0]=de[e>>0];de[te+1>>0]=de[e+1>>0];de[te+2>>0]=de[e+2>>0];de[te+3>>0]=de[e+3>>0]}function tt(e){e=e|0;de[te>>0]=de[e>>0];de[te+1>>0]=de[e+1>>0];de[te+2>>0]=de[e+2>>0];de[te+3>>0]=de[e+3>>0];de[te+4>>0]=de[e+4>>0];de[te+5>>0]=de[e+5>>0];de[te+6>>0]=de[e+6>>0];de[te+7>>0]=de[e+7>>0]}function rt(e){e=e|0;re=e}function nt(){return re|0}function it(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0;g=ve;ve=ve+608|0;h=g+88|0;f=g+72|0;u=g+64|0;s=g+48|0;a=g+24|0;o=g;c=g+96|0;d=g+92|0;l=e+4|0;p=e+8|0;if((pe[l>>2]|0)>>>0>(pe[p>>2]|0)>>>0){pe[o>>2]=1154;pe[o+4>>2]=2120;pe[o+8>>2]=1133;br(c,1100,o)|0;yr(c,g+16|0)|0}if((2147418112/(n>>>0)|0)>>>0<=t>>>0){pe[a>>2]=1154;pe[a+4>>2]=2121;pe[a+8>>2]=1169;br(c,1100,a)|0;yr(c,g+40|0)|0}a=pe[p>>2]|0;if(a>>>0>=t>>>0){p=1;ve=g;return p|0}do{if(r){if(t){o=t+-1|0;if(!(o&t)){o=11;break}else t=o}else t=-1;t=t>>>16|t;t=t>>>8|t;t=t>>>4|t;t=t>>>2|t;t=(t>>>1|t)+1|0;o=10}else o=10}while(0);if((o|0)==10)if(!t){t=0;o=12}else o=11;if((o|0)==11)if(t>>>0<=a>>>0)o=12;if((o|0)==12){pe[s>>2]=1154;pe[s+4>>2]=2130;pe[s+8>>2]=1217;br(c,1100,s)|0;yr(c,u)|0}r=_e(t,n)|0;do{if(!i){o=ot(pe[e>>2]|0,r,d,1)|0;if(!o){p=0;ve=g;return p|0}else{pe[e>>2]=o;break}}else{a=at(r,d)|0;if(!a){p=0;ve=g;return p|0}On[i&0](a,pe[e>>2]|0,pe[l>>2]|0);o=pe[e>>2]|0;do{if(o)if(!(o&7)){Dn[pe[104>>2]&1](o,0,0,1,pe[27]|0)|0;break}else{pe[f>>2]=1154;pe[f+4>>2]=2499;pe[f+8>>2]=1516;br(c,1100,f)|0;yr(c,h)|0;break}}while(0);pe[e>>2]=a}}while(0);o=pe[d>>2]|0;if(o>>>0>r>>>0)t=(o>>>0)/(n>>>0)|0;pe[p>>2]=t;p=1;ve=g;return p|0}function ot(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0;l=ve;ve=ve+592|0;u=l+48|0;o=l+24|0;i=l;s=l+72|0;a=l+68|0;if(e&7){pe[i>>2]=1154;pe[i+4>>2]=2499;pe[i+8>>2]=1494;br(s,1100,i)|0;yr(s,l+16|0)|0;u=0;ve=l;return u|0}if(t>>>0>2147418112){pe[o>>2]=1154;pe[o+4>>2]=2499;pe[o+8>>2]=1387;br(s,1100,o)|0;yr(s,l+40|0)|0;u=0;ve=l;return u|0}pe[a>>2]=t;n=Dn[pe[104>>2]&1](e,t,a,n,pe[27]|0)|0;if(r)pe[r>>2]=pe[a>>2];if(!(n&7)){u=n;ve=l;return u|0}pe[u>>2]=1154;pe[u+4>>2]=2551;pe[u+8>>2]=1440;br(s,1100,u)|0;yr(s,l+64|0)|0;u=n;ve=l;return u|0}function at(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0;u=ve;ve=ve+592|0;a=u+48|0;s=u+24|0;r=u;o=u+72|0;i=u+68|0;n=e+3&-4;n=(n|0)!=0?n:4;if(n>>>0>2147418112){pe[r>>2]=1154;pe[r+4>>2]=2499;pe[r+8>>2]=1387;br(o,1100,r)|0;yr(o,u+16|0)|0;s=0;ve=u;return s|0}pe[i>>2]=n;r=Dn[pe[104>>2]&1](0,n,i,1,pe[27]|0)|0;e=pe[i>>2]|0;if(t)pe[t>>2]=e;if((r|0)==0|e>>>0>>0){pe[s>>2]=1154;pe[s+4>>2]=2499;pe[s+8>>2]=1413;br(o,1100,s)|0;yr(o,u+40|0)|0;s=0;ve=u;return s|0}if(!(r&7)){s=r;ve=u;return s|0}pe[a>>2]=1154;pe[a+4>>2]=2526;pe[a+8>>2]=1440;br(o,1100,a)|0;yr(o,u+64|0)|0;s=r;ve=u;return s|0}function st(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0;F=ve;ve=ve+960|0;L=F+232|0;D=F+216|0;I=F+208|0;R=F+192|0;O=F+184|0;A=F+168|0;E=F+160|0;k=F+144|0;M=F+136|0;S=F+120|0;T=F+112|0;w=F+96|0;y=F+88|0;_=F+72|0;v=F+64|0;m=F+48|0;f=F+40|0;d=F+24|0;h=F+16|0;c=F;C=F+440|0;N=F+376|0;j=F+304|0;g=F+236|0;if((t|0)==0|n>>>0>11){e=0;ve=F;return e|0}pe[e>>2]=t;i=j;o=i+68|0;do{pe[i>>2]=0;i=i+4|0}while((i|0)<(o|0));o=0;do{i=de[r+o>>0]|0;if(i<<24>>24){P=j+((i&255)<<2)|0;pe[P>>2]=(pe[P>>2]|0)+1}o=o+1|0}while((o|0)!=(t|0));o=0;l=1;a=0;s=-1;u=0;while(1){i=pe[j+(l<<2)>>2]|0;if(!i)pe[e+28+(l+-1<<2)>>2]=0;else{P=l+-1|0;pe[N+(P<<2)>>2]=o;o=i+o|0;x=16-l|0;pe[e+28+(P<<2)>>2]=(o+-1<>2]=u;pe[g+(l<<2)>>2]=u;a=a>>>0>l>>>0?a:l;s=s>>>0>>0?s:l;u=i+u|0}l=l+1|0;if((l|0)==17){P=a;break}else o=o<<1}pe[e+4>>2]=u;o=e+172|0;do{if(u>>>0>(pe[o>>2]|0)>>>0){pe[o>>2]=u;if(u){i=u+-1|0;if(i&u)p=14}else{i=-1;p=14}if((p|0)==14){x=i>>>16|i;x=x>>>8|x;x=x>>>4|x;x=x>>>2|x;x=(x>>>1|x)+1|0;pe[o>>2]=x>>>0>t>>>0?t:x}a=e+176|0;i=pe[a>>2]|0;do{if(i){x=pe[i+-4>>2]|0;i=i+-8|0;if(!((x|0)!=0?(x|0)==(~pe[i>>2]|0):0)){pe[c>>2]=1154;pe[c+4>>2]=644;pe[c+8>>2]=1863;br(C,1100,c)|0;yr(C,h)|0}if(!(i&7)){Dn[pe[104>>2]&1](i,0,0,1,pe[27]|0)|0;break}else{pe[d>>2]=1154;pe[d+4>>2]=2499;pe[d+8>>2]=1516;br(C,1100,d)|0;yr(C,f)|0;break}}}while(0);o=pe[o>>2]|0;o=(o|0)!=0?o:1;i=at((o<<1)+8|0,0)|0;if(!i){pe[a>>2]=0;i=0;break}else{pe[i+4>>2]=o;pe[i>>2]=~o;pe[a>>2]=i+8;p=25;break}}else p=25}while(0);e:do{if((p|0)==25){x=e+24|0;de[x>>0]=s;de[e+25>>0]=P;o=e+176|0;a=0;do{b=de[r+a>>0]|0;i=b&255;if(b<<24>>24){if(!(pe[j+(i<<2)>>2]|0)){pe[m>>2]=1154;pe[m+4>>2]=2273;pe[m+8>>2]=1261;br(C,1100,m)|0;yr(C,v)|0}b=g+(i<<2)|0;i=pe[b>>2]|0;pe[b>>2]=i+1;if(i>>>0>=u>>>0){pe[_>>2]=1154;pe[_+4>>2]=2277;pe[_+8>>2]=1274;br(C,1100,_)|0;yr(C,y)|0}Q[(pe[o>>2]|0)+(i<<1)>>1]=a}a=a+1|0}while((a|0)!=(t|0));i=de[x>>0]|0;y=(i&255)>>>0>>0?n:0;b=e+8|0;pe[b>>2]=y;_=(y|0)!=0;if(_){v=1<>>0>(pe[i>>2]|0)>>>0){pe[i>>2]=v;a=e+168|0;i=pe[a>>2]|0;do{if(i){m=pe[i+-4>>2]|0;i=i+-8|0;if(!((m|0)!=0?(m|0)==(~pe[i>>2]|0):0)){pe[w>>2]=1154;pe[w+4>>2]=644;pe[w+8>>2]=1863;br(C,1100,w)|0;yr(C,T)|0}if(!(i&7)){Dn[pe[104>>2]&1](i,0,0,1,pe[27]|0)|0;break}else{pe[S>>2]=1154;pe[S+4>>2]=2499;pe[S+8>>2]=1516;br(C,1100,S)|0;yr(C,M)|0;break}}}while(0);i=v<<2;o=at(i+8|0,0)|0;if(!o){pe[a>>2]=0;i=0;break e}else{M=o+8|0;pe[o+4>>2]=v;pe[o>>2]=~v;pe[a>>2]=M;o=M;break}}else{o=e+168|0;i=v<<2;a=o;o=pe[o>>2]|0}}while(0);Vr(o|0,-1,i|0)|0;p=e+176|0;m=1;do{if(pe[j+(m<<2)>>2]|0){t=y-m|0;g=1<>2]|0;if(o>>>0>=16){pe[k>>2]=1154;pe[k+4>>2]=1953;pe[k+8>>2]=1737;br(C,1100,k)|0;yr(C,E)|0}i=pe[e+28+(o<<2)>>2]|0;if(!i)d=-1;else d=(i+-1|0)>>>(16-m|0);if(s>>>0<=d>>>0){f=(pe[e+96+(o<<2)>>2]|0)-s|0;h=m<<16;do{i=me[(pe[p>>2]|0)+(f+s<<1)>>1]|0;if((ge[r+i>>0]|0|0)!=(m|0)){pe[A>>2]=1154;pe[A+4>>2]=2319;pe[A+8>>2]=1303;br(C,1100,A)|0;yr(C,O)|0}c=s<>>0>=v>>>0){pe[R>>2]=1154;pe[R+4>>2]=2325;pe[R+8>>2]=1337;br(C,1100,R)|0;yr(C,I)|0}i=pe[a>>2]|0;if((pe[i+(u<<2)>>2]|0)!=-1){pe[D>>2]=1154;pe[D+4>>2]=2327;pe[D+8>>2]=1360;br(C,1100,D)|0;yr(C,L)|0;i=pe[a>>2]|0}pe[i+(u<<2)>>2]=o;l=l+1|0}while(l>>>0>>0);s=s+1|0}while(s>>>0<=d>>>0)}}m=m+1|0}while(y>>>0>=m>>>0);i=de[x>>0]|0}o=e+96|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N>>2]|0);o=e+100|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+4>>2]|0);o=e+104|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+8>>2]|0);o=e+108|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+12>>2]|0);o=e+112|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+16>>2]|0);o=e+116|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+20>>2]|0);o=e+120|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+24>>2]|0);o=e+124|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+28>>2]|0);o=e+128|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+32>>2]|0);o=e+132|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+36>>2]|0);o=e+136|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+40>>2]|0);o=e+140|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+44>>2]|0);o=e+144|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+48>>2]|0);o=e+148|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+52>>2]|0);o=e+152|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+56>>2]|0);o=e+156|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+60>>2]|0);o=e+16|0;pe[o>>2]=0;a=e+20|0;pe[a>>2]=i&255;t:do{if(_){while(1){if(!n)break t;i=n+-1|0;if(!(pe[j+(n<<2)>>2]|0))n=i;else break}pe[o>>2]=pe[e+28+(i<<2)>>2];i=y+1|0;pe[a>>2]=i;if(i>>>0<=P>>>0){while(1){if(pe[j+(i<<2)>>2]|0)break;i=i+1|0;if(i>>>0>P>>>0)break t}pe[a>>2]=i}}}while(0);pe[e+92>>2]=-1;pe[e+160>>2]=1048575;pe[e+12>>2]=32-(pe[b>>2]|0);i=1}}while(0);e=i;ve=F;return e|0}function ut(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0;if(!e){i=zr(t)|0;if(!r){r=i;return r|0}if(!i)o=0;else o=qr(i)|0;pe[r>>2]=o;r=i;return r|0}if(!t){Ur(e);if(!r){r=0;return r|0}pe[r>>2]=0;r=0;return r|0}i=Xr(e,t)|0;o=(i|0)!=0;if(o|n^1)o=o?i:e;else{i=Xr(e,t)|0;o=(i|0)==0?e:i}if(!r){r=i;return r|0}t=qr(o)|0;pe[r>>2]=t;r=i;return r|0}function lt(e,t,r){e=e|0;t=t|0;r=r|0;var n=0;if(!((e|0)!=0&t>>>0>73&(r|0)!=0)){r=0;return r|0}if((pe[r>>2]|0)!=40|t>>>0<74){r=0;return r|0}if(((ge[e>>0]|0)<<8|(ge[e+1>>0]|0)|0)!=18552){r=0;return r|0}if(((ge[e+2>>0]|0)<<8|(ge[e+3>>0]|0))>>>0<74){r=0;return r|0}if(((ge[e+7>>0]|0)<<16|(ge[e+6>>0]|0)<<24|(ge[e+8>>0]|0)<<8|(ge[e+9>>0]|0))>>>0>t>>>0){r=0;return r|0}pe[r+4>>2]=(ge[e+12>>0]|0)<<8|(ge[e+13>>0]|0);pe[r+8>>2]=(ge[e+14>>0]|0)<<8|(ge[e+15>>0]|0);pe[r+12>>2]=ge[e+16>>0];pe[r+16>>2]=ge[e+17>>0];t=e+18|0;n=r+32|0;pe[n>>2]=ge[t>>0];pe[n+4>>2]=0;t=de[t>>0]|0;pe[r+20>>2]=t<<24>>24==0|t<<24>>24==9?8:16;pe[r+24>>2]=(ge[e+26>>0]|0)<<16|(ge[e+25>>0]|0)<<24|(ge[e+27>>0]|0)<<8|(ge[e+28>>0]|0);pe[r+28>>2]=(ge[e+30>>0]|0)<<16|(ge[e+29>>0]|0)<<24|(ge[e+31>>0]|0)<<8|(ge[e+32>>0]|0);r=1;return r|0}function ct(e){e=e|0;Oe(e|0)|0;Ut()}function ft(e){e=e|0;var t=0,r=0,n=0,i=0,o=0;o=ve;ve=ve+544|0;i=o;n=o+24|0;t=pe[e+20>>2]|0;if(t)ht(t);t=e+4|0;r=pe[t>>2]|0;if(!r){i=e+16|0;de[i>>0]=0;ve=o;return}if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[i>>2]=1154;pe[i+4>>2]=2499;pe[i+8>>2]=1516;br(n,1100,i)|0;yr(n,o+16|0)|0}pe[t>>2]=0;pe[e+8>>2]=0;pe[e+12>>2]=0;i=e+16|0;de[i>>0]=0;ve=o;return}function ht(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;d=ve;ve=ve+640|0;h=d+112|0;f=d+96|0;c=d+88|0;l=d+72|0;u=d+64|0;s=d+48|0;n=d+40|0;o=d+24|0;i=d+16|0;r=d;a=d+120|0;if(!e){ve=d;return}t=pe[e+168>>2]|0;do{if(t){p=pe[t+-4>>2]|0;t=t+-8|0;if(!((p|0)!=0?(p|0)==(~pe[t>>2]|0):0)){pe[r>>2]=1154;pe[r+4>>2]=644;pe[r+8>>2]=1863;br(a,1100,r)|0;yr(a,i)|0}if(!(t&7)){Dn[pe[104>>2]&1](t,0,0,1,pe[27]|0)|0;break}else{pe[o>>2]=1154;pe[o+4>>2]=2499;pe[o+8>>2]=1516;br(a,1100,o)|0;yr(a,n)|0;break}}}while(0);t=pe[e+176>>2]|0;do{if(t){p=pe[t+-4>>2]|0;t=t+-8|0;if(!((p|0)!=0?(p|0)==(~pe[t>>2]|0):0)){pe[s>>2]=1154;pe[s+4>>2]=644;pe[s+8>>2]=1863;br(a,1100,s)|0;yr(a,u)|0}if(!(t&7)){Dn[pe[104>>2]&1](t,0,0,1,pe[27]|0)|0;break}else{pe[l>>2]=1154;pe[l+4>>2]=2499;pe[l+8>>2]=1516;br(a,1100,l)|0;yr(a,c)|0;break}}}while(0);if(!(e&7)){Dn[pe[104>>2]&1](e,0,0,1,pe[27]|0)|0;ve=d;return}else{pe[f>>2]=1154;pe[f+4>>2]=2499;pe[f+8>>2]=1516;br(a,1100,f)|0;yr(a,h)|0;ve=d;return}}function dt(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+560|0;a=c+40|0;s=c+24|0;t=c;o=c+48|0;i=e+8|0;r=pe[i>>2]|0;if((r+-1|0)>>>0>=8192){pe[t>>2]=1154;pe[t+4>>2]=2997;pe[t+8>>2]=1541;br(o,1100,t)|0;yr(o,c+16|0)|0}pe[e>>2]=r;n=e+20|0;t=pe[n>>2]|0;if(!t){t=at(180,0)|0;if(!t)t=0;else{l=t+164|0;pe[l>>2]=0;pe[l+4>>2]=0;pe[l+8>>2]=0;pe[l+12>>2]=0}pe[n>>2]=t;l=t;u=pe[e>>2]|0}else{l=t;u=r}if(!(pe[i>>2]|0)){pe[s>>2]=1154;pe[s+4>>2]=903;pe[s+8>>2]=1781;br(o,1100,s)|0;yr(o,a)|0;o=pe[e>>2]|0}else o=u;i=pe[e+4>>2]|0;if(o>>>0>16){r=o;t=0}else{e=0;l=st(l,u,i,e)|0;ve=c;return l|0}while(1){n=t+1|0;if(r>>>0>3){r=r>>>1;t=n}else{r=n;break}}e=t+2+((r|0)!=32&1<>>0>>0&1)|0;e=e>>>0<11?e&255:11;l=st(l,u,i,e)|0;ve=c;return l|0}function pt(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0;L=ve;ve=ve+800|0;A=L+256|0;E=L+240|0;k=L+232|0;C=L+216|0;P=L+208|0;M=L+192|0;S=L+184|0;T=L+168|0;w=L+160|0;x=L+144|0;b=L+136|0;y=L+120|0;_=L+112|0;v=L+96|0;m=L+88|0;g=L+72|0;f=L+64|0;c=L+48|0;s=L+40|0;u=L+24|0;o=L+16|0;i=L;I=L+288|0;D=L+264|0;O=gt(e,14)|0;if(!O){pe[t>>2]=0;r=t+4|0;n=pe[r>>2]|0;if(n){if(!(n&7))Dn[pe[104>>2]&1](n,0,0,1,pe[27]|0)|0;else{pe[i>>2]=1154;pe[i+4>>2]=2499;pe[i+8>>2]=1516;br(I,1100,i)|0;yr(I,o)|0}pe[r>>2]=0;pe[t+8>>2]=0;pe[t+12>>2]=0}de[t+16>>0]=0;r=t+20|0;n=pe[r>>2]|0;if(!n){t=1;ve=L;return t|0}ht(n);pe[r>>2]=0;t=1;ve=L;return t|0}d=t+4|0;p=t+8|0;r=pe[p>>2]|0;if((r|0)!=(O|0)){if(r>>>0<=O>>>0){do{if((pe[t+12>>2]|0)>>>0>>0){if(it(d,O,(r+1|0)==(O|0),1,0)|0){r=pe[p>>2]|0;break}de[t+16>>0]=1;t=0;ve=L;return t|0}}while(0);Vr((pe[d>>2]|0)+r|0,0,O-r|0)|0}pe[p>>2]=O}Vr(pe[d>>2]|0,0,O|0)|0;h=e+20|0;r=pe[h>>2]|0;if((r|0)<5){o=e+4|0;a=e+8|0;i=e+16|0;do{n=pe[o>>2]|0;if((n|0)==(pe[a>>2]|0))n=0;else{pe[o>>2]=n+1;n=ge[n>>0]|0}r=r+8|0;pe[h>>2]=r;if((r|0)>=33){pe[u>>2]=1154;pe[u+4>>2]=3199;pe[u+8>>2]=1650;br(I,1100,u)|0;yr(I,s)|0;r=pe[h>>2]|0}n=n<<32-r|pe[i>>2];pe[i>>2]=n}while((r|0)<5)}else{n=e+16|0;i=n;n=pe[n>>2]|0}l=n>>>27;pe[i>>2]=n<<5;pe[h>>2]=r+-5;if((l+-1|0)>>>0>20){t=0;ve=L;return t|0}pe[D+20>>2]=0;pe[D>>2]=0;pe[D+4>>2]=0;pe[D+8>>2]=0;pe[D+12>>2]=0;de[D+16>>0]=0;r=D+4|0;n=D+8|0;e:do{if(it(r,21,0,1,0)|0){s=pe[n>>2]|0;u=pe[r>>2]|0;Vr(u+s|0,0,21-s|0)|0;pe[n>>2]=21;if(l){i=e+4|0;o=e+8|0;a=e+16|0;s=0;do{r=pe[h>>2]|0;if((r|0)<3)do{n=pe[i>>2]|0;if((n|0)==(pe[o>>2]|0))n=0;else{pe[i>>2]=n+1;n=ge[n>>0]|0}r=r+8|0;pe[h>>2]=r;if((r|0)>=33){pe[c>>2]=1154;pe[c+4>>2]=3199;pe[c+8>>2]=1650;br(I,1100,c)|0;yr(I,f)|0;r=pe[h>>2]|0}n=n<<32-r|pe[a>>2];pe[a>>2]=n}while((r|0)<3);else n=pe[a>>2]|0;pe[a>>2]=n<<3;pe[h>>2]=r+-3;de[u+(ge[1611+s>>0]|0)>>0]=n>>>29;s=s+1|0}while((s|0)!=(l|0))}if(dt(D)|0){s=e+4|0;u=e+8|0;l=e+16|0;n=0;t:while(1){a=O-n|0;r=mt(e,D)|0;r:do{if(r>>>0<17){if((pe[p>>2]|0)>>>0<=n>>>0){pe[g>>2]=1154;pe[g+4>>2]=903;pe[g+8>>2]=1781;br(I,1100,g)|0;yr(I,m)|0}de[(pe[d>>2]|0)+n>>0]=r;r=n+1|0}else switch(r|0){case 17:{r=pe[h>>2]|0;if((r|0)<3)do{i=pe[s>>2]|0;if((i|0)==(pe[u>>2]|0))i=0;else{pe[s>>2]=i+1;i=ge[i>>0]|0}r=r+8|0;pe[h>>2]=r;if((r|0)>=33){pe[v>>2]=1154;pe[v+4>>2]=3199;pe[v+8>>2]=1650;br(I,1100,v)|0;yr(I,_)|0;r=pe[h>>2]|0}i=i<<32-r|pe[l>>2];pe[l>>2]=i}while((r|0)<3);else i=pe[l>>2]|0;pe[l>>2]=i<<3;pe[h>>2]=r+-3;r=(i>>>29)+3|0;if(r>>>0>a>>>0){r=0;break e}r=r+n|0;break r}case 18:{r=pe[h>>2]|0;if((r|0)<7)do{i=pe[s>>2]|0;if((i|0)==(pe[u>>2]|0))i=0;else{pe[s>>2]=i+1;i=ge[i>>0]|0}r=r+8|0;pe[h>>2]=r;if((r|0)>=33){pe[y>>2]=1154;pe[y+4>>2]=3199;pe[y+8>>2]=1650;br(I,1100,y)|0;yr(I,b)|0;r=pe[h>>2]|0}i=i<<32-r|pe[l>>2];pe[l>>2]=i}while((r|0)<7);else i=pe[l>>2]|0;pe[l>>2]=i<<7;pe[h>>2]=r+-7;r=(i>>>25)+11|0;if(r>>>0>a>>>0){r=0;break e}r=r+n|0;break r}default:{if((r+-19|0)>>>0>=2){R=90;break t}o=pe[h>>2]|0;if((r|0)==19){if((o|0)<2){i=o;while(1){r=pe[s>>2]|0;if((r|0)==(pe[u>>2]|0))o=0;else{pe[s>>2]=r+1;o=ge[r>>0]|0}r=i+8|0;pe[h>>2]=r;if((r|0)>=33){pe[x>>2]=1154;pe[x+4>>2]=3199;pe[x+8>>2]=1650;br(I,1100,x)|0;yr(I,w)|0;r=pe[h>>2]|0}i=o<<32-r|pe[l>>2];pe[l>>2]=i;if((r|0)<2)i=r;else break}}else{i=pe[l>>2]|0;r=o}pe[l>>2]=i<<2;pe[h>>2]=r+-2;o=(i>>>30)+3|0}else{if((o|0)<6){i=o;while(1){r=pe[s>>2]|0;if((r|0)==(pe[u>>2]|0))o=0;else{pe[s>>2]=r+1;o=ge[r>>0]|0}r=i+8|0;pe[h>>2]=r;if((r|0)>=33){pe[T>>2]=1154;pe[T+4>>2]=3199;pe[T+8>>2]=1650;br(I,1100,T)|0;yr(I,S)|0;r=pe[h>>2]|0}i=o<<32-r|pe[l>>2];pe[l>>2]=i;if((r|0)<6)i=r;else break}}else{i=pe[l>>2]|0;r=o}pe[l>>2]=i<<6;pe[h>>2]=r+-6;o=(i>>>26)+7|0}if((n|0)==0|o>>>0>a>>>0){r=0;break e}r=n+-1|0;if((pe[p>>2]|0)>>>0<=r>>>0){pe[M>>2]=1154;pe[M+4>>2]=903;pe[M+8>>2]=1781;br(I,1100,M)|0;yr(I,P)|0}i=de[(pe[d>>2]|0)+r>>0]|0;if(!(i<<24>>24)){r=0;break e}r=o+n|0;if(n>>>0>=r>>>0){r=n;break r}do{if((pe[p>>2]|0)>>>0<=n>>>0){pe[C>>2]=1154;pe[C+4>>2]=903;pe[C+8>>2]=1781;br(I,1100,C)|0;yr(I,k)|0}de[(pe[d>>2]|0)+n>>0]=i;n=n+1|0}while((n|0)!=(r|0))}}}while(0);if(O>>>0>r>>>0)n=r;else break}if((R|0)==90){pe[E>>2]=1154;pe[E+4>>2]=3140;pe[E+8>>2]=1632;br(I,1100,E)|0;yr(I,A)|0;r=0;break}if((O|0)==(r|0))r=dt(t)|0;else r=0}else r=0}else{de[D+16>>0]=1;r=0}}while(0);ft(D);t=r;ve=L;return t|0}function gt(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+544|0;s=c+16|0;a=c;o=c+24|0;if(!t){l=0;ve=c;return l|0}if(t>>>0<=16){l=vt(e,t)|0;ve=c;return l|0}u=vt(e,t+-16|0)|0;l=e+20|0;t=pe[l>>2]|0;if((t|0)<16){n=e+4|0;i=e+8|0;r=e+16|0;do{e=pe[n>>2]|0;if((e|0)==(pe[i>>2]|0))e=0;else{pe[n>>2]=e+1;e=ge[e>>0]|0}t=t+8|0;pe[l>>2]=t;if((t|0)>=33){pe[a>>2]=1154;pe[a+4>>2]=3199;pe[a+8>>2]=1650;br(o,1100,a)|0;yr(o,s)|0;t=pe[l>>2]|0}e=e<<32-t|pe[r>>2];pe[r>>2]=e}while((t|0)<16)}else{e=e+16|0;r=e;e=pe[e>>2]|0}pe[r>>2]=e<<16;pe[l>>2]=t+-16;l=e>>>16|u<<16;ve=c;return l|0}function mt(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0;y=ve;ve=ve+608|0;g=y+88|0;p=y+72|0;h=y+64|0;f=y+48|0;c=y+40|0;d=y+24|0;l=y+16|0;u=y;v=y+96|0;m=pe[t+20>>2]|0;_=e+20|0;s=pe[_>>2]|0;do{if((s|0)<24){a=e+4|0;n=pe[a>>2]|0;i=pe[e+8>>2]|0;r=n>>>0>>0;if((s|0)>=16){if(r){pe[a>>2]=n+1;r=ge[n>>0]|0}else r=0;pe[_>>2]=s+8;a=e+16|0;o=r<<24-s|pe[a>>2];pe[a>>2]=o;break}if(r){o=(ge[n>>0]|0)<<8;r=n+1|0}else{o=0;r=n}if(r>>>0>>0){n=ge[r>>0]|0;r=r+1|0}else n=0;pe[a>>2]=r;pe[_>>2]=s+16;a=e+16|0;o=(n|o)<<16-s|pe[a>>2];pe[a>>2]=o}else{o=e+16|0;a=o;o=pe[o>>2]|0}}while(0);i=(o>>>16)+1|0;do{if(i>>>0<=(pe[m+16>>2]|0)>>>0){n=pe[(pe[m+168>>2]|0)+(o>>>(32-(pe[m+8>>2]|0)|0)<<2)>>2]|0;if((n|0)==-1){pe[u>>2]=1154;pe[u+4>>2]=3244;pe[u+8>>2]=1677;br(v,1100,u)|0;yr(v,l)|0}r=n&65535;n=n>>>16;if((pe[t+8>>2]|0)>>>0<=r>>>0){pe[d>>2]=1154;pe[d+4>>2]=902;pe[d+8>>2]=1781;br(v,1100,d)|0;yr(v,c)|0}if((ge[(pe[t+4>>2]|0)+r>>0]|0|0)!=(n|0)){pe[f>>2]=1154;pe[f+4>>2]=3248;pe[f+8>>2]=1694;br(v,1100,f)|0;yr(v,h)|0}}else{n=pe[m+20>>2]|0;while(1){r=n+-1|0;if(i>>>0>(pe[m+28+(r<<2)>>2]|0)>>>0)n=n+1|0;else break}r=(o>>>(32-n|0))+(pe[m+96+(r<<2)>>2]|0)|0;if(r>>>0<(pe[t>>2]|0)>>>0){r=me[(pe[m+176>>2]|0)+(r<<1)>>1]|0;break}pe[p>>2]=1154;pe[p+4>>2]=3266;pe[p+8>>2]=1632;br(v,1100,p)|0;yr(v,g)|0;_=0;ve=y;return _|0}}while(0);pe[a>>2]=pe[a>>2]<>2]=(pe[_>>2]|0)-n;_=r;ve=y;return _|0}function vt(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+560|0;s=c+40|0;u=c+24|0;r=c;a=c+48|0;if(t>>>0>=33){pe[r>>2]=1154;pe[r+4>>2]=3190;pe[r+8>>2]=1634;br(a,1100,r)|0;yr(a,c+16|0)|0}l=e+20|0;r=pe[l>>2]|0;if((r|0)>=(t|0)){o=e+16|0;a=o;o=pe[o>>2]|0;s=r;u=32-t|0;u=o>>>u;o=o<>2]=o;t=s-t|0;pe[l>>2]=t;ve=c;return u|0}i=e+4|0;o=e+8|0;n=e+16|0;do{e=pe[i>>2]|0;if((e|0)==(pe[o>>2]|0))e=0;else{pe[i>>2]=e+1;e=ge[e>>0]|0}r=r+8|0;pe[l>>2]=r;if((r|0)>=33){pe[u>>2]=1154;pe[u+4>>2]=3199;pe[u+8>>2]=1650;br(a,1100,u)|0;yr(a,s)|0;r=pe[l>>2]|0}e=e<<32-r|pe[n>>2];pe[n>>2]=e}while((r|0)<(t|0));u=32-t|0;u=e>>>u;s=e<>2]=s;t=r-t|0;pe[l>>2]=t;ve=c;return u|0}function _t(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0;p=ve;ve=ve+544|0;h=p+16|0;f=p;c=p+24|0;if((e|0)==0|t>>>0<62){d=0;ve=p;return d|0}l=at(300,0)|0;if(!l){d=0;ve=p;return d|0}pe[l>>2]=519686845;r=l+4|0;pe[r>>2]=0;n=l+8|0;pe[n>>2]=0;u=l+88|0;i=l+136|0;o=l+160|0;a=u;s=a+44|0;do{pe[a>>2]=0;a=a+4|0}while((a|0)<(s|0));de[u+44>>0]=0;g=l+184|0;a=l+208|0;s=l+232|0;m=l+252|0;pe[m>>2]=0;pe[m+4>>2]=0;pe[m+8>>2]=0;de[m+12>>0]=0;m=l+268|0;pe[m>>2]=0;pe[m+4>>2]=0;pe[m+8>>2]=0;de[m+12>>0]=0;m=l+284|0;pe[m>>2]=0;pe[m+4>>2]=0;pe[m+8>>2]=0;de[m+12>>0]=0;pe[i>>2]=0;pe[i+4>>2]=0;pe[i+8>>2]=0;pe[i+12>>2]=0;pe[i+16>>2]=0;de[i+20>>0]=0;pe[o>>2]=0;pe[o+4>>2]=0;pe[o+8>>2]=0;pe[o+12>>2]=0;pe[o+16>>2]=0;de[o+20>>0]=0;pe[g>>2]=0;pe[g+4>>2]=0;pe[g+8>>2]=0;pe[g+12>>2]=0;pe[g+16>>2]=0;de[g+20>>0]=0;pe[a>>2]=0;pe[a+4>>2]=0;pe[a+8>>2]=0;pe[a+12>>2]=0;pe[a+16>>2]=0;de[a+20>>0]=0;pe[s>>2]=0;pe[s+4>>2]=0;pe[s+8>>2]=0;pe[s+12>>2]=0;de[s+16>>0]=0;do{if(((t>>>0>=74?((ge[e>>0]|0)<<8|(ge[e+1>>0]|0)|0)==18552:0)?((ge[e+2>>0]|0)<<8|(ge[e+3>>0]|0))>>>0>=74:0)?((ge[e+7>>0]|0)<<16|(ge[e+6>>0]|0)<<24|(ge[e+8>>0]|0)<<8|(ge[e+9>>0]|0))>>>0<=t>>>0:0){pe[u>>2]=e;pe[r>>2]=e;pe[n>>2]=t;if(Ct(l)|0){r=pe[u>>2]|0;if((ge[r+39>>0]|0)<<8|(ge[r+40>>0]|0)){if(!(kt(l)|0))break;if(!(Et(l)|0))break;r=pe[u>>2]|0}if(!((ge[r+55>>0]|0)<<8|(ge[r+56>>0]|0))){m=l;ve=p;return m|0}if(At(l)|0?Ot(l)|0:0){m=l;ve=p;return m|0}}}else d=7}while(0);if((d|0)==7)pe[u>>2]=0;Nt(l);if(!(l&7)){Dn[pe[104>>2]&1](l,0,0,1,pe[27]|0)|0;m=0;ve=p;return m|0}else{pe[f>>2]=1154;pe[f+4>>2]=2499;pe[f+8>>2]=1516;br(c,1100,f)|0;yr(c,h)|0;m=0;ve=p;return m|0}return 0}function yt(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+544|0;l=c;u=c+24|0;o=pe[e+88>>2]|0;s=(ge[o+70+(i<<2)+1>>0]|0)<<16|(ge[o+70+(i<<2)>>0]|0)<<24|(ge[o+70+(i<<2)+2>>0]|0)<<8|(ge[o+70+(i<<2)+3>>0]|0);a=i+1|0;if(a>>>0<(ge[o+16>>0]|0)>>>0)o=(ge[o+70+(a<<2)+1>>0]|0)<<16|(ge[o+70+(a<<2)>>0]|0)<<24|(ge[o+70+(a<<2)+2>>0]|0)<<8|(ge[o+70+(a<<2)+3>>0]|0);else o=pe[e+8>>2]|0;if(o>>>0>s>>>0){u=e+4|0;u=pe[u>>2]|0;u=u+s|0;l=o-s|0;l=bt(e,u,l,t,r,n,i)|0;ve=c;return l|0}pe[l>>2]=1154;pe[l+4>>2]=3704;pe[l+8>>2]=1792;br(u,1100,l)|0;yr(u,c+16|0)|0;u=e+4|0;u=pe[u>>2]|0;u=u+s|0;l=o-s|0;l=bt(e,u,l,t,r,n,i)|0;ve=c;return l|0}function bt(e,t,r,n,i,o,a){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;var s=0,u=0,l=0,c=0;c=pe[e+88>>2]|0;u=((ge[c+12>>0]|0)<<8|(ge[c+13>>0]|0))>>>a;l=((ge[c+14>>0]|0)<<8|(ge[c+15>>0]|0))>>>a;u=u>>>0>1?(u+3|0)>>>2:1;l=l>>>0>1?(l+3|0)>>>2:1;c=c+18|0;a=de[c>>0]|0;a=_e(a<<24>>24==0|a<<24>>24==9?8:16,u)|0;if(o)if((o&3|0)==0&a>>>0<=o>>>0)a=o;else{e=0;return e|0}if((_e(a,l)|0)>>>0>i>>>0){e=0;return e|0}o=(u+1|0)>>>1;s=(l+1|0)>>>1;if(!r){e=0;return e|0}pe[e+92>>2]=t;pe[e+96>>2]=t;pe[e+104>>2]=r;pe[e+100>>2]=t+r;pe[e+108>>2]=0;pe[e+112>>2]=0;switch(ge[c>>0]|0|0){case 0:{Rt(e,n,i,a,u,l,o,s)|0;e=1;return e|0}case 4:case 6:case 5:case 3:case 2:{It(e,n,i,a,u,l,o,s)|0;e=1;return e|0}case 9:{Dt(e,n,i,a,u,l,o,s)|0;e=1;return e|0}case 8:case 7:{Lt(e,n,i,a,u,l,o,s)|0;e=1;return e|0}default:{e=0;return e|0}}return 0}function xt(e,t){e=e|0;t=t|0;var r=0,n=0;n=ve;ve=ve+48|0;r=n;pe[r>>2]=40;lt(e,t,r)|0;ve=n;return pe[r+4>>2]|0}function wt(e,t){e=e|0;t=t|0;var r=0,n=0;n=ve;ve=ve+48|0;r=n;pe[r>>2]=40;lt(e,t,r)|0;ve=n;return pe[r+8>>2]|0}function Tt(e,t){e=e|0;t=t|0;var r=0,n=0;n=ve;ve=ve+48|0;r=n;pe[r>>2]=40;lt(e,t,r)|0;ve=n;return pe[r+12>>2]|0}function St(e,t){e=e|0;t=t|0;var r=0,n=0;n=ve;ve=ve+48|0;r=n;pe[r>>2]=40;lt(e,t,r)|0;ve=n;return pe[r+32>>2]|0}function Mt(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0,s=0,u=0,l=0;u=ve;ve=ve+576|0;a=u+56|0;o=u+40|0;i=u+64|0;l=u;pe[l>>2]=40;lt(e,t,l)|0;n=(((pe[l+4>>2]|0)>>>r)+3|0)>>>2;t=(((pe[l+8>>2]|0)>>>r)+3|0)>>>2;r=l+32|0;e=pe[r+4>>2]|0;do{switch(pe[r>>2]|0){case 0:{if(!e)e=8;else s=13;break}case 1:{if(!e)s=12;else s=13;break}case 2:{if(!e)s=12;else s=13;break}case 3:{if(!e)s=12;else s=13;break}case 4:{if(!e)s=12;else s=13;break}case 5:{if(!e)s=12;else s=13;break}case 6:{if(!e)s=12;else s=13;break}case 7:{if(!e)s=12;else s=13;break}case 8:{if(!e)s=12;else s=13;break}case 9:{if(!e)e=8;else s=13;break}default:s=13}}while(0);if((s|0)==12)e=16;else if((s|0)==13){pe[o>>2]=1154;pe[o+4>>2]=2663;pe[o+8>>2]=1535;br(i,1100,o)|0;yr(i,a)|0;e=0}l=_e(_e(t,n)|0,e)|0;ve=u;return l|0}function Pt(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0;p=ve;ve=ve+608|0;h=p+80|0;d=p+64|0;s=p+56|0;a=p+40|0;c=p+88|0;g=p;f=p+84|0;pe[g>>2]=40;lt(e,t,g)|0;u=(((pe[g+4>>2]|0)>>>i)+3|0)>>>2;g=g+32|0;o=pe[g+4>>2]|0;do{switch(pe[g>>2]|0){case 0:{if(!o)o=8;else l=13;break}case 1:{if(!o)l=12;else l=13;break}case 2:{if(!o)l=12;else l=13;break}case 3:{if(!o)l=12;else l=13;break}case 4:{if(!o)l=12;else l=13;break}case 5:{if(!o)l=12;else l=13;break}case 6:{if(!o)l=12;else l=13;break}case 7:{if(!o)l=12;else l=13;break}case 8:{if(!o)l=12;else l=13;break}case 9:{if(!o)o=8;else l=13;break}default:l=13}}while(0);if((l|0)==12)o=16;else if((l|0)==13){pe[a>>2]=1154;pe[a+4>>2]=2663;pe[a+8>>2]=1535;br(c,1100,a)|0;yr(c,s)|0;o=0}s=_e(o,u)|0;a=_t(e,t)|0;pe[f>>2]=r;o=(a|0)==0;if(!(i>>>0>15|(n>>>0<8|o))?(pe[a>>2]|0)==519686845:0)yt(a,f,n,s,i)|0;if(o){ve=p;return}if((pe[a>>2]|0)!=519686845){ve=p;return}Nt(a);if(!(a&7)){Dn[pe[104>>2]&1](a,0,0,1,pe[27]|0)|0;ve=p;return}else{pe[d>>2]=1154;pe[d+4>>2]=2499;pe[d+8>>2]=1516;br(c,1100,d)|0;yr(c,h)|0;ve=p;return}}function Ct(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0;a=e+92|0;n=pe[e+4>>2]|0;o=e+88|0;i=pe[o>>2]|0;t=(ge[i+68>>0]|0)<<8|(ge[i+67>>0]|0)<<16|(ge[i+69>>0]|0);r=n+t|0;i=(ge[i+65>>0]|0)<<8|(ge[i+66>>0]|0);if(!i){e=0;return e|0}pe[a>>2]=r;pe[e+96>>2]=r;pe[e+104>>2]=i;pe[e+100>>2]=n+(i+t);pe[e+108>>2]=0;pe[e+112>>2]=0;if(!(pt(a,e+116|0)|0)){e=0;return e|0}t=pe[o>>2]|0;do{if(!((ge[t+39>>0]|0)<<8|(ge[t+40>>0]|0))){if(!((ge[t+55>>0]|0)<<8|(ge[t+56>>0]|0))){e=0;return e|0}}else{if(!(pt(a,e+140|0)|0)){e=0;return e|0}if(pt(a,e+188|0)|0){t=pe[o>>2]|0;break}else{e=0;return e|0}}}while(0);if((ge[t+55>>0]|0)<<8|(ge[t+56>>0]|0)){if(!(pt(a,e+164|0)|0)){e=0;return e|0}if(!(pt(a,e+212|0)|0)){e=0;return e|0}}e=1;return e|0}function kt(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;p=ve;ve=ve+592|0;u=p+16|0;s=p;a=p+72|0;d=p+24|0;n=e+88|0;t=pe[n>>2]|0;h=(ge[t+39>>0]|0)<<8|(ge[t+40>>0]|0);c=e+236|0;o=e+240|0;r=pe[o>>2]|0;if((r|0)!=(h|0)){if(r>>>0<=h>>>0){do{if((pe[e+244>>2]|0)>>>0>>0){if(it(c,h,(r+1|0)==(h|0),4,0)|0){t=pe[o>>2]|0;break}de[e+248>>0]=1;d=0;ve=p;return d|0}else t=r}while(0);Vr((pe[c>>2]|0)+(t<<2)|0,0,h-t<<2|0)|0;t=pe[n>>2]|0}pe[o>>2]=h}l=e+92|0;r=pe[e+4>>2]|0;n=(ge[t+34>>0]|0)<<8|(ge[t+33>>0]|0)<<16|(ge[t+35>>0]|0);i=r+n|0;t=(ge[t+37>>0]|0)<<8|(ge[t+36>>0]|0)<<16|(ge[t+38>>0]|0);if(!t){d=0;ve=p;return d|0}pe[l>>2]=i;pe[e+96>>2]=i;pe[e+104>>2]=t;pe[e+100>>2]=r+(t+n);pe[e+108>>2]=0;pe[e+112>>2]=0;pe[d+20>>2]=0;pe[d>>2]=0;pe[d+4>>2]=0;pe[d+8>>2]=0;pe[d+12>>2]=0;de[d+16>>0]=0;e=d+24|0;pe[d+44>>2]=0;pe[e>>2]=0;pe[e+4>>2]=0;pe[e+8>>2]=0;pe[e+12>>2]=0;de[e+16>>0]=0;if(pt(l,d)|0?(f=d+24|0,pt(l,f)|0):0){if(!(pe[o>>2]|0)){pe[s>>2]=1154;pe[s+4>>2]=903;pe[s+8>>2]=1781;br(a,1100,s)|0;yr(a,u)|0}if(!h)t=1;else{n=0;i=0;o=0;t=0;a=0;e=0;s=0;r=pe[c>>2]|0;while(1){n=(mt(l,d)|0)+n&31;i=(mt(l,f)|0)+i&63;o=(mt(l,d)|0)+o&31;t=(mt(l,d)|0)+t|0;a=(mt(l,f)|0)+a&63;e=(mt(l,d)|0)+e&31;pe[r>>2]=i<<5|n<<11|o|t<<27|a<<21|e<<16;s=s+1|0;if((s|0)==(h|0)){t=1;break}else{t=t&31;r=r+4|0}}}}else t=0;ft(d+24|0);ft(d);d=t;ve=p;return d|0}function Et(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0;M=ve;ve=ve+1024|0;s=M+16|0;a=M;o=M+504|0;S=M+480|0;w=M+284|0;T=M+88|0;x=M+24|0;i=pe[e+88>>2]|0;b=(ge[i+47>>0]|0)<<8|(ge[i+48>>0]|0);y=e+92|0;t=pe[e+4>>2]|0;r=(ge[i+42>>0]|0)<<8|(ge[i+41>>0]|0)<<16|(ge[i+43>>0]|0);n=t+r|0;i=(ge[i+45>>0]|0)<<8|(ge[i+44>>0]|0)<<16|(ge[i+46>>0]|0);if(!i){S=0;ve=M;return S|0}pe[y>>2]=n;pe[e+96>>2]=n;pe[e+104>>2]=i;pe[e+100>>2]=t+(i+r);pe[e+108>>2]=0;pe[e+112>>2]=0;pe[S+20>>2]=0;pe[S>>2]=0;pe[S+4>>2]=0;pe[S+8>>2]=0;pe[S+12>>2]=0;de[S+16>>0]=0;if(pt(y,S)|0){r=0;n=-3;i=-3;while(1){pe[w+(r<<2)>>2]=n;pe[T+(r<<2)>>2]=i;t=(n|0)>2;r=r+1|0;if((r|0)==49)break;else{n=t?-3:n+1|0;i=(t&1)+i|0}}t=x;r=t+64|0;do{pe[t>>2]=0;t=t+4|0}while((t|0)<(r|0));_=e+252|0;r=e+256|0;t=pe[r>>2]|0;e:do{if((t|0)==(b|0))u=13;else{if(t>>>0<=b>>>0){do{if((pe[e+260>>2]|0)>>>0>>0)if(it(_,b,(t+1|0)==(b|0),4,0)|0){t=pe[r>>2]|0;break}else{de[e+264>>0]=1;t=0;break e}}while(0);Vr((pe[_>>2]|0)+(t<<2)|0,0,b-t<<2|0)|0}pe[r>>2]=b;u=13}}while(0);do{if((u|0)==13){if(!b){pe[a>>2]=1154;pe[a+4>>2]=903;pe[a+8>>2]=1781;br(o,1100,a)|0;yr(o,s)|0;t=1;break}n=x+4|0;i=x+8|0;e=x+12|0;o=x+16|0;a=x+20|0;s=x+24|0;u=x+28|0;l=x+32|0;c=x+36|0;f=x+40|0;h=x+44|0;d=x+48|0;p=x+52|0;g=x+56|0;m=x+60|0;v=0;r=pe[_>>2]|0;while(1){t=0;do{P=mt(y,S)|0;_=t<<1;C=x+(_<<2)|0;pe[C>>2]=(pe[C>>2]|0)+(pe[w+(P<<2)>>2]|0)&3;_=x+((_|1)<<2)|0;pe[_>>2]=(pe[_>>2]|0)+(pe[T+(P<<2)>>2]|0)&3;t=t+1|0}while((t|0)!=8);pe[r>>2]=(ge[1725+(pe[n>>2]|0)>>0]|0)<<2|(ge[1725+(pe[x>>2]|0)>>0]|0)|(ge[1725+(pe[i>>2]|0)>>0]|0)<<4|(ge[1725+(pe[e>>2]|0)>>0]|0)<<6|(ge[1725+(pe[o>>2]|0)>>0]|0)<<8|(ge[1725+(pe[a>>2]|0)>>0]|0)<<10|(ge[1725+(pe[s>>2]|0)>>0]|0)<<12|(ge[1725+(pe[u>>2]|0)>>0]|0)<<14|(ge[1725+(pe[l>>2]|0)>>0]|0)<<16|(ge[1725+(pe[c>>2]|0)>>0]|0)<<18|(ge[1725+(pe[f>>2]|0)>>0]|0)<<20|(ge[1725+(pe[h>>2]|0)>>0]|0)<<22|(ge[1725+(pe[d>>2]|0)>>0]|0)<<24|(ge[1725+(pe[p>>2]|0)>>0]|0)<<26|(ge[1725+(pe[g>>2]|0)>>0]|0)<<28|(ge[1725+(pe[m>>2]|0)>>0]|0)<<30;v=v+1|0;if((v|0)==(b|0)){t=1;break}else r=r+4|0}}}while(0)}else t=0;ft(S);C=t;ve=M;return C|0}function At(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0;h=ve;ve=ve+560|0;u=h+16|0;s=h;a=h+48|0;f=h+24|0;i=pe[e+88>>2]|0;c=(ge[i+55>>0]|0)<<8|(ge[i+56>>0]|0);l=e+92|0;t=pe[e+4>>2]|0;r=(ge[i+50>>0]|0)<<8|(ge[i+49>>0]|0)<<16|(ge[i+51>>0]|0);n=t+r|0;i=(ge[i+53>>0]|0)<<8|(ge[i+52>>0]|0)<<16|(ge[i+54>>0]|0);if(!i){f=0;ve=h;return f|0}pe[l>>2]=n;pe[e+96>>2]=n;pe[e+104>>2]=i;pe[e+100>>2]=t+(i+r);pe[e+108>>2]=0;pe[e+112>>2]=0;pe[f+20>>2]=0;pe[f>>2]=0;pe[f+4>>2]=0;pe[f+8>>2]=0;pe[f+12>>2]=0;de[f+16>>0]=0;e:do{if(pt(l,f)|0){o=e+268|0;r=e+272|0;t=pe[r>>2]|0;if((t|0)!=(c|0)){if(t>>>0<=c>>>0){do{if((pe[e+276>>2]|0)>>>0>>0)if(it(o,c,(t+1|0)==(c|0),2,0)|0){t=pe[r>>2]|0;break}else{de[e+280>>0]=1;t=0;break e}}while(0);Vr((pe[o>>2]|0)+(t<<1)|0,0,c-t<<1|0)|0}pe[r>>2]=c}if(!c){pe[s>>2]=1154;pe[s+4>>2]=903;pe[s+8>>2]=1781;br(a,1100,s)|0;yr(a,u)|0;t=1;break}r=0;n=0;i=0;t=pe[o>>2]|0;while(1){u=mt(l,f)|0;r=u+r&255;n=(mt(l,f)|0)+n&255;Q[t>>1]=n<<8|r;i=i+1|0;if((i|0)==(c|0)){t=1;break}else t=t+2|0}}else t=0}while(0);ft(f);f=t;ve=h;return f|0}function Ot(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0;M=ve;ve=ve+2432|0;s=M+16|0;a=M;o=M+1912|0;S=M+1888|0;w=M+988|0;T=M+88|0;x=M+24|0;i=pe[e+88>>2]|0;b=(ge[i+63>>0]|0)<<8|(ge[i+64>>0]|0);y=e+92|0;t=pe[e+4>>2]|0;r=(ge[i+58>>0]|0)<<8|(ge[i+57>>0]|0)<<16|(ge[i+59>>0]|0);n=t+r|0;i=(ge[i+61>>0]|0)<<8|(ge[i+60>>0]|0)<<16|(ge[i+62>>0]|0);if(!i){S=0;ve=M;return S|0}pe[y>>2]=n;pe[e+96>>2]=n;pe[e+104>>2]=i;pe[e+100>>2]=t+(i+r);pe[e+108>>2]=0;pe[e+112>>2]=0;pe[S+20>>2]=0;pe[S>>2]=0;pe[S+4>>2]=0;pe[S+8>>2]=0;pe[S+12>>2]=0;de[S+16>>0]=0;if(pt(y,S)|0){r=0;n=-7;i=-7;while(1){pe[w+(r<<2)>>2]=n;pe[T+(r<<2)>>2]=i;t=(n|0)>6;r=r+1|0;if((r|0)==225)break;else{n=t?-7:n+1|0;i=(t&1)+i|0}}t=x;r=t+64|0;do{pe[t>>2]=0;t=t+4|0}while((t|0)<(r|0));_=e+284|0;r=b*3|0;n=e+288|0;t=pe[n>>2]|0;e:do{if((t|0)==(r|0))u=13;else{if(t>>>0<=r>>>0){do{if((pe[e+292>>2]|0)>>>0>>0)if(it(_,r,(t+1|0)==(r|0),2,0)|0){t=pe[n>>2]|0;break}else{de[e+296>>0]=1;t=0;break e}}while(0);Vr((pe[_>>2]|0)+(t<<1)|0,0,r-t<<1|0)|0}pe[n>>2]=r;u=13}}while(0);do{if((u|0)==13){if(!b){pe[a>>2]=1154;pe[a+4>>2]=903;pe[a+8>>2]=1781;br(o,1100,a)|0;yr(o,s)|0;t=1;break}n=x+4|0;i=x+8|0;e=x+12|0;o=x+16|0;a=x+20|0;s=x+24|0;u=x+28|0;l=x+32|0;c=x+36|0;f=x+40|0;h=x+44|0;d=x+48|0;p=x+52|0;g=x+56|0;m=x+60|0;v=0;r=pe[_>>2]|0;while(1){t=0;do{P=mt(y,S)|0;_=t<<1;C=x+(_<<2)|0;pe[C>>2]=(pe[C>>2]|0)+(pe[w+(P<<2)>>2]|0)&7;_=x+((_|1)<<2)|0;pe[_>>2]=(pe[_>>2]|0)+(pe[T+(P<<2)>>2]|0)&7;t=t+1|0}while((t|0)!=8);P=ge[1729+(pe[a>>2]|0)>>0]|0;Q[r>>1]=(ge[1729+(pe[n>>2]|0)>>0]|0)<<3|(ge[1729+(pe[x>>2]|0)>>0]|0)|(ge[1729+(pe[i>>2]|0)>>0]|0)<<6|(ge[1729+(pe[e>>2]|0)>>0]|0)<<9|(ge[1729+(pe[o>>2]|0)>>0]|0)<<12|P<<15;C=ge[1729+(pe[f>>2]|0)>>0]|0;Q[r+2>>1]=(ge[1729+(pe[s>>2]|0)>>0]|0)<<2|P>>>1|(ge[1729+(pe[u>>2]|0)>>0]|0)<<5|(ge[1729+(pe[l>>2]|0)>>0]|0)<<8|(ge[1729+(pe[c>>2]|0)>>0]|0)<<11|C<<14;Q[r+4>>1]=(ge[1729+(pe[h>>2]|0)>>0]|0)<<1|C>>>2|(ge[1729+(pe[d>>2]|0)>>0]|0)<<4|(ge[1729+(pe[p>>2]|0)>>0]|0)<<7|(ge[1729+(pe[g>>2]|0)>>0]|0)<<10|(ge[1729+(pe[m>>2]|0)>>0]|0)<<13;v=v+1|0;if((v|0)==(b|0)){t=1;break}else r=r+6|0}}}while(0)}else t=0;ft(S);C=t;ve=M;return C|0}function Rt(e,t,r,n,i,o,a,s){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;s=s|0;var u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0,$=0,Q=0,ee=0,te=0,re=0,ne=0,ie=0,oe=0,ae=0,se=0,ue=0,le=0,ce=0,fe=0,he=0;ce=ve;ve=ve+720|0;le=ce+184|0;se=ce+168|0;ae=ce+160|0;oe=ce+144|0;ie=ce+136|0;ne=ce+120|0;re=ce+112|0;ee=ce+96|0;Q=ce+88|0;$=ce+72|0;J=ce+64|0;Z=ce+48|0;K=ce+40|0;ue=ce+24|0;te=ce+16|0;V=ce;G=ce+208|0;W=ce+192|0;B=e+240|0;z=pe[B>>2]|0;q=e+256|0;H=pe[q>>2]|0;r=de[(pe[e+88>>2]|0)+17>>0]|0;Y=n>>>2;if(!(r<<24>>24)){ve=ce;return 1}U=(s|0)==0;X=s+-1|0;R=(o&1|0)!=0;I=n<<1;D=e+92|0;L=e+116|0;N=e+140|0;j=e+236|0;F=a+-1|0;O=(i&1|0)!=0;A=e+188|0;M=e+252|0;P=Y+1|0;C=Y+2|0;k=Y+3|0;E=F<<4;T=r&255;r=0;o=0;i=1;S=0;do{if(!U){x=pe[t+(S<<2)>>2]|0;w=0;while(1){_=w&1;u=(_|0)==0;v=(_<<5^32)+-16|0;_=(_<<1^2)+-1|0;b=u?a:-1;l=u?0:F;e=(w|0)==(X|0);y=R&e;if((l|0)!=(b|0)){m=R&e^1;g=u?x:x+E|0;while(1){if((i|0)==1)i=mt(D,L)|0|512;p=i&7;i=i>>>3;u=ge[1823+p>>0]|0;e=0;do{h=(mt(D,N)|0)+o|0;d=h-z|0;o=d>>31;o=o&h|d&~o;if((pe[B>>2]|0)>>>0<=o>>>0){pe[V>>2]=1154;pe[V+4>>2]=903;pe[V+8>>2]=1781;br(G,1100,V)|0;yr(G,te)|0}pe[W+(e<<2)>>2]=pe[(pe[j>>2]|0)+(o<<2)>>2];e=e+1|0}while(e>>>0>>0);d=O&(l|0)==(F|0);if(y|d){h=0;do{c=_e(h,n)|0;e=g+c|0;u=(h|0)==0|m;f=h<<1;he=(mt(D,A)|0)+r|0;fe=he-H|0;r=fe>>31;r=r&he|fe&~r;do{if(d){if(!u){fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;break}pe[e>>2]=pe[W+((ge[1831+(p<<2)+f>>0]|0)<<2)>>2];if((pe[q>>2]|0)>>>0<=r>>>0){pe[oe>>2]=1154;pe[oe+4>>2]=903;pe[oe+8>>2]=1781;br(G,1100,oe)|0;yr(G,ae)|0}pe[g+(c+4)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r}else{if(!u){fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;break}pe[e>>2]=pe[W+((ge[1831+(p<<2)+f>>0]|0)<<2)>>2];if((pe[q>>2]|0)>>>0<=r>>>0){pe[ne>>2]=1154;pe[ne+4>>2]=903;pe[ne+8>>2]=1781;br(G,1100,ne)|0;yr(G,ie)|0}pe[g+(c+4)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;pe[g+(c+8)>>2]=pe[W+((ge[(f|1)+(1831+(p<<2))>>0]|0)<<2)>>2];if((pe[q>>2]|0)>>>0<=r>>>0){pe[se>>2]=1154;pe[se+4>>2]=903;pe[se+8>>2]=1781;br(G,1100,se)|0;yr(G,le)|0}pe[g+(c+12)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2]}}while(0);h=h+1|0}while((h|0)!=2)}else{pe[g>>2]=pe[W+((ge[1831+(p<<2)>>0]|0)<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;if((pe[q>>2]|0)>>>0<=r>>>0){pe[ue>>2]=1154;pe[ue+4>>2]=903;pe[ue+8>>2]=1781;br(G,1100,ue)|0;yr(G,K)|0}pe[g+4>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];pe[g+8>>2]=pe[W+((ge[1831+(p<<2)+1>>0]|0)<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;if((pe[q>>2]|0)>>>0<=r>>>0){pe[Z>>2]=1154;pe[Z+4>>2]=903;pe[Z+8>>2]=1781;br(G,1100,Z)|0;yr(G,J)|0}pe[g+12>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];pe[g+(Y<<2)>>2]=pe[W+((ge[1831+(p<<2)+2>>0]|0)<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;if((pe[q>>2]|0)>>>0<=r>>>0){pe[$>>2]=1154;pe[$+4>>2]=903;pe[$+8>>2]=1781;br(G,1100,$)|0;yr(G,Q)|0}pe[g+(P<<2)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];pe[g+(C<<2)>>2]=pe[W+((ge[1831+(p<<2)+3>>0]|0)<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;if((pe[q>>2]|0)>>>0<=r>>>0){pe[ee>>2]=1154;pe[ee+4>>2]=903;pe[ee+8>>2]=1781;br(G,1100,ee)|0;yr(G,re)|0}pe[g+(k<<2)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2]}l=l+_|0;if((l|0)==(b|0))break;else g=g+v|0}}w=w+1|0;if((w|0)==(s|0))break;else x=x+I|0}}S=S+1|0}while((S|0)!=(T|0));ve=ce;return 1}function It(e,t,r,n,i,o,a,s){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;s=s|0;var u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0,$=0,Q=0,ee=0,te=0,re=0,ne=0,ie=0,oe=0,ae=0,se=0,ue=0,le=0,ce=0,fe=0,he=0;fe=ve;ve=ve+640|0;ue=fe+88|0;se=fe+72|0;ae=fe+64|0;oe=fe+48|0;ie=fe+40|0;ce=fe+24|0;le=fe+16|0;ne=fe;te=fe+128|0;re=fe+112|0;ee=fe+96|0;B=e+240|0;z=pe[B>>2]|0;q=e+256|0;J=pe[q>>2]|0;$=e+272|0;Q=pe[$>>2]|0;r=pe[e+88>>2]|0;U=(ge[r+63>>0]|0)<<8|(ge[r+64>>0]|0);r=de[r+17>>0]|0;if(!(r<<24>>24)){ve=fe;return 1}X=(s|0)==0;H=s+-1|0;Y=n<<1;G=e+92|0;W=e+116|0;V=a+-1|0;K=e+212|0;Z=e+188|0;F=(i&1|0)==0;j=(o&1|0)==0;O=e+288|0;R=e+284|0;I=e+252|0;D=e+140|0;L=e+236|0;N=e+164|0;E=e+268|0;A=V<<5;C=r&255;r=0;i=0;o=0;e=0;u=1;k=0;do{if(!X){M=pe[t+(k<<2)>>2]|0;P=0;while(1){T=P&1;l=(T|0)==0;w=(T<<6^64)+-32|0;T=(T<<1^2)+-1|0;S=l?a:-1;c=l?0:V;if((c|0)!=(S|0)){x=j|(P|0)!=(H|0);b=l?M:M+A|0;while(1){if((u|0)==1)u=mt(G,W)|0|512;y=u&7;u=u>>>3;f=ge[1823+y>>0]|0;l=0;do{v=(mt(G,N)|0)+i|0;_=v-Q|0;i=_>>31;i=i&v|_&~i;if((pe[$>>2]|0)>>>0<=i>>>0){pe[ne>>2]=1154;pe[ne+4>>2]=903;pe[ne+8>>2]=1781;br(te,1100,ne)|0;yr(te,le)|0}pe[ee+(l<<2)>>2]=me[(pe[E>>2]|0)+(i<<1)>>1];l=l+1|0}while(l>>>0>>0);l=0;do{v=(mt(G,D)|0)+e|0;_=v-z|0;e=_>>31;e=e&v|_&~e;if((pe[B>>2]|0)>>>0<=e>>>0){pe[ce>>2]=1154;pe[ce+4>>2]=903;pe[ce+8>>2]=1781;br(te,1100,ce)|0;yr(te,ie)|0}pe[re+(l<<2)>>2]=pe[(pe[L>>2]|0)+(e<<2)>>2];l=l+1|0}while(l>>>0>>0);_=F|(c|0)!=(V|0);m=0;v=b;while(1){g=x|(m|0)==0;p=m<<1;h=0;d=v;while(1){f=(mt(G,K)|0)+r|0;l=f-U|0;r=l>>31;r=r&f|l&~r;l=(mt(G,Z)|0)+o|0;f=l-J|0;o=f>>31;o=o&l|f&~o;if((_|(h|0)==0)&g){l=ge[h+p+(1831+(y<<2))>>0]|0;f=r*3|0;if((pe[O>>2]|0)>>>0<=f>>>0){pe[oe>>2]=1154;pe[oe+4>>2]=903;pe[oe+8>>2]=1781;br(te,1100,oe)|0;yr(te,ae)|0}he=pe[R>>2]|0;pe[d>>2]=(me[he+(f<<1)>>1]|0)<<16|pe[ee+(l<<2)>>2];pe[d+4>>2]=(me[he+(f+2<<1)>>1]|0)<<16|(me[he+(f+1<<1)>>1]|0);pe[d+8>>2]=pe[re+(l<<2)>>2];if((pe[q>>2]|0)>>>0<=o>>>0){pe[se>>2]=1154;pe[se+4>>2]=903;pe[se+8>>2]=1781;br(te,1100,se)|0;yr(te,ue)|0}pe[d+12>>2]=pe[(pe[I>>2]|0)+(o<<2)>>2]}h=h+1|0;if((h|0)==2)break;else d=d+16|0}m=m+1|0;if((m|0)==2)break;else v=v+n|0}c=c+T|0;if((c|0)==(S|0))break;else b=b+w|0}}P=P+1|0;if((P|0)==(s|0))break;else M=M+Y|0}}k=k+1|0}while((k|0)!=(C|0));ve=fe;return 1}function Dt(e,t,r,n,i,o,a,s){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;s=s|0;var u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0;J=ve;ve=ve+608|0;V=J+64|0;W=J+48|0;G=J+40|0;Z=J+24|0;K=J+16|0;Y=J;H=J+88|0;q=J+72|0;I=e+272|0;D=pe[I>>2]|0;r=pe[e+88>>2]|0;L=(ge[r+63>>0]|0)<<8|(ge[r+64>>0]|0);r=de[r+17>>0]|0;if(!(r<<24>>24)){ve=J;return 1}N=(s|0)==0;j=s+-1|0;F=n<<1;B=e+92|0;z=e+116|0;U=a+-1|0;X=e+212|0;R=(o&1|0)==0;E=e+288|0;A=e+284|0;O=e+164|0;C=e+268|0;k=U<<4;P=r&255;M=(i&1|0)!=0;r=0;o=0;e=1;S=0;do{if(!N){w=pe[t+(S<<2)>>2]|0;T=0;while(1){b=T&1;i=(b|0)==0;y=(b<<5^32)+-16|0;b=(b<<1^2)+-1|0;x=i?a:-1;u=i?0:U;if((u|0)!=(x|0)){_=R|(T|0)!=(j|0);v=i?w:w+k|0;while(1){if((e|0)==1)e=mt(B,z)|0|512;m=e&7;e=e>>>3;l=ge[1823+m>>0]|0;i=0;do{p=(mt(B,O)|0)+o|0;g=p-D|0;o=g>>31;o=o&p|g&~o;if((pe[I>>2]|0)>>>0<=o>>>0){pe[Y>>2]=1154;pe[Y+4>>2]=903;pe[Y+8>>2]=1781;br(H,1100,Y)|0;yr(H,K)|0}pe[q+(i<<2)>>2]=me[(pe[C>>2]|0)+(o<<1)>>1];i=i+1|0}while(i>>>0>>0);g=(u|0)==(U|0)&M;d=0;p=v;while(1){h=_|(d|0)==0;f=d<<1;i=(mt(B,X)|0)+r|0;c=i-L|0;l=c>>31;l=l&i|c&~l;if(h){r=ge[1831+(m<<2)+f>>0]|0;i=l*3|0;if((pe[E>>2]|0)>>>0<=i>>>0){pe[Z>>2]=1154;pe[Z+4>>2]=903;pe[Z+8>>2]=1781;br(H,1100,Z)|0;yr(H,G)|0}c=pe[A>>2]|0;pe[p>>2]=(me[c+(i<<1)>>1]|0)<<16|pe[q+(r<<2)>>2];pe[p+4>>2]=(me[c+(i+2<<1)>>1]|0)<<16|(me[c+(i+1<<1)>>1]|0)}c=p+8|0;i=(mt(B,X)|0)+l|0;l=i-L|0;r=l>>31;r=r&i|l&~r;if(!(g|h^1)){i=ge[(f|1)+(1831+(m<<2))>>0]|0;l=r*3|0;if((pe[E>>2]|0)>>>0<=l>>>0){pe[W>>2]=1154;pe[W+4>>2]=903;pe[W+8>>2]=1781;br(H,1100,W)|0;yr(H,V)|0}h=pe[A>>2]|0;pe[c>>2]=(me[h+(l<<1)>>1]|0)<<16|pe[q+(i<<2)>>2];pe[p+12>>2]=(me[h+(l+2<<1)>>1]|0)<<16|(me[h+(l+1<<1)>>1]|0)}d=d+1|0;if((d|0)==2)break;else p=p+n|0}u=u+b|0;if((u|0)==(x|0))break;else v=v+y|0}}T=T+1|0;if((T|0)==(s|0))break;else w=w+F|0}}S=S+1|0}while((S|0)!=(P|0));ve=J;return 1}function Lt(e,t,r,n,i,o,a,s){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;s=s|0;var u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0,$=0,Q=0,ee=0,te=0,re=0,ne=0,ie=0,oe=0,ae=0;ae=ve;ve=ve+640|0;ne=ae+88|0;re=ae+72|0;te=ae+64|0;ee=ae+48|0;Q=ae+40|0;oe=ae+24|0;ie=ae+16|0;$=ae;J=ae+128|0;K=ae+112|0;Z=ae+96|0;B=e+272|0;z=pe[B>>2]|0;r=pe[e+88>>2]|0;U=(ge[r+63>>0]|0)<<8|(ge[r+64>>0]|0);r=de[r+17>>0]|0;if(!(r<<24>>24)){ve=ae;return 1}X=(s|0)==0;q=s+-1|0;H=n<<1;Y=e+92|0;G=e+116|0;W=a+-1|0;V=e+212|0;F=(i&1|0)==0;j=(o&1|0)==0;D=e+288|0;L=e+284|0;N=e+164|0;R=e+268|0;I=W<<5;A=r&255;r=0;i=0;o=0;e=0;u=1;O=0;do{if(!X){k=pe[t+(O<<2)>>2]|0;E=0;while(1){P=E&1;l=(P|0)==0;M=(P<<6^64)+-32|0;P=(P<<1^2)+-1|0;C=l?a:-1;c=l?0:W;if((c|0)!=(C|0)){S=j|(E|0)!=(q|0);T=l?k:k+I|0;while(1){if((u|0)==1)u=mt(Y,G)|0|512;w=u&7;u=u>>>3;f=ge[1823+w>>0]|0;l=0;do{b=(mt(Y,N)|0)+e|0;x=b-z|0;e=x>>31;e=e&b|x&~e;if((pe[B>>2]|0)>>>0<=e>>>0){pe[$>>2]=1154;pe[$+4>>2]=903;pe[$+8>>2]=1781;br(J,1100,$)|0;yr(J,ie)|0}pe[K+(l<<2)>>2]=me[(pe[R>>2]|0)+(e<<1)>>1];l=l+1|0}while(l>>>0>>0);l=0;do{b=(mt(Y,N)|0)+i|0;x=b-z|0;i=x>>31;i=i&b|x&~i;if((pe[B>>2]|0)>>>0<=i>>>0){pe[oe>>2]=1154;pe[oe+4>>2]=903;pe[oe+8>>2]=1781;br(J,1100,oe)|0;yr(J,Q)|0}pe[Z+(l<<2)>>2]=me[(pe[R>>2]|0)+(i<<1)>>1];l=l+1|0}while(l>>>0>>0);x=F|(c|0)!=(W|0);y=0;b=T;while(1){_=S|(y|0)==0;v=y<<1;g=0;m=b;while(1){p=(mt(Y,V)|0)+o|0;d=p-U|0;o=d>>31;o=o&p|d&~o;d=(mt(Y,V)|0)+r|0;p=d-U|0;r=p>>31;r=r&d|p&~r;if((x|(g|0)==0)&_){d=ge[g+v+(1831+(w<<2))>>0]|0;p=o*3|0;l=pe[D>>2]|0;if(l>>>0<=p>>>0){pe[ee>>2]=1154;pe[ee+4>>2]=903;pe[ee+8>>2]=1781;br(J,1100,ee)|0;yr(J,te)|0;l=pe[D>>2]|0}f=pe[L>>2]|0;h=r*3|0;if(l>>>0>h>>>0)l=f;else{pe[re>>2]=1154;pe[re+4>>2]=903;pe[re+8>>2]=1781;br(J,1100,re)|0;yr(J,ne)|0;l=pe[L>>2]|0}pe[m>>2]=(me[f+(p<<1)>>1]|0)<<16|pe[K+(d<<2)>>2];pe[m+4>>2]=(me[f+(p+2<<1)>>1]|0)<<16|(me[f+(p+1<<1)>>1]|0);pe[m+8>>2]=(me[l+(h<<1)>>1]|0)<<16|pe[Z+(d<<2)>>2];pe[m+12>>2]=(me[l+(h+2<<1)>>1]|0)<<16|(me[l+(h+1<<1)>>1]|0)}g=g+1|0;if((g|0)==2)break;else m=m+16|0}y=y+1|0;if((y|0)==2)break;else b=b+n|0}c=c+P|0;if((c|0)==(C|0))break;else T=T+M|0}}E=E+1|0;if((E|0)==(s|0))break;else k=k+H|0}}O=O+1|0}while((O|0)!=(A|0));ve=ae;return 1}function Nt(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0;h=ve;ve=ve+608|0;f=h+88|0;c=h+72|0;u=h+64|0;s=h+48|0;o=h+40|0;a=h+24|0;i=h+16|0;n=h;l=h+96|0;pe[e>>2]=0;t=e+284|0;r=pe[t>>2]|0;if(r){if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[n>>2]=1154;pe[n+4>>2]=2499;pe[n+8>>2]=1516;br(l,1100,n)|0;yr(l,i)|0}pe[t>>2]=0;pe[e+288>>2]=0;pe[e+292>>2]=0}de[e+296>>0]=0;t=e+268|0;r=pe[t>>2]|0;if(r){if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[a>>2]=1154;pe[a+4>>2]=2499;pe[a+8>>2]=1516;br(l,1100,a)|0;yr(l,o)|0}pe[t>>2]=0;pe[e+272>>2]=0;pe[e+276>>2]=0}de[e+280>>0]=0;t=e+252|0;r=pe[t>>2]|0;if(r){if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[s>>2]=1154;pe[s+4>>2]=2499;pe[s+8>>2]=1516;br(l,1100,s)|0;yr(l,u)|0}pe[t>>2]=0;pe[e+256>>2]=0;pe[e+260>>2]=0}de[e+264>>0]=0;t=e+236|0;r=pe[t>>2]|0;if(!r){f=e+248|0;de[f>>0]=0;f=e+212|0;ft(f);f=e+188|0;ft(f);f=e+164|0;ft(f);f=e+140|0;ft(f);f=e+116|0;ft(f);ve=h;return}if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[c>>2]=1154;pe[c+4>>2]=2499;pe[c+8>>2]=1516;br(l,1100,c)|0;yr(l,f)|0}pe[t>>2]=0;pe[e+240>>2]=0;pe[e+244>>2]=0;f=e+248|0;de[f>>0]=0;f=e+212|0;ft(f);f=e+188|0;ft(f);f=e+164|0;ft(f);f=e+140|0;ft(f);f=e+116|0;ft(f);ve=h;return}function jt(e,t){e=e|0;t=t|0;var r=0;r=ve;ve=ve+16|0;pe[r>>2]=t;t=pe[63]|0;xr(t,e,r)|0;vr(10,t)|0;Xe()}function Ft(){var e=0,t=0;e=ve;ve=ve+16|0;if(!(Ne(200,2)|0)){t=De(pe[49]|0)|0;ve=e;return t|0}else jt(2090,e);return 0}function Bt(e){e=e|0;Ur(e);return}function zt(e){e=e|0;var t=0;t=ve;ve=ve+16|0;Rn[e&3]();jt(2139,t)}function Ut(){var e=0,t=0;e=Ft()|0;if(((e|0)!=0?(t=pe[e>>2]|0,(t|0)!=0):0)?(e=t+48|0,(pe[e>>2]&-256|0)==1126902528?(pe[e+4>>2]|0)==1129074247:0):0)zt(pe[t+12>>2]|0);t=pe[28]|0;pe[28]=t+0;zt(t)}function Xt(e){e=e|0;return}function qt(e){e=e|0;return}function Ht(e){e=e|0;return}function Yt(e){e=e|0;return}function Gt(e){e=e|0;Bt(e);return}function Wt(e){e=e|0;Bt(e);return}function Vt(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0;a=ve;ve=ve+64|0;o=a;if((e|0)!=(t|0))if((t|0)!=0?(i=$t(t,24,40,0)|0,(i|0)!=0):0){t=o;n=t+56|0;do{pe[t>>2]=0;t=t+4|0}while((t|0)<(n|0));pe[o>>2]=i;pe[o+8>>2]=e;pe[o+12>>2]=-1;pe[o+48>>2]=1;Ln[pe[(pe[i>>2]|0)+28>>2]&3](i,o,pe[r>>2]|0,1);if((pe[o+24>>2]|0)==1){pe[r>>2]=pe[o+16>>2];t=1}else t=0}else t=0;else t=1;ve=a;return t|0}function Kt(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0;e=t+16|0;i=pe[e>>2]|0;do{if(i){if((i|0)!=(r|0)){n=t+36|0;pe[n>>2]=(pe[n>>2]|0)+1;pe[t+24>>2]=2;de[t+54>>0]=1;break}e=t+24|0;if((pe[e>>2]|0)==2)pe[e>>2]=n}else{pe[e>>2]=r;pe[t+24>>2]=n;pe[t+36>>2]=1}}while(0);return}function Zt(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;if((e|0)==(pe[t+8>>2]|0))Kt(0,t,r,n);return}function Jt(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;if((e|0)==(pe[t+8>>2]|0))Kt(0,t,r,n);else{e=pe[e+8>>2]|0;Ln[pe[(pe[e>>2]|0)+28>>2]&3](e,t,r,n)}return}function $t(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0;d=ve;ve=ve+64|0;h=d;f=pe[e>>2]|0;c=e+(pe[f+-8>>2]|0)|0;f=pe[f+-4>>2]|0;pe[h>>2]=r;pe[h+4>>2]=e;pe[h+8>>2]=t;pe[h+12>>2]=n;n=h+16|0;e=h+20|0;t=h+24|0;i=h+28|0;o=h+32|0;a=h+40|0;s=(f|0)==(r|0);u=n;l=u+36|0;do{pe[u>>2]=0;u=u+4|0}while((u|0)<(l|0));Q[n+36>>1]=0;de[n+38>>0]=0;e:do{if(s){pe[h+48>>2]=1;In[pe[(pe[r>>2]|0)+20>>2]&3](r,h,c,c,1,0);n=(pe[t>>2]|0)==1?c:0}else{kn[pe[(pe[f>>2]|0)+24>>2]&3](f,h,c,1,0);switch(pe[h+36>>2]|0){case 0:{n=(pe[a>>2]|0)==1&(pe[i>>2]|0)==1&(pe[o>>2]|0)==1?pe[e>>2]|0:0;break e}case 1:break;default:{n=0;break e}}if((pe[t>>2]|0)!=1?!((pe[a>>2]|0)==0&(pe[i>>2]|0)==1&(pe[o>>2]|0)==1):0){n=0;break}n=pe[n>>2]|0}}while(0);ve=d;return n|0}function Qt(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;de[t+53>>0]=1;do{if((pe[t+4>>2]|0)==(n|0)){de[t+52>>0]=1;n=t+16|0;e=pe[n>>2]|0;if(!e){pe[n>>2]=r;pe[t+24>>2]=i;pe[t+36>>2]=1;if(!((i|0)==1?(pe[t+48>>2]|0)==1:0))break;de[t+54>>0]=1;break}if((e|0)!=(r|0)){i=t+36|0;pe[i>>2]=(pe[i>>2]|0)+1;de[t+54>>0]=1;break}e=t+24|0;n=pe[e>>2]|0;if((n|0)==2){pe[e>>2]=i;n=i}if((n|0)==1?(pe[t+48>>2]|0)==1:0)de[t+54>>0]=1}}while(0);return}function er(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0;e:do{if((e|0)==(pe[t+8>>2]|0)){if((pe[t+4>>2]|0)==(r|0)?(o=t+28|0,(pe[o>>2]|0)!=1):0)pe[o>>2]=n}else{if((e|0)!=(pe[t>>2]|0)){s=pe[e+8>>2]|0;kn[pe[(pe[s>>2]|0)+24>>2]&3](s,t,r,n,i);break}if((pe[t+16>>2]|0)!=(r|0)?(a=t+20|0,(pe[a>>2]|0)!=(r|0)):0){pe[t+32>>2]=n;n=t+44|0;if((pe[n>>2]|0)==4)break;o=t+52|0;de[o>>0]=0;u=t+53|0;de[u>>0]=0;e=pe[e+8>>2]|0;In[pe[(pe[e>>2]|0)+20>>2]&3](e,t,r,r,1,i);if(de[u>>0]|0){if(!(de[o>>0]|0)){o=1;s=13}}else{o=0;s=13}do{if((s|0)==13){pe[a>>2]=r;u=t+40|0;pe[u>>2]=(pe[u>>2]|0)+1;if((pe[t+36>>2]|0)==1?(pe[t+24>>2]|0)==2:0){de[t+54>>0]=1;if(o)break}else s=16;if((s|0)==16?o:0)break;pe[n>>2]=4;break e}}while(0);pe[n>>2]=3;break}if((n|0)==1)pe[t+32>>2]=1}}while(0);return}function tr(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0;do{if((e|0)==(pe[t+8>>2]|0)){if((pe[t+4>>2]|0)==(r|0)?(a=t+28|0,(pe[a>>2]|0)!=1):0)pe[a>>2]=n}else if((e|0)==(pe[t>>2]|0)){if((pe[t+16>>2]|0)!=(r|0)?(o=t+20|0,(pe[o>>2]|0)!=(r|0)):0){pe[t+32>>2]=n;pe[o>>2]=r;i=t+40|0;pe[i>>2]=(pe[i>>2]|0)+1;if((pe[t+36>>2]|0)==1?(pe[t+24>>2]|0)==2:0)de[t+54>>0]=1;pe[t+44>>2]=4;break}if((n|0)==1)pe[t+32>>2]=1}}while(0);return}function rr(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;if((e|0)==(pe[t+8>>2]|0))Qt(0,t,r,n,i);else{e=pe[e+8>>2]|0;In[pe[(pe[e>>2]|0)+20>>2]&3](e,t,r,n,i,o)}return}function nr(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;if((e|0)==(pe[t+8>>2]|0))Qt(0,t,r,n,i);return}function ir(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0;i=ve;ve=ve+16|0;n=i;pe[n>>2]=pe[r>>2];e=Cn[pe[(pe[e>>2]|0)+16>>2]&7](e,t,n)|0;if(e)pe[r>>2]=pe[n>>2];ve=i;return e&1|0}function or(e){e=e|0;if(!e)e=0;else e=($t(e,24,72,0)|0)!=0;return e&1|0}function ar(){var e=0,t=0,r=0,n=0,i=0,o=0,a=0,s=0;i=ve;ve=ve+48|0;a=i+32|0;r=i+24|0;s=i+16|0;o=i;i=i+36|0;e=Ft()|0;if((e|0)!=0?(n=pe[e>>2]|0,(n|0)!=0):0){e=n+48|0;t=pe[e>>2]|0;e=pe[e+4>>2]|0;if(!((t&-256|0)==1126902528&(e|0)==1129074247)){pe[r>>2]=pe[51];jt(2368,r)}if((t|0)==1126902529&(e|0)==1129074247)e=pe[n+44>>2]|0;else e=n+80|0;pe[i>>2]=e;n=pe[n>>2]|0;e=pe[n+4>>2]|0;if(Cn[pe[(pe[8>>2]|0)+16>>2]&7](8,n,i)|0){s=pe[i>>2]|0;i=pe[51]|0;s=An[pe[(pe[s>>2]|0)+8>>2]&1](s)|0;pe[o>>2]=i;pe[o+4>>2]=e;pe[o+8>>2]=s;jt(2282,o)}else{pe[s>>2]=pe[51];pe[s+4>>2]=e;jt(2327,s)}}jt(2406,a)}function sr(){var e=0;e=ve;ve=ve+16|0;if(!(je(196,6)|0)){ve=e;return}else jt(2179,e)}function ur(e){e=e|0;var t=0;t=ve;ve=ve+16|0;Ur(e);if(!(ze(pe[49]|0,0)|0)){ve=t;return}else jt(2229,t)}function lr(e){e=e|0;var t=0,r=0;t=0;while(1){if((ge[2427+t>>0]|0)==(e|0)){r=2;break}t=t+1|0;if((t|0)==87){t=87;e=2515;r=5;break}}if((r|0)==2)if(!t)e=2515;else{e=2515;r=5}if((r|0)==5)while(1){r=e;while(1){e=r+1|0;if(!(de[r>>0]|0))break;else r=e}t=t+-1|0;if(!t)break;else r=5}return e|0}function cr(){var e=0;if(!(pe[52]|0))e=264;else{e=(Le()|0)+60|0;e=pe[e>>2]|0}return e|0}function fr(e){e=e|0;var t=0;if(e>>>0>4294963200){t=cr()|0;pe[t>>2]=0-e;e=-1}return e|0}function hr(e,t){e=+e;t=t|0;var r=0,n=0,i=0;ee[te>>3]=e;r=pe[te>>2]|0;n=pe[te+4>>2]|0;i=Kr(r|0,n|0,52)|0;i=i&2047;switch(i|0){case 0:{if(e!=0.0){e=+hr(e*18446744073709552.0e3,t);r=(pe[t>>2]|0)+-64|0}else r=0;pe[t>>2]=r;break}case 2047:break;default:{pe[t>>2]=i+-1022;pe[te>>2]=r;pe[te+4>>2]=n&-2146435073|1071644672;e=+ee[te>>3]}}return+e}function dr(e,t){e=+e;t=t|0;return+ +hr(e,t)}function pr(e,t,r){e=e|0;t=t|0;r=r|0;do{if(e){if(t>>>0<128){de[e>>0]=t;e=1;break}if(t>>>0<2048){de[e>>0]=t>>>6|192;de[e+1>>0]=t&63|128;e=2;break}if(t>>>0<55296|(t&-8192|0)==57344){de[e>>0]=t>>>12|224;de[e+1>>0]=t>>>6&63|128;de[e+2>>0]=t&63|128;e=3;break}if((t+-65536|0)>>>0<1048576){de[e>>0]=t>>>18|240;de[e+1>>0]=t>>>12&63|128;de[e+2>>0]=t>>>6&63|128;de[e+3>>0]=t&63|128;e=4;break}else{e=cr()|0;pe[e>>2]=84;e=-1;break}}else e=1}while(0);return e|0}function gr(e,t){e=e|0;t=t|0;if(!e)e=0;else e=pr(e,t,0)|0;return e|0}function mr(e){e=e|0;var t=0,r=0;do{if(e){if((pe[e+76>>2]|0)<=-1){t=Ir(e)|0;break}r=(Sr(e)|0)==0;t=Ir(e)|0;if(!r)Mr(e)}else{if(!(pe[65]|0))t=0;else t=mr(pe[65]|0)|0;Ue(236);e=pe[58]|0;if(e)do{if((pe[e+76>>2]|0)>-1)r=Sr(e)|0;else r=0;if((pe[e+20>>2]|0)>>>0>(pe[e+28>>2]|0)>>>0)t=Ir(e)|0|t;if(r)Mr(e);e=pe[e+56>>2]|0}while((e|0)!=0);Fe(236)}}while(0);return t|0}function vr(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0;if((pe[t+76>>2]|0)>=0?(Sr(t)|0)!=0:0){if((de[t+75>>0]|0)!=(e|0)?(n=t+20|0,i=pe[n>>2]|0,i>>>0<(pe[t+16>>2]|0)>>>0):0){pe[n>>2]=i+1;de[i>>0]=e;r=e&255}else r=Pr(t,e)|0;Mr(t)}else a=3;do{if((a|0)==3){if((de[t+75>>0]|0)!=(e|0)?(o=t+20|0,r=pe[o>>2]|0,r>>>0<(pe[t+16>>2]|0)>>>0):0){pe[o>>2]=r+1;de[r>>0]=e;r=e&255;break}r=Pr(t,e)|0}}while(0);return r|0}function _r(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0;n=r+16|0;i=pe[n>>2]|0;if(!i)if(!(Or(r)|0)){i=pe[n>>2]|0;o=4}else n=0;else o=4;e:do{if((o|0)==4){a=r+20|0;o=pe[a>>2]|0;if((i-o|0)>>>0>>0){n=Cn[pe[r+36>>2]&7](r,e,t)|0;break}t:do{if((de[r+75>>0]|0)>-1){n=t;while(1){if(!n){i=o;n=0;break t}i=n+-1|0;if((de[e+i>>0]|0)==10)break;else n=i}if((Cn[pe[r+36>>2]&7](r,e,n)|0)>>>0>>0)break e;t=t-n|0;e=e+n|0;i=pe[a>>2]|0}else{i=o;n=0}}while(0);$r(i|0,e|0,t|0)|0;pe[a>>2]=(pe[a>>2]|0)+t;n=n+t|0}}while(0);return n|0}function yr(e,t){e=e|0;t=t|0;var r=0,n=0;r=ve;ve=ve+16|0;n=r;pe[n>>2]=t;t=xr(pe[64]|0,e,n)|0;ve=r;return t|0}function br(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0;n=ve;ve=ve+16|0;i=n;pe[i>>2]=r;r=Tr(e,t,i)|0;ve=n;return r|0}function xr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0;g=ve;ve=ve+224|0;f=g+120|0;p=g+80|0;d=g;h=g+136|0;n=p;i=n+40|0;do{pe[n>>2]=0;n=n+4|0}while((n|0)<(i|0));pe[f>>2]=pe[r>>2];if((Dr(0,t,f,d,p)|0)<0)r=-1;else{if((pe[e+76>>2]|0)>-1)l=Sr(e)|0;else l=0;r=pe[e>>2]|0;c=r&32;if((de[e+74>>0]|0)<1)pe[e>>2]=r&-33;r=e+48|0;if(!(pe[r>>2]|0)){i=e+44|0;o=pe[i>>2]|0;pe[i>>2]=h;a=e+28|0;pe[a>>2]=h;s=e+20|0;pe[s>>2]=h;pe[r>>2]=80;u=e+16|0;pe[u>>2]=h+80;n=Dr(e,t,f,d,p)|0;if(o){Cn[pe[e+36>>2]&7](e,0,0)|0;n=(pe[s>>2]|0)==0?-1:n;pe[i>>2]=o;pe[r>>2]=0;pe[u>>2]=0;pe[a>>2]=0;pe[s>>2]=0}}else n=Dr(e,t,f,d,p)|0;r=pe[e>>2]|0;pe[e>>2]=r|c;if(l)Mr(e);r=(r&32|0)==0?n:-1}ve=g;return r|0}function wr(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+128|0;i=c+112|0;l=c;o=l;a=268;s=o+112|0;do{pe[o>>2]=pe[a>>2];o=o+4|0;a=a+4|0}while((o|0)<(s|0));if((t+-1|0)>>>0>2147483646)if(!t){t=1;u=4}else{t=cr()|0;pe[t>>2]=75;t=-1}else{i=e;u=4}if((u|0)==4){u=-2-i|0;u=t>>>0>u>>>0?u:t;pe[l+48>>2]=u;e=l+20|0;pe[e>>2]=i;pe[l+44>>2]=i;t=i+u|0;i=l+16|0;pe[i>>2]=t;pe[l+28>>2]=t;t=xr(l,r,n)|0;if(u){r=pe[e>>2]|0;de[r+(((r|0)==(pe[i>>2]|0))<<31>>31)>>0]=0}}ve=c;return t|0}function Tr(e,t,r){e=e|0;t=t|0;r=r|0;return wr(e,2147483647,t,r)|0}function Sr(e){e=e|0;return 0}function Mr(e){e=e|0;return}function Pr(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0;u=ve;ve=ve+16|0;s=u;a=t&255;de[s>>0]=a;n=e+16|0;i=pe[n>>2]|0;if(!i)if(!(Or(e)|0)){i=pe[n>>2]|0;o=4}else r=-1;else o=4;do{if((o|0)==4){n=e+20|0;o=pe[n>>2]|0;if(o>>>0>>0?(r=t&255,(r|0)!=(de[e+75>>0]|0)):0){pe[n>>2]=o+1;de[o>>0]=a;break}if((Cn[pe[e+36>>2]&7](e,s,1)|0)==1)r=ge[s>>0]|0;else r=-1}}while(0);ve=u;return r|0}function Cr(e){e=e|0;var t=0,r=0;t=ve;ve=ve+16|0;r=t;pe[r>>2]=pe[e+60>>2];e=fr(Pe(6,r|0)|0)|0;ve=t;return e|0}function kr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0;i=ve;ve=ve+32|0;o=i;n=i+20|0;pe[o>>2]=pe[e+60>>2];pe[o+4>>2]=0;pe[o+8>>2]=t;pe[o+12>>2]=n;pe[o+16>>2]=r;if((fr(Ye(140,o|0)|0)|0)<0){pe[n>>2]=-1;e=-1}else e=pe[n>>2]|0;ve=i;return e|0}function Er(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;p=ve;ve=ve+48|0;f=p+16|0;c=p;n=p+32|0;h=e+28|0;i=pe[h>>2]|0;pe[n>>2]=i;d=e+20|0;i=(pe[d>>2]|0)-i|0;pe[n+4>>2]=i;pe[n+8>>2]=t;pe[n+12>>2]=r;u=e+60|0;l=e+44|0;t=2;i=i+r|0;while(1){if(!(pe[52]|0)){pe[f>>2]=pe[u>>2];pe[f+4>>2]=n;pe[f+8>>2]=t;a=fr(Ge(146,f|0)|0)|0}else{qe(7,e|0);pe[c>>2]=pe[u>>2];pe[c+4>>2]=n;pe[c+8>>2]=t;a=fr(Ge(146,c|0)|0)|0;Se(0)}if((i|0)==(a|0)){i=6;break}if((a|0)<0){i=8;break}i=i-a|0;o=pe[n+4>>2]|0;if(a>>>0<=o>>>0)if((t|0)==2){pe[h>>2]=(pe[h>>2]|0)+a;s=o;t=2}else s=o;else{s=pe[l>>2]|0;pe[h>>2]=s;pe[d>>2]=s;s=pe[n+12>>2]|0;a=a-o|0;n=n+8|0;t=t+-1|0}pe[n>>2]=(pe[n>>2]|0)+a;pe[n+4>>2]=s-a}if((i|0)==6){f=pe[l>>2]|0;pe[e+16>>2]=f+(pe[e+48>>2]|0);e=f;pe[h>>2]=e;pe[d>>2]=e}else if((i|0)==8){pe[e+16>>2]=0;pe[h>>2]=0;pe[d>>2]=0;pe[e>>2]=pe[e>>2]|32;if((t|0)==2)r=0;else r=r-(pe[n+4>>2]|0)|0}ve=p;return r|0}function Ar(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0;i=ve;ve=ve+80|0;n=i;pe[e+36>>2]=3;if((pe[e>>2]&64|0)==0?(pe[n>>2]=pe[e+60>>2],pe[n+4>>2]=21505,pe[n+8>>2]=i+12,(Me(54,n|0)|0)!=0):0)de[e+75>>0]=-1;n=Er(e,t,r)|0;ve=i;return n|0}function Or(e){e=e|0;var t=0,r=0;t=e+74|0;r=de[t>>0]|0;de[t>>0]=r+255|r;t=pe[e>>2]|0;if(!(t&8)){pe[e+8>>2]=0;pe[e+4>>2]=0;t=pe[e+44>>2]|0;pe[e+28>>2]=t;pe[e+20>>2]=t;pe[e+16>>2]=t+(pe[e+48>>2]|0);t=0}else{pe[e>>2]=t|32;t=-1}return t|0}function Rr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0;o=t&255;n=(r|0)!=0;e:do{if(n&(e&3|0)!=0){i=t&255;while(1){if((de[e>>0]|0)==i<<24>>24){a=6;break e}e=e+1|0;r=r+-1|0;n=(r|0)!=0;if(!(n&(e&3|0)!=0)){a=5;break}}}else a=5}while(0);if((a|0)==5)if(n)a=6;else r=0;e:do{if((a|0)==6){i=t&255;if((de[e>>0]|0)!=i<<24>>24){n=_e(o,16843009)|0;t:do{if(r>>>0>3)while(1){o=pe[e>>2]^n;if((o&-2139062144^-2139062144)&o+-16843009)break;e=e+4|0;r=r+-4|0;if(r>>>0<=3){a=11;break t}}else a=11}while(0);if((a|0)==11)if(!r){r=0;break}while(1){if((de[e>>0]|0)==i<<24>>24)break e;e=e+1|0;r=r+-1|0;if(!r){r=0;break}}}}}while(0);return((r|0)!=0?e:0)|0}function Ir(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0;t=e+20|0;o=e+28|0;if((pe[t>>2]|0)>>>0>(pe[o>>2]|0)>>>0?(Cn[pe[e+36>>2]&7](e,0,0)|0,(pe[t>>2]|0)==0):0)t=-1;else{a=e+4|0;r=pe[a>>2]|0;n=e+8|0;i=pe[n>>2]|0;if(r>>>0>>0)Cn[pe[e+40>>2]&7](e,r-i|0,1)|0;pe[e+16>>2]=0;pe[o>>2]=0;pe[t>>2]=0;pe[n>>2]=0;pe[a>>2]=0;t=0}return t|0}function Dr(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0.0,c=0,f=0,h=0,d=0,p=0.0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0,$=0;$=ve;ve=ve+624|0;W=$+24|0;K=$+16|0;V=$+588|0;X=$+576|0;G=$;B=$+536|0;J=$+8|0;Z=$+528|0;A=(e|0)!=0;O=B+40|0;F=O;B=B+39|0;z=J+4|0;U=X+12|0;X=X+11|0;q=V;H=U;Y=H-q|0;R=-2-q|0;I=H+2|0;D=W+288|0;L=V+9|0;N=L;j=V+8|0;o=0;g=t;a=0;t=0;e:while(1){do{if((o|0)>-1)if((a|0)>(2147483647-o|0)){o=cr()|0;pe[o>>2]=75;o=-1;break}else{o=a+o|0;break}}while(0);a=de[g>>0]|0;if(!(a<<24>>24)){E=245;break}else s=g;t:while(1){switch(a<<24>>24){case 37:{a=s;E=9;break t}case 0:{a=s;break t}default:{}}k=s+1|0;a=de[k>>0]|0;s=k}t:do{if((E|0)==9)while(1){E=0;if((de[a+1>>0]|0)!=37)break t;s=s+1|0;a=a+2|0;if((de[a>>0]|0)==37)E=9;else break}}while(0);v=s-g|0;if(A?(pe[e>>2]&32|0)==0:0)_r(g,v,e)|0;if((s|0)!=(g|0)){g=a;a=v;continue}c=a+1|0;s=de[c>>0]|0;u=(s<<24>>24)+-48|0;if(u>>>0<10){k=(de[a+2>>0]|0)==36;c=k?a+3|0:c;s=de[c>>0]|0;d=k?u:-1;t=k?1:t}else d=-1;a=s<<24>>24;t:do{if((a&-32|0)==32){u=0;while(1){if(!(1<>24)+-32|u;c=c+1|0;s=de[c>>0]|0;a=s<<24>>24;if((a&-32|0)!=32){f=u;a=c;break}}}else{f=0;a=c}}while(0);do{if(s<<24>>24==42){u=a+1|0;s=(de[u>>0]|0)+-48|0;if(s>>>0<10?(de[a+2>>0]|0)==36:0){pe[i+(s<<2)>>2]=10;t=1;a=a+3|0;s=pe[n+((de[u>>0]|0)+-48<<3)>>2]|0}else{if(t){o=-1;break e}if(!A){m=f;a=u;t=0;k=0;break}t=(pe[r>>2]|0)+(4-1)&~(4-1);s=pe[t>>2]|0;pe[r>>2]=t+4;t=0;a=u}if((s|0)<0){m=f|8192;k=0-s|0}else{m=f;k=s}}else{u=(s<<24>>24)+-48|0;if(u>>>0<10){s=0;do{s=(s*10|0)+u|0;a=a+1|0;u=(de[a>>0]|0)+-48|0}while(u>>>0<10);if((s|0)<0){o=-1;break e}else{m=f;k=s}}else{m=f;k=0}}}while(0);t:do{if((de[a>>0]|0)==46){u=a+1|0;s=de[u>>0]|0;if(s<<24>>24!=42){c=(s<<24>>24)+-48|0;if(c>>>0<10){a=u;s=0}else{a=u;c=0;break}while(1){s=(s*10|0)+c|0;a=a+1|0;c=(de[a>>0]|0)+-48|0;if(c>>>0>=10){c=s;break t}}}u=a+2|0;s=(de[u>>0]|0)+-48|0;if(s>>>0<10?(de[a+3>>0]|0)==36:0){pe[i+(s<<2)>>2]=10;a=a+4|0;c=pe[n+((de[u>>0]|0)+-48<<3)>>2]|0;break}if(t){o=-1;break e}if(A){a=(pe[r>>2]|0)+(4-1)&~(4-1);c=pe[a>>2]|0;pe[r>>2]=a+4;a=u}else{a=u;c=0}}else c=-1}while(0);h=0;while(1){s=(de[a>>0]|0)+-65|0;if(s>>>0>57){o=-1;break e}u=a+1|0;s=de[5359+(h*58|0)+s>>0]|0;f=s&255;if((f+-1|0)>>>0<8){a=u;h=f}else{C=u;break}}if(!(s<<24>>24)){o=-1;break}u=(d|0)>-1;do{if(s<<24>>24==19)if(u){o=-1;break e}else E=52;else{if(u){pe[i+(d<<2)>>2]=f;M=n+(d<<3)|0;P=pe[M+4>>2]|0;E=G;pe[E>>2]=pe[M>>2];pe[E+4>>2]=P;E=52;break}if(!A){o=0;break e}jr(G,f,r)}}while(0);if((E|0)==52?(E=0,!A):0){g=C;a=v;continue}d=de[a>>0]|0;d=(h|0)!=0&(d&15|0)==3?d&-33:d;u=m&-65537;P=(m&8192|0)==0?m:u;t:do{switch(d|0){case 110:switch(h|0){case 0:{pe[pe[G>>2]>>2]=o;g=C;a=v;continue e}case 1:{pe[pe[G>>2]>>2]=o;g=C;a=v;continue e}case 2:{g=pe[G>>2]|0;pe[g>>2]=o;pe[g+4>>2]=((o|0)<0)<<31>>31;g=C;a=v;continue e}case 3:{Q[pe[G>>2]>>1]=o;g=C;a=v;continue e}case 4:{de[pe[G>>2]>>0]=o;g=C;a=v;continue e}case 6:{pe[pe[G>>2]>>2]=o;g=C;a=v;continue e}case 7:{g=pe[G>>2]|0;pe[g>>2]=o;pe[g+4>>2]=((o|0)<0)<<31>>31;g=C;a=v;continue e}default:{g=C;a=v;continue e}}case 112:{h=P|8;c=c>>>0>8?c:8;d=120;E=64;break}case 88:case 120:{h=P;E=64;break}case 111:{u=G;s=pe[u>>2]|0;u=pe[u+4>>2]|0;if((s|0)==0&(u|0)==0)a=O;else{a=O;do{a=a+-1|0;de[a>>0]=s&7|48;s=Kr(s|0,u|0,3)|0;u=re}while(!((s|0)==0&(u|0)==0))}if(!(P&8)){s=P;h=0;f=5839;E=77}else{h=F-a+1|0;s=P;c=(c|0)<(h|0)?h:c;h=0;f=5839;E=77}break}case 105:case 100:{s=G;a=pe[s>>2]|0;s=pe[s+4>>2]|0;if((s|0)<0){a=Wr(0,0,a|0,s|0)|0;s=re;u=G;pe[u>>2]=a;pe[u+4>>2]=s;u=1;f=5839;E=76;break t}if(!(P&2048)){f=P&1;u=f;f=(f|0)==0?5839:5841;E=76}else{u=1;f=5840;E=76}break}case 117:{s=G;a=pe[s>>2]|0;s=pe[s+4>>2]|0;u=0;f=5839;E=76;break}case 99:{de[B>>0]=pe[G>>2];g=B;s=1;h=0;d=5839;a=O;break}case 109:{a=cr()|0;a=lr(pe[a>>2]|0)|0;E=82;break}case 115:{a=pe[G>>2]|0;a=(a|0)!=0?a:5849;E=82;break}case 67:{pe[J>>2]=pe[G>>2];pe[z>>2]=0;pe[G>>2]=J;c=-1;E=86;break}case 83:{if(!c){Br(e,32,k,0,P);a=0;E=98}else E=86;break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{l=+ee[G>>3];pe[K>>2]=0;ee[te>>3]=l;if((pe[te+4>>2]|0)>=0)if(!(P&2048)){M=P&1;S=M;M=(M|0)==0?5857:5862}else{S=1;M=5859}else{l=-l;S=1;M=5856}ee[te>>3]=l;T=pe[te+4>>2]&2146435072;do{if(T>>>0<2146435072|(T|0)==2146435072&0<0){p=+dr(l,K)*2.0;s=p!=0.0;if(s)pe[K>>2]=(pe[K>>2]|0)+-1;x=d|32;if((x|0)==97){g=d&32;v=(g|0)==0?M:M+9|0;m=S|2;a=12-c|0;do{if(!(c>>>0>11|(a|0)==0)){l=8.0;do{a=a+-1|0;l=l*16.0}while((a|0)!=0);if((de[v>>0]|0)==45){l=-(l+(-p-l));break}else{l=p+l-l;break}}else l=p}while(0);s=pe[K>>2]|0;a=(s|0)<0?0-s|0:s;a=Fr(a,((a|0)<0)<<31>>31,U)|0;if((a|0)==(U|0)){de[X>>0]=48;a=X}de[a+-1>>0]=(s>>31&2)+43;h=a+-2|0;de[h>>0]=d+15;f=(c|0)<1;u=(P&8|0)==0;s=V;while(1){M=~~l;a=s+1|0;de[s>>0]=ge[5823+M>>0]|g;l=(l-+(M|0))*16.0;do{if((a-q|0)==1){if(u&(f&l==0.0))break;de[a>>0]=46;a=s+2|0}}while(0);if(!(l!=0.0))break;else s=a}c=(c|0)!=0&(R+a|0)<(c|0)?I+c-h|0:Y-h+a|0;u=c+m|0;Br(e,32,k,u,P);if(!(pe[e>>2]&32))_r(v,m,e)|0;Br(e,48,k,u,P^65536);a=a-q|0;if(!(pe[e>>2]&32))_r(V,a,e)|0;s=H-h|0;Br(e,48,c-(a+s)|0,0,0);if(!(pe[e>>2]&32))_r(h,s,e)|0;Br(e,32,k,u,P^8192);a=(u|0)<(k|0)?k:u;break}a=(c|0)<0?6:c;if(s){s=(pe[K>>2]|0)+-28|0;pe[K>>2]=s;l=p*268435456.0}else{l=p;s=pe[K>>2]|0}T=(s|0)<0?W:D;w=T;s=T;do{b=~~l>>>0;pe[s>>2]=b;s=s+4|0;l=(l-+(b>>>0))*1.0e9}while(l!=0.0);u=s;s=pe[K>>2]|0;if((s|0)>0){f=T;while(1){h=(s|0)>29?29:s;c=u+-4|0;do{if(c>>>0>>0)c=f;else{s=0;do{b=Zr(pe[c>>2]|0,0,h|0)|0;b=Jr(b|0,re|0,s|0,0)|0;s=re;y=sn(b|0,s|0,1e9,0)|0;pe[c>>2]=y;s=an(b|0,s|0,1e9,0)|0;c=c+-4|0}while(c>>>0>=f>>>0);if(!s){c=f;break}c=f+-4|0;pe[c>>2]=s}}while(0);while(1){if(u>>>0<=c>>>0)break;s=u+-4|0;if(!(pe[s>>2]|0))u=s;else break}s=(pe[K>>2]|0)-h|0;pe[K>>2]=s;if((s|0)>0)f=c;else break}}else c=T;if((s|0)<0){v=((a+25|0)/9|0)+1|0;_=(x|0)==102;g=c;while(1){m=0-s|0;m=(m|0)>9?9:m;do{if(g>>>0>>0){s=(1<>>m;c=0;h=g;do{b=pe[h>>2]|0;pe[h>>2]=(b>>>m)+c;c=_e(b&s,f)|0;h=h+4|0}while(h>>>0>>0);s=(pe[g>>2]|0)==0?g+4|0:g;if(!c){c=s;break}pe[u>>2]=c;c=s;u=u+4|0}else c=(pe[g>>2]|0)==0?g+4|0:g}while(0);s=_?T:c;u=(u-s>>2|0)>(v|0)?s+(v<<2)|0:u;s=(pe[K>>2]|0)+m|0;pe[K>>2]=s;if((s|0)>=0){g=c;break}else g=c}}else g=c;do{if(g>>>0>>0){s=(w-g>>2)*9|0;f=pe[g>>2]|0;if(f>>>0<10)break;else c=10;do{c=c*10|0;s=s+1|0}while(f>>>0>=c>>>0)}else s=0}while(0);y=(x|0)==103;b=(a|0)!=0;c=a-((x|0)!=102?s:0)+((b&y)<<31>>31)|0;if((c|0)<(((u-w>>2)*9|0)+-9|0)){h=c+9216|0;_=(h|0)/9|0;c=T+(_+-1023<<2)|0;h=((h|0)%9|0)+1|0;if((h|0)<9){f=10;do{f=f*10|0;h=h+1|0}while((h|0)!=9)}else f=10;m=pe[c>>2]|0;v=(m>>>0)%(f>>>0)|0;if((v|0)==0?(T+(_+-1022<<2)|0)==(u|0):0)f=g;else E=163;do{if((E|0)==163){E=0;p=(((m>>>0)/(f>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;h=(f|0)/2|0;do{if(v>>>0>>0)l=.5;else{if((v|0)==(h|0)?(T+(_+-1022<<2)|0)==(u|0):0){l=1.0;break}l=1.5}}while(0);do{if(S){if((de[M>>0]|0)!=45)break;p=-p;l=-l}}while(0);h=m-v|0;pe[c>>2]=h;if(!(p+l!=p)){f=g;break}x=h+f|0;pe[c>>2]=x;if(x>>>0>999999999){s=g;while(1){f=c+-4|0;pe[c>>2]=0;if(f>>>0>>0){s=s+-4|0;pe[s>>2]=0}x=(pe[f>>2]|0)+1|0;pe[f>>2]=x;if(x>>>0>999999999)c=f;else{g=s;c=f;break}}}s=(w-g>>2)*9|0;h=pe[g>>2]|0;if(h>>>0<10){f=g;break}else f=10;do{f=f*10|0;s=s+1|0}while(h>>>0>=f>>>0);f=g}}while(0);x=c+4|0;g=f;u=u>>>0>x>>>0?x:u}v=0-s|0;while(1){if(u>>>0<=g>>>0){_=0;x=u;break}c=u+-4|0;if(!(pe[c>>2]|0))u=c;else{_=1;x=u;break}}do{if(y){a=(b&1^1)+a|0;if((a|0)>(s|0)&(s|0)>-5){d=d+-1|0;a=a+-1-s|0}else{d=d+-2|0;a=a+-1|0}u=P&8;if(u)break;do{if(_){u=pe[x+-4>>2]|0;if(!u){c=9;break}if(!((u>>>0)%10|0)){f=10;c=0}else{c=0;break}do{f=f*10|0;c=c+1|0}while(((u>>>0)%(f>>>0)|0|0)==0)}else c=9}while(0);u=((x-w>>2)*9|0)+-9|0;if((d|32|0)==102){u=u-c|0;u=(u|0)<0?0:u;a=(a|0)<(u|0)?a:u;u=0;break}else{u=u+s-c|0;u=(u|0)<0?0:u;a=(a|0)<(u|0)?a:u;u=0;break}}else u=P&8}while(0);m=a|u;f=(m|0)!=0&1;h=(d|32|0)==102;if(h){s=(s|0)>0?s:0;d=0}else{c=(s|0)<0?v:s;c=Fr(c,((c|0)<0)<<31>>31,U)|0;if((H-c|0)<2)do{c=c+-1|0;de[c>>0]=48}while((H-c|0)<2);de[c+-1>>0]=(s>>31&2)+43;w=c+-2|0;de[w>>0]=d;s=H-w|0;d=w}v=S+1+a+f+s|0;Br(e,32,k,v,P);if(!(pe[e>>2]&32))_r(M,S,e)|0;Br(e,48,k,v,P^65536);do{if(h){c=g>>>0>T>>>0?T:g;s=c;do{u=Fr(pe[s>>2]|0,0,L)|0;do{if((s|0)==(c|0)){if((u|0)!=(L|0))break;de[j>>0]=48;u=j}else{if(u>>>0<=V>>>0)break;do{u=u+-1|0;de[u>>0]=48}while(u>>>0>V>>>0)}}while(0);if(!(pe[e>>2]&32))_r(u,N-u|0,e)|0;s=s+4|0}while(s>>>0<=T>>>0);do{if(m){if(pe[e>>2]&32)break;_r(5891,1,e)|0}}while(0);if((a|0)>0&s>>>0>>0){u=s;while(1){s=Fr(pe[u>>2]|0,0,L)|0;if(s>>>0>V>>>0)do{s=s+-1|0;de[s>>0]=48}while(s>>>0>V>>>0);if(!(pe[e>>2]&32))_r(s,(a|0)>9?9:a,e)|0;u=u+4|0;s=a+-9|0;if(!((a|0)>9&u>>>0>>0)){a=s;break}else a=s}}Br(e,48,a+9|0,9,0)}else{h=_?x:g+4|0;if((a|0)>-1){f=(u|0)==0;c=g;do{s=Fr(pe[c>>2]|0,0,L)|0;if((s|0)==(L|0)){de[j>>0]=48;s=j}do{if((c|0)==(g|0)){u=s+1|0;if(!(pe[e>>2]&32))_r(s,1,e)|0;if(f&(a|0)<1){s=u;break}if(pe[e>>2]&32){s=u;break}_r(5891,1,e)|0;s=u}else{if(s>>>0<=V>>>0)break;do{s=s+-1|0;de[s>>0]=48}while(s>>>0>V>>>0)}}while(0);u=N-s|0;if(!(pe[e>>2]&32))_r(s,(a|0)>(u|0)?u:a,e)|0;a=a-u|0;c=c+4|0}while(c>>>0>>0&(a|0)>-1)}Br(e,48,a+18|0,18,0);if(pe[e>>2]&32)break;_r(d,H-d|0,e)|0}}while(0);Br(e,32,k,v,P^8192);a=(v|0)<(k|0)?k:v}else{h=(d&32|0)!=0;f=l!=l|0.0!=0.0;s=f?0:S;c=s+3|0;Br(e,32,k,c,u);a=pe[e>>2]|0;if(!(a&32)){_r(M,s,e)|0;a=pe[e>>2]|0}if(!(a&32))_r(f?h?5883:5887:h?5875:5879,3,e)|0;Br(e,32,k,c,P^8192);a=(c|0)<(k|0)?k:c}}while(0);g=C;continue e}default:{u=P;s=c;h=0;d=5839;a=O}}}while(0);t:do{if((E|0)==64){u=G;s=pe[u>>2]|0;u=pe[u+4>>2]|0;f=d&32;if(!((s|0)==0&(u|0)==0)){a=O;do{a=a+-1|0;de[a>>0]=ge[5823+(s&15)>>0]|f;s=Kr(s|0,u|0,4)|0;u=re}while(!((s|0)==0&(u|0)==0));E=G;if((h&8|0)==0|(pe[E>>2]|0)==0&(pe[E+4>>2]|0)==0){s=h;h=0;f=5839;E=77}else{s=h;h=2;f=5839+(d>>4)|0;E=77}}else{a=O;s=h;h=0;f=5839;E=77}}else if((E|0)==76){a=Fr(a,s,O)|0;s=P;h=u;E=77}else if((E|0)==82){E=0;P=Rr(a,0,c)|0;M=(P|0)==0;g=a;s=M?c:P-a|0;h=0;d=5839;a=M?a+c|0:P}else if((E|0)==86){E=0;s=0;a=0;f=pe[G>>2]|0;while(1){u=pe[f>>2]|0;if(!u)break;a=gr(Z,u)|0;if((a|0)<0|a>>>0>(c-s|0)>>>0)break;s=a+s|0;if(c>>>0>s>>>0)f=f+4|0;else break}if((a|0)<0){o=-1;break e}Br(e,32,k,s,P);if(!s){a=0;E=98}else{u=0;c=pe[G>>2]|0;while(1){a=pe[c>>2]|0;if(!a){a=s;E=98;break t}a=gr(Z,a)|0;u=a+u|0;if((u|0)>(s|0)){a=s;E=98;break t}if(!(pe[e>>2]&32))_r(Z,a,e)|0;if(u>>>0>=s>>>0){a=s;E=98;break}else c=c+4|0}}}}while(0);if((E|0)==98){E=0;Br(e,32,k,a,P^8192);g=C;a=(k|0)>(a|0)?k:a;continue}if((E|0)==77){E=0;u=(c|0)>-1?s&-65537:s;s=G;s=(pe[s>>2]|0)!=0|(pe[s+4>>2]|0)!=0;if((c|0)!=0|s){s=(s&1^1)+(F-a)|0;g=a;s=(c|0)>(s|0)?c:s;d=f;a=O}else{g=O;s=0;d=f;a=O}}f=a-g|0;s=(s|0)<(f|0)?f:s;c=h+s|0;a=(k|0)<(c|0)?c:k;Br(e,32,a,c,u);if(!(pe[e>>2]&32))_r(d,h,e)|0;Br(e,48,a,c,u^65536);Br(e,48,s,f,0);if(!(pe[e>>2]&32))_r(g,f,e)|0;Br(e,32,a,c,u^8192);g=C}e:do{if((E|0)==245)if(!e)if(t){o=1;while(1){t=pe[i+(o<<2)>>2]|0;if(!t)break;jr(n+(o<<3)|0,t,r);o=o+1|0;if((o|0)>=10){o=1;break e}}if((o|0)<10)while(1){if(pe[i+(o<<2)>>2]|0){o=-1;break e}o=o+1|0;if((o|0)>=10){o=1;break}}else o=1}else o=0}while(0);ve=$;return o|0}function Lr(e){e=e|0;if(!(pe[e+68>>2]|0))Mr(e);return}function Nr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0;n=e+20|0;i=pe[n>>2]|0;e=(pe[e+16>>2]|0)-i|0;e=e>>>0>r>>>0?r:e;$r(i|0,t|0,e|0)|0;pe[n>>2]=(pe[n>>2]|0)+e;return r|0}function jr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0.0;e:do{if(t>>>0<=20)do{switch(t|0){case 9:{n=(pe[r>>2]|0)+(4-1)&~(4-1);t=pe[n>>2]|0;pe[r>>2]=n+4;pe[e>>2]=t;break e}case 10:{n=(pe[r>>2]|0)+(4-1)&~(4-1);t=pe[n>>2]|0;pe[r>>2]=n+4;n=e;pe[n>>2]=t;pe[n+4>>2]=((t|0)<0)<<31>>31;break e}case 11:{n=(pe[r>>2]|0)+(4-1)&~(4-1);t=pe[n>>2]|0;pe[r>>2]=n+4;n=e;pe[n>>2]=t;pe[n+4>>2]=0;break e}case 12:{n=(pe[r>>2]|0)+(8-1)&~(8-1);t=n;i=pe[t>>2]|0;t=pe[t+4>>2]|0;pe[r>>2]=n+8;n=e;pe[n>>2]=i;pe[n+4>>2]=t;break e}case 13:{i=(pe[r>>2]|0)+(4-1)&~(4-1);n=pe[i>>2]|0;pe[r>>2]=i+4;n=(n&65535)<<16>>16;i=e;pe[i>>2]=n;pe[i+4>>2]=((n|0)<0)<<31>>31;break e}case 14:{i=(pe[r>>2]|0)+(4-1)&~(4-1);n=pe[i>>2]|0;pe[r>>2]=i+4;i=e;pe[i>>2]=n&65535;pe[i+4>>2]=0;break e}case 15:{i=(pe[r>>2]|0)+(4-1)&~(4-1);n=pe[i>>2]|0;pe[r>>2]=i+4;n=(n&255)<<24>>24;i=e;pe[i>>2]=n;pe[i+4>>2]=((n|0)<0)<<31>>31;break e}case 16:{i=(pe[r>>2]|0)+(4-1)&~(4-1);n=pe[i>>2]|0;pe[r>>2]=i+4;i=e;pe[i>>2]=n&255;pe[i+4>>2]=0;break e}case 17:{i=(pe[r>>2]|0)+(8-1)&~(8-1);o=+ee[i>>3];pe[r>>2]=i+8;ee[e>>3]=o;break e}case 18:{i=(pe[r>>2]|0)+(8-1)&~(8-1);o=+ee[i>>3];pe[r>>2]=i+8;ee[e>>3]=o;break e}default:break e}}while(0)}while(0);return}function Fr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0;if(t>>>0>0|(t|0)==0&e>>>0>4294967295)while(1){n=sn(e|0,t|0,10,0)|0;r=r+-1|0;de[r>>0]=n|48;n=an(e|0,t|0,10,0)|0;if(t>>>0>9|(t|0)==9&e>>>0>4294967295){e=n;t=re}else{e=n;break}}if(e)while(1){r=r+-1|0;de[r>>0]=(e>>>0)%10|0|48;if(e>>>0<10)break;else e=(e>>>0)/10|0}return r|0}function Br(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0;s=ve;ve=ve+256|0;a=s;do{if((r|0)>(n|0)&(i&73728|0)==0){i=r-n|0;Vr(a|0,t|0,(i>>>0>256?256:i)|0)|0;t=pe[e>>2]|0;o=(t&32|0)==0;if(i>>>0>255){n=r-n|0;do{if(o){_r(a,256,e)|0;t=pe[e>>2]|0}i=i+-256|0;o=(t&32|0)==0}while(i>>>0>255);if(o)i=n&255;else break}else if(!o)break;_r(a,i,e)|0}}while(0);ve=s;return}function zr(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0;do{if(e>>>0<245){d=e>>>0<11?16:e+11&-8;e=d>>>3;s=pe[151]|0;r=s>>>e;if(r&3){e=(r&1^1)+e|0;n=e<<1;r=644+(n<<2)|0;n=644+(n+2<<2)|0;i=pe[n>>2]|0;o=i+8|0;a=pe[o>>2]|0;do{if((r|0)!=(a|0)){if(a>>>0<(pe[155]|0)>>>0)Xe();t=a+12|0;if((pe[t>>2]|0)==(i|0)){pe[t>>2]=r;pe[n>>2]=a;break}else Xe()}else pe[151]=s&~(1<>2]=j|3;j=i+(j|4)|0;pe[j>>2]=pe[j>>2]|1;j=o;return j|0}a=pe[153]|0;if(d>>>0>a>>>0){if(r){n=2<>>12&16;n=n>>>u;i=n>>>5&8;n=n>>>i;o=n>>>2&4;n=n>>>o;r=n>>>1&2;n=n>>>r;e=n>>>1&1;e=(i|u|o|r|e)+(n>>>e)|0;n=e<<1;r=644+(n<<2)|0;n=644+(n+2<<2)|0;o=pe[n>>2]|0;u=o+8|0;i=pe[u>>2]|0;do{if((r|0)!=(i|0)){if(i>>>0<(pe[155]|0)>>>0)Xe();t=i+12|0;if((pe[t>>2]|0)==(o|0)){pe[t>>2]=r;pe[n>>2]=i;l=pe[153]|0;break}else Xe()}else{pe[151]=s&~(1<>2]=d|3;s=o+d|0;pe[o+(d|4)>>2]=a|1;pe[o+j>>2]=a;if(l){i=pe[156]|0;r=l>>>3;t=r<<1;n=644+(t<<2)|0;e=pe[151]|0;r=1<>2]|0;if(t>>>0<(pe[155]|0)>>>0)Xe();else{c=e;f=t}}else{pe[151]=e|r;c=644+(t+2<<2)|0;f=n}pe[c>>2]=i;pe[f+12>>2]=i;pe[i+8>>2]=f;pe[i+12>>2]=n}pe[153]=a;pe[156]=s;j=u;return j|0}e=pe[152]|0;if(e){r=(e&0-e)+-1|0;N=r>>>12&16;r=r>>>N;L=r>>>5&8;r=r>>>L;j=r>>>2&4;r=r>>>j;e=r>>>1&2;r=r>>>e;n=r>>>1&1;n=pe[908+((L|N|j|e|n)+(r>>>n)<<2)>>2]|0;r=(pe[n+4>>2]&-8)-d|0;e=n;while(1){t=pe[e+16>>2]|0;if(!t){t=pe[e+20>>2]|0;if(!t){u=r;break}}e=(pe[t+4>>2]&-8)-d|0;j=e>>>0>>0;r=j?e:r;e=t;n=j?t:n}o=pe[155]|0;if(n>>>0>>0)Xe();s=n+d|0;if(n>>>0>=s>>>0)Xe();a=pe[n+24>>2]|0;r=pe[n+12>>2]|0;do{if((r|0)==(n|0)){e=n+20|0;t=pe[e>>2]|0;if(!t){e=n+16|0;t=pe[e>>2]|0;if(!t){h=0;break}}while(1){r=t+20|0;i=pe[r>>2]|0;if(i){t=i;e=r;continue}r=t+16|0;i=pe[r>>2]|0;if(!i)break;else{t=i;e=r}}if(e>>>0>>0)Xe();else{pe[e>>2]=0;h=t;break}}else{i=pe[n+8>>2]|0;if(i>>>0>>0)Xe();t=i+12|0;if((pe[t>>2]|0)!=(n|0))Xe();e=r+8|0;if((pe[e>>2]|0)==(n|0)){pe[t>>2]=r;pe[e>>2]=i;h=r;break}else Xe()}}while(0);do{if(a){t=pe[n+28>>2]|0;e=908+(t<<2)|0;if((n|0)==(pe[e>>2]|0)){pe[e>>2]=h;if(!h){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=a+16|0;if((pe[t>>2]|0)==(n|0))pe[t>>2]=h;else pe[a+20>>2]=h;if(!h)break}e=pe[155]|0;if(h>>>0>>0)Xe();pe[h+24>>2]=a;t=pe[n+16>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{pe[h+16>>2]=t;pe[t+24>>2]=h;break}}while(0);t=pe[n+20>>2]|0;if(t)if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[h+20>>2]=t;pe[t+24>>2]=h;break}}}while(0);if(u>>>0<16){j=u+d|0;pe[n+4>>2]=j|3;j=n+(j+4)|0;pe[j>>2]=pe[j>>2]|1}else{pe[n+4>>2]=d|3;pe[n+(d|4)>>2]=u|1;pe[n+(u+d)>>2]=u;t=pe[153]|0;if(t){o=pe[156]|0;r=t>>>3;t=r<<1;i=644+(t<<2)|0;e=pe[151]|0;r=1<>2]|0;if(e>>>0<(pe[155]|0)>>>0)Xe();else{p=t;g=e}}else{pe[151]=e|r;p=644+(t+2<<2)|0;g=i}pe[p>>2]=o;pe[g+12>>2]=o;pe[o+8>>2]=g;pe[o+12>>2]=i}pe[153]=u;pe[156]=s}j=n+8|0;return j|0}else g=d}else g=d}else if(e>>>0<=4294967231){e=e+11|0;f=e&-8;c=pe[152]|0;if(c){r=0-f|0;e=e>>>8;if(e)if(f>>>0>16777215)l=31;else{g=(e+1048320|0)>>>16&8;b=e<>>16&4;b=b<>>16&2;l=14-(p|g|l)+(b<>>15)|0;l=f>>>(l+7|0)&1|l<<1}else l=0;e=pe[908+(l<<2)>>2]|0;e:do{if(!e){i=0;e=0;b=86}else{a=r;i=0;s=f<<((l|0)==31?0:25-(l>>>1)|0);u=e;e=0;while(1){o=pe[u+4>>2]&-8;r=o-f|0;if(r>>>0>>0)if((o|0)==(f|0)){o=u;e=u;b=90;break e}else e=u;else r=a;b=pe[u+20>>2]|0;u=pe[u+16+(s>>>31<<2)>>2]|0;i=(b|0)==0|(b|0)==(u|0)?i:b;if(!u){b=86;break}else{a=r;s=s<<1}}}}while(0);if((b|0)==86){if((i|0)==0&(e|0)==0){e=2<>>12&16;e=e>>>h;c=e>>>5&8;e=e>>>c;p=e>>>2&4;e=e>>>p;g=e>>>1&2;e=e>>>g;i=e>>>1&1;i=pe[908+((c|h|p|g|i)+(e>>>i)<<2)>>2]|0;e=0}if(!i){s=r;u=e}else{o=i;b=90}}if((b|0)==90)while(1){b=0;g=(pe[o+4>>2]&-8)-f|0;i=g>>>0>>0;r=i?g:r;e=i?o:e;i=pe[o+16>>2]|0;if(i){o=i;b=90;continue}o=pe[o+20>>2]|0;if(!o){s=r;u=e;break}else b=90}if((u|0)!=0?s>>>0<((pe[153]|0)-f|0)>>>0:0){i=pe[155]|0;if(u>>>0>>0)Xe();a=u+f|0;if(u>>>0>=a>>>0)Xe();o=pe[u+24>>2]|0;r=pe[u+12>>2]|0;do{if((r|0)==(u|0)){e=u+20|0;t=pe[e>>2]|0;if(!t){e=u+16|0;t=pe[e>>2]|0;if(!t){d=0;break}}while(1){r=t+20|0;n=pe[r>>2]|0;if(n){t=n;e=r;continue}r=t+16|0;n=pe[r>>2]|0;if(!n)break;else{t=n;e=r}}if(e>>>0>>0)Xe();else{pe[e>>2]=0;d=t;break}}else{n=pe[u+8>>2]|0;if(n>>>0>>0)Xe();t=n+12|0;if((pe[t>>2]|0)!=(u|0))Xe();e=r+8|0;if((pe[e>>2]|0)==(u|0)){pe[t>>2]=r;pe[e>>2]=n;d=r;break}else Xe()}}while(0);do{if(o){t=pe[u+28>>2]|0;e=908+(t<<2)|0;if((u|0)==(pe[e>>2]|0)){pe[e>>2]=d;if(!d){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=o+16|0;if((pe[t>>2]|0)==(u|0))pe[t>>2]=d;else pe[o+20>>2]=d;if(!d)break}e=pe[155]|0;if(d>>>0>>0)Xe();pe[d+24>>2]=o;t=pe[u+16>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{pe[d+16>>2]=t;pe[t+24>>2]=d;break}}while(0);t=pe[u+20>>2]|0;if(t)if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[d+20>>2]=t;pe[t+24>>2]=d;break}}}while(0);e:do{if(s>>>0>=16){pe[u+4>>2]=f|3;pe[u+(f|4)>>2]=s|1;pe[u+(s+f)>>2]=s;t=s>>>3;if(s>>>0<256){e=t<<1;n=644+(e<<2)|0;r=pe[151]|0;t=1<>2]|0;if(e>>>0<(pe[155]|0)>>>0)Xe();else{v=t;_=e}}else{pe[151]=r|t;v=644+(e+2<<2)|0;_=n}pe[v>>2]=a;pe[_+12>>2]=a;pe[u+(f+8)>>2]=_;pe[u+(f+12)>>2]=n;break}t=s>>>8;if(t)if(s>>>0>16777215)n=31;else{N=(t+1048320|0)>>>16&8;j=t<>>16&4;j=j<>>16&2;n=14-(L|N|n)+(j<>>15)|0;n=s>>>(n+7|0)&1|n<<1}else n=0;t=908+(n<<2)|0;pe[u+(f+28)>>2]=n;pe[u+(f+20)>>2]=0;pe[u+(f+16)>>2]=0;e=pe[152]|0;r=1<>2]=a;pe[u+(f+24)>>2]=t;pe[u+(f+12)>>2]=a;pe[u+(f+8)>>2]=a;break}t=pe[t>>2]|0;t:do{if((pe[t+4>>2]&-8|0)!=(s|0)){n=s<<((n|0)==31?0:25-(n>>>1)|0);while(1){e=t+16+(n>>>31<<2)|0;r=pe[e>>2]|0;if(!r)break;if((pe[r+4>>2]&-8|0)==(s|0)){T=r;break t}else{n=n<<1;t=r}}if(e>>>0<(pe[155]|0)>>>0)Xe();else{pe[e>>2]=a;pe[u+(f+24)>>2]=t;pe[u+(f+12)>>2]=a;pe[u+(f+8)>>2]=a;break e}}else T=t}while(0);t=T+8|0;e=pe[t>>2]|0;j=pe[155]|0;if(e>>>0>=j>>>0&T>>>0>=j>>>0){pe[e+12>>2]=a;pe[t>>2]=a;pe[u+(f+8)>>2]=e;pe[u+(f+12)>>2]=T;pe[u+(f+24)>>2]=0;break}else Xe()}else{j=s+f|0;pe[u+4>>2]=j|3;j=u+(j+4)|0;pe[j>>2]=pe[j>>2]|1}}while(0);j=u+8|0;return j|0}else g=f}else g=f}else g=-1}while(0);r=pe[153]|0;if(r>>>0>=g>>>0){t=r-g|0;e=pe[156]|0;if(t>>>0>15){pe[156]=e+g;pe[153]=t;pe[e+(g+4)>>2]=t|1;pe[e+r>>2]=t;pe[e+4>>2]=g|3}else{pe[153]=0;pe[156]=0;pe[e+4>>2]=r|3;j=e+(r+4)|0;pe[j>>2]=pe[j>>2]|1}j=e+8|0;return j|0}e=pe[154]|0;if(e>>>0>g>>>0){N=e-g|0;pe[154]=N;j=pe[157]|0;pe[157]=j+g;pe[j+(g+4)>>2]=N|1;pe[j+4>>2]=g|3;j=j+8|0;return j|0}do{if(!(pe[269]|0)){e=Ie(30)|0;if(!(e+-1&e)){pe[271]=e;pe[270]=e;pe[272]=-1;pe[273]=-1;pe[274]=0;pe[262]=0;T=(He(0)|0)&-16^1431655768;pe[269]=T;break}else Xe()}}while(0);u=g+48|0;s=pe[271]|0;l=g+47|0;a=s+l|0;s=0-s|0;c=a&s;if(c>>>0<=g>>>0){j=0;return j|0}e=pe[261]|0;if((e|0)!=0?(_=pe[259]|0,T=_+c|0,T>>>0<=_>>>0|T>>>0>e>>>0):0){j=0;return j|0}e:do{if(!(pe[262]&4)){e=pe[157]|0;t:do{if(e){i=1052;while(1){r=pe[i>>2]|0;if(r>>>0<=e>>>0?(m=i+4|0,(r+(pe[m>>2]|0)|0)>>>0>e>>>0):0){o=i;e=m;break}i=pe[i+8>>2]|0;if(!i){b=174;break t}}r=a-(pe[154]|0)&s;if(r>>>0<2147483647){i=Ae(r|0)|0;T=(i|0)==((pe[o>>2]|0)+(pe[e>>2]|0)|0);e=T?r:0;if(T){if((i|0)!=(-1|0)){x=i;p=e;b=194;break e}}else b=184}else e=0}else b=174}while(0);do{if((b|0)==174){o=Ae(0)|0;if((o|0)!=(-1|0)){e=o;r=pe[270]|0;i=r+-1|0;if(!(i&e))r=c;else r=c-e+(i+e&0-r)|0;e=pe[259]|0;i=e+r|0;if(r>>>0>g>>>0&r>>>0<2147483647){T=pe[261]|0;if((T|0)!=0?i>>>0<=e>>>0|i>>>0>T>>>0:0){e=0;break}i=Ae(r|0)|0;T=(i|0)==(o|0);e=T?r:0;if(T){x=o;p=e;b=194;break e}else b=184}else e=0}else e=0}}while(0);t:do{if((b|0)==184){o=0-r|0;do{if(u>>>0>r>>>0&(r>>>0<2147483647&(i|0)!=(-1|0))?(y=pe[271]|0,y=l-r+y&0-y,y>>>0<2147483647):0)if((Ae(y|0)|0)==(-1|0)){Ae(o|0)|0;break t}else{r=y+r|0;break}}while(0);if((i|0)!=(-1|0)){x=i;p=r;b=194;break e}}}while(0);pe[262]=pe[262]|4;b=191}else{e=0;b=191}}while(0);if((((b|0)==191?c>>>0<2147483647:0)?(x=Ae(c|0)|0,w=Ae(0)|0,x>>>0>>0&((x|0)!=(-1|0)&(w|0)!=(-1|0))):0)?(S=w-x|0,M=S>>>0>(g+40|0)>>>0,M):0){p=M?S:e;b=194}if((b|0)==194){e=(pe[259]|0)+p|0;pe[259]=e;if(e>>>0>(pe[260]|0)>>>0)pe[260]=e;a=pe[157]|0;e:do{if(a){o=1052;do{e=pe[o>>2]|0;r=o+4|0;i=pe[r>>2]|0;if((x|0)==(e+i|0)){P=e;C=r;k=i;E=o;b=204;break}o=pe[o+8>>2]|0}while((o|0)!=0);if(((b|0)==204?(pe[E+12>>2]&8|0)==0:0)?a>>>0>>0&a>>>0>=P>>>0:0){pe[C>>2]=k+p;j=(pe[154]|0)+p|0;N=a+8|0;N=(N&7|0)==0?0:0-N&7;L=j-N|0;pe[157]=a+N;pe[154]=L;pe[a+(N+4)>>2]=L|1;pe[a+(j+4)>>2]=40;pe[158]=pe[273];break}e=pe[155]|0;if(x>>>0>>0){pe[155]=x;e=x}r=x+p|0;o=1052;while(1){if((pe[o>>2]|0)==(r|0)){i=o;r=o;b=212;break}o=pe[o+8>>2]|0;if(!o){r=1052;break}}if((b|0)==212)if(!(pe[r+12>>2]&8)){pe[i>>2]=x;h=r+4|0;pe[h>>2]=(pe[h>>2]|0)+p;h=x+8|0;h=(h&7|0)==0?0:0-h&7;l=x+(p+8)|0;l=(l&7|0)==0?0:0-l&7;t=x+(l+p)|0;f=h+g|0;d=x+f|0;c=t-(x+h)-g|0;pe[x+(h+4)>>2]=g|3;t:do{if((t|0)!=(a|0)){if((t|0)==(pe[156]|0)){j=(pe[153]|0)+c|0;pe[153]=j;pe[156]=d;pe[x+(f+4)>>2]=j|1;pe[x+(j+f)>>2]=j;break}s=p+4|0;r=pe[x+(s+l)>>2]|0;if((r&3|0)==1){u=r&-8;o=r>>>3;r:do{if(r>>>0>=256){a=pe[x+((l|24)+p)>>2]|0;n=pe[x+(p+12+l)>>2]|0;do{if((n|0)==(t|0)){i=l|16;n=x+(s+i)|0;r=pe[n>>2]|0;if(!r){n=x+(i+p)|0;r=pe[n>>2]|0;if(!r){D=0;break}}while(1){i=r+20|0;o=pe[i>>2]|0;if(o){r=o;n=i;continue}i=r+16|0;o=pe[i>>2]|0;if(!o)break;else{r=o;n=i}}if(n>>>0>>0)Xe();else{pe[n>>2]=0;D=r;break}}else{i=pe[x+((l|8)+p)>>2]|0;if(i>>>0>>0)Xe();e=i+12|0;if((pe[e>>2]|0)!=(t|0))Xe();r=n+8|0;if((pe[r>>2]|0)==(t|0)){pe[e>>2]=n;pe[r>>2]=i;D=n;break}else Xe()}}while(0);if(!a)break;e=pe[x+(p+28+l)>>2]|0;r=908+(e<<2)|0;do{if((t|0)!=(pe[r>>2]|0)){if(a>>>0<(pe[155]|0)>>>0)Xe();e=a+16|0;if((pe[e>>2]|0)==(t|0))pe[e>>2]=D;else pe[a+20>>2]=D;if(!D)break r}else{pe[r>>2]=D;if(D)break;pe[152]=pe[152]&~(1<>>0>>0)Xe();pe[D+24>>2]=a;t=l|16;e=pe[x+(t+p)>>2]|0;do{if(e)if(e>>>0>>0)Xe();else{pe[D+16>>2]=e;pe[e+24>>2]=D;break}}while(0);t=pe[x+(s+t)>>2]|0;if(!t)break;if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[D+20>>2]=t;pe[t+24>>2]=D;break}}else{n=pe[x+((l|8)+p)>>2]|0;i=pe[x+(p+12+l)>>2]|0;r=644+(o<<1<<2)|0;do{if((n|0)!=(r|0)){if(n>>>0>>0)Xe();if((pe[n+12>>2]|0)==(t|0))break;Xe()}}while(0);if((i|0)==(n|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();e=i+8|0;if((pe[e>>2]|0)==(t|0)){A=e;break}Xe()}}while(0);pe[n+12>>2]=i;pe[A>>2]=n}}while(0);t=x+((u|l)+p)|0;i=u+c|0}else i=c;t=t+4|0;pe[t>>2]=pe[t>>2]&-2;pe[x+(f+4)>>2]=i|1;pe[x+(i+f)>>2]=i;t=i>>>3;if(i>>>0<256){e=t<<1;n=644+(e<<2)|0;r=pe[151]|0;t=1<>2]|0;if(e>>>0>=(pe[155]|0)>>>0){L=t;N=e;break}Xe()}}while(0);pe[L>>2]=d;pe[N+12>>2]=d;pe[x+(f+8)>>2]=N;pe[x+(f+12)>>2]=n;break}t=i>>>8;do{if(!t)n=0;else{if(i>>>0>16777215){n=31;break}L=(t+1048320|0)>>>16&8;N=t<>>16&4;N=N<>>16&2;n=14-(D|L|n)+(N<>>15)|0;n=i>>>(n+7|0)&1|n<<1}}while(0);t=908+(n<<2)|0;pe[x+(f+28)>>2]=n;pe[x+(f+20)>>2]=0;pe[x+(f+16)>>2]=0;e=pe[152]|0;r=1<>2]=d;pe[x+(f+24)>>2]=t;pe[x+(f+12)>>2]=d;pe[x+(f+8)>>2]=d;break}t=pe[t>>2]|0;r:do{if((pe[t+4>>2]&-8|0)!=(i|0)){n=i<<((n|0)==31?0:25-(n>>>1)|0);while(1){e=t+16+(n>>>31<<2)|0;r=pe[e>>2]|0;if(!r)break;if((pe[r+4>>2]&-8|0)==(i|0)){j=r;break r}else{n=n<<1;t=r}}if(e>>>0<(pe[155]|0)>>>0)Xe();else{pe[e>>2]=d;pe[x+(f+24)>>2]=t;pe[x+(f+12)>>2]=d;pe[x+(f+8)>>2]=d;break t}}else j=t}while(0);t=j+8|0;e=pe[t>>2]|0;N=pe[155]|0;if(e>>>0>=N>>>0&j>>>0>=N>>>0){pe[e+12>>2]=d;pe[t>>2]=d;pe[x+(f+8)>>2]=e;pe[x+(f+12)>>2]=j;pe[x+(f+24)>>2]=0;break}else Xe()}else{j=(pe[154]|0)+c|0;pe[154]=j;pe[157]=d;pe[x+(f+4)>>2]=j|1}}while(0);j=x+(h|8)|0;return j|0}else r=1052;while(1){e=pe[r>>2]|0;if(e>>>0<=a>>>0?(t=pe[r+4>>2]|0,n=e+t|0,n>>>0>a>>>0):0)break;r=pe[r+8>>2]|0}i=e+(t+-39)|0;e=e+(t+-47+((i&7|0)==0?0:0-i&7))|0;i=a+16|0;e=e>>>0>>0?a:e;t=e+8|0;r=x+8|0;r=(r&7|0)==0?0:0-r&7;j=p+-40-r|0;pe[157]=x+r;pe[154]=j;pe[x+(r+4)>>2]=j|1;pe[x+(p+-36)>>2]=40;pe[158]=pe[273];r=e+4|0;pe[r>>2]=27;pe[t>>2]=pe[263];pe[t+4>>2]=pe[264];pe[t+8>>2]=pe[265];pe[t+12>>2]=pe[266];pe[263]=x;pe[264]=p;pe[266]=0;pe[265]=t;t=e+28|0;pe[t>>2]=7;if((e+32|0)>>>0>>0)do{j=t;t=t+4|0;pe[t>>2]=7}while((j+8|0)>>>0>>0);if((e|0)!=(a|0)){o=e-a|0;pe[r>>2]=pe[r>>2]&-2;pe[a+4>>2]=o|1;pe[e>>2]=o;t=o>>>3;if(o>>>0<256){e=t<<1;n=644+(e<<2)|0;r=pe[151]|0;t=1<>2]|0;if(e>>>0<(pe[155]|0)>>>0)Xe();else{O=t;R=e}}else{pe[151]=r|t;O=644+(e+2<<2)|0;R=n}pe[O>>2]=a;pe[R+12>>2]=a;pe[a+8>>2]=R;pe[a+12>>2]=n;break}t=o>>>8;if(t)if(o>>>0>16777215)n=31;else{N=(t+1048320|0)>>>16&8;j=t<>>16&4;j=j<>>16&2;n=14-(L|N|n)+(j<>>15)|0;n=o>>>(n+7|0)&1|n<<1}else n=0;r=908+(n<<2)|0;pe[a+28>>2]=n;pe[a+20>>2]=0;pe[i>>2]=0;t=pe[152]|0;e=1<>2]=a;pe[a+24>>2]=r;pe[a+12>>2]=a;pe[a+8>>2]=a;break}t=pe[r>>2]|0;t:do{if((pe[t+4>>2]&-8|0)!=(o|0)){n=o<<((n|0)==31?0:25-(n>>>1)|0);while(1){e=t+16+(n>>>31<<2)|0;r=pe[e>>2]|0;if(!r)break;if((pe[r+4>>2]&-8|0)==(o|0)){I=r;break t}else{n=n<<1;t=r}}if(e>>>0<(pe[155]|0)>>>0)Xe();else{pe[e>>2]=a;pe[a+24>>2]=t;pe[a+12>>2]=a;pe[a+8>>2]=a;break e}}else I=t}while(0);t=I+8|0;e=pe[t>>2]|0;j=pe[155]|0;if(e>>>0>=j>>>0&I>>>0>=j>>>0){pe[e+12>>2]=a;pe[t>>2]=a;pe[a+8>>2]=e;pe[a+12>>2]=I;pe[a+24>>2]=0;break}else Xe()}}else{j=pe[155]|0;if((j|0)==0|x>>>0>>0)pe[155]=x;pe[263]=x;pe[264]=p;pe[266]=0;pe[160]=pe[269];pe[159]=-1;t=0;do{j=t<<1;N=644+(j<<2)|0;pe[644+(j+3<<2)>>2]=N;pe[644+(j+2<<2)>>2]=N;t=t+1|0}while((t|0)!=32);j=x+8|0;j=(j&7|0)==0?0:0-j&7;N=p+-40-j|0;pe[157]=x+j;pe[154]=N;pe[x+(j+4)>>2]=N|1;pe[x+(p+-36)>>2]=40;pe[158]=pe[273]}}while(0);t=pe[154]|0;if(t>>>0>g>>>0){N=t-g|0;pe[154]=N;j=pe[157]|0;pe[157]=j+g;pe[j+(g+4)>>2]=N|1;pe[j+4>>2]=g|3;j=j+8|0;return j|0}}j=cr()|0;pe[j>>2]=12;j=0;return j|0}function Ur(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0;if(!e)return;t=e+-8|0;s=pe[155]|0;if(t>>>0>>0)Xe();r=pe[e+-4>>2]|0;n=r&3;if((n|0)==1)Xe();d=r&-8;g=e+(d+-8)|0;do{if(!(r&1)){t=pe[t>>2]|0;if(!n)return;u=-8-t|0;c=e+u|0;f=t+d|0;if(c>>>0>>0)Xe();if((c|0)==(pe[156]|0)){t=e+(d+-4)|0;r=pe[t>>2]|0;if((r&3|0)!=3){y=c;o=f;break}pe[153]=f;pe[t>>2]=r&-2;pe[e+(u+4)>>2]=f|1;pe[g>>2]=f;return}i=t>>>3;if(t>>>0<256){n=pe[e+(u+8)>>2]|0;r=pe[e+(u+12)>>2]|0;t=644+(i<<1<<2)|0;if((n|0)!=(t|0)){if(n>>>0>>0)Xe();if((pe[n+12>>2]|0)!=(c|0))Xe()}if((r|0)==(n|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();t=r+8|0;if((pe[t>>2]|0)==(c|0))a=t;else Xe()}else a=r+8|0;pe[n+12>>2]=r;pe[a>>2]=n;y=c;o=f;break}a=pe[e+(u+24)>>2]|0;n=pe[e+(u+12)>>2]|0;do{if((n|0)==(c|0)){r=e+(u+20)|0;t=pe[r>>2]|0;if(!t){r=e+(u+16)|0;t=pe[r>>2]|0;if(!t){l=0;break}}while(1){n=t+20|0;i=pe[n>>2]|0;if(i){t=i;r=n;continue}n=t+16|0;i=pe[n>>2]|0;if(!i)break;else{t=i;r=n}}if(r>>>0>>0)Xe();else{pe[r>>2]=0;l=t;break}}else{i=pe[e+(u+8)>>2]|0;if(i>>>0>>0)Xe();t=i+12|0;if((pe[t>>2]|0)!=(c|0))Xe();r=n+8|0;if((pe[r>>2]|0)==(c|0)){pe[t>>2]=n;pe[r>>2]=i;l=n;break}else Xe()}}while(0);if(a){t=pe[e+(u+28)>>2]|0;r=908+(t<<2)|0;if((c|0)==(pe[r>>2]|0)){pe[r>>2]=l;if(!l){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=a+16|0;if((pe[t>>2]|0)==(c|0))pe[t>>2]=l;else pe[a+20>>2]=l;if(!l){y=c;o=f;break}}r=pe[155]|0;if(l>>>0>>0)Xe();pe[l+24>>2]=a;t=pe[e+(u+16)>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{pe[l+16>>2]=t;pe[t+24>>2]=l;break}}while(0);t=pe[e+(u+20)>>2]|0;if(t)if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[l+20>>2]=t;pe[t+24>>2]=l;y=c;o=f;break}else{y=c;o=f}}else{y=c;o=f}}else{y=t;o=d}}while(0);if(y>>>0>=g>>>0)Xe();t=e+(d+-4)|0;r=pe[t>>2]|0;if(!(r&1))Xe();if(!(r&2)){if((g|0)==(pe[157]|0)){_=(pe[154]|0)+o|0;pe[154]=_;pe[157]=y;pe[y+4>>2]=_|1;if((y|0)!=(pe[156]|0))return;pe[156]=0;pe[153]=0;return}if((g|0)==(pe[156]|0)){_=(pe[153]|0)+o|0;pe[153]=_;pe[156]=y;pe[y+4>>2]=_|1;pe[y+_>>2]=_;return}o=(r&-8)+o|0;i=r>>>3;do{if(r>>>0>=256){a=pe[e+(d+16)>>2]|0;t=pe[e+(d|4)>>2]|0;do{if((t|0)==(g|0)){r=e+(d+12)|0;t=pe[r>>2]|0;if(!t){r=e+(d+8)|0;t=pe[r>>2]|0;if(!t){p=0;break}}while(1){n=t+20|0;i=pe[n>>2]|0;if(i){t=i;r=n;continue}n=t+16|0;i=pe[n>>2]|0;if(!i)break;else{t=i;r=n}}if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[r>>2]=0;p=t;break}}else{r=pe[e+d>>2]|0;if(r>>>0<(pe[155]|0)>>>0)Xe();n=r+12|0;if((pe[n>>2]|0)!=(g|0))Xe();i=t+8|0;if((pe[i>>2]|0)==(g|0)){pe[n>>2]=t;pe[i>>2]=r;p=t;break}else Xe()}}while(0);if(a){t=pe[e+(d+20)>>2]|0;r=908+(t<<2)|0;if((g|0)==(pe[r>>2]|0)){pe[r>>2]=p;if(!p){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=a+16|0;if((pe[t>>2]|0)==(g|0))pe[t>>2]=p;else pe[a+20>>2]=p;if(!p)break}r=pe[155]|0;if(p>>>0>>0)Xe();pe[p+24>>2]=a;t=pe[e+(d+8)>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{pe[p+16>>2]=t;pe[t+24>>2]=p;break}}while(0);t=pe[e+(d+12)>>2]|0;if(t)if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[p+20>>2]=t;pe[t+24>>2]=p;break}}}else{n=pe[e+d>>2]|0;r=pe[e+(d|4)>>2]|0;t=644+(i<<1<<2)|0;if((n|0)!=(t|0)){if(n>>>0<(pe[155]|0)>>>0)Xe();if((pe[n+12>>2]|0)!=(g|0))Xe()}if((r|0)==(n|0)){pe[151]=pe[151]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=r+8|0;if((pe[t>>2]|0)==(g|0))h=t;else Xe()}else h=r+8|0;pe[n+12>>2]=r;pe[h>>2]=n}}while(0);pe[y+4>>2]=o|1;pe[y+o>>2]=o;if((y|0)==(pe[156]|0)){pe[153]=o;return}}else{pe[t>>2]=r&-2;pe[y+4>>2]=o|1;pe[y+o>>2]=o}t=o>>>3;if(o>>>0<256){r=t<<1;i=644+(r<<2)|0;n=pe[151]|0;t=1<>2]|0;if(r>>>0<(pe[155]|0)>>>0)Xe();else{m=t;v=r}}else{pe[151]=n|t;m=644+(r+2<<2)|0;v=i}pe[m>>2]=y;pe[v+12>>2]=y;pe[y+8>>2]=v;pe[y+12>>2]=i;return}t=o>>>8;if(t)if(o>>>0>16777215)i=31;else{m=(t+1048320|0)>>>16&8;v=t<>>16&4;v=v<>>16&2;i=14-(g|m|i)+(v<>>15)|0;i=o>>>(i+7|0)&1|i<<1}else i=0;t=908+(i<<2)|0;pe[y+28>>2]=i;pe[y+20>>2]=0;pe[y+16>>2]=0;r=pe[152]|0;n=1<>2]|0;t:do{if((pe[t+4>>2]&-8|0)!=(o|0)){i=o<<((i|0)==31?0:25-(i>>>1)|0);while(1){r=t+16+(i>>>31<<2)|0;n=pe[r>>2]|0;if(!n)break;if((pe[n+4>>2]&-8|0)==(o|0)){_=n;break t}else{i=i<<1;t=n}}if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[r>>2]=y;pe[y+24>>2]=t;pe[y+12>>2]=y;pe[y+8>>2]=y;break e}}else _=t}while(0);t=_+8|0;r=pe[t>>2]|0;v=pe[155]|0;if(r>>>0>=v>>>0&_>>>0>=v>>>0){pe[r+12>>2]=y;pe[t>>2]=y;pe[y+8>>2]=r;pe[y+12>>2]=_;pe[y+24>>2]=0;break}else Xe()}else{pe[152]=r|n;pe[t>>2]=y;pe[y+24>>2]=t;pe[y+12>>2]=y;pe[y+8>>2]=y}}while(0);y=(pe[159]|0)+-1|0;pe[159]=y;if(!y)t=1060;else return;while(1){t=pe[t>>2]|0;if(!t)break;else t=t+8|0}pe[159]=-1;return}function Xr(e,t){e=e|0;t=t|0;var r=0,n=0;if(!e){e=zr(t)|0;return e|0}if(t>>>0>4294967231){e=cr()|0;pe[e>>2]=12;e=0;return e|0}r=Hr(e+-8|0,t>>>0<11?16:t+11&-8)|0;if(r){e=r+8|0;return e|0}r=zr(t)|0;if(!r){e=0;return e|0}n=pe[e+-4>>2]|0;n=(n&-8)-((n&3|0)==0?8:4)|0;$r(r|0,e|0,(n>>>0>>0?n:t)|0)|0;Ur(e);e=r;return e|0}function qr(e){e=e|0;var t=0;if(!e){t=0;return t|0}e=pe[e+-4>>2]|0;t=e&3;if((t|0)==1){t=0;return t|0}t=(e&-8)-((t|0)==0?8:4)|0;return t|0}function Hr(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;d=e+4|0;p=pe[d>>2]|0;u=p&-8;c=e+u|0;s=pe[155]|0;r=p&3;if(!((r|0)!=1&e>>>0>=s>>>0&e>>>0>>0))Xe();n=e+(u|4)|0;i=pe[n>>2]|0;if(!(i&1))Xe();if(!r){if(t>>>0<256){e=0;return e|0}if(u>>>0>=(t+4|0)>>>0?(u-t|0)>>>0<=pe[271]<<1>>>0:0)return e|0;e=0;return e|0}if(u>>>0>=t>>>0){r=u-t|0;if(r>>>0<=15)return e|0;pe[d>>2]=p&1|t|2;pe[e+(t+4)>>2]=r|3;pe[n>>2]=pe[n>>2]|1;Yr(e+t|0,r);return e|0}if((c|0)==(pe[157]|0)){r=(pe[154]|0)+u|0;if(r>>>0<=t>>>0){e=0;return e|0}h=r-t|0;pe[d>>2]=p&1|t|2;pe[e+(t+4)>>2]=h|1;pe[157]=e+t;pe[154]=h;return e|0}if((c|0)==(pe[156]|0)){n=(pe[153]|0)+u|0;if(n>>>0>>0){e=0;return e|0}r=n-t|0;if(r>>>0>15){pe[d>>2]=p&1|t|2;pe[e+(t+4)>>2]=r|1;pe[e+n>>2]=r;n=e+(n+4)|0;pe[n>>2]=pe[n>>2]&-2;n=e+t|0}else{pe[d>>2]=p&1|n|2;n=e+(n+4)|0;pe[n>>2]=pe[n>>2]|1;n=0;r=0}pe[153]=r;pe[156]=n;return e|0}if(i&2){e=0;return e|0}f=(i&-8)+u|0;if(f>>>0>>0){e=0;return e|0}h=f-t|0;o=i>>>3;do{if(i>>>0>=256){a=pe[e+(u+24)>>2]|0;o=pe[e+(u+12)>>2]|0;do{if((o|0)==(c|0)){n=e+(u+20)|0;r=pe[n>>2]|0;if(!r){n=e+(u+16)|0;r=pe[n>>2]|0;if(!r){l=0;break}}while(1){i=r+20|0;o=pe[i>>2]|0;if(o){r=o;n=i;continue}i=r+16|0;o=pe[i>>2]|0;if(!o)break;else{r=o;n=i}}if(n>>>0>>0)Xe();else{pe[n>>2]=0;l=r;break}}else{i=pe[e+(u+8)>>2]|0;if(i>>>0>>0)Xe();r=i+12|0;if((pe[r>>2]|0)!=(c|0))Xe();n=o+8|0;if((pe[n>>2]|0)==(c|0)){pe[r>>2]=o;pe[n>>2]=i;l=o;break}else Xe()}}while(0);if(a){r=pe[e+(u+28)>>2]|0;n=908+(r<<2)|0;if((c|0)==(pe[n>>2]|0)){pe[n>>2]=l;if(!l){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();r=a+16|0;if((pe[r>>2]|0)==(c|0))pe[r>>2]=l;else pe[a+20>>2]=l;if(!l)break}n=pe[155]|0;if(l>>>0>>0)Xe();pe[l+24>>2]=a;r=pe[e+(u+16)>>2]|0;do{if(r)if(r>>>0>>0)Xe();else{pe[l+16>>2]=r;pe[r+24>>2]=l;break}}while(0);r=pe[e+(u+20)>>2]|0;if(r)if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[l+20>>2]=r;pe[r+24>>2]=l;break}}}else{i=pe[e+(u+8)>>2]|0;n=pe[e+(u+12)>>2]|0;r=644+(o<<1<<2)|0;if((i|0)!=(r|0)){if(i>>>0>>0)Xe();if((pe[i+12>>2]|0)!=(c|0))Xe()}if((n|0)==(i|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();r=n+8|0;if((pe[r>>2]|0)==(c|0))a=r;else Xe()}else a=n+8|0;pe[i+12>>2]=n;pe[a>>2]=i}}while(0);if(h>>>0<16){pe[d>>2]=f|p&1|2;t=e+(f|4)|0;pe[t>>2]=pe[t>>2]|1;return e|0}else{pe[d>>2]=p&1|t|2;pe[e+(t+4)>>2]=h|3;p=e+(f|4)|0;pe[p>>2]=pe[p>>2]|1;Yr(e+t|0,h);return e|0}return 0}function Yr(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0;g=e+t|0;r=pe[e+4>>2]|0;do{if(!(r&1)){l=pe[e>>2]|0;if(!(r&3))return;h=e+(0-l)|0;f=l+t|0;u=pe[155]|0;if(h>>>0>>0)Xe();if((h|0)==(pe[156]|0)){n=e+(t+4)|0;r=pe[n>>2]|0;if((r&3|0)!=3){_=h;a=f;break}pe[153]=f;pe[n>>2]=r&-2;pe[e+(4-l)>>2]=f|1;pe[g>>2]=f;return}o=l>>>3;if(l>>>0<256){i=pe[e+(8-l)>>2]|0;n=pe[e+(12-l)>>2]|0;r=644+(o<<1<<2)|0;if((i|0)!=(r|0)){if(i>>>0>>0)Xe();if((pe[i+12>>2]|0)!=(h|0))Xe()}if((n|0)==(i|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();r=n+8|0;if((pe[r>>2]|0)==(h|0))s=r;else Xe()}else s=n+8|0;pe[i+12>>2]=n;pe[s>>2]=i;_=h;a=f;break}s=pe[e+(24-l)>>2]|0;i=pe[e+(12-l)>>2]|0;do{if((i|0)==(h|0)){i=16-l|0;n=e+(i+4)|0;r=pe[n>>2]|0;if(!r){n=e+i|0;r=pe[n>>2]|0;if(!r){c=0;break}}while(1){i=r+20|0;o=pe[i>>2]|0;if(o){r=o;n=i;continue}i=r+16|0;o=pe[i>>2]|0;if(!o)break;else{r=o;n=i}}if(n>>>0>>0)Xe();else{pe[n>>2]=0;c=r;break}}else{o=pe[e+(8-l)>>2]|0;if(o>>>0>>0)Xe();r=o+12|0;if((pe[r>>2]|0)!=(h|0))Xe();n=i+8|0;if((pe[n>>2]|0)==(h|0)){pe[r>>2]=i;pe[n>>2]=o;c=i;break}else Xe()}}while(0);if(s){r=pe[e+(28-l)>>2]|0;n=908+(r<<2)|0;if((h|0)==(pe[n>>2]|0)){pe[n>>2]=c;if(!c){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();r=s+16|0;if((pe[r>>2]|0)==(h|0))pe[r>>2]=c;else pe[s+20>>2]=c;if(!c){_=h;a=f;break}}i=pe[155]|0;if(c>>>0>>0)Xe();pe[c+24>>2]=s;r=16-l|0;n=pe[e+r>>2]|0;do{if(n)if(n>>>0>>0)Xe();else{pe[c+16>>2]=n;pe[n+24>>2]=c;break}}while(0);r=pe[e+(r+4)>>2]|0;if(r)if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[c+20>>2]=r;pe[r+24>>2]=c;_=h;a=f;break}else{_=h;a=f}}else{_=h;a=f}}else{_=e;a=t}}while(0);u=pe[155]|0;if(g>>>0>>0)Xe();r=e+(t+4)|0;n=pe[r>>2]|0;if(!(n&2)){if((g|0)==(pe[157]|0)){v=(pe[154]|0)+a|0;pe[154]=v;pe[157]=_;pe[_+4>>2]=v|1;if((_|0)!=(pe[156]|0))return;pe[156]=0;pe[153]=0;return}if((g|0)==(pe[156]|0)){v=(pe[153]|0)+a|0;pe[153]=v;pe[156]=_;pe[_+4>>2]=v|1;pe[_+v>>2]=v;return}a=(n&-8)+a|0;o=n>>>3;do{if(n>>>0>=256){s=pe[e+(t+24)>>2]|0;i=pe[e+(t+12)>>2]|0;do{if((i|0)==(g|0)){n=e+(t+20)|0;r=pe[n>>2]|0;if(!r){n=e+(t+16)|0;r=pe[n>>2]|0;if(!r){p=0;break}}while(1){i=r+20|0;o=pe[i>>2]|0;if(o){r=o;n=i;continue}i=r+16|0;o=pe[i>>2]|0;if(!o)break;else{r=o;n=i}}if(n>>>0>>0)Xe();else{pe[n>>2]=0;p=r;break}}else{o=pe[e+(t+8)>>2]|0;if(o>>>0>>0)Xe();r=o+12|0;if((pe[r>>2]|0)!=(g|0))Xe();n=i+8|0;if((pe[n>>2]|0)==(g|0)){pe[r>>2]=i;pe[n>>2]=o;p=i;break}else Xe()}}while(0);if(s){r=pe[e+(t+28)>>2]|0;n=908+(r<<2)|0;if((g|0)==(pe[n>>2]|0)){pe[n>>2]=p;if(!p){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();r=s+16|0;if((pe[r>>2]|0)==(g|0))pe[r>>2]=p;else pe[s+20>>2]=p;if(!p)break}n=pe[155]|0;if(p>>>0>>0)Xe();pe[p+24>>2]=s;r=pe[e+(t+16)>>2]|0;do{if(r)if(r>>>0>>0)Xe();else{pe[p+16>>2]=r;pe[r+24>>2]=p;break}}while(0);r=pe[e+(t+20)>>2]|0;if(r)if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[p+20>>2]=r;pe[r+24>>2]=p;break}}}else{i=pe[e+(t+8)>>2]|0;n=pe[e+(t+12)>>2]|0;r=644+(o<<1<<2)|0;if((i|0)!=(r|0)){if(i>>>0>>0)Xe();if((pe[i+12>>2]|0)!=(g|0))Xe()}if((n|0)==(i|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();r=n+8|0;if((pe[r>>2]|0)==(g|0))d=r;else Xe()}else d=n+8|0;pe[i+12>>2]=n;pe[d>>2]=i}}while(0);pe[_+4>>2]=a|1;pe[_+a>>2]=a;if((_|0)==(pe[156]|0)){pe[153]=a;return}}else{pe[r>>2]=n&-2;pe[_+4>>2]=a|1;pe[_+a>>2]=a}r=a>>>3;if(a>>>0<256){n=r<<1;o=644+(n<<2)|0;i=pe[151]|0;r=1<>2]|0;if(n>>>0<(pe[155]|0)>>>0)Xe();else{m=r;v=n}}else{pe[151]=i|r;m=644+(n+2<<2)|0;v=o}pe[m>>2]=_;pe[v+12>>2]=_;pe[_+8>>2]=v;pe[_+12>>2]=o;return}r=a>>>8;if(r)if(a>>>0>16777215)o=31;else{m=(r+1048320|0)>>>16&8;v=r<>>16&4;v=v<>>16&2;o=14-(g|m|o)+(v<>>15)|0;o=a>>>(o+7|0)&1|o<<1}else o=0;r=908+(o<<2)|0;pe[_+28>>2]=o;pe[_+20>>2]=0;pe[_+16>>2]=0;n=pe[152]|0;i=1<>2]=_;pe[_+24>>2]=r;pe[_+12>>2]=_;pe[_+8>>2]=_;return}r=pe[r>>2]|0;e:do{if((pe[r+4>>2]&-8|0)!=(a|0)){o=a<<((o|0)==31?0:25-(o>>>1)|0);while(1){n=r+16+(o>>>31<<2)|0;i=pe[n>>2]|0;if(!i)break;if((pe[i+4>>2]&-8|0)==(a|0)){r=i;break e}else{o=o<<1;r=i}}if(n>>>0<(pe[155]|0)>>>0)Xe();pe[n>>2]=_;pe[_+24>>2]=r;pe[_+12>>2]=_;pe[_+8>>2]=_;return}}while(0);n=r+8|0;i=pe[n>>2]|0;v=pe[155]|0;if(!(i>>>0>=v>>>0&r>>>0>=v>>>0))Xe();pe[i+12>>2]=_;pe[n>>2]=_;pe[_+8>>2]=i;pe[_+12>>2]=r;pe[_+24>>2]=0;return}function Gr(){}function Wr(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;n=t-n-(r>>>0>e>>>0|0)>>>0;return(re=n,e-r>>>0|0)|0}function Vr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0;n=e+r|0;if((r|0)>=20){t=t&255;o=e&3;a=t|t<<8|t<<16|t<<24;i=n&~3;if(o){o=e+4-o|0;while((e|0)<(o|0)){de[e>>0]=t;e=e+1|0}}while((e|0)<(i|0)){pe[e>>2]=a;e=e+4|0}}while((e|0)<(n|0)){de[e>>0]=t;e=e+1|0}return e-r|0}function Kr(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t>>>r;return e>>>r|(t&(1<>>r-32|0}function Zr(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t<>>32-r;return e<>>0;return(re=t+n+(r>>>0>>0|0)>>>0,r|0)|0}function $r(e,t,r){e=e|0;t=t|0;r=r|0;var n=0;if((r|0)>=4096)return Re(e|0,t|0,r|0)|0;n=e|0;if((e&3)==(t&3)){while(e&3){if(!r)return n|0;de[e>>0]=de[t>>0]|0;e=e+1|0;t=t+1|0;r=r-1|0}while((r|0)>=4){pe[e>>2]=pe[t>>2];e=e+4|0;t=t+4|0;r=r-4|0}}while((r|0)>0){de[e>>0]=de[t>>0]|0;e=e+1|0;t=t+1|0;r=r-1|0}return n|0}function Qr(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t>>r;return e>>>r|(t&(1<>r-32|0}function en(e){e=e|0;var t=0;t=de[m+(e&255)>>0]|0;if((t|0)<8)return t|0;t=de[m+(e>>8&255)>>0]|0;if((t|0)<8)return t+8|0;t=de[m+(e>>16&255)>>0]|0;if((t|0)<8)return t+16|0;return(de[m+(e>>>24)>>0]|0)+24|0}function tn(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0;o=e&65535;i=t&65535;r=_e(i,o)|0;n=e>>>16;e=(r>>>16)+(_e(i,n)|0)|0;i=t>>>16;t=_e(i,o)|0;return(re=(e>>>16)+(_e(i,n)|0)+(((e&65535)+t|0)>>>16)|0,e+t<<16|r&65535|0)|0}function rn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0;l=t>>31|((t|0)<0?-1:0)<<1;u=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;o=n>>31|((n|0)<0?-1:0)<<1;i=((n|0)<0?-1:0)>>31|((n|0)<0?-1:0)<<1;s=Wr(l^e,u^t,l,u)|0;a=re;e=o^l;t=i^u;return Wr((un(s,a,Wr(o^r,i^n,o,i)|0,re,0)|0)^e,re^t,e,t)|0}function nn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0;i=ve;ve=ve+16|0;s=i|0;a=t>>31|((t|0)<0?-1:0)<<1;o=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;l=n>>31|((n|0)<0?-1:0)<<1;u=((n|0)<0?-1:0)>>31|((n|0)<0?-1:0)<<1;e=Wr(a^e,o^t,a,o)|0;t=re;un(e,t,Wr(l^r,u^n,l,u)|0,re,s)|0;n=Wr(pe[s>>2]^a,pe[s+4>>2]^o,a,o)|0;r=re;ve=i;return(re=r,n)|0}function on(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0;i=e;o=r;r=tn(i,o)|0;e=re;return(re=(_e(t,o)|0)+(_e(n,i)|0)+e|e&0,r|0|0)|0}function an(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;return un(e,t,r,n,0)|0}function sn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0;o=ve;ve=ve+16|0;i=o|0;un(e,t,r,n,i)|0;ve=o;return(re=pe[i+4>>2]|0,pe[i>>2]|0)|0}function un(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;c=e;u=t;l=u;a=r;h=n;s=h;if(!l){o=(i|0)!=0;if(!s){if(o){pe[i>>2]=(c>>>0)%(a>>>0);pe[i+4>>2]=0}h=0;i=(c>>>0)/(a>>>0)>>>0;return(re=h,i)|0}else{if(!o){h=0;i=0;return(re=h,i)|0}pe[i>>2]=e|0;pe[i+4>>2]=t&0;h=0;i=0;return(re=h,i)|0}}o=(s|0)==0;do{if(a){if(!o){o=(ae(s|0)|0)-(ae(l|0)|0)|0;if(o>>>0<=31){f=o+1|0;s=31-o|0;t=o-31>>31;a=f;e=c>>>(f>>>0)&t|l<>>(f>>>0)&t;o=0;s=c<>2]=e|0;pe[i+4>>2]=u|t&0;h=0;i=0;return(re=h,i)|0}o=a-1|0;if(o&a){s=(ae(a|0)|0)+33-(ae(l|0)|0)|0;p=64-s|0;f=32-s|0;u=f>>31;d=s-32|0;t=d>>31;a=s;e=f-1>>31&l>>>(d>>>0)|(l<>>(s>>>0))&t;t=t&l>>>(s>>>0);o=c<>>(d>>>0))&u|c<>31;break}if(i){pe[i>>2]=o&c;pe[i+4>>2]=0}if((a|0)==1){d=u|t&0;p=e|0|0;return(re=d,p)|0}else{p=en(a|0)|0;d=l>>>(p>>>0)|0;p=l<<32-p|c>>>(p>>>0)|0;return(re=d,p)|0}}else{if(o){if(i){pe[i>>2]=(l>>>0)%(a>>>0);pe[i+4>>2]=0}d=0;p=(l>>>0)/(a>>>0)>>>0;return(re=d,p)|0}if(!c){if(i){pe[i>>2]=0;pe[i+4>>2]=(l>>>0)%(s>>>0)}d=0;p=(l>>>0)/(s>>>0)>>>0;return(re=d,p)|0}o=s-1|0;if(!(o&s)){if(i){pe[i>>2]=e|0;pe[i+4>>2]=o&l|t&0}d=0;p=l>>>((en(s|0)|0)>>>0);return(re=d,p)|0}o=(ae(s|0)|0)-(ae(l|0)|0)|0;if(o>>>0<=30){t=o+1|0;s=31-o|0;a=t;e=l<>>(t>>>0);t=l>>>(t>>>0);o=0;s=c<>2]=e|0;pe[i+4>>2]=u|t&0;d=0;p=0;return(re=d,p)|0}}while(0);if(!a){l=s;u=0;s=0}else{f=r|0|0;c=h|n&0;l=Jr(f|0,c|0,-1,-1)|0;r=re;u=s;s=0;do{n=u;u=o>>>31|u<<1;o=s|o<<1;n=e<<1|n>>>31|0;h=e>>>31|t<<1|0;Wr(l,r,n,h)|0;p=re;d=p>>31|((p|0)<0?-1:0)<<1;s=d&1;e=Wr(n,h,d&f,(((p|0)<0?-1:0)>>31|((p|0)<0?-1:0)<<1)&c)|0;t=re;a=a-1|0}while((a|0)!=0);l=u;u=0}a=0;if(i){pe[i>>2]=e;pe[i+4>>2]=t}d=(o|0)>>>31|(l|a)<<1|(a<<1|o>>>31)&0|u;p=(o<<1|0>>>31)&-2|s;return(re=d,p)|0}function ln(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;return Cn[e&7](t|0,r|0,n|0)|0}function cn(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;kn[e&3](t|0,r|0,n|0,i|0,o|0)}function fn(e,t){e=e|0;t=t|0;En[e&7](t|0)}function hn(e,t){e=e|0;t=t|0;return An[e&1](t|0)|0}function dn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;On[e&0](t|0,r|0,n|0)}function pn(e){e=e|0;Rn[e&3]()}function gn(e,t,r,n,i,o,a){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;In[e&3](t|0,r|0,n|0,i|0,o|0,a|0)}function mn(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;return Dn[e&1](t|0,r|0,n|0,i|0,o|0)|0}function vn(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;Ln[e&3](t|0,r|0,n|0,i|0)}function _n(e,t,r){e=e|0;t=t|0;r=r|0;se(0);return 0}function yn(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;se(1)}function bn(e){e=e|0;se(2)}function xn(e){e=e|0;se(3);return 0}function wn(e,t,r){e=e|0;t=t|0;r=r|0;se(4)}function Tn(){se(5)}function Sn(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;se(6)}function Mn(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;se(7);return 0}function Pn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;se(8)}var Cn=[_n,Vt,Nr,Er,kr,Ar,_n,_n];var kn=[yn,tr,er,yn];var En=[bn,qt,Gt,Ht,Yt,Wt,ur,Lr];var An=[xn,Cr];var On=[wn];var Rn=[Tn,ar,sr,Tn];var In=[Sn,nr,rr,Sn];var Dn=[Mn,ut];var Ln=[Pn,Zt,Jt,Pn];return{___cxa_can_catch:ir,_crn_get_levels:Tt,_crn_get_uncompressed_size:Mt,_crn_decompress:Pt,_i64Add:Jr,_crn_get_width:xt,___cxa_is_pointer_type:or,_i64Subtract:Wr,_memset:Vr,_malloc:zr,_free:Ur,_memcpy:$r,_bitshift64Lshr:Kr,_fflush:mr,_bitshift64Shl:Zr,_crn_get_height:wt,___errno_location:cr,_crn_get_dxt_format:St,runPostSets:Gr,_emscripten_replace_memory:Ve,stackAlloc:Ke,stackSave:Ze,stackRestore:Je,establishStackSpace:$e,setThrew:Qe,setTempRet0:rt,getTempRet0:nt,dynCall_iiii:ln,dynCall_viiiii:cn,dynCall_vi:fn,dynCall_ii:hn,dynCall_viii:dn,dynCall_v:pn,dynCall_viiiiii:gn,dynCall_iiiiii:mn,dynCall_viiii:vn}}(e.Ya,e.Za,buffer);e.___cxa_can_catch=Z.___cxa_can_catch,e._crn_get_levels=Z._crn_get_levels,e.runPostSets=Z.runPostSets,e._crn_get_uncompressed_size=Z._crn_get_uncompressed_size,e._crn_decompress=Z._crn_decompress;var zc=e._i64Add=Z._i64Add;e._crn_get_height=Z._crn_get_height,e.___cxa_is_pointer_type=Z.___cxa_is_pointer_type;var nb=e._i64Subtract=Z._i64Subtract,qb=e._memset=Z._memset,Ea=e._malloc=Z._malloc,Bc=e._memcpy=Z._memcpy,Xa=e._emscripten_replace_memory=Z._emscripten_replace_memory;e._crn_get_dxt_format=Z._crn_get_dxt_format;var rb=e._bitshift64Lshr=Z._bitshift64Lshr,Na=e._free=Z._free;e._fflush=Z._fflush,e._crn_get_width=Z._crn_get_width,e.___errno_location=Z.___errno_location;var sb=e._bitshift64Shl=Z._bitshift64Shl;function ia(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}e.dynCall_iiii=Z.dynCall_iiii,e.dynCall_viiiii=Z.dynCall_viiiii,e.dynCall_vi=Z.dynCall_vi,e.dynCall_ii=Z.dynCall_ii,e.dynCall_viii=Z.dynCall_viii,e.dynCall_v=Z.dynCall_v,e.dynCall_viiiiii=Z.dynCall_viiiiii,e.dynCall_iiiiii=Z.dynCall_iiiiii,e.dynCall_viiii=Z.dynCall_viiii,n.aa=Z.stackAlloc,n.ua=Z.stackSave,n.ba=Z.stackRestore,n.Cd=Z.establishStackSpace,n.rb=Z.setTempRet0,n.fb=Z.getTempRet0,ia.prototype=Error(),ia.prototype.constructor=ia;var rd=null,jb=function t(){e.calledRun||td(),e.calledRun||(jb=t)};function td(t){function r(){if(!e.calledRun&&(e.calledRun=!0,!na)){if(Ha||(Ha=!0,ab(cb)),ab(db),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e._main&&vd&&e.callMain(t),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)gb(e.postRun.shift());ab(eb)}}if(t=t||e.arguments,null===rd&&(rd=Date.now()),!(0>6],i=0==(32&r);if(31==(31&r)){var o=r;for(r=0;128==(128&o);){if(o=e.readUInt8(t),e.isError(o))return o;r<<=7,r|=127&o}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:s.tag[r]}}function f(e,t,r){var n=e.readUInt8(r);if(e.isError(n))return n;if(!t&&128===n)return null;if(0==(128&n))return n;var i=127&n;if(4>=8)a++;(i=new l(2+a))[0]=o,i[1]=128|a;s=1+a;for(var u=n.length;0>=8)i[s]=255&u;return this._createEncoderBuffer([i,n])},s.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"!==t)return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(t)?this._createEncoderBuffer(e):"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported");for(var r=new l(2*e.length),n=0;n>=7)i++}var a=new l(i),s=a.length-1;for(n=e.length-1;0<=n;n--){o=e[n];for(a[s--]=127&o;0<(o>>=7);)a[s--]=128|127&o}return this._createEncoderBuffer(a)},s.prototype._encodeTime=function(e,t){var r,n=new Date(e);return"gentime"===t?r=[u(n.getFullYear()),u(n.getUTCMonth()+1),u(n.getUTCDate()),u(n.getUTCHours()),u(n.getUTCMinutes()),u(n.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[u(n.getFullYear()%100),u(n.getUTCMonth()+1),u(n.getUTCDate()),u(n.getUTCHours()),u(n.getUTCMinutes()),u(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},s.prototype._encodeNull=function(){return this._createEncoderBuffer("")},s.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!l.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new l(r)}if(l.isBuffer(e)){var n=e.length;0===e.length&&n++;var i=new l(n);return e.copy(i),0===e.length&&(i[0]=0),this._createEncoderBuffer(i)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);n=1;for(var o=e;256<=o;o>>=8)n++;for(o=(i=new Array(n)).length-1;0<=o;o--)i[o]=255&e,e>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(new l(i))},s.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},s.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},s.prototype._skipDefault=function(e,t,r){var n,i=this._baseState;if(null===i.default)return!1;var o=e.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,t,r).join()),o.length!==i.defaultBuffer.length)return!1;for(n=0;n>16&255,o[s++]=n>>8&255,o[s++]=255&n;2===i?(n=l[e.charCodeAt(t)]<<2|l[e.charCodeAt(t+1)]>>4,o[s++]=255&n):1===i&&(n=l[e.charCodeAt(t)]<<10|l[e.charCodeAt(t+1)]<<4|l[e.charCodeAt(t+2)]>>2,o[s++]=n>>8&255,o[s++]=255&n);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i="",o=[],a=0,s=r-n;a>2],i+=u[t<<4&63],i+="=="):2==n&&(t=(e[r-2]<<8)+e[r-1],i+=u[t>>10],i+=u[t>>4&63],i+=u[t<<2&63],i+="=");return o.push(i),o.join("")};for(var u=[],l=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;i>18&63]+u[i>>12&63]+u[i>>6&63]+u[63&i]);return o.join("")}l["-".charCodeAt(0)]=62,l["_".charCodeAt(0)]=63},{}],17:[function(T,e,t){!function(e,t){"use strict";function m(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function v(e,t,r){if(v.isBN(e))return e;this.negative=0,this.words=null,this.length=0,(this.red=null)!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var n;"object"==typeof e?e.exports=v:t.BN=v,(v.BN=v).wordSize=26;try{n=T("buffer").Buffer}catch(e){}function a(e,t,r){for(var n=0,i=Math.min(e.length,r),o=t;o>>26-a&67108863,26<=(a+=24)&&(a-=26,i++);else if("le"===r)for(i=n=0;n>>26-a&67108863,26<=(a+=24)&&(a-=26,i++);return this.strip()},v.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r>>26-o&4194303,26<=(o+=24)&&(o-=26,n++);r+6!==t&&(i=a(e,t,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},v.prototype._parseBase=function(e,t,r){this.words=[0];for(var n=0,i=this.length=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,l=r;l"};var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function i(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;n=(r.length=n)-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var l=1;l>>26,f=67108863&u,h=Math.min(l,t.length-1),d=Math.max(0,l-e.length+1);d<=h;d++){var p=l-d|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[d])+f)/67108864|0,f=67108863&a}r.words[l]=0|f,u=0|c}return 0!==u?r.words[l]=0|u:r.length--,r.strip()}v.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,i=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-s.length]+s+r:s+r,26<=(n+=2)&&(n-=26,o--)}for(0!==i&&(r=i.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&2<=e&&e<=36){var u=d[e],l=p[e];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var f=c.modn(l).toString(e);r=(c=c.idivn(l)).isZero()?f+r:h[u-f.length]+f+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}m(!1,"Base should be between 2 and 36")},v.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2>>=13),64<=t&&(r+=7,t>>>=7),8<=t&&(r+=4,t>>>=4),2<=t&&(r+=2,t>>>=2),r+t},v.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},v.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},v.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},v.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},v.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},v.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},v.prototype.iuxor=function(e){var t,r;r=this.length>e.length?(t=this,e):(t=e,this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},v.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},v.prototype.inotn=function(e){m("number"==typeof e&&0<=e);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),0>26-r),this.strip()},v.prototype.notn=function(e){return this.clone().inotn(e)},v.prototype.setn=function(e,t){m("number"==typeof e&&0<=e);var r=e/26|0,n=e%26;return this._expand(1+r),this.words[r]=t?this.words[r]|1<e.length?(r=this,e):(r=e,this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},v.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;n=0>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,d=0|a[1],p=8191&d,g=d>>>13,m=0|a[2],v=8191&m,_=m>>>13,y=0|a[3],b=8191&y,x=y>>>13,w=0|a[4],T=8191&w,S=w>>>13,M=0|a[5],P=8191&M,C=M>>>13,k=0|a[6],E=8191&k,A=k>>>13,O=0|a[7],R=8191&O,I=O>>>13,D=0|a[8],L=8191&D,N=D>>>13,j=0|a[9],F=8191&j,B=j>>>13,z=0|s[0],U=8191&z,X=z>>>13,q=0|s[1],H=8191&q,Y=q>>>13,G=0|s[2],W=8191&G,V=G>>>13,K=0|s[3],Z=8191&K,J=K>>>13,$=0|s[4],Q=8191&$,ee=$>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,le=se>>>13,ce=0|s[8],fe=8191&ce,he=ce>>>13,de=0|s[9],pe=8191&de,ge=de>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(l+(n=Math.imul(f,U))|0)+((8191&(i=(i=Math.imul(f,X))+Math.imul(h,U)|0))<<13)|0;l=((o=Math.imul(h,X))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(p,U),i=(i=Math.imul(p,X))+Math.imul(g,U)|0,o=Math.imul(g,X);var ve=(l+(n=n+Math.imul(f,H)|0)|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(h,H)|0))<<13)|0;l=((o=o+Math.imul(h,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(v,U),i=(i=Math.imul(v,X))+Math.imul(_,U)|0,o=Math.imul(_,X),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,Y)|0;var _e=(l+(n=n+Math.imul(f,W)|0)|0)+((8191&(i=(i=i+Math.imul(f,V)|0)+Math.imul(h,W)|0))<<13)|0;l=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(b,U),i=(i=Math.imul(b,X))+Math.imul(x,U)|0,o=Math.imul(x,X),n=n+Math.imul(v,H)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(_,H)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(g,W)|0,o=o+Math.imul(g,V)|0;var ye=(l+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(h,Z)|0))<<13)|0;l=((o=o+Math.imul(h,J)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(T,U),i=(i=Math.imul(T,X))+Math.imul(S,U)|0,o=Math.imul(S,X),n=n+Math.imul(b,H)|0,i=(i=i+Math.imul(b,Y)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,Y)|0,n=n+Math.imul(v,W)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,J)|0;var be=(l+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,ee)|0)+Math.imul(h,Q)|0))<<13)|0;l=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(P,U),i=(i=Math.imul(P,X))+Math.imul(C,U)|0,o=Math.imul(C,X),n=n+Math.imul(T,H)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(S,H)|0,o=o+Math.imul(S,Y)|0,n=n+Math.imul(b,W)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,V)|0,n=n+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,J)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,ee)|0;var xe=(l+(n=n+Math.imul(f,re)|0)|0)+((8191&(i=(i=i+Math.imul(f,ne)|0)+Math.imul(h,re)|0))<<13)|0;l=((o=o+Math.imul(h,ne)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(E,U),i=(i=Math.imul(E,X))+Math.imul(A,U)|0,o=Math.imul(A,X),n=n+Math.imul(P,H)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(C,H)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(T,W)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,V)|0,n=n+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,J)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,J)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(g,re)|0,o=o+Math.imul(g,ne)|0;var we=(l+(n=n+Math.imul(f,oe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ae)|0)+Math.imul(h,oe)|0))<<13)|0;l=((o=o+Math.imul(h,ae)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(R,U),i=(i=Math.imul(R,X))+Math.imul(I,U)|0,o=Math.imul(I,X),n=n+Math.imul(E,H)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,Y)|0,n=n+Math.imul(P,W)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(C,W)|0,o=o+Math.imul(C,V)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(S,Z)|0,o=o+Math.imul(S,J)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,ee)|0,n=n+Math.imul(v,re)|0,i=(i=i+Math.imul(v,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,ae)|0;var Te=(l+(n=n+Math.imul(f,ue)|0)|0)+((8191&(i=(i=i+Math.imul(f,le)|0)+Math.imul(h,ue)|0))<<13)|0;l=((o=o+Math.imul(h,le)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(L,U),i=(i=Math.imul(L,X))+Math.imul(N,U)|0,o=Math.imul(N,X),n=n+Math.imul(R,H)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,Y)|0,n=n+Math.imul(E,W)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,V)|0,n=n+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,J)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,J)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,ee)|0,n=n+Math.imul(b,re)|0,i=(i=i+Math.imul(b,ne)|0)+Math.imul(x,re)|0,o=o+Math.imul(x,ne)|0,n=n+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,le)|0)+Math.imul(g,ue)|0,o=o+Math.imul(g,le)|0;var Se=(l+(n=n+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,he)|0)+Math.imul(h,fe)|0))<<13)|0;l=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(F,U),i=(i=Math.imul(F,X))+Math.imul(B,U)|0,o=Math.imul(B,X),n=n+Math.imul(L,H)|0,i=(i=i+Math.imul(L,Y)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,Y)|0,n=n+Math.imul(R,W)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,V)|0,n=n+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,J)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,J)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(S,re)|0,o=o+Math.imul(S,ne)|0,n=n+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,ae)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,ae)|0,n=n+Math.imul(v,ue)|0,i=(i=i+Math.imul(v,le)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,le)|0,n=n+Math.imul(p,fe)|0,i=(i=i+Math.imul(p,he)|0)+Math.imul(g,fe)|0,o=o+Math.imul(g,he)|0;var Me=(l+(n=n+Math.imul(f,pe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ge)|0)+Math.imul(h,pe)|0))<<13)|0;l=((o=o+Math.imul(h,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(F,H),i=(i=Math.imul(F,Y))+Math.imul(B,H)|0,o=Math.imul(B,Y),n=n+Math.imul(L,W)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(N,W)|0,o=o+Math.imul(N,V)|0,n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,J)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(C,re)|0,o=o+Math.imul(C,ne)|0,n=n+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,n=n+Math.imul(b,ue)|0,i=(i=i+Math.imul(b,le)|0)+Math.imul(x,ue)|0,o=o+Math.imul(x,le)|0,n=n+Math.imul(v,fe)|0,i=(i=i+Math.imul(v,he)|0)+Math.imul(_,fe)|0,o=o+Math.imul(_,he)|0;var Pe=(l+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;l=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(F,W),i=(i=Math.imul(F,V))+Math.imul(B,W)|0,o=Math.imul(B,V),n=n+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,J)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,J)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,ee)|0,n=n+Math.imul(E,re)|0,i=(i=i+Math.imul(E,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,n=n+Math.imul(T,ue)|0,i=(i=i+Math.imul(T,le)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,le)|0,n=n+Math.imul(b,fe)|0,i=(i=i+Math.imul(b,he)|0)+Math.imul(x,fe)|0,o=o+Math.imul(x,he)|0;var Ce=(l+(n=n+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,ge)|0)+Math.imul(_,pe)|0))<<13)|0;l=((o=o+Math.imul(_,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(F,Z),i=(i=Math.imul(F,J))+Math.imul(B,Z)|0,o=Math.imul(B,J),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,ee)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,ee)|0,n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(I,re)|0,o=o+Math.imul(I,ne)|0,n=n+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,ae)|0,n=n+Math.imul(P,ue)|0,i=(i=i+Math.imul(P,le)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,le)|0,n=n+Math.imul(T,fe)|0,i=(i=i+Math.imul(T,he)|0)+Math.imul(S,fe)|0,o=o+Math.imul(S,he)|0;var ke=(l+(n=n+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ge)|0)+Math.imul(x,pe)|0))<<13)|0;l=((o=o+Math.imul(x,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,ee))+Math.imul(B,Q)|0,o=Math.imul(B,ee),n=n+Math.imul(L,re)|0,i=(i=i+Math.imul(L,ne)|0)+Math.imul(N,re)|0,o=o+Math.imul(N,ne)|0,n=n+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,ae)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,ae)|0,n=n+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,le)|0)+Math.imul(A,ue)|0,o=o+Math.imul(A,le)|0,n=n+Math.imul(P,fe)|0,i=(i=i+Math.imul(P,he)|0)+Math.imul(C,fe)|0,o=o+Math.imul(C,he)|0;var Ee=(l+(n=n+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,ge)|0)+Math.imul(S,pe)|0))<<13)|0;l=((o=o+Math.imul(S,ge)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(F,re),i=(i=Math.imul(F,ne))+Math.imul(B,re)|0,o=Math.imul(B,ne),n=n+Math.imul(L,oe)|0,i=(i=i+Math.imul(L,ae)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,ae)|0,n=n+Math.imul(R,ue)|0,i=(i=i+Math.imul(R,le)|0)+Math.imul(I,ue)|0,o=o+Math.imul(I,le)|0,n=n+Math.imul(E,fe)|0,i=(i=i+Math.imul(E,he)|0)+Math.imul(A,fe)|0,o=o+Math.imul(A,he)|0;var Ae=(l+(n=n+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,ge)|0)+Math.imul(C,pe)|0))<<13)|0;l=((o=o+Math.imul(C,ge)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(F,oe),i=(i=Math.imul(F,ae))+Math.imul(B,oe)|0,o=Math.imul(B,ae),n=n+Math.imul(L,ue)|0,i=(i=i+Math.imul(L,le)|0)+Math.imul(N,ue)|0,o=o+Math.imul(N,le)|0,n=n+Math.imul(R,fe)|0,i=(i=i+Math.imul(R,he)|0)+Math.imul(I,fe)|0,o=o+Math.imul(I,he)|0;var Oe=(l+(n=n+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,ge)|0)+Math.imul(A,pe)|0))<<13)|0;l=((o=o+Math.imul(A,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(F,ue),i=(i=Math.imul(F,le))+Math.imul(B,ue)|0,o=Math.imul(B,le),n=n+Math.imul(L,fe)|0,i=(i=i+Math.imul(L,he)|0)+Math.imul(N,fe)|0,o=o+Math.imul(N,he)|0;var Re=(l+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,ge)|0)+Math.imul(I,pe)|0))<<13)|0;l=((o=o+Math.imul(I,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(F,fe),i=(i=Math.imul(F,he))+Math.imul(B,fe)|0,o=Math.imul(B,he);var Ie=(l+(n=n+Math.imul(L,pe)|0)|0)+((8191&(i=(i=i+Math.imul(L,ge)|0)+Math.imul(N,pe)|0))<<13)|0;l=((o=o+Math.imul(N,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863;var De=(l+(n=Math.imul(F,pe))|0)+((8191&(i=(i=Math.imul(F,ge))+Math.imul(B,pe)|0))<<13)|0;return l=((o=Math.imul(B,ge))+(i>>>13)|0)+(De>>>26)|0,De&=67108863,u[0]=me,u[1]=ve,u[2]=_e,u[3]=ye,u[4]=be,u[5]=xe,u[6]=we,u[7]=Te,u[8]=Se,u[9]=Me,u[10]=Pe,u[11]=Ce,u[12]=ke,u[13]=Ee,u[14]=Ae,u[15]=Oe,u[16]=Re,u[17]=Ie,u[18]=De,0!==l&&(u[19]=l,r.length++),r};function s(e,t,r){return(new u).mulp(e,t,r)}function u(e,t){this.x=e,this.y=t}Math.imul||(o=i),v.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?o(this,e,t):r<63?i(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):s(this,e,t)},u.prototype.makeRBT=function(e){for(var t=new Array(e),r=v.prototype._countBits(e)-1,n=0;n>=1;return n},u.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*t;o>=26,t+=n/67108864|0,t+=i>>>26,this.words[r]=67108863&i}return 0!==t&&(this.words[r]=t,this.length++),this},v.prototype.muln=function(e){return this.clone().imuln(e)},v.prototype.sqr=function(){return this.mul(this)},v.prototype.isqr=function(){return this.imul(this.clone())},v.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new v(1);for(var r=this,n=0;n>>26-r<<26-r;if(0!=r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!=n){for(t=this.length-1;0<=t;t--)this.words[t+n]=this.words[t];for(t=0;t>>i<o)for(this.length-=o,u=0;u>>i,l=c&a}return s&&0!==l&&(s.words[s.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},v.prototype.ishrn=function(e,t,r){return m(0===this.negative),this.iushrn(e,t,r)},v.prototype.shln=function(e){return this.clone().ishln(e)},v.prototype.ushln=function(e){return this.clone().iushln(e)},v.prototype.shrn=function(e){return this.clone().ishrn(e)},v.prototype.ushrn=function(e){return this.clone().iushrn(e)},v.prototype.testn=function(e){m("number"==typeof e&&0<=e);var t=e%26,r=(e-t)/26,n=1<>>t<>26)-(s/67108864|0),this.words[n+r]=67108863&i}for(;n>26,this.words[n+r]=67108863&i;if(0===a)return this.strip();for(m(-1===a),n=a=0;n>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},v.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,o=0|i.words[i.length-1];0!=(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var a,s=n.length-i.length;if("mod"!==t){(a=new v(null)).length=1+s,a.words=new Array(a.length);for(var u=0;uthis.length||this.cmp(e)<0?{div:new v(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new v(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new v(this.modn(e.words[0]))}:this._wordDiv(e,t);var n,i,o},v.prototype.div=function(e){return this.divmod(e,"div",!1).div},v.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},v.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},v.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},v.prototype.modn=function(e){m(e<=67108863);for(var t=(1<<26)%e,r=0,n=this.length-1;0<=n;n--)r=(t*r+(0|this.words[n]))%e;return r},v.prototype.idivn=function(e){m(e<=67108863);for(var t=0,r=this.length-1;0<=r;r--){var n=(0|this.words[r])+67108864*t;this.words[r]=n/e|0,t=n%e}return this.strip()},v.prototype.divn=function(e){return this.clone().idivn(e)},v.prototype.egcd=function(e){m(0===e.negative),m(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new v(1),i=new v(0),o=new v(0),a=new v(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var u=r.clone(),l=t.clone();!t.isZero();){for(var c=0,f=1;0==(t.words[0]&f)&&c<26;++c,f<<=1);if(0>>26,a&=67108863,this.words[o]=a}return 0!==i&&(this.words[o]=i,this.length++),this},v.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},v.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),1e.length)return 1;if(this.lengththis.n;);var n=t>>22,i=o}i>>>=22,0===(e.words[n-10]=i)&&10>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},v._prime=function(e){if(l[e])return l[e];var t;if("k256"===e)t=new g;else if("p224"===e)t=new _;else if("p192"===e)t=new y;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new b}return l[e]=t},x.prototype._verify1=function(e){m(0===e.negative,"red works only with positives"),m(e.red,"red works only with red numbers")},x.prototype._verify2=function(e,t){m(0==(e.negative|t.negative),"red works only with positives"),m(e.red&&e.red===t.red,"red works only with red numbers")},x.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},x.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},x.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r._forceRed(this)},x.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r},x.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},x.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},x.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},x.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},x.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},x.prototype.isqr=function(e){return this.imul(e,e.clone())},x.prototype.sqr=function(e){return this.mul(e,e)},x.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(m(t%2==1),3===t){var r=this.m.add(new v(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),i=0;!n.isZero()&&0===n.andln(1);)i++,n.iushrn(1);m(!n.isZero());var o=new v(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new v(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var l=this.pow(u,n),c=this.pow(e,n.addn(1).iushrn(1)),f=this.pow(e,n),h=i;0!==f.cmp(o);){for(var d=f,p=0;0!==d.cmp(o);p++)d=d.redSqr();m(p>l&1;i!==r[0]&&(i=this.sqr(i)),0!=c||0!==o?(o<<=1,o|=c,(4===++a||0===n&&0===l)&&(i=this.mul(i,r[o]),o=a=0)):a=0}s=26}return i},x.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},x.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},v.mont=function(e){return new w(e)},r(w,x),w.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},w.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},w.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},w.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new v(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},w.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{buffer:19}],18:[function(e,t,r){var n;function i(e){this.rand=e}if(t.exports=function(e){return n||(n=new i(null)),n.generate(e)},(t.exports.Rand=i).prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r>>24]^c[p>>>16&255]^f[g>>>8&255]^h[255&m]^t[v++],a=l[p>>>24]^c[g>>>16&255]^f[m>>>8&255]^h[255&d]^t[v++],s=l[g>>>24]^c[m>>>16&255]^f[d>>>8&255]^h[255&p]^t[v++],u=l[m>>>24]^c[d>>>16&255]^f[p>>>8&255]^h[255&g]^t[v++],d=o,p=a,g=s,m=u;return o=(n[d>>>24]<<24|n[p>>>16&255]<<16|n[g>>>8&255]<<8|n[255&m])^t[v++],a=(n[p>>>24]<<24|n[g>>>16&255]<<16|n[m>>>8&255]<<8|n[255&d])^t[v++],s=(n[g>>>24]<<24|n[m>>>16&255]<<16|n[d>>>8&255]<<8|n[255&p])^t[v++],u=(n[m>>>24]<<24|n[d>>>16&255]<<16|n[p>>>8&255]<<8|n[255&g])^t[v++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var f=[0,1,2,4,8,16,32,64,128,27,54],h=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var l=s^s<<1^s<<2^s<<3^s<<4;l=l>>>8^255&l^99;var c=e[n[r[a]=l]=a],f=e[c],h=e[f],d=257*e[l]^16843008*l;i[0][a]=d<<24|d>>>8,i[1][a]=d<<16|d>>>16,i[2][a]=d<<8|d>>>24,i[3][a]=d,d=16843009*h^65537*f^257*c^16843008*a,o[0][l]=d<<24|d>>>8,o[1][l]=d<<16|d>>>16,o[2][l]=d<<8|d>>>24,o[3][l]=d,0===a?a=s=1:(a=c^e[e[e[h^c]]],s^=e[e[s]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function s(e){this._key=o(e),this._reset()}s.blockSize=16,s.keySize=32,s.prototype.blockSize=s.blockSize,s.prototype.keySize=s.keySize,s.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,n=4*(r+1),i=[],o=0;o>>24,a=h.SBOX[a>>>24]<<24|h.SBOX[a>>>16&255]<<16|h.SBOX[a>>>8&255]<<8|h.SBOX[255&a],a^=f[o/t|0]<<24):6>>24]<<24|h.SBOX[a>>>16&255]<<16|h.SBOX[a>>>8&255]<<8|h.SBOX[255&a]),i[o]=i[o-t]^a}for(var s=[],u=0;u>>24]]^h.INV_SUB_MIX[1][h.SBOX[c>>>16&255]]^h.INV_SUB_MIX[2][h.SBOX[c>>>8&255]]^h.INV_SUB_MIX[3][h.SBOX[255&c]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=s},s.prototype.encryptBlockRaw=function(e){return a(e=o(e),this._keySchedule,h.SUB_MIX,h.SBOX,this._nRounds)},s.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=i.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},s.prototype.decryptBlock=function(e){var t=(e=o(e))[1];e[1]=e[3],e[3]=t;var r=a(e,this._invKeySchedule,h.INV_SUB_MIX,h.INV_SBOX,this._nRounds),n=i.allocUnsafe(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[3],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[1],12),n},s.prototype.scrub=function(){n(this._keySchedule),n(this._invKeySchedule),n(this._key)},t.exports.AES=s},{"safe-buffer":143}],21:[function(e,t,r){var a=e("./aes"),l=e("safe-buffer").Buffer,s=e("cipher-base"),n=e("inherits"),c=e("./ghash"),i=e("buffer-xor"),f=e("./incr32");function o(e,t,r,n){s.call(this);var i=l.alloc(4,0);this._cipher=new a.AES(t);var o=this._cipher.encryptBlock(i);this._ghash=new c(o),r=function(e,t,r){if(12===t.length)return e._finID=l.concat([t,l.from([0,0,0,1])]),l.concat([t,l.from([0,0,0,2])]);var n=new c(r),i=t.length,o=i%16;n.update(t),o&&(o=16-o,n.update(l.alloc(o,0))),n.update(l.alloc(8,0));var a=8*i,s=l.alloc(8);s.writeUIntBE(a,0,8),n.update(s),e._finID=n.state;var u=l.from(e._finID);return f(u),u}(this,r,o),this._prev=l.from(r),this._cache=l.allocUnsafe(0),this._secCache=l.allocUnsafe(0),this._decrypt=n,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}n(o,s),o.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=l.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},o.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=i(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var r=0;e.length!==t.length&&r++;for(var n=Math.min(e.length,t.length),i=0;i>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function a(e){this.h=e,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}a.prototype.ghash=function(e){for(var t=-1;++t>>1|(1&r[e-1])<<31;r[0]=r[0]>>>1,t&&(r[0]=r[0]^225<<24)}this.state=o(n)},a.prototype.update=function(e){var t;for(this.cache=n.concat([this.cache,e]);16<=this.cache.length;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},a.prototype.final=function(e,t){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(o([0,e,0,t])),this.state},t.exports=a},{"safe-buffer":143}],26:[function(e,t,r){t.exports=function(e){for(var t,r=e.length;r--;){if(255!==(t=e.readUInt8(r))){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}},{}],27:[function(e,t,r){var i=e("buffer-xor");r.encrypt=function(e,t){var r=i(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},r.decrypt=function(e,t){var r=e._prev;e._prev=t;var n=e._cipher.decryptBlock(t);return i(n,r)}},{"buffer-xor":48}],28:[function(e,t,r){var o=e("safe-buffer").Buffer,a=e("buffer-xor");function s(e,t,r){var n=t.length,i=a(t,e._cache);return e._cache=e._cache.slice(n),e._prev=o.concat([e._prev,r?t:i]),i}r.encrypt=function(e,t,r){for(var n,i=o.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=o.allocUnsafe(0)),!(e._cache.length<=t.length)){i=o.concat([i,s(e,t,r)]);break}n=e._cache.length,i=o.concat([i,s(e,t.slice(0,n),r)]),t=t.slice(n)}return i}},{"buffer-xor":48,"safe-buffer":143}],29:[function(e,t,r){var a=e("safe-buffer").Buffer;function s(e,t,r){for(var n,i,o=-1,a=0;++o<8;)n=t&1<<7-o?128:0,a+=(128&(i=e._cipher.encryptBlock(e._prev)[0]^n))>>o%8,e._prev=u(e._prev,r?n:i);return a}function u(e,t){var r=e.length,n=-1,i=a.allocUnsafe(e.length);for(e=a.concat([e,a.from([t])]);++n>7;return i}r.encrypt=function(e,t,r){for(var n=t.length,i=a.allocUnsafe(n),o=-1;++o=t)throw new Error("invalid sig")}t.exports=function(e,t,r,n,i){var o=g(r);if("ec"===o.type){if("ecdsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");return function(e,t,r){var n=m[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new p(n),o=r.data.subjectPrivateKey.data;return i.verify(t,e,o)}(e,t,o)}if("dsa"===o.type){if("dsa"!==n)throw new Error("wrong public key type");return function(e,t,r){var n=r.data.p,i=r.data.q,o=r.data.g,a=r.data.pub_key,s=g.signature.decode(e,"der"),u=s.s,l=s.r;v(u,i),v(l,i);var c=d.mont(n),f=u.invm(i);return 0===o.toRed(c).redPow(new d(t).mul(f).mod(i)).fromRed().mul(a.toRed(c).redPow(l.mul(f).mod(i)).fromRed()).mod(n).mod(i).cmp(l)}(e,t,o)}if("rsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");t=h.concat([i,t]);for(var a=o.modulus.byteLength(),s=[1],u=0;t.length+s.length+2=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|e}function d(e,t){if(f.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return D(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return L(e).length;default:if(n)return D(e).length;t=(""+t).toLowerCase(),n=!0}}function p(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):2147483647=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,i);if("number"==typeof t)return t&=255,f.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,i){var o,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=a=2,u/=2,r/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=r;o>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}return function(e){var t=e.length;if(t<=x)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return S(this,t,r);case"utf8":case"utf-8":return b(this,t,r);case"ascii":return w(this,t,r);case"latin1":case"binary":return T(this,t,r);case"base64":return y(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},f.prototype.equals=function(e){if(!f.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===f.compare(this,e)},f.prototype.inspect=function(){var e="",t=F.INSPECT_MAX_BYTES;return 0t&&(e+=" ... ")),""},f.prototype.compare=function(e,t,r,n,i){if(!f.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(n,i),l=e.slice(t,r),c=0;cthis.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o,a,s,u,l,c,f,h,d,p=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return h=t,d=r,N(D(e,(f=this).length-h),f,h,d);case"ascii":return _(this,e,t,r);case"latin1":case"binary":return _(this,e,t,r);case"base64":return u=this,l=t,c=r,N(L(e),u,l,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a=t,s=r,N(function(e,t){for(var r,n,i,o=[],a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(e,(o=this).length-a),o,a,s);default:if(p)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var x=4096;function w(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;ie.length)throw new RangeError("Index out of range")}function k(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function E(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function A(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function O(e,t,r,n,i){return i||A(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function R(e,t,r,n,i){return i||A(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):n>>8):k(this,e,t,!0),t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):k(this,e,t,!1),t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):E(this,e,t,!0),t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):E(this,e,t,!1),t+4},f.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);C(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);C(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;0<=--o&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,1,127,-128),f.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):k(this,e,t,!0),t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):k(this,e,t,!1),t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):E(this,e,t,!0),t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),f.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):E(this,e,t,!1),t+4},f.prototype.writeFloatLE=function(e,t,r){return O(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return O(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return R(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return R(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),0=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function L(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(t,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function N(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":16,ieee754:101,isarray:105}],50:[function(e,t,r){var i=e("safe-buffer").Buffer,n=e("stream").Transform,o=e("string_decoder").StringDecoder;function a(e){n.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}e("inherits")(a,n),a.prototype.update=function(e,t,r){"string"==typeof e&&(e=i.from(e,t));var n=this._update(e);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){n=e}finally{r(n)}},a.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},a.prototype._finalOrDigest=function(e){var t=this.__final()||i.alloc(0);return e&&(t=this._toString(t,e,!0)),t},a.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n},t.exports=a},{inherits:103,"safe-buffer":143,stream:152,string_decoder:153}],51:[function(e,t,r){(function(e){function t(e){return Object.prototype.toString.call(e)}r.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},r.isBoolean=function(e){return"boolean"==typeof e},r.isNull=function(e){return null===e},r.isNullOrUndefined=function(e){return null==e},r.isNumber=function(e){return"number"==typeof e},r.isString=function(e){return"string"==typeof e},r.isSymbol=function(e){return"symbol"==typeof e},r.isUndefined=function(e){return void 0===e},r.isRegExp=function(e){return"[object RegExp]"===t(e)},r.isObject=function(e){return"object"==typeof e&&null!==e},r.isDate=function(e){return"[object Date]"===t(e)},r.isError=function(e){return"[object Error]"===t(e)||e instanceof Error},r.isFunction=function(e){return"function"==typeof e},r.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},r.isBuffer=e.isBuffer}).call(this,{isBuffer:e("../../is-buffer/index.js")})},{"../../is-buffer/index.js":104}],52:[function(e,s,t){(function(o){var t=e("elliptic"),n=e("bn.js");s.exports=function(e){return new i(e)};var r={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function i(e){this.curveType=r[e],this.curveType||(this.curveType={name:e}),this.curve=new t.ec(this.curveType.name),this.keys=void 0}function a(e,t,r){Array.isArray(e)||(e=e.toArray());var n=new o(e);if(r&&n.length>>2),n=0,i=0;n>5]|=128<>>9<<4)]=t;for(var r=1732584193,n=-271733879,i=-1732584194,o=271733878,a=0;a>>32-t}(g(g(t,e),g(n,o)),i),r)}function f(e,t,r,n,i,o,a){return s(t&r|~t&n,e,t,i,o,a)}function h(e,t,r,n,i,o,a){return s(t&n|r&~n,e,t,i,o,a)}function d(e,t,r,n,i,o,a){return s(t^r^n,e,t,i,o,a)}function p(e,t,r,n,i,o,a){return s(r^(t|~n),e,t,i,o,a)}function g(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}t.exports=function(e){return n(e,i)}},{"./make-hash":54}],56:[function(e,t,r){"use strict";var n=e("inherits"),i=e("./legacy"),a=e("cipher-base"),s=e("safe-buffer").Buffer,o=e("create-hash/md5"),u=e("ripemd160"),l=e("sha.js"),c=s.alloc(128);function f(e,t){a.call(this,"digest"),"string"==typeof t&&(t=s.from(t));var r="sha512"===e||"sha384"===e?128:64;(this._alg=e,(this._key=t).length>r)?t=("rmd160"===e?new u:l(e)).update(t).digest():t.length>>1];r=h.r28shl(r,o),n=h.r28shl(n,o),h.pc2(r,n,e.keys,i)}},u.prototype._update=function(e,t,r,n){var i=this._desState,o=h.readUInt32BE(e,t),a=h.readUInt32BE(e,t+4);h.ip(o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,a,i.tmp,0):this._decrypt(i,o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],h.writeUInt32BE(r,o,n),h.writeUInt32BE(r,a,n+4)},u.prototype._pad=function(e,t){for(var r=e.length-t,n=t;n>>0,o=f}h.rip(a,o,n,i)},u.prototype._decrypt=function(e,t,r,n,i){for(var o=r,a=t,s=e.keys.length-2;0<=s;s-=2){var u=e.keys[s],l=e.keys[s+1];h.expand(o,e.tmp,0),u^=e.tmp[0],l^=e.tmp[1];var c=h.substitute(u,l),f=o;o=(a^h.permute(c))>>>0,a=f}h.rip(o,a,n,i)}},{"../des":59,inherits:103,"minimalistic-assert":109}],63:[function(e,t,r){"use strict";var o=e("minimalistic-assert"),n=e("inherits"),i=e("../des"),a=i.Cipher,s=i.DES;function u(e,t){o.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),n=t.slice(8,16),i=t.slice(16,24);this.ciphers="encrypt"===e?[s.create({type:"encrypt",key:r}),s.create({type:"decrypt",key:n}),s.create({type:"encrypt",key:i})]:[s.create({type:"decrypt",key:i}),s.create({type:"encrypt",key:n}),s.create({type:"decrypt",key:r})]}function l(e){a.call(this,e);var t=new u(this.type,this.options.key);this._edeState=t}n(l,a),(t.exports=l).create=function(e){return new l(e)},l.prototype._update=function(e,t,r,n){var i=this._edeState;i.ciphers[0]._update(e,t,r,n),i.ciphers[1]._update(r,n,r,n),i.ciphers[2]._update(r,n,r,n)},l.prototype._pad=s.prototype._pad,l.prototype._unpad=s.prototype._unpad},{"../des":59,inherits:103,"minimalistic-assert":109}],64:[function(e,t,r){"use strict";r.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},r.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=t>>>16&255,e[2+r]=t>>>8&255,e[3+r]=255&t},r.ip=function(e,t,r,n){for(var i=0,o=0,a=6;0<=a;a-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>>s+a&1}for(a=6;0<=a;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1}r[n+0]=i>>>0,r[n+1]=o>>>0},r.rip=function(e,t,r,n){for(var i=0,o=0,a=0;a<4;a++)for(var s=24;0<=s;s-=8)i<<=1,i|=t>>>s+a&1,i<<=1,i|=e>>>s+a&1;for(a=4;a<8;a++)for(s=24;0<=s;s-=8)o<<=1,o|=t>>>s+a&1,o<<=1,o|=e>>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.pc1=function(e,t,r,n){for(var i=0,o=0,a=7;5<=a;a--){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.r28shl=function(e,t){return e<>>28-t};var u=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];r.pc2=function(e,t,r,n){for(var i=0,o=0,a=u.length>>>1,s=0;s>>u[s]&1;for(s=a;s>>u[s]&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.expand=function(e,t,r){var n=0,i=0;n=(1&e)<<5|e>>>27;for(var o=23;15<=o;o-=4)n<<=6,n|=e>>>o&63;for(o=11;3<=o;o-=4)i|=e>>>o&63,i<<=6;i|=(31&e)<<1|e>>>31,t[r+0]=n>>>0,t[r+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];r.substitute=function(e,t){for(var r=0,n=0;n<4;n++){r<<=4,r|=i[64*n+(e>>>18-6*n&63)]}for(n=0;n<4;n++){r<<=4,r|=i[256+64*n+(t>>>18-6*n&63)]}return r>>>0};var n=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];r.permute=function(e){for(var t=0,r=0;r>>n[r]&1;return t>>>0},r.padSplit=function(e,t,r){for(var n=e.toString(2);n.lengthe;)r.ishrn(1);if(r.isEven()&&r.iadd(u),r.testn(1)||r.iadd(l),t.cmp(l)){if(!t.cmp(c))for(;r.mod(f).cmp(h);)r.iadd(p)}else for(;r.mod(a).cmp(d);)r.iadd(p);if(m(n=r.shrn(1))&&m(r)&&v(n)&&v(r)&&s.test(n)&&s.test(r))return r}}},{"bn.js":17,"miller-rabin":108,randombytes:130}],68:[function(e,t,r){t.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},{}],69:[function(e,t,r){"use strict";var n=r;n.version=e("../package.json").version,n.utils=e("./elliptic/utils"),n.rand=e("brorand"),n.curve=e("./elliptic/curve"),n.curves=e("./elliptic/curves"),n.ec=e("./elliptic/ec"),n.eddsa=e("./elliptic/eddsa")},{"../package.json":84,"./elliptic/curve":72,"./elliptic/curves":75,"./elliptic/ec":76,"./elliptic/eddsa":79,"./elliptic/utils":83,brorand:18}],70:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("../../elliptic").utils,M=i.getNAF,P=i.getJSF,f=i.assert;function o(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var r=this.n&&this.p.div(this.n);!r||0>1]):a.mixedAdd(i[-u-1>>1].neg()):0>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},o.prototype._wnafMulAdd=function(e,t,r,n,i){for(var o=this._wnafT1,a=this._wnafT2,s=this._wnafT3,u=0,l=0;l>1]:S<0&&(T=a[m][-S-1>>1].neg()),y="affine"===T.type?y.mixedAdd(T):y.add(T))}}for(l=0;l=Math.ceil((e.bitLength()+1)/t.step)},a.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i":""},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},c.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),a=o.redSub(r),s=n.redSub(t),u=i.redMul(a),l=o.redMul(s),c=i.redMul(s),f=a.redMul(o);return this.curve.point(u,l,f,c)},c.prototype._projDbl=function(){var e,t,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var a=(l=this.curve._mulA(i)).redAdd(o);if(this.zOne)e=n.redSub(i).redSub(o).redMul(a.redSub(this.curve.two)),t=a.redMul(l.redSub(o)),r=a.redSqr().redSub(a).redSub(a);else{var s=this.z.redSqr(),u=a.redSub(s).redISub(s);e=n.redSub(i).redISub(o).redMul(u),t=a.redMul(l.redSub(o)),r=a.redMul(u)}}else{var l=i.redAdd(o);s=this.curve._mulC(this.c.redMul(this.z)).redSqr(),u=l.redSub(s).redSub(s);e=this.curve._mulC(n.redISub(l)).redMul(u),t=this.curve._mulC(l).redMul(i.redISub(o)),r=l.redMul(u)}return this.curve.point(e,t,r)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),a=i.redSub(n),s=i.redAdd(n),u=r.redAdd(t),l=o.redMul(a),c=s.redMul(u),f=o.redMul(u),h=a.redMul(s);return this.curve.point(l,c,h,f)},c.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),l=i.redAdd(s),c=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),f=n.redMul(u).redMul(c);return r=this.curve.twisted?(t=n.redMul(l).redMul(a.redSub(this.curve._mulA(o))),u.redMul(l)):(t=n.redMul(l).redMul(a.redSub(o)),this.curve._mulC(u).redMul(l)),this.curve.point(f,t,r)},c.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},c.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},c.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},c.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),0<=r.cmp(this.curve.p))return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}return!1},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},{"../../elliptic":69,"../curve":72,"bn.js":17,inherits:103}],72:[function(e,t,r){"use strict";var n=r;n.base=e("./base"),n.short=e("./short"),n.mont=e("./mont"),n.edwards=e("./edwards")},{"./base":70,"./edwards":71,"./mont":73,"./short":74}],73:[function(e,t,r){"use strict";var n=e("../curve"),i=e("bn.js"),o=e("inherits"),a=n.base,s=e("../../elliptic").utils;function u(e){a.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function l(e,t,r){a.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(u,a),(t.exports=u).prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},o(l,a.BasePoint),u.prototype.decodePoint=function(e,t){return this.point(s.toArray(e,t),1)},u.prototype.point=function(e,t){return new l(this,e,t)},u.prototype.pointFromJSON=function(e){return l.fromJSON(this,e)},l.prototype.precompute=function(){},l.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},l.fromJSON=function(e,t){return new l(e,t[0],t[1]||e.one)},l.prototype.inspect=function(){return this.isInfinity()?"":""},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},l.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},l.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},l.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),a=i.redMul(n),s=t.z.redMul(o.redAdd(a).redSqr()),u=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},l.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;0<=o;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},l.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},l.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},l.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},l.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},l.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../../elliptic":69,"../curve":72,"bn.js":17,inherits:103}],74:[function(e,t,r){"use strict";var n=e("../curve"),i=e("../../elliptic"),x=e("bn.js"),o=e("inherits"),a=n.base,s=i.utils.assert;function u(e){a.call(this,"short",e),this.a=new x(e.a,16).toRed(this.red),this.b=new x(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function l(e,t,r,n){a.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new x(t,16),this.y=new x(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function c(e,t,r,n){a.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new x(0)):(this.x=new x(t,16),this.y=new x(r,16),this.z=new x(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,a),(t.exports=u).prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new x(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new x(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?r=i[0]:(r=i[1],s(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map(function(e){return{a:new x(e.a,16),b:new x(e.b,16)}}):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:x.mont(e),r=new x(2).toRed(t).redInvm(),n=r.redNeg(),i=new x(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},u.prototype._getEndoBasis=function(e){for(var t,r,n,i,o,a,s,u,l,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=e,h=this.n.clone(),d=new x(1),p=new x(0),g=new x(0),m=new x(1),v=0;0!==f.cmpn(0);){var _=h.div(f);u=h.sub(_.mul(f)),l=g.sub(_.mul(d));var y=m.sub(_.mul(p));if(!n&&u.cmp(c)<0)t=s.neg(),r=d,n=u.neg(),i=l;else if(n&&2==++v)break;h=f,f=s=u,g=d,d=l,m=p,p=y}o=u.neg(),a=l;var b=n.sqr().add(i.sqr());return 0<=o.sqr().add(a.sqr()).cmp(b)&&(o=t,a=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:i},{a:o,b:a}]},u.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),u=i.mul(r.b),l=o.mul(n.b);return{k1:e.sub(a).sub(s),k2:u.add(l).neg()}},u.prototype.pointFromX=function(e,t){(e=new x(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},u.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},l.prototype.isInfinity=function(){return this.inf},l.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},l.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},l.prototype.getX=function(){return this.x.fromRed()},l.prototype.getY=function(){return this.y.fromRed()},l.prototype.mul=function(e){return e=new x(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},l.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},l.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},l.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},l.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},l.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(c,a.BasePoint),u.prototype.jpoint=function(e,t,r){return new c(this,e,t,r)},c.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},c.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},c.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=s.redSqr(),c=l.redMul(s),f=n.redMul(l),h=u.redSqr().redIAdd(c).redISub(f).redISub(f),d=u.redMul(f.redISub(h)).redISub(o.redMul(c)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(h,d,p)},c.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),c=r.redMul(u),f=s.redSqr().redIAdd(l).redISub(c).redISub(c),h=s.redMul(c.redISub(f)).redISub(i.redMul(l)),d=this.z.redMul(a);return this.curve.jpoint(f,h,d)},c.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":69,"../curve":72,"bn.js":17,inherits:103}],75:[function(e,t,r){"use strict";var n,i=r,o=e("hash.js"),a=e("../elliptic"),s=a.utils.assert;function u(e){"short"===e.type?this.curve=new a.curve.short(e):"edwards"===e.type?this.curve=new a.curve.edwards(e):this.curve=new a.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function l(t,r){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var e=new u(r);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:e}),e}})}i.PresetCurve=u,l("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),l("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),l("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),l("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),l("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),l("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),l("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=e("./precomputed/secp256k1")}catch(e){n=void 0}l("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"../elliptic":69,"./precomputed/secp256k1":82,"hash.js":88}],76:[function(e,t,r){"use strict";var m=e("bn.js"),v=e("hmac-drbg"),o=e("../../elliptic"),d=o.utils.assert,n=e("./key"),_=e("./signature");function i(e){if(!(this instanceof i))return new i(e);"string"==typeof e&&(d(o.curves.hasOwnProperty(e),"Unknown curve "+e),e=o.curves[e]),e instanceof o.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}(t.exports=i).prototype.keyPair=function(e){return new n(this,e)},i.prototype.keyFromPrivate=function(e,t){return n.fromPrivate(this,e,t)},i.prototype.keyFromPublic=function(e,t){return n.fromPublic(this,e,t)},i.prototype.genKeyPair=function(e){e||(e={});for(var t=new v({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||o.rand(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new m(2));;){var i=new m(t.generate(r));if(!(0>1;if(0<=a.cmp(this.curve.p.umod(this.curve.n))&&l)throw new Error("Unable to find sencond key candinate");a=l?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var c=t.r.invm(i),f=i.sub(o).mul(c).umod(i),h=s.mul(c).umod(i);return this.g.mulAdd(f,a,h)},i.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new _(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":69,"./key":77,"./signature":78,"bn.js":17,"hmac-drbg":100}],77:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("../../elliptic").utils.assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}(t.exports=o).fromPublic=function(e,t,r){return t instanceof o?t:new o(e,{pub:t,pubEnc:r})},o.fromPrivate=function(e,t,r){return t instanceof o?t:new o(e,{priv:t,privEnc:r})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.mul(this.priv).getX()},o.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},{"../../elliptic":69,"bn.js":17}],78:[function(e,t,r){"use strict";var s=e("bn.js"),u=e("../../elliptic").utils,n=u.assert;function i(e,t){if(e instanceof i)return e;this._importDER(e,t)||(n(e.r&&e.s,"Signature without r or s"),this.r=new s(e.r,16),this.s=new s(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function l(){this.place=0}function c(e,t){var r=e[t.place++];if(!(128&r))return r;for(var n=15&r,i=0,o=0,a=t.place;o>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}(t.exports=i).prototype._importDER=function(e,t){e=u.toArray(e,t);var r=new l;if(48!==e[r.place++])return!1;if(c(e,r)+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var n=c(e,r),i=e.slice(r.place,n+r.place);if(r.place+=n,2!==e[r.place++])return!1;var o=c(e,r);if(e.length!==o+r.place)return!1;var a=e.slice(r.place,o+r.place);return 0===i[0]&&128&i[1]&&(i=i.slice(1)),0===a[0]&&128&a[1]&&(a=a.slice(1)),this.r=new s(i),this.s=new s(a),!(this.recoveryParam=null)},i.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=a(t),r=a(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];f(n,t.length),(n=n.concat(t)).push(2),f(n,r.length);var i=n.concat(r),o=[48];return f(o,i.length),o=o.concat(i),u.encode(o,e)}},{"../../elliptic":69,"bn.js":17}],79:[function(e,t,r){"use strict";var n=e("hash.js"),i=e("../../elliptic"),o=i.utils,a=o.assert,u=o.parseBytes,s=e("./key"),l=e("./signature");function c(e){if(a("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof c))return new c(e);e=i.curves[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}(t.exports=c).prototype.sign=function(e,t){e=u(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),s=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},c.prototype.verify=function(e,t,r){e=u(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},c.prototype.hashInt=function(){for(var e=this.hash(),t=0;t>1)-1>1)-a:a,i.isubn(o)}else o=0;r.push(o);for(var s=0!==i.cmpn(0)&&0===i.andln(n-1)?t+1:1,u=1;ur&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.once=function(e,t){if(!u(t))throw TypeError("listener must be a function");var r=!1;function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var r,n,i,o;if(!u(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(i=(r=this._events[e]).length,n=-1,r===t||u(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(l(r)){for(o=i;0=this._blockSize;){for(var i=this._blockOffset;i=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;othis.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t>>3},r.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},{"../utils":99}],99:[function(e,t,r){"use strict";var l=e("minimalistic-assert"),n=e("inherits");function o(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function i(e){return 1===e.length?"0"+e:e}function a(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}r.inherits=n,r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>8,a=255&i;o?r.push(o,a):r.push(a)}else for(n=0;n>>0}return o},r.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},r.rotr32=function(e,t){return e>>>t|e<<32-t},r.rotl32=function(e,t){return e<>>32-t},r.sum32=function(e,t){return e+t>>>0},r.sum32_3=function(e,t,r){return e+t+r>>>0},r.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},r.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},r.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,a=(o>>0,e[t+1]=o},r.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},r.sum64_lo=function(e,t,r,n){return t+n>>>0},r.sum64_4_hi=function(e,t,r,n,i,o,a,s){var u=0,l=t;return u+=(l=l+n>>>0)>>0)>>0)>>0},r.sum64_4_lo=function(e,t,r,n,i,o,a,s){return t+n+o+s>>>0},r.sum64_5_hi=function(e,t,r,n,i,o,a,s,u,l){var c=0,f=t;return c+=(f=f+n>>>0)>>0)>>0)>>0)>>0},r.sum64_5_lo=function(e,t,r,n,i,o,a,s,u,l){return t+n+o+s+l>>>0},r.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},r.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},r.shr64_hi=function(e,t,r){return e>>>r},r.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},{inherits:103,"minimalistic-assert":109}],100:[function(e,t,r){"use strict";var n=e("hash.js"),a=e("minimalistic-crypto-utils"),i=e("minimalistic-assert");function o(e){if(!(this instanceof o))return new o(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=a.toArray(e.entropy,e.entropyEnc||"hex"),r=a.toArray(e.nonce,e.nonceEnc||"hex"),n=a.toArray(e.pers,e.persEnc||"hex");i(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}(t.exports=o).prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},o.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=a.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length>1,c=-7,f=r?i-1:0,h=r?-1:1,d=e[t+f];for(f+=h,o=d&(1<<-c)-1,d>>=-c,c+=s;0>=-c,c+=n;0>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),2<=(t+=1<=a+f?h/u:h*Math.pow(2,1-f))*u&&(a++,u/=2),c<=a+f?(s=0,a=c):1<=a+f?(s=(t*u-1)*Math.pow(2,i),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),a=0));8<=i;e[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<>>32-t}function u(e,t,r,n,i,o,a){return s(e+(t&r|~t&n)+i+o|0,a)+t|0}function l(e,t,r,n,i,o,a){return s(e+(t&n|r&~n)+i+o|0,a)+t|0}function c(e,t,r,n,i,o,a){return s(e+(t^r^n)+i+o|0,a)+t|0}function f(e,t,r,n,i,o,a){return s(e+(r^(t|~n))+i+o|0,a)+t|0}e(n,r),n.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d;n=f(n=f(n=f(n=f(n=c(n=c(n=c(n=c(n=l(n=l(n=l(n=l(n=u(n=u(n=u(n=u(n,i=u(i,o=u(o,r=u(r,n,i,o,e[0],3614090360,7),n,i,e[1],3905402710,12),r,n,e[2],606105819,17),o,r,e[3],3250441966,22),i=u(i,o=u(o,r=u(r,n,i,o,e[4],4118548399,7),n,i,e[5],1200080426,12),r,n,e[6],2821735955,17),o,r,e[7],4249261313,22),i=u(i,o=u(o,r=u(r,n,i,o,e[8],1770035416,7),n,i,e[9],2336552879,12),r,n,e[10],4294925233,17),o,r,e[11],2304563134,22),i=u(i,o=u(o,r=u(r,n,i,o,e[12],1804603682,7),n,i,e[13],4254626195,12),r,n,e[14],2792965006,17),o,r,e[15],1236535329,22),i=l(i,o=l(o,r=l(r,n,i,o,e[1],4129170786,5),n,i,e[6],3225465664,9),r,n,e[11],643717713,14),o,r,e[0],3921069994,20),i=l(i,o=l(o,r=l(r,n,i,o,e[5],3593408605,5),n,i,e[10],38016083,9),r,n,e[15],3634488961,14),o,r,e[4],3889429448,20),i=l(i,o=l(o,r=l(r,n,i,o,e[9],568446438,5),n,i,e[14],3275163606,9),r,n,e[3],4107603335,14),o,r,e[8],1163531501,20),i=l(i,o=l(o,r=l(r,n,i,o,e[13],2850285829,5),n,i,e[2],4243563512,9),r,n,e[7],1735328473,14),o,r,e[12],2368359562,20),i=c(i,o=c(o,r=c(r,n,i,o,e[5],4294588738,4),n,i,e[8],2272392833,11),r,n,e[11],1839030562,16),o,r,e[14],4259657740,23),i=c(i,o=c(o,r=c(r,n,i,o,e[1],2763975236,4),n,i,e[4],1272893353,11),r,n,e[7],4139469664,16),o,r,e[10],3200236656,23),i=c(i,o=c(o,r=c(r,n,i,o,e[13],681279174,4),n,i,e[0],3936430074,11),r,n,e[3],3572445317,16),o,r,e[6],76029189,23),i=c(i,o=c(o,r=c(r,n,i,o,e[9],3654602809,4),n,i,e[12],3873151461,11),r,n,e[15],530742520,16),o,r,e[2],3299628645,23),i=f(i,o=f(o,r=f(r,n,i,o,e[0],4096336452,6),n,i,e[7],1126891415,10),r,n,e[14],2878612391,15),o,r,e[5],4237533241,21),i=f(i,o=f(o,r=f(r,n,i,o,e[12],1700485571,6),n,i,e[3],2399980690,10),r,n,e[10],4293915773,15),o,r,e[1],2240044497,21),i=f(i,o=f(o,r=f(r,n,i,o,e[8],1873313359,6),n,i,e[15],4264355552,10),r,n,e[6],2734768916,15),o,r,e[13],1309151649,21),i=f(i,o=f(o,r=f(r,n,i,o,e[4],4149444226,6),n,i,e[11],3174756917,10),r,n,e[2],718787259,15),o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},n.prototype._digest=function(){this._block[this._blockOffset++]=128,56=this._blockSize;){for(var i=this._blockOffset;i>8,a=255&i;o?r.push(o,a):r.push(a)}return r},n.zero2=i,n.toHex=o,n.encode=function(e,t){return"hex"===t?o(e):e}},{}],111:[function(e,t,r){t.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},{}],112:[function(e,t,r){"use strict";var n=e("asn1.js");r.certificate=e("./certificate");var i=n.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});r.RSAPrivateKey=i;var o=n.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});r.RSAPublicKey=o;var a=n.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())});r.PublicKey=a;var s=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),u=n.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(s),this.key("subjectPrivateKey").octstr())});r.PrivateKey=u;var l=n.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});r.EncryptedPrivateKey=l;var c=n.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});r.DSAPrivateKey=c,r.DSAparam=n.define("DSAparam",function(){this.int()});var f=n.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(h),this.key("publicKey").optional().explicit(1).bitstr())});r.ECPrivateKey=f;var h=n.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});r.signature=n.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})},{"./certificate":113,"asn1.js":2}],113:[function(e,t,r){"use strict";var n=e("asn1.js"),i=n.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),o=n.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),a=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional())}),s=n.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(a),this.key("subjectPublicKey").bitstr())}),u=n.define("RelativeDistinguishedName",function(){this.setof(o)}),l=n.define("RDNSequence",function(){this.seqof(u)}),c=n.define("Name",function(){this.choice({rdnSequence:this.use(l)})}),f=n.define("Validity",function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))}),h=n.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),d=n.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int(),this.key("serialNumber").int(),this.key("signature").use(a),this.key("issuer").use(c),this.key("validity").use(f),this.key("subject").use(c),this.key("subjectPublicKeyInfo").use(s),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(h).optional())}),p=n.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(d),this.key("signatureAlgorithm").use(a),this.key("signatureValue").bitstr())});t.exports=p},{"asn1.js":2}],114:[function(e,t,r){(function(h){var d=/Proc-Type: 4,ENCRYPTED\n\r?DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\n\r?\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?/m,p=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n/m,g=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?-----END \1-----$/m,m=e("evp_bytestokey"),v=e("browserify-aes");t.exports=function(e,t){var r,n=e.toString(),i=n.match(d);if(i){var o="aes"+i[1],a=new h(i[2],"hex"),s=new h(i[3].replace(/\r?\n/g,""),"base64"),u=m(t,a.slice(0,8),parseInt(i[1],10)).key,l=[],c=v.createDecipheriv(o,u,a);l.push(c.update(s)),l.push(c.final()),r=h.concat(l)}else{var f=n.match(g);r=new h(f[2].replace(/\r?\n/g,""),"base64")}return{tag:n.match(p)[1],data:r}}}).call(this,e("buffer").Buffer)},{"browserify-aes":22,buffer:49,evp_bytestokey:86}],115:[function(t,r,e){(function(f){var s=t("./asn1"),h=t("./aesid.json"),u=t("./fixProc"),d=t("browserify-aes"),p=t("pbkdf2");function e(e){var t;"object"!=typeof e||f.isBuffer(e)||(t=e.passphrase,e=e.key),"string"==typeof e&&(e=new f(e));var r,n,i=u(e,t),o=i.tag,a=i.data;switch(o){case"CERTIFICATE":n=s.certificate.decode(a,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(n||(n=s.PublicKey.decode(a,"der")),r=n.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return s.RSAPublicKey.decode(n.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return n.subjectPrivateKey=n.subjectPublicKey,{type:"ec",data:n};case"1.2.840.10040.4.1":return n.algorithm.params.pub_key=s.DSAparam.decode(n.subjectPublicKey.data,"der"),{type:"dsa",data:n.algorithm.params};default:throw new Error("unknown key id "+r)}throw new Error("unknown key type "+o);case"ENCRYPTED PRIVATE KEY":a=function(e,t){var r=e.algorithm.decrypt.kde.kdeparams.salt,n=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),i=h[e.algorithm.decrypt.cipher.algo.join(".")],o=e.algorithm.decrypt.cipher.iv,a=e.subjectPrivateKey,s=parseInt(i.split("-")[1],10)/8,u=p.pbkdf2Sync(t,r,n,s),l=d.createDecipheriv(i,u,o),c=[];return c.push(l.update(a)),c.push(l.final()),f.concat(c)}(a=s.EncryptedPrivateKey.decode(a,"der"),t);case"PRIVATE KEY":switch(r=(n=s.PrivateKey.decode(a,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return s.RSAPrivateKey.decode(n.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:n.algorithm.curve,privateKey:s.ECPrivateKey.decode(n.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return n.algorithm.params.priv_key=s.DSAparam.decode(n.subjectPrivateKey,"der"),{type:"dsa",params:n.algorithm.params};default:throw new Error("unknown key id "+r)}throw new Error("unknown key type "+o);case"RSA PUBLIC KEY":return s.RSAPublicKey.decode(a,"der");case"RSA PRIVATE KEY":return s.RSAPrivateKey.decode(a,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:s.DSAPrivateKey.decode(a,"der")};case"EC PRIVATE KEY":return{curve:(a=s.ECPrivateKey.decode(a,"der")).parameters.value,privateKey:a.privateKey};default:throw new Error("unknown key type "+o)}}(r.exports=e).signature=s.signature}).call(this,t("buffer").Buffer)},{"./aesid.json":111,"./asn1":112,"./fixProc":114,"browserify-aes":22,buffer:49,pbkdf2:117}],116:[function(e,t,l){(function(i){function o(e,t){for(var r=0,n=e.length-1;0<=n;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,a=function(e){return t.exec(e).slice(1)};function s(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;ni?t=n(t):t.lengtha||0<=new l(t).cmp(o.modulus))throw new Error("decryption error");i=r?g(new l(t),o):d(t,o);var s=new c(a-i.length);if(s.fill(0),i=c.concat([s,i],a),4===n)return function(e,t){e.modulus;var r=e.modulus.byteLength(),n=(t.length,p("sha1").update(new c("")).digest()),i=n.length;if(0!==t[0])throw new Error("decryption error");var o=t.slice(1,i+1),a=t.slice(i+1),s=h(o,f(a,i)),u=h(a,f(s,r-i-1));if(function(e,t){e=new c(e),t=new c(t);var r=0,n=e.length;e.length!==t.length&&(r++,n=Math.min(e.length,t.length));var i=-1;for(;++i=t.length){o++;break}var a=t.slice(2,i-1);t.slice(i-1,i);("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&o++;a.length<8&&o++;if(o)throw new Error("decryption error");return t.slice(i)}(0,i,r);if(3===n)return i;throw new Error("unknown padding")}}).call(this,e("buffer").Buffer)},{"./mgf":125,"./withPublic":128,"./xor":129,"bn.js":17,"browserify-rsa":40,buffer:49,"create-hash":53,"parse-asn1":115}],127:[function(e,t,r){(function(h){var a=e("parse-asn1"),d=e("randombytes"),p=e("create-hash"),g=e("./mgf"),m=e("./xor"),v=e("bn.js"),s=e("./withPublic"),u=e("browserify-rsa");t.exports=function(e,t,r){var n;n=e.padding?e.padding:r?1:4;var i,o=a(e);if(4===n)i=function(e,t){var r=e.modulus.byteLength(),n=t.length,i=p("sha1").update(new h("")).digest(),o=i.length,a=2*o;if(r-a-2t.highWaterMark&&(t.highWaterMark=function(e){return u<=e?e=u:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function c(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?m(f,e):f(e))}function f(e){y("emit readable"),e.emit("readable"),x(e)}function d(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.highWaterMark||t.ended))return y("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?T(this):c(this),null;if(0===(e=l(e,t))&&t.ended)return 0===t.length&&T(this),null;var n,i=t.needReadable;return y("need readable",i),(0===t.length||t.length-e>>32-t}function p(e,t,r,n,i,o,a,s){return d(e+(t^r^n)+o+a|0,s)+i|0}function g(e,t,r,n,i,o,a,s){return d(e+(t&r|~t&n)+o+a|0,s)+i|0}function m(e,t,r,n,i,o,a,s){return d(e+((t|~r)^n)+o+a|0,s)+i|0}function v(e,t,r,n,i,o,a,s){return d(e+(t&n|r&~n)+o+a|0,s)+i|0}function _(e,t,r,n,i,o,a,s){return d(e+(t^(r|~n))+o+a|0,s)+i|0}e(n,r),n.prototype._update=function(){for(var e=new Array(16),t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d,a=this._e;a=p(a,r=p(r,n,i,o,a,e[0],0,11),n,i=d(i,10),o,e[1],0,14),n=p(n=d(n,10),i=p(i,o=p(o,a,r,n,i,e[2],0,15),a,r=d(r,10),n,e[3],0,12),o,a=d(a,10),r,e[4],0,5),o=p(o=d(o,10),a=p(a,r=p(r,n,i,o,a,e[5],0,8),n,i=d(i,10),o,e[6],0,7),r,n=d(n,10),i,e[7],0,9),r=p(r=d(r,10),n=p(n,i=p(i,o,a,r,n,e[8],0,11),o,a=d(a,10),r,e[9],0,13),i,o=d(o,10),a,e[10],0,14),i=p(i=d(i,10),o=p(o,a=p(a,r,n,i,o,e[11],0,15),r,n=d(n,10),i,e[12],0,6),a,r=d(r,10),n,e[13],0,7),a=g(a=d(a,10),r=p(r,n=p(n,i,o,a,r,e[14],0,9),i,o=d(o,10),a,e[15],0,8),n,i=d(i,10),o,e[7],1518500249,7),n=g(n=d(n,10),i=g(i,o=g(o,a,r,n,i,e[4],1518500249,6),a,r=d(r,10),n,e[13],1518500249,8),o,a=d(a,10),r,e[1],1518500249,13),o=g(o=d(o,10),a=g(a,r=g(r,n,i,o,a,e[10],1518500249,11),n,i=d(i,10),o,e[6],1518500249,9),r,n=d(n,10),i,e[15],1518500249,7),r=g(r=d(r,10),n=g(n,i=g(i,o,a,r,n,e[3],1518500249,15),o,a=d(a,10),r,e[12],1518500249,7),i,o=d(o,10),a,e[0],1518500249,12),i=g(i=d(i,10),o=g(o,a=g(a,r,n,i,o,e[9],1518500249,15),r,n=d(n,10),i,e[5],1518500249,9),a,r=d(r,10),n,e[2],1518500249,11),a=g(a=d(a,10),r=g(r,n=g(n,i,o,a,r,e[14],1518500249,7),i,o=d(o,10),a,e[11],1518500249,13),n,i=d(i,10),o,e[8],1518500249,12),n=m(n=d(n,10),i=m(i,o=m(o,a,r,n,i,e[3],1859775393,11),a,r=d(r,10),n,e[10],1859775393,13),o,a=d(a,10),r,e[14],1859775393,6),o=m(o=d(o,10),a=m(a,r=m(r,n,i,o,a,e[4],1859775393,7),n,i=d(i,10),o,e[9],1859775393,14),r,n=d(n,10),i,e[15],1859775393,9),r=m(r=d(r,10),n=m(n,i=m(i,o,a,r,n,e[8],1859775393,13),o,a=d(a,10),r,e[1],1859775393,15),i,o=d(o,10),a,e[2],1859775393,14),i=m(i=d(i,10),o=m(o,a=m(a,r,n,i,o,e[7],1859775393,8),r,n=d(n,10),i,e[0],1859775393,13),a,r=d(r,10),n,e[6],1859775393,6),a=m(a=d(a,10),r=m(r,n=m(n,i,o,a,r,e[13],1859775393,5),i,o=d(o,10),a,e[11],1859775393,12),n,i=d(i,10),o,e[5],1859775393,7),n=v(n=d(n,10),i=v(i,o=m(o,a,r,n,i,e[12],1859775393,5),a,r=d(r,10),n,e[1],2400959708,11),o,a=d(a,10),r,e[9],2400959708,12),o=v(o=d(o,10),a=v(a,r=v(r,n,i,o,a,e[11],2400959708,14),n,i=d(i,10),o,e[10],2400959708,15),r,n=d(n,10),i,e[0],2400959708,14),r=v(r=d(r,10),n=v(n,i=v(i,o,a,r,n,e[8],2400959708,15),o,a=d(a,10),r,e[12],2400959708,9),i,o=d(o,10),a,e[4],2400959708,8),i=v(i=d(i,10),o=v(o,a=v(a,r,n,i,o,e[13],2400959708,9),r,n=d(n,10),i,e[3],2400959708,14),a,r=d(r,10),n,e[7],2400959708,5),a=v(a=d(a,10),r=v(r,n=v(n,i,o,a,r,e[15],2400959708,6),i,o=d(o,10),a,e[14],2400959708,8),n,i=d(i,10),o,e[5],2400959708,6),n=_(n=d(n,10),i=v(i,o=v(o,a,r,n,i,e[6],2400959708,5),a,r=d(r,10),n,e[2],2400959708,12),o,a=d(a,10),r,e[4],2840853838,9),o=_(o=d(o,10),a=_(a,r=_(r,n,i,o,a,e[0],2840853838,15),n,i=d(i,10),o,e[5],2840853838,5),r,n=d(n,10),i,e[9],2840853838,11),r=_(r=d(r,10),n=_(n,i=_(i,o,a,r,n,e[7],2840853838,6),o,a=d(a,10),r,e[12],2840853838,8),i,o=d(o,10),a,e[2],2840853838,13),i=_(i=d(i,10),o=_(o,a=_(a,r,n,i,o,e[10],2840853838,12),r,n=d(n,10),i,e[14],2840853838,5),a,r=d(r,10),n,e[1],2840853838,12),a=_(a=d(a,10),r=_(r,n=_(n,i,o,a,r,e[3],2840853838,13),i,o=d(o,10),a,e[8],2840853838,14),n,i=d(i,10),o,e[11],2840853838,11),n=_(n=d(n,10),i=_(i,o=_(o,a,r,n,i,e[6],2840853838,8),a,r=d(r,10),n,e[15],2840853838,5),o,a=d(a,10),r,e[13],2840853838,6),o=d(o,10);var s=this._a,u=this._b,l=this._c,c=this._d,f=this._e;f=_(f,s=_(s,u,l,c,f,e[5],1352829926,8),u,l=d(l,10),c,e[14],1352829926,9),u=_(u=d(u,10),l=_(l,c=_(c,f,s,u,l,e[7],1352829926,9),f,s=d(s,10),u,e[0],1352829926,11),c,f=d(f,10),s,e[9],1352829926,13),c=_(c=d(c,10),f=_(f,s=_(s,u,l,c,f,e[2],1352829926,15),u,l=d(l,10),c,e[11],1352829926,15),s,u=d(u,10),l,e[4],1352829926,5),s=_(s=d(s,10),u=_(u,l=_(l,c,f,s,u,e[13],1352829926,7),c,f=d(f,10),s,e[6],1352829926,7),l,c=d(c,10),f,e[15],1352829926,8),l=_(l=d(l,10),c=_(c,f=_(f,s,u,l,c,e[8],1352829926,11),s,u=d(u,10),l,e[1],1352829926,14),f,s=d(s,10),u,e[10],1352829926,14),f=v(f=d(f,10),s=_(s,u=_(u,l,c,f,s,e[3],1352829926,12),l,c=d(c,10),f,e[12],1352829926,6),u,l=d(l,10),c,e[6],1548603684,9),u=v(u=d(u,10),l=v(l,c=v(c,f,s,u,l,e[11],1548603684,13),f,s=d(s,10),u,e[3],1548603684,15),c,f=d(f,10),s,e[7],1548603684,7),c=v(c=d(c,10),f=v(f,s=v(s,u,l,c,f,e[0],1548603684,12),u,l=d(l,10),c,e[13],1548603684,8),s,u=d(u,10),l,e[5],1548603684,9),s=v(s=d(s,10),u=v(u,l=v(l,c,f,s,u,e[10],1548603684,11),c,f=d(f,10),s,e[14],1548603684,7),l,c=d(c,10),f,e[15],1548603684,7),l=v(l=d(l,10),c=v(c,f=v(f,s,u,l,c,e[8],1548603684,12),s,u=d(u,10),l,e[12],1548603684,7),f,s=d(s,10),u,e[4],1548603684,6),f=v(f=d(f,10),s=v(s,u=v(u,l,c,f,s,e[9],1548603684,15),l,c=d(c,10),f,e[1],1548603684,13),u,l=d(l,10),c,e[2],1548603684,11),u=m(u=d(u,10),l=m(l,c=m(c,f,s,u,l,e[15],1836072691,9),f,s=d(s,10),u,e[5],1836072691,7),c,f=d(f,10),s,e[1],1836072691,15),c=m(c=d(c,10),f=m(f,s=m(s,u,l,c,f,e[3],1836072691,11),u,l=d(l,10),c,e[7],1836072691,8),s,u=d(u,10),l,e[14],1836072691,6),s=m(s=d(s,10),u=m(u,l=m(l,c,f,s,u,e[6],1836072691,6),c,f=d(f,10),s,e[9],1836072691,14),l,c=d(c,10),f,e[11],1836072691,12),l=m(l=d(l,10),c=m(c,f=m(f,s,u,l,c,e[8],1836072691,13),s,u=d(u,10),l,e[12],1836072691,5),f,s=d(s,10),u,e[2],1836072691,14),f=m(f=d(f,10),s=m(s,u=m(u,l,c,f,s,e[10],1836072691,13),l,c=d(c,10),f,e[0],1836072691,13),u,l=d(l,10),c,e[4],1836072691,7),u=g(u=d(u,10),l=g(l,c=m(c,f,s,u,l,e[13],1836072691,5),f,s=d(s,10),u,e[8],2053994217,15),c,f=d(f,10),s,e[6],2053994217,5),c=g(c=d(c,10),f=g(f,s=g(s,u,l,c,f,e[4],2053994217,8),u,l=d(l,10),c,e[1],2053994217,11),s,u=d(u,10),l,e[3],2053994217,14),s=g(s=d(s,10),u=g(u,l=g(l,c,f,s,u,e[11],2053994217,14),c,f=d(f,10),s,e[15],2053994217,6),l,c=d(c,10),f,e[0],2053994217,14),l=g(l=d(l,10),c=g(c,f=g(f,s,u,l,c,e[5],2053994217,6),s,u=d(u,10),l,e[12],2053994217,9),f,s=d(s,10),u,e[2],2053994217,12),f=g(f=d(f,10),s=g(s,u=g(u,l,c,f,s,e[13],2053994217,9),l,c=d(c,10),f,e[9],2053994217,12),u,l=d(l,10),c,e[7],2053994217,5),u=p(u=d(u,10),l=g(l,c=g(c,f,s,u,l,e[10],2053994217,15),f,s=d(s,10),u,e[14],2053994217,8),c,f=d(f,10),s,e[12],0,8),c=p(c=d(c,10),f=p(f,s=p(s,u,l,c,f,e[15],0,5),u,l=d(l,10),c,e[10],0,12),s,u=d(u,10),l,e[4],0,9),s=p(s=d(s,10),u=p(u,l=p(l,c,f,s,u,e[1],0,12),c,f=d(f,10),s,e[5],0,5),l,c=d(c,10),f,e[8],0,14),l=p(l=d(l,10),c=p(c,f=p(f,s,u,l,c,e[7],0,6),s,u=d(u,10),l,e[6],0,8),f,s=d(s,10),u,e[2],0,13),f=p(f=d(f,10),s=p(s,u=p(u,l,c,f,s,e[13],0,6),l,c=d(c,10),f,e[14],0,5),u,l=d(l,10),c,e[0],0,15),u=p(u=d(u,10),l=p(l,c=p(c,f,s,u,l,e[3],0,13),f,s=d(s,10),u,e[9],0,11),c,f=d(f,10),s,e[11],0,11),c=d(c,10);var h=this._b+i+c|0;this._b=this._c+o+f|0,this._c=this._d+a+s|0,this._d=this._e+r+u|0,this._e=this._a+n+l|0,this._a=h},n.prototype._digest=function(){this._block[this._blockOffset++]=128,56=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=4294967295&r,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},n.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=n},{"safe-buffer":143}],145:[function(e,t,r){(r=t.exports=function(e){e=e.toLowerCase();var t=r[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t}).sha=e("./sha"),r.sha1=e("./sha1"),r.sha224=e("./sha224"),r.sha256=e("./sha256"),r.sha384=e("./sha384"),r.sha512=e("./sha512")},{"./sha":146,"./sha1":147,"./sha224":148,"./sha256":149,"./sha384":150,"./sha512":151}],146:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,v=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function s(){this.init(),this._w=a,i.call(this,64,56)}n(s,i),s.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},s.prototype._update=function(e){for(var t,r,n,i,o,a,s=this._w,u=0|this._a,l=0|this._b,c=0|this._c,f=0|this._d,h=0|this._e,d=0;d<16;++d)s[d]=e.readInt32BE(4*d);for(;d<80;++d)s[d]=s[d-3]^s[d-8]^s[d-14]^s[d-16];for(var p=0;p<80;++p){var g=~~(p/20),m=0|((a=u)<<5|a>>>27)+(n=l,i=c,o=f,0===(r=g)?n&i|~n&o:2===r?n&i|n&o|i&o:n^i^o)+h+s[p]+v[g];h=f,f=c,c=(t=l)<<30|t>>>2,l=u,u=m}this._a=u+this._a|0,this._b=l+this._b|0,this._c=c+this._c|0,this._d=f+this._d|0,this._e=h+this._e|0},s.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=s},{"./hash":144,inherits:103,"safe-buffer":143}],147:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,_=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function s(){this.init(),this._w=a,i.call(this,64,56)}n(s,i),s.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},s.prototype._update=function(e){for(var t,r,n,i,o,a,s,u=this._w,l=0|this._a,c=0|this._b,f=0|this._c,h=0|this._d,d=0|this._e,p=0;p<16;++p)u[p]=e.readInt32BE(4*p);for(;p<80;++p)u[p]=(t=u[p-3]^u[p-8]^u[p-14]^u[p-16])<<1|t>>>31;for(var g=0;g<80;++g){var m=~~(g/20),v=0|((s=l)<<5|s>>>27)+(i=c,o=f,a=h,0===(n=m)?i&o|~i&a:2===n?i&o|i&a|o&a:i^o^a)+d+u[g]+_[m];d=h,h=f,f=(r=c)<<30|r>>>2,c=l,l=v}this._a=l+this._a|0,this._b=c+this._b|0,this._c=f+this._c|0,this._d=h+this._d|0,this._e=d+this._e|0},s.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=s},{"./hash":144,inherits:103,"safe-buffer":143}],148:[function(e,t,r){var n=e("inherits"),i=e("./sha256"),o=e("./hash"),a=e("safe-buffer").Buffer,s=new Array(64);function u(){this.init(),this._w=s,o.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var e=a.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},t.exports=u},{"./hash":144,"./sha256":149,inherits:103,"safe-buffer":143}],149:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,x=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a=new Array(64);function s(){this.init(),this._w=a,i.call(this,64,56)}n(s,i),s.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},s.prototype._update=function(e){for(var t,r,n,i,o,a,s,u=this._w,l=0|this._a,c=0|this._b,f=0|this._c,h=0|this._d,d=0|this._e,p=0|this._f,g=0|this._g,m=0|this._h,v=0;v<16;++v)u[v]=e.readInt32BE(4*v);for(;v<64;++v)u[v]=0|(((r=u[v-2])>>>17|r<<15)^(r>>>19|r<<13)^r>>>10)+u[v-7]+(((t=u[v-15])>>>7|t<<25)^(t>>>18|t<<14)^t>>>3)+u[v-16];for(var _=0;_<64;++_){var y=m+(((s=d)>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7))+((a=g)^d&(p^a))+x[_]+u[_]|0,b=0|(((o=l)>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+((n=l)&(i=c)|f&(n|i));m=g,g=p,p=d,d=h+y|0,h=f,f=c,c=l,l=y+b|0}this._a=l+this._a|0,this._b=c+this._b|0,this._c=f+this._c|0,this._d=h+this._d|0,this._e=d+this._e|0,this._f=p+this._f|0,this._g=g+this._g|0,this._h=m+this._h|0},s.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},t.exports=s},{"./hash":144,inherits:103,"safe-buffer":143}],150:[function(e,t,r){var n=e("inherits"),i=e("./sha512"),o=e("./hash"),a=e("safe-buffer").Buffer,s=new Array(160);function u(){this.init(),this._w=s,o.call(this,128,112)}n(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var n=a.allocUnsafe(48);function e(e,t,r){n.writeInt32BE(e,r),n.writeInt32BE(t,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),n},t.exports=u},{"./hash":144,"./sha512":151,inherits:103,"safe-buffer":143}],151:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,ee=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function s(){this.init(),this._w=a,i.call(this,128,112)}function te(e,t,r){return r^e&(t^r)}function re(e,t,r){return e&t|r&(e|t)}function ne(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function ie(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function oe(e,t){return e>>>0>>0?1:0}n(s,i),s.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},s.prototype._update=function(e){for(var t,r,n,i,o,a,s,u,l=this._w,c=0|this._ah,f=0|this._bh,h=0|this._ch,d=0|this._dh,p=0|this._eh,g=0|this._fh,m=0|this._gh,v=0|this._hh,_=0|this._al,y=0|this._bl,b=0|this._cl,x=0|this._dl,w=0|this._el,T=0|this._fl,S=0|this._gl,M=0|this._hl,P=0;P<32;P+=2)l[P]=e.readInt32BE(4*P),l[P+1]=e.readInt32BE(4*P+4);for(;P<160;P+=2){var C=l[P-30],k=l[P-30+1],E=((s=C)>>>1|(u=k)<<31)^(s>>>8|u<<24)^s>>>7,A=((o=k)>>>1|(a=C)<<31)^(o>>>8|a<<24)^(o>>>7|a<<25);C=l[P-4],k=l[P-4+1];var O=((n=C)>>>19|(i=k)<<13)^(i>>>29|n<<3)^n>>>6,R=((t=k)>>>19|(r=C)<<13)^(r>>>29|t<<3)^(t>>>6|r<<26),I=l[P-14],D=l[P-14+1],L=l[P-32],N=l[P-32+1],j=A+D|0,F=E+I+oe(j,A)|0;F=(F=F+O+oe(j=j+R|0,R)|0)+L+oe(j=j+N|0,N)|0,l[P]=F,l[P+1]=j}for(var B=0;B<160;B+=2){F=l[B],j=l[B+1];var z=re(c,f,h),U=re(_,y,b),X=ne(c,_),q=ne(_,c),H=ie(p,w),Y=ie(w,p),G=ee[B],W=ee[B+1],V=te(p,g,m),K=te(w,T,S),Z=M+Y|0,J=v+H+oe(Z,M)|0;J=(J=(J=J+V+oe(Z=Z+K|0,K)|0)+G+oe(Z=Z+W|0,W)|0)+F+oe(Z=Z+j|0,j)|0;var $=q+U|0,Q=X+z+oe($,q)|0;v=m,M=S,m=g,S=T,g=p,T=w,p=d+J+oe(w=x+Z|0,x)|0,d=h,x=b,h=f,b=y,f=c,y=_,c=J+Q+oe(_=Z+$|0,Z)|0}this._al=this._al+_|0,this._bl=this._bl+y|0,this._cl=this._cl+b|0,this._dl=this._dl+x|0,this._el=this._el+w|0,this._fl=this._fl+T|0,this._gl=this._gl+S|0,this._hl=this._hl+M|0,this._ah=this._ah+c+oe(this._al,_)|0,this._bh=this._bh+f+oe(this._bl,y)|0,this._ch=this._ch+h+oe(this._cl,b)|0,this._dh=this._dh+d+oe(this._dl,x)|0,this._eh=this._eh+p+oe(this._el,w)|0,this._fh=this._fh+g+oe(this._fl,T)|0,this._gh=this._gh+m+oe(this._gl,S)|0,this._hh=this._hh+v+oe(this._hl,M)|0},s.prototype._hash=function(){var n=o.allocUnsafe(64);function e(e,t,r){n.writeInt32BE(e,r),n.writeInt32BE(t,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),n},t.exports=s},{"./hash":144,inherits:103,"safe-buffer":143}],152:[function(e,t,r){t.exports=n;var c=e("events").EventEmitter;function n(){c.call(this)}e("inherits")(n,c),n.Readable=e("readable-stream/readable.js"),n.Writable=e("readable-stream/writable.js"),n.Duplex=e("readable-stream/duplex.js"),n.Transform=e("readable-stream/transform.js"),n.PassThrough=e("readable-stream/passthrough.js"),(n.Stream=n).prototype.pipe=function(t,e){var r=this;function n(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function i(){r.readable&&r.resume&&r.resume()}r.on("data",n),t.on("drain",i),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",s));var o=!1;function a(){o||(o=!0,t.end())}function s(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function u(e){if(l(),0===c.listenerCount(this,"error"))throw e}function l(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",a),r.removeListener("close",s),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",l),r.removeListener("close",l),t.removeListener("close",l)}return r.on("error",u),t.on("error",u),r.on("end",l),r.on("close",l),t.on("close",l),t.emit("pipe",r),t}},{events:85,inherits:103,"readable-stream/duplex.js":132,"readable-stream/passthrough.js":138,"readable-stream/readable.js":139,"readable-stream/transform.js":140,"readable-stream/writable.js":141}],153:[function(e,t,r){var n=e("buffer").Buffer,i=n.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};var o=r.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!i(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=s;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=u;break;default:return void(this.write=a)}this.charBuffer=new n(6),this.charReceived=0,this.charLength=0};function a(e){return e.toString(this.encoding)}function s(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function u(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}o.prototype.write=function(e){for(var t="";this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived>5==6){this.charLength=2;break}if(t<=2&&r>>4==14){this.charLength=3;break}if(t<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=t},o.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;t+=n.slice(0,r).toString(i)}return t}},{buffer:49}],154:[function(e,t,r){(function(r){function n(e){try{if(!r.localStorage)return!1}catch(e){return!1}var t=r.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}t.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],155:[function(require,module,exports){var indexOf=require("indexof"),Object_keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var r in e)t.push(r);return t},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r>2)*(r+3>>2)*8;case p:case g:case c:case m:return(t+3>>2)*(r+3>>2)*16;case ie:case ae:return Math.floor((Math.max(t,8)*Math.max(r,8)*4+7)/8);case oe:case se:return Math.floor((Math.max(t,16)*Math.max(r,8)*2+7)/8);case v:case i:return Math.floor((t+3)/4)*Math.floor((r+3)/4)*16;case _:case o:return Math.floor((t+4)/5)*Math.floor((r+3)/4)*16;case y:case a:return Math.floor((t+4)/5)*Math.floor((r+4)/5)*16;case b:case s:return Math.floor((t+5)/6)*Math.floor((r+4)/5)*16;case x:case u:return Math.floor((t+5)/6)*Math.floor((r+5)/6)*16;case w:case O:return Math.floor((t+7)/8)*Math.floor((r+4)/5)*16;case T:case R:return Math.floor((t+7)/8)*Math.floor((r+5)/6)*16;case S:case I:return Math.floor((t+7)/8)*Math.floor((r+7)/8)*16;case M:case D:return Math.floor((t+9)/10)*Math.floor((r+4)/5)*16;case P:case L:return Math.floor((t+9)/10)*Math.floor((r+5)/6)*16;case C:case N:return Math.floor((t+9)/10)*Math.floor((r+7)/8)*16;case k:case j:return Math.floor((t+9)/10)*Math.floor((r+9)/10)*16;case E:case F:return Math.floor((t+11)/12)*Math.floor((r+9)/10)*16;case A:case B:return Math.floor((t+11)/12)*Math.floor((r+11)/12)*16;default:return 0}}(t.exports=f).prototype.init=function(e,t,r,n,i,o,a,s){this.src=e,this.width=n,this.height=i,this.data=t,this.type=r,this.levels=o,this.internalFormat=a,this.isCompressedImage=!0,this.crunch=s,this.preserveSource=!0;var u=this.complete;return this.complete=!!t,!u&&this.complete&&this.onload&&this.onload({target:this}),this},f.prototype.dispose=function(){this.data=null},f.prototype.generateWebGLTexture=function(e){if(null===this.data)throw"Trying to create a second (or more) webgl texture from the same CompressedImage : "+this.src;for(var t=this.width,r=this.height,n=this.levels,i=0,o=0;o>=1)<1&&(t=1),(r>>=1)<1&&(r=1),i+=a}1>8&255,e>>16&255,e>>24&255)}(n)}var i=1;t[G]&U&&(i=Math.max(1,t[K]));var o=t[V],a=t[W],s=t[Y]+4,u=new Uint8Array(e,s);return this.init(this.src,u,"DDS",o,a,i,r)},f.prototype._loadASTC=function(e){var t=new Int8Array(e,0,Me);if(new Uint32Array(e.slice(0,4))!=Pe)throw"Invalid magic number in ASTC header";for(var r=[v,_,y,b,x,w,T,S,M,P,C,k,E,A],n=e.byteLength-Me,i=new Uint8Array([t[7],t[8],t[9],0]),o=new Uint8Array([t[10],t[11],t[12],0]),a=new Uint32Array(i.buffer)[0],s=new Uint32Array(o.buffer)[0],u=0,l=0;l 0.0) {\n c.rgb /= c.a;\n\n vec3 rgb = pow(c.rgb, vec3(1. / gamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);\n rgb.r *= red;\n rgb.g *= green;\n rgb.b *= blue;\n c.rgb = rgb * brightness;\n\n c.rgb *= c.a;\n }\n\n gl_FragColor = c * alpha;\n}\n"),Object.assign(this,{gamma:1,saturation:1,contrast:1,brightness:1,red:1,green:1,blue:1,alpha:1},e)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,n){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,e.applyFilter(this,t,r,n)},e}(h.Filter),d=function(n){function e(e,t,r){void 0===e&&(e=4),void 0===t&&(t=3),void 0===r&&(r=!1),n.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",r?"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\nuniform vec4 filterClamp;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample top right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}\n":"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample top right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}"),this.uniforms.uOffset=new Float32Array(2),this._pixelSize=new h.Point,this.pixelSize=1,this._clamp=r,this._kernels=null,Array.isArray(e)?this.kernels=e:(this._blur=e,this.quality=t)}n&&(e.__proto__=n);var t={kernels:{configurable:!0},clamp:{configurable:!0},pixelSize:{configurable:!0},quality:{configurable:!0},blur:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.apply=function(e,t,r,n){var i,o=this.pixelSize.x/t.size.width,a=this.pixelSize.y/t.size.height;if(1===this._quality||0===this._blur)i=this._kernels[0]+.5,this.uniforms.uOffset[0]=i*o,this.uniforms.uOffset[1]=i*a,e.applyFilter(this,t,r,n);else{for(var s,u=e.getRenderTarget(!0),l=t,c=u,f=this._quality-1,h=0;h threshold) {\n gl_FragColor = color;\n } else {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n"),this.threshold=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={threshold:{configurable:!0}};return r.threshold.get=function(){return this.uniforms.threshold},r.threshold.set=function(e){this.uniforms.threshold=e},Object.defineProperties(e.prototype,r),e}(h.Filter),n=function(a){function e(e){a.call(this,s,"uniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D bloomTexture;\nuniform float bloomScale;\nuniform float brightness;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n color.rgb *= brightness;\n vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0);\n bloomColor.rgb *= bloomScale;\n gl_FragColor = color + bloomColor;\n}\n"),"number"==typeof e&&(e={threshold:e}),e=Object.assign({threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:h.settings.RESOLUTION},e),this.bloomScale=e.bloomScale,this.brightness=e.brightness;var t=e.kernels,r=e.blur,n=e.quality,i=e.pixelSize,o=e.resolution;this._extractFilter=new u(e.threshold),this._extractFilter.resolution=o,this._blurFilter=t?new d(t):new d(r,n),this.pixelSize=i,this.resolution=o}a&&(e.__proto__=a);var t={resolution:{configurable:!0},threshold:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return((e.prototype=Object.create(a&&a.prototype)).constructor=e).prototype.apply=function(e,t,r,n,i){var o=e.getRenderTarget(!0);this._extractFilter.apply(e,t,o,!0,i);var a=e.getRenderTarget(!0);this._blurFilter.apply(e,o,a,!0,i),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=a,e.applyFilter(this,t,r,n),e.returnRenderTarget(a),e.returnRenderTarget(o)},t.resolution.get=function(){return this._resolution},t.resolution.set=function(e){this._resolution=e,this._extractFilter&&(this._extractFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},t.threshold.get=function(){return this._extractFilter.threshold},t.threshold.set=function(e){this._extractFilter.threshold=e},t.kernels.get=function(){return this._blurFilter.kernels},t.kernels.set=function(e){this._blurFilter.kernels=e},t.blur.get=function(){return this._blurFilter.blur},t.blur.set=function(e){this._blurFilter.blur=e},t.quality.get=function(){return this._blurFilter.quality},t.quality.set=function(e){this._blurFilter.quality=e},t.pixelSize.get=function(){return this._blurFilter.pixelSize},t.pixelSize.set=function(e){this._blurFilter.pixelSize=e},Object.defineProperties(e.prototype,t),e}(h.Filter),i=function(t){function e(e){void 0===e&&(e=8),t.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform float pixelSize;\nuniform sampler2D uSampler;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n return floor( coord / size ) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n return mod( coord , size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, -4.0) + 2.5);\n if (clamp(p.x, 0.0, 4.0) == p.x && clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n // get the rounded color..\n vec2 pixCoord = pixelate(coord, vec2(pixelSize));\n pixCoord = unmapCoord(pixCoord);\n\n vec4 color = texture2D(uSampler, pixCoord);\n\n // determine the character to use\n float gray = (color.r + color.g + color.b) / 3.0;\n\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n // get the mod..\n vec2 modd = getMod(coord, vec2(pixelSize));\n\n gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0);\n\n}"),this.size=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={size:{configurable:!0}};return r.size.get=function(){return this.uniforms.pixelSize},r.size.set=function(e){this.uniforms.pixelSize=e},Object.defineProperties(e.prototype,r),e}(h.Filter),o=function(t){function e(e){void 0===e&&(e={}),t.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","precision mediump float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float transformX;\nuniform float transformY;\nuniform vec3 lightColor;\nuniform float lightAlpha;\nuniform vec3 shadowColor;\nuniform float shadowAlpha;\n\nvoid main(void) {\n vec2 transform = vec2(1.0 / filterArea) * vec2(transformX, transformY);\n vec4 color = texture2D(uSampler, vTextureCoord);\n float light = texture2D(uSampler, vTextureCoord - transform).a;\n float shadow = texture2D(uSampler, vTextureCoord + transform).a;\n\n color.rgb = mix(color.rgb, lightColor, clamp((color.a - light) * lightAlpha, 0.0, 1.0));\n color.rgb = mix(color.rgb, shadowColor, clamp((color.a - shadow) * shadowAlpha, 0.0, 1.0));\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n"),this.uniforms.lightColor=new Float32Array(3),this.uniforms.shadowColor=new Float32Array(3),e=Object.assign({rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},e),this.rotation=e.rotation,this.thickness=e.thickness,this.lightColor=e.lightColor,this.lightAlpha=e.lightAlpha,this.shadowColor=e.shadowColor,this.shadowAlpha=e.shadowAlpha}t&&(e.__proto__=t);var r={rotation:{configurable:!0},thickness:{configurable:!0},lightColor:{configurable:!0},lightAlpha:{configurable:!0},shadowColor:{configurable:!0},shadowAlpha:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype._updateTransform=function(){this.uniforms.transformX=this._thickness*Math.cos(this._angle),this.uniforms.transformY=this._thickness*Math.sin(this._angle)},r.rotation.get=function(){return this._angle/h.DEG_TO_RAD},r.rotation.set=function(e){this._angle=e*h.DEG_TO_RAD,this._updateTransform()},r.thickness.get=function(){return this._thickness},r.thickness.set=function(e){this._thickness=e,this._updateTransform()},r.lightColor.get=function(){return h.utils.rgb2hex(this.uniforms.lightColor)},r.lightColor.set=function(e){h.utils.hex2rgb(e,this.uniforms.lightColor)},r.lightAlpha.get=function(){return this.uniforms.lightAlpha},r.lightAlpha.set=function(e){this.uniforms.lightAlpha=e},r.shadowColor.get=function(){return h.utils.rgb2hex(this.uniforms.shadowColor)},r.shadowColor.set=function(e){h.utils.hex2rgb(e,this.uniforms.shadowColor)},r.shadowAlpha.get=function(){return this.uniforms.shadowAlpha},r.shadowAlpha.set=function(e){this.uniforms.shadowAlpha=e},Object.defineProperties(e.prototype,r),e}(h.Filter),a=h.filters,l=a.BlurXFilter,c=a.BlurYFilter,f=a.AlphaFilter,p=function(a){function e(e,t,r,n){var i,o;void 0===e&&(e=2),void 0===t&&(t=4),void 0===r&&(r=h.settings.RESOLUTION),void 0===n&&(n=5),a.call(this),"number"==typeof e?o=i=e:e instanceof h.Point?(i=e.x,o=e.y):Array.isArray(e)&&(i=e[0],o=e[1]),this.blurXFilter=new l(i,t,r,n),this.blurYFilter=new c(o,t,r,n),this.blurYFilter.blendMode=h.BLEND_MODES.SCREEN,this.defaultFilter=new f}a&&(e.__proto__=a);var t={blur:{configurable:!0},blurX:{configurable:!0},blurY:{configurable:!0}};return((e.prototype=Object.create(a&&a.prototype)).constructor=e).prototype.apply=function(e,t,r){var n=e.getRenderTarget(!0);this.defaultFilter.apply(e,t,r),this.blurXFilter.apply(e,t,n),this.blurYFilter.apply(e,n,r),e.returnRenderTarget(n)},t.blur.get=function(){return this.blurXFilter.blur},t.blur.set=function(e){this.blurXFilter.blur=this.blurYFilter.blur=e},t.blurX.get=function(){return this.blurXFilter.blur},t.blurX.set=function(e){this.blurXFilter.blur=e},t.blurY.get=function(){return this.blurYFilter.blur},t.blurY.set=function(e){this.blurYFilter.blur=e},Object.defineProperties(e.prototype,t),e}(h.Filter),g=function(n){function e(e,t,r){n.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","uniform float radius;\nuniform float strength;\nuniform vec2 center;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nvoid main()\n{\n vec2 coord = vTextureCoord * filterArea.xy;\n coord -= center * dimensions.xy;\n float distance = length(coord);\n if (distance < radius) {\n float percent = distance / radius;\n if (strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n }\n }\n coord += center * dimensions.xy;\n coord /= filterArea.xy;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n vec4 color = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n gl_FragColor = color;\n}\n"),this.uniforms.dimensions=new Float32Array(2),this.center=e||[.5,.5],this.radius="number"==typeof t?t:100,this.strength="number"==typeof r?r:1}n&&(e.__proto__=n);var t={radius:{configurable:!0},strength:{configurable:!0},center:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.apply=function(e,t,r,n){this.uniforms.dimensions[0]=t.sourceFrame.width,this.uniforms.dimensions[1]=t.sourceFrame.height,e.applyFilter(this,t,r,n)},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(e){this.uniforms.radius=e},t.strength.get=function(){return this.uniforms.strength},t.strength.set=function(e){this.uniforms.strength=e},t.center.get=function(){return this.uniforms.center},t.center.set=function(e){this.uniforms.center=e},Object.defineProperties(e.prototype,t),e}(h.Filter),m=function(n){function e(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=1),n.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D colorMap;\nuniform float _mix;\nuniform float _size;\nuniform float _sliceSize;\nuniform float _slicePixelSize;\nuniform float _sliceInnerSize;\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord.xy);\n\n vec4 adjusted;\n if (color.a > 0.0) {\n color.rgb /= color.a;\n float innerWidth = _size - 1.0;\n float zSlice0 = min(floor(color.b * innerWidth), innerWidth);\n float zSlice1 = min(zSlice0 + 1.0, innerWidth);\n float xOffset = _slicePixelSize * 0.5 + color.r * _sliceInnerSize;\n float s0 = xOffset + (zSlice0 * _sliceSize);\n float s1 = xOffset + (zSlice1 * _sliceSize);\n float yOffset = _sliceSize * 0.5 + color.g * (1.0 - _sliceSize);\n vec4 slice0Color = texture2D(colorMap, vec2(s0,yOffset));\n vec4 slice1Color = texture2D(colorMap, vec2(s1,yOffset));\n float zOffset = fract(color.b * innerWidth);\n adjusted = mix(slice0Color, slice1Color, zOffset);\n\n color.rgb *= color.a;\n }\n gl_FragColor = vec4(mix(color, adjusted, _mix).rgb, color.a);\n\n}"),this._size=0,this._sliceSize=0,this._slicePixelSize=0,this._sliceInnerSize=0,this._scaleMode=null,this._nearest=!1,this.nearest=t,this.mix=r,this.colorMap=e}n&&(e.__proto__=n);var t={colorSize:{configurable:!0},colorMap:{configurable:!0},nearest:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.apply=function(e,t,r,n){this.uniforms._mix=this.mix,e.applyFilter(this,t,r,n)},t.colorSize.get=function(){return this._size},t.colorMap.get=function(){return this._colorMap},t.colorMap.set=function(e){e instanceof h.Texture||(e=h.Texture.from(e)),e&&e.baseTexture&&(e.baseTexture.scaleMode=this._scaleMode,e.baseTexture.mipmap=!1,this._size=e.height,this._sliceSize=1/this._size,this._slicePixelSize=this._sliceSize/this._size,this._sliceInnerSize=this._slicePixelSize*(this._size-1),this.uniforms._size=this._size,this.uniforms._sliceSize=this._sliceSize,this.uniforms._slicePixelSize=this._slicePixelSize,this.uniforms._sliceInnerSize=this._sliceInnerSize,this.uniforms.colorMap=e),this._colorMap=e},t.nearest.get=function(){return this._nearest},t.nearest.set=function(e){this._nearest=e,this._scaleMode=e?h.SCALE_MODES.NEAREST:h.SCALE_MODES.LINEAR;var t=this._colorMap;t&&t.baseTexture&&(t.baseTexture._glTextures={},t.baseTexture.scaleMode=this._scaleMode,t.baseTexture.mipmap=!1,t._updateID++,t.baseTexture.emit("update",t.baseTexture))},e.prototype.updateColorMap=function(){var e=this._colorMap;e&&e.baseTexture&&(e._updateID++,e.baseTexture.emit("update",e.baseTexture),this.colorMap=e)},e.prototype.destroy=function(e){this._colorMap&&this._colorMap.destroy(e),n.prototype.destroy.call(this)},Object.defineProperties(e.prototype,t),e}(h.Filter),v=function(n){function e(e,t,r){void 0===e&&(e=16711680),void 0===t&&(t=0),void 0===r&&(r=.4),n.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec3 originalColor;\nuniform vec3 newColor;\nuniform float epsilon;\nvoid main(void) {\n vec4 currentColor = texture2D(uSampler, vTextureCoord);\n vec3 colorDiff = originalColor - (currentColor.rgb / max(currentColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n float doReplace = step(colorDistance, epsilon);\n gl_FragColor = vec4(mix(currentColor.rgb, (newColor + colorDiff) * currentColor.a, doReplace), currentColor.a);\n}\n"),this.uniforms.originalColor=new Float32Array(3),this.uniforms.newColor=new Float32Array(3),this.originalColor=e,this.newColor=t,this.epsilon=r}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={originalColor:{configurable:!0},newColor:{configurable:!0},epsilon:{configurable:!0}};return t.originalColor.set=function(e){var t=this.uniforms.originalColor;"number"==typeof e?(h.utils.hex2rgb(e,t),this._originalColor=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],this._originalColor=h.utils.rgb2hex(t))},t.originalColor.get=function(){return this._originalColor},t.newColor.set=function(e){var t=this.uniforms.newColor;"number"==typeof e?(h.utils.hex2rgb(e,t),this._newColor=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],this._newColor=h.utils.rgb2hex(t))},t.newColor.get=function(){return this._newColor},t.epsilon.set=function(e){this.uniforms.epsilon=e},t.epsilon.get=function(){return this.uniforms.epsilon},Object.defineProperties(e.prototype,t),e}(h.Filter),_=function(n){function e(e,t,r){void 0===t&&(t=200),void 0===r&&(r=200),n.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","precision mediump float;\n\nvarying mediump vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 texelSize;\nuniform float matrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\n\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\n\n gl_FragColor =\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\n\n gl_FragColor.a = c22.a;\n}\n"),this.uniforms.texelSize=new Float32Array(2),this.uniforms.matrix=new Float32Array(9),void 0!==e&&(this.matrix=e),this.width=t,this.height=r}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={matrix:{configurable:!0},width:{configurable:!0},height:{configurable:!0}};return t.matrix.get=function(){return this.uniforms.matrix},t.matrix.set=function(e){var r=this;e.forEach(function(e,t){return r.uniforms.matrix[t]=e})},t.width.get=function(){return 1/this.uniforms.texelSize[0]},t.width.set=function(e){this.uniforms.texelSize[0]=1/e},t.height.get=function(){return 1/this.uniforms.texelSize[1]},t.height.set=function(e){this.uniforms.texelSize[1]=1/e},Object.defineProperties(e.prototype,t),e}(h.Filter),y=function(e){function t(){e.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);\n\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n\n if (lum < 1.00)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.75)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.50)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.3)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n}\n")}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t}(h.Filter),b=function(t){function e(e){t.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nconst float SQRT_2 = 1.414213;\n\nconst float light = 1.0;\n\nuniform float curvature;\nuniform float lineWidth;\nuniform float lineContrast;\nuniform bool verticalLine;\nuniform float noise;\nuniform float noiseSize;\n\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\n\nuniform float seed;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 coord = pixelCoord / dimensions;\n\n vec2 dir = vec2(coord - vec2(0.5, 0.5));\n\n float _c = curvature > 0. ? curvature : 1.;\n float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\n vec2 uv = dir * k;\n\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 rgb = gl_FragColor.rgb;\n\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n rgb += _noise * noise;\n }\n\n if (lineWidth > 0.0) {\n float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c;\n float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast;\n rgb *= j;\n float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.);\n rgb *= 0.99 + ceil(segment) * 0.015;\n }\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n gl_FragColor.rgb = rgb;\n}\n"),this.uniforms.dimensions=new Float32Array(2),this.time=0,this.seed=0,Object.assign(this,{curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},e)}t&&(e.__proto__=t);var r={curvature:{configurable:!0},lineWidth:{configurable:!0},lineContrast:{configurable:!0},verticalLine:{configurable:!0},noise:{configurable:!0},noiseSize:{configurable:!0},vignetting:{configurable:!0},vignettingAlpha:{configurable:!0},vignettingBlur:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,n){this.uniforms.dimensions[0]=t.sourceFrame.width,this.uniforms.dimensions[1]=t.sourceFrame.height,this.uniforms.seed=this.seed,this.uniforms.time=this.time,e.applyFilter(this,t,r,n)},r.curvature.set=function(e){this.uniforms.curvature=e},r.curvature.get=function(){return this.uniforms.curvature},r.lineWidth.set=function(e){this.uniforms.lineWidth=e},r.lineWidth.get=function(){return this.uniforms.lineWidth},r.lineContrast.set=function(e){this.uniforms.lineContrast=e},r.lineContrast.get=function(){return this.uniforms.lineContrast},r.verticalLine.set=function(e){this.uniforms.verticalLine=e},r.verticalLine.get=function(){return this.uniforms.verticalLine},r.noise.set=function(e){this.uniforms.noise=e},r.noise.get=function(){return this.uniforms.noise},r.noiseSize.set=function(e){this.uniforms.noiseSize=e},r.noiseSize.get=function(){return this.uniforms.noiseSize},r.vignetting.set=function(e){this.uniforms.vignetting=e},r.vignetting.get=function(){return this.uniforms.vignetting},r.vignettingAlpha.set=function(e){this.uniforms.vignettingAlpha=e},r.vignettingAlpha.get=function(){return this.uniforms.vignettingAlpha},r.vignettingBlur.set=function(e){this.uniforms.vignettingBlur=e},r.vignettingBlur.get=function(){return this.uniforms.vignettingBlur},Object.defineProperties(e.prototype,r),e}(h.Filter),x=function(r){function e(e,t){void 0===e&&(e=1),void 0===t&&(t=5),r.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 filterArea;\nuniform sampler2D uSampler;\n\nuniform float angle;\nuniform float scale;\n\nfloat pattern()\n{\n float s = sin(angle), c = cos(angle);\n vec2 tex = vTextureCoord * filterArea.xy;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float average = (color.r + color.g + color.b) / 3.0;\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n}\n"),this.scale=e,this.angle=t}r&&(e.__proto__=r),(e.prototype=Object.create(r&&r.prototype)).constructor=e;var t={scale:{configurable:!0},angle:{configurable:!0}};return t.scale.get=function(){return this.uniforms.scale},t.scale.set=function(e){this.uniforms.scale=e},t.angle.get=function(){return this.uniforms.angle},t.angle.set=function(e){this.uniforms.angle=e},Object.defineProperties(e.prototype,t),e}(h.Filter),w=function(f){function e(e){e&&e.constructor!==Object&&(console.warn("DropShadowFilter now uses options instead of (rotation, distance, blur, color, alpha)"),e={rotation:e},void 0!==arguments[1]&&(e.distance=arguments[1]),void 0!==arguments[2]&&(e.blur=arguments[2]),void 0!==arguments[3]&&(e.color=arguments[3]),void 0!==arguments[4]&&(e.alpha=arguments[4])),e=Object.assign({rotation:45,distance:5,color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:h.settings.RESOLUTION},e),f.call(this);var t=e.kernels,r=e.blur,n=e.quality,i=e.pixelSize,o=e.resolution;this._tintFilter=new h.Filter("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float alpha;\nuniform vec3 color;\nvoid main(void){\n vec4 sample = texture2D(uSampler, vTextureCoord);\n\n // Un-premultiply alpha before applying the color\n if (sample.a > 0.0) {\n sample.rgb /= sample.a;\n }\n\n // Premultiply alpha again\n sample.rgb = color.rgb * sample.a;\n\n // alpha user alpha\n sample *= alpha;\n\n gl_FragColor = sample;\n}"),this._tintFilter.uniforms.color=new Float32Array(4),this._tintFilter.resolution=o,this._blurFilter=t?new d(t):new d(r,n),this.pixelSize=i,this.resolution=o,this.targetTransform=new h.Matrix;var a=e.shadowOnly,s=e.rotation,u=e.distance,l=e.alpha,c=e.color;this.shadowOnly=a,this.rotation=s,this.distance=u,this.alpha=l,this.color=c,this._updatePadding()}f&&(e.__proto__=f);var t={resolution:{configurable:!0},distance:{configurable:!0},rotation:{configurable:!0},alpha:{configurable:!0},color:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return((e.prototype=Object.create(f&&f.prototype)).constructor=e).prototype.apply=function(e,t,r,n){var i=e.getRenderTarget();i.transform=this.targetTransform,this._tintFilter.apply(e,t,i,!0),i.transform=null,this._blurFilter.apply(e,i,r,n),!0!==this.shadowOnly&&e.applyFilter(this,t,r,!1),e.returnRenderTarget(i)},e.prototype._updatePadding=function(){this.padding=this.distance+2*this.blur},e.prototype._updateTargetTransform=function(){this.targetTransform.tx=this.distance*Math.cos(this.angle),this.targetTransform.ty=this.distance*Math.sin(this.angle)},t.resolution.get=function(){return this._resolution},t.resolution.set=function(e){this._resolution=e,this._tintFilter&&(this._tintFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},t.distance.get=function(){return this._distance},t.distance.set=function(e){this._distance=e,this._updatePadding(),this._updateTargetTransform()},t.rotation.get=function(){return this.angle/h.DEG_TO_RAD},t.rotation.set=function(e){this.angle=e*h.DEG_TO_RAD,this._updateTargetTransform()},t.alpha.get=function(){return this._tintFilter.uniforms.alpha},t.alpha.set=function(e){this._tintFilter.uniforms.alpha=e},t.color.get=function(){return h.utils.rgb2hex(this._tintFilter.uniforms.color)},t.color.set=function(e){h.utils.hex2rgb(e,this._tintFilter.uniforms.color)},t.kernels.get=function(){return this._blurFilter.kernels},t.kernels.set=function(e){this._blurFilter.kernels=e},t.blur.get=function(){return this._blurFilter.blur},t.blur.set=function(e){this._blurFilter.blur=e,this._updatePadding()},t.quality.get=function(){return this._blurFilter.quality},t.quality.set=function(e){this._blurFilter.quality=e},t.pixelSize.get=function(){return this._blurFilter.pixelSize},t.pixelSize.set=function(e){this._blurFilter.pixelSize=e},Object.defineProperties(e.prototype,t),e}(h.Filter),T=function(t){function e(e){void 0===e&&(e=5),t.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float strength;\nuniform vec4 filterArea;\n\n\nvoid main(void)\n{\n\tvec2 onePixel = vec2(1.0 / filterArea);\n\n\tvec4 color;\n\n\tcolor.rgb = vec3(0.5);\n\n\tcolor -= texture2D(uSampler, vTextureCoord - onePixel) * strength;\n\tcolor += texture2D(uSampler, vTextureCoord + onePixel) * strength;\n\n\tcolor.rgb = vec3((color.r + color.g + color.b) / 3.0);\n\n\tfloat alpha = texture2D(uSampler, vTextureCoord).a;\n\n\tgl_FragColor = vec4(color.rgb * alpha, alpha);\n}\n"),this.strength=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={strength:{configurable:!0}};return r.strength.get=function(){return this.uniforms.strength},r.strength.set=function(e){this.uniforms.strength=e},Object.defineProperties(e.prototype,r),e}(h.Filter),S=function(t){function e(e){void 0===e&&(e={}),t.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","// precision highp float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\nuniform float aspect;\n\nuniform sampler2D displacementMap;\nuniform float offset;\nuniform float sinDir;\nuniform float cosDir;\nuniform int fillMode;\n\nuniform float seed;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nconst int TRANSPARENT = 0;\nconst int ORIGINAL = 1;\nconst int LOOP = 2;\nconst int CLAMP = 3;\nconst int MIRROR = 4;\n\nvoid main(void)\n{\n vec2 coord = (vTextureCoord * filterArea.xy) / dimensions;\n\n if (coord.x > 1.0 || coord.y > 1.0) {\n return;\n }\n\n float cx = coord.x - 0.5;\n float cy = (coord.y - 0.5) * aspect;\n float ny = (-sinDir * cx + cosDir * cy) / aspect + 0.5;\n\n // displacementMap: repeat\n // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny);\n\n // displacementMap: mirror\n ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny);\n\n vec4 dc = texture2D(displacementMap, vec2(0.5, ny));\n\n float displacement = (dc.r - dc.g) * (offset / filterArea.x);\n\n coord = vTextureCoord + vec2(cosDir * displacement, sinDir * displacement * aspect);\n\n if (fillMode == CLAMP) {\n coord = clamp(coord, filterClamp.xy, filterClamp.zw);\n } else {\n if( coord.x > filterClamp.z ) {\n if (fillMode == ORIGINAL) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n } else if (fillMode == LOOP) {\n coord.x -= filterClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x = filterClamp.z * 2.0 - coord.x;\n } else {\n gl_FragColor = vec4(0., 0., 0., 0.);\n return;\n }\n } else if( coord.x < filterClamp.x ) {\n if (fillMode == ORIGINAL) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n } else if (fillMode == LOOP) {\n coord.x += filterClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x *= -filterClamp.z;\n } else {\n gl_FragColor = vec4(0., 0., 0., 0.);\n return;\n }\n }\n\n if( coord.y > filterClamp.w ) {\n if (fillMode == ORIGINAL) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n } else if (fillMode == LOOP) {\n coord.y -= filterClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y = filterClamp.w * 2.0 - coord.y;\n } else {\n gl_FragColor = vec4(0., 0., 0., 0.);\n return;\n }\n } else if( coord.y < filterClamp.y ) {\n if (fillMode == ORIGINAL) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n } else if (fillMode == LOOP) {\n coord.y += filterClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y *= -filterClamp.w;\n } else {\n gl_FragColor = vec4(0., 0., 0., 0.);\n return;\n }\n }\n }\n\n gl_FragColor.r = texture2D(uSampler, coord + red * (1.0 - seed * 0.4) / filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, coord + green * (1.0 - seed * 0.3) / filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, coord + blue * (1.0 - seed * 0.2) / filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, coord).a;\n}\n"),this.uniforms.dimensions=new Float32Array(2),e=Object.assign({slices:5,offset:100,direction:0,fillMode:0,average:!1,seed:0,red:[0,0],green:[0,0],blue:[0,0],minSize:8,sampleSize:512},e),this.direction=e.direction,this.red=e.red,this.green=e.green,this.blue=e.blue,this.offset=e.offset,this.fillMode=e.fillMode,this.average=e.average,this.seed=e.seed,this.minSize=e.minSize,this.sampleSize=e.sampleSize,this._canvas=document.createElement("canvas"),this._canvas.width=4,this._canvas.height=this.sampleSize,this.texture=h.Texture.fromCanvas(this._canvas,h.SCALE_MODES.NEAREST),this._slices=0,this.slices=e.slices}t&&(e.__proto__=t);var r={sizes:{configurable:!0},offsets:{configurable:!0},slices:{configurable:!0},direction:{configurable:!0},red:{configurable:!0},green:{configurable:!0},blue:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,n){var i=t.sourceFrame.width,o=t.sourceFrame.height;this.uniforms.dimensions[0]=i,this.uniforms.dimensions[1]=o,this.uniforms.aspect=o/i,this.uniforms.seed=this.seed,this.uniforms.offset=this.offset,this.uniforms.fillMode=this.fillMode,e.applyFilter(this,t,r,n)},e.prototype._randomizeSizes=function(){var e=this._sizes,t=this._slices-1,r=this.sampleSize,n=Math.min(this.minSize/r,.9/this._slices);if(this.average){for(var i=this._slices,o=1,a=0;a>0,n=e[t];e[t]=e[r],e[r]=n}},e.prototype._randomizeOffsets=function(){for(var e=0;e>0,t,1+a>>0),i+=a}r.baseTexture.update(),this.uniforms.displacementMap=r},r.sizes.set=function(e){for(var t=Math.min(this._slices,e.length),r=0;rthis._maxColors)throw"Length of replacements ("+n+") exceeds the maximum colors length ("+this._maxColors+")";t[3*n]=-1;for(var i=0;i 0.5) then: 1 - 2 * (1 - dst) * (1 - src)\n return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)),\n (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)),\n (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z)));\n}\n\n\nvoid main()\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 color = gl_FragColor.rgb;\n\n if (sepia > 0.0)\n {\n float gray = (color.x + color.y + color.z) / 3.0;\n vec3 grayscale = vec3(gray);\n\n color = Overlay(SEPIA_RGB, grayscale);\n\n color = grayscale + sepia * (color - grayscale);\n }\n\n vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy;\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n vec2 dir = vec2(vec2(0.5, 0.5) - coord);\n dir.y *= dimensions.y / dimensions.x;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n color.rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n if (scratchDensity > seed && scratch != 0.0)\n {\n float phase = seed * 256.0;\n float s = mod(floor(phase), 2.0);\n float dist = 1.0 / scratchDensity;\n float d = distance(coord, vec2(seed * dist, abs(s - seed * dist)));\n if (d < seed * 0.6 + 0.4)\n {\n highp float period = scratchDensity * 10.0;\n\n float xx = coord.x * period + phase;\n float aa = abs(mod(xx, 0.5) * 4.0);\n float bb = mod(floor(xx / 0.5), 2.0);\n float yy = (1.0 - bb) * aa + bb * (2.0 - aa);\n\n float kk = 2.0 * period;\n float dw = scratchWidth / dimensions.x * (0.75 + seed);\n float dh = dw * kk;\n\n float tine = (yy - (2.0 - dh));\n\n if (tine > 0.0) {\n float _sign = sign(scratch);\n\n tine = s * tine / period + scratch + 0.1;\n tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5);\n\n color.rgb *= tine;\n }\n }\n }\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + seed * 512.0, 1024.0 - seed * 512.0);\n // float _noise = snoise(d) * 0.5;\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n color += _noise * noise;\n }\n\n gl_FragColor.rgb = color;\n}\n"),this.uniforms.dimensions=new Float32Array(2),"number"==typeof e?(this.seed=e,e=null):this.seed=t,Object.assign(this,{sepia:.3,noise:.3,noiseSize:1,scratch:.5,scratchDensity:.3,scratchWidth:1,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3},e)}r&&(e.__proto__=r);var t={sepia:{configurable:!0},noise:{configurable:!0},noiseSize:{configurable:!0},scratch:{configurable:!0},scratchDensity:{configurable:!0},scratchWidth:{configurable:!0},vignetting:{configurable:!0},vignettingAlpha:{configurable:!0},vignettingBlur:{configurable:!0}};return((e.prototype=Object.create(r&&r.prototype)).constructor=e).prototype.apply=function(e,t,r,n){this.uniforms.dimensions[0]=t.sourceFrame.width,this.uniforms.dimensions[1]=t.sourceFrame.height,this.uniforms.seed=this.seed,e.applyFilter(this,t,r,n)},t.sepia.set=function(e){this.uniforms.sepia=e},t.sepia.get=function(){return this.uniforms.sepia},t.noise.set=function(e){this.uniforms.noise=e},t.noise.get=function(){return this.uniforms.noise},t.noiseSize.set=function(e){this.uniforms.noiseSize=e},t.noiseSize.get=function(){return this.uniforms.noiseSize},t.scratch.set=function(e){this.uniforms.scratch=e},t.scratch.get=function(){return this.uniforms.scratch},t.scratchDensity.set=function(e){this.uniforms.scratchDensity=e},t.scratchDensity.get=function(){return this.uniforms.scratchDensity},t.scratchWidth.set=function(e){this.uniforms.scratchWidth=e},t.scratchWidth.get=function(){return this.uniforms.scratchWidth},t.vignetting.set=function(e){this.uniforms.vignetting=e},t.vignetting.get=function(){return this.uniforms.vignetting},t.vignettingAlpha.set=function(e){this.uniforms.vignettingAlpha=e},t.vignettingAlpha.get=function(){return this.uniforms.vignettingAlpha},t.vignettingBlur.set=function(e){this.uniforms.vignettingBlur=e},t.vignettingBlur.get=function(){return this.uniforms.vignettingBlur},Object.defineProperties(e.prototype,t),e}(h.Filter),A=function(o){function a(e,t,r){void 0===e&&(e=1),void 0===t&&(t=0),void 0===r&&(r=.1);var n=Math.max(r*a.MAX_SAMPLES,a.MIN_SAMPLES),i=(2*Math.PI/n).toFixed(7);o.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 thickness;\nuniform vec4 outlineColor;\nuniform vec4 filterClamp;\n\nconst float DOUBLE_PI = 3.14159265358979323846264 * 2.;\n\nvoid main(void) {\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float maxAlpha = 0.;\n vec2 displaced;\n for (float angle = 0.; angle <= DOUBLE_PI; angle += ${angleStep}) {\n displaced.x = vTextureCoord.x + thickness.x * cos(angle);\n displaced.y = vTextureCoord.y + thickness.y * sin(angle);\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n maxAlpha = max(maxAlpha, curColor.a);\n }\n float resultAlpha = max(maxAlpha, ownColor.a);\n gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha);\n}\n".replace(/\$\{angleStep\}/,i)),this.uniforms.thickness=new Float32Array([0,0]),this.thickness=e,this.uniforms.outlineColor=new Float32Array([0,0,0,1]),this.color=t,this.quality=r}o&&(a.__proto__=o);var e={color:{configurable:!0}};return((a.prototype=Object.create(o&&o.prototype)).constructor=a).prototype.apply=function(e,t,r,n){this.uniforms.thickness[0]=this.thickness/t.size.width,this.uniforms.thickness[1]=this.thickness/t.size.height,e.applyFilter(this,t,r,n)},e.color.get=function(){return h.utils.rgb2hex(this.uniforms.outlineColor)},e.color.set=function(e){h.utils.hex2rgb(e,this.uniforms.outlineColor)},Object.defineProperties(a.prototype,e),a}(h.Filter);A.MIN_SAMPLES=1,A.MAX_SAMPLES=100;var O=function(t){function e(e){void 0===e&&(e=10),t.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform vec2 size;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n\treturn floor( coord / size ) * size;\n}\n\nvoid main(void)\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = pixelate(coord, size);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord);\n}\n"),this.size=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={size:{configurable:!0}};return r.size.get=function(){return this.uniforms.size},r.size.set=function(e){"number"==typeof e&&(e=[e,e]),this.uniforms.size=e},Object.defineProperties(e.prototype,r),e}(h.Filter),R=function(i){function e(e,t,r,n){void 0===e&&(e=0),void 0===t&&(t=[0,0]),void 0===r&&(r=5),void 0===n&&(n=-1),i.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float uRadian;\nuniform vec2 uCenter;\nuniform float uRadius;\nuniform int uKernelSize;\n\nconst int MAX_KERNEL_SIZE = 2048;\n\nvoid main(void)\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n if (uKernelSize == 0)\n {\n gl_FragColor = color;\n return;\n }\n\n float aspect = filterArea.y / filterArea.x;\n vec2 center = uCenter.xy / filterArea.xy;\n float gradient = uRadius / filterArea.x * 0.3;\n float radius = uRadius / filterArea.x - gradient * 0.5;\n int k = uKernelSize - 1;\n\n vec2 coord = vTextureCoord;\n vec2 dir = vec2(center - coord);\n float dist = length(vec2(dir.x, dir.y * aspect));\n\n float radianStep = uRadian;\n if (radius >= 0.0 && dist > radius) {\n float delta = dist - radius;\n float gap = gradient;\n float scale = 1.0 - abs(delta / gap);\n if (scale <= 0.0) {\n gl_FragColor = color;\n return;\n }\n radianStep *= scale;\n }\n radianStep /= float(k);\n\n float s = sin(radianStep);\n float c = cos(radianStep);\n mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c));\n\n for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n if (i == k) {\n break;\n }\n\n coord -= center;\n coord.y *= aspect;\n coord = rotationMatrix * coord;\n coord.y /= aspect;\n coord += center;\n\n vec4 sample = texture2D(uSampler, coord);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample;\n }\n\n gl_FragColor = color / float(uKernelSize);\n}\n"),this._angle=0,this.angle=e,this.center=t,this.kernelSize=r,this.radius=n}i&&(e.__proto__=i);var t={angle:{configurable:!0},center:{configurable:!0},radius:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,n){this.uniforms.uKernelSize=0!==this._angle?this.kernelSize:0,e.applyFilter(this,t,r,n)},t.angle.set=function(e){this._angle=e,this.uniforms.uRadian=e*Math.PI/180},t.angle.get=function(){return this._angle},t.center.get=function(){return this.uniforms.uCenter},t.center.set=function(e){this.uniforms.uCenter=e},t.radius.get=function(){return this.uniforms.uRadius},t.radius.set=function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},Object.defineProperties(e.prototype,t),e}(h.Filter),I=function(t){function e(e){t.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nuniform bool mirror;\nuniform float boundary;\nuniform vec2 amplitude;\nuniform vec2 waveLength;\nuniform vec2 alpha;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 coord = pixelCoord / dimensions;\n\n if (coord.y < boundary) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n float k = (coord.y - boundary) / (1. - boundary + 0.0001);\n float areaY = boundary * dimensions.y / filterArea.y;\n float v = areaY + areaY - vTextureCoord.y;\n float y = mirror ? v : vTextureCoord.y;\n\n float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x;\n float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y;\n float _alpha = (alpha.y - alpha.x) * k + alpha.x;\n\n float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude;\n x = clamp(x, filterClamp.x, filterClamp.z);\n\n vec4 color = texture2D(uSampler, vec2(x, y));\n\n gl_FragColor = color * _alpha;\n}\n"),this.uniforms.amplitude=new Float32Array(2),this.uniforms.waveLength=new Float32Array(2),this.uniforms.alpha=new Float32Array(2),this.uniforms.dimensions=new Float32Array(2),Object.assign(this,{mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0},e)}t&&(e.__proto__=t);var r={mirror:{configurable:!0},boundary:{configurable:!0},amplitude:{configurable:!0},waveLength:{configurable:!0},alpha:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,n){this.uniforms.dimensions[0]=t.sourceFrame.width,this.uniforms.dimensions[1]=t.sourceFrame.height,this.uniforms.time=this.time,e.applyFilter(this,t,r,n)},r.mirror.set=function(e){this.uniforms.mirror=e},r.mirror.get=function(){return this.uniforms.mirror},r.boundary.set=function(e){this.uniforms.boundary=e},r.boundary.get=function(){return this.uniforms.boundary},r.amplitude.set=function(e){this.uniforms.amplitude[0]=e[0],this.uniforms.amplitude[1]=e[1]},r.amplitude.get=function(){return this.uniforms.amplitude},r.waveLength.set=function(e){this.uniforms.waveLength[0]=e[0],this.uniforms.waveLength[1]=e[1]},r.waveLength.get=function(){return this.uniforms.waveLength},r.alpha.set=function(e){this.uniforms.alpha[0]=e[0],this.uniforms.alpha[1]=e[1]},r.alpha.get=function(){return this.uniforms.alpha},Object.defineProperties(e.prototype,r),e}(h.Filter),D=function(n){function e(e,t,r){void 0===e&&(e=[-10,0]),void 0===t&&(t=[0,10]),void 0===r&&(r=[0,0]),n.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nvoid main(void)\n{\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\n}\n"),this.red=e,this.green=t,this.blue=r}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={red:{configurable:!0},green:{configurable:!0},blue:{configurable:!0}};return t.red.get=function(){return this.uniforms.red},t.red.set=function(e){this.uniforms.red=e},t.green.get=function(){return this.uniforms.green},t.green.set=function(e){this.uniforms.green=e},t.blue.get=function(){return this.uniforms.blue},t.blue.set=function(e){this.uniforms.blue=e},Object.defineProperties(e.prototype,t),e}(h.Filter),L=function(n){function e(e,t,r){void 0===e&&(e=[0,0]),void 0===t&&(t={}),void 0===r&&(r=0),n.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\n\nuniform vec2 center;\n\nuniform float amplitude;\nuniform float wavelength;\n// uniform float power;\nuniform float brightness;\nuniform float speed;\nuniform float radius;\n\nuniform float time;\n\nconst float PI = 3.14159;\n\nvoid main()\n{\n float halfWavelength = wavelength * 0.5 / filterArea.x;\n float maxRadius = radius / filterArea.x;\n float currentRadius = time * speed / filterArea.x;\n\n float fade = 1.0;\n\n if (maxRadius > 0.0) {\n if (currentRadius > maxRadius) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\n }\n\n vec2 dir = vec2(vTextureCoord - center / filterArea.xy);\n dir.y *= filterArea.y / filterArea.x;\n float dist = length(dir);\n\n if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n vec2 diffUV = normalize(dir);\n\n float diff = (dist - currentRadius) / halfWavelength;\n\n float p = 1.0 - pow(abs(diff), 2.0);\n\n // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade );\n float powDiff = 1.25 * sin(diff * PI) * p * ( amplitude * fade );\n\n vec2 offset = diffUV * powDiff / filterArea.xy;\n\n // Do clamp :\n vec2 coord = vTextureCoord + offset;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n vec4 color = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n // No clamp :\n // gl_FragColor = texture2D(uSampler, vTextureCoord + offset);\n\n color.rgb *= 1.0 + (brightness - 1.0) * p * fade;\n\n gl_FragColor = color;\n}\n"),this.center=e,Array.isArray(t)&&(console.warn("Deprecated Warning: ShockwaveFilter params Array has been changed to options Object."),t={}),t=Object.assign({amplitude:30,wavelength:160,brightness:1,speed:500,radius:-1},t),this.amplitude=t.amplitude,this.wavelength=t.wavelength,this.brightness=t.brightness,this.speed=t.speed,this.radius=t.radius,this.time=r}n&&(e.__proto__=n);var t={center:{configurable:!0},amplitude:{configurable:!0},wavelength:{configurable:!0},brightness:{configurable:!0},speed:{configurable:!0},radius:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.apply=function(e,t,r,n){this.uniforms.time=this.time,e.applyFilter(this,t,r,n)},t.center.get=function(){return this.uniforms.center},t.center.set=function(e){this.uniforms.center=e},t.amplitude.get=function(){return this.uniforms.amplitude},t.amplitude.set=function(e){this.uniforms.amplitude=e},t.wavelength.get=function(){return this.uniforms.wavelength},t.wavelength.set=function(e){this.uniforms.wavelength=e},t.brightness.get=function(){return this.uniforms.brightness},t.brightness.set=function(e){this.uniforms.brightness=e},t.speed.get=function(){return this.uniforms.speed},t.speed.set=function(e){this.uniforms.speed=e},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(e){this.uniforms.radius=e},Object.defineProperties(e.prototype,t),e}(h.Filter),N=function(n){function e(e,t,r){void 0===t&&(t=0),void 0===r&&(r=1),n.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D uLightmap;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\nuniform vec4 ambientColor;\nvoid main() {\n vec4 diffuseColor = texture2D(uSampler, vTextureCoord);\n vec2 lightCoord = (vTextureCoord * filterArea.xy) / dimensions;\n vec4 light = texture2D(uLightmap, lightCoord);\n vec3 ambient = ambientColor.rgb * ambientColor.a;\n vec3 intensity = ambient + light.rgb;\n vec3 finalColor = diffuseColor.rgb * intensity;\n gl_FragColor = vec4(finalColor, diffuseColor.a);\n}\n"),this.uniforms.dimensions=new Float32Array(2),this.uniforms.ambientColor=new Float32Array([0,0,0,r]),this.texture=e,this.color=t}n&&(e.__proto__=n);var t={texture:{configurable:!0},color:{configurable:!0},alpha:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.apply=function(e,t,r,n){this.uniforms.dimensions[0]=t.sourceFrame.width,this.uniforms.dimensions[1]=t.sourceFrame.height,e.applyFilter(this,t,r,n)},t.texture.get=function(){return this.uniforms.uLightmap},t.texture.set=function(e){this.uniforms.uLightmap=e},t.color.set=function(e){var t=this.uniforms.ambientColor;"number"==typeof e?(h.utils.hex2rgb(e,t),this._color=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],this._color=h.utils.rgb2hex(t))},t.color.get=function(){return this._color},t.alpha.get=function(){return this.uniforms.ambientColor[3]},t.alpha.set=function(e){this.uniforms.ambientColor[3]=e},Object.defineProperties(e.prototype,t),e}(h.Filter),j=function(i){function e(e,t,r,n){void 0===e&&(e=100),void 0===t&&(t=600),void 0===r&&(r=null),void 0===n&&(n=null),i.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\n\nfloat random(vec3 scale, float seed)\n{\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\n\n for (float t = -30.0; t <= 30.0; t++)\n {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n color /= total;\n color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n"),this.uniforms.blur=e,this.uniforms.gradientBlur=t,this.uniforms.start=r||new h.Point(0,window.innerHeight/2),this.uniforms.end=n||new h.Point(600,window.innerHeight/2),this.uniforms.delta=new h.Point(30,30),this.uniforms.texSize=new h.Point(window.innerWidth,window.innerHeight),this.updateDelta()}i&&(e.__proto__=i);var t={blur:{configurable:!0},gradientBlur:{configurable:!0},start:{configurable:!0},end:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.updateDelta=function(){this.uniforms.delta.x=0,this.uniforms.delta.y=0},t.blur.get=function(){return this.uniforms.blur},t.blur.set=function(e){this.uniforms.blur=e},t.gradientBlur.get=function(){return this.uniforms.gradientBlur},t.gradientBlur.set=function(e){this.uniforms.gradientBlur=e},t.start.get=function(){return this.uniforms.start},t.start.set=function(e){this.uniforms.start=e,this.updateDelta()},t.end.get=function(){return this.uniforms.end},t.end.set=function(e){this.uniforms.end=e,this.updateDelta()},Object.defineProperties(e.prototype,t),e}(h.Filter),F=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.updateDelta=function(){var e=this.uniforms.end.x-this.uniforms.start.x,t=this.uniforms.end.y-this.uniforms.start.y,r=Math.sqrt(e*e+t*t);this.uniforms.delta.x=e/r,this.uniforms.delta.y=t/r},t}(j),B=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.updateDelta=function(){var e=this.uniforms.end.x-this.uniforms.start.x,t=this.uniforms.end.y-this.uniforms.start.y,r=Math.sqrt(e*e+t*t);this.uniforms.delta.x=-t/r,this.uniforms.delta.y=e/r},t}(j),z=function(i){function e(e,t,r,n){void 0===e&&(e=100),void 0===t&&(t=600),void 0===r&&(r=null),void 0===n&&(n=null),i.call(this),this.tiltShiftXFilter=new F(e,t,r,n),this.tiltShiftYFilter=new B(e,t,r,n)}i&&(e.__proto__=i);var t={blur:{configurable:!0},gradientBlur:{configurable:!0},start:{configurable:!0},end:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r){var n=e.getRenderTarget(!0);this.tiltShiftXFilter.apply(e,t,n),this.tiltShiftYFilter.apply(e,n,r),e.returnRenderTarget(n)},t.blur.get=function(){return this.tiltShiftXFilter.blur},t.blur.set=function(e){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=e},t.gradientBlur.get=function(){return this.tiltShiftXFilter.gradientBlur},t.gradientBlur.set=function(e){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=e},t.start.get=function(){return this.tiltShiftXFilter.start},t.start.set=function(e){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=e},t.end.get=function(){return this.tiltShiftXFilter.end},t.end.set=function(e){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=e},Object.defineProperties(e.prototype,t),e}(h.Filter),U=function(n){function e(e,t,r){void 0===e&&(e=200),void 0===t&&(t=4),void 0===r&&(r=20),n.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 twist(vec2 coord)\n{\n coord -= offset;\n\n float dist = length(coord);\n\n if (dist < radius)\n {\n float ratioDist = (radius - dist) / radius;\n float angleMod = ratioDist * ratioDist * angle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n\n coord += offset;\n\n return coord;\n}\n\nvoid main(void)\n{\n\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = twist(coord);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord );\n\n}\n"),this.radius=e,this.angle=t,this.padding=r}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={offset:{configurable:!0},radius:{configurable:!0},angle:{configurable:!0}};return t.offset.get=function(){return this.uniforms.offset},t.offset.set=function(e){this.uniforms.offset=e},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(e){this.uniforms.radius=e},t.angle.get=function(){return this.uniforms.angle},t.angle.set=function(e){this.uniforms.angle=e},Object.defineProperties(e.prototype,t),e}(h.Filter),X=function(i){function e(e,t,r,n){void 0===e&&(e=.1),void 0===t&&(t=[0,0]),void 0===r&&(r=0),void 0===n&&(n=-1),i.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\nconst float MAX_KERNEL_SIZE = 32.0;\n\n// author: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand(vec2 co, float seed) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot(co + seed, vec2(a, b)), sn = mod(dt, 3.14159);\n return fract(sin(sn) * c + seed);\n}\n\nvoid main() {\n\n float minGradient = uInnerRadius * 0.3;\n float innerRadius = (uInnerRadius + minGradient * 0.5) / filterArea.x;\n\n float gradient = uRadius * 0.3;\n float radius = (uRadius - gradient * 0.5) / filterArea.x;\n\n float countLimit = MAX_KERNEL_SIZE;\n\n vec2 dir = vec2(uCenter.xy / filterArea.xy - vTextureCoord);\n float dist = length(vec2(dir.x, dir.y * filterArea.y / filterArea.x));\n\n float strength = uStrength;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (radius >= 0.0 && dist > radius) { // radius < 0 means it's infinity\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / filterArea.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n }\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = rand(vTextureCoord, 0.0);\n\n float total = 0.0;\n vec4 color = vec4(0.0);\n\n dir *= strength;\n\n for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) {\n float percent = (t + offset) / MAX_KERNEL_SIZE;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture2D(uSampler, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n color /= total;\n // switch back from pre-multiplied alpha\n // color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n"),this.center=t,this.strength=e,this.innerRadius=r,this.radius=n}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={center:{configurable:!0},strength:{configurable:!0},innerRadius:{configurable:!0},radius:{configurable:!0}};return t.center.get=function(){return this.uniforms.uCenter},t.center.set=function(e){this.uniforms.uCenter=e},t.strength.get=function(){return this.uniforms.uStrength},t.strength.set=function(e){this.uniforms.uStrength=e},t.innerRadius.get=function(){return this.uniforms.uInnerRadius},t.innerRadius.set=function(e){this.uniforms.uInnerRadius=e},t.radius.get=function(){return this.uniforms.uRadius},t.radius.set=function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},Object.defineProperties(e.prototype,t),e}(h.Filter);return e.AdjustmentFilter=t,e.AdvancedBloomFilter=n,e.AsciiFilter=i,e.BevelFilter=o,e.BloomFilter=p,e.BulgePinchFilter=g,e.ColorMapFilter=m,e.ColorReplaceFilter=v,e.ConvolutionFilter=_,e.CrossHatchFilter=y,e.CRTFilter=b,e.DotFilter=x,e.DropShadowFilter=w,e.EmbossFilter=T,e.GlitchFilter=S,e.GlowFilter=M,e.GodrayFilter=P,e.KawaseBlurFilter=d,e.MotionBlurFilter=C,e.MultiColorReplaceFilter=k,e.OldFilmFilter=E,e.OutlineFilter=A,e.PixelateFilter=O,e.RadialBlurFilter=R,e.ReflectionFilter=I,e.RGBSplitFilter=D,e.ShockwaveFilter=L,e.SimpleLightmapFilter=N,e.TiltShiftFilter=z,e.TiltShiftAxisFilter=j,e.TiltShiftXFilter=F,e.TiltShiftYFilter=B,e.TwistFilter=U,e.ZoomBlurFilter=X,e}({},PIXI),pixi_projection,pixi_projection;Object.assign(PIXI.filters,this?this.__filters:__filters),function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).pixiParticles=e()}}(function(){return function o(a,s,u){function l(r,e){if(!s[r]){if(!a[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(c)return c(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var i=s[r]={exports:{}};a[r][0].call(i.exports,function(e){var t=a[r][1][e];return l(t||e)},i,i.exports,o,a,s,u)}return s[r].exports}for(var c="function"==typeof require&&require,e=0;ethis.duration&&(this.loop?this.elapsed=this.elapsed%this.duration:this.elapsed=this.duration-1e-6);var r=this.elapsed*this.framerate+1e-7|0;this.texture=this.textures[r]||PIXI.Texture.EMPTY}return t},e.prototype.destroy=function(){this.Particle_destroy(),this.textures=null},e.parseArt=function(e){for(var t,r,n,i,o,a=[],s=0;s=this.maxParticles)this._spawnTimer+=this._frequency;else{var u=void 0;if(u=this.minLifetime==this.maxLifetime?this.minLifetime:Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer=this.spawnChance)){var d=void 0;if(this._poolFirst?(d=this._poolFirst,this._poolFirst=this._poolFirst.next,d.next=null):d=new this.particleConstructor(this),1=this.maxLife||this.age<0)return this.kill(),-1;var t=this.age*this._oneOverLife;if(this.ease&&(t=4==this.ease.length?this.ease(t,0,1,1):this.ease(t)),this._doAlpha&&(this.alpha=this.alphaList.interpolate(t)),this._doScale){var r=this.scaleList.interpolate(t)*this.scaleMultiplier;this.scale.x=this.scale.y=r}if(this._doNormalMovement){if(this._doSpeed){var n=this.speedList.interpolate(t)*this.speedMultiplier;o.default.normalize(this.velocity),o.default.scaleBy(this.velocity,n)}else if(this._doAcceleration&&(this.velocity.x+=this.acceleration.x*e,this.velocity.y+=this.acceleration.y*e,this.maxSpeed)){var i=o.default.length(this.velocity);i>this.maxSpeed&&o.default.scaleBy(this.velocity,this.maxSpeed/i)}this.position.x+=this.velocity.x*e,this.position.y+=this.velocity.y*e}return this._doColor&&(this.tint=this.colorList.interpolate(t)),0!==this.rotationSpeed?this.rotation+=this.rotationSpeed*e:this.acceleration&&!this.noRotation&&(this.rotation=Math.atan2(this.velocity.y,this.velocity.x)),t},n.prototype.kill=function(){this.emitter.recycle(this)},n.prototype.destroy=function(){this.parent&&this.parent.removeChild(this),this.Sprite_destroy(),this.emitter=this.velocity=this.colorList=this.scaleList=this.alphaList=this.speedList=this.ease=this.next=this.prev=null},n.parseArt=function(e){var t;for(t=e.length;0<=t;--t)"string"==typeof e[t]&&(e[t]=PIXI.Texture.fromImage(e[t]));if(o.default.verbose)for(t=e.length-1;0a.time;)i=a,a=e[++o];u=(u-i.time)/(a.time-i.time);var l=d.hexToRGB(i.value),c=d.hexToRGB(a.value),f={};f.r=(c.r-l.r)*u+l.r,f.g=(c.g-l.g)*u+l.g,f.b=(c.b-l.b)*u+l.b,n.next=new h.default(f,s/t),n=n.next}return r}};r.default=d},{"./PropertyNode":7}],5:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("./ParticleUtils"),a=e("./Particle"),s=new PIXI.Point,u=["pow","sqrt","abs","floor","round","ceil","E","PI","sin","cos","tan","asin","acos","atan","atan2","log"],l=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(u).join("|"),"g"),c=function(r){function e(e){var t=r.call(this,e)||this;return t.path=null,t.initialRotation=0,t.initialPosition=new PIXI.Point,t.movement=0,t}return i(e,r),e.prototype.init=function(){this.initialRotation=this.rotation,this.Particle_init(),this.path=this.extraData.path,this._doNormalMovement=!this.path,this.movement=0,this.initialPosition.x=this.position.x,this.initialPosition.y=this.position.y},e.prototype.update=function(e){var t=this.Particle_update(e);if(0<=t&&this.path){var r=this.speedList.interpolate(t)*this.speedMultiplier;this.movement+=r*e,s.x=this.movement,s.y=this.path(this.movement),o.default.rotatePoint(this.initialRotation,s),this.position.x=this.initialPosition.x+s.x,this.position.y=this.initialPosition.y+s.y}return t},e.prototype.destroy=function(){this.Particle_destroy(),this.path=this.initialPosition=null},e.parseArt=function(e){return a.default.parseArt(e)},e.parseData=function(e){var t={};if(e&&e.path)try{t.path=function(e){for(var t=e.match(l),r=t.length-1;0<=r;--r)0<=u.indexOf(t[r])&&(t[r]="Math."+t[r]);return e=t.join(""),new Function("x","return "+e+";")}(e.path)}catch(e){o.default.verbose&&console.error("PathParticle: error in parsing path expression"),t.path=null}else o.default.verbose&&console.error("PathParticle requires a path string in extraData!"),t.path=null;return t},e}(a.default);r.default=c},{"./Particle":3,"./ParticleUtils":4}],6:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var a=e("./ParticleUtils"),n=function(){function e(e){void 0===e&&(e=!1),this.current=null,this.next=null,this.isColor=!!e,this.interpolate=null,this.ease=null}return e.prototype.reset=function(e){this.current=e,this.next=e.next,this.next&&1<=this.next.time?this.interpolate=this.isColor?o:i:e.isStepped?this.interpolate=this.isColor?c:l:this.interpolate=this.isColor?u:s,this.ease=this.current.ease},e}();function i(e){return this.ease&&(e=this.ease(e)),(this.next.value-this.current.value)*e+this.current.value}function o(e){this.ease&&(e=this.ease(e));var t=this.current.value,r=this.next.value,n=(r.r-t.r)*e+t.r,i=(r.g-t.g)*e+t.g,o=(r.b-t.b)*e+t.b;return a.default.combineRGBComponents(n,i,o)}function s(e){for(this.ease&&(e=this.ease(e));e>this.next.time;)this.current=this.next,this.next=this.next.next;return e=(e-this.current.time)/(this.next.time-this.current.time),(this.next.value-this.current.value)*e+this.current.value}function u(e){for(this.ease&&(e=this.ease(e));e>this.next.time;)this.current=this.next,this.next=this.next.next;e=(e-this.current.time)/(this.next.time-this.current.time);var t=this.current.value,r=this.next.value,n=(r.r-t.r)*e+t.r,i=(r.g-t.g)*e+t.g,o=(r.b-t.b)*e+t.b;return a.default.combineRGBComponents(n,i,o)}function l(e){for(this.ease&&(e=this.ease(e));this.next&&e>this.next.time;)this.current=this.next,this.next=this.next.next;return this.current.value}function c(e){for(this.ease&&(e=this.ease(e));this.next&&e>this.next.time;)this.current=this.next,this.next=this.next.next;var t=this.current.value;return a.default.combineRGBComponents(t.r,t.g,t.b)}r.default=n},{"./ParticleUtils":4}],7:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./ParticleUtils"),i=function(){function a(e,t,r){this.value="string"==typeof e?n.default.hexToRGB(e):e,this.time=t,this.next=null,this.isStepped=!1,this.ease=r?"function"==typeof r?r:n.default.generateEase(r):null}return a.createList=function(e){if(Array.isArray(e.list)){var t=e.list,r=void 0,n=void 0;if(n=r=new a(t[0].value,t[0].time,e.ease),2>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,1+(e|=e>>>16)},t.log2=function(e){var t,r;return t=+(65535>>=t))<<3,t|=r=+(15<(e>>>=r))<<2,(t|=r=+(3<(e>>>=r))<<1)|(e>>>=r)>>1},t.getIntersectionFactor=function(e,t,r,n,i){var o=t.x-e.x,a=r.x-n.x,s=r.x-e.x,u=t.y-e.y,l=r.y-n.y,c=r.y-e.y,f=o*l-u*a;if(Math.abs(f)<1e-7)return i.x=o,i.y=u,0;var h=(s*l-c*a)/f,d=(o*c-u*s)/f;return d<1e-6||-1e-6=this.size&&this.flush(),e._texture._uvs&&e._texture.baseTexture&&(this.sprites[this.currentIndex++]=e)},e.prototype.flush=function(){if(0!==this.currentIndex){var e,t,r,n=this.renderer.gl,i=this.MAX_TEXTURES,o=I.utils.nextPow2(this.currentIndex),a=I.utils.log2(o),s=this.buffers[a],u=this.sprites,l=this.groups,c=s.float32View,f=s.uint32View,h=0,d=null,p=1,g=0,m=l[0],v=O[u[0]._texture.baseTexture.premultipliedAlpha?1:0][u[0].blendMode];for(m.textureCount=0,m.start=0,m.blend=v,R++,r=0;rt[s]&&(n=t[s]),ot[s+1]&&(i=t[s+1]),ah[l]){u=f[s];f[s]=f[l],f[l]=u;var c=h[s];h[s]=h[l],h[l]=c}if(t[0]=f[0].x,t[1]=f[0].y,t[2]=f[1].x,t[3]=f[1].y,t[4]=f[2].x,t[5]=f[2].y,t[6]=f[3].x,t[7]=f[3].y,(f[3].x-f[2].x)*(f[1].y-f[2].y)-(f[1].x-f[2].x)*(f[3].y-f[2].y)<0)return t[4]=f[3].x,void(t[5]=f[3].y)}},e}();e.Surface=t}(pixi_projection||(pixi_projection={})),function(e){var S=new PIXI.Matrix,i=new PIXI.Rectangle,M=new PIXI.Point,t=function(t){function e(){var e=t.call(this)||this;return e.distortion=new PIXI.Point,e}return __extends(e,t),e.prototype.clear=function(){this.distortion.set(0,0)},e.prototype.apply=function(e,t){t=t||new PIXI.Point;var r=this.distortion,n=e.x*e.y;return t.x=e.x+r.x*n,t.y=e.y+r.y*n,t},e.prototype.applyInverse=function(e,t){t=t||new PIXI.Point;var r=e.x,n=e.y,i=this.distortion.x,o=this.distortion.y;if(0==i)t.x=r,t.y=n/(1+o*r);else if(0==o)t.y=n,t.x=r/(1+i*n);else{var a=.5*(n*i-r*o+1)/o,s=a*a+r/o;if(s<=1e-5)return void t.set(NaN,NaN);t.x=0 vFrame.z ||\n pixels.y < vFrame.y || pixels.y > vFrame.w) {\n uv.x = vTrans1.x * surface2.x + vTrans1.y * surface2.y + vTrans1.z;\n uv.y = vTrans2.x * surface2.x + vTrans2.y * surface2.y + vTrans2.z;\n pixels = uv * samplerSize[0];\n \n if (pixels.x < vFrame.x || pixels.x > vFrame.z ||\n pixels.y < vFrame.y || pixels.y > vFrame.w) {\n discard;\n }\n}\n\nvec4 edge;\nedge.xy = clamp(pixels - vFrame.xy + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\nedge.zw = clamp(vFrame.zw - pixels + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\n\nfloat alpha = 1.0; //edge.x * edge.y * edge.z * edge.w;\nvec4 rColor = vColor * alpha;\n\nfloat textureId = floor(vTextureId+0.5);\nvec4 color;\nvec2 textureCoord = uv;\n%forloop%\ngl_FragColor = color * rColor;\n}",e.defUniforms={worldTransform:new Float32Array([1,0,0,0,1,0,0,0,1]),distortion:new Float32Array([0,0])},e}return __extends(e,t),e.prototype.getUniforms=function(e){var t=e.proj;this.shader;return null!==t.surface?t.uniforms:null!==t._activeProjection?t._activeProjection.uniforms:this.defUniforms},e.prototype.createVao=function(e){var t=this.shader.attributes;this.vertSize=14,this.vertByteSize=4*this.vertSize;var r=this.renderer.gl,n=this.renderer.createVao().addIndex(this.indexBuffer).addAttribute(e,t.aVertexPosition,r.FLOAT,!1,this.vertByteSize,0).addAttribute(e,t.aTrans1,r.FLOAT,!1,this.vertByteSize,8).addAttribute(e,t.aTrans2,r.FLOAT,!1,this.vertByteSize,20).addAttribute(e,t.aFrame,r.FLOAT,!1,this.vertByteSize,32).addAttribute(e,t.aColor,r.UNSIGNED_BYTE,!0,this.vertByteSize,48);return t.aTextureId&&n.addAttribute(e,t.aTextureId,r.FLOAT,!1,this.vertByteSize,52),n},e.prototype.fillVertices=function(e,t,r,n,i,o){for(var a=n.vertexData,s=n._texture,u=(s.orig.width,s.orig.height,n._anchor._x,n._anchor._y,s._frame),l=n.aTrans,c=0;c<4;c++)e[r]=a[2*c],e[r+1]=a[2*c+1],e[r+2]=l.a,e[r+3]=l.c,e[r+4]=l.tx,e[r+5]=l.b,e[r+6]=l.d,e[r+7]=l.ty,e[r+8]=u.x,e[r+9]=u.y,e[r+10]=u.x+u.width,e[r+11]=u.y+u.height,t[r+12]=i,e[r+13]=o,r+=14},e}((pixi_projection||(pixi_projection={})).webgl.MultiTextureSpriteRenderer);PIXI.WebGLRenderer.registerPlugin("sprite_bilinear",t)}(),function(e){var t=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.size=100,e.MAX_TEXTURES_LOCAL=1,e.shaderVert="precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec3 aTrans1;\nattribute vec3 aTrans2;\nattribute vec4 aFrame;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 worldTransform;\n\nvarying vec2 vTextureCoord;\nvarying vec3 vTrans1;\nvarying vec3 vTrans2;\nvarying vec4 vFrame;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position.xyw = projectionMatrix * worldTransform * vec3(aVertexPosition, 1.0);\n gl_Position.z = 0.0;\n \n vTextureCoord = aVertexPosition;\n vTrans1 = aTrans1;\n vTrans2 = aTrans2;\n vTextureId = aTextureId;\n vColor = aColor;\n vFrame = aFrame;\n}\n",e.shaderFrag="precision highp float;\nvarying vec2 vTextureCoord;\nvarying vec3 vTrans1;\nvarying vec3 vTrans2;\nvarying vec4 vFrame;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nuniform sampler2D uSamplers[%count%];\nuniform vec2 samplerSize[%count%]; \nuniform vec4 params;\n\nvoid main(void){\nvec2 surface;\n\nfloat vx = vTextureCoord.x;\nfloat vy = vTextureCoord.y;\nfloat aleph = params.x;\nfloat bet = params.y;\nfloat A = params.z;\nfloat B = params.w;\n\nif (aleph == 0.0) {\n\tsurface.y = vy / (1.0 + vx * bet);\n\tsurface.x = vx;\n}\nelse if (bet == 0.0) {\n\tsurface.x = vx / (1.0 + vy * aleph);\n\tsurface.y = vy;\n} else {\n\tsurface.x = vx * (bet + 1.0) / (bet + 1.0 + vy * aleph);\n\tsurface.y = vy * (aleph + 1.0) / (aleph + 1.0 + vx * bet);\n}\n\nvec2 uv;\nuv.x = vTrans1.x * surface.x + vTrans1.y * surface.y + vTrans1.z;\nuv.y = vTrans2.x * surface.x + vTrans2.y * surface.y + vTrans2.z;\n\nvec2 pixels = uv * samplerSize[0];\n\nvec4 edge;\nedge.xy = clamp(pixels - vFrame.xy + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\nedge.zw = clamp(vFrame.zw - pixels + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\n\nfloat alpha = edge.x * edge.y * edge.z * edge.w;\nvec4 rColor = vColor * alpha;\n\nfloat textureId = floor(vTextureId+0.5);\nvec4 color;\nvec2 textureCoord = uv;\n%forloop%\ngl_FragColor = color * rColor;\n}",e.defUniforms={worldTransform:new Float32Array([1,0,0,0,1,0,0,0,1]),distortion:new Float32Array([0,0])},e}return __extends(e,t),e.prototype.getUniforms=function(e){var t=e.proj;this.shader;return null!==t.surface?t.uniforms:null!==t._activeProjection?t._activeProjection.uniforms:this.defUniforms},e.prototype.createVao=function(e){var t=this.shader.attributes;this.vertSize=14,this.vertByteSize=4*this.vertSize;var r=this.renderer.gl,n=this.renderer.createVao().addIndex(this.indexBuffer).addAttribute(e,t.aVertexPosition,r.FLOAT,!1,this.vertByteSize,0).addAttribute(e,t.aTrans1,r.FLOAT,!1,this.vertByteSize,8).addAttribute(e,t.aTrans2,r.FLOAT,!1,this.vertByteSize,20).addAttribute(e,t.aFrame,r.FLOAT,!1,this.vertByteSize,32).addAttribute(e,t.aColor,r.UNSIGNED_BYTE,!0,this.vertByteSize,48);return t.aTextureId&&n.addAttribute(e,t.aTextureId,r.FLOAT,!1,this.vertByteSize,52),n},e.prototype.fillVertices=function(e,t,r,n,i,o){for(var a=n.vertexData,s=n._texture,u=(s.orig.width,s.orig.height,n._anchor._x,n._anchor._y,s._frame),l=n.aTrans,c=0;c<4;c++)e[r]=a[2*c],e[r+1]=a[2*c+1],e[r+2]=l.a,e[r+3]=l.c,e[r+4]=l.tx,e[r+5]=l.b,e[r+6]=l.d,e[r+7]=l.ty,e[r+8]=u.x,e[r+9]=u.y,e[r+10]=u.x+u.width,e[r+11]=u.y+u.height,t[r+12]=i,e[r+13]=o,r+=14},e}((pixi_projection||(pixi_projection={})).webgl.MultiTextureSpriteRenderer);PIXI.WebGLRenderer.registerPlugin("sprite_strange",t)}(),function(e){var S=new PIXI.Matrix,i=new PIXI.Rectangle,M=new PIXI.Point,t=function(t){function e(){var e=t.call(this)||this;return e.params=[0,0,NaN,NaN],e}return __extends(e,t),e.prototype.clear=function(){var e=this.params;e[0]=0,e[1]=0,e[2]=NaN,e[3]=NaN},e.prototype.setAxisX=function(e,t,r){var n=e.x,i=e.y,o=Math.sqrt(n*n+i*i),a=r.rotation;0!==a&&(r.skew._x-=a,r.skew._y+=a,r.rotation=0),r.skew.y=Math.atan2(i,n);var s=this.params;s[2]=0!==t?-o*t:NaN,this._calc01()},e.prototype.setAxisY=function(e,t,r){var n=e.x,i=e.y,o=Math.sqrt(n*n+i*i),a=r.rotation;0!==a&&(r.skew._x-=a,r.skew._y+=a,r.rotation=0),r.skew.x=-Math.atan2(i,n)+Math.PI/2;var s=this.params;s[3]=0!==t?-o*t:NaN,this._calc01()},e.prototype._calc01=function(){var e=this.params;if(isNaN(e[2]))e[1]=0,isNaN(e[3])?e[0]=0:e[0]=1/e[3];else if(isNaN(e[3]))e[0]=0,e[1]=1/e[2];else{var t=1-e[2]*e[3];e[0]=(1-e[2])/t,e[1]=(1-e[3])/t}},e.prototype.apply=function(e,t){t=t||new PIXI.Point;var r=this.params[0],n=this.params[1],i=this.params[2],o=this.params[3],a=e.x,s=e.y;if(0===r)t.y=s*(1+a*n),t.x=a;else if(0===n)t.x=a*(1+s*r),t.y=s;else{var u=i*o-s*a;t.x=i*a*(o+s)/u,t.y=o*s*(i+a)/u}return t},e.prototype.applyInverse=function(e,t){t=t||new PIXI.Point;var r=this.params[0],n=this.params[1],i=(this.params[2],this.params[3],e.x),o=e.y;return 0===r?(t.y=o/(1+i*n),t.x=i):0===n?(t.x=i*(1+o*r),t.y=o):(t.x=i*(n+1)/(n+1+o*r),t.y=o*(r+1)/(r+1+i*n)),t},e.prototype.mapSprite=function(e,t,r){var n=e.texture;return i.x=-e.anchor.x*n.orig.width,i.y=-e.anchor.y*n.orig.height,i.width=n.orig.width,i.height=n.orig.height,this.mapQuad(i,t,r||e.transform)},e.prototype.mapQuad=function(e,t,r){var n=-e.x/e.width,i=-e.y/e.height,o=(1-e.x)/e.width,a=(1-e.y)/e.height,s=t[0].x*(1-n)+t[1].x*n,u=t[0].y*(1-n)+t[1].y*n,l=t[0].x*(1-o)+t[1].x*o,c=t[0].y*(1-o)+t[1].y*o,f=t[3].x*(1-n)+t[2].x*n,h=t[3].y*(1-n)+t[2].y*n,d=t[3].x*(1-o)+t[2].x*o,p=t[3].y*(1-o)+t[2].y*o,g=s*(1-i)+f*i,m=u*(1-i)+h*i,v=l*(1-i)+d*i,_=c*(1-i)+p*i,y=s*(1-a)+f*a,b=u*(1-a)+h*a,x=l*(1-a)+d*a,w=c*(1-a)+p*a,T=S;return T.tx=g,T.ty=m,T.a=v-g,T.b=_-m,T.c=y-g,T.d=b-m,M.set(x,w),T.applyInverse(M,M),r.setFromMatrix(T),this},e.prototype.fillUniforms=function(e){var t=this.params,r=e.params||new Float32Array([0,0,0,0]);(e.params=r)[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3]},e}(e.Surface);e.StrangeSurface=t}(pixi_projection||(pixi_projection={})),function(n){var e=function(r){function e(e){var t=r.call(this,e)||this;return t.aTrans=new PIXI.Matrix,t.proj=new n.ProjectionSurface(t.transform),t.pluginName="sprite_bilinear",t}return __extends(e,r),e.prototype._calculateBounds=function(){this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData)},e.prototype.calculateVertices=function(){var e=this.transform._worldID,t=this._texture._updateID;if(this._transformID!==e||this._textureID!==t){this._transformID=e,this._textureID=t;var r=this._texture,n=this.vertexData,i=r.trim,o=r.orig,a=this._anchor,s=0,u=0,l=0,c=0;if(l=i?(s=(u=i.x-a._x*o.width)+i.width,(c=i.y-a._y*o.height)+i.height):(s=(u=-a._x*o.width)+o.width,(c=-a._y*o.height)+o.height),this.proj._surface)n[0]=u,n[1]=c,n[2]=s,n[3]=c,n[4]=s,n[5]=l,n[6]=u,n[7]=l,this.proj._surface.boundsQuad(n,n);else{var f=this.transform.worldTransform,h=f.a,d=f.b,p=f.c,g=f.d,m=f.tx,v=f.ty;n[0]=h*u+p*c+m,n[1]=g*c+d*u+v,n[2]=h*s+p*c+m,n[3]=g*c+d*s+v,n[4]=h*s+p*l+m,n[5]=g*l+d*s+v,n[6]=h*u+p*l+m,n[7]=g*l+d*u+v,this.proj._activeProjection&&this.proj._activeProjection.surface.boundsQuad(n,n)}r.transform||(r.transform=new PIXI.TextureMatrix(r)),r.transform.update();var _=this.aTrans;_.set(o.width,0,0,o.height,u,c),null===this.proj._surface&&_.prepend(this.transform.worldTransform),_.invert(),_.prepend(r.transform.mapCoord)}},e.prototype.calculateTrimmedVertices=function(){var e=this.transform._worldID,t=this._texture._updateID;if(this.vertexTrimmedData){if(this._transformTrimmedID===e&&this._textureTrimmedID===t)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=e,this._textureTrimmedID=t;var r=this._texture,n=this.vertexTrimmedData,i=r.orig,o=this._anchor,a=-o._x*i.width,s=a+i.width,u=-o._y*i.height,l=u+i.height;if(this.proj._surface)n[0]=a,n[1]=u,n[2]=s,n[3]=u,n[4]=s,n[5]=l,n[6]=a,n[7]=l,this.proj._surface.boundsQuad(n,n,this.transform.worldTransform);else{var c=this.transform.worldTransform,f=c.a,h=c.b,d=c.c,p=c.d,g=c.tx,m=c.ty;n[0]=f*a+d*u+g,n[1]=p*u+h*a+m,n[2]=f*s+d*u+g,n[3]=p*u+h*s+m,n[4]=f*s+d*l+g,n[5]=p*l+h*s+m,n[6]=f*a+d*l+g,n[7]=p*l+h*a+m,this.proj._activeProjection&&this.proj._activeProjection.surface.boundsQuad(n,n,this.proj._activeProjection.legacy.worldTransform)}},Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.proj},enumerable:!0,configurable:!0}),e}(PIXI.Sprite);n.Sprite2s=e}(pixi_projection||(pixi_projection={})),function(o){var e=function(i){function e(e,t,r){var n=i.call(this,e,t,r)||this;return n.aTrans=new PIXI.Matrix,n.proj=new o.ProjectionSurface(n.transform),n.pluginName="sprite_bilinear",n}return __extends(e,i),Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.proj},enumerable:!0,configurable:!0}),e}(PIXI.Text);(o.Text2s=e).prototype.calculateVertices=o.Sprite2s.prototype.calculateVertices,e.prototype.calculateTrimmedVertices=o.Sprite2s.prototype.calculateTrimmedVertices,e.prototype._calculateBounds=o.Sprite2s.prototype._calculateBounds}(pixi_projection||(pixi_projection={})),function(e){PIXI.Sprite.prototype.convertTo2s=function(){this.proj||(this.pluginName="sprite_bilinear",this.aTrans=new PIXI.Matrix,this.calculateVertices=e.Sprite2s.prototype.calculateVertices,this.calculateTrimmedVertices=e.Sprite2s.prototype.calculateTrimmedVertices,this._calculateBounds=e.Sprite2s.prototype._calculateBounds,PIXI.Container.prototype.convertTo2s.call(this))},PIXI.Container.prototype.convertTo2s=function(){this.proj||(this.proj=new e.Projection2d(this.transform),Object.defineProperty(this,"worldTransform",{get:function(){return this.proj},enumerable:!0,configurable:!0}))},PIXI.Container.prototype.convertSubtreeTo2s=function(){this.convertTo2s();for(var e=0;e=o.TRANSFORM_STEP.PROJ?(n||this.displayObjectUpdateTransform(),this.proj.affine?this.transform.worldTransform.applyInverse(r,r):this.proj.world.applyInverse(r,r)):(this.parent?r=this.parent.worldTransform.applyInverse(e,r):r.copy(e),i===o.TRANSFORM_STEP.NONE?r:this.transform.localTransform.applyInverse(r,r))},Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.proj.affine?this.transform.worldTransform:this.proj.world},enumerable:!0,configurable:!0}),e}(PIXI.Container);o.Container2d=e,o.container2dToLocal=e.prototype.toLocal}(pixi_projection||(pixi_projection={})),function(e){var a,t,v=PIXI.Point,r=[1,0,0,0,1,0,0,0,1];(t=a=e.AFFINE||(e.AFFINE={}))[t.NONE=0]="NONE",t[t.FREE=1]="FREE",t[t.AXIS_X=2]="AXIS_X",t[t.AXIS_Y=3]="AXIS_Y",t[t.POINT=4]="POINT";var n=function(){function e(e){this.floatArray=null,this.mat3=new Float64Array(e||r)}return Object.defineProperty(e.prototype,"a",{get:function(){return this.mat3[0]/this.mat3[8]},set:function(e){this.mat3[0]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"b",{get:function(){return this.mat3[1]/this.mat3[8]},set:function(e){this.mat3[1]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"c",{get:function(){return this.mat3[3]/this.mat3[8]},set:function(e){this.mat3[3]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"d",{get:function(){return this.mat3[4]/this.mat3[8]},set:function(e){this.mat3[4]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tx",{get:function(){return this.mat3[6]/this.mat3[8]},set:function(e){this.mat3[6]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ty",{get:function(){return this.mat3[7]/this.mat3[8]},set:function(e){this.mat3[7]=e*this.mat3[8]},enumerable:!0,configurable:!0}),e.prototype.set=function(e,t,r,n,i,o){var a=this.mat3;return a[0]=e,a[1]=t,a[2]=0,a[3]=r,a[4]=n,a[5]=0,a[6]=i,a[7]=o,a[8]=1,this},e.prototype.toArray=function(e,t){this.floatArray||(this.floatArray=new Float32Array(9));var r=t||this.floatArray,n=this.mat3;return e?(r[0]=n[0],r[1]=n[1],r[2]=n[2],r[3]=n[3],r[4]=n[4],r[5]=n[5],r[6]=n[6],r[7]=n[7]):(r[0]=n[0],r[1]=n[3],r[2]=n[6],r[3]=n[1],r[4]=n[4],r[5]=n[7],r[6]=n[2],r[7]=n[5]),r[8]=n[8],r},e.prototype.apply=function(e,t){t=t||new PIXI.Point;var r=this.mat3,n=e.x,i=e.y,o=1/(r[2]*n+r[5]*i+r[8]);return t.x=o*(r[0]*n+r[3]*i+r[6]),t.y=o*(r[1]*n+r[4]*i+r[7]),t},e.prototype.translate=function(e,t){var r=this.mat3;return r[0]+=e*r[2],r[1]+=t*r[2],r[3]+=e*r[5],r[4]+=t*r[5],r[6]+=e*r[8],r[7]+=t*r[8],this},e.prototype.scale=function(e,t){var r=this.mat3;return r[0]*=e,r[1]*=t,r[3]*=e,r[4]*=t,r[6]*=e,r[7]*=t,this},e.prototype.scaleAndTranslate=function(e,t,r,n){var i=this.mat3;i[0]=e*i[0]+r*i[2],i[1]=t*i[1]+n*i[2],i[3]=e*i[3]+r*i[5],i[4]=t*i[4]+n*i[5],i[6]=e*i[6]+r*i[8],i[7]=t*i[7]+n*i[8]},e.prototype.applyInverse=function(e,t){t=t||new v;var r=this.mat3,n=e.x,i=e.y,o=r[0],a=r[3],s=r[6],u=r[1],l=r[4],c=r[7],f=r[2],h=r[5],d=r[8],p=(d*l-c*h)*n+(-d*a+s*h)*i+(c*a-s*l),g=(-d*u+c*f)*n+(d*o-s*f)*i+(-c*o+s*u),m=(h*u-l*f)*n+(-h*o+a*f)*i+(l*o-a*u);return t.x=p/m,t.y=g/m,t},e.prototype.invert=function(){var e=this.mat3,t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],a=e[5],s=e[6],u=e[7],l=e[8],c=l*o-a*u,f=-l*i+a*s,h=u*i-o*s,d=t*c+r*f+n*h;return d&&(d=1/d,e[0]=c*d,e[1]=(-l*r+n*u)*d,e[2]=(a*r-n*o)*d,e[3]=f*d,e[4]=(l*t-n*s)*d,e[5]=(-a*t+n*i)*d,e[6]=h*d,e[7]=(-u*t+r*s)*d,e[8]=(o*t-r*i)*d),this},e.prototype.identity=function(){var e=this.mat3;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,this},e.prototype.clone=function(){return new e(this.mat3)},e.prototype.copyTo=function(e){var t=this.mat3,r=e.mat3;return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],e},e.prototype.copy=function(e,t){var r=this.mat3,n=1/r[8],i=r[6]*n,o=r[7]*n;e.a=(r[0]-r[2]*i)*n,e.b=(r[1]-r[2]*o)*n,e.c=(r[3]-r[5]*i)*n,e.d=(r[4]-r[5]*o)*n,e.tx=i,e.ty=o,2<=t&&(t===a.POINT?(e.a=1,e.b=0,e.c=0,e.d=1):t===a.AXIS_X?(e.c=-e.b,e.d=e.a):t===a.AXIS_Y&&(e.a=e.d,e.c=-e.b))},e.prototype.copyFrom=function(e){var t=this.mat3;return t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=e.c,t[4]=e.d,t[5]=0,t[6]=e.tx,t[7]=e.ty,t[8]=1,this},e.prototype.setToMultLegacy=function(e,t){var r=this.mat3,n=t.mat3,i=e.a,o=e.b,a=e.c,s=e.d,u=e.tx,l=e.ty,c=n[0],f=n[1],h=n[2],d=n[3],p=n[4],g=n[5],m=n[6],v=n[7],_=n[8];return r[0]=c*i+f*a+h*u,r[1]=c*o+f*s+h*l,r[2]=h,r[3]=d*i+p*a+g*u,r[4]=d*o+p*s+g*l,r[5]=g,r[6]=m*i+v*a+_*u,r[7]=m*o+v*s+_*l,r[8]=_,this},e.prototype.setToMultLegacy2=function(e,t){var r=this.mat3,n=e.mat3,i=n[0],o=n[1],a=n[2],s=n[3],u=n[4],l=n[5],c=n[6],f=n[7],h=n[8],d=t.a,p=t.b,g=t.c,m=t.d,v=t.tx,_=t.ty;return r[0]=d*i+p*s,r[1]=d*o+p*u,r[2]=d*a+p*l,r[3]=g*i+m*s,r[4]=g*o+m*u,r[5]=g*a+m*l,r[6]=v*i+_*s+c,r[7]=v*o+_*u+f,r[8]=v*a+_*l+h,this},e.prototype.setToMult=function(e,t){var r=this.mat3,n=e.mat3,i=t.mat3,o=n[0],a=n[1],s=n[2],u=n[3],l=n[4],c=n[5],f=n[6],h=n[7],d=n[8],p=i[0],g=i[1],m=i[2],v=i[3],_=i[4],y=i[5],b=i[6],x=i[7],w=i[8];return r[0]=p*o+g*u+m*f,r[1]=p*a+g*l+m*h,r[2]=p*s+g*c+m*d,r[3]=v*o+_*u+y*f,r[4]=v*a+_*l+y*h,r[5]=v*s+_*c+y*d,r[6]=b*o+x*u+w*f,r[7]=b*a+x*l+w*h,r[8]=b*s+x*c+w*d,this},e.prototype.prepend=function(e){e.mat3?this.setToMult(e,this):this.setToMultLegacy(e,this)},e.IDENTITY=new e,e.TEMP_MATRIX=new e,e}();e.Matrix2d=n}(pixi_projection||(pixi_projection={})),function(d){var p=new PIXI.Point,g=[new PIXI.Point,new PIXI.Point,new PIXI.Point,new PIXI.Point],i=new PIXI.Rectangle,m=new d.Matrix2d,e=function(n){function e(e,t){var r=n.call(this,e,t)||this;return r.matrix=new d.Matrix2d,r.pivot=new PIXI.ObservablePoint(r.onChange,r,0,0),r.reverseLocalOrder=!1,r.local=new d.Matrix2d,r.world=new d.Matrix2d,r}return __extends(e,n),e.prototype.onChange=function(){var e=this.pivot,t=this.matrix.mat3;t[6]=-(e._x*t[0]+e._y*t[3]),t[7]=-(e._x*t[1]+e._y*t[4]),this._projID++},e.prototype.setAxisX=function(e,t){void 0===t&&(t=1);var r=e.x,n=e.y,i=Math.sqrt(r*r+n*n),o=this.matrix.mat3;o[0]=r/i,o[1]=n/i,o[2]=t/i,this.onChange()},e.prototype.setAxisY=function(e,t){void 0===t&&(t=1);var r=e.x,n=e.y,i=Math.sqrt(r*r+n*n),o=this.matrix.mat3;o[3]=r/i,o[4]=n/i,o[5]=t/i,this.onChange()},e.prototype.mapSprite=function(e,t){var r=e.texture;return i.x=-e.anchor.x*r.orig.width,i.y=-e.anchor.y*r.orig.height,i.width=r.orig.width,i.height=r.orig.height,this.mapQuad(i,t)},e.prototype.mapQuad=function(e,t){g[0].set(e.x,e.y),g[1].set(e.x+e.width,e.y),g[2].set(e.x+e.width,e.y+e.height),g[3].set(e.x,e.y+e.height);var r=1,n=2,i=3;if(0!==d.utils.getIntersectionFactor(t[0],t[2],t[1],t[3],p)){r=1,n=3,i=2;var o=Math.sqrt((t[0].x-p.x)*(t[0].x-p.x)+(t[0].y-p.y)*(t[0].y-p.y)),a=Math.sqrt((t[r].x-p.x)*(t[r].x-p.x)+(t[r].y-p.y)*(t[r].y-p.y)),s=Math.sqrt((t[n].x-p.x)*(t[n].x-p.x)+(t[n].y-p.y)*(t[n].y-p.y)),u=Math.sqrt((t[i].x-p.x)*(t[i].x-p.x)+(t[i].y-p.y)*(t[i].y-p.y)),l=(o+u)/u,c=(a+s)/s,f=(a+s)/a,h=this.matrix.mat3;h[0]=g[0].x*l,h[1]=g[0].y*l,h[2]=l,h[3]=g[r].x*c,h[4]=g[r].y*c,h[5]=c,h[6]=g[n].x*f,h[7]=g[n].y*f,h[8]=f,this.matrix.invert(),(h=m.mat3)[0]=t[0].x,h[1]=t[0].y,h[2]=1,h[3]=t[r].x,h[4]=t[r].y,h[5]=1,h[6]=t[n].x,h[7]=t[n].y,h[8]=1,this.matrix.setToMult(m,this.matrix),this._projID++}},e.prototype.updateLocalTransform=function(e){0!==this._projID?this.reverseLocalOrder?this.local.setToMultLegacy2(this.matrix,e):this.local.setToMultLegacy(e,this.matrix):this.local.copyFrom(e)},e.prototype.clear=function(){n.prototype.clear.call(this),this.matrix.identity(),this.pivot.set(0,0)},e}(d.LinearProjection);d.Projection2d=e}(pixi_projection||(pixi_projection={})),function(s){var e=function(a){function e(e,t,r,n,i){var o=a.call(this,e,t,r,n,i)||this;return o.proj=new s.Projection2d(o.transform),o.pluginName="mesh2d",o}return __extends(e,a),e.prototype.toLocal=function(e,t,r,n,i){return void 0===i&&(i=s.TRANSFORM_STEP.ALL),s.container2dToLocal.call(this,e,t,r,n,i)},Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.proj.affine?this.transform.worldTransform:this.proj.world},enumerable:!0,configurable:!0}),e}(PIXI.mesh.Mesh);s.Mesh2d=e}(pixi_projection||(pixi_projection={})),function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.onContextChange=function(){var e=this.renderer.gl;this.shader=new PIXI.Shader(e,"precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position.xyw = projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0);\n gl_Position.z = 0.0;\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n","\nvarying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}")},t}(PIXI.mesh.MeshRenderer);e.Mesh2dRenderer=t,PIXI.WebGLRenderer.registerPlugin("mesh2d",t)}(pixi_projection||(pixi_projection={})),function(o){var e=function(h){function e(e){var t=h.call(this,e)||this;return t.proj=new o.Projection2d(t.transform),t.pluginName="sprite2d",t.vertexData=new Float32Array(12),t}return __extends(e,h),e.prototype._calculateBounds=function(){this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData)},e.prototype.calculateVertices=function(){if(this.proj._affine)return 8!=this.vertexData.length&&(this.vertexData=new Float32Array(8)),void h.prototype.calculateVertices.call(this);12!=this.vertexData.length&&(this.vertexData=new Float32Array(12));var e=this.transform._worldID,t=this._texture._updateID;if(this._transformID!==e||this._textureID!==t){this._transformID=e,this._textureID=t;var r=this._texture,n=this.proj.world.mat3,i=this.vertexData,o=r.trim,a=r.orig,s=this._anchor,u=0,l=0,c=0,f=0;c=o?(u=(l=o.x-s._x*a.width)+o.width,(f=o.y-s._y*a.height)+o.height):(u=(l=-s._x*a.width)+a.width,(f=-s._y*a.height)+a.height),i[0]=n[0]*l+n[3]*f+n[6],i[1]=n[1]*l+n[4]*f+n[7],i[2]=n[2]*l+n[5]*f+n[8],i[3]=n[0]*u+n[3]*f+n[6],i[4]=n[1]*u+n[4]*f+n[7],i[5]=n[2]*u+n[5]*f+n[8],i[6]=n[0]*u+n[3]*c+n[6],i[7]=n[1]*u+n[4]*c+n[7],i[8]=n[2]*u+n[5]*c+n[8],i[9]=n[0]*l+n[3]*c+n[6],i[10]=n[1]*l+n[4]*c+n[7],i[11]=n[2]*l+n[5]*c+n[8]}},e.prototype.calculateTrimmedVertices=function(){if(this.proj._affine)h.prototype.calculateTrimmedVertices.call(this);else{var e=this.transform._worldID,t=this._texture._updateID;if(this.vertexTrimmedData){if(this._transformTrimmedID===e&&this._textureTrimmedID===t)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=e,this._textureTrimmedID=t;var r=this._texture,n=this.vertexTrimmedData,i=r.orig,o=this._anchor,a=this.proj.world.mat3,s=-o._x*i.width,u=s+i.width,l=-o._y*i.height,c=l+i.height,f=1/(a[2]*s+a[5]*l+a[8]);n[0]=f*(a[0]*s+a[3]*l+a[6]),n[1]=f*(a[1]*s+a[4]*l+a[7]),f=1/(a[2]*u+a[5]*l+a[8]),n[2]=f*(a[0]*u+a[3]*l+a[6]),n[3]=f*(a[1]*u+a[4]*l+a[7]),f=1/(a[2]*u+a[5]*c+a[8]),n[4]=f*(a[0]*u+a[3]*c+a[6]),n[5]=f*(a[1]*u+a[4]*c+a[7]),f=1/(a[2]*s+a[5]*c+a[8]),n[6]=f*(a[0]*s+a[3]*c+a[6]),n[7]=f*(a[1]*s+a[4]*c+a[7])}},e.prototype.toLocal=function(e,t,r,n,i){return void 0===i&&(i=o.TRANSFORM_STEP.ALL),o.container2dToLocal.call(this,e,t,r,n,i)},Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.proj.affine?this.transform.worldTransform:this.proj.world},enumerable:!0,configurable:!0}),e}(PIXI.Sprite);o.Sprite2d=e}(pixi_projection||(pixi_projection={})),function(e){var t=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.shaderVert="precision highp float;\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position.xyw = projectionMatrix * aVertexPosition;\n gl_Position.z = 0.0;\n \n vTextureCoord = aTextureCoord;\n vTextureId = aTextureId;\n vColor = aColor;\n}\n",e.shaderFrag="\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\nvec4 color;\nvec2 textureCoord = vTextureCoord;\nfloat textureId = floor(vTextureId+0.5);\n%forloop%\ngl_FragColor = color * vColor;\n}",e}return __extends(e,t),e.prototype.createVao=function(e){var t=this.shader.attributes;this.vertSize=6,this.vertByteSize=4*this.vertSize;var r=this.renderer.gl,n=this.renderer.createVao().addIndex(this.indexBuffer).addAttribute(e,t.aVertexPosition,r.FLOAT,!1,this.vertByteSize,0).addAttribute(e,t.aTextureCoord,r.UNSIGNED_SHORT,!0,this.vertByteSize,12).addAttribute(e,t.aColor,r.UNSIGNED_BYTE,!0,this.vertByteSize,16);return t.aTextureId&&n.addAttribute(e,t.aTextureId,r.FLOAT,!1,this.vertByteSize,20),n},e.prototype.fillVertices=function(e,t,r,n,i,o){var a=n.vertexData,s=n._texture._uvs.uvsUint32;if(8===a.length)if(this.renderer.roundPixels){var u=this.renderer.resolution;e[r]=(a[0]*u|0)/u,e[r+1]=(a[1]*u|0)/u,e[r+2]=1,e[r+6]=(a[2]*u|0)/u,e[r+7]=(a[3]*u|0)/u,e[r+8]=1,e[r+12]=(a[4]*u|0)/u,e[r+13]=(a[5]*u|0)/u,e[r+14]=1,e[r+18]=(a[6]*u|0)/u,e[r+19]=(a[7]*u|0)/u,e[r+20]=1}else e[r]=a[0],e[r+1]=a[1],e[r+2]=1,e[r+6]=a[2],e[r+7]=a[3],e[r+8]=1,e[r+12]=a[4],e[r+13]=a[5],e[r+14]=1,e[r+18]=a[6],e[r+19]=a[7],e[r+20]=1;else e[r]=a[0],e[r+1]=a[1],e[r+2]=a[2],e[r+6]=a[3],e[r+7]=a[4],e[r+8]=a[5],e[r+12]=a[6],e[r+13]=a[7],e[r+14]=a[8],e[r+18]=a[9],e[r+19]=a[10],e[r+20]=a[11];t[r+3]=s[0],t[r+9]=s[1],t[r+15]=s[2],t[r+21]=s[3],t[r+4]=t[r+10]=t[r+16]=t[r+22]=i,e[r+5]=e[r+11]=e[r+17]=e[r+23]=o},e}((pixi_projection||(pixi_projection={})).webgl.MultiTextureSpriteRenderer);PIXI.WebGLRenderer.registerPlugin("sprite2d",t)}(),function(o){var e=function(i){function e(e,t,r){var n=i.call(this,e,t,r)||this;return n.proj=new o.Projection2d(n.transform),n.pluginName="sprite2d",n.vertexData=new Float32Array(12),n}return __extends(e,i),Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.proj.affine?this.transform.worldTransform:this.proj.world},enumerable:!0,configurable:!0}),e}(PIXI.Text);(o.Text2d=e).prototype.calculateVertices=o.Sprite2d.prototype.calculateVertices,e.prototype.calculateTrimmedVertices=o.Sprite2d.prototype.calculateTrimmedVertices,e.prototype._calculateBounds=o.Sprite2d.prototype._calculateBounds}(pixi_projection||(pixi_projection={})),function(e){function t(){this.proj||(this.proj=new e.Projection2d(this.transform),this.toLocal=e.Container2d.prototype.toLocal,Object.defineProperty(this,"worldTransform",{get:e.container2dWorldTransform,enumerable:!0,configurable:!0}))}PIXI.Container.prototype.convertTo2d=t,PIXI.Sprite.prototype.convertTo2d=function(){this.proj||(this.calculateVertices=e.Sprite2d.prototype.calculateVertices,this.calculateTrimmedVertices=e.Sprite2d.prototype.calculateTrimmedVertices,this._calculateBounds=e.Sprite2d.prototype._calculateBounds,this.pluginName="sprite2d",this.vertexData=new Float32Array(12),t.call(this))},PIXI.mesh.Mesh.prototype.convertTo2d=function(){this.proj||(this.pluginName="mesh2d",t.call(this))},PIXI.Container.prototype.convertSubtreeTo2d=function(){this.convertTo2d();for(var e=0;e>0,0!==h._cycle&&h._cycle===h._totalTime/a&&g<=e&&h._cycle--,h._time=h._totalTime-h._cycle*a,h._yoyo&&0!=(1&h._cycle)&&(h._time=v-h._time,(f=h._yoyoEase||h.vars.yoyoEase)&&(h._yoyoEase||(!0!==f||h._initted?h._yoyoEase=f=!0===f?h._ease:f instanceof Ease?f:Ease.map[f]:(f=h.vars.ease,h._yoyoEase=f=f?f instanceof Ease?f:"function"==typeof f?new Ease(f,h.vars.easeParams):Ease.map[f]||y.defaultEase:y.defaultEase)),h.ratio=f?1-f.getRatio((v-h._time)/v):0)),h._time>v?h._time=v:h._time<0&&(h._time=0)),h._easeType&&!f?(s=h._time/v,(1===(u=h._easeType)||3===u&&.5<=s)&&(s=1-s),3===u&&(s*=2),1===(l=h._easePower)?s*=s:2===l?s*=s*s:3===l?s*=s*s*s:4===l&&(s*=s*s*s*s),h.ratio=1===u?1-s:2===u?s:h._time/v<.5?s/2:1-s/2):f||(h.ratio=h._ease.getRatio(h._time/v))),p!==h._time||r||m!==h._cycle){if(!h._initted){if(h._init(),!h._initted||h._gc)return;if(!r&&h._firstPT&&(!1!==h.vars.lazy&&h._duration||h.vars.lazy&&!h._duration))return h._time=p,h._totalTime=g,h._rawPrevTime=_,h._cycle=m,x.lazyTweens.push(h),void(h._lazy=[e,t]);!h._time||n||f?n&&this._ease._calcEnd&&!f&&(h.ratio=h._ease.getRatio(0===h._time?0:1)):h.ratio=h._ease.getRatio(h._time/v)}for(!1!==h._lazy&&(h._lazy=!1),h._active||!h._paused&&h._time!==p&&0<=e&&(h._active=!0),0===g&&(2===h._initted&&0e._startTime;u._timeline;)l&&u._timeline.smoothChildTiming?u.totalTime(u._totalTime,!0):u._gc&&u._enabled(!0,!1),u=u._timeline;return c},r.remove=function(e){if(e instanceof f){this._remove(e,!1);var t=e._timeline=e.vars.useFrames?f._rootFramesTimeline:f._rootTimeline;return e._startTime=(e._paused?e._pauseTime:t._time)-(e._reversed?e.totalDuration()-e._totalTime:e._totalTime)/e._timeScale,this}if(e instanceof Array||e&&e.push&&d(e)){for(var r=e.length;-1<--r;)this.remove(e[r]);return this}return"string"==typeof e?this.removeLabel(e):this.kill(null,e)},r._remove=function(e,t){return h.prototype._remove.call(this,e,t),this._last?this._time>this.duration()&&(this._time=this._duration,this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},r.append=function(e,t){return this.add(e,this._parseTimeOrLabel(null,t,!0,e))},r.insert=r.insertMultiple=function(e,t,r,n){return this.add(e,t||0,r,n)},r.appendMultiple=function(e,t,r,n){return this.add(e,this._parseTimeOrLabel(null,t,!0,e),r,n)},r.addLabel=function(e,t){return this._labels[e]=this._parseTimeOrLabel(t),this},r.addPause=function(e,t,r,n){var i=p.delayedCall(0,o,r,n||this);return i.vars.onComplete=i.vars.onReverseComplete=t,i.data="isPause",this._hasPause=!0,this.add(i,e)},r.removeLabel=function(e){return delete this._labels[e],this},r.getLabelTime=function(e){return null!=this._labels[e]?this._labels[e]:-1},r._parseTimeOrLabel=function(e,t,r,n){var i,o;if(n instanceof f&&n.timeline===this)this.remove(n);else if(n&&(n instanceof Array||n.push&&d(n)))for(o=n.length;-1<--o;)n[o]instanceof f&&n[o].timeline===this&&this.remove(n[o]);if(i="number"!=typeof e||t?99999999999=e&&!u;)n._duration||"isPause"===n.data&&0f._time;)u.render(u._reversed?u.totalDuration()-(e-u._startTime)*u._timeScale:(e-u._startTime)*u._timeScale,t,r),u=u._prev;u=null,f.pause(),f._pauseTime=c}n._reversed?n.render((n._dirty?n.totalDuration():n._totalDuration)-(e-n._startTime)*n._timeScale,t,r):n.render((e-n._startTime)*n._timeScale,t,r)}n=o}f._onUpdate&&(t||(v.length&&_(),f._callback("onUpdate"))),a&&(f._gc||p!==f._startTime&&g===f._timeScale||(0===f._time||d>=f.totalDuration())&&(i&&(v.length&&_(),f._timeline.autoRemoveChildren&&f._enabled(!1,!1),f._active=!1),!t&&f.vars[a]&&f._callback(a)))}},r._hasPausedChild=function(){for(var e=this._first;e;){if(e._paused||e instanceof g&&e._hasPausedChild())return!0;e=e._next}return!1},r.getChildren=function(e,t,r,n){n=n||-9999999999;for(var i=[],o=this._first,a=0;o;)o._startTime=r&&(i._startTime+=e),i=i._next;if(t)for(n in o)o[n]>=r&&(o[n]+=e);return this._uncache(!0)},r._kill=function(e,t){if(!e&&!t)return this._enabled(!1,!1);for(var r=t?this.getTweensOf(t):this.getChildren(!0,!0,!1),n=r.length,i=!1;-1<--n;)r[n]._kill(e,t)&&(i=!0);return i},r.clear=function(e){var t=this.getChildren(!1,!0,!0),r=t.length;for(this._time=this._totalTime=0;-1<--r;)t[r]._enabled(!1,!1);return!1!==e&&(this._labels={}),this._uncache(!0)},r.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return f.prototype.invalidate.call(this)},r._enabled=function(e,t){if(e===this._gc)for(var r=this._first;r;)r._enabled(e,!0),r=r._next;return h.prototype._enabled.call(this,e,t)},r.totalTime=function(e,t,r){this._forcingPlayhead=!0;var n=f.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,n},r.duration=function(e){return arguments.length?(0!==this.duration()&&0!==e&&this.timeScale(this._duration/e),this):(this._dirty&&this.totalDuration(),this._duration)},r.totalDuration=function(e){if(arguments.length)return e&&this.totalDuration()?this.timeScale(this._totalDuration/e):this;if(this._dirty){for(var t,r,n=0,i=this,o=i._last,a=999999999999;o;)t=o._prev,o._dirty&&o.totalDuration(),o._startTime>a&&i._sortChildren&&!o._paused&&!i._calculatingDuration?(i._calculatingDuration=1,i.add(o,o._startTime-o._delay),i._calculatingDuration=0):a=o._startTime,o._startTime<0&&!o._paused&&(n-=o._startTime,i._timeline.smoothChildTiming&&(i._startTime+=o._startTime/i._timeScale,i._time-=o._startTime,i._totalTime-=o._startTime,i._rawPrevTime-=o._startTime),i.shiftChildren(-o._startTime,!1,-9999999999),a=0),n<(r=o._startTime+o._totalDuration/o._timeScale)&&(n=r),o=t;i._duration=i._totalDuration=n,i._dirty=!1}return this._totalDuration},r.paused=function(e){if(!1===e&&this._paused)for(var t=this._first;t;)t._startTime===this._time&&"isPause"===t.data&&(t._rawPrevTime=0),t=t._next;return f.prototype.paused.apply(this,arguments)},r.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===f._rootFramesTimeline},r.rawTime=function(e){return e&&(this._paused||this._repeat&&0>0,h._cycle&&h._cycle===h._totalTime/u&&m<=e&&h._cycle--,h._time=h._totalTime-h._cycle*u,h._yoyo&&1&h._cycle&&(h._time=g-h._time),h._time>g?e=(h._time=g)+1e-4:h._time<0?h._time=e=0:e=h._time)),h._hasPause&&!h._forcingPlayhead&&!t){if(d<=(e=h._time)||h._repeat&&x!==h._cycle)for(n=h._first;n&&n._startTime<=e&&!l;)n._duration||"isPause"!==n.data||n.ratio||0===n._startTime&&0===h._rawPrevTime||(l=n),n=n._next;else for(n=h._last;n&&n._startTime>=e&&!l;)n._duration||"isPause"===n.data&&0h._time;)l.render(l._reversed?l.totalDuration()-(e-l._startTime)*l._timeScale:(e-l._startTime)*l._timeScale,t,r),l=l._prev;l=null,h.pause(),h._pauseTime=f}n._reversed?n.render((n._dirty?n.totalDuration():n._totalDuration)-(e-n._startTime)*n._timeScale,t,r):n.render((e-n._startTime)*n._timeScale,t,r)}n=o}h._onUpdate&&(t||(E.length&&A(),h._callback("onUpdate"))),a&&(h._locked||h._gc||v!==h._startTime&&_===h._timeScale||(0===h._time||p>=h.totalDuration())&&(i&&(E.length&&A(),h._timeline.autoRemoveChildren&&h._enabled(!1,!1),h._active=!1),!t&&h.vars[a]&&h._callback(a)))}else m!==h._totalTime&&h._onUpdate&&(t||h._callback("onUpdate"))},i.getActive=function(e,t,r){var n,i,o=[],a=this.getChildren(e||null==e,t||null==e,!!r),s=0,u=a.length;for(n=0;ne)return r[t].name;return null},i.getLabelBefore=function(e){null==e&&(e=this._time);for(var t=this.getLabelsArray(),r=t.length;-1<--r;)if(t[r].time>0||6)-1,f=[],h=[];for(r in e)p(e[r],a,t);for(i=a.length,n=0;n>0]=h,s[o]=l,u=0,h=[]);return{length:l,lengths:s,segments:f}}(this._beziers,this._timeRes);this._length=h.length,this._lengths=h.lengths,this._segments=h.segments,this._l1=this._li=this._s1=this._si=0,this._l2=this._lengths[0],this._curSeg=this._segments[0],this._s2=this._curSeg[0],this._prec=1/this._curSeg.length}if(f=this._autoRotate)for(this._initialRotations=[],f[0]instanceof Array||(this._autoRotate=f=[f]),o=f.length;-1<--o;){for(a=0;a<3;a++)n=f[o][a],this._func[n]="function"==typeof e[n]&&e[n.indexOf("set")||"function"!=typeof e["get"+n.substr(3)]?n:"get"+n.substr(3)];n=f[o][2],this._initialRotations[o]=(this._func[n]?this._func[n].call(this._target):this._target[n])||0,this._overwriteProps.push(n)}return this._startRatio=r.vars.runBackwards?1:0,!0},set:function(e){var t,r,n,i,o,a,s,u,l,c,f=this._segCount,h=this._func,d=this._target,p=e!==this._startRatio;if(this._timeRes){if(l=this._lengths,c=this._curSeg,e*=this._length,n=this._li,e>this._l2&&n=e;);0===n&&ethis._s2&&n=e;);0===n&&e>0)*(1/f))*f;for(r=1-a,n=this._props.length;-1<--n;)i=this._props[n],s=(a*a*(o=this._beziers[i][t]).da+3*r*(a*o.ca+r*o.ba))*a+o.a,this._mod[i]&&(s=this._mod[i](s,d)),h[i]?d[i](s):d[i]=s;if(this._autoRotate){var g,m,v,_,y,b,x,w=this._autoRotate;for(n=w.length;-1<--n;)i=w[n][2],b=w[n][3]||0,x=!0===w[n][4]?1:T,o=this._beziers[w[n][0]],g=this._beziers[w[n][1]],o&&g&&(o=o[t],g=g[t],m=o.a+(o.b-o.a)*a,m+=((_=o.b+(o.c-o.b)*a)-m)*a,_+=(o.c+(o.d-o.c)*a-_)*a,v=g.a+(g.b-g.a)*a,v+=((y=g.b+(g.c-g.b)*a)-v)*a,y+=(g.c+(g.d-g.c)*a-y)*a,s=p?Math.atan2(y-v,_-m)*x+b:this._initialRotations[n],this._mod[i]&&(s=this._mod[i](s,d)),h[i]?d[i](s):d[i]=s)}}}),e=m.prototype,m.bezierThrough=d,m.cubicToQuadratic=M,m._autoCSS=!0,m.quadraticToCubic=function(e,t,r){return new _(e,(2*t+e)/3,(2*t+r)/3,r)},m._cssRegister=function(){var e=r.CSSPlugin;if(e){var t=e._internals,d=t._parseToProxy,p=t._setPluginRatio,g=t.CSSPropTween;t._registerComplexSpecialProp("bezier",{parser:function(e,t,r,n,i,o){t instanceof Array&&(t={values:t}),o=new m;var a,s,u,l=t.values,c=l.length-1,f=[],h={};if(c<0)return i;for(a=0;a<=c;a++)u=d(e,l[a],n,i,o,c!==a),f[a]=u.end;for(s in t)h[s]=t[s];return h.values=f,(i=new g(e,"bezier",0,0,u.pt,2)).data=u,i.plugin=o,i.setRatio=p,0===h.autoRotate&&(h.autoRotate=!0),!h.autoRotate||h.autoRotate instanceof Array||(a=!0===h.autoRotate?0:Number(h.autoRotate),h.autoRotate=null!=u.end.left?[["left","top","rotation",a,!1]]:null!=u.end.x&&[["x","y","rotation",a,!1]]),h.autoRotate&&(n._transform||n._enableTransforms(!1),u.autoRotate=n._target._gsTransform,u.proxy.rotation=u.autoRotate.rotation||0,n._overwriteProps.push("rotation")),o._onInitTween(u.proxy,h,n._tween),i}})}},e._mod=function(e){for(var t,r=this._overwriteProps,n=r.length;-1<--n;)(t=e[r[n]])&&"function"==typeof t&&(this._mod[r[n]]=t)},e._kill=function(e){var t,r,n=this._props;for(t in this._beziers)if(t in e)for(delete this._beziers[t],delete this._func[t],r=n.length;-1<--r;)n[r]===t&&n.splice(r,1);if(n=this._autoRotate)for(r=n.length;-1<--r;)e[n[r][2]]&&n.splice(r,1);return this._super._kill.call(this,e)},_gsScope._gsDefine("plugins.CSSPlugin",["plugins.TweenPlugin","TweenLite"],function(o,z){var p,S,M,g,U=function(){o.call(this,"css"),this._overwriteProps.length=0,this.setRatio=U.prototype.setRatio},l=_gsScope._gsDefine.globals,m={},e=U.prototype=new o("css");(e.constructor=U).version="2.1.0",U.API=2,U.defaultTransformPerspective=0,U.defaultSkewType="compensated",U.defaultSmoothOrigin=!0,e="px",U.suffixMap={top:e,right:e,bottom:e,left:e,width:e,height:e,fontSize:e,padding:e,margin:e,perspective:e,lineHeight:""};var C,v,_,j,y,P,k,E,t,r,A=/(?:\-|\.|\b)(\d|\.|e\-)+/g,O=/(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g,b=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi,c=/(?![+-]?\d*\.?\d+|[+-]|e[+-]\d+)[^0-9]/g,R=/(?:\d|\-|\+|=|#|\.)*/g,I=/opacity *= *([^)]*)/i,x=/opacity:([^;]*)/i,a=/alpha\(opacity *=.+?\)/i,w=/^(rgb|hsl)/,s=/([A-Z])/g,u=/-([a-z])/gi,T=/(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi,f=function(e,t){return t.toUpperCase()},d=/(?:Left|Right|Width)/i,h=/(M11|M12|M21|M22)=[\d\-\.e]+/gi,D=/progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i,L=/,(?=[^\)]*(?:\(|$))/gi,N=/[\s,\(]/i,F=Math.PI/180,X=180/Math.PI,B={},n={style:{}},q=_gsScope.document||{createElement:function(){return n}},H=function(e,t){return t&&q.createElementNS?q.createElementNS(t,e):q.createElement(e)},Y=H("div"),G=H("img"),i=U._internals={_specialProps:m},W=(_gsScope.navigator||{}).userAgent||"",V=(t=W.indexOf("Android"),r=H("a"),_=-1!==W.indexOf("Safari")&&-1===W.indexOf("Chrome")&&(-1===t||3>16,e>>8&255,255&e];else{if(","===e.charAt(e.length-1)&&(e=e.substr(0,e.length-1)),pe[e])r=pe[e];else if("#"===e.charAt(0))4===e.length&&(e="#"+(n=e.charAt(1))+n+(i=e.charAt(2))+i+(o=e.charAt(3))+o),r=[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e];else if("hsl"===e.substr(0,3))if(r=h=e.match(A),t){if(-1!==e.indexOf("="))return e.match(O)}else a=Number(r[0])%360/360,s=Number(r[1])/100,n=2*(u=Number(r[2])/100)-(i=u<=.5?u*(s+1):u+s-u*s),3n--)for(;++nn--)for(;++n>0];return n.parse(e,a,i,o)}},xe=(i._setPluginRatio=function(e){this.plugin.setRatio(e);for(var t,r,n,i,o,a=this.data,s=a.proxy,u=a.firstMPT;u;)t=s[u.v],u.r?t=u.r(t):t<1e-6&&-1e-6s.length?u.length:s.length,a=0;ao.pr;)a=a._next;(o._prev=a?a._prev:u)?o._prev._next=o:s=o,(o._next=a)?a._prev=o:u=o,o=l}this._firstPT=s}return!0},e.parse=function(e,t,r,n){var i,o,a,s,u,l,c,f,h,d,p=e.style;for(i in t){if(l=t[i],o=m[i],"function"!=typeof l||o&&o.allowFunc||(l=l(E,k)),o)r=o.parse(e,l,i,this,r,n,t);else{if("--"===i.substr(0,2)){this._tween._propLookup[i]=this._addTween.call(this._tween,e.style,"setProperty",te(e).getPropertyValue(i)+"",l+"",i,!1,i);continue}u=re(e,i,M)+"",h="string"==typeof l,"color"===i||"fill"===i||"stroke"===i||-1!==i.indexOf("Color")||h&&w.test(l)?(h||(l=(3<(l=me(l)).length?"rgba(":"rgb(")+l.join(",")+")"),r=Se(p,i,u,l,!0,"transparent",r,0,n)):h&&N.test(l)?r=Se(p,i,u,l,!0,null,r,0,n):(c=(a=parseFloat(u))||0===a?u.substr((a+"").length):"",""!==u&&"auto"!==u||(c="width"===i||"height"===i?(a=le(e,i,M),"px"):"left"===i||"top"===i?(a=ie(e,i,M),"px"):(a="opacity"!==i?0:1,"")),""===(f=(d=h&&"="===l.charAt(1))?(s=parseInt(l.charAt(0)+"1",10),l=l.substr(2),s*=parseFloat(l),l.replace(R,"")):(s=parseFloat(l),h?l.replace(R,""):""))&&(f=i in S?S[i]:c),l=s||0===s?(d?s+a:s)+f:t[i],c!==f&&(""===f&&"lineHeight"!==i||(s||0===s)&&a&&(a=ne(e,i,a,c),"%"===f?(a/=ne(e,i,100,"%")/100,!0!==t.strictUnits&&(u=a+"%")):"em"===f||"rem"===f||"vw"===f||"vh"===f?a/=ne(e,i,1,f):"px"!==f&&(s=ne(e,i,s,f),f="px"),d&&(s||0===s)&&(l=s+a+f))),d&&(s+=a),!a&&0!==a||!s&&0!==s?void 0!==p[i]&&(l||l+""!="NaN"&&null!=l)?(r=new we(p,i,s||a||0,0,r,-1,i,!1,0,u,l)).xs0="none"!==l||"display"!==i&&-1===i.indexOf("Style")?l:u:Z("invalid "+i+" tween value: "+t[i]):(r=new we(p,i,a,s-a,r,0,i,!1!==C&&("px"===f||"zIndex"===i),0,u,l)).xs0=f)}n&&r&&!r.plugin&&(r.plugin=n)}return r},e.setRatio=function(e){var t,r,n,i=this._firstPT;if(1!==e||this._tween._time!==this._tween._duration&&0!==this._tween._time)if(e||this._tween._time!==this._tween._duration&&0!==this._tween._time||-1e-6===this._tween._rawPrevTime)for(;i;){if(t=i.c*e+i.s,i.r?t=i.r(t):t<1e-6&&-1e-6this._p3?this._calcEnd?1===e?0:1-(e=(e-this._p3)/this._p1)*e:t+(e-t)*(e=(e-this._p3)/this._p1)*e*e*e:this._calcEnd?1:t},p.ease=new p(.7,.7),g.config=p.config=function(e,t,r){return new p(e,t,r)},(g=(r=u("easing.SteppedEase",function(e,t){e=e||1,this._p1=1/e,this._p2=e+(t?0:1),this._p3=t?1:0},!0)).prototype=new m).constructor=r,g.getRatio=function(e){return e<0?e=0:1<=e&&(e=.999999999),((this._p2*e|0)+this._p3)*this._p1},g.config=r.config=function(e,t){return new r(e,t)},(g=(n=u("easing.ExpoScaleEase",function(e,t,r){this._p1=Math.log(t/e),this._p2=t-e,this._p3=e,this._ease=r},!0)).prototype=new m).constructor=n,g.getRatio=function(e){return this._ease&&(e=this._ease.getRatio(e)),(this._p3*Math.exp(this._p1*e)-this._p3)/this._p2},g.config=n.config=function(e,t,r){return new n(e,t,r)},(g=(t=u("easing.RoughEase",function(e){for(var t,r,n,i,o,a,s=(e=e||{}).taper||"none",u=[],l=0,c=0|(e.points||20),f=c,h=!1!==e.randomize,d=!0===e.clamp,p=e.template instanceof m?e.template:null,g="number"==typeof e.strength?.4*e.strength:.4;-1<--f;)t=h?Math.random():1/c*f,r=p?p.getRatio(t):t,n="none"===s?g:"out"===s?(i=1-t)*i*g:"in"===s?t*t*g:t<.5?(i=2*t)*i*.5*g:(i=2*(1-t))*i*.5*g,h?r+=Math.random()*n-.5*n:f%2?r+=.5*n:r-=.5*n,d&&(1t.t){for(;t.next&&e>=t.t;)t=t.next;t=t.prev}else for(;t.prev&&e<=t.t;)t=t.prev;return(this._prev=t).v+(e-t.t)/t.gap*t.c},g.config=function(e){return new t(e)},t.ease=new t,f("Bounce",l("BounceOut",function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}),l("BounceIn",function(e){return(e=1-e)<1/2.75?1-7.5625*e*e:e<2/2.75?1-(7.5625*(e-=1.5/2.75)*e+.75):e<2.5/2.75?1-(7.5625*(e-=2.25/2.75)*e+.9375):1-(7.5625*(e-=2.625/2.75)*e+.984375)}),l("BounceInOut",function(e){var t=e<.5;return(e=t?1-2*e:2*e-1)<1/2.75?e*=7.5625*e:e=e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,t?.5*(1-e):.5*e+.5})),f("Circ",l("CircOut",function(e){return Math.sqrt(1-(e-=1)*e)}),l("CircIn",function(e){return-(Math.sqrt(1-e*e)-1)}),l("CircInOut",function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)})),f("Elastic",(e=function(e,t,r){var n=u("easing."+e,function(e,t){this._p1=1<=e?e:1,this._p2=(t||r)/(e<1?e:1),this._p3=this._p2/a*(Math.asin(1/this._p1)||0),this._p2=a/this._p2},!0),i=n.prototype=new m;return i.constructor=n,i.getRatio=t,i.config=function(e,t){return new n(e,t)},n})("ElasticOut",function(e){return this._p1*Math.pow(2,-10*e)*Math.sin((e-this._p3)*this._p2)+1},.3),e("ElasticIn",function(e){return-this._p1*Math.pow(2,10*(e-=1))*Math.sin((e-this._p3)*this._p2)},.3),e("ElasticInOut",function(e){return(e*=2)<1?this._p1*Math.pow(2,10*(e-=1))*Math.sin((e-this._p3)*this._p2)*-.5:this._p1*Math.pow(2,-10*(e-=1))*Math.sin((e-this._p3)*this._p2)*.5+1},.45)),f("Expo",l("ExpoOut",function(e){return 1-Math.pow(2,-10*e)}),l("ExpoIn",function(e){return Math.pow(2,10*(e-1))-.001}),l("ExpoInOut",function(e){return(e*=2)<1?.5*Math.pow(2,10*(e-1)):.5*(2-Math.pow(2,-10*(e-1)))})),f("Sine",l("SineOut",function(e){return Math.sin(e*s)}),l("SineIn",function(e){return 1-Math.cos(e*s)}),l("SineInOut",function(e){return-.5*(Math.cos(Math.PI*e)-1)})),u("easing.EaseLookup",{find:function(e){return m.map[e]}},!0),c(i.SlowMo,"SlowMo","ease,"),c(t,"RoughEase","ease,"),c(r,"SteppedEase","ease,"),d},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(h,d){"use strict";var p={},n=h.document,g=h.GreenSockGlobals=h.GreenSockGlobals||h,e=g[d];if(e)return"undefined"!=typeof module&&module.exports&&(module.exports=e);var t,r,i,m,v,o,a,_=function(e){var t,r=e.split("."),n=g;for(t=0;t=r&&ethis._duration?this._duration:e,t)):this._time},i.totalTime=function(e,t,r){if(v||m.wake(),!arguments.length)return this._totalTime;if(this._timeline){if(e<0&&!r&&(e+=this.totalDuration()),this._timeline.smoothChildTiming){this._dirty&&this.totalDuration();var n=this._totalDuration,i=this._timeline;if(no;)i=i._prev;return i?(e._next=i._next,i._next=e):(e._next=this._first,this._first=e),e._next?e._next._prev=e:this._last=e,e._prev=i,this._recent=e,this._timeline&&this._uncache(!0),this},i._remove=function(e,t){return e.timeline===this&&(t||e._enabled(!1,!0),e._prev?e._prev._next=e._next:this._first===e&&(this._first=e._next),e._next?e._next._prev=e._prev:this._last===e&&(this._last=e._prev),e._next=e._prev=e.timeline=null,e===this._recent&&(this._recent=this._last),this._timeline&&this._uncache(!0)),this},i.render=function(e,t,r){var n,i=this._first;for(this._totalTime=this._time=this._rawPrevTime=e;i;)n=i._next,(i._active||e>=i._startTime&&!i._paused&&!i._gc)&&(i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(e-i._startTime)*i._timeScale,t,r):i.render((e-i._startTime)*i._timeScale,t,r)),i=n},i.rawTime=function(){return v||m.wake(),this._totalTime};var L=S("TweenLite",function(e,t,r){if(R.call(this,t,r),this.render=L.prototype.render,null==e)throw"Cannot tween a null target.";this.target=e="string"!=typeof e?e:L.selector(e)||e;var n,i,o,a=e.jquery||e.length&&e!==h&&e[0]&&(e[0]===h||e[0].nodeType&&e[0].style&&!e.nodeType),s=this.vars.overwrite;if(this._overwrite=s=null==s?Z[L.defaultOverwrite]:"number"==typeof s?s>>0:Z[s],(a||e instanceof Array||e.push&&x(e))&&"number"!=typeof e[0])for(this._targets=o=u(e),this._propLookup=[],this._siblings=[],n=0;n=Q){for(r in Q=m.frame+(parseInt(L.autoSleep,10)||120),W){for(e=(t=W[r].tweens).length;-1<--e;)t[e]._gc&&t.splice(e,1);0===t.length&&delete W[r]}if((!(r=$._first)||r._paused)&&L.autoSleep&&!J._first&&1===m._listeners.tick.length){for(;r&&r._paused;)r=r._next;r||m.sleep()}}},m.addEventListener("tick",R._updateRoot);var te=function(e,t,r){var n,i,o=e._gsTweenID;if(W[o||(e._gsTweenID=o="t"+V++)]||(W[o]={target:e,tweens:[]}),t&&((n=W[o].tweens)[i=n.length]=t,r))for(;-1<--i;)n[i]===t&&n.splice(i,1);return W[o].tweens},re=function(e,t,r,n){var i,o,a=e.vars.onOverwrite;return a&&(i=a(e,t,r,n)),(a=L.onOverwrite)&&(o=a(e,t,r,n)),!1!==i&&!1!==o},ne=function(e,t,r,n,i){var o,a,s,u;if(1===n||4<=n){for(u=i.length,o=0;oc&&((d||!s._initted)&&c-s._startTime<=2e-8||(f[h++]=s)));for(o=h;-1<--o;)if(u=(s=f[o])._firstPT,2===n&&s._kill(r,e,t)&&(a=!0),2!==n||!s._firstPT&&s._initted&&u){if(2!==n&&!re(s,t))continue;s._enabled(!1,!1)&&(a=!0)}return a},ie=function(e,t,r){for(var n=e._timeline,i=n._timeScale,o=e._startTime;n._timeline;){if(o+=n._startTime,i*=n._timeScale,n._paused)return-100;n=n._timeline}return t<(o/=i)?o-t:r&&o===t||!e._initted&&o-t<2e-8?y:(o+=e.totalDuration()/e._timeScale/i)>t+y?0:o-t-y};i._init=function(){var e,t,r,n,i,o,a=this.vars,s=this._overwrittenProps,u=this._duration,l=!!a.immediateRender,c=a.ease,f=this._startAt;if(a.startAt){for(n in f&&(f.render(-1,!0),f.kill()),i={},a.startAt)i[n]=a.startAt[n];if(i.data="isStart",i.overwrite=!1,i.immediateRender=!0,i.lazy=l&&!1!==a.lazy,i.startAt=i.delay=null,i.onUpdate=a.onUpdate,i.onUpdateParams=a.onUpdateParams,i.onUpdateScope=a.onUpdateScope||a.callbackScope||this,this._startAt=L.to(this.target||{},0,i),l)if(0s.pr;)n=n._next;(s._prev=n?n._prev:o)?s._prev._next=s:i=s,(s._next=n)?n._prev=s:o=s,s=a}s=t._firstPT=i}for(;s;)s.pg&&"function"==typeof s.t[e]&&s.t[e]()&&(r=!0),s=s._next;return r},oe.activate=function(e){for(var t=e.length;-1<--t;)e[t].API===oe.API&&(G[(new e[t])._propName]=e[t]);return!0},s.plugin=function(e){if(!(e&&e.propName&&e.init&&e.API))throw"illegal plugin definition.";var t,r=e.propName,n=e.priority||0,i=e.overwriteProps,o={init:"_onInitTween",set:"setRatio",kill:"_kill",round:"_mod",mod:"_mod",initAll:"_onInitAllProps"},a=S("plugins."+r.charAt(0).toUpperCase()+r.substr(1)+"Plugin",function(){oe.call(this,r,n),this._overwriteProps=i||[]},!0===e.global),s=a.prototype=new oe(r);for(t in(s.constructor=a).API=e.API,o)"function"==typeof e[t]&&(s[o[t]]=e[t]);return a.version=e.version,oe.activate([a]),a},t=h._gsQueue){for(r=0;re._startTime;u._timeline;)l&&u._timeline.smoothChildTiming?u.totalTime(u._totalTime,!0):u._gc&&u._enabled(!0,!1),u=u._timeline;return c},r.remove=function(e){if(e instanceof f){this._remove(e,!1);var t=e._timeline=e.vars.useFrames?f._rootFramesTimeline:f._rootTimeline;return e._startTime=(e._paused?e._pauseTime:t._time)-(e._reversed?e.totalDuration()-e._totalTime:e._totalTime)/e._timeScale,this}if(e instanceof Array||e&&e.push&&d(e)){for(var r=e.length;-1<--r;)this.remove(e[r]);return this}return"string"==typeof e?this.removeLabel(e):this.kill(null,e)},r._remove=function(e,t){return h.prototype._remove.call(this,e,t),this._last?this._time>this.duration()&&(this._time=this._duration,this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},r.append=function(e,t){return this.add(e,this._parseTimeOrLabel(null,t,!0,e))},r.insert=r.insertMultiple=function(e,t,r,n){return this.add(e,t||0,r,n)},r.appendMultiple=function(e,t,r,n){return this.add(e,this._parseTimeOrLabel(null,t,!0,e),r,n)},r.addLabel=function(e,t){return this._labels[e]=this._parseTimeOrLabel(t),this},r.addPause=function(e,t,r,n){var i=p.delayedCall(0,o,r,n||this);return i.vars.onComplete=i.vars.onReverseComplete=t,i.data="isPause",this._hasPause=!0,this.add(i,e)},r.removeLabel=function(e){return delete this._labels[e],this},r.getLabelTime=function(e){return null!=this._labels[e]?this._labels[e]:-1},r._parseTimeOrLabel=function(e,t,r,n){var i,o;if(n instanceof f&&n.timeline===this)this.remove(n);else if(n&&(n instanceof Array||n.push&&d(n)))for(o=n.length;-1<--o;)n[o]instanceof f&&n[o].timeline===this&&this.remove(n[o]);if(i="number"!=typeof e||t?99999999999=e&&!u;)n._duration||"isPause"===n.data&&0f._time;)u.render(u._reversed?u.totalDuration()-(e-u._startTime)*u._timeScale:(e-u._startTime)*u._timeScale,t,r),u=u._prev;u=null,f.pause(),f._pauseTime=c}n._reversed?n.render((n._dirty?n.totalDuration():n._totalDuration)-(e-n._startTime)*n._timeScale,t,r):n.render((e-n._startTime)*n._timeScale,t,r)}n=o}f._onUpdate&&(t||(v.length&&_(),f._callback("onUpdate"))),a&&(f._gc||p!==f._startTime&&g===f._timeScale||(0===f._time||d>=f.totalDuration())&&(i&&(v.length&&_(),f._timeline.autoRemoveChildren&&f._enabled(!1,!1),f._active=!1),!t&&f.vars[a]&&f._callback(a)))}},r._hasPausedChild=function(){for(var e=this._first;e;){if(e._paused||e instanceof g&&e._hasPausedChild())return!0;e=e._next}return!1},r.getChildren=function(e,t,r,n){n=n||-9999999999;for(var i=[],o=this._first,a=0;o;)o._startTime=r&&(i._startTime+=e),i=i._next;if(t)for(n in o)o[n]>=r&&(o[n]+=e);return this._uncache(!0)},r._kill=function(e,t){if(!e&&!t)return this._enabled(!1,!1);for(var r=t?this.getTweensOf(t):this.getChildren(!0,!0,!1),n=r.length,i=!1;-1<--n;)r[n]._kill(e,t)&&(i=!0);return i},r.clear=function(e){var t=this.getChildren(!1,!0,!0),r=t.length;for(this._time=this._totalTime=0;-1<--r;)t[r]._enabled(!1,!1);return!1!==e&&(this._labels={}),this._uncache(!0)},r.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return f.prototype.invalidate.call(this)},r._enabled=function(e,t){if(e===this._gc)for(var r=this._first;r;)r._enabled(e,!0),r=r._next;return h.prototype._enabled.call(this,e,t)},r.totalTime=function(e,t,r){this._forcingPlayhead=!0;var n=f.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,n},r.duration=function(e){return arguments.length?(0!==this.duration()&&0!==e&&this.timeScale(this._duration/e),this):(this._dirty&&this.totalDuration(),this._duration)},r.totalDuration=function(e){if(arguments.length)return e&&this.totalDuration()?this.timeScale(this._totalDuration/e):this;if(this._dirty){for(var t,r,n=0,i=this,o=i._last,a=999999999999;o;)t=o._prev,o._dirty&&o.totalDuration(),o._startTime>a&&i._sortChildren&&!o._paused&&!i._calculatingDuration?(i._calculatingDuration=1,i.add(o,o._startTime-o._delay),i._calculatingDuration=0):a=o._startTime,o._startTime<0&&!o._paused&&(n-=o._startTime,i._timeline.smoothChildTiming&&(i._startTime+=o._startTime/i._timeScale,i._time-=o._startTime,i._totalTime-=o._startTime,i._rawPrevTime-=o._startTime),i.shiftChildren(-o._startTime,!1,-9999999999),a=0),n<(r=o._startTime+o._totalDuration/o._timeScale)&&(n=r),o=t;i._duration=i._totalDuration=n,i._dirty=!1}return this._totalDuration},r.paused=function(e){if(!1===e&&this._paused)for(var t=this._first;t;)t._startTime===this._time&&"isPause"===t.data&&(t._rawPrevTime=0),t=t._next;return f.prototype.paused.apply(this,arguments)},r.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===f._rootFramesTimeline},r.rawTime=function(e){return e&&(this._paused||this._repeat&&0>0,h._cycle&&h._cycle===h._totalTime/u&&m<=e&&h._cycle--,h._time=h._totalTime-h._cycle*u,h._yoyo&&1&h._cycle&&(h._time=g-h._time),h._time>g?e=(h._time=g)+1e-4:h._time<0?h._time=e=0:e=h._time)),h._hasPause&&!h._forcingPlayhead&&!t){if(d<=(e=h._time)||h._repeat&&x!==h._cycle)for(n=h._first;n&&n._startTime<=e&&!l;)n._duration||"isPause"!==n.data||n.ratio||0===n._startTime&&0===h._rawPrevTime||(l=n),n=n._next;else for(n=h._last;n&&n._startTime>=e&&!l;)n._duration||"isPause"===n.data&&0h._time;)l.render(l._reversed?l.totalDuration()-(e-l._startTime)*l._timeScale:(e-l._startTime)*l._timeScale,t,r),l=l._prev;l=null,h.pause(),h._pauseTime=f}n._reversed?n.render((n._dirty?n.totalDuration():n._totalDuration)-(e-n._startTime)*n._timeScale,t,r):n.render((e-n._startTime)*n._timeScale,t,r)}n=o}h._onUpdate&&(t||(E.length&&A(),h._callback("onUpdate"))),a&&(h._locked||h._gc||v!==h._startTime&&_===h._timeScale||(0===h._time||p>=h.totalDuration())&&(i&&(E.length&&A(),h._timeline.autoRemoveChildren&&h._enabled(!1,!1),h._active=!1),!t&&h.vars[a]&&h._callback(a)))}else m!==h._totalTime&&h._onUpdate&&(t||h._callback("onUpdate"))},i.getActive=function(e,t,r){var n,i,o=[],a=this.getChildren(e||null==e,t||null==e,!!r),s=0,u=a.length;for(n=0;ne)return r[t].name;return null},i.getLabelBefore=function(e){null==e&&(e=this._time);for(var t=this.getLabelsArray(),r=t.length;-1<--r;)if(t[r].timee._startTime;u._timeline;)l&&u._timeline.smoothChildTiming?u.totalTime(u._totalTime,!0):u._gc&&u._enabled(!0,!1),u=u._timeline;return c},r.remove=function(e){if(e instanceof f){this._remove(e,!1);var t=e._timeline=e.vars.useFrames?f._rootFramesTimeline:f._rootTimeline;return e._startTime=(e._paused?e._pauseTime:t._time)-(e._reversed?e.totalDuration()-e._totalTime:e._totalTime)/e._timeScale,this}if(e instanceof Array||e&&e.push&&d(e)){for(var r=e.length;-1<--r;)this.remove(e[r]);return this}return"string"==typeof e?this.removeLabel(e):this.kill(null,e)},r._remove=function(e,t){return h.prototype._remove.call(this,e,t),this._last?this._time>this.duration()&&(this._time=this._duration,this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},r.append=function(e,t){return this.add(e,this._parseTimeOrLabel(null,t,!0,e))},r.insert=r.insertMultiple=function(e,t,r,n){return this.add(e,t||0,r,n)},r.appendMultiple=function(e,t,r,n){return this.add(e,this._parseTimeOrLabel(null,t,!0,e),r,n)},r.addLabel=function(e,t){return this._labels[e]=this._parseTimeOrLabel(t),this},r.addPause=function(e,t,r,n){var i=p.delayedCall(0,o,r,n||this);return i.vars.onComplete=i.vars.onReverseComplete=t,i.data="isPause",this._hasPause=!0,this.add(i,e)},r.removeLabel=function(e){return delete this._labels[e],this},r.getLabelTime=function(e){return null!=this._labels[e]?this._labels[e]:-1},r._parseTimeOrLabel=function(e,t,r,n){var i,o;if(n instanceof f&&n.timeline===this)this.remove(n);else if(n&&(n instanceof Array||n.push&&d(n)))for(o=n.length;-1<--o;)n[o]instanceof f&&n[o].timeline===this&&this.remove(n[o]);if(i="number"!=typeof e||t?99999999999=e&&!u;)n._duration||"isPause"===n.data&&0f._time;)u.render(u._reversed?u.totalDuration()-(e-u._startTime)*u._timeScale:(e-u._startTime)*u._timeScale,t,r),u=u._prev;u=null,f.pause(),f._pauseTime=c}n._reversed?n.render((n._dirty?n.totalDuration():n._totalDuration)-(e-n._startTime)*n._timeScale,t,r):n.render((e-n._startTime)*n._timeScale,t,r)}n=o}f._onUpdate&&(t||(v.length&&_(),f._callback("onUpdate"))),a&&(f._gc||p!==f._startTime&&g===f._timeScale||(0===f._time||d>=f.totalDuration())&&(i&&(v.length&&_(),f._timeline.autoRemoveChildren&&f._enabled(!1,!1),f._active=!1),!t&&f.vars[a]&&f._callback(a)))}},r._hasPausedChild=function(){for(var e=this._first;e;){if(e._paused||e instanceof g&&e._hasPausedChild())return!0;e=e._next}return!1},r.getChildren=function(e,t,r,n){n=n||-9999999999;for(var i=[],o=this._first,a=0;o;)o._startTime=r&&(i._startTime+=e),i=i._next;if(t)for(n in o)o[n]>=r&&(o[n]+=e);return this._uncache(!0)},r._kill=function(e,t){if(!e&&!t)return this._enabled(!1,!1);for(var r=t?this.getTweensOf(t):this.getChildren(!0,!0,!1),n=r.length,i=!1;-1<--n;)r[n]._kill(e,t)&&(i=!0);return i},r.clear=function(e){var t=this.getChildren(!1,!0,!0),r=t.length;for(this._time=this._totalTime=0;-1<--r;)t[r]._enabled(!1,!1);return!1!==e&&(this._labels={}),this._uncache(!0)},r.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return f.prototype.invalidate.call(this)},r._enabled=function(e,t){if(e===this._gc)for(var r=this._first;r;)r._enabled(e,!0),r=r._next;return h.prototype._enabled.call(this,e,t)},r.totalTime=function(e,t,r){this._forcingPlayhead=!0;var n=f.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,n},r.duration=function(e){return arguments.length?(0!==this.duration()&&0!==e&&this.timeScale(this._duration/e),this):(this._dirty&&this.totalDuration(),this._duration)},r.totalDuration=function(e){if(arguments.length)return e&&this.totalDuration()?this.timeScale(this._totalDuration/e):this;if(this._dirty){for(var t,r,n=0,i=this,o=i._last,a=999999999999;o;)t=o._prev,o._dirty&&o.totalDuration(),o._startTime>a&&i._sortChildren&&!o._paused&&!i._calculatingDuration?(i._calculatingDuration=1,i.add(o,o._startTime-o._delay),i._calculatingDuration=0):a=o._startTime,o._startTime<0&&!o._paused&&(n-=o._startTime,i._timeline.smoothChildTiming&&(i._startTime+=o._startTime/i._timeScale,i._time-=o._startTime,i._totalTime-=o._startTime,i._rawPrevTime-=o._startTime),i.shiftChildren(-o._startTime,!1,-9999999999),a=0),n<(r=o._startTime+o._totalDuration/o._timeScale)&&(n=r),o=t;i._duration=i._totalDuration=n,i._dirty=!1}return this._totalDuration},r.paused=function(e){if(!1===e&&this._paused)for(var t=this._first;t;)t._startTime===this._time&&"isPause"===t.data&&(t._rawPrevTime=0),t=t._next;return f.prototype.paused.apply(this,arguments)},r.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===f._rootFramesTimeline},r.rawTime=function(e){return e&&(this._paused||this._repeat&&0=r&&ethis._duration?this._duration:e,t)):this._time},i.totalTime=function(e,t,r){if(v||m.wake(),!arguments.length)return this._totalTime;if(this._timeline){if(e<0&&!r&&(e+=this.totalDuration()),this._timeline.smoothChildTiming){this._dirty&&this.totalDuration();var n=this._totalDuration,i=this._timeline;if(no;)i=i._prev;return i?(e._next=i._next,i._next=e):(e._next=this._first,this._first=e),e._next?e._next._prev=e:this._last=e,e._prev=i,this._recent=e,this._timeline&&this._uncache(!0),this},i._remove=function(e,t){return e.timeline===this&&(t||e._enabled(!1,!0),e._prev?e._prev._next=e._next:this._first===e&&(this._first=e._next),e._next?e._next._prev=e._prev:this._last===e&&(this._last=e._prev),e._next=e._prev=e.timeline=null,e===this._recent&&(this._recent=this._last),this._timeline&&this._uncache(!0)),this},i.render=function(e,t,r){var n,i=this._first;for(this._totalTime=this._time=this._rawPrevTime=e;i;)n=i._next,(i._active||e>=i._startTime&&!i._paused&&!i._gc)&&(i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(e-i._startTime)*i._timeScale,t,r):i.render((e-i._startTime)*i._timeScale,t,r)),i=n},i.rawTime=function(){return v||m.wake(),this._totalTime};var L=S("TweenLite",function(e,t,r){if(R.call(this,t,r),this.render=L.prototype.render,null==e)throw"Cannot tween a null target.";this.target=e="string"!=typeof e?e:L.selector(e)||e;var n,i,o,a=e.jquery||e.length&&e!==h&&e[0]&&(e[0]===h||e[0].nodeType&&e[0].style&&!e.nodeType),s=this.vars.overwrite;if(this._overwrite=s=null==s?Z[L.defaultOverwrite]:"number"==typeof s?s>>0:Z[s],(a||e instanceof Array||e.push&&x(e))&&"number"!=typeof e[0])for(this._targets=o=u(e),this._propLookup=[],this._siblings=[],n=0;n=Q){for(r in Q=m.frame+(parseInt(L.autoSleep,10)||120),W){for(e=(t=W[r].tweens).length;-1<--e;)t[e]._gc&&t.splice(e,1);0===t.length&&delete W[r]}if((!(r=$._first)||r._paused)&&L.autoSleep&&!J._first&&1===m._listeners.tick.length){for(;r&&r._paused;)r=r._next;r||m.sleep()}}},m.addEventListener("tick",R._updateRoot);var te=function(e,t,r){var n,i,o=e._gsTweenID;if(W[o||(e._gsTweenID=o="t"+V++)]||(W[o]={target:e,tweens:[]}),t&&((n=W[o].tweens)[i=n.length]=t,r))for(;-1<--i;)n[i]===t&&n.splice(i,1);return W[o].tweens},re=function(e,t,r,n){var i,o,a=e.vars.onOverwrite;return a&&(i=a(e,t,r,n)),(a=L.onOverwrite)&&(o=a(e,t,r,n)),!1!==i&&!1!==o},ne=function(e,t,r,n,i){var o,a,s,u;if(1===n||4<=n){for(u=i.length,o=0;oc&&((d||!s._initted)&&c-s._startTime<=2e-8||(f[h++]=s)));for(o=h;-1<--o;)if(u=(s=f[o])._firstPT,2===n&&s._kill(r,e,t)&&(a=!0),2!==n||!s._firstPT&&s._initted&&u){if(2!==n&&!re(s,t))continue;s._enabled(!1,!1)&&(a=!0)}return a},ie=function(e,t,r){for(var n=e._timeline,i=n._timeScale,o=e._startTime;n._timeline;){if(o+=n._startTime,i*=n._timeScale,n._paused)return-100;n=n._timeline}return t<(o/=i)?o-t:r&&o===t||!e._initted&&o-t<2e-8?y:(o+=e.totalDuration()/e._timeScale/i)>t+y?0:o-t-y};i._init=function(){var e,t,r,n,i,o,a=this.vars,s=this._overwrittenProps,u=this._duration,l=!!a.immediateRender,c=a.ease,f=this._startAt;if(a.startAt){for(n in f&&(f.render(-1,!0),f.kill()),i={},a.startAt)i[n]=a.startAt[n];if(i.data="isStart",i.overwrite=!1,i.immediateRender=!0,i.lazy=l&&!1!==a.lazy,i.startAt=i.delay=null,i.onUpdate=a.onUpdate,i.onUpdateParams=a.onUpdateParams,i.onUpdateScope=a.onUpdateScope||a.callbackScope||this,this._startAt=L.to(this.target||{},0,i),l)if(0s.pr;)n=n._next;(s._prev=n?n._prev:o)?s._prev._next=s:i=s,(s._next=n)?n._prev=s:o=s,s=a}s=t._firstPT=i}for(;s;)s.pg&&"function"==typeof s.t[e]&&s.t[e]()&&(r=!0),s=s._next;return r},oe.activate=function(e){for(var t=e.length;-1<--t;)e[t].API===oe.API&&(G[(new e[t])._propName]=e[t]);return!0},s.plugin=function(e){if(!(e&&e.propName&&e.init&&e.API))throw"illegal plugin definition.";var t,r=e.propName,n=e.priority||0,i=e.overwriteProps,o={init:"_onInitTween",set:"setRatio",kill:"_kill",round:"_mod",mod:"_mod",initAll:"_onInitAllProps"},a=S("plugins."+r.charAt(0).toUpperCase()+r.substr(1)+"Plugin",function(){oe.call(this,r,n),this._overwriteProps=i||[]},!0===e.global),s=a.prototype=new oe(r);for(t in(s.constructor=a).API=e.API,o)"function"==typeof e[t]&&(s[o[t]]=e[t]);return a.version=e.version,oe.activate([a]),a},t=h._gsQueue){for(r=0;rthis._p3?this._calcEnd?1===e?0:1-(e=(e-this._p3)/this._p1)*e:t+(e-t)*(e=(e-this._p3)/this._p1)*e*e*e:this._calcEnd?1:t},p.ease=new p(.7,.7),g.config=p.config=function(e,t,r){return new p(e,t,r)},(g=(r=u("easing.SteppedEase",function(e,t){e=e||1,this._p1=1/e,this._p2=e+(t?0:1),this._p3=t?1:0},!0)).prototype=new m).constructor=r,g.getRatio=function(e){return e<0?e=0:1<=e&&(e=.999999999),((this._p2*e|0)+this._p3)*this._p1},g.config=r.config=function(e,t){return new r(e,t)},(g=(n=u("easing.ExpoScaleEase",function(e,t,r){this._p1=Math.log(t/e),this._p2=t-e,this._p3=e,this._ease=r},!0)).prototype=new m).constructor=n,g.getRatio=function(e){return this._ease&&(e=this._ease.getRatio(e)),(this._p3*Math.exp(this._p1*e)-this._p3)/this._p2},g.config=n.config=function(e,t,r){return new n(e,t,r)},(g=(t=u("easing.RoughEase",function(e){for(var t,r,n,i,o,a,s=(e=e||{}).taper||"none",u=[],l=0,c=0|(e.points||20),f=c,h=!1!==e.randomize,d=!0===e.clamp,p=e.template instanceof m?e.template:null,g="number"==typeof e.strength?.4*e.strength:.4;-1<--f;)t=h?Math.random():1/c*f,r=p?p.getRatio(t):t,n="none"===s?g:"out"===s?(i=1-t)*i*g:"in"===s?t*t*g:t<.5?(i=2*t)*i*.5*g:(i=2*(1-t))*i*.5*g,h?r+=Math.random()*n-.5*n:f%2?r+=.5*n:r-=.5*n,d&&(1t.t){for(;t.next&&e>=t.t;)t=t.next;t=t.prev}else for(;t.prev&&e<=t.t;)t=t.prev;return(this._prev=t).v+(e-t.t)/t.gap*t.c},g.config=function(e){return new t(e)},t.ease=new t,f("Bounce",l("BounceOut",function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}),l("BounceIn",function(e){return(e=1-e)<1/2.75?1-7.5625*e*e:e<2/2.75?1-(7.5625*(e-=1.5/2.75)*e+.75):e<2.5/2.75?1-(7.5625*(e-=2.25/2.75)*e+.9375):1-(7.5625*(e-=2.625/2.75)*e+.984375)}),l("BounceInOut",function(e){var t=e<.5;return(e=t?1-2*e:2*e-1)<1/2.75?e*=7.5625*e:e=e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,t?.5*(1-e):.5*e+.5})),f("Circ",l("CircOut",function(e){return Math.sqrt(1-(e-=1)*e)}),l("CircIn",function(e){return-(Math.sqrt(1-e*e)-1)}),l("CircInOut",function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)})),f("Elastic",(e=function(e,t,r){var n=u("easing."+e,function(e,t){this._p1=1<=e?e:1,this._p2=(t||r)/(e<1?e:1),this._p3=this._p2/a*(Math.asin(1/this._p1)||0),this._p2=a/this._p2},!0),i=n.prototype=new m;return i.constructor=n,i.getRatio=t,i.config=function(e,t){return new n(e,t)},n})("ElasticOut",function(e){return this._p1*Math.pow(2,-10*e)*Math.sin((e-this._p3)*this._p2)+1},.3),e("ElasticIn",function(e){return-this._p1*Math.pow(2,10*(e-=1))*Math.sin((e-this._p3)*this._p2)},.3),e("ElasticInOut",function(e){return(e*=2)<1?this._p1*Math.pow(2,10*(e-=1))*Math.sin((e-this._p3)*this._p2)*-.5:this._p1*Math.pow(2,-10*(e-=1))*Math.sin((e-this._p3)*this._p2)*.5+1},.45)),f("Expo",l("ExpoOut",function(e){return 1-Math.pow(2,-10*e)}),l("ExpoIn",function(e){return Math.pow(2,10*(e-1))-.001}),l("ExpoInOut",function(e){return(e*=2)<1?.5*Math.pow(2,10*(e-1)):.5*(2-Math.pow(2,-10*(e-1)))})),f("Sine",l("SineOut",function(e){return Math.sin(e*s)}),l("SineIn",function(e){return 1-Math.cos(e*s)}),l("SineInOut",function(e){return-.5*(Math.cos(Math.PI*e)-1)})),u("easing.EaseLookup",{find:function(e){return m.map[e]}},!0),c(i.SlowMo,"SlowMo","ease,"),c(t,"RoughEase","ease,"),c(r,"SteppedEase","ease,"),d},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(){"use strict";var e=function(){return _gsScope.GreenSockGlobals||_gsScope};"undefined"!=typeof module&&module.exports?(require("../TweenLite.js"),module.exports=e()):"function"==typeof define&&define.amd&&define(["TweenLite"],e)}();var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("easing.CustomBounce",["easing.CustomEase"],function(_){var e,y=function(e){var t,r=e.length,n=1/e[r-2];for(t=2;tl.x||l.y!==u.y&&l.x===u.x||u===l?(l.cx=u.x-l.x,l.cy=u.y-l.y,l.n=u,l.nx=u.x,this.fast&&1l||i===u-1)&&(r.push(c+","+f),n=(s-f)/(a-c)),c=a,f=s;return m&&("string"==typeof m?document.querySelector(m):m).setAttribute("d",r.join(" ")),r.join(" ")},i},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(e){"use strict";var t=function(){return(_gsScope.GreenSockGlobals||_gsScope).CustomEase};"undefined"!=typeof module&&module.exports?(require("../TweenLite.js"),module.exports=t()):"function"==typeof define&&define.amd&&define(["TweenLite"],t)}();var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("easing.CustomWiggle",["easing.CustomEase","easing.Ease"],function(r,n){var e,m={easeOut:new r("","M0,1,C0.7,1,0.6,0,1,0"),easeInOut:new r("","M0,0,C0.104,0,0.242,1,0.444,1,0.644,1,0.608,0,1,0"),anticipate:new r("","M0,0,C0,0.222,0.024,0.386,0.06,0.402,0.181,0.455,0.647,0.646,0.7,0.67,0.9,0.76,1,0.846,1,1"),uniform:new r("","M0,0,C0,0.95,0.01,1,0.01,1,0.01,1,1,1,1,1,1,1,1,0.01,1,0")},v=new r,_=function(t,e){return(t=t.getRatio?t:n.map[t]||new r("",t)).rawBezier||!e?t:{getRatio:function(e){return 1-t.getRatio(e)}}},i=function(e,t){this.vars=t||{},r.call(this,e),this.update(this.vars)};return i.prototype=e=new r,e.constructor=i,e.update=function(e){var t,r,n,i,o,a,s,u,l,c=0|((e=e||this.vars).wiggles||10),f=1/c,h=f/2,d="anticipate"===e.type,p=m[e.type]||m.easeOut,g=v;if(d&&(g=p,p=m.easeOut),e.timingEase&&(g=_(e.timingEase)),e.amplitudeEase&&(p=_(e.amplitudeEase,!0)),u=[0,0,(a=g.getRatio(h))/4,0,a/2,s=d?-p.getRatio(h):p.getRatio(h),a,s],"random"===e.type){for(u.length=4,t=g.getRatio(f),r=2*Math.random()-1,l=2;l":"")+this._text.slice(0,o).join(this._delimiter)+(t?"
":"")+(r?"":"")+this._delimiter+this._original.slice(o).join(this._delimiter)+(r?"":"")):this._text.slice(0,o).join(this._delimiter)+this._delimiter+this._original.slice(o).join(this._delimiter),this._svg?this._target.textContent=n:this._target.innerHTML=" "===this._fillChar&&-1!==n.indexOf(" ")?n.split(" ").join("  "):n}}).prototype;t._newClass=t._oldClass=t._delimiter=""}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(e){"use strict";var t=function(){return(_gsScope.GreenSockGlobals||_gsScope).TextPlugin};"undefined"!=typeof module&&module.exports?(require("../TweenLite.js"),module.exports=t()):"function"==typeof define&&define.amd&&define(["TweenLite"],t)}();var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine.plugin({propName:"endArray",API:2,version:"0.1.3",init:function(e,t,r){var n,i,o=t.length,a=this.a=[];if(this.target=e,this._mod=0,!o)return!1;for(;-1<--o;)(n=e[o])!==(i=t[o])&&a.push({i:o,s:n,c:i-n});return!0},mod:function(e){"function"==typeof e.endArray&&(this._mod=e.endArray)},set:function(e){var t,r,n=this.target,i=this.a,o=i.length,a=this._mod;if(a)for(;-1<--o;)n[(t=i[o]).i]=a(t.s+t.c*e,n);else for(;-1<--o;)r=(t=i[o]).s+t.c*e,n[t.i]=r<1e-6&&-1e-6a.length&&a.grow(o),this._chars=a.sets[this._setIndex],this._revealDelay=t.revealDelay||0,this._tweenLength=!1!==t.tweenLength,this._tween=r,this._rightToLeft=!!t.rightToLeft,!0},set:function(e){var t,r,n,i,o,a,s,u,l,c=this._text.length,f=this._delimiter,h=this._tween._time,d=h-this._prevScrambleTime;this._revealDelay&&(this._tween.vars.runBackwards&&(h=this._tween._duration-h),e=0===h?0:hthis._speed||d<-this._speed)&&(this._setIndex=(this._setIndex+(19*Math.random()|0))%20,this._chars=this._charSet.sets[this._setIndex],this._prevScrambleTime+=d),this._chars):this._original.join(f),i=this._rightToLeft?1!==e||!this._tween.vars.runBackwards&&"isFromStart"!==this._tween.data?(s=this._text.slice(t).join(f),n=this._charsHaveEmoji?p(i).slice(0,this._length+(this._tweenLength?1-e*e*e:1)*this._lengthDif-(this._textHasEmoji?p(s):s).length+.5|0).join(""):i.substr(0,this._length+(this._tweenLength?1-e*e*e:1)*this._lengthDif-(this._textHasEmoji?p(s):s).length+.5|0),s):(n="",this._original.join(f)):(n=this._text.slice(0,t).join(f),r=(this._textHasEmoji?p(n):n).length,this._charsHaveEmoji?p(i).slice(r,this._length+(this._tweenLength?1-(e=1-e)*e*e*e:1)*this._lengthDif+.5|0).join(""):i.substr(r,this._length+(this._tweenLength?1-(e=1-e)*e*e*e:1)*this._lengthDif-r+.5|0)),s=this._hasClass?((o=(u=this._rightToLeft?this._oldClass:this._newClass)&&0!=t)?"":"")+n+(o?"":"")+((a=(l=this._rightToLeft?this._newClass:this._oldClass)&&t!==c)?"":"")+f+i+(a?"":""):n+f+i,this._target[this._prop]=" "===this._fillChar&&-1!==s.indexOf(" ")?s.split(" ").join("  "):s}}).prototype;for(a in a._newClass=a._oldClass="",g)g[a.toLowerCase()]=g[a],g[a.toUpperCase()]=g[a]}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(e){"use strict";var t=function(){return(_gsScope.GreenSockGlobals||_gsScope).ScrambleTextPlugin};"undefined"!=typeof module&&module.exports?(require("../TweenLite.js"),module.exports=t()):"function"==typeof define&&define.amd&&define(["TweenLite"],t)}();var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";var a,e,t,p=/(\d|\.)+/g,g=/(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g,m={aqua:[0,255,255],lime:[0,255,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,255],navy:[0,0,128],white:[255,255,255],fuchsia:[255,0,255],olive:[128,128,0],yellow:[255,255,0],orange:[255,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[255,0,0],pink:[255,192,203],cyan:[0,255,255],transparent:[255,255,255,0]},v=function(e,t,r){return 255*(6*(e=e<0?e+1:1>16,e>>8&255,255&e];else{if(","===e.charAt(e.length-1)&&(e=e.substr(0,e.length-1)),m[e])r=m[e];else if("#"===e.charAt(0))4===e.length&&(e="#"+(n=e.charAt(1))+n+(i=e.charAt(2))+i+(o=e.charAt(3))+o),r=[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e];else if("hsl"===e.substr(0,3))if(r=h=e.match(p),d){if(-1!==e.indexOf("="))return e.match(g)}else a=Number(r[0])%360/360,s=Number(r[1])/100,n=2*(u=Number(r[2])/100)-(i=u<=.5?u*(s+1):u+s-u*s),3>16,e>>8&255,255&e];else{if(","===e.charAt(e.length-1)&&(e=e.substr(0,e.length-1)),g[e])r=g[e];else if("#"===e.charAt(0))4===e.length&&(e="#"+(n=e.charAt(1))+n+(i=e.charAt(2))+i+(o=e.charAt(3))+o),r=[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e];else if("hsl"===e.substr(0,3))if(r=h=e.match(d),t){if(-1!==e.indexOf("="))return e.match(p)}else a=Number(r[0])%360/360,s=Number(r[1])/100,n=2*(u=Number(r[2])/100)-(i=u<=.5?u*(s+1):u+s-u*s),3>16,e>>8&255,255&e];else{if(","===e.charAt(e.length-1)&&(e=e.substr(0,e.length-1)),pe[e])r=pe[e];else if("#"===e.charAt(0))4===e.length&&(e="#"+(n=e.charAt(1))+n+(i=e.charAt(2))+i+(o=e.charAt(3))+o),r=[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e];else if("hsl"===e.substr(0,3))if(r=h=e.match(A),t){if(-1!==e.indexOf("="))return e.match(O)}else a=Number(r[0])%360/360,s=Number(r[1])/100,n=2*(u=Number(r[2])/100)-(i=u<=.5?u*(s+1):u+s-u*s),3n--)for(;++nn--)for(;++n>0];return n.parse(e,a,i,o)}},xe=(i._setPluginRatio=function(e){this.plugin.setRatio(e);for(var t,r,n,i,o,a=this.data,s=a.proxy,u=a.firstMPT;u;)t=s[u.v],u.r?t=u.r(t):t<1e-6&&-1e-6s.length?u.length:s.length,a=0;ao.pr;)a=a._next;(o._prev=a?a._prev:u)?o._prev._next=o:s=o,(o._next=a)?a._prev=o:u=o,o=l}this._firstPT=s}return!0},e.parse=function(e,t,r,n){var i,o,a,s,u,l,c,f,h,d,p=e.style;for(i in t){if(l=t[i],o=m[i],"function"!=typeof l||o&&o.allowFunc||(l=l(E,k)),o)r=o.parse(e,l,i,this,r,n,t);else{if("--"===i.substr(0,2)){this._tween._propLookup[i]=this._addTween.call(this._tween,e.style,"setProperty",te(e).getPropertyValue(i)+"",l+"",i,!1,i);continue}u=re(e,i,M)+"",h="string"==typeof l,"color"===i||"fill"===i||"stroke"===i||-1!==i.indexOf("Color")||h&&w.test(l)?(h||(l=(3<(l=me(l)).length?"rgba(":"rgb(")+l.join(",")+")"),r=Se(p,i,u,l,!0,"transparent",r,0,n)):h&&N.test(l)?r=Se(p,i,u,l,!0,null,r,0,n):(c=(a=parseFloat(u))||0===a?u.substr((a+"").length):"",""!==u&&"auto"!==u||(c="width"===i||"height"===i?(a=le(e,i,M),"px"):"left"===i||"top"===i?(a=ie(e,i,M),"px"):(a="opacity"!==i?0:1,"")),""===(f=(d=h&&"="===l.charAt(1))?(s=parseInt(l.charAt(0)+"1",10),l=l.substr(2),s*=parseFloat(l),l.replace(R,"")):(s=parseFloat(l),h?l.replace(R,""):""))&&(f=i in S?S[i]:c),l=s||0===s?(d?s+a:s)+f:t[i],c!==f&&(""===f&&"lineHeight"!==i||(s||0===s)&&a&&(a=ne(e,i,a,c),"%"===f?(a/=ne(e,i,100,"%")/100,!0!==t.strictUnits&&(u=a+"%")):"em"===f||"rem"===f||"vw"===f||"vh"===f?a/=ne(e,i,1,f):"px"!==f&&(s=ne(e,i,s,f),f="px"),d&&(s||0===s)&&(l=s+a+f))),d&&(s+=a),!a&&0!==a||!s&&0!==s?void 0!==p[i]&&(l||l+""!="NaN"&&null!=l)?(r=new we(p,i,s||a||0,0,r,-1,i,!1,0,u,l)).xs0="none"!==l||"display"!==i&&-1===i.indexOf("Style")?l:u:Z("invalid "+i+" tween value: "+t[i]):(r=new we(p,i,a,s-a,r,0,i,!1!==C&&("px"===f||"zIndex"===i),0,u,l)).xs0=f)}n&&r&&!r.plugin&&(r.plugin=n)}return r},e.setRatio=function(e){var t,r,n,i=this._firstPT;if(1!==e||this._tween._time!==this._tween._duration&&0!==this._tween._time)if(e||this._tween._time!==this._tween._duration&&0!==this._tween._time||-1e-6===this._tween._rawPrevTime)for(;i;){if(t=i.c*e+i.s,i.r?t=i.r(t):t<1e-6&&-1e-6>0||6)-1,f=[],h=[];for(r in e)p(e[r],a,t);for(i=a.length,n=0;n>0]=h,s[o]=l,u=0,h=[]);return{length:l,lengths:s,segments:f}}(this._beziers,this._timeRes);this._length=h.length,this._lengths=h.lengths,this._segments=h.segments,this._l1=this._li=this._s1=this._si=0,this._l2=this._lengths[0],this._curSeg=this._segments[0],this._s2=this._curSeg[0],this._prec=1/this._curSeg.length}if(f=this._autoRotate)for(this._initialRotations=[],f[0]instanceof Array||(this._autoRotate=f=[f]),o=f.length;-1<--o;){for(a=0;a<3;a++)n=f[o][a],this._func[n]="function"==typeof e[n]&&e[n.indexOf("set")||"function"!=typeof e["get"+n.substr(3)]?n:"get"+n.substr(3)];n=f[o][2],this._initialRotations[o]=(this._func[n]?this._func[n].call(this._target):this._target[n])||0,this._overwriteProps.push(n)}return this._startRatio=r.vars.runBackwards?1:0,!0},set:function(e){var t,r,n,i,o,a,s,u,l,c,f=this._segCount,h=this._func,d=this._target,p=e!==this._startRatio;if(this._timeRes){if(l=this._lengths,c=this._curSeg,e*=this._length,n=this._li,e>this._l2&&n=e;);0===n&&ethis._s2&&n=e;);0===n&&e>0)*(1/f))*f;for(r=1-a,n=this._props.length;-1<--n;)i=this._props[n],s=(a*a*(o=this._beziers[i][t]).da+3*r*(a*o.ca+r*o.ba))*a+o.a,this._mod[i]&&(s=this._mod[i](s,d)),h[i]?d[i](s):d[i]=s;if(this._autoRotate){var g,m,v,_,y,b,x,w=this._autoRotate;for(n=w.length;-1<--n;)i=w[n][2],b=w[n][3]||0,x=!0===w[n][4]?1:T,o=this._beziers[w[n][0]],g=this._beziers[w[n][1]],o&&g&&(o=o[t],g=g[t],m=o.a+(o.b-o.a)*a,m+=((_=o.b+(o.c-o.b)*a)-m)*a,_+=(o.c+(o.d-o.c)*a-_)*a,v=g.a+(g.b-g.a)*a,v+=((y=g.b+(g.c-g.b)*a)-v)*a,y+=(g.c+(g.d-g.c)*a-y)*a,s=p?Math.atan2(y-v,_-m)*x+b:this._initialRotations[n],this._mod[i]&&(s=this._mod[i](s,d)),h[i]?d[i](s):d[i]=s)}}}),e=m.prototype;m.bezierThrough=d,m.cubicToQuadratic=M,m._autoCSS=!0,m.quadraticToCubic=function(e,t,r){return new _(e,(2*t+e)/3,(2*t+r)/3,r)},m._cssRegister=function(){var e=r.CSSPlugin;if(e){var t=e._internals,d=t._parseToProxy,p=t._setPluginRatio,g=t.CSSPropTween;t._registerComplexSpecialProp("bezier",{parser:function(e,t,r,n,i,o){t instanceof Array&&(t={values:t}),o=new m;var a,s,u,l=t.values,c=l.length-1,f=[],h={};if(c<0)return i;for(a=0;a<=c;a++)u=d(e,l[a],n,i,o,c!==a),f[a]=u.end;for(s in t)h[s]=t[s];return h.values=f,(i=new g(e,"bezier",0,0,u.pt,2)).data=u,i.plugin=o,i.setRatio=p,0===h.autoRotate&&(h.autoRotate=!0),!h.autoRotate||h.autoRotate instanceof Array||(a=!0===h.autoRotate?0:Number(h.autoRotate),h.autoRotate=null!=u.end.left?[["left","top","rotation",a,!1]]:null!=u.end.x&&[["x","y","rotation",a,!1]]),h.autoRotate&&(n._transform||n._enableTransforms(!1),u.autoRotate=n._target._gsTransform,u.proxy.rotation=u.autoRotate.rotation||0,n._overwriteProps.push("rotation")),o._onInitTween(u.proxy,h,n._tween),i}})}},e._mod=function(e){for(var t,r=this._overwriteProps,n=r.length;-1<--n;)(t=e[r[n]])&&"function"==typeof t&&(this._mod[r[n]]=t)},e._kill=function(e){var t,r,n=this._props;for(t in this._beziers)if(t in e)for(delete this._beziers[t],delete this._func[t],r=n.length;-1<--r;)n[r]===t&&n.splice(r,1);if(n=this._autoRotate)for(r=n.length;-1<--r;)e[n[r][2]]&&n.splice(r,1);return this._super._kill.call(this,e)}}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(e){"use strict";var t=function(){return(_gsScope.GreenSockGlobals||_gsScope).BezierPlugin};"undefined"!=typeof module&&module.exports?(require("../TweenLite.js"),module.exports=t()):"function"==typeof define&&define.amd&&define(["TweenLite"],t)}();var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";var e,t=_gsScope.document,r="undefined"!=typeof window?window:t.defaultView||{getComputedStyle:function(){}},l=function(e){return r.getComputedStyle(e)},f=/(?:(-|-=|\+=)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,c=-1!==((_gsScope.navigator||{}).userAgent||"").indexOf("Edge"),h={rect:["width","height"],circle:["r","r"],ellipse:["rx","ry"],line:["x2","y2"]};function d(e,t,r,n,i,o){return r=(parseFloat(r||0)-parseFloat(e||0))*i,n=(parseFloat(n||0)-parseFloat(t||0))*o,Math.sqrt(r*r+n*n)}function p(e){return"string"!=typeof e&&e.nodeType||(e=_gsScope.TweenLite.selector(e)).length&&(e=e[0]),e}function g(e){if(!e)return 0;var t,r,n,i,o,a,s,u=(e=p(e)).tagName.toLowerCase(),l=1,c=1;"non-scaling-stroke"===e.getAttribute("vector-effect")&&(c=e.getScreenCTM(),l=Math.sqrt(c.a*c.a+c.b*c.b),c=Math.sqrt(c.d*c.d+c.c*c.c));try{r=e.getBBox()}catch(e){console.log("Error: Some browsers like Firefox won't report measurements of invisible elements (like display:none or masks inside defs).")}if(r&&(r.width||r.height)||!h[u]||(r={width:parseFloat(e.getAttribute(h[u][0])),height:parseFloat(e.getAttribute(h[u][1]))},"rect"!==u&&"line"!==u&&(r.width*=2,r.height*=2),"line"===u&&(r.x=parseFloat(e.getAttribute("x1")),r.y=parseFloat(e.getAttribute("y1")),r.width=Math.abs(r.width-r.x),r.height=Math.abs(r.height-r.y))),"path"===u)i=e.style.strokeDasharray,e.style.strokeDasharray="none",t=e.getTotalLength()||0,l!==c&&console.log("Warning: length cannot be measured accurately when vector-effect is non-scaling-stroke and the element isn't proportionally scaled."),t*=(l+c)/2,e.style.strokeDasharray=i;else if("rect"===u)t=2*r.width*l+2*r.height*c;else if("line"===u)t=d(r.x,r.y,r.x+r.width,r.y+r.height,l,c);else if("polyline"===u||"polygon"===u)for(n=e.getAttribute("points").match(f)||[],"polygon"===u&&n.push(n[0],n[1]),t=0,o=2;o>16,e>>8&255,255&e]:""===e||null==e||"none"===e||"string"!=typeof e?r.transparent:r[e]?r[e]:"#"===e.charAt(0)?(4===e.length&&(e="#"+e.charAt(1)+e.charAt(1)+e.charAt(2)+e.charAt(2)+e.charAt(3)+e.charAt(3)),[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e]):e.match(t)||r.transparent},p={scaleX:1,scaleY:1,tx:1,ty:1,rotation:1,shortRotation:1,skewX:1,skewY:1,scale:1},g=function(e,t){var r=e.matrix,n=r.a,i=r.b,o=r.c,a=r.d,s=t&&e._gsTransform||{skewY:0},u=s.scaleX<0;return s.tx=r.e-(s.ox||0),s.ty=r.f-(s.oy||0),s.scaleX=Math.sqrt(n*n+i*i),s.scaleY=Math.sqrt(a*a+o*o),s.rotation=n||i?Math.atan2(i,n):s.rotation||0,s.skewX=o||a?Math.atan2(o,a)+s.rotation:s.skewX||0,Math.abs(s.skewX)>Math.PI/2&&(u?(s.scaleX*=-1,s.skewX+=s.rotation<=0?Math.PI:-Math.PI,s.rotation+=s.rotation<=0?Math.PI:-Math.PI):(s.scaleY*=-1,s.skewX+=s.skewX<=0?Math.PI:-Math.PI)),s.rotation<1e-6&&-1e-6>0)+", "+(r.gs+e*r.gc>>0)+", "+(r.bs+e*r.bc>>0)+")":2===r.type?r.t[r.p]="rgba("+(t>>0)+", "+(r.gs+e*r.gc>>0)+", "+(r.bs+e*r.bc>>0)+", "+(r.as+e*r.ac)+")":-1===r.type&&(r.t[r.p]=r.i):r.t[r.p]=t,r=r._next;if(this._target.attr(this._props),this._transform){var n=(r=this._transform).rotation,i=n-r.skewX,o=Math.cos(n)*r.scaleX,a=Math.sin(n)*r.scaleX,s=Math.sin(i)*-r.scaleY,u=Math.cos(i)*r.scaleY,l=this._pxl,c=this._pyl;a<1e-6&&-1e-6>16,e>>8&255,255&e]:"#"===e.charAt(0)?(4===e.length&&(e="#"+e.charAt(1)+e.charAt(1)+e.charAt(2)+e.charAt(2)+e.charAt(3)+e.charAt(3)),[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e]):e.match(t)||r.transparent},d=function(e,t,r){if(!c&&!(c=_gsScope.ColorFilter||_gsScope.createjs.ColorFilter))throw"EaselPlugin error: The EaselJS ColorFilter JavaScript file wasn't loaded.";for(var n,i,o,a,s,u=e.filters||[],l=u.length;-1<--l;)if(u[l]instanceof c){i=u[l];break}if(i||(i=new c,u.push(i),e.filters=u),o=i.clone(),null!=t.tint)n=h(t.tint),a=null!=t.tintAmount?Number(t.tintAmount):1,o.redOffset=Number(n[0])*a,o.greenOffset=Number(n[1])*a,o.blueOffset=Number(n[2])*a,o.redMultiplier=o.greenMultiplier=o.blueMultiplier=1-a;else for(s in t)"exposure"!==s&&"brightness"!==s&&(o[s]=Number(t[s]));for(null!=t.exposure?(o.redOffset=o.greenOffset=o.blueOffset=255*(Number(t.exposure)-1),o.redMultiplier=o.greenMultiplier=o.blueMultiplier=1):null!=t.brightness&&(a=Number(t.brightness)-1,o.redOffset=o.greenOffset=o.blueOffset=0p[0].length&&M(p[0],(d[0].length-p[0].length)/6|0),_=p.length;gMath.abs(o[0]-a[a.length-2])+Math.abs(o[1]-a[a.length-1])+Math.abs(o[o.length-2]-a[0])+Math.abs(o[o.length-1]-a[1])||r%2)?(P(a),y[_]=-1,b=!0):"auto"===r?y[_]=0:"reverse"===r&&(y[_]=-1),a.closed!==o.closed&&(a.closed=o.closed=!1));return x&&I("shapeIndex:["+y.join(",")+"]"),e.shapeIndex=y}},i=function(e,t){var r,n,i,o,a,s,u,l=0,c=parseFloat(e[0]),f=parseFloat(e[1]),h=c+","+f+" ";for(r=.5*t/(.5*(i=e.length)-1),n=0;n element. "+$),!1;if(o="PATH"===i?"d":"points",("string"==typeof t||t.getBBox||t[0])&&(t={shape:t}),!t.prop&&"function"!=typeof e.setAttribute)return!1;if(s=K(t.shape||t.d||t.points||"","d"==o,e),u&&R.test(s))return I("WARNING: a <"+i+"> cannot accept path data. "+$),!1;if(l=t.shapeIndex||0===t.shapeIndex?t.shapeIndex:"auto",c=t.map||Q.defaultMap,this._prop=t.prop,this._render=t.render||Q.defaultRender,this._apply="updateTarget"in t?t.updateTarget:Q.defaultUpdateTarget,this._rnd=Math.pow(10,isNaN(t.precision)?2:+t.precision),this._tween=r,s){if(this._target=e,b="object"==typeof t.precompile,d=this._prop?e[this._prop]:e.getAttribute(o),this._prop||e.getAttributeNS(null,"data-original")||e.setAttributeNS(null,"data-original",d),"d"==o||this._prop){if(d=D(b?t.precompile[0]:d),p=D(b?t.precompile[1]:s),!b&&!U(d,p,l,c,k))return!1;for("log"!==t.precompile&&!0!==t.precompile||I('precompile:["'+L(d)+'","'+L(p)+'"]'),(S="linear"!==(t.type||Q.defaultType))&&(d=Z(d,t.smoothTolerance),p=Z(p,t.smoothTolerance),d.size||N(d),p.size||N(p),T=J(E[0]),this._origin=d.origin={x:d.left+T.x*d.width,y:d.top+T.y*d.height},E[1]&&(T=J(E[1])),this._eOrigin={x:p.left+T.x*p.width,y:p.top+T.y*p.height}),this._rawPath=e._gsRawPath=d,m=d.length;-1<--m;)for(_=d[m],y=p[m],f=_.isSmooth||[],h=y.isSmooth||[],v=_.length,g=A=0;gp?i:o,sl:c,cl:G(u*u+l*l)-c,i:r}},Q.pathFilter=function(e,t,r,n,i){var o=D(e[0]),a=D(e[1]);U(o,a,t||0===t?t:"auto",r,i)&&(e[0]=L(o),e[1]=L(a),"log"!==n&&!0!==n||I('precompile:["'+e[0]+'","'+e[1]+'"]'))},Q.pointsFilter=r,Q.getTotalSize=N,Q.subdivideRawBezier=Q.subdivideSegment=M,Q.rawPathToString=L,Q.defaultType="linear",Q.defaultUpdateTarget=!0,Q.defaultMap="size",Q.stringToRawPath=Q.pathDataToRawBezier=function(e){return D(K(e,!0))},Q.equalizeSegmentQuantity=U,Q.convertToPath=function(e,t){"string"==typeof e&&(e=g.selector(e));for(var r=e&&0!==e.length?e.length&&e[0]&&e[0].nodeType?Array.prototype.slice.call(e,0):[e]:[],n=r.length;-1<--n;)r[n]=s(r[n],!1!==t);return r},Q.pathDataToBezier=function(e,t){var r,n,i,o,a,s,u,l,c=D(K(e,!0))[0]||[],f=0;if(l=(t=t||{}).align||t.relative,o=t.matrix||[1,0,0,1,0,0],a=t.offsetX||0,s=t.offsetY||0,"relative"===l||!0===l?(a-=c[0]*o[0]+c[1]*o[2],s-=c[0]*o[1]+c[1]*o[3],f="+="):(a+=o[4],s+=o[5],l&&(l="string"==typeof l?g.selector(l):l&&l[0]?l:[l])&&l[0]&&(a-=(u=l[0].getBBox()||{x:0,y:0}).x,s-=u.y)),r=[],i=c.length,o&&"1,0,0,1,0,0"!==o.join(","))for(n=0;nNumber(s.max)+1e-10?(g=s.unitFactor||k.defaultUnitFactors[a]||1,(d=f>s.max&&s.min!==s.max||-15c&&(y||o.preventOvershoot?l=o.min-a:f=o.min-a-l)),this._overwriteProps[b]=i,this._props[b++]={p:i,s:a,c1:l,c2:f,f:s,r:!1}}return!0},e._kill=function(e){for(var t=this._props.length;-1<--t;)null!=e[this._props[t].p]&&this._props.splice(t,1);return r.prototype._kill.call(this,e)},e._mod=function(e){for(var t,r=this._props,n=r.length;-1<--n;)"function"==typeof(t=e[r[n].p]||e.throwProps)&&(r[n].m=t)},e.setRatio=function(e){for(var t,r,n=this._props.length;-1<--n;)r=(t=this._props[n]).s+t.c1*e+t.c2*e*e,t.m?r=t.m(r,this.target):1===e&&(r=(1e4*r+(r<0?-.5:.5)|0)/1e4),t.f?this.target[t.p](r):this.target[t.p]=r},r.activate([k]),k},!0),_gsScope._gsDefine("utils.VelocityTracker",["TweenLite"],function(a){var o,t,i,s=/([A-Z])/g,u={},e=_gsScope.document,l={x:1,y:1,z:2,scale:1,scaleX:1,scaleY:1,rotation:1,rotationZ:1,rotationX:2,rotationY:2,skewX:1,skewY:1,xPercent:1,yPercent:1},c="undefined"!=typeof window?window:e.defaultView||{getComputedStyle:function(){}},f=function(e,t,r){var n=(e._gsTransform||u)[t];return n||0===n?n:(e.style[t]?n=e.style[t]:(r=r||function(e){return c.getComputedStyle(e)}(e))?n=r[t]||r.getPropertyValue(t)||r.getPropertyValue(t.replace(s,"-$1").toLowerCase()):e.currentStyle&&(n=e.currentStyle[t]),parseFloat(n)||0)},h=a.ticker,d=function(e,t,r){this.p=e,this.f=t,this.v1=this.v2=0,this.t1=this.t2=h.time,this.css=!1,this.type="",this._prev=null,r&&((this._next=r)._prev=this)},r=function(){var e,t,r=o,n=h.time;if(.03<=n-i)for(i,i=n;r;){for(t=r._firstVP;t;)((e=t.css?f(r.target,t.p):t.f?r.target[t.p]():r.target[t.p])!==t.v1||.15":">")}},n=e.SplitText=i.SplitText=function(e,t){if("string"==typeof e&&(e=n.selector(e)),!e)throw"cannot split a null element.";this.elements=a(e)?function(e){var t,r,n,i=[],o=e.length;for(t=0;tP&&("BR"!==c.nodeName||0===s)&&(d=[],D.push(d),x=_),j&&(c._x=c.offsetLeft,c._y=_,c._w=c.offsetWidth,c._h=c.offsetHeight),D&&((c._isSplit&&h||!N&&h||L&&h||!L&&c.parentNode.parentNode===e&&!c.parentNode._isSplit)&&(d.push(c),c._x-=b,G(c,e,O)&&(c._wordEnd=!0)),"BR"===c.nodeName&&(c.nextSibling&&"BR"===c.nextSibling.nodeName||0===s)&&D.push([])));for(s=0;se.clientHeight&&(e.style.height=a-S+"px",e.clientHeighte.clientWidth&&(e.style.width=o-M+"px",e.clientWidth",b=!0,x=t.specialChars?"function"==typeof t.specialChars?t.specialChars:M:null,w=U.createElement("div"),T=e.parentNode;for(T.insertBefore(w,e),w.textContent=e.nodeValue,T.removeChild(e),c=-1!==(i=S(e=w)).indexOf("<"),!1!==t.reduceWhiteSpace&&(i=i.replace(C," ").replace(P,"")),c&&(i=i.split("<").join("{{LT}}")),u=i.length,o=(" "===i.charAt(0)?_:"")+r(),a=0;a":l,a+=d-1;else if(l===v&&i.charAt(a-1)!==v&&a){for(o+=b?y:"",b=!1;i.charAt(a+1)===v;)o+=_,a++;a===u-1?o+=_:")"!==i.charAt(a+1)&&(o+=_+r(),b=!0)}else"{"===l&&"{{LT}}"===i.substr(a,6)?(o+=g?n()+"{{LT}}":"{{LT}}",a+=5):55296<=l.charCodeAt(0)&&l.charCodeAt(0)<=56319||65024<=i.charCodeAt(a+1)&&i.charCodeAt(a+1)<=65039?(f=k(i.substr(a,2)),h=k(i.substr(a+2,2)),s=127462<=f&&f<=127487&&127462<=h&&h<=127487||127995<=h&&h<=127999?4:2,o+=g&&" "!==l?n()+i.substr(a,s)+"":i.substr(a,s),a+=s-1):o+=g&&" "!==l?n()+l+"":l;e.outerHTML=o+(b?y:""),c&&H(T,"{{LT}}","<")}(e,t,r,n)},h=n.prototype;h.split=function(e){this.isSplit&&this.revert(),this.vars=e=e||this.vars,this._originals.length=this.chars.length=this.words.length=this.lines.length=0;for(var t,r,n,i=this.elements.length,o=e.tag?e.tag:e.span?"span":"div",a=u(e.wordsClass,o),s=u(e.charsClass,o);-1<--i;)n=this.elements[i],this._originals[i]=n.innerHTML,t=n.clientHeight,r=n.clientWidth,f(n,e,a,s),c(n,e,this.chars,this.words,this.lines,r,t);return this.chars.reverse(),this.words.reverse(),this.lines.reverse(),this.isSplit=!0,this},h.revert=function(){if(!this._originals)throw"revert() call wasn't scoped properly.";for(var e=this._originals.length;-1<--e;)this.elements[e].innerHTML=this._originals[e];return this.chars=[],this.words=[],this.lines=[],this.isSplit=!1,this},n.selector=r.$||r.jQuery||function(e){var t=r.$||r.jQuery;return t?(n.selector=t)(e):"undefined"==typeof document?e:document.querySelectorAll?document.querySelectorAll(e):document.getElementById("#"===e.charAt(0)?e.substr(1):e)},n.version="0.7.0"}(_gsScope),function(e){"use strict";var t=function(){return(_gsScope.GreenSockGlobals||_gsScope).SplitText};"undefined"!=typeof module&&module.exports?module.exports=t():"function"==typeof define&&define.amd&&define([],t)}();var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("utils.Draggable",["events.EventDispatcher","TweenLite","plugins.CSSPlugin"],function(r,be,xe){var we,o,Te,S,p,g,M,P,e,t,n,i,a,Se={css:{},data:"_draggable"},Me={css:{},data:"_draggable"},Pe={css:{},data:"_draggable"},Ce={css:{}},ke=_gsScope._gsDefine.globals,s={},u=function(){return!1},l={style:{},appendChild:u,removeChild:u},Ee=_gsScope.document||{createElement:function(){return l}},Ae=Ee.documentElement||{},c=function(e){return Ee.createElementNS?Ee.createElementNS("http://www.w3.org/1999/xhtml",e):Ee.createElement(e)},f=c("div"),Oe=[],Re=180/Math.PI,Ie=999999999999999,De=Date.now||function(){return(new Date).getTime()},Le=!(Ee.addEventListener||!Ee.all),Ne=Ee.createElement("div"),je=[],Fe={},Be=0,h=/^(?:a|input|textarea|button|select)$/i,ze=0,Ue=_gsScope.navigator&&-1!==_gsScope.navigator.userAgent.toLowerCase().indexOf("android"),Xe=0,qe={},He={},Ye=function(e,t){var r,n={};if(t)for(r in e)n[r]=e[r]*t;else for(r in e)n[r]=e[r];return n},Ge=function(){for(var e=je.length;-1<--e;)je[e]()},We=function(e){for(var t=je.length;-1<--t;)je[t]===e&&je.splice(t,1);be.to(d,0,{overwrite:"all",delay:15,onComplete:d,data:"_draggable"})},d=function(){je.length||be.ticker.removeEventListener("tick",Ge)},C=function(){return null!=window.pageYOffset?window.pageYOffset:null!=Ee.scrollTop?Ee.scrollTop:Ae.scrollTop||Ee.body.scrollTop||0},k=function(){return null!=window.pageXOffset?window.pageXOffset:null!=Ee.scrollLeft?Ee.scrollLeft:Ae.scrollLeft||Ee.body.scrollLeft||0},Ve=function(e,t){lt(e,"scroll",t),Ze(e.parentNode)||Ve(e.parentNode,t)},Ke=function(e,t){ct(e,"scroll",t),Ze(e.parentNode)||Ke(e.parentNode,t)},Ze=function(e){return!(e&&e!==Ae&&e!==Ee&&e!==Ee.body&&e!==window&&e.nodeType&&e.parentNode)},m=function(e,t){var r="x"===t?"Width":"Height",n="scroll"+r,i="client"+r,o=Ee.body;return Math.max(0,Ze(e)?Math.max(Ae[n],o[n])-(window["inner"+r]||Ae[i]||o[i]):e[n]-e[i])},Je=function(e){var t=Ze(e),r=m(e,"x"),n=m(e,"y");t?e=He:Je(e.parentNode),e._gsMaxScrollX=r,e._gsMaxScrollY=n,e._gsScrollX=e.scrollLeft||0,e._gsScrollY=e.scrollTop||0},$e=function(e,t){return e=e||window.event,s.pageX=e.clientX+Ee.body.scrollLeft+Ae.scrollLeft,s.pageY=e.clientY+Ee.body.scrollTop+Ae.scrollTop,t&&(e.returnValue=!1),s},Qe=function(e){return e?("string"==typeof e&&(e=be.selector(e)),e.length&&e!==window&&e[0]&&e[0].style&&!e.nodeType&&(e=e[0]),e===window||e.nodeType&&e.style?e:null):e},v=function(e,t){var r,n,i,o=e.style;if(void 0===o[t]){for(i=["O","Moz","ms","Ms","Webkit"],n=5,r=t.charAt(0).toUpperCase()+t.substr(1);-1<--n&&void 0===o[i[n]+r];);if(n<0)return"";t=(3===n?"ms":i[n])+r}return t},et=function(e,t,r){var n=e.style;n&&(void 0===n[t]&&(t=v(e,t)),null==r?n.removeProperty?n.removeProperty(t.replace(/([A-Z])/g,"-$1").toLowerCase()):n.removeAttribute(t):void 0!==n[t]&&(n[t]=r))},_="undefined"!=typeof window?window:Ee.defaultView||{getComputedStyle:function(){}},E=function(e,t){return _.getComputedStyle(e instanceof Element?e:e.host||(e.parentNode||{}).host||e,t)},y=/(?:Left|Right|Width)/i,b=/(?:\d|\-|\+|=|#|\.)*/g,x=function(e,t,r,n,i){if("px"===n||!n)return r;if("auto"===n||!r)return 0;var o,a=y.test(t),s=e,u=f.style,l=r<0;return l&&(r=-r),"%"===n&&-1!==t.indexOf("border")?o=r/100*(a?e.clientWidth:e.clientHeight):(u.cssText="border:0 solid red;position:"+tt(e,"position",!0)+";line-height:0;","%"!==n&&s.appendChild?u[a?"borderLeftWidth":"borderTopWidth"]=r+n:(s=e.parentNode||Ee.body,u[a?"width":"height"]=r+n),s.appendChild(f),o=parseFloat(f[a?"offsetWidth":"offsetHeight"]),s.removeChild(f),0!==o||i||(o=x(e,t,r,n,!0))),l?-o:o},tt=function(e,t,r){var n,i=(e._gsTransform||{})[t];return i||0===i?i:(e.style&&e.style[t]?i=e.style[t]:(n=E(e))?i=(i=n.getPropertyValue(t.replace(/([A-Z])/g,"-$1").toLowerCase()))||n.length?i:n[t]:e.currentStyle&&(i=e.currentStyle[t]),"auto"!==i||"top"!==t&&"left"!==t||(i=function(e,t){if("absolute"!==tt(e,"position",!0))return 0;var r="left"===t?"Left":"Top",n=tt(e,"margin"+r,!0);return e["offset"+r]-(x(e,t,parseFloat(n),(n+"").replace(b,""))||0)}(e,t)),r?i:parseFloat(i)||0)},rt=function(e,t,r){var n=e.vars,i=n[r],o=e._listeners[t];"function"==typeof i&&i.apply(n[r+"Scope"]||n.callbackScope||e,n[r+"Params"]||[e.pointerEvent]),o&&e.dispatchEvent(t)},nt=function(e,t){var r,n,i,o=Qe(e);return o?q(o,t):void 0!==e.left?(i=ot(t),{left:e.left-i.x,top:e.top-i.y,width:e.width,height:e.height}):{left:n=e.min||e.minX||e.minRotation||0,top:r=e.min||e.minY||0,width:(e.max||e.maxX||e.maxRotation||0)-n,height:(e.max||e.maxY||0)-r}},A=function(){if(!Ee.createElementNS)return S=0,void(p=!1);var e,t,r,n,i=c("div"),o=Ee.createElementNS("http://www.w3.org/2000/svg","svg"),a=c("div"),s=i.style,u=Ee.body||Ae,l="flex"===tt(u,"display",!0);Ee.body&&O&&(s.position="absolute",u.appendChild(a),a.appendChild(i),n=i.offsetParent,a.style[O]="rotate(1deg)",P=i.offsetParent===n,a.style.position="absolute",s.height="10px",n=i.offsetTop,a.style.border="5px solid red",M=n!==i.offsetTop,u.removeChild(a)),s=o.style,o.setAttributeNS(null,"width","400px"),o.setAttributeNS(null,"height","400px"),o.setAttributeNS(null,"viewBox","0 0 400 400"),s.display="block",s.boxSizing="border-box",s.border="0px solid red",s.transform="none",i.style.cssText="width:100px;height:100px;overflow:scroll;-ms-overflow-style:none;",u.appendChild(i),i.appendChild(o),t=(r=o.createSVGPoint().matrixTransform(o.getScreenCTM())).y,i.scrollTop=100,r.x=r.y=0,r=r.matrixTransform(o.getScreenCTM()),g=t-r.y<100.1?0:t-r.y-150,i.removeChild(o),u.removeChild(i),u.appendChild(o),l&&(u.style.display="block"),t=(e=o.getScreenCTM()).e,s.border="50px solid red",e=o.getScreenCTM(),p=0===t&&0===e.e&&0===e.f&&1===e.a?(S=1,!0):(S=t!==e.e?1:0,1!==e.a),l&&(u.style.display="flex"),u.removeChild(o)},w=""!==v(f,"perspective"),T=v(f,"transformOrigin").replace(/^ms/g,"Ms").replace(/([A-Z])/g,"-$1").toLowerCase(),O=v(f,"transform"),R=O.replace(/^ms/g,"Ms").replace(/([A-Z])/g,"-$1").toLowerCase(),I={},D={},L=_gsScope.SVGElement,it=function(e){return!!(L&&"function"==typeof e.getBBox&&e.getCTM&&(!e.parentNode||e.parentNode.getBBox&&e.parentNode.getCTM))},N=_gsScope.navigator&&(/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(_gsScope.navigator.userAgent)||/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(_gsScope.navigator.userAgent))&&parseFloat(RegExp.$1)<11,j=[],F=[],B=function(e){if(!e.getBoundingClientRect||!e.parentNode||!O)return{offsetTop:0,offsetLeft:0,scaleX:1,scaleY:1,offsetParent:Ae};if(!1!==mt.cacheSVGData&&e._dCache&&e._dCache.lastUpdate===be.ticker.frame)return e._dCache;var t,r,n,i,o,a,s,u,l,c,f,h=e,d=z(e);if(d.lastUpdate=be.ticker.frame,e.getBBox&&!d.isSVGRoot){for(h=e.parentNode,t=e.getBBox();h&&"svg"!==(h.nodeName+"").toLowerCase();)h=h.parentNode;return i=B(h),d.offsetTop=t.y*i.scaleY,d.offsetLeft=t.x*i.scaleX,d.scaleX=i.scaleX,d.scaleY=i.scaleY,d.offsetParent=h||Ae,d}for((n=d.offsetParent)===Ee.body&&(n=Ae),F.length=j.length=0;h&&h.parentNode;)"matrix(1, 0, 0, 1, 0, 0)"!==(o=tt(h,O,!0))&&"none"!==o&&"translate3d(0px, 0px, 0px)"!==o&&(F.push(h),j.push(h.style[O]),h.style[O]="none"),h=h.parentNode;for(r=n.getBoundingClientRect(),o=e.getScreenCTM(),s=e.createSVGPoint().matrixTransform(o),d.scaleX=Math.sqrt(o.a*o.a+o.b*o.b),d.scaleY=Math.sqrt(o.d*o.d+o.c*o.c),void 0===S&&A(),d.borderBox&&!p&&e.getAttribute("width")&&(i=E(e)||{},u=parseFloat(i.borderLeftWidth)+parseFloat(i.borderRightWidth)||0,l=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth)||0,c=parseFloat(i.width)||0,f=parseFloat(i.height)||0,d.scaleX*=(c-u)/c,d.scaleY*=(f-l)/f),g?(t=e.getBoundingClientRect(),d.offsetLeft=t.left-r.left,d.offsetTop=t.top-r.top):(d.offsetLeft=s.x-r.left,d.offsetTop=s.y-r.top),d.offsetParent=n,a=F.length;-1<--a;)F[a].style[O]=j[a];return d},ot=function(e,t){if(t=t||{},!e||e===Ae||!e.parentNode||e===window)return{x:0,y:0};var r=E(e),n=T&&r?r.getPropertyValue(T):"50% 50%",i=n.split(" "),o=-1!==n.indexOf("left")?"0%":-1!==n.indexOf("right")?"100%":i[0],a=-1!==n.indexOf("top")?"0%":-1!==n.indexOf("bottom")?"100%":i[1];return"center"!==a&&null!=a||(a="50%"),("center"===o||isNaN(parseFloat(o)))&&(o="50%"),e.getBBox&&it(e)?(e._gsTransform||(be.set(e,{x:"+=0",overwrite:!1}),void 0===e._gsTransform.xOrigin&&console.log("Draggable requires at least GSAP 1.17.0")),n=e.getBBox(),t.x=e._gsTransform.xOrigin-n.x,t.y=e._gsTransform.yOrigin-n.y):(e.getBBox&&-1!==(o+a).indexOf("%")&&(e={offsetWidth:(e=e.getBBox()).width,offsetHeight:e.height}),t.x=-1!==o.indexOf("%")?e.offsetWidth*parseFloat(o)/100:parseFloat(o),t.y=-1!==a.indexOf("%")?e.offsetHeight*parseFloat(a)/100:parseFloat(a)),t},z=function(e){if(!1!==mt.cacheSVGData&&e._dCache&&e._dCache.lastUpdate===be.ticker.frame)return e._dCache;var t,r=e._dCache=e._dCache||{},n=E(e),i=e.getBBox&&it(e),o="svg"===(e.nodeName+"").toLowerCase();if(r.isSVG=i,r.isSVGRoot=o,r.borderBox="border-box"===n.boxSizing,r.computedStyle=n,o)(t=e.parentNode||Ae).insertBefore(f,e),r.offsetParent=f.offsetParent||Ae,t.removeChild(f);else if(i){for(t=e.parentNode;t&&"svg"!==(t.nodeName+"").toLowerCase();)t=t.parentNode;r.offsetParent=t}else r.offsetParent=e.offsetParent;return r},U=function(e,t,r,n,i){if(e===window||!e||!e.style||!e.parentNode)return[1,0,0,1,0,0];var o,a,s,u,l,c,f,h,d,p,g,m,v,_,y=e._dCache||z(e),b=e.parentNode,x=b._dCache||z(b),w=y.computedStyle,T=y.isSVG?x.offsetParent:b.offsetParent;if(o=y.isSVG&&-1!==(e.style[O]+"").indexOf("matrix")?e.style[O]:w?w.getPropertyValue(R):e.currentStyle?e.currentStyle[O]:"1,0,0,1,0,0",e.getBBox&&-1!==(e.getAttribute("transform")+"").indexOf("matrix")&&(o=e.getAttribute("transform")),6<(o=(o+"").match(/(?:\-|\.|\b)(\d|\.|e\-)+/g)||[1,0,0,1,0,0]).length&&(o=[o[0],o[1],o[4],o[5],o[12],o[13]]),n?o[4]=o[5]=0:y.isSVG&&(l=e._gsTransform)&&(l.xOrigin||l.yOrigin)&&(o[0]=parseFloat(o[0]),o[1]=parseFloat(o[1]),o[2]=parseFloat(o[2]),o[3]=parseFloat(o[3]),o[4]=parseFloat(o[4])-(l.xOrigin-(l.xOrigin*o[0]+l.yOrigin*o[2])),o[5]=parseFloat(o[5])-(l.yOrigin-(l.xOrigin*o[1]+l.yOrigin*o[3]))),t)if(void 0===S&&A(),s=y.isSVG||y.isSVGRoot?B(e):e,y.isSVG?(u=e.getBBox(),p=x.isSVGRoot?{x:0,y:0}:b.getBBox(),s={offsetLeft:u.x-p.x,offsetTop:u.y-p.y,offsetParent:y.offsetParent}):y.isSVGRoot?(g=parseInt(w.borderTopWidth,10)||0,m=parseInt(w.borderLeftWidth,10)||0,v=(o[0]-S)*m+o[2]*g,_=o[1]*m+(o[3]-S)*g,c=t.x,f=t.y,h=c-(c*o[0]+f*o[2]),d=f-(c*o[1]+f*o[3]),o[4]=parseFloat(o[4])+h,o[5]=parseFloat(o[5])+d,t.x-=h,t.y-=d,c=s.scaleX,f=s.scaleY,i||(t.x*=c,t.y*=f),o[0]*=c,o[1]*=f,o[2]*=c,o[3]*=f,N||(t.x+=v,t.y+=_),T===Ee.body&&s.offsetParent===Ae&&(T=Ae)):!M&&e.offsetParent&&(t.x+=parseInt(tt(e.offsetParent,"borderLeftWidth"),10)||0,t.y+=parseInt(tt(e.offsetParent,"borderTopWidth"),10)||0),a=b===Ae||b===Ee.body,o[4]=Number(o[4])+t.x+(s.offsetLeft||0)-r.x-(a?0:b.scrollLeft||0),o[5]=Number(o[5])+t.y+(s.offsetTop||0)-r.y-(a?0:b.scrollTop||0),b&&"fixed"===tt(e,"position",!0))for(o[4]+=k(),o[5]+=C(),b=b.offsetParent;b;)o[4]-=b.offsetLeft,o[5]-=b.offsetTop,b=b.offsetParent;else!b||b===Ae||T!==s.offsetParent||x.isSVG||P&&"100100"!==U(b).join("")||(s=x.isSVGRoot?B(b):b,o[4]-=s.offsetLeft||0,o[5]-=s.offsetTop||0,M||!x.offsetParent||y.isSVG||y.isSVGRoot||(o[4]-=parseInt(tt(x.offsetParent,"borderLeftWidth"),10)||0,o[5]-=parseInt(tt(x.offsetParent,"borderTopWidth"),10)||0));return o},at=function(e,t){if(!e||e===window||!e.parentNode)return[1,0,0,1,0,0];for(var r,n,i,o,a,s,u,l,c=ot(e,I),f=ot(e.parentNode,D),h=U(e,c,f,!1,!t);(e=e.parentNode)&&e.parentNode&&e!==Ae;)c=f,f=ot(e.parentNode,c===I?D:I),u=U(e,c,f),r=h[0],n=h[1],i=h[2],o=h[3],a=h[4],s=h[5],h[0]=r*u[0]+n*u[2],h[1]=r*u[1]+n*u[3],h[2]=i*u[0]+o*u[2],h[3]=i*u[1]+o*u[3],h[4]=a*u[0]+s*u[2]+u[4],h[5]=a*u[1]+s*u[3]+u[5];return t&&(r=h[0],n=h[1],i=h[2],o=h[3],a=h[4],s=h[5],l=r*o-n*i,h[0]=o/l,h[1]=-n/l,h[2]=-i/l,h[3]=r/l,h[4]=(i*s-o*a)/l,h[5]=-(r*s-n*a)/l),h},X=function(e,t,r){var n=e.x*t[0]+e.y*t[2]+t[4],i=e.x*t[1]+e.y*t[3]+t[5];return e.x=n*r[0]+i*r[2]+r[4],e.y=n*r[1]+i*r[3]+r[5],e},q=function(e,t,r){if(!(e=Qe(e)))return null;t=Qe(t);var n,i,o,a,s,u,l,c,f,h,d,p,g,m,v,_,y,b,x,w,T,S,M=e.getBBox&&it(e);if(e===window)a=C(),o=(i=k())+(Ae.clientWidth||e.innerWidth||Ee.body.clientWidth||0),s=a+((e.innerHeight||0)-20t.scrollHeight,a.removeChild(t),e),gt=function(i,o){i=Qe(i),o=o||{};var a,s,u,e,l,c,f=Ee.createElement("div"),h=f.style,t=i.firstChild,d=0,p=0,g=i.scrollTop,m=i.scrollLeft,v=i.scrollWidth,_=i.scrollHeight,y=0,b=0,x=0;w&&!1!==o.force3D?(l="translate3d(",c="px,0px)"):O&&(l="translate(",c="px)"),this.scrollTop=function(e,t){if(!arguments.length)return-this.top();this.top(-e,t)},this.scrollLeft=function(e,t){if(!arguments.length)return-this.left();this.left(-e,t)},this.left=function(e,t){if(!arguments.length)return-(i.scrollLeft+p);var r=i.scrollLeft-m,n=p;if((2n.bottom-Q&&u?(Z=!0,s=Math.min(u,c*(1-Math.max(0,n.bottom-o)/Q)|0)):on.right-$&&u?(Z=!0,a=Math.min(u,c*(1-Math.max(0,n.right-i)/$)|0)):iG?(W.y=o,c+(v-o)*u):c):(I&&(s=e*I[0]+t*I[2]+I[4],t=e*I[1]+t*I[3]+I[5],e=s),(n=t-m)Math.abs(n)?"y":Y?"x":null,s&&"function"==typeof W.vars.onLockAxis&&W.vars.onLockAxis.call(W,W.pointerEvent)),"y"===s?n=0:"x"===s&&(r=0)),i=c+r*u,o=v+n*u),(k||E||A)&&(W.x!==i||W.y!==o&&!U)?(A&&(qe.x=i,qe.y=o,i=(s=A(qe)).x,o=s.y),k&&(i=k(i)),E&&(o=E(o))):_&&(bo._gsMaxScrollY&&(o.scrollTop=o._gsMaxScrollY),H&&o.scrollLeft>o._gsMaxScrollX&&(o.scrollLeft=o._gsMaxScrollX),i=o;W.isThrowing&&(n||W.endX>b||W.endXw||W.endYa.right||s.righta.bottom||s.bottom=a.width*a.height*r||i>=s.width*s.height*r):n.width>r&&n.height>r))},Ne.style.cssText="visibility:hidden;height:1px;top:-1px;pointer-events:none;position:relative;clear:both;",mt},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(e){"use strict";var t=function(){return(_gsScope.GreenSockGlobals||_gsScope).Draggable};"undefined"!=typeof module&&module.exports?(require("../TweenLite.js"),require("../plugins/CSSPlugin.js"),module.exports=t()):"function"==typeof define&&define.amd&&define(["TweenLite","CSSPlugin"],t)}();var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("GSDevTools",["TweenLite","core.Animation","core.SimpleTimeline","TimelineLite","utils.Draggable","plugins.CSSPlugin"],function(ue,le,a,ce,fe){var he,s,de,u,pe,i=document,ge=i.documentElement,o="http://www.w3.org/2000/svg",l="http://www.w3.org/1999/xhtml",me=0,ve={},_e=function(e,t,r){var n=i.createElementNS?i.createElementNS("svg"===e?o:l,e):i.createElement(e);return t&&("string"==typeof t&&(t=i.querySelector(t)),t.appendChild(n)),"svg"===e&&(n.setAttribute("xmlns",o),n.setAttribute("xmlns:xlink",l)),r&&(n.style.cssText=r),n},ye=function(){i.selection?i.selection.empty():window.getSelection&&window.getSelection().removeAllRanges()},c=le._rootTimeline,be=function(e,t){for(var r=[],n=0,i=e._first;i;)i instanceof ue?i.vars.id&&(r[n++]=i):(t&&i.vars.id&&(r[n++]=i),n=(r=r.concat(be(i,t))).length),i=i._next;return r},xe=function(e,t){var r=0,n=Math.max(0,e._repeat),i=e._first;for(i||(r=e.duration());i;)r=Math.max(r,999v._duration&&(e=v._duration),g||v.time(e),w.style.width=Math.min(O-A,Math.max(0,e/v._duration*100-A))+"%",T.innerHTML=e.toFixed(2)},onRelease:function(e){F||v.resume()}})[0],C=t(".in-point"),k=t(".out-point"),E=function(){A=0,O=100,C.style.left="0%",k.style.left="100%",_("in",A),_("out",O),D(!0)},A=0,O=100,R=fe.create(C,{type:"x",cursor:"ew-resize",zIndexBoost:!1,allowNativeTouchScrolling:!1,allowEventDefault:!0,onPress:r(C,1,!0),onDoubleClick:E,onDrag:function(){A=(d+h*this.x)/v.duration()*100,v.progress(A/100),D(!0)},onRelease:function(){A<0&&(A=0),ye(),C.style.left=A+"%",_("in",A),ue.set(C,{x:0,data:"root",display:"block"}),F||v.resume()}})[0],I=fe.create(k,{type:"x",cursor:"ew-resize",allowNativeTouchScrolling:!1,allowEventDefault:!0,zIndexBoost:!1,onPress:r(k,0,!0),onDoubleClick:E,onDrag:function(){O=(d+h*this.x)/v.duration()*100,v.progress(O/100),D(!0)},onRelease:function(){100a.duration();100=O/100&&(v.target===a&&v.target.seek(u+(l-u)*A/100),v._repeat&&!A?v.totalProgress(0,!0):v.progress(A/100,!0)),j.play(),v.resume(),F&&f.update(),F=!1},z=function(){j.reverse(),v&&v.pause(),F=!0},U=function(){F?B():z()},X=function(e){P.isPressed||(v.target===a&&v.target.seek(u+(l-u)*A/100),v.progress(A/100,!0),F||v.resume())},q=t(".loop"),H=function(e){var t=new ce({data:"root",paused:!0,onComplete:function(){t.kill()}});return t.to(e,.5,{rotation:360,ease:Power3.easeInOut,transformOrigin:"50% 50%"}).to(e.querySelectorAll(".loop-path"),.5,{fill:"#91e600",ease:Linear.easeNone},0),t}(q),Y=function(e){_("loop",i=e),i?(H.play(),v.progress()>=O/100&&(v.target===a&&v.target.seek(u+(l-u)*A/100),a._repeat&&!A&&100===O?v.totalProgress(0,!0):v.progress(A/100,!0),B())):H.reverse()},G=function(){Y(!i)},W=t(".animation-list"),V=t(".animation-label"),K=function(){var e,t,r=be(s&&!1===o.globalSync?s:ke,!0),n=W.children,i=0;for(s&&!1===o.globalSync?r.unshift(s):o.hideGlobalTimeline||r.unshift(ke),t=0;t=O/100?(v.target===a&&v.target.seek(u+(l-u)*A/100),v.progress(A/100,!0).pause()):v.pause(),ue.delayedCall(.01,function(){v.resume()})),Q.innerHTML=t+"x",$.blur&&$.blur()},te=ue.to([t(".gs-bottom"),t(".gs-top")],.3,{autoAlpha:0,y:50,ease:Power2.easeIn,data:"root",paused:!0}),re=!1,ne=function(e){fe.hitTest(e,n)||P.isDragging||R.isDragging||I.isDragging||ae.restart(!0)},ie=function(){re||(te.play(),ae.pause(),re=!0)},oe=function(){ae.pause(),re&&(te.reverse(),re=!1)},ae=ue.delayedCall(1.3,ie).pause(),se=function(e){Re&&!Ie&&(Ie=ke._startTime),c=!e,(s=we(o.animation))&&!s.vars.id&&(s.vars.id="[no id]"),K();var t=we(y("animation"));t&&(t._inProgress=y("in")||0,t._outProgress=y("out")||100),o.paused&&z(),a=null,Z(s||t||ke);var r=o.timeScale||y("timeScale"),n=t===a;r&&(Pe($,r,Q,r+"x"),v.timeScale(r)),100===(A=("inTime"in o?Te(o.inTime,a,0,0):n?t._inProgress:0)||0)&&!o.animation&&t&&(Z(ke),A=Te(o.inTime,a,0,0)||0),A&&(C.style.left=A+"%",C.style.display=k.style.display="block"),(O=("outTime"in o?Te(o.outTime,a,100,A):n?t._outProgress:0)||100)this.duration()&&(this._time=this._duration,this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},ue.onOverwrite=function(e,t,r,n){p.logOverwrites&&(n?console.log("[Overwrite warning] the following properties were overwritten: ",n,"| target:",r,"| overwritten tween: ",e,"| overwriting tween:",t):console.log("[Overwrite warning] the following tween was overwritten:",e,"by",t)),"function"==typeof g&&g(e,t,r,n)},p.create=function(e){return new p(e)},p},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()();var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("utils.Draggable",["events.EventDispatcher","TweenLite","plugins.CSSPlugin"],function(r,be,xe){var we,o,Te,S,p,g,M,P,e,t,n,i,a,Se={css:{},data:"_draggable"},Me={css:{},data:"_draggable"},Pe={css:{},data:"_draggable"},Ce={css:{}},ke=_gsScope._gsDefine.globals,s={},u=function(){return!1},l={style:{},appendChild:u,removeChild:u},Ee=_gsScope.document||{createElement:function(){return l}},Ae=Ee.documentElement||{},c=function(e){return Ee.createElementNS?Ee.createElementNS("http://www.w3.org/1999/xhtml",e):Ee.createElement(e)},f=c("div"),Oe=[],Re=180/Math.PI,Ie=999999999999999,De=Date.now||function(){return(new Date).getTime()},Le=!(Ee.addEventListener||!Ee.all),Ne=Ee.createElement("div"),je=[],Fe={},Be=0,h=/^(?:a|input|textarea|button|select)$/i,ze=0,Ue=_gsScope.navigator&&-1!==_gsScope.navigator.userAgent.toLowerCase().indexOf("android"),Xe=0,qe={},He={},Ye=function(e,t){var r,n={};if(t)for(r in e)n[r]=e[r]*t;else for(r in e)n[r]=e[r];return n},Ge=function(){for(var e=je.length;-1<--e;)je[e]()},We=function(e){for(var t=je.length;-1<--t;)je[t]===e&&je.splice(t,1);be.to(d,0,{overwrite:"all",delay:15,onComplete:d,data:"_draggable"})},d=function(){je.length||be.ticker.removeEventListener("tick",Ge)},C=function(){return null!=window.pageYOffset?window.pageYOffset:null!=Ee.scrollTop?Ee.scrollTop:Ae.scrollTop||Ee.body.scrollTop||0},k=function(){return null!=window.pageXOffset?window.pageXOffset:null!=Ee.scrollLeft?Ee.scrollLeft:Ae.scrollLeft||Ee.body.scrollLeft||0},Ve=function(e,t){lt(e,"scroll",t),Ze(e.parentNode)||Ve(e.parentNode,t)},Ke=function(e,t){ct(e,"scroll",t),Ze(e.parentNode)||Ke(e.parentNode,t)},Ze=function(e){return!(e&&e!==Ae&&e!==Ee&&e!==Ee.body&&e!==window&&e.nodeType&&e.parentNode)},m=function(e,t){var r="x"===t?"Width":"Height",n="scroll"+r,i="client"+r,o=Ee.body;return Math.max(0,Ze(e)?Math.max(Ae[n],o[n])-(window["inner"+r]||Ae[i]||o[i]):e[n]-e[i])},Je=function(e){var t=Ze(e),r=m(e,"x"),n=m(e,"y");t?e=He:Je(e.parentNode),e._gsMaxScrollX=r,e._gsMaxScrollY=n,e._gsScrollX=e.scrollLeft||0,e._gsScrollY=e.scrollTop||0},$e=function(e,t){return e=e||window.event,s.pageX=e.clientX+Ee.body.scrollLeft+Ae.scrollLeft,s.pageY=e.clientY+Ee.body.scrollTop+Ae.scrollTop,t&&(e.returnValue=!1),s},Qe=function(e){return e?("string"==typeof e&&(e=be.selector(e)),e.length&&e!==window&&e[0]&&e[0].style&&!e.nodeType&&(e=e[0]),e===window||e.nodeType&&e.style?e:null):e},v=function(e,t){var r,n,i,o=e.style;if(void 0===o[t]){for(i=["O","Moz","ms","Ms","Webkit"],n=5,r=t.charAt(0).toUpperCase()+t.substr(1);-1<--n&&void 0===o[i[n]+r];);if(n<0)return"";t=(3===n?"ms":i[n])+r}return t},et=function(e,t,r){var n=e.style;n&&(void 0===n[t]&&(t=v(e,t)),null==r?n.removeProperty?n.removeProperty(t.replace(/([A-Z])/g,"-$1").toLowerCase()):n.removeAttribute(t):void 0!==n[t]&&(n[t]=r))},_="undefined"!=typeof window?window:Ee.defaultView||{getComputedStyle:function(){}},E=function(e,t){return _.getComputedStyle(e instanceof Element?e:e.host||(e.parentNode||{}).host||e,t)},y=/(?:Left|Right|Width)/i,b=/(?:\d|\-|\+|=|#|\.)*/g,x=function(e,t,r,n,i){if("px"===n||!n)return r;if("auto"===n||!r)return 0;var o,a=y.test(t),s=e,u=f.style,l=r<0;return l&&(r=-r),"%"===n&&-1!==t.indexOf("border")?o=r/100*(a?e.clientWidth:e.clientHeight):(u.cssText="border:0 solid red;position:"+tt(e,"position",!0)+";line-height:0;","%"!==n&&s.appendChild?u[a?"borderLeftWidth":"borderTopWidth"]=r+n:(s=e.parentNode||Ee.body,u[a?"width":"height"]=r+n),s.appendChild(f),o=parseFloat(f[a?"offsetWidth":"offsetHeight"]),s.removeChild(f),0!==o||i||(o=x(e,t,r,n,!0))),l?-o:o},tt=function(e,t,r){var n,i=(e._gsTransform||{})[t];return i||0===i?i:(e.style&&e.style[t]?i=e.style[t]:(n=E(e))?i=(i=n.getPropertyValue(t.replace(/([A-Z])/g,"-$1").toLowerCase()))||n.length?i:n[t]:e.currentStyle&&(i=e.currentStyle[t]),"auto"!==i||"top"!==t&&"left"!==t||(i=function(e,t){if("absolute"!==tt(e,"position",!0))return 0;var r="left"===t?"Left":"Top",n=tt(e,"margin"+r,!0);return e["offset"+r]-(x(e,t,parseFloat(n),(n+"").replace(b,""))||0)}(e,t)),r?i:parseFloat(i)||0)},rt=function(e,t,r){var n=e.vars,i=n[r],o=e._listeners[t];"function"==typeof i&&i.apply(n[r+"Scope"]||n.callbackScope||e,n[r+"Params"]||[e.pointerEvent]),o&&e.dispatchEvent(t)},nt=function(e,t){var r,n,i,o=Qe(e);return o?q(o,t):void 0!==e.left?(i=ot(t),{left:e.left-i.x,top:e.top-i.y,width:e.width,height:e.height}):{left:n=e.min||e.minX||e.minRotation||0,top:r=e.min||e.minY||0,width:(e.max||e.maxX||e.maxRotation||0)-n,height:(e.max||e.maxY||0)-r}},A=function(){if(!Ee.createElementNS)return S=0,void(p=!1);var e,t,r,n,i=c("div"),o=Ee.createElementNS("http://www.w3.org/2000/svg","svg"),a=c("div"),s=i.style,u=Ee.body||Ae,l="flex"===tt(u,"display",!0);Ee.body&&O&&(s.position="absolute",u.appendChild(a),a.appendChild(i),n=i.offsetParent,a.style[O]="rotate(1deg)",P=i.offsetParent===n,a.style.position="absolute",s.height="10px",n=i.offsetTop,a.style.border="5px solid red",M=n!==i.offsetTop,u.removeChild(a)),s=o.style,o.setAttributeNS(null,"width","400px"),o.setAttributeNS(null,"height","400px"),o.setAttributeNS(null,"viewBox","0 0 400 400"),s.display="block",s.boxSizing="border-box",s.border="0px solid red",s.transform="none",i.style.cssText="width:100px;height:100px;overflow:scroll;-ms-overflow-style:none;",u.appendChild(i),i.appendChild(o),t=(r=o.createSVGPoint().matrixTransform(o.getScreenCTM())).y,i.scrollTop=100,r.x=r.y=0,r=r.matrixTransform(o.getScreenCTM()),g=t-r.y<100.1?0:t-r.y-150,i.removeChild(o),u.removeChild(i),u.appendChild(o),l&&(u.style.display="block"),t=(e=o.getScreenCTM()).e,s.border="50px solid red",e=o.getScreenCTM(),p=0===t&&0===e.e&&0===e.f&&1===e.a?(S=1,!0):(S=t!==e.e?1:0,1!==e.a),l&&(u.style.display="flex"),u.removeChild(o)},w=""!==v(f,"perspective"),T=v(f,"transformOrigin").replace(/^ms/g,"Ms").replace(/([A-Z])/g,"-$1").toLowerCase(),O=v(f,"transform"),R=O.replace(/^ms/g,"Ms").replace(/([A-Z])/g,"-$1").toLowerCase(),I={},D={},L=_gsScope.SVGElement,it=function(e){return!!(L&&"function"==typeof e.getBBox&&e.getCTM&&(!e.parentNode||e.parentNode.getBBox&&e.parentNode.getCTM))},N=_gsScope.navigator&&(/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(_gsScope.navigator.userAgent)||/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(_gsScope.navigator.userAgent))&&parseFloat(RegExp.$1)<11,j=[],F=[],B=function(e){if(!e.getBoundingClientRect||!e.parentNode||!O)return{offsetTop:0,offsetLeft:0,scaleX:1,scaleY:1,offsetParent:Ae};if(!1!==mt.cacheSVGData&&e._dCache&&e._dCache.lastUpdate===be.ticker.frame)return e._dCache;var t,r,n,i,o,a,s,u,l,c,f,h=e,d=z(e);if(d.lastUpdate=be.ticker.frame,e.getBBox&&!d.isSVGRoot){for(h=e.parentNode,t=e.getBBox();h&&"svg"!==(h.nodeName+"").toLowerCase();)h=h.parentNode;return i=B(h),d.offsetTop=t.y*i.scaleY,d.offsetLeft=t.x*i.scaleX,d.scaleX=i.scaleX,d.scaleY=i.scaleY,d.offsetParent=h||Ae,d}for((n=d.offsetParent)===Ee.body&&(n=Ae),F.length=j.length=0;h&&h.parentNode;)"matrix(1, 0, 0, 1, 0, 0)"!==(o=tt(h,O,!0))&&"none"!==o&&"translate3d(0px, 0px, 0px)"!==o&&(F.push(h),j.push(h.style[O]),h.style[O]="none"),h=h.parentNode;for(r=n.getBoundingClientRect(),o=e.getScreenCTM(),s=e.createSVGPoint().matrixTransform(o),d.scaleX=Math.sqrt(o.a*o.a+o.b*o.b),d.scaleY=Math.sqrt(o.d*o.d+o.c*o.c),void 0===S&&A(),d.borderBox&&!p&&e.getAttribute("width")&&(i=E(e)||{},u=parseFloat(i.borderLeftWidth)+parseFloat(i.borderRightWidth)||0,l=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth)||0,c=parseFloat(i.width)||0,f=parseFloat(i.height)||0,d.scaleX*=(c-u)/c,d.scaleY*=(f-l)/f),g?(t=e.getBoundingClientRect(),d.offsetLeft=t.left-r.left,d.offsetTop=t.top-r.top):(d.offsetLeft=s.x-r.left,d.offsetTop=s.y-r.top),d.offsetParent=n,a=F.length;-1<--a;)F[a].style[O]=j[a];return d},ot=function(e,t){if(t=t||{},!e||e===Ae||!e.parentNode||e===window)return{x:0,y:0};var r=E(e),n=T&&r?r.getPropertyValue(T):"50% 50%",i=n.split(" "),o=-1!==n.indexOf("left")?"0%":-1!==n.indexOf("right")?"100%":i[0],a=-1!==n.indexOf("top")?"0%":-1!==n.indexOf("bottom")?"100%":i[1];return"center"!==a&&null!=a||(a="50%"),("center"===o||isNaN(parseFloat(o)))&&(o="50%"),e.getBBox&&it(e)?(e._gsTransform||(be.set(e,{x:"+=0",overwrite:!1}),void 0===e._gsTransform.xOrigin&&console.log("Draggable requires at least GSAP 1.17.0")),n=e.getBBox(),t.x=e._gsTransform.xOrigin-n.x,t.y=e._gsTransform.yOrigin-n.y):(e.getBBox&&-1!==(o+a).indexOf("%")&&(e={offsetWidth:(e=e.getBBox()).width,offsetHeight:e.height}),t.x=-1!==o.indexOf("%")?e.offsetWidth*parseFloat(o)/100:parseFloat(o),t.y=-1!==a.indexOf("%")?e.offsetHeight*parseFloat(a)/100:parseFloat(a)),t},z=function(e){if(!1!==mt.cacheSVGData&&e._dCache&&e._dCache.lastUpdate===be.ticker.frame)return e._dCache;var t,r=e._dCache=e._dCache||{},n=E(e),i=e.getBBox&&it(e),o="svg"===(e.nodeName+"").toLowerCase();if(r.isSVG=i,r.isSVGRoot=o,r.borderBox="border-box"===n.boxSizing,r.computedStyle=n,o)(t=e.parentNode||Ae).insertBefore(f,e),r.offsetParent=f.offsetParent||Ae,t.removeChild(f);else if(i){for(t=e.parentNode;t&&"svg"!==(t.nodeName+"").toLowerCase();)t=t.parentNode;r.offsetParent=t}else r.offsetParent=e.offsetParent;return r},U=function(e,t,r,n,i){if(e===window||!e||!e.style||!e.parentNode)return[1,0,0,1,0,0];var o,a,s,u,l,c,f,h,d,p,g,m,v,_,y=e._dCache||z(e),b=e.parentNode,x=b._dCache||z(b),w=y.computedStyle,T=y.isSVG?x.offsetParent:b.offsetParent;if(o=y.isSVG&&-1!==(e.style[O]+"").indexOf("matrix")?e.style[O]:w?w.getPropertyValue(R):e.currentStyle?e.currentStyle[O]:"1,0,0,1,0,0",e.getBBox&&-1!==(e.getAttribute("transform")+"").indexOf("matrix")&&(o=e.getAttribute("transform")),6<(o=(o+"").match(/(?:\-|\.|\b)(\d|\.|e\-)+/g)||[1,0,0,1,0,0]).length&&(o=[o[0],o[1],o[4],o[5],o[12],o[13]]),n?o[4]=o[5]=0:y.isSVG&&(l=e._gsTransform)&&(l.xOrigin||l.yOrigin)&&(o[0]=parseFloat(o[0]),o[1]=parseFloat(o[1]),o[2]=parseFloat(o[2]),o[3]=parseFloat(o[3]),o[4]=parseFloat(o[4])-(l.xOrigin-(l.xOrigin*o[0]+l.yOrigin*o[2])),o[5]=parseFloat(o[5])-(l.yOrigin-(l.xOrigin*o[1]+l.yOrigin*o[3]))),t)if(void 0===S&&A(),s=y.isSVG||y.isSVGRoot?B(e):e,y.isSVG?(u=e.getBBox(),p=x.isSVGRoot?{x:0,y:0}:b.getBBox(),s={offsetLeft:u.x-p.x,offsetTop:u.y-p.y,offsetParent:y.offsetParent}):y.isSVGRoot?(g=parseInt(w.borderTopWidth,10)||0,m=parseInt(w.borderLeftWidth,10)||0,v=(o[0]-S)*m+o[2]*g,_=o[1]*m+(o[3]-S)*g,c=t.x,f=t.y,h=c-(c*o[0]+f*o[2]),d=f-(c*o[1]+f*o[3]),o[4]=parseFloat(o[4])+h,o[5]=parseFloat(o[5])+d,t.x-=h,t.y-=d,c=s.scaleX,f=s.scaleY,i||(t.x*=c,t.y*=f),o[0]*=c,o[1]*=f,o[2]*=c,o[3]*=f,N||(t.x+=v,t.y+=_),T===Ee.body&&s.offsetParent===Ae&&(T=Ae)):!M&&e.offsetParent&&(t.x+=parseInt(tt(e.offsetParent,"borderLeftWidth"),10)||0,t.y+=parseInt(tt(e.offsetParent,"borderTopWidth"),10)||0),a=b===Ae||b===Ee.body,o[4]=Number(o[4])+t.x+(s.offsetLeft||0)-r.x-(a?0:b.scrollLeft||0),o[5]=Number(o[5])+t.y+(s.offsetTop||0)-r.y-(a?0:b.scrollTop||0),b&&"fixed"===tt(e,"position",!0))for(o[4]+=k(),o[5]+=C(),b=b.offsetParent;b;)o[4]-=b.offsetLeft,o[5]-=b.offsetTop,b=b.offsetParent;else!b||b===Ae||T!==s.offsetParent||x.isSVG||P&&"100100"!==U(b).join("")||(s=x.isSVGRoot?B(b):b,o[4]-=s.offsetLeft||0,o[5]-=s.offsetTop||0,M||!x.offsetParent||y.isSVG||y.isSVGRoot||(o[4]-=parseInt(tt(x.offsetParent,"borderLeftWidth"),10)||0,o[5]-=parseInt(tt(x.offsetParent,"borderTopWidth"),10)||0));return o},at=function(e,t){if(!e||e===window||!e.parentNode)return[1,0,0,1,0,0];for(var r,n,i,o,a,s,u,l,c=ot(e,I),f=ot(e.parentNode,D),h=U(e,c,f,!1,!t);(e=e.parentNode)&&e.parentNode&&e!==Ae;)c=f,f=ot(e.parentNode,c===I?D:I),u=U(e,c,f),r=h[0],n=h[1],i=h[2],o=h[3],a=h[4],s=h[5],h[0]=r*u[0]+n*u[2],h[1]=r*u[1]+n*u[3],h[2]=i*u[0]+o*u[2],h[3]=i*u[1]+o*u[3],h[4]=a*u[0]+s*u[2]+u[4],h[5]=a*u[1]+s*u[3]+u[5];return t&&(r=h[0],n=h[1],i=h[2],o=h[3],a=h[4],s=h[5],l=r*o-n*i,h[0]=o/l,h[1]=-n/l,h[2]=-i/l,h[3]=r/l,h[4]=(i*s-o*a)/l,h[5]=-(r*s-n*a)/l),h},X=function(e,t,r){var n=e.x*t[0]+e.y*t[2]+t[4],i=e.x*t[1]+e.y*t[3]+t[5];return e.x=n*r[0]+i*r[2]+r[4],e.y=n*r[1]+i*r[3]+r[5],e},q=function(e,t,r){if(!(e=Qe(e)))return null;t=Qe(t);var n,i,o,a,s,u,l,c,f,h,d,p,g,m,v,_,y,b,x,w,T,S,M=e.getBBox&&it(e);if(e===window)a=C(),o=(i=k())+(Ae.clientWidth||e.innerWidth||Ee.body.clientWidth||0),s=a+((e.innerHeight||0)-20t.scrollHeight,a.removeChild(t),e),gt=function(i,o){i=Qe(i),o=o||{};var a,s,u,e,l,c,f=Ee.createElement("div"),h=f.style,t=i.firstChild,d=0,p=0,g=i.scrollTop,m=i.scrollLeft,v=i.scrollWidth,_=i.scrollHeight,y=0,b=0,x=0;w&&!1!==o.force3D?(l="translate3d(",c="px,0px)"):O&&(l="translate(",c="px)"),this.scrollTop=function(e,t){if(!arguments.length)return-this.top();this.top(-e,t)},this.scrollLeft=function(e,t){if(!arguments.length)return-this.left();this.left(-e,t)},this.left=function(e,t){if(!arguments.length)return-(i.scrollLeft+p);var r=i.scrollLeft-m,n=p;if((2n.bottom-Q&&u?(Z=!0,s=Math.min(u,c*(1-Math.max(0,n.bottom-o)/Q)|0)):on.right-$&&u?(Z=!0,a=Math.min(u,c*(1-Math.max(0,n.right-i)/$)|0)):iG?(W.y=o,c+(v-o)*u):c):(I&&(s=e*I[0]+t*I[2]+I[4],t=e*I[1]+t*I[3]+I[5],e=s),(n=t-m)Math.abs(n)?"y":Y?"x":null,s&&"function"==typeof W.vars.onLockAxis&&W.vars.onLockAxis.call(W,W.pointerEvent)),"y"===s?n=0:"x"===s&&(r=0)),i=c+r*u,o=v+n*u),(k||E||A)&&(W.x!==i||W.y!==o&&!U)?(A&&(qe.x=i,qe.y=o,i=(s=A(qe)).x,o=s.y),k&&(i=k(i)),E&&(o=E(o))):_&&(bo._gsMaxScrollY&&(o.scrollTop=o._gsMaxScrollY),H&&o.scrollLeft>o._gsMaxScrollX&&(o.scrollLeft=o._gsMaxScrollX),i=o;W.isThrowing&&(n||W.endX>b||W.endXw||W.endYa.right||s.righta.bottom||s.bottom=a.width*a.height*r||i>=s.width*s.height*r):n.width>r&&n.height>r))},Ne.style.cssText="visibility:hidden;height:1px;top:-1px;pointer-events:none;position:relative;clear:both;",mt},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(e){"use strict";var t=function(){return(_gsScope.GreenSockGlobals||_gsScope).GSDevTools};"undefined"!=typeof module&&module.exports?(require("../TweenLite.js"),require("../TimelineLite.js"),require("../plugins/CSSPlugin.js"),module.exports=t()):"function"==typeof define&&define.amd&&define(["TweenLite","TimelineLite","CSSPlugin"],t)}(),function(){"use strict";var f="undefined"==typeof WebKitCSSMatrix?new DOMMatrix:new WebKitCSSMatrix;function h(e,t,r){this.x=e,this.y=t,this.z=r}function d(t){try{return"undefined"==typeof WebKitCSSMatrix?new DOMMatrix(t):new WebKitCSSMatrix(t)}catch(e){return console.warn(t),console.warn(e.toString()),f}}function n(e){for(var t=f,r=e;null!=r&&r!==r.ownerDocument.documentElement;){var n=window.getComputedStyle(r,void 0).transform||"none";t=("none"===n?f:d(n)).multiply(t),r=r.parentNode}for(var i=e.offsetWidth,o=e.offsetHeight,a=4,s=1/0,u=1/0;0<=--a;){var l=new h(0===a||1===a?0:i,0===a||3===a?0:o,0).transformBy(t);l.x+~]|"+N+")"+N+"*"),H=new RegExp("="+N+"*([^\\]'\"]*?)"+N+"*\\]","g"),Y=new RegExp(B),G=new RegExp("^"+j+"$"),W={ID:new RegExp("^#("+j+")"),CLASS:new RegExp("^\\.("+j+")"),TAG:new RegExp("^("+j+"|[*])"),ATTR:new RegExp("^"+F),PSEUDO:new RegExp("^"+B),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+N+"*(even|odd|(([+-]|)(\\d*)n|)"+N+"*(?:([+-]|)"+N+"*(\\d+)|))"+N+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+N+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+N+"*((?:-\\d)?\\d*)"+N+"*\\)|)(?=[^-]|$)","i")},V=/^(?:input|select|textarea|button)$/i,K=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,Q=new RegExp("\\\\([\\da-f]{1,6}"+N+"?|("+N+")|.)","ig"),ee=function(e,t,r){var n="0x"+t-65536;return n!=n||r?t:n<0?String.fromCharCode(65536+n):String.fromCharCode(n>>10|55296,1023&n|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,re=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},ne=function(){w()},ie=_e(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{R.apply(t=I.call(_.childNodes),_.childNodes),t[_.childNodes.length].nodeType}catch(e){R={apply:t.length?function(e,t){O.apply(e,I.call(t))}:function(e,t){for(var r=e.length,n=0;e[r++]=t[n++];);e.length=r-1}}}function oe(e,t,r,n){var i,o,a,s,u,l,c,f=t&&t.ownerDocument,h=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==h&&9!==h&&11!==h)return r;if(!n&&((t?t.ownerDocument||t:_)!==T&&w(t),t=t||T,S)){if(11!==h&&(u=J.exec(e)))if(i=u[1]){if(9===h){if(!(a=t.getElementById(i)))return r;if(a.id===i)return r.push(a),r}else if(f&&(a=f.getElementById(i))&&v(t,a)&&a.id===i)return r.push(a),r}else{if(u[2])return R.apply(r,t.getElementsByTagName(e)),r;if((i=u[3])&&d.getElementsByClassName&&t.getElementsByClassName)return R.apply(r,t.getElementsByClassName(i)),r}if(d.qsa&&!C[e+" "]&&(!m||!m.test(e))){if(1!==h)f=t,c=e;else if("object"!==t.nodeName.toLowerCase()){for((s=t.getAttribute("id"))?s=s.replace(te,re):t.setAttribute("id",s=M),o=(l=p(e)).length;o--;)l[o]="#"+s+" "+ve(l[o]);c=l.join(","),f=$.test(e)&&ge(t.parentNode)||t}if(c)try{return R.apply(r,f.querySelectorAll(c)),r}catch(e){}finally{s===M&&t.removeAttribute("id")}}}return g(e.replace(U,"$1"),t,r,n)}function ae(){var n=[];return function e(t,r){return n.push(t+" ")>b.cacheLength&&delete e[n.shift()],e[t+" "]=r}}function se(e){return e[M]=!0,e}function ue(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){for(var r=e.split("|"),n=r.length;n--;)b.attrHandle[r[n]]=t}function ce(e,t){var r=t&&e,n=r&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(n)return n;if(r)for(;r=r.nextSibling;)if(r===t)return-1;return e?1:-1}function fe(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(r){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===r}}function de(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ie(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function pe(a){return se(function(o){return o=+o,se(function(e,t){for(var r,n=a([],e.length,o),i=n.length;i--;)e[r=n[i]]&&(e[r]=!(t[r]=e[r]))})})}function ge(e){return e&&void 0!==e.getElementsByTagName&&e}for(e in d=oe.support={},i=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},w=oe.setDocument=function(e){var t,r,n=e?e.ownerDocument||e:_;return n!==T&&9===n.nodeType&&n.documentElement&&(a=(T=n).documentElement,S=!i(T),_!==T&&(r=T.defaultView)&&r.top!==r&&(r.addEventListener?r.addEventListener("unload",ne,!1):r.attachEvent&&r.attachEvent("onunload",ne)),d.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ue(function(e){return e.appendChild(T.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=Z.test(T.getElementsByClassName),d.getById=ue(function(e){return a.appendChild(e).id=M,!T.getElementsByName||!T.getElementsByName(M).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(Q,ee);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if(void 0!==t.getElementById&&S){var r=t.getElementById(e);return r?[r]:[]}}):(b.filter.ID=function(e){var r=e.replace(Q,ee);return function(e){var t=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===r}},b.find.ID=function(e,t){if(void 0!==t.getElementById&&S){var r,n,i,o=t.getElementById(e);if(o){if((r=o.getAttributeNode("id"))&&r.value===e)return[o];for(i=t.getElementsByName(e),n=0;o=i[n++];)if((r=o.getAttributeNode("id"))&&r.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var r,n=[],i=0,o=t.getElementsByTagName(e);if("*"!==e)return o;for(;r=o[i++];)1===r.nodeType&&n.push(r);return n},b.find.CLASS=d.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&S)return t.getElementsByClassName(e)},s=[],m=[],(d.qsa=Z.test(T.querySelectorAll))&&(ue(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+N+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+N+"*(?:value|"+L+")"),e.querySelectorAll("[id~="+M+"-]").length||m.push("~="),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+M+"+*").length||m.push(".#.+[+~]")}),ue(function(e){e.innerHTML="";var t=T.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+N+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&m.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:")})),(d.matchesSelector=Z.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ue(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",B)}),m=m.length&&new RegExp(m.join("|")),s=s.length&&new RegExp(s.join("|")),t=Z.test(a.compareDocumentPosition),v=t||Z.test(a.contains)?function(e,t){var r=9===e.nodeType?e.documentElement:e,n=t&&t.parentNode;return e===n||!(!n||1!==n.nodeType||!(r.contains?r.contains(n):e.compareDocumentPosition&&16&e.compareDocumentPosition(n)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},k=t?function(e,t){if(e===t)return l=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===r?e===T||e.ownerDocument===_&&v(_,e)?-1:t===T||t.ownerDocument===_&&v(_,t)?1:u?D(u,e)-D(u,t):0:4&r?-1:1)}:function(e,t){if(e===t)return l=!0,0;var r,n=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===T?-1:t===T?1:i?-1:o?1:u?D(u,e)-D(u,t):0;if(i===o)return ce(e,t);for(r=e;r=r.parentNode;)a.unshift(r);for(r=t;r=r.parentNode;)s.unshift(r);for(;a[n]===s[n];)n++;return n?ce(a[n],s[n]):a[n]===_?-1:s[n]===_?1:0}),T},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==T&&w(e),t=t.replace(H,"='$1']"),d.matchesSelector&&S&&!C[t+" "]&&(!s||!s.test(t))&&(!m||!m.test(t)))try{var r=c.call(e,t);if(r||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Q,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Q,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,r=!e[6]&&e[2];return W.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":r&&Y.test(r)&&(t=p(r,!0))&&(t=r.indexOf(")",r.length-t)-r.length)&&(e[0]=e[0].slice(0,t),e[2]=r.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Q,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=h[e+" "];return t||(t=new RegExp("(^|"+N+")"+e+"("+N+"|$)"))&&h(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(r,n,i){return function(e){var t=oe.attr(e,r);return null==t?"!="===n:!n||(t+="","="===n?t===i:"!="===n?t!==i:"^="===n?i&&0===t.indexOf(i):"*="===n?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function E(e,r,n){return _(r)?M.grep(e,function(e,t){return!!r.call(e,t,e)!==n}):r.nodeType?M.grep(e,function(e){return e===r!==n}):"string"!=typeof r?M.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(M.fn.init=function(e,t,r){var n,i;if(!e)return this;if(r=r||A,"string"!=typeof e)return e.nodeType?(this[0]=e,this.length=1,this):_(e)?void 0!==r.ready?r.ready(e):e(M):M.makeArray(e,this);if(!(n="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:O.exec(e))||!n[1]&&t)return!t||t.jquery?(t||r).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof M?t[0]:t,M.merge(this,M.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:S,!0)),k.test(n[1])&&M.isPlainObject(t))for(n in t)_(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}return(i=S.getElementById(n[2]))&&(this[0]=i,this.length=1),this}).prototype=M.fn,A=M(S);var R=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};function D(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}M.fn.extend({has:function(e){var t=M(e,this),r=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]+)/i,ce=/^$|^module$|\/(?:java|ecma)script/i,fe={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function he(e,t){var r;return r=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&C(e,t)?M.merge([e],r):r}function de(e,t){for(var r=0,n=e.length;rx",v.noCloneChecked=!!pe.cloneNode(!0).lastChild.defaultValue;var _e=S.documentElement,ye=/^key/,be=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,xe=/^([^.]*)(?:\.(.+)|)/;function we(){return!0}function Te(){return!1}function Se(){try{return S.activeElement}catch(e){}}function Me(e,t,r,n,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof r&&(n=n||r,r=void 0),t)Me(e,s,r,n,t[s],o);return e}if(null==n&&null==i?(i=r,n=r=void 0):null==i&&("string"==typeof r?(i=n,n=void 0):(i=n,n=r,r=void 0)),!1===i)i=Te;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return M().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=M.guid++)),e.each(function(){M.event.add(this,t,i,n,r)})}M.event={global:{},add:function(t,e,r,n,i){var o,a,s,u,l,c,f,h,d,p,g,m=K.get(t);if(m)for(r.handler&&(r=(o=r).handler,i=o.selector),i&&M.find.matchesSelector(_e,i),r.guid||(r.guid=M.guid++),(u=m.events)||(u=m.events={}),(a=m.handle)||(a=m.handle=function(e){return void 0!==M&&M.event.triggered!==e.type?M.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(L)||[""]).length;l--;)d=g=(s=xe.exec(e[l])||[])[1],p=(s[2]||"").split(".").sort(),d&&(f=M.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=M.event.special[d]||{},c=M.extend({type:d,origType:g,data:n,handler:r,guid:r.guid,selector:i,needsContext:i&&M.expr.match.needsContext.test(i),namespace:p.join(".")},o),(h=u[d])||((h=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,n,p,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=r.guid)),i?h.splice(h.delegateCount++,0,c):h.push(c),M.event.global[d]=!0)},remove:function(e,t,r,n,i){var o,a,s,u,l,c,f,h,d,p,g,m=K.hasData(e)&&K.get(e);if(m&&(u=m.events)){for(l=(t=(t||"").match(L)||[""]).length;l--;)if(d=g=(s=xe.exec(t[l])||[])[1],p=(s[2]||"").split(".").sort(),d){for(f=M.event.special[d]||{},h=u[d=(n?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=h.length;o--;)c=h[o],!i&&g!==c.origType||r&&r.guid!==c.guid||s&&!s.test(c.namespace)||n&&n!==c.selector&&("**"!==n||!c.selector)||(h.splice(o,1),c.selector&&h.delegateCount--,f.remove&&f.remove.call(e,c));a&&!h.length&&(f.teardown&&!1!==f.teardown.call(e,p,m.handle)||M.removeEvent(e,d,m.handle),delete u[d])}else for(d in u)M.event.remove(e,d+t[l],r,n,!0);M.isEmptyObject(u)&&K.remove(e,"handle events")}},dispatch:function(e){var t,r,n,i,o,a,s=M.event.fix(e),u=new Array(arguments.length),l=(K.get(this,"events")||{})[s.type]||[],c=M.event.special[s.type]||{};for(u[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,Ce=/\s*$/g;function Ae(e,t){return C(e,"table")&&C(11!==t.nodeType?t:t.firstChild,"tr")&&M(e).children("tbody")[0]||e}function Oe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Ie(e,t){var r,n,i,o,a,s,u,l;if(1===t.nodeType){if(K.hasData(e)&&(o=K.access(e),a=K.set(t,o),l=o.events))for(i in delete a.handle,a.events={},l)for(r=0,n=l[i].length;r")},clone:function(e,t,r){var n,i,o,a,s,u,l,c=e.cloneNode(!0),f=M.contains(e.ownerDocument,e);if(!(v.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||M.isXMLDoc(e)))for(a=he(c),n=0,i=(o=he(e)).length;n").prop({charset:r.scriptCharset,src:r.url}).on("load error",i=function(e){n.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),S.head.appendChild(n[0])},abort:function(){i&&i()}}});var Xt,qt=[],Ht=/(=)\?(?=&|$)|\?\?/;M.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=qt.pop()||M.expando+"_"+bt++;return this[e]=!0,e}}),M.ajaxPrefilter("json jsonp",function(e,t,r){var n,i,o,a=!1!==e.jsonp&&(Ht.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ht.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return n=e.jsonpCallback=_(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ht,"$1"+n):!1!==e.jsonp&&(e.url+=(xt.test(e.url)?"&":"?")+e.jsonp+"="+n),e.converters["script json"]=function(){return o||M.error(n+" was not called"),o[0]},e.dataTypes[0]="json",i=T[n],T[n]=function(){o=arguments},r.always(function(){void 0===i?M(T).removeProp(n):T[n]=i,e[n]&&(e.jsonpCallback=t.jsonpCallback,qt.push(n)),o&&_(i)&&i(o[0]),o=i=void 0}),"script"}),v.createHTMLDocument=((Xt=S.implementation.createHTMLDocument("").body).innerHTML="
",2===Xt.childNodes.length),M.parseHTML=function(e,t,r){return"string"!=typeof e?[]:("boolean"==typeof t&&(r=t,t=!1),t||(v.createHTMLDocument?((n=(t=S.implementation.createHTMLDocument("")).createElement("base")).href=S.location.href,t.head.appendChild(n)):t=S),o=!r&&[],(i=k.exec(e))?[t.createElement(i[1])]:(i=ve([e],t,o),o&&o.length&&M(o).remove(),M.merge([],i.childNodes)));var n,i,o},M.fn.load=function(e,t,r){var n,i,o,a=this,s=e.indexOf(" ");return-1").append(M.parseHTML(e)).find(n):e)}).always(r&&function(e,t){a.each(function(){r.apply(this,o||[e.responseText,t,e])})}),this},M.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){M.fn[t]=function(e){return this.on(t,e)}}),M.expr.pseudos.animated=function(t){return M.grep(M.timers,function(e){return t===e.elem}).length},M.offset={setOffset:function(e,t,r){var n,i,o,a,s,u,l=M.css(e,"position"),c=M(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=M.css(e,"top"),u=M.css(e,"left"),i=("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(n=c.position()).top,n.left):(a=parseFloat(o)||0,parseFloat(u)||0),_(t)&&(t=t.call(e,r,M.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},M.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){M.offset.setOffset(this,t,e)});var e,r,n=this[0];return n?n.getClientRects().length?(e=n.getBoundingClientRect(),r=n.ownerDocument.defaultView,{top:e.top+r.pageYOffset,left:e.left+r.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,r,n=this[0],i={top:0,left:0};if("fixed"===M.css(n,"position"))t=n.getBoundingClientRect();else{for(t=this.offset(),r=n.ownerDocument,e=n.offsetParent||r.documentElement;e&&(e===r.body||e===r.documentElement)&&"static"===M.css(e,"position");)e=e.parentNode;e&&e!==n&&1===e.nodeType&&((i=M(e).offset()).top+=M.css(e,"borderTopWidth",!0),i.left+=M.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-M.css(n,"marginTop",!0),left:t.left-i.left-M.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===M.css(e,"position");)e=e.offsetParent;return e||_e})}}),M.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;M.fn[t]=function(e){return X(this,function(e,t,r){var n;if(y(e)?n=e:9===e.nodeType&&(n=e.defaultView),void 0===r)return n?n[i]:e[t];n?n.scrollTo(o?n.pageXOffset:r,o?r:n.pageYOffset):e[t]=r},t,e,arguments.length)}}),M.each(["top","left"],function(e,r){M.cssHooks[r]=ze(v.pixelPosition,function(e,t){if(t)return t=Be(e,r),Ne.test(t)?M(e).position()[r]+"px":t})}),M.each({Height:"height",Width:"width"},function(a,s){M.each({padding:"inner"+a,content:s,"":"outer"+a},function(n,o){M.fn[o]=function(e,t){var r=arguments.length&&(n||"boolean"!=typeof e),i=n||(!0===e||!0===t?"margin":"border");return X(this,function(e,t,r){var n;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(n=e.documentElement,Math.max(e.body["scroll"+a],n["scroll"+a],e.body["offset"+a],n["offset"+a],n["client"+a])):void 0===r?M.css(e,t,i):M.style(e,t,r,i)},s,r?e:void 0,r)}})}),M.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,r){M.fn[r]=function(e,t){return 0@~]/g,"\\$&").replace(/\n/g,"A")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCommonAncestor=function(e){var t=(1 /g,">").split(/\s+(?=(?:(?:[^"]*"){2})*[^"]*$)/);if(n.length<2)return h("",e,"",t);var i=[n.pop()];for(;1/g,"> ").trim()};var n,i=r(3),c=(n=i)&&n.__esModule?n:{default:n},f=r(0);function h(r,n,i,o){if(r.length&&(r+=" "),i.length&&(i=" "+i),/\[*\]/.test(n)){var e=n.replace(/=.*$/,"]"),a=""+r+e+i;if(m(document.querySelectorAll(a),o))n=e;else for(var s=document.querySelectorAll(""+r+e),t=function(){var t=s[u];if(o.some(function(e){return t.contains(e)})){var e=t.tagName.toLowerCase();return a=""+r+e+i,m(document.querySelectorAll(a),o)&&(n=e),"break"}},u=0,l=s.length;u/.test(n)){var c=n.replace(/>/,"");a=""+r+c+i;m(document.querySelectorAll(a),o)&&(n=c)}if(/:nth-child/.test(n)){var f=n.replace(/nth-child/g,"nth-of-type");a=""+r+f+i;m(document.querySelectorAll(a),o)&&(n=f)}if(/\.\S+\.\S+/.test(n)){for(var h=n.trim().split(".").slice(1).map(function(e){return"."+e}).sort(function(e,t){return e.length-t.length});h.length;){var d=n.replace(h.shift(),"").trim();if(!(a=(""+r+d+i).trim()).length||">"===a.charAt(0)||">"===a.charAt(a.length-1))break;m(document.querySelectorAll(a),o)&&(n=d)}if((h=n&&n.match(/\./g))&&2/.test(s):l=function(t){return function(e){return e(t.parent)&&t.parent}};break;case/^\./.test(s):var r=s.substr(1).split(".");u=function(e){var t=e.attribs.class;return t&&r.every(function(e){return-1)(\S)/g,"$1 $2").trim()),t=n.shift(),i=n.length;return t(this).filter(function(e){for(var t=0;t\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=o.console&&(o.console.warn||o.console.log);return r&&r.call(o.console,i,t),n.apply(this,arguments)}}a="function"!=typeof Object.assign?function(e){if(e===f||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1;rt[r]}):n.sort()),n}function E(e,t){for(var r,n,i=t[0].toUpperCase()+t.slice(1),o=0;oh(l.y)?l.x:l.y,t.scale=a?function(e,t){return ne(t[0],t[1],Z)/ne(e[0],e[1],Z)}(a.pointers,n):1,t.rotation=a?function(e,t){return ie(t[1],t[0],Z)+ie(e[1],e[0],Z)}(a.pointers,n):0,t.maxPointers=r.prevInput?t.pointers.length>r.prevInput.maxPointers?t.pointers.length:r.prevInput.maxPointers:t.pointers.length,function(e,t){var r,n,i,o,a=e.lastInterval||t,s=t.timeStamp-a.timeStamp;if(t.eventType!=z&&(jh(c.y)?c.x:c.y,o=re(u,l),e.lastInterval=t}else r=a.velocity,n=a.velocityX,i=a.velocityY,o=a.direction;t.velocity=r,t.velocityX=n,t.velocityY=i,t.direction=o}(r,t);var c=e.element;T(t.srcEvent.target,c)&&(c=t.srcEvent.target);t.target=c}(e,r),e.emit("hammer.input",r),e.recognize(r),e.session.prevInput=r}function Q(e){for(var t=[],r=0;r=h(t)?e<0?X:q:t<0?H:Y}function ne(e,t,r){r||(r=K);var n=t[r[0]]-e[r[0]],i=t[r[1]]-e[r[1]];return Math.sqrt(n*n+i*i)}function ie(e,t,r){r||(r=K);var n=t[r[0]]-e[r[0]],i=t[r[1]]-e[r[1]];return 180*Math.atan2(i,n)/Math.PI}J.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(O(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(O(this.element),this.evWin,this.domHandler)}};var oe={mousedown:F,mousemove:2,mouseup:B},ae="mousedown",se="mousemove mouseup";function ue(){this.evEl=ae,this.evWin=se,this.pressed=!1,J.apply(this,arguments)}v(ue,J,{handler:function(e){var t=oe[e.type];t&F&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=B),this.pressed&&(t&B&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:N,srcEvent:e}))}});var le={pointerdown:F,pointermove:2,pointerup:B,pointercancel:z,pointerout:z},ce={2:L,3:"pen",4:N,5:"kinect"},fe="pointerdown",he="pointermove pointerup pointercancel";function de(){this.evEl=fe,this.evWin=he,J.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}o.MSPointerEvent&&!o.PointerEvent&&(fe="MSPointerDown",he="MSPointerMove MSPointerUp MSPointerCancel"),v(de,J,{handler:function(e){var t=this.store,r=!1,n=e.type.toLowerCase().replace("ms",""),i=le[n],o=ce[e.pointerType]||e.pointerType,a=o==L,s=P(t,e.pointerId,"pointerId");i&F&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):i&(B|z)&&(r=!0),s<0||(t[s]=e,this.callback(this.manager,i,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),r&&t.splice(s,1))}});var pe={touchstart:F,touchmove:2,touchend:B,touchcancel:z};function ge(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,J.apply(this,arguments)}v(ge,J,{handler:function(e){var t=pe[e.type];if(t===F&&(this.started=!0),this.started){var r=function(e,t){var r=C(e.touches),n=C(e.changedTouches);t&(B|z)&&(r=k(r.concat(n),"identifier",!0));return[r,n]}.call(this,e,t);t&(B|z)&&r[0].length-r[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:r[0],changedPointers:r[1],pointerType:L,srcEvent:e})}}});var me={touchstart:F,touchmove:2,touchend:B,touchcancel:z},ve="touchstart touchmove touchend touchcancel";function _e(){this.evTarget=ve,this.targetIds={},J.apply(this,arguments)}v(_e,J,{handler:function(e){var t=me[e.type],r=function(e,t){var r=C(e.touches),n=this.targetIds;if(t&(2|F)&&1===r.length)return n[r[0].identifier]=!0,[r,r];var i,o,a=C(e.changedTouches),s=[],u=this.target;if(o=r.filter(function(e){return T(e.target,u)}),t===F)for(i=0;it.threshold&&i&t.direction},attrTest:function(e){return Ne.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=De(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),v(Fe,Ne,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Pe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),v(Be,Re,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return["auto"]},process:function(e){var t=this.options,r=e.pointers.length===t.pointers,n=e.distancet.time;if(this._input=e,!n||!r||e.eventType&(B|z)&&!i)this.reset();else if(e.eventType&F)this.reset(),this._timer=l(function(){this.state=8,this.tryEmit()},t.time,this);else if(e.eventType&B)return 8;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&B?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=d(),this.manager.emit(this.options.event,this._input)))}}),v(ze,Ne,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Pe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),v(Ue,Ne,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:G|W,pointers:1},getTouchAction:function(){return je.prototype.getTouchAction.call(this)},attrTest:function(e){var t,r=this.options.direction;return r&(G|W)?t=e.overallVelocity:r&G?t=e.overallVelocityX:r&W&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&r&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&h(t)>this.options.velocity&&e.eventType&B},emit:function(e){var t=De(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),v(Xe,Re,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Me]},process:function(e){var t=this.options,r=e.pointers.length===t.pointers,n=e.distance>>1;o(e[i],t)<0?r=1+i:n=i}return r},right:function(e,t,r,n){for(null==r&&(r=0),null==n&&(n=e.length);r>>1;0>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):(t=it.exec(e))?dt(parseInt(t[1],16)):(t=ot.exec(e))?new vt(t[1],t[2],t[3],1):(t=at.exec(e))?new vt(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=st.exec(e))?pt(t[1],t[2],t[3],t[4]):(t=ut.exec(e))?pt(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=lt.exec(e))?yt(t[1],t[2]/100,t[3]/100,1):(t=ct.exec(e))?yt(t[1],t[2]/100,t[3]/100,t[4]):ft.hasOwnProperty(e)?dt(ft[e]):"transparent"===e?new vt(NaN,NaN,NaN,0):null}function dt(e){return new vt(e>>16&255,e>>8&255,255&e,1)}function pt(e,t,r,n){return n<=0&&(e=t=r=NaN),new vt(e,t,r,n)}function gt(e){return e instanceof $e||(e=ht(e)),e?new vt((e=e.rgb()).r,e.g,e.b,e.opacity):new vt}function mt(e,t,r,n){return 1===arguments.length?gt(e):new vt(e,t,r,null==n?1:n)}function vt(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function _t(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function yt(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||1<=r?e=t=NaN:t<=0&&(e=NaN),new xt(e,t,r,n)}function bt(e,t,r,n){return 1===arguments.length?function(e){if(e instanceof xt)return new xt(e.h,e.s,e.l,e.opacity);if(e instanceof $e||(e=ht(e)),!e)return new xt;if(e instanceof xt)return e;var t=(e=e.rgb()).r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),o=Math.max(t,r,n),a=NaN,s=o-i,u=(o+i)/2;return s?(a=t===o?(r-n)/s+6*(ro&&(i=n.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(t=t[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:fr(t,r)})),o=pr.lastIndex;return or._time&&(n=r._time),(e=r)._next):(t=r._next,r._next=null,e?e._next=t:qr=t);Hr=e,un(n)}(),Zr=0}}function sn(){var e=$r.now(),t=e-Kr;Vrhn)throw new Error("too late; already scheduled");return r}function xn(e,t){var r=wn(e,t);if(r.state>gn)throw new Error("too late; already running");return r}function wn(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function Tn(e,t){var r,n,i,o=e.__transition,a=!0;if(o){for(i in t=null==t?null:t+"",o)(r=o[i]).name===t?(n=r.state>pn&&r.stateMath.abs(e[1]-C[1])?d=!0:h=!0),C=e,f=!0,pi(),I()}function I(){var e;switch(l=C[0]-P[0],c=C[1]-P[1],m){case mi:case gi:v&&(l=Math.max(x-t,Math.min(T-o,l)),r=t+l,a=o+l),_&&(c=Math.max(w-n,Math.min(S-s,c)),i=n+c,u=s+c);break;case vi:v<0?(l=Math.max(x-t,Math.min(T-t,l)),r=t+l,a=o):0=t,ho[n<<1].forEach(a);for(;++u=t,ho[r|n<<1].forEach(a);ho[n<<0].forEach(a);for(;++l=t,i=e[l*h]>=t,ho[n<<1|i<<2].forEach(a);++u=t,o=i,i=e[l*h+u+1]>=t,ho[r|n<<1|i<<2|o<<3].forEach(a);ho[n|i<<3].forEach(a)}u=-1,i=e[l*h]>=t,ho[i<<2].forEach(a);for(;++u=t,ho[i<<2|o<<3].forEach(a);function a(e){var t,r,n=[e[0][0]+u,e[0][1]+l],i=[e[1][0]+u,e[1][1]+l],o=p(n),a=p(i);(t=f[o])?(r=c[a])?(delete f[t.end],delete c[r.start],t===r?(t.ring.push(i),s(t.ring)):c[t.start]=f[r.end]={start:t.start,end:r.end,ring:t.ring.concat(r.ring)}):(delete f[t.end],t.ring.push(i),f[t.end=a]=t):(t=c[a])?(r=f[o])?(delete c[t.start],delete f[r.end],t===r?(t.ring.push(i),s(t.ring)):c[r.start]=f[t.end]={start:r.start,end:t.end,ring:r.ring.concat(t.ring)}):(delete c[t.start],t.ring.unshift(n),c[t.start=o]=t):c[o]=f[a]={start:o,end:a,ring:[n,i]}}ho[i<<3].forEach(a)}(t,r,function(e){a(e,t,r),0=i?s=!0:(t=n.charCodeAt(o++))===To?u=!0:t===So&&(u=!0,n.charCodeAt(o)===To&&++o),n.slice(r+1,e-1).replace(/""/g,'"')}for(;o=(o=(g+v)/2))?g=o:v=o,(c=r>=(a=(m+_)/2))?m=a:_=a,!(d=(i=d)[f=c<<1|l]))return i[f]=p,e;if(s=+e._x.call(null,d.data),u=+e._y.call(null,d.data),t===s&&r===u)return p.next=d,i?i[f]=p:e._root=p,e;for(;i=i?i[f]=new Array(4):e._root=new Array(4),(l=t>=(o=(g+v)/2))?g=o:v=o,(c=r>=(a=(m+_)/2))?m=a:_=a,(f=c<<1|l)==(h=(a<=u)<<1|o<=s););return i[h]=d,i[f]=p,e}function na(e,t,r,n,i){this.node=e,this.x0=t,this.y0=r,this.x1=n,this.y1=i}function ia(e){return e[0]}function oa(e){return e[1]}function aa(e,t,r){var n=new sa(null==t?ia:t,null==r?oa:r,NaN,NaN,NaN,NaN);return null==e?n:n.addAll(e)}function sa(e,t,r,n,i,o){this._x=e,this._y=t,this._x0=r,this._y0=n,this._x1=i,this._y1=o,this._root=void 0}function ua(e){for(var t={data:e.data},r=t;e=e.next;)r=r.next={data:e.data};return t}var la=aa.prototype=sa.prototype;function ca(e){return e.x+e.vx}function fa(e){return e.y+e.vy}function ha(e){return e.index}function da(e,t){var r=e.get(t);if(!r)throw new Error("missing: "+t);return r}function pa(e){return e.x}function ga(e){return e.y}la.copy=function(){var e,t,r=new sa(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=ua(n),r;for(e=[{source:n,target:r._root=new Array(4)}];n=e.pop();)for(var i=0;i<4;++i)(t=n.source[i])&&(t.length?e.push({source:t,target:n.target[i]=new Array(4)}):n.target[i]=ua(t));return r},la.add=function(e){var t=+this._x.call(null,e),r=+this._y.call(null,e);return ra(this.cover(t,r),t,r,e)},la.addAll=function(e){var t,r,n,i,o=e.length,a=new Array(o),s=new Array(o),u=1/0,l=1/0,c=-1/0,f=-1/0;for(r=0;rh||(o=u.y0)>d||(a=u.x1)=(s=(p+m)/2))?p=s:m=s,(c=a>=(u=(g+v)/2))?g=u:v=u,!(d=(t=d)[f=c<<1|l]))return this;if(!d.length)break;(t[f+1&3]||t[f+2&3]||t[f+3&3])&&(r=t,h=f)}for(;d.data!==e;)if(!(d=(n=d).next))return this;return(i=d.next)&&delete d.next,n?i?n.next=i:delete n.next:t?(i?t[f]=i:delete t[f],(d=t[0]||t[1]||t[2]||t[3])&&d===(t[3]||t[2]||t[1]||t[0])&&!d.length&&(r?r[h]=d:this._root=d)):this._root=i,this},la.removeAll=function(e){for(var t=0,r=e.length;t=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xa(e){return new wa(e)}function wa(e){if(!(t=ba.exec(e)))throw new Error("invalid format: "+e);var t;this.fill=t[1]||" ",this.align=t[2]||">",this.sign=t[3]||"-",this.symbol=t[4]||"",this.zero=!!t[5],this.width=t[6]&&+t[6],this.comma=!!t[7],this.precision=t[8]&&+t[8].slice(1),this.trim=!!t[9],this.type=t[10]||""}function Ta(e,t){var r=va(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}xa.prototype=wa.prototype,wa.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Sa={"%":function(e,t){return(100*e).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:function(e){return Math.round(e).toString(10)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return Ta(100*e,t)},r:Ta,s:function(e,t){var r=va(e,t);if(!r)return e+"";var n=r[0],i=r[1],o=i-(ya=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=n.length;return o===a?n:at));)o=s[i=(i+1)%s.length];return n.reverse().join(u)}}(e.grouping,e.thousands):Ma,n=e.currency,T=e.decimal,S=e.numerals?function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(e.numerals):Ma,i=e.percent||"%";function a(e){var l=(e=xa(e)).fill,c=e.align,f=e.sign,t=e.symbol,h=e.zero,d=e.width,p=e.comma,g=e.precision,m=e.trim,v=e.type;"n"===v?(p=!0,v="g"):Sa[v]||(null==g&&(g=12),m=!0,v="g"),(h||"0"===l&&"="===c)&&(h=!0,l="0",c="=");var _="$"===t?n[0]:"#"===t&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",y="$"===t?n[1]:/[%p]/.test(v)?i:"",b=Sa[v],x=/[defgprs%]/.test(v);function r(e){var t,r,n,i=_,o=y;if("c"===v)o=b(e)+o,e="";else{var a=(e=+e)<0;if(e=b(Math.abs(e),g),m&&(e=function(e){e:for(var t,r=e.length,n=1,i=-1;n>1)+i+e+o+u.slice(s);break;default:e=u+i+e+o}return S(e)}return g=null==g?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),r.toString=function(){return e+""},r}return{format:a,formatPrefix:function(e,t){var r=a(((e=xa(e)).type="f",e)),n=3*Math.max(-8,Math.min(8,Math.floor(_a(t)/3))),i=Math.pow(10,-n),o=Ca[8+n/3];return function(e){return r(i*e)+o}}}}function Ea(e){return Pa=ka(e),z.format=Pa.format,z.formatPrefix=Pa.formatPrefix,Pa}function Aa(e){return Math.max(0,-_a(Math.abs(e)))}function Oa(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(_a(t)/3)))-_a(Math.abs(e)))}function Ra(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,_a(t)-_a(e))+1}function Ia(){return new Da}function Da(){this.reset()}Ea({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),Da.prototype={constructor:Da,reset:function(){this.s=this.t=0},add:function(e){Na(La,e,this.t),Na(this,La.s,this.s),this.s?this.t+=La.t:this.s=La.t},valueOf:function(){return this.s}};var La=new Da;function Na(e,t,r){var n=e.s=t+r,i=n-t,o=n-i;e.t=t-o+(r-i)}var ja=1e-6,Fa=Math.PI,Ba=Fa/2,za=Fa/4,Ua=2*Fa,Xa=180/Fa,qa=Fa/180,Ha=Math.abs,Ya=Math.atan,Ga=Math.atan2,Wa=Math.cos,Va=Math.ceil,Ka=Math.exp,Za=Math.log,Ja=Math.pow,$a=Math.sin,Qa=Math.sign||function(e){return 0hu(Os,Is)&&(Is=e):hu(e,Is)>hu(Os,Is)&&(Os=e):Os<=Is?(ehu(Os,Is)&&(Is=e):hu(e,Is)>hu(Os,Is)&&(Os=e)}else Bs.push(zs=[Os=e,Is=e]);tja&&(Os=-(Is=180)),zs[0]=Os,zs[1]=Is,Fs=null}function hu(e,t){return(t-=e)<0?t+360:t}function du(e,t){return e[0]-t[0]}function pu(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tFa?e+Math.round(-e/Ua)*Ua:e,t]}function Eu(e,t,r){return(e%=Ua)?t||r?Cu(Ou(e),Ru(t,r)):Ou(e):t||r?Ru(t,r):ku}function Au(r){return function(e,t){return[Fa<(e+=r)?e-Ua:e<-Fa?e+Ua:e,t]}}function Ou(e){var t=Au(e);return t.invert=Au(-e),t}function Ru(e,t){var s=Wa(e),u=$a(e),l=Wa(t),c=$a(t);function r(e,t){var r=Wa(t),n=Wa(e)*r,i=$a(e)*r,o=$a(t),a=o*s+n*u;return[Ga(i*l-a*c,n*s-o*u),ns(a*l+i*c)]}return r.invert=function(e,t){var r=Wa(t),n=Wa(e)*r,i=$a(e)*r,o=$a(t),a=o*l-i*c;return[Ga(i*l+o*c,n*s+a*u),ns(a*s-n*u)]},r}function Iu(t){function e(e){return(e=t(e[0]*qa,e[1]*qa))[0]*=Xa,e[1]*=Xa,e}return t=Eu(t[0]*qa,t[1]*qa,2ja?Ya(($a(t)*(o=Wa(n))*$a(r)-$a(n)*(i=Wa(t))*$a(e))/(i*o*a)):(t+n)/2}(a,s,e,t),i.point(u,s),i.lineEnd(),i.lineStart(),i.point(r,s),o=0),i.point(a=e,s=t),u=r},lineEnd:function(){i.lineEnd(),a=s=NaN},clean:function(){return 2-o}}},function(e,t,r,n){var i;if(null==e)i=r*Ba,n.point(-Fa,i),n.point(0,i),n.point(Fa,i),n.point(Fa,0),n.point(Fa,-i),n.point(0,-i),n.point(-Fa,-i),n.point(-Fa,0),n.point(-Fa,i);else if(Ha(e[0]-t[0])>ja){var o=e[0]ja;function g(e,t){return Wa(e)*Wa(t)>P}function m(e,t,r){var n=[1,0,0],i=Cs(Ms(e),Ms(t)),o=Ps(i,i),a=i[0],s=o-a*a;if(!s)return!r&&e;var u=P*o/s,l=-P*a/s,c=Cs(n,i),f=Es(n,u);ks(f,Es(i,l));var h=c,d=Ps(f,h),p=Ps(h,h),g=d*d-p*(Ps(f,f)-1);if(!(g<0)){var m=es(g),v=Es(h,(-d-m)/p);if(ks(v,f),v=Ss(v),!r)return v;var _,y=e[0],b=t[0],x=e[1],w=t[1];bja}).map(l)).concat(M(Va(a/p)*p,o,p).filter(function(e){return Ha(e%m)>ja}).map(c))}return _.lines=function(){return e().map(function(e){return{type:"LineString",coordinates:e}})},_.outline=function(){return{type:"Polygon",coordinates:[f(i).concat(h(s).slice(1),f(n).reverse().slice(1),h(u).reverse().slice(1))]}},_.extent=function(e){return arguments.length?_.extentMajor(e).extentMinor(e):_.extentMinor()},_.extentMajor=function(e){return arguments.length?(i=+e[0][0],n=+e[1][0],u=+e[0][1],s=+e[1][1],nja&&0<--i);return[e/(.8707+(o=n*n)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),n]},tf.invert=jc(ns),rf.invert=jc(function(e){return 2*Ya(e)}),nf.invert=function(e,t){return[-t,2*Ya(Ka(e))-Ba]},df.prototype=lf.prototype={constructor:df,count:function(){return this.eachAfter(uf)},each:function(e){var t,r,n,i,o=this,a=[o];do{for(t=a.reverse(),a=[];o=t.pop();)if(e(o),r=o.children)for(n=0,i=r.length;ntv){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,u=3*e._l01_a*(e._l01_a+e._l12_a);n=(n*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/u,i=(i*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/u}if(e._l23_a>tv){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,c=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*l+e._x1*e._l23_2a-t*e._l12_2a)/c,a=(a*l+e._y1*e._l23_2a-r*e._l12_2a)/c}e._context.bezierCurveTo(n,i,o,a,e._x2,e._y2)}function h_(e,t){this._context=e,this._alpha=t}h_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:f_(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var d_=function t(r){function e(e){return r?new h_(e,r):new o_(e,0)}return e.alpha=function(e){return t(+e)},e}(.5);function p_(e,t){this._context=e,this._alpha=t}p_.prototype={areaStart:Jv,areaEnd:Jv,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:f_(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var g_=function t(r){function e(e){return r?new p_(e,r):new s_(e,0)}return e.alpha=function(e){return t(+e)},e}(.5);function m_(e,t){this._context=e,this._alpha=t}m_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:f_(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var v_=function t(r){function e(e){return r?new m_(e,r):new l_(e,0)}return e.alpha=function(e){return t(+e)},e}(.5);function __(e){this._context=e}function y_(e){return e<0?-1:1}function b_(e,t,r){var n=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(n||i<0&&-0),a=(r-e._y1)/(i||n<0&&-0),s=(o*i+a*n)/(n+i);return(y_(o)+y_(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function x_(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function w_(e,t,r){var n=e._x0,i=e._y0,o=e._x1,a=e._y1,s=(o-n)/3;e._context.bezierCurveTo(n+s,i+s*t,o-s,a-s*r,o,a)}function T_(e){this._context=e}function S_(e){this._context=new M_(e)}function M_(e){this._context=e}function P_(e){this._context=e}function C_(e){var t,r,n=e.length-1,i=new Array(n),o=new Array(n),a=new Array(n);for(o[i[0]=0]=2,a[0]=e[0]+2*e[1],t=1;to&&(o=t,n=r);return n}function D_(e){var r=e.map(L_);return A_(e).sort(function(e,t){return r[e]-r[t]})}function L_(e){for(var t,r=0,n=-1,i=e.length;++n=i)return}else u=[g,r];o=[g,i]}else{if(u){if(u[1]=i)return}else u=[(r-s)/a,r];o=[(i-s)/a,i]}else{if(u){if(u[1]=n)return}else u=[t,a*t+s];o=[n,a*n+s]}else{if(u){if(u[0]dy||Math.abs(i[0][1]-i[1][1])>dy)||delete hy[o]}(a,s,u,l),function(e,t,r,n){var i,o,a,s,u,l,c,f,h,d,p,g,m,v,_=cy.length,y=!0;for(i=0;i<_;++i)if(o=cy[i]){for(a=o.site,s=(u=o.halfedges).length;s--;)hy[u[s]]||u.splice(s,1);for(s=0,l=u.length;sdy||Math.abs(g-h)>dy)&&(u.splice(s,0,hy.push(Y_(a,d,Math.abs(p-e)=r)return null;for(var n=a-u.site[0],i=s-u.site[1],f=n*n+i*i;u=l.cells[t=c],c=null,u.halfedges.forEach(function(e){var t=l.edges[e],r=t.left;if(r!==u.site&&r||(r=t.right)){var n=a-r[0],i=s-r[1],o=n*n+i*i;os;)u.pop(),--l;var c,f=new Array(l+1);for(t=0;t<=l;++t)(c=f[t]=[]).x0=0=p.length)return null!=h&&e.sort(h),null!=d?d(e):e;for(var t,o,a,s=-1,u=e.length,l=p[r++],c=$i(),f=n();++sp.length)return e;var i,o=a[n-1];return null!=d&&n>=p.length?i=e.entries():(i=[],e.each(function(e,t){i.push({key:t,values:r(e,n)})})),null!=o?i.sort(function(e,t){return o(e.key,t.key)}):i}(g(e,0,to,ro),0)},key:function(e){return p.push(e),t},sortKeys:function(e){return a[p.length-1]=e,t},sortValues:function(e){return h=e,t},rollup:function(e){return d=e,t}}},z.set=oo,z.map=$i,z.keys=function(e){var t=[];for(var r in e)t.push(r);return t},z.values=function(e){var t=[];for(var r in e)t.push(e[r]);return t},z.entries=function(e){var t=[];for(var r in e)t.push({key:r,value:e[r]});return t},z.color=ht,z.rgb=mt,z.hsl=bt,z.lab=It,z.hcl=zt,z.lch=function(e,t,r,n){return 1===arguments.length?Bt(e):new Ut(r,t,e,null==n?1:n)},z.gray=function(e,t){return new Dt(e,0,0,null==t?1:t)},z.cubehelix=Kt,z.contours=po,z.contourDensity=function(){var s=vo,u=_o,l=yo,n=960,i=500,o=20,c=2,f=3*o,h=n+2*f>>c,d=i+2*f>>c,p=uo(20);function t(e){var a=new Float32Array(h*d),t=new Float32Array(h*d);e.forEach(function(e,t,r){var n=+s(e,t,r)+f>>c,i=+u(e,t,r)+f>>c,o=+l(e,t,r);0<=n&&n>c),mo({width:h,height:d,data:t},{width:h,height:d,data:a},o>>c),go({width:h,height:d,data:a},{width:h,height:d,data:t},o>>c),mo({width:h,height:d,data:t},{width:h,height:d,data:a},o>>c),go({width:h,height:d,data:a},{width:h,height:d,data:t},o>>c),mo({width:h,height:d,data:t},{width:h,height:d,data:a},o>>c);var r=p(a);if(!Array.isArray(r)){var n=x(a);r=P(0,n,r),(r=M(0,Math.floor(n/r)*r,r)).shift()}return po().thresholds(r).size([h,d])(a).map(g)}function g(e){return e.value*=Math.pow(2,-2*c),e.coordinates.forEach(r),e}function r(e){e.forEach(a)}function a(e){e.forEach(m)}function m(e){e[0]=e[0]*Math.pow(2,c)-f,e[1]=e[1]*Math.pow(2,c)-f}function v(){return h=n+2*(f=3*o)>>c,d=i+2*f>>c,t}return t.x=function(e){return arguments.length?(s="function"==typeof e?e:uo(+e),t):s},t.y=function(e){return arguments.length?(u="function"==typeof e?e:uo(+e),t):u},t.weight=function(e){return arguments.length?(l="function"==typeof e?e:uo(+e),t):l},t.size=function(e){if(!arguments.length)return[n,i];var t=Math.ceil(e[0]),r=Math.ceil(e[1]);if(!(0<=t||0<=t))throw new Error("invalid size");return n=t,i=r,v()},t.cellSize=function(e){if(!arguments.length)return 1<f.index){var u=h-o.x-o.vx,l=d-o.y-o.vy,c=u*u+l*l;ce.r&&(e.r=e[t].r)}function r(){if(o){var e,t,r=o.length;for(a=new Array(r),e=0;ehu(n[0],n[1])&&(n[1]=i[1]),hu(i[0],n[1])>hu(n[0],n[1])&&(n[0]=i[0])):o.push(n=i);for(a=-1/0,t=0,n=o[r=o.length-1];t<=r;n=i,++t)i=o[t],(s=hu(n[1],i[0]))>a&&(a=s,Os=i[0],Is=n[1])}return Bs=zs=null,Os===1/0||Rs===1/0?[[NaN,NaN],[NaN,NaN]]:[[Os,Rs],[Is,Ds]]},z.geoCentroid=function(e){Us=Xs=qs=Hs=Ys=Gs=Ws=Vs=Ks=Zs=Js=0,fs(e,gu);var t=Ks,r=Zs,n=Js,i=t*t+r*r+n*n;return i<1e-12&&(t=Gs,r=Ws,n=Vs,Xsn.x&&(n=e),e.depth>i.depth&&(i=e)});var o=r===n?1:y(r,n)/2,a=o-r.x,s=l/(n.x+o+a),u=c/(i.depth||1);e.eachBefore(function(e){e.x=(e.x+a)*s,e.y=e.depth*u})}return e}function h(e){var t=e.children,r=e.parent.children,n=e.i?r[e.i-1]:null;if(t){!function(e){for(var t,r=0,n=0,i=e.children,o=i.length;0<=--o;)(t=i[o]).z+=r,t.m+=r,r+=t.s+(n+=t.c)}(e);var i=(t[0].z+t[t.length-1].z)/2;n?(e.z=n.z+y(e._,n._),e.m=e.z-i):e.z=i}else n&&(e.z=n.z+y(e._,n._));e.parent.A=function(e,t,r){if(t){for(var n,i=e,o=e,a=t,s=i.parent.children[0],u=i.m,l=o.m,c=a.m,f=s.m;a=qf(a),i=Xf(i),a&&i;)s=Xf(s),(o=qf(o)).a=e,0<(n=a.z+c-i.z-u+y(a._,i._))&&(v=e,_=r,h=(m=a).a.parent===v.parent?m.a:_,g=(p=n)/((d=e).i-h.i),d.c-=g,d.s+=p,h.c+=g,d.z+=p,d.m+=p,u+=n,l+=n),c+=a.m,u+=i.m,f+=s.m,l+=o.m;a&&!qf(o)&&(o.t=a,o.m+=c-l),i&&!Xf(s)&&(s.t=i,s.m+=u-f,r=e)}var h,d,p,g,m,v,_;return r}(e,n,e.parent.A||r[0])}function d(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function p(e){e.x*=l,e.y=e.depth*c}return t.separation=function(e){return arguments.length?(y=e,t):y},t.size=function(e){return arguments.length?(f=!1,l=+e[0],c=+e[1],t):f?null:[l,c]},t.nodeSize=function(e){return arguments.length?(f=!0,l=+e[0],c=+e[1],t):f?[l,c]:null},t},z.treemap=function(){var a=Vf,t=!1,r=1,n=1,s=[0],u=Ef,l=Ef,c=Ef,f=Ef,h=Ef;function i(e){return e.x0=e.y0=0,e.x1=r,e.y1=n,e.eachBefore(o),s=[0],t&&e.eachBefore(Lf),e}function o(e){var t=s[e.depth],r=e.x0+t,n=e.y0+t,i=e.x1-t,o=e.y1-t;i>>1;y[d]tv?(h+=x*=s?1:-1,d-=x):(p=0,h=d=(i+o)/2),(g-=2*w)>tv?(c+=w*=s?1:-1,f-=w):(g=0,c=f=(i+o)/2)}var T=n*Zm(c),S=n*Qm(c),M=r*Zm(d),P=r*Qm(d);if(tv<_){var C,k=n*Zm(f),E=n*Qm(f),A=r*Zm(h),O=r*Qm(h);if(adn&&r.name===t)return new En([[e]],ci,t,+n);return null},z.interrupt=Tn,z.voronoi=function(){var i=j_,o=F_,t=null;function r(n){return new my(n.map(function(e,t){var r=[Math.round(i(e,t,n)/dy)*dy,Math.round(o(e,t,n)/dy)*dy];return r.index=t,r.data=e,r}),t)}return r.polygons=function(e){return r(e).polygons()},r.links=function(e){return r(e).links()},r.triangles=function(e){return r(e).triangles()},r.x=function(e){return arguments.length?(i="function"==typeof e?e:N_(+e),r):i},r.y=function(e){return arguments.length?(o="function"==typeof e?e:N_(+e),r):o},r.extent=function(e){return arguments.length?(t=null==e?null:[[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]],r):t&&[[t[0][0],t[0][1]],[t[1][0],t[1][1]]]},r.size=function(e){return arguments.length?(t=null==e?null:[[0,0],[+e[0],+e[1]]],r):t&&[t[1][0]-t[0][0],t[1][1]-t[0][1]]},r},z.zoom=function(){var d,o,s=Sy,c=My,p=Ey,i=Cy,t=ky,a=[0,1/0],g=[[-1/0,-1/0],[1/0,1/0]],u=250,f=Ir,l=[],r=X("start","zoom","end"),h=500,m=150,v=0;function _(e){e.property("__zoom",Py).on("wheel.zoom",n).on("mousedown.zoom",M).on("dblclick.zoom",P).filter(t).on("touchstart.zoom",C).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(e,t){return(t=Math.max(a[0],Math.min(a[1],t)))===e.k?e:new yy(t,e.x,e.y)}function b(e,t,r){var n=t[0]-r[0]*e.k,i=t[1]-r[1]*e.k;return n===e.x&&i===e.y?e:new yy(e.k,n,i)}function x(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function w(e,u,l){e.on("start.zoom",function(){T(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).end()}).tween("zoom",function(){var e=arguments,n=T(this,e),t=c.apply(this,e),i=l||x(t),o=Math.max(t[1][0]-t[0][0],t[1][1]-t[0][1]),r=this.__zoom,a="function"==typeof u?u.apply(this,e):u,s=f(r.invert(i).concat(o/r.k),a.invert(i).concat(o/a.k));return function(e){if(1===e)e=a;else{var t=s(e),r=o/t[2];e=new yy(r,i[0]-t[0]*r,i[1]-t[1]*r)}n.zoom(null,e)}})}function T(e,t){for(var r,n=0,i=l.length;n]/gm,function(e){return a[e]})}function f(e){return e.nodeName.toLowerCase()}function y(e,t){var r=e&&e.exec(t);return r&&0===r.index}function s(e){return n.test(e)}function b(e,t){var r,n={};for(r in e)n[r]=e[r];if(t)for(r in t)n[r]=t[r];return n}function u(e){var i=[];return function e(t,r){for(var n=t.firstChild;n;n=n.nextSibling)3===n.nodeType?r+=n.nodeValue.length:1===n.nodeType&&(i.push({event:"start",offset:r,node:n}),r=e(n,r),f(n).match(/br|hr|img|input/)||i.push({event:"stop",offset:r,node:n}));return r}(e,0),i}function x(e,t,o,r){function s(e,t,r,n){var i='')+t+(r?"":P)}function a(){h+=null!=c.sL?function(){var e="string"==typeof c.sL;if(e&&!M[c.sL])return _(d);var t=e?x(c.sL,d,!0,f[c.sL]):w(d,c.sL.length?c.sL:void 0);return 0")+'"');return d+=t,t.length||1}var l=T(e);if(!l)throw new Error('Unknown language: "'+e+'"');!function(s){function u(e){return e&&e.source||e}function l(e,t){return new RegExp(u(e),"m"+(s.cI?"i":"")+(t?"g":""))}!function t(r,e){if(!r.compiled){if(r.compiled=!0,r.k=r.k||r.bK,r.k){var n={},i=function(r,e){s.cI&&(e=e.toLowerCase()),e.split(" ").forEach(function(e){var t=e.split("|");n[t[0]]=[r,t[1]?Number(t[1]):1]})};"string"==typeof r.k?i("keyword",r.k):S(r.k).forEach(function(e){i(e,r.k[e])}),r.k=n}r.lR=l(r.l||/\w+/,!0),e&&(r.bK&&(r.b="\\b("+r.bK.split(" ").join("|")+")\\b"),r.b||(r.b=/\B|\b/),r.bR=l(r.b),r.e||r.eW||(r.e=/\B|\b/),r.e&&(r.eR=l(r.e)),r.tE=u(r.e)||"",r.eW&&e.tE&&(r.tE+=(r.e?"|":"")+e.tE)),r.i&&(r.iR=l(r.i)),null==r.r&&(r.r=1),r.c||(r.c=[]);var o=[];r.c.forEach(function(t){t.v?t.v.forEach(function(e){o.push(b(t,e))}):o.push("self"===t?r:t)}),r.c=o,r.c.forEach(function(e){t(e,r)}),r.starts&&t(r.starts,e);var a=r.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([r.tE,r.i]).map(u).filter(Boolean);r.t=a.length?l(a.join("|"),!0):{exec:function(){return null}}}}(s)}(l);var i,c=r||l,f={},h="";for(i=c;i!==l;i=i.parent)i.cN&&(h=s(i.cN,"",!0)+h);var d="",p=0;try{for(var g,m,v=0;c.t.lastIndex=v,g=c.t.exec(t);)m=n(t.substring(v,g.index),g[0]),v=g.index+m;for(n(t.substr(v)),i=c;i.parent;i=i.parent)i.cN&&(h+=P);return{r:p,value:h,language:e,top:c}}catch(e){if(e.message&&-1!==e.message.indexOf("Illegal"))return{r:0,value:_(t)};throw e}}function w(r,e){e=e||C.languages||S(M);var n={r:0,value:_(r)},i=n;return e.filter(T).forEach(function(e){var t=x(e,r,!1);t.language=e,t.r>i.r&&(i=t),t.r>n.r&&(i=n,n=t)}),i.language&&(n.second_best=i),n}function l(e){return C.tabReplace||C.useBR?e.replace(o,function(e,t){return C.useBR&&"\n"===e?"
":C.tabReplace?t.replace(/\t/g,C.tabReplace):void 0}):e}function t(e){var t,r,n,i,o,a=function(e){var t,r,n,i,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",r=d.exec(o))return T(r[1])?r[1]:"no-highlight";for(t=0,n=(o=o.split(/\s+/)).length;t/g,"\n"):t=e,o=t.textContent,n=a?x(a,o,!0):w(o),(r=u(t)).length&&((i=document.createElementNS("http://www.w3.org/1999/xhtml","div")).innerHTML=n.value,n.value=function(e,t,r){function n(){return e.length&&t.length?e[0].offset!==t[0].offset?e[0].offset"}function o(e){u+=""}function a(e){("start"===e.event?i:o)(e.node)}for(var s=0,u="",l=[];e.length||t.length;){var c=n();if(u+=_(r.substring(s,c[0].offset)),s=c[0].offset,c===e){for(l.reverse().forEach(o);a(c.splice(0,1)[0]),(c=n())===e&&c.length&&c[0].offset===s;);l.reverse().forEach(i)}else"start"===c[0].event?l.push(c[0].node):l.pop(),a(c.splice(0,1)[0])}return u+_(r.substr(s))}(r,u(i),o)),n.value=l(n.value),e.innerHTML=n.value,e.className=function(e,t,r){var n=t?c[t]:r,i=[e.trim()];return e.match(/\bhljs\b/)||i.push("hljs"),-1===e.indexOf(n)&&i.push(n),i.join(" ").trim()}(e.className,a,n.language),e.result={language:n.language,re:n.r},n.second_best&&(e.second_best={language:n.second_best.language,re:n.second_best.r}))}function r(){if(!r.called){r.called=!0;var e=document.querySelectorAll("pre code");h.forEach.call(e,t)}}function T(e){return e=(e||"").toLowerCase(),M[e]||M[c[e]]}var h=[],S=Object.keys,M={},c={},n=/^(no-?highlight|plain|text)$/i,d=/\blang(?:uage)?-([\w-]+)\b/i,o=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,P="
",C={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},a={"&":"&","<":"<",">":">"};return i.highlight=x,i.highlightAuto=w,i.fixMarkup=l,i.highlightBlock=t,i.configure=function(e){C=b(C,e)},i.initHighlighting=r,i.initHighlightingOnLoad=function(){addEventListener("DOMContentLoaded",r,!1),addEventListener("load",r,!1)},i.registerLanguage=function(t,e){var r=M[t]=e(i);r.aliases&&r.aliases.forEach(function(e){c[e]=t})},i.listLanguages=function(){return S(M)},i.getLanguage=T,i.inherit=b,i.IR="[a-zA-Z]\\w*",i.UIR="[a-zA-Z_]\\w*",i.NR="\\b\\d+(\\.\\d+)?",i.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",i.BNR="\\b(0b[01]+)",i.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",i.BE={b:"\\\\[\\s\\S]",r:0},i.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[i.BE]},i.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[i.BE]},i.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},i.C=function(e,t,r){var n=i.inherit({cN:"comment",b:e,e:t,c:[]},r||{});return n.c.push(i.PWM),n.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),n},i.CLCM=i.C("//","$"),i.CBCM=i.C("/\\*","\\*/"),i.HCM=i.C("#","$"),i.NM={cN:"number",b:i.NR,r:0},i.CNM={cN:"number",b:i.CNR,r:0},i.BNM={cN:"number",b:i.BNR,r:0},i.CSSNM={cN:"number",b:i.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},i.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[i.BE,{b:/\[/,e:/\]/,r:0,c:[i.BE]}]},i.TM={cN:"title",b:i.IR,r:0},i.UTM={cN:"title",b:i.UIR,r:0},i.METHOD_GUARD={b:"\\.\\s*"+i.UIR,r:0},i}),hljs.registerLanguage("ini",function(e){var t={cN:"string",c:[e.BE],v:[{b:"'''",e:"'''",r:10},{b:'"""',e:'"""',r:10},{b:'"',e:'"'},{b:"'",e:"'"}]};return{aliases:["toml"],cI:!0,i:/\S/,c:[e.C(";","$"),e.HCM,{cN:"section",b:/^\s*\[+/,e:/\]+/},{b:/^[a-z0-9\[\]_-]+\s*=\s*/,e:"$",rB:!0,c:[{cN:"attr",b:/[a-z0-9\[\]_-]+/},{b:/=/,eW:!0,r:0,c:[{cN:"literal",b:/\bon|off|true|false|yes|no\b/},{cN:"variable",v:[{b:/\$[\w\d"][\w\d_]*/},{b:/\$\{(.*?)}/}]},t,{cN:"number",b:/([\+\-]+)?[\d]+_[\d_]+/},e.NM]}]}]}}),hljs.registerLanguage("diff",function(e){return{aliases:["patch"],c:[{cN:"meta",r:10,v:[{b:/^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"comment",v:[{b:/Index: /,e:/$/},{b:/={3,}/,e:/$/},{b:/^\-{3}/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+{3}/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"addition",b:"^\\!",e:"$"}]}}),hljs.registerLanguage("coffeescript",function(e){var t={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super yield import export from as default await then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",built_in:"npm require console print module global window document"},r="[A-Za-z$_][0-9A-Za-z$_]*",n={cN:"subst",b:/#\{/,e:/}/,k:t},i=[e.BNM,e.inherit(e.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'''/,e:/'''/,c:[e.BE]},{b:/'/,e:/'/,c:[e.BE]},{b:/"""/,e:/"""/,c:[e.BE,n]},{b:/"/,e:/"/,c:[e.BE,n]}]},{cN:"regexp",v:[{b:"///",e:"///",c:[n,e.HCM]},{b:"//[gim]*",r:0},{b:/\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/}]},{b:"@"+r},{sL:"javascript",eB:!0,eE:!0,v:[{b:"```",e:"```"},{b:"`",e:"`"}]}];n.c=i;var o=e.inherit(e.TM,{b:r}),a="(\\(.*\\))?\\s*\\B[-=]>",s={cN:"params",b:"\\([^\\(]",rB:!0,c:[{b:/\(/,e:/\)/,k:t,c:["self"].concat(i)}]};return{aliases:["coffee","cson","iced"],k:t,i:/\/\*/,c:i.concat([e.C("###","###"),e.HCM,{cN:"function",b:"^\\s*"+r+"\\s*=\\s*"+a,e:"[-=]>",rB:!0,c:[o,s]},{b:/[:\(,=]\s*/,r:0,c:[{cN:"function",b:a,e:"[-=]>",rB:!0,c:[s]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[o]},o]},{b:r+":",e:":",rB:!0,rE:!0,r:0}])}}),hljs.registerLanguage("cs",function(e){var t={keyword:"abstract as base bool break byte case catch char checked const continue decimal default delegate do double else enum event explicit extern finally fixed float for foreach goto if implicit in int interface internal is lock long object operator out override params private protected public readonly ref sbyte sealed short sizeof stackalloc static string struct switch this try typeof uint ulong unchecked unsafe ushort using virtual void volatile while nameof add alias ascending async await by descending dynamic equals from get global group into join let on orderby partial remove select set value var where yield",literal:"null false true"},r={cN:"string",b:'@"',e:'"',c:[{b:'""'}]},n=e.inherit(r,{i:/\n/}),i={cN:"subst",b:"{",e:"}",k:t},o=e.inherit(i,{i:/\n/}),a={cN:"string",b:/\$"/,e:'"',i:/\n/,c:[{b:"{{"},{b:"}}"},e.BE,o]},s={cN:"string",b:/\$@"/,e:'"',c:[{b:"{{"},{b:"}}"},{b:'""'},i]},u=e.inherit(s,{i:/\n/,c:[{b:"{{"},{b:"}}"},{b:'""'},o]});i.c=[s,a,r,e.ASM,e.QSM,e.CNM,e.CBCM],o.c=[u,a,n,e.ASM,e.QSM,e.CNM,e.inherit(e.CBCM,{i:/\n/})];var l={v:[s,a,r,e.ASM,e.QSM]},c=e.IR+"(<"+e.IR+"(\\s*,\\s*"+e.IR+")*>)?(\\[\\])?";return{aliases:["csharp"],k:t,i:/::/,c:[e.C("///","$",{rB:!0,c:[{cN:"doctag",v:[{b:"///",r:0},{b:"\x3c!--|--\x3e"},{b:""}]}]}),e.CLCM,e.CBCM,{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef warning error line region endregion pragma checksum"}},l,e.CNM,{bK:"class interface",e:/[{;=]/,i:/[^\s:]/,c:[e.TM,e.CLCM,e.CBCM]},{bK:"namespace",e:/[{;=]/,i:/[^\s:]/,c:[e.inherit(e.TM,{b:"[a-zA-Z](\\.?\\w)*"}),e.CLCM,e.CBCM]},{bK:"new return throw await",r:0},{cN:"function",b:"("+c+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:t,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,r:0,c:[l,e.CNM,e.CBCM]},e.CLCM,e.CBCM]}]}}),hljs.registerLanguage("sql",function(e){var t=e.C("--","$");return{cI:!0,i:/[<>{}*#]/,c:[{bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke comment",e:/;/,eW:!0,l:/[\w\.]+/,k:{keyword:"abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text varchar varying void"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t]},e.CBCM,t]}}),hljs.registerLanguage("javascript",function(e){var t="[A-Za-z$_][0-9A-Za-z$_]*",r={keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},n={cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},i={cN:"subst",b:"\\$\\{",e:"\\}",k:r,c:[]},o={cN:"string",b:"`",e:"`",c:[e.BE,i]};i.c=[e.ASM,e.QSM,o,n,e.RM];var a=i.c.concat([e.CBCM,e.CLCM]);return{aliases:["js","jsx"],k:r,c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,o,e.CLCM,e.CBCM,n,{b:/[{,]\s*/,r:0,c:[{b:t+"\\s*:",rB:!0,r:0,c:[{cN:"attr",b:t,r:0}]}]},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+t+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:t},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:r,c:a}]}]},{b://,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:t}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:a}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}}),hljs.registerLanguage("nginx",function(e){var t={cN:"variable",v:[{b:/\$\d+/},{b:/\$\{/,e:/}/},{b:"[\\$\\@]"+e.UIR}]},r={eW:!0,l:"[a-z/_]+",k:{literal:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[e.HCM,{cN:"string",c:[e.BE,t],v:[{b:/"/,e:/"/},{b:/'/,e:/'/}]},{b:"([a-z]+):/",e:"\\s",eW:!0,eE:!0,c:[t]},{cN:"regexp",c:[e.BE,t],v:[{b:"\\s\\^",e:"\\s|{|;",rE:!0},{b:"~\\*?\\s+",e:"\\s|{|;",rE:!0},{b:"\\*(\\.[a-z\\-]+)+"},{b:"([a-z\\-]+\\.)+\\*"}]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0},t]};return{aliases:["nginxconf"],c:[e.HCM,{b:e.UIR+"\\s+{",rB:!0,e:"{",c:[{cN:"section",b:e.UIR}],r:0},{b:e.UIR+"\\s",e:";|{",rB:!0,c:[{cN:"attribute",b:e.UIR,starts:r}],r:0}],i:"[^\\s\\}]"}}),hljs.registerLanguage("objectivec",function(e){var t=/[a-zA-Z@][a-zA-Z0-9_]*/,r="@interface @class @protocol @implementation";return{aliases:["mm","objc","obj-c"],k:{keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign readwrite self @synchronized id typeof nonatomic super unichar IBOutlet IBAction strong weak copy in out inout bycopy byref oneway __strong __weak __block __autoreleasing @private @protected @public @try @property @end @throw @catch @finally @autoreleasepool @synthesize @dynamic @selector @optional @required @encode @package @import @defs @compatibility_alias __bridge __bridge_transfer __bridge_retained __bridge_retain __covariant __contravariant __kindof _Nonnull _Nullable _Null_unspecified __FUNCTION__ __PRETTY_FUNCTION__ __attribute__ getter setter retain unsafe_unretained nonnull nullable null_unspecified null_resettable class instancetype NS_DESIGNATED_INITIALIZER NS_UNAVAILABLE NS_REQUIRES_SUPER NS_RETURNS_INNER_POINTER NS_INLINE NS_AVAILABLE NS_DEPRECATED NS_ENUM NS_OPTIONS NS_SWIFT_UNAVAILABLE NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_REFINED_FOR_SWIFT NS_SWIFT_NAME NS_SWIFT_NOTHROW NS_DURING NS_HANDLER NS_ENDHANDLER NS_VALUERETURN NS_VOIDRETURN",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"BOOL dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"},l:t,i:""}]}]},{cN:"class",b:"("+r.split(" ").join("|")+")\\b",e:"({|$)",eE:!0,k:r,l:t,c:[e.UTM]},{b:"\\."+e.UIR,r:0}]}}),hljs.registerLanguage("php",function(e){var t={b:"\\$+[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*"},r={cN:"meta",b:/<\?(php)?|\?>/},n={cN:"string",c:[e.BE,r],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},i={v:[e.BNM,e.CNM]};return{aliases:["php3","php4","php5","php6"],cI:!0,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[e.HCM,e.C("//","$",{c:[r]}),e.C("/\\*","\\*/",{c:[{cN:"doctag",b:"@[A-Za-z]+"}]}),e.C("__halt_compiler.+?;",!1,{eW:!0,k:"__halt_compiler",l:e.UIR}),{cN:"string",b:/<<<['"]?\w+['"]?$/,e:/^\w+;?$/,c:[e.BE,{cN:"subst",v:[{b:/\$\w+/},{b:/\{\$/,e:/\}/}]}]},r,{cN:"keyword",b:/\$this\b/},t,{b:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{cN:"function",bK:"function",e:/[;{]/,eE:!0,i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",t,e.CBCM,n,i]}]},{cN:"class",bK:"class interface",e:"{",eE:!0,i:/[:\(\$"]/,c:[{bK:"extends implements"},e.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[e.UTM]},{bK:"use",e:";",c:[e.UTM]},{b:"=>"},n,i]}}),hljs.registerLanguage("json",function(e){var t={literal:"true false null"},r=[e.QSM,e.CNM],n={e:",",eW:!0,eE:!0,c:r,k:t},i={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(n,{b:/:/})],i:"\\S"},o={b:"\\[",e:"\\]",c:[e.inherit(n)],i:"\\S"};return r.splice(r.length,0,i,o),{c:r,k:t,i:"\\S"}}),hljs.registerLanguage("cpp",function(e){var t={cN:"keyword",b:"\\b[a-z\\d_]*_t\\b"},r={cN:"string",v:[{b:'(u8?|U)?L?"',e:'"',i:"\\n",c:[e.BE]},{b:'(u8?|U)?R"',e:'"',c:[e.BE]},{b:"'\\\\?.",e:"'",i:"."}]},n={cN:"number",v:[{b:"\\b(0b[01']+)"},{b:"\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{b:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],r:0},i={cN:"meta",b:/#\s*[a-z]+\b/,e:/$/,k:{"meta-keyword":"if else elif endif define undef warning error line pragma ifdef ifndef include"},c:[{b:/\\\n/,r:0},e.inherit(r,{cN:"meta-string"}),{cN:"meta-string",b:"<",e:">",i:"\\n"},e.CLCM,e.CBCM]},o=e.IR+"\\s*\\(",a={keyword:"int float while private char catch import module export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue inline delete alignof constexpr decltype noexcept static_assert thread_local restrict _Bool complex _Complex _Imaginary atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong new throw return",built_in:"std string cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr",literal:"true false nullptr NULL"},s=[t,e.CLCM,e.CBCM,n,r];return{aliases:["c","cc","h","c++","h++","hpp"],k:a,i:"",k:a,c:["self",t]},{b:e.IR+"::",k:a},{v:[{b:/=/,e:/;/},{b:/\(/,e:/\)/},{bK:"new throw return else",e:/;/}],k:a,c:s.concat([{b:/\(/,e:/\)/,k:a,c:s.concat(["self"]),r:0}]),r:0},{cN:"function",b:"("+e.IR+"[\\*&\\s]+)+"+o,rB:!0,e:/[{;=]/,eE:!0,k:a,i:/[^\w\s\*&]/,c:[{b:o,rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:a,r:0,c:[e.CLCM,e.CBCM,r,n,t]},e.CLCM,e.CBCM,i]}]),exports:{preprocessor:i,strings:r,k:a}}}),hljs.registerLanguage("python",function(e){var t={cN:"meta",b:/^(>>>|\.\.\.) /},r={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[t],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[t],r:10},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},e.ASM,e.QSM]},n={cN:"number",r:0,v:[{b:e.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:e.CNR+"[lLjJ]?"}]},i={cN:"params",b:/\(/,e:/\)/,c:["self",t,n,r]};return{aliases:["py","gyp"],k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda async await nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)|=>/,c:[t,n,r,e.HCM,{v:[{cN:"function",bK:"def"},{cN:"class",bK:"class"}],e:/:/,i:/[${=;\n,]/,c:[e.UTM,i,{b:/->/,eW:!0,k:"None"}]},{cN:"meta",b:/^[\t ]*@/,e:/$/},{b:/\b(print|exec)\(/}]}}),hljs.registerLanguage("makefile",function(e){var t={cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]};return{aliases:["mk","mak"],c:[e.HCM,{b:/^\w+\s*\W*=/,rB:!0,r:0,starts:{e:/\s*\W*=/,eE:!0,starts:{e:/$/,r:0,c:[t]}}},{cN:"section",b:/^[\w]+:\s*$/},{cN:"meta",b:/^\.PHONY:/,e:/$/,k:{"meta-keyword":".PHONY"},l:/[\.\w]+/},{b:/^\t+/,e:/$/,r:0,c:[e.QSM,t]}]}}),hljs.registerLanguage("xml",function(e){var t={eW:!0,i:/`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},e.C("\x3c!--","--\x3e",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0}]},{cN:"tag",b:"|$)",e:">",k:{name:"style"},c:[t],starts:{e:"",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"|$)",e:">",k:{name:"script"},c:[t],starts:{e:"<\/script>",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"",c:[{cN:"name",b:/[^\/><\s]+/,r:0},t]}]}}),hljs.registerLanguage("http",function(e){var t="HTTP/[0-9\\.]+";return{aliases:["https"],i:"\\S",c:[{b:"^"+t,e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{b:"^[A-Z]+ (.*?) "+t+"$",rB:!0,e:"$",c:[{cN:"string",b:" ",e:" ",eB:!0,eE:!0},{b:t},{cN:"keyword",b:"[A-Z]+"}]},{cN:"attribute",b:"^\\w",e:": ",eE:!0,i:"\\n|\\s|=",starts:{e:"$",r:0}},{b:"\\n\\n",starts:{sL:[],eW:!0}}]}}),hljs.registerLanguage("java",function(e){var t="false synchronized int abstract float private char boolean static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private module requires exports do",r={cN:"number",b:"\\b(0[bB]([01]+[01_]+[01]+|[01]+)|0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)|(([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?|\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))([eE][-+]?\\d+)?)[lLfF]?",r:0};return{aliases:["jsp"],k:t,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return else",r:0},{cN:"function",b:"([À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*(<[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*(\\s*,\\s*[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*)*>)?\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:t,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:t,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},r,{cN:"meta",b:"@[A-Za-z]+"}]}}),hljs.registerLanguage("markdown",function(e){return{aliases:["md","mkdown","mkd"],c:[{cN:"section",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"quote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"^```w*s*$",e:"^```s*$"},{b:"`.+?`"},{b:"^( {4}|\t)",e:"$",r:0}]},{b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"string",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"symbol",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:/^\[[^\n]+\]:/,rB:!0,c:[{cN:"symbol",b:/\[/,e:/\]/,eB:!0,eE:!0},{cN:"link",b:/:\s*/,e:/$/,eB:!0}]}]}}),hljs.registerLanguage("apache",function(e){var t={cN:"number",b:"[\\$%]\\d+"};return{aliases:["apacheconf"],cI:!0,c:[e.HCM,{cN:"section",b:""},{cN:"attribute",b:/\w+/,r:0,k:{nomarkup:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"meta",b:"\\s\\[",e:"\\]$"},{cN:"variable",b:"[\\$%]\\{",e:"\\}",c:["self",t]},t,e.QSM]}}],i:/\S/}}),hljs.registerLanguage("css",function(e){var t={b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\w-]+\(/,rB:!0,c:[{cN:"built_in",b:/[\w-]+/},{b:/\(/,e:/\)/,c:[e.ASM,e.QSM]}]},e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"number",b:"#[0-9A-Fa-f]+"},{cN:"meta",b:"!important"}]}}]};return{cI:!0,i:/[=\/|'\$]/,c:[e.CBCM,{cN:"selector-id",b:/#[A-Za-z0-9_-]+/},{cN:"selector-class",b:/\.[A-Za-z0-9_-]+/},{cN:"selector-attr",b:/\[/,e:/\]/,i:"$"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{b:"@",e:"[{;]",i:/:/,c:[{cN:"keyword",b:/\w+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[e.ASM,e.QSM,e.CSSNM]}]},{cN:"selector-tag",b:"[a-zA-Z-][a-zA-Z0-9_-]*",r:0},{b:"{",e:"}",i:/\S/,c:[e.CBCM,t]}]}}),hljs.registerLanguage("ruby",function(e){var t="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",r={keyword:"and then defined module in return redo if BEGIN retry end for self when next until do begin unless END rescue else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor",literal:"true false nil"},n={cN:"doctag",b:"@[A-Za-z]+"},i={b:"#<",e:">"},o=[e.C("#","$",{c:[n]}),e.C("^\\=begin","^\\=end",{c:[n],r:10}),e.C("^__END__","\\n$")],a={cN:"subst",b:"#\\{",e:"}",k:r},s={cN:"string",c:[e.BE,a],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/`/,e:/`/},{b:"%[qQwWx]?\\(",e:"\\)"},{b:"%[qQwWx]?\\[",e:"\\]"},{b:"%[qQwWx]?{",e:"}"},{b:"%[qQwWx]?<",e:">"},{b:"%[qQwWx]?/",e:"/"},{b:"%[qQwWx]?%",e:"%"},{b:"%[qQwWx]?-",e:"-"},{b:"%[qQwWx]?\\|",e:"\\|"},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/},{b:/<<(-?)\w+$/,e:/^\s*\w+$/}]},u={cN:"params",b:"\\(",e:"\\)",endsParent:!0,k:r},l=[s,i,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{b:"<\\s*",c:[{b:"("+e.IR+"::)?"+e.IR}]}].concat(o)},{cN:"function",bK:"def",e:"$|;",c:[e.inherit(e.TM,{b:t}),u].concat(o)},{b:e.IR+"::"},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":(?!\\s)",c:[s,{b:t}],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{cN:"params",b:/\|/,e:/\|/,k:r},{b:"("+e.RSR+"|unless)\\s*",c:[i,{cN:"regexp",c:[e.BE,a],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}].concat(o),r:0}].concat(o);a.c=l;var c=[{b:/^\s*=>/,starts:{e:"$",c:u.c=l}},{cN:"meta",b:"^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+>|(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>)",starts:{e:"$",c:l}}];return{aliases:["rb","gemspec","podspec","thor","irb"],k:r,i:/\/\*/,c:o.concat(c).concat(l)}}),hljs.registerLanguage("perl",function(e){var t="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when",r={cN:"subst",b:"[$@]\\{",e:"\\}",k:t},n={b:"->{",e:"}"},i={v:[{b:/\$\d/},{b:/[\$%@](\^\w\b|#\w+(::\w+)*|{\w+}|\w+(::\w*)*)/},{b:/[\$%@][^\s\w{]/,r:0}]},o=[e.BE,r,i],a=[i,e.HCM,e.C("^\\=\\w","\\=cut",{eW:!0}),n,{cN:"string",c:o,v:[{b:"q[qwxr]?\\s*\\(",e:"\\)",r:5},{b:"q[qwxr]?\\s*\\[",e:"\\]",r:5},{b:"q[qwxr]?\\s*\\{",e:"\\}",r:5},{b:"q[qwxr]?\\s*\\|",e:"\\|",r:5},{b:"q[qwxr]?\\s*\\<",e:"\\>",r:5},{b:"qw\\s+q",e:"q",r:5},{b:"'",e:"'",c:[e.BE]},{b:'"',e:'"'},{b:"`",e:"`",c:[e.BE]},{b:"{\\w+}",c:[],r:0},{b:"-?\\w+\\s*\\=\\>",c:[],r:0}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\/\\/|"+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"function",bK:"sub",e:"(\\s*\\(.*?\\))?[;{]",eE:!0,r:5,c:[e.TM]},{b:"-\\w\\b",r:0},{b:"^__DATA__$",e:"^__END__$",sL:"mojolicious",c:[{b:"^@@.*",e:"$",cN:"comment"}]}];return r.c=a,{aliases:["pl","pm"],l:/[\w\.]+/,k:t,c:n.c=a}}),hljs.registerLanguage("bash",function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},r={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]};return{aliases:["sh","zsh"],l:/-?[a-z\._]+/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"meta",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,r,{cN:"string",b:/'/,e:/'/},t]}}),function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).PIXI=e()}}(function(){return function o(a,s,u){function l(r,e){if(!s[r]){if(!a[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(c)return c(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var i=s[r]={exports:{}};a[r][0].call(i.exports,function(e){var t=a[r][1][e];return l(t||e)},i,i.exports,o,a,s,u)}return s[r].exports}for(var c="function"==typeof require&&require,e=0;e>31;return(e^t)-t},r.min=function(e,t){return t^(e^t)&-(e>>=t))<<3,t|=r=(15<(e>>>=r))<<2,(t|=r=(3<(e>>>=r))<<1)|(e>>>=r)>>1},r.log10=function(e){return 1e9<=e?9:1e8<=e?8:1e7<=e?7:1e6<=e?6:1e5<=e?5:1e4<=e?4:1e3<=e?3:100<=e?2:10<=e?1:0},r.popCount=function(e){return 16843009*((e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(e){return e+=0===e,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1},r.prevPow2=function(e){return e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)-(e>>>1)},r.parity=function(e){return e^=e>>>16,e^=e>>>8,e^=e>>>4,27030>>>(e&=15)&1};var i=new Array(256);!function(e){for(var t=0;t<256;++t){var r=t,n=t,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;e[t]=n<>>8&255]<<16|i[e>>>16&255]<<8|i[e>>>24&255]},r.interleave2=function(e,t){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))<<1},r.deinterleave2=function(e,t){return(e=65535&((e=16711935&((e=252645135&((e=858993459&((e=e>>>t&1431655765)|e>>>1))|e>>>2))|e>>>4))|e>>>16))<<16>>16},r.interleave3=function(e,t,r){return e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2),(e|=(t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2))<<1)|(r=1227133513&((r=3272356035&((r=251719695&((r=4278190335&((r&=1023)|r<<16))|r<<8))|r<<4))|r<<2))<<2},r.deinterleave3=function(e,t){return(e=1023&((e=4278190335&((e=251719695&((e=3272356035&((e=e>>>t&1227133513)|e>>>2))|e>>>4))|e>>>8))|e>>>16))<<22>>22},r.nextCombination=function(e){var t=e|e-1;return 1+t|(~t&-~t)-1>>>n(e)+1}},{}],2:[function(e,t,r){"use strict";function n(e,t,r){r=r||2;var n,i,o,a,s,u,l,c=t&&t.length,f=c?t[0]*r:e.length,h=g(e,0,f,r,!0),d=[];if(!h||h.next===h.prev)return d;if(c&&(h=function(e,t,r,n){var i,o,a,s,u,l=[];for(i=0,o=t.length;i80*r){n=o=e[0],i=a=e[1];for(var p=r;po.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,c=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,f=b(s,u,t,r,n),h=b(l,c,t,r,n),d=e.prevZ,p=e.nextZ;d&&d.z>=f&&p&&p.z<=h;){if(d!==e.prev&&d!==e.next&&w(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&0<=T(d.prev,d,d.next))return!1;if(d=d.prevZ,p!==e.prev&&p!==e.next&&w(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&0<=T(p.prev,p,p.next))return!1;p=p.nextZ}for(;d&&d.z>=f;){if(d!==e.prev&&d!==e.next&&w(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&0<=T(d.prev,d,d.next))return!1;d=d.prevZ}for(;p&&p.z<=h;){if(p!==e.prev&&p!==e.next&&w(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&0<=T(p.prev,p,p.next))return!1;p=p.nextZ}return!0}function h(e,t,r){var n=e;do{var i=n.prev,o=n.next.next;!s(i,o)&&p(i,n,n.next,o)&&S(i,o)&&S(o,i)&&(t.push(i.i/r),t.push(n.i/r),t.push(o.i/r),P(n),P(n.next),n=e=o),n=n.next}while(n!==e);return n}function d(e,t,r,n,i,o){var a,s,u=e;do{for(var l=u.next.next;l!==u.prev;){if(u.i!==l.i&&(s=l,(a=u).next.i!==s.i&&a.prev.i!==s.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&p(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(a,s)&&S(a,s)&&S(s,a)&&function(e,t){var r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;for(;r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next,r!==e;);return n}(a,s))){var c=M(u,l);return u=m(u,u.next),c=m(c,c.next),v(u,t,r,n,i,o),void v(c,t,r,n,i,o)}l=l.next}u=u.next}while(u!==e)}function _(e,t){return e.x-t.x}function y(e,t){if(t=function(e,t){var r,n=t,i=e.x,o=e.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&a=n.x&&n.x>=c&&i!==n.x&&w(or.x)&&S(n,e)&&(r=n,h=u),n=n.next;return r}(e,t)){var r=M(t,e);m(r,r.next)}}function b(e,t,r,n,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function x(e){for(var t=e,r=e;t.x=e.byteLength?n.bufferSubData(this.type,t,e):n.bufferData(this.type,e,this.drawType),this.data=e},o.prototype.bind=function(){this.gl.bindBuffer(this.type,this.buffer)},o.createVertexBuffer=function(e,t,r){return new o(e,e.ARRAY_BUFFER,t,r)},o.createIndexBuffer=function(e,t,r){return new o(e,e.ELEMENT_ARRAY_BUFFER,t,r)},o.create=function(e,t,r,n){return new o(e,t,r,n)},o.prototype.destroy=function(){this.gl.deleteBuffer(this.buffer)},t.exports=o},{}],10:[function(e,t,r){var a=e("./GLTexture"),s=function(e,t,r){this.gl=e,this.framebuffer=e.createFramebuffer(),this.stencil=null,this.texture=null,this.width=t||100,this.height=r||100};s.prototype.enableTexture=function(e){var t=this.gl;this.texture=e||new a(t),this.texture.bind(),this.bind(),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.texture.texture,0)},s.prototype.enableStencil=function(){if(!this.stencil){var e=this.gl;this.stencil=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,this.stencil),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,this.stencil),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,this.width,this.height)}},s.prototype.clear=function(e,t,r,n){this.bind();var i=this.gl;i.clearColor(e,t,r,n),i.clear(i.COLOR_BUFFER_BIT|i.DEPTH_BUFFER_BIT)},s.prototype.bind=function(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer)},s.prototype.unbind=function(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null)},s.prototype.resize=function(e,t){var r=this.gl;this.width=e,this.height=t,this.texture&&this.texture.uploadData(null,e,t),this.stencil&&(r.bindRenderbuffer(r.RENDERBUFFER,this.stencil),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,e,t))},s.prototype.destroy=function(){var e=this.gl;this.texture&&this.texture.destroy(),e.deleteFramebuffer(this.framebuffer),this.gl=null,this.stencil=null,this.texture=null},s.createRGBA=function(e,t,r,n){var i=a.fromData(e,null,t,r);i.enableNearestScaling(),i.enableWrapClamp();var o=new s(e,t,r);return o.enableTexture(i),o.unbind(),o},s.createFloat32=function(e,t,r,n){var i=new a.fromData(e,n,t,r);i.enableNearestScaling(),i.enableWrapClamp();var o=new s(e,t,r);return o.enableTexture(i),o.unbind(),o},t.exports=s},{"./GLTexture":12}],11:[function(e,t,r){var o=e("./shader/compileProgram"),a=e("./shader/extractAttributes"),s=e("./shader/extractUniforms"),u=e("./shader/setPrecision"),l=e("./shader/generateUniformAccessObject"),n=function(e,t,r,n,i){this.gl=e,n&&(t=u(t,n),r=u(r,n)),this.program=o(e,t,r,i),this.attributes=a(e,this.program),this.uniformData=s(e,this.program),this.uniforms=l(e,this.uniformData)};n.prototype.bind=function(){return this.gl.useProgram(this.program),this},n.prototype.destroy=function(){this.attributes=null,this.uniformData=null,this.uniforms=null,this.gl.deleteProgram(this.program)},t.exports=n},{"./shader/compileProgram":17,"./shader/extractAttributes":19,"./shader/extractUniforms":20,"./shader/generateUniformAccessObject":21,"./shader/setPrecision":25}],12:[function(e,t,r){var o=function(e,t,r,n,i){this.gl=e,this.texture=e.createTexture(),this.mipmap=!1,this.premultiplyAlpha=!1,this.width=t||-1,this.height=r||-1,this.format=n||e.RGBA,this.type=i||e.UNSIGNED_BYTE},i=!(o.prototype.upload=function(e){this.bind();var t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha);var r=e.videoWidth||e.width,n=e.videoHeight||e.height;n!==this.height||r!==this.width?t.texImage2D(t.TEXTURE_2D,0,this.format,this.format,this.type,e):t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.format,this.type,e),this.width=r,this.height=n});o.prototype.uploadData=function(e,t,r){this.bind();var n=this.gl;if(e instanceof Float32Array){if(!i){if(!n.getExtension("OES_texture_float"))throw new Error("floating point textures not available");i=!0}this.type=n.FLOAT}else this.type=this.type||n.UNSIGNED_BYTE;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha),t!==this.width||r!==this.height?n.texImage2D(n.TEXTURE_2D,0,this.format,t,r,0,this.format,this.type,e||null):n.texSubImage2D(n.TEXTURE_2D,0,0,0,t,r,this.format,this.type,e||null),this.width=t,this.height=r},o.prototype.bind=function(e){var t=this.gl;void 0!==e&&t.activeTexture(t.TEXTURE0+e),t.bindTexture(t.TEXTURE_2D,this.texture)},o.prototype.unbind=function(){var e=this.gl;e.bindTexture(e.TEXTURE_2D,null)},o.prototype.minFilter=function(e){var t=this.gl;this.bind(),this.mipmap?t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,e?t.LINEAR_MIPMAP_LINEAR:t.NEAREST_MIPMAP_NEAREST):t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,e?t.LINEAR:t.NEAREST)},o.prototype.magFilter=function(e){var t=this.gl;this.bind(),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,e?t.LINEAR:t.NEAREST)},o.prototype.enableMipmap=function(){var e=this.gl;this.bind(),this.mipmap=!0,e.generateMipmap(e.TEXTURE_2D)},o.prototype.enableLinearScaling=function(){this.minFilter(!0),this.magFilter(!0)},o.prototype.enableNearestScaling=function(){this.minFilter(!1),this.magFilter(!1)},o.prototype.enableWrapClamp=function(){var e=this.gl;this.bind(),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)},o.prototype.enableWrapRepeat=function(){var e=this.gl;this.bind(),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT)},o.prototype.enableWrapMirrorRepeat=function(){var e=this.gl;this.bind(),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.MIRRORED_REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.MIRRORED_REPEAT)},o.prototype.destroy=function(){this.gl.deleteTexture(this.texture)},o.fromSource=function(e,t,r){var n=new o(e);return n.premultiplyAlpha=r||!1,n.upload(t),n},o.fromData=function(e,t,r,n){var i=new o(e);return i.uploadData(t,r,n),i},t.exports=o},{}],13:[function(e,t,r){var i=e("./setVertexAttribArrays");function n(e,t){if(this.nativeVaoExtension=null,n.FORCE_NATIVE||(this.nativeVaoExtension=e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object")),this.nativeState=t,this.nativeVaoExtension){this.nativeVao=this.nativeVaoExtension.createVertexArrayOES();var r=e.getParameter(e.MAX_VERTEX_ATTRIBS);this.nativeState={tempAttribState:new Array(r),attribState:new Array(r)}}this.gl=e,this.attributes=[],this.indexBuffer=null,this.dirty=!1}n.prototype.constructor=n,(t.exports=n).FORCE_NATIVE=!1,n.prototype.bind=function(){if(this.nativeVao){if(this.nativeVaoExtension.bindVertexArrayOES(this.nativeVao),this.dirty)return this.dirty=!1,this.activate(),this;this.indexBuffer&&this.indexBuffer.bind()}else this.activate();return this},n.prototype.unbind=function(){return this.nativeVao&&this.nativeVaoExtension.bindVertexArrayOES(null),this},n.prototype.activate=function(){for(var e=this.gl,t=null,r=0;r= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=_-y,S=Math.floor,M=String.fromCharCode;function P(e){throw new RangeError(f[e])}function d(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function p(e,t){var r=e.split("@"),n="";return 1>>10&1023|55296),e=56320|1023&e),t+=M(e)}).join("")}function E(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function A(e,t,r){var n=0;for(e=r?S(e/s):e>>1,e+=S(e/t);h*b>>1S((v-p)/a))&&P("overflow"),p+=u*a,!(u<(l=s<=m?y:m+b<=s?b:s-m));s+=_)a>S(v/(c=_-l))&&P("overflow"),a*=c;m=A(p-o,t=h.length+1,0==o),S(p/t)>v-g&&P("overflow"),g+=S(p/t),p%=t,h.splice(p++,0,g)}return k(h)}function m(e){var t,r,n,i,o,a,s,u,l,c,f,h,d,p,g,m=[];for(h=(e=C(e)).length,t=w,o=x,a=r=0;aS((v-r)/(d=n+1))&&P("overflow"),r+=(s-t)*d,t=s,a=0;av&&P("overflow"),f==t){for(u=r,l=_;!(u<(c=l<=o?y:o+b<=l?b:l-o));l+=_)g=u-c,p=_-c,m.push(M(E(c+g%p,0))),u=S(g/p);m.push(M(E(u,0))),o=A(r,d,n==i),r=0,++n}++r,++t}return m.join("")}if(i={version:"1.4.1",ucs2:{decode:C,encode:k},decode:g,encode:m,toASCII:function(e){return p(e,function(e){return l.test(e)?"xn--"+m(e):e})},toUnicode:function(e){return p(e,function(e){return u.test(e)?g(e.slice(4).toLowerCase()):e})}},t&&r)if(R.exports==t)r.exports=i;else for(o in i)i.hasOwnProperty(o)&&(t[o]=i[o]);else e.punycode=i}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],28:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){t=t||"&",r=r||"=";var i={};if("string"!=typeof e||0===e.length)return i;var o=/\+/g;e=e.split(t);var a=1e3;n&&"number"==typeof n.maxKeys&&(a=n.maxKeys);var s,u,l=e.length;0>2,i[1]=(3&n[0])<<4|n[1]>>4,i[2]=(15&n[1])<<2|n[2]>>6,i[3]=63&n[2],r-(e.length-1)){case 2:i[3]=64,i[2]=64;break;case 1:i[3]=64}for(var a=0;a",'"',"`"," ","\r","\n","\t"]),j=["'"].concat(i),F=["%","/","?",";","#"].concat(j),B=["/","?","#"],z=/^[+a-z0-9A-Z_-]{0,63}$/,U=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,X={javascript:!0,"javascript:":!0},q={javascript:!0,"javascript:":!0},H={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Y=e("querystring");function o(e,t,r){if(e&&D.isObject(e)&&e instanceof C)return e;var n=new C;return n.parse(e,t,r),n}C.prototype.parse=function(e,t,r){if(!D.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),i=-1!==n&&nthis.renderer.width&&(e.width=this.renderer.width-e.x),e.y+e.height>this.renderer.height&&(e.height=this.renderer.height-e.y)},r.prototype.addChild=function(e){var t=this.pool.pop();t||((t=document.createElement("button")).style.width="100px",t.style.height="100px",t.style.backgroundColor=this.debug?"rgba(255,0,0,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=2,t.style.borderStyle="none",-1]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,r.SHAPES={POLY:0,RECT:1,CIRC:2,ELIP:3,RREC:4},r.PRECISION={LOW:"lowp",MEDIUM:"mediump",HIGH:"highp"},r.TRANSFORM_MODE={STATIC:0,DYNAMIC:1},r.TEXT_GRADIENT={LINEAR_VERTICAL:0,LINEAR_HORIZONTAL:1},r.UPDATE_PRIORITY={INTERACTION:50,HIGH:25,NORMAL:0,LOW:-25,UTILITY:-50}},{}],47:[function(e,t,r){"use strict";r.__esModule=!0;var n=e("../math");var i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null}return e.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},e.prototype.clear=function(){this.updateID++,this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},e.prototype.getRectangle=function(e){return this.minX>this.maxX||this.minY>this.maxY?n.Rectangle.EMPTY:((e=e||new n.Rectangle(0,0,1,1)).x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)},e.prototype.addPoint=function(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)},e.prototype.addQuad=function(e){var t=this.minX,r=this.minY,n=this.maxX,i=this.maxY,o=e[0],a=e[1];t=on?e.maxX:n,this.maxY=e.maxY>i?e.maxY:i},e.prototype.addBoundsMask=function(e,t){var r=e.minX>t.minX?e.minX:t.minX,n=e.minY>t.minY?e.minY:t.minY,i=e.maxXt.x?e.minX:t.x,n=e.minY>t.y?e.minY:t.y,i=e.maxXthis.children.length)throw new Error(e+"addChildAt: The index "+t+" supplied is out of bounds "+this.children.length);return e.parent&&e.parent.removeChild(e),e.parent=this,e.transform._parentID=-1,this.children.splice(t,0,e),this._boundsID++,this.onChildrenChange(t),e.emit("added",this),e},t.prototype.swapChildren=function(e,t){if(e!==t){var r=this.getChildIndex(e),n=this.getChildIndex(t);this.children[r]=t,this.children[n]=e,this.onChildrenChange(r=this.children.length)throw new Error("The index "+t+" supplied is out of bounds "+this.children.length);var r=this.getChildIndex(e);(0,a.removeItems)(this.children,r,1),this.children.splice(t,0,e),this.onChildrenChange(t)},t.prototype.getChildAt=function(e){if(e<0||e>=this.children.length)throw new Error("getChildAt: Index ("+e+") does not exist.");return this.children[e]},t.prototype.removeChild=function(e){var t=arguments.length;if(1T.CURVES.maxSegments&&(t=T.CURVES.maxSegments),t},T.prototype.lineStyle=function(){var e=0>16&255)/255,r=(e.tint>>8&255)/255,n=(255&e.tint)/255,i=0;i>16&255)/255*t*255<<16)+((a>>8&255)/255*r*255<<8)+(255&a)/255*n*255,o._lineTint=((s>>16&255)/255*t*255<<16)+((s>>8&255)/255*r*255<<8)+(255&s)/255*n*255}},t.prototype.renderPolygon=function(e,t,r){r.moveTo(e[0],e[1]);for(var n=1;n=this.x&&e=this.y&&t=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){if(t>=this.y+this.radius&&t<=this.y+this.height-this.radius||e>=this.x+this.radius&&e<=this.x+this.width-this.radius)return!0;var r=e-(this.x+this.radius),n=t-(this.y+this.radius),i=this.radius*this.radius;if(r*r+n*n<=i)return!0;if((r=e-(this.x+this.width-this.radius))*r+n*n<=i)return!0;if(r*r+(n=t-(this.y+this.height-this.radius))*n<=i)return!0;if((r=e-(this.x+this.radius))*r+n*n<=i)return!0}return!1},o}();r.default=n},{"../../const":46}],76:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(){function n(e,t){for(var r=0;rthis.checkCountMax&&(this.checkCount=0,this.run()))},t.prototype.run=function(){for(var e=this.renderer.textureManager,t=e._managedTextures,r=!1,n=0;nthis.maxIdle&&(e.destroyTexture(i,!0),r=!(t[n]=null))}if(r){for(var o=0,a=0;a 0.5)"," {"," color = vec4(1.0, 0.0, 0.0, 1.0);"," }"," else"," {"," color = vec4(0.0, 1.0, 0.0, 1.0);"," }"," gl_FragColor = mix(sample, masky, 0.5);"," gl_FragColor *= sample.a;","}"].join("\n")}}]),i}();r.default=c},{"../../../const":46,"../../../settings":101,"../../../utils":125,"./extractUniformsFromSrc":87}],87:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e,t,r){var n=o(e),i=o(t);return Object.assign(n,i)};var n,i=e("pixi-gl-core");var f=((n=i)&&n.__esModule?n:{default:n}).default.shader.defaultValue;function o(e){for(var t=new RegExp("^(projectionMatrix|uSampler|filterArea|filterClamp)$"),r={},n=void 0,i=e.replace(/\s+/g," ").split(/\s*;\s*/),o=0;o=n&&c.x=i&&c.y>16)+(65280&e)+((255&e)<<16)}},{key:"texture",get:function(){return this._texture},set:function(e){this._texture!==e&&(this._texture=e||u.default.EMPTY,this.cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.hasLoaded?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))}}]),n}(n.default);r.default=f},{"../const":46,"../display/Container":48,"../math":70,"../textures/Texture":115,"../utils":125}],103:[function(e,t,r){"use strict";r.__esModule=!0;var n=i(e("../../renderers/canvas/CanvasRenderer")),c=e("../../const"),f=e("../../math"),h=i(e("./CanvasTinter"));function i(e){return e&&e.__esModule?e:{default:e}}var d=new f.Matrix,o=function(){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.renderer=e}return t.prototype.render=function(e){var t=e._texture,r=this.renderer,n=t._frame.width,i=t._frame.height,o=e.transform.worldTransform,a=0,s=0;if(!(t.orig.width<=0||t.orig.height<=0)&&t.baseTexture.source&&(r.setBlendMode(e.blendMode),t.valid)){r.context.globalAlpha=e.worldAlpha;var u=t.baseTexture.scaleMode===c.SCALE_MODES.LINEAR;r.smoothProperty&&r.context[r.smoothProperty]!==u&&(r.context[r.smoothProperty]=u),s=t.trim?(a=t.trim.width/2+t.trim.x-e.anchor.x*t.orig.width,t.trim.height/2+t.trim.y-e.anchor.y*t.orig.height):(a=(.5-e.anchor.x)*t.orig.width,(.5-e.anchor.y)*t.orig.height),t.rotate&&(o.copy(d),o=d,f.GroupD8.matrixAppendRotationInv(o,t.rotate,a,s),s=a=0),a-=n/2,s-=i/2,r.roundPixels?(r.context.setTransform(o.a,o.b,o.c,o.d,o.tx*r.resolution|0,o.ty*r.resolution|0),a|=0,s|=0):r.context.setTransform(o.a,o.b,o.c,o.d,o.tx*r.resolution,o.ty*r.resolution);var l=t.baseTexture.resolution;16777215!==e.tint?(e.cachedTint===e.tint&&e.tintedTexture.tintId===e._texture._updateID||(e.cachedTint=e.tint,e.tintedTexture=h.default.getTintedTexture(e,e.tint)),r.context.drawImage(e.tintedTexture,0,0,n*l,i*l,a*r.resolution,s*r.resolution,n*r.resolution,i*r.resolution)):r.context.drawImage(t.baseTexture.source,t._frame.x*l,t._frame.y*l,n*l,i*l,a*r.resolution,s*r.resolution,n*r.resolution,i*r.resolution)}},t.prototype.destroy=function(){this.renderer=null},t}();r.default=o,n.default.registerPlugin("sprite",o)},{"../../const":46,"../../math":70,"../../renderers/canvas/CanvasRenderer":77,"./CanvasTinter":104}],104:[function(e,t,r){"use strict";r.__esModule=!0;var n,d=e("../../utils"),i=e("../../renderers/canvas/utils/canUseNewCanvasBlendModes");var s={getTintedTexture:function(e,t){var r=e._texture,n="#"+("00000"+(0|(t=s.roundColor(t))).toString(16)).substr(-6);r.tintCache=r.tintCache||{};var i=r.tintCache[n],o=void 0;if(i){if(i.tintId===r._updateID)return r.tintCache[n];o=r.tintCache[n]}else o=s.canvas||document.createElement("canvas");if(s.tintMethod(r,t,o),o.tintId=r._updateID,s.convertTintToImage){var a=new Image;a.src=o.toDataURL(),r.tintCache[n]=a}else r.tintCache[n]=o,s.canvas=null;return o},tintWithMultiply:function(e,t,r){var n=r.getContext("2d"),i=e._frame.clone(),o=e.baseTexture.resolution;i.x*=o,i.y*=o,i.width*=o,i.height*=o,r.width=Math.ceil(i.width),r.height=Math.ceil(i.height),n.save(),n.fillStyle="#"+("00000"+(0|t).toString(16)).substr(-6),n.fillRect(0,0,i.width,i.height),n.globalCompositeOperation="multiply",n.drawImage(e.baseTexture.source,i.x,i.y,i.width,i.height,0,0,i.width,i.height),n.globalCompositeOperation="destination-atop",n.drawImage(e.baseTexture.source,i.x,i.y,i.width,i.height,0,0,i.width,i.height),n.restore()},tintWithOverlay:function(e,t,r){var n=r.getContext("2d"),i=e._frame.clone(),o=e.baseTexture.resolution;i.x*=o,i.y*=o,i.width*=o,i.height*=o,r.width=Math.ceil(i.width),r.height=Math.ceil(i.height),n.save(),n.globalCompositeOperation="copy",n.fillStyle="#"+("00000"+(0|t).toString(16)).substr(-6),n.fillRect(0,0,i.width,i.height),n.globalCompositeOperation="destination-atop",n.drawImage(e.baseTexture.source,i.x,i.y,i.width,i.height,0,0,i.width,i.height),n.restore()},tintWithPerPixel:function(e,t,r){var n=r.getContext("2d"),i=e._frame.clone(),o=e.baseTexture.resolution;i.x*=o,i.y*=o,i.width*=o,i.height*=o,r.width=Math.ceil(i.width),r.height=Math.ceil(i.height),n.save(),n.globalCompositeOperation="copy",n.drawImage(e.baseTexture.source,i.x,i.y,i.width,i.height,0,0,i.width,i.height),n.restore();for(var a=(0,d.hex2rgb)(t),s=a[0],u=a[1],l=a[2],c=n.getImageData(0,0,i.width,i.height),f=c.data,h=0;h=this.size&&this.flush(),e._texture._uvs&&(this.sprites[this.currentIndex++]=e)},o.prototype.flush=function(){if(0!==this.currentIndex){var e=this.renderer.gl,t=this.MAX_TEXTURES,r=z.default.nextPow2(this.currentIndex),n=z.default.log2(r),i=this.buffers[n],o=this.sprites,a=this.groups,s=i.float32View,u=i.uint32View,l=this.boundTextures,c=this.renderer.boundTextures,f=this.renderer.textureGC.count,h=0,d=void 0,p=void 0,g=1,m=0,v=a[0],_=void 0,y=void 0,b=F.premultiplyBlendMode[o[0]._texture.baseTexture.premultipliedAlpha?1:0][o[0].blendMode];v.textureCount=0,v.start=0,v.blend=b,U++;var x=void 0;for(x=0;x=r.length)break;o=r[i++]}else{if((i=r.next()).done)break;o=i.value}var a=o;this.animations[t].push(this.textures[a])}}},f.prototype._parseComplete=function(){var e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)},f.prototype._nextBatch=function(){var e=this;this._processFrames(this._batchIndex*f.BATCH_SIZE),this._batchIndex++,setTimeout(function(){e._batchIndex*f.BATCH_SIZEthis.baseTexture.width,a=r+i>this.baseTexture.height;if(o||a){var s=o&&a?"and":"or",u="X: "+t+" + "+n+" = "+(t+n)+" > "+this.baseTexture.width,l="Y: "+r+" + "+i+" = "+(r+i)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+u+" "+s+" "+l)}this.valid=n&&i&&this.baseTexture.hasLoaded,this.trim||this.rotate||(this.orig=e),this.valid&&this._updateUvs()}},{key:"rotate",get:function(){return this._rotate},set:function(e){this._rotate=e,this.valid&&this._updateUvs()}},{key:"width",get:function(){return this.orig.width}},{key:"height",get:function(){return this.orig.height}}]),u}(s.default);function d(e){e.destroy=function(){},e.on=function(){},e.once=function(){},e.emit=function(){}}(r.default=h).EMPTY=new h(new o.default),d(h.EMPTY),d(h.EMPTY.baseTexture),h.WHITE=function(){var e=document.createElement("canvas");e.width=10,e.height=10;var t=e.getContext("2d");return t.fillStyle="white",t.fillRect(0,0,10,10),new h(new o.default(e))}(),d(h.WHITE),d(h.WHITE.baseTexture)},{"../math":70,"../settings":101,"../utils":125,"./BaseTexture":112,"./TextureUvs":117,"./VideoBaseTexture":118,eventemitter3:3}],116:[function(e,t,r){"use strict";r.__esModule=!0;var n,i=function(){function n(e,t){for(var r=0;rt.priority){e.connect(r);break}t=(r=t).next}e.previous||e.connect(r)}else e.connect(r);return this._startIfPossible(),this},e.prototype.remove=function(e,t){for(var r=this._head.next;r;)r=r.match(e,t)?r.destroy():r.next;return this._head.next||this._cancelIfNeeded(),this},e.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},e.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},e.prototype.destroy=function(){this.stop();for(var e=this._head.next;e;)e=e.destroy(!0);this._head.destroy(),this._head=null},e.prototype.update=function(){var e=0this.lastTime){(t=this.elapsedMS=e-this.lastTime)>this._maxElapsedMS&&(t=this._maxElapsedMS),this.deltaTime=t*i.default.TARGET_FPMS*this.speed;for(var r=this._head,n=r.next;n;)n=n.emit(this.deltaTime);r.next||this._cancelIfNeeded()}else this.deltaTime=this.elapsedMS=0;this.lastTime=e},n(e,[{key:"FPS",get:function(){return 1e3/this.elapsedMS}},{key:"minFPS",get:function(){return 1e3/this._maxElapsedMS},set:function(e){var t=Math.min(Math.max(0,e)/1e3,i.default.TARGET_FPMS);this._maxElapsedMS=1/t}}]),e}();r.default=u},{"../const":46,"../settings":101,"./TickerListener":120}],120:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(){function i(e){var t=1>16&255)/255,t[1]=(e>>8&255)/255,t[2]=(255&e)/255,t},r.hex2string=function(e){return e=e.toString(16),"#"+(e="000000".substr(0,6-e.length)+e)},r.rgb2hex=function(e){return(255*e[0]<<16)+(255*e[1]<<8)+(255*e[2]|0)},r.getResolutionOfUrl=function(e,t){var r=i.default.RETINA_PREFIX.exec(e);if(r)return parseFloat(r[1]);return void 0!==t?t:1},r.decomposeDataUri=function(e){var t=n.DATA_URI.exec(e);if(t)return{mediaType:t[1]?t[1].toLowerCase():void 0,subType:t[2]?t[2].toLowerCase():void 0,charset:t[3]?t[3].toLowerCase():void 0,encoding:t[4]?t[4].toLowerCase():void 0,data:t[5]};return},r.getUrlFileExtension=function(e){var t=n.URL_FILE_EXTENSION.exec(e);if(t)return t[1].toLowerCase();return},r.getSvgSize=function(e){var t=n.SVG_SIZE.exec(e),r={};t&&(r[t[1]]=Math.round(parseFloat(t[3])),r[t[5]]=Math.round(parseFloat(t[7])));return r},r.skipHello=function(){g=!0},r.sayHello=function(e){if(g)return;if(-1>16&255,n=e>>8&255,i=255&e;return(255*t<<24)+((r=r*t+.5|0)<<16)+((n=n*t+.5|0)<<8)+(i=i*t+.5|0)},r.premultiplyRgba=function(e,t,r,n){r=r||new Float32Array(4),n||void 0===n?(r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t):(r[0]=e[0],r[1]=e[1],r[2]=e[2]);return r[3]=t,r},r.premultiplyTintToRgba=function(e,t,r,n){(r=r||new Float32Array(4))[0]=(e>>16&255)/255,r[1]=(e>>8&255)/255,r[2]=(255&e)/255,(n||void 0===n)&&(r[0]*=t,r[1]*=t,r[2]*=t);return r[3]=t,r};var n=e("../const"),i=d(e("../settings")),o=d(e("eventemitter3")),a=d(e("./pluginTarget")),s=h(e("./mixin")),u=h(e("ismobilejs")),l=d(e("remove-array-items")),c=d(e("./mapPremultipliedBlendModes")),f=d(e("earcut"));function h(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function d(e){return e&&e.__esModule?e:{default:e}}var p=0,g=!1;r.isMobile=u,r.removeItems=l.default,r.EventEmitter=o.default,r.pluginTarget=a.default,r.mixins=s,r.earcut=f.default;var m=r.TextureCache=Object.create(null),v=r.BaseTextureCache=Object.create(null);var _=r.premultiplyBlendMode=(0,c.default)()},{"../const":46,"../settings":101,"./mapPremultipliedBlendModes":126,"./mixin":128,"./pluginTarget":129,earcut:2,eventemitter3:3,ismobilejs:4,"remove-array-items":31}],126:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(){for(var e=[],t=[],r=0;r<32;r++)e[r]=r,t[r]=r;e[i.BLEND_MODES.NORMAL_NPM]=i.BLEND_MODES.NORMAL,e[i.BLEND_MODES.ADD_NPM]=i.BLEND_MODES.ADD,e[i.BLEND_MODES.SCREEN_NPM]=i.BLEND_MODES.SCREEN,t[i.BLEND_MODES.NORMAL]=i.BLEND_MODES.NORMAL_NPM,t[i.BLEND_MODES.ADD]=i.BLEND_MODES.ADD_NPM,t[i.BLEND_MODES.SCREEN]=i.BLEND_MODES.SCREEN_NPM;var n=[];return n.push(t),n.push(e),n};var i=e("../const")},{"../const":46}],127:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e){if(o.default.tablet||o.default.phone)return 4;return e};var n,i=e("ismobilejs"),o=(n=i)&&n.__esModule?n:{default:n}},{ismobilejs:4}],128:[function(e,t,r){"use strict";function n(e,t){if(e&&t)for(var r=Object.keys(t),n=0;n=this._durations[this.currentFrame];)n-=this._durations[this.currentFrame]*i,this._currentTime+=i;this._currentTime+=n/this._durations[this.currentFrame]}else this._currentTime+=t;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):r!==this.currentFrame&&(this.loop&&this.onLoop&&(0r&&this.onLoop()),this.updateTexture())},i.prototype.updateTexture=function(){this._texture=this._textures[this.currentFrame],this._textureID=-1,this.cachedTint=16777215,this.updateAnchor&&this._anchor.copy(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame)},i.prototype.destroy=function(e){this.stop(),n.prototype.destroy.call(this,e)},i.fromFrames=function(e){for(var t=[],r=0;rs&&(++p,O.utils.removeItems(n,1+h-p,1+m-h),m=h,h=-1,i.push(d),c=Math.max(c,d),f++,r.x=0,r.y+=e.lineHeight,u=null))}else i.push(l),c=Math.max(c,l),++f,++p,r.x=0,r.y+=e.lineHeight,u=null}var b=o.charAt(o.length-1);"\r"!==b&&"\n"!==b&&(/(?:\s)/.test(b)&&(l=d),i.push(l),c=Math.max(c,l));for(var x=[],w=0;w<=f;w++){var T=0;"right"===this._font.align?T=c-i[w]:"center"===this._font.align&&(T=(c-i[w])/2),x.push(T)}for(var S=n.length,M=this.tint,P=0;P=n&&s.x=i&&s.y 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n"));return e.uniforms.m=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],e.alpha=1,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(r,t),r.prototype._loadMatrix=function(e){var t=e;1>16&255)/255,a=(r>>8&255)/255,s=(255&r)/255,u=((n=n||3375104)>>16&255)/255,l=(n>>8&255)/255,c=(255&n)/255,f=[.3,.59,.11,0,0,o,a,s,e=e||.2,0,u,l,c,t=t||.15,0,o-u,a-l,s-c,0,0];this._loadMatrix(f,i)},r.prototype.night=function(e,t){var r=[-2*(e=e||.1),-e,0,0,0,-e,0,e,0,0,0,e,2*e,0,0,0,0,0,1,0];this._loadMatrix(r,t)},r.prototype.predator=function(e,t){var r=[11.224130630493164*e,-4.794486999511719*e,-2.8746118545532227*e,0*e,.40342438220977783*e,-3.6330697536468506*e,9.193157196044922*e,-2.951810836791992*e,0*e,-1.316135048866272*e,-3.2184197902679443*e,-4.2375030517578125*e,7.476448059082031*e,0*e,.8044459223747253*e,0,0,0,1,0];this._loadMatrix(r,t)},r.prototype.lsd=function(e){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],e)},r.prototype.reset=function(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)},n(r,[{key:"matrix",get:function(){return this.uniforms.m},set:function(e){this.uniforms.m=e}},{key:"alpha",get:function(){return this.uniforms.uAlpha},set:function(e){this.uniforms.uAlpha=e}}]),r}(i.Filter);(r.default=o).prototype.grayscale=o.prototype.greyscale},{"../../core":65,path:8}],151:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(){function n(e,t){for(var r=0;r lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec2 fragCoord = vTextureCoord * filterArea.xy;\n\n vec4 color;\n\n color = fxaa(uSampler, fragCoord, filterArea.xy, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n'))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(n.Filter);r.default=i},{"../../core":65,path:8}],153:[function(e,t,r){"use strict";r.__esModule=!0;var n=e("./fxaa/FXAAFilter");Object.defineProperty(r,"FXAAFilter",{enumerable:!0,get:function(){return f(n).default}});var i=e("./noise/NoiseFilter");Object.defineProperty(r,"NoiseFilter",{enumerable:!0,get:function(){return f(i).default}});var o=e("./displacement/DisplacementFilter");Object.defineProperty(r,"DisplacementFilter",{enumerable:!0,get:function(){return f(o).default}});var a=e("./blur/BlurFilter");Object.defineProperty(r,"BlurFilter",{enumerable:!0,get:function(){return f(a).default}});var s=e("./blur/BlurXFilter");Object.defineProperty(r,"BlurXFilter",{enumerable:!0,get:function(){return f(s).default}});var u=e("./blur/BlurYFilter");Object.defineProperty(r,"BlurYFilter",{enumerable:!0,get:function(){return f(u).default}});var l=e("./colormatrix/ColorMatrixFilter");Object.defineProperty(r,"ColorMatrixFilter",{enumerable:!0,get:function(){return f(l).default}});var c=e("./alpha/AlphaFilter");function f(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"AlphaFilter",{enumerable:!0,get:function(){return f(c).default}})},{"./alpha/AlphaFilter":143,"./blur/BlurFilter":144,"./blur/BlurXFilter":145,"./blur/BlurYFilter":146,"./colormatrix/ColorMatrixFilter":150,"./displacement/DisplacementFilter":151,"./fxaa/FXAAFilter":152,"./noise/NoiseFilter":154}],154:[function(e,t,r){"use strict";r.__esModule=!0;var o=function(){function n(e,t){for(var r=0;r 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n"));return r.noise=e,r.seed=t,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(i,n),o(i,[{key:"noise",get:function(){return this.uniforms.uNoise},set:function(e){this.uniforms.uNoise=e}},{key:"seed",get:function(){return this.uniforms.uSeed},set:function(e){this.uniforms.uSeed=e}}]),i}(n.Filter);r.default=i},{"../../core":65,path:8}],155:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(){function n(e,t){for(var r=0;rt?1:this._height/t;e[9]=e[11]=e[13]=e[15]=this._topHeight*r,e[17]=e[19]=e[21]=e[23]=this._height-this._bottomHeight*r,e[25]=e[27]=e[29]=e[31]=this._height},s.prototype.updateVerticalVertices=function(){var e=this.vertices,t=this._leftWidth+this._rightWidth,r=this._width>t?1:this._width/t;e[2]=e[10]=e[18]=e[26]=this._leftWidth*r,e[4]=e[12]=e[20]=e[28]=this._width-this._rightWidth*r,e[6]=e[14]=e[22]=e[30]=this._width},s.prototype._renderCanvas=function(e){var t=e.context,r=this.worldTransform,n=e.resolution,i=16777215!==this.tint,o=this._texture;i&&this._cachedTint!==this.tint&&(this._cachedTint=this.tint,this._tintedTexture=x.default.getTintedTexture(this,this.tint));var a=i?this._tintedTexture:o.baseTexture.source;this._canvasUvs||(this._canvasUvs=[0,0,0,0,0,0,0,0]);var s=this.vertices,u=this._canvasUvs,l=i?0:o.frame.x,c=i?0:o.frame.y,f=l+o.frame.width,h=c+o.frame.height;u[0]=l,u[1]=l+this._leftWidth,u[2]=f-this._rightWidth,u[3]=f,u[4]=c,u[5]=c+this._topHeight,u[6]=h-this._bottomHeight,u[7]=h;for(var d=0;d<8;d++)u[d]*=o.baseTexture.resolution;t.globalAlpha=this.worldAlpha,e.setBlendMode(this.blendMode),e.roundPixels?t.setTransform(r.a*n,r.b*n,r.c*n,r.d*n,r.tx*n|0,r.ty*n|0):t.setTransform(r.a*n,r.b*n,r.c*n,r.d*n,r.tx*n,r.ty*n);for(var p=0;p<3;p++)for(var g=0;g<3;g++){var m=2*g+8*p,v=Math.max(1,u[g+1]-u[g]),_=Math.max(1,u[p+5]-u[p+4]),y=Math.max(1,s[10+m]-s[m]),b=Math.max(1,s[11+m]-s[1+m]);t.drawImage(a,u[g],u[p+4],v,_,s[m],s[1+m],y,b)}},s.prototype._refresh=function(){a.prototype._refresh.call(this);var e=this.uvs,t=this._texture;this._origWidth=t.orig.width,this._origHeight=t.orig.height;var r=1/this._origWidth,n=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=r*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-r*this._rightWidth,e[9]=e[11]=e[13]=e[15]=n*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-n*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.dirty++,this.multiplyUvs()},n(s,[{key:"width",get:function(){return this._width},set:function(e){this._width=e,this._refresh()}},{key:"height",get:function(){return this._height},set:function(e){this._height=e,this._refresh()}},{key:"leftWidth",get:function(){return this._leftWidth},set:function(e){this._leftWidth=e,this._refresh()}},{key:"rightWidth",get:function(){return this._rightWidth},set:function(e){this._rightWidth=e,this._refresh()}},{key:"topHeight",get:function(){return this._topHeight},set:function(e){this._topHeight=e,this._refresh()}},{key:"bottomHeight",get:function(){return this._bottomHeight},set:function(e){this._bottomHeight=e,this._refresh()}}]),s}(i.default);r.default=a},{"../core/sprites/canvas/CanvasTinter":104,"./Plane":168}],168:[function(e,t,r){"use strict";r.__esModule=!0;var n,i=e("./Mesh"),a=(n=i)&&n.__esModule?n:{default:n};var o=function(i){function o(e,t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,i.call(this,e));return n._ready=!0,n.verticesX=t||10,n.verticesY=r||10,n.drawMode=a.default.DRAW_MODES.TRIANGLES,n.refresh(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(o,i),o.prototype._refresh=function(){for(var e=this._texture,t=this.verticesX*this.verticesY,r=[],n=[],i=[],o=this.verticesX-1,a=this.verticesY-1,s=e.width/o,u=e.height/a,l=0;l=a.length){if(!e.autoResize)break;a.push(this._generateOneMoreBuffer(e))}var p=a[h];p.uploadDynamic(t,f,d);var g=e._bufferUpdateIDs[h]||0;(c=c||p._updateID 0) var gc = undefined");else{if(!ba&&!ca)throw"Unknown runtime environment. Where are we?";e.read=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},"undefined"!=typeof arguments&&(e.arguments=arguments),"undefined"!=typeof console?(e.print||(e.print=function(e){console.log(e)}),e.printErr||(e.printErr=function(e){console.log(e)})):e.print||(e.print=function(){}),ca&&(e.load=importScripts),void 0===e.setWindowTitle&&(e.setWindowTitle=function(e){document.title=e})}function ha(e){eval.call(null,e)}for(k in!e.load&&e.read&&(e.load=function(t){ha(e.read(t))}),e.print||(e.print=function(){}),e.printErr||(e.printErr=e.print),e.arguments||(e.arguments=[]),e.thisProgram||(e.thisProgram="./this.program"),e.print=e.print,e.W=e.printErr,e.preRun=[],e.postRun=[],aa)aa.hasOwnProperty(k)&&(e[k]=aa[k]);var n={rb:function(e){ka=e},fb:function(){return ka},ua:function(){return m},ba:function(e){m=e},Ka:function(e){switch(e){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:return"*"===e[e.length-1]?n.J:"i"===e[0]?(assert(0==(e=parseInt(e.substr(1)))%8),e/8):0}},eb:function(e){return Math.max(n.Ka(e),n.J)},ud:16,Qd:function(e,t){return"double"===t||"i64"===t?7&e&&(assert(4==(7&e)),e+=4):assert(0==(3&e)),e},Ed:function(e,t,r){return r||"i64"!=e&&"double"!=e?e?Math.min(t||(e?n.eb(e):0),n.J):Math.min(t,8):8},L:function(t,r,n){return n&&n.length?(n.splice||(n=Array.prototype.slice.call(n)),n.splice(0,0,r),e["dynCall_"+t].apply(null,n)):e["dynCall_"+t].call(null,r)},Z:[],Xa:function(e){for(var t=0;t>>0)+4294967296*+(t>>>0):+(e>>>0)+4294967296*+(0|t)},Ua:8,J:4,vd:0};e.Runtime=n,n.addFunction=n.Xa,n.removeFunction=n.nb;var na=!1,oa,pa,ka,ra,sa;function assert(e,t){e||x("Assertion failed: "+t)}function qa(a){var b=e["_"+a];if(!b)try{b=eval("_"+a)}catch(e){}return assert(b,"Cannot call unknown function "+a+" (perhaps LLVM optimizations or closure removed it?)"),b}function wa(e,t,r){switch("*"===(r=r||"i8").charAt(r.length-1)&&(r="i32"),r){case"i1":case"i8":y[e>>0]=t;break;case"i16":z[e>>1]=t;break;case"i32":C[e>>2]=t;break;case"i64":pa=[t>>>0,(oa=t,1<=+xa(oa)?0>>0:~~+Aa((oa-+(~~oa>>>0))/4294967296)>>>0:0)],C[e>>2]=pa[0],C[e+4>>2]=pa[1];break;case"float":Ba[e>>2]=t;break;case"double":Ca[e>>3]=t;break;default:x("invalid type for setValue: "+r)}}function Da(e,t){switch("*"===(t=t||"i8").charAt(t.length-1)&&(t="i32"),t){case"i1":case"i8":return y[e>>0];case"i16":return z[e>>1];case"i32":case"i64":return C[e>>2];case"float":return Ba[e>>2];case"double":return Ca[e>>3];default:x("invalid type for setValue: "+t)}return null}function D(e,t,r,i){var o,a;a="number"==typeof e?(o=!0,e):(o=!1,e.length);var s,u,l="string"==typeof t?t:null;if(r=4==r?i:[Ea,n.aa,n.Ra,n.R][void 0===r?2:r](Math.max(a,l?1:t.length)),o){for(assert(0==(3&(i=r))),e=r+(-4&a);i>2]=0;for(e=r+a;i>0]=0;return r}if("i8"===l)return e.subarray||e.slice?E.set(e,r):E.set(new Uint8Array(e),r),r;for(i=0;i>0],0!=n||r)&&(o++,!r||o!=r););if(r||(r=o),n="",i<128){for(;0>10,56320|1023&r)))):s+=String.fromCharCode(r)}}function Ka(e,t,r,n){if(!(0>6}else{if(a<=65535){if(n<=r+2)break;t[r++]=224|a>>12}else{if(a<=2097151){if(n<=r+3)break;t[r++]=240|a>>18}else{if(a<=67108863){if(n<=r+4)break;t[r++]=248|a>>24}else{if(n<=r+5)break;t[r++]=252|a>>30,t[r++]=128|a>>24&63}t[r++]=128|a>>18&63}t[r++]=128|a>>12&63}t[r++]=128|a>>6&63}t[r++]=128|63&a}}return t[r]=0,r-i}function La(e){for(var t=0,r=0;r"):o=i;e:for(;f>0];if(!r)return t;t+=String.fromCharCode(r)}},e.stringToAscii=function(e,t){return Ia(e,t,!1)},e.UTF8ArrayToString=Ja,e.UTF8ToString=function(e){return Ja(E,e)},e.stringToUTF8Array=Ka,e.stringToUTF8=function(e,t,r){return Ka(e,E,t,r)},e.lengthBytesUTF8=La,e.UTF16ToString=function(e){for(var t=0,r="";;){var n=z[e+2*t>>1];if(0==n)return r;++t,r+=String.fromCharCode(n)}},e.stringToUTF16=function(e,t,r){if(void 0===r&&(r=2147483647),r<2)return 0;var n=t;r=(r-=2)<2*e.length?r/2:e.length;for(var i=0;i>1]=e.charCodeAt(i),t+=2;return z[t>>1]=0,t-n},e.lengthBytesUTF16=function(e){return 2*e.length},e.UTF32ToString=function(e){for(var t=0,r="";;){var n=C[e+4*t>>2];if(0==n)return r;++t,65536<=n?(n-=65536,r+=String.fromCharCode(55296|n>>10,56320|1023&n)):r+=String.fromCharCode(n)}},e.stringToUTF32=function(e,t,r){if(void 0===r&&(r=2147483647),r<4)return 0;var n=t;r=n+r-4;for(var i=0;i>2]=o,r<(t+=4)+4)break}return C[t>>2]=0,t-n},e.lengthBytesUTF32=function(e){for(var t=0,r=0;r>0]=e[r],r+=1}function ta(e,t){for(var r=0;r>0]=e[r]}function Ia(e,t,r){for(var n=0;n>0]=e.charCodeAt(n);r||(y[t>>0]=0)}e.addOnPreRun=fb,e.addOnInit=function(e){cb.unshift(e)},e.addOnPreMain=function(e){db.unshift(e)},e.addOnExit=function(e){H.unshift(e)},e.addOnPostRun=gb,e.intArrayFromString=hb,e.intArrayToString=function(e){for(var t=[],r=0;r>>16)*n+r*(t>>>16)<<16)|0}),Math.Jd=Math.imul,Math.clz32||(Math.clz32=function(e){e>>>=0;for(var t=0;t<32;t++)if(e&1<<31-t)return t;return 32}),Math.Ad=Math.clz32;var xa=Math.abs,Aa=Math.ceil,za=Math.floor,ya=Math.min,I=0,ib=null,jb=null;function kb(){I++,e.monitorRunDependencies&&e.monitorRunDependencies(I)}function lb(){if(I--,e.monitorRunDependencies&&e.monitorRunDependencies(I),0==I&&(null!==ib&&(clearInterval(ib),ib=null),jb)){var t=jb;jb=null,t()}}e.addRunDependency=kb,e.removeRunDependency=lb,e.preloadedImages={},e.preloadedAudios={},Ta=8,la=Ta+5888,cb.push(),D([124,0,0,0,98,7,0,0,124,0,0,0,111,7,0,0,164,0,0,0,124,7,0,0,16,0,0,0,0,0,0,0,164,0,0,0,157,7,0,0,24,0,0,0,0,0,0,0,164,0,0,0,227,7,0,0,24,0,0,0,0,0,0,0,164,0,0,0,191,7,0,0,56,0,0,0,0,0,0,0,164,0,0,0,5,8,0,0,40,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,40,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,88,0,0,0,1,0,0,0,5,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,114,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,124,1,0,0,236,1,0,0,236,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,4,0,0,0,239,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,4,0,0,0,231,16,0,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,115,40,37,117,41,58,32,65,115,115,101,114,116,105,111,110,32,102,97,105,108,117,114,101,58,32,34,37,115,34,10,0,109,95,115,105,122,101,32,60,61,32,109,95,99,97,112,97,99,105,116,121,0,46,47,99,114,110,95,100,101,99,111,109,112,46,104,0,109,105,110,95,110,101,119,95,99,97,112,97,99,105,116,121,32,60,32,40,48,120,55,70,70,70,48,48,48,48,85,32,47,32,101,108,101,109,101,110,116,95,115,105,122,101,41,0,110,101,119,95,99,97,112,97,99,105,116,121,32,38,38,32,40,110,101,119,95,99,97,112,97,99,105,116,121,32,62,32,109,95,99,97,112,97,99,105,116,121,41,0,110,117,109,95,99,111,100,101,115,91,99,93,0,115,111,114,116,101,100,95,112,111,115,32,60,32,116,111,116,97,108,95,117,115,101,100,95,115,121,109,115,0,112,67,111,100,101,115,105,122,101,115,91,115,121,109,95,105,110,100,101,120,93,32,61,61,32,99,111,100,101,115,105,122,101,0,116,32,60,32,40,49,85,32,60,60,32,116,97,98,108,101,95,98,105,116,115,41,0,109,95,108,111,111,107,117,112,91,116,93,32,61,61,32,99,85,73,78,84,51,50,95,77,65,88,0,99,114,110,100,95,109,97,108,108,111,99,58,32,115,105,122,101,32,116,111,111,32,98,105,103,0,99,114,110,100,95,109,97,108,108,111,99,58,32,111,117,116,32,111,102,32,109,101,109,111,114,121,0,40,40,117,105,110,116,51,50,41,112,95,110,101,119,32,38,32,40,67,82,78,68,95,77,73,78,95,65,76,76,79,67,95,65,76,73,71,78,77,69,78,84,32,45,32,49,41,41,32,61,61,32,48,0,99,114,110,100,95,114,101,97,108,108,111,99,58,32,98,97,100,32,112,116,114,0,99,114,110,100,95,102,114,101,101,58,32,98,97,100,32,112,116,114,0,102,97,108,115,101,0,40,116,111,116,97,108,95,115,121,109,115,32,62,61,32,49,41,32,38,38,32,40,116,111,116,97,108,95,115,121,109,115,32,60,61,32,112,114,101,102,105,120,95,99,111,100,105,110,103,58,58,99,77,97,120,83,117,112,112,111,114,116,101,100,83,121,109,115,41,0,17,18,19,20,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15,16,48,0,110,117,109,95,98,105,116,115,32,60,61,32,51,50,85,0,109,95,98,105,116,95,99,111,117,110,116,32,60,61,32,99,66,105,116,66,117,102,83,105,122,101,0,116,32,33,61,32,99,85,73,78,84,51,50,95,77,65,88,0,109,111,100,101,108,46,109,95,99,111,100,101,95,115,105,122,101,115,91,115,121,109,93,32,61,61,32,108,101,110,0,0,2,3,1,0,2,3,4,5,6,7,1,40,108,101,110,32,62,61,32,49,41,32,38,38,32,40,108,101,110,32,60,61,32,99,77,97,120,69,120,112,101,99,116,101,100,67,111,100,101,83,105,122,101,41,0,105,32,60,32,109,95,115,105,122,101,0,110,101,120,116,95,108,101,118,101,108,95,111,102,115,32,62,32,99,117,114,95,108,101,118,101,108,95,111,102,115,0,1,2,2,3,3,3,3,4,0,0,0,0,0,0,1,1,0,1,0,1,0,0,1,2,1,2,0,0,0,1,0,2,1,0,2,0,0,1,2,3,110,117,109,32,38,38,32,40,110,117,109,32,61,61,32,126,110,117,109,95,99,104,101,99,107,41,0,83,116,57,101,120,99,101,112,116,105,111,110,0,83,116,57,116,121,112,101,95,105,110,102,111,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,54,95,95,115,104,105,109,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,57,95,95,112,111,105,110,116,101,114,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,112,98,97,115,101,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,48,95,95,115,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,112,116,104,114,101,97,100,95,111,110,99,101,32,102,97,105,108,117,114,101,32,105,110,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,95,102,97,115,116,40,41,0,116,101,114,109,105,110,97,116,101,95,104,97,110,100,108,101,114,32,117,110,101,120,112,101,99,116,101,100,108,121,32,114,101,116,117,114,110,101,100,0,99,97,110,110,111,116,32,99,114,101,97,116,101,32,112,116,104,114,101,97,100,32,107,101,121,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,99,97,110,110,111,116,32,122,101,114,111,32,111,117,116,32,116,104,114,101,97,100,32,118,97,108,117,101,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,58,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,102,111,114,101,105,103,110,32,101,120,99,101,112,116,105,111,110,0,116,101,114,109,105,110,97,116,105,110,103,0,117,110,99,97,117,103,104,116,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116,32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,46,0],"i8",4,n.Ua);var mb=n.ja(D(12,"i8",2),8);function ob(t){return e.___errno_location&&(C[e.___errno_location()>>2]=t),t}assert(0==mb%8),e._i64Subtract=nb;var J={I:1,F:2,ed:3,bc:4,H:5,Aa:6,vb:7,zc:8,ea:9,Jb:10,va:11,qd:11,Ta:12,da:13,Vb:14,Lc:15,fa:16,wa:17,rd:18,ha:19,ya:20,P:21,q:22,uc:23,Sa:24,Q:25,nd:26,Wb:27,Hc:28,ia:29,bd:30,nc:31,Vc:32,Sb:33,Zc:34,Dc:42,Zb:43,Kb:44,ec:45,fc:46,gc:47,mc:48,od:49,xc:50,dc:51,Pb:35,Ac:37,Bb:52,Eb:53,sd:54,vc:55,Fb:56,Gb:57,Qb:35,Hb:59,Jc:60,yc:61,kd:62,Ic:63,Ec:64,Fc:65,ad:66,Bc:67,yb:68,gd:69,Lb:70,Wc:71,pc:72,Tb:73,Db:74,Qc:76,Cb:77,$c:78,hc:79,ic:80,lc:81,kc:82,jc:83,Kc:38,za:39,qc:36,ga:40,Rc:95,Uc:96,Ob:104,wc:105,zb:97,Yc:91,Oc:88,Gc:92,cd:108,Nb:111,wb:98,Mb:103,tc:101,rc:100,ld:110,Xb:112,Yb:113,ac:115,Ab:114,Rb:89,oc:90,Xc:93,dd:94,xb:99,sc:102,cc:106,Mc:107,md:109,pd:87,Ub:122,hd:116,Pc:95,Cc:123,$b:84,Sc:75,Ib:125,Nc:131,Tc:130,jd:86};function pb(e,t){H.push(function(){n.L("vi",e,[t])}),pb.level=H.length}function tb(){return!!tb.p}e._memset=qb,e._bitshift64Lshr=rb,e._bitshift64Shl=sb;var ub=[],vb={};function wb(e,t){wb.p||(wb.p={}),e in wb.p||(n.L("v",t),wb.p[e]=1)}var xb={0:"Success",1:"Not super-user",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"I/O error",6:"No such device or address",7:"Arg list too long",8:"Exec format error",9:"Bad file number",10:"No children",11:"No more processes",12:"Not enough core",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Mount device busy",17:"File exists",18:"Cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",25:"Not a typewriter",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",30:"Read only file system",31:"Too many links",32:"Broken pipe",33:"Math arg out of domain of func",34:"Math result not representable",35:"File locking deadlock error",36:"File or path name too long",37:"No record locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many symbolic links",42:"No message of desired type",43:"Identifier removed",44:"Channel number out of range",45:"Level 2 not synchronized",46:"Level 3 halted",47:"Level 3 reset",48:"Link number out of range",49:"Protocol driver not attached",50:"No CSI structure available",51:"Level 2 halted",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",57:"Invalid slot",59:"Bad font file fmt",60:"Device not a stream",61:"No data (for no delay io)",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",65:"Package not installed",66:"The object is remote",67:"The link has been severed",68:"Advertise error",69:"Srmount error",70:"Communication error on send",71:"Protocol error",72:"Multihop attempted",73:"Cross mount point (not really error)",74:"Trying to read unreadable message",75:"Value too large for defined data type",76:"Given log. name not unique",77:"f.d. invalid for this operation",78:"Remote address changed",79:"Can access a needed shared lib",80:"Accessing a corrupted shared lib",81:".lib section in a.out corrupted",82:"Attempting to link in too many libs",83:"Attempting to exec a shared library",84:"Illegal byte sequence",86:"Streams pipe error",87:"Too many users",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Unknown protocol",94:"Socket type not supported",95:"Not supported",96:"Protocol family not supported",97:"Address family not supported by protocol family",98:"Address already in use",99:"Address not available",100:"Network interface is not configured",101:"Network is unreachable",102:"Connection reset by network",103:"Connection aborted",104:"Connection reset by peer",105:"No buffer space available",106:"Socket is already connected",107:"Socket is not connected",108:"Can't send after socket shutdown",109:"Too many references",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"Host is unreachable",114:"Socket already connected",115:"Connection already in progress",116:"Stale file handle",122:"Quota exceeded",123:"No medium (in tape drive)",125:"Operation canceled",130:"Previous owner died",131:"State not recoverable"};function yb(e,t){for(var r=0,n=e.length-1;0<=n;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function zb(e){var t="/"===e.charAt(0),r="/"===e.substr(-1);return(e=yb(e.split("/").filter(function(e){return!!e}),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e}function Ab(e){var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1);return e=t[0],t=t[1],e||t?(t&&(t=t.substr(0,t.length-1)),e+t):"."}function Bb(e){if("/"===e)return"/";var t=e.lastIndexOf("/");return-1===t?e:e.substr(t+1)}function Cb(){return zb(Array.prototype.slice.call(arguments,0).join("/"))}function K(e,t){return zb(e+"/"+t)}function Db(){for(var e="",t=!1,r=arguments.length-1;-1<=r&&!t;r--){if("string"!=typeof(t=0<=r?arguments[r]:"/"))throw new TypeError("Arguments to path.resolve must be strings");if(!t)return"";e=t+"/"+e,t="/"===t.charAt(0)}return(t?"/":"")+(e=yb(e.split("/").filter(function(e){return!!e}),!t).join("/"))||"."}var Eb=[];function Fb(e,t){Eb[e]={input:[],output:[],N:t},Gb(e,Hb)}var Hb={open:function(e){var t=Eb[e.g.rdev];if(!t)throw new L(J.ha);e.tty=t,e.seekable=!1},close:function(e){e.tty.N.flush(e.tty)},flush:function(e){e.tty.N.flush(e.tty)},read:function(e,t,r,n){if(!e.tty||!e.tty.N.La)throw new L(J.Aa);for(var i=0,o=0;oe.e.length&&(e.e=M.cb(e),e.o=e.e.length),!e.e||e.e.subarray){var r=e.e?e.e.buffer.byteLength:0;t<=r||(t=Math.max(t,r*(r<1048576?2:1.125)|0),0!=r&&(t=Math.max(t,256)),r=e.e,e.e=new Uint8Array(t),0t)e.e.length=t;else for(;e.e.length=e.g.o)return 0;if(assert(0<=(e=Math.min(e.g.o-i,n))),8>1)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}return t.mode},B:function(e){for(var t=[];e.parent!==e;)t.push(e.name),e=e.parent;return t.push(e.A.pa.root),t.reverse(),Cb.apply(null,t)},Ha:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},$a:function(e){if((e&=-32769)in P.Ha)return P.Ha[e];throw new L(J.q)},k:{D:function(e){var t;e=P.B(e);try{t=fs.lstatSync(e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}return P.$&&!t.K&&(t.K=4096),P.$&&!t.blocks&&(t.blocks=(t.size+t.K-1)/t.K|0),{dev:t.dev,ino:t.ino,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,size:t.size,atime:t.atime,mtime:t.mtime,ctime:t.ctime,K:t.K,blocks:t.blocks}},u:function(e,t){var r=P.B(e);try{void 0!==t.mode&&(fs.chmodSync(r,t.mode),e.mode=t.mode),void 0!==t.size&&fs.truncateSync(r,t.size)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},lookup:function(e,t){var r=K(P.B(e),t);r=P.Ja(r);return P.createNode(e,t,r)},T:function(e,t,r,n){e=P.createNode(e,t,r,n),t=P.B(e);try{N(e.mode)?fs.mkdirSync(t,e.mode):fs.writeFileSync(t,"",{mode:e.mode})}catch(e){if(!e.code)throw e;throw new L(J[e.code])}return e},rename:function(e,t,r){e=P.B(e),t=K(P.B(t),r);try{fs.renameSync(e,t)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},unlink:function(e,t){var r=K(P.B(e),t);try{fs.unlinkSync(r)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},rmdir:function(e,t){var r=K(P.B(e),t);try{fs.rmdirSync(r)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},readdir:function(e){e=P.B(e);try{return fs.readdirSync(e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},symlink:function(e,t,r){e=K(P.B(e),t);try{fs.symlinkSync(r,e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},readlink:function(e){var t=P.B(e);try{return t=fs.readlinkSync(t),t=Ob.relative(Ob.resolve(e.A.pa.root),t)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}}},n:{open:function(e){var t=P.B(e.g);try{32768==(61440&e.g.mode)&&(e.V=fs.openSync(t,P.$a(e.flags)))}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},close:function(e){try{32768==(61440&e.g.mode)&&e.V&&fs.closeSync(e.V)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},read:function(e,t,r,n,i){if(0===n)return 0;var o,a=new Buffer(n);try{o=fs.readSync(e.V,a,0,n,i)}catch(e){throw new L(J[e.code])}if(0>>0)%Q.length}function Xb(e){var t=Wb(e.parent.id,e.name);e.M=Q[t],Q[t]=e}function Nb(e,t){var r;if(r=(r=Yb(e,"x"))?r:e.k.lookup?0:J.da)throw new L(r,e);for(r=Q[Wb(e.id,t)];r;r=r.M){var n=r.name;if(r.parent.id===e.id&&n===t)return r}return e.k.lookup(e,t)}function Lb(e,t,r,n){return Zb||((Zb=function(e,t,r,n){e||(e=this),this.parent=e,this.A=e.A,this.U=null,this.id=Sb++,this.name=t,this.mode=r,this.k={},this.n={},this.rdev=n}).prototype={},Object.defineProperties(Zb.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(e){e?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(e){e?this.mode|=146:this.mode&=-147}},kb:{get:function(){return N(this.mode)}},jb:{get:function(){return 8192==(61440&this.mode)}}})),Xb(e=new Zb(e,t,r,n)),e}function N(e){return 16384==(61440&e)}var $b={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218};function Yb(e,t){return Tb?0:(-1===t.indexOf("r")||292&e.mode)&&(-1===t.indexOf("w")||146&e.mode)&&(-1===t.indexOf("x")||73&e.mode)?0:J.da}function ac(e,t){try{return Nb(e,t),J.wa}catch(e){}return Yb(e,"wx")}function bc(){for(var e=0;e<=4096;e++)if(!Rb[e])return e;throw new L(J.Sa)}function cc(e){dc||((dc=function(){}).prototype={},Object.defineProperties(dc.prototype,{object:{get:function(){return this.g},set:function(e){this.g=e}},Ld:{get:function(){return 1!=(2097155&this.flags)}},Md:{get:function(){return 0!=(2097155&this.flags)}},Kd:{get:function(){return 1024&this.flags}}}));var t,r=new dc;for(t in e)r[t]=e[t];return e=r,r=bc(),e.fd=r,Rb[r]=e}var Kb={open:function(e){e.n=Qb[e.g.rdev].n,e.n.open&&e.n.open(e)},G:function(){throw new L(J.ia)}},qc;function Gb(e,t){Qb[e]={n:t}}function ec(e,t){var r,n="/"===t,i=!t;if(n&&Pb)throw new L(J.fa);if(!n&&!i){if(t=(r=S(t,{Ia:!1})).path,(r=r.g).U)throw new L(J.fa);if(!N(r.mode))throw new L(J.ya)}i={type:e,pa:{},Oa:t,lb:[]};var o=e.A(i);(o.A=i).root=o,n?Pb=o:r&&(r.U=i,r.A&&r.A.lb.push(i))}function fc(e,t,r){var n=S(e,{parent:!0}).g;if(!(e=Bb(e))||"."===e||".."===e)throw new L(J.q);var i=ac(n,e);if(i)throw new L(i);if(!n.k.T)throw new L(J.I);return n.k.T(n,e,t,r)}function gc(e,t){return t=4095&(void 0!==t?t:438),fc(e,t|=32768,0)}function V(e,t){return t=1023&(void 0!==t?t:511),fc(e,t|=16384,0)}function hc(e,t,r){return void 0===r&&(r=t,t=438),fc(e,8192|t,r)}function ic(e,t){if(!Db(e))throw new L(J.F);var r=S(t,{parent:!0}).g;if(!r)throw new L(J.F);var n=Bb(t),i=ac(r,n);if(i)throw new L(i);if(!r.k.symlink)throw new L(J.I);return r.k.symlink(r,n,e)}function Vb(e){if(!(e=S(e).g))throw new L(J.F);if(!e.k.readlink)throw new L(J.q);return Db(T(e.parent),e.k.readlink(e))}function jc(e,t){var r;if(!(r="string"==typeof e?S(e,{la:!0}).g:e).k.u)throw new L(J.I);r.k.u(r,{mode:4095&t|-4096&r.mode,timestamp:Date.now()})}function kc(t,r){var n,i,o;if(""===t)throw new L(J.F);if("string"==typeof r){if(void 0===(i=$b[r]))throw Error("Unknown file open mode: "+r)}else i=r;if(n=64&(r=i)?4095&(void 0===n?438:n)|32768:0,"object"==typeof t)o=t;else{t=zb(t);try{o=S(t,{la:!(131072&r)}).g}catch(e){}}if(i=!1,64&r)if(o){if(128&r)throw new L(J.wa)}else o=fc(t,n,0),i=!0;if(!o)throw new L(J.F);if(8192==(61440&o.mode)&&(r&=-513),65536&r&&!N(o.mode))throw new L(J.ya);if(!i&&(n=o?40960==(61440&o.mode)?J.ga:N(o.mode)&&(0!=(2097155&r)||512&r)?J.P:(n=["r","w","rw"][3&r],512&r&&(n+="w"),Yb(o,n)):J.F))throw new L(n);if(512&r){var a;if(!(a="string"==typeof(n=o)?S(n,{la:!0}).g:n).k.u)throw new L(J.I);if(N(a.mode))throw new L(J.P);if(32768!=(61440&a.mode))throw new L(J.q);if(n=Yb(a,"w"))throw new L(n);a.k.u(a,{size:0,timestamp:Date.now()})}r&=-641,(o=cc({g:o,path:T(o),flags:r,seekable:!0,position:0,n:o.n,tb:[],error:!1})).n.open&&o.n.open(o),!e.logReadFiles||1&r||(lc||(lc={}),t in lc||(lc[t]=1,e.printErr("read file: "+t)));try{R.onOpenFile&&(a=0,1!=(2097155&r)&&(a|=1),0!=(2097155&r)&&(a|=2),R.onOpenFile(t,a))}catch(e){console.log("FS.trackingDelegate['onOpenFile']('"+t+"', flags) threw an exception: "+e.message)}return o}function mc(e){e.na&&(e.na=null);try{e.n.close&&e.n.close(e)}catch(e){throw e}finally{Rb[e.fd]=null}}function nc(e,t,r){if(!e.seekable||!e.n.G)throw new L(J.ia);e.position=e.n.G(e,t,r),e.tb=[]}function oc(e,t,r,n,i,o){if(n<0||i<0)throw new L(J.q);if(0==(2097155&e.flags))throw new L(J.ea);if(N(e.g.mode))throw new L(J.P);if(!e.n.write)throw new L(J.q);1024&e.flags&&nc(e,0,2);var a=!0;if(void 0===i)i=e.position,a=!1;else if(!e.seekable)throw new L(J.ia);t=e.n.write(e,t,r,n,i,o),a||(e.position+=t);try{e.path&&R.onWriteToFile&&R.onWriteToFile(e.path)}catch(e){console.log("FS.trackingDelegate['onWriteToFile']('"+path+"') threw an exception: "+e.message)}return t}function pc(){L||((L=function(e,t){this.g=t,this.qb=function(e){for(var t in this.S=e,J)if(J[t]===e){this.code=t;break}},this.qb(e),this.message=xb[e]}).prototype=Error(),L.prototype.constructor=L,[J.F].forEach(function(e){Mb[e]=new L(e),Mb[e].stack=""}))}function rc(e,t){var r=0;return e&&(r|=365),t&&(r|=146),r}function sc(e,t,r,n){return gc(e=K("string"==typeof e?e:T(e),t),rc(r,n))}function tc(e,t,r,n,i,o){if(i=gc(e=t?K("string"==typeof e?e:T(e),t):e,n=rc(n,i)),r){if("string"==typeof r){e=Array(r.length),t=0;for(var a=r.length;t>2]}function xc(){var e;if(e=X(),!(e=Rb[e]))throw new L(J.ea);return e}var yc={};function Ga(e){Ga.p||(r=Qa(r),Ga.p=!0,assert(n.R),Ga.bb=n.R,n.R=function(){x("cannot dynamically allocate, sbrk now has control")});var t=r;return 0==e||Ga.bb(e)?t:4294967295}e._i64Add=zc;var Ac=1;function Cc(e,t){if(Dc=e,Ec=t,!Fc)return 1;if(0==e)Y=function(){setTimeout(Gc,t)},Hc="timeout";else if(1==e)Y=function(){Ic(Gc)},Hc="rAF";else if(2==e){if(!window.setImmediate){var r=[];window.addEventListener("message",function(e){e.source===window&&"__emcc"===e.data&&(e.stopPropagation(),r.shift()())},!0),window.setImmediate=function(e){r.push(e),window.postMessage("__emcc","*")}}Y=function(){window.setImmediate(Gc)},Hc="immediate"}return 0}function Jc(a,t,r,s,i){e.noExitRuntime=!0,assert(!Fc,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters."),Fc=a,Kc=s;var u=Lc;if(Gc=function(){if(!na)if(0>r-6&63;r=r-6,e=e+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[i]}2==r?(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t)<<4],e+="=="):4==r&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t)<<2],e+="="),l.src="data:audio/x-"+a.substr(-3)+";base64,"+e,s(l)}},l.src=i,ad(function(){s(l)})}});var r=e.canvas;r&&(r.sa=r.requestPointerLock||r.mozRequestPointerLock||r.webkitRequestPointerLock||r.msRequestPointerLock||function(){},r.Fa=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||function(){},r.Fa=r.Fa.bind(document),document.addEventListener("pointerlockchange",t,!1),document.addEventListener("mozpointerlockchange",t,!1),document.addEventListener("webkitpointerlockchange",t,!1),document.addEventListener("mspointerlockchange",t,!1),e.elementPointerLock&&r.addEventListener("click",function(e){!Tc&&r.sa&&(r.sa(),e.preventDefault())},!1))}}function bd(t,r,n,i){if(r&&e.ka&&t==e.canvas)return e.ka;var o,a;if(r){if(a={antialias:!1,alpha:!1},i)for(var s in i)a[s]=i[s];(a=GL.createContext(t,a))&&(o=GL.getContext(a).td),t.style.backgroundColor="black"}else o=t.getContext("2d");return o?(n&&(r||assert("undefined"==typeof GLctx,"cannot set in module if GLctx is used, but we are a non-GL context that would replace it"),e.ka=o,r&&GL.Od(a),e.Td=r,Uc.forEach(function(e){e()}),Vc()),o):null}var cd=!1,dd=void 0,ed=void 0;function fd(t,r,n){function i(){Sc=!1;var t=o.parentNode;(document.webkitFullScreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.mozFullscreenElement||document.fullScreenElement||document.fullscreenElement||document.msFullScreenElement||document.msFullscreenElement||document.webkitCurrentFullScreenElement)===t?(o.Da=document.cancelFullScreen||document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msExitFullscreen||document.exitFullscreen||function(){},o.Da=o.Da.bind(document),dd&&o.sa(),Sc=!0,ed&&gd()):(t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),ed&&hd()),e.onFullScreen&&e.onFullScreen(Sc),id(o)}void 0===(dd=t)&&(dd=!0),void 0===(ed=r)&&(ed=!1),void 0===(jd=n)&&(jd=null);var o=e.canvas;cd||(cd=!0,document.addEventListener("fullscreenchange",i,!1),document.addEventListener("mozfullscreenchange",i,!1),document.addEventListener("webkitfullscreenchange",i,!1),document.addEventListener("MSFullscreenChange",i,!1));var a=document.createElement("div");o.parentNode.insertBefore(a,o),a.appendChild(o),a.p=a.requestFullScreen||a.mozRequestFullScreen||a.msRequestFullscreen||(a.webkitRequestFullScreen?function(){a.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}:null),n?a.p({Ud:n}):a.p()}var kd=0;function ld(e){var t=Date.now();if(0===kd)kd=t+1e3/60;else for(;kd<=t+2;)kd+=1e3/60;t=Math.max(kd-t,0),setTimeout(e,t)}function Ic(e){"undefined"==typeof window?ld(e):(window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||ld),window.requestAnimationFrame(e))}function ad(t){e.noExitRuntime=!0,setTimeout(function(){na||t()},1e4)}function $c(e){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[e.substr(e.lastIndexOf(".")+1)]}function md(e,t,r){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)}function nd(t,r,e){md(t,function(e){assert(e,'Loading data file "'+t+'" failed (no arrayBuffer).'),r(new Uint8Array(e)),lb()},function(){if(!e)throw'Loading data file "'+t+'" failed.';e()}),kb()}var od=[],Wc,Xc,Yc,Zc,jd;function pd(){var t=e.canvas;od.forEach(function(e){e(t.width,t.height)})}function gd(){if("undefined"!=typeof SDL){var e=Sa[SDL.screen+0*n.J>>2];C[SDL.screen+0*n.J>>2]=8388608|e}pd()}function hd(){if("undefined"!=typeof SDL){var e=Sa[SDL.screen+0*n.J>>2];C[SDL.screen+0*n.J>>2]=-8388609&e}pd()}function id(t,r,n){r&&n?(t.ub=r,t.hb=n):(r=t.ub,n=t.hb);var i=r,o=n;if(e.forcedAspectRatio&&0this.length-1||e<0)){var t=e%this.chunkSize;return this.gb(e/this.chunkSize|0)[t]}},a.prototype.pb=function(e){this.gb=e},a.prototype.Ca=function(){var e=new XMLHttpRequest;if(e.open("HEAD",u,!1),e.send(null),!(200<=e.status&&e.status<300||304===e.status))throw Error("Couldn't load "+u+". Status: "+e.status);var t,o=Number(e.getResponseHeader("Content-length")),a=1048576;(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t||(a=o);var s=this;s.pb(function(e){var t=e*a,r=(e+1)*a-1;r=Math.min(r,o-1);if(void 0===s.Y[e]){var n=s.Y;if(r=(e=e.g.e).length)return 0;if(assert(0<=(n=Math.min(e.length-i,n))),e.slice)for(var o=0;o>2]=0;case 21520:return r.tty?-J.q:-J.Q;case 21531:if(i=X(),!r.n.ib)throw new L(J.Q);return r.n.ib(r,n,i);default:x("bad ioctl syscall "+n)}}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},___syscall6:function(e,t){wc=t;try{return mc(xc()),0}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},_emscripten_set_main_loop_timing:Cc,__ZSt18uncaught_exceptionv:tb,___setErrNo:ob,_sbrk:Ga,___cxa_begin_catch:function(e){var t;tb.p--,ub.push(e);e:{if(e&&!vb[e])for(t in vb)if(vb[t].wd===e)break e;t=e}return t&&vb[t].Sd++,e},_emscripten_memcpy_big:function(e,t,r){return E.set(E.subarray(t,t+r),e),e},_sysconf:function(e){switch(e){case 30:return 4096;case 85:return F/4096;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"==typeof navigator&&navigator.hardwareConcurrency||1}return ob(J.q),-1},_pthread_getspecific:function(e){return yc[e]||0},_pthread_self:function(){return 0},_pthread_once:wb,_pthread_key_create:function(e){return 0==e?J.q:(C[e>>2]=Ac,yc[Ac]=0,Ac++,0)},___unlock:function(){},_emscripten_set_main_loop:Jc,_pthread_setspecific:function(e,t){return e in yc?(yc[e]=t,0):J.q},___lock:function(){},_abort:function(){e.abort()},_pthread_cleanup_push:pb,_time:function(e){var t=Date.now()/1e3|0;return e&&(C[e>>2]=t),t},___syscall140:function(e,t){wc=t;try{var r=xc(),n=X(),i=X(),o=X(),a=X();return assert(0===n),nc(r,i,a),C[o>>2]=r.position,r.na&&0===i&&0===a&&(r.na=null),0}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},___syscall146:function(e,t){wc=t;try{var r,n=xc(),i=X();e:{for(var o=X(),a=0,s=0;s>2],C[i+(8*s+4)>>2],void 0);if(u<0){r=-1;break e}a+=u}r=a}return r}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},STACKTOP:m,STACK_MAX:Va,tempDoublePtr:mb,ABORT:na,cttz_i8:qd};var Z=function(e,t,r){"use asm";var n=e.Int8Array;var i=e.Int16Array;var o=e.Int32Array;var a=e.Uint8Array;var s=e.Uint16Array;var u=e.Uint32Array;var l=e.Float32Array;var c=e.Float64Array;var de=new n(r);var Q=new i(r);var pe=new o(r);var ge=new a(r);var me=new s(r);var f=new u(r);var h=new l(r);var ee=new c(r);var d=e.byteLength;var ve=t.STACKTOP|0;var p=t.STACK_MAX|0;var te=t.tempDoublePtr|0;var g=t.ABORT|0;var m=t.cttz_i8|0;var v=0;var _=0;var y=0;var b=0;var x=e.NaN,w=e.Infinity;var T=0,S=0,M=0,P=0,C=0.0,k=0,E=0,A=0,O=0.0;var re=0;var R=0;var I=0;var D=0;var L=0;var N=0;var j=0;var F=0;var B=0;var z=0;var U=e.Math.floor;var X=e.Math.abs;var q=e.Math.sqrt;var H=e.Math.pow;var Y=e.Math.cos;var G=e.Math.sin;var W=e.Math.tan;var V=e.Math.acos;var K=e.Math.asin;var Z=e.Math.atan;var J=e.Math.atan2;var $=e.Math.exp;var ne=e.Math.log;var ie=e.Math.ceil;var _e=e.Math.imul;var oe=e.Math.min;var ae=e.Math.clz32;var se=t.abort;var ue=t.assert;var le=t.invoke_iiii;var ce=t.invoke_viiiii;var fe=t.invoke_vi;var he=t.invoke_ii;var ye=t.invoke_viii;var be=t.invoke_v;var xe=t.invoke_viiiiii;var we=t.invoke_iiiiii;var Te=t.invoke_viiii;var Se=t._pthread_cleanup_pop;var Me=t.___syscall54;var Pe=t.___syscall6;var Ce=t._emscripten_set_main_loop_timing;var ke=t.__ZSt18uncaught_exceptionv;var Ee=t.___setErrNo;var Ae=t._sbrk;var Oe=t.___cxa_begin_catch;var Re=t._emscripten_memcpy_big;var Ie=t._sysconf;var De=t._pthread_getspecific;var Le=t._pthread_self;var Ne=t._pthread_once;var je=t._pthread_key_create;var Fe=t.___unlock;var Be=t._emscripten_set_main_loop;var ze=t._pthread_setspecific;var Ue=t.___lock;var Xe=t._abort;var qe=t._pthread_cleanup_push;var He=t._time;var Ye=t.___syscall140;var Ge=t.___syscall146;var We=0.0;function Ve(e){if(d(e)&16777215||d(e)<=16777215||d(e)>2147483648)return false;de=new n(e);Q=new i(e);pe=new o(e);ge=new a(e);me=new s(e);f=new u(e);h=new l(e);ee=new c(e);r=e;return true}function Ke(e){e=e|0;var t=0;t=ve;ve=ve+e|0;ve=ve+15&-16;return t|0}function Ze(){return ve|0}function Je(e){e=e|0;ve=e}function $e(e,t){e=e|0;t=t|0;ve=e;p=t}function Qe(e,t){e=e|0;t=t|0;if(!v){v=e;_=t}}function et(e){e=e|0;de[te>>0]=de[e>>0];de[te+1>>0]=de[e+1>>0];de[te+2>>0]=de[e+2>>0];de[te+3>>0]=de[e+3>>0]}function tt(e){e=e|0;de[te>>0]=de[e>>0];de[te+1>>0]=de[e+1>>0];de[te+2>>0]=de[e+2>>0];de[te+3>>0]=de[e+3>>0];de[te+4>>0]=de[e+4>>0];de[te+5>>0]=de[e+5>>0];de[te+6>>0]=de[e+6>>0];de[te+7>>0]=de[e+7>>0]}function rt(e){e=e|0;re=e}function nt(){return re|0}function it(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0;g=ve;ve=ve+608|0;h=g+88|0;f=g+72|0;u=g+64|0;s=g+48|0;a=g+24|0;o=g;c=g+96|0;d=g+92|0;l=e+4|0;p=e+8|0;if((pe[l>>2]|0)>>>0>(pe[p>>2]|0)>>>0){pe[o>>2]=1154;pe[o+4>>2]=2120;pe[o+8>>2]=1133;br(c,1100,o)|0;yr(c,g+16|0)|0}if((2147418112/(n>>>0)|0)>>>0<=t>>>0){pe[a>>2]=1154;pe[a+4>>2]=2121;pe[a+8>>2]=1169;br(c,1100,a)|0;yr(c,g+40|0)|0}a=pe[p>>2]|0;if(a>>>0>=t>>>0){p=1;ve=g;return p|0}do{if(r){if(t){o=t+-1|0;if(!(o&t)){o=11;break}else t=o}else t=-1;t=t>>>16|t;t=t>>>8|t;t=t>>>4|t;t=t>>>2|t;t=(t>>>1|t)+1|0;o=10}else o=10}while(0);if((o|0)==10)if(!t){t=0;o=12}else o=11;if((o|0)==11)if(t>>>0<=a>>>0)o=12;if((o|0)==12){pe[s>>2]=1154;pe[s+4>>2]=2130;pe[s+8>>2]=1217;br(c,1100,s)|0;yr(c,u)|0}r=_e(t,n)|0;do{if(!i){o=ot(pe[e>>2]|0,r,d,1)|0;if(!o){p=0;ve=g;return p|0}else{pe[e>>2]=o;break}}else{a=at(r,d)|0;if(!a){p=0;ve=g;return p|0}On[i&0](a,pe[e>>2]|0,pe[l>>2]|0);o=pe[e>>2]|0;do{if(o)if(!(o&7)){Dn[pe[104>>2]&1](o,0,0,1,pe[27]|0)|0;break}else{pe[f>>2]=1154;pe[f+4>>2]=2499;pe[f+8>>2]=1516;br(c,1100,f)|0;yr(c,h)|0;break}}while(0);pe[e>>2]=a}}while(0);o=pe[d>>2]|0;if(o>>>0>r>>>0)t=(o>>>0)/(n>>>0)|0;pe[p>>2]=t;p=1;ve=g;return p|0}function ot(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0;l=ve;ve=ve+592|0;u=l+48|0;o=l+24|0;i=l;s=l+72|0;a=l+68|0;if(e&7){pe[i>>2]=1154;pe[i+4>>2]=2499;pe[i+8>>2]=1494;br(s,1100,i)|0;yr(s,l+16|0)|0;u=0;ve=l;return u|0}if(t>>>0>2147418112){pe[o>>2]=1154;pe[o+4>>2]=2499;pe[o+8>>2]=1387;br(s,1100,o)|0;yr(s,l+40|0)|0;u=0;ve=l;return u|0}pe[a>>2]=t;n=Dn[pe[104>>2]&1](e,t,a,n,pe[27]|0)|0;if(r)pe[r>>2]=pe[a>>2];if(!(n&7)){u=n;ve=l;return u|0}pe[u>>2]=1154;pe[u+4>>2]=2551;pe[u+8>>2]=1440;br(s,1100,u)|0;yr(s,l+64|0)|0;u=n;ve=l;return u|0}function at(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0;u=ve;ve=ve+592|0;a=u+48|0;s=u+24|0;r=u;o=u+72|0;i=u+68|0;n=e+3&-4;n=(n|0)!=0?n:4;if(n>>>0>2147418112){pe[r>>2]=1154;pe[r+4>>2]=2499;pe[r+8>>2]=1387;br(o,1100,r)|0;yr(o,u+16|0)|0;s=0;ve=u;return s|0}pe[i>>2]=n;r=Dn[pe[104>>2]&1](0,n,i,1,pe[27]|0)|0;e=pe[i>>2]|0;if(t)pe[t>>2]=e;if((r|0)==0|e>>>0>>0){pe[s>>2]=1154;pe[s+4>>2]=2499;pe[s+8>>2]=1413;br(o,1100,s)|0;yr(o,u+40|0)|0;s=0;ve=u;return s|0}if(!(r&7)){s=r;ve=u;return s|0}pe[a>>2]=1154;pe[a+4>>2]=2526;pe[a+8>>2]=1440;br(o,1100,a)|0;yr(o,u+64|0)|0;s=r;ve=u;return s|0}function st(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0;F=ve;ve=ve+960|0;L=F+232|0;D=F+216|0;I=F+208|0;R=F+192|0;O=F+184|0;A=F+168|0;E=F+160|0;k=F+144|0;M=F+136|0;S=F+120|0;T=F+112|0;w=F+96|0;y=F+88|0;_=F+72|0;v=F+64|0;m=F+48|0;f=F+40|0;d=F+24|0;h=F+16|0;c=F;C=F+440|0;N=F+376|0;j=F+304|0;g=F+236|0;if((t|0)==0|n>>>0>11){e=0;ve=F;return e|0}pe[e>>2]=t;i=j;o=i+68|0;do{pe[i>>2]=0;i=i+4|0}while((i|0)<(o|0));o=0;do{i=de[r+o>>0]|0;if(i<<24>>24){P=j+((i&255)<<2)|0;pe[P>>2]=(pe[P>>2]|0)+1}o=o+1|0}while((o|0)!=(t|0));o=0;l=1;a=0;s=-1;u=0;while(1){i=pe[j+(l<<2)>>2]|0;if(!i)pe[e+28+(l+-1<<2)>>2]=0;else{P=l+-1|0;pe[N+(P<<2)>>2]=o;o=i+o|0;x=16-l|0;pe[e+28+(P<<2)>>2]=(o+-1<>2]=u;pe[g+(l<<2)>>2]=u;a=a>>>0>l>>>0?a:l;s=s>>>0>>0?s:l;u=i+u|0}l=l+1|0;if((l|0)==17){P=a;break}else o=o<<1}pe[e+4>>2]=u;o=e+172|0;do{if(u>>>0>(pe[o>>2]|0)>>>0){pe[o>>2]=u;if(u){i=u+-1|0;if(i&u)p=14}else{i=-1;p=14}if((p|0)==14){x=i>>>16|i;x=x>>>8|x;x=x>>>4|x;x=x>>>2|x;x=(x>>>1|x)+1|0;pe[o>>2]=x>>>0>t>>>0?t:x}a=e+176|0;i=pe[a>>2]|0;do{if(i){x=pe[i+-4>>2]|0;i=i+-8|0;if(!((x|0)!=0?(x|0)==(~pe[i>>2]|0):0)){pe[c>>2]=1154;pe[c+4>>2]=644;pe[c+8>>2]=1863;br(C,1100,c)|0;yr(C,h)|0}if(!(i&7)){Dn[pe[104>>2]&1](i,0,0,1,pe[27]|0)|0;break}else{pe[d>>2]=1154;pe[d+4>>2]=2499;pe[d+8>>2]=1516;br(C,1100,d)|0;yr(C,f)|0;break}}}while(0);o=pe[o>>2]|0;o=(o|0)!=0?o:1;i=at((o<<1)+8|0,0)|0;if(!i){pe[a>>2]=0;i=0;break}else{pe[i+4>>2]=o;pe[i>>2]=~o;pe[a>>2]=i+8;p=25;break}}else p=25}while(0);e:do{if((p|0)==25){x=e+24|0;de[x>>0]=s;de[e+25>>0]=P;o=e+176|0;a=0;do{b=de[r+a>>0]|0;i=b&255;if(b<<24>>24){if(!(pe[j+(i<<2)>>2]|0)){pe[m>>2]=1154;pe[m+4>>2]=2273;pe[m+8>>2]=1261;br(C,1100,m)|0;yr(C,v)|0}b=g+(i<<2)|0;i=pe[b>>2]|0;pe[b>>2]=i+1;if(i>>>0>=u>>>0){pe[_>>2]=1154;pe[_+4>>2]=2277;pe[_+8>>2]=1274;br(C,1100,_)|0;yr(C,y)|0}Q[(pe[o>>2]|0)+(i<<1)>>1]=a}a=a+1|0}while((a|0)!=(t|0));i=de[x>>0]|0;y=(i&255)>>>0>>0?n:0;b=e+8|0;pe[b>>2]=y;_=(y|0)!=0;if(_){v=1<>>0>(pe[i>>2]|0)>>>0){pe[i>>2]=v;a=e+168|0;i=pe[a>>2]|0;do{if(i){m=pe[i+-4>>2]|0;i=i+-8|0;if(!((m|0)!=0?(m|0)==(~pe[i>>2]|0):0)){pe[w>>2]=1154;pe[w+4>>2]=644;pe[w+8>>2]=1863;br(C,1100,w)|0;yr(C,T)|0}if(!(i&7)){Dn[pe[104>>2]&1](i,0,0,1,pe[27]|0)|0;break}else{pe[S>>2]=1154;pe[S+4>>2]=2499;pe[S+8>>2]=1516;br(C,1100,S)|0;yr(C,M)|0;break}}}while(0);i=v<<2;o=at(i+8|0,0)|0;if(!o){pe[a>>2]=0;i=0;break e}else{M=o+8|0;pe[o+4>>2]=v;pe[o>>2]=~v;pe[a>>2]=M;o=M;break}}else{o=e+168|0;i=v<<2;a=o;o=pe[o>>2]|0}}while(0);Vr(o|0,-1,i|0)|0;p=e+176|0;m=1;do{if(pe[j+(m<<2)>>2]|0){t=y-m|0;g=1<>2]|0;if(o>>>0>=16){pe[k>>2]=1154;pe[k+4>>2]=1953;pe[k+8>>2]=1737;br(C,1100,k)|0;yr(C,E)|0}i=pe[e+28+(o<<2)>>2]|0;if(!i)d=-1;else d=(i+-1|0)>>>(16-m|0);if(s>>>0<=d>>>0){f=(pe[e+96+(o<<2)>>2]|0)-s|0;h=m<<16;do{i=me[(pe[p>>2]|0)+(f+s<<1)>>1]|0;if((ge[r+i>>0]|0|0)!=(m|0)){pe[A>>2]=1154;pe[A+4>>2]=2319;pe[A+8>>2]=1303;br(C,1100,A)|0;yr(C,O)|0}c=s<>>0>=v>>>0){pe[R>>2]=1154;pe[R+4>>2]=2325;pe[R+8>>2]=1337;br(C,1100,R)|0;yr(C,I)|0}i=pe[a>>2]|0;if((pe[i+(u<<2)>>2]|0)!=-1){pe[D>>2]=1154;pe[D+4>>2]=2327;pe[D+8>>2]=1360;br(C,1100,D)|0;yr(C,L)|0;i=pe[a>>2]|0}pe[i+(u<<2)>>2]=o;l=l+1|0}while(l>>>0>>0);s=s+1|0}while(s>>>0<=d>>>0)}}m=m+1|0}while(y>>>0>=m>>>0);i=de[x>>0]|0}o=e+96|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N>>2]|0);o=e+100|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+4>>2]|0);o=e+104|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+8>>2]|0);o=e+108|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+12>>2]|0);o=e+112|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+16>>2]|0);o=e+116|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+20>>2]|0);o=e+120|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+24>>2]|0);o=e+124|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+28>>2]|0);o=e+128|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+32>>2]|0);o=e+132|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+36>>2]|0);o=e+136|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+40>>2]|0);o=e+140|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+44>>2]|0);o=e+144|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+48>>2]|0);o=e+148|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+52>>2]|0);o=e+152|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+56>>2]|0);o=e+156|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+60>>2]|0);o=e+16|0;pe[o>>2]=0;a=e+20|0;pe[a>>2]=i&255;t:do{if(_){while(1){if(!n)break t;i=n+-1|0;if(!(pe[j+(n<<2)>>2]|0))n=i;else break}pe[o>>2]=pe[e+28+(i<<2)>>2];i=y+1|0;pe[a>>2]=i;if(i>>>0<=P>>>0){while(1){if(pe[j+(i<<2)>>2]|0)break;i=i+1|0;if(i>>>0>P>>>0)break t}pe[a>>2]=i}}}while(0);pe[e+92>>2]=-1;pe[e+160>>2]=1048575;pe[e+12>>2]=32-(pe[b>>2]|0);i=1}}while(0);e=i;ve=F;return e|0}function ut(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0;if(!e){i=zr(t)|0;if(!r){r=i;return r|0}if(!i)o=0;else o=qr(i)|0;pe[r>>2]=o;r=i;return r|0}if(!t){Ur(e);if(!r){r=0;return r|0}pe[r>>2]=0;r=0;return r|0}i=Xr(e,t)|0;o=(i|0)!=0;if(o|n^1)o=o?i:e;else{i=Xr(e,t)|0;o=(i|0)==0?e:i}if(!r){r=i;return r|0}t=qr(o)|0;pe[r>>2]=t;r=i;return r|0}function lt(e,t,r){e=e|0;t=t|0;r=r|0;var n=0;if(!((e|0)!=0&t>>>0>73&(r|0)!=0)){r=0;return r|0}if((pe[r>>2]|0)!=40|t>>>0<74){r=0;return r|0}if(((ge[e>>0]|0)<<8|(ge[e+1>>0]|0)|0)!=18552){r=0;return r|0}if(((ge[e+2>>0]|0)<<8|(ge[e+3>>0]|0))>>>0<74){r=0;return r|0}if(((ge[e+7>>0]|0)<<16|(ge[e+6>>0]|0)<<24|(ge[e+8>>0]|0)<<8|(ge[e+9>>0]|0))>>>0>t>>>0){r=0;return r|0}pe[r+4>>2]=(ge[e+12>>0]|0)<<8|(ge[e+13>>0]|0);pe[r+8>>2]=(ge[e+14>>0]|0)<<8|(ge[e+15>>0]|0);pe[r+12>>2]=ge[e+16>>0];pe[r+16>>2]=ge[e+17>>0];t=e+18|0;n=r+32|0;pe[n>>2]=ge[t>>0];pe[n+4>>2]=0;t=de[t>>0]|0;pe[r+20>>2]=t<<24>>24==0|t<<24>>24==9?8:16;pe[r+24>>2]=(ge[e+26>>0]|0)<<16|(ge[e+25>>0]|0)<<24|(ge[e+27>>0]|0)<<8|(ge[e+28>>0]|0);pe[r+28>>2]=(ge[e+30>>0]|0)<<16|(ge[e+29>>0]|0)<<24|(ge[e+31>>0]|0)<<8|(ge[e+32>>0]|0);r=1;return r|0}function ct(e){e=e|0;Oe(e|0)|0;Ut()}function ft(e){e=e|0;var t=0,r=0,n=0,i=0,o=0;o=ve;ve=ve+544|0;i=o;n=o+24|0;t=pe[e+20>>2]|0;if(t)ht(t);t=e+4|0;r=pe[t>>2]|0;if(!r){i=e+16|0;de[i>>0]=0;ve=o;return}if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[i>>2]=1154;pe[i+4>>2]=2499;pe[i+8>>2]=1516;br(n,1100,i)|0;yr(n,o+16|0)|0}pe[t>>2]=0;pe[e+8>>2]=0;pe[e+12>>2]=0;i=e+16|0;de[i>>0]=0;ve=o;return}function ht(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;d=ve;ve=ve+640|0;h=d+112|0;f=d+96|0;c=d+88|0;l=d+72|0;u=d+64|0;s=d+48|0;n=d+40|0;o=d+24|0;i=d+16|0;r=d;a=d+120|0;if(!e){ve=d;return}t=pe[e+168>>2]|0;do{if(t){p=pe[t+-4>>2]|0;t=t+-8|0;if(!((p|0)!=0?(p|0)==(~pe[t>>2]|0):0)){pe[r>>2]=1154;pe[r+4>>2]=644;pe[r+8>>2]=1863;br(a,1100,r)|0;yr(a,i)|0}if(!(t&7)){Dn[pe[104>>2]&1](t,0,0,1,pe[27]|0)|0;break}else{pe[o>>2]=1154;pe[o+4>>2]=2499;pe[o+8>>2]=1516;br(a,1100,o)|0;yr(a,n)|0;break}}}while(0);t=pe[e+176>>2]|0;do{if(t){p=pe[t+-4>>2]|0;t=t+-8|0;if(!((p|0)!=0?(p|0)==(~pe[t>>2]|0):0)){pe[s>>2]=1154;pe[s+4>>2]=644;pe[s+8>>2]=1863;br(a,1100,s)|0;yr(a,u)|0}if(!(t&7)){Dn[pe[104>>2]&1](t,0,0,1,pe[27]|0)|0;break}else{pe[l>>2]=1154;pe[l+4>>2]=2499;pe[l+8>>2]=1516;br(a,1100,l)|0;yr(a,c)|0;break}}}while(0);if(!(e&7)){Dn[pe[104>>2]&1](e,0,0,1,pe[27]|0)|0;ve=d;return}else{pe[f>>2]=1154;pe[f+4>>2]=2499;pe[f+8>>2]=1516;br(a,1100,f)|0;yr(a,h)|0;ve=d;return}}function dt(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+560|0;a=c+40|0;s=c+24|0;t=c;o=c+48|0;i=e+8|0;r=pe[i>>2]|0;if((r+-1|0)>>>0>=8192){pe[t>>2]=1154;pe[t+4>>2]=2997;pe[t+8>>2]=1541;br(o,1100,t)|0;yr(o,c+16|0)|0}pe[e>>2]=r;n=e+20|0;t=pe[n>>2]|0;if(!t){t=at(180,0)|0;if(!t)t=0;else{l=t+164|0;pe[l>>2]=0;pe[l+4>>2]=0;pe[l+8>>2]=0;pe[l+12>>2]=0}pe[n>>2]=t;l=t;u=pe[e>>2]|0}else{l=t;u=r}if(!(pe[i>>2]|0)){pe[s>>2]=1154;pe[s+4>>2]=903;pe[s+8>>2]=1781;br(o,1100,s)|0;yr(o,a)|0;o=pe[e>>2]|0}else o=u;i=pe[e+4>>2]|0;if(o>>>0>16){r=o;t=0}else{e=0;l=st(l,u,i,e)|0;ve=c;return l|0}while(1){n=t+1|0;if(r>>>0>3){r=r>>>1;t=n}else{r=n;break}}e=t+2+((r|0)!=32&1<>>0>>0&1)|0;e=e>>>0<11?e&255:11;l=st(l,u,i,e)|0;ve=c;return l|0}function pt(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0;L=ve;ve=ve+800|0;A=L+256|0;E=L+240|0;k=L+232|0;C=L+216|0;P=L+208|0;M=L+192|0;S=L+184|0;T=L+168|0;w=L+160|0;x=L+144|0;b=L+136|0;y=L+120|0;_=L+112|0;v=L+96|0;m=L+88|0;g=L+72|0;f=L+64|0;c=L+48|0;s=L+40|0;u=L+24|0;o=L+16|0;i=L;I=L+288|0;D=L+264|0;O=gt(e,14)|0;if(!O){pe[t>>2]=0;r=t+4|0;n=pe[r>>2]|0;if(n){if(!(n&7))Dn[pe[104>>2]&1](n,0,0,1,pe[27]|0)|0;else{pe[i>>2]=1154;pe[i+4>>2]=2499;pe[i+8>>2]=1516;br(I,1100,i)|0;yr(I,o)|0}pe[r>>2]=0;pe[t+8>>2]=0;pe[t+12>>2]=0}de[t+16>>0]=0;r=t+20|0;n=pe[r>>2]|0;if(!n){t=1;ve=L;return t|0}ht(n);pe[r>>2]=0;t=1;ve=L;return t|0}d=t+4|0;p=t+8|0;r=pe[p>>2]|0;if((r|0)!=(O|0)){if(r>>>0<=O>>>0){do{if((pe[t+12>>2]|0)>>>0>>0){if(it(d,O,(r+1|0)==(O|0),1,0)|0){r=pe[p>>2]|0;break}de[t+16>>0]=1;t=0;ve=L;return t|0}}while(0);Vr((pe[d>>2]|0)+r|0,0,O-r|0)|0}pe[p>>2]=O}Vr(pe[d>>2]|0,0,O|0)|0;h=e+20|0;r=pe[h>>2]|0;if((r|0)<5){o=e+4|0;a=e+8|0;i=e+16|0;do{n=pe[o>>2]|0;if((n|0)==(pe[a>>2]|0))n=0;else{pe[o>>2]=n+1;n=ge[n>>0]|0}r=r+8|0;pe[h>>2]=r;if((r|0)>=33){pe[u>>2]=1154;pe[u+4>>2]=3199;pe[u+8>>2]=1650;br(I,1100,u)|0;yr(I,s)|0;r=pe[h>>2]|0}n=n<<32-r|pe[i>>2];pe[i>>2]=n}while((r|0)<5)}else{n=e+16|0;i=n;n=pe[n>>2]|0}l=n>>>27;pe[i>>2]=n<<5;pe[h>>2]=r+-5;if((l+-1|0)>>>0>20){t=0;ve=L;return t|0}pe[D+20>>2]=0;pe[D>>2]=0;pe[D+4>>2]=0;pe[D+8>>2]=0;pe[D+12>>2]=0;de[D+16>>0]=0;r=D+4|0;n=D+8|0;e:do{if(it(r,21,0,1,0)|0){s=pe[n>>2]|0;u=pe[r>>2]|0;Vr(u+s|0,0,21-s|0)|0;pe[n>>2]=21;if(l){i=e+4|0;o=e+8|0;a=e+16|0;s=0;do{r=pe[h>>2]|0;if((r|0)<3)do{n=pe[i>>2]|0;if((n|0)==(pe[o>>2]|0))n=0;else{pe[i>>2]=n+1;n=ge[n>>0]|0}r=r+8|0;pe[h>>2]=r;if((r|0)>=33){pe[c>>2]=1154;pe[c+4>>2]=3199;pe[c+8>>2]=1650;br(I,1100,c)|0;yr(I,f)|0;r=pe[h>>2]|0}n=n<<32-r|pe[a>>2];pe[a>>2]=n}while((r|0)<3);else n=pe[a>>2]|0;pe[a>>2]=n<<3;pe[h>>2]=r+-3;de[u+(ge[1611+s>>0]|0)>>0]=n>>>29;s=s+1|0}while((s|0)!=(l|0))}if(dt(D)|0){s=e+4|0;u=e+8|0;l=e+16|0;n=0;t:while(1){a=O-n|0;r=mt(e,D)|0;r:do{if(r>>>0<17){if((pe[p>>2]|0)>>>0<=n>>>0){pe[g>>2]=1154;pe[g+4>>2]=903;pe[g+8>>2]=1781;br(I,1100,g)|0;yr(I,m)|0}de[(pe[d>>2]|0)+n>>0]=r;r=n+1|0}else switch(r|0){case 17:{r=pe[h>>2]|0;if((r|0)<3)do{i=pe[s>>2]|0;if((i|0)==(pe[u>>2]|0))i=0;else{pe[s>>2]=i+1;i=ge[i>>0]|0}r=r+8|0;pe[h>>2]=r;if((r|0)>=33){pe[v>>2]=1154;pe[v+4>>2]=3199;pe[v+8>>2]=1650;br(I,1100,v)|0;yr(I,_)|0;r=pe[h>>2]|0}i=i<<32-r|pe[l>>2];pe[l>>2]=i}while((r|0)<3);else i=pe[l>>2]|0;pe[l>>2]=i<<3;pe[h>>2]=r+-3;r=(i>>>29)+3|0;if(r>>>0>a>>>0){r=0;break e}r=r+n|0;break r}case 18:{r=pe[h>>2]|0;if((r|0)<7)do{i=pe[s>>2]|0;if((i|0)==(pe[u>>2]|0))i=0;else{pe[s>>2]=i+1;i=ge[i>>0]|0}r=r+8|0;pe[h>>2]=r;if((r|0)>=33){pe[y>>2]=1154;pe[y+4>>2]=3199;pe[y+8>>2]=1650;br(I,1100,y)|0;yr(I,b)|0;r=pe[h>>2]|0}i=i<<32-r|pe[l>>2];pe[l>>2]=i}while((r|0)<7);else i=pe[l>>2]|0;pe[l>>2]=i<<7;pe[h>>2]=r+-7;r=(i>>>25)+11|0;if(r>>>0>a>>>0){r=0;break e}r=r+n|0;break r}default:{if((r+-19|0)>>>0>=2){R=90;break t}o=pe[h>>2]|0;if((r|0)==19){if((o|0)<2){i=o;while(1){r=pe[s>>2]|0;if((r|0)==(pe[u>>2]|0))o=0;else{pe[s>>2]=r+1;o=ge[r>>0]|0}r=i+8|0;pe[h>>2]=r;if((r|0)>=33){pe[x>>2]=1154;pe[x+4>>2]=3199;pe[x+8>>2]=1650;br(I,1100,x)|0;yr(I,w)|0;r=pe[h>>2]|0}i=o<<32-r|pe[l>>2];pe[l>>2]=i;if((r|0)<2)i=r;else break}}else{i=pe[l>>2]|0;r=o}pe[l>>2]=i<<2;pe[h>>2]=r+-2;o=(i>>>30)+3|0}else{if((o|0)<6){i=o;while(1){r=pe[s>>2]|0;if((r|0)==(pe[u>>2]|0))o=0;else{pe[s>>2]=r+1;o=ge[r>>0]|0}r=i+8|0;pe[h>>2]=r;if((r|0)>=33){pe[T>>2]=1154;pe[T+4>>2]=3199;pe[T+8>>2]=1650;br(I,1100,T)|0;yr(I,S)|0;r=pe[h>>2]|0}i=o<<32-r|pe[l>>2];pe[l>>2]=i;if((r|0)<6)i=r;else break}}else{i=pe[l>>2]|0;r=o}pe[l>>2]=i<<6;pe[h>>2]=r+-6;o=(i>>>26)+7|0}if((n|0)==0|o>>>0>a>>>0){r=0;break e}r=n+-1|0;if((pe[p>>2]|0)>>>0<=r>>>0){pe[M>>2]=1154;pe[M+4>>2]=903;pe[M+8>>2]=1781;br(I,1100,M)|0;yr(I,P)|0}i=de[(pe[d>>2]|0)+r>>0]|0;if(!(i<<24>>24)){r=0;break e}r=o+n|0;if(n>>>0>=r>>>0){r=n;break r}do{if((pe[p>>2]|0)>>>0<=n>>>0){pe[C>>2]=1154;pe[C+4>>2]=903;pe[C+8>>2]=1781;br(I,1100,C)|0;yr(I,k)|0}de[(pe[d>>2]|0)+n>>0]=i;n=n+1|0}while((n|0)!=(r|0))}}}while(0);if(O>>>0>r>>>0)n=r;else break}if((R|0)==90){pe[E>>2]=1154;pe[E+4>>2]=3140;pe[E+8>>2]=1632;br(I,1100,E)|0;yr(I,A)|0;r=0;break}if((O|0)==(r|0))r=dt(t)|0;else r=0}else r=0}else{de[D+16>>0]=1;r=0}}while(0);ft(D);t=r;ve=L;return t|0}function gt(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+544|0;s=c+16|0;a=c;o=c+24|0;if(!t){l=0;ve=c;return l|0}if(t>>>0<=16){l=vt(e,t)|0;ve=c;return l|0}u=vt(e,t+-16|0)|0;l=e+20|0;t=pe[l>>2]|0;if((t|0)<16){n=e+4|0;i=e+8|0;r=e+16|0;do{e=pe[n>>2]|0;if((e|0)==(pe[i>>2]|0))e=0;else{pe[n>>2]=e+1;e=ge[e>>0]|0}t=t+8|0;pe[l>>2]=t;if((t|0)>=33){pe[a>>2]=1154;pe[a+4>>2]=3199;pe[a+8>>2]=1650;br(o,1100,a)|0;yr(o,s)|0;t=pe[l>>2]|0}e=e<<32-t|pe[r>>2];pe[r>>2]=e}while((t|0)<16)}else{e=e+16|0;r=e;e=pe[e>>2]|0}pe[r>>2]=e<<16;pe[l>>2]=t+-16;l=e>>>16|u<<16;ve=c;return l|0}function mt(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0;y=ve;ve=ve+608|0;g=y+88|0;p=y+72|0;h=y+64|0;f=y+48|0;c=y+40|0;d=y+24|0;l=y+16|0;u=y;v=y+96|0;m=pe[t+20>>2]|0;_=e+20|0;s=pe[_>>2]|0;do{if((s|0)<24){a=e+4|0;n=pe[a>>2]|0;i=pe[e+8>>2]|0;r=n>>>0>>0;if((s|0)>=16){if(r){pe[a>>2]=n+1;r=ge[n>>0]|0}else r=0;pe[_>>2]=s+8;a=e+16|0;o=r<<24-s|pe[a>>2];pe[a>>2]=o;break}if(r){o=(ge[n>>0]|0)<<8;r=n+1|0}else{o=0;r=n}if(r>>>0>>0){n=ge[r>>0]|0;r=r+1|0}else n=0;pe[a>>2]=r;pe[_>>2]=s+16;a=e+16|0;o=(n|o)<<16-s|pe[a>>2];pe[a>>2]=o}else{o=e+16|0;a=o;o=pe[o>>2]|0}}while(0);i=(o>>>16)+1|0;do{if(i>>>0<=(pe[m+16>>2]|0)>>>0){n=pe[(pe[m+168>>2]|0)+(o>>>(32-(pe[m+8>>2]|0)|0)<<2)>>2]|0;if((n|0)==-1){pe[u>>2]=1154;pe[u+4>>2]=3244;pe[u+8>>2]=1677;br(v,1100,u)|0;yr(v,l)|0}r=n&65535;n=n>>>16;if((pe[t+8>>2]|0)>>>0<=r>>>0){pe[d>>2]=1154;pe[d+4>>2]=902;pe[d+8>>2]=1781;br(v,1100,d)|0;yr(v,c)|0}if((ge[(pe[t+4>>2]|0)+r>>0]|0|0)!=(n|0)){pe[f>>2]=1154;pe[f+4>>2]=3248;pe[f+8>>2]=1694;br(v,1100,f)|0;yr(v,h)|0}}else{n=pe[m+20>>2]|0;while(1){r=n+-1|0;if(i>>>0>(pe[m+28+(r<<2)>>2]|0)>>>0)n=n+1|0;else break}r=(o>>>(32-n|0))+(pe[m+96+(r<<2)>>2]|0)|0;if(r>>>0<(pe[t>>2]|0)>>>0){r=me[(pe[m+176>>2]|0)+(r<<1)>>1]|0;break}pe[p>>2]=1154;pe[p+4>>2]=3266;pe[p+8>>2]=1632;br(v,1100,p)|0;yr(v,g)|0;_=0;ve=y;return _|0}}while(0);pe[a>>2]=pe[a>>2]<>2]=(pe[_>>2]|0)-n;_=r;ve=y;return _|0}function vt(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+560|0;s=c+40|0;u=c+24|0;r=c;a=c+48|0;if(t>>>0>=33){pe[r>>2]=1154;pe[r+4>>2]=3190;pe[r+8>>2]=1634;br(a,1100,r)|0;yr(a,c+16|0)|0}l=e+20|0;r=pe[l>>2]|0;if((r|0)>=(t|0)){o=e+16|0;a=o;o=pe[o>>2]|0;s=r;u=32-t|0;u=o>>>u;o=o<>2]=o;t=s-t|0;pe[l>>2]=t;ve=c;return u|0}i=e+4|0;o=e+8|0;n=e+16|0;do{e=pe[i>>2]|0;if((e|0)==(pe[o>>2]|0))e=0;else{pe[i>>2]=e+1;e=ge[e>>0]|0}r=r+8|0;pe[l>>2]=r;if((r|0)>=33){pe[u>>2]=1154;pe[u+4>>2]=3199;pe[u+8>>2]=1650;br(a,1100,u)|0;yr(a,s)|0;r=pe[l>>2]|0}e=e<<32-r|pe[n>>2];pe[n>>2]=e}while((r|0)<(t|0));u=32-t|0;u=e>>>u;s=e<>2]=s;t=r-t|0;pe[l>>2]=t;ve=c;return u|0}function _t(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0;p=ve;ve=ve+544|0;h=p+16|0;f=p;c=p+24|0;if((e|0)==0|t>>>0<62){d=0;ve=p;return d|0}l=at(300,0)|0;if(!l){d=0;ve=p;return d|0}pe[l>>2]=519686845;r=l+4|0;pe[r>>2]=0;n=l+8|0;pe[n>>2]=0;u=l+88|0;i=l+136|0;o=l+160|0;a=u;s=a+44|0;do{pe[a>>2]=0;a=a+4|0}while((a|0)<(s|0));de[u+44>>0]=0;g=l+184|0;a=l+208|0;s=l+232|0;m=l+252|0;pe[m>>2]=0;pe[m+4>>2]=0;pe[m+8>>2]=0;de[m+12>>0]=0;m=l+268|0;pe[m>>2]=0;pe[m+4>>2]=0;pe[m+8>>2]=0;de[m+12>>0]=0;m=l+284|0;pe[m>>2]=0;pe[m+4>>2]=0;pe[m+8>>2]=0;de[m+12>>0]=0;pe[i>>2]=0;pe[i+4>>2]=0;pe[i+8>>2]=0;pe[i+12>>2]=0;pe[i+16>>2]=0;de[i+20>>0]=0;pe[o>>2]=0;pe[o+4>>2]=0;pe[o+8>>2]=0;pe[o+12>>2]=0;pe[o+16>>2]=0;de[o+20>>0]=0;pe[g>>2]=0;pe[g+4>>2]=0;pe[g+8>>2]=0;pe[g+12>>2]=0;pe[g+16>>2]=0;de[g+20>>0]=0;pe[a>>2]=0;pe[a+4>>2]=0;pe[a+8>>2]=0;pe[a+12>>2]=0;pe[a+16>>2]=0;de[a+20>>0]=0;pe[s>>2]=0;pe[s+4>>2]=0;pe[s+8>>2]=0;pe[s+12>>2]=0;de[s+16>>0]=0;do{if(((t>>>0>=74?((ge[e>>0]|0)<<8|(ge[e+1>>0]|0)|0)==18552:0)?((ge[e+2>>0]|0)<<8|(ge[e+3>>0]|0))>>>0>=74:0)?((ge[e+7>>0]|0)<<16|(ge[e+6>>0]|0)<<24|(ge[e+8>>0]|0)<<8|(ge[e+9>>0]|0))>>>0<=t>>>0:0){pe[u>>2]=e;pe[r>>2]=e;pe[n>>2]=t;if(Ct(l)|0){r=pe[u>>2]|0;if((ge[r+39>>0]|0)<<8|(ge[r+40>>0]|0)){if(!(kt(l)|0))break;if(!(Et(l)|0))break;r=pe[u>>2]|0}if(!((ge[r+55>>0]|0)<<8|(ge[r+56>>0]|0))){m=l;ve=p;return m|0}if(At(l)|0?Ot(l)|0:0){m=l;ve=p;return m|0}}}else d=7}while(0);if((d|0)==7)pe[u>>2]=0;Nt(l);if(!(l&7)){Dn[pe[104>>2]&1](l,0,0,1,pe[27]|0)|0;m=0;ve=p;return m|0}else{pe[f>>2]=1154;pe[f+4>>2]=2499;pe[f+8>>2]=1516;br(c,1100,f)|0;yr(c,h)|0;m=0;ve=p;return m|0}return 0}function yt(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+544|0;l=c;u=c+24|0;o=pe[e+88>>2]|0;s=(ge[o+70+(i<<2)+1>>0]|0)<<16|(ge[o+70+(i<<2)>>0]|0)<<24|(ge[o+70+(i<<2)+2>>0]|0)<<8|(ge[o+70+(i<<2)+3>>0]|0);a=i+1|0;if(a>>>0<(ge[o+16>>0]|0)>>>0)o=(ge[o+70+(a<<2)+1>>0]|0)<<16|(ge[o+70+(a<<2)>>0]|0)<<24|(ge[o+70+(a<<2)+2>>0]|0)<<8|(ge[o+70+(a<<2)+3>>0]|0);else o=pe[e+8>>2]|0;if(o>>>0>s>>>0){u=e+4|0;u=pe[u>>2]|0;u=u+s|0;l=o-s|0;l=bt(e,u,l,t,r,n,i)|0;ve=c;return l|0}pe[l>>2]=1154;pe[l+4>>2]=3704;pe[l+8>>2]=1792;br(u,1100,l)|0;yr(u,c+16|0)|0;u=e+4|0;u=pe[u>>2]|0;u=u+s|0;l=o-s|0;l=bt(e,u,l,t,r,n,i)|0;ve=c;return l|0}function bt(e,t,r,n,i,o,a){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;var s=0,u=0,l=0,c=0;c=pe[e+88>>2]|0;u=((ge[c+12>>0]|0)<<8|(ge[c+13>>0]|0))>>>a;l=((ge[c+14>>0]|0)<<8|(ge[c+15>>0]|0))>>>a;u=u>>>0>1?(u+3|0)>>>2:1;l=l>>>0>1?(l+3|0)>>>2:1;c=c+18|0;a=de[c>>0]|0;a=_e(a<<24>>24==0|a<<24>>24==9?8:16,u)|0;if(o)if((o&3|0)==0&a>>>0<=o>>>0)a=o;else{e=0;return e|0}if((_e(a,l)|0)>>>0>i>>>0){e=0;return e|0}o=(u+1|0)>>>1;s=(l+1|0)>>>1;if(!r){e=0;return e|0}pe[e+92>>2]=t;pe[e+96>>2]=t;pe[e+104>>2]=r;pe[e+100>>2]=t+r;pe[e+108>>2]=0;pe[e+112>>2]=0;switch(ge[c>>0]|0|0){case 0:{Rt(e,n,i,a,u,l,o,s)|0;e=1;return e|0}case 4:case 6:case 5:case 3:case 2:{It(e,n,i,a,u,l,o,s)|0;e=1;return e|0}case 9:{Dt(e,n,i,a,u,l,o,s)|0;e=1;return e|0}case 8:case 7:{Lt(e,n,i,a,u,l,o,s)|0;e=1;return e|0}default:{e=0;return e|0}}return 0}function xt(e,t){e=e|0;t=t|0;var r=0,n=0;n=ve;ve=ve+48|0;r=n;pe[r>>2]=40;lt(e,t,r)|0;ve=n;return pe[r+4>>2]|0}function wt(e,t){e=e|0;t=t|0;var r=0,n=0;n=ve;ve=ve+48|0;r=n;pe[r>>2]=40;lt(e,t,r)|0;ve=n;return pe[r+8>>2]|0}function Tt(e,t){e=e|0;t=t|0;var r=0,n=0;n=ve;ve=ve+48|0;r=n;pe[r>>2]=40;lt(e,t,r)|0;ve=n;return pe[r+12>>2]|0}function St(e,t){e=e|0;t=t|0;var r=0,n=0;n=ve;ve=ve+48|0;r=n;pe[r>>2]=40;lt(e,t,r)|0;ve=n;return pe[r+32>>2]|0}function Mt(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0,s=0,u=0,l=0;u=ve;ve=ve+576|0;a=u+56|0;o=u+40|0;i=u+64|0;l=u;pe[l>>2]=40;lt(e,t,l)|0;n=(((pe[l+4>>2]|0)>>>r)+3|0)>>>2;t=(((pe[l+8>>2]|0)>>>r)+3|0)>>>2;r=l+32|0;e=pe[r+4>>2]|0;do{switch(pe[r>>2]|0){case 0:{if(!e)e=8;else s=13;break}case 1:{if(!e)s=12;else s=13;break}case 2:{if(!e)s=12;else s=13;break}case 3:{if(!e)s=12;else s=13;break}case 4:{if(!e)s=12;else s=13;break}case 5:{if(!e)s=12;else s=13;break}case 6:{if(!e)s=12;else s=13;break}case 7:{if(!e)s=12;else s=13;break}case 8:{if(!e)s=12;else s=13;break}case 9:{if(!e)e=8;else s=13;break}default:s=13}}while(0);if((s|0)==12)e=16;else if((s|0)==13){pe[o>>2]=1154;pe[o+4>>2]=2663;pe[o+8>>2]=1535;br(i,1100,o)|0;yr(i,a)|0;e=0}l=_e(_e(t,n)|0,e)|0;ve=u;return l|0}function Pt(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0;p=ve;ve=ve+608|0;h=p+80|0;d=p+64|0;s=p+56|0;a=p+40|0;c=p+88|0;g=p;f=p+84|0;pe[g>>2]=40;lt(e,t,g)|0;u=(((pe[g+4>>2]|0)>>>i)+3|0)>>>2;g=g+32|0;o=pe[g+4>>2]|0;do{switch(pe[g>>2]|0){case 0:{if(!o)o=8;else l=13;break}case 1:{if(!o)l=12;else l=13;break}case 2:{if(!o)l=12;else l=13;break}case 3:{if(!o)l=12;else l=13;break}case 4:{if(!o)l=12;else l=13;break}case 5:{if(!o)l=12;else l=13;break}case 6:{if(!o)l=12;else l=13;break}case 7:{if(!o)l=12;else l=13;break}case 8:{if(!o)l=12;else l=13;break}case 9:{if(!o)o=8;else l=13;break}default:l=13}}while(0);if((l|0)==12)o=16;else if((l|0)==13){pe[a>>2]=1154;pe[a+4>>2]=2663;pe[a+8>>2]=1535;br(c,1100,a)|0;yr(c,s)|0;o=0}s=_e(o,u)|0;a=_t(e,t)|0;pe[f>>2]=r;o=(a|0)==0;if(!(i>>>0>15|(n>>>0<8|o))?(pe[a>>2]|0)==519686845:0)yt(a,f,n,s,i)|0;if(o){ve=p;return}if((pe[a>>2]|0)!=519686845){ve=p;return}Nt(a);if(!(a&7)){Dn[pe[104>>2]&1](a,0,0,1,pe[27]|0)|0;ve=p;return}else{pe[d>>2]=1154;pe[d+4>>2]=2499;pe[d+8>>2]=1516;br(c,1100,d)|0;yr(c,h)|0;ve=p;return}}function Ct(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0;a=e+92|0;n=pe[e+4>>2]|0;o=e+88|0;i=pe[o>>2]|0;t=(ge[i+68>>0]|0)<<8|(ge[i+67>>0]|0)<<16|(ge[i+69>>0]|0);r=n+t|0;i=(ge[i+65>>0]|0)<<8|(ge[i+66>>0]|0);if(!i){e=0;return e|0}pe[a>>2]=r;pe[e+96>>2]=r;pe[e+104>>2]=i;pe[e+100>>2]=n+(i+t);pe[e+108>>2]=0;pe[e+112>>2]=0;if(!(pt(a,e+116|0)|0)){e=0;return e|0}t=pe[o>>2]|0;do{if(!((ge[t+39>>0]|0)<<8|(ge[t+40>>0]|0))){if(!((ge[t+55>>0]|0)<<8|(ge[t+56>>0]|0))){e=0;return e|0}}else{if(!(pt(a,e+140|0)|0)){e=0;return e|0}if(pt(a,e+188|0)|0){t=pe[o>>2]|0;break}else{e=0;return e|0}}}while(0);if((ge[t+55>>0]|0)<<8|(ge[t+56>>0]|0)){if(!(pt(a,e+164|0)|0)){e=0;return e|0}if(!(pt(a,e+212|0)|0)){e=0;return e|0}}e=1;return e|0}function kt(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;p=ve;ve=ve+592|0;u=p+16|0;s=p;a=p+72|0;d=p+24|0;n=e+88|0;t=pe[n>>2]|0;h=(ge[t+39>>0]|0)<<8|(ge[t+40>>0]|0);c=e+236|0;o=e+240|0;r=pe[o>>2]|0;if((r|0)!=(h|0)){if(r>>>0<=h>>>0){do{if((pe[e+244>>2]|0)>>>0>>0){if(it(c,h,(r+1|0)==(h|0),4,0)|0){t=pe[o>>2]|0;break}de[e+248>>0]=1;d=0;ve=p;return d|0}else t=r}while(0);Vr((pe[c>>2]|0)+(t<<2)|0,0,h-t<<2|0)|0;t=pe[n>>2]|0}pe[o>>2]=h}l=e+92|0;r=pe[e+4>>2]|0;n=(ge[t+34>>0]|0)<<8|(ge[t+33>>0]|0)<<16|(ge[t+35>>0]|0);i=r+n|0;t=(ge[t+37>>0]|0)<<8|(ge[t+36>>0]|0)<<16|(ge[t+38>>0]|0);if(!t){d=0;ve=p;return d|0}pe[l>>2]=i;pe[e+96>>2]=i;pe[e+104>>2]=t;pe[e+100>>2]=r+(t+n);pe[e+108>>2]=0;pe[e+112>>2]=0;pe[d+20>>2]=0;pe[d>>2]=0;pe[d+4>>2]=0;pe[d+8>>2]=0;pe[d+12>>2]=0;de[d+16>>0]=0;e=d+24|0;pe[d+44>>2]=0;pe[e>>2]=0;pe[e+4>>2]=0;pe[e+8>>2]=0;pe[e+12>>2]=0;de[e+16>>0]=0;if(pt(l,d)|0?(f=d+24|0,pt(l,f)|0):0){if(!(pe[o>>2]|0)){pe[s>>2]=1154;pe[s+4>>2]=903;pe[s+8>>2]=1781;br(a,1100,s)|0;yr(a,u)|0}if(!h)t=1;else{n=0;i=0;o=0;t=0;a=0;e=0;s=0;r=pe[c>>2]|0;while(1){n=(mt(l,d)|0)+n&31;i=(mt(l,f)|0)+i&63;o=(mt(l,d)|0)+o&31;t=(mt(l,d)|0)+t|0;a=(mt(l,f)|0)+a&63;e=(mt(l,d)|0)+e&31;pe[r>>2]=i<<5|n<<11|o|t<<27|a<<21|e<<16;s=s+1|0;if((s|0)==(h|0)){t=1;break}else{t=t&31;r=r+4|0}}}}else t=0;ft(d+24|0);ft(d);d=t;ve=p;return d|0}function Et(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0;M=ve;ve=ve+1024|0;s=M+16|0;a=M;o=M+504|0;S=M+480|0;w=M+284|0;T=M+88|0;x=M+24|0;i=pe[e+88>>2]|0;b=(ge[i+47>>0]|0)<<8|(ge[i+48>>0]|0);y=e+92|0;t=pe[e+4>>2]|0;r=(ge[i+42>>0]|0)<<8|(ge[i+41>>0]|0)<<16|(ge[i+43>>0]|0);n=t+r|0;i=(ge[i+45>>0]|0)<<8|(ge[i+44>>0]|0)<<16|(ge[i+46>>0]|0);if(!i){S=0;ve=M;return S|0}pe[y>>2]=n;pe[e+96>>2]=n;pe[e+104>>2]=i;pe[e+100>>2]=t+(i+r);pe[e+108>>2]=0;pe[e+112>>2]=0;pe[S+20>>2]=0;pe[S>>2]=0;pe[S+4>>2]=0;pe[S+8>>2]=0;pe[S+12>>2]=0;de[S+16>>0]=0;if(pt(y,S)|0){r=0;n=-3;i=-3;while(1){pe[w+(r<<2)>>2]=n;pe[T+(r<<2)>>2]=i;t=(n|0)>2;r=r+1|0;if((r|0)==49)break;else{n=t?-3:n+1|0;i=(t&1)+i|0}}t=x;r=t+64|0;do{pe[t>>2]=0;t=t+4|0}while((t|0)<(r|0));_=e+252|0;r=e+256|0;t=pe[r>>2]|0;e:do{if((t|0)==(b|0))u=13;else{if(t>>>0<=b>>>0){do{if((pe[e+260>>2]|0)>>>0>>0)if(it(_,b,(t+1|0)==(b|0),4,0)|0){t=pe[r>>2]|0;break}else{de[e+264>>0]=1;t=0;break e}}while(0);Vr((pe[_>>2]|0)+(t<<2)|0,0,b-t<<2|0)|0}pe[r>>2]=b;u=13}}while(0);do{if((u|0)==13){if(!b){pe[a>>2]=1154;pe[a+4>>2]=903;pe[a+8>>2]=1781;br(o,1100,a)|0;yr(o,s)|0;t=1;break}n=x+4|0;i=x+8|0;e=x+12|0;o=x+16|0;a=x+20|0;s=x+24|0;u=x+28|0;l=x+32|0;c=x+36|0;f=x+40|0;h=x+44|0;d=x+48|0;p=x+52|0;g=x+56|0;m=x+60|0;v=0;r=pe[_>>2]|0;while(1){t=0;do{P=mt(y,S)|0;_=t<<1;C=x+(_<<2)|0;pe[C>>2]=(pe[C>>2]|0)+(pe[w+(P<<2)>>2]|0)&3;_=x+((_|1)<<2)|0;pe[_>>2]=(pe[_>>2]|0)+(pe[T+(P<<2)>>2]|0)&3;t=t+1|0}while((t|0)!=8);pe[r>>2]=(ge[1725+(pe[n>>2]|0)>>0]|0)<<2|(ge[1725+(pe[x>>2]|0)>>0]|0)|(ge[1725+(pe[i>>2]|0)>>0]|0)<<4|(ge[1725+(pe[e>>2]|0)>>0]|0)<<6|(ge[1725+(pe[o>>2]|0)>>0]|0)<<8|(ge[1725+(pe[a>>2]|0)>>0]|0)<<10|(ge[1725+(pe[s>>2]|0)>>0]|0)<<12|(ge[1725+(pe[u>>2]|0)>>0]|0)<<14|(ge[1725+(pe[l>>2]|0)>>0]|0)<<16|(ge[1725+(pe[c>>2]|0)>>0]|0)<<18|(ge[1725+(pe[f>>2]|0)>>0]|0)<<20|(ge[1725+(pe[h>>2]|0)>>0]|0)<<22|(ge[1725+(pe[d>>2]|0)>>0]|0)<<24|(ge[1725+(pe[p>>2]|0)>>0]|0)<<26|(ge[1725+(pe[g>>2]|0)>>0]|0)<<28|(ge[1725+(pe[m>>2]|0)>>0]|0)<<30;v=v+1|0;if((v|0)==(b|0)){t=1;break}else r=r+4|0}}}while(0)}else t=0;ft(S);C=t;ve=M;return C|0}function At(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0;h=ve;ve=ve+560|0;u=h+16|0;s=h;a=h+48|0;f=h+24|0;i=pe[e+88>>2]|0;c=(ge[i+55>>0]|0)<<8|(ge[i+56>>0]|0);l=e+92|0;t=pe[e+4>>2]|0;r=(ge[i+50>>0]|0)<<8|(ge[i+49>>0]|0)<<16|(ge[i+51>>0]|0);n=t+r|0;i=(ge[i+53>>0]|0)<<8|(ge[i+52>>0]|0)<<16|(ge[i+54>>0]|0);if(!i){f=0;ve=h;return f|0}pe[l>>2]=n;pe[e+96>>2]=n;pe[e+104>>2]=i;pe[e+100>>2]=t+(i+r);pe[e+108>>2]=0;pe[e+112>>2]=0;pe[f+20>>2]=0;pe[f>>2]=0;pe[f+4>>2]=0;pe[f+8>>2]=0;pe[f+12>>2]=0;de[f+16>>0]=0;e:do{if(pt(l,f)|0){o=e+268|0;r=e+272|0;t=pe[r>>2]|0;if((t|0)!=(c|0)){if(t>>>0<=c>>>0){do{if((pe[e+276>>2]|0)>>>0>>0)if(it(o,c,(t+1|0)==(c|0),2,0)|0){t=pe[r>>2]|0;break}else{de[e+280>>0]=1;t=0;break e}}while(0);Vr((pe[o>>2]|0)+(t<<1)|0,0,c-t<<1|0)|0}pe[r>>2]=c}if(!c){pe[s>>2]=1154;pe[s+4>>2]=903;pe[s+8>>2]=1781;br(a,1100,s)|0;yr(a,u)|0;t=1;break}r=0;n=0;i=0;t=pe[o>>2]|0;while(1){u=mt(l,f)|0;r=u+r&255;n=(mt(l,f)|0)+n&255;Q[t>>1]=n<<8|r;i=i+1|0;if((i|0)==(c|0)){t=1;break}else t=t+2|0}}else t=0}while(0);ft(f);f=t;ve=h;return f|0}function Ot(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0;M=ve;ve=ve+2432|0;s=M+16|0;a=M;o=M+1912|0;S=M+1888|0;w=M+988|0;T=M+88|0;x=M+24|0;i=pe[e+88>>2]|0;b=(ge[i+63>>0]|0)<<8|(ge[i+64>>0]|0);y=e+92|0;t=pe[e+4>>2]|0;r=(ge[i+58>>0]|0)<<8|(ge[i+57>>0]|0)<<16|(ge[i+59>>0]|0);n=t+r|0;i=(ge[i+61>>0]|0)<<8|(ge[i+60>>0]|0)<<16|(ge[i+62>>0]|0);if(!i){S=0;ve=M;return S|0}pe[y>>2]=n;pe[e+96>>2]=n;pe[e+104>>2]=i;pe[e+100>>2]=t+(i+r);pe[e+108>>2]=0;pe[e+112>>2]=0;pe[S+20>>2]=0;pe[S>>2]=0;pe[S+4>>2]=0;pe[S+8>>2]=0;pe[S+12>>2]=0;de[S+16>>0]=0;if(pt(y,S)|0){r=0;n=-7;i=-7;while(1){pe[w+(r<<2)>>2]=n;pe[T+(r<<2)>>2]=i;t=(n|0)>6;r=r+1|0;if((r|0)==225)break;else{n=t?-7:n+1|0;i=(t&1)+i|0}}t=x;r=t+64|0;do{pe[t>>2]=0;t=t+4|0}while((t|0)<(r|0));_=e+284|0;r=b*3|0;n=e+288|0;t=pe[n>>2]|0;e:do{if((t|0)==(r|0))u=13;else{if(t>>>0<=r>>>0){do{if((pe[e+292>>2]|0)>>>0>>0)if(it(_,r,(t+1|0)==(r|0),2,0)|0){t=pe[n>>2]|0;break}else{de[e+296>>0]=1;t=0;break e}}while(0);Vr((pe[_>>2]|0)+(t<<1)|0,0,r-t<<1|0)|0}pe[n>>2]=r;u=13}}while(0);do{if((u|0)==13){if(!b){pe[a>>2]=1154;pe[a+4>>2]=903;pe[a+8>>2]=1781;br(o,1100,a)|0;yr(o,s)|0;t=1;break}n=x+4|0;i=x+8|0;e=x+12|0;o=x+16|0;a=x+20|0;s=x+24|0;u=x+28|0;l=x+32|0;c=x+36|0;f=x+40|0;h=x+44|0;d=x+48|0;p=x+52|0;g=x+56|0;m=x+60|0;v=0;r=pe[_>>2]|0;while(1){t=0;do{P=mt(y,S)|0;_=t<<1;C=x+(_<<2)|0;pe[C>>2]=(pe[C>>2]|0)+(pe[w+(P<<2)>>2]|0)&7;_=x+((_|1)<<2)|0;pe[_>>2]=(pe[_>>2]|0)+(pe[T+(P<<2)>>2]|0)&7;t=t+1|0}while((t|0)!=8);P=ge[1729+(pe[a>>2]|0)>>0]|0;Q[r>>1]=(ge[1729+(pe[n>>2]|0)>>0]|0)<<3|(ge[1729+(pe[x>>2]|0)>>0]|0)|(ge[1729+(pe[i>>2]|0)>>0]|0)<<6|(ge[1729+(pe[e>>2]|0)>>0]|0)<<9|(ge[1729+(pe[o>>2]|0)>>0]|0)<<12|P<<15;C=ge[1729+(pe[f>>2]|0)>>0]|0;Q[r+2>>1]=(ge[1729+(pe[s>>2]|0)>>0]|0)<<2|P>>>1|(ge[1729+(pe[u>>2]|0)>>0]|0)<<5|(ge[1729+(pe[l>>2]|0)>>0]|0)<<8|(ge[1729+(pe[c>>2]|0)>>0]|0)<<11|C<<14;Q[r+4>>1]=(ge[1729+(pe[h>>2]|0)>>0]|0)<<1|C>>>2|(ge[1729+(pe[d>>2]|0)>>0]|0)<<4|(ge[1729+(pe[p>>2]|0)>>0]|0)<<7|(ge[1729+(pe[g>>2]|0)>>0]|0)<<10|(ge[1729+(pe[m>>2]|0)>>0]|0)<<13;v=v+1|0;if((v|0)==(b|0)){t=1;break}else r=r+6|0}}}while(0)}else t=0;ft(S);C=t;ve=M;return C|0}function Rt(e,t,r,n,i,o,a,s){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;s=s|0;var u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0,$=0,Q=0,ee=0,te=0,re=0,ne=0,ie=0,oe=0,ae=0,se=0,ue=0,le=0,ce=0,fe=0,he=0;ce=ve;ve=ve+720|0;le=ce+184|0;se=ce+168|0;ae=ce+160|0;oe=ce+144|0;ie=ce+136|0;ne=ce+120|0;re=ce+112|0;ee=ce+96|0;Q=ce+88|0;$=ce+72|0;J=ce+64|0;Z=ce+48|0;K=ce+40|0;ue=ce+24|0;te=ce+16|0;V=ce;G=ce+208|0;W=ce+192|0;B=e+240|0;z=pe[B>>2]|0;q=e+256|0;H=pe[q>>2]|0;r=de[(pe[e+88>>2]|0)+17>>0]|0;Y=n>>>2;if(!(r<<24>>24)){ve=ce;return 1}U=(s|0)==0;X=s+-1|0;R=(o&1|0)!=0;I=n<<1;D=e+92|0;L=e+116|0;N=e+140|0;j=e+236|0;F=a+-1|0;O=(i&1|0)!=0;A=e+188|0;M=e+252|0;P=Y+1|0;C=Y+2|0;k=Y+3|0;E=F<<4;T=r&255;r=0;o=0;i=1;S=0;do{if(!U){x=pe[t+(S<<2)>>2]|0;w=0;while(1){_=w&1;u=(_|0)==0;v=(_<<5^32)+-16|0;_=(_<<1^2)+-1|0;b=u?a:-1;l=u?0:F;e=(w|0)==(X|0);y=R&e;if((l|0)!=(b|0)){m=R&e^1;g=u?x:x+E|0;while(1){if((i|0)==1)i=mt(D,L)|0|512;p=i&7;i=i>>>3;u=ge[1823+p>>0]|0;e=0;do{h=(mt(D,N)|0)+o|0;d=h-z|0;o=d>>31;o=o&h|d&~o;if((pe[B>>2]|0)>>>0<=o>>>0){pe[V>>2]=1154;pe[V+4>>2]=903;pe[V+8>>2]=1781;br(G,1100,V)|0;yr(G,te)|0}pe[W+(e<<2)>>2]=pe[(pe[j>>2]|0)+(o<<2)>>2];e=e+1|0}while(e>>>0>>0);d=O&(l|0)==(F|0);if(y|d){h=0;do{c=_e(h,n)|0;e=g+c|0;u=(h|0)==0|m;f=h<<1;he=(mt(D,A)|0)+r|0;fe=he-H|0;r=fe>>31;r=r&he|fe&~r;do{if(d){if(!u){fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;break}pe[e>>2]=pe[W+((ge[1831+(p<<2)+f>>0]|0)<<2)>>2];if((pe[q>>2]|0)>>>0<=r>>>0){pe[oe>>2]=1154;pe[oe+4>>2]=903;pe[oe+8>>2]=1781;br(G,1100,oe)|0;yr(G,ae)|0}pe[g+(c+4)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r}else{if(!u){fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;break}pe[e>>2]=pe[W+((ge[1831+(p<<2)+f>>0]|0)<<2)>>2];if((pe[q>>2]|0)>>>0<=r>>>0){pe[ne>>2]=1154;pe[ne+4>>2]=903;pe[ne+8>>2]=1781;br(G,1100,ne)|0;yr(G,ie)|0}pe[g+(c+4)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;pe[g+(c+8)>>2]=pe[W+((ge[(f|1)+(1831+(p<<2))>>0]|0)<<2)>>2];if((pe[q>>2]|0)>>>0<=r>>>0){pe[se>>2]=1154;pe[se+4>>2]=903;pe[se+8>>2]=1781;br(G,1100,se)|0;yr(G,le)|0}pe[g+(c+12)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2]}}while(0);h=h+1|0}while((h|0)!=2)}else{pe[g>>2]=pe[W+((ge[1831+(p<<2)>>0]|0)<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;if((pe[q>>2]|0)>>>0<=r>>>0){pe[ue>>2]=1154;pe[ue+4>>2]=903;pe[ue+8>>2]=1781;br(G,1100,ue)|0;yr(G,K)|0}pe[g+4>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];pe[g+8>>2]=pe[W+((ge[1831+(p<<2)+1>>0]|0)<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;if((pe[q>>2]|0)>>>0<=r>>>0){pe[Z>>2]=1154;pe[Z+4>>2]=903;pe[Z+8>>2]=1781;br(G,1100,Z)|0;yr(G,J)|0}pe[g+12>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];pe[g+(Y<<2)>>2]=pe[W+((ge[1831+(p<<2)+2>>0]|0)<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;if((pe[q>>2]|0)>>>0<=r>>>0){pe[$>>2]=1154;pe[$+4>>2]=903;pe[$+8>>2]=1781;br(G,1100,$)|0;yr(G,Q)|0}pe[g+(P<<2)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];pe[g+(C<<2)>>2]=pe[W+((ge[1831+(p<<2)+3>>0]|0)<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;if((pe[q>>2]|0)>>>0<=r>>>0){pe[ee>>2]=1154;pe[ee+4>>2]=903;pe[ee+8>>2]=1781;br(G,1100,ee)|0;yr(G,re)|0}pe[g+(k<<2)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2]}l=l+_|0;if((l|0)==(b|0))break;else g=g+v|0}}w=w+1|0;if((w|0)==(s|0))break;else x=x+I|0}}S=S+1|0}while((S|0)!=(T|0));ve=ce;return 1}function It(e,t,r,n,i,o,a,s){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;s=s|0;var u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0,$=0,Q=0,ee=0,te=0,re=0,ne=0,ie=0,oe=0,ae=0,se=0,ue=0,le=0,ce=0,fe=0,he=0;fe=ve;ve=ve+640|0;ue=fe+88|0;se=fe+72|0;ae=fe+64|0;oe=fe+48|0;ie=fe+40|0;ce=fe+24|0;le=fe+16|0;ne=fe;te=fe+128|0;re=fe+112|0;ee=fe+96|0;B=e+240|0;z=pe[B>>2]|0;q=e+256|0;J=pe[q>>2]|0;$=e+272|0;Q=pe[$>>2]|0;r=pe[e+88>>2]|0;U=(ge[r+63>>0]|0)<<8|(ge[r+64>>0]|0);r=de[r+17>>0]|0;if(!(r<<24>>24)){ve=fe;return 1}X=(s|0)==0;H=s+-1|0;Y=n<<1;G=e+92|0;W=e+116|0;V=a+-1|0;K=e+212|0;Z=e+188|0;F=(i&1|0)==0;j=(o&1|0)==0;O=e+288|0;R=e+284|0;I=e+252|0;D=e+140|0;L=e+236|0;N=e+164|0;E=e+268|0;A=V<<5;C=r&255;r=0;i=0;o=0;e=0;u=1;k=0;do{if(!X){M=pe[t+(k<<2)>>2]|0;P=0;while(1){T=P&1;l=(T|0)==0;w=(T<<6^64)+-32|0;T=(T<<1^2)+-1|0;S=l?a:-1;c=l?0:V;if((c|0)!=(S|0)){x=j|(P|0)!=(H|0);b=l?M:M+A|0;while(1){if((u|0)==1)u=mt(G,W)|0|512;y=u&7;u=u>>>3;f=ge[1823+y>>0]|0;l=0;do{v=(mt(G,N)|0)+i|0;_=v-Q|0;i=_>>31;i=i&v|_&~i;if((pe[$>>2]|0)>>>0<=i>>>0){pe[ne>>2]=1154;pe[ne+4>>2]=903;pe[ne+8>>2]=1781;br(te,1100,ne)|0;yr(te,le)|0}pe[ee+(l<<2)>>2]=me[(pe[E>>2]|0)+(i<<1)>>1];l=l+1|0}while(l>>>0>>0);l=0;do{v=(mt(G,D)|0)+e|0;_=v-z|0;e=_>>31;e=e&v|_&~e;if((pe[B>>2]|0)>>>0<=e>>>0){pe[ce>>2]=1154;pe[ce+4>>2]=903;pe[ce+8>>2]=1781;br(te,1100,ce)|0;yr(te,ie)|0}pe[re+(l<<2)>>2]=pe[(pe[L>>2]|0)+(e<<2)>>2];l=l+1|0}while(l>>>0>>0);_=F|(c|0)!=(V|0);m=0;v=b;while(1){g=x|(m|0)==0;p=m<<1;h=0;d=v;while(1){f=(mt(G,K)|0)+r|0;l=f-U|0;r=l>>31;r=r&f|l&~r;l=(mt(G,Z)|0)+o|0;f=l-J|0;o=f>>31;o=o&l|f&~o;if((_|(h|0)==0)&g){l=ge[h+p+(1831+(y<<2))>>0]|0;f=r*3|0;if((pe[O>>2]|0)>>>0<=f>>>0){pe[oe>>2]=1154;pe[oe+4>>2]=903;pe[oe+8>>2]=1781;br(te,1100,oe)|0;yr(te,ae)|0}he=pe[R>>2]|0;pe[d>>2]=(me[he+(f<<1)>>1]|0)<<16|pe[ee+(l<<2)>>2];pe[d+4>>2]=(me[he+(f+2<<1)>>1]|0)<<16|(me[he+(f+1<<1)>>1]|0);pe[d+8>>2]=pe[re+(l<<2)>>2];if((pe[q>>2]|0)>>>0<=o>>>0){pe[se>>2]=1154;pe[se+4>>2]=903;pe[se+8>>2]=1781;br(te,1100,se)|0;yr(te,ue)|0}pe[d+12>>2]=pe[(pe[I>>2]|0)+(o<<2)>>2]}h=h+1|0;if((h|0)==2)break;else d=d+16|0}m=m+1|0;if((m|0)==2)break;else v=v+n|0}c=c+T|0;if((c|0)==(S|0))break;else b=b+w|0}}P=P+1|0;if((P|0)==(s|0))break;else M=M+Y|0}}k=k+1|0}while((k|0)!=(C|0));ve=fe;return 1}function Dt(e,t,r,n,i,o,a,s){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;s=s|0;var u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0;J=ve;ve=ve+608|0;V=J+64|0;W=J+48|0;G=J+40|0;Z=J+24|0;K=J+16|0;Y=J;H=J+88|0;q=J+72|0;I=e+272|0;D=pe[I>>2]|0;r=pe[e+88>>2]|0;L=(ge[r+63>>0]|0)<<8|(ge[r+64>>0]|0);r=de[r+17>>0]|0;if(!(r<<24>>24)){ve=J;return 1}N=(s|0)==0;j=s+-1|0;F=n<<1;B=e+92|0;z=e+116|0;U=a+-1|0;X=e+212|0;R=(o&1|0)==0;E=e+288|0;A=e+284|0;O=e+164|0;C=e+268|0;k=U<<4;P=r&255;M=(i&1|0)!=0;r=0;o=0;e=1;S=0;do{if(!N){w=pe[t+(S<<2)>>2]|0;T=0;while(1){b=T&1;i=(b|0)==0;y=(b<<5^32)+-16|0;b=(b<<1^2)+-1|0;x=i?a:-1;u=i?0:U;if((u|0)!=(x|0)){_=R|(T|0)!=(j|0);v=i?w:w+k|0;while(1){if((e|0)==1)e=mt(B,z)|0|512;m=e&7;e=e>>>3;l=ge[1823+m>>0]|0;i=0;do{p=(mt(B,O)|0)+o|0;g=p-D|0;o=g>>31;o=o&p|g&~o;if((pe[I>>2]|0)>>>0<=o>>>0){pe[Y>>2]=1154;pe[Y+4>>2]=903;pe[Y+8>>2]=1781;br(H,1100,Y)|0;yr(H,K)|0}pe[q+(i<<2)>>2]=me[(pe[C>>2]|0)+(o<<1)>>1];i=i+1|0}while(i>>>0>>0);g=(u|0)==(U|0)&M;d=0;p=v;while(1){h=_|(d|0)==0;f=d<<1;i=(mt(B,X)|0)+r|0;c=i-L|0;l=c>>31;l=l&i|c&~l;if(h){r=ge[1831+(m<<2)+f>>0]|0;i=l*3|0;if((pe[E>>2]|0)>>>0<=i>>>0){pe[Z>>2]=1154;pe[Z+4>>2]=903;pe[Z+8>>2]=1781;br(H,1100,Z)|0;yr(H,G)|0}c=pe[A>>2]|0;pe[p>>2]=(me[c+(i<<1)>>1]|0)<<16|pe[q+(r<<2)>>2];pe[p+4>>2]=(me[c+(i+2<<1)>>1]|0)<<16|(me[c+(i+1<<1)>>1]|0)}c=p+8|0;i=(mt(B,X)|0)+l|0;l=i-L|0;r=l>>31;r=r&i|l&~r;if(!(g|h^1)){i=ge[(f|1)+(1831+(m<<2))>>0]|0;l=r*3|0;if((pe[E>>2]|0)>>>0<=l>>>0){pe[W>>2]=1154;pe[W+4>>2]=903;pe[W+8>>2]=1781;br(H,1100,W)|0;yr(H,V)|0}h=pe[A>>2]|0;pe[c>>2]=(me[h+(l<<1)>>1]|0)<<16|pe[q+(i<<2)>>2];pe[p+12>>2]=(me[h+(l+2<<1)>>1]|0)<<16|(me[h+(l+1<<1)>>1]|0)}d=d+1|0;if((d|0)==2)break;else p=p+n|0}u=u+b|0;if((u|0)==(x|0))break;else v=v+y|0}}T=T+1|0;if((T|0)==(s|0))break;else w=w+F|0}}S=S+1|0}while((S|0)!=(P|0));ve=J;return 1}function Lt(e,t,r,n,i,o,a,s){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;s=s|0;var u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0,$=0,Q=0,ee=0,te=0,re=0,ne=0,ie=0,oe=0,ae=0;ae=ve;ve=ve+640|0;ne=ae+88|0;re=ae+72|0;te=ae+64|0;ee=ae+48|0;Q=ae+40|0;oe=ae+24|0;ie=ae+16|0;$=ae;J=ae+128|0;K=ae+112|0;Z=ae+96|0;B=e+272|0;z=pe[B>>2]|0;r=pe[e+88>>2]|0;U=(ge[r+63>>0]|0)<<8|(ge[r+64>>0]|0);r=de[r+17>>0]|0;if(!(r<<24>>24)){ve=ae;return 1}X=(s|0)==0;q=s+-1|0;H=n<<1;Y=e+92|0;G=e+116|0;W=a+-1|0;V=e+212|0;F=(i&1|0)==0;j=(o&1|0)==0;D=e+288|0;L=e+284|0;N=e+164|0;R=e+268|0;I=W<<5;A=r&255;r=0;i=0;o=0;e=0;u=1;O=0;do{if(!X){k=pe[t+(O<<2)>>2]|0;E=0;while(1){P=E&1;l=(P|0)==0;M=(P<<6^64)+-32|0;P=(P<<1^2)+-1|0;C=l?a:-1;c=l?0:W;if((c|0)!=(C|0)){S=j|(E|0)!=(q|0);T=l?k:k+I|0;while(1){if((u|0)==1)u=mt(Y,G)|0|512;w=u&7;u=u>>>3;f=ge[1823+w>>0]|0;l=0;do{b=(mt(Y,N)|0)+e|0;x=b-z|0;e=x>>31;e=e&b|x&~e;if((pe[B>>2]|0)>>>0<=e>>>0){pe[$>>2]=1154;pe[$+4>>2]=903;pe[$+8>>2]=1781;br(J,1100,$)|0;yr(J,ie)|0}pe[K+(l<<2)>>2]=me[(pe[R>>2]|0)+(e<<1)>>1];l=l+1|0}while(l>>>0>>0);l=0;do{b=(mt(Y,N)|0)+i|0;x=b-z|0;i=x>>31;i=i&b|x&~i;if((pe[B>>2]|0)>>>0<=i>>>0){pe[oe>>2]=1154;pe[oe+4>>2]=903;pe[oe+8>>2]=1781;br(J,1100,oe)|0;yr(J,Q)|0}pe[Z+(l<<2)>>2]=me[(pe[R>>2]|0)+(i<<1)>>1];l=l+1|0}while(l>>>0>>0);x=F|(c|0)!=(W|0);y=0;b=T;while(1){_=S|(y|0)==0;v=y<<1;g=0;m=b;while(1){p=(mt(Y,V)|0)+o|0;d=p-U|0;o=d>>31;o=o&p|d&~o;d=(mt(Y,V)|0)+r|0;p=d-U|0;r=p>>31;r=r&d|p&~r;if((x|(g|0)==0)&_){d=ge[g+v+(1831+(w<<2))>>0]|0;p=o*3|0;l=pe[D>>2]|0;if(l>>>0<=p>>>0){pe[ee>>2]=1154;pe[ee+4>>2]=903;pe[ee+8>>2]=1781;br(J,1100,ee)|0;yr(J,te)|0;l=pe[D>>2]|0}f=pe[L>>2]|0;h=r*3|0;if(l>>>0>h>>>0)l=f;else{pe[re>>2]=1154;pe[re+4>>2]=903;pe[re+8>>2]=1781;br(J,1100,re)|0;yr(J,ne)|0;l=pe[L>>2]|0}pe[m>>2]=(me[f+(p<<1)>>1]|0)<<16|pe[K+(d<<2)>>2];pe[m+4>>2]=(me[f+(p+2<<1)>>1]|0)<<16|(me[f+(p+1<<1)>>1]|0);pe[m+8>>2]=(me[l+(h<<1)>>1]|0)<<16|pe[Z+(d<<2)>>2];pe[m+12>>2]=(me[l+(h+2<<1)>>1]|0)<<16|(me[l+(h+1<<1)>>1]|0)}g=g+1|0;if((g|0)==2)break;else m=m+16|0}y=y+1|0;if((y|0)==2)break;else b=b+n|0}c=c+P|0;if((c|0)==(C|0))break;else T=T+M|0}}E=E+1|0;if((E|0)==(s|0))break;else k=k+H|0}}O=O+1|0}while((O|0)!=(A|0));ve=ae;return 1}function Nt(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0;h=ve;ve=ve+608|0;f=h+88|0;c=h+72|0;u=h+64|0;s=h+48|0;o=h+40|0;a=h+24|0;i=h+16|0;n=h;l=h+96|0;pe[e>>2]=0;t=e+284|0;r=pe[t>>2]|0;if(r){if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[n>>2]=1154;pe[n+4>>2]=2499;pe[n+8>>2]=1516;br(l,1100,n)|0;yr(l,i)|0}pe[t>>2]=0;pe[e+288>>2]=0;pe[e+292>>2]=0}de[e+296>>0]=0;t=e+268|0;r=pe[t>>2]|0;if(r){if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[a>>2]=1154;pe[a+4>>2]=2499;pe[a+8>>2]=1516;br(l,1100,a)|0;yr(l,o)|0}pe[t>>2]=0;pe[e+272>>2]=0;pe[e+276>>2]=0}de[e+280>>0]=0;t=e+252|0;r=pe[t>>2]|0;if(r){if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[s>>2]=1154;pe[s+4>>2]=2499;pe[s+8>>2]=1516;br(l,1100,s)|0;yr(l,u)|0}pe[t>>2]=0;pe[e+256>>2]=0;pe[e+260>>2]=0}de[e+264>>0]=0;t=e+236|0;r=pe[t>>2]|0;if(!r){f=e+248|0;de[f>>0]=0;f=e+212|0;ft(f);f=e+188|0;ft(f);f=e+164|0;ft(f);f=e+140|0;ft(f);f=e+116|0;ft(f);ve=h;return}if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[c>>2]=1154;pe[c+4>>2]=2499;pe[c+8>>2]=1516;br(l,1100,c)|0;yr(l,f)|0}pe[t>>2]=0;pe[e+240>>2]=0;pe[e+244>>2]=0;f=e+248|0;de[f>>0]=0;f=e+212|0;ft(f);f=e+188|0;ft(f);f=e+164|0;ft(f);f=e+140|0;ft(f);f=e+116|0;ft(f);ve=h;return}function jt(e,t){e=e|0;t=t|0;var r=0;r=ve;ve=ve+16|0;pe[r>>2]=t;t=pe[63]|0;xr(t,e,r)|0;vr(10,t)|0;Xe()}function Ft(){var e=0,t=0;e=ve;ve=ve+16|0;if(!(Ne(200,2)|0)){t=De(pe[49]|0)|0;ve=e;return t|0}else jt(2090,e);return 0}function Bt(e){e=e|0;Ur(e);return}function zt(e){e=e|0;var t=0;t=ve;ve=ve+16|0;Rn[e&3]();jt(2139,t)}function Ut(){var e=0,t=0;e=Ft()|0;if(((e|0)!=0?(t=pe[e>>2]|0,(t|0)!=0):0)?(e=t+48|0,(pe[e>>2]&-256|0)==1126902528?(pe[e+4>>2]|0)==1129074247:0):0)zt(pe[t+12>>2]|0);t=pe[28]|0;pe[28]=t+0;zt(t)}function Xt(e){e=e|0;return}function qt(e){e=e|0;return}function Ht(e){e=e|0;return}function Yt(e){e=e|0;return}function Gt(e){e=e|0;Bt(e);return}function Wt(e){e=e|0;Bt(e);return}function Vt(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0;a=ve;ve=ve+64|0;o=a;if((e|0)!=(t|0))if((t|0)!=0?(i=$t(t,24,40,0)|0,(i|0)!=0):0){t=o;n=t+56|0;do{pe[t>>2]=0;t=t+4|0}while((t|0)<(n|0));pe[o>>2]=i;pe[o+8>>2]=e;pe[o+12>>2]=-1;pe[o+48>>2]=1;Ln[pe[(pe[i>>2]|0)+28>>2]&3](i,o,pe[r>>2]|0,1);if((pe[o+24>>2]|0)==1){pe[r>>2]=pe[o+16>>2];t=1}else t=0}else t=0;else t=1;ve=a;return t|0}function Kt(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0;e=t+16|0;i=pe[e>>2]|0;do{if(i){if((i|0)!=(r|0)){n=t+36|0;pe[n>>2]=(pe[n>>2]|0)+1;pe[t+24>>2]=2;de[t+54>>0]=1;break}e=t+24|0;if((pe[e>>2]|0)==2)pe[e>>2]=n}else{pe[e>>2]=r;pe[t+24>>2]=n;pe[t+36>>2]=1}}while(0);return}function Zt(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;if((e|0)==(pe[t+8>>2]|0))Kt(0,t,r,n);return}function Jt(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;if((e|0)==(pe[t+8>>2]|0))Kt(0,t,r,n);else{e=pe[e+8>>2]|0;Ln[pe[(pe[e>>2]|0)+28>>2]&3](e,t,r,n)}return}function $t(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0;d=ve;ve=ve+64|0;h=d;f=pe[e>>2]|0;c=e+(pe[f+-8>>2]|0)|0;f=pe[f+-4>>2]|0;pe[h>>2]=r;pe[h+4>>2]=e;pe[h+8>>2]=t;pe[h+12>>2]=n;n=h+16|0;e=h+20|0;t=h+24|0;i=h+28|0;o=h+32|0;a=h+40|0;s=(f|0)==(r|0);u=n;l=u+36|0;do{pe[u>>2]=0;u=u+4|0}while((u|0)<(l|0));Q[n+36>>1]=0;de[n+38>>0]=0;e:do{if(s){pe[h+48>>2]=1;In[pe[(pe[r>>2]|0)+20>>2]&3](r,h,c,c,1,0);n=(pe[t>>2]|0)==1?c:0}else{kn[pe[(pe[f>>2]|0)+24>>2]&3](f,h,c,1,0);switch(pe[h+36>>2]|0){case 0:{n=(pe[a>>2]|0)==1&(pe[i>>2]|0)==1&(pe[o>>2]|0)==1?pe[e>>2]|0:0;break e}case 1:break;default:{n=0;break e}}if((pe[t>>2]|0)!=1?!((pe[a>>2]|0)==0&(pe[i>>2]|0)==1&(pe[o>>2]|0)==1):0){n=0;break}n=pe[n>>2]|0}}while(0);ve=d;return n|0}function Qt(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;de[t+53>>0]=1;do{if((pe[t+4>>2]|0)==(n|0)){de[t+52>>0]=1;n=t+16|0;e=pe[n>>2]|0;if(!e){pe[n>>2]=r;pe[t+24>>2]=i;pe[t+36>>2]=1;if(!((i|0)==1?(pe[t+48>>2]|0)==1:0))break;de[t+54>>0]=1;break}if((e|0)!=(r|0)){i=t+36|0;pe[i>>2]=(pe[i>>2]|0)+1;de[t+54>>0]=1;break}e=t+24|0;n=pe[e>>2]|0;if((n|0)==2){pe[e>>2]=i;n=i}if((n|0)==1?(pe[t+48>>2]|0)==1:0)de[t+54>>0]=1}}while(0);return}function er(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0;e:do{if((e|0)==(pe[t+8>>2]|0)){if((pe[t+4>>2]|0)==(r|0)?(o=t+28|0,(pe[o>>2]|0)!=1):0)pe[o>>2]=n}else{if((e|0)!=(pe[t>>2]|0)){s=pe[e+8>>2]|0;kn[pe[(pe[s>>2]|0)+24>>2]&3](s,t,r,n,i);break}if((pe[t+16>>2]|0)!=(r|0)?(a=t+20|0,(pe[a>>2]|0)!=(r|0)):0){pe[t+32>>2]=n;n=t+44|0;if((pe[n>>2]|0)==4)break;o=t+52|0;de[o>>0]=0;u=t+53|0;de[u>>0]=0;e=pe[e+8>>2]|0;In[pe[(pe[e>>2]|0)+20>>2]&3](e,t,r,r,1,i);if(de[u>>0]|0){if(!(de[o>>0]|0)){o=1;s=13}}else{o=0;s=13}do{if((s|0)==13){pe[a>>2]=r;u=t+40|0;pe[u>>2]=(pe[u>>2]|0)+1;if((pe[t+36>>2]|0)==1?(pe[t+24>>2]|0)==2:0){de[t+54>>0]=1;if(o)break}else s=16;if((s|0)==16?o:0)break;pe[n>>2]=4;break e}}while(0);pe[n>>2]=3;break}if((n|0)==1)pe[t+32>>2]=1}}while(0);return}function tr(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0;do{if((e|0)==(pe[t+8>>2]|0)){if((pe[t+4>>2]|0)==(r|0)?(a=t+28|0,(pe[a>>2]|0)!=1):0)pe[a>>2]=n}else if((e|0)==(pe[t>>2]|0)){if((pe[t+16>>2]|0)!=(r|0)?(o=t+20|0,(pe[o>>2]|0)!=(r|0)):0){pe[t+32>>2]=n;pe[o>>2]=r;i=t+40|0;pe[i>>2]=(pe[i>>2]|0)+1;if((pe[t+36>>2]|0)==1?(pe[t+24>>2]|0)==2:0)de[t+54>>0]=1;pe[t+44>>2]=4;break}if((n|0)==1)pe[t+32>>2]=1}}while(0);return}function rr(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;if((e|0)==(pe[t+8>>2]|0))Qt(0,t,r,n,i);else{e=pe[e+8>>2]|0;In[pe[(pe[e>>2]|0)+20>>2]&3](e,t,r,n,i,o)}return}function nr(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;if((e|0)==(pe[t+8>>2]|0))Qt(0,t,r,n,i);return}function ir(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0;i=ve;ve=ve+16|0;n=i;pe[n>>2]=pe[r>>2];e=Cn[pe[(pe[e>>2]|0)+16>>2]&7](e,t,n)|0;if(e)pe[r>>2]=pe[n>>2];ve=i;return e&1|0}function or(e){e=e|0;if(!e)e=0;else e=($t(e,24,72,0)|0)!=0;return e&1|0}function ar(){var e=0,t=0,r=0,n=0,i=0,o=0,a=0,s=0;i=ve;ve=ve+48|0;a=i+32|0;r=i+24|0;s=i+16|0;o=i;i=i+36|0;e=Ft()|0;if((e|0)!=0?(n=pe[e>>2]|0,(n|0)!=0):0){e=n+48|0;t=pe[e>>2]|0;e=pe[e+4>>2]|0;if(!((t&-256|0)==1126902528&(e|0)==1129074247)){pe[r>>2]=pe[51];jt(2368,r)}if((t|0)==1126902529&(e|0)==1129074247)e=pe[n+44>>2]|0;else e=n+80|0;pe[i>>2]=e;n=pe[n>>2]|0;e=pe[n+4>>2]|0;if(Cn[pe[(pe[8>>2]|0)+16>>2]&7](8,n,i)|0){s=pe[i>>2]|0;i=pe[51]|0;s=An[pe[(pe[s>>2]|0)+8>>2]&1](s)|0;pe[o>>2]=i;pe[o+4>>2]=e;pe[o+8>>2]=s;jt(2282,o)}else{pe[s>>2]=pe[51];pe[s+4>>2]=e;jt(2327,s)}}jt(2406,a)}function sr(){var e=0;e=ve;ve=ve+16|0;if(!(je(196,6)|0)){ve=e;return}else jt(2179,e)}function ur(e){e=e|0;var t=0;t=ve;ve=ve+16|0;Ur(e);if(!(ze(pe[49]|0,0)|0)){ve=t;return}else jt(2229,t)}function lr(e){e=e|0;var t=0,r=0;t=0;while(1){if((ge[2427+t>>0]|0)==(e|0)){r=2;break}t=t+1|0;if((t|0)==87){t=87;e=2515;r=5;break}}if((r|0)==2)if(!t)e=2515;else{e=2515;r=5}if((r|0)==5)while(1){r=e;while(1){e=r+1|0;if(!(de[r>>0]|0))break;else r=e}t=t+-1|0;if(!t)break;else r=5}return e|0}function cr(){var e=0;if(!(pe[52]|0))e=264;else{e=(Le()|0)+60|0;e=pe[e>>2]|0}return e|0}function fr(e){e=e|0;var t=0;if(e>>>0>4294963200){t=cr()|0;pe[t>>2]=0-e;e=-1}return e|0}function hr(e,t){e=+e;t=t|0;var r=0,n=0,i=0;ee[te>>3]=e;r=pe[te>>2]|0;n=pe[te+4>>2]|0;i=Kr(r|0,n|0,52)|0;i=i&2047;switch(i|0){case 0:{if(e!=0.0){e=+hr(e*18446744073709552.0e3,t);r=(pe[t>>2]|0)+-64|0}else r=0;pe[t>>2]=r;break}case 2047:break;default:{pe[t>>2]=i+-1022;pe[te>>2]=r;pe[te+4>>2]=n&-2146435073|1071644672;e=+ee[te>>3]}}return+e}function dr(e,t){e=+e;t=t|0;return+ +hr(e,t)}function pr(e,t,r){e=e|0;t=t|0;r=r|0;do{if(e){if(t>>>0<128){de[e>>0]=t;e=1;break}if(t>>>0<2048){de[e>>0]=t>>>6|192;de[e+1>>0]=t&63|128;e=2;break}if(t>>>0<55296|(t&-8192|0)==57344){de[e>>0]=t>>>12|224;de[e+1>>0]=t>>>6&63|128;de[e+2>>0]=t&63|128;e=3;break}if((t+-65536|0)>>>0<1048576){de[e>>0]=t>>>18|240;de[e+1>>0]=t>>>12&63|128;de[e+2>>0]=t>>>6&63|128;de[e+3>>0]=t&63|128;e=4;break}else{e=cr()|0;pe[e>>2]=84;e=-1;break}}else e=1}while(0);return e|0}function gr(e,t){e=e|0;t=t|0;if(!e)e=0;else e=pr(e,t,0)|0;return e|0}function mr(e){e=e|0;var t=0,r=0;do{if(e){if((pe[e+76>>2]|0)<=-1){t=Ir(e)|0;break}r=(Sr(e)|0)==0;t=Ir(e)|0;if(!r)Mr(e)}else{if(!(pe[65]|0))t=0;else t=mr(pe[65]|0)|0;Ue(236);e=pe[58]|0;if(e)do{if((pe[e+76>>2]|0)>-1)r=Sr(e)|0;else r=0;if((pe[e+20>>2]|0)>>>0>(pe[e+28>>2]|0)>>>0)t=Ir(e)|0|t;if(r)Mr(e);e=pe[e+56>>2]|0}while((e|0)!=0);Fe(236)}}while(0);return t|0}function vr(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0;if((pe[t+76>>2]|0)>=0?(Sr(t)|0)!=0:0){if((de[t+75>>0]|0)!=(e|0)?(n=t+20|0,i=pe[n>>2]|0,i>>>0<(pe[t+16>>2]|0)>>>0):0){pe[n>>2]=i+1;de[i>>0]=e;r=e&255}else r=Pr(t,e)|0;Mr(t)}else a=3;do{if((a|0)==3){if((de[t+75>>0]|0)!=(e|0)?(o=t+20|0,r=pe[o>>2]|0,r>>>0<(pe[t+16>>2]|0)>>>0):0){pe[o>>2]=r+1;de[r>>0]=e;r=e&255;break}r=Pr(t,e)|0}}while(0);return r|0}function _r(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0;n=r+16|0;i=pe[n>>2]|0;if(!i)if(!(Or(r)|0)){i=pe[n>>2]|0;o=4}else n=0;else o=4;e:do{if((o|0)==4){a=r+20|0;o=pe[a>>2]|0;if((i-o|0)>>>0>>0){n=Cn[pe[r+36>>2]&7](r,e,t)|0;break}t:do{if((de[r+75>>0]|0)>-1){n=t;while(1){if(!n){i=o;n=0;break t}i=n+-1|0;if((de[e+i>>0]|0)==10)break;else n=i}if((Cn[pe[r+36>>2]&7](r,e,n)|0)>>>0>>0)break e;t=t-n|0;e=e+n|0;i=pe[a>>2]|0}else{i=o;n=0}}while(0);$r(i|0,e|0,t|0)|0;pe[a>>2]=(pe[a>>2]|0)+t;n=n+t|0}}while(0);return n|0}function yr(e,t){e=e|0;t=t|0;var r=0,n=0;r=ve;ve=ve+16|0;n=r;pe[n>>2]=t;t=xr(pe[64]|0,e,n)|0;ve=r;return t|0}function br(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0;n=ve;ve=ve+16|0;i=n;pe[i>>2]=r;r=Tr(e,t,i)|0;ve=n;return r|0}function xr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0;g=ve;ve=ve+224|0;f=g+120|0;p=g+80|0;d=g;h=g+136|0;n=p;i=n+40|0;do{pe[n>>2]=0;n=n+4|0}while((n|0)<(i|0));pe[f>>2]=pe[r>>2];if((Dr(0,t,f,d,p)|0)<0)r=-1;else{if((pe[e+76>>2]|0)>-1)l=Sr(e)|0;else l=0;r=pe[e>>2]|0;c=r&32;if((de[e+74>>0]|0)<1)pe[e>>2]=r&-33;r=e+48|0;if(!(pe[r>>2]|0)){i=e+44|0;o=pe[i>>2]|0;pe[i>>2]=h;a=e+28|0;pe[a>>2]=h;s=e+20|0;pe[s>>2]=h;pe[r>>2]=80;u=e+16|0;pe[u>>2]=h+80;n=Dr(e,t,f,d,p)|0;if(o){Cn[pe[e+36>>2]&7](e,0,0)|0;n=(pe[s>>2]|0)==0?-1:n;pe[i>>2]=o;pe[r>>2]=0;pe[u>>2]=0;pe[a>>2]=0;pe[s>>2]=0}}else n=Dr(e,t,f,d,p)|0;r=pe[e>>2]|0;pe[e>>2]=r|c;if(l)Mr(e);r=(r&32|0)==0?n:-1}ve=g;return r|0}function wr(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+128|0;i=c+112|0;l=c;o=l;a=268;s=o+112|0;do{pe[o>>2]=pe[a>>2];o=o+4|0;a=a+4|0}while((o|0)<(s|0));if((t+-1|0)>>>0>2147483646)if(!t){t=1;u=4}else{t=cr()|0;pe[t>>2]=75;t=-1}else{i=e;u=4}if((u|0)==4){u=-2-i|0;u=t>>>0>u>>>0?u:t;pe[l+48>>2]=u;e=l+20|0;pe[e>>2]=i;pe[l+44>>2]=i;t=i+u|0;i=l+16|0;pe[i>>2]=t;pe[l+28>>2]=t;t=xr(l,r,n)|0;if(u){r=pe[e>>2]|0;de[r+(((r|0)==(pe[i>>2]|0))<<31>>31)>>0]=0}}ve=c;return t|0}function Tr(e,t,r){e=e|0;t=t|0;r=r|0;return wr(e,2147483647,t,r)|0}function Sr(e){e=e|0;return 0}function Mr(e){e=e|0;return}function Pr(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0;u=ve;ve=ve+16|0;s=u;a=t&255;de[s>>0]=a;n=e+16|0;i=pe[n>>2]|0;if(!i)if(!(Or(e)|0)){i=pe[n>>2]|0;o=4}else r=-1;else o=4;do{if((o|0)==4){n=e+20|0;o=pe[n>>2]|0;if(o>>>0>>0?(r=t&255,(r|0)!=(de[e+75>>0]|0)):0){pe[n>>2]=o+1;de[o>>0]=a;break}if((Cn[pe[e+36>>2]&7](e,s,1)|0)==1)r=ge[s>>0]|0;else r=-1}}while(0);ve=u;return r|0}function Cr(e){e=e|0;var t=0,r=0;t=ve;ve=ve+16|0;r=t;pe[r>>2]=pe[e+60>>2];e=fr(Pe(6,r|0)|0)|0;ve=t;return e|0}function kr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0;i=ve;ve=ve+32|0;o=i;n=i+20|0;pe[o>>2]=pe[e+60>>2];pe[o+4>>2]=0;pe[o+8>>2]=t;pe[o+12>>2]=n;pe[o+16>>2]=r;if((fr(Ye(140,o|0)|0)|0)<0){pe[n>>2]=-1;e=-1}else e=pe[n>>2]|0;ve=i;return e|0}function Er(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;p=ve;ve=ve+48|0;f=p+16|0;c=p;n=p+32|0;h=e+28|0;i=pe[h>>2]|0;pe[n>>2]=i;d=e+20|0;i=(pe[d>>2]|0)-i|0;pe[n+4>>2]=i;pe[n+8>>2]=t;pe[n+12>>2]=r;u=e+60|0;l=e+44|0;t=2;i=i+r|0;while(1){if(!(pe[52]|0)){pe[f>>2]=pe[u>>2];pe[f+4>>2]=n;pe[f+8>>2]=t;a=fr(Ge(146,f|0)|0)|0}else{qe(7,e|0);pe[c>>2]=pe[u>>2];pe[c+4>>2]=n;pe[c+8>>2]=t;a=fr(Ge(146,c|0)|0)|0;Se(0)}if((i|0)==(a|0)){i=6;break}if((a|0)<0){i=8;break}i=i-a|0;o=pe[n+4>>2]|0;if(a>>>0<=o>>>0)if((t|0)==2){pe[h>>2]=(pe[h>>2]|0)+a;s=o;t=2}else s=o;else{s=pe[l>>2]|0;pe[h>>2]=s;pe[d>>2]=s;s=pe[n+12>>2]|0;a=a-o|0;n=n+8|0;t=t+-1|0}pe[n>>2]=(pe[n>>2]|0)+a;pe[n+4>>2]=s-a}if((i|0)==6){f=pe[l>>2]|0;pe[e+16>>2]=f+(pe[e+48>>2]|0);e=f;pe[h>>2]=e;pe[d>>2]=e}else if((i|0)==8){pe[e+16>>2]=0;pe[h>>2]=0;pe[d>>2]=0;pe[e>>2]=pe[e>>2]|32;if((t|0)==2)r=0;else r=r-(pe[n+4>>2]|0)|0}ve=p;return r|0}function Ar(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0;i=ve;ve=ve+80|0;n=i;pe[e+36>>2]=3;if((pe[e>>2]&64|0)==0?(pe[n>>2]=pe[e+60>>2],pe[n+4>>2]=21505,pe[n+8>>2]=i+12,(Me(54,n|0)|0)!=0):0)de[e+75>>0]=-1;n=Er(e,t,r)|0;ve=i;return n|0}function Or(e){e=e|0;var t=0,r=0;t=e+74|0;r=de[t>>0]|0;de[t>>0]=r+255|r;t=pe[e>>2]|0;if(!(t&8)){pe[e+8>>2]=0;pe[e+4>>2]=0;t=pe[e+44>>2]|0;pe[e+28>>2]=t;pe[e+20>>2]=t;pe[e+16>>2]=t+(pe[e+48>>2]|0);t=0}else{pe[e>>2]=t|32;t=-1}return t|0}function Rr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0;o=t&255;n=(r|0)!=0;e:do{if(n&(e&3|0)!=0){i=t&255;while(1){if((de[e>>0]|0)==i<<24>>24){a=6;break e}e=e+1|0;r=r+-1|0;n=(r|0)!=0;if(!(n&(e&3|0)!=0)){a=5;break}}}else a=5}while(0);if((a|0)==5)if(n)a=6;else r=0;e:do{if((a|0)==6){i=t&255;if((de[e>>0]|0)!=i<<24>>24){n=_e(o,16843009)|0;t:do{if(r>>>0>3)while(1){o=pe[e>>2]^n;if((o&-2139062144^-2139062144)&o+-16843009)break;e=e+4|0;r=r+-4|0;if(r>>>0<=3){a=11;break t}}else a=11}while(0);if((a|0)==11)if(!r){r=0;break}while(1){if((de[e>>0]|0)==i<<24>>24)break e;e=e+1|0;r=r+-1|0;if(!r){r=0;break}}}}}while(0);return((r|0)!=0?e:0)|0}function Ir(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0;t=e+20|0;o=e+28|0;if((pe[t>>2]|0)>>>0>(pe[o>>2]|0)>>>0?(Cn[pe[e+36>>2]&7](e,0,0)|0,(pe[t>>2]|0)==0):0)t=-1;else{a=e+4|0;r=pe[a>>2]|0;n=e+8|0;i=pe[n>>2]|0;if(r>>>0>>0)Cn[pe[e+40>>2]&7](e,r-i|0,1)|0;pe[e+16>>2]=0;pe[o>>2]=0;pe[t>>2]=0;pe[n>>2]=0;pe[a>>2]=0;t=0}return t|0}function Dr(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0.0,c=0,f=0,h=0,d=0,p=0.0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0,$=0;$=ve;ve=ve+624|0;W=$+24|0;K=$+16|0;V=$+588|0;X=$+576|0;G=$;B=$+536|0;J=$+8|0;Z=$+528|0;A=(e|0)!=0;O=B+40|0;F=O;B=B+39|0;z=J+4|0;U=X+12|0;X=X+11|0;q=V;H=U;Y=H-q|0;R=-2-q|0;I=H+2|0;D=W+288|0;L=V+9|0;N=L;j=V+8|0;o=0;g=t;a=0;t=0;e:while(1){do{if((o|0)>-1)if((a|0)>(2147483647-o|0)){o=cr()|0;pe[o>>2]=75;o=-1;break}else{o=a+o|0;break}}while(0);a=de[g>>0]|0;if(!(a<<24>>24)){E=245;break}else s=g;t:while(1){switch(a<<24>>24){case 37:{a=s;E=9;break t}case 0:{a=s;break t}default:{}}k=s+1|0;a=de[k>>0]|0;s=k}t:do{if((E|0)==9)while(1){E=0;if((de[a+1>>0]|0)!=37)break t;s=s+1|0;a=a+2|0;if((de[a>>0]|0)==37)E=9;else break}}while(0);v=s-g|0;if(A?(pe[e>>2]&32|0)==0:0)_r(g,v,e)|0;if((s|0)!=(g|0)){g=a;a=v;continue}c=a+1|0;s=de[c>>0]|0;u=(s<<24>>24)+-48|0;if(u>>>0<10){k=(de[a+2>>0]|0)==36;c=k?a+3|0:c;s=de[c>>0]|0;d=k?u:-1;t=k?1:t}else d=-1;a=s<<24>>24;t:do{if((a&-32|0)==32){u=0;while(1){if(!(1<>24)+-32|u;c=c+1|0;s=de[c>>0]|0;a=s<<24>>24;if((a&-32|0)!=32){f=u;a=c;break}}}else{f=0;a=c}}while(0);do{if(s<<24>>24==42){u=a+1|0;s=(de[u>>0]|0)+-48|0;if(s>>>0<10?(de[a+2>>0]|0)==36:0){pe[i+(s<<2)>>2]=10;t=1;a=a+3|0;s=pe[n+((de[u>>0]|0)+-48<<3)>>2]|0}else{if(t){o=-1;break e}if(!A){m=f;a=u;t=0;k=0;break}t=(pe[r>>2]|0)+(4-1)&~(4-1);s=pe[t>>2]|0;pe[r>>2]=t+4;t=0;a=u}if((s|0)<0){m=f|8192;k=0-s|0}else{m=f;k=s}}else{u=(s<<24>>24)+-48|0;if(u>>>0<10){s=0;do{s=(s*10|0)+u|0;a=a+1|0;u=(de[a>>0]|0)+-48|0}while(u>>>0<10);if((s|0)<0){o=-1;break e}else{m=f;k=s}}else{m=f;k=0}}}while(0);t:do{if((de[a>>0]|0)==46){u=a+1|0;s=de[u>>0]|0;if(s<<24>>24!=42){c=(s<<24>>24)+-48|0;if(c>>>0<10){a=u;s=0}else{a=u;c=0;break}while(1){s=(s*10|0)+c|0;a=a+1|0;c=(de[a>>0]|0)+-48|0;if(c>>>0>=10){c=s;break t}}}u=a+2|0;s=(de[u>>0]|0)+-48|0;if(s>>>0<10?(de[a+3>>0]|0)==36:0){pe[i+(s<<2)>>2]=10;a=a+4|0;c=pe[n+((de[u>>0]|0)+-48<<3)>>2]|0;break}if(t){o=-1;break e}if(A){a=(pe[r>>2]|0)+(4-1)&~(4-1);c=pe[a>>2]|0;pe[r>>2]=a+4;a=u}else{a=u;c=0}}else c=-1}while(0);h=0;while(1){s=(de[a>>0]|0)+-65|0;if(s>>>0>57){o=-1;break e}u=a+1|0;s=de[5359+(h*58|0)+s>>0]|0;f=s&255;if((f+-1|0)>>>0<8){a=u;h=f}else{C=u;break}}if(!(s<<24>>24)){o=-1;break}u=(d|0)>-1;do{if(s<<24>>24==19)if(u){o=-1;break e}else E=52;else{if(u){pe[i+(d<<2)>>2]=f;M=n+(d<<3)|0;P=pe[M+4>>2]|0;E=G;pe[E>>2]=pe[M>>2];pe[E+4>>2]=P;E=52;break}if(!A){o=0;break e}jr(G,f,r)}}while(0);if((E|0)==52?(E=0,!A):0){g=C;a=v;continue}d=de[a>>0]|0;d=(h|0)!=0&(d&15|0)==3?d&-33:d;u=m&-65537;P=(m&8192|0)==0?m:u;t:do{switch(d|0){case 110:switch(h|0){case 0:{pe[pe[G>>2]>>2]=o;g=C;a=v;continue e}case 1:{pe[pe[G>>2]>>2]=o;g=C;a=v;continue e}case 2:{g=pe[G>>2]|0;pe[g>>2]=o;pe[g+4>>2]=((o|0)<0)<<31>>31;g=C;a=v;continue e}case 3:{Q[pe[G>>2]>>1]=o;g=C;a=v;continue e}case 4:{de[pe[G>>2]>>0]=o;g=C;a=v;continue e}case 6:{pe[pe[G>>2]>>2]=o;g=C;a=v;continue e}case 7:{g=pe[G>>2]|0;pe[g>>2]=o;pe[g+4>>2]=((o|0)<0)<<31>>31;g=C;a=v;continue e}default:{g=C;a=v;continue e}}case 112:{h=P|8;c=c>>>0>8?c:8;d=120;E=64;break}case 88:case 120:{h=P;E=64;break}case 111:{u=G;s=pe[u>>2]|0;u=pe[u+4>>2]|0;if((s|0)==0&(u|0)==0)a=O;else{a=O;do{a=a+-1|0;de[a>>0]=s&7|48;s=Kr(s|0,u|0,3)|0;u=re}while(!((s|0)==0&(u|0)==0))}if(!(P&8)){s=P;h=0;f=5839;E=77}else{h=F-a+1|0;s=P;c=(c|0)<(h|0)?h:c;h=0;f=5839;E=77}break}case 105:case 100:{s=G;a=pe[s>>2]|0;s=pe[s+4>>2]|0;if((s|0)<0){a=Wr(0,0,a|0,s|0)|0;s=re;u=G;pe[u>>2]=a;pe[u+4>>2]=s;u=1;f=5839;E=76;break t}if(!(P&2048)){f=P&1;u=f;f=(f|0)==0?5839:5841;E=76}else{u=1;f=5840;E=76}break}case 117:{s=G;a=pe[s>>2]|0;s=pe[s+4>>2]|0;u=0;f=5839;E=76;break}case 99:{de[B>>0]=pe[G>>2];g=B;s=1;h=0;d=5839;a=O;break}case 109:{a=cr()|0;a=lr(pe[a>>2]|0)|0;E=82;break}case 115:{a=pe[G>>2]|0;a=(a|0)!=0?a:5849;E=82;break}case 67:{pe[J>>2]=pe[G>>2];pe[z>>2]=0;pe[G>>2]=J;c=-1;E=86;break}case 83:{if(!c){Br(e,32,k,0,P);a=0;E=98}else E=86;break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{l=+ee[G>>3];pe[K>>2]=0;ee[te>>3]=l;if((pe[te+4>>2]|0)>=0)if(!(P&2048)){M=P&1;S=M;M=(M|0)==0?5857:5862}else{S=1;M=5859}else{l=-l;S=1;M=5856}ee[te>>3]=l;T=pe[te+4>>2]&2146435072;do{if(T>>>0<2146435072|(T|0)==2146435072&0<0){p=+dr(l,K)*2.0;s=p!=0.0;if(s)pe[K>>2]=(pe[K>>2]|0)+-1;x=d|32;if((x|0)==97){g=d&32;v=(g|0)==0?M:M+9|0;m=S|2;a=12-c|0;do{if(!(c>>>0>11|(a|0)==0)){l=8.0;do{a=a+-1|0;l=l*16.0}while((a|0)!=0);if((de[v>>0]|0)==45){l=-(l+(-p-l));break}else{l=p+l-l;break}}else l=p}while(0);s=pe[K>>2]|0;a=(s|0)<0?0-s|0:s;a=Fr(a,((a|0)<0)<<31>>31,U)|0;if((a|0)==(U|0)){de[X>>0]=48;a=X}de[a+-1>>0]=(s>>31&2)+43;h=a+-2|0;de[h>>0]=d+15;f=(c|0)<1;u=(P&8|0)==0;s=V;while(1){M=~~l;a=s+1|0;de[s>>0]=ge[5823+M>>0]|g;l=(l-+(M|0))*16.0;do{if((a-q|0)==1){if(u&(f&l==0.0))break;de[a>>0]=46;a=s+2|0}}while(0);if(!(l!=0.0))break;else s=a}c=(c|0)!=0&(R+a|0)<(c|0)?I+c-h|0:Y-h+a|0;u=c+m|0;Br(e,32,k,u,P);if(!(pe[e>>2]&32))_r(v,m,e)|0;Br(e,48,k,u,P^65536);a=a-q|0;if(!(pe[e>>2]&32))_r(V,a,e)|0;s=H-h|0;Br(e,48,c-(a+s)|0,0,0);if(!(pe[e>>2]&32))_r(h,s,e)|0;Br(e,32,k,u,P^8192);a=(u|0)<(k|0)?k:u;break}a=(c|0)<0?6:c;if(s){s=(pe[K>>2]|0)+-28|0;pe[K>>2]=s;l=p*268435456.0}else{l=p;s=pe[K>>2]|0}T=(s|0)<0?W:D;w=T;s=T;do{b=~~l>>>0;pe[s>>2]=b;s=s+4|0;l=(l-+(b>>>0))*1.0e9}while(l!=0.0);u=s;s=pe[K>>2]|0;if((s|0)>0){f=T;while(1){h=(s|0)>29?29:s;c=u+-4|0;do{if(c>>>0>>0)c=f;else{s=0;do{b=Zr(pe[c>>2]|0,0,h|0)|0;b=Jr(b|0,re|0,s|0,0)|0;s=re;y=sn(b|0,s|0,1e9,0)|0;pe[c>>2]=y;s=an(b|0,s|0,1e9,0)|0;c=c+-4|0}while(c>>>0>=f>>>0);if(!s){c=f;break}c=f+-4|0;pe[c>>2]=s}}while(0);while(1){if(u>>>0<=c>>>0)break;s=u+-4|0;if(!(pe[s>>2]|0))u=s;else break}s=(pe[K>>2]|0)-h|0;pe[K>>2]=s;if((s|0)>0)f=c;else break}}else c=T;if((s|0)<0){v=((a+25|0)/9|0)+1|0;_=(x|0)==102;g=c;while(1){m=0-s|0;m=(m|0)>9?9:m;do{if(g>>>0>>0){s=(1<>>m;c=0;h=g;do{b=pe[h>>2]|0;pe[h>>2]=(b>>>m)+c;c=_e(b&s,f)|0;h=h+4|0}while(h>>>0>>0);s=(pe[g>>2]|0)==0?g+4|0:g;if(!c){c=s;break}pe[u>>2]=c;c=s;u=u+4|0}else c=(pe[g>>2]|0)==0?g+4|0:g}while(0);s=_?T:c;u=(u-s>>2|0)>(v|0)?s+(v<<2)|0:u;s=(pe[K>>2]|0)+m|0;pe[K>>2]=s;if((s|0)>=0){g=c;break}else g=c}}else g=c;do{if(g>>>0>>0){s=(w-g>>2)*9|0;f=pe[g>>2]|0;if(f>>>0<10)break;else c=10;do{c=c*10|0;s=s+1|0}while(f>>>0>=c>>>0)}else s=0}while(0);y=(x|0)==103;b=(a|0)!=0;c=a-((x|0)!=102?s:0)+((b&y)<<31>>31)|0;if((c|0)<(((u-w>>2)*9|0)+-9|0)){h=c+9216|0;_=(h|0)/9|0;c=T+(_+-1023<<2)|0;h=((h|0)%9|0)+1|0;if((h|0)<9){f=10;do{f=f*10|0;h=h+1|0}while((h|0)!=9)}else f=10;m=pe[c>>2]|0;v=(m>>>0)%(f>>>0)|0;if((v|0)==0?(T+(_+-1022<<2)|0)==(u|0):0)f=g;else E=163;do{if((E|0)==163){E=0;p=(((m>>>0)/(f>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;h=(f|0)/2|0;do{if(v>>>0>>0)l=.5;else{if((v|0)==(h|0)?(T+(_+-1022<<2)|0)==(u|0):0){l=1.0;break}l=1.5}}while(0);do{if(S){if((de[M>>0]|0)!=45)break;p=-p;l=-l}}while(0);h=m-v|0;pe[c>>2]=h;if(!(p+l!=p)){f=g;break}x=h+f|0;pe[c>>2]=x;if(x>>>0>999999999){s=g;while(1){f=c+-4|0;pe[c>>2]=0;if(f>>>0>>0){s=s+-4|0;pe[s>>2]=0}x=(pe[f>>2]|0)+1|0;pe[f>>2]=x;if(x>>>0>999999999)c=f;else{g=s;c=f;break}}}s=(w-g>>2)*9|0;h=pe[g>>2]|0;if(h>>>0<10){f=g;break}else f=10;do{f=f*10|0;s=s+1|0}while(h>>>0>=f>>>0);f=g}}while(0);x=c+4|0;g=f;u=u>>>0>x>>>0?x:u}v=0-s|0;while(1){if(u>>>0<=g>>>0){_=0;x=u;break}c=u+-4|0;if(!(pe[c>>2]|0))u=c;else{_=1;x=u;break}}do{if(y){a=(b&1^1)+a|0;if((a|0)>(s|0)&(s|0)>-5){d=d+-1|0;a=a+-1-s|0}else{d=d+-2|0;a=a+-1|0}u=P&8;if(u)break;do{if(_){u=pe[x+-4>>2]|0;if(!u){c=9;break}if(!((u>>>0)%10|0)){f=10;c=0}else{c=0;break}do{f=f*10|0;c=c+1|0}while(((u>>>0)%(f>>>0)|0|0)==0)}else c=9}while(0);u=((x-w>>2)*9|0)+-9|0;if((d|32|0)==102){u=u-c|0;u=(u|0)<0?0:u;a=(a|0)<(u|0)?a:u;u=0;break}else{u=u+s-c|0;u=(u|0)<0?0:u;a=(a|0)<(u|0)?a:u;u=0;break}}else u=P&8}while(0);m=a|u;f=(m|0)!=0&1;h=(d|32|0)==102;if(h){s=(s|0)>0?s:0;d=0}else{c=(s|0)<0?v:s;c=Fr(c,((c|0)<0)<<31>>31,U)|0;if((H-c|0)<2)do{c=c+-1|0;de[c>>0]=48}while((H-c|0)<2);de[c+-1>>0]=(s>>31&2)+43;w=c+-2|0;de[w>>0]=d;s=H-w|0;d=w}v=S+1+a+f+s|0;Br(e,32,k,v,P);if(!(pe[e>>2]&32))_r(M,S,e)|0;Br(e,48,k,v,P^65536);do{if(h){c=g>>>0>T>>>0?T:g;s=c;do{u=Fr(pe[s>>2]|0,0,L)|0;do{if((s|0)==(c|0)){if((u|0)!=(L|0))break;de[j>>0]=48;u=j}else{if(u>>>0<=V>>>0)break;do{u=u+-1|0;de[u>>0]=48}while(u>>>0>V>>>0)}}while(0);if(!(pe[e>>2]&32))_r(u,N-u|0,e)|0;s=s+4|0}while(s>>>0<=T>>>0);do{if(m){if(pe[e>>2]&32)break;_r(5891,1,e)|0}}while(0);if((a|0)>0&s>>>0>>0){u=s;while(1){s=Fr(pe[u>>2]|0,0,L)|0;if(s>>>0>V>>>0)do{s=s+-1|0;de[s>>0]=48}while(s>>>0>V>>>0);if(!(pe[e>>2]&32))_r(s,(a|0)>9?9:a,e)|0;u=u+4|0;s=a+-9|0;if(!((a|0)>9&u>>>0>>0)){a=s;break}else a=s}}Br(e,48,a+9|0,9,0)}else{h=_?x:g+4|0;if((a|0)>-1){f=(u|0)==0;c=g;do{s=Fr(pe[c>>2]|0,0,L)|0;if((s|0)==(L|0)){de[j>>0]=48;s=j}do{if((c|0)==(g|0)){u=s+1|0;if(!(pe[e>>2]&32))_r(s,1,e)|0;if(f&(a|0)<1){s=u;break}if(pe[e>>2]&32){s=u;break}_r(5891,1,e)|0;s=u}else{if(s>>>0<=V>>>0)break;do{s=s+-1|0;de[s>>0]=48}while(s>>>0>V>>>0)}}while(0);u=N-s|0;if(!(pe[e>>2]&32))_r(s,(a|0)>(u|0)?u:a,e)|0;a=a-u|0;c=c+4|0}while(c>>>0>>0&(a|0)>-1)}Br(e,48,a+18|0,18,0);if(pe[e>>2]&32)break;_r(d,H-d|0,e)|0}}while(0);Br(e,32,k,v,P^8192);a=(v|0)<(k|0)?k:v}else{h=(d&32|0)!=0;f=l!=l|0.0!=0.0;s=f?0:S;c=s+3|0;Br(e,32,k,c,u);a=pe[e>>2]|0;if(!(a&32)){_r(M,s,e)|0;a=pe[e>>2]|0}if(!(a&32))_r(f?h?5883:5887:h?5875:5879,3,e)|0;Br(e,32,k,c,P^8192);a=(c|0)<(k|0)?k:c}}while(0);g=C;continue e}default:{u=P;s=c;h=0;d=5839;a=O}}}while(0);t:do{if((E|0)==64){u=G;s=pe[u>>2]|0;u=pe[u+4>>2]|0;f=d&32;if(!((s|0)==0&(u|0)==0)){a=O;do{a=a+-1|0;de[a>>0]=ge[5823+(s&15)>>0]|f;s=Kr(s|0,u|0,4)|0;u=re}while(!((s|0)==0&(u|0)==0));E=G;if((h&8|0)==0|(pe[E>>2]|0)==0&(pe[E+4>>2]|0)==0){s=h;h=0;f=5839;E=77}else{s=h;h=2;f=5839+(d>>4)|0;E=77}}else{a=O;s=h;h=0;f=5839;E=77}}else if((E|0)==76){a=Fr(a,s,O)|0;s=P;h=u;E=77}else if((E|0)==82){E=0;P=Rr(a,0,c)|0;M=(P|0)==0;g=a;s=M?c:P-a|0;h=0;d=5839;a=M?a+c|0:P}else if((E|0)==86){E=0;s=0;a=0;f=pe[G>>2]|0;while(1){u=pe[f>>2]|0;if(!u)break;a=gr(Z,u)|0;if((a|0)<0|a>>>0>(c-s|0)>>>0)break;s=a+s|0;if(c>>>0>s>>>0)f=f+4|0;else break}if((a|0)<0){o=-1;break e}Br(e,32,k,s,P);if(!s){a=0;E=98}else{u=0;c=pe[G>>2]|0;while(1){a=pe[c>>2]|0;if(!a){a=s;E=98;break t}a=gr(Z,a)|0;u=a+u|0;if((u|0)>(s|0)){a=s;E=98;break t}if(!(pe[e>>2]&32))_r(Z,a,e)|0;if(u>>>0>=s>>>0){a=s;E=98;break}else c=c+4|0}}}}while(0);if((E|0)==98){E=0;Br(e,32,k,a,P^8192);g=C;a=(k|0)>(a|0)?k:a;continue}if((E|0)==77){E=0;u=(c|0)>-1?s&-65537:s;s=G;s=(pe[s>>2]|0)!=0|(pe[s+4>>2]|0)!=0;if((c|0)!=0|s){s=(s&1^1)+(F-a)|0;g=a;s=(c|0)>(s|0)?c:s;d=f;a=O}else{g=O;s=0;d=f;a=O}}f=a-g|0;s=(s|0)<(f|0)?f:s;c=h+s|0;a=(k|0)<(c|0)?c:k;Br(e,32,a,c,u);if(!(pe[e>>2]&32))_r(d,h,e)|0;Br(e,48,a,c,u^65536);Br(e,48,s,f,0);if(!(pe[e>>2]&32))_r(g,f,e)|0;Br(e,32,a,c,u^8192);g=C}e:do{if((E|0)==245)if(!e)if(t){o=1;while(1){t=pe[i+(o<<2)>>2]|0;if(!t)break;jr(n+(o<<3)|0,t,r);o=o+1|0;if((o|0)>=10){o=1;break e}}if((o|0)<10)while(1){if(pe[i+(o<<2)>>2]|0){o=-1;break e}o=o+1|0;if((o|0)>=10){o=1;break}}else o=1}else o=0}while(0);ve=$;return o|0}function Lr(e){e=e|0;if(!(pe[e+68>>2]|0))Mr(e);return}function Nr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0;n=e+20|0;i=pe[n>>2]|0;e=(pe[e+16>>2]|0)-i|0;e=e>>>0>r>>>0?r:e;$r(i|0,t|0,e|0)|0;pe[n>>2]=(pe[n>>2]|0)+e;return r|0}function jr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0.0;e:do{if(t>>>0<=20)do{switch(t|0){case 9:{n=(pe[r>>2]|0)+(4-1)&~(4-1);t=pe[n>>2]|0;pe[r>>2]=n+4;pe[e>>2]=t;break e}case 10:{n=(pe[r>>2]|0)+(4-1)&~(4-1);t=pe[n>>2]|0;pe[r>>2]=n+4;n=e;pe[n>>2]=t;pe[n+4>>2]=((t|0)<0)<<31>>31;break e}case 11:{n=(pe[r>>2]|0)+(4-1)&~(4-1);t=pe[n>>2]|0;pe[r>>2]=n+4;n=e;pe[n>>2]=t;pe[n+4>>2]=0;break e}case 12:{n=(pe[r>>2]|0)+(8-1)&~(8-1);t=n;i=pe[t>>2]|0;t=pe[t+4>>2]|0;pe[r>>2]=n+8;n=e;pe[n>>2]=i;pe[n+4>>2]=t;break e}case 13:{i=(pe[r>>2]|0)+(4-1)&~(4-1);n=pe[i>>2]|0;pe[r>>2]=i+4;n=(n&65535)<<16>>16;i=e;pe[i>>2]=n;pe[i+4>>2]=((n|0)<0)<<31>>31;break e}case 14:{i=(pe[r>>2]|0)+(4-1)&~(4-1);n=pe[i>>2]|0;pe[r>>2]=i+4;i=e;pe[i>>2]=n&65535;pe[i+4>>2]=0;break e}case 15:{i=(pe[r>>2]|0)+(4-1)&~(4-1);n=pe[i>>2]|0;pe[r>>2]=i+4;n=(n&255)<<24>>24;i=e;pe[i>>2]=n;pe[i+4>>2]=((n|0)<0)<<31>>31;break e}case 16:{i=(pe[r>>2]|0)+(4-1)&~(4-1);n=pe[i>>2]|0;pe[r>>2]=i+4;i=e;pe[i>>2]=n&255;pe[i+4>>2]=0;break e}case 17:{i=(pe[r>>2]|0)+(8-1)&~(8-1);o=+ee[i>>3];pe[r>>2]=i+8;ee[e>>3]=o;break e}case 18:{i=(pe[r>>2]|0)+(8-1)&~(8-1);o=+ee[i>>3];pe[r>>2]=i+8;ee[e>>3]=o;break e}default:break e}}while(0)}while(0);return}function Fr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0;if(t>>>0>0|(t|0)==0&e>>>0>4294967295)while(1){n=sn(e|0,t|0,10,0)|0;r=r+-1|0;de[r>>0]=n|48;n=an(e|0,t|0,10,0)|0;if(t>>>0>9|(t|0)==9&e>>>0>4294967295){e=n;t=re}else{e=n;break}}if(e)while(1){r=r+-1|0;de[r>>0]=(e>>>0)%10|0|48;if(e>>>0<10)break;else e=(e>>>0)/10|0}return r|0}function Br(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0;s=ve;ve=ve+256|0;a=s;do{if((r|0)>(n|0)&(i&73728|0)==0){i=r-n|0;Vr(a|0,t|0,(i>>>0>256?256:i)|0)|0;t=pe[e>>2]|0;o=(t&32|0)==0;if(i>>>0>255){n=r-n|0;do{if(o){_r(a,256,e)|0;t=pe[e>>2]|0}i=i+-256|0;o=(t&32|0)==0}while(i>>>0>255);if(o)i=n&255;else break}else if(!o)break;_r(a,i,e)|0}}while(0);ve=s;return}function zr(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0;do{if(e>>>0<245){d=e>>>0<11?16:e+11&-8;e=d>>>3;s=pe[151]|0;r=s>>>e;if(r&3){e=(r&1^1)+e|0;n=e<<1;r=644+(n<<2)|0;n=644+(n+2<<2)|0;i=pe[n>>2]|0;o=i+8|0;a=pe[o>>2]|0;do{if((r|0)!=(a|0)){if(a>>>0<(pe[155]|0)>>>0)Xe();t=a+12|0;if((pe[t>>2]|0)==(i|0)){pe[t>>2]=r;pe[n>>2]=a;break}else Xe()}else pe[151]=s&~(1<>2]=j|3;j=i+(j|4)|0;pe[j>>2]=pe[j>>2]|1;j=o;return j|0}a=pe[153]|0;if(d>>>0>a>>>0){if(r){n=2<>>12&16;n=n>>>u;i=n>>>5&8;n=n>>>i;o=n>>>2&4;n=n>>>o;r=n>>>1&2;n=n>>>r;e=n>>>1&1;e=(i|u|o|r|e)+(n>>>e)|0;n=e<<1;r=644+(n<<2)|0;n=644+(n+2<<2)|0;o=pe[n>>2]|0;u=o+8|0;i=pe[u>>2]|0;do{if((r|0)!=(i|0)){if(i>>>0<(pe[155]|0)>>>0)Xe();t=i+12|0;if((pe[t>>2]|0)==(o|0)){pe[t>>2]=r;pe[n>>2]=i;l=pe[153]|0;break}else Xe()}else{pe[151]=s&~(1<>2]=d|3;s=o+d|0;pe[o+(d|4)>>2]=a|1;pe[o+j>>2]=a;if(l){i=pe[156]|0;r=l>>>3;t=r<<1;n=644+(t<<2)|0;e=pe[151]|0;r=1<>2]|0;if(t>>>0<(pe[155]|0)>>>0)Xe();else{c=e;f=t}}else{pe[151]=e|r;c=644+(t+2<<2)|0;f=n}pe[c>>2]=i;pe[f+12>>2]=i;pe[i+8>>2]=f;pe[i+12>>2]=n}pe[153]=a;pe[156]=s;j=u;return j|0}e=pe[152]|0;if(e){r=(e&0-e)+-1|0;N=r>>>12&16;r=r>>>N;L=r>>>5&8;r=r>>>L;j=r>>>2&4;r=r>>>j;e=r>>>1&2;r=r>>>e;n=r>>>1&1;n=pe[908+((L|N|j|e|n)+(r>>>n)<<2)>>2]|0;r=(pe[n+4>>2]&-8)-d|0;e=n;while(1){t=pe[e+16>>2]|0;if(!t){t=pe[e+20>>2]|0;if(!t){u=r;break}}e=(pe[t+4>>2]&-8)-d|0;j=e>>>0>>0;r=j?e:r;e=t;n=j?t:n}o=pe[155]|0;if(n>>>0>>0)Xe();s=n+d|0;if(n>>>0>=s>>>0)Xe();a=pe[n+24>>2]|0;r=pe[n+12>>2]|0;do{if((r|0)==(n|0)){e=n+20|0;t=pe[e>>2]|0;if(!t){e=n+16|0;t=pe[e>>2]|0;if(!t){h=0;break}}while(1){r=t+20|0;i=pe[r>>2]|0;if(i){t=i;e=r;continue}r=t+16|0;i=pe[r>>2]|0;if(!i)break;else{t=i;e=r}}if(e>>>0>>0)Xe();else{pe[e>>2]=0;h=t;break}}else{i=pe[n+8>>2]|0;if(i>>>0>>0)Xe();t=i+12|0;if((pe[t>>2]|0)!=(n|0))Xe();e=r+8|0;if((pe[e>>2]|0)==(n|0)){pe[t>>2]=r;pe[e>>2]=i;h=r;break}else Xe()}}while(0);do{if(a){t=pe[n+28>>2]|0;e=908+(t<<2)|0;if((n|0)==(pe[e>>2]|0)){pe[e>>2]=h;if(!h){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=a+16|0;if((pe[t>>2]|0)==(n|0))pe[t>>2]=h;else pe[a+20>>2]=h;if(!h)break}e=pe[155]|0;if(h>>>0>>0)Xe();pe[h+24>>2]=a;t=pe[n+16>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{pe[h+16>>2]=t;pe[t+24>>2]=h;break}}while(0);t=pe[n+20>>2]|0;if(t)if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[h+20>>2]=t;pe[t+24>>2]=h;break}}}while(0);if(u>>>0<16){j=u+d|0;pe[n+4>>2]=j|3;j=n+(j+4)|0;pe[j>>2]=pe[j>>2]|1}else{pe[n+4>>2]=d|3;pe[n+(d|4)>>2]=u|1;pe[n+(u+d)>>2]=u;t=pe[153]|0;if(t){o=pe[156]|0;r=t>>>3;t=r<<1;i=644+(t<<2)|0;e=pe[151]|0;r=1<>2]|0;if(e>>>0<(pe[155]|0)>>>0)Xe();else{p=t;g=e}}else{pe[151]=e|r;p=644+(t+2<<2)|0;g=i}pe[p>>2]=o;pe[g+12>>2]=o;pe[o+8>>2]=g;pe[o+12>>2]=i}pe[153]=u;pe[156]=s}j=n+8|0;return j|0}else g=d}else g=d}else if(e>>>0<=4294967231){e=e+11|0;f=e&-8;c=pe[152]|0;if(c){r=0-f|0;e=e>>>8;if(e)if(f>>>0>16777215)l=31;else{g=(e+1048320|0)>>>16&8;b=e<>>16&4;b=b<>>16&2;l=14-(p|g|l)+(b<>>15)|0;l=f>>>(l+7|0)&1|l<<1}else l=0;e=pe[908+(l<<2)>>2]|0;e:do{if(!e){i=0;e=0;b=86}else{a=r;i=0;s=f<<((l|0)==31?0:25-(l>>>1)|0);u=e;e=0;while(1){o=pe[u+4>>2]&-8;r=o-f|0;if(r>>>0>>0)if((o|0)==(f|0)){o=u;e=u;b=90;break e}else e=u;else r=a;b=pe[u+20>>2]|0;u=pe[u+16+(s>>>31<<2)>>2]|0;i=(b|0)==0|(b|0)==(u|0)?i:b;if(!u){b=86;break}else{a=r;s=s<<1}}}}while(0);if((b|0)==86){if((i|0)==0&(e|0)==0){e=2<>>12&16;e=e>>>h;c=e>>>5&8;e=e>>>c;p=e>>>2&4;e=e>>>p;g=e>>>1&2;e=e>>>g;i=e>>>1&1;i=pe[908+((c|h|p|g|i)+(e>>>i)<<2)>>2]|0;e=0}if(!i){s=r;u=e}else{o=i;b=90}}if((b|0)==90)while(1){b=0;g=(pe[o+4>>2]&-8)-f|0;i=g>>>0>>0;r=i?g:r;e=i?o:e;i=pe[o+16>>2]|0;if(i){o=i;b=90;continue}o=pe[o+20>>2]|0;if(!o){s=r;u=e;break}else b=90}if((u|0)!=0?s>>>0<((pe[153]|0)-f|0)>>>0:0){i=pe[155]|0;if(u>>>0>>0)Xe();a=u+f|0;if(u>>>0>=a>>>0)Xe();o=pe[u+24>>2]|0;r=pe[u+12>>2]|0;do{if((r|0)==(u|0)){e=u+20|0;t=pe[e>>2]|0;if(!t){e=u+16|0;t=pe[e>>2]|0;if(!t){d=0;break}}while(1){r=t+20|0;n=pe[r>>2]|0;if(n){t=n;e=r;continue}r=t+16|0;n=pe[r>>2]|0;if(!n)break;else{t=n;e=r}}if(e>>>0>>0)Xe();else{pe[e>>2]=0;d=t;break}}else{n=pe[u+8>>2]|0;if(n>>>0>>0)Xe();t=n+12|0;if((pe[t>>2]|0)!=(u|0))Xe();e=r+8|0;if((pe[e>>2]|0)==(u|0)){pe[t>>2]=r;pe[e>>2]=n;d=r;break}else Xe()}}while(0);do{if(o){t=pe[u+28>>2]|0;e=908+(t<<2)|0;if((u|0)==(pe[e>>2]|0)){pe[e>>2]=d;if(!d){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=o+16|0;if((pe[t>>2]|0)==(u|0))pe[t>>2]=d;else pe[o+20>>2]=d;if(!d)break}e=pe[155]|0;if(d>>>0>>0)Xe();pe[d+24>>2]=o;t=pe[u+16>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{pe[d+16>>2]=t;pe[t+24>>2]=d;break}}while(0);t=pe[u+20>>2]|0;if(t)if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[d+20>>2]=t;pe[t+24>>2]=d;break}}}while(0);e:do{if(s>>>0>=16){pe[u+4>>2]=f|3;pe[u+(f|4)>>2]=s|1;pe[u+(s+f)>>2]=s;t=s>>>3;if(s>>>0<256){e=t<<1;n=644+(e<<2)|0;r=pe[151]|0;t=1<>2]|0;if(e>>>0<(pe[155]|0)>>>0)Xe();else{v=t;_=e}}else{pe[151]=r|t;v=644+(e+2<<2)|0;_=n}pe[v>>2]=a;pe[_+12>>2]=a;pe[u+(f+8)>>2]=_;pe[u+(f+12)>>2]=n;break}t=s>>>8;if(t)if(s>>>0>16777215)n=31;else{N=(t+1048320|0)>>>16&8;j=t<>>16&4;j=j<>>16&2;n=14-(L|N|n)+(j<>>15)|0;n=s>>>(n+7|0)&1|n<<1}else n=0;t=908+(n<<2)|0;pe[u+(f+28)>>2]=n;pe[u+(f+20)>>2]=0;pe[u+(f+16)>>2]=0;e=pe[152]|0;r=1<>2]=a;pe[u+(f+24)>>2]=t;pe[u+(f+12)>>2]=a;pe[u+(f+8)>>2]=a;break}t=pe[t>>2]|0;t:do{if((pe[t+4>>2]&-8|0)!=(s|0)){n=s<<((n|0)==31?0:25-(n>>>1)|0);while(1){e=t+16+(n>>>31<<2)|0;r=pe[e>>2]|0;if(!r)break;if((pe[r+4>>2]&-8|0)==(s|0)){T=r;break t}else{n=n<<1;t=r}}if(e>>>0<(pe[155]|0)>>>0)Xe();else{pe[e>>2]=a;pe[u+(f+24)>>2]=t;pe[u+(f+12)>>2]=a;pe[u+(f+8)>>2]=a;break e}}else T=t}while(0);t=T+8|0;e=pe[t>>2]|0;j=pe[155]|0;if(e>>>0>=j>>>0&T>>>0>=j>>>0){pe[e+12>>2]=a;pe[t>>2]=a;pe[u+(f+8)>>2]=e;pe[u+(f+12)>>2]=T;pe[u+(f+24)>>2]=0;break}else Xe()}else{j=s+f|0;pe[u+4>>2]=j|3;j=u+(j+4)|0;pe[j>>2]=pe[j>>2]|1}}while(0);j=u+8|0;return j|0}else g=f}else g=f}else g=-1}while(0);r=pe[153]|0;if(r>>>0>=g>>>0){t=r-g|0;e=pe[156]|0;if(t>>>0>15){pe[156]=e+g;pe[153]=t;pe[e+(g+4)>>2]=t|1;pe[e+r>>2]=t;pe[e+4>>2]=g|3}else{pe[153]=0;pe[156]=0;pe[e+4>>2]=r|3;j=e+(r+4)|0;pe[j>>2]=pe[j>>2]|1}j=e+8|0;return j|0}e=pe[154]|0;if(e>>>0>g>>>0){N=e-g|0;pe[154]=N;j=pe[157]|0;pe[157]=j+g;pe[j+(g+4)>>2]=N|1;pe[j+4>>2]=g|3;j=j+8|0;return j|0}do{if(!(pe[269]|0)){e=Ie(30)|0;if(!(e+-1&e)){pe[271]=e;pe[270]=e;pe[272]=-1;pe[273]=-1;pe[274]=0;pe[262]=0;T=(He(0)|0)&-16^1431655768;pe[269]=T;break}else Xe()}}while(0);u=g+48|0;s=pe[271]|0;l=g+47|0;a=s+l|0;s=0-s|0;c=a&s;if(c>>>0<=g>>>0){j=0;return j|0}e=pe[261]|0;if((e|0)!=0?(_=pe[259]|0,T=_+c|0,T>>>0<=_>>>0|T>>>0>e>>>0):0){j=0;return j|0}e:do{if(!(pe[262]&4)){e=pe[157]|0;t:do{if(e){i=1052;while(1){r=pe[i>>2]|0;if(r>>>0<=e>>>0?(m=i+4|0,(r+(pe[m>>2]|0)|0)>>>0>e>>>0):0){o=i;e=m;break}i=pe[i+8>>2]|0;if(!i){b=174;break t}}r=a-(pe[154]|0)&s;if(r>>>0<2147483647){i=Ae(r|0)|0;T=(i|0)==((pe[o>>2]|0)+(pe[e>>2]|0)|0);e=T?r:0;if(T){if((i|0)!=(-1|0)){x=i;p=e;b=194;break e}}else b=184}else e=0}else b=174}while(0);do{if((b|0)==174){o=Ae(0)|0;if((o|0)!=(-1|0)){e=o;r=pe[270]|0;i=r+-1|0;if(!(i&e))r=c;else r=c-e+(i+e&0-r)|0;e=pe[259]|0;i=e+r|0;if(r>>>0>g>>>0&r>>>0<2147483647){T=pe[261]|0;if((T|0)!=0?i>>>0<=e>>>0|i>>>0>T>>>0:0){e=0;break}i=Ae(r|0)|0;T=(i|0)==(o|0);e=T?r:0;if(T){x=o;p=e;b=194;break e}else b=184}else e=0}else e=0}}while(0);t:do{if((b|0)==184){o=0-r|0;do{if(u>>>0>r>>>0&(r>>>0<2147483647&(i|0)!=(-1|0))?(y=pe[271]|0,y=l-r+y&0-y,y>>>0<2147483647):0)if((Ae(y|0)|0)==(-1|0)){Ae(o|0)|0;break t}else{r=y+r|0;break}}while(0);if((i|0)!=(-1|0)){x=i;p=r;b=194;break e}}}while(0);pe[262]=pe[262]|4;b=191}else{e=0;b=191}}while(0);if((((b|0)==191?c>>>0<2147483647:0)?(x=Ae(c|0)|0,w=Ae(0)|0,x>>>0>>0&((x|0)!=(-1|0)&(w|0)!=(-1|0))):0)?(S=w-x|0,M=S>>>0>(g+40|0)>>>0,M):0){p=M?S:e;b=194}if((b|0)==194){e=(pe[259]|0)+p|0;pe[259]=e;if(e>>>0>(pe[260]|0)>>>0)pe[260]=e;a=pe[157]|0;e:do{if(a){o=1052;do{e=pe[o>>2]|0;r=o+4|0;i=pe[r>>2]|0;if((x|0)==(e+i|0)){P=e;C=r;k=i;E=o;b=204;break}o=pe[o+8>>2]|0}while((o|0)!=0);if(((b|0)==204?(pe[E+12>>2]&8|0)==0:0)?a>>>0>>0&a>>>0>=P>>>0:0){pe[C>>2]=k+p;j=(pe[154]|0)+p|0;N=a+8|0;N=(N&7|0)==0?0:0-N&7;L=j-N|0;pe[157]=a+N;pe[154]=L;pe[a+(N+4)>>2]=L|1;pe[a+(j+4)>>2]=40;pe[158]=pe[273];break}e=pe[155]|0;if(x>>>0>>0){pe[155]=x;e=x}r=x+p|0;o=1052;while(1){if((pe[o>>2]|0)==(r|0)){i=o;r=o;b=212;break}o=pe[o+8>>2]|0;if(!o){r=1052;break}}if((b|0)==212)if(!(pe[r+12>>2]&8)){pe[i>>2]=x;h=r+4|0;pe[h>>2]=(pe[h>>2]|0)+p;h=x+8|0;h=(h&7|0)==0?0:0-h&7;l=x+(p+8)|0;l=(l&7|0)==0?0:0-l&7;t=x+(l+p)|0;f=h+g|0;d=x+f|0;c=t-(x+h)-g|0;pe[x+(h+4)>>2]=g|3;t:do{if((t|0)!=(a|0)){if((t|0)==(pe[156]|0)){j=(pe[153]|0)+c|0;pe[153]=j;pe[156]=d;pe[x+(f+4)>>2]=j|1;pe[x+(j+f)>>2]=j;break}s=p+4|0;r=pe[x+(s+l)>>2]|0;if((r&3|0)==1){u=r&-8;o=r>>>3;r:do{if(r>>>0>=256){a=pe[x+((l|24)+p)>>2]|0;n=pe[x+(p+12+l)>>2]|0;do{if((n|0)==(t|0)){i=l|16;n=x+(s+i)|0;r=pe[n>>2]|0;if(!r){n=x+(i+p)|0;r=pe[n>>2]|0;if(!r){D=0;break}}while(1){i=r+20|0;o=pe[i>>2]|0;if(o){r=o;n=i;continue}i=r+16|0;o=pe[i>>2]|0;if(!o)break;else{r=o;n=i}}if(n>>>0>>0)Xe();else{pe[n>>2]=0;D=r;break}}else{i=pe[x+((l|8)+p)>>2]|0;if(i>>>0>>0)Xe();e=i+12|0;if((pe[e>>2]|0)!=(t|0))Xe();r=n+8|0;if((pe[r>>2]|0)==(t|0)){pe[e>>2]=n;pe[r>>2]=i;D=n;break}else Xe()}}while(0);if(!a)break;e=pe[x+(p+28+l)>>2]|0;r=908+(e<<2)|0;do{if((t|0)!=(pe[r>>2]|0)){if(a>>>0<(pe[155]|0)>>>0)Xe();e=a+16|0;if((pe[e>>2]|0)==(t|0))pe[e>>2]=D;else pe[a+20>>2]=D;if(!D)break r}else{pe[r>>2]=D;if(D)break;pe[152]=pe[152]&~(1<>>0>>0)Xe();pe[D+24>>2]=a;t=l|16;e=pe[x+(t+p)>>2]|0;do{if(e)if(e>>>0>>0)Xe();else{pe[D+16>>2]=e;pe[e+24>>2]=D;break}}while(0);t=pe[x+(s+t)>>2]|0;if(!t)break;if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[D+20>>2]=t;pe[t+24>>2]=D;break}}else{n=pe[x+((l|8)+p)>>2]|0;i=pe[x+(p+12+l)>>2]|0;r=644+(o<<1<<2)|0;do{if((n|0)!=(r|0)){if(n>>>0>>0)Xe();if((pe[n+12>>2]|0)==(t|0))break;Xe()}}while(0);if((i|0)==(n|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();e=i+8|0;if((pe[e>>2]|0)==(t|0)){A=e;break}Xe()}}while(0);pe[n+12>>2]=i;pe[A>>2]=n}}while(0);t=x+((u|l)+p)|0;i=u+c|0}else i=c;t=t+4|0;pe[t>>2]=pe[t>>2]&-2;pe[x+(f+4)>>2]=i|1;pe[x+(i+f)>>2]=i;t=i>>>3;if(i>>>0<256){e=t<<1;n=644+(e<<2)|0;r=pe[151]|0;t=1<>2]|0;if(e>>>0>=(pe[155]|0)>>>0){L=t;N=e;break}Xe()}}while(0);pe[L>>2]=d;pe[N+12>>2]=d;pe[x+(f+8)>>2]=N;pe[x+(f+12)>>2]=n;break}t=i>>>8;do{if(!t)n=0;else{if(i>>>0>16777215){n=31;break}L=(t+1048320|0)>>>16&8;N=t<>>16&4;N=N<>>16&2;n=14-(D|L|n)+(N<>>15)|0;n=i>>>(n+7|0)&1|n<<1}}while(0);t=908+(n<<2)|0;pe[x+(f+28)>>2]=n;pe[x+(f+20)>>2]=0;pe[x+(f+16)>>2]=0;e=pe[152]|0;r=1<>2]=d;pe[x+(f+24)>>2]=t;pe[x+(f+12)>>2]=d;pe[x+(f+8)>>2]=d;break}t=pe[t>>2]|0;r:do{if((pe[t+4>>2]&-8|0)!=(i|0)){n=i<<((n|0)==31?0:25-(n>>>1)|0);while(1){e=t+16+(n>>>31<<2)|0;r=pe[e>>2]|0;if(!r)break;if((pe[r+4>>2]&-8|0)==(i|0)){j=r;break r}else{n=n<<1;t=r}}if(e>>>0<(pe[155]|0)>>>0)Xe();else{pe[e>>2]=d;pe[x+(f+24)>>2]=t;pe[x+(f+12)>>2]=d;pe[x+(f+8)>>2]=d;break t}}else j=t}while(0);t=j+8|0;e=pe[t>>2]|0;N=pe[155]|0;if(e>>>0>=N>>>0&j>>>0>=N>>>0){pe[e+12>>2]=d;pe[t>>2]=d;pe[x+(f+8)>>2]=e;pe[x+(f+12)>>2]=j;pe[x+(f+24)>>2]=0;break}else Xe()}else{j=(pe[154]|0)+c|0;pe[154]=j;pe[157]=d;pe[x+(f+4)>>2]=j|1}}while(0);j=x+(h|8)|0;return j|0}else r=1052;while(1){e=pe[r>>2]|0;if(e>>>0<=a>>>0?(t=pe[r+4>>2]|0,n=e+t|0,n>>>0>a>>>0):0)break;r=pe[r+8>>2]|0}i=e+(t+-39)|0;e=e+(t+-47+((i&7|0)==0?0:0-i&7))|0;i=a+16|0;e=e>>>0>>0?a:e;t=e+8|0;r=x+8|0;r=(r&7|0)==0?0:0-r&7;j=p+-40-r|0;pe[157]=x+r;pe[154]=j;pe[x+(r+4)>>2]=j|1;pe[x+(p+-36)>>2]=40;pe[158]=pe[273];r=e+4|0;pe[r>>2]=27;pe[t>>2]=pe[263];pe[t+4>>2]=pe[264];pe[t+8>>2]=pe[265];pe[t+12>>2]=pe[266];pe[263]=x;pe[264]=p;pe[266]=0;pe[265]=t;t=e+28|0;pe[t>>2]=7;if((e+32|0)>>>0>>0)do{j=t;t=t+4|0;pe[t>>2]=7}while((j+8|0)>>>0>>0);if((e|0)!=(a|0)){o=e-a|0;pe[r>>2]=pe[r>>2]&-2;pe[a+4>>2]=o|1;pe[e>>2]=o;t=o>>>3;if(o>>>0<256){e=t<<1;n=644+(e<<2)|0;r=pe[151]|0;t=1<>2]|0;if(e>>>0<(pe[155]|0)>>>0)Xe();else{O=t;R=e}}else{pe[151]=r|t;O=644+(e+2<<2)|0;R=n}pe[O>>2]=a;pe[R+12>>2]=a;pe[a+8>>2]=R;pe[a+12>>2]=n;break}t=o>>>8;if(t)if(o>>>0>16777215)n=31;else{N=(t+1048320|0)>>>16&8;j=t<>>16&4;j=j<>>16&2;n=14-(L|N|n)+(j<>>15)|0;n=o>>>(n+7|0)&1|n<<1}else n=0;r=908+(n<<2)|0;pe[a+28>>2]=n;pe[a+20>>2]=0;pe[i>>2]=0;t=pe[152]|0;e=1<>2]=a;pe[a+24>>2]=r;pe[a+12>>2]=a;pe[a+8>>2]=a;break}t=pe[r>>2]|0;t:do{if((pe[t+4>>2]&-8|0)!=(o|0)){n=o<<((n|0)==31?0:25-(n>>>1)|0);while(1){e=t+16+(n>>>31<<2)|0;r=pe[e>>2]|0;if(!r)break;if((pe[r+4>>2]&-8|0)==(o|0)){I=r;break t}else{n=n<<1;t=r}}if(e>>>0<(pe[155]|0)>>>0)Xe();else{pe[e>>2]=a;pe[a+24>>2]=t;pe[a+12>>2]=a;pe[a+8>>2]=a;break e}}else I=t}while(0);t=I+8|0;e=pe[t>>2]|0;j=pe[155]|0;if(e>>>0>=j>>>0&I>>>0>=j>>>0){pe[e+12>>2]=a;pe[t>>2]=a;pe[a+8>>2]=e;pe[a+12>>2]=I;pe[a+24>>2]=0;break}else Xe()}}else{j=pe[155]|0;if((j|0)==0|x>>>0>>0)pe[155]=x;pe[263]=x;pe[264]=p;pe[266]=0;pe[160]=pe[269];pe[159]=-1;t=0;do{j=t<<1;N=644+(j<<2)|0;pe[644+(j+3<<2)>>2]=N;pe[644+(j+2<<2)>>2]=N;t=t+1|0}while((t|0)!=32);j=x+8|0;j=(j&7|0)==0?0:0-j&7;N=p+-40-j|0;pe[157]=x+j;pe[154]=N;pe[x+(j+4)>>2]=N|1;pe[x+(p+-36)>>2]=40;pe[158]=pe[273]}}while(0);t=pe[154]|0;if(t>>>0>g>>>0){N=t-g|0;pe[154]=N;j=pe[157]|0;pe[157]=j+g;pe[j+(g+4)>>2]=N|1;pe[j+4>>2]=g|3;j=j+8|0;return j|0}}j=cr()|0;pe[j>>2]=12;j=0;return j|0}function Ur(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0;if(!e)return;t=e+-8|0;s=pe[155]|0;if(t>>>0>>0)Xe();r=pe[e+-4>>2]|0;n=r&3;if((n|0)==1)Xe();d=r&-8;g=e+(d+-8)|0;do{if(!(r&1)){t=pe[t>>2]|0;if(!n)return;u=-8-t|0;c=e+u|0;f=t+d|0;if(c>>>0>>0)Xe();if((c|0)==(pe[156]|0)){t=e+(d+-4)|0;r=pe[t>>2]|0;if((r&3|0)!=3){y=c;o=f;break}pe[153]=f;pe[t>>2]=r&-2;pe[e+(u+4)>>2]=f|1;pe[g>>2]=f;return}i=t>>>3;if(t>>>0<256){n=pe[e+(u+8)>>2]|0;r=pe[e+(u+12)>>2]|0;t=644+(i<<1<<2)|0;if((n|0)!=(t|0)){if(n>>>0>>0)Xe();if((pe[n+12>>2]|0)!=(c|0))Xe()}if((r|0)==(n|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();t=r+8|0;if((pe[t>>2]|0)==(c|0))a=t;else Xe()}else a=r+8|0;pe[n+12>>2]=r;pe[a>>2]=n;y=c;o=f;break}a=pe[e+(u+24)>>2]|0;n=pe[e+(u+12)>>2]|0;do{if((n|0)==(c|0)){r=e+(u+20)|0;t=pe[r>>2]|0;if(!t){r=e+(u+16)|0;t=pe[r>>2]|0;if(!t){l=0;break}}while(1){n=t+20|0;i=pe[n>>2]|0;if(i){t=i;r=n;continue}n=t+16|0;i=pe[n>>2]|0;if(!i)break;else{t=i;r=n}}if(r>>>0>>0)Xe();else{pe[r>>2]=0;l=t;break}}else{i=pe[e+(u+8)>>2]|0;if(i>>>0>>0)Xe();t=i+12|0;if((pe[t>>2]|0)!=(c|0))Xe();r=n+8|0;if((pe[r>>2]|0)==(c|0)){pe[t>>2]=n;pe[r>>2]=i;l=n;break}else Xe()}}while(0);if(a){t=pe[e+(u+28)>>2]|0;r=908+(t<<2)|0;if((c|0)==(pe[r>>2]|0)){pe[r>>2]=l;if(!l){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=a+16|0;if((pe[t>>2]|0)==(c|0))pe[t>>2]=l;else pe[a+20>>2]=l;if(!l){y=c;o=f;break}}r=pe[155]|0;if(l>>>0>>0)Xe();pe[l+24>>2]=a;t=pe[e+(u+16)>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{pe[l+16>>2]=t;pe[t+24>>2]=l;break}}while(0);t=pe[e+(u+20)>>2]|0;if(t)if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[l+20>>2]=t;pe[t+24>>2]=l;y=c;o=f;break}else{y=c;o=f}}else{y=c;o=f}}else{y=t;o=d}}while(0);if(y>>>0>=g>>>0)Xe();t=e+(d+-4)|0;r=pe[t>>2]|0;if(!(r&1))Xe();if(!(r&2)){if((g|0)==(pe[157]|0)){_=(pe[154]|0)+o|0;pe[154]=_;pe[157]=y;pe[y+4>>2]=_|1;if((y|0)!=(pe[156]|0))return;pe[156]=0;pe[153]=0;return}if((g|0)==(pe[156]|0)){_=(pe[153]|0)+o|0;pe[153]=_;pe[156]=y;pe[y+4>>2]=_|1;pe[y+_>>2]=_;return}o=(r&-8)+o|0;i=r>>>3;do{if(r>>>0>=256){a=pe[e+(d+16)>>2]|0;t=pe[e+(d|4)>>2]|0;do{if((t|0)==(g|0)){r=e+(d+12)|0;t=pe[r>>2]|0;if(!t){r=e+(d+8)|0;t=pe[r>>2]|0;if(!t){p=0;break}}while(1){n=t+20|0;i=pe[n>>2]|0;if(i){t=i;r=n;continue}n=t+16|0;i=pe[n>>2]|0;if(!i)break;else{t=i;r=n}}if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[r>>2]=0;p=t;break}}else{r=pe[e+d>>2]|0;if(r>>>0<(pe[155]|0)>>>0)Xe();n=r+12|0;if((pe[n>>2]|0)!=(g|0))Xe();i=t+8|0;if((pe[i>>2]|0)==(g|0)){pe[n>>2]=t;pe[i>>2]=r;p=t;break}else Xe()}}while(0);if(a){t=pe[e+(d+20)>>2]|0;r=908+(t<<2)|0;if((g|0)==(pe[r>>2]|0)){pe[r>>2]=p;if(!p){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=a+16|0;if((pe[t>>2]|0)==(g|0))pe[t>>2]=p;else pe[a+20>>2]=p;if(!p)break}r=pe[155]|0;if(p>>>0>>0)Xe();pe[p+24>>2]=a;t=pe[e+(d+8)>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{pe[p+16>>2]=t;pe[t+24>>2]=p;break}}while(0);t=pe[e+(d+12)>>2]|0;if(t)if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[p+20>>2]=t;pe[t+24>>2]=p;break}}}else{n=pe[e+d>>2]|0;r=pe[e+(d|4)>>2]|0;t=644+(i<<1<<2)|0;if((n|0)!=(t|0)){if(n>>>0<(pe[155]|0)>>>0)Xe();if((pe[n+12>>2]|0)!=(g|0))Xe()}if((r|0)==(n|0)){pe[151]=pe[151]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=r+8|0;if((pe[t>>2]|0)==(g|0))h=t;else Xe()}else h=r+8|0;pe[n+12>>2]=r;pe[h>>2]=n}}while(0);pe[y+4>>2]=o|1;pe[y+o>>2]=o;if((y|0)==(pe[156]|0)){pe[153]=o;return}}else{pe[t>>2]=r&-2;pe[y+4>>2]=o|1;pe[y+o>>2]=o}t=o>>>3;if(o>>>0<256){r=t<<1;i=644+(r<<2)|0;n=pe[151]|0;t=1<>2]|0;if(r>>>0<(pe[155]|0)>>>0)Xe();else{m=t;v=r}}else{pe[151]=n|t;m=644+(r+2<<2)|0;v=i}pe[m>>2]=y;pe[v+12>>2]=y;pe[y+8>>2]=v;pe[y+12>>2]=i;return}t=o>>>8;if(t)if(o>>>0>16777215)i=31;else{m=(t+1048320|0)>>>16&8;v=t<>>16&4;v=v<>>16&2;i=14-(g|m|i)+(v<>>15)|0;i=o>>>(i+7|0)&1|i<<1}else i=0;t=908+(i<<2)|0;pe[y+28>>2]=i;pe[y+20>>2]=0;pe[y+16>>2]=0;r=pe[152]|0;n=1<>2]|0;t:do{if((pe[t+4>>2]&-8|0)!=(o|0)){i=o<<((i|0)==31?0:25-(i>>>1)|0);while(1){r=t+16+(i>>>31<<2)|0;n=pe[r>>2]|0;if(!n)break;if((pe[n+4>>2]&-8|0)==(o|0)){_=n;break t}else{i=i<<1;t=n}}if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[r>>2]=y;pe[y+24>>2]=t;pe[y+12>>2]=y;pe[y+8>>2]=y;break e}}else _=t}while(0);t=_+8|0;r=pe[t>>2]|0;v=pe[155]|0;if(r>>>0>=v>>>0&_>>>0>=v>>>0){pe[r+12>>2]=y;pe[t>>2]=y;pe[y+8>>2]=r;pe[y+12>>2]=_;pe[y+24>>2]=0;break}else Xe()}else{pe[152]=r|n;pe[t>>2]=y;pe[y+24>>2]=t;pe[y+12>>2]=y;pe[y+8>>2]=y}}while(0);y=(pe[159]|0)+-1|0;pe[159]=y;if(!y)t=1060;else return;while(1){t=pe[t>>2]|0;if(!t)break;else t=t+8|0}pe[159]=-1;return}function Xr(e,t){e=e|0;t=t|0;var r=0,n=0;if(!e){e=zr(t)|0;return e|0}if(t>>>0>4294967231){e=cr()|0;pe[e>>2]=12;e=0;return e|0}r=Hr(e+-8|0,t>>>0<11?16:t+11&-8)|0;if(r){e=r+8|0;return e|0}r=zr(t)|0;if(!r){e=0;return e|0}n=pe[e+-4>>2]|0;n=(n&-8)-((n&3|0)==0?8:4)|0;$r(r|0,e|0,(n>>>0>>0?n:t)|0)|0;Ur(e);e=r;return e|0}function qr(e){e=e|0;var t=0;if(!e){t=0;return t|0}e=pe[e+-4>>2]|0;t=e&3;if((t|0)==1){t=0;return t|0}t=(e&-8)-((t|0)==0?8:4)|0;return t|0}function Hr(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;d=e+4|0;p=pe[d>>2]|0;u=p&-8;c=e+u|0;s=pe[155]|0;r=p&3;if(!((r|0)!=1&e>>>0>=s>>>0&e>>>0>>0))Xe();n=e+(u|4)|0;i=pe[n>>2]|0;if(!(i&1))Xe();if(!r){if(t>>>0<256){e=0;return e|0}if(u>>>0>=(t+4|0)>>>0?(u-t|0)>>>0<=pe[271]<<1>>>0:0)return e|0;e=0;return e|0}if(u>>>0>=t>>>0){r=u-t|0;if(r>>>0<=15)return e|0;pe[d>>2]=p&1|t|2;pe[e+(t+4)>>2]=r|3;pe[n>>2]=pe[n>>2]|1;Yr(e+t|0,r);return e|0}if((c|0)==(pe[157]|0)){r=(pe[154]|0)+u|0;if(r>>>0<=t>>>0){e=0;return e|0}h=r-t|0;pe[d>>2]=p&1|t|2;pe[e+(t+4)>>2]=h|1;pe[157]=e+t;pe[154]=h;return e|0}if((c|0)==(pe[156]|0)){n=(pe[153]|0)+u|0;if(n>>>0>>0){e=0;return e|0}r=n-t|0;if(r>>>0>15){pe[d>>2]=p&1|t|2;pe[e+(t+4)>>2]=r|1;pe[e+n>>2]=r;n=e+(n+4)|0;pe[n>>2]=pe[n>>2]&-2;n=e+t|0}else{pe[d>>2]=p&1|n|2;n=e+(n+4)|0;pe[n>>2]=pe[n>>2]|1;n=0;r=0}pe[153]=r;pe[156]=n;return e|0}if(i&2){e=0;return e|0}f=(i&-8)+u|0;if(f>>>0>>0){e=0;return e|0}h=f-t|0;o=i>>>3;do{if(i>>>0>=256){a=pe[e+(u+24)>>2]|0;o=pe[e+(u+12)>>2]|0;do{if((o|0)==(c|0)){n=e+(u+20)|0;r=pe[n>>2]|0;if(!r){n=e+(u+16)|0;r=pe[n>>2]|0;if(!r){l=0;break}}while(1){i=r+20|0;o=pe[i>>2]|0;if(o){r=o;n=i;continue}i=r+16|0;o=pe[i>>2]|0;if(!o)break;else{r=o;n=i}}if(n>>>0>>0)Xe();else{pe[n>>2]=0;l=r;break}}else{i=pe[e+(u+8)>>2]|0;if(i>>>0>>0)Xe();r=i+12|0;if((pe[r>>2]|0)!=(c|0))Xe();n=o+8|0;if((pe[n>>2]|0)==(c|0)){pe[r>>2]=o;pe[n>>2]=i;l=o;break}else Xe()}}while(0);if(a){r=pe[e+(u+28)>>2]|0;n=908+(r<<2)|0;if((c|0)==(pe[n>>2]|0)){pe[n>>2]=l;if(!l){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();r=a+16|0;if((pe[r>>2]|0)==(c|0))pe[r>>2]=l;else pe[a+20>>2]=l;if(!l)break}n=pe[155]|0;if(l>>>0>>0)Xe();pe[l+24>>2]=a;r=pe[e+(u+16)>>2]|0;do{if(r)if(r>>>0>>0)Xe();else{pe[l+16>>2]=r;pe[r+24>>2]=l;break}}while(0);r=pe[e+(u+20)>>2]|0;if(r)if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[l+20>>2]=r;pe[r+24>>2]=l;break}}}else{i=pe[e+(u+8)>>2]|0;n=pe[e+(u+12)>>2]|0;r=644+(o<<1<<2)|0;if((i|0)!=(r|0)){if(i>>>0>>0)Xe();if((pe[i+12>>2]|0)!=(c|0))Xe()}if((n|0)==(i|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();r=n+8|0;if((pe[r>>2]|0)==(c|0))a=r;else Xe()}else a=n+8|0;pe[i+12>>2]=n;pe[a>>2]=i}}while(0);if(h>>>0<16){pe[d>>2]=f|p&1|2;t=e+(f|4)|0;pe[t>>2]=pe[t>>2]|1;return e|0}else{pe[d>>2]=p&1|t|2;pe[e+(t+4)>>2]=h|3;p=e+(f|4)|0;pe[p>>2]=pe[p>>2]|1;Yr(e+t|0,h);return e|0}return 0}function Yr(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0;g=e+t|0;r=pe[e+4>>2]|0;do{if(!(r&1)){l=pe[e>>2]|0;if(!(r&3))return;h=e+(0-l)|0;f=l+t|0;u=pe[155]|0;if(h>>>0>>0)Xe();if((h|0)==(pe[156]|0)){n=e+(t+4)|0;r=pe[n>>2]|0;if((r&3|0)!=3){_=h;a=f;break}pe[153]=f;pe[n>>2]=r&-2;pe[e+(4-l)>>2]=f|1;pe[g>>2]=f;return}o=l>>>3;if(l>>>0<256){i=pe[e+(8-l)>>2]|0;n=pe[e+(12-l)>>2]|0;r=644+(o<<1<<2)|0;if((i|0)!=(r|0)){if(i>>>0>>0)Xe();if((pe[i+12>>2]|0)!=(h|0))Xe()}if((n|0)==(i|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();r=n+8|0;if((pe[r>>2]|0)==(h|0))s=r;else Xe()}else s=n+8|0;pe[i+12>>2]=n;pe[s>>2]=i;_=h;a=f;break}s=pe[e+(24-l)>>2]|0;i=pe[e+(12-l)>>2]|0;do{if((i|0)==(h|0)){i=16-l|0;n=e+(i+4)|0;r=pe[n>>2]|0;if(!r){n=e+i|0;r=pe[n>>2]|0;if(!r){c=0;break}}while(1){i=r+20|0;o=pe[i>>2]|0;if(o){r=o;n=i;continue}i=r+16|0;o=pe[i>>2]|0;if(!o)break;else{r=o;n=i}}if(n>>>0>>0)Xe();else{pe[n>>2]=0;c=r;break}}else{o=pe[e+(8-l)>>2]|0;if(o>>>0>>0)Xe();r=o+12|0;if((pe[r>>2]|0)!=(h|0))Xe();n=i+8|0;if((pe[n>>2]|0)==(h|0)){pe[r>>2]=i;pe[n>>2]=o;c=i;break}else Xe()}}while(0);if(s){r=pe[e+(28-l)>>2]|0;n=908+(r<<2)|0;if((h|0)==(pe[n>>2]|0)){pe[n>>2]=c;if(!c){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();r=s+16|0;if((pe[r>>2]|0)==(h|0))pe[r>>2]=c;else pe[s+20>>2]=c;if(!c){_=h;a=f;break}}i=pe[155]|0;if(c>>>0>>0)Xe();pe[c+24>>2]=s;r=16-l|0;n=pe[e+r>>2]|0;do{if(n)if(n>>>0>>0)Xe();else{pe[c+16>>2]=n;pe[n+24>>2]=c;break}}while(0);r=pe[e+(r+4)>>2]|0;if(r)if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[c+20>>2]=r;pe[r+24>>2]=c;_=h;a=f;break}else{_=h;a=f}}else{_=h;a=f}}else{_=e;a=t}}while(0);u=pe[155]|0;if(g>>>0>>0)Xe();r=e+(t+4)|0;n=pe[r>>2]|0;if(!(n&2)){if((g|0)==(pe[157]|0)){v=(pe[154]|0)+a|0;pe[154]=v;pe[157]=_;pe[_+4>>2]=v|1;if((_|0)!=(pe[156]|0))return;pe[156]=0;pe[153]=0;return}if((g|0)==(pe[156]|0)){v=(pe[153]|0)+a|0;pe[153]=v;pe[156]=_;pe[_+4>>2]=v|1;pe[_+v>>2]=v;return}a=(n&-8)+a|0;o=n>>>3;do{if(n>>>0>=256){s=pe[e+(t+24)>>2]|0;i=pe[e+(t+12)>>2]|0;do{if((i|0)==(g|0)){n=e+(t+20)|0;r=pe[n>>2]|0;if(!r){n=e+(t+16)|0;r=pe[n>>2]|0;if(!r){p=0;break}}while(1){i=r+20|0;o=pe[i>>2]|0;if(o){r=o;n=i;continue}i=r+16|0;o=pe[i>>2]|0;if(!o)break;else{r=o;n=i}}if(n>>>0>>0)Xe();else{pe[n>>2]=0;p=r;break}}else{o=pe[e+(t+8)>>2]|0;if(o>>>0>>0)Xe();r=o+12|0;if((pe[r>>2]|0)!=(g|0))Xe();n=i+8|0;if((pe[n>>2]|0)==(g|0)){pe[r>>2]=i;pe[n>>2]=o;p=i;break}else Xe()}}while(0);if(s){r=pe[e+(t+28)>>2]|0;n=908+(r<<2)|0;if((g|0)==(pe[n>>2]|0)){pe[n>>2]=p;if(!p){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();r=s+16|0;if((pe[r>>2]|0)==(g|0))pe[r>>2]=p;else pe[s+20>>2]=p;if(!p)break}n=pe[155]|0;if(p>>>0>>0)Xe();pe[p+24>>2]=s;r=pe[e+(t+16)>>2]|0;do{if(r)if(r>>>0>>0)Xe();else{pe[p+16>>2]=r;pe[r+24>>2]=p;break}}while(0);r=pe[e+(t+20)>>2]|0;if(r)if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[p+20>>2]=r;pe[r+24>>2]=p;break}}}else{i=pe[e+(t+8)>>2]|0;n=pe[e+(t+12)>>2]|0;r=644+(o<<1<<2)|0;if((i|0)!=(r|0)){if(i>>>0>>0)Xe();if((pe[i+12>>2]|0)!=(g|0))Xe()}if((n|0)==(i|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();r=n+8|0;if((pe[r>>2]|0)==(g|0))d=r;else Xe()}else d=n+8|0;pe[i+12>>2]=n;pe[d>>2]=i}}while(0);pe[_+4>>2]=a|1;pe[_+a>>2]=a;if((_|0)==(pe[156]|0)){pe[153]=a;return}}else{pe[r>>2]=n&-2;pe[_+4>>2]=a|1;pe[_+a>>2]=a}r=a>>>3;if(a>>>0<256){n=r<<1;o=644+(n<<2)|0;i=pe[151]|0;r=1<>2]|0;if(n>>>0<(pe[155]|0)>>>0)Xe();else{m=r;v=n}}else{pe[151]=i|r;m=644+(n+2<<2)|0;v=o}pe[m>>2]=_;pe[v+12>>2]=_;pe[_+8>>2]=v;pe[_+12>>2]=o;return}r=a>>>8;if(r)if(a>>>0>16777215)o=31;else{m=(r+1048320|0)>>>16&8;v=r<>>16&4;v=v<>>16&2;o=14-(g|m|o)+(v<>>15)|0;o=a>>>(o+7|0)&1|o<<1}else o=0;r=908+(o<<2)|0;pe[_+28>>2]=o;pe[_+20>>2]=0;pe[_+16>>2]=0;n=pe[152]|0;i=1<>2]=_;pe[_+24>>2]=r;pe[_+12>>2]=_;pe[_+8>>2]=_;return}r=pe[r>>2]|0;e:do{if((pe[r+4>>2]&-8|0)!=(a|0)){o=a<<((o|0)==31?0:25-(o>>>1)|0);while(1){n=r+16+(o>>>31<<2)|0;i=pe[n>>2]|0;if(!i)break;if((pe[i+4>>2]&-8|0)==(a|0)){r=i;break e}else{o=o<<1;r=i}}if(n>>>0<(pe[155]|0)>>>0)Xe();pe[n>>2]=_;pe[_+24>>2]=r;pe[_+12>>2]=_;pe[_+8>>2]=_;return}}while(0);n=r+8|0;i=pe[n>>2]|0;v=pe[155]|0;if(!(i>>>0>=v>>>0&r>>>0>=v>>>0))Xe();pe[i+12>>2]=_;pe[n>>2]=_;pe[_+8>>2]=i;pe[_+12>>2]=r;pe[_+24>>2]=0;return}function Gr(){}function Wr(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;n=t-n-(r>>>0>e>>>0|0)>>>0;return(re=n,e-r>>>0|0)|0}function Vr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0;n=e+r|0;if((r|0)>=20){t=t&255;o=e&3;a=t|t<<8|t<<16|t<<24;i=n&~3;if(o){o=e+4-o|0;while((e|0)<(o|0)){de[e>>0]=t;e=e+1|0}}while((e|0)<(i|0)){pe[e>>2]=a;e=e+4|0}}while((e|0)<(n|0)){de[e>>0]=t;e=e+1|0}return e-r|0}function Kr(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t>>>r;return e>>>r|(t&(1<>>r-32|0}function Zr(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t<>>32-r;return e<>>0;return(re=t+n+(r>>>0>>0|0)>>>0,r|0)|0}function $r(e,t,r){e=e|0;t=t|0;r=r|0;var n=0;if((r|0)>=4096)return Re(e|0,t|0,r|0)|0;n=e|0;if((e&3)==(t&3)){while(e&3){if(!r)return n|0;de[e>>0]=de[t>>0]|0;e=e+1|0;t=t+1|0;r=r-1|0}while((r|0)>=4){pe[e>>2]=pe[t>>2];e=e+4|0;t=t+4|0;r=r-4|0}}while((r|0)>0){de[e>>0]=de[t>>0]|0;e=e+1|0;t=t+1|0;r=r-1|0}return n|0}function Qr(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t>>r;return e>>>r|(t&(1<>r-32|0}function en(e){e=e|0;var t=0;t=de[m+(e&255)>>0]|0;if((t|0)<8)return t|0;t=de[m+(e>>8&255)>>0]|0;if((t|0)<8)return t+8|0;t=de[m+(e>>16&255)>>0]|0;if((t|0)<8)return t+16|0;return(de[m+(e>>>24)>>0]|0)+24|0}function tn(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0;o=e&65535;i=t&65535;r=_e(i,o)|0;n=e>>>16;e=(r>>>16)+(_e(i,n)|0)|0;i=t>>>16;t=_e(i,o)|0;return(re=(e>>>16)+(_e(i,n)|0)+(((e&65535)+t|0)>>>16)|0,e+t<<16|r&65535|0)|0}function rn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0;l=t>>31|((t|0)<0?-1:0)<<1;u=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;o=n>>31|((n|0)<0?-1:0)<<1;i=((n|0)<0?-1:0)>>31|((n|0)<0?-1:0)<<1;s=Wr(l^e,u^t,l,u)|0;a=re;e=o^l;t=i^u;return Wr((un(s,a,Wr(o^r,i^n,o,i)|0,re,0)|0)^e,re^t,e,t)|0}function nn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0;i=ve;ve=ve+16|0;s=i|0;a=t>>31|((t|0)<0?-1:0)<<1;o=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;l=n>>31|((n|0)<0?-1:0)<<1;u=((n|0)<0?-1:0)>>31|((n|0)<0?-1:0)<<1;e=Wr(a^e,o^t,a,o)|0;t=re;un(e,t,Wr(l^r,u^n,l,u)|0,re,s)|0;n=Wr(pe[s>>2]^a,pe[s+4>>2]^o,a,o)|0;r=re;ve=i;return(re=r,n)|0}function on(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0;i=e;o=r;r=tn(i,o)|0;e=re;return(re=(_e(t,o)|0)+(_e(n,i)|0)+e|e&0,r|0|0)|0}function an(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;return un(e,t,r,n,0)|0}function sn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0;o=ve;ve=ve+16|0;i=o|0;un(e,t,r,n,i)|0;ve=o;return(re=pe[i+4>>2]|0,pe[i>>2]|0)|0}function un(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;c=e;u=t;l=u;a=r;h=n;s=h;if(!l){o=(i|0)!=0;if(!s){if(o){pe[i>>2]=(c>>>0)%(a>>>0);pe[i+4>>2]=0}h=0;i=(c>>>0)/(a>>>0)>>>0;return(re=h,i)|0}else{if(!o){h=0;i=0;return(re=h,i)|0}pe[i>>2]=e|0;pe[i+4>>2]=t&0;h=0;i=0;return(re=h,i)|0}}o=(s|0)==0;do{if(a){if(!o){o=(ae(s|0)|0)-(ae(l|0)|0)|0;if(o>>>0<=31){f=o+1|0;s=31-o|0;t=o-31>>31;a=f;e=c>>>(f>>>0)&t|l<>>(f>>>0)&t;o=0;s=c<>2]=e|0;pe[i+4>>2]=u|t&0;h=0;i=0;return(re=h,i)|0}o=a-1|0;if(o&a){s=(ae(a|0)|0)+33-(ae(l|0)|0)|0;p=64-s|0;f=32-s|0;u=f>>31;d=s-32|0;t=d>>31;a=s;e=f-1>>31&l>>>(d>>>0)|(l<>>(s>>>0))&t;t=t&l>>>(s>>>0);o=c<>>(d>>>0))&u|c<>31;break}if(i){pe[i>>2]=o&c;pe[i+4>>2]=0}if((a|0)==1){d=u|t&0;p=e|0|0;return(re=d,p)|0}else{p=en(a|0)|0;d=l>>>(p>>>0)|0;p=l<<32-p|c>>>(p>>>0)|0;return(re=d,p)|0}}else{if(o){if(i){pe[i>>2]=(l>>>0)%(a>>>0);pe[i+4>>2]=0}d=0;p=(l>>>0)/(a>>>0)>>>0;return(re=d,p)|0}if(!c){if(i){pe[i>>2]=0;pe[i+4>>2]=(l>>>0)%(s>>>0)}d=0;p=(l>>>0)/(s>>>0)>>>0;return(re=d,p)|0}o=s-1|0;if(!(o&s)){if(i){pe[i>>2]=e|0;pe[i+4>>2]=o&l|t&0}d=0;p=l>>>((en(s|0)|0)>>>0);return(re=d,p)|0}o=(ae(s|0)|0)-(ae(l|0)|0)|0;if(o>>>0<=30){t=o+1|0;s=31-o|0;a=t;e=l<>>(t>>>0);t=l>>>(t>>>0);o=0;s=c<>2]=e|0;pe[i+4>>2]=u|t&0;d=0;p=0;return(re=d,p)|0}}while(0);if(!a){l=s;u=0;s=0}else{f=r|0|0;c=h|n&0;l=Jr(f|0,c|0,-1,-1)|0;r=re;u=s;s=0;do{n=u;u=o>>>31|u<<1;o=s|o<<1;n=e<<1|n>>>31|0;h=e>>>31|t<<1|0;Wr(l,r,n,h)|0;p=re;d=p>>31|((p|0)<0?-1:0)<<1;s=d&1;e=Wr(n,h,d&f,(((p|0)<0?-1:0)>>31|((p|0)<0?-1:0)<<1)&c)|0;t=re;a=a-1|0}while((a|0)!=0);l=u;u=0}a=0;if(i){pe[i>>2]=e;pe[i+4>>2]=t}d=(o|0)>>>31|(l|a)<<1|(a<<1|o>>>31)&0|u;p=(o<<1|0>>>31)&-2|s;return(re=d,p)|0}function ln(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;return Cn[e&7](t|0,r|0,n|0)|0}function cn(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;kn[e&3](t|0,r|0,n|0,i|0,o|0)}function fn(e,t){e=e|0;t=t|0;En[e&7](t|0)}function hn(e,t){e=e|0;t=t|0;return An[e&1](t|0)|0}function dn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;On[e&0](t|0,r|0,n|0)}function pn(e){e=e|0;Rn[e&3]()}function gn(e,t,r,n,i,o,a){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;In[e&3](t|0,r|0,n|0,i|0,o|0,a|0)}function mn(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;return Dn[e&1](t|0,r|0,n|0,i|0,o|0)|0}function vn(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;Ln[e&3](t|0,r|0,n|0,i|0)}function _n(e,t,r){e=e|0;t=t|0;r=r|0;se(0);return 0}function yn(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;se(1)}function bn(e){e=e|0;se(2)}function xn(e){e=e|0;se(3);return 0}function wn(e,t,r){e=e|0;t=t|0;r=r|0;se(4)}function Tn(){se(5)}function Sn(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;se(6)}function Mn(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;se(7);return 0}function Pn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;se(8)}var Cn=[_n,Vt,Nr,Er,kr,Ar,_n,_n];var kn=[yn,tr,er,yn];var En=[bn,qt,Gt,Ht,Yt,Wt,ur,Lr];var An=[xn,Cr];var On=[wn];var Rn=[Tn,ar,sr,Tn];var In=[Sn,nr,rr,Sn];var Dn=[Mn,ut];var Ln=[Pn,Zt,Jt,Pn];return{___cxa_can_catch:ir,_crn_get_levels:Tt,_crn_get_uncompressed_size:Mt,_crn_decompress:Pt,_i64Add:Jr,_crn_get_width:xt,___cxa_is_pointer_type:or,_i64Subtract:Wr,_memset:Vr,_malloc:zr,_free:Ur,_memcpy:$r,_bitshift64Lshr:Kr,_fflush:mr,_bitshift64Shl:Zr,_crn_get_height:wt,___errno_location:cr,_crn_get_dxt_format:St,runPostSets:Gr,_emscripten_replace_memory:Ve,stackAlloc:Ke,stackSave:Ze,stackRestore:Je,establishStackSpace:$e,setThrew:Qe,setTempRet0:rt,getTempRet0:nt,dynCall_iiii:ln,dynCall_viiiii:cn,dynCall_vi:fn,dynCall_ii:hn,dynCall_viii:dn,dynCall_v:pn,dynCall_viiiiii:gn,dynCall_iiiiii:mn,dynCall_viiii:vn}}(e.Ya,e.Za,buffer);e.___cxa_can_catch=Z.___cxa_can_catch,e._crn_get_levels=Z._crn_get_levels,e.runPostSets=Z.runPostSets,e._crn_get_uncompressed_size=Z._crn_get_uncompressed_size,e._crn_decompress=Z._crn_decompress;var zc=e._i64Add=Z._i64Add;e._crn_get_height=Z._crn_get_height,e.___cxa_is_pointer_type=Z.___cxa_is_pointer_type;var nb=e._i64Subtract=Z._i64Subtract,qb=e._memset=Z._memset,Ea=e._malloc=Z._malloc,Bc=e._memcpy=Z._memcpy,Xa=e._emscripten_replace_memory=Z._emscripten_replace_memory;e._crn_get_dxt_format=Z._crn_get_dxt_format;var rb=e._bitshift64Lshr=Z._bitshift64Lshr,Na=e._free=Z._free;e._fflush=Z._fflush,e._crn_get_width=Z._crn_get_width,e.___errno_location=Z.___errno_location;var sb=e._bitshift64Shl=Z._bitshift64Shl;function ia(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}e.dynCall_iiii=Z.dynCall_iiii,e.dynCall_viiiii=Z.dynCall_viiiii,e.dynCall_vi=Z.dynCall_vi,e.dynCall_ii=Z.dynCall_ii,e.dynCall_viii=Z.dynCall_viii,e.dynCall_v=Z.dynCall_v,e.dynCall_viiiiii=Z.dynCall_viiiiii,e.dynCall_iiiiii=Z.dynCall_iiiiii,e.dynCall_viiii=Z.dynCall_viiii,n.aa=Z.stackAlloc,n.ua=Z.stackSave,n.ba=Z.stackRestore,n.Cd=Z.establishStackSpace,n.rb=Z.setTempRet0,n.fb=Z.getTempRet0,ia.prototype=Error(),ia.prototype.constructor=ia;var rd=null,jb=function t(){e.calledRun||td(),e.calledRun||(jb=t)};function td(t){function r(){if(!e.calledRun&&(e.calledRun=!0,!na)){if(Ha||(Ha=!0,ab(cb)),ab(db),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e._main&&vd&&e.callMain(t),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)gb(e.postRun.shift());ab(eb)}}if(t=t||e.arguments,null===rd&&(rd=Date.now()),!(0 0) var gc = undefined");else{if(!ba&&!ca)throw"Unknown runtime environment. Where are we?";e.read=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},void 0!==arguments&&(e.arguments=arguments),"undefined"!=typeof console?(e.print||(e.print=function(e){console.log(e)}),e.printErr||(e.printErr=function(e){console.log(e)})):e.print||(e.print=function(){}),ca&&(e.load=importScripts),void 0===e.setWindowTitle&&(e.setWindowTitle=function(e){document.title=e})}function ha(e){eval.call(null,e)}for(k in!e.load&&e.read&&(e.load=function(t){ha(e.read(t))}),e.print||(e.print=function(){}),e.printErr||(e.printErr=e.print),e.arguments||(e.arguments=[]),e.thisProgram||(e.thisProgram="./this.program"),e.print=e.print,e.W=e.printErr,e.preRun=[],e.postRun=[],aa)aa.hasOwnProperty(k)&&(e[k]=aa[k]);var n={rb:function(e){ka=e},fb:function(){return ka},ua:function(){return m},ba:function(e){m=e},Ka:function(e){switch(e){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:return"*"===e[e.length-1]?n.J:"i"===e[0]?(assert(0==(e=parseInt(e.substr(1)))%8),e/8):0}},eb:function(e){return Math.max(n.Ka(e),n.J)},ud:16,Qd:function(e,t){return"double"===t||"i64"===t?7&e&&(assert(4==(7&e)),e+=4):assert(0==(3&e)),e},Ed:function(e,t,r){return r||"i64"!=e&&"double"!=e?e?Math.min(t||(e?n.eb(e):0),n.J):Math.min(t,8):8},L:function(t,r,n){return n&&n.length?(n.splice||(n=Array.prototype.slice.call(n)),n.splice(0,0,r),e["dynCall_"+t].apply(null,n)):e["dynCall_"+t].call(null,r)},Z:[],Xa:function(e){for(var t=0;t>>0)+4294967296*+(t>>>0):+(e>>>0)+4294967296*+(0|t)},Ua:8,J:4,vd:0};e.Runtime=n,n.addFunction=n.Xa,n.removeFunction=n.nb;var na=!1,oa,pa,ka,ra,sa;function assert(e,t){e||x("Assertion failed: "+t)}function qa(a){var b=e["_"+a];if(!b)try{b=eval("_"+a)}catch(e){}return assert(b,"Cannot call unknown function "+a+" (perhaps LLVM optimizations or closure removed it?)"),b}function wa(e,t,r){switch("*"===(r=r||"i8").charAt(r.length-1)&&(r="i32"),r){case"i1":case"i8":y[e>>0]=t;break;case"i16":z[e>>1]=t;break;case"i32":C[e>>2]=t;break;case"i64":pa=[t>>>0,(oa=t,1<=+xa(oa)?0>>0:~~+Aa((oa-+(~~oa>>>0))/4294967296)>>>0:0)],C[e>>2]=pa[0],C[e+4>>2]=pa[1];break;case"float":Ba[e>>2]=t;break;case"double":Ca[e>>3]=t;break;default:x("invalid type for setValue: "+r)}}function Da(e,t){switch("*"===(t=t||"i8").charAt(t.length-1)&&(t="i32"),t){case"i1":case"i8":return y[e>>0];case"i16":return z[e>>1];case"i32":case"i64":return C[e>>2];case"float":return Ba[e>>2];case"double":return Ca[e>>3];default:x("invalid type for setValue: "+t)}return null}function D(e,t,r,i){var o,a;a="number"==typeof e?(o=!0,e):(o=!1,e.length);var s,u,l="string"==typeof t?t:null;if(r=4==r?i:[Ea,n.aa,n.Ra,n.R][void 0===r?2:r](Math.max(a,l?1:t.length)),o){for(assert(0==(3&(i=r))),e=r+(-4&a);i>2]=0;for(e=r+a;i>0]=0;return r}if("i8"===l)return e.subarray||e.slice?E.set(e,r):E.set(new Uint8Array(e),r),r;for(i=0;i>0],0!=n||r)&&(o++,!r||o!=r););if(r||(r=o),n="",i<128){for(;0>10,56320|1023&r)))):s+=String.fromCharCode(r)}}function Ka(e,t,r,n){if(!(0>6}else{if(a<=65535){if(n<=r+2)break;t[r++]=224|a>>12}else{if(a<=2097151){if(n<=r+3)break;t[r++]=240|a>>18}else{if(a<=67108863){if(n<=r+4)break;t[r++]=248|a>>24}else{if(n<=r+5)break;t[r++]=252|a>>30,t[r++]=128|a>>24&63}t[r++]=128|a>>18&63}t[r++]=128|a>>12&63}t[r++]=128|a>>6&63}t[r++]=128|63&a}}return t[r]=0,r-i}function La(e){for(var t=0,r=0;r"):o=i;e:for(;f>0];if(!r)return t;t+=String.fromCharCode(r)}},e.stringToAscii=function(e,t){return Ia(e,t,!1)},e.UTF8ArrayToString=Ja,e.UTF8ToString=function(e){return Ja(E,e)},e.stringToUTF8Array=Ka,e.stringToUTF8=function(e,t,r){return Ka(e,E,t,r)},e.lengthBytesUTF8=La,e.UTF16ToString=function(e){for(var t=0,r="";;){var n=z[e+2*t>>1];if(0==n)return r;++t,r+=String.fromCharCode(n)}},e.stringToUTF16=function(e,t,r){if(void 0===r&&(r=2147483647),r<2)return 0;var n=t;r=(r-=2)<2*e.length?r/2:e.length;for(var i=0;i>1]=e.charCodeAt(i),t+=2;return z[t>>1]=0,t-n},e.lengthBytesUTF16=function(e){return 2*e.length},e.UTF32ToString=function(e){for(var t=0,r="";;){var n=C[e+4*t>>2];if(0==n)return r;++t,65536<=n?(n-=65536,r+=String.fromCharCode(55296|n>>10,56320|1023&n)):r+=String.fromCharCode(n)}},e.stringToUTF32=function(e,t,r){if(void 0===r&&(r=2147483647),r<4)return 0;var n=t;r=n+r-4;for(var i=0;i>2]=o,r<(t+=4)+4)break}return C[t>>2]=0,t-n},e.lengthBytesUTF32=function(e){for(var t=0,r=0;r>0]=e[r],r+=1}function ta(e,t){for(var r=0;r>0]=e[r]}function Ia(e,t,r){for(var n=0;n>0]=e.charCodeAt(n);r||(y[t>>0]=0)}e.addOnPreRun=fb,e.addOnInit=function(e){cb.unshift(e)},e.addOnPreMain=function(e){db.unshift(e)},e.addOnExit=function(e){H.unshift(e)},e.addOnPostRun=gb,e.intArrayFromString=hb,e.intArrayToString=function(e){for(var t=[],r=0;r>>16)*n+r*(t>>>16)<<16)|0}),Math.Jd=Math.imul,Math.clz32||(Math.clz32=function(e){e>>>=0;for(var t=0;t<32;t++)if(e&1<<31-t)return t;return 32}),Math.Ad=Math.clz32;var xa=Math.abs,Aa=Math.ceil,za=Math.floor,ya=Math.min,I=0,ib=null,jb=null;function kb(){I++,e.monitorRunDependencies&&e.monitorRunDependencies(I)}function lb(){if(I--,e.monitorRunDependencies&&e.monitorRunDependencies(I),0==I&&(null!==ib&&(clearInterval(ib),ib=null),jb)){var t=jb;jb=null,t()}}e.addRunDependency=kb,e.removeRunDependency=lb,e.preloadedImages={},e.preloadedAudios={},Ta=8,la=Ta+5888,cb.push(),D([124,0,0,0,98,7,0,0,124,0,0,0,111,7,0,0,164,0,0,0,124,7,0,0,16,0,0,0,0,0,0,0,164,0,0,0,157,7,0,0,24,0,0,0,0,0,0,0,164,0,0,0,227,7,0,0,24,0,0,0,0,0,0,0,164,0,0,0,191,7,0,0,56,0,0,0,0,0,0,0,164,0,0,0,5,8,0,0,40,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,40,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,88,0,0,0,1,0,0,0,5,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,114,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,124,1,0,0,236,1,0,0,236,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,4,0,0,0,239,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,4,0,0,0,231,16,0,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,115,40,37,117,41,58,32,65,115,115,101,114,116,105,111,110,32,102,97,105,108,117,114,101,58,32,34,37,115,34,10,0,109,95,115,105,122,101,32,60,61,32,109,95,99,97,112,97,99,105,116,121,0,46,47,99,114,110,95,100,101,99,111,109,112,46,104,0,109,105,110,95,110,101,119,95,99,97,112,97,99,105,116,121,32,60,32,40,48,120,55,70,70,70,48,48,48,48,85,32,47,32,101,108,101,109,101,110,116,95,115,105,122,101,41,0,110,101,119,95,99,97,112,97,99,105,116,121,32,38,38,32,40,110,101,119,95,99,97,112,97,99,105,116,121,32,62,32,109,95,99,97,112,97,99,105,116,121,41,0,110,117,109,95,99,111,100,101,115,91,99,93,0,115,111,114,116,101,100,95,112,111,115,32,60,32,116,111,116,97,108,95,117,115,101,100,95,115,121,109,115,0,112,67,111,100,101,115,105,122,101,115,91,115,121,109,95,105,110,100,101,120,93,32,61,61,32,99,111,100,101,115,105,122,101,0,116,32,60,32,40,49,85,32,60,60,32,116,97,98,108,101,95,98,105,116,115,41,0,109,95,108,111,111,107,117,112,91,116,93,32,61,61,32,99,85,73,78,84,51,50,95,77,65,88,0,99,114,110,100,95,109,97,108,108,111,99,58,32,115,105,122,101,32,116,111,111,32,98,105,103,0,99,114,110,100,95,109,97,108,108,111,99,58,32,111,117,116,32,111,102,32,109,101,109,111,114,121,0,40,40,117,105,110,116,51,50,41,112,95,110,101,119,32,38,32,40,67,82,78,68,95,77,73,78,95,65,76,76,79,67,95,65,76,73,71,78,77,69,78,84,32,45,32,49,41,41,32,61,61,32,48,0,99,114,110,100,95,114,101,97,108,108,111,99,58,32,98,97,100,32,112,116,114,0,99,114,110,100,95,102,114,101,101,58,32,98,97,100,32,112,116,114,0,102,97,108,115,101,0,40,116,111,116,97,108,95,115,121,109,115,32,62,61,32,49,41,32,38,38,32,40,116,111,116,97,108,95,115,121,109,115,32,60,61,32,112,114,101,102,105,120,95,99,111,100,105,110,103,58,58,99,77,97,120,83,117,112,112,111,114,116,101,100,83,121,109,115,41,0,17,18,19,20,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15,16,48,0,110,117,109,95,98,105,116,115,32,60,61,32,51,50,85,0,109,95,98,105,116,95,99,111,117,110,116,32,60,61,32,99,66,105,116,66,117,102,83,105,122,101,0,116,32,33,61,32,99,85,73,78,84,51,50,95,77,65,88,0,109,111,100,101,108,46,109,95,99,111,100,101,95,115,105,122,101,115,91,115,121,109,93,32,61,61,32,108,101,110,0,0,2,3,1,0,2,3,4,5,6,7,1,40,108,101,110,32,62,61,32,49,41,32,38,38,32,40,108,101,110,32,60,61,32,99,77,97,120,69,120,112,101,99,116,101,100,67,111,100,101,83,105,122,101,41,0,105,32,60,32,109,95,115,105,122,101,0,110,101,120,116,95,108,101,118,101,108,95,111,102,115,32,62,32,99,117,114,95,108,101,118,101,108,95,111,102,115,0,1,2,2,3,3,3,3,4,0,0,0,0,0,0,1,1,0,1,0,1,0,0,1,2,1,2,0,0,0,1,0,2,1,0,2,0,0,1,2,3,110,117,109,32,38,38,32,40,110,117,109,32,61,61,32,126,110,117,109,95,99,104,101,99,107,41,0,83,116,57,101,120,99,101,112,116,105,111,110,0,83,116,57,116,121,112,101,95,105,110,102,111,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,54,95,95,115,104,105,109,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,57,95,95,112,111,105,110,116,101,114,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,112,98,97,115,101,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,48,95,95,115,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,112,116,104,114,101,97,100,95,111,110,99,101,32,102,97,105,108,117,114,101,32,105,110,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,95,102,97,115,116,40,41,0,116,101,114,109,105,110,97,116,101,95,104,97,110,100,108,101,114,32,117,110,101,120,112,101,99,116,101,100,108,121,32,114,101,116,117,114,110,101,100,0,99,97,110,110,111,116,32,99,114,101,97,116,101,32,112,116,104,114,101,97,100,32,107,101,121,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,99,97,110,110,111,116,32,122,101,114,111,32,111,117,116,32,116,104,114,101,97,100,32,118,97,108,117,101,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,58,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,102,111,114,101,105,103,110,32,101,120,99,101,112,116,105,111,110,0,116,101,114,109,105,110,97,116,105,110,103,0,117,110,99,97,117,103,104,116,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116,32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,46,0],"i8",4,n.Ua);var mb=n.ja(D(12,"i8",2),8);function ob(t){return e.___errno_location&&(C[e.___errno_location()>>2]=t),t}assert(0==mb%8),e._i64Subtract=nb;var J={I:1,F:2,ed:3,bc:4,H:5,Aa:6,vb:7,zc:8,ea:9,Jb:10,va:11,qd:11,Ta:12,da:13,Vb:14,Lc:15,fa:16,wa:17,rd:18,ha:19,ya:20,P:21,q:22,uc:23,Sa:24,Q:25,nd:26,Wb:27,Hc:28,ia:29,bd:30,nc:31,Vc:32,Sb:33,Zc:34,Dc:42,Zb:43,Kb:44,ec:45,fc:46,gc:47,mc:48,od:49,xc:50,dc:51,Pb:35,Ac:37,Bb:52,Eb:53,sd:54,vc:55,Fb:56,Gb:57,Qb:35,Hb:59,Jc:60,yc:61,kd:62,Ic:63,Ec:64,Fc:65,ad:66,Bc:67,yb:68,gd:69,Lb:70,Wc:71,pc:72,Tb:73,Db:74,Qc:76,Cb:77,$c:78,hc:79,ic:80,lc:81,kc:82,jc:83,Kc:38,za:39,qc:36,ga:40,Rc:95,Uc:96,Ob:104,wc:105,zb:97,Yc:91,Oc:88,Gc:92,cd:108,Nb:111,wb:98,Mb:103,tc:101,rc:100,ld:110,Xb:112,Yb:113,ac:115,Ab:114,Rb:89,oc:90,Xc:93,dd:94,xb:99,sc:102,cc:106,Mc:107,md:109,pd:87,Ub:122,hd:116,Pc:95,Cc:123,$b:84,Sc:75,Ib:125,Nc:131,Tc:130,jd:86};function pb(e,t){H.push(function(){n.L("vi",e,[t])}),pb.level=H.length}function tb(){return!!tb.p}e._memset=qb,e._bitshift64Lshr=rb,e._bitshift64Shl=sb;var ub=[],vb={};function wb(e,t){wb.p||(wb.p={}),e in wb.p||(n.L("v",t),wb.p[e]=1)}var xb={0:"Success",1:"Not super-user",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"I/O error",6:"No such device or address",7:"Arg list too long",8:"Exec format error",9:"Bad file number",10:"No children",11:"No more processes",12:"Not enough core",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Mount device busy",17:"File exists",18:"Cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",25:"Not a typewriter",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",30:"Read only file system",31:"Too many links",32:"Broken pipe",33:"Math arg out of domain of func",34:"Math result not representable",35:"File locking deadlock error",36:"File or path name too long",37:"No record locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many symbolic links",42:"No message of desired type",43:"Identifier removed",44:"Channel number out of range",45:"Level 2 not synchronized",46:"Level 3 halted",47:"Level 3 reset",48:"Link number out of range",49:"Protocol driver not attached",50:"No CSI structure available",51:"Level 2 halted",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",57:"Invalid slot",59:"Bad font file fmt",60:"Device not a stream",61:"No data (for no delay io)",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",65:"Package not installed",66:"The object is remote",67:"The link has been severed",68:"Advertise error",69:"Srmount error",70:"Communication error on send",71:"Protocol error",72:"Multihop attempted",73:"Cross mount point (not really error)",74:"Trying to read unreadable message",75:"Value too large for defined data type",76:"Given log. name not unique",77:"f.d. invalid for this operation",78:"Remote address changed",79:"Can access a needed shared lib",80:"Accessing a corrupted shared lib",81:".lib section in a.out corrupted",82:"Attempting to link in too many libs",83:"Attempting to exec a shared library",84:"Illegal byte sequence",86:"Streams pipe error",87:"Too many users",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Unknown protocol",94:"Socket type not supported",95:"Not supported",96:"Protocol family not supported",97:"Address family not supported by protocol family",98:"Address already in use",99:"Address not available",100:"Network interface is not configured",101:"Network is unreachable",102:"Connection reset by network",103:"Connection aborted",104:"Connection reset by peer",105:"No buffer space available",106:"Socket is already connected",107:"Socket is not connected",108:"Can't send after socket shutdown",109:"Too many references",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"Host is unreachable",114:"Socket already connected",115:"Connection already in progress",116:"Stale file handle",122:"Quota exceeded",123:"No medium (in tape drive)",125:"Operation canceled",130:"Previous owner died",131:"State not recoverable"};function yb(e,t){for(var r=0,n=e.length-1;0<=n;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function zb(e){var t="/"===e.charAt(0),r="/"===e.substr(-1);return(e=yb(e.split("/").filter(function(e){return!!e}),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e}function Ab(e){var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1);return e=t[0],t=t[1],e||t?(t&&(t=t.substr(0,t.length-1)),e+t):"."}function Bb(e){if("/"===e)return"/";var t=e.lastIndexOf("/");return-1===t?e:e.substr(t+1)}function Cb(){return zb(Array.prototype.slice.call(arguments,0).join("/"))}function K(e,t){return zb(e+"/"+t)}function Db(){for(var e="",t=!1,r=arguments.length-1;-1<=r&&!t;r--){if("string"!=typeof(t=0<=r?arguments[r]:"/"))throw new TypeError("Arguments to path.resolve must be strings");if(!t)return"";e=t+"/"+e,t="/"===t.charAt(0)}return(t?"/":"")+(e=yb(e.split("/").filter(function(e){return!!e}),!t).join("/"))||"."}var Eb=[];function Fb(e,t){Eb[e]={input:[],output:[],N:t},Gb(e,Hb)}var Hb={open:function(e){var t=Eb[e.g.rdev];if(!t)throw new L(J.ha);e.tty=t,e.seekable=!1},close:function(e){e.tty.N.flush(e.tty)},flush:function(e){e.tty.N.flush(e.tty)},read:function(e,t,r,n){if(!e.tty||!e.tty.N.La)throw new L(J.Aa);for(var i=0,o=0;oe.e.length&&(e.e=M.cb(e),e.o=e.e.length),!e.e||e.e.subarray){var r=e.e?e.e.buffer.byteLength:0;t<=r||(t=Math.max(t,r*(r<1048576?2:1.125)|0),0!=r&&(t=Math.max(t,256)),r=e.e,e.e=new Uint8Array(t),0t)e.e.length=t;else for(;e.e.length=e.g.o)return 0;if(assert(0<=(e=Math.min(e.g.o-i,n))),8>1)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}return t.mode},B:function(e){for(var t=[];e.parent!==e;)t.push(e.name),e=e.parent;return t.push(e.A.pa.root),t.reverse(),Cb.apply(null,t)},Ha:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},$a:function(e){if((e&=-32769)in P.Ha)return P.Ha[e];throw new L(J.q)},k:{D:function(e){var t;e=P.B(e);try{t=fs.lstatSync(e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}return P.$&&!t.K&&(t.K=4096),P.$&&!t.blocks&&(t.blocks=(t.size+t.K-1)/t.K|0),{dev:t.dev,ino:t.ino,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,size:t.size,atime:t.atime,mtime:t.mtime,ctime:t.ctime,K:t.K,blocks:t.blocks}},u:function(e,t){var r=P.B(e);try{void 0!==t.mode&&(fs.chmodSync(r,t.mode),e.mode=t.mode),void 0!==t.size&&fs.truncateSync(r,t.size)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},lookup:function(e,t){var r=K(P.B(e),t);r=P.Ja(r);return P.createNode(e,t,r)},T:function(e,t,r,n){e=P.createNode(e,t,r,n),t=P.B(e);try{N(e.mode)?fs.mkdirSync(t,e.mode):fs.writeFileSync(t,"",{mode:e.mode})}catch(e){if(!e.code)throw e;throw new L(J[e.code])}return e},rename:function(e,t,r){e=P.B(e),t=K(P.B(t),r);try{fs.renameSync(e,t)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},unlink:function(e,t){var r=K(P.B(e),t);try{fs.unlinkSync(r)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},rmdir:function(e,t){var r=K(P.B(e),t);try{fs.rmdirSync(r)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},readdir:function(e){e=P.B(e);try{return fs.readdirSync(e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},symlink:function(e,t,r){e=K(P.B(e),t);try{fs.symlinkSync(r,e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},readlink:function(e){var t=P.B(e);try{return t=fs.readlinkSync(t),t=Ob.relative(Ob.resolve(e.A.pa.root),t)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}}},n:{open:function(e){var t=P.B(e.g);try{32768==(61440&e.g.mode)&&(e.V=fs.openSync(t,P.$a(e.flags)))}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},close:function(e){try{32768==(61440&e.g.mode)&&e.V&&fs.closeSync(e.V)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},read:function(e,t,r,n,i){if(0===n)return 0;var o,a=new Buffer(n);try{o=fs.readSync(e.V,a,0,n,i)}catch(e){throw new L(J[e.code])}if(0>>0)%Q.length}function Xb(e){var t=Wb(e.parent.id,e.name);e.M=Q[t],Q[t]=e}function Nb(e,t){var r;if(r=(r=Yb(e,"x"))?r:e.k.lookup?0:J.da)throw new L(r,e);for(r=Q[Wb(e.id,t)];r;r=r.M){var n=r.name;if(r.parent.id===e.id&&n===t)return r}return e.k.lookup(e,t)}function Lb(e,t,r,n){return Zb||((Zb=function(e,t,r,n){e||(e=this),this.parent=e,this.A=e.A,this.U=null,this.id=Sb++,this.name=t,this.mode=r,this.k={},this.n={},this.rdev=n}).prototype={},Object.defineProperties(Zb.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(e){e?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(e){e?this.mode|=146:this.mode&=-147}},kb:{get:function(){return N(this.mode)}},jb:{get:function(){return 8192==(61440&this.mode)}}})),Xb(e=new Zb(e,t,r,n)),e}function N(e){return 16384==(61440&e)}var $b={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218};function Yb(e,t){return Tb?0:(-1===t.indexOf("r")||292&e.mode)&&(-1===t.indexOf("w")||146&e.mode)&&(-1===t.indexOf("x")||73&e.mode)?0:J.da}function ac(e,t){try{return Nb(e,t),J.wa}catch(e){}return Yb(e,"wx")}function bc(){for(var e=0;e<=4096;e++)if(!Rb[e])return e;throw new L(J.Sa)}function cc(e){dc||((dc=function(){}).prototype={},Object.defineProperties(dc.prototype,{object:{get:function(){return this.g},set:function(e){this.g=e}},Ld:{get:function(){return 1!=(2097155&this.flags)}},Md:{get:function(){return 0!=(2097155&this.flags)}},Kd:{get:function(){return 1024&this.flags}}}));var t,r=new dc;for(t in e)r[t]=e[t];return e=r,r=bc(),e.fd=r,Rb[r]=e}var Kb={open:function(e){e.n=Qb[e.g.rdev].n,e.n.open&&e.n.open(e)},G:function(){throw new L(J.ia)}},qc;function Gb(e,t){Qb[e]={n:t}}function ec(e,t){var r,n="/"===t,i=!t;if(n&&Pb)throw new L(J.fa);if(!n&&!i){if(t=(r=S(t,{Ia:!1})).path,(r=r.g).U)throw new L(J.fa);if(!N(r.mode))throw new L(J.ya)}i={type:e,pa:{},Oa:t,lb:[]};var o=e.A(i);(o.A=i).root=o,n?Pb=o:r&&(r.U=i,r.A&&r.A.lb.push(i))}function fc(e,t,r){var n=S(e,{parent:!0}).g;if(!(e=Bb(e))||"."===e||".."===e)throw new L(J.q);var i=ac(n,e);if(i)throw new L(i);if(!n.k.T)throw new L(J.I);return n.k.T(n,e,t,r)}function gc(e,t){return t=4095&(void 0!==t?t:438),fc(e,t|=32768,0)}function V(e,t){return t=1023&(void 0!==t?t:511),fc(e,t|=16384,0)}function hc(e,t,r){return void 0===r&&(r=t,t=438),fc(e,8192|t,r)}function ic(e,t){if(!Db(e))throw new L(J.F);var r=S(t,{parent:!0}).g;if(!r)throw new L(J.F);var n=Bb(t),i=ac(r,n);if(i)throw new L(i);if(!r.k.symlink)throw new L(J.I);return r.k.symlink(r,n,e)}function Vb(e){if(!(e=S(e).g))throw new L(J.F);if(!e.k.readlink)throw new L(J.q);return Db(T(e.parent),e.k.readlink(e))}function jc(e,t){var r;if(!(r="string"==typeof e?S(e,{la:!0}).g:e).k.u)throw new L(J.I);r.k.u(r,{mode:4095&t|-4096&r.mode,timestamp:Date.now()})}function kc(t,r){var n,i,o;if(""===t)throw new L(J.F);if("string"==typeof r){if(void 0===(i=$b[r]))throw Error("Unknown file open mode: "+r)}else i=r;if(n=64&(r=i)?4095&(void 0===n?438:n)|32768:0,"object"==typeof t)o=t;else{t=zb(t);try{o=S(t,{la:!(131072&r)}).g}catch(e){}}if(i=!1,64&r)if(o){if(128&r)throw new L(J.wa)}else o=fc(t,n,0),i=!0;if(!o)throw new L(J.F);if(8192==(61440&o.mode)&&(r&=-513),65536&r&&!N(o.mode))throw new L(J.ya);if(!i&&(n=o?40960==(61440&o.mode)?J.ga:N(o.mode)&&(0!=(2097155&r)||512&r)?J.P:(n=["r","w","rw"][3&r],512&r&&(n+="w"),Yb(o,n)):J.F))throw new L(n);if(512&r){var a;if(!(a="string"==typeof(n=o)?S(n,{la:!0}).g:n).k.u)throw new L(J.I);if(N(a.mode))throw new L(J.P);if(32768!=(61440&a.mode))throw new L(J.q);if(n=Yb(a,"w"))throw new L(n);a.k.u(a,{size:0,timestamp:Date.now()})}r&=-641,(o=cc({g:o,path:T(o),flags:r,seekable:!0,position:0,n:o.n,tb:[],error:!1})).n.open&&o.n.open(o),!e.logReadFiles||1&r||(lc||(lc={}),t in lc||(lc[t]=1,e.printErr("read file: "+t)));try{R.onOpenFile&&(a=0,1!=(2097155&r)&&(a|=1),0!=(2097155&r)&&(a|=2),R.onOpenFile(t,a))}catch(e){console.log("FS.trackingDelegate['onOpenFile']('"+t+"', flags) threw an exception: "+e.message)}return o}function mc(e){e.na&&(e.na=null);try{e.n.close&&e.n.close(e)}catch(e){throw e}finally{Rb[e.fd]=null}}function nc(e,t,r){if(!e.seekable||!e.n.G)throw new L(J.ia);e.position=e.n.G(e,t,r),e.tb=[]}function oc(e,t,r,n,i,o){if(n<0||i<0)throw new L(J.q);if(0==(2097155&e.flags))throw new L(J.ea);if(N(e.g.mode))throw new L(J.P);if(!e.n.write)throw new L(J.q);1024&e.flags&&nc(e,0,2);var a=!0;if(void 0===i)i=e.position,a=!1;else if(!e.seekable)throw new L(J.ia);t=e.n.write(e,t,r,n,i,o),a||(e.position+=t);try{e.path&&R.onWriteToFile&&R.onWriteToFile(e.path)}catch(e){console.log("FS.trackingDelegate['onWriteToFile']('"+path+"') threw an exception: "+e.message)}return t}function pc(){L||((L=function(e,t){this.g=t,this.qb=function(e){for(var t in this.S=e,J)if(J[t]===e){this.code=t;break}},this.qb(e),this.message=xb[e]}).prototype=Error(),L.prototype.constructor=L,[J.F].forEach(function(e){Mb[e]=new L(e),Mb[e].stack=""}))}function rc(e,t){var r=0;return e&&(r|=365),t&&(r|=146),r}function sc(e,t,r,n){return gc(e=K("string"==typeof e?e:T(e),t),rc(r,n))}function tc(e,t,r,n,i,o){if(i=gc(e=t?K("string"==typeof e?e:T(e),t):e,n=rc(n,i)),r){if("string"==typeof r){e=Array(r.length),t=0;for(var a=r.length;t>2]}function xc(){var e;if(e=X(),!(e=Rb[e]))throw new L(J.ea);return e}var yc={};function Ga(e){Ga.p||(r=Qa(r),Ga.p=!0,assert(n.R),Ga.bb=n.R,n.R=function(){x("cannot dynamically allocate, sbrk now has control")});var t=r;return 0==e||Ga.bb(e)?t:4294967295}e._i64Add=zc;var Ac=1;function Cc(e,t){if(Dc=e,Ec=t,!Fc)return 1;if(0==e)Y=function(){setTimeout(Gc,t)},Hc="timeout";else if(1==e)Y=function(){Ic(Gc)},Hc="rAF";else if(2==e){if(!window.setImmediate){var r=[];window.addEventListener("message",function(e){e.source===window&&"__emcc"===e.data&&(e.stopPropagation(),r.shift()())},!0),window.setImmediate=function(e){r.push(e),window.postMessage("__emcc","*")}}Y=function(){window.setImmediate(Gc)},Hc="immediate"}return 0}function Jc(a,t,r,s,i){e.noExitRuntime=!0,assert(!Fc,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters."),Fc=a,Kc=s;var u=Lc;if(Gc=function(){if(!na)if(0>r-6&63;r=r-6,e=e+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[i]}2==r?(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t)<<4],e+="=="):4==r&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t)<<2],e+="="),l.src="data:audio/x-"+a.substr(-3)+";base64,"+e,s(l)}},l.src=i,ad(function(){s(l)})}});var r=e.canvas;r&&(r.sa=r.requestPointerLock||r.mozRequestPointerLock||r.webkitRequestPointerLock||r.msRequestPointerLock||function(){},r.Fa=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||function(){},r.Fa=r.Fa.bind(document),document.addEventListener("pointerlockchange",t,!1),document.addEventListener("mozpointerlockchange",t,!1),document.addEventListener("webkitpointerlockchange",t,!1),document.addEventListener("mspointerlockchange",t,!1),e.elementPointerLock&&r.addEventListener("click",function(e){!Tc&&r.sa&&(r.sa(),e.preventDefault())},!1))}}function bd(t,r,n,i){if(r&&e.ka&&t==e.canvas)return e.ka;var o,a;if(r){if(a={antialias:!1,alpha:!1},i)for(var s in i)a[s]=i[s];(a=GL.createContext(t,a))&&(o=GL.getContext(a).td),t.style.backgroundColor="black"}else o=t.getContext("2d");return o?(n&&(r||assert("undefined"==typeof GLctx,"cannot set in module if GLctx is used, but we are a non-GL context that would replace it"),e.ka=o,r&&GL.Od(a),e.Td=r,Uc.forEach(function(e){e()}),Vc()),o):null}var cd=!1,dd=void 0,ed=void 0;function fd(t,r,n){function i(){Sc=!1;var t=o.parentNode;(document.webkitFullScreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.mozFullscreenElement||document.fullScreenElement||document.fullscreenElement||document.msFullScreenElement||document.msFullscreenElement||document.webkitCurrentFullScreenElement)===t?(o.Da=document.cancelFullScreen||document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msExitFullscreen||document.exitFullscreen||function(){},o.Da=o.Da.bind(document),dd&&o.sa(),Sc=!0,ed&&gd()):(t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),ed&&hd()),e.onFullScreen&&e.onFullScreen(Sc),id(o)}void 0===(dd=t)&&(dd=!0),void 0===(ed=r)&&(ed=!1),void 0===(jd=n)&&(jd=null);var o=e.canvas;cd||(cd=!0,document.addEventListener("fullscreenchange",i,!1),document.addEventListener("mozfullscreenchange",i,!1),document.addEventListener("webkitfullscreenchange",i,!1),document.addEventListener("MSFullscreenChange",i,!1));var a=document.createElement("div");o.parentNode.insertBefore(a,o),a.appendChild(o),a.p=a.requestFullScreen||a.mozRequestFullScreen||a.msRequestFullscreen||(a.webkitRequestFullScreen?function(){a.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}:null),n?a.p({Ud:n}):a.p()}var kd=0;function ld(e){var t=Date.now();if(0===kd)kd=t+1e3/60;else for(;kd<=t+2;)kd+=1e3/60;t=Math.max(kd-t,0),setTimeout(e,t)}function Ic(e){"undefined"==typeof window?ld(e):(window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||ld),window.requestAnimationFrame(e))}function ad(t){e.noExitRuntime=!0,setTimeout(function(){na||t()},1e4)}function $c(e){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[e.substr(e.lastIndexOf(".")+1)]}function md(e,t,r){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)}function nd(t,r,e){md(t,function(e){assert(e,'Loading data file "'+t+'" failed (no arrayBuffer).'),r(new Uint8Array(e)),lb()},function(){if(!e)throw'Loading data file "'+t+'" failed.';e()}),kb()}var od=[],Wc,Xc,Yc,Zc,jd;function pd(){var t=e.canvas;od.forEach(function(e){e(t.width,t.height)})}function gd(){if("undefined"!=typeof SDL){var e=Sa[SDL.screen+0*n.J>>2];C[SDL.screen+0*n.J>>2]=8388608|e}pd()}function hd(){if("undefined"!=typeof SDL){var e=Sa[SDL.screen+0*n.J>>2];C[SDL.screen+0*n.J>>2]=-8388609&e}pd()}function id(t,r,n){r&&n?(t.ub=r,t.hb=n):(r=t.ub,n=t.hb);var i=r,o=n;if(e.forcedAspectRatio&&0this.length-1||e<0)){var t=e%this.chunkSize;return this.gb(e/this.chunkSize|0)[t]}},a.prototype.pb=function(e){this.gb=e},a.prototype.Ca=function(){var e=new XMLHttpRequest;if(e.open("HEAD",u,!1),e.send(null),!(200<=e.status&&e.status<300||304===e.status))throw Error("Couldn't load "+u+". Status: "+e.status);var t,o=Number(e.getResponseHeader("Content-length")),a=1048576;(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t||(a=o);var s=this;s.pb(function(e){var t=e*a,r=(e+1)*a-1;r=Math.min(r,o-1);if(void 0===s.Y[e]){var n=s.Y;if(r=(e=e.g.e).length)return 0;if(assert(0<=(n=Math.min(e.length-i,n))),e.slice)for(var o=0;o>2]=0;case 21520:return r.tty?-J.q:-J.Q;case 21531:if(i=X(),!r.n.ib)throw new L(J.Q);return r.n.ib(r,n,i);default:x("bad ioctl syscall "+n)}}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},___syscall6:function(e,t){wc=t;try{return mc(xc()),0}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},_emscripten_set_main_loop_timing:Cc,__ZSt18uncaught_exceptionv:tb,___setErrNo:ob,_sbrk:Ga,___cxa_begin_catch:function(e){var t;tb.p--,ub.push(e);e:{if(e&&!vb[e])for(t in vb)if(vb[t].wd===e)break e;t=e}return t&&vb[t].Sd++,e},_emscripten_memcpy_big:function(e,t,r){return E.set(E.subarray(t,t+r),e),e},_sysconf:function(e){switch(e){case 30:return 4096;case 85:return F/4096;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"==typeof navigator&&navigator.hardwareConcurrency||1}return ob(J.q),-1},_pthread_getspecific:function(e){return yc[e]||0},_pthread_self:function(){return 0},_pthread_once:wb,_pthread_key_create:function(e){return 0==e?J.q:(C[e>>2]=Ac,yc[Ac]=0,Ac++,0)},___unlock:function(){},_emscripten_set_main_loop:Jc,_pthread_setspecific:function(e,t){return e in yc?(yc[e]=t,0):J.q},___lock:function(){},_abort:function(){e.abort()},_pthread_cleanup_push:pb,_time:function(e){var t=Date.now()/1e3|0;return e&&(C[e>>2]=t),t},___syscall140:function(e,t){wc=t;try{var r=xc(),n=X(),i=X(),o=X(),a=X();return assert(0===n),nc(r,i,a),C[o>>2]=r.position,r.na&&0===i&&0===a&&(r.na=null),0}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},___syscall146:function(e,t){wc=t;try{var r,n=xc(),i=X();e:{for(var o=X(),a=0,s=0;s>2],C[i+(8*s+4)>>2],void 0);if(u<0){r=-1;break e}a+=u}r=a}return r}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},STACKTOP:m,STACK_MAX:Va,tempDoublePtr:mb,ABORT:na,cttz_i8:qd};var Z=function(e,t,r){"use asm";var n=e.Int8Array;var i=e.Int16Array;var o=e.Int32Array;var a=e.Uint8Array;var s=e.Uint16Array;var u=e.Uint32Array;var l=e.Float32Array;var c=e.Float64Array;var de=new n(r);var Q=new i(r);var pe=new o(r);var ge=new a(r);var me=new s(r);var f=new u(r);var h=new l(r);var ee=new c(r);var d=e.byteLength;var ve=t.STACKTOP|0;var p=t.STACK_MAX|0;var te=t.tempDoublePtr|0;var g=t.ABORT|0;var m=t.cttz_i8|0;var v=0;var _=0;var y=0;var b=0;var x=e.NaN,w=e.Infinity;var T=0,S=0,M=0,P=0,C=0.0,k=0,E=0,A=0,O=0.0;var re=0;var R=0;var I=0;var D=0;var L=0;var N=0;var j=0;var F=0;var B=0;var z=0;var U=e.Math.floor;var X=e.Math.abs;var q=e.Math.sqrt;var H=e.Math.pow;var Y=e.Math.cos;var G=e.Math.sin;var W=e.Math.tan;var V=e.Math.acos;var K=e.Math.asin;var Z=e.Math.atan;var J=e.Math.atan2;var $=e.Math.exp;var ne=e.Math.log;var ie=e.Math.ceil;var _e=e.Math.imul;var oe=e.Math.min;var ae=e.Math.clz32;var se=t.abort;var ue=t.assert;var le=t.invoke_iiii;var ce=t.invoke_viiiii;var fe=t.invoke_vi;var he=t.invoke_ii;var ye=t.invoke_viii;var be=t.invoke_v;var xe=t.invoke_viiiiii;var we=t.invoke_iiiiii;var Te=t.invoke_viiii;var Se=t._pthread_cleanup_pop;var Me=t.___syscall54;var Pe=t.___syscall6;var Ce=t._emscripten_set_main_loop_timing;var ke=t.__ZSt18uncaught_exceptionv;var Ee=t.___setErrNo;var Ae=t._sbrk;var Oe=t.___cxa_begin_catch;var Re=t._emscripten_memcpy_big;var Ie=t._sysconf;var De=t._pthread_getspecific;var Le=t._pthread_self;var Ne=t._pthread_once;var je=t._pthread_key_create;var Fe=t.___unlock;var Be=t._emscripten_set_main_loop;var ze=t._pthread_setspecific;var Ue=t.___lock;var Xe=t._abort;var qe=t._pthread_cleanup_push;var He=t._time;var Ye=t.___syscall140;var Ge=t.___syscall146;var We=0.0;function Ve(e){if(d(e)&16777215||d(e)<=16777215||d(e)>2147483648)return false;de=new n(e);Q=new i(e);pe=new o(e);ge=new a(e);me=new s(e);f=new u(e);h=new l(e);ee=new c(e);r=e;return true}function Ke(e){e=e|0;var t=0;t=ve;ve=ve+e|0;ve=ve+15&-16;return t|0}function Ze(){return ve|0}function Je(e){e=e|0;ve=e}function $e(e,t){e=e|0;t=t|0;ve=e;p=t}function Qe(e,t){e=e|0;t=t|0;if(!v){v=e;_=t}}function et(e){e=e|0;de[te>>0]=de[e>>0];de[te+1>>0]=de[e+1>>0];de[te+2>>0]=de[e+2>>0];de[te+3>>0]=de[e+3>>0]}function tt(e){e=e|0;de[te>>0]=de[e>>0];de[te+1>>0]=de[e+1>>0];de[te+2>>0]=de[e+2>>0];de[te+3>>0]=de[e+3>>0];de[te+4>>0]=de[e+4>>0];de[te+5>>0]=de[e+5>>0];de[te+6>>0]=de[e+6>>0];de[te+7>>0]=de[e+7>>0]}function rt(e){e=e|0;re=e}function nt(){return re|0}function it(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0;g=ve;ve=ve+608|0;h=g+88|0;f=g+72|0;u=g+64|0;s=g+48|0;a=g+24|0;o=g;c=g+96|0;d=g+92|0;l=e+4|0;p=e+8|0;if((pe[l>>2]|0)>>>0>(pe[p>>2]|0)>>>0){pe[o>>2]=1154;pe[o+4>>2]=2120;pe[o+8>>2]=1133;br(c,1100,o)|0;yr(c,g+16|0)|0}if((2147418112/(n>>>0)|0)>>>0<=t>>>0){pe[a>>2]=1154;pe[a+4>>2]=2121;pe[a+8>>2]=1169;br(c,1100,a)|0;yr(c,g+40|0)|0}a=pe[p>>2]|0;if(a>>>0>=t>>>0){p=1;ve=g;return p|0}do{if(r){if(t){o=t+-1|0;if(!(o&t)){o=11;break}else t=o}else t=-1;t=t>>>16|t;t=t>>>8|t;t=t>>>4|t;t=t>>>2|t;t=(t>>>1|t)+1|0;o=10}else o=10}while(0);if((o|0)==10)if(!t){t=0;o=12}else o=11;if((o|0)==11)if(t>>>0<=a>>>0)o=12;if((o|0)==12){pe[s>>2]=1154;pe[s+4>>2]=2130;pe[s+8>>2]=1217;br(c,1100,s)|0;yr(c,u)|0}r=_e(t,n)|0;do{if(!i){o=ot(pe[e>>2]|0,r,d,1)|0;if(!o){p=0;ve=g;return p|0}else{pe[e>>2]=o;break}}else{a=at(r,d)|0;if(!a){p=0;ve=g;return p|0}On[i&0](a,pe[e>>2]|0,pe[l>>2]|0);o=pe[e>>2]|0;do{if(o)if(!(o&7)){Dn[pe[104>>2]&1](o,0,0,1,pe[27]|0)|0;break}else{pe[f>>2]=1154;pe[f+4>>2]=2499;pe[f+8>>2]=1516;br(c,1100,f)|0;yr(c,h)|0;break}}while(0);pe[e>>2]=a}}while(0);o=pe[d>>2]|0;if(o>>>0>r>>>0)t=(o>>>0)/(n>>>0)|0;pe[p>>2]=t;p=1;ve=g;return p|0}function ot(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0;l=ve;ve=ve+592|0;u=l+48|0;o=l+24|0;i=l;s=l+72|0;a=l+68|0;if(e&7){pe[i>>2]=1154;pe[i+4>>2]=2499;pe[i+8>>2]=1494;br(s,1100,i)|0;yr(s,l+16|0)|0;u=0;ve=l;return u|0}if(t>>>0>2147418112){pe[o>>2]=1154;pe[o+4>>2]=2499;pe[o+8>>2]=1387;br(s,1100,o)|0;yr(s,l+40|0)|0;u=0;ve=l;return u|0}pe[a>>2]=t;n=Dn[pe[104>>2]&1](e,t,a,n,pe[27]|0)|0;if(r)pe[r>>2]=pe[a>>2];if(!(n&7)){u=n;ve=l;return u|0}pe[u>>2]=1154;pe[u+4>>2]=2551;pe[u+8>>2]=1440;br(s,1100,u)|0;yr(s,l+64|0)|0;u=n;ve=l;return u|0}function at(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0;u=ve;ve=ve+592|0;a=u+48|0;s=u+24|0;r=u;o=u+72|0;i=u+68|0;n=e+3&-4;n=(n|0)!=0?n:4;if(n>>>0>2147418112){pe[r>>2]=1154;pe[r+4>>2]=2499;pe[r+8>>2]=1387;br(o,1100,r)|0;yr(o,u+16|0)|0;s=0;ve=u;return s|0}pe[i>>2]=n;r=Dn[pe[104>>2]&1](0,n,i,1,pe[27]|0)|0;e=pe[i>>2]|0;if(t)pe[t>>2]=e;if((r|0)==0|e>>>0>>0){pe[s>>2]=1154;pe[s+4>>2]=2499;pe[s+8>>2]=1413;br(o,1100,s)|0;yr(o,u+40|0)|0;s=0;ve=u;return s|0}if(!(r&7)){s=r;ve=u;return s|0}pe[a>>2]=1154;pe[a+4>>2]=2526;pe[a+8>>2]=1440;br(o,1100,a)|0;yr(o,u+64|0)|0;s=r;ve=u;return s|0}function st(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0;F=ve;ve=ve+960|0;L=F+232|0;D=F+216|0;I=F+208|0;R=F+192|0;O=F+184|0;A=F+168|0;E=F+160|0;k=F+144|0;M=F+136|0;S=F+120|0;T=F+112|0;w=F+96|0;y=F+88|0;_=F+72|0;v=F+64|0;m=F+48|0;f=F+40|0;d=F+24|0;h=F+16|0;c=F;C=F+440|0;N=F+376|0;j=F+304|0;g=F+236|0;if((t|0)==0|n>>>0>11){e=0;ve=F;return e|0}pe[e>>2]=t;i=j;o=i+68|0;do{pe[i>>2]=0;i=i+4|0}while((i|0)<(o|0));o=0;do{i=de[r+o>>0]|0;if(i<<24>>24){P=j+((i&255)<<2)|0;pe[P>>2]=(pe[P>>2]|0)+1}o=o+1|0}while((o|0)!=(t|0));o=0;l=1;a=0;s=-1;u=0;while(1){i=pe[j+(l<<2)>>2]|0;if(!i)pe[e+28+(l+-1<<2)>>2]=0;else{P=l+-1|0;pe[N+(P<<2)>>2]=o;o=i+o|0;x=16-l|0;pe[e+28+(P<<2)>>2]=(o+-1<>2]=u;pe[g+(l<<2)>>2]=u;a=a>>>0>l>>>0?a:l;s=s>>>0>>0?s:l;u=i+u|0}l=l+1|0;if((l|0)==17){P=a;break}else o=o<<1}pe[e+4>>2]=u;o=e+172|0;do{if(u>>>0>(pe[o>>2]|0)>>>0){pe[o>>2]=u;if(u){i=u+-1|0;if(i&u)p=14}else{i=-1;p=14}if((p|0)==14){x=i>>>16|i;x=x>>>8|x;x=x>>>4|x;x=x>>>2|x;x=(x>>>1|x)+1|0;pe[o>>2]=x>>>0>t>>>0?t:x}a=e+176|0;i=pe[a>>2]|0;do{if(i){x=pe[i+-4>>2]|0;i=i+-8|0;if(!((x|0)!=0?(x|0)==(~pe[i>>2]|0):0)){pe[c>>2]=1154;pe[c+4>>2]=644;pe[c+8>>2]=1863;br(C,1100,c)|0;yr(C,h)|0}if(!(i&7)){Dn[pe[104>>2]&1](i,0,0,1,pe[27]|0)|0;break}else{pe[d>>2]=1154;pe[d+4>>2]=2499;pe[d+8>>2]=1516;br(C,1100,d)|0;yr(C,f)|0;break}}}while(0);o=pe[o>>2]|0;o=(o|0)!=0?o:1;i=at((o<<1)+8|0,0)|0;if(!i){pe[a>>2]=0;i=0;break}else{pe[i+4>>2]=o;pe[i>>2]=~o;pe[a>>2]=i+8;p=25;break}}else p=25}while(0);e:do{if((p|0)==25){x=e+24|0;de[x>>0]=s;de[e+25>>0]=P;o=e+176|0;a=0;do{b=de[r+a>>0]|0;i=b&255;if(b<<24>>24){if(!(pe[j+(i<<2)>>2]|0)){pe[m>>2]=1154;pe[m+4>>2]=2273;pe[m+8>>2]=1261;br(C,1100,m)|0;yr(C,v)|0}b=g+(i<<2)|0;i=pe[b>>2]|0;pe[b>>2]=i+1;if(i>>>0>=u>>>0){pe[_>>2]=1154;pe[_+4>>2]=2277;pe[_+8>>2]=1274;br(C,1100,_)|0;yr(C,y)|0}Q[(pe[o>>2]|0)+(i<<1)>>1]=a}a=a+1|0}while((a|0)!=(t|0));i=de[x>>0]|0;y=(i&255)>>>0>>0?n:0;b=e+8|0;pe[b>>2]=y;_=(y|0)!=0;if(_){v=1<>>0>(pe[i>>2]|0)>>>0){pe[i>>2]=v;a=e+168|0;i=pe[a>>2]|0;do{if(i){m=pe[i+-4>>2]|0;i=i+-8|0;if(!((m|0)!=0?(m|0)==(~pe[i>>2]|0):0)){pe[w>>2]=1154;pe[w+4>>2]=644;pe[w+8>>2]=1863;br(C,1100,w)|0;yr(C,T)|0}if(!(i&7)){Dn[pe[104>>2]&1](i,0,0,1,pe[27]|0)|0;break}else{pe[S>>2]=1154;pe[S+4>>2]=2499;pe[S+8>>2]=1516;br(C,1100,S)|0;yr(C,M)|0;break}}}while(0);i=v<<2;o=at(i+8|0,0)|0;if(!o){pe[a>>2]=0;i=0;break e}else{M=o+8|0;pe[o+4>>2]=v;pe[o>>2]=~v;pe[a>>2]=M;o=M;break}}else{o=e+168|0;i=v<<2;a=o;o=pe[o>>2]|0}}while(0);Vr(o|0,-1,i|0)|0;p=e+176|0;m=1;do{if(pe[j+(m<<2)>>2]|0){t=y-m|0;g=1<>2]|0;if(o>>>0>=16){pe[k>>2]=1154;pe[k+4>>2]=1953;pe[k+8>>2]=1737;br(C,1100,k)|0;yr(C,E)|0}i=pe[e+28+(o<<2)>>2]|0;if(!i)d=-1;else d=(i+-1|0)>>>(16-m|0);if(s>>>0<=d>>>0){f=(pe[e+96+(o<<2)>>2]|0)-s|0;h=m<<16;do{i=me[(pe[p>>2]|0)+(f+s<<1)>>1]|0;if((ge[r+i>>0]|0|0)!=(m|0)){pe[A>>2]=1154;pe[A+4>>2]=2319;pe[A+8>>2]=1303;br(C,1100,A)|0;yr(C,O)|0}c=s<>>0>=v>>>0){pe[R>>2]=1154;pe[R+4>>2]=2325;pe[R+8>>2]=1337;br(C,1100,R)|0;yr(C,I)|0}i=pe[a>>2]|0;if((pe[i+(u<<2)>>2]|0)!=-1){pe[D>>2]=1154;pe[D+4>>2]=2327;pe[D+8>>2]=1360;br(C,1100,D)|0;yr(C,L)|0;i=pe[a>>2]|0}pe[i+(u<<2)>>2]=o;l=l+1|0}while(l>>>0>>0);s=s+1|0}while(s>>>0<=d>>>0)}}m=m+1|0}while(y>>>0>=m>>>0);i=de[x>>0]|0}o=e+96|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N>>2]|0);o=e+100|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+4>>2]|0);o=e+104|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+8>>2]|0);o=e+108|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+12>>2]|0);o=e+112|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+16>>2]|0);o=e+116|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+20>>2]|0);o=e+120|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+24>>2]|0);o=e+124|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+28>>2]|0);o=e+128|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+32>>2]|0);o=e+132|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+36>>2]|0);o=e+136|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+40>>2]|0);o=e+140|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+44>>2]|0);o=e+144|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+48>>2]|0);o=e+148|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+52>>2]|0);o=e+152|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+56>>2]|0);o=e+156|0;pe[o>>2]=(pe[o>>2]|0)-(pe[N+60>>2]|0);o=e+16|0;pe[o>>2]=0;a=e+20|0;pe[a>>2]=i&255;t:do{if(_){while(1){if(!n)break t;i=n+-1|0;if(!(pe[j+(n<<2)>>2]|0))n=i;else break}pe[o>>2]=pe[e+28+(i<<2)>>2];i=y+1|0;pe[a>>2]=i;if(i>>>0<=P>>>0){while(1){if(pe[j+(i<<2)>>2]|0)break;i=i+1|0;if(i>>>0>P>>>0)break t}pe[a>>2]=i}}}while(0);pe[e+92>>2]=-1;pe[e+160>>2]=1048575;pe[e+12>>2]=32-(pe[b>>2]|0);i=1}}while(0);e=i;ve=F;return e|0}function ut(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0;if(!e){i=zr(t)|0;if(!r){r=i;return r|0}if(!i)o=0;else o=qr(i)|0;pe[r>>2]=o;r=i;return r|0}if(!t){Ur(e);if(!r){r=0;return r|0}pe[r>>2]=0;r=0;return r|0}i=Xr(e,t)|0;o=(i|0)!=0;if(o|n^1)o=o?i:e;else{i=Xr(e,t)|0;o=(i|0)==0?e:i}if(!r){r=i;return r|0}t=qr(o)|0;pe[r>>2]=t;r=i;return r|0}function lt(e,t,r){e=e|0;t=t|0;r=r|0;var n=0;if(!((e|0)!=0&t>>>0>73&(r|0)!=0)){r=0;return r|0}if((pe[r>>2]|0)!=40|t>>>0<74){r=0;return r|0}if(((ge[e>>0]|0)<<8|(ge[e+1>>0]|0)|0)!=18552){r=0;return r|0}if(((ge[e+2>>0]|0)<<8|(ge[e+3>>0]|0))>>>0<74){r=0;return r|0}if(((ge[e+7>>0]|0)<<16|(ge[e+6>>0]|0)<<24|(ge[e+8>>0]|0)<<8|(ge[e+9>>0]|0))>>>0>t>>>0){r=0;return r|0}pe[r+4>>2]=(ge[e+12>>0]|0)<<8|(ge[e+13>>0]|0);pe[r+8>>2]=(ge[e+14>>0]|0)<<8|(ge[e+15>>0]|0);pe[r+12>>2]=ge[e+16>>0];pe[r+16>>2]=ge[e+17>>0];t=e+18|0;n=r+32|0;pe[n>>2]=ge[t>>0];pe[n+4>>2]=0;t=de[t>>0]|0;pe[r+20>>2]=t<<24>>24==0|t<<24>>24==9?8:16;pe[r+24>>2]=(ge[e+26>>0]|0)<<16|(ge[e+25>>0]|0)<<24|(ge[e+27>>0]|0)<<8|(ge[e+28>>0]|0);pe[r+28>>2]=(ge[e+30>>0]|0)<<16|(ge[e+29>>0]|0)<<24|(ge[e+31>>0]|0)<<8|(ge[e+32>>0]|0);r=1;return r|0}function ct(e){e=e|0;Oe(e|0)|0;Ut()}function ft(e){e=e|0;var t=0,r=0,n=0,i=0,o=0;o=ve;ve=ve+544|0;i=o;n=o+24|0;t=pe[e+20>>2]|0;if(t)ht(t);t=e+4|0;r=pe[t>>2]|0;if(!r){i=e+16|0;de[i>>0]=0;ve=o;return}if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[i>>2]=1154;pe[i+4>>2]=2499;pe[i+8>>2]=1516;br(n,1100,i)|0;yr(n,o+16|0)|0}pe[t>>2]=0;pe[e+8>>2]=0;pe[e+12>>2]=0;i=e+16|0;de[i>>0]=0;ve=o;return}function ht(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;d=ve;ve=ve+640|0;h=d+112|0;f=d+96|0;c=d+88|0;l=d+72|0;u=d+64|0;s=d+48|0;n=d+40|0;o=d+24|0;i=d+16|0;r=d;a=d+120|0;if(!e){ve=d;return}t=pe[e+168>>2]|0;do{if(t){p=pe[t+-4>>2]|0;t=t+-8|0;if(!((p|0)!=0?(p|0)==(~pe[t>>2]|0):0)){pe[r>>2]=1154;pe[r+4>>2]=644;pe[r+8>>2]=1863;br(a,1100,r)|0;yr(a,i)|0}if(!(t&7)){Dn[pe[104>>2]&1](t,0,0,1,pe[27]|0)|0;break}else{pe[o>>2]=1154;pe[o+4>>2]=2499;pe[o+8>>2]=1516;br(a,1100,o)|0;yr(a,n)|0;break}}}while(0);t=pe[e+176>>2]|0;do{if(t){p=pe[t+-4>>2]|0;t=t+-8|0;if(!((p|0)!=0?(p|0)==(~pe[t>>2]|0):0)){pe[s>>2]=1154;pe[s+4>>2]=644;pe[s+8>>2]=1863;br(a,1100,s)|0;yr(a,u)|0}if(!(t&7)){Dn[pe[104>>2]&1](t,0,0,1,pe[27]|0)|0;break}else{pe[l>>2]=1154;pe[l+4>>2]=2499;pe[l+8>>2]=1516;br(a,1100,l)|0;yr(a,c)|0;break}}}while(0);if(!(e&7)){Dn[pe[104>>2]&1](e,0,0,1,pe[27]|0)|0;ve=d;return}else{pe[f>>2]=1154;pe[f+4>>2]=2499;pe[f+8>>2]=1516;br(a,1100,f)|0;yr(a,h)|0;ve=d;return}}function dt(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+560|0;a=c+40|0;s=c+24|0;t=c;o=c+48|0;i=e+8|0;r=pe[i>>2]|0;if((r+-1|0)>>>0>=8192){pe[t>>2]=1154;pe[t+4>>2]=2997;pe[t+8>>2]=1541;br(o,1100,t)|0;yr(o,c+16|0)|0}pe[e>>2]=r;n=e+20|0;t=pe[n>>2]|0;if(!t){t=at(180,0)|0;if(!t)t=0;else{l=t+164|0;pe[l>>2]=0;pe[l+4>>2]=0;pe[l+8>>2]=0;pe[l+12>>2]=0}pe[n>>2]=t;l=t;u=pe[e>>2]|0}else{l=t;u=r}if(!(pe[i>>2]|0)){pe[s>>2]=1154;pe[s+4>>2]=903;pe[s+8>>2]=1781;br(o,1100,s)|0;yr(o,a)|0;o=pe[e>>2]|0}else o=u;i=pe[e+4>>2]|0;if(o>>>0>16){r=o;t=0}else{e=0;l=st(l,u,i,e)|0;ve=c;return l|0}while(1){n=t+1|0;if(r>>>0>3){r=r>>>1;t=n}else{r=n;break}}e=t+2+((r|0)!=32&1<>>0>>0&1)|0;e=e>>>0<11?e&255:11;l=st(l,u,i,e)|0;ve=c;return l|0}function pt(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0;L=ve;ve=ve+800|0;A=L+256|0;E=L+240|0;k=L+232|0;C=L+216|0;P=L+208|0;M=L+192|0;S=L+184|0;T=L+168|0;w=L+160|0;x=L+144|0;b=L+136|0;y=L+120|0;_=L+112|0;v=L+96|0;m=L+88|0;g=L+72|0;f=L+64|0;c=L+48|0;s=L+40|0;u=L+24|0;o=L+16|0;i=L;I=L+288|0;D=L+264|0;O=gt(e,14)|0;if(!O){pe[t>>2]=0;r=t+4|0;n=pe[r>>2]|0;if(n){if(!(n&7))Dn[pe[104>>2]&1](n,0,0,1,pe[27]|0)|0;else{pe[i>>2]=1154;pe[i+4>>2]=2499;pe[i+8>>2]=1516;br(I,1100,i)|0;yr(I,o)|0}pe[r>>2]=0;pe[t+8>>2]=0;pe[t+12>>2]=0}de[t+16>>0]=0;r=t+20|0;n=pe[r>>2]|0;if(!n){t=1;ve=L;return t|0}ht(n);pe[r>>2]=0;t=1;ve=L;return t|0}d=t+4|0;p=t+8|0;r=pe[p>>2]|0;if((r|0)!=(O|0)){if(r>>>0<=O>>>0){do{if((pe[t+12>>2]|0)>>>0>>0){if(it(d,O,(r+1|0)==(O|0),1,0)|0){r=pe[p>>2]|0;break}de[t+16>>0]=1;t=0;ve=L;return t|0}}while(0);Vr((pe[d>>2]|0)+r|0,0,O-r|0)|0}pe[p>>2]=O}Vr(pe[d>>2]|0,0,O|0)|0;h=e+20|0;r=pe[h>>2]|0;if((r|0)<5){o=e+4|0;a=e+8|0;i=e+16|0;do{n=pe[o>>2]|0;if((n|0)==(pe[a>>2]|0))n=0;else{pe[o>>2]=n+1;n=ge[n>>0]|0}r=r+8|0;pe[h>>2]=r;if((r|0)>=33){pe[u>>2]=1154;pe[u+4>>2]=3199;pe[u+8>>2]=1650;br(I,1100,u)|0;yr(I,s)|0;r=pe[h>>2]|0}n=n<<32-r|pe[i>>2];pe[i>>2]=n}while((r|0)<5)}else{n=e+16|0;i=n;n=pe[n>>2]|0}l=n>>>27;pe[i>>2]=n<<5;pe[h>>2]=r+-5;if((l+-1|0)>>>0>20){t=0;ve=L;return t|0}pe[D+20>>2]=0;pe[D>>2]=0;pe[D+4>>2]=0;pe[D+8>>2]=0;pe[D+12>>2]=0;de[D+16>>0]=0;r=D+4|0;n=D+8|0;e:do{if(it(r,21,0,1,0)|0){s=pe[n>>2]|0;u=pe[r>>2]|0;Vr(u+s|0,0,21-s|0)|0;pe[n>>2]=21;if(l){i=e+4|0;o=e+8|0;a=e+16|0;s=0;do{r=pe[h>>2]|0;if((r|0)<3)do{n=pe[i>>2]|0;if((n|0)==(pe[o>>2]|0))n=0;else{pe[i>>2]=n+1;n=ge[n>>0]|0}r=r+8|0;pe[h>>2]=r;if((r|0)>=33){pe[c>>2]=1154;pe[c+4>>2]=3199;pe[c+8>>2]=1650;br(I,1100,c)|0;yr(I,f)|0;r=pe[h>>2]|0}n=n<<32-r|pe[a>>2];pe[a>>2]=n}while((r|0)<3);else n=pe[a>>2]|0;pe[a>>2]=n<<3;pe[h>>2]=r+-3;de[u+(ge[1611+s>>0]|0)>>0]=n>>>29;s=s+1|0}while((s|0)!=(l|0))}if(dt(D)|0){s=e+4|0;u=e+8|0;l=e+16|0;n=0;t:while(1){a=O-n|0;r=mt(e,D)|0;r:do{if(r>>>0<17){if((pe[p>>2]|0)>>>0<=n>>>0){pe[g>>2]=1154;pe[g+4>>2]=903;pe[g+8>>2]=1781;br(I,1100,g)|0;yr(I,m)|0}de[(pe[d>>2]|0)+n>>0]=r;r=n+1|0}else switch(r|0){case 17:{r=pe[h>>2]|0;if((r|0)<3)do{i=pe[s>>2]|0;if((i|0)==(pe[u>>2]|0))i=0;else{pe[s>>2]=i+1;i=ge[i>>0]|0}r=r+8|0;pe[h>>2]=r;if((r|0)>=33){pe[v>>2]=1154;pe[v+4>>2]=3199;pe[v+8>>2]=1650;br(I,1100,v)|0;yr(I,_)|0;r=pe[h>>2]|0}i=i<<32-r|pe[l>>2];pe[l>>2]=i}while((r|0)<3);else i=pe[l>>2]|0;pe[l>>2]=i<<3;pe[h>>2]=r+-3;r=(i>>>29)+3|0;if(r>>>0>a>>>0){r=0;break e}r=r+n|0;break r}case 18:{r=pe[h>>2]|0;if((r|0)<7)do{i=pe[s>>2]|0;if((i|0)==(pe[u>>2]|0))i=0;else{pe[s>>2]=i+1;i=ge[i>>0]|0}r=r+8|0;pe[h>>2]=r;if((r|0)>=33){pe[y>>2]=1154;pe[y+4>>2]=3199;pe[y+8>>2]=1650;br(I,1100,y)|0;yr(I,b)|0;r=pe[h>>2]|0}i=i<<32-r|pe[l>>2];pe[l>>2]=i}while((r|0)<7);else i=pe[l>>2]|0;pe[l>>2]=i<<7;pe[h>>2]=r+-7;r=(i>>>25)+11|0;if(r>>>0>a>>>0){r=0;break e}r=r+n|0;break r}default:{if((r+-19|0)>>>0>=2){R=90;break t}o=pe[h>>2]|0;if((r|0)==19){if((o|0)<2){i=o;while(1){r=pe[s>>2]|0;if((r|0)==(pe[u>>2]|0))o=0;else{pe[s>>2]=r+1;o=ge[r>>0]|0}r=i+8|0;pe[h>>2]=r;if((r|0)>=33){pe[x>>2]=1154;pe[x+4>>2]=3199;pe[x+8>>2]=1650;br(I,1100,x)|0;yr(I,w)|0;r=pe[h>>2]|0}i=o<<32-r|pe[l>>2];pe[l>>2]=i;if((r|0)<2)i=r;else break}}else{i=pe[l>>2]|0;r=o}pe[l>>2]=i<<2;pe[h>>2]=r+-2;o=(i>>>30)+3|0}else{if((o|0)<6){i=o;while(1){r=pe[s>>2]|0;if((r|0)==(pe[u>>2]|0))o=0;else{pe[s>>2]=r+1;o=ge[r>>0]|0}r=i+8|0;pe[h>>2]=r;if((r|0)>=33){pe[T>>2]=1154;pe[T+4>>2]=3199;pe[T+8>>2]=1650;br(I,1100,T)|0;yr(I,S)|0;r=pe[h>>2]|0}i=o<<32-r|pe[l>>2];pe[l>>2]=i;if((r|0)<6)i=r;else break}}else{i=pe[l>>2]|0;r=o}pe[l>>2]=i<<6;pe[h>>2]=r+-6;o=(i>>>26)+7|0}if((n|0)==0|o>>>0>a>>>0){r=0;break e}r=n+-1|0;if((pe[p>>2]|0)>>>0<=r>>>0){pe[M>>2]=1154;pe[M+4>>2]=903;pe[M+8>>2]=1781;br(I,1100,M)|0;yr(I,P)|0}i=de[(pe[d>>2]|0)+r>>0]|0;if(!(i<<24>>24)){r=0;break e}r=o+n|0;if(n>>>0>=r>>>0){r=n;break r}do{if((pe[p>>2]|0)>>>0<=n>>>0){pe[C>>2]=1154;pe[C+4>>2]=903;pe[C+8>>2]=1781;br(I,1100,C)|0;yr(I,k)|0}de[(pe[d>>2]|0)+n>>0]=i;n=n+1|0}while((n|0)!=(r|0))}}}while(0);if(O>>>0>r>>>0)n=r;else break}if((R|0)==90){pe[E>>2]=1154;pe[E+4>>2]=3140;pe[E+8>>2]=1632;br(I,1100,E)|0;yr(I,A)|0;r=0;break}if((O|0)==(r|0))r=dt(t)|0;else r=0}else r=0}else{de[D+16>>0]=1;r=0}}while(0);ft(D);t=r;ve=L;return t|0}function gt(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+544|0;s=c+16|0;a=c;o=c+24|0;if(!t){l=0;ve=c;return l|0}if(t>>>0<=16){l=vt(e,t)|0;ve=c;return l|0}u=vt(e,t+-16|0)|0;l=e+20|0;t=pe[l>>2]|0;if((t|0)<16){n=e+4|0;i=e+8|0;r=e+16|0;do{e=pe[n>>2]|0;if((e|0)==(pe[i>>2]|0))e=0;else{pe[n>>2]=e+1;e=ge[e>>0]|0}t=t+8|0;pe[l>>2]=t;if((t|0)>=33){pe[a>>2]=1154;pe[a+4>>2]=3199;pe[a+8>>2]=1650;br(o,1100,a)|0;yr(o,s)|0;t=pe[l>>2]|0}e=e<<32-t|pe[r>>2];pe[r>>2]=e}while((t|0)<16)}else{e=e+16|0;r=e;e=pe[e>>2]|0}pe[r>>2]=e<<16;pe[l>>2]=t+-16;l=e>>>16|u<<16;ve=c;return l|0}function mt(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0;y=ve;ve=ve+608|0;g=y+88|0;p=y+72|0;h=y+64|0;f=y+48|0;c=y+40|0;d=y+24|0;l=y+16|0;u=y;v=y+96|0;m=pe[t+20>>2]|0;_=e+20|0;s=pe[_>>2]|0;do{if((s|0)<24){a=e+4|0;n=pe[a>>2]|0;i=pe[e+8>>2]|0;r=n>>>0>>0;if((s|0)>=16){if(r){pe[a>>2]=n+1;r=ge[n>>0]|0}else r=0;pe[_>>2]=s+8;a=e+16|0;o=r<<24-s|pe[a>>2];pe[a>>2]=o;break}if(r){o=(ge[n>>0]|0)<<8;r=n+1|0}else{o=0;r=n}if(r>>>0>>0){n=ge[r>>0]|0;r=r+1|0}else n=0;pe[a>>2]=r;pe[_>>2]=s+16;a=e+16|0;o=(n|o)<<16-s|pe[a>>2];pe[a>>2]=o}else{o=e+16|0;a=o;o=pe[o>>2]|0}}while(0);i=(o>>>16)+1|0;do{if(i>>>0<=(pe[m+16>>2]|0)>>>0){n=pe[(pe[m+168>>2]|0)+(o>>>(32-(pe[m+8>>2]|0)|0)<<2)>>2]|0;if((n|0)==-1){pe[u>>2]=1154;pe[u+4>>2]=3244;pe[u+8>>2]=1677;br(v,1100,u)|0;yr(v,l)|0}r=n&65535;n=n>>>16;if((pe[t+8>>2]|0)>>>0<=r>>>0){pe[d>>2]=1154;pe[d+4>>2]=902;pe[d+8>>2]=1781;br(v,1100,d)|0;yr(v,c)|0}if((ge[(pe[t+4>>2]|0)+r>>0]|0|0)!=(n|0)){pe[f>>2]=1154;pe[f+4>>2]=3248;pe[f+8>>2]=1694;br(v,1100,f)|0;yr(v,h)|0}}else{n=pe[m+20>>2]|0;while(1){r=n+-1|0;if(i>>>0>(pe[m+28+(r<<2)>>2]|0)>>>0)n=n+1|0;else break}r=(o>>>(32-n|0))+(pe[m+96+(r<<2)>>2]|0)|0;if(r>>>0<(pe[t>>2]|0)>>>0){r=me[(pe[m+176>>2]|0)+(r<<1)>>1]|0;break}pe[p>>2]=1154;pe[p+4>>2]=3266;pe[p+8>>2]=1632;br(v,1100,p)|0;yr(v,g)|0;_=0;ve=y;return _|0}}while(0);pe[a>>2]=pe[a>>2]<>2]=(pe[_>>2]|0)-n;_=r;ve=y;return _|0}function vt(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+560|0;s=c+40|0;u=c+24|0;r=c;a=c+48|0;if(t>>>0>=33){pe[r>>2]=1154;pe[r+4>>2]=3190;pe[r+8>>2]=1634;br(a,1100,r)|0;yr(a,c+16|0)|0}l=e+20|0;r=pe[l>>2]|0;if((r|0)>=(t|0)){o=e+16|0;a=o;o=pe[o>>2]|0;s=r;u=32-t|0;u=o>>>u;o=o<>2]=o;t=s-t|0;pe[l>>2]=t;ve=c;return u|0}i=e+4|0;o=e+8|0;n=e+16|0;do{e=pe[i>>2]|0;if((e|0)==(pe[o>>2]|0))e=0;else{pe[i>>2]=e+1;e=ge[e>>0]|0}r=r+8|0;pe[l>>2]=r;if((r|0)>=33){pe[u>>2]=1154;pe[u+4>>2]=3199;pe[u+8>>2]=1650;br(a,1100,u)|0;yr(a,s)|0;r=pe[l>>2]|0}e=e<<32-r|pe[n>>2];pe[n>>2]=e}while((r|0)<(t|0));u=32-t|0;u=e>>>u;s=e<>2]=s;t=r-t|0;pe[l>>2]=t;ve=c;return u|0}function _t(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0;p=ve;ve=ve+544|0;h=p+16|0;f=p;c=p+24|0;if((e|0)==0|t>>>0<62){d=0;ve=p;return d|0}l=at(300,0)|0;if(!l){d=0;ve=p;return d|0}pe[l>>2]=519686845;r=l+4|0;pe[r>>2]=0;n=l+8|0;pe[n>>2]=0;u=l+88|0;i=l+136|0;o=l+160|0;a=u;s=a+44|0;do{pe[a>>2]=0;a=a+4|0}while((a|0)<(s|0));de[u+44>>0]=0;g=l+184|0;a=l+208|0;s=l+232|0;m=l+252|0;pe[m>>2]=0;pe[m+4>>2]=0;pe[m+8>>2]=0;de[m+12>>0]=0;m=l+268|0;pe[m>>2]=0;pe[m+4>>2]=0;pe[m+8>>2]=0;de[m+12>>0]=0;m=l+284|0;pe[m>>2]=0;pe[m+4>>2]=0;pe[m+8>>2]=0;de[m+12>>0]=0;pe[i>>2]=0;pe[i+4>>2]=0;pe[i+8>>2]=0;pe[i+12>>2]=0;pe[i+16>>2]=0;de[i+20>>0]=0;pe[o>>2]=0;pe[o+4>>2]=0;pe[o+8>>2]=0;pe[o+12>>2]=0;pe[o+16>>2]=0;de[o+20>>0]=0;pe[g>>2]=0;pe[g+4>>2]=0;pe[g+8>>2]=0;pe[g+12>>2]=0;pe[g+16>>2]=0;de[g+20>>0]=0;pe[a>>2]=0;pe[a+4>>2]=0;pe[a+8>>2]=0;pe[a+12>>2]=0;pe[a+16>>2]=0;de[a+20>>0]=0;pe[s>>2]=0;pe[s+4>>2]=0;pe[s+8>>2]=0;pe[s+12>>2]=0;de[s+16>>0]=0;do{if(((t>>>0>=74?((ge[e>>0]|0)<<8|(ge[e+1>>0]|0)|0)==18552:0)?((ge[e+2>>0]|0)<<8|(ge[e+3>>0]|0))>>>0>=74:0)?((ge[e+7>>0]|0)<<16|(ge[e+6>>0]|0)<<24|(ge[e+8>>0]|0)<<8|(ge[e+9>>0]|0))>>>0<=t>>>0:0){pe[u>>2]=e;pe[r>>2]=e;pe[n>>2]=t;if(Ct(l)|0){r=pe[u>>2]|0;if((ge[r+39>>0]|0)<<8|(ge[r+40>>0]|0)){if(!(kt(l)|0))break;if(!(Et(l)|0))break;r=pe[u>>2]|0}if(!((ge[r+55>>0]|0)<<8|(ge[r+56>>0]|0))){m=l;ve=p;return m|0}if(At(l)|0?Ot(l)|0:0){m=l;ve=p;return m|0}}}else d=7}while(0);if((d|0)==7)pe[u>>2]=0;Nt(l);if(!(l&7)){Dn[pe[104>>2]&1](l,0,0,1,pe[27]|0)|0;m=0;ve=p;return m|0}else{pe[f>>2]=1154;pe[f+4>>2]=2499;pe[f+8>>2]=1516;br(c,1100,f)|0;yr(c,h)|0;m=0;ve=p;return m|0}return 0}function yt(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+544|0;l=c;u=c+24|0;o=pe[e+88>>2]|0;s=(ge[o+70+(i<<2)+1>>0]|0)<<16|(ge[o+70+(i<<2)>>0]|0)<<24|(ge[o+70+(i<<2)+2>>0]|0)<<8|(ge[o+70+(i<<2)+3>>0]|0);a=i+1|0;if(a>>>0<(ge[o+16>>0]|0)>>>0)o=(ge[o+70+(a<<2)+1>>0]|0)<<16|(ge[o+70+(a<<2)>>0]|0)<<24|(ge[o+70+(a<<2)+2>>0]|0)<<8|(ge[o+70+(a<<2)+3>>0]|0);else o=pe[e+8>>2]|0;if(o>>>0>s>>>0){u=e+4|0;u=pe[u>>2]|0;u=u+s|0;l=o-s|0;l=bt(e,u,l,t,r,n,i)|0;ve=c;return l|0}pe[l>>2]=1154;pe[l+4>>2]=3704;pe[l+8>>2]=1792;br(u,1100,l)|0;yr(u,c+16|0)|0;u=e+4|0;u=pe[u>>2]|0;u=u+s|0;l=o-s|0;l=bt(e,u,l,t,r,n,i)|0;ve=c;return l|0}function bt(e,t,r,n,i,o,a){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;var s=0,u=0,l=0,c=0;c=pe[e+88>>2]|0;u=((ge[c+12>>0]|0)<<8|(ge[c+13>>0]|0))>>>a;l=((ge[c+14>>0]|0)<<8|(ge[c+15>>0]|0))>>>a;u=u>>>0>1?(u+3|0)>>>2:1;l=l>>>0>1?(l+3|0)>>>2:1;c=c+18|0;a=de[c>>0]|0;a=_e(a<<24>>24==0|a<<24>>24==9?8:16,u)|0;if(o)if((o&3|0)==0&a>>>0<=o>>>0)a=o;else{e=0;return e|0}if((_e(a,l)|0)>>>0>i>>>0){e=0;return e|0}o=(u+1|0)>>>1;s=(l+1|0)>>>1;if(!r){e=0;return e|0}pe[e+92>>2]=t;pe[e+96>>2]=t;pe[e+104>>2]=r;pe[e+100>>2]=t+r;pe[e+108>>2]=0;pe[e+112>>2]=0;switch(ge[c>>0]|0|0){case 0:{Rt(e,n,i,a,u,l,o,s)|0;e=1;return e|0}case 4:case 6:case 5:case 3:case 2:{It(e,n,i,a,u,l,o,s)|0;e=1;return e|0}case 9:{Dt(e,n,i,a,u,l,o,s)|0;e=1;return e|0}case 8:case 7:{Lt(e,n,i,a,u,l,o,s)|0;e=1;return e|0}default:{e=0;return e|0}}return 0}function xt(e,t){e=e|0;t=t|0;var r=0,n=0;n=ve;ve=ve+48|0;r=n;pe[r>>2]=40;lt(e,t,r)|0;ve=n;return pe[r+4>>2]|0}function wt(e,t){e=e|0;t=t|0;var r=0,n=0;n=ve;ve=ve+48|0;r=n;pe[r>>2]=40;lt(e,t,r)|0;ve=n;return pe[r+8>>2]|0}function Tt(e,t){e=e|0;t=t|0;var r=0,n=0;n=ve;ve=ve+48|0;r=n;pe[r>>2]=40;lt(e,t,r)|0;ve=n;return pe[r+12>>2]|0}function St(e,t){e=e|0;t=t|0;var r=0,n=0;n=ve;ve=ve+48|0;r=n;pe[r>>2]=40;lt(e,t,r)|0;ve=n;return pe[r+32>>2]|0}function Mt(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0,s=0,u=0,l=0;u=ve;ve=ve+576|0;a=u+56|0;o=u+40|0;i=u+64|0;l=u;pe[l>>2]=40;lt(e,t,l)|0;n=(((pe[l+4>>2]|0)>>>r)+3|0)>>>2;t=(((pe[l+8>>2]|0)>>>r)+3|0)>>>2;r=l+32|0;e=pe[r+4>>2]|0;do{switch(pe[r>>2]|0){case 0:{if(!e)e=8;else s=13;break}case 1:{if(!e)s=12;else s=13;break}case 2:{if(!e)s=12;else s=13;break}case 3:{if(!e)s=12;else s=13;break}case 4:{if(!e)s=12;else s=13;break}case 5:{if(!e)s=12;else s=13;break}case 6:{if(!e)s=12;else s=13;break}case 7:{if(!e)s=12;else s=13;break}case 8:{if(!e)s=12;else s=13;break}case 9:{if(!e)e=8;else s=13;break}default:s=13}}while(0);if((s|0)==12)e=16;else if((s|0)==13){pe[o>>2]=1154;pe[o+4>>2]=2663;pe[o+8>>2]=1535;br(i,1100,o)|0;yr(i,a)|0;e=0}l=_e(_e(t,n)|0,e)|0;ve=u;return l|0}function Pt(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0;p=ve;ve=ve+608|0;h=p+80|0;d=p+64|0;s=p+56|0;a=p+40|0;c=p+88|0;g=p;f=p+84|0;pe[g>>2]=40;lt(e,t,g)|0;u=(((pe[g+4>>2]|0)>>>i)+3|0)>>>2;g=g+32|0;o=pe[g+4>>2]|0;do{switch(pe[g>>2]|0){case 0:{if(!o)o=8;else l=13;break}case 1:{if(!o)l=12;else l=13;break}case 2:{if(!o)l=12;else l=13;break}case 3:{if(!o)l=12;else l=13;break}case 4:{if(!o)l=12;else l=13;break}case 5:{if(!o)l=12;else l=13;break}case 6:{if(!o)l=12;else l=13;break}case 7:{if(!o)l=12;else l=13;break}case 8:{if(!o)l=12;else l=13;break}case 9:{if(!o)o=8;else l=13;break}default:l=13}}while(0);if((l|0)==12)o=16;else if((l|0)==13){pe[a>>2]=1154;pe[a+4>>2]=2663;pe[a+8>>2]=1535;br(c,1100,a)|0;yr(c,s)|0;o=0}s=_e(o,u)|0;a=_t(e,t)|0;pe[f>>2]=r;o=(a|0)==0;if(!(i>>>0>15|(n>>>0<8|o))?(pe[a>>2]|0)==519686845:0)yt(a,f,n,s,i)|0;if(o){ve=p;return}if((pe[a>>2]|0)!=519686845){ve=p;return}Nt(a);if(!(a&7)){Dn[pe[104>>2]&1](a,0,0,1,pe[27]|0)|0;ve=p;return}else{pe[d>>2]=1154;pe[d+4>>2]=2499;pe[d+8>>2]=1516;br(c,1100,d)|0;yr(c,h)|0;ve=p;return}}function Ct(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0;a=e+92|0;n=pe[e+4>>2]|0;o=e+88|0;i=pe[o>>2]|0;t=(ge[i+68>>0]|0)<<8|(ge[i+67>>0]|0)<<16|(ge[i+69>>0]|0);r=n+t|0;i=(ge[i+65>>0]|0)<<8|(ge[i+66>>0]|0);if(!i){e=0;return e|0}pe[a>>2]=r;pe[e+96>>2]=r;pe[e+104>>2]=i;pe[e+100>>2]=n+(i+t);pe[e+108>>2]=0;pe[e+112>>2]=0;if(!(pt(a,e+116|0)|0)){e=0;return e|0}t=pe[o>>2]|0;do{if(!((ge[t+39>>0]|0)<<8|(ge[t+40>>0]|0))){if(!((ge[t+55>>0]|0)<<8|(ge[t+56>>0]|0))){e=0;return e|0}}else{if(!(pt(a,e+140|0)|0)){e=0;return e|0}if(pt(a,e+188|0)|0){t=pe[o>>2]|0;break}else{e=0;return e|0}}}while(0);if((ge[t+55>>0]|0)<<8|(ge[t+56>>0]|0)){if(!(pt(a,e+164|0)|0)){e=0;return e|0}if(!(pt(a,e+212|0)|0)){e=0;return e|0}}e=1;return e|0}function kt(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;p=ve;ve=ve+592|0;u=p+16|0;s=p;a=p+72|0;d=p+24|0;n=e+88|0;t=pe[n>>2]|0;h=(ge[t+39>>0]|0)<<8|(ge[t+40>>0]|0);c=e+236|0;o=e+240|0;r=pe[o>>2]|0;if((r|0)!=(h|0)){if(r>>>0<=h>>>0){do{if((pe[e+244>>2]|0)>>>0>>0){if(it(c,h,(r+1|0)==(h|0),4,0)|0){t=pe[o>>2]|0;break}de[e+248>>0]=1;d=0;ve=p;return d|0}else t=r}while(0);Vr((pe[c>>2]|0)+(t<<2)|0,0,h-t<<2|0)|0;t=pe[n>>2]|0}pe[o>>2]=h}l=e+92|0;r=pe[e+4>>2]|0;n=(ge[t+34>>0]|0)<<8|(ge[t+33>>0]|0)<<16|(ge[t+35>>0]|0);i=r+n|0;t=(ge[t+37>>0]|0)<<8|(ge[t+36>>0]|0)<<16|(ge[t+38>>0]|0);if(!t){d=0;ve=p;return d|0}pe[l>>2]=i;pe[e+96>>2]=i;pe[e+104>>2]=t;pe[e+100>>2]=r+(t+n);pe[e+108>>2]=0;pe[e+112>>2]=0;pe[d+20>>2]=0;pe[d>>2]=0;pe[d+4>>2]=0;pe[d+8>>2]=0;pe[d+12>>2]=0;de[d+16>>0]=0;e=d+24|0;pe[d+44>>2]=0;pe[e>>2]=0;pe[e+4>>2]=0;pe[e+8>>2]=0;pe[e+12>>2]=0;de[e+16>>0]=0;if(pt(l,d)|0?(f=d+24|0,pt(l,f)|0):0){if(!(pe[o>>2]|0)){pe[s>>2]=1154;pe[s+4>>2]=903;pe[s+8>>2]=1781;br(a,1100,s)|0;yr(a,u)|0}if(!h)t=1;else{n=0;i=0;o=0;t=0;a=0;e=0;s=0;r=pe[c>>2]|0;while(1){n=(mt(l,d)|0)+n&31;i=(mt(l,f)|0)+i&63;o=(mt(l,d)|0)+o&31;t=(mt(l,d)|0)+t|0;a=(mt(l,f)|0)+a&63;e=(mt(l,d)|0)+e&31;pe[r>>2]=i<<5|n<<11|o|t<<27|a<<21|e<<16;s=s+1|0;if((s|0)==(h|0)){t=1;break}else{t=t&31;r=r+4|0}}}}else t=0;ft(d+24|0);ft(d);d=t;ve=p;return d|0}function Et(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0;M=ve;ve=ve+1024|0;s=M+16|0;a=M;o=M+504|0;S=M+480|0;w=M+284|0;T=M+88|0;x=M+24|0;i=pe[e+88>>2]|0;b=(ge[i+47>>0]|0)<<8|(ge[i+48>>0]|0);y=e+92|0;t=pe[e+4>>2]|0;r=(ge[i+42>>0]|0)<<8|(ge[i+41>>0]|0)<<16|(ge[i+43>>0]|0);n=t+r|0;i=(ge[i+45>>0]|0)<<8|(ge[i+44>>0]|0)<<16|(ge[i+46>>0]|0);if(!i){S=0;ve=M;return S|0}pe[y>>2]=n;pe[e+96>>2]=n;pe[e+104>>2]=i;pe[e+100>>2]=t+(i+r);pe[e+108>>2]=0;pe[e+112>>2]=0;pe[S+20>>2]=0;pe[S>>2]=0;pe[S+4>>2]=0;pe[S+8>>2]=0;pe[S+12>>2]=0;de[S+16>>0]=0;if(pt(y,S)|0){r=0;n=-3;i=-3;while(1){pe[w+(r<<2)>>2]=n;pe[T+(r<<2)>>2]=i;t=(n|0)>2;r=r+1|0;if((r|0)==49)break;else{n=t?-3:n+1|0;i=(t&1)+i|0}}t=x;r=t+64|0;do{pe[t>>2]=0;t=t+4|0}while((t|0)<(r|0));_=e+252|0;r=e+256|0;t=pe[r>>2]|0;e:do{if((t|0)==(b|0))u=13;else{if(t>>>0<=b>>>0){do{if((pe[e+260>>2]|0)>>>0>>0)if(it(_,b,(t+1|0)==(b|0),4,0)|0){t=pe[r>>2]|0;break}else{de[e+264>>0]=1;t=0;break e}}while(0);Vr((pe[_>>2]|0)+(t<<2)|0,0,b-t<<2|0)|0}pe[r>>2]=b;u=13}}while(0);do{if((u|0)==13){if(!b){pe[a>>2]=1154;pe[a+4>>2]=903;pe[a+8>>2]=1781;br(o,1100,a)|0;yr(o,s)|0;t=1;break}n=x+4|0;i=x+8|0;e=x+12|0;o=x+16|0;a=x+20|0;s=x+24|0;u=x+28|0;l=x+32|0;c=x+36|0;f=x+40|0;h=x+44|0;d=x+48|0;p=x+52|0;g=x+56|0;m=x+60|0;v=0;r=pe[_>>2]|0;while(1){t=0;do{P=mt(y,S)|0;_=t<<1;C=x+(_<<2)|0;pe[C>>2]=(pe[C>>2]|0)+(pe[w+(P<<2)>>2]|0)&3;_=x+((_|1)<<2)|0;pe[_>>2]=(pe[_>>2]|0)+(pe[T+(P<<2)>>2]|0)&3;t=t+1|0}while((t|0)!=8);pe[r>>2]=(ge[1725+(pe[n>>2]|0)>>0]|0)<<2|(ge[1725+(pe[x>>2]|0)>>0]|0)|(ge[1725+(pe[i>>2]|0)>>0]|0)<<4|(ge[1725+(pe[e>>2]|0)>>0]|0)<<6|(ge[1725+(pe[o>>2]|0)>>0]|0)<<8|(ge[1725+(pe[a>>2]|0)>>0]|0)<<10|(ge[1725+(pe[s>>2]|0)>>0]|0)<<12|(ge[1725+(pe[u>>2]|0)>>0]|0)<<14|(ge[1725+(pe[l>>2]|0)>>0]|0)<<16|(ge[1725+(pe[c>>2]|0)>>0]|0)<<18|(ge[1725+(pe[f>>2]|0)>>0]|0)<<20|(ge[1725+(pe[h>>2]|0)>>0]|0)<<22|(ge[1725+(pe[d>>2]|0)>>0]|0)<<24|(ge[1725+(pe[p>>2]|0)>>0]|0)<<26|(ge[1725+(pe[g>>2]|0)>>0]|0)<<28|(ge[1725+(pe[m>>2]|0)>>0]|0)<<30;v=v+1|0;if((v|0)==(b|0)){t=1;break}else r=r+4|0}}}while(0)}else t=0;ft(S);C=t;ve=M;return C|0}function At(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0;h=ve;ve=ve+560|0;u=h+16|0;s=h;a=h+48|0;f=h+24|0;i=pe[e+88>>2]|0;c=(ge[i+55>>0]|0)<<8|(ge[i+56>>0]|0);l=e+92|0;t=pe[e+4>>2]|0;r=(ge[i+50>>0]|0)<<8|(ge[i+49>>0]|0)<<16|(ge[i+51>>0]|0);n=t+r|0;i=(ge[i+53>>0]|0)<<8|(ge[i+52>>0]|0)<<16|(ge[i+54>>0]|0);if(!i){f=0;ve=h;return f|0}pe[l>>2]=n;pe[e+96>>2]=n;pe[e+104>>2]=i;pe[e+100>>2]=t+(i+r);pe[e+108>>2]=0;pe[e+112>>2]=0;pe[f+20>>2]=0;pe[f>>2]=0;pe[f+4>>2]=0;pe[f+8>>2]=0;pe[f+12>>2]=0;de[f+16>>0]=0;e:do{if(pt(l,f)|0){o=e+268|0;r=e+272|0;t=pe[r>>2]|0;if((t|0)!=(c|0)){if(t>>>0<=c>>>0){do{if((pe[e+276>>2]|0)>>>0>>0)if(it(o,c,(t+1|0)==(c|0),2,0)|0){t=pe[r>>2]|0;break}else{de[e+280>>0]=1;t=0;break e}}while(0);Vr((pe[o>>2]|0)+(t<<1)|0,0,c-t<<1|0)|0}pe[r>>2]=c}if(!c){pe[s>>2]=1154;pe[s+4>>2]=903;pe[s+8>>2]=1781;br(a,1100,s)|0;yr(a,u)|0;t=1;break}r=0;n=0;i=0;t=pe[o>>2]|0;while(1){u=mt(l,f)|0;r=u+r&255;n=(mt(l,f)|0)+n&255;Q[t>>1]=n<<8|r;i=i+1|0;if((i|0)==(c|0)){t=1;break}else t=t+2|0}}else t=0}while(0);ft(f);f=t;ve=h;return f|0}function Ot(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0;M=ve;ve=ve+2432|0;s=M+16|0;a=M;o=M+1912|0;S=M+1888|0;w=M+988|0;T=M+88|0;x=M+24|0;i=pe[e+88>>2]|0;b=(ge[i+63>>0]|0)<<8|(ge[i+64>>0]|0);y=e+92|0;t=pe[e+4>>2]|0;r=(ge[i+58>>0]|0)<<8|(ge[i+57>>0]|0)<<16|(ge[i+59>>0]|0);n=t+r|0;i=(ge[i+61>>0]|0)<<8|(ge[i+60>>0]|0)<<16|(ge[i+62>>0]|0);if(!i){S=0;ve=M;return S|0}pe[y>>2]=n;pe[e+96>>2]=n;pe[e+104>>2]=i;pe[e+100>>2]=t+(i+r);pe[e+108>>2]=0;pe[e+112>>2]=0;pe[S+20>>2]=0;pe[S>>2]=0;pe[S+4>>2]=0;pe[S+8>>2]=0;pe[S+12>>2]=0;de[S+16>>0]=0;if(pt(y,S)|0){r=0;n=-7;i=-7;while(1){pe[w+(r<<2)>>2]=n;pe[T+(r<<2)>>2]=i;t=(n|0)>6;r=r+1|0;if((r|0)==225)break;else{n=t?-7:n+1|0;i=(t&1)+i|0}}t=x;r=t+64|0;do{pe[t>>2]=0;t=t+4|0}while((t|0)<(r|0));_=e+284|0;r=b*3|0;n=e+288|0;t=pe[n>>2]|0;e:do{if((t|0)==(r|0))u=13;else{if(t>>>0<=r>>>0){do{if((pe[e+292>>2]|0)>>>0>>0)if(it(_,r,(t+1|0)==(r|0),2,0)|0){t=pe[n>>2]|0;break}else{de[e+296>>0]=1;t=0;break e}}while(0);Vr((pe[_>>2]|0)+(t<<1)|0,0,r-t<<1|0)|0}pe[n>>2]=r;u=13}}while(0);do{if((u|0)==13){if(!b){pe[a>>2]=1154;pe[a+4>>2]=903;pe[a+8>>2]=1781;br(o,1100,a)|0;yr(o,s)|0;t=1;break}n=x+4|0;i=x+8|0;e=x+12|0;o=x+16|0;a=x+20|0;s=x+24|0;u=x+28|0;l=x+32|0;c=x+36|0;f=x+40|0;h=x+44|0;d=x+48|0;p=x+52|0;g=x+56|0;m=x+60|0;v=0;r=pe[_>>2]|0;while(1){t=0;do{P=mt(y,S)|0;_=t<<1;C=x+(_<<2)|0;pe[C>>2]=(pe[C>>2]|0)+(pe[w+(P<<2)>>2]|0)&7;_=x+((_|1)<<2)|0;pe[_>>2]=(pe[_>>2]|0)+(pe[T+(P<<2)>>2]|0)&7;t=t+1|0}while((t|0)!=8);P=ge[1729+(pe[a>>2]|0)>>0]|0;Q[r>>1]=(ge[1729+(pe[n>>2]|0)>>0]|0)<<3|(ge[1729+(pe[x>>2]|0)>>0]|0)|(ge[1729+(pe[i>>2]|0)>>0]|0)<<6|(ge[1729+(pe[e>>2]|0)>>0]|0)<<9|(ge[1729+(pe[o>>2]|0)>>0]|0)<<12|P<<15;C=ge[1729+(pe[f>>2]|0)>>0]|0;Q[r+2>>1]=(ge[1729+(pe[s>>2]|0)>>0]|0)<<2|P>>>1|(ge[1729+(pe[u>>2]|0)>>0]|0)<<5|(ge[1729+(pe[l>>2]|0)>>0]|0)<<8|(ge[1729+(pe[c>>2]|0)>>0]|0)<<11|C<<14;Q[r+4>>1]=(ge[1729+(pe[h>>2]|0)>>0]|0)<<1|C>>>2|(ge[1729+(pe[d>>2]|0)>>0]|0)<<4|(ge[1729+(pe[p>>2]|0)>>0]|0)<<7|(ge[1729+(pe[g>>2]|0)>>0]|0)<<10|(ge[1729+(pe[m>>2]|0)>>0]|0)<<13;v=v+1|0;if((v|0)==(b|0)){t=1;break}else r=r+6|0}}}while(0)}else t=0;ft(S);C=t;ve=M;return C|0}function Rt(e,t,r,n,i,o,a,s){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;s=s|0;var u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0,$=0,Q=0,ee=0,te=0,re=0,ne=0,ie=0,oe=0,ae=0,se=0,ue=0,le=0,ce=0,fe=0,he=0;ce=ve;ve=ve+720|0;le=ce+184|0;se=ce+168|0;ae=ce+160|0;oe=ce+144|0;ie=ce+136|0;ne=ce+120|0;re=ce+112|0;ee=ce+96|0;Q=ce+88|0;$=ce+72|0;J=ce+64|0;Z=ce+48|0;K=ce+40|0;ue=ce+24|0;te=ce+16|0;V=ce;G=ce+208|0;W=ce+192|0;B=e+240|0;z=pe[B>>2]|0;q=e+256|0;H=pe[q>>2]|0;r=de[(pe[e+88>>2]|0)+17>>0]|0;Y=n>>>2;if(!(r<<24>>24)){ve=ce;return 1}U=(s|0)==0;X=s+-1|0;R=(o&1|0)!=0;I=n<<1;D=e+92|0;L=e+116|0;N=e+140|0;j=e+236|0;F=a+-1|0;O=(i&1|0)!=0;A=e+188|0;M=e+252|0;P=Y+1|0;C=Y+2|0;k=Y+3|0;E=F<<4;T=r&255;r=0;o=0;i=1;S=0;do{if(!U){x=pe[t+(S<<2)>>2]|0;w=0;while(1){_=w&1;u=(_|0)==0;v=(_<<5^32)+-16|0;_=(_<<1^2)+-1|0;b=u?a:-1;l=u?0:F;e=(w|0)==(X|0);y=R&e;if((l|0)!=(b|0)){m=R&e^1;g=u?x:x+E|0;while(1){if((i|0)==1)i=mt(D,L)|0|512;p=i&7;i=i>>>3;u=ge[1823+p>>0]|0;e=0;do{h=(mt(D,N)|0)+o|0;d=h-z|0;o=d>>31;o=o&h|d&~o;if((pe[B>>2]|0)>>>0<=o>>>0){pe[V>>2]=1154;pe[V+4>>2]=903;pe[V+8>>2]=1781;br(G,1100,V)|0;yr(G,te)|0}pe[W+(e<<2)>>2]=pe[(pe[j>>2]|0)+(o<<2)>>2];e=e+1|0}while(e>>>0>>0);d=O&(l|0)==(F|0);if(y|d){h=0;do{c=_e(h,n)|0;e=g+c|0;u=(h|0)==0|m;f=h<<1;he=(mt(D,A)|0)+r|0;fe=he-H|0;r=fe>>31;r=r&he|fe&~r;do{if(d){if(!u){fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;break}pe[e>>2]=pe[W+((ge[1831+(p<<2)+f>>0]|0)<<2)>>2];if((pe[q>>2]|0)>>>0<=r>>>0){pe[oe>>2]=1154;pe[oe+4>>2]=903;pe[oe+8>>2]=1781;br(G,1100,oe)|0;yr(G,ae)|0}pe[g+(c+4)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r}else{if(!u){fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;break}pe[e>>2]=pe[W+((ge[1831+(p<<2)+f>>0]|0)<<2)>>2];if((pe[q>>2]|0)>>>0<=r>>>0){pe[ne>>2]=1154;pe[ne+4>>2]=903;pe[ne+8>>2]=1781;br(G,1100,ne)|0;yr(G,ie)|0}pe[g+(c+4)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;pe[g+(c+8)>>2]=pe[W+((ge[(f|1)+(1831+(p<<2))>>0]|0)<<2)>>2];if((pe[q>>2]|0)>>>0<=r>>>0){pe[se>>2]=1154;pe[se+4>>2]=903;pe[se+8>>2]=1781;br(G,1100,se)|0;yr(G,le)|0}pe[g+(c+12)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2]}}while(0);h=h+1|0}while((h|0)!=2)}else{pe[g>>2]=pe[W+((ge[1831+(p<<2)>>0]|0)<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;if((pe[q>>2]|0)>>>0<=r>>>0){pe[ue>>2]=1154;pe[ue+4>>2]=903;pe[ue+8>>2]=1781;br(G,1100,ue)|0;yr(G,K)|0}pe[g+4>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];pe[g+8>>2]=pe[W+((ge[1831+(p<<2)+1>>0]|0)<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;if((pe[q>>2]|0)>>>0<=r>>>0){pe[Z>>2]=1154;pe[Z+4>>2]=903;pe[Z+8>>2]=1781;br(G,1100,Z)|0;yr(G,J)|0}pe[g+12>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];pe[g+(Y<<2)>>2]=pe[W+((ge[1831+(p<<2)+2>>0]|0)<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;if((pe[q>>2]|0)>>>0<=r>>>0){pe[$>>2]=1154;pe[$+4>>2]=903;pe[$+8>>2]=1781;br(G,1100,$)|0;yr(G,Q)|0}pe[g+(P<<2)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2];pe[g+(C<<2)>>2]=pe[W+((ge[1831+(p<<2)+3>>0]|0)<<2)>>2];fe=(mt(D,A)|0)+r|0;he=fe-H|0;r=he>>31;r=r&fe|he&~r;if((pe[q>>2]|0)>>>0<=r>>>0){pe[ee>>2]=1154;pe[ee+4>>2]=903;pe[ee+8>>2]=1781;br(G,1100,ee)|0;yr(G,re)|0}pe[g+(k<<2)>>2]=pe[(pe[M>>2]|0)+(r<<2)>>2]}l=l+_|0;if((l|0)==(b|0))break;else g=g+v|0}}w=w+1|0;if((w|0)==(s|0))break;else x=x+I|0}}S=S+1|0}while((S|0)!=(T|0));ve=ce;return 1}function It(e,t,r,n,i,o,a,s){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;s=s|0;var u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0,$=0,Q=0,ee=0,te=0,re=0,ne=0,ie=0,oe=0,ae=0,se=0,ue=0,le=0,ce=0,fe=0,he=0;fe=ve;ve=ve+640|0;ue=fe+88|0;se=fe+72|0;ae=fe+64|0;oe=fe+48|0;ie=fe+40|0;ce=fe+24|0;le=fe+16|0;ne=fe;te=fe+128|0;re=fe+112|0;ee=fe+96|0;B=e+240|0;z=pe[B>>2]|0;q=e+256|0;J=pe[q>>2]|0;$=e+272|0;Q=pe[$>>2]|0;r=pe[e+88>>2]|0;U=(ge[r+63>>0]|0)<<8|(ge[r+64>>0]|0);r=de[r+17>>0]|0;if(!(r<<24>>24)){ve=fe;return 1}X=(s|0)==0;H=s+-1|0;Y=n<<1;G=e+92|0;W=e+116|0;V=a+-1|0;K=e+212|0;Z=e+188|0;F=(i&1|0)==0;j=(o&1|0)==0;O=e+288|0;R=e+284|0;I=e+252|0;D=e+140|0;L=e+236|0;N=e+164|0;E=e+268|0;A=V<<5;C=r&255;r=0;i=0;o=0;e=0;u=1;k=0;do{if(!X){M=pe[t+(k<<2)>>2]|0;P=0;while(1){T=P&1;l=(T|0)==0;w=(T<<6^64)+-32|0;T=(T<<1^2)+-1|0;S=l?a:-1;c=l?0:V;if((c|0)!=(S|0)){x=j|(P|0)!=(H|0);b=l?M:M+A|0;while(1){if((u|0)==1)u=mt(G,W)|0|512;y=u&7;u=u>>>3;f=ge[1823+y>>0]|0;l=0;do{v=(mt(G,N)|0)+i|0;_=v-Q|0;i=_>>31;i=i&v|_&~i;if((pe[$>>2]|0)>>>0<=i>>>0){pe[ne>>2]=1154;pe[ne+4>>2]=903;pe[ne+8>>2]=1781;br(te,1100,ne)|0;yr(te,le)|0}pe[ee+(l<<2)>>2]=me[(pe[E>>2]|0)+(i<<1)>>1];l=l+1|0}while(l>>>0>>0);l=0;do{v=(mt(G,D)|0)+e|0;_=v-z|0;e=_>>31;e=e&v|_&~e;if((pe[B>>2]|0)>>>0<=e>>>0){pe[ce>>2]=1154;pe[ce+4>>2]=903;pe[ce+8>>2]=1781;br(te,1100,ce)|0;yr(te,ie)|0}pe[re+(l<<2)>>2]=pe[(pe[L>>2]|0)+(e<<2)>>2];l=l+1|0}while(l>>>0>>0);_=F|(c|0)!=(V|0);m=0;v=b;while(1){g=x|(m|0)==0;p=m<<1;h=0;d=v;while(1){f=(mt(G,K)|0)+r|0;l=f-U|0;r=l>>31;r=r&f|l&~r;l=(mt(G,Z)|0)+o|0;f=l-J|0;o=f>>31;o=o&l|f&~o;if((_|(h|0)==0)&g){l=ge[h+p+(1831+(y<<2))>>0]|0;f=r*3|0;if((pe[O>>2]|0)>>>0<=f>>>0){pe[oe>>2]=1154;pe[oe+4>>2]=903;pe[oe+8>>2]=1781;br(te,1100,oe)|0;yr(te,ae)|0}he=pe[R>>2]|0;pe[d>>2]=(me[he+(f<<1)>>1]|0)<<16|pe[ee+(l<<2)>>2];pe[d+4>>2]=(me[he+(f+2<<1)>>1]|0)<<16|(me[he+(f+1<<1)>>1]|0);pe[d+8>>2]=pe[re+(l<<2)>>2];if((pe[q>>2]|0)>>>0<=o>>>0){pe[se>>2]=1154;pe[se+4>>2]=903;pe[se+8>>2]=1781;br(te,1100,se)|0;yr(te,ue)|0}pe[d+12>>2]=pe[(pe[I>>2]|0)+(o<<2)>>2]}h=h+1|0;if((h|0)==2)break;else d=d+16|0}m=m+1|0;if((m|0)==2)break;else v=v+n|0}c=c+T|0;if((c|0)==(S|0))break;else b=b+w|0}}P=P+1|0;if((P|0)==(s|0))break;else M=M+Y|0}}k=k+1|0}while((k|0)!=(C|0));ve=fe;return 1}function Dt(e,t,r,n,i,o,a,s){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;s=s|0;var u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0;J=ve;ve=ve+608|0;V=J+64|0;W=J+48|0;G=J+40|0;Z=J+24|0;K=J+16|0;Y=J;H=J+88|0;q=J+72|0;I=e+272|0;D=pe[I>>2]|0;r=pe[e+88>>2]|0;L=(ge[r+63>>0]|0)<<8|(ge[r+64>>0]|0);r=de[r+17>>0]|0;if(!(r<<24>>24)){ve=J;return 1}N=(s|0)==0;j=s+-1|0;F=n<<1;B=e+92|0;z=e+116|0;U=a+-1|0;X=e+212|0;R=(o&1|0)==0;E=e+288|0;A=e+284|0;O=e+164|0;C=e+268|0;k=U<<4;P=r&255;M=(i&1|0)!=0;r=0;o=0;e=1;S=0;do{if(!N){w=pe[t+(S<<2)>>2]|0;T=0;while(1){b=T&1;i=(b|0)==0;y=(b<<5^32)+-16|0;b=(b<<1^2)+-1|0;x=i?a:-1;u=i?0:U;if((u|0)!=(x|0)){_=R|(T|0)!=(j|0);v=i?w:w+k|0;while(1){if((e|0)==1)e=mt(B,z)|0|512;m=e&7;e=e>>>3;l=ge[1823+m>>0]|0;i=0;do{p=(mt(B,O)|0)+o|0;g=p-D|0;o=g>>31;o=o&p|g&~o;if((pe[I>>2]|0)>>>0<=o>>>0){pe[Y>>2]=1154;pe[Y+4>>2]=903;pe[Y+8>>2]=1781;br(H,1100,Y)|0;yr(H,K)|0}pe[q+(i<<2)>>2]=me[(pe[C>>2]|0)+(o<<1)>>1];i=i+1|0}while(i>>>0>>0);g=(u|0)==(U|0)&M;d=0;p=v;while(1){h=_|(d|0)==0;f=d<<1;i=(mt(B,X)|0)+r|0;c=i-L|0;l=c>>31;l=l&i|c&~l;if(h){r=ge[1831+(m<<2)+f>>0]|0;i=l*3|0;if((pe[E>>2]|0)>>>0<=i>>>0){pe[Z>>2]=1154;pe[Z+4>>2]=903;pe[Z+8>>2]=1781;br(H,1100,Z)|0;yr(H,G)|0}c=pe[A>>2]|0;pe[p>>2]=(me[c+(i<<1)>>1]|0)<<16|pe[q+(r<<2)>>2];pe[p+4>>2]=(me[c+(i+2<<1)>>1]|0)<<16|(me[c+(i+1<<1)>>1]|0)}c=p+8|0;i=(mt(B,X)|0)+l|0;l=i-L|0;r=l>>31;r=r&i|l&~r;if(!(g|h^1)){i=ge[(f|1)+(1831+(m<<2))>>0]|0;l=r*3|0;if((pe[E>>2]|0)>>>0<=l>>>0){pe[W>>2]=1154;pe[W+4>>2]=903;pe[W+8>>2]=1781;br(H,1100,W)|0;yr(H,V)|0}h=pe[A>>2]|0;pe[c>>2]=(me[h+(l<<1)>>1]|0)<<16|pe[q+(i<<2)>>2];pe[p+12>>2]=(me[h+(l+2<<1)>>1]|0)<<16|(me[h+(l+1<<1)>>1]|0)}d=d+1|0;if((d|0)==2)break;else p=p+n|0}u=u+b|0;if((u|0)==(x|0))break;else v=v+y|0}}T=T+1|0;if((T|0)==(s|0))break;else w=w+F|0}}S=S+1|0}while((S|0)!=(P|0));ve=J;return 1}function Lt(e,t,r,n,i,o,a,s){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;s=s|0;var u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0,$=0,Q=0,ee=0,te=0,re=0,ne=0,ie=0,oe=0,ae=0;ae=ve;ve=ve+640|0;ne=ae+88|0;re=ae+72|0;te=ae+64|0;ee=ae+48|0;Q=ae+40|0;oe=ae+24|0;ie=ae+16|0;$=ae;J=ae+128|0;K=ae+112|0;Z=ae+96|0;B=e+272|0;z=pe[B>>2]|0;r=pe[e+88>>2]|0;U=(ge[r+63>>0]|0)<<8|(ge[r+64>>0]|0);r=de[r+17>>0]|0;if(!(r<<24>>24)){ve=ae;return 1}X=(s|0)==0;q=s+-1|0;H=n<<1;Y=e+92|0;G=e+116|0;W=a+-1|0;V=e+212|0;F=(i&1|0)==0;j=(o&1|0)==0;D=e+288|0;L=e+284|0;N=e+164|0;R=e+268|0;I=W<<5;A=r&255;r=0;i=0;o=0;e=0;u=1;O=0;do{if(!X){k=pe[t+(O<<2)>>2]|0;E=0;while(1){P=E&1;l=(P|0)==0;M=(P<<6^64)+-32|0;P=(P<<1^2)+-1|0;C=l?a:-1;c=l?0:W;if((c|0)!=(C|0)){S=j|(E|0)!=(q|0);T=l?k:k+I|0;while(1){if((u|0)==1)u=mt(Y,G)|0|512;w=u&7;u=u>>>3;f=ge[1823+w>>0]|0;l=0;do{b=(mt(Y,N)|0)+e|0;x=b-z|0;e=x>>31;e=e&b|x&~e;if((pe[B>>2]|0)>>>0<=e>>>0){pe[$>>2]=1154;pe[$+4>>2]=903;pe[$+8>>2]=1781;br(J,1100,$)|0;yr(J,ie)|0}pe[K+(l<<2)>>2]=me[(pe[R>>2]|0)+(e<<1)>>1];l=l+1|0}while(l>>>0>>0);l=0;do{b=(mt(Y,N)|0)+i|0;x=b-z|0;i=x>>31;i=i&b|x&~i;if((pe[B>>2]|0)>>>0<=i>>>0){pe[oe>>2]=1154;pe[oe+4>>2]=903;pe[oe+8>>2]=1781;br(J,1100,oe)|0;yr(J,Q)|0}pe[Z+(l<<2)>>2]=me[(pe[R>>2]|0)+(i<<1)>>1];l=l+1|0}while(l>>>0>>0);x=F|(c|0)!=(W|0);y=0;b=T;while(1){_=S|(y|0)==0;v=y<<1;g=0;m=b;while(1){p=(mt(Y,V)|0)+o|0;d=p-U|0;o=d>>31;o=o&p|d&~o;d=(mt(Y,V)|0)+r|0;p=d-U|0;r=p>>31;r=r&d|p&~r;if((x|(g|0)==0)&_){d=ge[g+v+(1831+(w<<2))>>0]|0;p=o*3|0;l=pe[D>>2]|0;if(l>>>0<=p>>>0){pe[ee>>2]=1154;pe[ee+4>>2]=903;pe[ee+8>>2]=1781;br(J,1100,ee)|0;yr(J,te)|0;l=pe[D>>2]|0}f=pe[L>>2]|0;h=r*3|0;if(l>>>0>h>>>0)l=f;else{pe[re>>2]=1154;pe[re+4>>2]=903;pe[re+8>>2]=1781;br(J,1100,re)|0;yr(J,ne)|0;l=pe[L>>2]|0}pe[m>>2]=(me[f+(p<<1)>>1]|0)<<16|pe[K+(d<<2)>>2];pe[m+4>>2]=(me[f+(p+2<<1)>>1]|0)<<16|(me[f+(p+1<<1)>>1]|0);pe[m+8>>2]=(me[l+(h<<1)>>1]|0)<<16|pe[Z+(d<<2)>>2];pe[m+12>>2]=(me[l+(h+2<<1)>>1]|0)<<16|(me[l+(h+1<<1)>>1]|0)}g=g+1|0;if((g|0)==2)break;else m=m+16|0}y=y+1|0;if((y|0)==2)break;else b=b+n|0}c=c+P|0;if((c|0)==(C|0))break;else T=T+M|0}}E=E+1|0;if((E|0)==(s|0))break;else k=k+H|0}}O=O+1|0}while((O|0)!=(A|0));ve=ae;return 1}function Nt(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0;h=ve;ve=ve+608|0;f=h+88|0;c=h+72|0;u=h+64|0;s=h+48|0;o=h+40|0;a=h+24|0;i=h+16|0;n=h;l=h+96|0;pe[e>>2]=0;t=e+284|0;r=pe[t>>2]|0;if(r){if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[n>>2]=1154;pe[n+4>>2]=2499;pe[n+8>>2]=1516;br(l,1100,n)|0;yr(l,i)|0}pe[t>>2]=0;pe[e+288>>2]=0;pe[e+292>>2]=0}de[e+296>>0]=0;t=e+268|0;r=pe[t>>2]|0;if(r){if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[a>>2]=1154;pe[a+4>>2]=2499;pe[a+8>>2]=1516;br(l,1100,a)|0;yr(l,o)|0}pe[t>>2]=0;pe[e+272>>2]=0;pe[e+276>>2]=0}de[e+280>>0]=0;t=e+252|0;r=pe[t>>2]|0;if(r){if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[s>>2]=1154;pe[s+4>>2]=2499;pe[s+8>>2]=1516;br(l,1100,s)|0;yr(l,u)|0}pe[t>>2]=0;pe[e+256>>2]=0;pe[e+260>>2]=0}de[e+264>>0]=0;t=e+236|0;r=pe[t>>2]|0;if(!r){f=e+248|0;de[f>>0]=0;f=e+212|0;ft(f);f=e+188|0;ft(f);f=e+164|0;ft(f);f=e+140|0;ft(f);f=e+116|0;ft(f);ve=h;return}if(!(r&7))Dn[pe[104>>2]&1](r,0,0,1,pe[27]|0)|0;else{pe[c>>2]=1154;pe[c+4>>2]=2499;pe[c+8>>2]=1516;br(l,1100,c)|0;yr(l,f)|0}pe[t>>2]=0;pe[e+240>>2]=0;pe[e+244>>2]=0;f=e+248|0;de[f>>0]=0;f=e+212|0;ft(f);f=e+188|0;ft(f);f=e+164|0;ft(f);f=e+140|0;ft(f);f=e+116|0;ft(f);ve=h;return}function jt(e,t){e=e|0;t=t|0;var r=0;r=ve;ve=ve+16|0;pe[r>>2]=t;t=pe[63]|0;xr(t,e,r)|0;vr(10,t)|0;Xe()}function Ft(){var e=0,t=0;e=ve;ve=ve+16|0;if(!(Ne(200,2)|0)){t=De(pe[49]|0)|0;ve=e;return t|0}else jt(2090,e);return 0}function Bt(e){e=e|0;Ur(e);return}function zt(e){e=e|0;var t=0;t=ve;ve=ve+16|0;Rn[e&3]();jt(2139,t)}function Ut(){var e=0,t=0;e=Ft()|0;if(((e|0)!=0?(t=pe[e>>2]|0,(t|0)!=0):0)?(e=t+48|0,(pe[e>>2]&-256|0)==1126902528?(pe[e+4>>2]|0)==1129074247:0):0)zt(pe[t+12>>2]|0);t=pe[28]|0;pe[28]=t+0;zt(t)}function Xt(e){e=e|0;return}function qt(e){e=e|0;return}function Ht(e){e=e|0;return}function Yt(e){e=e|0;return}function Gt(e){e=e|0;Bt(e);return}function Wt(e){e=e|0;Bt(e);return}function Vt(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0;a=ve;ve=ve+64|0;o=a;if((e|0)!=(t|0))if((t|0)!=0?(i=$t(t,24,40,0)|0,(i|0)!=0):0){t=o;n=t+56|0;do{pe[t>>2]=0;t=t+4|0}while((t|0)<(n|0));pe[o>>2]=i;pe[o+8>>2]=e;pe[o+12>>2]=-1;pe[o+48>>2]=1;Ln[pe[(pe[i>>2]|0)+28>>2]&3](i,o,pe[r>>2]|0,1);if((pe[o+24>>2]|0)==1){pe[r>>2]=pe[o+16>>2];t=1}else t=0}else t=0;else t=1;ve=a;return t|0}function Kt(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0;e=t+16|0;i=pe[e>>2]|0;do{if(i){if((i|0)!=(r|0)){n=t+36|0;pe[n>>2]=(pe[n>>2]|0)+1;pe[t+24>>2]=2;de[t+54>>0]=1;break}e=t+24|0;if((pe[e>>2]|0)==2)pe[e>>2]=n}else{pe[e>>2]=r;pe[t+24>>2]=n;pe[t+36>>2]=1}}while(0);return}function Zt(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;if((e|0)==(pe[t+8>>2]|0))Kt(0,t,r,n);return}function Jt(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;if((e|0)==(pe[t+8>>2]|0))Kt(0,t,r,n);else{e=pe[e+8>>2]|0;Ln[pe[(pe[e>>2]|0)+28>>2]&3](e,t,r,n)}return}function $t(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0;d=ve;ve=ve+64|0;h=d;f=pe[e>>2]|0;c=e+(pe[f+-8>>2]|0)|0;f=pe[f+-4>>2]|0;pe[h>>2]=r;pe[h+4>>2]=e;pe[h+8>>2]=t;pe[h+12>>2]=n;n=h+16|0;e=h+20|0;t=h+24|0;i=h+28|0;o=h+32|0;a=h+40|0;s=(f|0)==(r|0);u=n;l=u+36|0;do{pe[u>>2]=0;u=u+4|0}while((u|0)<(l|0));Q[n+36>>1]=0;de[n+38>>0]=0;e:do{if(s){pe[h+48>>2]=1;In[pe[(pe[r>>2]|0)+20>>2]&3](r,h,c,c,1,0);n=(pe[t>>2]|0)==1?c:0}else{kn[pe[(pe[f>>2]|0)+24>>2]&3](f,h,c,1,0);switch(pe[h+36>>2]|0){case 0:{n=(pe[a>>2]|0)==1&(pe[i>>2]|0)==1&(pe[o>>2]|0)==1?pe[e>>2]|0:0;break e}case 1:break;default:{n=0;break e}}if((pe[t>>2]|0)!=1?!((pe[a>>2]|0)==0&(pe[i>>2]|0)==1&(pe[o>>2]|0)==1):0){n=0;break}n=pe[n>>2]|0}}while(0);ve=d;return n|0}function Qt(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;de[t+53>>0]=1;do{if((pe[t+4>>2]|0)==(n|0)){de[t+52>>0]=1;n=t+16|0;e=pe[n>>2]|0;if(!e){pe[n>>2]=r;pe[t+24>>2]=i;pe[t+36>>2]=1;if(!((i|0)==1?(pe[t+48>>2]|0)==1:0))break;de[t+54>>0]=1;break}if((e|0)!=(r|0)){i=t+36|0;pe[i>>2]=(pe[i>>2]|0)+1;de[t+54>>0]=1;break}e=t+24|0;n=pe[e>>2]|0;if((n|0)==2){pe[e>>2]=i;n=i}if((n|0)==1?(pe[t+48>>2]|0)==1:0)de[t+54>>0]=1}}while(0);return}function er(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0;e:do{if((e|0)==(pe[t+8>>2]|0)){if((pe[t+4>>2]|0)==(r|0)?(o=t+28|0,(pe[o>>2]|0)!=1):0)pe[o>>2]=n}else{if((e|0)!=(pe[t>>2]|0)){s=pe[e+8>>2]|0;kn[pe[(pe[s>>2]|0)+24>>2]&3](s,t,r,n,i);break}if((pe[t+16>>2]|0)!=(r|0)?(a=t+20|0,(pe[a>>2]|0)!=(r|0)):0){pe[t+32>>2]=n;n=t+44|0;if((pe[n>>2]|0)==4)break;o=t+52|0;de[o>>0]=0;u=t+53|0;de[u>>0]=0;e=pe[e+8>>2]|0;In[pe[(pe[e>>2]|0)+20>>2]&3](e,t,r,r,1,i);if(de[u>>0]|0){if(!(de[o>>0]|0)){o=1;s=13}}else{o=0;s=13}do{if((s|0)==13){pe[a>>2]=r;u=t+40|0;pe[u>>2]=(pe[u>>2]|0)+1;if((pe[t+36>>2]|0)==1?(pe[t+24>>2]|0)==2:0){de[t+54>>0]=1;if(o)break}else s=16;if((s|0)==16?o:0)break;pe[n>>2]=4;break e}}while(0);pe[n>>2]=3;break}if((n|0)==1)pe[t+32>>2]=1}}while(0);return}function tr(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0;do{if((e|0)==(pe[t+8>>2]|0)){if((pe[t+4>>2]|0)==(r|0)?(a=t+28|0,(pe[a>>2]|0)!=1):0)pe[a>>2]=n}else if((e|0)==(pe[t>>2]|0)){if((pe[t+16>>2]|0)!=(r|0)?(o=t+20|0,(pe[o>>2]|0)!=(r|0)):0){pe[t+32>>2]=n;pe[o>>2]=r;i=t+40|0;pe[i>>2]=(pe[i>>2]|0)+1;if((pe[t+36>>2]|0)==1?(pe[t+24>>2]|0)==2:0)de[t+54>>0]=1;pe[t+44>>2]=4;break}if((n|0)==1)pe[t+32>>2]=1}}while(0);return}function rr(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;if((e|0)==(pe[t+8>>2]|0))Qt(0,t,r,n,i);else{e=pe[e+8>>2]|0;In[pe[(pe[e>>2]|0)+20>>2]&3](e,t,r,n,i,o)}return}function nr(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;if((e|0)==(pe[t+8>>2]|0))Qt(0,t,r,n,i);return}function ir(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0;i=ve;ve=ve+16|0;n=i;pe[n>>2]=pe[r>>2];e=Cn[pe[(pe[e>>2]|0)+16>>2]&7](e,t,n)|0;if(e)pe[r>>2]=pe[n>>2];ve=i;return e&1|0}function or(e){e=e|0;if(!e)e=0;else e=($t(e,24,72,0)|0)!=0;return e&1|0}function ar(){var e=0,t=0,r=0,n=0,i=0,o=0,a=0,s=0;i=ve;ve=ve+48|0;a=i+32|0;r=i+24|0;s=i+16|0;o=i;i=i+36|0;e=Ft()|0;if((e|0)!=0?(n=pe[e>>2]|0,(n|0)!=0):0){e=n+48|0;t=pe[e>>2]|0;e=pe[e+4>>2]|0;if(!((t&-256|0)==1126902528&(e|0)==1129074247)){pe[r>>2]=pe[51];jt(2368,r)}if((t|0)==1126902529&(e|0)==1129074247)e=pe[n+44>>2]|0;else e=n+80|0;pe[i>>2]=e;n=pe[n>>2]|0;e=pe[n+4>>2]|0;if(Cn[pe[(pe[8>>2]|0)+16>>2]&7](8,n,i)|0){s=pe[i>>2]|0;i=pe[51]|0;s=An[pe[(pe[s>>2]|0)+8>>2]&1](s)|0;pe[o>>2]=i;pe[o+4>>2]=e;pe[o+8>>2]=s;jt(2282,o)}else{pe[s>>2]=pe[51];pe[s+4>>2]=e;jt(2327,s)}}jt(2406,a)}function sr(){var e=0;e=ve;ve=ve+16|0;if(!(je(196,6)|0)){ve=e;return}else jt(2179,e)}function ur(e){e=e|0;var t=0;t=ve;ve=ve+16|0;Ur(e);if(!(ze(pe[49]|0,0)|0)){ve=t;return}else jt(2229,t)}function lr(e){e=e|0;var t=0,r=0;t=0;while(1){if((ge[2427+t>>0]|0)==(e|0)){r=2;break}t=t+1|0;if((t|0)==87){t=87;e=2515;r=5;break}}if((r|0)==2)if(!t)e=2515;else{e=2515;r=5}if((r|0)==5)while(1){r=e;while(1){e=r+1|0;if(!(de[r>>0]|0))break;else r=e}t=t+-1|0;if(!t)break;else r=5}return e|0}function cr(){var e=0;if(!(pe[52]|0))e=264;else{e=(Le()|0)+60|0;e=pe[e>>2]|0}return e|0}function fr(e){e=e|0;var t=0;if(e>>>0>4294963200){t=cr()|0;pe[t>>2]=0-e;e=-1}return e|0}function hr(e,t){e=+e;t=t|0;var r=0,n=0,i=0;ee[te>>3]=e;r=pe[te>>2]|0;n=pe[te+4>>2]|0;i=Kr(r|0,n|0,52)|0;i=i&2047;switch(i|0){case 0:{if(e!=0.0){e=+hr(e*18446744073709552.0e3,t);r=(pe[t>>2]|0)+-64|0}else r=0;pe[t>>2]=r;break}case 2047:break;default:{pe[t>>2]=i+-1022;pe[te>>2]=r;pe[te+4>>2]=n&-2146435073|1071644672;e=+ee[te>>3]}}return+e}function dr(e,t){e=+e;t=t|0;return+ +hr(e,t)}function pr(e,t,r){e=e|0;t=t|0;r=r|0;do{if(e){if(t>>>0<128){de[e>>0]=t;e=1;break}if(t>>>0<2048){de[e>>0]=t>>>6|192;de[e+1>>0]=t&63|128;e=2;break}if(t>>>0<55296|(t&-8192|0)==57344){de[e>>0]=t>>>12|224;de[e+1>>0]=t>>>6&63|128;de[e+2>>0]=t&63|128;e=3;break}if((t+-65536|0)>>>0<1048576){de[e>>0]=t>>>18|240;de[e+1>>0]=t>>>12&63|128;de[e+2>>0]=t>>>6&63|128;de[e+3>>0]=t&63|128;e=4;break}else{e=cr()|0;pe[e>>2]=84;e=-1;break}}else e=1}while(0);return e|0}function gr(e,t){e=e|0;t=t|0;if(!e)e=0;else e=pr(e,t,0)|0;return e|0}function mr(e){e=e|0;var t=0,r=0;do{if(e){if((pe[e+76>>2]|0)<=-1){t=Ir(e)|0;break}r=(Sr(e)|0)==0;t=Ir(e)|0;if(!r)Mr(e)}else{if(!(pe[65]|0))t=0;else t=mr(pe[65]|0)|0;Ue(236);e=pe[58]|0;if(e)do{if((pe[e+76>>2]|0)>-1)r=Sr(e)|0;else r=0;if((pe[e+20>>2]|0)>>>0>(pe[e+28>>2]|0)>>>0)t=Ir(e)|0|t;if(r)Mr(e);e=pe[e+56>>2]|0}while((e|0)!=0);Fe(236)}}while(0);return t|0}function vr(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0;if((pe[t+76>>2]|0)>=0?(Sr(t)|0)!=0:0){if((de[t+75>>0]|0)!=(e|0)?(n=t+20|0,i=pe[n>>2]|0,i>>>0<(pe[t+16>>2]|0)>>>0):0){pe[n>>2]=i+1;de[i>>0]=e;r=e&255}else r=Pr(t,e)|0;Mr(t)}else a=3;do{if((a|0)==3){if((de[t+75>>0]|0)!=(e|0)?(o=t+20|0,r=pe[o>>2]|0,r>>>0<(pe[t+16>>2]|0)>>>0):0){pe[o>>2]=r+1;de[r>>0]=e;r=e&255;break}r=Pr(t,e)|0}}while(0);return r|0}function _r(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0;n=r+16|0;i=pe[n>>2]|0;if(!i)if(!(Or(r)|0)){i=pe[n>>2]|0;o=4}else n=0;else o=4;e:do{if((o|0)==4){a=r+20|0;o=pe[a>>2]|0;if((i-o|0)>>>0>>0){n=Cn[pe[r+36>>2]&7](r,e,t)|0;break}t:do{if((de[r+75>>0]|0)>-1){n=t;while(1){if(!n){i=o;n=0;break t}i=n+-1|0;if((de[e+i>>0]|0)==10)break;else n=i}if((Cn[pe[r+36>>2]&7](r,e,n)|0)>>>0>>0)break e;t=t-n|0;e=e+n|0;i=pe[a>>2]|0}else{i=o;n=0}}while(0);$r(i|0,e|0,t|0)|0;pe[a>>2]=(pe[a>>2]|0)+t;n=n+t|0}}while(0);return n|0}function yr(e,t){e=e|0;t=t|0;var r=0,n=0;r=ve;ve=ve+16|0;n=r;pe[n>>2]=t;t=xr(pe[64]|0,e,n)|0;ve=r;return t|0}function br(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0;n=ve;ve=ve+16|0;i=n;pe[i>>2]=r;r=Tr(e,t,i)|0;ve=n;return r|0}function xr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0;g=ve;ve=ve+224|0;f=g+120|0;p=g+80|0;d=g;h=g+136|0;n=p;i=n+40|0;do{pe[n>>2]=0;n=n+4|0}while((n|0)<(i|0));pe[f>>2]=pe[r>>2];if((Dr(0,t,f,d,p)|0)<0)r=-1;else{if((pe[e+76>>2]|0)>-1)l=Sr(e)|0;else l=0;r=pe[e>>2]|0;c=r&32;if((de[e+74>>0]|0)<1)pe[e>>2]=r&-33;r=e+48|0;if(!(pe[r>>2]|0)){i=e+44|0;o=pe[i>>2]|0;pe[i>>2]=h;a=e+28|0;pe[a>>2]=h;s=e+20|0;pe[s>>2]=h;pe[r>>2]=80;u=e+16|0;pe[u>>2]=h+80;n=Dr(e,t,f,d,p)|0;if(o){Cn[pe[e+36>>2]&7](e,0,0)|0;n=(pe[s>>2]|0)==0?-1:n;pe[i>>2]=o;pe[r>>2]=0;pe[u>>2]=0;pe[a>>2]=0;pe[s>>2]=0}}else n=Dr(e,t,f,d,p)|0;r=pe[e>>2]|0;pe[e>>2]=r|c;if(l)Mr(e);r=(r&32|0)==0?n:-1}ve=g;return r|0}function wr(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0,c=0;c=ve;ve=ve+128|0;i=c+112|0;l=c;o=l;a=268;s=o+112|0;do{pe[o>>2]=pe[a>>2];o=o+4|0;a=a+4|0}while((o|0)<(s|0));if((t+-1|0)>>>0>2147483646)if(!t){t=1;u=4}else{t=cr()|0;pe[t>>2]=75;t=-1}else{i=e;u=4}if((u|0)==4){u=-2-i|0;u=t>>>0>u>>>0?u:t;pe[l+48>>2]=u;e=l+20|0;pe[e>>2]=i;pe[l+44>>2]=i;t=i+u|0;i=l+16|0;pe[i>>2]=t;pe[l+28>>2]=t;t=xr(l,r,n)|0;if(u){r=pe[e>>2]|0;de[r+(((r|0)==(pe[i>>2]|0))<<31>>31)>>0]=0}}ve=c;return t|0}function Tr(e,t,r){e=e|0;t=t|0;r=r|0;return wr(e,2147483647,t,r)|0}function Sr(e){e=e|0;return 0}function Mr(e){e=e|0;return}function Pr(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0;u=ve;ve=ve+16|0;s=u;a=t&255;de[s>>0]=a;n=e+16|0;i=pe[n>>2]|0;if(!i)if(!(Or(e)|0)){i=pe[n>>2]|0;o=4}else r=-1;else o=4;do{if((o|0)==4){n=e+20|0;o=pe[n>>2]|0;if(o>>>0>>0?(r=t&255,(r|0)!=(de[e+75>>0]|0)):0){pe[n>>2]=o+1;de[o>>0]=a;break}if((Cn[pe[e+36>>2]&7](e,s,1)|0)==1)r=ge[s>>0]|0;else r=-1}}while(0);ve=u;return r|0}function Cr(e){e=e|0;var t=0,r=0;t=ve;ve=ve+16|0;r=t;pe[r>>2]=pe[e+60>>2];e=fr(Pe(6,r|0)|0)|0;ve=t;return e|0}function kr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0;i=ve;ve=ve+32|0;o=i;n=i+20|0;pe[o>>2]=pe[e+60>>2];pe[o+4>>2]=0;pe[o+8>>2]=t;pe[o+12>>2]=n;pe[o+16>>2]=r;if((fr(Ye(140,o|0)|0)|0)<0){pe[n>>2]=-1;e=-1}else e=pe[n>>2]|0;ve=i;return e|0}function Er(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;p=ve;ve=ve+48|0;f=p+16|0;c=p;n=p+32|0;h=e+28|0;i=pe[h>>2]|0;pe[n>>2]=i;d=e+20|0;i=(pe[d>>2]|0)-i|0;pe[n+4>>2]=i;pe[n+8>>2]=t;pe[n+12>>2]=r;u=e+60|0;l=e+44|0;t=2;i=i+r|0;while(1){if(!(pe[52]|0)){pe[f>>2]=pe[u>>2];pe[f+4>>2]=n;pe[f+8>>2]=t;a=fr(Ge(146,f|0)|0)|0}else{qe(7,e|0);pe[c>>2]=pe[u>>2];pe[c+4>>2]=n;pe[c+8>>2]=t;a=fr(Ge(146,c|0)|0)|0;Se(0)}if((i|0)==(a|0)){i=6;break}if((a|0)<0){i=8;break}i=i-a|0;o=pe[n+4>>2]|0;if(a>>>0<=o>>>0)if((t|0)==2){pe[h>>2]=(pe[h>>2]|0)+a;s=o;t=2}else s=o;else{s=pe[l>>2]|0;pe[h>>2]=s;pe[d>>2]=s;s=pe[n+12>>2]|0;a=a-o|0;n=n+8|0;t=t+-1|0}pe[n>>2]=(pe[n>>2]|0)+a;pe[n+4>>2]=s-a}if((i|0)==6){f=pe[l>>2]|0;pe[e+16>>2]=f+(pe[e+48>>2]|0);e=f;pe[h>>2]=e;pe[d>>2]=e}else if((i|0)==8){pe[e+16>>2]=0;pe[h>>2]=0;pe[d>>2]=0;pe[e>>2]=pe[e>>2]|32;if((t|0)==2)r=0;else r=r-(pe[n+4>>2]|0)|0}ve=p;return r|0}function Ar(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0;i=ve;ve=ve+80|0;n=i;pe[e+36>>2]=3;if((pe[e>>2]&64|0)==0?(pe[n>>2]=pe[e+60>>2],pe[n+4>>2]=21505,pe[n+8>>2]=i+12,(Me(54,n|0)|0)!=0):0)de[e+75>>0]=-1;n=Er(e,t,r)|0;ve=i;return n|0}function Or(e){e=e|0;var t=0,r=0;t=e+74|0;r=de[t>>0]|0;de[t>>0]=r+255|r;t=pe[e>>2]|0;if(!(t&8)){pe[e+8>>2]=0;pe[e+4>>2]=0;t=pe[e+44>>2]|0;pe[e+28>>2]=t;pe[e+20>>2]=t;pe[e+16>>2]=t+(pe[e+48>>2]|0);t=0}else{pe[e>>2]=t|32;t=-1}return t|0}function Rr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0;o=t&255;n=(r|0)!=0;e:do{if(n&(e&3|0)!=0){i=t&255;while(1){if((de[e>>0]|0)==i<<24>>24){a=6;break e}e=e+1|0;r=r+-1|0;n=(r|0)!=0;if(!(n&(e&3|0)!=0)){a=5;break}}}else a=5}while(0);if((a|0)==5)if(n)a=6;else r=0;e:do{if((a|0)==6){i=t&255;if((de[e>>0]|0)!=i<<24>>24){n=_e(o,16843009)|0;t:do{if(r>>>0>3)while(1){o=pe[e>>2]^n;if((o&-2139062144^-2139062144)&o+-16843009)break;e=e+4|0;r=r+-4|0;if(r>>>0<=3){a=11;break t}}else a=11}while(0);if((a|0)==11)if(!r){r=0;break}while(1){if((de[e>>0]|0)==i<<24>>24)break e;e=e+1|0;r=r+-1|0;if(!r){r=0;break}}}}}while(0);return((r|0)!=0?e:0)|0}function Ir(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0;t=e+20|0;o=e+28|0;if((pe[t>>2]|0)>>>0>(pe[o>>2]|0)>>>0?(Cn[pe[e+36>>2]&7](e,0,0)|0,(pe[t>>2]|0)==0):0)t=-1;else{a=e+4|0;r=pe[a>>2]|0;n=e+8|0;i=pe[n>>2]|0;if(r>>>0>>0)Cn[pe[e+40>>2]&7](e,r-i|0,1)|0;pe[e+16>>2]=0;pe[o>>2]=0;pe[t>>2]=0;pe[n>>2]=0;pe[a>>2]=0;t=0}return t|0}function Dr(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0.0,c=0,f=0,h=0,d=0,p=0.0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0,F=0,B=0,z=0,U=0,X=0,q=0,H=0,Y=0,G=0,W=0,V=0,K=0,Z=0,J=0,$=0;$=ve;ve=ve+624|0;W=$+24|0;K=$+16|0;V=$+588|0;X=$+576|0;G=$;B=$+536|0;J=$+8|0;Z=$+528|0;A=(e|0)!=0;O=B+40|0;F=O;B=B+39|0;z=J+4|0;U=X+12|0;X=X+11|0;q=V;H=U;Y=H-q|0;R=-2-q|0;I=H+2|0;D=W+288|0;L=V+9|0;N=L;j=V+8|0;o=0;g=t;a=0;t=0;e:while(1){do{if((o|0)>-1)if((a|0)>(2147483647-o|0)){o=cr()|0;pe[o>>2]=75;o=-1;break}else{o=a+o|0;break}}while(0);a=de[g>>0]|0;if(!(a<<24>>24)){E=245;break}else s=g;t:while(1){switch(a<<24>>24){case 37:{a=s;E=9;break t}case 0:{a=s;break t}default:{}}k=s+1|0;a=de[k>>0]|0;s=k}t:do{if((E|0)==9)while(1){E=0;if((de[a+1>>0]|0)!=37)break t;s=s+1|0;a=a+2|0;if((de[a>>0]|0)==37)E=9;else break}}while(0);v=s-g|0;if(A?(pe[e>>2]&32|0)==0:0)_r(g,v,e)|0;if((s|0)!=(g|0)){g=a;a=v;continue}c=a+1|0;s=de[c>>0]|0;u=(s<<24>>24)+-48|0;if(u>>>0<10){k=(de[a+2>>0]|0)==36;c=k?a+3|0:c;s=de[c>>0]|0;d=k?u:-1;t=k?1:t}else d=-1;a=s<<24>>24;t:do{if((a&-32|0)==32){u=0;while(1){if(!(1<>24)+-32|u;c=c+1|0;s=de[c>>0]|0;a=s<<24>>24;if((a&-32|0)!=32){f=u;a=c;break}}}else{f=0;a=c}}while(0);do{if(s<<24>>24==42){u=a+1|0;s=(de[u>>0]|0)+-48|0;if(s>>>0<10?(de[a+2>>0]|0)==36:0){pe[i+(s<<2)>>2]=10;t=1;a=a+3|0;s=pe[n+((de[u>>0]|0)+-48<<3)>>2]|0}else{if(t){o=-1;break e}if(!A){m=f;a=u;t=0;k=0;break}t=(pe[r>>2]|0)+(4-1)&~(4-1);s=pe[t>>2]|0;pe[r>>2]=t+4;t=0;a=u}if((s|0)<0){m=f|8192;k=0-s|0}else{m=f;k=s}}else{u=(s<<24>>24)+-48|0;if(u>>>0<10){s=0;do{s=(s*10|0)+u|0;a=a+1|0;u=(de[a>>0]|0)+-48|0}while(u>>>0<10);if((s|0)<0){o=-1;break e}else{m=f;k=s}}else{m=f;k=0}}}while(0);t:do{if((de[a>>0]|0)==46){u=a+1|0;s=de[u>>0]|0;if(s<<24>>24!=42){c=(s<<24>>24)+-48|0;if(c>>>0<10){a=u;s=0}else{a=u;c=0;break}while(1){s=(s*10|0)+c|0;a=a+1|0;c=(de[a>>0]|0)+-48|0;if(c>>>0>=10){c=s;break t}}}u=a+2|0;s=(de[u>>0]|0)+-48|0;if(s>>>0<10?(de[a+3>>0]|0)==36:0){pe[i+(s<<2)>>2]=10;a=a+4|0;c=pe[n+((de[u>>0]|0)+-48<<3)>>2]|0;break}if(t){o=-1;break e}if(A){a=(pe[r>>2]|0)+(4-1)&~(4-1);c=pe[a>>2]|0;pe[r>>2]=a+4;a=u}else{a=u;c=0}}else c=-1}while(0);h=0;while(1){s=(de[a>>0]|0)+-65|0;if(s>>>0>57){o=-1;break e}u=a+1|0;s=de[5359+(h*58|0)+s>>0]|0;f=s&255;if((f+-1|0)>>>0<8){a=u;h=f}else{C=u;break}}if(!(s<<24>>24)){o=-1;break}u=(d|0)>-1;do{if(s<<24>>24==19)if(u){o=-1;break e}else E=52;else{if(u){pe[i+(d<<2)>>2]=f;M=n+(d<<3)|0;P=pe[M+4>>2]|0;E=G;pe[E>>2]=pe[M>>2];pe[E+4>>2]=P;E=52;break}if(!A){o=0;break e}jr(G,f,r)}}while(0);if((E|0)==52?(E=0,!A):0){g=C;a=v;continue}d=de[a>>0]|0;d=(h|0)!=0&(d&15|0)==3?d&-33:d;u=m&-65537;P=(m&8192|0)==0?m:u;t:do{switch(d|0){case 110:switch(h|0){case 0:{pe[pe[G>>2]>>2]=o;g=C;a=v;continue e}case 1:{pe[pe[G>>2]>>2]=o;g=C;a=v;continue e}case 2:{g=pe[G>>2]|0;pe[g>>2]=o;pe[g+4>>2]=((o|0)<0)<<31>>31;g=C;a=v;continue e}case 3:{Q[pe[G>>2]>>1]=o;g=C;a=v;continue e}case 4:{de[pe[G>>2]>>0]=o;g=C;a=v;continue e}case 6:{pe[pe[G>>2]>>2]=o;g=C;a=v;continue e}case 7:{g=pe[G>>2]|0;pe[g>>2]=o;pe[g+4>>2]=((o|0)<0)<<31>>31;g=C;a=v;continue e}default:{g=C;a=v;continue e}}case 112:{h=P|8;c=c>>>0>8?c:8;d=120;E=64;break}case 88:case 120:{h=P;E=64;break}case 111:{u=G;s=pe[u>>2]|0;u=pe[u+4>>2]|0;if((s|0)==0&(u|0)==0)a=O;else{a=O;do{a=a+-1|0;de[a>>0]=s&7|48;s=Kr(s|0,u|0,3)|0;u=re}while(!((s|0)==0&(u|0)==0))}if(!(P&8)){s=P;h=0;f=5839;E=77}else{h=F-a+1|0;s=P;c=(c|0)<(h|0)?h:c;h=0;f=5839;E=77}break}case 105:case 100:{s=G;a=pe[s>>2]|0;s=pe[s+4>>2]|0;if((s|0)<0){a=Wr(0,0,a|0,s|0)|0;s=re;u=G;pe[u>>2]=a;pe[u+4>>2]=s;u=1;f=5839;E=76;break t}if(!(P&2048)){f=P&1;u=f;f=(f|0)==0?5839:5841;E=76}else{u=1;f=5840;E=76}break}case 117:{s=G;a=pe[s>>2]|0;s=pe[s+4>>2]|0;u=0;f=5839;E=76;break}case 99:{de[B>>0]=pe[G>>2];g=B;s=1;h=0;d=5839;a=O;break}case 109:{a=cr()|0;a=lr(pe[a>>2]|0)|0;E=82;break}case 115:{a=pe[G>>2]|0;a=(a|0)!=0?a:5849;E=82;break}case 67:{pe[J>>2]=pe[G>>2];pe[z>>2]=0;pe[G>>2]=J;c=-1;E=86;break}case 83:{if(!c){Br(e,32,k,0,P);a=0;E=98}else E=86;break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{l=+ee[G>>3];pe[K>>2]=0;ee[te>>3]=l;if((pe[te+4>>2]|0)>=0)if(!(P&2048)){M=P&1;S=M;M=(M|0)==0?5857:5862}else{S=1;M=5859}else{l=-l;S=1;M=5856}ee[te>>3]=l;T=pe[te+4>>2]&2146435072;do{if(T>>>0<2146435072|(T|0)==2146435072&0<0){p=+dr(l,K)*2.0;s=p!=0.0;if(s)pe[K>>2]=(pe[K>>2]|0)+-1;x=d|32;if((x|0)==97){g=d&32;v=(g|0)==0?M:M+9|0;m=S|2;a=12-c|0;do{if(!(c>>>0>11|(a|0)==0)){l=8.0;do{a=a+-1|0;l=l*16.0}while((a|0)!=0);if((de[v>>0]|0)==45){l=-(l+(-p-l));break}else{l=p+l-l;break}}else l=p}while(0);s=pe[K>>2]|0;a=(s|0)<0?0-s|0:s;a=Fr(a,((a|0)<0)<<31>>31,U)|0;if((a|0)==(U|0)){de[X>>0]=48;a=X}de[a+-1>>0]=(s>>31&2)+43;h=a+-2|0;de[h>>0]=d+15;f=(c|0)<1;u=(P&8|0)==0;s=V;while(1){M=~~l;a=s+1|0;de[s>>0]=ge[5823+M>>0]|g;l=(l-+(M|0))*16.0;do{if((a-q|0)==1){if(u&(f&l==0.0))break;de[a>>0]=46;a=s+2|0}}while(0);if(!(l!=0.0))break;else s=a}c=(c|0)!=0&(R+a|0)<(c|0)?I+c-h|0:Y-h+a|0;u=c+m|0;Br(e,32,k,u,P);if(!(pe[e>>2]&32))_r(v,m,e)|0;Br(e,48,k,u,P^65536);a=a-q|0;if(!(pe[e>>2]&32))_r(V,a,e)|0;s=H-h|0;Br(e,48,c-(a+s)|0,0,0);if(!(pe[e>>2]&32))_r(h,s,e)|0;Br(e,32,k,u,P^8192);a=(u|0)<(k|0)?k:u;break}a=(c|0)<0?6:c;if(s){s=(pe[K>>2]|0)+-28|0;pe[K>>2]=s;l=p*268435456.0}else{l=p;s=pe[K>>2]|0}T=(s|0)<0?W:D;w=T;s=T;do{b=~~l>>>0;pe[s>>2]=b;s=s+4|0;l=(l-+(b>>>0))*1.0e9}while(l!=0.0);u=s;s=pe[K>>2]|0;if((s|0)>0){f=T;while(1){h=(s|0)>29?29:s;c=u+-4|0;do{if(c>>>0>>0)c=f;else{s=0;do{b=Zr(pe[c>>2]|0,0,h|0)|0;b=Jr(b|0,re|0,s|0,0)|0;s=re;y=sn(b|0,s|0,1e9,0)|0;pe[c>>2]=y;s=an(b|0,s|0,1e9,0)|0;c=c+-4|0}while(c>>>0>=f>>>0);if(!s){c=f;break}c=f+-4|0;pe[c>>2]=s}}while(0);while(1){if(u>>>0<=c>>>0)break;s=u+-4|0;if(!(pe[s>>2]|0))u=s;else break}s=(pe[K>>2]|0)-h|0;pe[K>>2]=s;if((s|0)>0)f=c;else break}}else c=T;if((s|0)<0){v=((a+25|0)/9|0)+1|0;_=(x|0)==102;g=c;while(1){m=0-s|0;m=(m|0)>9?9:m;do{if(g>>>0>>0){s=(1<>>m;c=0;h=g;do{b=pe[h>>2]|0;pe[h>>2]=(b>>>m)+c;c=_e(b&s,f)|0;h=h+4|0}while(h>>>0>>0);s=(pe[g>>2]|0)==0?g+4|0:g;if(!c){c=s;break}pe[u>>2]=c;c=s;u=u+4|0}else c=(pe[g>>2]|0)==0?g+4|0:g}while(0);s=_?T:c;u=(u-s>>2|0)>(v|0)?s+(v<<2)|0:u;s=(pe[K>>2]|0)+m|0;pe[K>>2]=s;if((s|0)>=0){g=c;break}else g=c}}else g=c;do{if(g>>>0>>0){s=(w-g>>2)*9|0;f=pe[g>>2]|0;if(f>>>0<10)break;else c=10;do{c=c*10|0;s=s+1|0}while(f>>>0>=c>>>0)}else s=0}while(0);y=(x|0)==103;b=(a|0)!=0;c=a-((x|0)!=102?s:0)+((b&y)<<31>>31)|0;if((c|0)<(((u-w>>2)*9|0)+-9|0)){h=c+9216|0;_=(h|0)/9|0;c=T+(_+-1023<<2)|0;h=((h|0)%9|0)+1|0;if((h|0)<9){f=10;do{f=f*10|0;h=h+1|0}while((h|0)!=9)}else f=10;m=pe[c>>2]|0;v=(m>>>0)%(f>>>0)|0;if((v|0)==0?(T+(_+-1022<<2)|0)==(u|0):0)f=g;else E=163;do{if((E|0)==163){E=0;p=(((m>>>0)/(f>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;h=(f|0)/2|0;do{if(v>>>0>>0)l=.5;else{if((v|0)==(h|0)?(T+(_+-1022<<2)|0)==(u|0):0){l=1.0;break}l=1.5}}while(0);do{if(S){if((de[M>>0]|0)!=45)break;p=-p;l=-l}}while(0);h=m-v|0;pe[c>>2]=h;if(!(p+l!=p)){f=g;break}x=h+f|0;pe[c>>2]=x;if(x>>>0>999999999){s=g;while(1){f=c+-4|0;pe[c>>2]=0;if(f>>>0>>0){s=s+-4|0;pe[s>>2]=0}x=(pe[f>>2]|0)+1|0;pe[f>>2]=x;if(x>>>0>999999999)c=f;else{g=s;c=f;break}}}s=(w-g>>2)*9|0;h=pe[g>>2]|0;if(h>>>0<10){f=g;break}else f=10;do{f=f*10|0;s=s+1|0}while(h>>>0>=f>>>0);f=g}}while(0);x=c+4|0;g=f;u=u>>>0>x>>>0?x:u}v=0-s|0;while(1){if(u>>>0<=g>>>0){_=0;x=u;break}c=u+-4|0;if(!(pe[c>>2]|0))u=c;else{_=1;x=u;break}}do{if(y){a=(b&1^1)+a|0;if((a|0)>(s|0)&(s|0)>-5){d=d+-1|0;a=a+-1-s|0}else{d=d+-2|0;a=a+-1|0}u=P&8;if(u)break;do{if(_){u=pe[x+-4>>2]|0;if(!u){c=9;break}if(!((u>>>0)%10|0)){f=10;c=0}else{c=0;break}do{f=f*10|0;c=c+1|0}while(((u>>>0)%(f>>>0)|0|0)==0)}else c=9}while(0);u=((x-w>>2)*9|0)+-9|0;if((d|32|0)==102){u=u-c|0;u=(u|0)<0?0:u;a=(a|0)<(u|0)?a:u;u=0;break}else{u=u+s-c|0;u=(u|0)<0?0:u;a=(a|0)<(u|0)?a:u;u=0;break}}else u=P&8}while(0);m=a|u;f=(m|0)!=0&1;h=(d|32|0)==102;if(h){s=(s|0)>0?s:0;d=0}else{c=(s|0)<0?v:s;c=Fr(c,((c|0)<0)<<31>>31,U)|0;if((H-c|0)<2)do{c=c+-1|0;de[c>>0]=48}while((H-c|0)<2);de[c+-1>>0]=(s>>31&2)+43;w=c+-2|0;de[w>>0]=d;s=H-w|0;d=w}v=S+1+a+f+s|0;Br(e,32,k,v,P);if(!(pe[e>>2]&32))_r(M,S,e)|0;Br(e,48,k,v,P^65536);do{if(h){c=g>>>0>T>>>0?T:g;s=c;do{u=Fr(pe[s>>2]|0,0,L)|0;do{if((s|0)==(c|0)){if((u|0)!=(L|0))break;de[j>>0]=48;u=j}else{if(u>>>0<=V>>>0)break;do{u=u+-1|0;de[u>>0]=48}while(u>>>0>V>>>0)}}while(0);if(!(pe[e>>2]&32))_r(u,N-u|0,e)|0;s=s+4|0}while(s>>>0<=T>>>0);do{if(m){if(pe[e>>2]&32)break;_r(5891,1,e)|0}}while(0);if((a|0)>0&s>>>0>>0){u=s;while(1){s=Fr(pe[u>>2]|0,0,L)|0;if(s>>>0>V>>>0)do{s=s+-1|0;de[s>>0]=48}while(s>>>0>V>>>0);if(!(pe[e>>2]&32))_r(s,(a|0)>9?9:a,e)|0;u=u+4|0;s=a+-9|0;if(!((a|0)>9&u>>>0>>0)){a=s;break}else a=s}}Br(e,48,a+9|0,9,0)}else{h=_?x:g+4|0;if((a|0)>-1){f=(u|0)==0;c=g;do{s=Fr(pe[c>>2]|0,0,L)|0;if((s|0)==(L|0)){de[j>>0]=48;s=j}do{if((c|0)==(g|0)){u=s+1|0;if(!(pe[e>>2]&32))_r(s,1,e)|0;if(f&(a|0)<1){s=u;break}if(pe[e>>2]&32){s=u;break}_r(5891,1,e)|0;s=u}else{if(s>>>0<=V>>>0)break;do{s=s+-1|0;de[s>>0]=48}while(s>>>0>V>>>0)}}while(0);u=N-s|0;if(!(pe[e>>2]&32))_r(s,(a|0)>(u|0)?u:a,e)|0;a=a-u|0;c=c+4|0}while(c>>>0>>0&(a|0)>-1)}Br(e,48,a+18|0,18,0);if(pe[e>>2]&32)break;_r(d,H-d|0,e)|0}}while(0);Br(e,32,k,v,P^8192);a=(v|0)<(k|0)?k:v}else{h=(d&32|0)!=0;f=l!=l|0.0!=0.0;s=f?0:S;c=s+3|0;Br(e,32,k,c,u);a=pe[e>>2]|0;if(!(a&32)){_r(M,s,e)|0;a=pe[e>>2]|0}if(!(a&32))_r(f?h?5883:5887:h?5875:5879,3,e)|0;Br(e,32,k,c,P^8192);a=(c|0)<(k|0)?k:c}}while(0);g=C;continue e}default:{u=P;s=c;h=0;d=5839;a=O}}}while(0);t:do{if((E|0)==64){u=G;s=pe[u>>2]|0;u=pe[u+4>>2]|0;f=d&32;if(!((s|0)==0&(u|0)==0)){a=O;do{a=a+-1|0;de[a>>0]=ge[5823+(s&15)>>0]|f;s=Kr(s|0,u|0,4)|0;u=re}while(!((s|0)==0&(u|0)==0));E=G;if((h&8|0)==0|(pe[E>>2]|0)==0&(pe[E+4>>2]|0)==0){s=h;h=0;f=5839;E=77}else{s=h;h=2;f=5839+(d>>4)|0;E=77}}else{a=O;s=h;h=0;f=5839;E=77}}else if((E|0)==76){a=Fr(a,s,O)|0;s=P;h=u;E=77}else if((E|0)==82){E=0;P=Rr(a,0,c)|0;M=(P|0)==0;g=a;s=M?c:P-a|0;h=0;d=5839;a=M?a+c|0:P}else if((E|0)==86){E=0;s=0;a=0;f=pe[G>>2]|0;while(1){u=pe[f>>2]|0;if(!u)break;a=gr(Z,u)|0;if((a|0)<0|a>>>0>(c-s|0)>>>0)break;s=a+s|0;if(c>>>0>s>>>0)f=f+4|0;else break}if((a|0)<0){o=-1;break e}Br(e,32,k,s,P);if(!s){a=0;E=98}else{u=0;c=pe[G>>2]|0;while(1){a=pe[c>>2]|0;if(!a){a=s;E=98;break t}a=gr(Z,a)|0;u=a+u|0;if((u|0)>(s|0)){a=s;E=98;break t}if(!(pe[e>>2]&32))_r(Z,a,e)|0;if(u>>>0>=s>>>0){a=s;E=98;break}else c=c+4|0}}}}while(0);if((E|0)==98){E=0;Br(e,32,k,a,P^8192);g=C;a=(k|0)>(a|0)?k:a;continue}if((E|0)==77){E=0;u=(c|0)>-1?s&-65537:s;s=G;s=(pe[s>>2]|0)!=0|(pe[s+4>>2]|0)!=0;if((c|0)!=0|s){s=(s&1^1)+(F-a)|0;g=a;s=(c|0)>(s|0)?c:s;d=f;a=O}else{g=O;s=0;d=f;a=O}}f=a-g|0;s=(s|0)<(f|0)?f:s;c=h+s|0;a=(k|0)<(c|0)?c:k;Br(e,32,a,c,u);if(!(pe[e>>2]&32))_r(d,h,e)|0;Br(e,48,a,c,u^65536);Br(e,48,s,f,0);if(!(pe[e>>2]&32))_r(g,f,e)|0;Br(e,32,a,c,u^8192);g=C}e:do{if((E|0)==245)if(!e)if(t){o=1;while(1){t=pe[i+(o<<2)>>2]|0;if(!t)break;jr(n+(o<<3)|0,t,r);o=o+1|0;if((o|0)>=10){o=1;break e}}if((o|0)<10)while(1){if(pe[i+(o<<2)>>2]|0){o=-1;break e}o=o+1|0;if((o|0)>=10){o=1;break}}else o=1}else o=0}while(0);ve=$;return o|0}function Lr(e){e=e|0;if(!(pe[e+68>>2]|0))Mr(e);return}function Nr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0;n=e+20|0;i=pe[n>>2]|0;e=(pe[e+16>>2]|0)-i|0;e=e>>>0>r>>>0?r:e;$r(i|0,t|0,e|0)|0;pe[n>>2]=(pe[n>>2]|0)+e;return r|0}function jr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0.0;e:do{if(t>>>0<=20)do{switch(t|0){case 9:{n=(pe[r>>2]|0)+(4-1)&~(4-1);t=pe[n>>2]|0;pe[r>>2]=n+4;pe[e>>2]=t;break e}case 10:{n=(pe[r>>2]|0)+(4-1)&~(4-1);t=pe[n>>2]|0;pe[r>>2]=n+4;n=e;pe[n>>2]=t;pe[n+4>>2]=((t|0)<0)<<31>>31;break e}case 11:{n=(pe[r>>2]|0)+(4-1)&~(4-1);t=pe[n>>2]|0;pe[r>>2]=n+4;n=e;pe[n>>2]=t;pe[n+4>>2]=0;break e}case 12:{n=(pe[r>>2]|0)+(8-1)&~(8-1);t=n;i=pe[t>>2]|0;t=pe[t+4>>2]|0;pe[r>>2]=n+8;n=e;pe[n>>2]=i;pe[n+4>>2]=t;break e}case 13:{i=(pe[r>>2]|0)+(4-1)&~(4-1);n=pe[i>>2]|0;pe[r>>2]=i+4;n=(n&65535)<<16>>16;i=e;pe[i>>2]=n;pe[i+4>>2]=((n|0)<0)<<31>>31;break e}case 14:{i=(pe[r>>2]|0)+(4-1)&~(4-1);n=pe[i>>2]|0;pe[r>>2]=i+4;i=e;pe[i>>2]=n&65535;pe[i+4>>2]=0;break e}case 15:{i=(pe[r>>2]|0)+(4-1)&~(4-1);n=pe[i>>2]|0;pe[r>>2]=i+4;n=(n&255)<<24>>24;i=e;pe[i>>2]=n;pe[i+4>>2]=((n|0)<0)<<31>>31;break e}case 16:{i=(pe[r>>2]|0)+(4-1)&~(4-1);n=pe[i>>2]|0;pe[r>>2]=i+4;i=e;pe[i>>2]=n&255;pe[i+4>>2]=0;break e}case 17:{i=(pe[r>>2]|0)+(8-1)&~(8-1);o=+ee[i>>3];pe[r>>2]=i+8;ee[e>>3]=o;break e}case 18:{i=(pe[r>>2]|0)+(8-1)&~(8-1);o=+ee[i>>3];pe[r>>2]=i+8;ee[e>>3]=o;break e}default:break e}}while(0)}while(0);return}function Fr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0;if(t>>>0>0|(t|0)==0&e>>>0>4294967295)while(1){n=sn(e|0,t|0,10,0)|0;r=r+-1|0;de[r>>0]=n|48;n=an(e|0,t|0,10,0)|0;if(t>>>0>9|(t|0)==9&e>>>0>4294967295){e=n;t=re}else{e=n;break}}if(e)while(1){r=r+-1|0;de[r>>0]=(e>>>0)%10|0|48;if(e>>>0<10)break;else e=(e>>>0)/10|0}return r|0}function Br(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0;s=ve;ve=ve+256|0;a=s;do{if((r|0)>(n|0)&(i&73728|0)==0){i=r-n|0;Vr(a|0,t|0,(i>>>0>256?256:i)|0)|0;t=pe[e>>2]|0;o=(t&32|0)==0;if(i>>>0>255){n=r-n|0;do{if(o){_r(a,256,e)|0;t=pe[e>>2]|0}i=i+-256|0;o=(t&32|0)==0}while(i>>>0>255);if(o)i=n&255;else break}else if(!o)break;_r(a,i,e)|0}}while(0);ve=s;return}function zr(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,S=0,M=0,P=0,C=0,k=0,E=0,A=0,O=0,R=0,I=0,D=0,L=0,N=0,j=0;do{if(e>>>0<245){d=e>>>0<11?16:e+11&-8;e=d>>>3;s=pe[151]|0;r=s>>>e;if(r&3){e=(r&1^1)+e|0;n=e<<1;r=644+(n<<2)|0;n=644+(n+2<<2)|0;i=pe[n>>2]|0;o=i+8|0;a=pe[o>>2]|0;do{if((r|0)!=(a|0)){if(a>>>0<(pe[155]|0)>>>0)Xe();t=a+12|0;if((pe[t>>2]|0)==(i|0)){pe[t>>2]=r;pe[n>>2]=a;break}else Xe()}else pe[151]=s&~(1<>2]=j|3;j=i+(j|4)|0;pe[j>>2]=pe[j>>2]|1;j=o;return j|0}a=pe[153]|0;if(d>>>0>a>>>0){if(r){n=2<>>12&16;n=n>>>u;i=n>>>5&8;n=n>>>i;o=n>>>2&4;n=n>>>o;r=n>>>1&2;n=n>>>r;e=n>>>1&1;e=(i|u|o|r|e)+(n>>>e)|0;n=e<<1;r=644+(n<<2)|0;n=644+(n+2<<2)|0;o=pe[n>>2]|0;u=o+8|0;i=pe[u>>2]|0;do{if((r|0)!=(i|0)){if(i>>>0<(pe[155]|0)>>>0)Xe();t=i+12|0;if((pe[t>>2]|0)==(o|0)){pe[t>>2]=r;pe[n>>2]=i;l=pe[153]|0;break}else Xe()}else{pe[151]=s&~(1<>2]=d|3;s=o+d|0;pe[o+(d|4)>>2]=a|1;pe[o+j>>2]=a;if(l){i=pe[156]|0;r=l>>>3;t=r<<1;n=644+(t<<2)|0;e=pe[151]|0;r=1<>2]|0;if(t>>>0<(pe[155]|0)>>>0)Xe();else{c=e;f=t}}else{pe[151]=e|r;c=644+(t+2<<2)|0;f=n}pe[c>>2]=i;pe[f+12>>2]=i;pe[i+8>>2]=f;pe[i+12>>2]=n}pe[153]=a;pe[156]=s;j=u;return j|0}e=pe[152]|0;if(e){r=(e&0-e)+-1|0;N=r>>>12&16;r=r>>>N;L=r>>>5&8;r=r>>>L;j=r>>>2&4;r=r>>>j;e=r>>>1&2;r=r>>>e;n=r>>>1&1;n=pe[908+((L|N|j|e|n)+(r>>>n)<<2)>>2]|0;r=(pe[n+4>>2]&-8)-d|0;e=n;while(1){t=pe[e+16>>2]|0;if(!t){t=pe[e+20>>2]|0;if(!t){u=r;break}}e=(pe[t+4>>2]&-8)-d|0;j=e>>>0>>0;r=j?e:r;e=t;n=j?t:n}o=pe[155]|0;if(n>>>0>>0)Xe();s=n+d|0;if(n>>>0>=s>>>0)Xe();a=pe[n+24>>2]|0;r=pe[n+12>>2]|0;do{if((r|0)==(n|0)){e=n+20|0;t=pe[e>>2]|0;if(!t){e=n+16|0;t=pe[e>>2]|0;if(!t){h=0;break}}while(1){r=t+20|0;i=pe[r>>2]|0;if(i){t=i;e=r;continue}r=t+16|0;i=pe[r>>2]|0;if(!i)break;else{t=i;e=r}}if(e>>>0>>0)Xe();else{pe[e>>2]=0;h=t;break}}else{i=pe[n+8>>2]|0;if(i>>>0>>0)Xe();t=i+12|0;if((pe[t>>2]|0)!=(n|0))Xe();e=r+8|0;if((pe[e>>2]|0)==(n|0)){pe[t>>2]=r;pe[e>>2]=i;h=r;break}else Xe()}}while(0);do{if(a){t=pe[n+28>>2]|0;e=908+(t<<2)|0;if((n|0)==(pe[e>>2]|0)){pe[e>>2]=h;if(!h){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=a+16|0;if((pe[t>>2]|0)==(n|0))pe[t>>2]=h;else pe[a+20>>2]=h;if(!h)break}e=pe[155]|0;if(h>>>0>>0)Xe();pe[h+24>>2]=a;t=pe[n+16>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{pe[h+16>>2]=t;pe[t+24>>2]=h;break}}while(0);t=pe[n+20>>2]|0;if(t)if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[h+20>>2]=t;pe[t+24>>2]=h;break}}}while(0);if(u>>>0<16){j=u+d|0;pe[n+4>>2]=j|3;j=n+(j+4)|0;pe[j>>2]=pe[j>>2]|1}else{pe[n+4>>2]=d|3;pe[n+(d|4)>>2]=u|1;pe[n+(u+d)>>2]=u;t=pe[153]|0;if(t){o=pe[156]|0;r=t>>>3;t=r<<1;i=644+(t<<2)|0;e=pe[151]|0;r=1<>2]|0;if(e>>>0<(pe[155]|0)>>>0)Xe();else{p=t;g=e}}else{pe[151]=e|r;p=644+(t+2<<2)|0;g=i}pe[p>>2]=o;pe[g+12>>2]=o;pe[o+8>>2]=g;pe[o+12>>2]=i}pe[153]=u;pe[156]=s}j=n+8|0;return j|0}else g=d}else g=d}else if(e>>>0<=4294967231){e=e+11|0;f=e&-8;c=pe[152]|0;if(c){r=0-f|0;e=e>>>8;if(e)if(f>>>0>16777215)l=31;else{g=(e+1048320|0)>>>16&8;b=e<>>16&4;b=b<>>16&2;l=14-(p|g|l)+(b<>>15)|0;l=f>>>(l+7|0)&1|l<<1}else l=0;e=pe[908+(l<<2)>>2]|0;e:do{if(!e){i=0;e=0;b=86}else{a=r;i=0;s=f<<((l|0)==31?0:25-(l>>>1)|0);u=e;e=0;while(1){o=pe[u+4>>2]&-8;r=o-f|0;if(r>>>0>>0)if((o|0)==(f|0)){o=u;e=u;b=90;break e}else e=u;else r=a;b=pe[u+20>>2]|0;u=pe[u+16+(s>>>31<<2)>>2]|0;i=(b|0)==0|(b|0)==(u|0)?i:b;if(!u){b=86;break}else{a=r;s=s<<1}}}}while(0);if((b|0)==86){if((i|0)==0&(e|0)==0){e=2<>>12&16;e=e>>>h;c=e>>>5&8;e=e>>>c;p=e>>>2&4;e=e>>>p;g=e>>>1&2;e=e>>>g;i=e>>>1&1;i=pe[908+((c|h|p|g|i)+(e>>>i)<<2)>>2]|0;e=0}if(!i){s=r;u=e}else{o=i;b=90}}if((b|0)==90)while(1){b=0;g=(pe[o+4>>2]&-8)-f|0;i=g>>>0>>0;r=i?g:r;e=i?o:e;i=pe[o+16>>2]|0;if(i){o=i;b=90;continue}o=pe[o+20>>2]|0;if(!o){s=r;u=e;break}else b=90}if((u|0)!=0?s>>>0<((pe[153]|0)-f|0)>>>0:0){i=pe[155]|0;if(u>>>0>>0)Xe();a=u+f|0;if(u>>>0>=a>>>0)Xe();o=pe[u+24>>2]|0;r=pe[u+12>>2]|0;do{if((r|0)==(u|0)){e=u+20|0;t=pe[e>>2]|0;if(!t){e=u+16|0;t=pe[e>>2]|0;if(!t){d=0;break}}while(1){r=t+20|0;n=pe[r>>2]|0;if(n){t=n;e=r;continue}r=t+16|0;n=pe[r>>2]|0;if(!n)break;else{t=n;e=r}}if(e>>>0>>0)Xe();else{pe[e>>2]=0;d=t;break}}else{n=pe[u+8>>2]|0;if(n>>>0>>0)Xe();t=n+12|0;if((pe[t>>2]|0)!=(u|0))Xe();e=r+8|0;if((pe[e>>2]|0)==(u|0)){pe[t>>2]=r;pe[e>>2]=n;d=r;break}else Xe()}}while(0);do{if(o){t=pe[u+28>>2]|0;e=908+(t<<2)|0;if((u|0)==(pe[e>>2]|0)){pe[e>>2]=d;if(!d){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=o+16|0;if((pe[t>>2]|0)==(u|0))pe[t>>2]=d;else pe[o+20>>2]=d;if(!d)break}e=pe[155]|0;if(d>>>0>>0)Xe();pe[d+24>>2]=o;t=pe[u+16>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{pe[d+16>>2]=t;pe[t+24>>2]=d;break}}while(0);t=pe[u+20>>2]|0;if(t)if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[d+20>>2]=t;pe[t+24>>2]=d;break}}}while(0);e:do{if(s>>>0>=16){pe[u+4>>2]=f|3;pe[u+(f|4)>>2]=s|1;pe[u+(s+f)>>2]=s;t=s>>>3;if(s>>>0<256){e=t<<1;n=644+(e<<2)|0;r=pe[151]|0;t=1<>2]|0;if(e>>>0<(pe[155]|0)>>>0)Xe();else{v=t;_=e}}else{pe[151]=r|t;v=644+(e+2<<2)|0;_=n}pe[v>>2]=a;pe[_+12>>2]=a;pe[u+(f+8)>>2]=_;pe[u+(f+12)>>2]=n;break}t=s>>>8;if(t)if(s>>>0>16777215)n=31;else{N=(t+1048320|0)>>>16&8;j=t<>>16&4;j=j<>>16&2;n=14-(L|N|n)+(j<>>15)|0;n=s>>>(n+7|0)&1|n<<1}else n=0;t=908+(n<<2)|0;pe[u+(f+28)>>2]=n;pe[u+(f+20)>>2]=0;pe[u+(f+16)>>2]=0;e=pe[152]|0;r=1<>2]=a;pe[u+(f+24)>>2]=t;pe[u+(f+12)>>2]=a;pe[u+(f+8)>>2]=a;break}t=pe[t>>2]|0;t:do{if((pe[t+4>>2]&-8|0)!=(s|0)){n=s<<((n|0)==31?0:25-(n>>>1)|0);while(1){e=t+16+(n>>>31<<2)|0;r=pe[e>>2]|0;if(!r)break;if((pe[r+4>>2]&-8|0)==(s|0)){T=r;break t}else{n=n<<1;t=r}}if(e>>>0<(pe[155]|0)>>>0)Xe();else{pe[e>>2]=a;pe[u+(f+24)>>2]=t;pe[u+(f+12)>>2]=a;pe[u+(f+8)>>2]=a;break e}}else T=t}while(0);t=T+8|0;e=pe[t>>2]|0;j=pe[155]|0;if(e>>>0>=j>>>0&T>>>0>=j>>>0){pe[e+12>>2]=a;pe[t>>2]=a;pe[u+(f+8)>>2]=e;pe[u+(f+12)>>2]=T;pe[u+(f+24)>>2]=0;break}else Xe()}else{j=s+f|0;pe[u+4>>2]=j|3;j=u+(j+4)|0;pe[j>>2]=pe[j>>2]|1}}while(0);j=u+8|0;return j|0}else g=f}else g=f}else g=-1}while(0);r=pe[153]|0;if(r>>>0>=g>>>0){t=r-g|0;e=pe[156]|0;if(t>>>0>15){pe[156]=e+g;pe[153]=t;pe[e+(g+4)>>2]=t|1;pe[e+r>>2]=t;pe[e+4>>2]=g|3}else{pe[153]=0;pe[156]=0;pe[e+4>>2]=r|3;j=e+(r+4)|0;pe[j>>2]=pe[j>>2]|1}j=e+8|0;return j|0}e=pe[154]|0;if(e>>>0>g>>>0){N=e-g|0;pe[154]=N;j=pe[157]|0;pe[157]=j+g;pe[j+(g+4)>>2]=N|1;pe[j+4>>2]=g|3;j=j+8|0;return j|0}do{if(!(pe[269]|0)){e=Ie(30)|0;if(!(e+-1&e)){pe[271]=e;pe[270]=e;pe[272]=-1;pe[273]=-1;pe[274]=0;pe[262]=0;T=(He(0)|0)&-16^1431655768;pe[269]=T;break}else Xe()}}while(0);u=g+48|0;s=pe[271]|0;l=g+47|0;a=s+l|0;s=0-s|0;c=a&s;if(c>>>0<=g>>>0){j=0;return j|0}e=pe[261]|0;if((e|0)!=0?(_=pe[259]|0,T=_+c|0,T>>>0<=_>>>0|T>>>0>e>>>0):0){j=0;return j|0}e:do{if(!(pe[262]&4)){e=pe[157]|0;t:do{if(e){i=1052;while(1){r=pe[i>>2]|0;if(r>>>0<=e>>>0?(m=i+4|0,(r+(pe[m>>2]|0)|0)>>>0>e>>>0):0){o=i;e=m;break}i=pe[i+8>>2]|0;if(!i){b=174;break t}}r=a-(pe[154]|0)&s;if(r>>>0<2147483647){i=Ae(r|0)|0;T=(i|0)==((pe[o>>2]|0)+(pe[e>>2]|0)|0);e=T?r:0;if(T){if((i|0)!=(-1|0)){x=i;p=e;b=194;break e}}else b=184}else e=0}else b=174}while(0);do{if((b|0)==174){o=Ae(0)|0;if((o|0)!=(-1|0)){e=o;r=pe[270]|0;i=r+-1|0;if(!(i&e))r=c;else r=c-e+(i+e&0-r)|0;e=pe[259]|0;i=e+r|0;if(r>>>0>g>>>0&r>>>0<2147483647){T=pe[261]|0;if((T|0)!=0?i>>>0<=e>>>0|i>>>0>T>>>0:0){e=0;break}i=Ae(r|0)|0;T=(i|0)==(o|0);e=T?r:0;if(T){x=o;p=e;b=194;break e}else b=184}else e=0}else e=0}}while(0);t:do{if((b|0)==184){o=0-r|0;do{if(u>>>0>r>>>0&(r>>>0<2147483647&(i|0)!=(-1|0))?(y=pe[271]|0,y=l-r+y&0-y,y>>>0<2147483647):0)if((Ae(y|0)|0)==(-1|0)){Ae(o|0)|0;break t}else{r=y+r|0;break}}while(0);if((i|0)!=(-1|0)){x=i;p=r;b=194;break e}}}while(0);pe[262]=pe[262]|4;b=191}else{e=0;b=191}}while(0);if((((b|0)==191?c>>>0<2147483647:0)?(x=Ae(c|0)|0,w=Ae(0)|0,x>>>0>>0&((x|0)!=(-1|0)&(w|0)!=(-1|0))):0)?(S=w-x|0,M=S>>>0>(g+40|0)>>>0,M):0){p=M?S:e;b=194}if((b|0)==194){e=(pe[259]|0)+p|0;pe[259]=e;if(e>>>0>(pe[260]|0)>>>0)pe[260]=e;a=pe[157]|0;e:do{if(a){o=1052;do{e=pe[o>>2]|0;r=o+4|0;i=pe[r>>2]|0;if((x|0)==(e+i|0)){P=e;C=r;k=i;E=o;b=204;break}o=pe[o+8>>2]|0}while((o|0)!=0);if(((b|0)==204?(pe[E+12>>2]&8|0)==0:0)?a>>>0>>0&a>>>0>=P>>>0:0){pe[C>>2]=k+p;j=(pe[154]|0)+p|0;N=a+8|0;N=(N&7|0)==0?0:0-N&7;L=j-N|0;pe[157]=a+N;pe[154]=L;pe[a+(N+4)>>2]=L|1;pe[a+(j+4)>>2]=40;pe[158]=pe[273];break}e=pe[155]|0;if(x>>>0>>0){pe[155]=x;e=x}r=x+p|0;o=1052;while(1){if((pe[o>>2]|0)==(r|0)){i=o;r=o;b=212;break}o=pe[o+8>>2]|0;if(!o){r=1052;break}}if((b|0)==212)if(!(pe[r+12>>2]&8)){pe[i>>2]=x;h=r+4|0;pe[h>>2]=(pe[h>>2]|0)+p;h=x+8|0;h=(h&7|0)==0?0:0-h&7;l=x+(p+8)|0;l=(l&7|0)==0?0:0-l&7;t=x+(l+p)|0;f=h+g|0;d=x+f|0;c=t-(x+h)-g|0;pe[x+(h+4)>>2]=g|3;t:do{if((t|0)!=(a|0)){if((t|0)==(pe[156]|0)){j=(pe[153]|0)+c|0;pe[153]=j;pe[156]=d;pe[x+(f+4)>>2]=j|1;pe[x+(j+f)>>2]=j;break}s=p+4|0;r=pe[x+(s+l)>>2]|0;if((r&3|0)==1){u=r&-8;o=r>>>3;r:do{if(r>>>0>=256){a=pe[x+((l|24)+p)>>2]|0;n=pe[x+(p+12+l)>>2]|0;do{if((n|0)==(t|0)){i=l|16;n=x+(s+i)|0;r=pe[n>>2]|0;if(!r){n=x+(i+p)|0;r=pe[n>>2]|0;if(!r){D=0;break}}while(1){i=r+20|0;o=pe[i>>2]|0;if(o){r=o;n=i;continue}i=r+16|0;o=pe[i>>2]|0;if(!o)break;else{r=o;n=i}}if(n>>>0>>0)Xe();else{pe[n>>2]=0;D=r;break}}else{i=pe[x+((l|8)+p)>>2]|0;if(i>>>0>>0)Xe();e=i+12|0;if((pe[e>>2]|0)!=(t|0))Xe();r=n+8|0;if((pe[r>>2]|0)==(t|0)){pe[e>>2]=n;pe[r>>2]=i;D=n;break}else Xe()}}while(0);if(!a)break;e=pe[x+(p+28+l)>>2]|0;r=908+(e<<2)|0;do{if((t|0)!=(pe[r>>2]|0)){if(a>>>0<(pe[155]|0)>>>0)Xe();e=a+16|0;if((pe[e>>2]|0)==(t|0))pe[e>>2]=D;else pe[a+20>>2]=D;if(!D)break r}else{pe[r>>2]=D;if(D)break;pe[152]=pe[152]&~(1<>>0>>0)Xe();pe[D+24>>2]=a;t=l|16;e=pe[x+(t+p)>>2]|0;do{if(e)if(e>>>0>>0)Xe();else{pe[D+16>>2]=e;pe[e+24>>2]=D;break}}while(0);t=pe[x+(s+t)>>2]|0;if(!t)break;if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[D+20>>2]=t;pe[t+24>>2]=D;break}}else{n=pe[x+((l|8)+p)>>2]|0;i=pe[x+(p+12+l)>>2]|0;r=644+(o<<1<<2)|0;do{if((n|0)!=(r|0)){if(n>>>0>>0)Xe();if((pe[n+12>>2]|0)==(t|0))break;Xe()}}while(0);if((i|0)==(n|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();e=i+8|0;if((pe[e>>2]|0)==(t|0)){A=e;break}Xe()}}while(0);pe[n+12>>2]=i;pe[A>>2]=n}}while(0);t=x+((u|l)+p)|0;i=u+c|0}else i=c;t=t+4|0;pe[t>>2]=pe[t>>2]&-2;pe[x+(f+4)>>2]=i|1;pe[x+(i+f)>>2]=i;t=i>>>3;if(i>>>0<256){e=t<<1;n=644+(e<<2)|0;r=pe[151]|0;t=1<>2]|0;if(e>>>0>=(pe[155]|0)>>>0){L=t;N=e;break}Xe()}}while(0);pe[L>>2]=d;pe[N+12>>2]=d;pe[x+(f+8)>>2]=N;pe[x+(f+12)>>2]=n;break}t=i>>>8;do{if(!t)n=0;else{if(i>>>0>16777215){n=31;break}L=(t+1048320|0)>>>16&8;N=t<>>16&4;N=N<>>16&2;n=14-(D|L|n)+(N<>>15)|0;n=i>>>(n+7|0)&1|n<<1}}while(0);t=908+(n<<2)|0;pe[x+(f+28)>>2]=n;pe[x+(f+20)>>2]=0;pe[x+(f+16)>>2]=0;e=pe[152]|0;r=1<>2]=d;pe[x+(f+24)>>2]=t;pe[x+(f+12)>>2]=d;pe[x+(f+8)>>2]=d;break}t=pe[t>>2]|0;r:do{if((pe[t+4>>2]&-8|0)!=(i|0)){n=i<<((n|0)==31?0:25-(n>>>1)|0);while(1){e=t+16+(n>>>31<<2)|0;r=pe[e>>2]|0;if(!r)break;if((pe[r+4>>2]&-8|0)==(i|0)){j=r;break r}else{n=n<<1;t=r}}if(e>>>0<(pe[155]|0)>>>0)Xe();else{pe[e>>2]=d;pe[x+(f+24)>>2]=t;pe[x+(f+12)>>2]=d;pe[x+(f+8)>>2]=d;break t}}else j=t}while(0);t=j+8|0;e=pe[t>>2]|0;N=pe[155]|0;if(e>>>0>=N>>>0&j>>>0>=N>>>0){pe[e+12>>2]=d;pe[t>>2]=d;pe[x+(f+8)>>2]=e;pe[x+(f+12)>>2]=j;pe[x+(f+24)>>2]=0;break}else Xe()}else{j=(pe[154]|0)+c|0;pe[154]=j;pe[157]=d;pe[x+(f+4)>>2]=j|1}}while(0);j=x+(h|8)|0;return j|0}else r=1052;while(1){e=pe[r>>2]|0;if(e>>>0<=a>>>0?(t=pe[r+4>>2]|0,n=e+t|0,n>>>0>a>>>0):0)break;r=pe[r+8>>2]|0}i=e+(t+-39)|0;e=e+(t+-47+((i&7|0)==0?0:0-i&7))|0;i=a+16|0;e=e>>>0>>0?a:e;t=e+8|0;r=x+8|0;r=(r&7|0)==0?0:0-r&7;j=p+-40-r|0;pe[157]=x+r;pe[154]=j;pe[x+(r+4)>>2]=j|1;pe[x+(p+-36)>>2]=40;pe[158]=pe[273];r=e+4|0;pe[r>>2]=27;pe[t>>2]=pe[263];pe[t+4>>2]=pe[264];pe[t+8>>2]=pe[265];pe[t+12>>2]=pe[266];pe[263]=x;pe[264]=p;pe[266]=0;pe[265]=t;t=e+28|0;pe[t>>2]=7;if((e+32|0)>>>0>>0)do{j=t;t=t+4|0;pe[t>>2]=7}while((j+8|0)>>>0>>0);if((e|0)!=(a|0)){o=e-a|0;pe[r>>2]=pe[r>>2]&-2;pe[a+4>>2]=o|1;pe[e>>2]=o;t=o>>>3;if(o>>>0<256){e=t<<1;n=644+(e<<2)|0;r=pe[151]|0;t=1<>2]|0;if(e>>>0<(pe[155]|0)>>>0)Xe();else{O=t;R=e}}else{pe[151]=r|t;O=644+(e+2<<2)|0;R=n}pe[O>>2]=a;pe[R+12>>2]=a;pe[a+8>>2]=R;pe[a+12>>2]=n;break}t=o>>>8;if(t)if(o>>>0>16777215)n=31;else{N=(t+1048320|0)>>>16&8;j=t<>>16&4;j=j<>>16&2;n=14-(L|N|n)+(j<>>15)|0;n=o>>>(n+7|0)&1|n<<1}else n=0;r=908+(n<<2)|0;pe[a+28>>2]=n;pe[a+20>>2]=0;pe[i>>2]=0;t=pe[152]|0;e=1<>2]=a;pe[a+24>>2]=r;pe[a+12>>2]=a;pe[a+8>>2]=a;break}t=pe[r>>2]|0;t:do{if((pe[t+4>>2]&-8|0)!=(o|0)){n=o<<((n|0)==31?0:25-(n>>>1)|0);while(1){e=t+16+(n>>>31<<2)|0;r=pe[e>>2]|0;if(!r)break;if((pe[r+4>>2]&-8|0)==(o|0)){I=r;break t}else{n=n<<1;t=r}}if(e>>>0<(pe[155]|0)>>>0)Xe();else{pe[e>>2]=a;pe[a+24>>2]=t;pe[a+12>>2]=a;pe[a+8>>2]=a;break e}}else I=t}while(0);t=I+8|0;e=pe[t>>2]|0;j=pe[155]|0;if(e>>>0>=j>>>0&I>>>0>=j>>>0){pe[e+12>>2]=a;pe[t>>2]=a;pe[a+8>>2]=e;pe[a+12>>2]=I;pe[a+24>>2]=0;break}else Xe()}}else{j=pe[155]|0;if((j|0)==0|x>>>0>>0)pe[155]=x;pe[263]=x;pe[264]=p;pe[266]=0;pe[160]=pe[269];pe[159]=-1;t=0;do{j=t<<1;N=644+(j<<2)|0;pe[644+(j+3<<2)>>2]=N;pe[644+(j+2<<2)>>2]=N;t=t+1|0}while((t|0)!=32);j=x+8|0;j=(j&7|0)==0?0:0-j&7;N=p+-40-j|0;pe[157]=x+j;pe[154]=N;pe[x+(j+4)>>2]=N|1;pe[x+(p+-36)>>2]=40;pe[158]=pe[273]}}while(0);t=pe[154]|0;if(t>>>0>g>>>0){N=t-g|0;pe[154]=N;j=pe[157]|0;pe[157]=j+g;pe[j+(g+4)>>2]=N|1;pe[j+4>>2]=g|3;j=j+8|0;return j|0}}j=cr()|0;pe[j>>2]=12;j=0;return j|0}function Ur(e){e=e|0;var t=0,r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0,y=0;if(!e)return;t=e+-8|0;s=pe[155]|0;if(t>>>0>>0)Xe();r=pe[e+-4>>2]|0;n=r&3;if((n|0)==1)Xe();d=r&-8;g=e+(d+-8)|0;do{if(!(r&1)){t=pe[t>>2]|0;if(!n)return;u=-8-t|0;c=e+u|0;f=t+d|0;if(c>>>0>>0)Xe();if((c|0)==(pe[156]|0)){t=e+(d+-4)|0;r=pe[t>>2]|0;if((r&3|0)!=3){y=c;o=f;break}pe[153]=f;pe[t>>2]=r&-2;pe[e+(u+4)>>2]=f|1;pe[g>>2]=f;return}i=t>>>3;if(t>>>0<256){n=pe[e+(u+8)>>2]|0;r=pe[e+(u+12)>>2]|0;t=644+(i<<1<<2)|0;if((n|0)!=(t|0)){if(n>>>0>>0)Xe();if((pe[n+12>>2]|0)!=(c|0))Xe()}if((r|0)==(n|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();t=r+8|0;if((pe[t>>2]|0)==(c|0))a=t;else Xe()}else a=r+8|0;pe[n+12>>2]=r;pe[a>>2]=n;y=c;o=f;break}a=pe[e+(u+24)>>2]|0;n=pe[e+(u+12)>>2]|0;do{if((n|0)==(c|0)){r=e+(u+20)|0;t=pe[r>>2]|0;if(!t){r=e+(u+16)|0;t=pe[r>>2]|0;if(!t){l=0;break}}while(1){n=t+20|0;i=pe[n>>2]|0;if(i){t=i;r=n;continue}n=t+16|0;i=pe[n>>2]|0;if(!i)break;else{t=i;r=n}}if(r>>>0>>0)Xe();else{pe[r>>2]=0;l=t;break}}else{i=pe[e+(u+8)>>2]|0;if(i>>>0>>0)Xe();t=i+12|0;if((pe[t>>2]|0)!=(c|0))Xe();r=n+8|0;if((pe[r>>2]|0)==(c|0)){pe[t>>2]=n;pe[r>>2]=i;l=n;break}else Xe()}}while(0);if(a){t=pe[e+(u+28)>>2]|0;r=908+(t<<2)|0;if((c|0)==(pe[r>>2]|0)){pe[r>>2]=l;if(!l){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=a+16|0;if((pe[t>>2]|0)==(c|0))pe[t>>2]=l;else pe[a+20>>2]=l;if(!l){y=c;o=f;break}}r=pe[155]|0;if(l>>>0>>0)Xe();pe[l+24>>2]=a;t=pe[e+(u+16)>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{pe[l+16>>2]=t;pe[t+24>>2]=l;break}}while(0);t=pe[e+(u+20)>>2]|0;if(t)if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[l+20>>2]=t;pe[t+24>>2]=l;y=c;o=f;break}else{y=c;o=f}}else{y=c;o=f}}else{y=t;o=d}}while(0);if(y>>>0>=g>>>0)Xe();t=e+(d+-4)|0;r=pe[t>>2]|0;if(!(r&1))Xe();if(!(r&2)){if((g|0)==(pe[157]|0)){_=(pe[154]|0)+o|0;pe[154]=_;pe[157]=y;pe[y+4>>2]=_|1;if((y|0)!=(pe[156]|0))return;pe[156]=0;pe[153]=0;return}if((g|0)==(pe[156]|0)){_=(pe[153]|0)+o|0;pe[153]=_;pe[156]=y;pe[y+4>>2]=_|1;pe[y+_>>2]=_;return}o=(r&-8)+o|0;i=r>>>3;do{if(r>>>0>=256){a=pe[e+(d+16)>>2]|0;t=pe[e+(d|4)>>2]|0;do{if((t|0)==(g|0)){r=e+(d+12)|0;t=pe[r>>2]|0;if(!t){r=e+(d+8)|0;t=pe[r>>2]|0;if(!t){p=0;break}}while(1){n=t+20|0;i=pe[n>>2]|0;if(i){t=i;r=n;continue}n=t+16|0;i=pe[n>>2]|0;if(!i)break;else{t=i;r=n}}if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[r>>2]=0;p=t;break}}else{r=pe[e+d>>2]|0;if(r>>>0<(pe[155]|0)>>>0)Xe();n=r+12|0;if((pe[n>>2]|0)!=(g|0))Xe();i=t+8|0;if((pe[i>>2]|0)==(g|0)){pe[n>>2]=t;pe[i>>2]=r;p=t;break}else Xe()}}while(0);if(a){t=pe[e+(d+20)>>2]|0;r=908+(t<<2)|0;if((g|0)==(pe[r>>2]|0)){pe[r>>2]=p;if(!p){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=a+16|0;if((pe[t>>2]|0)==(g|0))pe[t>>2]=p;else pe[a+20>>2]=p;if(!p)break}r=pe[155]|0;if(p>>>0>>0)Xe();pe[p+24>>2]=a;t=pe[e+(d+8)>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{pe[p+16>>2]=t;pe[t+24>>2]=p;break}}while(0);t=pe[e+(d+12)>>2]|0;if(t)if(t>>>0<(pe[155]|0)>>>0)Xe();else{pe[p+20>>2]=t;pe[t+24>>2]=p;break}}}else{n=pe[e+d>>2]|0;r=pe[e+(d|4)>>2]|0;t=644+(i<<1<<2)|0;if((n|0)!=(t|0)){if(n>>>0<(pe[155]|0)>>>0)Xe();if((pe[n+12>>2]|0)!=(g|0))Xe()}if((r|0)==(n|0)){pe[151]=pe[151]&~(1<>>0<(pe[155]|0)>>>0)Xe();t=r+8|0;if((pe[t>>2]|0)==(g|0))h=t;else Xe()}else h=r+8|0;pe[n+12>>2]=r;pe[h>>2]=n}}while(0);pe[y+4>>2]=o|1;pe[y+o>>2]=o;if((y|0)==(pe[156]|0)){pe[153]=o;return}}else{pe[t>>2]=r&-2;pe[y+4>>2]=o|1;pe[y+o>>2]=o}t=o>>>3;if(o>>>0<256){r=t<<1;i=644+(r<<2)|0;n=pe[151]|0;t=1<>2]|0;if(r>>>0<(pe[155]|0)>>>0)Xe();else{m=t;v=r}}else{pe[151]=n|t;m=644+(r+2<<2)|0;v=i}pe[m>>2]=y;pe[v+12>>2]=y;pe[y+8>>2]=v;pe[y+12>>2]=i;return}t=o>>>8;if(t)if(o>>>0>16777215)i=31;else{m=(t+1048320|0)>>>16&8;v=t<>>16&4;v=v<>>16&2;i=14-(g|m|i)+(v<>>15)|0;i=o>>>(i+7|0)&1|i<<1}else i=0;t=908+(i<<2)|0;pe[y+28>>2]=i;pe[y+20>>2]=0;pe[y+16>>2]=0;r=pe[152]|0;n=1<>2]|0;t:do{if((pe[t+4>>2]&-8|0)!=(o|0)){i=o<<((i|0)==31?0:25-(i>>>1)|0);while(1){r=t+16+(i>>>31<<2)|0;n=pe[r>>2]|0;if(!n)break;if((pe[n+4>>2]&-8|0)==(o|0)){_=n;break t}else{i=i<<1;t=n}}if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[r>>2]=y;pe[y+24>>2]=t;pe[y+12>>2]=y;pe[y+8>>2]=y;break e}}else _=t}while(0);t=_+8|0;r=pe[t>>2]|0;v=pe[155]|0;if(r>>>0>=v>>>0&_>>>0>=v>>>0){pe[r+12>>2]=y;pe[t>>2]=y;pe[y+8>>2]=r;pe[y+12>>2]=_;pe[y+24>>2]=0;break}else Xe()}else{pe[152]=r|n;pe[t>>2]=y;pe[y+24>>2]=t;pe[y+12>>2]=y;pe[y+8>>2]=y}}while(0);y=(pe[159]|0)+-1|0;pe[159]=y;if(!y)t=1060;else return;while(1){t=pe[t>>2]|0;if(!t)break;else t=t+8|0}pe[159]=-1;return}function Xr(e,t){e=e|0;t=t|0;var r=0,n=0;if(!e){e=zr(t)|0;return e|0}if(t>>>0>4294967231){e=cr()|0;pe[e>>2]=12;e=0;return e|0}r=Hr(e+-8|0,t>>>0<11?16:t+11&-8)|0;if(r){e=r+8|0;return e|0}r=zr(t)|0;if(!r){e=0;return e|0}n=pe[e+-4>>2]|0;n=(n&-8)-((n&3|0)==0?8:4)|0;$r(r|0,e|0,(n>>>0>>0?n:t)|0)|0;Ur(e);e=r;return e|0}function qr(e){e=e|0;var t=0;if(!e){t=0;return t|0}e=pe[e+-4>>2]|0;t=e&3;if((t|0)==1){t=0;return t|0}t=(e&-8)-((t|0)==0?8:4)|0;return t|0}function Hr(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;d=e+4|0;p=pe[d>>2]|0;u=p&-8;c=e+u|0;s=pe[155]|0;r=p&3;if(!((r|0)!=1&e>>>0>=s>>>0&e>>>0>>0))Xe();n=e+(u|4)|0;i=pe[n>>2]|0;if(!(i&1))Xe();if(!r){if(t>>>0<256){e=0;return e|0}if(u>>>0>=(t+4|0)>>>0?(u-t|0)>>>0<=pe[271]<<1>>>0:0)return e|0;e=0;return e|0}if(u>>>0>=t>>>0){r=u-t|0;if(r>>>0<=15)return e|0;pe[d>>2]=p&1|t|2;pe[e+(t+4)>>2]=r|3;pe[n>>2]=pe[n>>2]|1;Yr(e+t|0,r);return e|0}if((c|0)==(pe[157]|0)){r=(pe[154]|0)+u|0;if(r>>>0<=t>>>0){e=0;return e|0}h=r-t|0;pe[d>>2]=p&1|t|2;pe[e+(t+4)>>2]=h|1;pe[157]=e+t;pe[154]=h;return e|0}if((c|0)==(pe[156]|0)){n=(pe[153]|0)+u|0;if(n>>>0>>0){e=0;return e|0}r=n-t|0;if(r>>>0>15){pe[d>>2]=p&1|t|2;pe[e+(t+4)>>2]=r|1;pe[e+n>>2]=r;n=e+(n+4)|0;pe[n>>2]=pe[n>>2]&-2;n=e+t|0}else{pe[d>>2]=p&1|n|2;n=e+(n+4)|0;pe[n>>2]=pe[n>>2]|1;n=0;r=0}pe[153]=r;pe[156]=n;return e|0}if(i&2){e=0;return e|0}f=(i&-8)+u|0;if(f>>>0>>0){e=0;return e|0}h=f-t|0;o=i>>>3;do{if(i>>>0>=256){a=pe[e+(u+24)>>2]|0;o=pe[e+(u+12)>>2]|0;do{if((o|0)==(c|0)){n=e+(u+20)|0;r=pe[n>>2]|0;if(!r){n=e+(u+16)|0;r=pe[n>>2]|0;if(!r){l=0;break}}while(1){i=r+20|0;o=pe[i>>2]|0;if(o){r=o;n=i;continue}i=r+16|0;o=pe[i>>2]|0;if(!o)break;else{r=o;n=i}}if(n>>>0>>0)Xe();else{pe[n>>2]=0;l=r;break}}else{i=pe[e+(u+8)>>2]|0;if(i>>>0>>0)Xe();r=i+12|0;if((pe[r>>2]|0)!=(c|0))Xe();n=o+8|0;if((pe[n>>2]|0)==(c|0)){pe[r>>2]=o;pe[n>>2]=i;l=o;break}else Xe()}}while(0);if(a){r=pe[e+(u+28)>>2]|0;n=908+(r<<2)|0;if((c|0)==(pe[n>>2]|0)){pe[n>>2]=l;if(!l){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();r=a+16|0;if((pe[r>>2]|0)==(c|0))pe[r>>2]=l;else pe[a+20>>2]=l;if(!l)break}n=pe[155]|0;if(l>>>0>>0)Xe();pe[l+24>>2]=a;r=pe[e+(u+16)>>2]|0;do{if(r)if(r>>>0>>0)Xe();else{pe[l+16>>2]=r;pe[r+24>>2]=l;break}}while(0);r=pe[e+(u+20)>>2]|0;if(r)if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[l+20>>2]=r;pe[r+24>>2]=l;break}}}else{i=pe[e+(u+8)>>2]|0;n=pe[e+(u+12)>>2]|0;r=644+(o<<1<<2)|0;if((i|0)!=(r|0)){if(i>>>0>>0)Xe();if((pe[i+12>>2]|0)!=(c|0))Xe()}if((n|0)==(i|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();r=n+8|0;if((pe[r>>2]|0)==(c|0))a=r;else Xe()}else a=n+8|0;pe[i+12>>2]=n;pe[a>>2]=i}}while(0);if(h>>>0<16){pe[d>>2]=f|p&1|2;t=e+(f|4)|0;pe[t>>2]=pe[t>>2]|1;return e|0}else{pe[d>>2]=p&1|t|2;pe[e+(t+4)>>2]=h|3;p=e+(f|4)|0;pe[p>>2]=pe[p>>2]|1;Yr(e+t|0,h);return e|0}return 0}function Yr(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0,g=0,m=0,v=0,_=0;g=e+t|0;r=pe[e+4>>2]|0;do{if(!(r&1)){l=pe[e>>2]|0;if(!(r&3))return;h=e+(0-l)|0;f=l+t|0;u=pe[155]|0;if(h>>>0>>0)Xe();if((h|0)==(pe[156]|0)){n=e+(t+4)|0;r=pe[n>>2]|0;if((r&3|0)!=3){_=h;a=f;break}pe[153]=f;pe[n>>2]=r&-2;pe[e+(4-l)>>2]=f|1;pe[g>>2]=f;return}o=l>>>3;if(l>>>0<256){i=pe[e+(8-l)>>2]|0;n=pe[e+(12-l)>>2]|0;r=644+(o<<1<<2)|0;if((i|0)!=(r|0)){if(i>>>0>>0)Xe();if((pe[i+12>>2]|0)!=(h|0))Xe()}if((n|0)==(i|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();r=n+8|0;if((pe[r>>2]|0)==(h|0))s=r;else Xe()}else s=n+8|0;pe[i+12>>2]=n;pe[s>>2]=i;_=h;a=f;break}s=pe[e+(24-l)>>2]|0;i=pe[e+(12-l)>>2]|0;do{if((i|0)==(h|0)){i=16-l|0;n=e+(i+4)|0;r=pe[n>>2]|0;if(!r){n=e+i|0;r=pe[n>>2]|0;if(!r){c=0;break}}while(1){i=r+20|0;o=pe[i>>2]|0;if(o){r=o;n=i;continue}i=r+16|0;o=pe[i>>2]|0;if(!o)break;else{r=o;n=i}}if(n>>>0>>0)Xe();else{pe[n>>2]=0;c=r;break}}else{o=pe[e+(8-l)>>2]|0;if(o>>>0>>0)Xe();r=o+12|0;if((pe[r>>2]|0)!=(h|0))Xe();n=i+8|0;if((pe[n>>2]|0)==(h|0)){pe[r>>2]=i;pe[n>>2]=o;c=i;break}else Xe()}}while(0);if(s){r=pe[e+(28-l)>>2]|0;n=908+(r<<2)|0;if((h|0)==(pe[n>>2]|0)){pe[n>>2]=c;if(!c){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();r=s+16|0;if((pe[r>>2]|0)==(h|0))pe[r>>2]=c;else pe[s+20>>2]=c;if(!c){_=h;a=f;break}}i=pe[155]|0;if(c>>>0>>0)Xe();pe[c+24>>2]=s;r=16-l|0;n=pe[e+r>>2]|0;do{if(n)if(n>>>0>>0)Xe();else{pe[c+16>>2]=n;pe[n+24>>2]=c;break}}while(0);r=pe[e+(r+4)>>2]|0;if(r)if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[c+20>>2]=r;pe[r+24>>2]=c;_=h;a=f;break}else{_=h;a=f}}else{_=h;a=f}}else{_=e;a=t}}while(0);u=pe[155]|0;if(g>>>0>>0)Xe();r=e+(t+4)|0;n=pe[r>>2]|0;if(!(n&2)){if((g|0)==(pe[157]|0)){v=(pe[154]|0)+a|0;pe[154]=v;pe[157]=_;pe[_+4>>2]=v|1;if((_|0)!=(pe[156]|0))return;pe[156]=0;pe[153]=0;return}if((g|0)==(pe[156]|0)){v=(pe[153]|0)+a|0;pe[153]=v;pe[156]=_;pe[_+4>>2]=v|1;pe[_+v>>2]=v;return}a=(n&-8)+a|0;o=n>>>3;do{if(n>>>0>=256){s=pe[e+(t+24)>>2]|0;i=pe[e+(t+12)>>2]|0;do{if((i|0)==(g|0)){n=e+(t+20)|0;r=pe[n>>2]|0;if(!r){n=e+(t+16)|0;r=pe[n>>2]|0;if(!r){p=0;break}}while(1){i=r+20|0;o=pe[i>>2]|0;if(o){r=o;n=i;continue}i=r+16|0;o=pe[i>>2]|0;if(!o)break;else{r=o;n=i}}if(n>>>0>>0)Xe();else{pe[n>>2]=0;p=r;break}}else{o=pe[e+(t+8)>>2]|0;if(o>>>0>>0)Xe();r=o+12|0;if((pe[r>>2]|0)!=(g|0))Xe();n=i+8|0;if((pe[n>>2]|0)==(g|0)){pe[r>>2]=i;pe[n>>2]=o;p=i;break}else Xe()}}while(0);if(s){r=pe[e+(t+28)>>2]|0;n=908+(r<<2)|0;if((g|0)==(pe[n>>2]|0)){pe[n>>2]=p;if(!p){pe[152]=pe[152]&~(1<>>0<(pe[155]|0)>>>0)Xe();r=s+16|0;if((pe[r>>2]|0)==(g|0))pe[r>>2]=p;else pe[s+20>>2]=p;if(!p)break}n=pe[155]|0;if(p>>>0>>0)Xe();pe[p+24>>2]=s;r=pe[e+(t+16)>>2]|0;do{if(r)if(r>>>0>>0)Xe();else{pe[p+16>>2]=r;pe[r+24>>2]=p;break}}while(0);r=pe[e+(t+20)>>2]|0;if(r)if(r>>>0<(pe[155]|0)>>>0)Xe();else{pe[p+20>>2]=r;pe[r+24>>2]=p;break}}}else{i=pe[e+(t+8)>>2]|0;n=pe[e+(t+12)>>2]|0;r=644+(o<<1<<2)|0;if((i|0)!=(r|0)){if(i>>>0>>0)Xe();if((pe[i+12>>2]|0)!=(g|0))Xe()}if((n|0)==(i|0)){pe[151]=pe[151]&~(1<>>0>>0)Xe();r=n+8|0;if((pe[r>>2]|0)==(g|0))d=r;else Xe()}else d=n+8|0;pe[i+12>>2]=n;pe[d>>2]=i}}while(0);pe[_+4>>2]=a|1;pe[_+a>>2]=a;if((_|0)==(pe[156]|0)){pe[153]=a;return}}else{pe[r>>2]=n&-2;pe[_+4>>2]=a|1;pe[_+a>>2]=a}r=a>>>3;if(a>>>0<256){n=r<<1;o=644+(n<<2)|0;i=pe[151]|0;r=1<>2]|0;if(n>>>0<(pe[155]|0)>>>0)Xe();else{m=r;v=n}}else{pe[151]=i|r;m=644+(n+2<<2)|0;v=o}pe[m>>2]=_;pe[v+12>>2]=_;pe[_+8>>2]=v;pe[_+12>>2]=o;return}r=a>>>8;if(r)if(a>>>0>16777215)o=31;else{m=(r+1048320|0)>>>16&8;v=r<>>16&4;v=v<>>16&2;o=14-(g|m|o)+(v<>>15)|0;o=a>>>(o+7|0)&1|o<<1}else o=0;r=908+(o<<2)|0;pe[_+28>>2]=o;pe[_+20>>2]=0;pe[_+16>>2]=0;n=pe[152]|0;i=1<>2]=_;pe[_+24>>2]=r;pe[_+12>>2]=_;pe[_+8>>2]=_;return}r=pe[r>>2]|0;e:do{if((pe[r+4>>2]&-8|0)!=(a|0)){o=a<<((o|0)==31?0:25-(o>>>1)|0);while(1){n=r+16+(o>>>31<<2)|0;i=pe[n>>2]|0;if(!i)break;if((pe[i+4>>2]&-8|0)==(a|0)){r=i;break e}else{o=o<<1;r=i}}if(n>>>0<(pe[155]|0)>>>0)Xe();pe[n>>2]=_;pe[_+24>>2]=r;pe[_+12>>2]=_;pe[_+8>>2]=_;return}}while(0);n=r+8|0;i=pe[n>>2]|0;v=pe[155]|0;if(!(i>>>0>=v>>>0&r>>>0>=v>>>0))Xe();pe[i+12>>2]=_;pe[n>>2]=_;pe[_+8>>2]=i;pe[_+12>>2]=r;pe[_+24>>2]=0;return}function Gr(){}function Wr(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;n=t-n-(r>>>0>e>>>0|0)>>>0;return(re=n,e-r>>>0|0)|0}function Vr(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0,o=0,a=0;n=e+r|0;if((r|0)>=20){t=t&255;o=e&3;a=t|t<<8|t<<16|t<<24;i=n&~3;if(o){o=e+4-o|0;while((e|0)<(o|0)){de[e>>0]=t;e=e+1|0}}while((e|0)<(i|0)){pe[e>>2]=a;e=e+4|0}}while((e|0)<(n|0)){de[e>>0]=t;e=e+1|0}return e-r|0}function Kr(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t>>>r;return e>>>r|(t&(1<>>r-32|0}function Zr(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t<>>32-r;return e<>>0;return(re=t+n+(r>>>0>>0|0)>>>0,r|0)|0}function $r(e,t,r){e=e|0;t=t|0;r=r|0;var n=0;if((r|0)>=4096)return Re(e|0,t|0,r|0)|0;n=e|0;if((e&3)==(t&3)){while(e&3){if(!r)return n|0;de[e>>0]=de[t>>0]|0;e=e+1|0;t=t+1|0;r=r-1|0}while((r|0)>=4){pe[e>>2]=pe[t>>2];e=e+4|0;t=t+4|0;r=r-4|0}}while((r|0)>0){de[e>>0]=de[t>>0]|0;e=e+1|0;t=t+1|0;r=r-1|0}return n|0}function Qr(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t>>r;return e>>>r|(t&(1<>r-32|0}function en(e){e=e|0;var t=0;t=de[m+(e&255)>>0]|0;if((t|0)<8)return t|0;t=de[m+(e>>8&255)>>0]|0;if((t|0)<8)return t+8|0;t=de[m+(e>>16&255)>>0]|0;if((t|0)<8)return t+16|0;return(de[m+(e>>>24)>>0]|0)+24|0}function tn(e,t){e=e|0;t=t|0;var r=0,n=0,i=0,o=0;o=e&65535;i=t&65535;r=_e(i,o)|0;n=e>>>16;e=(r>>>16)+(_e(i,n)|0)|0;i=t>>>16;t=_e(i,o)|0;return(re=(e>>>16)+(_e(i,n)|0)+(((e&65535)+t|0)>>>16)|0,e+t<<16|r&65535|0)|0}function rn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0;l=t>>31|((t|0)<0?-1:0)<<1;u=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;o=n>>31|((n|0)<0?-1:0)<<1;i=((n|0)<0?-1:0)>>31|((n|0)<0?-1:0)<<1;s=Wr(l^e,u^t,l,u)|0;a=re;e=o^l;t=i^u;return Wr((un(s,a,Wr(o^r,i^n,o,i)|0,re,0)|0)^e,re^t,e,t)|0}function nn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0,a=0,s=0,u=0,l=0;i=ve;ve=ve+16|0;s=i|0;a=t>>31|((t|0)<0?-1:0)<<1;o=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;l=n>>31|((n|0)<0?-1:0)<<1;u=((n|0)<0?-1:0)>>31|((n|0)<0?-1:0)<<1;e=Wr(a^e,o^t,a,o)|0;t=re;un(e,t,Wr(l^r,u^n,l,u)|0,re,s)|0;n=Wr(pe[s>>2]^a,pe[s+4>>2]^o,a,o)|0;r=re;ve=i;return(re=r,n)|0}function on(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0;i=e;o=r;r=tn(i,o)|0;e=re;return(re=(_e(t,o)|0)+(_e(n,i)|0)+e|e&0,r|0|0)|0}function an(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;return un(e,t,r,n,0)|0}function sn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,o=0;o=ve;ve=ve+16|0;i=o|0;un(e,t,r,n,i)|0;ve=o;return(re=pe[i+4>>2]|0,pe[i>>2]|0)|0}function un(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;var o=0,a=0,s=0,u=0,l=0,c=0,f=0,h=0,d=0,p=0;c=e;u=t;l=u;a=r;h=n;s=h;if(!l){o=(i|0)!=0;if(!s){if(o){pe[i>>2]=(c>>>0)%(a>>>0);pe[i+4>>2]=0}h=0;i=(c>>>0)/(a>>>0)>>>0;return(re=h,i)|0}else{if(!o){h=0;i=0;return(re=h,i)|0}pe[i>>2]=e|0;pe[i+4>>2]=t&0;h=0;i=0;return(re=h,i)|0}}o=(s|0)==0;do{if(a){if(!o){o=(ae(s|0)|0)-(ae(l|0)|0)|0;if(o>>>0<=31){f=o+1|0;s=31-o|0;t=o-31>>31;a=f;e=c>>>(f>>>0)&t|l<>>(f>>>0)&t;o=0;s=c<>2]=e|0;pe[i+4>>2]=u|t&0;h=0;i=0;return(re=h,i)|0}o=a-1|0;if(o&a){s=(ae(a|0)|0)+33-(ae(l|0)|0)|0;p=64-s|0;f=32-s|0;u=f>>31;d=s-32|0;t=d>>31;a=s;e=f-1>>31&l>>>(d>>>0)|(l<>>(s>>>0))&t;t=t&l>>>(s>>>0);o=c<>>(d>>>0))&u|c<>31;break}if(i){pe[i>>2]=o&c;pe[i+4>>2]=0}if((a|0)==1){d=u|t&0;p=e|0|0;return(re=d,p)|0}else{p=en(a|0)|0;d=l>>>(p>>>0)|0;p=l<<32-p|c>>>(p>>>0)|0;return(re=d,p)|0}}else{if(o){if(i){pe[i>>2]=(l>>>0)%(a>>>0);pe[i+4>>2]=0}d=0;p=(l>>>0)/(a>>>0)>>>0;return(re=d,p)|0}if(!c){if(i){pe[i>>2]=0;pe[i+4>>2]=(l>>>0)%(s>>>0)}d=0;p=(l>>>0)/(s>>>0)>>>0;return(re=d,p)|0}o=s-1|0;if(!(o&s)){if(i){pe[i>>2]=e|0;pe[i+4>>2]=o&l|t&0}d=0;p=l>>>((en(s|0)|0)>>>0);return(re=d,p)|0}o=(ae(s|0)|0)-(ae(l|0)|0)|0;if(o>>>0<=30){t=o+1|0;s=31-o|0;a=t;e=l<>>(t>>>0);t=l>>>(t>>>0);o=0;s=c<>2]=e|0;pe[i+4>>2]=u|t&0;d=0;p=0;return(re=d,p)|0}}while(0);if(!a){l=s;u=0;s=0}else{f=r|0|0;c=h|n&0;l=Jr(f|0,c|0,-1,-1)|0;r=re;u=s;s=0;do{n=u;u=o>>>31|u<<1;o=s|o<<1;n=e<<1|n>>>31|0;h=e>>>31|t<<1|0;Wr(l,r,n,h)|0;p=re;d=p>>31|((p|0)<0?-1:0)<<1;s=d&1;e=Wr(n,h,d&f,(((p|0)<0?-1:0)>>31|((p|0)<0?-1:0)<<1)&c)|0;t=re;a=a-1|0}while((a|0)!=0);l=u;u=0}a=0;if(i){pe[i>>2]=e;pe[i+4>>2]=t}d=(o|0)>>>31|(l|a)<<1|(a<<1|o>>>31)&0|u;p=(o<<1|0>>>31)&-2|s;return(re=d,p)|0}function ln(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;return Cn[e&7](t|0,r|0,n|0)|0}function cn(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;kn[e&3](t|0,r|0,n|0,i|0,o|0)}function fn(e,t){e=e|0;t=t|0;En[e&7](t|0)}function hn(e,t){e=e|0;t=t|0;return An[e&1](t|0)|0}function dn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;On[e&0](t|0,r|0,n|0)}function pn(e){e=e|0;Rn[e&3]()}function gn(e,t,r,n,i,o,a){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;a=a|0;In[e&3](t|0,r|0,n|0,i|0,o|0,a|0)}function mn(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;return Dn[e&1](t|0,r|0,n|0,i|0,o|0)|0}function vn(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;Ln[e&3](t|0,r|0,n|0,i|0)}function _n(e,t,r){e=e|0;t=t|0;r=r|0;se(0);return 0}function yn(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;se(1)}function bn(e){e=e|0;se(2)}function xn(e){e=e|0;se(3);return 0}function wn(e,t,r){e=e|0;t=t|0;r=r|0;se(4)}function Tn(){se(5)}function Sn(e,t,r,n,i,o){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;o=o|0;se(6)}function Mn(e,t,r,n,i){e=e|0;t=t|0;r=r|0;n=n|0;i=i|0;se(7);return 0}function Pn(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;se(8)}var Cn=[_n,Vt,Nr,Er,kr,Ar,_n,_n];var kn=[yn,tr,er,yn];var En=[bn,qt,Gt,Ht,Yt,Wt,ur,Lr];var An=[xn,Cr];var On=[wn];var Rn=[Tn,ar,sr,Tn];var In=[Sn,nr,rr,Sn];var Dn=[Mn,ut];var Ln=[Pn,Zt,Jt,Pn];return{___cxa_can_catch:ir,_crn_get_levels:Tt,_crn_get_uncompressed_size:Mt,_crn_decompress:Pt,_i64Add:Jr,_crn_get_width:xt,___cxa_is_pointer_type:or,_i64Subtract:Wr,_memset:Vr,_malloc:zr,_free:Ur,_memcpy:$r,_bitshift64Lshr:Kr,_fflush:mr,_bitshift64Shl:Zr,_crn_get_height:wt,___errno_location:cr,_crn_get_dxt_format:St,runPostSets:Gr,_emscripten_replace_memory:Ve,stackAlloc:Ke,stackSave:Ze,stackRestore:Je,establishStackSpace:$e,setThrew:Qe,setTempRet0:rt,getTempRet0:nt,dynCall_iiii:ln,dynCall_viiiii:cn,dynCall_vi:fn,dynCall_ii:hn,dynCall_viii:dn,dynCall_v:pn,dynCall_viiiiii:gn,dynCall_iiiiii:mn,dynCall_viiii:vn}}(e.Ya,e.Za,buffer);e.___cxa_can_catch=Z.___cxa_can_catch,e._crn_get_levels=Z._crn_get_levels,e.runPostSets=Z.runPostSets,e._crn_get_uncompressed_size=Z._crn_get_uncompressed_size,e._crn_decompress=Z._crn_decompress;var zc=e._i64Add=Z._i64Add;e._crn_get_height=Z._crn_get_height,e.___cxa_is_pointer_type=Z.___cxa_is_pointer_type;var nb=e._i64Subtract=Z._i64Subtract,qb=e._memset=Z._memset,Ea=e._malloc=Z._malloc,Bc=e._memcpy=Z._memcpy,Xa=e._emscripten_replace_memory=Z._emscripten_replace_memory;e._crn_get_dxt_format=Z._crn_get_dxt_format;var rb=e._bitshift64Lshr=Z._bitshift64Lshr,Na=e._free=Z._free;e._fflush=Z._fflush,e._crn_get_width=Z._crn_get_width,e.___errno_location=Z.___errno_location;var sb=e._bitshift64Shl=Z._bitshift64Shl;function ia(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}e.dynCall_iiii=Z.dynCall_iiii,e.dynCall_viiiii=Z.dynCall_viiiii,e.dynCall_vi=Z.dynCall_vi,e.dynCall_ii=Z.dynCall_ii,e.dynCall_viii=Z.dynCall_viii,e.dynCall_v=Z.dynCall_v,e.dynCall_viiiiii=Z.dynCall_viiiiii,e.dynCall_iiiiii=Z.dynCall_iiiiii,e.dynCall_viiii=Z.dynCall_viiii,n.aa=Z.stackAlloc,n.ua=Z.stackSave,n.ba=Z.stackRestore,n.Cd=Z.establishStackSpace,n.rb=Z.setTempRet0,n.fb=Z.getTempRet0,ia.prototype=Error(),ia.prototype.constructor=ia;var rd=null,jb=function t(){e.calledRun||td(),e.calledRun||(jb=t)};function td(t){function r(){if(!e.calledRun&&(e.calledRun=!0,!na)){if(Ha||(Ha=!0,ab(cb)),ab(db),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e._main&&vd&&e.callMain(t),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)gb(e.postRun.shift());ab(eb)}}if(t=t||e.arguments,null===rd&&(rd=Date.now()),!(0>6],i=0==(32&r);if(31==(31&r)){var o=r;for(r=0;128==(128&o);){if(o=e.readUInt8(t),e.isError(o))return o;r<<=7,r|=127&o}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:s.tag[r]}}function f(e,t,r){var n=e.readUInt8(r);if(e.isError(n))return n;if(!t&&128===n)return null;if(0==(128&n))return n;var i=127&n;if(4>=8)a++;(i=new l(2+a))[0]=o,i[1]=128|a;s=1+a;for(var u=n.length;0>=8)i[s]=255&u;return this._createEncoderBuffer([i,n])},s.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"!==t)return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(t)?this._createEncoderBuffer(e):"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported");for(var r=new l(2*e.length),n=0;n>=7)i++}var a=new l(i),s=a.length-1;for(n=e.length-1;0<=n;n--){o=e[n];for(a[s--]=127&o;0<(o>>=7);)a[s--]=128|127&o}return this._createEncoderBuffer(a)},s.prototype._encodeTime=function(e,t){var r,n=new Date(e);return"gentime"===t?r=[u(n.getFullYear()),u(n.getUTCMonth()+1),u(n.getUTCDate()),u(n.getUTCHours()),u(n.getUTCMinutes()),u(n.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[u(n.getFullYear()%100),u(n.getUTCMonth()+1),u(n.getUTCDate()),u(n.getUTCHours()),u(n.getUTCMinutes()),u(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},s.prototype._encodeNull=function(){return this._createEncoderBuffer("")},s.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!l.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new l(r)}if(l.isBuffer(e)){var n=e.length;0===e.length&&n++;var i=new l(n);return e.copy(i),0===e.length&&(i[0]=0),this._createEncoderBuffer(i)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);n=1;for(var o=e;256<=o;o>>=8)n++;for(o=(i=new Array(n)).length-1;0<=o;o--)i[o]=255&e,e>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(new l(i))},s.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},s.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},s.prototype._skipDefault=function(e,t,r){var n,i=this._baseState;if(null===i.default)return!1;var o=e.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,t,r).join()),o.length!==i.defaultBuffer.length)return!1;for(n=0;n>16&255,o[s++]=n>>8&255,o[s++]=255&n;2===i?(n=l[e.charCodeAt(t)]<<2|l[e.charCodeAt(t+1)]>>4,o[s++]=255&n):1===i&&(n=l[e.charCodeAt(t)]<<10|l[e.charCodeAt(t+1)]<<4|l[e.charCodeAt(t+2)]>>2,o[s++]=n>>8&255,o[s++]=255&n);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i="",o=[],a=0,s=r-n;a>2],i+=u[t<<4&63],i+="=="):2==n&&(t=(e[r-2]<<8)+e[r-1],i+=u[t>>10],i+=u[t>>4&63],i+=u[t<<2&63],i+="=");return o.push(i),o.join("")};for(var u=[],l=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;i>18&63]+u[i>>12&63]+u[i>>6&63]+u[63&i]);return o.join("")}l["-".charCodeAt(0)]=62,l["_".charCodeAt(0)]=63},{}],17:[function(T,e,t){!function(e,t){"use strict";function m(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function v(e,t,r){if(v.isBN(e))return e;this.negative=0,this.words=null,this.length=0,(this.red=null)!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var n;"object"==typeof e?e.exports=v:t.BN=v,(v.BN=v).wordSize=26;try{n=T("buffer").Buffer}catch(e){}function a(e,t,r){for(var n=0,i=Math.min(e.length,r),o=t;o>>26-a&67108863,26<=(a+=24)&&(a-=26,i++);else if("le"===r)for(i=n=0;n>>26-a&67108863,26<=(a+=24)&&(a-=26,i++);return this.strip()},v.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r>>26-o&4194303,26<=(o+=24)&&(o-=26,n++);r+6!==t&&(i=a(e,t,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},v.prototype._parseBase=function(e,t,r){this.words=[0];for(var n=0,i=this.length=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,l=r;l"};var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function i(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;n=(r.length=n)-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var l=1;l>>26,f=67108863&u,h=Math.min(l,t.length-1),d=Math.max(0,l-e.length+1);d<=h;d++){var p=l-d|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[d])+f)/67108864|0,f=67108863&a}r.words[l]=0|f,u=0|c}return 0!==u?r.words[l]=0|u:r.length--,r.strip()}v.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,i=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-s.length]+s+r:s+r,26<=(n+=2)&&(n-=26,o--)}for(0!==i&&(r=i.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&2<=e&&e<=36){var u=d[e],l=p[e];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var f=c.modn(l).toString(e);r=(c=c.idivn(l)).isZero()?f+r:h[u-f.length]+f+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}m(!1,"Base should be between 2 and 36")},v.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2>>=13),64<=t&&(r+=7,t>>>=7),8<=t&&(r+=4,t>>>=4),2<=t&&(r+=2,t>>>=2),r+t},v.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},v.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},v.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},v.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},v.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},v.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},v.prototype.iuxor=function(e){var t,r;r=this.length>e.length?(t=this,e):(t=e,this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},v.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},v.prototype.inotn=function(e){m("number"==typeof e&&0<=e);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),0>26-r),this.strip()},v.prototype.notn=function(e){return this.clone().inotn(e)},v.prototype.setn=function(e,t){m("number"==typeof e&&0<=e);var r=e/26|0,n=e%26;return this._expand(1+r),this.words[r]=t?this.words[r]|1<e.length?(r=this,e):(r=e,this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},v.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;n=0>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,d=0|a[1],p=8191&d,g=d>>>13,m=0|a[2],v=8191&m,_=m>>>13,y=0|a[3],b=8191&y,x=y>>>13,w=0|a[4],T=8191&w,S=w>>>13,M=0|a[5],P=8191&M,C=M>>>13,k=0|a[6],E=8191&k,A=k>>>13,O=0|a[7],R=8191&O,I=O>>>13,D=0|a[8],L=8191&D,N=D>>>13,j=0|a[9],F=8191&j,B=j>>>13,z=0|s[0],U=8191&z,X=z>>>13,q=0|s[1],H=8191&q,Y=q>>>13,G=0|s[2],W=8191&G,V=G>>>13,K=0|s[3],Z=8191&K,J=K>>>13,$=0|s[4],Q=8191&$,ee=$>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,le=se>>>13,ce=0|s[8],fe=8191&ce,he=ce>>>13,de=0|s[9],pe=8191&de,ge=de>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(l+(n=Math.imul(f,U))|0)+((8191&(i=(i=Math.imul(f,X))+Math.imul(h,U)|0))<<13)|0;l=((o=Math.imul(h,X))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(p,U),i=(i=Math.imul(p,X))+Math.imul(g,U)|0,o=Math.imul(g,X);var ve=(l+(n=n+Math.imul(f,H)|0)|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(h,H)|0))<<13)|0;l=((o=o+Math.imul(h,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(v,U),i=(i=Math.imul(v,X))+Math.imul(_,U)|0,o=Math.imul(_,X),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,Y)|0;var _e=(l+(n=n+Math.imul(f,W)|0)|0)+((8191&(i=(i=i+Math.imul(f,V)|0)+Math.imul(h,W)|0))<<13)|0;l=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(b,U),i=(i=Math.imul(b,X))+Math.imul(x,U)|0,o=Math.imul(x,X),n=n+Math.imul(v,H)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(_,H)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(g,W)|0,o=o+Math.imul(g,V)|0;var ye=(l+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(h,Z)|0))<<13)|0;l=((o=o+Math.imul(h,J)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(T,U),i=(i=Math.imul(T,X))+Math.imul(S,U)|0,o=Math.imul(S,X),n=n+Math.imul(b,H)|0,i=(i=i+Math.imul(b,Y)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,Y)|0,n=n+Math.imul(v,W)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,J)|0;var be=(l+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,ee)|0)+Math.imul(h,Q)|0))<<13)|0;l=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(P,U),i=(i=Math.imul(P,X))+Math.imul(C,U)|0,o=Math.imul(C,X),n=n+Math.imul(T,H)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(S,H)|0,o=o+Math.imul(S,Y)|0,n=n+Math.imul(b,W)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,V)|0,n=n+Math.imul(v,Z)|0,i=(i=i+Math.imul(v,J)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,ee)|0;var xe=(l+(n=n+Math.imul(f,re)|0)|0)+((8191&(i=(i=i+Math.imul(f,ne)|0)+Math.imul(h,re)|0))<<13)|0;l=((o=o+Math.imul(h,ne)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(E,U),i=(i=Math.imul(E,X))+Math.imul(A,U)|0,o=Math.imul(A,X),n=n+Math.imul(P,H)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(C,H)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(T,W)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,V)|0,n=n+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,J)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,J)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(g,re)|0,o=o+Math.imul(g,ne)|0;var we=(l+(n=n+Math.imul(f,oe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ae)|0)+Math.imul(h,oe)|0))<<13)|0;l=((o=o+Math.imul(h,ae)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(R,U),i=(i=Math.imul(R,X))+Math.imul(I,U)|0,o=Math.imul(I,X),n=n+Math.imul(E,H)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,Y)|0,n=n+Math.imul(P,W)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(C,W)|0,o=o+Math.imul(C,V)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(S,Z)|0,o=o+Math.imul(S,J)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,ee)|0,n=n+Math.imul(v,re)|0,i=(i=i+Math.imul(v,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,ae)|0;var Te=(l+(n=n+Math.imul(f,ue)|0)|0)+((8191&(i=(i=i+Math.imul(f,le)|0)+Math.imul(h,ue)|0))<<13)|0;l=((o=o+Math.imul(h,le)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(L,U),i=(i=Math.imul(L,X))+Math.imul(N,U)|0,o=Math.imul(N,X),n=n+Math.imul(R,H)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,Y)|0,n=n+Math.imul(E,W)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,V)|0,n=n+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,J)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,J)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,ee)|0,n=n+Math.imul(b,re)|0,i=(i=i+Math.imul(b,ne)|0)+Math.imul(x,re)|0,o=o+Math.imul(x,ne)|0,n=n+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,le)|0)+Math.imul(g,ue)|0,o=o+Math.imul(g,le)|0;var Se=(l+(n=n+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,he)|0)+Math.imul(h,fe)|0))<<13)|0;l=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(F,U),i=(i=Math.imul(F,X))+Math.imul(B,U)|0,o=Math.imul(B,X),n=n+Math.imul(L,H)|0,i=(i=i+Math.imul(L,Y)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,Y)|0,n=n+Math.imul(R,W)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,V)|0,n=n+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,J)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,J)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(S,re)|0,o=o+Math.imul(S,ne)|0,n=n+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,ae)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,ae)|0,n=n+Math.imul(v,ue)|0,i=(i=i+Math.imul(v,le)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,le)|0,n=n+Math.imul(p,fe)|0,i=(i=i+Math.imul(p,he)|0)+Math.imul(g,fe)|0,o=o+Math.imul(g,he)|0;var Me=(l+(n=n+Math.imul(f,pe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ge)|0)+Math.imul(h,pe)|0))<<13)|0;l=((o=o+Math.imul(h,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(F,H),i=(i=Math.imul(F,Y))+Math.imul(B,H)|0,o=Math.imul(B,Y),n=n+Math.imul(L,W)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(N,W)|0,o=o+Math.imul(N,V)|0,n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,J)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(C,re)|0,o=o+Math.imul(C,ne)|0,n=n+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,n=n+Math.imul(b,ue)|0,i=(i=i+Math.imul(b,le)|0)+Math.imul(x,ue)|0,o=o+Math.imul(x,le)|0,n=n+Math.imul(v,fe)|0,i=(i=i+Math.imul(v,he)|0)+Math.imul(_,fe)|0,o=o+Math.imul(_,he)|0;var Pe=(l+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;l=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(F,W),i=(i=Math.imul(F,V))+Math.imul(B,W)|0,o=Math.imul(B,V),n=n+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,J)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,J)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,ee)|0,n=n+Math.imul(E,re)|0,i=(i=i+Math.imul(E,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,n=n+Math.imul(T,ue)|0,i=(i=i+Math.imul(T,le)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,le)|0,n=n+Math.imul(b,fe)|0,i=(i=i+Math.imul(b,he)|0)+Math.imul(x,fe)|0,o=o+Math.imul(x,he)|0;var Ce=(l+(n=n+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,ge)|0)+Math.imul(_,pe)|0))<<13)|0;l=((o=o+Math.imul(_,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(F,Z),i=(i=Math.imul(F,J))+Math.imul(B,Z)|0,o=Math.imul(B,J),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,ee)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,ee)|0,n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(I,re)|0,o=o+Math.imul(I,ne)|0,n=n+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,ae)|0,n=n+Math.imul(P,ue)|0,i=(i=i+Math.imul(P,le)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,le)|0,n=n+Math.imul(T,fe)|0,i=(i=i+Math.imul(T,he)|0)+Math.imul(S,fe)|0,o=o+Math.imul(S,he)|0;var ke=(l+(n=n+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ge)|0)+Math.imul(x,pe)|0))<<13)|0;l=((o=o+Math.imul(x,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,ee))+Math.imul(B,Q)|0,o=Math.imul(B,ee),n=n+Math.imul(L,re)|0,i=(i=i+Math.imul(L,ne)|0)+Math.imul(N,re)|0,o=o+Math.imul(N,ne)|0,n=n+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,ae)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,ae)|0,n=n+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,le)|0)+Math.imul(A,ue)|0,o=o+Math.imul(A,le)|0,n=n+Math.imul(P,fe)|0,i=(i=i+Math.imul(P,he)|0)+Math.imul(C,fe)|0,o=o+Math.imul(C,he)|0;var Ee=(l+(n=n+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,ge)|0)+Math.imul(S,pe)|0))<<13)|0;l=((o=o+Math.imul(S,ge)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(F,re),i=(i=Math.imul(F,ne))+Math.imul(B,re)|0,o=Math.imul(B,ne),n=n+Math.imul(L,oe)|0,i=(i=i+Math.imul(L,ae)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,ae)|0,n=n+Math.imul(R,ue)|0,i=(i=i+Math.imul(R,le)|0)+Math.imul(I,ue)|0,o=o+Math.imul(I,le)|0,n=n+Math.imul(E,fe)|0,i=(i=i+Math.imul(E,he)|0)+Math.imul(A,fe)|0,o=o+Math.imul(A,he)|0;var Ae=(l+(n=n+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,ge)|0)+Math.imul(C,pe)|0))<<13)|0;l=((o=o+Math.imul(C,ge)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(F,oe),i=(i=Math.imul(F,ae))+Math.imul(B,oe)|0,o=Math.imul(B,ae),n=n+Math.imul(L,ue)|0,i=(i=i+Math.imul(L,le)|0)+Math.imul(N,ue)|0,o=o+Math.imul(N,le)|0,n=n+Math.imul(R,fe)|0,i=(i=i+Math.imul(R,he)|0)+Math.imul(I,fe)|0,o=o+Math.imul(I,he)|0;var Oe=(l+(n=n+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,ge)|0)+Math.imul(A,pe)|0))<<13)|0;l=((o=o+Math.imul(A,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(F,ue),i=(i=Math.imul(F,le))+Math.imul(B,ue)|0,o=Math.imul(B,le),n=n+Math.imul(L,fe)|0,i=(i=i+Math.imul(L,he)|0)+Math.imul(N,fe)|0,o=o+Math.imul(N,he)|0;var Re=(l+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,ge)|0)+Math.imul(I,pe)|0))<<13)|0;l=((o=o+Math.imul(I,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(F,fe),i=(i=Math.imul(F,he))+Math.imul(B,fe)|0,o=Math.imul(B,he);var Ie=(l+(n=n+Math.imul(L,pe)|0)|0)+((8191&(i=(i=i+Math.imul(L,ge)|0)+Math.imul(N,pe)|0))<<13)|0;l=((o=o+Math.imul(N,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863;var De=(l+(n=Math.imul(F,pe))|0)+((8191&(i=(i=Math.imul(F,ge))+Math.imul(B,pe)|0))<<13)|0;return l=((o=Math.imul(B,ge))+(i>>>13)|0)+(De>>>26)|0,De&=67108863,u[0]=me,u[1]=ve,u[2]=_e,u[3]=ye,u[4]=be,u[5]=xe,u[6]=we,u[7]=Te,u[8]=Se,u[9]=Me,u[10]=Pe,u[11]=Ce,u[12]=ke,u[13]=Ee,u[14]=Ae,u[15]=Oe,u[16]=Re,u[17]=Ie,u[18]=De,0!==l&&(u[19]=l,r.length++),r};function s(e,t,r){return(new u).mulp(e,t,r)}function u(e,t){this.x=e,this.y=t}Math.imul||(o=i),v.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?o(this,e,t):r<63?i(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):s(this,e,t)},u.prototype.makeRBT=function(e){for(var t=new Array(e),r=v.prototype._countBits(e)-1,n=0;n>=1;return n},u.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*t;o>=26,t+=n/67108864|0,t+=i>>>26,this.words[r]=67108863&i}return 0!==t&&(this.words[r]=t,this.length++),this},v.prototype.muln=function(e){return this.clone().imuln(e)},v.prototype.sqr=function(){return this.mul(this)},v.prototype.isqr=function(){return this.imul(this.clone())},v.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new v(1);for(var r=this,n=0;n>>26-r<<26-r;if(0!=r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!=n){for(t=this.length-1;0<=t;t--)this.words[t+n]=this.words[t];for(t=0;t>>i<o)for(this.length-=o,u=0;u>>i,l=c&a}return s&&0!==l&&(s.words[s.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},v.prototype.ishrn=function(e,t,r){return m(0===this.negative),this.iushrn(e,t,r)},v.prototype.shln=function(e){return this.clone().ishln(e)},v.prototype.ushln=function(e){return this.clone().iushln(e)},v.prototype.shrn=function(e){return this.clone().ishrn(e)},v.prototype.ushrn=function(e){return this.clone().iushrn(e)},v.prototype.testn=function(e){m("number"==typeof e&&0<=e);var t=e%26,r=(e-t)/26,n=1<>>t<>26)-(s/67108864|0),this.words[n+r]=67108863&i}for(;n>26,this.words[n+r]=67108863&i;if(0===a)return this.strip();for(m(-1===a),n=a=0;n>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},v.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,o=0|i.words[i.length-1];0!=(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var a,s=n.length-i.length;if("mod"!==t){(a=new v(null)).length=1+s,a.words=new Array(a.length);for(var u=0;uthis.length||this.cmp(e)<0?{div:new v(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new v(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new v(this.modn(e.words[0]))}:this._wordDiv(e,t);var n,i,o},v.prototype.div=function(e){return this.divmod(e,"div",!1).div},v.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},v.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},v.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},v.prototype.modn=function(e){m(e<=67108863);for(var t=(1<<26)%e,r=0,n=this.length-1;0<=n;n--)r=(t*r+(0|this.words[n]))%e;return r},v.prototype.idivn=function(e){m(e<=67108863);for(var t=0,r=this.length-1;0<=r;r--){var n=(0|this.words[r])+67108864*t;this.words[r]=n/e|0,t=n%e}return this.strip()},v.prototype.divn=function(e){return this.clone().idivn(e)},v.prototype.egcd=function(e){m(0===e.negative),m(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new v(1),i=new v(0),o=new v(0),a=new v(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var u=r.clone(),l=t.clone();!t.isZero();){for(var c=0,f=1;0==(t.words[0]&f)&&c<26;++c,f<<=1);if(0>>26,a&=67108863,this.words[o]=a}return 0!==i&&(this.words[o]=i,this.length++),this},v.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},v.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),1e.length)return 1;if(this.lengththis.n;);var n=t>>22,i=o}i>>>=22,0===(e.words[n-10]=i)&&10>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},v._prime=function(e){if(l[e])return l[e];var t;if("k256"===e)t=new g;else if("p224"===e)t=new _;else if("p192"===e)t=new y;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new b}return l[e]=t},x.prototype._verify1=function(e){m(0===e.negative,"red works only with positives"),m(e.red,"red works only with red numbers")},x.prototype._verify2=function(e,t){m(0==(e.negative|t.negative),"red works only with positives"),m(e.red&&e.red===t.red,"red works only with red numbers")},x.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},x.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},x.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r._forceRed(this)},x.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r},x.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},x.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},x.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},x.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},x.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},x.prototype.isqr=function(e){return this.imul(e,e.clone())},x.prototype.sqr=function(e){return this.mul(e,e)},x.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(m(t%2==1),3===t){var r=this.m.add(new v(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),i=0;!n.isZero()&&0===n.andln(1);)i++,n.iushrn(1);m(!n.isZero());var o=new v(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new v(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var l=this.pow(u,n),c=this.pow(e,n.addn(1).iushrn(1)),f=this.pow(e,n),h=i;0!==f.cmp(o);){for(var d=f,p=0;0!==d.cmp(o);p++)d=d.redSqr();m(p>l&1;i!==r[0]&&(i=this.sqr(i)),0!=c||0!==o?(o<<=1,o|=c,(4===++a||0===n&&0===l)&&(i=this.mul(i,r[o]),o=a=0)):a=0}s=26}return i},x.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},x.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},v.mont=function(e){return new w(e)},r(w,x),w.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},w.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},w.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},w.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new v(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},w.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{buffer:19}],18:[function(e,t,r){var n;function i(e){this.rand=e}if(t.exports=function(e){return n||(n=new i(null)),n.generate(e)},(t.exports.Rand=i).prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r>>24]^c[p>>>16&255]^f[g>>>8&255]^h[255&m]^t[v++],a=l[p>>>24]^c[g>>>16&255]^f[m>>>8&255]^h[255&d]^t[v++],s=l[g>>>24]^c[m>>>16&255]^f[d>>>8&255]^h[255&p]^t[v++],u=l[m>>>24]^c[d>>>16&255]^f[p>>>8&255]^h[255&g]^t[v++],d=o,p=a,g=s,m=u;return o=(n[d>>>24]<<24|n[p>>>16&255]<<16|n[g>>>8&255]<<8|n[255&m])^t[v++],a=(n[p>>>24]<<24|n[g>>>16&255]<<16|n[m>>>8&255]<<8|n[255&d])^t[v++],s=(n[g>>>24]<<24|n[m>>>16&255]<<16|n[d>>>8&255]<<8|n[255&p])^t[v++],u=(n[m>>>24]<<24|n[d>>>16&255]<<16|n[p>>>8&255]<<8|n[255&g])^t[v++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var f=[0,1,2,4,8,16,32,64,128,27,54],h=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var l=s^s<<1^s<<2^s<<3^s<<4;l=l>>>8^255&l^99;var c=e[n[r[a]=l]=a],f=e[c],h=e[f],d=257*e[l]^16843008*l;i[0][a]=d<<24|d>>>8,i[1][a]=d<<16|d>>>16,i[2][a]=d<<8|d>>>24,i[3][a]=d,d=16843009*h^65537*f^257*c^16843008*a,o[0][l]=d<<24|d>>>8,o[1][l]=d<<16|d>>>16,o[2][l]=d<<8|d>>>24,o[3][l]=d,0===a?a=s=1:(a=c^e[e[e[h^c]]],s^=e[e[s]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function s(e){this._key=o(e),this._reset()}s.blockSize=16,s.keySize=32,s.prototype.blockSize=s.blockSize,s.prototype.keySize=s.keySize,s.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,n=4*(r+1),i=[],o=0;o>>24,a=h.SBOX[a>>>24]<<24|h.SBOX[a>>>16&255]<<16|h.SBOX[a>>>8&255]<<8|h.SBOX[255&a],a^=f[o/t|0]<<24):6>>24]<<24|h.SBOX[a>>>16&255]<<16|h.SBOX[a>>>8&255]<<8|h.SBOX[255&a]),i[o]=i[o-t]^a}for(var s=[],u=0;u>>24]]^h.INV_SUB_MIX[1][h.SBOX[c>>>16&255]]^h.INV_SUB_MIX[2][h.SBOX[c>>>8&255]]^h.INV_SUB_MIX[3][h.SBOX[255&c]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=s},s.prototype.encryptBlockRaw=function(e){return a(e=o(e),this._keySchedule,h.SUB_MIX,h.SBOX,this._nRounds)},s.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=i.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},s.prototype.decryptBlock=function(e){var t=(e=o(e))[1];e[1]=e[3],e[3]=t;var r=a(e,this._invKeySchedule,h.INV_SUB_MIX,h.INV_SBOX,this._nRounds),n=i.allocUnsafe(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[3],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[1],12),n},s.prototype.scrub=function(){n(this._keySchedule),n(this._invKeySchedule),n(this._key)},t.exports.AES=s},{"safe-buffer":143}],21:[function(e,t,r){var a=e("./aes"),l=e("safe-buffer").Buffer,s=e("cipher-base"),n=e("inherits"),c=e("./ghash"),i=e("buffer-xor"),f=e("./incr32");function o(e,t,r,n){s.call(this);var i=l.alloc(4,0);this._cipher=new a.AES(t);var o=this._cipher.encryptBlock(i);this._ghash=new c(o),r=function(e,t,r){if(12===t.length)return e._finID=l.concat([t,l.from([0,0,0,1])]),l.concat([t,l.from([0,0,0,2])]);var n=new c(r),i=t.length,o=i%16;n.update(t),o&&(o=16-o,n.update(l.alloc(o,0))),n.update(l.alloc(8,0));var a=8*i,s=l.alloc(8);s.writeUIntBE(a,0,8),n.update(s),e._finID=n.state;var u=l.from(e._finID);return f(u),u}(this,r,o),this._prev=l.from(r),this._cache=l.allocUnsafe(0),this._secCache=l.allocUnsafe(0),this._decrypt=n,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}n(o,s),o.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=l.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},o.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=i(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var r=0;e.length!==t.length&&r++;for(var n=Math.min(e.length,t.length),i=0;i>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function a(e){this.h=e,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}a.prototype.ghash=function(e){for(var t=-1;++t>>1|(1&r[e-1])<<31;r[0]=r[0]>>>1,t&&(r[0]=r[0]^225<<24)}this.state=o(n)},a.prototype.update=function(e){var t;for(this.cache=n.concat([this.cache,e]);16<=this.cache.length;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},a.prototype.final=function(e,t){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(o([0,e,0,t])),this.state},t.exports=a},{"safe-buffer":143}],26:[function(e,t,r){t.exports=function(e){for(var t,r=e.length;r--;){if(255!==(t=e.readUInt8(r))){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}},{}],27:[function(e,t,r){var i=e("buffer-xor");r.encrypt=function(e,t){var r=i(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},r.decrypt=function(e,t){var r=e._prev;e._prev=t;var n=e._cipher.decryptBlock(t);return i(n,r)}},{"buffer-xor":48}],28:[function(e,t,r){var o=e("safe-buffer").Buffer,a=e("buffer-xor");function s(e,t,r){var n=t.length,i=a(t,e._cache);return e._cache=e._cache.slice(n),e._prev=o.concat([e._prev,r?t:i]),i}r.encrypt=function(e,t,r){for(var n,i=o.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=o.allocUnsafe(0)),!(e._cache.length<=t.length)){i=o.concat([i,s(e,t,r)]);break}n=e._cache.length,i=o.concat([i,s(e,t.slice(0,n),r)]),t=t.slice(n)}return i}},{"buffer-xor":48,"safe-buffer":143}],29:[function(e,t,r){var a=e("safe-buffer").Buffer;function s(e,t,r){for(var n,i,o=-1,a=0;++o<8;)n=t&1<<7-o?128:0,a+=(128&(i=e._cipher.encryptBlock(e._prev)[0]^n))>>o%8,e._prev=u(e._prev,r?n:i);return a}function u(e,t){var r=e.length,n=-1,i=a.allocUnsafe(e.length);for(e=a.concat([e,a.from([t])]);++n>7;return i}r.encrypt=function(e,t,r){for(var n=t.length,i=a.allocUnsafe(n),o=-1;++o=t)throw new Error("invalid sig")}t.exports=function(e,t,r,n,i){var o=g(r);if("ec"===o.type){if("ecdsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");return function(e,t,r){var n=m[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new p(n),o=r.data.subjectPrivateKey.data;return i.verify(t,e,o)}(e,t,o)}if("dsa"===o.type){if("dsa"!==n)throw new Error("wrong public key type");return function(e,t,r){var n=r.data.p,i=r.data.q,o=r.data.g,a=r.data.pub_key,s=g.signature.decode(e,"der"),u=s.s,l=s.r;v(u,i),v(l,i);var c=d.mont(n),f=u.invm(i);return 0===o.toRed(c).redPow(new d(t).mul(f).mod(i)).fromRed().mul(a.toRed(c).redPow(l.mul(f).mod(i)).fromRed()).mod(n).mod(i).cmp(l)}(e,t,o)}if("rsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");t=h.concat([i,t]);for(var a=o.modulus.byteLength(),s=[1],u=0;t.length+s.length+2=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|e}function d(e,t){if(f.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return D(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return L(e).length;default:if(n)return D(e).length;t=(""+t).toLowerCase(),n=!0}}function p(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):2147483647=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=f.from(t,n)),f.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,i);if("number"==typeof t)return t&=255,f.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,i){var o,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=a=2,u/=2,r/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=r;o>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}return function(e){var t=e.length;if(t<=x)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return S(this,t,r);case"utf8":case"utf-8":return b(this,t,r);case"ascii":return w(this,t,r);case"latin1":case"binary":return T(this,t,r);case"base64":return y(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},f.prototype.equals=function(e){if(!f.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===f.compare(this,e)},f.prototype.inspect=function(){var e="",t=F.INSPECT_MAX_BYTES;return 0t&&(e+=" ... ")),""},f.prototype.compare=function(e,t,r,n,i){if(!f.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(n,i),l=e.slice(t,r),c=0;cthis.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o,a,s,u,l,c,f,h,d,p=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return h=t,d=r,N(D(e,(f=this).length-h),f,h,d);case"ascii":return _(this,e,t,r);case"latin1":case"binary":return _(this,e,t,r);case"base64":return u=this,l=t,c=r,N(L(e),u,l,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a=t,s=r,N(function(e,t){for(var r,n,i,o=[],a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(e,(o=this).length-a),o,a,s);default:if(p)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var x=4096;function w(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;ie.length)throw new RangeError("Index out of range")}function k(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function E(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function A(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function O(e,t,r,n,i){return i||A(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function R(e,t,r,n,i){return i||A(e,0,r,8),o.write(e,t,r,n,52,8),r+8}f.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):n>>8):k(this,e,t,!0),t+2},f.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):k(this,e,t,!1),t+2},f.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):E(this,e,t,!0),t+4},f.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):E(this,e,t,!1),t+4},f.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);C(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},f.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);C(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;0<=--o&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},f.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,1,127,-128),f.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},f.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):k(this,e,t,!0),t+2},f.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):k(this,e,t,!1),t+2},f.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):E(this,e,t,!0),t+4},f.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),f.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):E(this,e,t,!1),t+4},f.prototype.writeFloatLE=function(e,t,r){return O(this,e,t,!0,r)},f.prototype.writeFloatBE=function(e,t,r){return O(this,e,t,!1,r)},f.prototype.writeDoubleLE=function(e,t,r){return R(this,e,t,!0,r)},f.prototype.writeDoubleBE=function(e,t,r){return R(this,e,t,!1,r)},f.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),0=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function L(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(t,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function N(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":16,ieee754:101,isarray:105}],50:[function(e,t,r){var i=e("safe-buffer").Buffer,n=e("stream").Transform,o=e("string_decoder").StringDecoder;function a(e){n.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}e("inherits")(a,n),a.prototype.update=function(e,t,r){"string"==typeof e&&(e=i.from(e,t));var n=this._update(e);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){n=e}finally{r(n)}},a.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},a.prototype._finalOrDigest=function(e){var t=this.__final()||i.alloc(0);return e&&(t=this._toString(t,e,!0)),t},a.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n},t.exports=a},{inherits:103,"safe-buffer":143,stream:152,string_decoder:153}],51:[function(e,t,r){(function(e){function t(e){return Object.prototype.toString.call(e)}r.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},r.isBoolean=function(e){return"boolean"==typeof e},r.isNull=function(e){return null===e},r.isNullOrUndefined=function(e){return null==e},r.isNumber=function(e){return"number"==typeof e},r.isString=function(e){return"string"==typeof e},r.isSymbol=function(e){return"symbol"==typeof e},r.isUndefined=function(e){return void 0===e},r.isRegExp=function(e){return"[object RegExp]"===t(e)},r.isObject=function(e){return"object"==typeof e&&null!==e},r.isDate=function(e){return"[object Date]"===t(e)},r.isError=function(e){return"[object Error]"===t(e)||e instanceof Error},r.isFunction=function(e){return"function"==typeof e},r.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},r.isBuffer=e.isBuffer}).call(this,{isBuffer:e("../../is-buffer/index.js")})},{"../../is-buffer/index.js":104}],52:[function(e,s,t){(function(o){var t=e("elliptic"),n=e("bn.js");s.exports=function(e){return new i(e)};var r={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function i(e){this.curveType=r[e],this.curveType||(this.curveType={name:e}),this.curve=new t.ec(this.curveType.name),this.keys=void 0}function a(e,t,r){Array.isArray(e)||(e=e.toArray());var n=new o(e);if(r&&n.length>>2),n=0,i=0;n>5]|=128<>>9<<4)]=t;for(var r=1732584193,n=-271733879,i=-1732584194,o=271733878,a=0;a>>32-t}(g(g(t,e),g(n,o)),i),r)}function f(e,t,r,n,i,o,a){return s(t&r|~t&n,e,t,i,o,a)}function h(e,t,r,n,i,o,a){return s(t&n|r&~n,e,t,i,o,a)}function d(e,t,r,n,i,o,a){return s(t^r^n,e,t,i,o,a)}function p(e,t,r,n,i,o,a){return s(r^(t|~n),e,t,i,o,a)}function g(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}t.exports=function(e){return n(e,i)}},{"./make-hash":54}],56:[function(e,t,r){"use strict";var n=e("inherits"),i=e("./legacy"),a=e("cipher-base"),s=e("safe-buffer").Buffer,o=e("create-hash/md5"),u=e("ripemd160"),l=e("sha.js"),c=s.alloc(128);function f(e,t){a.call(this,"digest"),"string"==typeof t&&(t=s.from(t));var r="sha512"===e||"sha384"===e?128:64;(this._alg=e,(this._key=t).length>r)?t=("rmd160"===e?new u:l(e)).update(t).digest():t.length>>1];r=h.r28shl(r,o),n=h.r28shl(n,o),h.pc2(r,n,e.keys,i)}},u.prototype._update=function(e,t,r,n){var i=this._desState,o=h.readUInt32BE(e,t),a=h.readUInt32BE(e,t+4);h.ip(o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,a,i.tmp,0):this._decrypt(i,o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],h.writeUInt32BE(r,o,n),h.writeUInt32BE(r,a,n+4)},u.prototype._pad=function(e,t){for(var r=e.length-t,n=t;n>>0,o=f}h.rip(a,o,n,i)},u.prototype._decrypt=function(e,t,r,n,i){for(var o=r,a=t,s=e.keys.length-2;0<=s;s-=2){var u=e.keys[s],l=e.keys[s+1];h.expand(o,e.tmp,0),u^=e.tmp[0],l^=e.tmp[1];var c=h.substitute(u,l),f=o;o=(a^h.permute(c))>>>0,a=f}h.rip(o,a,n,i)}},{"../des":59,inherits:103,"minimalistic-assert":109}],63:[function(e,t,r){"use strict";var o=e("minimalistic-assert"),n=e("inherits"),i=e("../des"),a=i.Cipher,s=i.DES;function u(e,t){o.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),n=t.slice(8,16),i=t.slice(16,24);this.ciphers="encrypt"===e?[s.create({type:"encrypt",key:r}),s.create({type:"decrypt",key:n}),s.create({type:"encrypt",key:i})]:[s.create({type:"decrypt",key:i}),s.create({type:"encrypt",key:n}),s.create({type:"decrypt",key:r})]}function l(e){a.call(this,e);var t=new u(this.type,this.options.key);this._edeState=t}n(l,a),(t.exports=l).create=function(e){return new l(e)},l.prototype._update=function(e,t,r,n){var i=this._edeState;i.ciphers[0]._update(e,t,r,n),i.ciphers[1]._update(r,n,r,n),i.ciphers[2]._update(r,n,r,n)},l.prototype._pad=s.prototype._pad,l.prototype._unpad=s.prototype._unpad},{"../des":59,inherits:103,"minimalistic-assert":109}],64:[function(e,t,r){"use strict";r.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},r.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=t>>>16&255,e[2+r]=t>>>8&255,e[3+r]=255&t},r.ip=function(e,t,r,n){for(var i=0,o=0,a=6;0<=a;a-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>>s+a&1}for(a=6;0<=a;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1}r[n+0]=i>>>0,r[n+1]=o>>>0},r.rip=function(e,t,r,n){for(var i=0,o=0,a=0;a<4;a++)for(var s=24;0<=s;s-=8)i<<=1,i|=t>>>s+a&1,i<<=1,i|=e>>>s+a&1;for(a=4;a<8;a++)for(s=24;0<=s;s-=8)o<<=1,o|=t>>>s+a&1,o<<=1,o|=e>>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.pc1=function(e,t,r,n){for(var i=0,o=0,a=7;5<=a;a--){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.r28shl=function(e,t){return e<>>28-t};var u=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];r.pc2=function(e,t,r,n){for(var i=0,o=0,a=u.length>>>1,s=0;s>>u[s]&1;for(s=a;s>>u[s]&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.expand=function(e,t,r){var n=0,i=0;n=(1&e)<<5|e>>>27;for(var o=23;15<=o;o-=4)n<<=6,n|=e>>>o&63;for(o=11;3<=o;o-=4)i|=e>>>o&63,i<<=6;i|=(31&e)<<1|e>>>31,t[r+0]=n>>>0,t[r+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];r.substitute=function(e,t){for(var r=0,n=0;n<4;n++){r<<=4,r|=i[64*n+(e>>>18-6*n&63)]}for(n=0;n<4;n++){r<<=4,r|=i[256+64*n+(t>>>18-6*n&63)]}return r>>>0};var n=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];r.permute=function(e){for(var t=0,r=0;r>>n[r]&1;return t>>>0},r.padSplit=function(e,t,r){for(var n=e.toString(2);n.lengthe;)r.ishrn(1);if(r.isEven()&&r.iadd(u),r.testn(1)||r.iadd(l),t.cmp(l)){if(!t.cmp(c))for(;r.mod(f).cmp(h);)r.iadd(p)}else for(;r.mod(a).cmp(d);)r.iadd(p);if(m(n=r.shrn(1))&&m(r)&&v(n)&&v(r)&&s.test(n)&&s.test(r))return r}}},{"bn.js":17,"miller-rabin":108,randombytes:130}],68:[function(e,t,r){t.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},{}],69:[function(e,t,r){"use strict";var n=r;n.version=e("../package.json").version,n.utils=e("./elliptic/utils"),n.rand=e("brorand"),n.curve=e("./elliptic/curve"),n.curves=e("./elliptic/curves"),n.ec=e("./elliptic/ec"),n.eddsa=e("./elliptic/eddsa")},{"../package.json":84,"./elliptic/curve":72,"./elliptic/curves":75,"./elliptic/ec":76,"./elliptic/eddsa":79,"./elliptic/utils":83,brorand:18}],70:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("../../elliptic").utils,M=i.getNAF,P=i.getJSF,f=i.assert;function o(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var r=this.n&&this.p.div(this.n);!r||0>1]):a.mixedAdd(i[-u-1>>1].neg()):0>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},o.prototype._wnafMulAdd=function(e,t,r,n,i){for(var o=this._wnafT1,a=this._wnafT2,s=this._wnafT3,u=0,l=0;l>1]:S<0&&(T=a[m][-S-1>>1].neg()),y="affine"===T.type?y.mixedAdd(T):y.add(T))}}for(l=0;l=Math.ceil((e.bitLength()+1)/t.step)},a.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i":""},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},c.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),a=o.redSub(r),s=n.redSub(t),u=i.redMul(a),l=o.redMul(s),c=i.redMul(s),f=a.redMul(o);return this.curve.point(u,l,f,c)},c.prototype._projDbl=function(){var e,t,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var a=(l=this.curve._mulA(i)).redAdd(o);if(this.zOne)e=n.redSub(i).redSub(o).redMul(a.redSub(this.curve.two)),t=a.redMul(l.redSub(o)),r=a.redSqr().redSub(a).redSub(a);else{var s=this.z.redSqr(),u=a.redSub(s).redISub(s);e=n.redSub(i).redISub(o).redMul(u),t=a.redMul(l.redSub(o)),r=a.redMul(u)}}else{var l=i.redAdd(o);s=this.curve._mulC(this.c.redMul(this.z)).redSqr(),u=l.redSub(s).redSub(s);e=this.curve._mulC(n.redISub(l)).redMul(u),t=this.curve._mulC(l).redMul(i.redISub(o)),r=l.redMul(u)}return this.curve.point(e,t,r)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),a=i.redSub(n),s=i.redAdd(n),u=r.redAdd(t),l=o.redMul(a),c=s.redMul(u),f=o.redMul(u),h=a.redMul(s);return this.curve.point(l,c,h,f)},c.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),l=i.redAdd(s),c=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),f=n.redMul(u).redMul(c);return r=this.curve.twisted?(t=n.redMul(l).redMul(a.redSub(this.curve._mulA(o))),u.redMul(l)):(t=n.redMul(l).redMul(a.redSub(o)),this.curve._mulC(u).redMul(l)),this.curve.point(f,t,r)},c.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},c.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},c.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},c.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),0<=r.cmp(this.curve.p))return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}return!1},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},{"../../elliptic":69,"../curve":72,"bn.js":17,inherits:103}],72:[function(e,t,r){"use strict";var n=r;n.base=e("./base"),n.short=e("./short"),n.mont=e("./mont"),n.edwards=e("./edwards")},{"./base":70,"./edwards":71,"./mont":73,"./short":74}],73:[function(e,t,r){"use strict";var n=e("../curve"),i=e("bn.js"),o=e("inherits"),a=n.base,s=e("../../elliptic").utils;function u(e){a.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function l(e,t,r){a.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(u,a),(t.exports=u).prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},o(l,a.BasePoint),u.prototype.decodePoint=function(e,t){return this.point(s.toArray(e,t),1)},u.prototype.point=function(e,t){return new l(this,e,t)},u.prototype.pointFromJSON=function(e){return l.fromJSON(this,e)},l.prototype.precompute=function(){},l.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},l.fromJSON=function(e,t){return new l(e,t[0],t[1]||e.one)},l.prototype.inspect=function(){return this.isInfinity()?"":""},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},l.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},l.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},l.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),a=i.redMul(n),s=t.z.redMul(o.redAdd(a).redSqr()),u=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},l.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;0<=o;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},l.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},l.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},l.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},l.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},l.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../../elliptic":69,"../curve":72,"bn.js":17,inherits:103}],74:[function(e,t,r){"use strict";var n=e("../curve"),i=e("../../elliptic"),x=e("bn.js"),o=e("inherits"),a=n.base,s=i.utils.assert;function u(e){a.call(this,"short",e),this.a=new x(e.a,16).toRed(this.red),this.b=new x(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function l(e,t,r,n){a.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new x(t,16),this.y=new x(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function c(e,t,r,n){a.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new x(0)):(this.x=new x(t,16),this.y=new x(r,16),this.z=new x(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,a),(t.exports=u).prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new x(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new x(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?r=i[0]:(r=i[1],s(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map(function(e){return{a:new x(e.a,16),b:new x(e.b,16)}}):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:x.mont(e),r=new x(2).toRed(t).redInvm(),n=r.redNeg(),i=new x(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},u.prototype._getEndoBasis=function(e){for(var t,r,n,i,o,a,s,u,l,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=e,h=this.n.clone(),d=new x(1),p=new x(0),g=new x(0),m=new x(1),v=0;0!==f.cmpn(0);){var _=h.div(f);u=h.sub(_.mul(f)),l=g.sub(_.mul(d));var y=m.sub(_.mul(p));if(!n&&u.cmp(c)<0)t=s.neg(),r=d,n=u.neg(),i=l;else if(n&&2==++v)break;h=f,f=s=u,g=d,d=l,m=p,p=y}o=u.neg(),a=l;var b=n.sqr().add(i.sqr());return 0<=o.sqr().add(a.sqr()).cmp(b)&&(o=t,a=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:i},{a:o,b:a}]},u.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),u=i.mul(r.b),l=o.mul(n.b);return{k1:e.sub(a).sub(s),k2:u.add(l).neg()}},u.prototype.pointFromX=function(e,t){(e=new x(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},u.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},l.prototype.isInfinity=function(){return this.inf},l.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},l.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},l.prototype.getX=function(){return this.x.fromRed()},l.prototype.getY=function(){return this.y.fromRed()},l.prototype.mul=function(e){return e=new x(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},l.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},l.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},l.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},l.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},l.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(c,a.BasePoint),u.prototype.jpoint=function(e,t,r){return new c(this,e,t,r)},c.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},c.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},c.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=s.redSqr(),c=l.redMul(s),f=n.redMul(l),h=u.redSqr().redIAdd(c).redISub(f).redISub(f),d=u.redMul(f.redISub(h)).redISub(o.redMul(c)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(h,d,p)},c.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),c=r.redMul(u),f=s.redSqr().redIAdd(l).redISub(c).redISub(c),h=s.redMul(c.redISub(f)).redISub(i.redMul(l)),d=this.z.redMul(a);return this.curve.jpoint(f,h,d)},c.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":69,"../curve":72,"bn.js":17,inherits:103}],75:[function(e,t,r){"use strict";var n,i=r,o=e("hash.js"),a=e("../elliptic"),s=a.utils.assert;function u(e){"short"===e.type?this.curve=new a.curve.short(e):"edwards"===e.type?this.curve=new a.curve.edwards(e):this.curve=new a.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function l(t,r){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var e=new u(r);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:e}),e}})}i.PresetCurve=u,l("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),l("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),l("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),l("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),l("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),l("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),l("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=e("./precomputed/secp256k1")}catch(e){n=void 0}l("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"../elliptic":69,"./precomputed/secp256k1":82,"hash.js":88}],76:[function(e,t,r){"use strict";var m=e("bn.js"),v=e("hmac-drbg"),o=e("../../elliptic"),d=o.utils.assert,n=e("./key"),_=e("./signature");function i(e){if(!(this instanceof i))return new i(e);"string"==typeof e&&(d(o.curves.hasOwnProperty(e),"Unknown curve "+e),e=o.curves[e]),e instanceof o.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}(t.exports=i).prototype.keyPair=function(e){return new n(this,e)},i.prototype.keyFromPrivate=function(e,t){return n.fromPrivate(this,e,t)},i.prototype.keyFromPublic=function(e,t){return n.fromPublic(this,e,t)},i.prototype.genKeyPair=function(e){e||(e={});for(var t=new v({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||o.rand(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new m(2));;){var i=new m(t.generate(r));if(!(0>1;if(0<=a.cmp(this.curve.p.umod(this.curve.n))&&l)throw new Error("Unable to find sencond key candinate");a=l?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var c=t.r.invm(i),f=i.sub(o).mul(c).umod(i),h=s.mul(c).umod(i);return this.g.mulAdd(f,a,h)},i.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new _(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":69,"./key":77,"./signature":78,"bn.js":17,"hmac-drbg":100}],77:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("../../elliptic").utils.assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}(t.exports=o).fromPublic=function(e,t,r){return t instanceof o?t:new o(e,{pub:t,pubEnc:r})},o.fromPrivate=function(e,t,r){return t instanceof o?t:new o(e,{priv:t,privEnc:r})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.mul(this.priv).getX()},o.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},{"../../elliptic":69,"bn.js":17}],78:[function(e,t,r){"use strict";var s=e("bn.js"),u=e("../../elliptic").utils,n=u.assert;function i(e,t){if(e instanceof i)return e;this._importDER(e,t)||(n(e.r&&e.s,"Signature without r or s"),this.r=new s(e.r,16),this.s=new s(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function l(){this.place=0}function c(e,t){var r=e[t.place++];if(!(128&r))return r;for(var n=15&r,i=0,o=0,a=t.place;o>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}(t.exports=i).prototype._importDER=function(e,t){e=u.toArray(e,t);var r=new l;if(48!==e[r.place++])return!1;if(c(e,r)+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var n=c(e,r),i=e.slice(r.place,n+r.place);if(r.place+=n,2!==e[r.place++])return!1;var o=c(e,r);if(e.length!==o+r.place)return!1;var a=e.slice(r.place,o+r.place);return 0===i[0]&&128&i[1]&&(i=i.slice(1)),0===a[0]&&128&a[1]&&(a=a.slice(1)),this.r=new s(i),this.s=new s(a),!(this.recoveryParam=null)},i.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=a(t),r=a(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];f(n,t.length),(n=n.concat(t)).push(2),f(n,r.length);var i=n.concat(r),o=[48];return f(o,i.length),o=o.concat(i),u.encode(o,e)}},{"../../elliptic":69,"bn.js":17}],79:[function(e,t,r){"use strict";var n=e("hash.js"),i=e("../../elliptic"),o=i.utils,a=o.assert,u=o.parseBytes,s=e("./key"),l=e("./signature");function c(e){if(a("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof c))return new c(e);e=i.curves[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}(t.exports=c).prototype.sign=function(e,t){e=u(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),s=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},c.prototype.verify=function(e,t,r){e=u(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},c.prototype.hashInt=function(){for(var e=this.hash(),t=0;t>1)-1>1)-a:a,i.isubn(o)}else o=0;r.push(o);for(var s=0!==i.cmpn(0)&&0===i.andln(n-1)?t+1:1,u=1;ur&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.once=function(e,t){if(!u(t))throw TypeError("listener must be a function");var r=!1;function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var r,n,i,o;if(!u(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(i=(r=this._events[e]).length,n=-1,r===t||u(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(l(r)){for(o=i;0=this._blockSize;){for(var i=this._blockOffset;i=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;othis.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t>>3},r.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},{"../utils":99}],99:[function(e,t,r){"use strict";var l=e("minimalistic-assert"),n=e("inherits");function o(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function i(e){return 1===e.length?"0"+e:e}function a(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}r.inherits=n,r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>8,a=255&i;o?r.push(o,a):r.push(a)}else for(n=0;n>>0}return o},r.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},r.rotr32=function(e,t){return e>>>t|e<<32-t},r.rotl32=function(e,t){return e<>>32-t},r.sum32=function(e,t){return e+t>>>0},r.sum32_3=function(e,t,r){return e+t+r>>>0},r.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},r.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},r.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,a=(o>>0,e[t+1]=o},r.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},r.sum64_lo=function(e,t,r,n){return t+n>>>0},r.sum64_4_hi=function(e,t,r,n,i,o,a,s){var u=0,l=t;return u+=(l=l+n>>>0)>>0)>>0)>>0},r.sum64_4_lo=function(e,t,r,n,i,o,a,s){return t+n+o+s>>>0},r.sum64_5_hi=function(e,t,r,n,i,o,a,s,u,l){var c=0,f=t;return c+=(f=f+n>>>0)>>0)>>0)>>0)>>0},r.sum64_5_lo=function(e,t,r,n,i,o,a,s,u,l){return t+n+o+s+l>>>0},r.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},r.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},r.shr64_hi=function(e,t,r){return e>>>r},r.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},{inherits:103,"minimalistic-assert":109}],100:[function(e,t,r){"use strict";var n=e("hash.js"),a=e("minimalistic-crypto-utils"),i=e("minimalistic-assert");function o(e){if(!(this instanceof o))return new o(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=a.toArray(e.entropy,e.entropyEnc||"hex"),r=a.toArray(e.nonce,e.nonceEnc||"hex"),n=a.toArray(e.pers,e.persEnc||"hex");i(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}(t.exports=o).prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},o.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=a.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length>1,c=-7,f=r?i-1:0,h=r?-1:1,d=e[t+f];for(f+=h,o=d&(1<<-c)-1,d>>=-c,c+=s;0>=-c,c+=n;0>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),2<=(t+=1<=a+f?h/u:h*Math.pow(2,1-f))*u&&(a++,u/=2),c<=a+f?(s=0,a=c):1<=a+f?(s=(t*u-1)*Math.pow(2,i),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),a=0));8<=i;e[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<>>32-t}function u(e,t,r,n,i,o,a){return s(e+(t&r|~t&n)+i+o|0,a)+t|0}function l(e,t,r,n,i,o,a){return s(e+(t&n|r&~n)+i+o|0,a)+t|0}function c(e,t,r,n,i,o,a){return s(e+(t^r^n)+i+o|0,a)+t|0}function f(e,t,r,n,i,o,a){return s(e+(r^(t|~n))+i+o|0,a)+t|0}e(n,r),n.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d;n=f(n=f(n=f(n=f(n=c(n=c(n=c(n=c(n=l(n=l(n=l(n=l(n=u(n=u(n=u(n=u(n,i=u(i,o=u(o,r=u(r,n,i,o,e[0],3614090360,7),n,i,e[1],3905402710,12),r,n,e[2],606105819,17),o,r,e[3],3250441966,22),i=u(i,o=u(o,r=u(r,n,i,o,e[4],4118548399,7),n,i,e[5],1200080426,12),r,n,e[6],2821735955,17),o,r,e[7],4249261313,22),i=u(i,o=u(o,r=u(r,n,i,o,e[8],1770035416,7),n,i,e[9],2336552879,12),r,n,e[10],4294925233,17),o,r,e[11],2304563134,22),i=u(i,o=u(o,r=u(r,n,i,o,e[12],1804603682,7),n,i,e[13],4254626195,12),r,n,e[14],2792965006,17),o,r,e[15],1236535329,22),i=l(i,o=l(o,r=l(r,n,i,o,e[1],4129170786,5),n,i,e[6],3225465664,9),r,n,e[11],643717713,14),o,r,e[0],3921069994,20),i=l(i,o=l(o,r=l(r,n,i,o,e[5],3593408605,5),n,i,e[10],38016083,9),r,n,e[15],3634488961,14),o,r,e[4],3889429448,20),i=l(i,o=l(o,r=l(r,n,i,o,e[9],568446438,5),n,i,e[14],3275163606,9),r,n,e[3],4107603335,14),o,r,e[8],1163531501,20),i=l(i,o=l(o,r=l(r,n,i,o,e[13],2850285829,5),n,i,e[2],4243563512,9),r,n,e[7],1735328473,14),o,r,e[12],2368359562,20),i=c(i,o=c(o,r=c(r,n,i,o,e[5],4294588738,4),n,i,e[8],2272392833,11),r,n,e[11],1839030562,16),o,r,e[14],4259657740,23),i=c(i,o=c(o,r=c(r,n,i,o,e[1],2763975236,4),n,i,e[4],1272893353,11),r,n,e[7],4139469664,16),o,r,e[10],3200236656,23),i=c(i,o=c(o,r=c(r,n,i,o,e[13],681279174,4),n,i,e[0],3936430074,11),r,n,e[3],3572445317,16),o,r,e[6],76029189,23),i=c(i,o=c(o,r=c(r,n,i,o,e[9],3654602809,4),n,i,e[12],3873151461,11),r,n,e[15],530742520,16),o,r,e[2],3299628645,23),i=f(i,o=f(o,r=f(r,n,i,o,e[0],4096336452,6),n,i,e[7],1126891415,10),r,n,e[14],2878612391,15),o,r,e[5],4237533241,21),i=f(i,o=f(o,r=f(r,n,i,o,e[12],1700485571,6),n,i,e[3],2399980690,10),r,n,e[10],4293915773,15),o,r,e[1],2240044497,21),i=f(i,o=f(o,r=f(r,n,i,o,e[8],1873313359,6),n,i,e[15],4264355552,10),r,n,e[6],2734768916,15),o,r,e[13],1309151649,21),i=f(i,o=f(o,r=f(r,n,i,o,e[4],4149444226,6),n,i,e[11],3174756917,10),r,n,e[2],718787259,15),o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},n.prototype._digest=function(){this._block[this._blockOffset++]=128,56=this._blockSize;){for(var i=this._blockOffset;i>8,a=255&i;o?r.push(o,a):r.push(a)}return r},n.zero2=i,n.toHex=o,n.encode=function(e,t){return"hex"===t?o(e):e}},{}],111:[function(e,t,r){t.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},{}],112:[function(e,t,r){"use strict";var n=e("asn1.js");r.certificate=e("./certificate");var i=n.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});r.RSAPrivateKey=i;var o=n.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});r.RSAPublicKey=o;var a=n.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())});r.PublicKey=a;var s=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),u=n.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(s),this.key("subjectPrivateKey").octstr())});r.PrivateKey=u;var l=n.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});r.EncryptedPrivateKey=l;var c=n.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});r.DSAPrivateKey=c,r.DSAparam=n.define("DSAparam",function(){this.int()});var f=n.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(h),this.key("publicKey").optional().explicit(1).bitstr())});r.ECPrivateKey=f;var h=n.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});r.signature=n.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})},{"./certificate":113,"asn1.js":2}],113:[function(e,t,r){"use strict";var n=e("asn1.js"),i=n.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),o=n.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),a=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional())}),s=n.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(a),this.key("subjectPublicKey").bitstr())}),u=n.define("RelativeDistinguishedName",function(){this.setof(o)}),l=n.define("RDNSequence",function(){this.seqof(u)}),c=n.define("Name",function(){this.choice({rdnSequence:this.use(l)})}),f=n.define("Validity",function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))}),h=n.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),d=n.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int(),this.key("serialNumber").int(),this.key("signature").use(a),this.key("issuer").use(c),this.key("validity").use(f),this.key("subject").use(c),this.key("subjectPublicKeyInfo").use(s),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(h).optional())}),p=n.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(d),this.key("signatureAlgorithm").use(a),this.key("signatureValue").bitstr())});t.exports=p},{"asn1.js":2}],114:[function(e,t,r){(function(h){var d=/Proc-Type: 4,ENCRYPTED\n\r?DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\n\r?\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?/m,p=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n/m,g=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?-----END \1-----$/m,m=e("evp_bytestokey"),v=e("browserify-aes");t.exports=function(e,t){var r,n=e.toString(),i=n.match(d);if(i){var o="aes"+i[1],a=new h(i[2],"hex"),s=new h(i[3].replace(/\r?\n/g,""),"base64"),u=m(t,a.slice(0,8),parseInt(i[1],10)).key,l=[],c=v.createDecipheriv(o,u,a);l.push(c.update(s)),l.push(c.final()),r=h.concat(l)}else{var f=n.match(g);r=new h(f[2].replace(/\r?\n/g,""),"base64")}return{tag:n.match(p)[1],data:r}}}).call(this,e("buffer").Buffer)},{"browserify-aes":22,buffer:49,evp_bytestokey:86}],115:[function(t,r,e){(function(f){var s=t("./asn1"),h=t("./aesid.json"),u=t("./fixProc"),d=t("browserify-aes"),p=t("pbkdf2");function e(e){var t;"object"!=typeof e||f.isBuffer(e)||(t=e.passphrase,e=e.key),"string"==typeof e&&(e=new f(e));var r,n,i=u(e,t),o=i.tag,a=i.data;switch(o){case"CERTIFICATE":n=s.certificate.decode(a,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(n||(n=s.PublicKey.decode(a,"der")),r=n.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return s.RSAPublicKey.decode(n.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return n.subjectPrivateKey=n.subjectPublicKey,{type:"ec",data:n};case"1.2.840.10040.4.1":return n.algorithm.params.pub_key=s.DSAparam.decode(n.subjectPublicKey.data,"der"),{type:"dsa",data:n.algorithm.params};default:throw new Error("unknown key id "+r)}throw new Error("unknown key type "+o);case"ENCRYPTED PRIVATE KEY":a=function(e,t){var r=e.algorithm.decrypt.kde.kdeparams.salt,n=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),i=h[e.algorithm.decrypt.cipher.algo.join(".")],o=e.algorithm.decrypt.cipher.iv,a=e.subjectPrivateKey,s=parseInt(i.split("-")[1],10)/8,u=p.pbkdf2Sync(t,r,n,s),l=d.createDecipheriv(i,u,o),c=[];return c.push(l.update(a)),c.push(l.final()),f.concat(c)}(a=s.EncryptedPrivateKey.decode(a,"der"),t);case"PRIVATE KEY":switch(r=(n=s.PrivateKey.decode(a,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return s.RSAPrivateKey.decode(n.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:n.algorithm.curve,privateKey:s.ECPrivateKey.decode(n.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return n.algorithm.params.priv_key=s.DSAparam.decode(n.subjectPrivateKey,"der"),{type:"dsa",params:n.algorithm.params};default:throw new Error("unknown key id "+r)}throw new Error("unknown key type "+o);case"RSA PUBLIC KEY":return s.RSAPublicKey.decode(a,"der");case"RSA PRIVATE KEY":return s.RSAPrivateKey.decode(a,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:s.DSAPrivateKey.decode(a,"der")};case"EC PRIVATE KEY":return{curve:(a=s.ECPrivateKey.decode(a,"der")).parameters.value,privateKey:a.privateKey};default:throw new Error("unknown key type "+o)}}(r.exports=e).signature=s.signature}).call(this,t("buffer").Buffer)},{"./aesid.json":111,"./asn1":112,"./fixProc":114,"browserify-aes":22,buffer:49,pbkdf2:117}],116:[function(e,t,l){(function(i){function o(e,t){for(var r=0,n=e.length-1;0<=n;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,a=function(e){return t.exec(e).slice(1)};function s(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;ni?t=n(t):t.lengtha||0<=new l(t).cmp(o.modulus))throw new Error("decryption error");i=r?g(new l(t),o):d(t,o);var s=new c(a-i.length);if(s.fill(0),i=c.concat([s,i],a),4===n)return function(e,t){e.modulus;var r=e.modulus.byteLength(),n=(t.length,p("sha1").update(new c("")).digest()),i=n.length;if(0!==t[0])throw new Error("decryption error");var o=t.slice(1,i+1),a=t.slice(i+1),s=h(o,f(a,i)),u=h(a,f(s,r-i-1));if(function(e,t){e=new c(e),t=new c(t);var r=0,n=e.length;e.length!==t.length&&(r++,n=Math.min(e.length,t.length));var i=-1;for(;++i=t.length){o++;break}var a=t.slice(2,i-1);t.slice(i-1,i);("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&o++;a.length<8&&o++;if(o)throw new Error("decryption error");return t.slice(i)}(0,i,r);if(3===n)return i;throw new Error("unknown padding")}}).call(this,e("buffer").Buffer)},{"./mgf":125,"./withPublic":128,"./xor":129,"bn.js":17,"browserify-rsa":40,buffer:49,"create-hash":53,"parse-asn1":115}],127:[function(e,t,r){(function(h){var a=e("parse-asn1"),d=e("randombytes"),p=e("create-hash"),g=e("./mgf"),m=e("./xor"),v=e("bn.js"),s=e("./withPublic"),u=e("browserify-rsa");t.exports=function(e,t,r){var n;n=e.padding?e.padding:r?1:4;var i,o=a(e);if(4===n)i=function(e,t){var r=e.modulus.byteLength(),n=t.length,i=p("sha1").update(new h("")).digest(),o=i.length,a=2*o;if(r-a-2t.highWaterMark&&(t.highWaterMark=function(e){return u<=e?e=u:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function c(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?m(f,e):f(e))}function f(e){y("emit readable"),e.emit("readable"),x(e)}function d(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.highWaterMark||t.ended))return y("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?T(this):c(this),null;if(0===(e=l(e,t))&&t.ended)return 0===t.length&&T(this),null;var n,i=t.needReadable;return y("need readable",i),(0===t.length||t.length-e>>32-t}function p(e,t,r,n,i,o,a,s){return d(e+(t^r^n)+o+a|0,s)+i|0}function g(e,t,r,n,i,o,a,s){return d(e+(t&r|~t&n)+o+a|0,s)+i|0}function m(e,t,r,n,i,o,a,s){return d(e+((t|~r)^n)+o+a|0,s)+i|0}function v(e,t,r,n,i,o,a,s){return d(e+(t&n|r&~n)+o+a|0,s)+i|0}function _(e,t,r,n,i,o,a,s){return d(e+(t^(r|~n))+o+a|0,s)+i|0}e(n,r),n.prototype._update=function(){for(var e=new Array(16),t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d,a=this._e;a=p(a,r=p(r,n,i,o,a,e[0],0,11),n,i=d(i,10),o,e[1],0,14),n=p(n=d(n,10),i=p(i,o=p(o,a,r,n,i,e[2],0,15),a,r=d(r,10),n,e[3],0,12),o,a=d(a,10),r,e[4],0,5),o=p(o=d(o,10),a=p(a,r=p(r,n,i,o,a,e[5],0,8),n,i=d(i,10),o,e[6],0,7),r,n=d(n,10),i,e[7],0,9),r=p(r=d(r,10),n=p(n,i=p(i,o,a,r,n,e[8],0,11),o,a=d(a,10),r,e[9],0,13),i,o=d(o,10),a,e[10],0,14),i=p(i=d(i,10),o=p(o,a=p(a,r,n,i,o,e[11],0,15),r,n=d(n,10),i,e[12],0,6),a,r=d(r,10),n,e[13],0,7),a=g(a=d(a,10),r=p(r,n=p(n,i,o,a,r,e[14],0,9),i,o=d(o,10),a,e[15],0,8),n,i=d(i,10),o,e[7],1518500249,7),n=g(n=d(n,10),i=g(i,o=g(o,a,r,n,i,e[4],1518500249,6),a,r=d(r,10),n,e[13],1518500249,8),o,a=d(a,10),r,e[1],1518500249,13),o=g(o=d(o,10),a=g(a,r=g(r,n,i,o,a,e[10],1518500249,11),n,i=d(i,10),o,e[6],1518500249,9),r,n=d(n,10),i,e[15],1518500249,7),r=g(r=d(r,10),n=g(n,i=g(i,o,a,r,n,e[3],1518500249,15),o,a=d(a,10),r,e[12],1518500249,7),i,o=d(o,10),a,e[0],1518500249,12),i=g(i=d(i,10),o=g(o,a=g(a,r,n,i,o,e[9],1518500249,15),r,n=d(n,10),i,e[5],1518500249,9),a,r=d(r,10),n,e[2],1518500249,11),a=g(a=d(a,10),r=g(r,n=g(n,i,o,a,r,e[14],1518500249,7),i,o=d(o,10),a,e[11],1518500249,13),n,i=d(i,10),o,e[8],1518500249,12),n=m(n=d(n,10),i=m(i,o=m(o,a,r,n,i,e[3],1859775393,11),a,r=d(r,10),n,e[10],1859775393,13),o,a=d(a,10),r,e[14],1859775393,6),o=m(o=d(o,10),a=m(a,r=m(r,n,i,o,a,e[4],1859775393,7),n,i=d(i,10),o,e[9],1859775393,14),r,n=d(n,10),i,e[15],1859775393,9),r=m(r=d(r,10),n=m(n,i=m(i,o,a,r,n,e[8],1859775393,13),o,a=d(a,10),r,e[1],1859775393,15),i,o=d(o,10),a,e[2],1859775393,14),i=m(i=d(i,10),o=m(o,a=m(a,r,n,i,o,e[7],1859775393,8),r,n=d(n,10),i,e[0],1859775393,13),a,r=d(r,10),n,e[6],1859775393,6),a=m(a=d(a,10),r=m(r,n=m(n,i,o,a,r,e[13],1859775393,5),i,o=d(o,10),a,e[11],1859775393,12),n,i=d(i,10),o,e[5],1859775393,7),n=v(n=d(n,10),i=v(i,o=m(o,a,r,n,i,e[12],1859775393,5),a,r=d(r,10),n,e[1],2400959708,11),o,a=d(a,10),r,e[9],2400959708,12),o=v(o=d(o,10),a=v(a,r=v(r,n,i,o,a,e[11],2400959708,14),n,i=d(i,10),o,e[10],2400959708,15),r,n=d(n,10),i,e[0],2400959708,14),r=v(r=d(r,10),n=v(n,i=v(i,o,a,r,n,e[8],2400959708,15),o,a=d(a,10),r,e[12],2400959708,9),i,o=d(o,10),a,e[4],2400959708,8),i=v(i=d(i,10),o=v(o,a=v(a,r,n,i,o,e[13],2400959708,9),r,n=d(n,10),i,e[3],2400959708,14),a,r=d(r,10),n,e[7],2400959708,5),a=v(a=d(a,10),r=v(r,n=v(n,i,o,a,r,e[15],2400959708,6),i,o=d(o,10),a,e[14],2400959708,8),n,i=d(i,10),o,e[5],2400959708,6),n=_(n=d(n,10),i=v(i,o=v(o,a,r,n,i,e[6],2400959708,5),a,r=d(r,10),n,e[2],2400959708,12),o,a=d(a,10),r,e[4],2840853838,9),o=_(o=d(o,10),a=_(a,r=_(r,n,i,o,a,e[0],2840853838,15),n,i=d(i,10),o,e[5],2840853838,5),r,n=d(n,10),i,e[9],2840853838,11),r=_(r=d(r,10),n=_(n,i=_(i,o,a,r,n,e[7],2840853838,6),o,a=d(a,10),r,e[12],2840853838,8),i,o=d(o,10),a,e[2],2840853838,13),i=_(i=d(i,10),o=_(o,a=_(a,r,n,i,o,e[10],2840853838,12),r,n=d(n,10),i,e[14],2840853838,5),a,r=d(r,10),n,e[1],2840853838,12),a=_(a=d(a,10),r=_(r,n=_(n,i,o,a,r,e[3],2840853838,13),i,o=d(o,10),a,e[8],2840853838,14),n,i=d(i,10),o,e[11],2840853838,11),n=_(n=d(n,10),i=_(i,o=_(o,a,r,n,i,e[6],2840853838,8),a,r=d(r,10),n,e[15],2840853838,5),o,a=d(a,10),r,e[13],2840853838,6),o=d(o,10);var s=this._a,u=this._b,l=this._c,c=this._d,f=this._e;f=_(f,s=_(s,u,l,c,f,e[5],1352829926,8),u,l=d(l,10),c,e[14],1352829926,9),u=_(u=d(u,10),l=_(l,c=_(c,f,s,u,l,e[7],1352829926,9),f,s=d(s,10),u,e[0],1352829926,11),c,f=d(f,10),s,e[9],1352829926,13),c=_(c=d(c,10),f=_(f,s=_(s,u,l,c,f,e[2],1352829926,15),u,l=d(l,10),c,e[11],1352829926,15),s,u=d(u,10),l,e[4],1352829926,5),s=_(s=d(s,10),u=_(u,l=_(l,c,f,s,u,e[13],1352829926,7),c,f=d(f,10),s,e[6],1352829926,7),l,c=d(c,10),f,e[15],1352829926,8),l=_(l=d(l,10),c=_(c,f=_(f,s,u,l,c,e[8],1352829926,11),s,u=d(u,10),l,e[1],1352829926,14),f,s=d(s,10),u,e[10],1352829926,14),f=v(f=d(f,10),s=_(s,u=_(u,l,c,f,s,e[3],1352829926,12),l,c=d(c,10),f,e[12],1352829926,6),u,l=d(l,10),c,e[6],1548603684,9),u=v(u=d(u,10),l=v(l,c=v(c,f,s,u,l,e[11],1548603684,13),f,s=d(s,10),u,e[3],1548603684,15),c,f=d(f,10),s,e[7],1548603684,7),c=v(c=d(c,10),f=v(f,s=v(s,u,l,c,f,e[0],1548603684,12),u,l=d(l,10),c,e[13],1548603684,8),s,u=d(u,10),l,e[5],1548603684,9),s=v(s=d(s,10),u=v(u,l=v(l,c,f,s,u,e[10],1548603684,11),c,f=d(f,10),s,e[14],1548603684,7),l,c=d(c,10),f,e[15],1548603684,7),l=v(l=d(l,10),c=v(c,f=v(f,s,u,l,c,e[8],1548603684,12),s,u=d(u,10),l,e[12],1548603684,7),f,s=d(s,10),u,e[4],1548603684,6),f=v(f=d(f,10),s=v(s,u=v(u,l,c,f,s,e[9],1548603684,15),l,c=d(c,10),f,e[1],1548603684,13),u,l=d(l,10),c,e[2],1548603684,11),u=m(u=d(u,10),l=m(l,c=m(c,f,s,u,l,e[15],1836072691,9),f,s=d(s,10),u,e[5],1836072691,7),c,f=d(f,10),s,e[1],1836072691,15),c=m(c=d(c,10),f=m(f,s=m(s,u,l,c,f,e[3],1836072691,11),u,l=d(l,10),c,e[7],1836072691,8),s,u=d(u,10),l,e[14],1836072691,6),s=m(s=d(s,10),u=m(u,l=m(l,c,f,s,u,e[6],1836072691,6),c,f=d(f,10),s,e[9],1836072691,14),l,c=d(c,10),f,e[11],1836072691,12),l=m(l=d(l,10),c=m(c,f=m(f,s,u,l,c,e[8],1836072691,13),s,u=d(u,10),l,e[12],1836072691,5),f,s=d(s,10),u,e[2],1836072691,14),f=m(f=d(f,10),s=m(s,u=m(u,l,c,f,s,e[10],1836072691,13),l,c=d(c,10),f,e[0],1836072691,13),u,l=d(l,10),c,e[4],1836072691,7),u=g(u=d(u,10),l=g(l,c=m(c,f,s,u,l,e[13],1836072691,5),f,s=d(s,10),u,e[8],2053994217,15),c,f=d(f,10),s,e[6],2053994217,5),c=g(c=d(c,10),f=g(f,s=g(s,u,l,c,f,e[4],2053994217,8),u,l=d(l,10),c,e[1],2053994217,11),s,u=d(u,10),l,e[3],2053994217,14),s=g(s=d(s,10),u=g(u,l=g(l,c,f,s,u,e[11],2053994217,14),c,f=d(f,10),s,e[15],2053994217,6),l,c=d(c,10),f,e[0],2053994217,14),l=g(l=d(l,10),c=g(c,f=g(f,s,u,l,c,e[5],2053994217,6),s,u=d(u,10),l,e[12],2053994217,9),f,s=d(s,10),u,e[2],2053994217,12),f=g(f=d(f,10),s=g(s,u=g(u,l,c,f,s,e[13],2053994217,9),l,c=d(c,10),f,e[9],2053994217,12),u,l=d(l,10),c,e[7],2053994217,5),u=p(u=d(u,10),l=g(l,c=g(c,f,s,u,l,e[10],2053994217,15),f,s=d(s,10),u,e[14],2053994217,8),c,f=d(f,10),s,e[12],0,8),c=p(c=d(c,10),f=p(f,s=p(s,u,l,c,f,e[15],0,5),u,l=d(l,10),c,e[10],0,12),s,u=d(u,10),l,e[4],0,9),s=p(s=d(s,10),u=p(u,l=p(l,c,f,s,u,e[1],0,12),c,f=d(f,10),s,e[5],0,5),l,c=d(c,10),f,e[8],0,14),l=p(l=d(l,10),c=p(c,f=p(f,s,u,l,c,e[7],0,6),s,u=d(u,10),l,e[6],0,8),f,s=d(s,10),u,e[2],0,13),f=p(f=d(f,10),s=p(s,u=p(u,l,c,f,s,e[13],0,6),l,c=d(c,10),f,e[14],0,5),u,l=d(l,10),c,e[0],0,15),u=p(u=d(u,10),l=p(l,c=p(c,f,s,u,l,e[3],0,13),f,s=d(s,10),u,e[9],0,11),c,f=d(f,10),s,e[11],0,11),c=d(c,10);var h=this._b+i+c|0;this._b=this._c+o+f|0,this._c=this._d+a+s|0,this._d=this._e+r+u|0,this._e=this._a+n+l|0,this._a=h},n.prototype._digest=function(){this._block[this._blockOffset++]=128,56=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=4294967295&r,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},n.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=n},{"safe-buffer":143}],145:[function(e,t,r){(r=t.exports=function(e){e=e.toLowerCase();var t=r[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t}).sha=e("./sha"),r.sha1=e("./sha1"),r.sha224=e("./sha224"),r.sha256=e("./sha256"),r.sha384=e("./sha384"),r.sha512=e("./sha512")},{"./sha":146,"./sha1":147,"./sha224":148,"./sha256":149,"./sha384":150,"./sha512":151}],146:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,v=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function s(){this.init(),this._w=a,i.call(this,64,56)}n(s,i),s.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},s.prototype._update=function(e){for(var t,r,n,i,o,a,s=this._w,u=0|this._a,l=0|this._b,c=0|this._c,f=0|this._d,h=0|this._e,d=0;d<16;++d)s[d]=e.readInt32BE(4*d);for(;d<80;++d)s[d]=s[d-3]^s[d-8]^s[d-14]^s[d-16];for(var p=0;p<80;++p){var g=~~(p/20),m=0|((a=u)<<5|a>>>27)+(n=l,i=c,o=f,0===(r=g)?n&i|~n&o:2===r?n&i|n&o|i&o:n^i^o)+h+s[p]+v[g];h=f,f=c,c=(t=l)<<30|t>>>2,l=u,u=m}this._a=u+this._a|0,this._b=l+this._b|0,this._c=c+this._c|0,this._d=f+this._d|0,this._e=h+this._e|0},s.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=s},{"./hash":144,inherits:103,"safe-buffer":143}],147:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,_=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function s(){this.init(),this._w=a,i.call(this,64,56)}n(s,i),s.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},s.prototype._update=function(e){for(var t,r,n,i,o,a,s,u=this._w,l=0|this._a,c=0|this._b,f=0|this._c,h=0|this._d,d=0|this._e,p=0;p<16;++p)u[p]=e.readInt32BE(4*p);for(;p<80;++p)u[p]=(t=u[p-3]^u[p-8]^u[p-14]^u[p-16])<<1|t>>>31;for(var g=0;g<80;++g){var m=~~(g/20),v=0|((s=l)<<5|s>>>27)+(i=c,o=f,a=h,0===(n=m)?i&o|~i&a:2===n?i&o|i&a|o&a:i^o^a)+d+u[g]+_[m];d=h,h=f,f=(r=c)<<30|r>>>2,c=l,l=v}this._a=l+this._a|0,this._b=c+this._b|0,this._c=f+this._c|0,this._d=h+this._d|0,this._e=d+this._e|0},s.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=s},{"./hash":144,inherits:103,"safe-buffer":143}],148:[function(e,t,r){var n=e("inherits"),i=e("./sha256"),o=e("./hash"),a=e("safe-buffer").Buffer,s=new Array(64);function u(){this.init(),this._w=s,o.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var e=a.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},t.exports=u},{"./hash":144,"./sha256":149,inherits:103,"safe-buffer":143}],149:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,x=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a=new Array(64);function s(){this.init(),this._w=a,i.call(this,64,56)}n(s,i),s.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},s.prototype._update=function(e){for(var t,r,n,i,o,a,s,u=this._w,l=0|this._a,c=0|this._b,f=0|this._c,h=0|this._d,d=0|this._e,p=0|this._f,g=0|this._g,m=0|this._h,v=0;v<16;++v)u[v]=e.readInt32BE(4*v);for(;v<64;++v)u[v]=0|(((r=u[v-2])>>>17|r<<15)^(r>>>19|r<<13)^r>>>10)+u[v-7]+(((t=u[v-15])>>>7|t<<25)^(t>>>18|t<<14)^t>>>3)+u[v-16];for(var _=0;_<64;++_){var y=m+(((s=d)>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7))+((a=g)^d&(p^a))+x[_]+u[_]|0,b=0|(((o=l)>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+((n=l)&(i=c)|f&(n|i));m=g,g=p,p=d,d=h+y|0,h=f,f=c,c=l,l=y+b|0}this._a=l+this._a|0,this._b=c+this._b|0,this._c=f+this._c|0,this._d=h+this._d|0,this._e=d+this._e|0,this._f=p+this._f|0,this._g=g+this._g|0,this._h=m+this._h|0},s.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},t.exports=s},{"./hash":144,inherits:103,"safe-buffer":143}],150:[function(e,t,r){var n=e("inherits"),i=e("./sha512"),o=e("./hash"),a=e("safe-buffer").Buffer,s=new Array(160);function u(){this.init(),this._w=s,o.call(this,128,112)}n(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var n=a.allocUnsafe(48);function e(e,t,r){n.writeInt32BE(e,r),n.writeInt32BE(t,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),n},t.exports=u},{"./hash":144,"./sha512":151,inherits:103,"safe-buffer":143}],151:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,ee=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function s(){this.init(),this._w=a,i.call(this,128,112)}function te(e,t,r){return r^e&(t^r)}function re(e,t,r){return e&t|r&(e|t)}function ne(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function ie(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function oe(e,t){return e>>>0>>0?1:0}n(s,i),s.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},s.prototype._update=function(e){for(var t,r,n,i,o,a,s,u,l=this._w,c=0|this._ah,f=0|this._bh,h=0|this._ch,d=0|this._dh,p=0|this._eh,g=0|this._fh,m=0|this._gh,v=0|this._hh,_=0|this._al,y=0|this._bl,b=0|this._cl,x=0|this._dl,w=0|this._el,T=0|this._fl,S=0|this._gl,M=0|this._hl,P=0;P<32;P+=2)l[P]=e.readInt32BE(4*P),l[P+1]=e.readInt32BE(4*P+4);for(;P<160;P+=2){var C=l[P-30],k=l[P-30+1],E=((s=C)>>>1|(u=k)<<31)^(s>>>8|u<<24)^s>>>7,A=((o=k)>>>1|(a=C)<<31)^(o>>>8|a<<24)^(o>>>7|a<<25);C=l[P-4],k=l[P-4+1];var O=((n=C)>>>19|(i=k)<<13)^(i>>>29|n<<3)^n>>>6,R=((t=k)>>>19|(r=C)<<13)^(r>>>29|t<<3)^(t>>>6|r<<26),I=l[P-14],D=l[P-14+1],L=l[P-32],N=l[P-32+1],j=A+D|0,F=E+I+oe(j,A)|0;F=(F=F+O+oe(j=j+R|0,R)|0)+L+oe(j=j+N|0,N)|0,l[P]=F,l[P+1]=j}for(var B=0;B<160;B+=2){F=l[B],j=l[B+1];var z=re(c,f,h),U=re(_,y,b),X=ne(c,_),q=ne(_,c),H=ie(p,w),Y=ie(w,p),G=ee[B],W=ee[B+1],V=te(p,g,m),K=te(w,T,S),Z=M+Y|0,J=v+H+oe(Z,M)|0;J=(J=(J=J+V+oe(Z=Z+K|0,K)|0)+G+oe(Z=Z+W|0,W)|0)+F+oe(Z=Z+j|0,j)|0;var $=q+U|0,Q=X+z+oe($,q)|0;v=m,M=S,m=g,S=T,g=p,T=w,p=d+J+oe(w=x+Z|0,x)|0,d=h,x=b,h=f,b=y,f=c,y=_,c=J+Q+oe(_=Z+$|0,Z)|0}this._al=this._al+_|0,this._bl=this._bl+y|0,this._cl=this._cl+b|0,this._dl=this._dl+x|0,this._el=this._el+w|0,this._fl=this._fl+T|0,this._gl=this._gl+S|0,this._hl=this._hl+M|0,this._ah=this._ah+c+oe(this._al,_)|0,this._bh=this._bh+f+oe(this._bl,y)|0,this._ch=this._ch+h+oe(this._cl,b)|0,this._dh=this._dh+d+oe(this._dl,x)|0,this._eh=this._eh+p+oe(this._el,w)|0,this._fh=this._fh+g+oe(this._fl,T)|0,this._gh=this._gh+m+oe(this._gl,S)|0,this._hh=this._hh+v+oe(this._hl,M)|0},s.prototype._hash=function(){var n=o.allocUnsafe(64);function e(e,t,r){n.writeInt32BE(e,r),n.writeInt32BE(t,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),n},t.exports=s},{"./hash":144,inherits:103,"safe-buffer":143}],152:[function(e,t,r){t.exports=n;var c=e("events").EventEmitter;function n(){c.call(this)}e("inherits")(n,c),n.Readable=e("readable-stream/readable.js"),n.Writable=e("readable-stream/writable.js"),n.Duplex=e("readable-stream/duplex.js"),n.Transform=e("readable-stream/transform.js"),n.PassThrough=e("readable-stream/passthrough.js"),(n.Stream=n).prototype.pipe=function(t,e){var r=this;function n(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function i(){r.readable&&r.resume&&r.resume()}r.on("data",n),t.on("drain",i),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",s));var o=!1;function a(){o||(o=!0,t.end())}function s(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function u(e){if(l(),0===c.listenerCount(this,"error"))throw e}function l(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",a),r.removeListener("close",s),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",l),r.removeListener("close",l),t.removeListener("close",l)}return r.on("error",u),t.on("error",u),r.on("end",l),r.on("close",l),t.on("close",l),t.emit("pipe",r),t}},{events:85,inherits:103,"readable-stream/duplex.js":132,"readable-stream/passthrough.js":138,"readable-stream/readable.js":139,"readable-stream/transform.js":140,"readable-stream/writable.js":141}],153:[function(e,t,r){var n=e("buffer").Buffer,i=n.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};var o=r.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!i(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=s;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=u;break;default:return void(this.write=a)}this.charBuffer=new n(6),this.charReceived=0,this.charLength=0};function a(e){return e.toString(this.encoding)}function s(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function u(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}o.prototype.write=function(e){for(var t="";this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived>5==6){this.charLength=2;break}if(t<=2&&r>>4==14){this.charLength=3;break}if(t<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=t},o.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;t+=n.slice(0,r).toString(i)}return t}},{buffer:49}],154:[function(e,t,r){(function(r){function n(e){try{if(!r.localStorage)return!1}catch(e){return!1}var t=r.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}t.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],155:[function(require,module,exports){var indexOf=require("indexof"),Object_keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var r in e)t.push(r);return t},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r>2)*(r+3>>2)*8;case p:case g:case c:case m:return(t+3>>2)*(r+3>>2)*16;case ie:case ae:return Math.floor((Math.max(t,8)*Math.max(r,8)*4+7)/8);case oe:case se:return Math.floor((Math.max(t,16)*Math.max(r,8)*2+7)/8);case v:case i:return Math.floor((t+3)/4)*Math.floor((r+3)/4)*16;case _:case o:return Math.floor((t+4)/5)*Math.floor((r+3)/4)*16;case y:case a:return Math.floor((t+4)/5)*Math.floor((r+4)/5)*16;case b:case s:return Math.floor((t+5)/6)*Math.floor((r+4)/5)*16;case x:case u:return Math.floor((t+5)/6)*Math.floor((r+5)/6)*16;case w:case O:return Math.floor((t+7)/8)*Math.floor((r+4)/5)*16;case T:case R:return Math.floor((t+7)/8)*Math.floor((r+5)/6)*16;case S:case I:return Math.floor((t+7)/8)*Math.floor((r+7)/8)*16;case M:case D:return Math.floor((t+9)/10)*Math.floor((r+4)/5)*16;case P:case L:return Math.floor((t+9)/10)*Math.floor((r+5)/6)*16;case C:case N:return Math.floor((t+9)/10)*Math.floor((r+7)/8)*16;case k:case j:return Math.floor((t+9)/10)*Math.floor((r+9)/10)*16;case E:case F:return Math.floor((t+11)/12)*Math.floor((r+9)/10)*16;case A:case B:return Math.floor((t+11)/12)*Math.floor((r+11)/12)*16;default:return 0}}(t.exports=f).prototype.init=function(e,t,r,n,i,o,a,s){this.src=e,this.width=n,this.height=i,this.data=t,this.type=r,this.levels=o,this.internalFormat=a,this.isCompressedImage=!0,this.crunch=s,this.preserveSource=!0;var u=this.complete;return this.complete=!!t,!u&&this.complete&&this.onload&&this.onload({target:this}),this},f.prototype.dispose=function(){this.data=null},f.prototype.generateWebGLTexture=function(e){if(null===this.data)throw"Trying to create a second (or more) webgl texture from the same CompressedImage : "+this.src;for(var t=this.width,r=this.height,n=this.levels,i=0,o=0;o>=1)<1&&(t=1),(r>>=1)<1&&(r=1),i+=a}1>8&255,e>>16&255,e>>24&255)}(n)}var i=1;t[G]&U&&(i=Math.max(1,t[K]));var o=t[V],a=t[W],s=t[Y]+4,u=new Uint8Array(e,s);return this.init(this.src,u,"DDS",o,a,i,r)},f.prototype._loadASTC=function(e){var t=new Int8Array(e,0,Me);if(new Uint32Array(e.slice(0,4))!=Pe)throw"Invalid magic number in ASTC header";for(var r=[v,_,y,b,x,w,T,S,M,P,C,k,E,A],n=e.byteLength-Me,i=new Uint8Array([t[7],t[8],t[9],0]),o=new Uint8Array([t[10],t[11],t[12],0]),a=new Uint32Array(i.buffer)[0],s=new Uint32Array(o.buffer)[0],u=0,l=0;l 0.0) {\n c.rgb /= c.a;\n\n vec3 rgb = pow(c.rgb, vec3(1. / gamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);\n rgb.r *= red;\n rgb.g *= green;\n rgb.b *= blue;\n c.rgb = rgb * brightness;\n\n c.rgb *= c.a;\n }\n\n gl_FragColor = c * alpha;\n}\n"),Object.assign(this,{gamma:1,saturation:1,contrast:1,brightness:1,red:1,green:1,blue:1,alpha:1},e)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,n){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,e.applyFilter(this,t,r,n)},e}(h.Filter),d=function(n){function e(e,t,r){void 0===e&&(e=4),void 0===t&&(t=3),void 0===r&&(r=!1),n.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",r?"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\nuniform vec4 filterClamp;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample top right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}\n":"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample top right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}"),this.uniforms.uOffset=new Float32Array(2),this._pixelSize=new h.Point,this.pixelSize=1,this._clamp=r,this._kernels=null,Array.isArray(e)?this.kernels=e:(this._blur=e,this.quality=t)}n&&(e.__proto__=n);var t={kernels:{configurable:!0},clamp:{configurable:!0},pixelSize:{configurable:!0},quality:{configurable:!0},blur:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.apply=function(e,t,r,n){var i,o=this.pixelSize.x/t.size.width,a=this.pixelSize.y/t.size.height;if(1===this._quality||0===this._blur)i=this._kernels[0]+.5,this.uniforms.uOffset[0]=i*o,this.uniforms.uOffset[1]=i*a,e.applyFilter(this,t,r,n);else{for(var s,u=e.getRenderTarget(!0),l=t,c=u,f=this._quality-1,h=0;h threshold) {\n gl_FragColor = color;\n } else {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n"),this.threshold=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={threshold:{configurable:!0}};return r.threshold.get=function(){return this.uniforms.threshold},r.threshold.set=function(e){this.uniforms.threshold=e},Object.defineProperties(e.prototype,r),e}(h.Filter),n=function(a){function e(e){a.call(this,s,"uniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D bloomTexture;\nuniform float bloomScale;\nuniform float brightness;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n color.rgb *= brightness;\n vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0);\n bloomColor.rgb *= bloomScale;\n gl_FragColor = color + bloomColor;\n}\n"),"number"==typeof e&&(e={threshold:e}),e=Object.assign({threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:h.settings.RESOLUTION},e),this.bloomScale=e.bloomScale,this.brightness=e.brightness;var t=e.kernels,r=e.blur,n=e.quality,i=e.pixelSize,o=e.resolution;this._extractFilter=new u(e.threshold),this._extractFilter.resolution=o,this._blurFilter=t?new d(t):new d(r,n),this.pixelSize=i,this.resolution=o}a&&(e.__proto__=a);var t={resolution:{configurable:!0},threshold:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return((e.prototype=Object.create(a&&a.prototype)).constructor=e).prototype.apply=function(e,t,r,n,i){var o=e.getRenderTarget(!0);this._extractFilter.apply(e,t,o,!0,i);var a=e.getRenderTarget(!0);this._blurFilter.apply(e,o,a,!0,i),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=a,e.applyFilter(this,t,r,n),e.returnRenderTarget(a),e.returnRenderTarget(o)},t.resolution.get=function(){return this._resolution},t.resolution.set=function(e){this._resolution=e,this._extractFilter&&(this._extractFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},t.threshold.get=function(){return this._extractFilter.threshold},t.threshold.set=function(e){this._extractFilter.threshold=e},t.kernels.get=function(){return this._blurFilter.kernels},t.kernels.set=function(e){this._blurFilter.kernels=e},t.blur.get=function(){return this._blurFilter.blur},t.blur.set=function(e){this._blurFilter.blur=e},t.quality.get=function(){return this._blurFilter.quality},t.quality.set=function(e){this._blurFilter.quality=e},t.pixelSize.get=function(){return this._blurFilter.pixelSize},t.pixelSize.set=function(e){this._blurFilter.pixelSize=e},Object.defineProperties(e.prototype,t),e}(h.Filter),i=function(t){function e(e){void 0===e&&(e=8),t.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform float pixelSize;\nuniform sampler2D uSampler;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n return floor( coord / size ) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n return mod( coord , size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, -4.0) + 2.5);\n if (clamp(p.x, 0.0, 4.0) == p.x && clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n // get the rounded color..\n vec2 pixCoord = pixelate(coord, vec2(pixelSize));\n pixCoord = unmapCoord(pixCoord);\n\n vec4 color = texture2D(uSampler, pixCoord);\n\n // determine the character to use\n float gray = (color.r + color.g + color.b) / 3.0;\n\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n // get the mod..\n vec2 modd = getMod(coord, vec2(pixelSize));\n\n gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0);\n\n}"),this.size=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={size:{configurable:!0}};return r.size.get=function(){return this.uniforms.pixelSize},r.size.set=function(e){this.uniforms.pixelSize=e},Object.defineProperties(e.prototype,r),e}(h.Filter),o=function(t){function e(e){void 0===e&&(e={}),t.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","precision mediump float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float transformX;\nuniform float transformY;\nuniform vec3 lightColor;\nuniform float lightAlpha;\nuniform vec3 shadowColor;\nuniform float shadowAlpha;\n\nvoid main(void) {\n vec2 transform = vec2(1.0 / filterArea) * vec2(transformX, transformY);\n vec4 color = texture2D(uSampler, vTextureCoord);\n float light = texture2D(uSampler, vTextureCoord - transform).a;\n float shadow = texture2D(uSampler, vTextureCoord + transform).a;\n\n color.rgb = mix(color.rgb, lightColor, clamp((color.a - light) * lightAlpha, 0.0, 1.0));\n color.rgb = mix(color.rgb, shadowColor, clamp((color.a - shadow) * shadowAlpha, 0.0, 1.0));\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n"),this.uniforms.lightColor=new Float32Array(3),this.uniforms.shadowColor=new Float32Array(3),e=Object.assign({rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},e),this.rotation=e.rotation,this.thickness=e.thickness,this.lightColor=e.lightColor,this.lightAlpha=e.lightAlpha,this.shadowColor=e.shadowColor,this.shadowAlpha=e.shadowAlpha}t&&(e.__proto__=t);var r={rotation:{configurable:!0},thickness:{configurable:!0},lightColor:{configurable:!0},lightAlpha:{configurable:!0},shadowColor:{configurable:!0},shadowAlpha:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype._updateTransform=function(){this.uniforms.transformX=this._thickness*Math.cos(this._angle),this.uniforms.transformY=this._thickness*Math.sin(this._angle)},r.rotation.get=function(){return this._angle/h.DEG_TO_RAD},r.rotation.set=function(e){this._angle=e*h.DEG_TO_RAD,this._updateTransform()},r.thickness.get=function(){return this._thickness},r.thickness.set=function(e){this._thickness=e,this._updateTransform()},r.lightColor.get=function(){return h.utils.rgb2hex(this.uniforms.lightColor)},r.lightColor.set=function(e){h.utils.hex2rgb(e,this.uniforms.lightColor)},r.lightAlpha.get=function(){return this.uniforms.lightAlpha},r.lightAlpha.set=function(e){this.uniforms.lightAlpha=e},r.shadowColor.get=function(){return h.utils.rgb2hex(this.uniforms.shadowColor)},r.shadowColor.set=function(e){h.utils.hex2rgb(e,this.uniforms.shadowColor)},r.shadowAlpha.get=function(){return this.uniforms.shadowAlpha},r.shadowAlpha.set=function(e){this.uniforms.shadowAlpha=e},Object.defineProperties(e.prototype,r),e}(h.Filter),a=h.filters,l=a.BlurXFilter,c=a.BlurYFilter,f=a.AlphaFilter,p=function(a){function e(e,t,r,n){var i,o;void 0===e&&(e=2),void 0===t&&(t=4),void 0===r&&(r=h.settings.RESOLUTION),void 0===n&&(n=5),a.call(this),"number"==typeof e?o=i=e:e instanceof h.Point?(i=e.x,o=e.y):Array.isArray(e)&&(i=e[0],o=e[1]),this.blurXFilter=new l(i,t,r,n),this.blurYFilter=new c(o,t,r,n),this.blurYFilter.blendMode=h.BLEND_MODES.SCREEN,this.defaultFilter=new f}a&&(e.__proto__=a);var t={blur:{configurable:!0},blurX:{configurable:!0},blurY:{configurable:!0}};return((e.prototype=Object.create(a&&a.prototype)).constructor=e).prototype.apply=function(e,t,r){var n=e.getRenderTarget(!0);this.defaultFilter.apply(e,t,r),this.blurXFilter.apply(e,t,n),this.blurYFilter.apply(e,n,r),e.returnRenderTarget(n)},t.blur.get=function(){return this.blurXFilter.blur},t.blur.set=function(e){this.blurXFilter.blur=this.blurYFilter.blur=e},t.blurX.get=function(){return this.blurXFilter.blur},t.blurX.set=function(e){this.blurXFilter.blur=e},t.blurY.get=function(){return this.blurYFilter.blur},t.blurY.set=function(e){this.blurYFilter.blur=e},Object.defineProperties(e.prototype,t),e}(h.Filter),g=function(n){function e(e,t,r){n.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","uniform float radius;\nuniform float strength;\nuniform vec2 center;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nvoid main()\n{\n vec2 coord = vTextureCoord * filterArea.xy;\n coord -= center * dimensions.xy;\n float distance = length(coord);\n if (distance < radius) {\n float percent = distance / radius;\n if (strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n }\n }\n coord += center * dimensions.xy;\n coord /= filterArea.xy;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n vec4 color = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n gl_FragColor = color;\n}\n"),this.uniforms.dimensions=new Float32Array(2),this.center=e||[.5,.5],this.radius="number"==typeof t?t:100,this.strength="number"==typeof r?r:1}n&&(e.__proto__=n);var t={radius:{configurable:!0},strength:{configurable:!0},center:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.apply=function(e,t,r,n){this.uniforms.dimensions[0]=t.sourceFrame.width,this.uniforms.dimensions[1]=t.sourceFrame.height,e.applyFilter(this,t,r,n)},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(e){this.uniforms.radius=e},t.strength.get=function(){return this.uniforms.strength},t.strength.set=function(e){this.uniforms.strength=e},t.center.get=function(){return this.uniforms.center},t.center.set=function(e){this.uniforms.center=e},Object.defineProperties(e.prototype,t),e}(h.Filter),m=function(n){function e(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=1),n.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D colorMap;\nuniform float _mix;\nuniform float _size;\nuniform float _sliceSize;\nuniform float _slicePixelSize;\nuniform float _sliceInnerSize;\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord.xy);\n\n vec4 adjusted;\n if (color.a > 0.0) {\n color.rgb /= color.a;\n float innerWidth = _size - 1.0;\n float zSlice0 = min(floor(color.b * innerWidth), innerWidth);\n float zSlice1 = min(zSlice0 + 1.0, innerWidth);\n float xOffset = _slicePixelSize * 0.5 + color.r * _sliceInnerSize;\n float s0 = xOffset + (zSlice0 * _sliceSize);\n float s1 = xOffset + (zSlice1 * _sliceSize);\n float yOffset = _sliceSize * 0.5 + color.g * (1.0 - _sliceSize);\n vec4 slice0Color = texture2D(colorMap, vec2(s0,yOffset));\n vec4 slice1Color = texture2D(colorMap, vec2(s1,yOffset));\n float zOffset = fract(color.b * innerWidth);\n adjusted = mix(slice0Color, slice1Color, zOffset);\n\n color.rgb *= color.a;\n }\n gl_FragColor = vec4(mix(color, adjusted, _mix).rgb, color.a);\n\n}"),this._size=0,this._sliceSize=0,this._slicePixelSize=0,this._sliceInnerSize=0,this._scaleMode=null,this._nearest=!1,this.nearest=t,this.mix=r,this.colorMap=e}n&&(e.__proto__=n);var t={colorSize:{configurable:!0},colorMap:{configurable:!0},nearest:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.apply=function(e,t,r,n){this.uniforms._mix=this.mix,e.applyFilter(this,t,r,n)},t.colorSize.get=function(){return this._size},t.colorMap.get=function(){return this._colorMap},t.colorMap.set=function(e){e instanceof h.Texture||(e=h.Texture.from(e)),e&&e.baseTexture&&(e.baseTexture.scaleMode=this._scaleMode,e.baseTexture.mipmap=!1,this._size=e.height,this._sliceSize=1/this._size,this._slicePixelSize=this._sliceSize/this._size,this._sliceInnerSize=this._slicePixelSize*(this._size-1),this.uniforms._size=this._size,this.uniforms._sliceSize=this._sliceSize,this.uniforms._slicePixelSize=this._slicePixelSize,this.uniforms._sliceInnerSize=this._sliceInnerSize,this.uniforms.colorMap=e),this._colorMap=e},t.nearest.get=function(){return this._nearest},t.nearest.set=function(e){this._nearest=e,this._scaleMode=e?h.SCALE_MODES.NEAREST:h.SCALE_MODES.LINEAR;var t=this._colorMap;t&&t.baseTexture&&(t.baseTexture._glTextures={},t.baseTexture.scaleMode=this._scaleMode,t.baseTexture.mipmap=!1,t._updateID++,t.baseTexture.emit("update",t.baseTexture))},e.prototype.updateColorMap=function(){var e=this._colorMap;e&&e.baseTexture&&(e._updateID++,e.baseTexture.emit("update",e.baseTexture),this.colorMap=e)},e.prototype.destroy=function(e){this._colorMap&&this._colorMap.destroy(e),n.prototype.destroy.call(this)},Object.defineProperties(e.prototype,t),e}(h.Filter),v=function(n){function e(e,t,r){void 0===e&&(e=16711680),void 0===t&&(t=0),void 0===r&&(r=.4),n.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec3 originalColor;\nuniform vec3 newColor;\nuniform float epsilon;\nvoid main(void) {\n vec4 currentColor = texture2D(uSampler, vTextureCoord);\n vec3 colorDiff = originalColor - (currentColor.rgb / max(currentColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n float doReplace = step(colorDistance, epsilon);\n gl_FragColor = vec4(mix(currentColor.rgb, (newColor + colorDiff) * currentColor.a, doReplace), currentColor.a);\n}\n"),this.uniforms.originalColor=new Float32Array(3),this.uniforms.newColor=new Float32Array(3),this.originalColor=e,this.newColor=t,this.epsilon=r}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={originalColor:{configurable:!0},newColor:{configurable:!0},epsilon:{configurable:!0}};return t.originalColor.set=function(e){var t=this.uniforms.originalColor;"number"==typeof e?(h.utils.hex2rgb(e,t),this._originalColor=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],this._originalColor=h.utils.rgb2hex(t))},t.originalColor.get=function(){return this._originalColor},t.newColor.set=function(e){var t=this.uniforms.newColor;"number"==typeof e?(h.utils.hex2rgb(e,t),this._newColor=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],this._newColor=h.utils.rgb2hex(t))},t.newColor.get=function(){return this._newColor},t.epsilon.set=function(e){this.uniforms.epsilon=e},t.epsilon.get=function(){return this.uniforms.epsilon},Object.defineProperties(e.prototype,t),e}(h.Filter),_=function(n){function e(e,t,r){void 0===t&&(t=200),void 0===r&&(r=200),n.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","precision mediump float;\n\nvarying mediump vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 texelSize;\nuniform float matrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\n\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\n\n gl_FragColor =\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\n\n gl_FragColor.a = c22.a;\n}\n"),this.uniforms.texelSize=new Float32Array(2),this.uniforms.matrix=new Float32Array(9),void 0!==e&&(this.matrix=e),this.width=t,this.height=r}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={matrix:{configurable:!0},width:{configurable:!0},height:{configurable:!0}};return t.matrix.get=function(){return this.uniforms.matrix},t.matrix.set=function(e){var r=this;e.forEach(function(e,t){return r.uniforms.matrix[t]=e})},t.width.get=function(){return 1/this.uniforms.texelSize[0]},t.width.set=function(e){this.uniforms.texelSize[0]=1/e},t.height.get=function(){return 1/this.uniforms.texelSize[1]},t.height.set=function(e){this.uniforms.texelSize[1]=1/e},Object.defineProperties(e.prototype,t),e}(h.Filter),y=function(e){function t(){e.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);\n\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n\n if (lum < 1.00)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.75)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.50)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.3)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n}\n")}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t}(h.Filter),b=function(t){function e(e){t.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nconst float SQRT_2 = 1.414213;\n\nconst float light = 1.0;\n\nuniform float curvature;\nuniform float lineWidth;\nuniform float lineContrast;\nuniform bool verticalLine;\nuniform float noise;\nuniform float noiseSize;\n\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\n\nuniform float seed;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 coord = pixelCoord / dimensions;\n\n vec2 dir = vec2(coord - vec2(0.5, 0.5));\n\n float _c = curvature > 0. ? curvature : 1.;\n float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\n vec2 uv = dir * k;\n\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 rgb = gl_FragColor.rgb;\n\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n rgb += _noise * noise;\n }\n\n if (lineWidth > 0.0) {\n float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c;\n float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast;\n rgb *= j;\n float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.);\n rgb *= 0.99 + ceil(segment) * 0.015;\n }\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n gl_FragColor.rgb = rgb;\n}\n"),this.uniforms.dimensions=new Float32Array(2),this.time=0,this.seed=0,Object.assign(this,{curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},e)}t&&(e.__proto__=t);var r={curvature:{configurable:!0},lineWidth:{configurable:!0},lineContrast:{configurable:!0},verticalLine:{configurable:!0},noise:{configurable:!0},noiseSize:{configurable:!0},vignetting:{configurable:!0},vignettingAlpha:{configurable:!0},vignettingBlur:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,n){this.uniforms.dimensions[0]=t.sourceFrame.width,this.uniforms.dimensions[1]=t.sourceFrame.height,this.uniforms.seed=this.seed,this.uniforms.time=this.time,e.applyFilter(this,t,r,n)},r.curvature.set=function(e){this.uniforms.curvature=e},r.curvature.get=function(){return this.uniforms.curvature},r.lineWidth.set=function(e){this.uniforms.lineWidth=e},r.lineWidth.get=function(){return this.uniforms.lineWidth},r.lineContrast.set=function(e){this.uniforms.lineContrast=e},r.lineContrast.get=function(){return this.uniforms.lineContrast},r.verticalLine.set=function(e){this.uniforms.verticalLine=e},r.verticalLine.get=function(){return this.uniforms.verticalLine},r.noise.set=function(e){this.uniforms.noise=e},r.noise.get=function(){return this.uniforms.noise},r.noiseSize.set=function(e){this.uniforms.noiseSize=e},r.noiseSize.get=function(){return this.uniforms.noiseSize},r.vignetting.set=function(e){this.uniforms.vignetting=e},r.vignetting.get=function(){return this.uniforms.vignetting},r.vignettingAlpha.set=function(e){this.uniforms.vignettingAlpha=e},r.vignettingAlpha.get=function(){return this.uniforms.vignettingAlpha},r.vignettingBlur.set=function(e){this.uniforms.vignettingBlur=e},r.vignettingBlur.get=function(){return this.uniforms.vignettingBlur},Object.defineProperties(e.prototype,r),e}(h.Filter),x=function(r){function e(e,t){void 0===e&&(e=1),void 0===t&&(t=5),r.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 filterArea;\nuniform sampler2D uSampler;\n\nuniform float angle;\nuniform float scale;\n\nfloat pattern()\n{\n float s = sin(angle), c = cos(angle);\n vec2 tex = vTextureCoord * filterArea.xy;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float average = (color.r + color.g + color.b) / 3.0;\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n}\n"),this.scale=e,this.angle=t}r&&(e.__proto__=r),(e.prototype=Object.create(r&&r.prototype)).constructor=e;var t={scale:{configurable:!0},angle:{configurable:!0}};return t.scale.get=function(){return this.uniforms.scale},t.scale.set=function(e){this.uniforms.scale=e},t.angle.get=function(){return this.uniforms.angle},t.angle.set=function(e){this.uniforms.angle=e},Object.defineProperties(e.prototype,t),e}(h.Filter),w=function(f){function e(e){e&&e.constructor!==Object&&(console.warn("DropShadowFilter now uses options instead of (rotation, distance, blur, color, alpha)"),e={rotation:e},void 0!==arguments[1]&&(e.distance=arguments[1]),void 0!==arguments[2]&&(e.blur=arguments[2]),void 0!==arguments[3]&&(e.color=arguments[3]),void 0!==arguments[4]&&(e.alpha=arguments[4])),e=Object.assign({rotation:45,distance:5,color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:h.settings.RESOLUTION},e),f.call(this);var t=e.kernels,r=e.blur,n=e.quality,i=e.pixelSize,o=e.resolution;this._tintFilter=new h.Filter("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float alpha;\nuniform vec3 color;\nvoid main(void){\n vec4 sample = texture2D(uSampler, vTextureCoord);\n\n // Un-premultiply alpha before applying the color\n if (sample.a > 0.0) {\n sample.rgb /= sample.a;\n }\n\n // Premultiply alpha again\n sample.rgb = color.rgb * sample.a;\n\n // alpha user alpha\n sample *= alpha;\n\n gl_FragColor = sample;\n}"),this._tintFilter.uniforms.color=new Float32Array(4),this._tintFilter.resolution=o,this._blurFilter=t?new d(t):new d(r,n),this.pixelSize=i,this.resolution=o,this.targetTransform=new h.Matrix;var a=e.shadowOnly,s=e.rotation,u=e.distance,l=e.alpha,c=e.color;this.shadowOnly=a,this.rotation=s,this.distance=u,this.alpha=l,this.color=c,this._updatePadding()}f&&(e.__proto__=f);var t={resolution:{configurable:!0},distance:{configurable:!0},rotation:{configurable:!0},alpha:{configurable:!0},color:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return((e.prototype=Object.create(f&&f.prototype)).constructor=e).prototype.apply=function(e,t,r,n){var i=e.getRenderTarget();i.transform=this.targetTransform,this._tintFilter.apply(e,t,i,!0),i.transform=null,this._blurFilter.apply(e,i,r,n),!0!==this.shadowOnly&&e.applyFilter(this,t,r,!1),e.returnRenderTarget(i)},e.prototype._updatePadding=function(){this.padding=this.distance+2*this.blur},e.prototype._updateTargetTransform=function(){this.targetTransform.tx=this.distance*Math.cos(this.angle),this.targetTransform.ty=this.distance*Math.sin(this.angle)},t.resolution.get=function(){return this._resolution},t.resolution.set=function(e){this._resolution=e,this._tintFilter&&(this._tintFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},t.distance.get=function(){return this._distance},t.distance.set=function(e){this._distance=e,this._updatePadding(),this._updateTargetTransform()},t.rotation.get=function(){return this.angle/h.DEG_TO_RAD},t.rotation.set=function(e){this.angle=e*h.DEG_TO_RAD,this._updateTargetTransform()},t.alpha.get=function(){return this._tintFilter.uniforms.alpha},t.alpha.set=function(e){this._tintFilter.uniforms.alpha=e},t.color.get=function(){return h.utils.rgb2hex(this._tintFilter.uniforms.color)},t.color.set=function(e){h.utils.hex2rgb(e,this._tintFilter.uniforms.color)},t.kernels.get=function(){return this._blurFilter.kernels},t.kernels.set=function(e){this._blurFilter.kernels=e},t.blur.get=function(){return this._blurFilter.blur},t.blur.set=function(e){this._blurFilter.blur=e,this._updatePadding()},t.quality.get=function(){return this._blurFilter.quality},t.quality.set=function(e){this._blurFilter.quality=e},t.pixelSize.get=function(){return this._blurFilter.pixelSize},t.pixelSize.set=function(e){this._blurFilter.pixelSize=e},Object.defineProperties(e.prototype,t),e}(h.Filter),T=function(t){function e(e){void 0===e&&(e=5),t.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float strength;\nuniform vec4 filterArea;\n\n\nvoid main(void)\n{\n\tvec2 onePixel = vec2(1.0 / filterArea);\n\n\tvec4 color;\n\n\tcolor.rgb = vec3(0.5);\n\n\tcolor -= texture2D(uSampler, vTextureCoord - onePixel) * strength;\n\tcolor += texture2D(uSampler, vTextureCoord + onePixel) * strength;\n\n\tcolor.rgb = vec3((color.r + color.g + color.b) / 3.0);\n\n\tfloat alpha = texture2D(uSampler, vTextureCoord).a;\n\n\tgl_FragColor = vec4(color.rgb * alpha, alpha);\n}\n"),this.strength=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={strength:{configurable:!0}};return r.strength.get=function(){return this.uniforms.strength},r.strength.set=function(e){this.uniforms.strength=e},Object.defineProperties(e.prototype,r),e}(h.Filter),S=function(t){function e(e){void 0===e&&(e={}),t.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","// precision highp float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\nuniform float aspect;\n\nuniform sampler2D displacementMap;\nuniform float offset;\nuniform float sinDir;\nuniform float cosDir;\nuniform int fillMode;\n\nuniform float seed;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nconst int TRANSPARENT = 0;\nconst int ORIGINAL = 1;\nconst int LOOP = 2;\nconst int CLAMP = 3;\nconst int MIRROR = 4;\n\nvoid main(void)\n{\n vec2 coord = (vTextureCoord * filterArea.xy) / dimensions;\n\n if (coord.x > 1.0 || coord.y > 1.0) {\n return;\n }\n\n float cx = coord.x - 0.5;\n float cy = (coord.y - 0.5) * aspect;\n float ny = (-sinDir * cx + cosDir * cy) / aspect + 0.5;\n\n // displacementMap: repeat\n // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny);\n\n // displacementMap: mirror\n ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny);\n\n vec4 dc = texture2D(displacementMap, vec2(0.5, ny));\n\n float displacement = (dc.r - dc.g) * (offset / filterArea.x);\n\n coord = vTextureCoord + vec2(cosDir * displacement, sinDir * displacement * aspect);\n\n if (fillMode == CLAMP) {\n coord = clamp(coord, filterClamp.xy, filterClamp.zw);\n } else {\n if( coord.x > filterClamp.z ) {\n if (fillMode == ORIGINAL) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n } else if (fillMode == LOOP) {\n coord.x -= filterClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x = filterClamp.z * 2.0 - coord.x;\n } else {\n gl_FragColor = vec4(0., 0., 0., 0.);\n return;\n }\n } else if( coord.x < filterClamp.x ) {\n if (fillMode == ORIGINAL) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n } else if (fillMode == LOOP) {\n coord.x += filterClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x *= -filterClamp.z;\n } else {\n gl_FragColor = vec4(0., 0., 0., 0.);\n return;\n }\n }\n\n if( coord.y > filterClamp.w ) {\n if (fillMode == ORIGINAL) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n } else if (fillMode == LOOP) {\n coord.y -= filterClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y = filterClamp.w * 2.0 - coord.y;\n } else {\n gl_FragColor = vec4(0., 0., 0., 0.);\n return;\n }\n } else if( coord.y < filterClamp.y ) {\n if (fillMode == ORIGINAL) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n } else if (fillMode == LOOP) {\n coord.y += filterClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y *= -filterClamp.w;\n } else {\n gl_FragColor = vec4(0., 0., 0., 0.);\n return;\n }\n }\n }\n\n gl_FragColor.r = texture2D(uSampler, coord + red * (1.0 - seed * 0.4) / filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, coord + green * (1.0 - seed * 0.3) / filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, coord + blue * (1.0 - seed * 0.2) / filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, coord).a;\n}\n"),this.uniforms.dimensions=new Float32Array(2),e=Object.assign({slices:5,offset:100,direction:0,fillMode:0,average:!1,seed:0,red:[0,0],green:[0,0],blue:[0,0],minSize:8,sampleSize:512},e),this.direction=e.direction,this.red=e.red,this.green=e.green,this.blue=e.blue,this.offset=e.offset,this.fillMode=e.fillMode,this.average=e.average,this.seed=e.seed,this.minSize=e.minSize,this.sampleSize=e.sampleSize,this._canvas=document.createElement("canvas"),this._canvas.width=4,this._canvas.height=this.sampleSize,this.texture=h.Texture.fromCanvas(this._canvas,h.SCALE_MODES.NEAREST),this._slices=0,this.slices=e.slices}t&&(e.__proto__=t);var r={sizes:{configurable:!0},offsets:{configurable:!0},slices:{configurable:!0},direction:{configurable:!0},red:{configurable:!0},green:{configurable:!0},blue:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,n){var i=t.sourceFrame.width,o=t.sourceFrame.height;this.uniforms.dimensions[0]=i,this.uniforms.dimensions[1]=o,this.uniforms.aspect=o/i,this.uniforms.seed=this.seed,this.uniforms.offset=this.offset,this.uniforms.fillMode=this.fillMode,e.applyFilter(this,t,r,n)},e.prototype._randomizeSizes=function(){var e=this._sizes,t=this._slices-1,r=this.sampleSize,n=Math.min(this.minSize/r,.9/this._slices);if(this.average){for(var i=this._slices,o=1,a=0;a>0,n=e[t];e[t]=e[r],e[r]=n}},e.prototype._randomizeOffsets=function(){for(var e=0;e>0,t,1+a>>0),i+=a}r.baseTexture.update(),this.uniforms.displacementMap=r},r.sizes.set=function(e){for(var t=Math.min(this._slices,e.length),r=0;rthis._maxColors)throw"Length of replacements ("+n+") exceeds the maximum colors length ("+this._maxColors+")";t[3*n]=-1;for(var i=0;i 0.5) then: 1 - 2 * (1 - dst) * (1 - src)\n return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)),\n (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)),\n (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z)));\n}\n\n\nvoid main()\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 color = gl_FragColor.rgb;\n\n if (sepia > 0.0)\n {\n float gray = (color.x + color.y + color.z) / 3.0;\n vec3 grayscale = vec3(gray);\n\n color = Overlay(SEPIA_RGB, grayscale);\n\n color = grayscale + sepia * (color - grayscale);\n }\n\n vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy;\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n vec2 dir = vec2(vec2(0.5, 0.5) - coord);\n dir.y *= dimensions.y / dimensions.x;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n color.rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n if (scratchDensity > seed && scratch != 0.0)\n {\n float phase = seed * 256.0;\n float s = mod(floor(phase), 2.0);\n float dist = 1.0 / scratchDensity;\n float d = distance(coord, vec2(seed * dist, abs(s - seed * dist)));\n if (d < seed * 0.6 + 0.4)\n {\n highp float period = scratchDensity * 10.0;\n\n float xx = coord.x * period + phase;\n float aa = abs(mod(xx, 0.5) * 4.0);\n float bb = mod(floor(xx / 0.5), 2.0);\n float yy = (1.0 - bb) * aa + bb * (2.0 - aa);\n\n float kk = 2.0 * period;\n float dw = scratchWidth / dimensions.x * (0.75 + seed);\n float dh = dw * kk;\n\n float tine = (yy - (2.0 - dh));\n\n if (tine > 0.0) {\n float _sign = sign(scratch);\n\n tine = s * tine / period + scratch + 0.1;\n tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5);\n\n color.rgb *= tine;\n }\n }\n }\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + seed * 512.0, 1024.0 - seed * 512.0);\n // float _noise = snoise(d) * 0.5;\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n color += _noise * noise;\n }\n\n gl_FragColor.rgb = color;\n}\n"),this.uniforms.dimensions=new Float32Array(2),"number"==typeof e?(this.seed=e,e=null):this.seed=t,Object.assign(this,{sepia:.3,noise:.3,noiseSize:1,scratch:.5,scratchDensity:.3,scratchWidth:1,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3},e)}r&&(e.__proto__=r);var t={sepia:{configurable:!0},noise:{configurable:!0},noiseSize:{configurable:!0},scratch:{configurable:!0},scratchDensity:{configurable:!0},scratchWidth:{configurable:!0},vignetting:{configurable:!0},vignettingAlpha:{configurable:!0},vignettingBlur:{configurable:!0}};return((e.prototype=Object.create(r&&r.prototype)).constructor=e).prototype.apply=function(e,t,r,n){this.uniforms.dimensions[0]=t.sourceFrame.width,this.uniforms.dimensions[1]=t.sourceFrame.height,this.uniforms.seed=this.seed,e.applyFilter(this,t,r,n)},t.sepia.set=function(e){this.uniforms.sepia=e},t.sepia.get=function(){return this.uniforms.sepia},t.noise.set=function(e){this.uniforms.noise=e},t.noise.get=function(){return this.uniforms.noise},t.noiseSize.set=function(e){this.uniforms.noiseSize=e},t.noiseSize.get=function(){return this.uniforms.noiseSize},t.scratch.set=function(e){this.uniforms.scratch=e},t.scratch.get=function(){return this.uniforms.scratch},t.scratchDensity.set=function(e){this.uniforms.scratchDensity=e},t.scratchDensity.get=function(){return this.uniforms.scratchDensity},t.scratchWidth.set=function(e){this.uniforms.scratchWidth=e},t.scratchWidth.get=function(){return this.uniforms.scratchWidth},t.vignetting.set=function(e){this.uniforms.vignetting=e},t.vignetting.get=function(){return this.uniforms.vignetting},t.vignettingAlpha.set=function(e){this.uniforms.vignettingAlpha=e},t.vignettingAlpha.get=function(){return this.uniforms.vignettingAlpha},t.vignettingBlur.set=function(e){this.uniforms.vignettingBlur=e},t.vignettingBlur.get=function(){return this.uniforms.vignettingBlur},Object.defineProperties(e.prototype,t),e}(h.Filter),A=function(o){function a(e,t,r){void 0===e&&(e=1),void 0===t&&(t=0),void 0===r&&(r=.1);var n=Math.max(r*a.MAX_SAMPLES,a.MIN_SAMPLES),i=(2*Math.PI/n).toFixed(7);o.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 thickness;\nuniform vec4 outlineColor;\nuniform vec4 filterClamp;\n\nconst float DOUBLE_PI = 3.14159265358979323846264 * 2.;\n\nvoid main(void) {\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float maxAlpha = 0.;\n vec2 displaced;\n for (float angle = 0.; angle <= DOUBLE_PI; angle += ${angleStep}) {\n displaced.x = vTextureCoord.x + thickness.x * cos(angle);\n displaced.y = vTextureCoord.y + thickness.y * sin(angle);\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n maxAlpha = max(maxAlpha, curColor.a);\n }\n float resultAlpha = max(maxAlpha, ownColor.a);\n gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha);\n}\n".replace(/\$\{angleStep\}/,i)),this.uniforms.thickness=new Float32Array([0,0]),this.thickness=e,this.uniforms.outlineColor=new Float32Array([0,0,0,1]),this.color=t,this.quality=r}o&&(a.__proto__=o);var e={color:{configurable:!0}};return((a.prototype=Object.create(o&&o.prototype)).constructor=a).prototype.apply=function(e,t,r,n){this.uniforms.thickness[0]=this.thickness/t.size.width,this.uniforms.thickness[1]=this.thickness/t.size.height,e.applyFilter(this,t,r,n)},e.color.get=function(){return h.utils.rgb2hex(this.uniforms.outlineColor)},e.color.set=function(e){h.utils.hex2rgb(e,this.uniforms.outlineColor)},Object.defineProperties(a.prototype,e),a}(h.Filter);A.MIN_SAMPLES=1,A.MAX_SAMPLES=100;var O=function(t){function e(e){void 0===e&&(e=10),t.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform vec2 size;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n\treturn floor( coord / size ) * size;\n}\n\nvoid main(void)\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = pixelate(coord, size);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord);\n}\n"),this.size=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={size:{configurable:!0}};return r.size.get=function(){return this.uniforms.size},r.size.set=function(e){"number"==typeof e&&(e=[e,e]),this.uniforms.size=e},Object.defineProperties(e.prototype,r),e}(h.Filter),R=function(i){function e(e,t,r,n){void 0===e&&(e=0),void 0===t&&(t=[0,0]),void 0===r&&(r=5),void 0===n&&(n=-1),i.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float uRadian;\nuniform vec2 uCenter;\nuniform float uRadius;\nuniform int uKernelSize;\n\nconst int MAX_KERNEL_SIZE = 2048;\n\nvoid main(void)\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n if (uKernelSize == 0)\n {\n gl_FragColor = color;\n return;\n }\n\n float aspect = filterArea.y / filterArea.x;\n vec2 center = uCenter.xy / filterArea.xy;\n float gradient = uRadius / filterArea.x * 0.3;\n float radius = uRadius / filterArea.x - gradient * 0.5;\n int k = uKernelSize - 1;\n\n vec2 coord = vTextureCoord;\n vec2 dir = vec2(center - coord);\n float dist = length(vec2(dir.x, dir.y * aspect));\n\n float radianStep = uRadian;\n if (radius >= 0.0 && dist > radius) {\n float delta = dist - radius;\n float gap = gradient;\n float scale = 1.0 - abs(delta / gap);\n if (scale <= 0.0) {\n gl_FragColor = color;\n return;\n }\n radianStep *= scale;\n }\n radianStep /= float(k);\n\n float s = sin(radianStep);\n float c = cos(radianStep);\n mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c));\n\n for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n if (i == k) {\n break;\n }\n\n coord -= center;\n coord.y *= aspect;\n coord = rotationMatrix * coord;\n coord.y /= aspect;\n coord += center;\n\n vec4 sample = texture2D(uSampler, coord);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample;\n }\n\n gl_FragColor = color / float(uKernelSize);\n}\n"),this._angle=0,this.angle=e,this.center=t,this.kernelSize=r,this.radius=n}i&&(e.__proto__=i);var t={angle:{configurable:!0},center:{configurable:!0},radius:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,n){this.uniforms.uKernelSize=0!==this._angle?this.kernelSize:0,e.applyFilter(this,t,r,n)},t.angle.set=function(e){this._angle=e,this.uniforms.uRadian=e*Math.PI/180},t.angle.get=function(){return this._angle},t.center.get=function(){return this.uniforms.uCenter},t.center.set=function(e){this.uniforms.uCenter=e},t.radius.get=function(){return this.uniforms.uRadius},t.radius.set=function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},Object.defineProperties(e.prototype,t),e}(h.Filter),I=function(t){function e(e){t.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nuniform bool mirror;\nuniform float boundary;\nuniform vec2 amplitude;\nuniform vec2 waveLength;\nuniform vec2 alpha;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 coord = pixelCoord / dimensions;\n\n if (coord.y < boundary) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n float k = (coord.y - boundary) / (1. - boundary + 0.0001);\n float areaY = boundary * dimensions.y / filterArea.y;\n float v = areaY + areaY - vTextureCoord.y;\n float y = mirror ? v : vTextureCoord.y;\n\n float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x;\n float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y;\n float _alpha = (alpha.y - alpha.x) * k + alpha.x;\n\n float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude;\n x = clamp(x, filterClamp.x, filterClamp.z);\n\n vec4 color = texture2D(uSampler, vec2(x, y));\n\n gl_FragColor = color * _alpha;\n}\n"),this.uniforms.amplitude=new Float32Array(2),this.uniforms.waveLength=new Float32Array(2),this.uniforms.alpha=new Float32Array(2),this.uniforms.dimensions=new Float32Array(2),Object.assign(this,{mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0},e)}t&&(e.__proto__=t);var r={mirror:{configurable:!0},boundary:{configurable:!0},amplitude:{configurable:!0},waveLength:{configurable:!0},alpha:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,n){this.uniforms.dimensions[0]=t.sourceFrame.width,this.uniforms.dimensions[1]=t.sourceFrame.height,this.uniforms.time=this.time,e.applyFilter(this,t,r,n)},r.mirror.set=function(e){this.uniforms.mirror=e},r.mirror.get=function(){return this.uniforms.mirror},r.boundary.set=function(e){this.uniforms.boundary=e},r.boundary.get=function(){return this.uniforms.boundary},r.amplitude.set=function(e){this.uniforms.amplitude[0]=e[0],this.uniforms.amplitude[1]=e[1]},r.amplitude.get=function(){return this.uniforms.amplitude},r.waveLength.set=function(e){this.uniforms.waveLength[0]=e[0],this.uniforms.waveLength[1]=e[1]},r.waveLength.get=function(){return this.uniforms.waveLength},r.alpha.set=function(e){this.uniforms.alpha[0]=e[0],this.uniforms.alpha[1]=e[1]},r.alpha.get=function(){return this.uniforms.alpha},Object.defineProperties(e.prototype,r),e}(h.Filter),D=function(n){function e(e,t,r){void 0===e&&(e=[-10,0]),void 0===t&&(t=[0,10]),void 0===r&&(r=[0,0]),n.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nvoid main(void)\n{\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\n}\n"),this.red=e,this.green=t,this.blue=r}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={red:{configurable:!0},green:{configurable:!0},blue:{configurable:!0}};return t.red.get=function(){return this.uniforms.red},t.red.set=function(e){this.uniforms.red=e},t.green.get=function(){return this.uniforms.green},t.green.set=function(e){this.uniforms.green=e},t.blue.get=function(){return this.uniforms.blue},t.blue.set=function(e){this.uniforms.blue=e},Object.defineProperties(e.prototype,t),e}(h.Filter),L=function(n){function e(e,t,r){void 0===e&&(e=[0,0]),void 0===t&&(t={}),void 0===r&&(r=0),n.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\n\nuniform vec2 center;\n\nuniform float amplitude;\nuniform float wavelength;\n// uniform float power;\nuniform float brightness;\nuniform float speed;\nuniform float radius;\n\nuniform float time;\n\nconst float PI = 3.14159;\n\nvoid main()\n{\n float halfWavelength = wavelength * 0.5 / filterArea.x;\n float maxRadius = radius / filterArea.x;\n float currentRadius = time * speed / filterArea.x;\n\n float fade = 1.0;\n\n if (maxRadius > 0.0) {\n if (currentRadius > maxRadius) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\n }\n\n vec2 dir = vec2(vTextureCoord - center / filterArea.xy);\n dir.y *= filterArea.y / filterArea.x;\n float dist = length(dir);\n\n if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n vec2 diffUV = normalize(dir);\n\n float diff = (dist - currentRadius) / halfWavelength;\n\n float p = 1.0 - pow(abs(diff), 2.0);\n\n // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade );\n float powDiff = 1.25 * sin(diff * PI) * p * ( amplitude * fade );\n\n vec2 offset = diffUV * powDiff / filterArea.xy;\n\n // Do clamp :\n vec2 coord = vTextureCoord + offset;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n vec4 color = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n // No clamp :\n // gl_FragColor = texture2D(uSampler, vTextureCoord + offset);\n\n color.rgb *= 1.0 + (brightness - 1.0) * p * fade;\n\n gl_FragColor = color;\n}\n"),this.center=e,Array.isArray(t)&&(console.warn("Deprecated Warning: ShockwaveFilter params Array has been changed to options Object."),t={}),t=Object.assign({amplitude:30,wavelength:160,brightness:1,speed:500,radius:-1},t),this.amplitude=t.amplitude,this.wavelength=t.wavelength,this.brightness=t.brightness,this.speed=t.speed,this.radius=t.radius,this.time=r}n&&(e.__proto__=n);var t={center:{configurable:!0},amplitude:{configurable:!0},wavelength:{configurable:!0},brightness:{configurable:!0},speed:{configurable:!0},radius:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.apply=function(e,t,r,n){this.uniforms.time=this.time,e.applyFilter(this,t,r,n)},t.center.get=function(){return this.uniforms.center},t.center.set=function(e){this.uniforms.center=e},t.amplitude.get=function(){return this.uniforms.amplitude},t.amplitude.set=function(e){this.uniforms.amplitude=e},t.wavelength.get=function(){return this.uniforms.wavelength},t.wavelength.set=function(e){this.uniforms.wavelength=e},t.brightness.get=function(){return this.uniforms.brightness},t.brightness.set=function(e){this.uniforms.brightness=e},t.speed.get=function(){return this.uniforms.speed},t.speed.set=function(e){this.uniforms.speed=e},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(e){this.uniforms.radius=e},Object.defineProperties(e.prototype,t),e}(h.Filter),N=function(n){function e(e,t,r){void 0===t&&(t=0),void 0===r&&(r=1),n.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D uLightmap;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\nuniform vec4 ambientColor;\nvoid main() {\n vec4 diffuseColor = texture2D(uSampler, vTextureCoord);\n vec2 lightCoord = (vTextureCoord * filterArea.xy) / dimensions;\n vec4 light = texture2D(uLightmap, lightCoord);\n vec3 ambient = ambientColor.rgb * ambientColor.a;\n vec3 intensity = ambient + light.rgb;\n vec3 finalColor = diffuseColor.rgb * intensity;\n gl_FragColor = vec4(finalColor, diffuseColor.a);\n}\n"),this.uniforms.dimensions=new Float32Array(2),this.uniforms.ambientColor=new Float32Array([0,0,0,r]),this.texture=e,this.color=t}n&&(e.__proto__=n);var t={texture:{configurable:!0},color:{configurable:!0},alpha:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.apply=function(e,t,r,n){this.uniforms.dimensions[0]=t.sourceFrame.width,this.uniforms.dimensions[1]=t.sourceFrame.height,e.applyFilter(this,t,r,n)},t.texture.get=function(){return this.uniforms.uLightmap},t.texture.set=function(e){this.uniforms.uLightmap=e},t.color.set=function(e){var t=this.uniforms.ambientColor;"number"==typeof e?(h.utils.hex2rgb(e,t),this._color=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],this._color=h.utils.rgb2hex(t))},t.color.get=function(){return this._color},t.alpha.get=function(){return this.uniforms.ambientColor[3]},t.alpha.set=function(e){this.uniforms.ambientColor[3]=e},Object.defineProperties(e.prototype,t),e}(h.Filter),j=function(i){function e(e,t,r,n){void 0===e&&(e=100),void 0===t&&(t=600),void 0===r&&(r=null),void 0===n&&(n=null),i.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\n\nfloat random(vec3 scale, float seed)\n{\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\n\n for (float t = -30.0; t <= 30.0; t++)\n {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n color /= total;\n color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n"),this.uniforms.blur=e,this.uniforms.gradientBlur=t,this.uniforms.start=r||new h.Point(0,window.innerHeight/2),this.uniforms.end=n||new h.Point(600,window.innerHeight/2),this.uniforms.delta=new h.Point(30,30),this.uniforms.texSize=new h.Point(window.innerWidth,window.innerHeight),this.updateDelta()}i&&(e.__proto__=i);var t={blur:{configurable:!0},gradientBlur:{configurable:!0},start:{configurable:!0},end:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.updateDelta=function(){this.uniforms.delta.x=0,this.uniforms.delta.y=0},t.blur.get=function(){return this.uniforms.blur},t.blur.set=function(e){this.uniforms.blur=e},t.gradientBlur.get=function(){return this.uniforms.gradientBlur},t.gradientBlur.set=function(e){this.uniforms.gradientBlur=e},t.start.get=function(){return this.uniforms.start},t.start.set=function(e){this.uniforms.start=e,this.updateDelta()},t.end.get=function(){return this.uniforms.end},t.end.set=function(e){this.uniforms.end=e,this.updateDelta()},Object.defineProperties(e.prototype,t),e}(h.Filter),F=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.updateDelta=function(){var e=this.uniforms.end.x-this.uniforms.start.x,t=this.uniforms.end.y-this.uniforms.start.y,r=Math.sqrt(e*e+t*t);this.uniforms.delta.x=e/r,this.uniforms.delta.y=t/r},t}(j),B=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.updateDelta=function(){var e=this.uniforms.end.x-this.uniforms.start.x,t=this.uniforms.end.y-this.uniforms.start.y,r=Math.sqrt(e*e+t*t);this.uniforms.delta.x=-t/r,this.uniforms.delta.y=e/r},t}(j),z=function(i){function e(e,t,r,n){void 0===e&&(e=100),void 0===t&&(t=600),void 0===r&&(r=null),void 0===n&&(n=null),i.call(this),this.tiltShiftXFilter=new F(e,t,r,n),this.tiltShiftYFilter=new B(e,t,r,n)}i&&(e.__proto__=i);var t={blur:{configurable:!0},gradientBlur:{configurable:!0},start:{configurable:!0},end:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r){var n=e.getRenderTarget(!0);this.tiltShiftXFilter.apply(e,t,n),this.tiltShiftYFilter.apply(e,n,r),e.returnRenderTarget(n)},t.blur.get=function(){return this.tiltShiftXFilter.blur},t.blur.set=function(e){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=e},t.gradientBlur.get=function(){return this.tiltShiftXFilter.gradientBlur},t.gradientBlur.set=function(e){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=e},t.start.get=function(){return this.tiltShiftXFilter.start},t.start.set=function(e){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=e},t.end.get=function(){return this.tiltShiftXFilter.end},t.end.set=function(e){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=e},Object.defineProperties(e.prototype,t),e}(h.Filter),U=function(n){function e(e,t,r){void 0===e&&(e=200),void 0===t&&(t=4),void 0===r&&(r=20),n.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 twist(vec2 coord)\n{\n coord -= offset;\n\n float dist = length(coord);\n\n if (dist < radius)\n {\n float ratioDist = (radius - dist) / radius;\n float angleMod = ratioDist * ratioDist * angle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n\n coord += offset;\n\n return coord;\n}\n\nvoid main(void)\n{\n\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = twist(coord);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord );\n\n}\n"),this.radius=e,this.angle=t,this.padding=r}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={offset:{configurable:!0},radius:{configurable:!0},angle:{configurable:!0}};return t.offset.get=function(){return this.uniforms.offset},t.offset.set=function(e){this.uniforms.offset=e},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(e){this.uniforms.radius=e},t.angle.get=function(){return this.uniforms.angle},t.angle.set=function(e){this.uniforms.angle=e},Object.defineProperties(e.prototype,t),e}(h.Filter),X=function(i){function e(e,t,r,n){void 0===e&&(e=.1),void 0===t&&(t=[0,0]),void 0===r&&(r=0),void 0===n&&(n=-1),i.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\nconst float MAX_KERNEL_SIZE = 32.0;\n\n// author: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand(vec2 co, float seed) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot(co + seed, vec2(a, b)), sn = mod(dt, 3.14159);\n return fract(sin(sn) * c + seed);\n}\n\nvoid main() {\n\n float minGradient = uInnerRadius * 0.3;\n float innerRadius = (uInnerRadius + minGradient * 0.5) / filterArea.x;\n\n float gradient = uRadius * 0.3;\n float radius = (uRadius - gradient * 0.5) / filterArea.x;\n\n float countLimit = MAX_KERNEL_SIZE;\n\n vec2 dir = vec2(uCenter.xy / filterArea.xy - vTextureCoord);\n float dist = length(vec2(dir.x, dir.y * filterArea.y / filterArea.x));\n\n float strength = uStrength;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (radius >= 0.0 && dist > radius) { // radius < 0 means it's infinity\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / filterArea.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n }\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = rand(vTextureCoord, 0.0);\n\n float total = 0.0;\n vec4 color = vec4(0.0);\n\n dir *= strength;\n\n for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) {\n float percent = (t + offset) / MAX_KERNEL_SIZE;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture2D(uSampler, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n color /= total;\n // switch back from pre-multiplied alpha\n // color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n"),this.center=t,this.strength=e,this.innerRadius=r,this.radius=n}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={center:{configurable:!0},strength:{configurable:!0},innerRadius:{configurable:!0},radius:{configurable:!0}};return t.center.get=function(){return this.uniforms.uCenter},t.center.set=function(e){this.uniforms.uCenter=e},t.strength.get=function(){return this.uniforms.uStrength},t.strength.set=function(e){this.uniforms.uStrength=e},t.innerRadius.get=function(){return this.uniforms.uInnerRadius},t.innerRadius.set=function(e){this.uniforms.uInnerRadius=e},t.radius.get=function(){return this.uniforms.uRadius},t.radius.set=function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},Object.defineProperties(e.prototype,t),e}(h.Filter);return e.AdjustmentFilter=t,e.AdvancedBloomFilter=n,e.AsciiFilter=i,e.BevelFilter=o,e.BloomFilter=p,e.BulgePinchFilter=g,e.ColorMapFilter=m,e.ColorReplaceFilter=v,e.ConvolutionFilter=_,e.CrossHatchFilter=y,e.CRTFilter=b,e.DotFilter=x,e.DropShadowFilter=w,e.EmbossFilter=T,e.GlitchFilter=S,e.GlowFilter=M,e.GodrayFilter=P,e.KawaseBlurFilter=d,e.MotionBlurFilter=C,e.MultiColorReplaceFilter=k,e.OldFilmFilter=E,e.OutlineFilter=A,e.PixelateFilter=O,e.RadialBlurFilter=R,e.ReflectionFilter=I,e.RGBSplitFilter=D,e.ShockwaveFilter=L,e.SimpleLightmapFilter=N,e.TiltShiftFilter=z,e.TiltShiftAxisFilter=j,e.TiltShiftXFilter=F,e.TiltShiftYFilter=B,e.TwistFilter=U,e.ZoomBlurFilter=X,e}({},PIXI),pixi_projection,pixi_projection;Object.assign(PIXI.filters,this?this.__filters:__filters),function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).pixiParticles=e()}}(function(){return function o(a,s,u){function l(r,e){if(!s[r]){if(!a[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(c)return c(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var i=s[r]={exports:{}};a[r][0].call(i.exports,function(e){var t=a[r][1][e];return l(t||e)},i,i.exports,o,a,s,u)}return s[r].exports}for(var c="function"==typeof require&&require,e=0;ethis.duration&&(this.loop?this.elapsed=this.elapsed%this.duration:this.elapsed=this.duration-1e-6);var r=this.elapsed*this.framerate+1e-7|0;this.texture=this.textures[r]||PIXI.Texture.EMPTY}return t},e.prototype.destroy=function(){this.Particle_destroy(),this.textures=null},e.parseArt=function(e){for(var t,r,n,i,o,a=[],s=0;s=this.maxParticles)this._spawnTimer+=this._frequency;else{var u=void 0;if(u=this.minLifetime==this.maxLifetime?this.minLifetime:Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer=this.spawnChance)){var d=void 0;if(this._poolFirst?(d=this._poolFirst,this._poolFirst=this._poolFirst.next,d.next=null):d=new this.particleConstructor(this),1=this.maxLife||this.age<0)return this.kill(),-1;var t=this.age*this._oneOverLife;if(this.ease&&(t=4==this.ease.length?this.ease(t,0,1,1):this.ease(t)),this._doAlpha&&(this.alpha=this.alphaList.interpolate(t)),this._doScale){var r=this.scaleList.interpolate(t)*this.scaleMultiplier;this.scale.x=this.scale.y=r}if(this._doNormalMovement){if(this._doSpeed){var n=this.speedList.interpolate(t)*this.speedMultiplier;o.default.normalize(this.velocity),o.default.scaleBy(this.velocity,n)}else if(this._doAcceleration&&(this.velocity.x+=this.acceleration.x*e,this.velocity.y+=this.acceleration.y*e,this.maxSpeed)){var i=o.default.length(this.velocity);i>this.maxSpeed&&o.default.scaleBy(this.velocity,this.maxSpeed/i)}this.position.x+=this.velocity.x*e,this.position.y+=this.velocity.y*e}return this._doColor&&(this.tint=this.colorList.interpolate(t)),0!==this.rotationSpeed?this.rotation+=this.rotationSpeed*e:this.acceleration&&!this.noRotation&&(this.rotation=Math.atan2(this.velocity.y,this.velocity.x)),t},n.prototype.kill=function(){this.emitter.recycle(this)},n.prototype.destroy=function(){this.parent&&this.parent.removeChild(this),this.Sprite_destroy(),this.emitter=this.velocity=this.colorList=this.scaleList=this.alphaList=this.speedList=this.ease=this.next=this.prev=null},n.parseArt=function(e){var t;for(t=e.length;0<=t;--t)"string"==typeof e[t]&&(e[t]=PIXI.Texture.fromImage(e[t]));if(o.default.verbose)for(t=e.length-1;0a.time;)i=a,a=e[++o];u=(u-i.time)/(a.time-i.time);var l=d.hexToRGB(i.value),c=d.hexToRGB(a.value),f={};f.r=(c.r-l.r)*u+l.r,f.g=(c.g-l.g)*u+l.g,f.b=(c.b-l.b)*u+l.b,n.next=new h.default(f,s/t),n=n.next}return r}};r.default=d},{"./PropertyNode":7}],5:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("./ParticleUtils"),a=e("./Particle"),s=new PIXI.Point,u=["pow","sqrt","abs","floor","round","ceil","E","PI","sin","cos","tan","asin","acos","atan","atan2","log"],l=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(u).join("|"),"g"),c=function(r){function e(e){var t=r.call(this,e)||this;return t.path=null,t.initialRotation=0,t.initialPosition=new PIXI.Point,t.movement=0,t}return i(e,r),e.prototype.init=function(){this.initialRotation=this.rotation,this.Particle_init(),this.path=this.extraData.path,this._doNormalMovement=!this.path,this.movement=0,this.initialPosition.x=this.position.x,this.initialPosition.y=this.position.y},e.prototype.update=function(e){var t=this.Particle_update(e);if(0<=t&&this.path){var r=this.speedList.interpolate(t)*this.speedMultiplier;this.movement+=r*e,s.x=this.movement,s.y=this.path(this.movement),o.default.rotatePoint(this.initialRotation,s),this.position.x=this.initialPosition.x+s.x,this.position.y=this.initialPosition.y+s.y}return t},e.prototype.destroy=function(){this.Particle_destroy(),this.path=this.initialPosition=null},e.parseArt=function(e){return a.default.parseArt(e)},e.parseData=function(e){var t={};if(e&&e.path)try{t.path=function(e){for(var t=e.match(l),r=t.length-1;0<=r;--r)0<=u.indexOf(t[r])&&(t[r]="Math."+t[r]);return e=t.join(""),new Function("x","return "+e+";")}(e.path)}catch(e){o.default.verbose&&console.error("PathParticle: error in parsing path expression"),t.path=null}else o.default.verbose&&console.error("PathParticle requires a path string in extraData!"),t.path=null;return t},e}(a.default);r.default=c},{"./Particle":3,"./ParticleUtils":4}],6:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var a=e("./ParticleUtils"),n=function(){function e(e){void 0===e&&(e=!1),this.current=null,this.next=null,this.isColor=!!e,this.interpolate=null,this.ease=null}return e.prototype.reset=function(e){this.current=e,this.next=e.next,this.next&&1<=this.next.time?this.interpolate=this.isColor?o:i:e.isStepped?this.interpolate=this.isColor?c:l:this.interpolate=this.isColor?u:s,this.ease=this.current.ease},e}();function i(e){return this.ease&&(e=this.ease(e)),(this.next.value-this.current.value)*e+this.current.value}function o(e){this.ease&&(e=this.ease(e));var t=this.current.value,r=this.next.value,n=(r.r-t.r)*e+t.r,i=(r.g-t.g)*e+t.g,o=(r.b-t.b)*e+t.b;return a.default.combineRGBComponents(n,i,o)}function s(e){for(this.ease&&(e=this.ease(e));e>this.next.time;)this.current=this.next,this.next=this.next.next;return e=(e-this.current.time)/(this.next.time-this.current.time),(this.next.value-this.current.value)*e+this.current.value}function u(e){for(this.ease&&(e=this.ease(e));e>this.next.time;)this.current=this.next,this.next=this.next.next;e=(e-this.current.time)/(this.next.time-this.current.time);var t=this.current.value,r=this.next.value,n=(r.r-t.r)*e+t.r,i=(r.g-t.g)*e+t.g,o=(r.b-t.b)*e+t.b;return a.default.combineRGBComponents(n,i,o)}function l(e){for(this.ease&&(e=this.ease(e));this.next&&e>this.next.time;)this.current=this.next,this.next=this.next.next;return this.current.value}function c(e){for(this.ease&&(e=this.ease(e));this.next&&e>this.next.time;)this.current=this.next,this.next=this.next.next;var t=this.current.value;return a.default.combineRGBComponents(t.r,t.g,t.b)}r.default=n},{"./ParticleUtils":4}],7:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./ParticleUtils"),i=function(){function a(e,t,r){this.value="string"==typeof e?n.default.hexToRGB(e):e,this.time=t,this.next=null,this.isStepped=!1,this.ease=r?"function"==typeof r?r:n.default.generateEase(r):null}return a.createList=function(e){if(Array.isArray(e.list)){var t=e.list,r=void 0,n=void 0;if(n=r=new a(t[0].value,t[0].time,e.ease),2>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,1+(e|=e>>>16)},t.log2=function(e){var t,r;return t=+(65535>>=t))<<3,t|=r=+(15<(e>>>=r))<<2,(t|=r=+(3<(e>>>=r))<<1)|(e>>>=r)>>1},t.getIntersectionFactor=function(e,t,r,n,i){var o=t.x-e.x,a=r.x-n.x,s=r.x-e.x,u=t.y-e.y,l=r.y-n.y,c=r.y-e.y,f=o*l-u*a;if(Math.abs(f)<1e-7)return i.x=o,i.y=u,0;var h=(s*l-c*a)/f,d=(o*c-u*s)/f;return d<1e-6||-1e-6=this.size&&this.flush(),e._texture._uvs&&e._texture.baseTexture&&(this.sprites[this.currentIndex++]=e)},e.prototype.flush=function(){if(0!==this.currentIndex){var e,t,r,n=this.renderer.gl,i=this.MAX_TEXTURES,o=I.utils.nextPow2(this.currentIndex),a=I.utils.log2(o),s=this.buffers[a],u=this.sprites,l=this.groups,c=s.float32View,f=s.uint32View,h=0,d=null,p=1,g=0,m=l[0],v=O[u[0]._texture.baseTexture.premultipliedAlpha?1:0][u[0].blendMode];for(m.textureCount=0,m.start=0,m.blend=v,R++,r=0;rt[s]&&(n=t[s]),ot[s+1]&&(i=t[s+1]),ah[l]){u=f[s];f[s]=f[l],f[l]=u;var c=h[s];h[s]=h[l],h[l]=c}if(t[0]=f[0].x,t[1]=f[0].y,t[2]=f[1].x,t[3]=f[1].y,t[4]=f[2].x,t[5]=f[2].y,t[6]=f[3].x,t[7]=f[3].y,(f[3].x-f[2].x)*(f[1].y-f[2].y)-(f[1].x-f[2].x)*(f[3].y-f[2].y)<0)return t[4]=f[3].x,void(t[5]=f[3].y)}},e}();e.Surface=t}(pixi_projection||(pixi_projection={})),function(e){var S=new PIXI.Matrix,i=new PIXI.Rectangle,M=new PIXI.Point,t=function(t){function e(){var e=t.call(this)||this;return e.distortion=new PIXI.Point,e}return __extends(e,t),e.prototype.clear=function(){this.distortion.set(0,0)},e.prototype.apply=function(e,t){t=t||new PIXI.Point;var r=this.distortion,n=e.x*e.y;return t.x=e.x+r.x*n,t.y=e.y+r.y*n,t},e.prototype.applyInverse=function(e,t){t=t||new PIXI.Point;var r=e.x,n=e.y,i=this.distortion.x,o=this.distortion.y;if(0==i)t.x=r,t.y=n/(1+o*r);else if(0==o)t.y=n,t.x=r/(1+i*n);else{var a=.5*(n*i-r*o+1)/o,s=a*a+r/o;if(s<=1e-5)return void t.set(NaN,NaN);t.x=0 vFrame.z ||\n pixels.y < vFrame.y || pixels.y > vFrame.w) {\n uv.x = vTrans1.x * surface2.x + vTrans1.y * surface2.y + vTrans1.z;\n uv.y = vTrans2.x * surface2.x + vTrans2.y * surface2.y + vTrans2.z;\n pixels = uv * samplerSize[0];\n \n if (pixels.x < vFrame.x || pixels.x > vFrame.z ||\n pixels.y < vFrame.y || pixels.y > vFrame.w) {\n discard;\n }\n}\n\nvec4 edge;\nedge.xy = clamp(pixels - vFrame.xy + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\nedge.zw = clamp(vFrame.zw - pixels + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\n\nfloat alpha = 1.0; //edge.x * edge.y * edge.z * edge.w;\nvec4 rColor = vColor * alpha;\n\nfloat textureId = floor(vTextureId+0.5);\nvec4 color;\nvec2 textureCoord = uv;\n%forloop%\ngl_FragColor = color * rColor;\n}",e.defUniforms={worldTransform:new Float32Array([1,0,0,0,1,0,0,0,1]),distortion:new Float32Array([0,0])},e}return __extends(e,t),e.prototype.getUniforms=function(e){var t=e.proj;this.shader;return null!==t.surface?t.uniforms:null!==t._activeProjection?t._activeProjection.uniforms:this.defUniforms},e.prototype.createVao=function(e){var t=this.shader.attributes;this.vertSize=14,this.vertByteSize=4*this.vertSize;var r=this.renderer.gl,n=this.renderer.createVao().addIndex(this.indexBuffer).addAttribute(e,t.aVertexPosition,r.FLOAT,!1,this.vertByteSize,0).addAttribute(e,t.aTrans1,r.FLOAT,!1,this.vertByteSize,8).addAttribute(e,t.aTrans2,r.FLOAT,!1,this.vertByteSize,20).addAttribute(e,t.aFrame,r.FLOAT,!1,this.vertByteSize,32).addAttribute(e,t.aColor,r.UNSIGNED_BYTE,!0,this.vertByteSize,48);return t.aTextureId&&n.addAttribute(e,t.aTextureId,r.FLOAT,!1,this.vertByteSize,52),n},e.prototype.fillVertices=function(e,t,r,n,i,o){for(var a=n.vertexData,s=n._texture,u=(s.orig.width,s.orig.height,n._anchor._x,n._anchor._y,s._frame),l=n.aTrans,c=0;c<4;c++)e[r]=a[2*c],e[r+1]=a[2*c+1],e[r+2]=l.a,e[r+3]=l.c,e[r+4]=l.tx,e[r+5]=l.b,e[r+6]=l.d,e[r+7]=l.ty,e[r+8]=u.x,e[r+9]=u.y,e[r+10]=u.x+u.width,e[r+11]=u.y+u.height,t[r+12]=i,e[r+13]=o,r+=14},e}((pixi_projection||(pixi_projection={})).webgl.MultiTextureSpriteRenderer);PIXI.WebGLRenderer.registerPlugin("sprite_bilinear",t)}(),function(e){var t=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.size=100,e.MAX_TEXTURES_LOCAL=1,e.shaderVert="precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec3 aTrans1;\nattribute vec3 aTrans2;\nattribute vec4 aFrame;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 worldTransform;\n\nvarying vec2 vTextureCoord;\nvarying vec3 vTrans1;\nvarying vec3 vTrans2;\nvarying vec4 vFrame;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position.xyw = projectionMatrix * worldTransform * vec3(aVertexPosition, 1.0);\n gl_Position.z = 0.0;\n \n vTextureCoord = aVertexPosition;\n vTrans1 = aTrans1;\n vTrans2 = aTrans2;\n vTextureId = aTextureId;\n vColor = aColor;\n vFrame = aFrame;\n}\n",e.shaderFrag="precision highp float;\nvarying vec2 vTextureCoord;\nvarying vec3 vTrans1;\nvarying vec3 vTrans2;\nvarying vec4 vFrame;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nuniform sampler2D uSamplers[%count%];\nuniform vec2 samplerSize[%count%]; \nuniform vec4 params;\n\nvoid main(void){\nvec2 surface;\n\nfloat vx = vTextureCoord.x;\nfloat vy = vTextureCoord.y;\nfloat aleph = params.x;\nfloat bet = params.y;\nfloat A = params.z;\nfloat B = params.w;\n\nif (aleph == 0.0) {\n\tsurface.y = vy / (1.0 + vx * bet);\n\tsurface.x = vx;\n}\nelse if (bet == 0.0) {\n\tsurface.x = vx / (1.0 + vy * aleph);\n\tsurface.y = vy;\n} else {\n\tsurface.x = vx * (bet + 1.0) / (bet + 1.0 + vy * aleph);\n\tsurface.y = vy * (aleph + 1.0) / (aleph + 1.0 + vx * bet);\n}\n\nvec2 uv;\nuv.x = vTrans1.x * surface.x + vTrans1.y * surface.y + vTrans1.z;\nuv.y = vTrans2.x * surface.x + vTrans2.y * surface.y + vTrans2.z;\n\nvec2 pixels = uv * samplerSize[0];\n\nvec4 edge;\nedge.xy = clamp(pixels - vFrame.xy + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\nedge.zw = clamp(vFrame.zw - pixels + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\n\nfloat alpha = edge.x * edge.y * edge.z * edge.w;\nvec4 rColor = vColor * alpha;\n\nfloat textureId = floor(vTextureId+0.5);\nvec4 color;\nvec2 textureCoord = uv;\n%forloop%\ngl_FragColor = color * rColor;\n}",e.defUniforms={worldTransform:new Float32Array([1,0,0,0,1,0,0,0,1]),distortion:new Float32Array([0,0])},e}return __extends(e,t),e.prototype.getUniforms=function(e){var t=e.proj;this.shader;return null!==t.surface?t.uniforms:null!==t._activeProjection?t._activeProjection.uniforms:this.defUniforms},e.prototype.createVao=function(e){var t=this.shader.attributes;this.vertSize=14,this.vertByteSize=4*this.vertSize;var r=this.renderer.gl,n=this.renderer.createVao().addIndex(this.indexBuffer).addAttribute(e,t.aVertexPosition,r.FLOAT,!1,this.vertByteSize,0).addAttribute(e,t.aTrans1,r.FLOAT,!1,this.vertByteSize,8).addAttribute(e,t.aTrans2,r.FLOAT,!1,this.vertByteSize,20).addAttribute(e,t.aFrame,r.FLOAT,!1,this.vertByteSize,32).addAttribute(e,t.aColor,r.UNSIGNED_BYTE,!0,this.vertByteSize,48);return t.aTextureId&&n.addAttribute(e,t.aTextureId,r.FLOAT,!1,this.vertByteSize,52),n},e.prototype.fillVertices=function(e,t,r,n,i,o){for(var a=n.vertexData,s=n._texture,u=(s.orig.width,s.orig.height,n._anchor._x,n._anchor._y,s._frame),l=n.aTrans,c=0;c<4;c++)e[r]=a[2*c],e[r+1]=a[2*c+1],e[r+2]=l.a,e[r+3]=l.c,e[r+4]=l.tx,e[r+5]=l.b,e[r+6]=l.d,e[r+7]=l.ty,e[r+8]=u.x,e[r+9]=u.y,e[r+10]=u.x+u.width,e[r+11]=u.y+u.height,t[r+12]=i,e[r+13]=o,r+=14},e}((pixi_projection||(pixi_projection={})).webgl.MultiTextureSpriteRenderer);PIXI.WebGLRenderer.registerPlugin("sprite_strange",t)}(),function(e){var S=new PIXI.Matrix,i=new PIXI.Rectangle,M=new PIXI.Point,t=function(t){function e(){var e=t.call(this)||this;return e.params=[0,0,NaN,NaN],e}return __extends(e,t),e.prototype.clear=function(){var e=this.params;e[0]=0,e[1]=0,e[2]=NaN,e[3]=NaN},e.prototype.setAxisX=function(e,t,r){var n=e.x,i=e.y,o=Math.sqrt(n*n+i*i),a=r.rotation;0!==a&&(r.skew._x-=a,r.skew._y+=a,r.rotation=0),r.skew.y=Math.atan2(i,n);var s=this.params;s[2]=0!==t?-o*t:NaN,this._calc01()},e.prototype.setAxisY=function(e,t,r){var n=e.x,i=e.y,o=Math.sqrt(n*n+i*i),a=r.rotation;0!==a&&(r.skew._x-=a,r.skew._y+=a,r.rotation=0),r.skew.x=-Math.atan2(i,n)+Math.PI/2;var s=this.params;s[3]=0!==t?-o*t:NaN,this._calc01()},e.prototype._calc01=function(){var e=this.params;if(isNaN(e[2]))e[1]=0,isNaN(e[3])?e[0]=0:e[0]=1/e[3];else if(isNaN(e[3]))e[0]=0,e[1]=1/e[2];else{var t=1-e[2]*e[3];e[0]=(1-e[2])/t,e[1]=(1-e[3])/t}},e.prototype.apply=function(e,t){t=t||new PIXI.Point;var r=this.params[0],n=this.params[1],i=this.params[2],o=this.params[3],a=e.x,s=e.y;if(0===r)t.y=s*(1+a*n),t.x=a;else if(0===n)t.x=a*(1+s*r),t.y=s;else{var u=i*o-s*a;t.x=i*a*(o+s)/u,t.y=o*s*(i+a)/u}return t},e.prototype.applyInverse=function(e,t){t=t||new PIXI.Point;var r=this.params[0],n=this.params[1],i=(this.params[2],this.params[3],e.x),o=e.y;return 0===r?(t.y=o/(1+i*n),t.x=i):0===n?(t.x=i*(1+o*r),t.y=o):(t.x=i*(n+1)/(n+1+o*r),t.y=o*(r+1)/(r+1+i*n)),t},e.prototype.mapSprite=function(e,t,r){var n=e.texture;return i.x=-e.anchor.x*n.orig.width,i.y=-e.anchor.y*n.orig.height,i.width=n.orig.width,i.height=n.orig.height,this.mapQuad(i,t,r||e.transform)},e.prototype.mapQuad=function(e,t,r){var n=-e.x/e.width,i=-e.y/e.height,o=(1-e.x)/e.width,a=(1-e.y)/e.height,s=t[0].x*(1-n)+t[1].x*n,u=t[0].y*(1-n)+t[1].y*n,l=t[0].x*(1-o)+t[1].x*o,c=t[0].y*(1-o)+t[1].y*o,f=t[3].x*(1-n)+t[2].x*n,h=t[3].y*(1-n)+t[2].y*n,d=t[3].x*(1-o)+t[2].x*o,p=t[3].y*(1-o)+t[2].y*o,g=s*(1-i)+f*i,m=u*(1-i)+h*i,v=l*(1-i)+d*i,_=c*(1-i)+p*i,y=s*(1-a)+f*a,b=u*(1-a)+h*a,x=l*(1-a)+d*a,w=c*(1-a)+p*a,T=S;return T.tx=g,T.ty=m,T.a=v-g,T.b=_-m,T.c=y-g,T.d=b-m,M.set(x,w),T.applyInverse(M,M),r.setFromMatrix(T),this},e.prototype.fillUniforms=function(e){var t=this.params,r=e.params||new Float32Array([0,0,0,0]);(e.params=r)[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3]},e}(e.Surface);e.StrangeSurface=t}(pixi_projection||(pixi_projection={})),function(n){var e=function(r){function e(e){var t=r.call(this,e)||this;return t.aTrans=new PIXI.Matrix,t.proj=new n.ProjectionSurface(t.transform),t.pluginName="sprite_bilinear",t}return __extends(e,r),e.prototype._calculateBounds=function(){this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData)},e.prototype.calculateVertices=function(){var e=this.transform._worldID,t=this._texture._updateID;if(this._transformID!==e||this._textureID!==t){this._transformID=e,this._textureID=t;var r=this._texture,n=this.vertexData,i=r.trim,o=r.orig,a=this._anchor,s=0,u=0,l=0,c=0;if(l=i?(s=(u=i.x-a._x*o.width)+i.width,(c=i.y-a._y*o.height)+i.height):(s=(u=-a._x*o.width)+o.width,(c=-a._y*o.height)+o.height),this.proj._surface)n[0]=u,n[1]=c,n[2]=s,n[3]=c,n[4]=s,n[5]=l,n[6]=u,n[7]=l,this.proj._surface.boundsQuad(n,n);else{var f=this.transform.worldTransform,h=f.a,d=f.b,p=f.c,g=f.d,m=f.tx,v=f.ty;n[0]=h*u+p*c+m,n[1]=g*c+d*u+v,n[2]=h*s+p*c+m,n[3]=g*c+d*s+v,n[4]=h*s+p*l+m,n[5]=g*l+d*s+v,n[6]=h*u+p*l+m,n[7]=g*l+d*u+v,this.proj._activeProjection&&this.proj._activeProjection.surface.boundsQuad(n,n)}r.transform||(r.transform=new PIXI.TextureMatrix(r)),r.transform.update();var _=this.aTrans;_.set(o.width,0,0,o.height,u,c),null===this.proj._surface&&_.prepend(this.transform.worldTransform),_.invert(),_.prepend(r.transform.mapCoord)}},e.prototype.calculateTrimmedVertices=function(){var e=this.transform._worldID,t=this._texture._updateID;if(this.vertexTrimmedData){if(this._transformTrimmedID===e&&this._textureTrimmedID===t)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=e,this._textureTrimmedID=t;var r=this._texture,n=this.vertexTrimmedData,i=r.orig,o=this._anchor,a=-o._x*i.width,s=a+i.width,u=-o._y*i.height,l=u+i.height;if(this.proj._surface)n[0]=a,n[1]=u,n[2]=s,n[3]=u,n[4]=s,n[5]=l,n[6]=a,n[7]=l,this.proj._surface.boundsQuad(n,n,this.transform.worldTransform);else{var c=this.transform.worldTransform,f=c.a,h=c.b,d=c.c,p=c.d,g=c.tx,m=c.ty;n[0]=f*a+d*u+g,n[1]=p*u+h*a+m,n[2]=f*s+d*u+g,n[3]=p*u+h*s+m,n[4]=f*s+d*l+g,n[5]=p*l+h*s+m,n[6]=f*a+d*l+g,n[7]=p*l+h*a+m,this.proj._activeProjection&&this.proj._activeProjection.surface.boundsQuad(n,n,this.proj._activeProjection.legacy.worldTransform)}},Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.proj},enumerable:!0,configurable:!0}),e}(PIXI.Sprite);n.Sprite2s=e}(pixi_projection||(pixi_projection={})),function(o){var e=function(i){function e(e,t,r){var n=i.call(this,e,t,r)||this;return n.aTrans=new PIXI.Matrix,n.proj=new o.ProjectionSurface(n.transform),n.pluginName="sprite_bilinear",n}return __extends(e,i),Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.proj},enumerable:!0,configurable:!0}),e}(PIXI.Text);(o.Text2s=e).prototype.calculateVertices=o.Sprite2s.prototype.calculateVertices,e.prototype.calculateTrimmedVertices=o.Sprite2s.prototype.calculateTrimmedVertices,e.prototype._calculateBounds=o.Sprite2s.prototype._calculateBounds}(pixi_projection||(pixi_projection={})),function(e){PIXI.Sprite.prototype.convertTo2s=function(){this.proj||(this.pluginName="sprite_bilinear",this.aTrans=new PIXI.Matrix,this.calculateVertices=e.Sprite2s.prototype.calculateVertices,this.calculateTrimmedVertices=e.Sprite2s.prototype.calculateTrimmedVertices,this._calculateBounds=e.Sprite2s.prototype._calculateBounds,PIXI.Container.prototype.convertTo2s.call(this))},PIXI.Container.prototype.convertTo2s=function(){this.proj||(this.proj=new e.Projection2d(this.transform),Object.defineProperty(this,"worldTransform",{get:function(){return this.proj},enumerable:!0,configurable:!0}))},PIXI.Container.prototype.convertSubtreeTo2s=function(){this.convertTo2s();for(var e=0;e=o.TRANSFORM_STEP.PROJ?(n||this.displayObjectUpdateTransform(),this.proj.affine?this.transform.worldTransform.applyInverse(r,r):this.proj.world.applyInverse(r,r)):(this.parent?r=this.parent.worldTransform.applyInverse(e,r):r.copy(e),i===o.TRANSFORM_STEP.NONE?r:this.transform.localTransform.applyInverse(r,r))},Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.proj.affine?this.transform.worldTransform:this.proj.world},enumerable:!0,configurable:!0}),e}(PIXI.Container);o.Container2d=e,o.container2dToLocal=e.prototype.toLocal}(pixi_projection||(pixi_projection={})),function(e){var a,t,v=PIXI.Point,r=[1,0,0,0,1,0,0,0,1];(t=a=e.AFFINE||(e.AFFINE={}))[t.NONE=0]="NONE",t[t.FREE=1]="FREE",t[t.AXIS_X=2]="AXIS_X",t[t.AXIS_Y=3]="AXIS_Y",t[t.POINT=4]="POINT";var n=function(){function e(e){this.floatArray=null,this.mat3=new Float64Array(e||r)}return Object.defineProperty(e.prototype,"a",{get:function(){return this.mat3[0]/this.mat3[8]},set:function(e){this.mat3[0]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"b",{get:function(){return this.mat3[1]/this.mat3[8]},set:function(e){this.mat3[1]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"c",{get:function(){return this.mat3[3]/this.mat3[8]},set:function(e){this.mat3[3]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"d",{get:function(){return this.mat3[4]/this.mat3[8]},set:function(e){this.mat3[4]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tx",{get:function(){return this.mat3[6]/this.mat3[8]},set:function(e){this.mat3[6]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ty",{get:function(){return this.mat3[7]/this.mat3[8]},set:function(e){this.mat3[7]=e*this.mat3[8]},enumerable:!0,configurable:!0}),e.prototype.set=function(e,t,r,n,i,o){var a=this.mat3;return a[0]=e,a[1]=t,a[2]=0,a[3]=r,a[4]=n,a[5]=0,a[6]=i,a[7]=o,a[8]=1,this},e.prototype.toArray=function(e,t){this.floatArray||(this.floatArray=new Float32Array(9));var r=t||this.floatArray,n=this.mat3;return e?(r[0]=n[0],r[1]=n[1],r[2]=n[2],r[3]=n[3],r[4]=n[4],r[5]=n[5],r[6]=n[6],r[7]=n[7]):(r[0]=n[0],r[1]=n[3],r[2]=n[6],r[3]=n[1],r[4]=n[4],r[5]=n[7],r[6]=n[2],r[7]=n[5]),r[8]=n[8],r},e.prototype.apply=function(e,t){t=t||new PIXI.Point;var r=this.mat3,n=e.x,i=e.y,o=1/(r[2]*n+r[5]*i+r[8]);return t.x=o*(r[0]*n+r[3]*i+r[6]),t.y=o*(r[1]*n+r[4]*i+r[7]),t},e.prototype.translate=function(e,t){var r=this.mat3;return r[0]+=e*r[2],r[1]+=t*r[2],r[3]+=e*r[5],r[4]+=t*r[5],r[6]+=e*r[8],r[7]+=t*r[8],this},e.prototype.scale=function(e,t){var r=this.mat3;return r[0]*=e,r[1]*=t,r[3]*=e,r[4]*=t,r[6]*=e,r[7]*=t,this},e.prototype.scaleAndTranslate=function(e,t,r,n){var i=this.mat3;i[0]=e*i[0]+r*i[2],i[1]=t*i[1]+n*i[2],i[3]=e*i[3]+r*i[5],i[4]=t*i[4]+n*i[5],i[6]=e*i[6]+r*i[8],i[7]=t*i[7]+n*i[8]},e.prototype.applyInverse=function(e,t){t=t||new v;var r=this.mat3,n=e.x,i=e.y,o=r[0],a=r[3],s=r[6],u=r[1],l=r[4],c=r[7],f=r[2],h=r[5],d=r[8],p=(d*l-c*h)*n+(-d*a+s*h)*i+(c*a-s*l),g=(-d*u+c*f)*n+(d*o-s*f)*i+(-c*o+s*u),m=(h*u-l*f)*n+(-h*o+a*f)*i+(l*o-a*u);return t.x=p/m,t.y=g/m,t},e.prototype.invert=function(){var e=this.mat3,t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],a=e[5],s=e[6],u=e[7],l=e[8],c=l*o-a*u,f=-l*i+a*s,h=u*i-o*s,d=t*c+r*f+n*h;return d&&(d=1/d,e[0]=c*d,e[1]=(-l*r+n*u)*d,e[2]=(a*r-n*o)*d,e[3]=f*d,e[4]=(l*t-n*s)*d,e[5]=(-a*t+n*i)*d,e[6]=h*d,e[7]=(-u*t+r*s)*d,e[8]=(o*t-r*i)*d),this},e.prototype.identity=function(){var e=this.mat3;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,this},e.prototype.clone=function(){return new e(this.mat3)},e.prototype.copyTo=function(e){var t=this.mat3,r=e.mat3;return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],e},e.prototype.copy=function(e,t){var r=this.mat3,n=1/r[8],i=r[6]*n,o=r[7]*n;e.a=(r[0]-r[2]*i)*n,e.b=(r[1]-r[2]*o)*n,e.c=(r[3]-r[5]*i)*n,e.d=(r[4]-r[5]*o)*n,e.tx=i,e.ty=o,2<=t&&(t===a.POINT?(e.a=1,e.b=0,e.c=0,e.d=1):t===a.AXIS_X?(e.c=-e.b,e.d=e.a):t===a.AXIS_Y&&(e.a=e.d,e.c=-e.b))},e.prototype.copyFrom=function(e){var t=this.mat3;return t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=e.c,t[4]=e.d,t[5]=0,t[6]=e.tx,t[7]=e.ty,t[8]=1,this},e.prototype.setToMultLegacy=function(e,t){var r=this.mat3,n=t.mat3,i=e.a,o=e.b,a=e.c,s=e.d,u=e.tx,l=e.ty,c=n[0],f=n[1],h=n[2],d=n[3],p=n[4],g=n[5],m=n[6],v=n[7],_=n[8];return r[0]=c*i+f*a+h*u,r[1]=c*o+f*s+h*l,r[2]=h,r[3]=d*i+p*a+g*u,r[4]=d*o+p*s+g*l,r[5]=g,r[6]=m*i+v*a+_*u,r[7]=m*o+v*s+_*l,r[8]=_,this},e.prototype.setToMultLegacy2=function(e,t){var r=this.mat3,n=e.mat3,i=n[0],o=n[1],a=n[2],s=n[3],u=n[4],l=n[5],c=n[6],f=n[7],h=n[8],d=t.a,p=t.b,g=t.c,m=t.d,v=t.tx,_=t.ty;return r[0]=d*i+p*s,r[1]=d*o+p*u,r[2]=d*a+p*l,r[3]=g*i+m*s,r[4]=g*o+m*u,r[5]=g*a+m*l,r[6]=v*i+_*s+c,r[7]=v*o+_*u+f,r[8]=v*a+_*l+h,this},e.prototype.setToMult=function(e,t){var r=this.mat3,n=e.mat3,i=t.mat3,o=n[0],a=n[1],s=n[2],u=n[3],l=n[4],c=n[5],f=n[6],h=n[7],d=n[8],p=i[0],g=i[1],m=i[2],v=i[3],_=i[4],y=i[5],b=i[6],x=i[7],w=i[8];return r[0]=p*o+g*u+m*f,r[1]=p*a+g*l+m*h,r[2]=p*s+g*c+m*d,r[3]=v*o+_*u+y*f,r[4]=v*a+_*l+y*h,r[5]=v*s+_*c+y*d,r[6]=b*o+x*u+w*f,r[7]=b*a+x*l+w*h,r[8]=b*s+x*c+w*d,this},e.prototype.prepend=function(e){e.mat3?this.setToMult(e,this):this.setToMultLegacy(e,this)},e.IDENTITY=new e,e.TEMP_MATRIX=new e,e}();e.Matrix2d=n}(pixi_projection||(pixi_projection={})),function(d){var p=new PIXI.Point,g=[new PIXI.Point,new PIXI.Point,new PIXI.Point,new PIXI.Point],i=new PIXI.Rectangle,m=new d.Matrix2d,e=function(n){function e(e,t){var r=n.call(this,e,t)||this;return r.matrix=new d.Matrix2d,r.pivot=new PIXI.ObservablePoint(r.onChange,r,0,0),r.reverseLocalOrder=!1,r.local=new d.Matrix2d,r.world=new d.Matrix2d,r}return __extends(e,n),e.prototype.onChange=function(){var e=this.pivot,t=this.matrix.mat3;t[6]=-(e._x*t[0]+e._y*t[3]),t[7]=-(e._x*t[1]+e._y*t[4]),this._projID++},e.prototype.setAxisX=function(e,t){void 0===t&&(t=1);var r=e.x,n=e.y,i=Math.sqrt(r*r+n*n),o=this.matrix.mat3;o[0]=r/i,o[1]=n/i,o[2]=t/i,this.onChange()},e.prototype.setAxisY=function(e,t){void 0===t&&(t=1);var r=e.x,n=e.y,i=Math.sqrt(r*r+n*n),o=this.matrix.mat3;o[3]=r/i,o[4]=n/i,o[5]=t/i,this.onChange()},e.prototype.mapSprite=function(e,t){var r=e.texture;return i.x=-e.anchor.x*r.orig.width,i.y=-e.anchor.y*r.orig.height,i.width=r.orig.width,i.height=r.orig.height,this.mapQuad(i,t)},e.prototype.mapQuad=function(e,t){g[0].set(e.x,e.y),g[1].set(e.x+e.width,e.y),g[2].set(e.x+e.width,e.y+e.height),g[3].set(e.x,e.y+e.height);var r=1,n=2,i=3;if(0!==d.utils.getIntersectionFactor(t[0],t[2],t[1],t[3],p)){r=1,n=3,i=2;var o=Math.sqrt((t[0].x-p.x)*(t[0].x-p.x)+(t[0].y-p.y)*(t[0].y-p.y)),a=Math.sqrt((t[r].x-p.x)*(t[r].x-p.x)+(t[r].y-p.y)*(t[r].y-p.y)),s=Math.sqrt((t[n].x-p.x)*(t[n].x-p.x)+(t[n].y-p.y)*(t[n].y-p.y)),u=Math.sqrt((t[i].x-p.x)*(t[i].x-p.x)+(t[i].y-p.y)*(t[i].y-p.y)),l=(o+u)/u,c=(a+s)/s,f=(a+s)/a,h=this.matrix.mat3;h[0]=g[0].x*l,h[1]=g[0].y*l,h[2]=l,h[3]=g[r].x*c,h[4]=g[r].y*c,h[5]=c,h[6]=g[n].x*f,h[7]=g[n].y*f,h[8]=f,this.matrix.invert(),(h=m.mat3)[0]=t[0].x,h[1]=t[0].y,h[2]=1,h[3]=t[r].x,h[4]=t[r].y,h[5]=1,h[6]=t[n].x,h[7]=t[n].y,h[8]=1,this.matrix.setToMult(m,this.matrix),this._projID++}},e.prototype.updateLocalTransform=function(e){0!==this._projID?this.reverseLocalOrder?this.local.setToMultLegacy2(this.matrix,e):this.local.setToMultLegacy(e,this.matrix):this.local.copyFrom(e)},e.prototype.clear=function(){n.prototype.clear.call(this),this.matrix.identity(),this.pivot.set(0,0)},e}(d.LinearProjection);d.Projection2d=e}(pixi_projection||(pixi_projection={})),function(s){var e=function(a){function e(e,t,r,n,i){var o=a.call(this,e,t,r,n,i)||this;return o.proj=new s.Projection2d(o.transform),o.pluginName="mesh2d",o}return __extends(e,a),e.prototype.toLocal=function(e,t,r,n,i){return void 0===i&&(i=s.TRANSFORM_STEP.ALL),s.container2dToLocal.call(this,e,t,r,n,i)},Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.proj.affine?this.transform.worldTransform:this.proj.world},enumerable:!0,configurable:!0}),e}(PIXI.mesh.Mesh);s.Mesh2d=e}(pixi_projection||(pixi_projection={})),function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.onContextChange=function(){var e=this.renderer.gl;this.shader=new PIXI.Shader(e,"precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position.xyw = projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0);\n gl_Position.z = 0.0;\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n","\nvarying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}")},t}(PIXI.mesh.MeshRenderer);e.Mesh2dRenderer=t,PIXI.WebGLRenderer.registerPlugin("mesh2d",t)}(pixi_projection||(pixi_projection={})),function(o){var e=function(h){function e(e){var t=h.call(this,e)||this;return t.proj=new o.Projection2d(t.transform),t.pluginName="sprite2d",t.vertexData=new Float32Array(12),t}return __extends(e,h),e.prototype._calculateBounds=function(){this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData)},e.prototype.calculateVertices=function(){if(this.proj._affine)return 8!=this.vertexData.length&&(this.vertexData=new Float32Array(8)),void h.prototype.calculateVertices.call(this);12!=this.vertexData.length&&(this.vertexData=new Float32Array(12));var e=this.transform._worldID,t=this._texture._updateID;if(this._transformID!==e||this._textureID!==t){this._transformID=e,this._textureID=t;var r=this._texture,n=this.proj.world.mat3,i=this.vertexData,o=r.trim,a=r.orig,s=this._anchor,u=0,l=0,c=0,f=0;c=o?(u=(l=o.x-s._x*a.width)+o.width,(f=o.y-s._y*a.height)+o.height):(u=(l=-s._x*a.width)+a.width,(f=-s._y*a.height)+a.height),i[0]=n[0]*l+n[3]*f+n[6],i[1]=n[1]*l+n[4]*f+n[7],i[2]=n[2]*l+n[5]*f+n[8],i[3]=n[0]*u+n[3]*f+n[6],i[4]=n[1]*u+n[4]*f+n[7],i[5]=n[2]*u+n[5]*f+n[8],i[6]=n[0]*u+n[3]*c+n[6],i[7]=n[1]*u+n[4]*c+n[7],i[8]=n[2]*u+n[5]*c+n[8],i[9]=n[0]*l+n[3]*c+n[6],i[10]=n[1]*l+n[4]*c+n[7],i[11]=n[2]*l+n[5]*c+n[8]}},e.prototype.calculateTrimmedVertices=function(){if(this.proj._affine)h.prototype.calculateTrimmedVertices.call(this);else{var e=this.transform._worldID,t=this._texture._updateID;if(this.vertexTrimmedData){if(this._transformTrimmedID===e&&this._textureTrimmedID===t)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=e,this._textureTrimmedID=t;var r=this._texture,n=this.vertexTrimmedData,i=r.orig,o=this._anchor,a=this.proj.world.mat3,s=-o._x*i.width,u=s+i.width,l=-o._y*i.height,c=l+i.height,f=1/(a[2]*s+a[5]*l+a[8]);n[0]=f*(a[0]*s+a[3]*l+a[6]),n[1]=f*(a[1]*s+a[4]*l+a[7]),f=1/(a[2]*u+a[5]*l+a[8]),n[2]=f*(a[0]*u+a[3]*l+a[6]),n[3]=f*(a[1]*u+a[4]*l+a[7]),f=1/(a[2]*u+a[5]*c+a[8]),n[4]=f*(a[0]*u+a[3]*c+a[6]),n[5]=f*(a[1]*u+a[4]*c+a[7]),f=1/(a[2]*s+a[5]*c+a[8]),n[6]=f*(a[0]*s+a[3]*c+a[6]),n[7]=f*(a[1]*s+a[4]*c+a[7])}},e.prototype.toLocal=function(e,t,r,n,i){return void 0===i&&(i=o.TRANSFORM_STEP.ALL),o.container2dToLocal.call(this,e,t,r,n,i)},Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.proj.affine?this.transform.worldTransform:this.proj.world},enumerable:!0,configurable:!0}),e}(PIXI.Sprite);o.Sprite2d=e}(pixi_projection||(pixi_projection={})),function(e){var t=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.shaderVert="precision highp float;\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position.xyw = projectionMatrix * aVertexPosition;\n gl_Position.z = 0.0;\n \n vTextureCoord = aTextureCoord;\n vTextureId = aTextureId;\n vColor = aColor;\n}\n",e.shaderFrag="\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\nvec4 color;\nvec2 textureCoord = vTextureCoord;\nfloat textureId = floor(vTextureId+0.5);\n%forloop%\ngl_FragColor = color * vColor;\n}",e}return __extends(e,t),e.prototype.createVao=function(e){var t=this.shader.attributes;this.vertSize=6,this.vertByteSize=4*this.vertSize;var r=this.renderer.gl,n=this.renderer.createVao().addIndex(this.indexBuffer).addAttribute(e,t.aVertexPosition,r.FLOAT,!1,this.vertByteSize,0).addAttribute(e,t.aTextureCoord,r.UNSIGNED_SHORT,!0,this.vertByteSize,12).addAttribute(e,t.aColor,r.UNSIGNED_BYTE,!0,this.vertByteSize,16);return t.aTextureId&&n.addAttribute(e,t.aTextureId,r.FLOAT,!1,this.vertByteSize,20),n},e.prototype.fillVertices=function(e,t,r,n,i,o){var a=n.vertexData,s=n._texture._uvs.uvsUint32;if(8===a.length)if(this.renderer.roundPixels){var u=this.renderer.resolution;e[r]=(a[0]*u|0)/u,e[r+1]=(a[1]*u|0)/u,e[r+2]=1,e[r+6]=(a[2]*u|0)/u,e[r+7]=(a[3]*u|0)/u,e[r+8]=1,e[r+12]=(a[4]*u|0)/u,e[r+13]=(a[5]*u|0)/u,e[r+14]=1,e[r+18]=(a[6]*u|0)/u,e[r+19]=(a[7]*u|0)/u,e[r+20]=1}else e[r]=a[0],e[r+1]=a[1],e[r+2]=1,e[r+6]=a[2],e[r+7]=a[3],e[r+8]=1,e[r+12]=a[4],e[r+13]=a[5],e[r+14]=1,e[r+18]=a[6],e[r+19]=a[7],e[r+20]=1;else e[r]=a[0],e[r+1]=a[1],e[r+2]=a[2],e[r+6]=a[3],e[r+7]=a[4],e[r+8]=a[5],e[r+12]=a[6],e[r+13]=a[7],e[r+14]=a[8],e[r+18]=a[9],e[r+19]=a[10],e[r+20]=a[11];t[r+3]=s[0],t[r+9]=s[1],t[r+15]=s[2],t[r+21]=s[3],t[r+4]=t[r+10]=t[r+16]=t[r+22]=i,e[r+5]=e[r+11]=e[r+17]=e[r+23]=o},e}((pixi_projection||(pixi_projection={})).webgl.MultiTextureSpriteRenderer);PIXI.WebGLRenderer.registerPlugin("sprite2d",t)}(),function(o){var e=function(i){function e(e,t,r){var n=i.call(this,e,t,r)||this;return n.proj=new o.Projection2d(n.transform),n.pluginName="sprite2d",n.vertexData=new Float32Array(12),n}return __extends(e,i),Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.proj.affine?this.transform.worldTransform:this.proj.world},enumerable:!0,configurable:!0}),e}(PIXI.Text);(o.Text2d=e).prototype.calculateVertices=o.Sprite2d.prototype.calculateVertices,e.prototype.calculateTrimmedVertices=o.Sprite2d.prototype.calculateTrimmedVertices,e.prototype._calculateBounds=o.Sprite2d.prototype._calculateBounds}(pixi_projection||(pixi_projection={})),function(e){function t(){this.proj||(this.proj=new e.Projection2d(this.transform),this.toLocal=e.Container2d.prototype.toLocal,Object.defineProperty(this,"worldTransform",{get:e.container2dWorldTransform,enumerable:!0,configurable:!0}))}PIXI.Container.prototype.convertTo2d=t,PIXI.Sprite.prototype.convertTo2d=function(){this.proj||(this.calculateVertices=e.Sprite2d.prototype.calculateVertices,this.calculateTrimmedVertices=e.Sprite2d.prototype.calculateTrimmedVertices,this._calculateBounds=e.Sprite2d.prototype._calculateBounds,this.pluginName="sprite2d",this.vertexData=new Float32Array(12),t.call(this))},PIXI.mesh.Mesh.prototype.convertTo2d=function(){this.proj||(this.pluginName="mesh2d",t.call(this))},PIXI.Container.prototype.convertSubtreeTo2d=function(){this.convertTo2d();for(var e=0;ee._startTime;u._timeline;)l&&u._timeline.smoothChildTiming?u.totalTime(u._totalTime,!0):u._gc&&u._enabled(!0,!1),u=u._timeline;return c},r.remove=function(e){if(e instanceof f){this._remove(e,!1);var t=e._timeline=e.vars.useFrames?f._rootFramesTimeline:f._rootTimeline;return e._startTime=(e._paused?e._pauseTime:t._time)-(e._reversed?e.totalDuration()-e._totalTime:e._totalTime)/e._timeScale,this}if(e instanceof Array||e&&e.push&&d(e)){for(var r=e.length;-1<--r;)this.remove(e[r]);return this}return"string"==typeof e?this.removeLabel(e):this.kill(null,e)},r._remove=function(e,t){return h.prototype._remove.call(this,e,t),this._last?this._time>this.duration()&&(this._time=this._duration,this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},r.append=function(e,t){return this.add(e,this._parseTimeOrLabel(null,t,!0,e))},r.insert=r.insertMultiple=function(e,t,r,n){return this.add(e,t||0,r,n)},r.appendMultiple=function(e,t,r,n){return this.add(e,this._parseTimeOrLabel(null,t,!0,e),r,n)},r.addLabel=function(e,t){return this._labels[e]=this._parseTimeOrLabel(t),this},r.addPause=function(e,t,r,n){var i=p.delayedCall(0,o,r,n||this);return i.vars.onComplete=i.vars.onReverseComplete=t,i.data="isPause",this._hasPause=!0,this.add(i,e)},r.removeLabel=function(e){return delete this._labels[e],this},r.getLabelTime=function(e){return null!=this._labels[e]?this._labels[e]:-1},r._parseTimeOrLabel=function(e,t,r,n){var i,o;if(n instanceof f&&n.timeline===this)this.remove(n);else if(n&&(n instanceof Array||n.push&&d(n)))for(o=n.length;-1<--o;)n[o]instanceof f&&n[o].timeline===this&&this.remove(n[o]);if(i="number"!=typeof e||t?99999999999=e&&!u;)n._duration||"isPause"===n.data&&0f._time;)u.render(u._reversed?u.totalDuration()-(e-u._startTime)*u._timeScale:(e-u._startTime)*u._timeScale,t,r),u=u._prev;u=null,f.pause(),f._pauseTime=c}n._reversed?n.render((n._dirty?n.totalDuration():n._totalDuration)-(e-n._startTime)*n._timeScale,t,r):n.render((e-n._startTime)*n._timeScale,t,r)}n=o}f._onUpdate&&(t||(v.length&&_(),f._callback("onUpdate"))),a&&(f._gc||p!==f._startTime&&g===f._timeScale||(0===f._time||d>=f.totalDuration())&&(i&&(v.length&&_(),f._timeline.autoRemoveChildren&&f._enabled(!1,!1),f._active=!1),!t&&f.vars[a]&&f._callback(a)))}},r._hasPausedChild=function(){for(var e=this._first;e;){if(e._paused||e instanceof g&&e._hasPausedChild())return!0;e=e._next}return!1},r.getChildren=function(e,t,r,n){n=n||-9999999999;for(var i=[],o=this._first,a=0;o;)o._startTime=r&&(i._startTime+=e),i=i._next;if(t)for(n in o)o[n]>=r&&(o[n]+=e);return this._uncache(!0)},r._kill=function(e,t){if(!e&&!t)return this._enabled(!1,!1);for(var r=t?this.getTweensOf(t):this.getChildren(!0,!0,!1),n=r.length,i=!1;-1<--n;)r[n]._kill(e,t)&&(i=!0);return i},r.clear=function(e){var t=this.getChildren(!1,!0,!0),r=t.length;for(this._time=this._totalTime=0;-1<--r;)t[r]._enabled(!1,!1);return!1!==e&&(this._labels={}),this._uncache(!0)},r.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return f.prototype.invalidate.call(this)},r._enabled=function(e,t){if(e===this._gc)for(var r=this._first;r;)r._enabled(e,!0),r=r._next;return h.prototype._enabled.call(this,e,t)},r.totalTime=function(e,t,r){this._forcingPlayhead=!0;var n=f.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,n},r.duration=function(e){return arguments.length?(0!==this.duration()&&0!==e&&this.timeScale(this._duration/e),this):(this._dirty&&this.totalDuration(),this._duration)},r.totalDuration=function(e){if(arguments.length)return e&&this.totalDuration()?this.timeScale(this._totalDuration/e):this;if(this._dirty){for(var t,r,n=0,i=this,o=i._last,a=999999999999;o;)t=o._prev,o._dirty&&o.totalDuration(),o._startTime>a&&i._sortChildren&&!o._paused&&!i._calculatingDuration?(i._calculatingDuration=1,i.add(o,o._startTime-o._delay),i._calculatingDuration=0):a=o._startTime,o._startTime<0&&!o._paused&&(n-=o._startTime,i._timeline.smoothChildTiming&&(i._startTime+=o._startTime/i._timeScale,i._time-=o._startTime,i._totalTime-=o._startTime,i._rawPrevTime-=o._startTime),i.shiftChildren(-o._startTime,!1,-9999999999),a=0),n<(r=o._startTime+o._totalDuration/o._timeScale)&&(n=r),o=t;i._duration=i._totalDuration=n,i._dirty=!1}return this._totalDuration},r.paused=function(e){if(!1===e&&this._paused)for(var t=this._first;t;)t._startTime===this._time&&"isPause"===t.data&&(t._rawPrevTime=0),t=t._next;return f.prototype.paused.apply(this,arguments)},r.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===f._rootFramesTimeline},r.rawTime=function(e){return e&&(this._paused||this._repeat&&0>0,h._cycle&&h._cycle===h._totalTime/u&&m<=e&&h._cycle--,h._time=h._totalTime-h._cycle*u,h._yoyo&&1&h._cycle&&(h._time=g-h._time),h._time>g?e=(h._time=g)+1e-4:h._time<0?h._time=e=0:e=h._time)),h._hasPause&&!h._forcingPlayhead&&!t){if(d<=(e=h._time)||h._repeat&&x!==h._cycle)for(n=h._first;n&&n._startTime<=e&&!l;)n._duration||"isPause"!==n.data||n.ratio||0===n._startTime&&0===h._rawPrevTime||(l=n),n=n._next;else for(n=h._last;n&&n._startTime>=e&&!l;)n._duration||"isPause"===n.data&&0h._time;)l.render(l._reversed?l.totalDuration()-(e-l._startTime)*l._timeScale:(e-l._startTime)*l._timeScale,t,r),l=l._prev;l=null,h.pause(),h._pauseTime=f}n._reversed?n.render((n._dirty?n.totalDuration():n._totalDuration)-(e-n._startTime)*n._timeScale,t,r):n.render((e-n._startTime)*n._timeScale,t,r)}n=o}h._onUpdate&&(t||(E.length&&A(),h._callback("onUpdate"))),a&&(h._locked||h._gc||v!==h._startTime&&_===h._timeScale||(0===h._time||p>=h.totalDuration())&&(i&&(E.length&&A(),h._timeline.autoRemoveChildren&&h._enabled(!1,!1),h._active=!1),!t&&h.vars[a]&&h._callback(a)))}else m!==h._totalTime&&h._onUpdate&&(t||h._callback("onUpdate"))},i.getActive=function(e,t,r){var n,i,o=[],a=this.getChildren(e||null==e,t||null==e,!!r),s=0,u=a.length;for(n=0;ne)return r[t].name;return null},i.getLabelBefore=function(e){null==e&&(e=this._time);for(var t=this.getLabelsArray(),r=t.length;-1<--r;)if(t[r].timee._startTime;u._timeline;)l&&u._timeline.smoothChildTiming?u.totalTime(u._totalTime,!0):u._gc&&u._enabled(!0,!1),u=u._timeline;return c},r.remove=function(e){if(e instanceof f){this._remove(e,!1);var t=e._timeline=e.vars.useFrames?f._rootFramesTimeline:f._rootTimeline;return e._startTime=(e._paused?e._pauseTime:t._time)-(e._reversed?e.totalDuration()-e._totalTime:e._totalTime)/e._timeScale,this}if(e instanceof Array||e&&e.push&&d(e)){for(var r=e.length;-1<--r;)this.remove(e[r]);return this}return"string"==typeof e?this.removeLabel(e):this.kill(null,e)},r._remove=function(e,t){return h.prototype._remove.call(this,e,t),this._last?this._time>this.duration()&&(this._time=this._duration,this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},r.append=function(e,t){return this.add(e,this._parseTimeOrLabel(null,t,!0,e))},r.insert=r.insertMultiple=function(e,t,r,n){return this.add(e,t||0,r,n)},r.appendMultiple=function(e,t,r,n){return this.add(e,this._parseTimeOrLabel(null,t,!0,e),r,n)},r.addLabel=function(e,t){return this._labels[e]=this._parseTimeOrLabel(t),this},r.addPause=function(e,t,r,n){var i=p.delayedCall(0,o,r,n||this);return i.vars.onComplete=i.vars.onReverseComplete=t,i.data="isPause",this._hasPause=!0,this.add(i,e)},r.removeLabel=function(e){return delete this._labels[e],this},r.getLabelTime=function(e){return null!=this._labels[e]?this._labels[e]:-1},r._parseTimeOrLabel=function(e,t,r,n){var i,o;if(n instanceof f&&n.timeline===this)this.remove(n);else if(n&&(n instanceof Array||n.push&&d(n)))for(o=n.length;-1<--o;)n[o]instanceof f&&n[o].timeline===this&&this.remove(n[o]);if(i="number"!=typeof e||t?99999999999=e&&!u;)n._duration||"isPause"===n.data&&0f._time;)u.render(u._reversed?u.totalDuration()-(e-u._startTime)*u._timeScale:(e-u._startTime)*u._timeScale,t,r),u=u._prev;u=null,f.pause(),f._pauseTime=c}n._reversed?n.render((n._dirty?n.totalDuration():n._totalDuration)-(e-n._startTime)*n._timeScale,t,r):n.render((e-n._startTime)*n._timeScale,t,r)}n=o}f._onUpdate&&(t||(v.length&&_(),f._callback("onUpdate"))),a&&(f._gc||p!==f._startTime&&g===f._timeScale||(0===f._time||d>=f.totalDuration())&&(i&&(v.length&&_(),f._timeline.autoRemoveChildren&&f._enabled(!1,!1),f._active=!1),!t&&f.vars[a]&&f._callback(a)))}},r._hasPausedChild=function(){for(var e=this._first;e;){if(e._paused||e instanceof g&&e._hasPausedChild())return!0;e=e._next}return!1},r.getChildren=function(e,t,r,n){n=n||-9999999999;for(var i=[],o=this._first,a=0;o;)o._startTime=r&&(i._startTime+=e),i=i._next;if(t)for(n in o)o[n]>=r&&(o[n]+=e);return this._uncache(!0)},r._kill=function(e,t){if(!e&&!t)return this._enabled(!1,!1);for(var r=t?this.getTweensOf(t):this.getChildren(!0,!0,!1),n=r.length,i=!1;-1<--n;)r[n]._kill(e,t)&&(i=!0);return i},r.clear=function(e){var t=this.getChildren(!1,!0,!0),r=t.length;for(this._time=this._totalTime=0;-1<--r;)t[r]._enabled(!1,!1);return!1!==e&&(this._labels={}),this._uncache(!0)},r.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return f.prototype.invalidate.call(this)},r._enabled=function(e,t){if(e===this._gc)for(var r=this._first;r;)r._enabled(e,!0),r=r._next;return h.prototype._enabled.call(this,e,t)},r.totalTime=function(e,t,r){this._forcingPlayhead=!0;var n=f.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,n},r.duration=function(e){return arguments.length?(0!==this.duration()&&0!==e&&this.timeScale(this._duration/e),this):(this._dirty&&this.totalDuration(),this._duration)},r.totalDuration=function(e){if(arguments.length)return e&&this.totalDuration()?this.timeScale(this._totalDuration/e):this;if(this._dirty){for(var t,r,n=0,i=this,o=i._last,a=999999999999;o;)t=o._prev,o._dirty&&o.totalDuration(),o._startTime>a&&i._sortChildren&&!o._paused&&!i._calculatingDuration?(i._calculatingDuration=1,i.add(o,o._startTime-o._delay),i._calculatingDuration=0):a=o._startTime,o._startTime<0&&!o._paused&&(n-=o._startTime,i._timeline.smoothChildTiming&&(i._startTime+=o._startTime/i._timeScale,i._time-=o._startTime,i._totalTime-=o._startTime,i._rawPrevTime-=o._startTime),i.shiftChildren(-o._startTime,!1,-9999999999),a=0),n<(r=o._startTime+o._totalDuration/o._timeScale)&&(n=r),o=t;i._duration=i._totalDuration=n,i._dirty=!1}return this._totalDuration},r.paused=function(e){if(!1===e&&this._paused)for(var t=this._first;t;)t._startTime===this._time&&"isPause"===t.data&&(t._rawPrevTime=0),t=t._next;return f.prototype.paused.apply(this,arguments)},r.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===f._rootFramesTimeline},r.rawTime=function(e){return e&&(this._paused||this._repeat&&0=r&&ethis._duration?this._duration:e,t)):this._time},i.totalTime=function(e,t,r){if(v||m.wake(),!arguments.length)return this._totalTime;if(this._timeline){if(e<0&&!r&&(e+=this.totalDuration()),this._timeline.smoothChildTiming){this._dirty&&this.totalDuration();var n=this._totalDuration,i=this._timeline;if(no;)i=i._prev;return i?(e._next=i._next,i._next=e):(e._next=this._first,this._first=e),e._next?e._next._prev=e:this._last=e,e._prev=i,this._recent=e,this._timeline&&this._uncache(!0),this},i._remove=function(e,t){return e.timeline===this&&(t||e._enabled(!1,!0),e._prev?e._prev._next=e._next:this._first===e&&(this._first=e._next),e._next?e._next._prev=e._prev:this._last===e&&(this._last=e._prev),e._next=e._prev=e.timeline=null,e===this._recent&&(this._recent=this._last),this._timeline&&this._uncache(!0)),this},i.render=function(e,t,r){var n,i=this._first;for(this._totalTime=this._time=this._rawPrevTime=e;i;)n=i._next,(i._active||e>=i._startTime&&!i._paused&&!i._gc)&&(i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(e-i._startTime)*i._timeScale,t,r):i.render((e-i._startTime)*i._timeScale,t,r)),i=n},i.rawTime=function(){return v||m.wake(),this._totalTime};var L=S("TweenLite",function(e,t,r){if(R.call(this,t,r),this.render=L.prototype.render,null==e)throw"Cannot tween a null target.";this.target=e="string"!=typeof e?e:L.selector(e)||e;var n,i,o,a=e.jquery||e.length&&e!==h&&e[0]&&(e[0]===h||e[0].nodeType&&e[0].style&&!e.nodeType),s=this.vars.overwrite;if(this._overwrite=s=null==s?Z[L.defaultOverwrite]:"number"==typeof s?s>>0:Z[s],(a||e instanceof Array||e.push&&x(e))&&"number"!=typeof e[0])for(this._targets=o=u(e),this._propLookup=[],this._siblings=[],n=0;n=Q){for(r in Q=m.frame+(parseInt(L.autoSleep,10)||120),W){for(e=(t=W[r].tweens).length;-1<--e;)t[e]._gc&&t.splice(e,1);0===t.length&&delete W[r]}if((!(r=$._first)||r._paused)&&L.autoSleep&&!J._first&&1===m._listeners.tick.length){for(;r&&r._paused;)r=r._next;r||m.sleep()}}},m.addEventListener("tick",R._updateRoot);var te=function(e,t,r){var n,i,o=e._gsTweenID;if(W[o||(e._gsTweenID=o="t"+V++)]||(W[o]={target:e,tweens:[]}),t&&((n=W[o].tweens)[i=n.length]=t,r))for(;-1<--i;)n[i]===t&&n.splice(i,1);return W[o].tweens},re=function(e,t,r,n){var i,o,a=e.vars.onOverwrite;return a&&(i=a(e,t,r,n)),(a=L.onOverwrite)&&(o=a(e,t,r,n)),!1!==i&&!1!==o},ne=function(e,t,r,n,i){var o,a,s,u;if(1===n||4<=n){for(u=i.length,o=0;oc&&((d||!s._initted)&&c-s._startTime<=2e-8||(f[h++]=s)));for(o=h;-1<--o;)if(u=(s=f[o])._firstPT,2===n&&s._kill(r,e,t)&&(a=!0),2!==n||!s._firstPT&&s._initted&&u){if(2!==n&&!re(s,t))continue;s._enabled(!1,!1)&&(a=!0)}return a},ie=function(e,t,r){for(var n=e._timeline,i=n._timeScale,o=e._startTime;n._timeline;){if(o+=n._startTime,i*=n._timeScale,n._paused)return-100;n=n._timeline}return t<(o/=i)?o-t:r&&o===t||!e._initted&&o-t<2e-8?y:(o+=e.totalDuration()/e._timeScale/i)>t+y?0:o-t-y};i._init=function(){var e,t,r,n,i,o,a=this.vars,s=this._overwrittenProps,u=this._duration,l=!!a.immediateRender,c=a.ease,f=this._startAt;if(a.startAt){for(n in f&&(f.render(-1,!0),f.kill()),i={},a.startAt)i[n]=a.startAt[n];if(i.data="isStart",i.overwrite=!1,i.immediateRender=!0,i.lazy=l&&!1!==a.lazy,i.startAt=i.delay=null,i.onUpdate=a.onUpdate,i.onUpdateParams=a.onUpdateParams,i.onUpdateScope=a.onUpdateScope||a.callbackScope||this,this._startAt=L.to(this.target||{},0,i),l)if(0s.pr;)n=n._next;(s._prev=n?n._prev:o)?s._prev._next=s:i=s,(s._next=n)?n._prev=s:o=s,s=a}s=t._firstPT=i}for(;s;)s.pg&&"function"==typeof s.t[e]&&s.t[e]()&&(r=!0),s=s._next;return r},oe.activate=function(e){for(var t=e.length;-1<--t;)e[t].API===oe.API&&(G[(new e[t])._propName]=e[t]);return!0},s.plugin=function(e){if(!(e&&e.propName&&e.init&&e.API))throw"illegal plugin definition.";var t,r=e.propName,n=e.priority||0,i=e.overwriteProps,o={init:"_onInitTween",set:"setRatio",kill:"_kill",round:"_mod",mod:"_mod",initAll:"_onInitAllProps"},a=S("plugins."+r.charAt(0).toUpperCase()+r.substr(1)+"Plugin",function(){oe.call(this,r,n),this._overwriteProps=i||[]},!0===e.global),s=a.prototype=new oe(r);for(t in(s.constructor=a).API=e.API,o)"function"==typeof e[t]&&(s[o[t]]=e[t]);return a.version=e.version,oe.activate([a]),a},t=h._gsQueue){for(r=0;r>0,0!==h._cycle&&h._cycle===h._totalTime/a&&g<=e&&h._cycle--,h._time=h._totalTime-h._cycle*a,h._yoyo&&0!=(1&h._cycle)&&(h._time=v-h._time,(f=h._yoyoEase||h.vars.yoyoEase)&&(h._yoyoEase||(!0!==f||h._initted?h._yoyoEase=f=!0===f?h._ease:f instanceof Ease?f:Ease.map[f]:(f=h.vars.ease,h._yoyoEase=f=f?f instanceof Ease?f:"function"==typeof f?new Ease(f,h.vars.easeParams):Ease.map[f]||y.defaultEase:y.defaultEase)),h.ratio=f?1-f.getRatio((v-h._time)/v):0)),h._time>v?h._time=v:h._time<0&&(h._time=0)),h._easeType&&!f?(s=h._time/v,(1===(u=h._easeType)||3===u&&.5<=s)&&(s=1-s),3===u&&(s*=2),1===(l=h._easePower)?s*=s:2===l?s*=s*s:3===l?s*=s*s*s:4===l&&(s*=s*s*s*s),h.ratio=1===u?1-s:2===u?s:h._time/v<.5?s/2:1-s/2):f||(h.ratio=h._ease.getRatio(h._time/v))),p!==h._time||r||m!==h._cycle){if(!h._initted){if(h._init(),!h._initted||h._gc)return;if(!r&&h._firstPT&&(!1!==h.vars.lazy&&h._duration||h.vars.lazy&&!h._duration))return h._time=p,h._totalTime=g,h._rawPrevTime=_,h._cycle=m,x.lazyTweens.push(h),void(h._lazy=[e,t]);!h._time||n||f?n&&this._ease._calcEnd&&!f&&(h.ratio=h._ease.getRatio(0===h._time?0:1)):h.ratio=h._ease.getRatio(h._time/v)}for(!1!==h._lazy&&(h._lazy=!1),h._active||!h._paused&&h._time!==p&&0<=e&&(h._active=!0),0===g&&(2===h._initted&&0e._startTime;u._timeline;)l&&u._timeline.smoothChildTiming?u.totalTime(u._totalTime,!0):u._gc&&u._enabled(!0,!1),u=u._timeline;return c},r.remove=function(e){if(e instanceof f){this._remove(e,!1);var t=e._timeline=e.vars.useFrames?f._rootFramesTimeline:f._rootTimeline;return e._startTime=(e._paused?e._pauseTime:t._time)-(e._reversed?e.totalDuration()-e._totalTime:e._totalTime)/e._timeScale,this}if(e instanceof Array||e&&e.push&&d(e)){for(var r=e.length;-1<--r;)this.remove(e[r]);return this}return"string"==typeof e?this.removeLabel(e):this.kill(null,e)},r._remove=function(e,t){return h.prototype._remove.call(this,e,t),this._last?this._time>this.duration()&&(this._time=this._duration,this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},r.append=function(e,t){return this.add(e,this._parseTimeOrLabel(null,t,!0,e))},r.insert=r.insertMultiple=function(e,t,r,n){return this.add(e,t||0,r,n)},r.appendMultiple=function(e,t,r,n){return this.add(e,this._parseTimeOrLabel(null,t,!0,e),r,n)},r.addLabel=function(e,t){return this._labels[e]=this._parseTimeOrLabel(t),this},r.addPause=function(e,t,r,n){var i=p.delayedCall(0,o,r,n||this);return i.vars.onComplete=i.vars.onReverseComplete=t,i.data="isPause",this._hasPause=!0,this.add(i,e)},r.removeLabel=function(e){return delete this._labels[e],this},r.getLabelTime=function(e){return null!=this._labels[e]?this._labels[e]:-1},r._parseTimeOrLabel=function(e,t,r,n){var i,o;if(n instanceof f&&n.timeline===this)this.remove(n);else if(n&&(n instanceof Array||n.push&&d(n)))for(o=n.length;-1<--o;)n[o]instanceof f&&n[o].timeline===this&&this.remove(n[o]);if(i="number"!=typeof e||t?99999999999=e&&!u;)n._duration||"isPause"===n.data&&0f._time;)u.render(u._reversed?u.totalDuration()-(e-u._startTime)*u._timeScale:(e-u._startTime)*u._timeScale,t,r),u=u._prev;u=null,f.pause(),f._pauseTime=c}n._reversed?n.render((n._dirty?n.totalDuration():n._totalDuration)-(e-n._startTime)*n._timeScale,t,r):n.render((e-n._startTime)*n._timeScale,t,r)}n=o}f._onUpdate&&(t||(v.length&&_(),f._callback("onUpdate"))),a&&(f._gc||p!==f._startTime&&g===f._timeScale||(0===f._time||d>=f.totalDuration())&&(i&&(v.length&&_(),f._timeline.autoRemoveChildren&&f._enabled(!1,!1),f._active=!1),!t&&f.vars[a]&&f._callback(a)))}},r._hasPausedChild=function(){for(var e=this._first;e;){if(e._paused||e instanceof g&&e._hasPausedChild())return!0;e=e._next}return!1},r.getChildren=function(e,t,r,n){n=n||-9999999999;for(var i=[],o=this._first,a=0;o;)o._startTime=r&&(i._startTime+=e),i=i._next;if(t)for(n in o)o[n]>=r&&(o[n]+=e);return this._uncache(!0)},r._kill=function(e,t){if(!e&&!t)return this._enabled(!1,!1);for(var r=t?this.getTweensOf(t):this.getChildren(!0,!0,!1),n=r.length,i=!1;-1<--n;)r[n]._kill(e,t)&&(i=!0);return i},r.clear=function(e){var t=this.getChildren(!1,!0,!0),r=t.length;for(this._time=this._totalTime=0;-1<--r;)t[r]._enabled(!1,!1);return!1!==e&&(this._labels={}),this._uncache(!0)},r.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return f.prototype.invalidate.call(this)},r._enabled=function(e,t){if(e===this._gc)for(var r=this._first;r;)r._enabled(e,!0),r=r._next;return h.prototype._enabled.call(this,e,t)},r.totalTime=function(e,t,r){this._forcingPlayhead=!0;var n=f.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,n},r.duration=function(e){return arguments.length?(0!==this.duration()&&0!==e&&this.timeScale(this._duration/e),this):(this._dirty&&this.totalDuration(),this._duration)},r.totalDuration=function(e){if(arguments.length)return e&&this.totalDuration()?this.timeScale(this._totalDuration/e):this;if(this._dirty){for(var t,r,n=0,i=this,o=i._last,a=999999999999;o;)t=o._prev,o._dirty&&o.totalDuration(),o._startTime>a&&i._sortChildren&&!o._paused&&!i._calculatingDuration?(i._calculatingDuration=1,i.add(o,o._startTime-o._delay),i._calculatingDuration=0):a=o._startTime,o._startTime<0&&!o._paused&&(n-=o._startTime,i._timeline.smoothChildTiming&&(i._startTime+=o._startTime/i._timeScale,i._time-=o._startTime,i._totalTime-=o._startTime,i._rawPrevTime-=o._startTime),i.shiftChildren(-o._startTime,!1,-9999999999),a=0),n<(r=o._startTime+o._totalDuration/o._timeScale)&&(n=r),o=t;i._duration=i._totalDuration=n,i._dirty=!1}return this._totalDuration},r.paused=function(e){if(!1===e&&this._paused)for(var t=this._first;t;)t._startTime===this._time&&"isPause"===t.data&&(t._rawPrevTime=0),t=t._next;return f.prototype.paused.apply(this,arguments)},r.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===f._rootFramesTimeline},r.rawTime=function(e){return e&&(this._paused||this._repeat&&0>0,h._cycle&&h._cycle===h._totalTime/u&&m<=e&&h._cycle--,h._time=h._totalTime-h._cycle*u,h._yoyo&&1&h._cycle&&(h._time=g-h._time),h._time>g?e=(h._time=g)+1e-4:h._time<0?h._time=e=0:e=h._time)),h._hasPause&&!h._forcingPlayhead&&!t){if(d<=(e=h._time)||h._repeat&&x!==h._cycle)for(n=h._first;n&&n._startTime<=e&&!l;)n._duration||"isPause"!==n.data||n.ratio||0===n._startTime&&0===h._rawPrevTime||(l=n),n=n._next;else for(n=h._last;n&&n._startTime>=e&&!l;)n._duration||"isPause"===n.data&&0h._time;)l.render(l._reversed?l.totalDuration()-(e-l._startTime)*l._timeScale:(e-l._startTime)*l._timeScale,t,r),l=l._prev;l=null,h.pause(),h._pauseTime=f}n._reversed?n.render((n._dirty?n.totalDuration():n._totalDuration)-(e-n._startTime)*n._timeScale,t,r):n.render((e-n._startTime)*n._timeScale,t,r)}n=o}h._onUpdate&&(t||(E.length&&A(),h._callback("onUpdate"))),a&&(h._locked||h._gc||v!==h._startTime&&_===h._timeScale||(0===h._time||p>=h.totalDuration())&&(i&&(E.length&&A(),h._timeline.autoRemoveChildren&&h._enabled(!1,!1),h._active=!1),!t&&h.vars[a]&&h._callback(a)))}else m!==h._totalTime&&h._onUpdate&&(t||h._callback("onUpdate"))},i.getActive=function(e,t,r){var n,i,o=[],a=this.getChildren(e||null==e,t||null==e,!!r),s=0,u=a.length;for(n=0;ne)return r[t].name;return null},i.getLabelBefore=function(e){null==e&&(e=this._time);for(var t=this.getLabelsArray(),r=t.length;-1<--r;)if(t[r].time>0||6)-1,f=[],h=[];for(r in e)p(e[r],a,t);for(i=a.length,n=0;n>0]=h,s[o]=l,u=0,h=[]);return{length:l,lengths:s,segments:f}}(this._beziers,this._timeRes);this._length=h.length,this._lengths=h.lengths,this._segments=h.segments,this._l1=this._li=this._s1=this._si=0,this._l2=this._lengths[0],this._curSeg=this._segments[0],this._s2=this._curSeg[0],this._prec=1/this._curSeg.length}if(f=this._autoRotate)for(this._initialRotations=[],f[0]instanceof Array||(this._autoRotate=f=[f]),o=f.length;-1<--o;){for(a=0;a<3;a++)n=f[o][a],this._func[n]="function"==typeof e[n]&&e[n.indexOf("set")||"function"!=typeof e["get"+n.substr(3)]?n:"get"+n.substr(3)];n=f[o][2],this._initialRotations[o]=(this._func[n]?this._func[n].call(this._target):this._target[n])||0,this._overwriteProps.push(n)}return this._startRatio=r.vars.runBackwards?1:0,!0},set:function(e){var t,r,n,i,o,a,s,u,l,c,f=this._segCount,h=this._func,d=this._target,p=e!==this._startRatio;if(this._timeRes){if(l=this._lengths,c=this._curSeg,e*=this._length,n=this._li,e>this._l2&&n=e;);0===n&&ethis._s2&&n=e;);0===n&&e>0)*(1/f))*f;for(r=1-a,n=this._props.length;-1<--n;)i=this._props[n],s=(a*a*(o=this._beziers[i][t]).da+3*r*(a*o.ca+r*o.ba))*a+o.a,this._mod[i]&&(s=this._mod[i](s,d)),h[i]?d[i](s):d[i]=s;if(this._autoRotate){var g,m,v,_,y,b,x,w=this._autoRotate;for(n=w.length;-1<--n;)i=w[n][2],b=w[n][3]||0,x=!0===w[n][4]?1:T,o=this._beziers[w[n][0]],g=this._beziers[w[n][1]],o&&g&&(o=o[t],g=g[t],m=o.a+(o.b-o.a)*a,m+=((_=o.b+(o.c-o.b)*a)-m)*a,_+=(o.c+(o.d-o.c)*a-_)*a,v=g.a+(g.b-g.a)*a,v+=((y=g.b+(g.c-g.b)*a)-v)*a,y+=(g.c+(g.d-g.c)*a-y)*a,s=p?Math.atan2(y-v,_-m)*x+b:this._initialRotations[n],this._mod[i]&&(s=this._mod[i](s,d)),h[i]?d[i](s):d[i]=s)}}}),e=m.prototype,m.bezierThrough=d,m.cubicToQuadratic=M,m._autoCSS=!0,m.quadraticToCubic=function(e,t,r){return new _(e,(2*t+e)/3,(2*t+r)/3,r)},m._cssRegister=function(){var e=r.CSSPlugin;if(e){var t=e._internals,d=t._parseToProxy,p=t._setPluginRatio,g=t.CSSPropTween;t._registerComplexSpecialProp("bezier",{parser:function(e,t,r,n,i,o){t instanceof Array&&(t={values:t}),o=new m;var a,s,u,l=t.values,c=l.length-1,f=[],h={};if(c<0)return i;for(a=0;a<=c;a++)u=d(e,l[a],n,i,o,c!==a),f[a]=u.end;for(s in t)h[s]=t[s];return h.values=f,(i=new g(e,"bezier",0,0,u.pt,2)).data=u,i.plugin=o,i.setRatio=p,0===h.autoRotate&&(h.autoRotate=!0),!h.autoRotate||h.autoRotate instanceof Array||(a=!0===h.autoRotate?0:Number(h.autoRotate),h.autoRotate=null!=u.end.left?[["left","top","rotation",a,!1]]:null!=u.end.x&&[["x","y","rotation",a,!1]]),h.autoRotate&&(n._transform||n._enableTransforms(!1),u.autoRotate=n._target._gsTransform,u.proxy.rotation=u.autoRotate.rotation||0,n._overwriteProps.push("rotation")),o._onInitTween(u.proxy,h,n._tween),i}})}},e._mod=function(e){for(var t,r=this._overwriteProps,n=r.length;-1<--n;)(t=e[r[n]])&&"function"==typeof t&&(this._mod[r[n]]=t)},e._kill=function(e){var t,r,n=this._props;for(t in this._beziers)if(t in e)for(delete this._beziers[t],delete this._func[t],r=n.length;-1<--r;)n[r]===t&&n.splice(r,1);if(n=this._autoRotate)for(r=n.length;-1<--r;)e[n[r][2]]&&n.splice(r,1);return this._super._kill.call(this,e)},_gsScope._gsDefine("plugins.CSSPlugin",["plugins.TweenPlugin","TweenLite"],function(o,z){var p,S,M,g,U=function(){o.call(this,"css"),this._overwriteProps.length=0,this.setRatio=U.prototype.setRatio},l=_gsScope._gsDefine.globals,m={},e=U.prototype=new o("css");(e.constructor=U).version="2.1.0",U.API=2,U.defaultTransformPerspective=0,U.defaultSkewType="compensated",U.defaultSmoothOrigin=!0,e="px",U.suffixMap={top:e,right:e,bottom:e,left:e,width:e,height:e,fontSize:e,padding:e,margin:e,perspective:e,lineHeight:""};var C,v,_,j,y,P,k,E,t,r,A=/(?:\-|\.|\b)(\d|\.|e\-)+/g,O=/(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g,b=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi,c=/(?![+-]?\d*\.?\d+|[+-]|e[+-]\d+)[^0-9]/g,R=/(?:\d|\-|\+|=|#|\.)*/g,I=/opacity *= *([^)]*)/i,x=/opacity:([^;]*)/i,a=/alpha\(opacity *=.+?\)/i,w=/^(rgb|hsl)/,s=/([A-Z])/g,u=/-([a-z])/gi,T=/(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi,f=function(e,t){return t.toUpperCase()},d=/(?:Left|Right|Width)/i,h=/(M11|M12|M21|M22)=[\d\-\.e]+/gi,D=/progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i,L=/,(?=[^\)]*(?:\(|$))/gi,N=/[\s,\(]/i,F=Math.PI/180,X=180/Math.PI,B={},n={style:{}},q=_gsScope.document||{createElement:function(){return n}},H=function(e,t){return t&&q.createElementNS?q.createElementNS(t,e):q.createElement(e)},Y=H("div"),G=H("img"),i=U._internals={_specialProps:m},W=(_gsScope.navigator||{}).userAgent||"",V=(t=W.indexOf("Android"),r=H("a"),_=-1!==W.indexOf("Safari")&&-1===W.indexOf("Chrome")&&(-1===t||3>16,e>>8&255,255&e];else{if(","===e.charAt(e.length-1)&&(e=e.substr(0,e.length-1)),pe[e])r=pe[e];else if("#"===e.charAt(0))4===e.length&&(e="#"+(n=e.charAt(1))+n+(i=e.charAt(2))+i+(o=e.charAt(3))+o),r=[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e];else if("hsl"===e.substr(0,3))if(r=h=e.match(A),t){if(-1!==e.indexOf("="))return e.match(O)}else a=Number(r[0])%360/360,s=Number(r[1])/100,n=2*(u=Number(r[2])/100)-(i=u<=.5?u*(s+1):u+s-u*s),3n--)for(;++nn--)for(;++n>0];return n.parse(e,a,i,o)}},xe=(i._setPluginRatio=function(e){this.plugin.setRatio(e);for(var t,r,n,i,o,a=this.data,s=a.proxy,u=a.firstMPT;u;)t=s[u.v],u.r?t=u.r(t):t<1e-6&&-1e-6s.length?u.length:s.length,a=0;ao.pr;)a=a._next;(o._prev=a?a._prev:u)?o._prev._next=o:s=o,(o._next=a)?a._prev=o:u=o,o=l}this._firstPT=s}return!0},e.parse=function(e,t,r,n){var i,o,a,s,u,l,c,f,h,d,p=e.style;for(i in t){if(l=t[i],o=m[i],"function"!=typeof l||o&&o.allowFunc||(l=l(E,k)),o)r=o.parse(e,l,i,this,r,n,t);else{if("--"===i.substr(0,2)){this._tween._propLookup[i]=this._addTween.call(this._tween,e.style,"setProperty",te(e).getPropertyValue(i)+"",l+"",i,!1,i);continue}u=re(e,i,M)+"",h="string"==typeof l,"color"===i||"fill"===i||"stroke"===i||-1!==i.indexOf("Color")||h&&w.test(l)?(h||(l=(3<(l=me(l)).length?"rgba(":"rgb(")+l.join(",")+")"),r=Se(p,i,u,l,!0,"transparent",r,0,n)):h&&N.test(l)?r=Se(p,i,u,l,!0,null,r,0,n):(c=(a=parseFloat(u))||0===a?u.substr((a+"").length):"",""!==u&&"auto"!==u||(c="width"===i||"height"===i?(a=le(e,i,M),"px"):"left"===i||"top"===i?(a=ie(e,i,M),"px"):(a="opacity"!==i?0:1,"")),""===(f=(d=h&&"="===l.charAt(1))?(s=parseInt(l.charAt(0)+"1",10),l=l.substr(2),s*=parseFloat(l),l.replace(R,"")):(s=parseFloat(l),h?l.replace(R,""):""))&&(f=i in S?S[i]:c),l=s||0===s?(d?s+a:s)+f:t[i],c!==f&&(""===f&&"lineHeight"!==i||(s||0===s)&&a&&(a=ne(e,i,a,c),"%"===f?(a/=ne(e,i,100,"%")/100,!0!==t.strictUnits&&(u=a+"%")):"em"===f||"rem"===f||"vw"===f||"vh"===f?a/=ne(e,i,1,f):"px"!==f&&(s=ne(e,i,s,f),f="px"),d&&(s||0===s)&&(l=s+a+f))),d&&(s+=a),!a&&0!==a||!s&&0!==s?void 0!==p[i]&&(l||l+""!="NaN"&&null!=l)?(r=new we(p,i,s||a||0,0,r,-1,i,!1,0,u,l)).xs0="none"!==l||"display"!==i&&-1===i.indexOf("Style")?l:u:Z("invalid "+i+" tween value: "+t[i]):(r=new we(p,i,a,s-a,r,0,i,!1!==C&&("px"===f||"zIndex"===i),0,u,l)).xs0=f)}n&&r&&!r.plugin&&(r.plugin=n)}return r},e.setRatio=function(e){var t,r,n,i=this._firstPT;if(1!==e||this._tween._time!==this._tween._duration&&0!==this._tween._time)if(e||this._tween._time!==this._tween._duration&&0!==this._tween._time||-1e-6===this._tween._rawPrevTime)for(;i;){if(t=i.c*e+i.s,i.r?t=i.r(t):t<1e-6&&-1e-6this._p3?this._calcEnd?1===e?0:1-(e=(e-this._p3)/this._p1)*e:t+(e-t)*(e=(e-this._p3)/this._p1)*e*e*e:this._calcEnd?1:t},p.ease=new p(.7,.7),g.config=p.config=function(e,t,r){return new p(e,t,r)},(g=(r=u("easing.SteppedEase",function(e,t){e=e||1,this._p1=1/e,this._p2=e+(t?0:1),this._p3=t?1:0},!0)).prototype=new m).constructor=r,g.getRatio=function(e){return e<0?e=0:1<=e&&(e=.999999999),((this._p2*e|0)+this._p3)*this._p1},g.config=r.config=function(e,t){return new r(e,t)},(g=(n=u("easing.ExpoScaleEase",function(e,t,r){this._p1=Math.log(t/e),this._p2=t-e,this._p3=e,this._ease=r},!0)).prototype=new m).constructor=n,g.getRatio=function(e){return this._ease&&(e=this._ease.getRatio(e)),(this._p3*Math.exp(this._p1*e)-this._p3)/this._p2},g.config=n.config=function(e,t,r){return new n(e,t,r)},(g=(t=u("easing.RoughEase",function(e){for(var t,r,n,i,o,a,s=(e=e||{}).taper||"none",u=[],l=0,c=0|(e.points||20),f=c,h=!1!==e.randomize,d=!0===e.clamp,p=e.template instanceof m?e.template:null,g="number"==typeof e.strength?.4*e.strength:.4;-1<--f;)t=h?Math.random():1/c*f,r=p?p.getRatio(t):t,n="none"===s?g:"out"===s?(i=1-t)*i*g:"in"===s?t*t*g:t<.5?(i=2*t)*i*.5*g:(i=2*(1-t))*i*.5*g,h?r+=Math.random()*n-.5*n:f%2?r+=.5*n:r-=.5*n,d&&(1t.t){for(;t.next&&e>=t.t;)t=t.next;t=t.prev}else for(;t.prev&&e<=t.t;)t=t.prev;return(this._prev=t).v+(e-t.t)/t.gap*t.c},g.config=function(e){return new t(e)},t.ease=new t,f("Bounce",l("BounceOut",function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}),l("BounceIn",function(e){return(e=1-e)<1/2.75?1-7.5625*e*e:e<2/2.75?1-(7.5625*(e-=1.5/2.75)*e+.75):e<2.5/2.75?1-(7.5625*(e-=2.25/2.75)*e+.9375):1-(7.5625*(e-=2.625/2.75)*e+.984375)}),l("BounceInOut",function(e){var t=e<.5;return(e=t?1-2*e:2*e-1)<1/2.75?e*=7.5625*e:e=e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,t?.5*(1-e):.5*e+.5})),f("Circ",l("CircOut",function(e){return Math.sqrt(1-(e-=1)*e)}),l("CircIn",function(e){return-(Math.sqrt(1-e*e)-1)}),l("CircInOut",function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)})),f("Elastic",(e=function(e,t,r){var n=u("easing."+e,function(e,t){this._p1=1<=e?e:1,this._p2=(t||r)/(e<1?e:1),this._p3=this._p2/a*(Math.asin(1/this._p1)||0),this._p2=a/this._p2},!0),i=n.prototype=new m;return i.constructor=n,i.getRatio=t,i.config=function(e,t){return new n(e,t)},n})("ElasticOut",function(e){return this._p1*Math.pow(2,-10*e)*Math.sin((e-this._p3)*this._p2)+1},.3),e("ElasticIn",function(e){return-this._p1*Math.pow(2,10*(e-=1))*Math.sin((e-this._p3)*this._p2)},.3),e("ElasticInOut",function(e){return(e*=2)<1?this._p1*Math.pow(2,10*(e-=1))*Math.sin((e-this._p3)*this._p2)*-.5:this._p1*Math.pow(2,-10*(e-=1))*Math.sin((e-this._p3)*this._p2)*.5+1},.45)),f("Expo",l("ExpoOut",function(e){return 1-Math.pow(2,-10*e)}),l("ExpoIn",function(e){return Math.pow(2,10*(e-1))-.001}),l("ExpoInOut",function(e){return(e*=2)<1?.5*Math.pow(2,10*(e-1)):.5*(2-Math.pow(2,-10*(e-1)))})),f("Sine",l("SineOut",function(e){return Math.sin(e*s)}),l("SineIn",function(e){return 1-Math.cos(e*s)}),l("SineInOut",function(e){return-.5*(Math.cos(Math.PI*e)-1)})),u("easing.EaseLookup",{find:function(e){return m.map[e]}},!0),c(i.SlowMo,"SlowMo","ease,"),c(t,"RoughEase","ease,"),c(r,"SteppedEase","ease,"),d},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(h,d){"use strict";var p={},n=h.document,g=h.GreenSockGlobals=h.GreenSockGlobals||h,e=g[d];if(e)return"undefined"!=typeof module&&module.exports&&(module.exports=e);var t,r,i,m,v,o,a,_=function(e){var t,r=e.split("."),n=g;for(t=0;t=r&&ethis._duration?this._duration:e,t)):this._time},i.totalTime=function(e,t,r){if(v||m.wake(),!arguments.length)return this._totalTime;if(this._timeline){if(e<0&&!r&&(e+=this.totalDuration()),this._timeline.smoothChildTiming){this._dirty&&this.totalDuration();var n=this._totalDuration,i=this._timeline;if(no;)i=i._prev;return i?(e._next=i._next,i._next=e):(e._next=this._first,this._first=e),e._next?e._next._prev=e:this._last=e,e._prev=i,this._recent=e,this._timeline&&this._uncache(!0),this},i._remove=function(e,t){return e.timeline===this&&(t||e._enabled(!1,!0),e._prev?e._prev._next=e._next:this._first===e&&(this._first=e._next),e._next?e._next._prev=e._prev:this._last===e&&(this._last=e._prev),e._next=e._prev=e.timeline=null,e===this._recent&&(this._recent=this._last),this._timeline&&this._uncache(!0)),this},i.render=function(e,t,r){var n,i=this._first;for(this._totalTime=this._time=this._rawPrevTime=e;i;)n=i._next,(i._active||e>=i._startTime&&!i._paused&&!i._gc)&&(i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(e-i._startTime)*i._timeScale,t,r):i.render((e-i._startTime)*i._timeScale,t,r)),i=n},i.rawTime=function(){return v||m.wake(),this._totalTime};var L=S("TweenLite",function(e,t,r){if(R.call(this,t,r),this.render=L.prototype.render,null==e)throw"Cannot tween a null target.";this.target=e="string"!=typeof e?e:L.selector(e)||e;var n,i,o,a=e.jquery||e.length&&e!==h&&e[0]&&(e[0]===h||e[0].nodeType&&e[0].style&&!e.nodeType),s=this.vars.overwrite;if(this._overwrite=s=null==s?Z[L.defaultOverwrite]:"number"==typeof s?s>>0:Z[s],(a||e instanceof Array||e.push&&x(e))&&"number"!=typeof e[0])for(this._targets=o=u(e),this._propLookup=[],this._siblings=[],n=0;n=Q){for(r in Q=m.frame+(parseInt(L.autoSleep,10)||120),W){for(e=(t=W[r].tweens).length;-1<--e;)t[e]._gc&&t.splice(e,1);0===t.length&&delete W[r]}if((!(r=$._first)||r._paused)&&L.autoSleep&&!J._first&&1===m._listeners.tick.length){for(;r&&r._paused;)r=r._next;r||m.sleep()}}},m.addEventListener("tick",R._updateRoot);var te=function(e,t,r){var n,i,o=e._gsTweenID;if(W[o||(e._gsTweenID=o="t"+V++)]||(W[o]={target:e,tweens:[]}),t&&((n=W[o].tweens)[i=n.length]=t,r))for(;-1<--i;)n[i]===t&&n.splice(i,1);return W[o].tweens},re=function(e,t,r,n){var i,o,a=e.vars.onOverwrite;return a&&(i=a(e,t,r,n)),(a=L.onOverwrite)&&(o=a(e,t,r,n)),!1!==i&&!1!==o},ne=function(e,t,r,n,i){var o,a,s,u;if(1===n||4<=n){for(u=i.length,o=0;oc&&((d||!s._initted)&&c-s._startTime<=2e-8||(f[h++]=s)));for(o=h;-1<--o;)if(u=(s=f[o])._firstPT,2===n&&s._kill(r,e,t)&&(a=!0),2!==n||!s._firstPT&&s._initted&&u){if(2!==n&&!re(s,t))continue;s._enabled(!1,!1)&&(a=!0)}return a},ie=function(e,t,r){for(var n=e._timeline,i=n._timeScale,o=e._startTime;n._timeline;){if(o+=n._startTime,i*=n._timeScale,n._paused)return-100;n=n._timeline}return t<(o/=i)?o-t:r&&o===t||!e._initted&&o-t<2e-8?y:(o+=e.totalDuration()/e._timeScale/i)>t+y?0:o-t-y};i._init=function(){var e,t,r,n,i,o,a=this.vars,s=this._overwrittenProps,u=this._duration,l=!!a.immediateRender,c=a.ease,f=this._startAt;if(a.startAt){for(n in f&&(f.render(-1,!0),f.kill()),i={},a.startAt)i[n]=a.startAt[n];if(i.data="isStart",i.overwrite=!1,i.immediateRender=!0,i.lazy=l&&!1!==a.lazy,i.startAt=i.delay=null,i.onUpdate=a.onUpdate,i.onUpdateParams=a.onUpdateParams,i.onUpdateScope=a.onUpdateScope||a.callbackScope||this,this._startAt=L.to(this.target||{},0,i),l)if(0s.pr;)n=n._next;(s._prev=n?n._prev:o)?s._prev._next=s:i=s,(s._next=n)?n._prev=s:o=s,s=a}s=t._firstPT=i}for(;s;)s.pg&&"function"==typeof s.t[e]&&s.t[e]()&&(r=!0),s=s._next;return r},oe.activate=function(e){for(var t=e.length;-1<--t;)e[t].API===oe.API&&(G[(new e[t])._propName]=e[t]);return!0},s.plugin=function(e){if(!(e&&e.propName&&e.init&&e.API))throw"illegal plugin definition.";var t,r=e.propName,n=e.priority||0,i=e.overwriteProps,o={init:"_onInitTween",set:"setRatio",kill:"_kill",round:"_mod",mod:"_mod",initAll:"_onInitAllProps"},a=S("plugins."+r.charAt(0).toUpperCase()+r.substr(1)+"Plugin",function(){oe.call(this,r,n),this._overwriteProps=i||[]},!0===e.global),s=a.prototype=new oe(r);for(t in(s.constructor=a).API=e.API,o)"function"==typeof e[t]&&(s[o[t]]=e[t]);return a.version=e.version,oe.activate([a]),a},t=h._gsQueue){for(r=0;rl.x||l.y!==u.y&&l.x===u.x||u===l?(l.cx=u.x-l.x,l.cy=u.y-l.y,l.n=u,l.nx=u.x,this.fast&&1l||i===u-1)&&(r.push(c+","+f),n=(s-f)/(a-c)),c=a,f=s;return m&&("string"==typeof m?document.querySelector(m):m).setAttribute("d",r.join(" ")),r.join(" ")},i},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(e){"use strict";var t=function(){return(_gsScope.GreenSockGlobals||_gsScope).CustomEase};"undefined"!=typeof module&&module.exports?(require("../TweenLite.js"),module.exports=t()):"function"==typeof define&&define.amd&&define(["TweenLite"],t)}();var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("easing.CustomWiggle",["easing.CustomEase","easing.Ease"],function(r,n){var e,m={easeOut:new r("","M0,1,C0.7,1,0.6,0,1,0"),easeInOut:new r("","M0,0,C0.104,0,0.242,1,0.444,1,0.644,1,0.608,0,1,0"),anticipate:new r("","M0,0,C0,0.222,0.024,0.386,0.06,0.402,0.181,0.455,0.647,0.646,0.7,0.67,0.9,0.76,1,0.846,1,1"),uniform:new r("","M0,0,C0,0.95,0.01,1,0.01,1,0.01,1,1,1,1,1,1,1,1,0.01,1,0")},v=new r,_=function(t,e){return(t=t.getRatio?t:n.map[t]||new r("",t)).rawBezier||!e?t:{getRatio:function(e){return 1-t.getRatio(e)}}},i=function(e,t){this.vars=t||{},r.call(this,e),this.update(this.vars)};return i.prototype=e=new r,e.constructor=i,e.update=function(e){var t,r,n,i,o,a,s,u,l,c=0|((e=e||this.vars).wiggles||10),f=1/c,h=f/2,d="anticipate"===e.type,p=m[e.type]||m.easeOut,g=v;if(d&&(g=p,p=m.easeOut),e.timingEase&&(g=_(e.timingEase)),e.amplitudeEase&&(p=_(e.amplitudeEase,!0)),u=[0,0,(a=g.getRatio(h))/4,0,a/2,s=d?-p.getRatio(h):p.getRatio(h),a,s],"random"===e.type){for(u.length=4,t=g.getRatio(f),r=2*Math.random()-1,l=2;lthis._p3?this._calcEnd?1===e?0:1-(e=(e-this._p3)/this._p1)*e:t+(e-t)*(e=(e-this._p3)/this._p1)*e*e*e:this._calcEnd?1:t},p.ease=new p(.7,.7),g.config=p.config=function(e,t,r){return new p(e,t,r)},(g=(r=u("easing.SteppedEase",function(e,t){e=e||1,this._p1=1/e,this._p2=e+(t?0:1),this._p3=t?1:0},!0)).prototype=new m).constructor=r,g.getRatio=function(e){return e<0?e=0:1<=e&&(e=.999999999),((this._p2*e|0)+this._p3)*this._p1},g.config=r.config=function(e,t){return new r(e,t)},(g=(n=u("easing.ExpoScaleEase",function(e,t,r){this._p1=Math.log(t/e),this._p2=t-e,this._p3=e,this._ease=r},!0)).prototype=new m).constructor=n,g.getRatio=function(e){return this._ease&&(e=this._ease.getRatio(e)),(this._p3*Math.exp(this._p1*e)-this._p3)/this._p2},g.config=n.config=function(e,t,r){return new n(e,t,r)},(g=(t=u("easing.RoughEase",function(e){for(var t,r,n,i,o,a,s=(e=e||{}).taper||"none",u=[],l=0,c=0|(e.points||20),f=c,h=!1!==e.randomize,d=!0===e.clamp,p=e.template instanceof m?e.template:null,g="number"==typeof e.strength?.4*e.strength:.4;-1<--f;)t=h?Math.random():1/c*f,r=p?p.getRatio(t):t,n="none"===s?g:"out"===s?(i=1-t)*i*g:"in"===s?t*t*g:t<.5?(i=2*t)*i*.5*g:(i=2*(1-t))*i*.5*g,h?r+=Math.random()*n-.5*n:f%2?r+=.5*n:r-=.5*n,d&&(1t.t){for(;t.next&&e>=t.t;)t=t.next;t=t.prev}else for(;t.prev&&e<=t.t;)t=t.prev;return(this._prev=t).v+(e-t.t)/t.gap*t.c},g.config=function(e){return new t(e)},t.ease=new t,f("Bounce",l("BounceOut",function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}),l("BounceIn",function(e){return(e=1-e)<1/2.75?1-7.5625*e*e:e<2/2.75?1-(7.5625*(e-=1.5/2.75)*e+.75):e<2.5/2.75?1-(7.5625*(e-=2.25/2.75)*e+.9375):1-(7.5625*(e-=2.625/2.75)*e+.984375)}),l("BounceInOut",function(e){var t=e<.5;return(e=t?1-2*e:2*e-1)<1/2.75?e*=7.5625*e:e=e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,t?.5*(1-e):.5*e+.5})),f("Circ",l("CircOut",function(e){return Math.sqrt(1-(e-=1)*e)}),l("CircIn",function(e){return-(Math.sqrt(1-e*e)-1)}),l("CircInOut",function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)})),f("Elastic",(e=function(e,t,r){var n=u("easing."+e,function(e,t){this._p1=1<=e?e:1,this._p2=(t||r)/(e<1?e:1),this._p3=this._p2/a*(Math.asin(1/this._p1)||0),this._p2=a/this._p2},!0),i=n.prototype=new m;return i.constructor=n,i.getRatio=t,i.config=function(e,t){return new n(e,t)},n})("ElasticOut",function(e){return this._p1*Math.pow(2,-10*e)*Math.sin((e-this._p3)*this._p2)+1},.3),e("ElasticIn",function(e){return-this._p1*Math.pow(2,10*(e-=1))*Math.sin((e-this._p3)*this._p2)},.3),e("ElasticInOut",function(e){return(e*=2)<1?this._p1*Math.pow(2,10*(e-=1))*Math.sin((e-this._p3)*this._p2)*-.5:this._p1*Math.pow(2,-10*(e-=1))*Math.sin((e-this._p3)*this._p2)*.5+1},.45)),f("Expo",l("ExpoOut",function(e){return 1-Math.pow(2,-10*e)}),l("ExpoIn",function(e){return Math.pow(2,10*(e-1))-.001}),l("ExpoInOut",function(e){return(e*=2)<1?.5*Math.pow(2,10*(e-1)):.5*(2-Math.pow(2,-10*(e-1)))})),f("Sine",l("SineOut",function(e){return Math.sin(e*s)}),l("SineIn",function(e){return 1-Math.cos(e*s)}),l("SineInOut",function(e){return-.5*(Math.cos(Math.PI*e)-1)})),u("easing.EaseLookup",{find:function(e){return m.map[e]}},!0),c(i.SlowMo,"SlowMo","ease,"),c(t,"RoughEase","ease,"),c(r,"SteppedEase","ease,"),d},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(){"use strict";var e=function(){return _gsScope.GreenSockGlobals||_gsScope};"undefined"!=typeof module&&module.exports?(require("../TweenLite.js"),module.exports=e()):"function"==typeof define&&define.amd&&define(["TweenLite"],e)}();var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("utils.Draggable",["events.EventDispatcher","TweenLite","plugins.CSSPlugin"],function(r,be,xe){var we,o,Te,S,p,g,M,P,e,t,n,i,a,Se={css:{},data:"_draggable"},Me={css:{},data:"_draggable"},Pe={css:{},data:"_draggable"},Ce={css:{}},ke=_gsScope._gsDefine.globals,s={},u=function(){return!1},l={style:{},appendChild:u,removeChild:u},Ee=_gsScope.document||{createElement:function(){return l}},Ae=Ee.documentElement||{},c=function(e){return Ee.createElementNS?Ee.createElementNS("http://www.w3.org/1999/xhtml",e):Ee.createElement(e)},f=c("div"),Oe=[],Re=180/Math.PI,Ie=999999999999999,De=Date.now||function(){return(new Date).getTime()},Le=!(Ee.addEventListener||!Ee.all),Ne=Ee.createElement("div"),je=[],Fe={},Be=0,h=/^(?:a|input|textarea|button|select)$/i,ze=0,Ue=_gsScope.navigator&&-1!==_gsScope.navigator.userAgent.toLowerCase().indexOf("android"),Xe=0,qe={},He={},Ye=function(e,t){var r,n={};if(t)for(r in e)n[r]=e[r]*t;else for(r in e)n[r]=e[r];return n},Ge=function(){for(var e=je.length;-1<--e;)je[e]()},We=function(e){for(var t=je.length;-1<--t;)je[t]===e&&je.splice(t,1);be.to(d,0,{overwrite:"all",delay:15,onComplete:d,data:"_draggable"})},d=function(){je.length||be.ticker.removeEventListener("tick",Ge)},C=function(){return null!=window.pageYOffset?window.pageYOffset:null!=Ee.scrollTop?Ee.scrollTop:Ae.scrollTop||Ee.body.scrollTop||0},k=function(){return null!=window.pageXOffset?window.pageXOffset:null!=Ee.scrollLeft?Ee.scrollLeft:Ae.scrollLeft||Ee.body.scrollLeft||0},Ve=function(e,t){lt(e,"scroll",t),Ze(e.parentNode)||Ve(e.parentNode,t)},Ke=function(e,t){ct(e,"scroll",t),Ze(e.parentNode)||Ke(e.parentNode,t)},Ze=function(e){return!(e&&e!==Ae&&e!==Ee&&e!==Ee.body&&e!==window&&e.nodeType&&e.parentNode)},m=function(e,t){var r="x"===t?"Width":"Height",n="scroll"+r,i="client"+r,o=Ee.body;return Math.max(0,Ze(e)?Math.max(Ae[n],o[n])-(window["inner"+r]||Ae[i]||o[i]):e[n]-e[i])},Je=function(e){var t=Ze(e),r=m(e,"x"),n=m(e,"y");t?e=He:Je(e.parentNode),e._gsMaxScrollX=r,e._gsMaxScrollY=n,e._gsScrollX=e.scrollLeft||0,e._gsScrollY=e.scrollTop||0},$e=function(e,t){return e=e||window.event,s.pageX=e.clientX+Ee.body.scrollLeft+Ae.scrollLeft,s.pageY=e.clientY+Ee.body.scrollTop+Ae.scrollTop,t&&(e.returnValue=!1),s},Qe=function(e){return e?("string"==typeof e&&(e=be.selector(e)),e.length&&e!==window&&e[0]&&e[0].style&&!e.nodeType&&(e=e[0]),e===window||e.nodeType&&e.style?e:null):e},v=function(e,t){var r,n,i,o=e.style;if(void 0===o[t]){for(i=["O","Moz","ms","Ms","Webkit"],n=5,r=t.charAt(0).toUpperCase()+t.substr(1);-1<--n&&void 0===o[i[n]+r];);if(n<0)return"";t=(3===n?"ms":i[n])+r}return t},et=function(e,t,r){var n=e.style;n&&(void 0===n[t]&&(t=v(e,t)),null==r?n.removeProperty?n.removeProperty(t.replace(/([A-Z])/g,"-$1").toLowerCase()):n.removeAttribute(t):void 0!==n[t]&&(n[t]=r))},_="undefined"!=typeof window?window:Ee.defaultView||{getComputedStyle:function(){}},E=function(e,t){return _.getComputedStyle(e instanceof Element?e:e.host||(e.parentNode||{}).host||e,t)},y=/(?:Left|Right|Width)/i,b=/(?:\d|\-|\+|=|#|\.)*/g,x=function(e,t,r,n,i){if("px"===n||!n)return r;if("auto"===n||!r)return 0;var o,a=y.test(t),s=e,u=f.style,l=r<0;return l&&(r=-r),"%"===n&&-1!==t.indexOf("border")?o=r/100*(a?e.clientWidth:e.clientHeight):(u.cssText="border:0 solid red;position:"+tt(e,"position",!0)+";line-height:0;","%"!==n&&s.appendChild?u[a?"borderLeftWidth":"borderTopWidth"]=r+n:(s=e.parentNode||Ee.body,u[a?"width":"height"]=r+n),s.appendChild(f),o=parseFloat(f[a?"offsetWidth":"offsetHeight"]),s.removeChild(f),0!==o||i||(o=x(e,t,r,n,!0))),l?-o:o},tt=function(e,t,r){var n,i=(e._gsTransform||{})[t];return i||0===i?i:(e.style&&e.style[t]?i=e.style[t]:(n=E(e))?i=(i=n.getPropertyValue(t.replace(/([A-Z])/g,"-$1").toLowerCase()))||n.length?i:n[t]:e.currentStyle&&(i=e.currentStyle[t]),"auto"!==i||"top"!==t&&"left"!==t||(i=function(e,t){if("absolute"!==tt(e,"position",!0))return 0;var r="left"===t?"Left":"Top",n=tt(e,"margin"+r,!0);return e["offset"+r]-(x(e,t,parseFloat(n),(n+"").replace(b,""))||0)}(e,t)),r?i:parseFloat(i)||0)},rt=function(e,t,r){var n=e.vars,i=n[r],o=e._listeners[t];"function"==typeof i&&i.apply(n[r+"Scope"]||n.callbackScope||e,n[r+"Params"]||[e.pointerEvent]),o&&e.dispatchEvent(t)},nt=function(e,t){var r,n,i,o=Qe(e);return o?q(o,t):void 0!==e.left?(i=ot(t),{left:e.left-i.x,top:e.top-i.y,width:e.width,height:e.height}):{left:n=e.min||e.minX||e.minRotation||0,top:r=e.min||e.minY||0,width:(e.max||e.maxX||e.maxRotation||0)-n,height:(e.max||e.maxY||0)-r}},A=function(){if(!Ee.createElementNS)return S=0,void(p=!1);var e,t,r,n,i=c("div"),o=Ee.createElementNS("http://www.w3.org/2000/svg","svg"),a=c("div"),s=i.style,u=Ee.body||Ae,l="flex"===tt(u,"display",!0);Ee.body&&O&&(s.position="absolute",u.appendChild(a),a.appendChild(i),n=i.offsetParent,a.style[O]="rotate(1deg)",P=i.offsetParent===n,a.style.position="absolute",s.height="10px",n=i.offsetTop,a.style.border="5px solid red",M=n!==i.offsetTop,u.removeChild(a)),s=o.style,o.setAttributeNS(null,"width","400px"),o.setAttributeNS(null,"height","400px"),o.setAttributeNS(null,"viewBox","0 0 400 400"),s.display="block",s.boxSizing="border-box",s.border="0px solid red",s.transform="none",i.style.cssText="width:100px;height:100px;overflow:scroll;-ms-overflow-style:none;",u.appendChild(i),i.appendChild(o),t=(r=o.createSVGPoint().matrixTransform(o.getScreenCTM())).y,i.scrollTop=100,r.x=r.y=0,r=r.matrixTransform(o.getScreenCTM()),g=t-r.y<100.1?0:t-r.y-150,i.removeChild(o),u.removeChild(i),u.appendChild(o),l&&(u.style.display="block"),t=(e=o.getScreenCTM()).e,s.border="50px solid red",e=o.getScreenCTM(),p=0===t&&0===e.e&&0===e.f&&1===e.a?(S=1,!0):(S=t!==e.e?1:0,1!==e.a),l&&(u.style.display="flex"),u.removeChild(o)},w=""!==v(f,"perspective"),T=v(f,"transformOrigin").replace(/^ms/g,"Ms").replace(/([A-Z])/g,"-$1").toLowerCase(),O=v(f,"transform"),R=O.replace(/^ms/g,"Ms").replace(/([A-Z])/g,"-$1").toLowerCase(),I={},D={},L=_gsScope.SVGElement,it=function(e){return!!(L&&"function"==typeof e.getBBox&&e.getCTM&&(!e.parentNode||e.parentNode.getBBox&&e.parentNode.getCTM))},N=_gsScope.navigator&&(/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(_gsScope.navigator.userAgent)||/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(_gsScope.navigator.userAgent))&&parseFloat(RegExp.$1)<11,j=[],F=[],B=function(e){if(!e.getBoundingClientRect||!e.parentNode||!O)return{offsetTop:0,offsetLeft:0,scaleX:1,scaleY:1,offsetParent:Ae};if(!1!==mt.cacheSVGData&&e._dCache&&e._dCache.lastUpdate===be.ticker.frame)return e._dCache;var t,r,n,i,o,a,s,u,l,c,f,h=e,d=z(e);if(d.lastUpdate=be.ticker.frame,e.getBBox&&!d.isSVGRoot){for(h=e.parentNode,t=e.getBBox();h&&"svg"!==(h.nodeName+"").toLowerCase();)h=h.parentNode;return i=B(h),d.offsetTop=t.y*i.scaleY,d.offsetLeft=t.x*i.scaleX,d.scaleX=i.scaleX,d.scaleY=i.scaleY,d.offsetParent=h||Ae,d}for((n=d.offsetParent)===Ee.body&&(n=Ae),F.length=j.length=0;h&&h.parentNode;)"matrix(1, 0, 0, 1, 0, 0)"!==(o=tt(h,O,!0))&&"none"!==o&&"translate3d(0px, 0px, 0px)"!==o&&(F.push(h),j.push(h.style[O]),h.style[O]="none"),h=h.parentNode;for(r=n.getBoundingClientRect(),o=e.getScreenCTM(),s=e.createSVGPoint().matrixTransform(o),d.scaleX=Math.sqrt(o.a*o.a+o.b*o.b),d.scaleY=Math.sqrt(o.d*o.d+o.c*o.c),void 0===S&&A(),d.borderBox&&!p&&e.getAttribute("width")&&(i=E(e)||{},u=parseFloat(i.borderLeftWidth)+parseFloat(i.borderRightWidth)||0,l=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth)||0,c=parseFloat(i.width)||0,f=parseFloat(i.height)||0,d.scaleX*=(c-u)/c,d.scaleY*=(f-l)/f),g?(t=e.getBoundingClientRect(),d.offsetLeft=t.left-r.left,d.offsetTop=t.top-r.top):(d.offsetLeft=s.x-r.left,d.offsetTop=s.y-r.top),d.offsetParent=n,a=F.length;-1<--a;)F[a].style[O]=j[a];return d},ot=function(e,t){if(t=t||{},!e||e===Ae||!e.parentNode||e===window)return{x:0,y:0};var r=E(e),n=T&&r?r.getPropertyValue(T):"50% 50%",i=n.split(" "),o=-1!==n.indexOf("left")?"0%":-1!==n.indexOf("right")?"100%":i[0],a=-1!==n.indexOf("top")?"0%":-1!==n.indexOf("bottom")?"100%":i[1];return"center"!==a&&null!=a||(a="50%"),("center"===o||isNaN(parseFloat(o)))&&(o="50%"),e.getBBox&&it(e)?(e._gsTransform||(be.set(e,{x:"+=0",overwrite:!1}),void 0===e._gsTransform.xOrigin&&console.log("Draggable requires at least GSAP 1.17.0")),n=e.getBBox(),t.x=e._gsTransform.xOrigin-n.x,t.y=e._gsTransform.yOrigin-n.y):(e.getBBox&&-1!==(o+a).indexOf("%")&&(e={offsetWidth:(e=e.getBBox()).width,offsetHeight:e.height}),t.x=-1!==o.indexOf("%")?e.offsetWidth*parseFloat(o)/100:parseFloat(o),t.y=-1!==a.indexOf("%")?e.offsetHeight*parseFloat(a)/100:parseFloat(a)),t},z=function(e){if(!1!==mt.cacheSVGData&&e._dCache&&e._dCache.lastUpdate===be.ticker.frame)return e._dCache;var t,r=e._dCache=e._dCache||{},n=E(e),i=e.getBBox&&it(e),o="svg"===(e.nodeName+"").toLowerCase();if(r.isSVG=i,r.isSVGRoot=o,r.borderBox="border-box"===n.boxSizing,r.computedStyle=n,o)(t=e.parentNode||Ae).insertBefore(f,e),r.offsetParent=f.offsetParent||Ae,t.removeChild(f);else if(i){for(t=e.parentNode;t&&"svg"!==(t.nodeName+"").toLowerCase();)t=t.parentNode;r.offsetParent=t}else r.offsetParent=e.offsetParent;return r},U=function(e,t,r,n,i){if(e===window||!e||!e.style||!e.parentNode)return[1,0,0,1,0,0];var o,a,s,u,l,c,f,h,d,p,g,m,v,_,y=e._dCache||z(e),b=e.parentNode,x=b._dCache||z(b),w=y.computedStyle,T=y.isSVG?x.offsetParent:b.offsetParent;if(o=y.isSVG&&-1!==(e.style[O]+"").indexOf("matrix")?e.style[O]:w?w.getPropertyValue(R):e.currentStyle?e.currentStyle[O]:"1,0,0,1,0,0",e.getBBox&&-1!==(e.getAttribute("transform")+"").indexOf("matrix")&&(o=e.getAttribute("transform")),6<(o=(o+"").match(/(?:\-|\.|\b)(\d|\.|e\-)+/g)||[1,0,0,1,0,0]).length&&(o=[o[0],o[1],o[4],o[5],o[12],o[13]]),n?o[4]=o[5]=0:y.isSVG&&(l=e._gsTransform)&&(l.xOrigin||l.yOrigin)&&(o[0]=parseFloat(o[0]),o[1]=parseFloat(o[1]),o[2]=parseFloat(o[2]),o[3]=parseFloat(o[3]),o[4]=parseFloat(o[4])-(l.xOrigin-(l.xOrigin*o[0]+l.yOrigin*o[2])),o[5]=parseFloat(o[5])-(l.yOrigin-(l.xOrigin*o[1]+l.yOrigin*o[3]))),t)if(void 0===S&&A(),s=y.isSVG||y.isSVGRoot?B(e):e,y.isSVG?(u=e.getBBox(),p=x.isSVGRoot?{x:0,y:0}:b.getBBox(),s={offsetLeft:u.x-p.x,offsetTop:u.y-p.y,offsetParent:y.offsetParent}):y.isSVGRoot?(g=parseInt(w.borderTopWidth,10)||0,m=parseInt(w.borderLeftWidth,10)||0,v=(o[0]-S)*m+o[2]*g,_=o[1]*m+(o[3]-S)*g,c=t.x,f=t.y,h=c-(c*o[0]+f*o[2]),d=f-(c*o[1]+f*o[3]),o[4]=parseFloat(o[4])+h,o[5]=parseFloat(o[5])+d,t.x-=h,t.y-=d,c=s.scaleX,f=s.scaleY,i||(t.x*=c,t.y*=f),o[0]*=c,o[1]*=f,o[2]*=c,o[3]*=f,N||(t.x+=v,t.y+=_),T===Ee.body&&s.offsetParent===Ae&&(T=Ae)):!M&&e.offsetParent&&(t.x+=parseInt(tt(e.offsetParent,"borderLeftWidth"),10)||0,t.y+=parseInt(tt(e.offsetParent,"borderTopWidth"),10)||0),a=b===Ae||b===Ee.body,o[4]=Number(o[4])+t.x+(s.offsetLeft||0)-r.x-(a?0:b.scrollLeft||0),o[5]=Number(o[5])+t.y+(s.offsetTop||0)-r.y-(a?0:b.scrollTop||0),b&&"fixed"===tt(e,"position",!0))for(o[4]+=k(),o[5]+=C(),b=b.offsetParent;b;)o[4]-=b.offsetLeft,o[5]-=b.offsetTop,b=b.offsetParent;else!b||b===Ae||T!==s.offsetParent||x.isSVG||P&&"100100"!==U(b).join("")||(s=x.isSVGRoot?B(b):b,o[4]-=s.offsetLeft||0,o[5]-=s.offsetTop||0,M||!x.offsetParent||y.isSVG||y.isSVGRoot||(o[4]-=parseInt(tt(x.offsetParent,"borderLeftWidth"),10)||0,o[5]-=parseInt(tt(x.offsetParent,"borderTopWidth"),10)||0));return o},at=function(e,t){if(!e||e===window||!e.parentNode)return[1,0,0,1,0,0];for(var r,n,i,o,a,s,u,l,c=ot(e,I),f=ot(e.parentNode,D),h=U(e,c,f,!1,!t);(e=e.parentNode)&&e.parentNode&&e!==Ae;)c=f,f=ot(e.parentNode,c===I?D:I),u=U(e,c,f),r=h[0],n=h[1],i=h[2],o=h[3],a=h[4],s=h[5],h[0]=r*u[0]+n*u[2],h[1]=r*u[1]+n*u[3],h[2]=i*u[0]+o*u[2],h[3]=i*u[1]+o*u[3],h[4]=a*u[0]+s*u[2]+u[4],h[5]=a*u[1]+s*u[3]+u[5];return t&&(r=h[0],n=h[1],i=h[2],o=h[3],a=h[4],s=h[5],l=r*o-n*i,h[0]=o/l,h[1]=-n/l,h[2]=-i/l,h[3]=r/l,h[4]=(i*s-o*a)/l,h[5]=-(r*s-n*a)/l),h},X=function(e,t,r){var n=e.x*t[0]+e.y*t[2]+t[4],i=e.x*t[1]+e.y*t[3]+t[5];return e.x=n*r[0]+i*r[2]+r[4],e.y=n*r[1]+i*r[3]+r[5],e},q=function(e,t,r){if(!(e=Qe(e)))return null;t=Qe(t);var n,i,o,a,s,u,l,c,f,h,d,p,g,m,v,_,y,b,x,w,T,S,M=e.getBBox&&it(e);if(e===window)a=C(),o=(i=k())+(Ae.clientWidth||e.innerWidth||Ee.body.clientWidth||0),s=a+((e.innerHeight||0)-20t.scrollHeight,a.removeChild(t),e),gt=function(i,o){i=Qe(i),o=o||{};var a,s,u,e,l,c,f=Ee.createElement("div"),h=f.style,t=i.firstChild,d=0,p=0,g=i.scrollTop,m=i.scrollLeft,v=i.scrollWidth,_=i.scrollHeight,y=0,b=0,x=0;w&&!1!==o.force3D?(l="translate3d(",c="px,0px)"):O&&(l="translate(",c="px)"),this.scrollTop=function(e,t){if(!arguments.length)return-this.top();this.top(-e,t)},this.scrollLeft=function(e,t){if(!arguments.length)return-this.left();this.left(-e,t)},this.left=function(e,t){if(!arguments.length)return-(i.scrollLeft+p);var r=i.scrollLeft-m,n=p;if((2n.bottom-Q&&u?(Z=!0,s=Math.min(u,c*(1-Math.max(0,n.bottom-o)/Q)|0)):on.right-$&&u?(Z=!0,a=Math.min(u,c*(1-Math.max(0,n.right-i)/$)|0)):iG?(W.y=o,c+(v-o)*u):c):(I&&(s=e*I[0]+t*I[2]+I[4],t=e*I[1]+t*I[3]+I[5],e=s),(n=t-m)Math.abs(n)?"y":Y?"x":null,s&&"function"==typeof W.vars.onLockAxis&&W.vars.onLockAxis.call(W,W.pointerEvent)),"y"===s?n=0:"x"===s&&(r=0)),i=c+r*u,o=v+n*u),(k||E||A)&&(W.x!==i||W.y!==o&&!U)?(A&&(qe.x=i,qe.y=o,i=(s=A(qe)).x,o=s.y),k&&(i=k(i)),E&&(o=E(o))):_&&(bo._gsMaxScrollY&&(o.scrollTop=o._gsMaxScrollY),H&&o.scrollLeft>o._gsMaxScrollX&&(o.scrollLeft=o._gsMaxScrollX),i=o;W.isThrowing&&(n||W.endX>b||W.endXw||W.endYa.right||s.righta.bottom||s.bottom=a.width*a.height*r||i>=s.width*s.height*r):n.width>r&&n.height>r))},Ne.style.cssText="visibility:hidden;height:1px;top:-1px;pointer-events:none;position:relative;clear:both;",mt},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(e){"use strict";var t=function(){return(_gsScope.GreenSockGlobals||_gsScope).Draggable};"undefined"!=typeof module&&module.exports?(require("../TweenLite.js"),require("../plugins/CSSPlugin.js"),module.exports=t()):"function"==typeof define&&define.amd&&define(["TweenLite","CSSPlugin"],t)}();var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("GSDevTools",["TweenLite","core.Animation","core.SimpleTimeline","TimelineLite","utils.Draggable","plugins.CSSPlugin"],function(ue,le,a,ce,fe){var he,s,de,u,pe,i=document,ge=i.documentElement,o="http://www.w3.org/2000/svg",l="http://www.w3.org/1999/xhtml",me=0,ve={},_e=function(e,t,r){var n=i.createElementNS?i.createElementNS("svg"===e?o:l,e):i.createElement(e);return t&&("string"==typeof t&&(t=i.querySelector(t)),t.appendChild(n)),"svg"===e&&(n.setAttribute("xmlns",o),n.setAttribute("xmlns:xlink",l)),r&&(n.style.cssText=r),n},ye=function(){i.selection?i.selection.empty():window.getSelection&&window.getSelection().removeAllRanges()},c=le._rootTimeline,be=function(e,t){for(var r=[],n=0,i=e._first;i;)i instanceof ue?i.vars.id&&(r[n++]=i):(t&&i.vars.id&&(r[n++]=i),n=(r=r.concat(be(i,t))).length),i=i._next;return r},xe=function(e,t){var r=0,n=Math.max(0,e._repeat),i=e._first;for(i||(r=e.duration());i;)r=Math.max(r,999v._duration&&(e=v._duration),g||v.time(e),w.style.width=Math.min(O-A,Math.max(0,e/v._duration*100-A))+"%",T.innerHTML=e.toFixed(2)},onRelease:function(e){F||v.resume()}})[0],C=t(".in-point"),k=t(".out-point"),E=function(){A=0,O=100,C.style.left="0%",k.style.left="100%",_("in",A),_("out",O),D(!0)},A=0,O=100,R=fe.create(C,{type:"x",cursor:"ew-resize",zIndexBoost:!1,allowNativeTouchScrolling:!1,allowEventDefault:!0,onPress:r(C,1,!0),onDoubleClick:E,onDrag:function(){A=(d+h*this.x)/v.duration()*100,v.progress(A/100),D(!0)},onRelease:function(){A<0&&(A=0),ye(),C.style.left=A+"%",_("in",A),ue.set(C,{x:0,data:"root",display:"block"}),F||v.resume()}})[0],I=fe.create(k,{type:"x",cursor:"ew-resize",allowNativeTouchScrolling:!1,allowEventDefault:!0,zIndexBoost:!1,onPress:r(k,0,!0),onDoubleClick:E,onDrag:function(){O=(d+h*this.x)/v.duration()*100,v.progress(O/100),D(!0)},onRelease:function(){100a.duration();100=O/100&&(v.target===a&&v.target.seek(u+(l-u)*A/100),v._repeat&&!A?v.totalProgress(0,!0):v.progress(A/100,!0)),j.play(),v.resume(),F&&f.update(),F=!1},z=function(){j.reverse(),v&&v.pause(),F=!0},U=function(){F?B():z()},X=function(e){P.isPressed||(v.target===a&&v.target.seek(u+(l-u)*A/100),v.progress(A/100,!0),F||v.resume())},q=t(".loop"),H=function(e){var t=new ce({data:"root",paused:!0,onComplete:function(){t.kill()}});return t.to(e,.5,{rotation:360,ease:Power3.easeInOut,transformOrigin:"50% 50%"}).to(e.querySelectorAll(".loop-path"),.5,{fill:"#91e600",ease:Linear.easeNone},0),t}(q),Y=function(e){_("loop",i=e),i?(H.play(),v.progress()>=O/100&&(v.target===a&&v.target.seek(u+(l-u)*A/100),a._repeat&&!A&&100===O?v.totalProgress(0,!0):v.progress(A/100,!0),B())):H.reverse()},G=function(){Y(!i)},W=t(".animation-list"),V=t(".animation-label"),K=function(){var e,t,r=be(s&&!1===o.globalSync?s:ke,!0),n=W.children,i=0;for(s&&!1===o.globalSync?r.unshift(s):o.hideGlobalTimeline||r.unshift(ke),t=0;t=O/100?(v.target===a&&v.target.seek(u+(l-u)*A/100),v.progress(A/100,!0).pause()):v.pause(),ue.delayedCall(.01,function(){v.resume()})),Q.innerHTML=t+"x",$.blur&&$.blur()},te=ue.to([t(".gs-bottom"),t(".gs-top")],.3,{autoAlpha:0,y:50,ease:Power2.easeIn,data:"root",paused:!0}),re=!1,ne=function(e){fe.hitTest(e,n)||P.isDragging||R.isDragging||I.isDragging||ae.restart(!0)},ie=function(){re||(te.play(),ae.pause(),re=!0)},oe=function(){ae.pause(),re&&(te.reverse(),re=!1)},ae=ue.delayedCall(1.3,ie).pause(),se=function(e){Re&&!Ie&&(Ie=ke._startTime),c=!e,(s=we(o.animation))&&!s.vars.id&&(s.vars.id="[no id]"),K();var t=we(y("animation"));t&&(t._inProgress=y("in")||0,t._outProgress=y("out")||100),o.paused&&z(),a=null,Z(s||t||ke);var r=o.timeScale||y("timeScale"),n=t===a;r&&(Pe($,r,Q,r+"x"),v.timeScale(r)),100===(A=("inTime"in o?Te(o.inTime,a,0,0):n?t._inProgress:0)||0)&&!o.animation&&t&&(Z(ke),A=Te(o.inTime,a,0,0)||0),A&&(C.style.left=A+"%",C.style.display=k.style.display="block"),(O=("outTime"in o?Te(o.outTime,a,100,A):n?t._outProgress:0)||100)this.duration()&&(this._time=this._duration,this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},ue.onOverwrite=function(e,t,r,n){p.logOverwrites&&(n?console.log("[Overwrite warning] the following properties were overwritten: ",n,"| target:",r,"| overwritten tween: ",e,"| overwriting tween:",t):console.log("[Overwrite warning] the following tween was overwritten:",e,"by",t)),"function"==typeof g&&g(e,t,r,n)},p.create=function(e){return new p(e)},p},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()();var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("utils.Draggable",["events.EventDispatcher","TweenLite","plugins.CSSPlugin"],function(r,be,xe){var we,o,Te,S,p,g,M,P,e,t,n,i,a,Se={css:{},data:"_draggable"},Me={css:{},data:"_draggable"},Pe={css:{},data:"_draggable"},Ce={css:{}},ke=_gsScope._gsDefine.globals,s={},u=function(){return!1},l={style:{},appendChild:u,removeChild:u},Ee=_gsScope.document||{createElement:function(){return l}},Ae=Ee.documentElement||{},c=function(e){return Ee.createElementNS?Ee.createElementNS("http://www.w3.org/1999/xhtml",e):Ee.createElement(e)},f=c("div"),Oe=[],Re=180/Math.PI,Ie=999999999999999,De=Date.now||function(){return(new Date).getTime()},Le=!(Ee.addEventListener||!Ee.all),Ne=Ee.createElement("div"),je=[],Fe={},Be=0,h=/^(?:a|input|textarea|button|select)$/i,ze=0,Ue=_gsScope.navigator&&-1!==_gsScope.navigator.userAgent.toLowerCase().indexOf("android"),Xe=0,qe={},He={},Ye=function(e,t){var r,n={};if(t)for(r in e)n[r]=e[r]*t;else for(r in e)n[r]=e[r];return n},Ge=function(){for(var e=je.length;-1<--e;)je[e]()},We=function(e){for(var t=je.length;-1<--t;)je[t]===e&&je.splice(t,1);be.to(d,0,{overwrite:"all",delay:15,onComplete:d,data:"_draggable"})},d=function(){je.length||be.ticker.removeEventListener("tick",Ge)},C=function(){return null!=window.pageYOffset?window.pageYOffset:null!=Ee.scrollTop?Ee.scrollTop:Ae.scrollTop||Ee.body.scrollTop||0},k=function(){return null!=window.pageXOffset?window.pageXOffset:null!=Ee.scrollLeft?Ee.scrollLeft:Ae.scrollLeft||Ee.body.scrollLeft||0},Ve=function(e,t){lt(e,"scroll",t),Ze(e.parentNode)||Ve(e.parentNode,t)},Ke=function(e,t){ct(e,"scroll",t),Ze(e.parentNode)||Ke(e.parentNode,t)},Ze=function(e){return!(e&&e!==Ae&&e!==Ee&&e!==Ee.body&&e!==window&&e.nodeType&&e.parentNode)},m=function(e,t){var r="x"===t?"Width":"Height",n="scroll"+r,i="client"+r,o=Ee.body;return Math.max(0,Ze(e)?Math.max(Ae[n],o[n])-(window["inner"+r]||Ae[i]||o[i]):e[n]-e[i])},Je=function(e){var t=Ze(e),r=m(e,"x"),n=m(e,"y");t?e=He:Je(e.parentNode),e._gsMaxScrollX=r,e._gsMaxScrollY=n,e._gsScrollX=e.scrollLeft||0,e._gsScrollY=e.scrollTop||0},$e=function(e,t){return e=e||window.event,s.pageX=e.clientX+Ee.body.scrollLeft+Ae.scrollLeft,s.pageY=e.clientY+Ee.body.scrollTop+Ae.scrollTop,t&&(e.returnValue=!1),s},Qe=function(e){return e?("string"==typeof e&&(e=be.selector(e)),e.length&&e!==window&&e[0]&&e[0].style&&!e.nodeType&&(e=e[0]),e===window||e.nodeType&&e.style?e:null):e},v=function(e,t){var r,n,i,o=e.style;if(void 0===o[t]){for(i=["O","Moz","ms","Ms","Webkit"],n=5,r=t.charAt(0).toUpperCase()+t.substr(1);-1<--n&&void 0===o[i[n]+r];);if(n<0)return"";t=(3===n?"ms":i[n])+r}return t},et=function(e,t,r){var n=e.style;n&&(void 0===n[t]&&(t=v(e,t)),null==r?n.removeProperty?n.removeProperty(t.replace(/([A-Z])/g,"-$1").toLowerCase()):n.removeAttribute(t):void 0!==n[t]&&(n[t]=r))},_="undefined"!=typeof window?window:Ee.defaultView||{getComputedStyle:function(){}},E=function(e,t){return _.getComputedStyle(e instanceof Element?e:e.host||(e.parentNode||{}).host||e,t)},y=/(?:Left|Right|Width)/i,b=/(?:\d|\-|\+|=|#|\.)*/g,x=function(e,t,r,n,i){if("px"===n||!n)return r;if("auto"===n||!r)return 0;var o,a=y.test(t),s=e,u=f.style,l=r<0;return l&&(r=-r),"%"===n&&-1!==t.indexOf("border")?o=r/100*(a?e.clientWidth:e.clientHeight):(u.cssText="border:0 solid red;position:"+tt(e,"position",!0)+";line-height:0;","%"!==n&&s.appendChild?u[a?"borderLeftWidth":"borderTopWidth"]=r+n:(s=e.parentNode||Ee.body,u[a?"width":"height"]=r+n),s.appendChild(f),o=parseFloat(f[a?"offsetWidth":"offsetHeight"]),s.removeChild(f),0!==o||i||(o=x(e,t,r,n,!0))),l?-o:o},tt=function(e,t,r){var n,i=(e._gsTransform||{})[t];return i||0===i?i:(e.style&&e.style[t]?i=e.style[t]:(n=E(e))?i=(i=n.getPropertyValue(t.replace(/([A-Z])/g,"-$1").toLowerCase()))||n.length?i:n[t]:e.currentStyle&&(i=e.currentStyle[t]),"auto"!==i||"top"!==t&&"left"!==t||(i=function(e,t){if("absolute"!==tt(e,"position",!0))return 0;var r="left"===t?"Left":"Top",n=tt(e,"margin"+r,!0);return e["offset"+r]-(x(e,t,parseFloat(n),(n+"").replace(b,""))||0)}(e,t)),r?i:parseFloat(i)||0)},rt=function(e,t,r){var n=e.vars,i=n[r],o=e._listeners[t];"function"==typeof i&&i.apply(n[r+"Scope"]||n.callbackScope||e,n[r+"Params"]||[e.pointerEvent]),o&&e.dispatchEvent(t)},nt=function(e,t){var r,n,i,o=Qe(e);return o?q(o,t):void 0!==e.left?(i=ot(t),{left:e.left-i.x,top:e.top-i.y,width:e.width,height:e.height}):{left:n=e.min||e.minX||e.minRotation||0,top:r=e.min||e.minY||0,width:(e.max||e.maxX||e.maxRotation||0)-n,height:(e.max||e.maxY||0)-r}},A=function(){if(!Ee.createElementNS)return S=0,void(p=!1);var e,t,r,n,i=c("div"),o=Ee.createElementNS("http://www.w3.org/2000/svg","svg"),a=c("div"),s=i.style,u=Ee.body||Ae,l="flex"===tt(u,"display",!0);Ee.body&&O&&(s.position="absolute",u.appendChild(a),a.appendChild(i),n=i.offsetParent,a.style[O]="rotate(1deg)",P=i.offsetParent===n,a.style.position="absolute",s.height="10px",n=i.offsetTop,a.style.border="5px solid red",M=n!==i.offsetTop,u.removeChild(a)),s=o.style,o.setAttributeNS(null,"width","400px"),o.setAttributeNS(null,"height","400px"),o.setAttributeNS(null,"viewBox","0 0 400 400"),s.display="block",s.boxSizing="border-box",s.border="0px solid red",s.transform="none",i.style.cssText="width:100px;height:100px;overflow:scroll;-ms-overflow-style:none;",u.appendChild(i),i.appendChild(o),t=(r=o.createSVGPoint().matrixTransform(o.getScreenCTM())).y,i.scrollTop=100,r.x=r.y=0,r=r.matrixTransform(o.getScreenCTM()),g=t-r.y<100.1?0:t-r.y-150,i.removeChild(o),u.removeChild(i),u.appendChild(o),l&&(u.style.display="block"),t=(e=o.getScreenCTM()).e,s.border="50px solid red",e=o.getScreenCTM(),p=0===t&&0===e.e&&0===e.f&&1===e.a?(S=1,!0):(S=t!==e.e?1:0,1!==e.a),l&&(u.style.display="flex"),u.removeChild(o)},w=""!==v(f,"perspective"),T=v(f,"transformOrigin").replace(/^ms/g,"Ms").replace(/([A-Z])/g,"-$1").toLowerCase(),O=v(f,"transform"),R=O.replace(/^ms/g,"Ms").replace(/([A-Z])/g,"-$1").toLowerCase(),I={},D={},L=_gsScope.SVGElement,it=function(e){return!!(L&&"function"==typeof e.getBBox&&e.getCTM&&(!e.parentNode||e.parentNode.getBBox&&e.parentNode.getCTM))},N=_gsScope.navigator&&(/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(_gsScope.navigator.userAgent)||/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(_gsScope.navigator.userAgent))&&parseFloat(RegExp.$1)<11,j=[],F=[],B=function(e){if(!e.getBoundingClientRect||!e.parentNode||!O)return{offsetTop:0,offsetLeft:0,scaleX:1,scaleY:1,offsetParent:Ae};if(!1!==mt.cacheSVGData&&e._dCache&&e._dCache.lastUpdate===be.ticker.frame)return e._dCache;var t,r,n,i,o,a,s,u,l,c,f,h=e,d=z(e);if(d.lastUpdate=be.ticker.frame,e.getBBox&&!d.isSVGRoot){for(h=e.parentNode,t=e.getBBox();h&&"svg"!==(h.nodeName+"").toLowerCase();)h=h.parentNode;return i=B(h),d.offsetTop=t.y*i.scaleY,d.offsetLeft=t.x*i.scaleX,d.scaleX=i.scaleX,d.scaleY=i.scaleY,d.offsetParent=h||Ae,d}for((n=d.offsetParent)===Ee.body&&(n=Ae),F.length=j.length=0;h&&h.parentNode;)"matrix(1, 0, 0, 1, 0, 0)"!==(o=tt(h,O,!0))&&"none"!==o&&"translate3d(0px, 0px, 0px)"!==o&&(F.push(h),j.push(h.style[O]),h.style[O]="none"),h=h.parentNode;for(r=n.getBoundingClientRect(),o=e.getScreenCTM(),s=e.createSVGPoint().matrixTransform(o),d.scaleX=Math.sqrt(o.a*o.a+o.b*o.b),d.scaleY=Math.sqrt(o.d*o.d+o.c*o.c),void 0===S&&A(),d.borderBox&&!p&&e.getAttribute("width")&&(i=E(e)||{},u=parseFloat(i.borderLeftWidth)+parseFloat(i.borderRightWidth)||0,l=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth)||0,c=parseFloat(i.width)||0,f=parseFloat(i.height)||0,d.scaleX*=(c-u)/c,d.scaleY*=(f-l)/f),g?(t=e.getBoundingClientRect(),d.offsetLeft=t.left-r.left,d.offsetTop=t.top-r.top):(d.offsetLeft=s.x-r.left,d.offsetTop=s.y-r.top),d.offsetParent=n,a=F.length;-1<--a;)F[a].style[O]=j[a];return d},ot=function(e,t){if(t=t||{},!e||e===Ae||!e.parentNode||e===window)return{x:0,y:0};var r=E(e),n=T&&r?r.getPropertyValue(T):"50% 50%",i=n.split(" "),o=-1!==n.indexOf("left")?"0%":-1!==n.indexOf("right")?"100%":i[0],a=-1!==n.indexOf("top")?"0%":-1!==n.indexOf("bottom")?"100%":i[1];return"center"!==a&&null!=a||(a="50%"),("center"===o||isNaN(parseFloat(o)))&&(o="50%"),e.getBBox&&it(e)?(e._gsTransform||(be.set(e,{x:"+=0",overwrite:!1}),void 0===e._gsTransform.xOrigin&&console.log("Draggable requires at least GSAP 1.17.0")),n=e.getBBox(),t.x=e._gsTransform.xOrigin-n.x,t.y=e._gsTransform.yOrigin-n.y):(e.getBBox&&-1!==(o+a).indexOf("%")&&(e={offsetWidth:(e=e.getBBox()).width,offsetHeight:e.height}),t.x=-1!==o.indexOf("%")?e.offsetWidth*parseFloat(o)/100:parseFloat(o),t.y=-1!==a.indexOf("%")?e.offsetHeight*parseFloat(a)/100:parseFloat(a)),t},z=function(e){if(!1!==mt.cacheSVGData&&e._dCache&&e._dCache.lastUpdate===be.ticker.frame)return e._dCache;var t,r=e._dCache=e._dCache||{},n=E(e),i=e.getBBox&&it(e),o="svg"===(e.nodeName+"").toLowerCase();if(r.isSVG=i,r.isSVGRoot=o,r.borderBox="border-box"===n.boxSizing,r.computedStyle=n,o)(t=e.parentNode||Ae).insertBefore(f,e),r.offsetParent=f.offsetParent||Ae,t.removeChild(f);else if(i){for(t=e.parentNode;t&&"svg"!==(t.nodeName+"").toLowerCase();)t=t.parentNode;r.offsetParent=t}else r.offsetParent=e.offsetParent;return r},U=function(e,t,r,n,i){if(e===window||!e||!e.style||!e.parentNode)return[1,0,0,1,0,0];var o,a,s,u,l,c,f,h,d,p,g,m,v,_,y=e._dCache||z(e),b=e.parentNode,x=b._dCache||z(b),w=y.computedStyle,T=y.isSVG?x.offsetParent:b.offsetParent;if(o=y.isSVG&&-1!==(e.style[O]+"").indexOf("matrix")?e.style[O]:w?w.getPropertyValue(R):e.currentStyle?e.currentStyle[O]:"1,0,0,1,0,0",e.getBBox&&-1!==(e.getAttribute("transform")+"").indexOf("matrix")&&(o=e.getAttribute("transform")),6<(o=(o+"").match(/(?:\-|\.|\b)(\d|\.|e\-)+/g)||[1,0,0,1,0,0]).length&&(o=[o[0],o[1],o[4],o[5],o[12],o[13]]),n?o[4]=o[5]=0:y.isSVG&&(l=e._gsTransform)&&(l.xOrigin||l.yOrigin)&&(o[0]=parseFloat(o[0]),o[1]=parseFloat(o[1]),o[2]=parseFloat(o[2]),o[3]=parseFloat(o[3]),o[4]=parseFloat(o[4])-(l.xOrigin-(l.xOrigin*o[0]+l.yOrigin*o[2])),o[5]=parseFloat(o[5])-(l.yOrigin-(l.xOrigin*o[1]+l.yOrigin*o[3]))),t)if(void 0===S&&A(),s=y.isSVG||y.isSVGRoot?B(e):e,y.isSVG?(u=e.getBBox(),p=x.isSVGRoot?{x:0,y:0}:b.getBBox(),s={offsetLeft:u.x-p.x,offsetTop:u.y-p.y,offsetParent:y.offsetParent}):y.isSVGRoot?(g=parseInt(w.borderTopWidth,10)||0,m=parseInt(w.borderLeftWidth,10)||0,v=(o[0]-S)*m+o[2]*g,_=o[1]*m+(o[3]-S)*g,c=t.x,f=t.y,h=c-(c*o[0]+f*o[2]),d=f-(c*o[1]+f*o[3]),o[4]=parseFloat(o[4])+h,o[5]=parseFloat(o[5])+d,t.x-=h,t.y-=d,c=s.scaleX,f=s.scaleY,i||(t.x*=c,t.y*=f),o[0]*=c,o[1]*=f,o[2]*=c,o[3]*=f,N||(t.x+=v,t.y+=_),T===Ee.body&&s.offsetParent===Ae&&(T=Ae)):!M&&e.offsetParent&&(t.x+=parseInt(tt(e.offsetParent,"borderLeftWidth"),10)||0,t.y+=parseInt(tt(e.offsetParent,"borderTopWidth"),10)||0),a=b===Ae||b===Ee.body,o[4]=Number(o[4])+t.x+(s.offsetLeft||0)-r.x-(a?0:b.scrollLeft||0),o[5]=Number(o[5])+t.y+(s.offsetTop||0)-r.y-(a?0:b.scrollTop||0),b&&"fixed"===tt(e,"position",!0))for(o[4]+=k(),o[5]+=C(),b=b.offsetParent;b;)o[4]-=b.offsetLeft,o[5]-=b.offsetTop,b=b.offsetParent;else!b||b===Ae||T!==s.offsetParent||x.isSVG||P&&"100100"!==U(b).join("")||(s=x.isSVGRoot?B(b):b,o[4]-=s.offsetLeft||0,o[5]-=s.offsetTop||0,M||!x.offsetParent||y.isSVG||y.isSVGRoot||(o[4]-=parseInt(tt(x.offsetParent,"borderLeftWidth"),10)||0,o[5]-=parseInt(tt(x.offsetParent,"borderTopWidth"),10)||0));return o},at=function(e,t){if(!e||e===window||!e.parentNode)return[1,0,0,1,0,0];for(var r,n,i,o,a,s,u,l,c=ot(e,I),f=ot(e.parentNode,D),h=U(e,c,f,!1,!t);(e=e.parentNode)&&e.parentNode&&e!==Ae;)c=f,f=ot(e.parentNode,c===I?D:I),u=U(e,c,f),r=h[0],n=h[1],i=h[2],o=h[3],a=h[4],s=h[5],h[0]=r*u[0]+n*u[2],h[1]=r*u[1]+n*u[3],h[2]=i*u[0]+o*u[2],h[3]=i*u[1]+o*u[3],h[4]=a*u[0]+s*u[2]+u[4],h[5]=a*u[1]+s*u[3]+u[5];return t&&(r=h[0],n=h[1],i=h[2],o=h[3],a=h[4],s=h[5],l=r*o-n*i,h[0]=o/l,h[1]=-n/l,h[2]=-i/l,h[3]=r/l,h[4]=(i*s-o*a)/l,h[5]=-(r*s-n*a)/l),h},X=function(e,t,r){var n=e.x*t[0]+e.y*t[2]+t[4],i=e.x*t[1]+e.y*t[3]+t[5];return e.x=n*r[0]+i*r[2]+r[4],e.y=n*r[1]+i*r[3]+r[5],e},q=function(e,t,r){if(!(e=Qe(e)))return null;t=Qe(t);var n,i,o,a,s,u,l,c,f,h,d,p,g,m,v,_,y,b,x,w,T,S,M=e.getBBox&&it(e);if(e===window)a=C(),o=(i=k())+(Ae.clientWidth||e.innerWidth||Ee.body.clientWidth||0),s=a+((e.innerHeight||0)-20t.scrollHeight,a.removeChild(t),e),gt=function(i,o){i=Qe(i),o=o||{};var a,s,u,e,l,c,f=Ee.createElement("div"),h=f.style,t=i.firstChild,d=0,p=0,g=i.scrollTop,m=i.scrollLeft,v=i.scrollWidth,_=i.scrollHeight,y=0,b=0,x=0;w&&!1!==o.force3D?(l="translate3d(",c="px,0px)"):O&&(l="translate(",c="px)"),this.scrollTop=function(e,t){if(!arguments.length)return-this.top();this.top(-e,t)},this.scrollLeft=function(e,t){if(!arguments.length)return-this.left();this.left(-e,t)},this.left=function(e,t){if(!arguments.length)return-(i.scrollLeft+p);var r=i.scrollLeft-m,n=p;if((2n.bottom-Q&&u?(Z=!0,s=Math.min(u,c*(1-Math.max(0,n.bottom-o)/Q)|0)):on.right-$&&u?(Z=!0,a=Math.min(u,c*(1-Math.max(0,n.right-i)/$)|0)):iG?(W.y=o,c+(v-o)*u):c):(I&&(s=e*I[0]+t*I[2]+I[4],t=e*I[1]+t*I[3]+I[5],e=s),(n=t-m)Math.abs(n)?"y":Y?"x":null,s&&"function"==typeof W.vars.onLockAxis&&W.vars.onLockAxis.call(W,W.pointerEvent)),"y"===s?n=0:"x"===s&&(r=0)),i=c+r*u,o=v+n*u),(k||E||A)&&(W.x!==i||W.y!==o&&!U)?(A&&(qe.x=i,qe.y=o,i=(s=A(qe)).x,o=s.y),k&&(i=k(i)),E&&(o=E(o))):_&&(bo._gsMaxScrollY&&(o.scrollTop=o._gsMaxScrollY),H&&o.scrollLeft>o._gsMaxScrollX&&(o.scrollLeft=o._gsMaxScrollX),i=o;W.isThrowing&&(n||W.endX>b||W.endXw||W.endYa.right||s.righta.bottom||s.bottom=a.width*a.height*r||i>=s.width*s.height*r):n.width>r&&n.height>r))},Ne.style.cssText="visibility:hidden;height:1px;top:-1px;pointer-events:none;position:relative;clear:both;",mt},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(e){"use strict";var t=function(){return(_gsScope.GreenSockGlobals||_gsScope).GSDevTools};"undefined"!=typeof module&&module.exports?(require("../TweenLite.js"),require("../TimelineLite.js"),require("../plugins/CSSPlugin.js"),module.exports=t()):"function"==typeof define&&define.amd&&define(["TweenLite","TimelineLite","CSSPlugin"],t)}();var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;!function(r){"use strict";var i=r.GreenSockGlobals||r,e=function(e){var t,r=e.split("."),n=i;for(t=0;t":">")}},n=e.SplitText=i.SplitText=function(e,t){if("string"==typeof e&&(e=n.selector(e)),!e)throw"cannot split a null element.";this.elements=a(e)?function(e){var t,r,n,i=[],o=e.length;for(t=0;tP&&("BR"!==c.nodeName||0===s)&&(d=[],D.push(d),x=_),j&&(c._x=c.offsetLeft,c._y=_,c._w=c.offsetWidth,c._h=c.offsetHeight),D&&((c._isSplit&&h||!N&&h||L&&h||!L&&c.parentNode.parentNode===e&&!c.parentNode._isSplit)&&(d.push(c),c._x-=b,G(c,e,O)&&(c._wordEnd=!0)),"BR"===c.nodeName&&(c.nextSibling&&"BR"===c.nextSibling.nodeName||0===s)&&D.push([])));for(s=0;se.clientHeight&&(e.style.height=a-S+"px",e.clientHeighte.clientWidth&&(e.style.width=o-M+"px",e.clientWidth",b=!0,x=t.specialChars?"function"==typeof t.specialChars?t.specialChars:M:null,w=U.createElement("div"),T=e.parentNode;for(T.insertBefore(w,e),w.textContent=e.nodeValue,T.removeChild(e),c=-1!==(i=S(e=w)).indexOf("<"),!1!==t.reduceWhiteSpace&&(i=i.replace(C," ").replace(P,"")),c&&(i=i.split("<").join("{{LT}}")),u=i.length,o=(" "===i.charAt(0)?_:"")+r(),a=0;a":l,a+=d-1;else if(l===v&&i.charAt(a-1)!==v&&a){for(o+=b?y:"",b=!1;i.charAt(a+1)===v;)o+=_,a++;a===u-1?o+=_:")"!==i.charAt(a+1)&&(o+=_+r(),b=!0)}else"{"===l&&"{{LT}}"===i.substr(a,6)?(o+=g?n()+"{{LT}}":"{{LT}}",a+=5):55296<=l.charCodeAt(0)&&l.charCodeAt(0)<=56319||65024<=i.charCodeAt(a+1)&&i.charCodeAt(a+1)<=65039?(f=k(i.substr(a,2)),h=k(i.substr(a+2,2)),s=127462<=f&&f<=127487&&127462<=h&&h<=127487||127995<=h&&h<=127999?4:2,o+=g&&" "!==l?n()+i.substr(a,s)+"":i.substr(a,s),a+=s-1):o+=g&&" "!==l?n()+l+"":l;e.outerHTML=o+(b?y:""),c&&H(T,"{{LT}}","<")}(e,t,r,n)},h=n.prototype;h.split=function(e){this.isSplit&&this.revert(),this.vars=e=e||this.vars,this._originals.length=this.chars.length=this.words.length=this.lines.length=0;for(var t,r,n,i=this.elements.length,o=e.tag?e.tag:e.span?"span":"div",a=u(e.wordsClass,o),s=u(e.charsClass,o);-1<--i;)n=this.elements[i],this._originals[i]=n.innerHTML,t=n.clientHeight,r=n.clientWidth,f(n,e,a,s),c(n,e,this.chars,this.words,this.lines,r,t);return this.chars.reverse(),this.words.reverse(),this.lines.reverse(),this.isSplit=!0,this},h.revert=function(){if(!this._originals)throw"revert() call wasn't scoped properly.";for(var e=this._originals.length;-1<--e;)this.elements[e].innerHTML=this._originals[e];return this.chars=[],this.words=[],this.lines=[],this.isSplit=!1,this},n.selector=r.$||r.jQuery||function(e){var t=r.$||r.jQuery;return t?(n.selector=t)(e):"undefined"==typeof document?e:document.querySelectorAll?document.querySelectorAll(e):document.getElementById("#"===e.charAt(0)?e.substr(1):e)},n.version="0.7.0"}(_gsScope),function(e){"use strict";var t=function(){return(_gsScope.GreenSockGlobals||_gsScope).SplitText};"undefined"!=typeof module&&module.exports?module.exports=t():"function"==typeof define&&define.amd&&define([],t)}();var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine.plugin({propName:"attr",API:2,version:"0.6.1",init:function(e,t,r,n){var i,o;if("function"!=typeof e.setAttribute)return!1;for(i in t)"function"==typeof(o=t[i])&&(o=o(n,e)),this._addTween(e,"setAttribute",e.getAttribute(i)+"",o+"",i,!1,i),this._overwriteProps.push(i);return!0}})}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(e){"use strict";var t=function(){return(_gsScope.GreenSockGlobals||_gsScope).AttrPlugin};"undefined"!=typeof module&&module.exports?(require("../TweenLite.js"),module.exports=t()):"function"==typeof define&&define.amd&&define(["TweenLite"],t)}();var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";var T=180/Math.PI,x=[],w=[],S=[],v={},r=_gsScope._gsDefine.globals,_=function(e,t,r,n){r===n&&(r=n-(n-t)/1e6),e===t&&(t=e+(r-e)/1e6),this.a=e,this.b=t,this.c=r,this.d=n,this.da=n-e,this.ca=r-e,this.ba=t-e},M=function(e,t,r,n){var i={a:e},o={},a={},s={c:n},u=(e+t)/2,l=(t+r)/2,c=(r+n)/2,f=(u+l)/2,h=(l+c)/2,d=(h-f)/8;return i.b=u+(e-u)/4,o.b=f+d,i.c=o.a=(i.b+o.b)/2,o.c=a.a=(f+h)/2,a.b=h-d,s.b=c+(n-c)/4,a.c=s.a=(a.b+s.b)/2,[i,o,a,s]},y=function(e,t,r,n,i){var o,a,s,u,l,c,f,h,d,p,g,m,v,_=e.length-1,y=0,b=e[0].a;for(o=0;o<_;o++)a=(l=e[y]).a,s=l.d,u=e[y+1].d,h=i?(g=x[o],v=((m=w[o])+g)*t*.25/(n?.5:S[o]||.5),s-((c=s-(s-a)*(n?.5*t:0!==g?v/g:0))+(((f=s+(u-s)*(n?.5*t:0!==m?v/m:0))-c)*(3*g/(g+m)+.5)/4||0))):s-((c=s-(s-a)*t*.5)+(f=s+(u-s)*t*.5))/2,c+=h,f+=h,l.c=d=c,l.b=0!==o?b:b=l.a+.6*(l.c-l.a),l.da=s-a,l.ca=d-a,l.ba=b-a,r?(p=M(a,b,d,s),e.splice(y,1,p[0],p[1],p[2],p[3]),y+=4):y++,b=f;(l=e[y]).b=b,l.c=b+.4*(l.d-b),l.da=l.d-l.a,l.ca=l.c-l.a,l.ba=b-l.a,r&&(p=M(l.a,b,l.c,l.d),e.splice(y,1,p[0],p[1],p[2],p[3]))},b=function(e,t,r,n){var i,o,a,s,u,l,c=[];if(n)for(o=(e=[n].concat(e)).length;-1<--o;)"string"==typeof(l=e[o][t])&&"="===l.charAt(1)&&(e[o][t]=n[t]+Number(l.charAt(0)+l.substr(2)));if((i=e.length-2)<0)return c[0]=new _(e[0][t],0,0,e[0][t]),c;for(o=0;o>0||6)-1,f=[],h=[];for(r in e)p(e[r],a,t);for(i=a.length,n=0;n>0]=h,s[o]=l,u=0,h=[]);return{length:l,lengths:s,segments:f}}(this._beziers,this._timeRes);this._length=h.length,this._lengths=h.lengths,this._segments=h.segments,this._l1=this._li=this._s1=this._si=0,this._l2=this._lengths[0],this._curSeg=this._segments[0],this._s2=this._curSeg[0],this._prec=1/this._curSeg.length}if(f=this._autoRotate)for(this._initialRotations=[],f[0]instanceof Array||(this._autoRotate=f=[f]),o=f.length;-1<--o;){for(a=0;a<3;a++)n=f[o][a],this._func[n]="function"==typeof e[n]&&e[n.indexOf("set")||"function"!=typeof e["get"+n.substr(3)]?n:"get"+n.substr(3)];n=f[o][2],this._initialRotations[o]=(this._func[n]?this._func[n].call(this._target):this._target[n])||0,this._overwriteProps.push(n)}return this._startRatio=r.vars.runBackwards?1:0,!0},set:function(e){var t,r,n,i,o,a,s,u,l,c,f=this._segCount,h=this._func,d=this._target,p=e!==this._startRatio;if(this._timeRes){if(l=this._lengths,c=this._curSeg,e*=this._length,n=this._li,e>this._l2&&n=e;);0===n&&ethis._s2&&n=e;);0===n&&e>0)*(1/f))*f;for(r=1-a,n=this._props.length;-1<--n;)i=this._props[n],s=(a*a*(o=this._beziers[i][t]).da+3*r*(a*o.ca+r*o.ba))*a+o.a,this._mod[i]&&(s=this._mod[i](s,d)),h[i]?d[i](s):d[i]=s;if(this._autoRotate){var g,m,v,_,y,b,x,w=this._autoRotate;for(n=w.length;-1<--n;)i=w[n][2],b=w[n][3]||0,x=!0===w[n][4]?1:T,o=this._beziers[w[n][0]],g=this._beziers[w[n][1]],o&&g&&(o=o[t],g=g[t],m=o.a+(o.b-o.a)*a,m+=((_=o.b+(o.c-o.b)*a)-m)*a,_+=(o.c+(o.d-o.c)*a-_)*a,v=g.a+(g.b-g.a)*a,v+=((y=g.b+(g.c-g.b)*a)-v)*a,y+=(g.c+(g.d-g.c)*a-y)*a,s=p?Math.atan2(y-v,_-m)*x+b:this._initialRotations[n],this._mod[i]&&(s=this._mod[i](s,d)),h[i]?d[i](s):d[i]=s)}}}),e=m.prototype;m.bezierThrough=d,m.cubicToQuadratic=M,m._autoCSS=!0,m.quadraticToCubic=function(e,t,r){return new _(e,(2*t+e)/3,(2*t+r)/3,r)},m._cssRegister=function(){var e=r.CSSPlugin;if(e){var t=e._internals,d=t._parseToProxy,p=t._setPluginRatio,g=t.CSSPropTween;t._registerComplexSpecialProp("bezier",{parser:function(e,t,r,n,i,o){t instanceof Array&&(t={values:t}),o=new m;var a,s,u,l=t.values,c=l.length-1,f=[],h={};if(c<0)return i;for(a=0;a<=c;a++)u=d(e,l[a],n,i,o,c!==a),f[a]=u.end;for(s in t)h[s]=t[s];return h.values=f,(i=new g(e,"bezier",0,0,u.pt,2)).data=u,i.plugin=o,i.setRatio=p,0===h.autoRotate&&(h.autoRotate=!0),!h.autoRotate||h.autoRotate instanceof Array||(a=!0===h.autoRotate?0:Number(h.autoRotate),h.autoRotate=null!=u.end.left?[["left","top","rotation",a,!1]]:null!=u.end.x&&[["x","y","rotation",a,!1]]),h.autoRotate&&(n._transform||n._enableTransforms(!1),u.autoRotate=n._target._gsTransform,u.proxy.rotation=u.autoRotate.rotation||0,n._overwriteProps.push("rotation")),o._onInitTween(u.proxy,h,n._tween),i}})}},e._mod=function(e){for(var t,r=this._overwriteProps,n=r.length;-1<--n;)(t=e[r[n]])&&"function"==typeof t&&(this._mod[r[n]]=t)},e._kill=function(e){var t,r,n=this._props;for(t in this._beziers)if(t in e)for(delete this._beziers[t],delete this._func[t],r=n.length;-1<--r;)n[r]===t&&n.splice(r,1);if(n=this._autoRotate)for(r=n.length;-1<--r;)e[n[r][2]]&&n.splice(r,1);return this._super._kill.call(this,e)}}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(e){"use strict";var t=function(){return(_gsScope.GreenSockGlobals||_gsScope).BezierPlugin};"undefined"!=typeof module&&module.exports?(require("../TweenLite.js"),module.exports=t()):"function"==typeof define&&define.amd&&define(["TweenLite"],t)}();var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("plugins.CSSPlugin",["plugins.TweenPlugin","TweenLite"],function(o,z){var p,S,M,g,U=function(){o.call(this,"css"),this._overwriteProps.length=0,this.setRatio=U.prototype.setRatio},l=_gsScope._gsDefine.globals,m={},e=U.prototype=new o("css");(e.constructor=U).version="2.1.0",U.API=2,U.defaultTransformPerspective=0,U.defaultSkewType="compensated",U.defaultSmoothOrigin=!0,e="px",U.suffixMap={top:e,right:e,bottom:e,left:e,width:e,height:e,fontSize:e,padding:e,margin:e,perspective:e,lineHeight:""};var C,v,_,j,y,P,k,E,t,r,A=/(?:\-|\.|\b)(\d|\.|e\-)+/g,O=/(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g,b=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi,c=/(?![+-]?\d*\.?\d+|[+-]|e[+-]\d+)[^0-9]/g,R=/(?:\d|\-|\+|=|#|\.)*/g,I=/opacity *= *([^)]*)/i,x=/opacity:([^;]*)/i,a=/alpha\(opacity *=.+?\)/i,w=/^(rgb|hsl)/,s=/([A-Z])/g,u=/-([a-z])/gi,T=/(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi,f=function(e,t){return t.toUpperCase()},d=/(?:Left|Right|Width)/i,h=/(M11|M12|M21|M22)=[\d\-\.e]+/gi,D=/progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i,L=/,(?=[^\)]*(?:\(|$))/gi,N=/[\s,\(]/i,F=Math.PI/180,X=180/Math.PI,B={},n={style:{}},q=_gsScope.document||{createElement:function(){return n}},H=function(e,t){return t&&q.createElementNS?q.createElementNS(t,e):q.createElement(e)},Y=H("div"),G=H("img"),i=U._internals={_specialProps:m},W=(_gsScope.navigator||{}).userAgent||"",V=(t=W.indexOf("Android"),r=H("a"),_=-1!==W.indexOf("Safari")&&-1===W.indexOf("Chrome")&&(-1===t||3>16,e>>8&255,255&e];else{if(","===e.charAt(e.length-1)&&(e=e.substr(0,e.length-1)),pe[e])r=pe[e];else if("#"===e.charAt(0))4===e.length&&(e="#"+(n=e.charAt(1))+n+(i=e.charAt(2))+i+(o=e.charAt(3))+o),r=[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e];else if("hsl"===e.substr(0,3))if(r=h=e.match(A),t){if(-1!==e.indexOf("="))return e.match(O)}else a=Number(r[0])%360/360,s=Number(r[1])/100,n=2*(u=Number(r[2])/100)-(i=u<=.5?u*(s+1):u+s-u*s),3n--)for(;++nn--)for(;++n>0];return n.parse(e,a,i,o)}},xe=(i._setPluginRatio=function(e){this.plugin.setRatio(e);for(var t,r,n,i,o,a=this.data,s=a.proxy,u=a.firstMPT;u;)t=s[u.v],u.r?t=u.r(t):t<1e-6&&-1e-6s.length?u.length:s.length,a=0;ao.pr;)a=a._next;(o._prev=a?a._prev:u)?o._prev._next=o:s=o,(o._next=a)?a._prev=o:u=o,o=l}this._firstPT=s}return!0},e.parse=function(e,t,r,n){var i,o,a,s,u,l,c,f,h,d,p=e.style;for(i in t){if(l=t[i],o=m[i],"function"!=typeof l||o&&o.allowFunc||(l=l(E,k)),o)r=o.parse(e,l,i,this,r,n,t);else{if("--"===i.substr(0,2)){this._tween._propLookup[i]=this._addTween.call(this._tween,e.style,"setProperty",te(e).getPropertyValue(i)+"",l+"",i,!1,i);continue}u=re(e,i,M)+"",h="string"==typeof l,"color"===i||"fill"===i||"stroke"===i||-1!==i.indexOf("Color")||h&&w.test(l)?(h||(l=(3<(l=me(l)).length?"rgba(":"rgb(")+l.join(",")+")"),r=Se(p,i,u,l,!0,"transparent",r,0,n)):h&&N.test(l)?r=Se(p,i,u,l,!0,null,r,0,n):(c=(a=parseFloat(u))||0===a?u.substr((a+"").length):"",""!==u&&"auto"!==u||(c="width"===i||"height"===i?(a=le(e,i,M),"px"):"left"===i||"top"===i?(a=ie(e,i,M),"px"):(a="opacity"!==i?0:1,"")),""===(f=(d=h&&"="===l.charAt(1))?(s=parseInt(l.charAt(0)+"1",10),l=l.substr(2),s*=parseFloat(l),l.replace(R,"")):(s=parseFloat(l),h?l.replace(R,""):""))&&(f=i in S?S[i]:c),l=s||0===s?(d?s+a:s)+f:t[i],c!==f&&(""===f&&"lineHeight"!==i||(s||0===s)&&a&&(a=ne(e,i,a,c),"%"===f?(a/=ne(e,i,100,"%")/100,!0!==t.strictUnits&&(u=a+"%")):"em"===f||"rem"===f||"vw"===f||"vh"===f?a/=ne(e,i,1,f):"px"!==f&&(s=ne(e,i,s,f),f="px"),d&&(s||0===s)&&(l=s+a+f))),d&&(s+=a),!a&&0!==a||!s&&0!==s?void 0!==p[i]&&(l||l+""!="NaN"&&null!=l)?(r=new we(p,i,s||a||0,0,r,-1,i,!1,0,u,l)).xs0="none"!==l||"display"!==i&&-1===i.indexOf("Style")?l:u:Z("invalid "+i+" tween value: "+t[i]):(r=new we(p,i,a,s-a,r,0,i,!1!==C&&("px"===f||"zIndex"===i),0,u,l)).xs0=f)}n&&r&&!r.plugin&&(r.plugin=n)}return r},e.setRatio=function(e){var t,r,n,i=this._firstPT;if(1!==e||this._tween._time!==this._tween._duration&&0!==this._tween._time)if(e||this._tween._time!==this._tween._duration&&0!==this._tween._time||-1e-6===this._tween._rawPrevTime)for(;i;){if(t=i.c*e+i.s,i.r?t=i.r(t):t<1e-6&&-1e-6>16,e>>8&255,255&e];else{if(","===e.charAt(e.length-1)&&(e=e.substr(0,e.length-1)),g[e])r=g[e];else if("#"===e.charAt(0))4===e.length&&(e="#"+(n=e.charAt(1))+n+(i=e.charAt(2))+i+(o=e.charAt(3))+o),r=[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e];else if("hsl"===e.substr(0,3))if(r=h=e.match(d),t){if(-1!==e.indexOf("="))return e.match(p)}else a=Number(r[0])%360/360,s=Number(r[1])/100,n=2*(u=Number(r[2])/100)-(i=u<=.5?u*(s+1):u+s-u*s),3 length cannot be measured accurately when vector-effect is non-scaling-stroke and the element isn't proportionally scaled."),t*=(l+c)/2,e.style.strokeDasharray=i;else if("rect"===u)t=2*r.width*l+2*r.height*c;else if("line"===u)t=d(r.x,r.y,r.x+r.width,r.y+r.height,l,c);else if("polyline"===u||"polygon"===u)for(n=e.getAttribute("points").match(f)||[],"polygon"===u&&n.push(n[0],n[1]),t=0,o=2;o>16,e>>8&255,255&e]:"#"===e.charAt(0)?(4===e.length&&(e="#"+e.charAt(1)+e.charAt(1)+e.charAt(2)+e.charAt(2)+e.charAt(3)+e.charAt(3)),[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e]):e.match(t)||r.transparent},d=function(e,t,r){if(!c&&!(c=_gsScope.ColorFilter||_gsScope.createjs.ColorFilter))throw"EaselPlugin error: The EaselJS ColorFilter JavaScript file wasn't loaded.";for(var n,i,o,a,s,u=e.filters||[],l=u.length;-1<--l;)if(u[l]instanceof c){i=u[l];break}if(i||(i=new c,u.push(i),e.filters=u),o=i.clone(),null!=t.tint)n=h(t.tint),a=null!=t.tintAmount?Number(t.tintAmount):1,o.redOffset=Number(n[0])*a,o.greenOffset=Number(n[1])*a,o.blueOffset=Number(n[2])*a,o.redMultiplier=o.greenMultiplier=o.blueMultiplier=1-a;else for(s in t)"exposure"!==s&&"brightness"!==s&&(o[s]=Number(t[s]));for(null!=t.exposure?(o.redOffset=o.greenOffset=o.blueOffset=255*(Number(t.exposure)-1),o.redMultiplier=o.greenMultiplier=o.blueMultiplier=1):null!=t.brightness&&(a=Number(t.brightness)-1,o.redOffset=o.greenOffset=o.blueOffset=0p[0].length&&M(p[0],(d[0].length-p[0].length)/6|0),_=p.length;gMath.abs(o[0]-a[a.length-2])+Math.abs(o[1]-a[a.length-1])+Math.abs(o[o.length-2]-a[0])+Math.abs(o[o.length-1]-a[1])||r%2)?(P(a),y[_]=-1,b=!0):"auto"===r?y[_]=0:"reverse"===r&&(y[_]=-1),a.closed!==o.closed&&(a.closed=o.closed=!1));return x&&I("shapeIndex:["+y.join(",")+"]"),e.shapeIndex=y}},i=function(e,t){var r,n,i,o,a,s,u,l=0,c=parseFloat(e[0]),f=parseFloat(e[1]),h=c+","+f+" ";for(r=.5*t/(.5*(i=e.length)-1),n=0;n element. "+$),!1;if(o="PATH"===i?"d":"points",("string"==typeof t||t.getBBox||t[0])&&(t={shape:t}),!t.prop&&"function"!=typeof e.setAttribute)return!1;if(s=K(t.shape||t.d||t.points||"","d"==o,e),u&&R.test(s))return I("WARNING: a <"+i+"> cannot accept path data. "+$),!1;if(l=t.shapeIndex||0===t.shapeIndex?t.shapeIndex:"auto",c=t.map||Q.defaultMap,this._prop=t.prop,this._render=t.render||Q.defaultRender,this._apply="updateTarget"in t?t.updateTarget:Q.defaultUpdateTarget,this._rnd=Math.pow(10,isNaN(t.precision)?2:+t.precision),this._tween=r,s){if(this._target=e,b="object"==typeof t.precompile,d=this._prop?e[this._prop]:e.getAttribute(o),this._prop||e.getAttributeNS(null,"data-original")||e.setAttributeNS(null,"data-original",d),"d"==o||this._prop){if(d=D(b?t.precompile[0]:d),p=D(b?t.precompile[1]:s),!b&&!U(d,p,l,c,k))return!1;for("log"!==t.precompile&&!0!==t.precompile||I('precompile:["'+L(d)+'","'+L(p)+'"]'),(S="linear"!==(t.type||Q.defaultType))&&(d=Z(d,t.smoothTolerance),p=Z(p,t.smoothTolerance),d.size||N(d),p.size||N(p),T=J(E[0]),this._origin=d.origin={x:d.left+T.x*d.width,y:d.top+T.y*d.height},E[1]&&(T=J(E[1])),this._eOrigin={x:p.left+T.x*p.width,y:p.top+T.y*p.height}),this._rawPath=e._gsRawPath=d,m=d.length;-1<--m;)for(_=d[m],y=p[m],f=_.isSmooth||[],h=y.isSmooth||[],v=_.length,g=A=0;gp?i:o,sl:c,cl:G(u*u+l*l)-c,i:r}},Q.pathFilter=function(e,t,r,n,i){var o=D(e[0]),a=D(e[1]);U(o,a,t||0===t?t:"auto",r,i)&&(e[0]=L(o),e[1]=L(a),"log"!==n&&!0!==n||I('precompile:["'+e[0]+'","'+e[1]+'"]'))},Q.pointsFilter=r,Q.getTotalSize=N,Q.subdivideRawBezier=Q.subdivideSegment=M,Q.rawPathToString=L,Q.defaultType="linear",Q.defaultUpdateTarget=!0,Q.defaultMap="size",Q.stringToRawPath=Q.pathDataToRawBezier=function(e){return D(K(e,!0))},Q.equalizeSegmentQuantity=U,Q.convertToPath=function(e,t){"string"==typeof e&&(e=g.selector(e));for(var r=e&&0!==e.length?e.length&&e[0]&&e[0].nodeType?Array.prototype.slice.call(e,0):[e]:[],n=r.length;-1<--n;)r[n]=s(r[n],!1!==t);return r},Q.pathDataToBezier=function(e,t){var r,n,i,o,a,s,u,l,c=D(K(e,!0))[0]||[],f=0;if(l=(t=t||{}).align||t.relative,o=t.matrix||[1,0,0,1,0,0],a=t.offsetX||0,s=t.offsetY||0,"relative"===l||!0===l?(a-=c[0]*o[0]+c[1]*o[2],s-=c[0]*o[1]+c[1]*o[3],f="+="):(a+=o[4],s+=o[5],l&&(l="string"==typeof l?g.selector(l):l&&l[0]?l:[l])&&l[0]&&(a-=(u=l[0].getBBox()||{x:0,y:0}).x,s-=u.y)),r=[],i=c.length,o&&"1,0,0,1,0,0"!==o.join(","))for(n=0;n>16,e>>8&255,255&e];else{if(","===e.charAt(e.length-1)&&(e=e.substr(0,e.length-1)),m[e])r=m[e];else if("#"===e.charAt(0))4===e.length&&(e="#"+(n=e.charAt(1))+n+(i=e.charAt(2))+i+(o=e.charAt(3))+o),r=[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e];else if("hsl"===e.substr(0,3))if(r=h=e.match(p),d){if(-1!==e.indexOf("="))return e.match(g)}else a=Number(r[0])%360/360,s=Number(r[1])/100,n=2*(u=Number(r[2])/100)-(i=u<=.5?u*(s+1):u+s-u*s),3>16,e>>8&255,255&e]:""===e||null==e||"none"===e||"string"!=typeof e?r.transparent:r[e]?r[e]:"#"===e.charAt(0)?(4===e.length&&(e="#"+e.charAt(1)+e.charAt(1)+e.charAt(2)+e.charAt(2)+e.charAt(3)+e.charAt(3)),[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e]):e.match(t)||r.transparent},p={scaleX:1,scaleY:1,tx:1,ty:1,rotation:1,shortRotation:1,skewX:1,skewY:1,scale:1},g=function(e,t){var r=e.matrix,n=r.a,i=r.b,o=r.c,a=r.d,s=t&&e._gsTransform||{skewY:0},u=s.scaleX<0;return s.tx=r.e-(s.ox||0),s.ty=r.f-(s.oy||0),s.scaleX=Math.sqrt(n*n+i*i),s.scaleY=Math.sqrt(a*a+o*o),s.rotation=n||i?Math.atan2(i,n):s.rotation||0,s.skewX=o||a?Math.atan2(o,a)+s.rotation:s.skewX||0,Math.abs(s.skewX)>Math.PI/2&&(u?(s.scaleX*=-1,s.skewX+=s.rotation<=0?Math.PI:-Math.PI,s.rotation+=s.rotation<=0?Math.PI:-Math.PI):(s.scaleY*=-1,s.skewX+=s.skewX<=0?Math.PI:-Math.PI)),s.rotation<1e-6&&-1e-6>0)+", "+(r.gs+e*r.gc>>0)+", "+(r.bs+e*r.bc>>0)+")":2===r.type?r.t[r.p]="rgba("+(t>>0)+", "+(r.gs+e*r.gc>>0)+", "+(r.bs+e*r.bc>>0)+", "+(r.as+e*r.ac)+")":-1===r.type&&(r.t[r.p]=r.i):r.t[r.p]=t,r=r._next;if(this._target.attr(this._props),this._transform){var n=(r=this._transform).rotation,i=n-r.skewX,o=Math.cos(n)*r.scaleX,a=Math.sin(n)*r.scaleX,s=Math.sin(i)*-r.scaleY,u=Math.cos(i)*r.scaleY,l=this._pxl,c=this._pyl;a<1e-6&&-1e-6a.length&&a.grow(o),this._chars=a.sets[this._setIndex],this._revealDelay=t.revealDelay||0,this._tweenLength=!1!==t.tweenLength,this._tween=r,this._rightToLeft=!!t.rightToLeft,!0},set:function(e){var t,r,n,i,o,a,s,u,l,c=this._text.length,f=this._delimiter,h=this._tween._time,d=h-this._prevScrambleTime;this._revealDelay&&(this._tween.vars.runBackwards&&(h=this._tween._duration-h),e=0===h?0:hthis._speed||d<-this._speed)&&(this._setIndex=(this._setIndex+(19*Math.random()|0))%20,this._chars=this._charSet.sets[this._setIndex],this._prevScrambleTime+=d),this._chars):this._original.join(f),i=this._rightToLeft?1!==e||!this._tween.vars.runBackwards&&"isFromStart"!==this._tween.data?(s=this._text.slice(t).join(f),n=this._charsHaveEmoji?p(i).slice(0,this._length+(this._tweenLength?1-e*e*e:1)*this._lengthDif-(this._textHasEmoji?p(s):s).length+.5|0).join(""):i.substr(0,this._length+(this._tweenLength?1-e*e*e:1)*this._lengthDif-(this._textHasEmoji?p(s):s).length+.5|0),s):(n="",this._original.join(f)):(n=this._text.slice(0,t).join(f),r=(this._textHasEmoji?p(n):n).length,this._charsHaveEmoji?p(i).slice(r,this._length+(this._tweenLength?1-(e=1-e)*e*e*e:1)*this._lengthDif+.5|0).join(""):i.substr(r,this._length+(this._tweenLength?1-(e=1-e)*e*e*e:1)*this._lengthDif-r+.5|0)),s=this._hasClass?((o=(u=this._rightToLeft?this._oldClass:this._newClass)&&0!=t)?"":"")+n+(o?"":"")+((a=(l=this._rightToLeft?this._newClass:this._oldClass)&&t!==c)?"":"")+f+i+(a?"":""):n+f+i,this._target[this._prop]=" "===this._fillChar&&-1!==s.indexOf(" ")?s.split(" ").join("  "):s}}).prototype;for(a in a._newClass=a._oldClass="",g)g[a.toLowerCase()]=g[a],g[a.toUpperCase()]=g[a]}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(e){"use strict";var t=function(){return(_gsScope.GreenSockGlobals||_gsScope).ScrambleTextPlugin};"undefined"!=typeof module&&module.exports?(require("../TweenLite.js"),module.exports=t()):"function"==typeof define&&define.amd&&define(["TweenLite"],t)}();var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";var s=(_gsScope.document||{}).documentElement,u=_gsScope,a=function(e,t){var r="x"===t?"Width":"Height",n="scroll"+r,i="client"+r,o=document.body;return e===u||e===s||e===o?Math.max(s[n],o[n])-(u["inner"+r]||s[i]||o[i]):e[n]-e["offset"+r]},l=function(e,t){var r="scroll"+("x"===t?"Left":"Top");return e===u&&(null!=e.pageXOffset?r="page"+t.toUpperCase()+"Offset":e=null!=s[r]?s:document.body),function(){return e[r]}},o=function(e,t){var r=function(e){return"string"==typeof e&&(e=TweenLite.selector(e)),e.length&&e!==u&&e[0]&&e[0].style&&!e.nodeType&&(e=e[0]),e===u||e.nodeType&&e.style?e:null}(e).getBoundingClientRect(),n=document.body,i=!t||t===u||t===n,o=i?{top:s.clientTop-(window.pageYOffset||s.scrollTop||n.scrollTop||0),left:s.clientLeft-(window.pageXOffset||s.scrollLeft||n.scrollLeft||0)}:t.getBoundingClientRect(),a={x:r.left-o.left,y:r.top-o.top};return!i&&t&&(a.x+=l(t,"x")(),a.y+=l(t,"y")()),a},n=function(e,t,r,n){var i=typeof e;return isNaN(e)?"string"==i&&"="===e.charAt(1)?parseInt(e.charAt(0)+"1",10)*parseFloat(e.substr(2))+n:"max"===e?a(t,r):Math.min(a(t,r),o(e,t)[r]):parseFloat(e)},c=_gsScope._gsDefine.plugin({propName:"scrollTo",API:2,global:!0,version:"1.9.2",init:function(e,t,r){return this._wdw=e===u,this._target=e,this._tween=r,"object"!=typeof t?"string"==typeof(t={y:t}).y&&"max"!==t.y&&"="!==t.y.charAt(1)&&(t.x=t.y):t.nodeType&&(t={y:t,x:t}),this.vars=t,this._autoKill=!1!==t.autoKill,this.getX=l(e,"x"),this.getY=l(e,"y"),this.x=this.xPrev=this.getX(),this.y=this.yPrev=this.getY(),null!=t.x?(this._addTween(this,"x",this.x,n(t.x,e,"x",this.x)-(t.offsetX||0),"scrollTo_x",!0),this._overwriteProps.push("scrollTo_x")):this.skipX=!0,null!=t.y?(this._addTween(this,"y",this.y,n(t.y,e,"y",this.y)-(t.offsetY||0),"scrollTo_y",!0),this._overwriteProps.push("scrollTo_y")):this.skipY=!0,!0},set:function(e){this._super.setRatio.call(this,e);var t=this._wdw||!this.skipX?this.getX():this.xPrev,r=this._wdw||!this.skipY?this.getY():this.yPrev,n=r-this.yPrev,i=t-this.xPrev,o=c.autoKillThreshold;this.x<0&&(this.x=0),this.y<0&&(this.y=0),this._autoKill&&(!this.skipX&&(o":"")+this._text.slice(0,o).join(this._delimiter)+(t?"":"")+(r?"":"")+this._delimiter+this._original.slice(o).join(this._delimiter)+(r?"":"")):this._text.slice(0,o).join(this._delimiter)+this._delimiter+this._original.slice(o).join(this._delimiter),this._svg?this._target.textContent=n:this._target.innerHTML=" "===this._fillChar&&-1!==n.indexOf(" ")?n.split(" ").join("  "):n}}).prototype;t._newClass=t._oldClass=t._delimiter=""}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(e){"use strict";var t=function(){return(_gsScope.GreenSockGlobals||_gsScope).TextPlugin};"undefined"!=typeof module&&module.exports?(require("../TweenLite.js"),module.exports=t()):"function"==typeof define&&define.amd&&define(["TweenLite"],t)}();var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("plugins.ThrowPropsPlugin",["plugins.TweenPlugin","TweenLite","easing.Ease","utils.VelocityTracker"],function(r,M,P,C){var y,b,x,w,k=function(e,t){r.call(this,"throwProps"),this._overwriteProps.length=0},h=999999999999999,n=_gsScope._gsDefine.globals,E=!1,T={x:1,y:1,z:2,scale:1,scaleX:1,scaleY:1,rotation:1,rotationZ:1,rotationX:2,rotationY:2,skewX:1,skewY:1,xPercent:1,yPercent:1},l=function(e,t,r,n,i){var o,a,s,u,l=t.length,c=0,f=h;if("object"==typeof e){for(;-1<--l;){for(s in o=t[l],a=0,e)a+=(u=o[s]-e[s])*u;aNumber(s.max)+1e-10?(g=s.unitFactor||k.defaultUnitFactors[a]||1,(d=f>s.max&&s.min!==s.max||-15c&&(y||o.preventOvershoot?l=o.min-a:f=o.min-a-l)),this._overwriteProps[b]=i,this._props[b++]={p:i,s:a,c1:l,c2:f,f:s,r:!1}}return!0},e._kill=function(e){for(var t=this._props.length;-1<--t;)null!=e[this._props[t].p]&&this._props.splice(t,1);return r.prototype._kill.call(this,e)},e._mod=function(e){for(var t,r=this._props,n=r.length;-1<--n;)"function"==typeof(t=e[r[n].p]||e.throwProps)&&(r[n].m=t)},e.setRatio=function(e){for(var t,r,n=this._props.length;-1<--n;)r=(t=this._props[n]).s+t.c1*e+t.c2*e*e,t.m?r=t.m(r,this.target):1===e&&(r=(1e4*r+(r<0?-.5:.5)|0)/1e4),t.f?this.target[t.p](r):this.target[t.p]=r},r.activate([k]),k},!0),_gsScope._gsDefine("utils.VelocityTracker",["TweenLite"],function(a){var o,t,i,s=/([A-Z])/g,u={},e=_gsScope.document,l={x:1,y:1,z:2,scale:1,scaleX:1,scaleY:1,rotation:1,rotationZ:1,rotationX:2,rotationY:2,skewX:1,skewY:1,xPercent:1,yPercent:1},c="undefined"!=typeof window?window:e.defaultView||{getComputedStyle:function(){}},f=function(e,t,r){var n=(e._gsTransform||u)[t];return n||0===n?n:(e.style[t]?n=e.style[t]:(r=r||function(e){return c.getComputedStyle(e)}(e))?n=r[t]||r.getPropertyValue(t)||r.getPropertyValue(t.replace(s,"-$1").toLowerCase()):e.currentStyle&&(n=e.currentStyle[t]),parseFloat(n)||0)},h=a.ticker,d=function(e,t,r){this.p=e,this.f=t,this.v1=this.v2=0,this.t1=this.t2=h.time,this.css=!1,this.type="",this._prev=null,r&&((this._next=r)._prev=this)},r=function(){var e,t,r=o,n=h.time;if(.03<=n-i)for(i,i=n;r;){for(t=r._firstVP;t;)((e=t.css?f(r.target,t.p):t.f?r.target[t.p]():r.target[t.p])!==t.v1||.15]/gm,function(e){return I[e]})}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0===t.index}function i(e){return k.test(e)}function a(e){var n,t,r,a,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",t=B.exec(o))return R(t[1])?t[1]:"no-highlight";for(o=o.split(/\s+/),n=0,r=o.length;r>n;n++)if(a=o[n],i(a)||R(a))return a}function o(e,n){var t,r={};for(t in e)r[t]=e[t];if(n)for(t in n)r[t]=n[t];return r}function u(e){var n=[];return function r(e,i){for(var a=e.firstChild;a;a=a.nextSibling)3===a.nodeType?i+=a.nodeValue.length:1===a.nodeType&&(n.push({event:"start",offset:i,node:a}),i=r(a,i),t(a).match(/br|hr|img|input/)||n.push({event:"stop",offset:i,node:a}));return i}(e,0),n}function c(e,r,i){function a(){return e.length&&r.length?e[0].offset!==r[0].offset?e[0].offset"}function u(e){l+=""}function c(e){("start"===e.event?o:u)(e.node)}for(var s=0,l="",f=[];e.length||r.length;){var g=a();if(l+=n(i.substring(s,g[0].offset)),s=g[0].offset,g===e){f.reverse().forEach(u);do c(g.splice(0,1)[0]),g=a();while(g===e&&g.length&&g[0].offset===s);f.reverse().forEach(o)}else"start"===g[0].event?f.push(g[0].node):f.pop(),c(g.splice(0,1)[0])}return l+n(i.substr(s))}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(i,a){if(!i.compiled){if(i.compiled=!0,i.k=i.k||i.bK,i.k){var u={},c=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");u[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof i.k?c("keyword",i.k):E(i.k).forEach(function(e){c(e,i.k[e])}),i.k=u}i.lR=t(i.l||/\w+/,!0),a&&(i.bK&&(i.b="\\b("+i.bK.split(" ").join("|")+")\\b"),i.b||(i.b=/\B|\b/),i.bR=t(i.b),i.e||i.eW||(i.e=/\B|\b/),i.e&&(i.eR=t(i.e)),i.tE=n(i.e)||"",i.eW&&a.tE&&(i.tE+=(i.e?"|":"")+a.tE)),i.i&&(i.iR=t(i.i)),null==i.r&&(i.r=1),i.c||(i.c=[]);var s=[];i.c.forEach(function(e){e.v?e.v.forEach(function(n){s.push(o(e,n))}):s.push("self"===e?i:e)}),i.c=s,i.c.forEach(function(e){r(e,i)}),i.starts&&r(i.starts,a);var l=i.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([i.tE,i.i]).map(n).filter(Boolean);i.t=l.length?t(l.join("|"),!0):{exec:function(){return null}}}}r(e)}function l(e,t,i,a){function o(e,n){var t,i;for(t=0,i=n.c.length;i>t;t++)if(r(n.c[t].bR,e))return n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function c(e,n){return!i&&r(n.iR,e)}function g(e,n){var t=N.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function h(e,n,t,r){var i=r?"":y.classPrefix,a='',a+n+o}function p(){var e,t,r,i;if(!E.k)return n(B);for(i="",t=0,E.lR.lastIndex=0,r=E.lR.exec(B);r;)i+=n(B.substring(t,r.index)),e=g(E,r),e?(M+=e[1],i+=h(e[0],n(r[0]))):i+=n(r[0]),t=E.lR.lastIndex,r=E.lR.exec(B);return i+n(B.substr(t))}function d(){var e="string"==typeof E.sL;if(e&&!x[E.sL])return n(B);var t=e?l(E.sL,B,!0,L[E.sL]):f(B,E.sL.length?E.sL:void 0);return E.r>0&&(M+=t.r),e&&(L[E.sL]=t.top),h(t.language,t.value,!1,!0)}function b(){k+=null!=E.sL?d():p(),B=""}function v(e){k+=e.cN?h(e.cN,"",!0):"",E=Object.create(e,{parent:{value:E}})}function m(e,n){if(B+=e,null==n)return b(),0;var t=o(n,E);if(t)return t.skip?B+=n:(t.eB&&(B+=n),b(),t.rB||t.eB||(B=n)),v(t,n),t.rB?0:n.length;var r=u(E,n);if(r){var i=E;i.skip?B+=n:(i.rE||i.eE||(B+=n),b(),i.eE&&(B=n));do E.cN&&(k+=C),E.skip||(M+=E.r),E=E.parent;while(E!==r.parent);return r.starts&&v(r.starts,""),i.rE?0:n.length}if(c(n,E))throw new Error('Illegal lexeme "'+n+'" for mode "'+(E.cN||"")+'"');return B+=n,n.length||1}var N=R(e);if(!N)throw new Error('Unknown language: "'+e+'"');s(N);var w,E=a||N,L={},k="";for(w=E;w!==N;w=w.parent)w.cN&&(k=h(w.cN,"",!0)+k);var B="",M=0;try{for(var I,j,O=0;;){if(E.t.lastIndex=O,I=E.t.exec(t),!I)break;j=m(t.substring(O,I.index),I[0]),O=I.index+j}for(m(t.substr(O)),w=E;w.parent;w=w.parent)w.cN&&(k+=C);return{r:M,value:k,language:e,top:E}}catch(T){if(T.message&&-1!==T.message.indexOf("Illegal"))return{r:0,value:n(t)};throw T}}function f(e,t){t=t||y.languages||E(x);var r={r:0,value:n(e)},i=r;return t.filter(R).forEach(function(n){var t=l(n,e,!1);t.language=n,t.r>i.r&&(i=t),t.r>r.r&&(i=r,r=t)}),i.language&&(r.second_best=i),r}function g(e){return y.tabReplace||y.useBR?e.replace(M,function(e,n){return y.useBR&&"\n"===e?"
":y.tabReplace?n.replace(/\t/g,y.tabReplace):void 0}):e}function h(e,n,t){var r=n?L[n]:t,i=[e.trim()];return e.match(/\bhljs\b/)||i.push("hljs"),-1===e.indexOf(r)&&i.push(r),i.join(" ").trim()}function p(e){var n,t,r,o,s,p=a(e);i(p)||(y.useBR?(n=document.createElementNS("http://www.w3.org/1999/xhtml","div"),n.innerHTML=e.innerHTML.replace(/\n/g,"").replace(//g,"\n")):n=e,s=n.textContent,r=p?l(p,s,!0):f(s),t=u(n),t.length&&(o=document.createElementNS("http://www.w3.org/1999/xhtml","div"),o.innerHTML=r.value,r.value=c(t,u(o),s)),r.value=g(r.value),e.innerHTML=r.value,e.className=h(e.className,p,r.language),e.result={language:r.language,re:r.r},r.second_best&&(e.second_best={language:r.second_best.language,re:r.second_best.r}))}function d(e){y=o(y,e)}function b(){if(!b.called){b.called=!0;var e=document.querySelectorAll("pre code");w.forEach.call(e,p)}}function v(){addEventListener("DOMContentLoaded",b,!1),addEventListener("load",b,!1)}function m(n,t){var r=x[n]=t(e);r.aliases&&r.aliases.forEach(function(e){L[e]=n})}function N(){return E(x)}function R(e){return e=(e||"").toLowerCase(),x[e]||x[L[e]]}var w=[],E=Object.keys,x={},L={},k=/^(no-?highlight|plain|text)$/i,B=/\blang(?:uage)?-([\w-]+)\b/i,M=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,C="
",y={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},I={"&":"&","<":"<",">":">"};return e.highlight=l,e.highlightAuto=f,e.fixMarkup=g,e.highlightBlock=p,e.configure=d,e.initHighlighting=b,e.initHighlightingOnLoad=v,e.registerLanguage=m,e.listLanguages=N,e.getLanguage=R,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(n,t,r){var i=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return i.c.push(e.PWM),i.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),i},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("ini",function(e){var b={cN:"string",c:[e.BE],v:[{b:"'''",e:"'''",r:10},{b:'"""',e:'"""',r:10},{b:'"',e:'"'},{b:"'",e:"'"}]};return{aliases:["toml"],cI:!0,i:/\S/,c:[e.C(";","$"),e.HCM,{cN:"section",b:/^\s*\[+/,e:/\]+/},{b:/^[a-z0-9\[\]_-]+\s*=\s*/,e:"$",rB:!0,c:[{cN:"attr",b:/[a-z0-9\[\]_-]+/},{b:/=/,eW:!0,r:0,c:[{cN:"literal",b:/\bon|off|true|false|yes|no\b/},{cN:"variable",v:[{b:/\$[\w\d"][\w\d_]*/},{b:/\$\{(.*?)}/}]},b,{cN:"number",b:/([\+\-]+)?[\d]+_[\d_]+/},e.NM]}]}]}});hljs.registerLanguage("diff",function(e){return{aliases:["patch"],c:[{cN:"meta",r:10,v:[{b:/^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"comment",v:[{b:/Index: /,e:/$/},{b:/={3,}/,e:/$/},{b:/^\-{3}/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+{3}/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"addition",b:"^\\!",e:"$"}]}});hljs.registerLanguage("coffeescript",function(e){var c={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super yield import export from as default await then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",built_in:"npm require console print module global window document"},n="[A-Za-z$_][0-9A-Za-z$_]*",r={cN:"subst",b:/#\{/,e:/}/,k:c},i=[e.BNM,e.inherit(e.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'''/,e:/'''/,c:[e.BE]},{b:/'/,e:/'/,c:[e.BE]},{b:/"""/,e:/"""/,c:[e.BE,r]},{b:/"/,e:/"/,c:[e.BE,r]}]},{cN:"regexp",v:[{b:"///",e:"///",c:[r,e.HCM]},{b:"//[gim]*",r:0},{b:/\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/}]},{b:"@"+n},{sL:"javascript",eB:!0,eE:!0,v:[{b:"```",e:"```"},{b:"`",e:"`"}]}];r.c=i;var s=e.inherit(e.TM,{b:n}),t="(\\(.*\\))?\\s*\\B[-=]>",o={cN:"params",b:"\\([^\\(]",rB:!0,c:[{b:/\(/,e:/\)/,k:c,c:["self"].concat(i)}]};return{aliases:["coffee","cson","iced"],k:c,i:/\/\*/,c:i.concat([e.C("###","###"),e.HCM,{cN:"function",b:"^\\s*"+n+"\\s*=\\s*"+t,e:"[-=]>",rB:!0,c:[s,o]},{b:/[:\(,=]\s*/,r:0,c:[{cN:"function",b:t,e:"[-=]>",rB:!0,c:[o]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[s]},s]},{b:n+":",e:":",rB:!0,rE:!0,r:0}])}});hljs.registerLanguage("cs",function(e){var i={keyword:"abstract as base bool break byte case catch char checked const continue decimal default delegate do double else enum event explicit extern finally fixed float for foreach goto if implicit in int interface internal is lock long object operator out override params private protected public readonly ref sbyte sealed short sizeof stackalloc static string struct switch this try typeof uint ulong unchecked unsafe ushort using virtual void volatile while nameof add alias ascending async await by descending dynamic equals from get global group into join let on orderby partial remove select set value var where yield",literal:"null false true"},r={cN:"string",b:'@"',e:'"',c:[{b:'""'}]},t=e.inherit(r,{i:/\n/}),a={cN:"subst",b:"{",e:"}",k:i},n=e.inherit(a,{i:/\n/}),c={cN:"string",b:/\$"/,e:'"',i:/\n/,c:[{b:"{{"},{b:"}}"},e.BE,n]},s={cN:"string",b:/\$@"/,e:'"',c:[{b:"{{"},{b:"}}"},{b:'""'},a]},o=e.inherit(s,{i:/\n/,c:[{b:"{{"},{b:"}}"},{b:'""'},n]});a.c=[s,c,r,e.ASM,e.QSM,e.CNM,e.CBCM],n.c=[o,c,t,e.ASM,e.QSM,e.CNM,e.inherit(e.CBCM,{i:/\n/})];var l={v:[s,c,r,e.ASM,e.QSM]},b=e.IR+"(<"+e.IR+"(\\s*,\\s*"+e.IR+")*>)?(\\[\\])?";return{aliases:["csharp"],k:i,i:/::/,c:[e.C("///","$",{rB:!0,c:[{cN:"doctag",v:[{b:"///",r:0},{b:""},{b:""}]}]}),e.CLCM,e.CBCM,{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef warning error line region endregion pragma checksum"}},l,e.CNM,{bK:"class interface",e:/[{;=]/,i:/[^\s:]/,c:[e.TM,e.CLCM,e.CBCM]},{bK:"namespace",e:/[{;=]/,i:/[^\s:]/,c:[e.inherit(e.TM,{b:"[a-zA-Z](\\.?\\w)*"}),e.CLCM,e.CBCM]},{bK:"new return throw await",r:0},{cN:"function",b:"("+b+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:i,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:i,r:0,c:[l,e.CNM,e.CBCM]},e.CLCM,e.CBCM]}]}});hljs.registerLanguage("sql",function(e){var t=e.C("--","$");return{cI:!0,i:/[<>{}*#]/,c:[{bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke comment",e:/;/,eW:!0,l:/[\w\.]+/,k:{keyword:"abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text varchar varying void"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t]},e.CBCM,t]}});hljs.registerLanguage("javascript",function(e){var r="[A-Za-z$_][0-9A-Za-z$_]*",t={keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},a={cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},n={cN:"subst",b:"\\$\\{",e:"\\}",k:t,c:[]},c={cN:"string",b:"`",e:"`",c:[e.BE,n]};n.c=[e.ASM,e.QSM,c,a,e.RM];var s=n.c.concat([e.CBCM,e.CLCM]);return{aliases:["js","jsx"],k:t,c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,c,e.CLCM,e.CBCM,a,{b:/[{,]\s*/,r:0,c:[{b:r+"\\s*:",rB:!0,r:0,c:[{cN:"attr",b:r,r:0}]}]},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+r+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:r},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,c:s}]}]},{b://,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:r}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:s}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}});hljs.registerLanguage("nginx",function(e){var r={cN:"variable",v:[{b:/\$\d+/},{b:/\$\{/,e:/}/},{b:"[\\$\\@]"+e.UIR}]},b={eW:!0,l:"[a-z/_]+",k:{literal:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[e.HCM,{cN:"string",c:[e.BE,r],v:[{b:/"/,e:/"/},{b:/'/,e:/'/}]},{b:"([a-z]+):/",e:"\\s",eW:!0,eE:!0,c:[r]},{cN:"regexp",c:[e.BE,r],v:[{b:"\\s\\^",e:"\\s|{|;",rE:!0},{b:"~\\*?\\s+",e:"\\s|{|;",rE:!0},{b:"\\*(\\.[a-z\\-]+)+"},{b:"([a-z\\-]+\\.)+\\*"}]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0},r]};return{aliases:["nginxconf"],c:[e.HCM,{b:e.UIR+"\\s+{",rB:!0,e:"{",c:[{cN:"section",b:e.UIR}],r:0},{b:e.UIR+"\\s",e:";|{",rB:!0,c:[{cN:"attribute",b:e.UIR,starts:b}],r:0}],i:"[^\\s\\}]"}});hljs.registerLanguage("objectivec",function(e){var t={cN:"built_in",b:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},_={keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign readwrite self @synchronized id typeof nonatomic super unichar IBOutlet IBAction strong weak copy in out inout bycopy byref oneway __strong __weak __block __autoreleasing @private @protected @public @try @property @end @throw @catch @finally @autoreleasepool @synthesize @dynamic @selector @optional @required @encode @package @import @defs @compatibility_alias __bridge __bridge_transfer __bridge_retained __bridge_retain __covariant __contravariant __kindof _Nonnull _Nullable _Null_unspecified __FUNCTION__ __PRETTY_FUNCTION__ __attribute__ getter setter retain unsafe_unretained nonnull nullable null_unspecified null_resettable class instancetype NS_DESIGNATED_INITIALIZER NS_UNAVAILABLE NS_REQUIRES_SUPER NS_RETURNS_INNER_POINTER NS_INLINE NS_AVAILABLE NS_DEPRECATED NS_ENUM NS_OPTIONS NS_SWIFT_UNAVAILABLE NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_REFINED_FOR_SWIFT NS_SWIFT_NAME NS_SWIFT_NOTHROW NS_DURING NS_HANDLER NS_ENDHANDLER NS_VALUERETURN NS_VOIDRETURN",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"BOOL dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"},i=/[a-zA-Z@][a-zA-Z0-9_]*/,n="@interface @class @protocol @implementation";return{aliases:["mm","objc","obj-c"],k:_,l:i,i:""}]}]},{cN:"class",b:"("+n.split(" ").join("|")+")\\b",e:"({|$)",eE:!0,k:n,l:i,c:[e.UTM]},{b:"\\."+e.UIR,r:0}]}});hljs.registerLanguage("php",function(e){var c={b:"\\$+[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*"},i={cN:"meta",b:/<\?(php)?|\?>/},t={cN:"string",c:[e.BE,i],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},a={v:[e.BNM,e.CNM]};return{aliases:["php3","php4","php5","php6"],cI:!0,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[e.HCM,e.C("//","$",{c:[i]}),e.C("/\\*","\\*/",{c:[{cN:"doctag",b:"@[A-Za-z]+"}]}),e.C("__halt_compiler.+?;",!1,{eW:!0,k:"__halt_compiler",l:e.UIR}),{cN:"string",b:/<<<['"]?\w+['"]?$/,e:/^\w+;?$/,c:[e.BE,{cN:"subst",v:[{b:/\$\w+/},{b:/\{\$/,e:/\}/}]}]},i,{cN:"keyword",b:/\$this\b/},c,{b:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{cN:"function",bK:"function",e:/[;{]/,eE:!0,i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",c,e.CBCM,t,a]}]},{cN:"class",bK:"class interface",e:"{",eE:!0,i:/[:\(\$"]/,c:[{bK:"extends implements"},e.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[e.UTM]},{bK:"use",e:";",c:[e.UTM]},{b:"=>"},t,a]}});hljs.registerLanguage("json",function(e){var i={literal:"true false null"},n=[e.QSM,e.CNM],r={e:",",eW:!0,eE:!0,c:n,k:i},t={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(r,{b:/:/})],i:"\\S"},c={b:"\\[",e:"\\]",c:[e.inherit(r)],i:"\\S"};return n.splice(n.length,0,t,c),{c:n,k:i,i:"\\S"}});hljs.registerLanguage("cpp",function(t){var e={cN:"keyword",b:"\\b[a-z\\d_]*_t\\b"},r={cN:"string",v:[{b:'(u8?|U)?L?"',e:'"',i:"\\n",c:[t.BE]},{b:'(u8?|U)?R"',e:'"',c:[t.BE]},{b:"'\\\\?.",e:"'",i:"."}]},s={cN:"number",v:[{b:"\\b(0b[01']+)"},{b:"\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{b:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],r:0},i={cN:"meta",b:/#\s*[a-z]+\b/,e:/$/,k:{"meta-keyword":"if else elif endif define undef warning error line pragma ifdef ifndef include"},c:[{b:/\\\n/,r:0},t.inherit(r,{cN:"meta-string"}),{cN:"meta-string",b:"<",e:">",i:"\\n"},t.CLCM,t.CBCM]},a=t.IR+"\\s*\\(",c={keyword:"int float while private char catch import module export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue inline delete alignof constexpr decltype noexcept static_assert thread_local restrict _Bool complex _Complex _Imaginary atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong new throw return",built_in:"std string cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr",literal:"true false nullptr NULL"},n=[e,t.CLCM,t.CBCM,s,r];return{aliases:["c","cc","h","c++","h++","hpp"],k:c,i:"",k:c,c:["self",e]},{b:t.IR+"::",k:c},{v:[{b:/=/,e:/;/},{b:/\(/,e:/\)/},{bK:"new throw return else",e:/;/}],k:c,c:n.concat([{b:/\(/,e:/\)/,k:c,c:n.concat(["self"]),r:0}]),r:0},{cN:"function",b:"("+t.IR+"[\\*&\\s]+)+"+a,rB:!0,e:/[{;=]/,eE:!0,k:c,i:/[^\w\s\*&]/,c:[{b:a,rB:!0,c:[t.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:c,r:0,c:[t.CLCM,t.CBCM,r,s,e]},t.CLCM,t.CBCM,i]}]),exports:{preprocessor:i,strings:r,k:c}}});hljs.registerLanguage("python",function(e){var r={cN:"meta",b:/^(>>>|\.\.\.) /},b={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[r],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[r],r:10},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},e.ASM,e.QSM]},a={cN:"number",r:0,v:[{b:e.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:e.CNR+"[lLjJ]?"}]},l={cN:"params",b:/\(/,e:/\)/,c:["self",r,a,b]};return{aliases:["py","gyp"],k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda async await nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)|=>/,c:[r,a,b,e.HCM,{v:[{cN:"function",bK:"def"},{cN:"class",bK:"class"}],e:/:/,i:/[${=;\n,]/,c:[e.UTM,l,{b:/->/,eW:!0,k:"None"}]},{cN:"meta",b:/^[\t ]*@/,e:/$/},{b:/\b(print|exec)\(/}]}});hljs.registerLanguage("makefile",function(e){var a={cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]};return{aliases:["mk","mak"],c:[e.HCM,{b:/^\w+\s*\W*=/,rB:!0,r:0,starts:{e:/\s*\W*=/,eE:!0,starts:{e:/$/,r:0,c:[a]}}},{cN:"section",b:/^[\w]+:\s*$/},{cN:"meta",b:/^\.PHONY:/,e:/$/,k:{"meta-keyword":".PHONY"},l:/[\.\w]+/},{b:/^\t+/,e:/$/,r:0,c:[e.QSM,a]}]}});hljs.registerLanguage("xml",function(s){var e="[A-Za-z0-9\\._:-]+",t={eW:!0,i:/`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},s.C("",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0}]},{cN:"tag",b:"|$)",e:">",k:{name:"style"},c:[t],starts:{e:"",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"|$)",e:">",k:{name:"script"},c:[t],starts:{e:"",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"",c:[{cN:"name",b:/[^\/><\s]+/,r:0},t]}]}});hljs.registerLanguage("http",function(e){var t="HTTP/[0-9\\.]+";return{aliases:["https"],i:"\\S",c:[{b:"^"+t,e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{b:"^[A-Z]+ (.*?) "+t+"$",rB:!0,e:"$",c:[{cN:"string",b:" ",e:" ",eB:!0,eE:!0},{b:t},{cN:"keyword",b:"[A-Z]+"}]},{cN:"attribute",b:"^\\w",e:": ",eE:!0,i:"\\n|\\s|=",starts:{e:"$",r:0}},{b:"\\n\\n",starts:{sL:[],eW:!0}}]}});hljs.registerLanguage("java",function(e){var a="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",t=a+"(<"+a+"(\\s*,\\s*"+a+")*>)?",r="false synchronized int abstract float private char boolean static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private module requires exports do",s="\\b(0[bB]([01]+[01_]+[01]+|[01]+)|0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)|(([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?|\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))([eE][-+]?\\d+)?)[lLfF]?",c={cN:"number",b:s,r:0};return{aliases:["jsp"],k:r,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return else",r:0},{cN:"function",b:"("+t+"\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:r,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:r,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},c,{cN:"meta",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("markdown",function(e){return{aliases:["md","mkdown","mkd"],c:[{cN:"section",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"quote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"^```w*s*$",e:"^```s*$"},{b:"`.+?`"},{b:"^( {4}| )",e:"$",r:0}]},{b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"string",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"symbol",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:/^\[[^\n]+\]:/,rB:!0,c:[{cN:"symbol",b:/\[/,e:/\]/,eB:!0,eE:!0},{cN:"link",b:/:\s*/,e:/$/,eB:!0}]}]}});hljs.registerLanguage("apache",function(e){var r={cN:"number",b:"[\\$%]\\d+"};return{aliases:["apacheconf"],cI:!0,c:[e.HCM,{cN:"section",b:""},{cN:"attribute",b:/\w+/,r:0,k:{nomarkup:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"meta",b:"\\s\\[",e:"\\]$"},{cN:"variable",b:"[\\$%]\\{",e:"\\}",c:["self",r]},r,e.QSM]}}],i:/\S/}});hljs.registerLanguage("css",function(e){var c="[a-zA-Z-][a-zA-Z0-9_-]*",t={b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\w-]+\(/,rB:!0,c:[{cN:"built_in",b:/[\w-]+/},{b:/\(/,e:/\)/,c:[e.ASM,e.QSM]}]},e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"number",b:"#[0-9A-Fa-f]+"},{cN:"meta",b:"!important"}]}}]};return{cI:!0,i:/[=\/|'\$]/,c:[e.CBCM,{cN:"selector-id",b:/#[A-Za-z0-9_-]+/},{cN:"selector-class",b:/\.[A-Za-z0-9_-]+/},{cN:"selector-attr",b:/\[/,e:/\]/,i:"$"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{b:"@",e:"[{;]",i:/:/,c:[{cN:"keyword",b:/\w+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[e.ASM,e.QSM,e.CSSNM]}]},{cN:"selector-tag",b:c,r:0},{b:"{",e:"}",i:/\S/,c:[e.CBCM,t]}]}});hljs.registerLanguage("ruby",function(e){var b="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",r={keyword:"and then defined module in return redo if BEGIN retry end for self when next until do begin unless END rescue else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor",literal:"true false nil"},c={cN:"doctag",b:"@[A-Za-z]+"},a={b:"#<",e:">"},s=[e.C("#","$",{c:[c]}),e.C("^\\=begin","^\\=end",{c:[c],r:10}),e.C("^__END__","\\n$")],n={cN:"subst",b:"#\\{",e:"}",k:r},t={cN:"string",c:[e.BE,n],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/`/,e:/`/},{b:"%[qQwWx]?\\(",e:"\\)"},{b:"%[qQwWx]?\\[",e:"\\]"},{b:"%[qQwWx]?{",e:"}"},{b:"%[qQwWx]?<",e:">"},{b:"%[qQwWx]?/",e:"/"},{b:"%[qQwWx]?%",e:"%"},{b:"%[qQwWx]?-",e:"-"},{b:"%[qQwWx]?\\|",e:"\\|"},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/},{b:/<<(-?)\w+$/,e:/^\s*\w+$/}]},i={cN:"params",b:"\\(",e:"\\)",endsParent:!0,k:r},d=[t,a,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{b:"<\\s*",c:[{b:"("+e.IR+"::)?"+e.IR}]}].concat(s)},{cN:"function",bK:"def",e:"$|;",c:[e.inherit(e.TM,{b:b}),i].concat(s)},{b:e.IR+"::"},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":(?!\\s)",c:[t,{b:b}],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{cN:"params",b:/\|/,e:/\|/,k:r},{b:"("+e.RSR+"|unless)\\s*",c:[a,{cN:"regexp",c:[e.BE,n],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}].concat(s),r:0}].concat(s);n.c=d,i.c=d;var l="[>?]>",o="[\\w#]+\\(\\w+\\):\\d+:\\d+>",u="(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>",w=[{b:/^\s*=>/,starts:{e:"$",c:d}},{cN:"meta",b:"^("+l+"|"+o+"|"+u+")",starts:{e:"$",c:d}}];return{aliases:["rb","gemspec","podspec","thor","irb"],k:r,i:/\/\*/,c:s.concat(w).concat(d)}});hljs.registerLanguage("perl",function(e){var t="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when",r={cN:"subst",b:"[$@]\\{",e:"\\}",k:t},s={b:"->{",e:"}"},n={v:[{b:/\$\d/},{b:/[\$%@](\^\w\b|#\w+(::\w+)*|{\w+}|\w+(::\w*)*)/},{b:/[\$%@][^\s\w{]/,r:0}]},i=[e.BE,r,n],o=[n,e.HCM,e.C("^\\=\\w","\\=cut",{eW:!0}),s,{cN:"string",c:i,v:[{b:"q[qwxr]?\\s*\\(",e:"\\)",r:5},{b:"q[qwxr]?\\s*\\[",e:"\\]",r:5},{b:"q[qwxr]?\\s*\\{",e:"\\}",r:5},{b:"q[qwxr]?\\s*\\|",e:"\\|",r:5},{b:"q[qwxr]?\\s*\\<",e:"\\>",r:5},{b:"qw\\s+q",e:"q",r:5},{b:"'",e:"'",c:[e.BE]},{b:'"',e:'"'},{b:"`",e:"`",c:[e.BE]},{b:"{\\w+}",c:[],r:0},{b:"-?\\w+\\s*\\=\\>",c:[],r:0}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\/\\/|"+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"function",bK:"sub",e:"(\\s*\\(.*?\\))?[;{]",eE:!0,r:5,c:[e.TM]},{b:"-\\w\\b",r:0},{b:"^__DATA__$",e:"^__END__$",sL:"mojolicious",c:[{b:"^@@.*",e:"$",cN:"comment"}]}];return r.c=o,s.c=o,{aliases:["pl","pm"],l:/[\w\.]+/,k:t,c:o}});hljs.registerLanguage("bash",function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},s={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]},a={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/-?[a-z\._]+/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"meta",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,s,a,t]}}); +/*! + * VERSION: 0.6.1 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + _gsScope._gsDefine.plugin({ + propName: "attr", + API: 2, + version: "0.6.1", + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween, index) { + var p, end; + if (typeof(target.setAttribute) !== "function") { + return false; + } + for (p in value) { + end = value[p]; + if (typeof(end) === "function") { + end = end(index, target); + } + this._addTween(target, "setAttribute", target.getAttribute(p) + "", end + "", p, false, p); + this._overwriteProps.push(p); + } + return true; + } + + }); + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("AttrPlugin")); +/*! + * VERSION: 1.3.8 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + **/ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _RAD2DEG = 180 / Math.PI, + _r1 = [], + _r2 = [], + _r3 = [], + _corProps = {}, + _globals = _gsScope._gsDefine.globals, + Segment = function(a, b, c, d) { + if (c === d) { //if c and d match, the final autoRotate value could lock at -90 degrees, so differentiate them slightly. + c = d - (d - b) / 1000000; + } + if (a === b) { //if a and b match, the starting autoRotate value could lock at -90 degrees, so differentiate them slightly. + b = a + (c - a) / 1000000; + } + this.a = a; + this.b = b; + this.c = c; + this.d = d; + this.da = d - a; + this.ca = c - a; + this.ba = b - a; + }, + _correlate = ",x,y,z,left,top,right,bottom,marginTop,marginLeft,marginRight,marginBottom,paddingLeft,paddingTop,paddingRight,paddingBottom,backgroundPosition,backgroundPosition_y,", + cubicToQuadratic = function(a, b, c, d) { + var q1 = {a:a}, + q2 = {}, + q3 = {}, + q4 = {c:d}, + mab = (a + b) / 2, + mbc = (b + c) / 2, + mcd = (c + d) / 2, + mabc = (mab + mbc) / 2, + mbcd = (mbc + mcd) / 2, + m8 = (mbcd - mabc) / 8; + q1.b = mab + (a - mab) / 4; + q2.b = mabc + m8; + q1.c = q2.a = (q1.b + q2.b) / 2; + q2.c = q3.a = (mabc + mbcd) / 2; + q3.b = mbcd - m8; + q4.b = mcd + (d - mcd) / 4; + q3.c = q4.a = (q3.b + q4.b) / 2; + return [q1, q2, q3, q4]; + }, + _calculateControlPoints = function(a, curviness, quad, basic, correlate) { + var l = a.length - 1, + ii = 0, + cp1 = a[0].a, + i, p1, p2, p3, seg, m1, m2, mm, cp2, qb, r1, r2, tl; + for (i = 0; i < l; i++) { + seg = a[ii]; + p1 = seg.a; + p2 = seg.d; + p3 = a[ii+1].d; + + if (correlate) { + r1 = _r1[i]; + r2 = _r2[i]; + tl = ((r2 + r1) * curviness * 0.25) / (basic ? 0.5 : _r3[i] || 0.5); + m1 = p2 - (p2 - p1) * (basic ? curviness * 0.5 : (r1 !== 0 ? tl / r1 : 0)); + m2 = p2 + (p3 - p2) * (basic ? curviness * 0.5 : (r2 !== 0 ? tl / r2 : 0)); + mm = p2 - (m1 + (((m2 - m1) * ((r1 * 3 / (r1 + r2)) + 0.5) / 4) || 0)); + } else { + m1 = p2 - (p2 - p1) * curviness * 0.5; + m2 = p2 + (p3 - p2) * curviness * 0.5; + mm = p2 - (m1 + m2) / 2; + } + m1 += mm; + m2 += mm; + + seg.c = cp2 = m1; + if (i !== 0) { + seg.b = cp1; + } else { + seg.b = cp1 = seg.a + (seg.c - seg.a) * 0.6; //instead of placing b on a exactly, we move it inline with c so that if the user specifies an ease like Back.easeIn or Elastic.easeIn which goes BEYOND the beginning, it will do so smoothly. + } + + seg.da = p2 - p1; + seg.ca = cp2 - p1; + seg.ba = cp1 - p1; + + if (quad) { + qb = cubicToQuadratic(p1, cp1, cp2, p2); + a.splice(ii, 1, qb[0], qb[1], qb[2], qb[3]); + ii += 4; + } else { + ii++; + } + + cp1 = m2; + } + seg = a[ii]; + seg.b = cp1; + seg.c = cp1 + (seg.d - cp1) * 0.4; //instead of placing c on d exactly, we move it inline with b so that if the user specifies an ease like Back.easeOut or Elastic.easeOut which goes BEYOND the end, it will do so smoothly. + seg.da = seg.d - seg.a; + seg.ca = seg.c - seg.a; + seg.ba = cp1 - seg.a; + if (quad) { + qb = cubicToQuadratic(seg.a, cp1, seg.c, seg.d); + a.splice(ii, 1, qb[0], qb[1], qb[2], qb[3]); + } + }, + _parseAnchors = function(values, p, correlate, prepend) { + var a = [], + l, i, p1, p2, p3, tmp; + if (prepend) { + values = [prepend].concat(values); + i = values.length; + while (--i > -1) { + if (typeof( (tmp = values[i][p]) ) === "string") if (tmp.charAt(1) === "=") { + values[i][p] = prepend[p] + Number(tmp.charAt(0) + tmp.substr(2)); //accommodate relative values. Do it inline instead of breaking it out into a function for speed reasons + } + } + } + l = values.length - 2; + if (l < 0) { + a[0] = new Segment(values[0][p], 0, 0, values[0][p]); + return a; + } + for (i = 0; i < l; i++) { + p1 = values[i][p]; + p2 = values[i+1][p]; + a[i] = new Segment(p1, 0, 0, p2); + if (correlate) { + p3 = values[i+2][p]; + _r1[i] = (_r1[i] || 0) + (p2 - p1) * (p2 - p1); + _r2[i] = (_r2[i] || 0) + (p3 - p2) * (p3 - p2); + } + } + a[i] = new Segment(values[i][p], 0, 0, values[i+1][p]); + return a; + }, + bezierThrough = function(values, curviness, quadratic, basic, correlate, prepend) { + var obj = {}, + props = [], + first = prepend || values[0], + i, p, a, j, r, l, seamless, last; + correlate = (typeof(correlate) === "string") ? ","+correlate+"," : _correlate; + if (curviness == null) { + curviness = 1; + } + for (p in values[0]) { + props.push(p); + } + //check to see if the last and first values are identical (well, within 0.05). If so, make seamless by appending the second element to the very end of the values array and the 2nd-to-last element to the very beginning (we'll remove those segments later) + if (values.length > 1) { + last = values[values.length - 1]; + seamless = true; + i = props.length; + while (--i > -1) { + p = props[i]; + if (Math.abs(first[p] - last[p]) > 0.05) { //build in a tolerance of +/-0.05 to accommodate rounding errors. + seamless = false; + break; + } + } + if (seamless) { + values = values.concat(); //duplicate the array to avoid contaminating the original which the user may be reusing for other tweens + if (prepend) { + values.unshift(prepend); + } + values.push(values[1]); + prepend = values[values.length - 3]; + } + } + _r1.length = _r2.length = _r3.length = 0; + i = props.length; + while (--i > -1) { + p = props[i]; + _corProps[p] = (correlate.indexOf(","+p+",") !== -1); + obj[p] = _parseAnchors(values, p, _corProps[p], prepend); + } + i = _r1.length; + while (--i > -1) { + _r1[i] = Math.sqrt(_r1[i]); + _r2[i] = Math.sqrt(_r2[i]); + } + if (!basic) { + i = props.length; + while (--i > -1) { + if (_corProps[p]) { + a = obj[props[i]]; + l = a.length - 1; + for (j = 0; j < l; j++) { + r = (a[j+1].da / _r2[j] + a[j].da / _r1[j]) || 0; + _r3[j] = (_r3[j] || 0) + r * r; + } + } + } + i = _r3.length; + while (--i > -1) { + _r3[i] = Math.sqrt(_r3[i]); + } + } + i = props.length; + j = quadratic ? 4 : 1; + while (--i > -1) { + p = props[i]; + a = obj[p]; + _calculateControlPoints(a, curviness, quadratic, basic, _corProps[p]); //this method requires that _parseAnchors() and _setSegmentRatios() ran first so that _r1, _r2, and _r3 values are populated for all properties + if (seamless) { + a.splice(0, j); + a.splice(a.length - j, j); + } + } + return obj; + }, + _parseBezierData = function(values, type, prepend) { + type = type || "soft"; + var obj = {}, + inc = (type === "cubic") ? 3 : 2, + soft = (type === "soft"), + props = [], + a, b, c, d, cur, i, j, l, p, cnt, tmp; + if (soft && prepend) { + values = [prepend].concat(values); + } + if (values == null || values.length < inc + 1) { throw "invalid Bezier data"; } + for (p in values[0]) { + props.push(p); + } + i = props.length; + while (--i > -1) { + p = props[i]; + obj[p] = cur = []; + cnt = 0; + l = values.length; + for (j = 0; j < l; j++) { + a = (prepend == null) ? values[j][p] : (typeof( (tmp = values[j][p]) ) === "string" && tmp.charAt(1) === "=") ? prepend[p] + Number(tmp.charAt(0) + tmp.substr(2)) : Number(tmp); + if (soft) if (j > 1) if (j < l - 1) { + cur[cnt++] = (a + cur[cnt-2]) / 2; + } + cur[cnt++] = a; + } + l = cnt - inc + 1; + cnt = 0; + for (j = 0; j < l; j += inc) { + a = cur[j]; + b = cur[j+1]; + c = cur[j+2]; + d = (inc === 2) ? 0 : cur[j+3]; + cur[cnt++] = tmp = (inc === 3) ? new Segment(a, b, c, d) : new Segment(a, (2 * b + a) / 3, (2 * b + c) / 3, c); + } + cur.length = cnt; + } + return obj; + }, + _addCubicLengths = function(a, steps, resolution) { + var inc = 1 / resolution, + j = a.length, + d, d1, s, da, ca, ba, p, i, inv, bez, index; + while (--j > -1) { + bez = a[j]; + s = bez.a; + da = bez.d - s; + ca = bez.c - s; + ba = bez.b - s; + d = d1 = 0; + for (i = 1; i <= resolution; i++) { + p = inc * i; + inv = 1 - p; + d = d1 - (d1 = (p * p * da + 3 * inv * (p * ca + inv * ba)) * p); + index = j * resolution + i - 1; + steps[index] = (steps[index] || 0) + d * d; + } + } + }, + _parseLengthData = function(obj, resolution) { + resolution = resolution >> 0 || 6; + var a = [], + lengths = [], + d = 0, + total = 0, + threshold = resolution - 1, + segments = [], + curLS = [], //current length segments array + p, i, l, index; + for (p in obj) { + _addCubicLengths(obj[p], a, resolution); + } + l = a.length; + for (i = 0; i < l; i++) { + d += Math.sqrt(a[i]); + index = i % resolution; + curLS[index] = d; + if (index === threshold) { + total += d; + index = (i / resolution) >> 0; + segments[index] = curLS; + lengths[index] = total; + d = 0; + curLS = []; + } + } + return {length:total, lengths:lengths, segments:segments}; + }, + + + + BezierPlugin = _gsScope._gsDefine.plugin({ + propName: "bezier", + priority: -1, + version: "1.3.8", + API: 2, + global:true, + + //gets called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, vars, tween) { + this._target = target; + if (vars instanceof Array) { + vars = {values:vars}; + } + this._func = {}; + this._mod = {}; + this._props = []; + this._timeRes = (vars.timeResolution == null) ? 6 : parseInt(vars.timeResolution, 10); + var values = vars.values || [], + first = {}, + second = values[0], + autoRotate = vars.autoRotate || tween.vars.orientToBezier, + p, isFunc, i, j, prepend; + + this._autoRotate = autoRotate ? (autoRotate instanceof Array) ? autoRotate : [["x","y","rotation",((autoRotate === true) ? 0 : Number(autoRotate) || 0)]] : null; + for (p in second) { + this._props.push(p); + } + + i = this._props.length; + while (--i > -1) { + p = this._props[i]; + + this._overwriteProps.push(p); + isFunc = this._func[p] = (typeof(target[p]) === "function"); + first[p] = (!isFunc) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ](); + if (!prepend) if (first[p] !== values[0][p]) { + prepend = first; + } + } + this._beziers = (vars.type !== "cubic" && vars.type !== "quadratic" && vars.type !== "soft") ? bezierThrough(values, isNaN(vars.curviness) ? 1 : vars.curviness, false, (vars.type === "thruBasic"), vars.correlate, prepend) : _parseBezierData(values, vars.type, first); + this._segCount = this._beziers[p].length; + + if (this._timeRes) { + var ld = _parseLengthData(this._beziers, this._timeRes); + this._length = ld.length; + this._lengths = ld.lengths; + this._segments = ld.segments; + this._l1 = this._li = this._s1 = this._si = 0; + this._l2 = this._lengths[0]; + this._curSeg = this._segments[0]; + this._s2 = this._curSeg[0]; + this._prec = 1 / this._curSeg.length; + } + + if ((autoRotate = this._autoRotate)) { + this._initialRotations = []; + if (!(autoRotate[0] instanceof Array)) { + this._autoRotate = autoRotate = [autoRotate]; + } + i = autoRotate.length; + while (--i > -1) { + for (j = 0; j < 3; j++) { + p = autoRotate[i][j]; + this._func[p] = (typeof(target[p]) === "function") ? target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ] : false; + } + p = autoRotate[i][2]; + this._initialRotations[i] = (this._func[p] ? this._func[p].call(this._target) : this._target[p]) || 0; + this._overwriteProps.push(p); + } + } + this._startRatio = tween.vars.runBackwards ? 1 : 0; //we determine the starting ratio when the tween inits which is always 0 unless the tween has runBackwards:true (indicating it's a from() tween) in which case it's 1. + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(v) { + var segments = this._segCount, + func = this._func, + target = this._target, + notStart = (v !== this._startRatio), + curIndex, inv, i, p, b, t, val, l, lengths, curSeg; + if (!this._timeRes) { + curIndex = (v < 0) ? 0 : (v >= 1) ? segments - 1 : (segments * v) >> 0; + t = (v - (curIndex * (1 / segments))) * segments; + } else { + lengths = this._lengths; + curSeg = this._curSeg; + v *= this._length; + i = this._li; + //find the appropriate segment (if the currently cached one isn't correct) + if (v > this._l2 && i < segments - 1) { + l = segments - 1; + while (i < l && (this._l2 = lengths[++i]) <= v) { } + this._l1 = lengths[i-1]; + this._li = i; + this._curSeg = curSeg = this._segments[i]; + this._s2 = curSeg[(this._s1 = this._si = 0)]; + } else if (v < this._l1 && i > 0) { + while (i > 0 && (this._l1 = lengths[--i]) >= v) { } + if (i === 0 && v < this._l1) { + this._l1 = 0; + } else { + i++; + } + this._l2 = lengths[i]; + this._li = i; + this._curSeg = curSeg = this._segments[i]; + this._s1 = curSeg[(this._si = curSeg.length - 1) - 1] || 0; + this._s2 = curSeg[this._si]; + } + curIndex = i; + //now find the appropriate sub-segment (we split it into the number of pieces that was defined by "precision" and measured each one) + v -= this._l1; + i = this._si; + if (v > this._s2 && i < curSeg.length - 1) { + l = curSeg.length - 1; + while (i < l && (this._s2 = curSeg[++i]) <= v) { } + this._s1 = curSeg[i-1]; + this._si = i; + } else if (v < this._s1 && i > 0) { + while (i > 0 && (this._s1 = curSeg[--i]) >= v) { } + if (i === 0 && v < this._s1) { + this._s1 = 0; + } else { + i++; + } + this._s2 = curSeg[i]; + this._si = i; + } + t = ((i + (v - this._s1) / (this._s2 - this._s1)) * this._prec) || 0; + } + inv = 1 - t; + + i = this._props.length; + while (--i > -1) { + p = this._props[i]; + b = this._beziers[p][curIndex]; + val = (t * t * b.da + 3 * inv * (t * b.ca + inv * b.ba)) * t + b.a; + if (this._mod[p]) { + val = this._mod[p](val, target); + } + if (func[p]) { + target[p](val); + } else { + target[p] = val; + } + } + + if (this._autoRotate) { + var ar = this._autoRotate, + b2, x1, y1, x2, y2, add, conv; + i = ar.length; + while (--i > -1) { + p = ar[i][2]; + add = ar[i][3] || 0; + conv = (ar[i][4] === true) ? 1 : _RAD2DEG; + b = this._beziers[ar[i][0]]; + b2 = this._beziers[ar[i][1]]; + + if (b && b2) { //in case one of the properties got overwritten. + b = b[curIndex]; + b2 = b2[curIndex]; + + x1 = b.a + (b.b - b.a) * t; + x2 = b.b + (b.c - b.b) * t; + x1 += (x2 - x1) * t; + x2 += ((b.c + (b.d - b.c) * t) - x2) * t; + + y1 = b2.a + (b2.b - b2.a) * t; + y2 = b2.b + (b2.c - b2.b) * t; + y1 += (y2 - y1) * t; + y2 += ((b2.c + (b2.d - b2.c) * t) - y2) * t; + + val = notStart ? Math.atan2(y2 - y1, x2 - x1) * conv + add : this._initialRotations[i]; + + if (this._mod[p]) { + val = this._mod[p](val, target); //for modProps + } + + if (func[p]) { + target[p](val); + } else { + target[p] = val; + } + } + } + } + } + }), + p = BezierPlugin.prototype; + + + BezierPlugin.bezierThrough = bezierThrough; + BezierPlugin.cubicToQuadratic = cubicToQuadratic; + BezierPlugin._autoCSS = true; //indicates that this plugin can be inserted into the "css" object using the autoCSS feature of TweenLite + BezierPlugin.quadraticToCubic = function(a, b, c) { + return new Segment(a, (2 * b + a) / 3, (2 * b + c) / 3, c); + }; + + BezierPlugin._cssRegister = function() { + var CSSPlugin = _globals.CSSPlugin; + if (!CSSPlugin) { + return; + } + var _internals = CSSPlugin._internals, + _parseToProxy = _internals._parseToProxy, + _setPluginRatio = _internals._setPluginRatio, + CSSPropTween = _internals.CSSPropTween; + _internals._registerComplexSpecialProp("bezier", {parser:function(t, e, prop, cssp, pt, plugin) { + if (e instanceof Array) { + e = {values:e}; + } + plugin = new BezierPlugin(); + var values = e.values, + l = values.length - 1, + pluginValues = [], + v = {}, + i, p, data; + if (l < 0) { + return pt; + } + for (i = 0; i <= l; i++) { + data = _parseToProxy(t, values[i], cssp, pt, plugin, (l !== i)); + pluginValues[i] = data.end; + } + for (p in e) { + v[p] = e[p]; //duplicate the vars object because we need to alter some things which would cause problems if the user plans to reuse the same vars object for another tween. + } + v.values = pluginValues; + pt = new CSSPropTween(t, "bezier", 0, 0, data.pt, 2); + pt.data = data; + pt.plugin = plugin; + pt.setRatio = _setPluginRatio; + if (v.autoRotate === 0) { + v.autoRotate = true; + } + if (v.autoRotate && !(v.autoRotate instanceof Array)) { + i = (v.autoRotate === true) ? 0 : Number(v.autoRotate); + v.autoRotate = (data.end.left != null) ? [["left","top","rotation",i,false]] : (data.end.x != null) ? [["x","y","rotation",i,false]] : false; + } + if (v.autoRotate) { + if (!cssp._transform) { + cssp._enableTransforms(false); + } + data.autoRotate = cssp._target._gsTransform; + data.proxy.rotation = data.autoRotate.rotation || 0; + cssp._overwriteProps.push("rotation"); + } + plugin._onInitTween(data.proxy, v, cssp._tween); + return pt; + }}); + }; + + p._mod = function(lookup) { + var op = this._overwriteProps, + i = op.length, + val; + while (--i > -1) { + val = lookup[op[i]]; + if (val && typeof(val) === "function") { + this._mod[op[i]] = val; + } + } + }; + + p._kill = function(lookup) { + var a = this._props, + p, i; + for (p in this._beziers) { + if (p in lookup) { + delete this._beziers[p]; + delete this._func[p]; + i = a.length; + while (--i > -1) { + if (a[i] === p) { + a.splice(i, 1); + } + } + } + } + a = this._autoRotate; + if (a) { + i = a.length; + while (--i > -1) { + if (lookup[a[i][2]]) { + a.splice(i, 1); + } + } + } + return this._super._kill.call(this, lookup); + }; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("BezierPlugin")); + +/*! + * VERSION: 2.1.0 + * DATE: 2019-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + _gsScope._gsDefine("plugins.CSSPlugin", ["plugins.TweenPlugin","TweenLite"], function(TweenPlugin, TweenLite) { + + /** @constructor **/ + var CSSPlugin = function() { + TweenPlugin.call(this, "css"); + this._overwriteProps.length = 0; + this.setRatio = CSSPlugin.prototype.setRatio; //speed optimization (avoid prototype lookup on this "hot" method) + }, + _globals = _gsScope._gsDefine.globals, + _hasPriority, //turns true whenever a CSSPropTween instance is created that has a priority other than 0. This helps us discern whether or not we should spend the time organizing the linked list or not after a CSSPlugin's _onInitTween() method is called. + _suffixMap, //we set this in _onInitTween() each time as a way to have a persistent variable we can use in other methods like _parse() without having to pass it around as a parameter and we keep _parse() decoupled from a particular CSSPlugin instance + _cs, //computed style (we store this in a shared variable to conserve memory and make minification tighter + _overwriteProps, //alias to the currently instantiating CSSPlugin's _overwriteProps array. We use this closure in order to avoid having to pass a reference around from method to method and aid in minification. + _specialProps = {}, + p = CSSPlugin.prototype = new TweenPlugin("css"); + + p.constructor = CSSPlugin; + CSSPlugin.version = "2.1.0"; + CSSPlugin.API = 2; + CSSPlugin.defaultTransformPerspective = 0; + CSSPlugin.defaultSkewType = "compensated"; + CSSPlugin.defaultSmoothOrigin = true; + p = "px"; //we'll reuse the "p" variable to keep file size down + CSSPlugin.suffixMap = {top:p, right:p, bottom:p, left:p, width:p, height:p, fontSize:p, padding:p, margin:p, perspective:p, lineHeight:""}; + + + var _numExp = /(?:\-|\.|\b)(\d|\.|e\-)+/g, + _relNumExp = /(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g, + _valuesExp = /(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi, //finds all the values that begin with numbers or += or -= and then a number. Includes suffixes. We use this to split complex values apart like "1px 5px 20px rgb(255,102,51)" + _NaNExp = /(?![+-]?\d*\.?\d+|[+-]|e[+-]\d+)[^0-9]/g, //also allows scientific notation and doesn't kill the leading -/+ in -= and += + _suffixExp = /(?:\d|\-|\+|=|#|\.)*/g, + _opacityExp = /opacity *= *([^)]*)/i, + _opacityValExp = /opacity:([^;]*)/i, + _alphaFilterExp = /alpha\(opacity *=.+?\)/i, + _rgbhslExp = /^(rgb|hsl)/, + _capsExp = /([A-Z])/g, + _camelExp = /-([a-z])/gi, + _urlExp = /(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi, //for pulling out urls from url(...) or url("...") strings (some browsers wrap urls in quotes, some don't when reporting things like backgroundImage) + _camelFunc = function(s, g) { return g.toUpperCase(); }, + _horizExp = /(?:Left|Right|Width)/i, + _ieGetMatrixExp = /(M11|M12|M21|M22)=[\d\-\.e]+/gi, + _ieSetMatrixExp = /progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i, + _commasOutsideParenExp = /,(?=[^\)]*(?:\(|$))/gi, //finds any commas that are not within parenthesis + _complexExp = /[\s,\(]/i, //for testing a string to find if it has a space, comma, or open parenthesis (clues that it's a complex value) + _DEG2RAD = Math.PI / 180, + _RAD2DEG = 180 / Math.PI, + _forcePT = {}, + _dummyElement = {style:{}}, + _doc = _gsScope.document || {createElement: function() {return _dummyElement;}}, + _createElement = function(type, ns) { + return (ns && _doc.createElementNS) ? _doc.createElementNS(ns, type) : _doc.createElement(type); + }, + _tempDiv = _createElement("div"), + _tempImg = _createElement("img"), + _internals = CSSPlugin._internals = {_specialProps:_specialProps}, //provides a hook to a few internal methods that we need to access from inside other plugins + _agent = (_gsScope.navigator || {}).userAgent || "", + _autoRound, + _reqSafariFix, //we won't apply the Safari transform fix until we actually come across a tween that affects a transform property (to maintain best performance). + + _isSafari, + _isFirefox, //Firefox has a bug that causes 3D transformed elements to randomly disappear unless a repaint is forced after each update on each element. + _isSafariLT6, //Safari (and Android 4 which uses a flavor of Safari) has a bug that prevents changes to "top" and "left" properties from rendering properly if changed on the same frame as a transform UNLESS we set the element's WebkitBackfaceVisibility to hidden (weird, I know). Doing this for Android 3 and earlier seems to actually cause other problems, though (fun!) + _ieVers, + _supportsOpacity = (function() { //we set _isSafari, _ieVers, _isFirefox, and _supportsOpacity all in one function here to reduce file size slightly, especially in the minified version. + var i = _agent.indexOf("Android"), + a = _createElement("a"); + _isSafari = (_agent.indexOf("Safari") !== -1 && _agent.indexOf("Chrome") === -1 && (i === -1 || parseFloat(_agent.substr(i+8, 2)) > 3)); + _isSafariLT6 = (_isSafari && (parseFloat(_agent.substr(_agent.indexOf("Version/")+8, 2)) < 6)); + _isFirefox = (_agent.indexOf("Firefox") !== -1); + if ((/MSIE ([0-9]{1,}[\.0-9]{0,})/).exec(_agent) || (/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/).exec(_agent)) { + _ieVers = parseFloat( RegExp.$1 ); + } + if (!a) { + return false; + } + a.style.cssText = "top:1px;opacity:.55;"; + return /^0.55/.test(a.style.opacity); + }()), + _getIEOpacity = function(v) { + return (_opacityExp.test( ((typeof(v) === "string") ? v : (v.currentStyle ? v.currentStyle.filter : v.style.filter) || "") ) ? ( parseFloat( RegExp.$1 ) / 100 ) : 1); + }, + _log = function(s) {//for logging messages, but in a way that won't throw errors in old versions of IE. + if (_gsScope.console) { + console.log(s); + } + }, + _target, //when initting a CSSPlugin, we set this variable so that we can access it from within many other functions without having to pass it around as params + _index, //when initting a CSSPlugin, we set this variable so that we can access it from within many other functions without having to pass it around as params + + _prefixCSS = "", //the non-camelCase vendor prefix like "-o-", "-moz-", "-ms-", or "-webkit-" + _prefix = "", //camelCase vendor prefix like "O", "ms", "Webkit", or "Moz". + + // @private feed in a camelCase property name like "transform" and it will check to see if it is valid as-is or if it needs a vendor prefix. It returns the corrected camelCase property name (i.e. "WebkitTransform" or "MozTransform" or "transform" or null if no such property is found, like if the browser is IE8 or before, "transform" won't be found at all) + _checkPropPrefix = function(p, e) { + e = e || _tempDiv; + var s = e.style, + a, i; + if (s[p] !== undefined) { + return p; + } + p = p.charAt(0).toUpperCase() + p.substr(1); + a = ["O","Moz","ms","Ms","Webkit"]; + i = 5; + while (--i > -1 && s[a[i]+p] === undefined) { } + if (i >= 0) { + _prefix = (i === 3) ? "ms" : a[i]; + _prefixCSS = "-" + _prefix.toLowerCase() + "-"; + return _prefix + p; + } + return null; + }, + + _computedStyleScope = (typeof(window) !== "undefined" ? window : _doc.defaultView || {getComputedStyle:function() {}}), + _getComputedStyle = function(e) { + return _computedStyleScope.getComputedStyle(e); //to avoid errors in Microsoft Edge, we need to call getComputedStyle() from a specific scope, typically window. + }, + + /** + * @private Returns the css style for a particular property of an element. For example, to get whatever the current "left" css value for an element with an ID of "myElement", you could do: + * var currentLeft = CSSPlugin.getStyle( document.getElementById("myElement"), "left"); + * + * @param {!Object} t Target element whose style property you want to query + * @param {!string} p Property name (like "left" or "top" or "marginTop", etc.) + * @param {Object=} cs Computed style object. This just provides a way to speed processing if you're going to get several properties on the same element in quick succession - you can reuse the result of the getComputedStyle() call. + * @param {boolean=} calc If true, the value will not be read directly from the element's "style" property (if it exists there), but instead the getComputedStyle() result will be used. This can be useful when you want to ensure that the browser itself is interpreting the value. + * @param {string=} dflt Default value that should be returned in the place of null, "none", "auto" or "auto auto". + * @return {?string} The current property value + */ + _getStyle = CSSPlugin.getStyle = function(t, p, cs, calc, dflt) { + var rv; + if (!_supportsOpacity) if (p === "opacity") { //several versions of IE don't use the standard "opacity" property - they use things like filter:alpha(opacity=50), so we parse that here. + return _getIEOpacity(t); + } + if (!calc && t.style[p]) { + rv = t.style[p]; + } else if ((cs = cs || _getComputedStyle(t))) { + rv = cs[p] || cs.getPropertyValue(p) || cs.getPropertyValue(p.replace(_capsExp, "-$1").toLowerCase()); + } else if (t.currentStyle) { + rv = t.currentStyle[p]; + } + return (dflt != null && (!rv || rv === "none" || rv === "auto" || rv === "auto auto")) ? dflt : rv; + }, + + /** + * @private Pass the target element, the property name, the numeric value, and the suffix (like "%", "em", "px", etc.) and it will spit back the equivalent pixel number. + * @param {!Object} t Target element + * @param {!string} p Property name (like "left", "top", "marginLeft", etc.) + * @param {!number} v Value + * @param {string=} sfx Suffix (like "px" or "%" or "em") + * @param {boolean=} recurse If true, the call is a recursive one. In some browsers (like IE7/8), occasionally the value isn't accurately reported initially, but if we run the function again it will take effect. + * @return {number} value in pixels + */ + _convertToPixels = _internals.convertToPixels = function(t, p, v, sfx, recurse) { + if (sfx === "px" || (!sfx && p !== "lineHeight")) { return v; } + if (sfx === "auto" || !v) { return 0; } + var horiz = _horizExp.test(p), + node = t, + style = _tempDiv.style, + neg = (v < 0), + precise = (v === 1), + pix, cache, time; + if (neg) { + v = -v; + } + if (precise) { + v *= 100; + } + if (p === "lineHeight" && !sfx) { //special case of when a simple lineHeight (without a unit) is used. Set it to the value, read back the computed value, and then revert. + cache = _getComputedStyle(t).lineHeight; + t.style.lineHeight = v; + pix = parseFloat(_getComputedStyle(t).lineHeight); + t.style.lineHeight = cache; + } else if (sfx === "%" && p.indexOf("border") !== -1) { + pix = (v / 100) * (horiz ? t.clientWidth : t.clientHeight); + } else { + style.cssText = "border:0 solid red;position:" + _getStyle(t, "position") + ";line-height:0;"; + if (sfx === "%" || !node.appendChild || sfx.charAt(0) === "v" || sfx === "rem") { + node = t.parentNode || _doc.body; + if (_getStyle(node, "display").indexOf("flex") !== -1) { //Edge and IE11 have a bug that causes offsetWidth to report as 0 if the container has display:flex and the child is position:relative. Switching to position: absolute solves it. + style.position = "absolute"; + } + cache = node._gsCache; + time = TweenLite.ticker.frame; + if (cache && horiz && cache.time === time) { //performance optimization: we record the width of elements along with the ticker frame so that we can quickly get it again on the same tick (seems relatively safe to assume it wouldn't change on the same tick) + return cache.width * v / 100; + } + style[(horiz ? "width" : "height")] = v + sfx; + } else { + style[(horiz ? "borderLeftWidth" : "borderTopWidth")] = v + sfx; + } + node.appendChild(_tempDiv); + pix = parseFloat(_tempDiv[(horiz ? "offsetWidth" : "offsetHeight")]); + node.removeChild(_tempDiv); + if (horiz && sfx === "%" && CSSPlugin.cacheWidths !== false) { + cache = node._gsCache = node._gsCache || {}; + cache.time = time; + cache.width = pix / v * 100; + } + if (pix === 0 && !recurse) { + pix = _convertToPixels(t, p, v, sfx, true); + } + } + if (precise) { + pix /= 100; + } + return neg ? -pix : pix; + }, + _calculateOffset = _internals.calculateOffset = function(t, p, cs) { //for figuring out "top" or "left" in px when it's "auto". We need to factor in margin with the offsetLeft/offsetTop + if (_getStyle(t, "position", cs) !== "absolute") { return 0; } + var dim = ((p === "left") ? "Left" : "Top"), + v = _getStyle(t, "margin" + dim, cs); + return t["offset" + dim] - (_convertToPixels(t, p, parseFloat(v), v.replace(_suffixExp, "")) || 0); + }, + + // @private returns at object containing ALL of the style properties in camelCase and their associated values. + _getAllStyles = function(t, cs) { + var s = {}, + i, tr, p; + if ((cs = cs || _getComputedStyle(t, null))) { + if ((i = cs.length)) { + while (--i > -1) { + p = cs[i]; + if (p.indexOf("-transform") === -1 || _transformPropCSS === p) { //Some webkit browsers duplicate transform values, one non-prefixed and one prefixed ("transform" and "WebkitTransform"), so we must weed out the extra one here. + s[p.replace(_camelExp, _camelFunc)] = cs.getPropertyValue(p); + } + } + } else { //some browsers behave differently - cs.length is always 0, so we must do a for...in loop. + for (i in cs) { + if (i.indexOf("Transform") === -1 || _transformProp === i) { //Some webkit browsers duplicate transform values, one non-prefixed and one prefixed ("transform" and "WebkitTransform"), so we must weed out the extra one here. + s[i] = cs[i]; + } + } + } + } else if ((cs = t.currentStyle || t.style)) { + for (i in cs) { + if (typeof(i) === "string" && s[i] === undefined) { + s[i.replace(_camelExp, _camelFunc)] = cs[i]; + } + } + } + if (!_supportsOpacity) { + s.opacity = _getIEOpacity(t); + } + tr = _getTransform(t, cs, false); + s.rotation = tr.rotation; + s.skewX = tr.skewX; + s.scaleX = tr.scaleX; + s.scaleY = tr.scaleY; + s.x = tr.x; + s.y = tr.y; + if (_supports3D) { + s.z = tr.z; + s.rotationX = tr.rotationX; + s.rotationY = tr.rotationY; + s.scaleZ = tr.scaleZ; + } + if (s.filters) { + delete s.filters; + } + return s; + }, + + // @private analyzes two style objects (as returned by _getAllStyles()) and only looks for differences between them that contain tweenable values (like a number or color). It returns an object with a "difs" property which refers to an object containing only those isolated properties and values for tweening, and a "firstMPT" property which refers to the first MiniPropTween instance in a linked list that recorded all the starting values of the different properties so that we can revert to them at the end or beginning of the tween - we don't want the cascading to get messed up. The forceLookup parameter is an optional generic object with properties that should be forced into the results - this is necessary for className tweens that are overwriting others because imagine a scenario where a rollover/rollout adds/removes a class and the user swipes the mouse over the target SUPER fast, thus nothing actually changed yet and the subsequent comparison of the properties would indicate they match (especially when px rounding is taken into consideration), thus no tweening is necessary even though it SHOULD tween and remove those properties after the tween (otherwise the inline styles will contaminate things). See the className SpecialProp code for details. + _cssDif = function(t, s1, s2, vars, forceLookup) { + var difs = {}, + style = t.style, + val, p, mpt; + for (p in s2) { + if (p !== "cssText") if (p !== "length") if (isNaN(p)) if (s1[p] !== (val = s2[p]) || (forceLookup && forceLookup[p])) if (p.indexOf("Origin") === -1) if (typeof(val) === "number" || typeof(val) === "string") { + difs[p] = (val === "auto" && (p === "left" || p === "top")) ? _calculateOffset(t, p) : ((val === "" || val === "auto" || val === "none") && typeof(s1[p]) === "string" && s1[p].replace(_NaNExp, "") !== "") ? 0 : val; //if the ending value is defaulting ("" or "auto"), we check the starting value and if it can be parsed into a number (a string which could have a suffix too, like 700px), then we swap in 0 for "" or "auto" so that things actually tween. + if (style[p] !== undefined) { //for className tweens, we must remember which properties already existed inline - the ones that didn't should be removed when the tween isn't in progress because they were only introduced to facilitate the transition between classes. + mpt = new MiniPropTween(style, p, style[p], mpt); + } + } + } + if (vars) { + for (p in vars) { //copy properties (except className) + if (p !== "className") { + difs[p] = vars[p]; + } + } + } + return {difs:difs, firstMPT:mpt}; + }, + _dimensions = {width:["Left","Right"], height:["Top","Bottom"]}, + _margins = ["marginLeft","marginRight","marginTop","marginBottom"], + + /** + * @private Gets the width or height of an element + * @param {!Object} t Target element + * @param {!string} p Property name ("width" or "height") + * @param {Object=} cs Computed style object (if one exists). Just a speed optimization. + * @return {number} Dimension (in pixels) + */ + _getDimension = function(t, p, cs) { + if ((t.nodeName + "").toLowerCase() === "svg") { //Chrome no longer supports offsetWidth/offsetHeight on SVG elements. + return (cs || _getComputedStyle(t))[p] || 0; + } else if (t.getCTM && _isSVG(t)) { + return t.getBBox()[p] || 0; + } + var v = parseFloat((p === "width") ? t.offsetWidth : t.offsetHeight), + a = _dimensions[p], + i = a.length; + cs = cs || _getComputedStyle(t, null); + while (--i > -1) { + v -= parseFloat( _getStyle(t, "padding" + a[i], cs, true) ) || 0; + v -= parseFloat( _getStyle(t, "border" + a[i] + "Width", cs, true) ) || 0; + } + return v; + }, + + // @private Parses position-related complex strings like "top left" or "50px 10px" or "70% 20%", etc. which are used for things like transformOrigin or backgroundPosition. Optionally decorates a supplied object (recObj) with the following properties: "ox" (offsetX), "oy" (offsetY), "oxp" (if true, "ox" is a percentage not a pixel value), and "oxy" (if true, "oy" is a percentage not a pixel value) + _parsePosition = function(v, recObj) { + if (v === "contain" || v === "auto" || v === "auto auto") { //note: Firefox uses "auto auto" as default whereas Chrome uses "auto". + return v + " "; + } + if (v == null || v === "") { + v = "0 0"; + } + var a = v.split(" "), + x = (v.indexOf("left") !== -1) ? "0%" : (v.indexOf("right") !== -1) ? "100%" : a[0], + y = (v.indexOf("top") !== -1) ? "0%" : (v.indexOf("bottom") !== -1) ? "100%" : a[1], + i; + if (a.length > 3 && !recObj) { //multiple positions + a = v.split(", ").join(",").split(","); + v = []; + for (i = 0; i < a.length; i++) { + v.push(_parsePosition(a[i])); + } + return v.join(","); + } + if (y == null) { + y = (x === "center") ? "50%" : "0"; + } else if (y === "center") { + y = "50%"; + } + if (x === "center" || (isNaN(parseFloat(x)) && (x + "").indexOf("=") === -1)) { //remember, the user could flip-flop the values and say "bottom center" or "center bottom", etc. "center" is ambiguous because it could be used to describe horizontal or vertical, hence the isNaN(). If there's an "=" sign in the value, it's relative. + x = "50%"; + } + v = x + " " + y + ((a.length > 2) ? " " + a[2] : ""); + if (recObj) { + recObj.oxp = (x.indexOf("%") !== -1); + recObj.oyp = (y.indexOf("%") !== -1); + recObj.oxr = (x.charAt(1) === "="); + recObj.oyr = (y.charAt(1) === "="); + recObj.ox = parseFloat(x.replace(_NaNExp, "")); + recObj.oy = parseFloat(y.replace(_NaNExp, "")); + recObj.v = v; + } + return recObj || v; + }, + + /** + * @private Takes an ending value (typically a string, but can be a number) and a starting value and returns the change between the two, looking for relative value indicators like += and -= and it also ignores suffixes (but make sure the ending value starts with a number or +=/-= and that the starting value is a NUMBER!) + * @param {(number|string)} e End value which is typically a string, but could be a number + * @param {(number|string)} b Beginning value which is typically a string but could be a number + * @return {number} Amount of change between the beginning and ending values (relative values that have a "+=" or "-=" are recognized) + */ + _parseChange = function(e, b) { + if (typeof(e) === "function") { + e = e(_index, _target); + } + return (typeof(e) === "string" && e.charAt(1) === "=") ? parseInt(e.charAt(0) + "1", 10) * parseFloat(e.substr(2)) : (parseFloat(e) - parseFloat(b)) || 0; + }, + + /** + * @private Takes a value and a default number, checks if the value is relative, null, or numeric and spits back a normalized number accordingly. Primarily used in the _parseTransform() function. + * @param {Object} v Value to be parsed + * @param {!number} d Default value (which is also used for relative calculations if "+=" or "-=" is found in the first parameter) + * @return {number} Parsed value + */ + _parseVal = function(v, d) { + if (typeof(v) === "function") { + v = v(_index, _target); + } + var isRelative = (typeof(v) === "string" && v.charAt(1) === "="); + if (typeof(v) === "string" && v.charAt(v.length - 2) === "v") { //convert vw and vh into px-equivalents. + v = (isRelative ? v.substr(0, 2) : 0) + (window["inner" + ((v.substr(-2) === "vh") ? "Height" : "Width")] * (parseFloat(isRelative ? v.substr(2) : v) / 100)); + } + return (v == null) ? d : isRelative ? parseInt(v.charAt(0) + "1", 10) * parseFloat(v.substr(2)) + d : parseFloat(v) || 0; + }, + + /** + * @private Translates strings like "40deg" or "40" or 40rad" or "+=40deg" or "270_short" or "-90_cw" or "+=45_ccw" to a numeric radian angle. Of course a starting/default value must be fed in too so that relative values can be calculated properly. + * @param {Object} v Value to be parsed + * @param {!number} d Default value (which is also used for relative calculations if "+=" or "-=" is found in the first parameter) + * @param {string=} p property name for directionalEnd (optional - only used when the parsed value is directional ("_short", "_cw", or "_ccw" suffix). We need a way to store the uncompensated value so that at the end of the tween, we set it to exactly what was requested with no directional compensation). Property name would be "rotation", "rotationX", or "rotationY" + * @param {Object=} directionalEnd An object that will store the raw end values for directional angles ("_short", "_cw", or "_ccw" suffix). We need a way to store the uncompensated value so that at the end of the tween, we set it to exactly what was requested with no directional compensation. + * @return {number} parsed angle in radians + */ + _parseAngle = function(v, d, p, directionalEnd) { + var min = 0.000001, + cap, split, dif, result, isRelative; + if (typeof(v) === "function") { + v = v(_index, _target); + } + if (v == null) { + result = d; + } else if (typeof(v) === "number") { + result = v; + } else { + cap = 360; + split = v.split("_"); + isRelative = (v.charAt(1) === "="); + dif = (isRelative ? parseInt(v.charAt(0) + "1", 10) * parseFloat(split[0].substr(2)) : parseFloat(split[0])) * ((v.indexOf("rad") === -1) ? 1 : _RAD2DEG) - (isRelative ? 0 : d); + if (split.length) { + if (directionalEnd) { + directionalEnd[p] = d + dif; + } + if (v.indexOf("short") !== -1) { + dif = dif % cap; + if (dif !== dif % (cap / 2)) { + dif = (dif < 0) ? dif + cap : dif - cap; + } + } + if (v.indexOf("_cw") !== -1 && dif < 0) { + dif = ((dif + cap * 9999999999) % cap) - ((dif / cap) | 0) * cap; + } else if (v.indexOf("ccw") !== -1 && dif > 0) { + dif = ((dif - cap * 9999999999) % cap) - ((dif / cap) | 0) * cap; + } + } + result = d + dif; + } + if (result < min && result > -min) { + result = 0; + } + return result; + }, + + _colorLookup = {aqua:[0,255,255], + lime:[0,255,0], + silver:[192,192,192], + black:[0,0,0], + maroon:[128,0,0], + teal:[0,128,128], + blue:[0,0,255], + navy:[0,0,128], + white:[255,255,255], + fuchsia:[255,0,255], + olive:[128,128,0], + yellow:[255,255,0], + orange:[255,165,0], + gray:[128,128,128], + purple:[128,0,128], + green:[0,128,0], + red:[255,0,0], + pink:[255,192,203], + cyan:[0,255,255], + transparent:[255,255,255,0]}, + + _hue = function(h, m1, m2) { + h = (h < 0) ? h + 1 : (h > 1) ? h - 1 : h; + return ((((h * 6 < 1) ? m1 + (m2 - m1) * h * 6 : (h < 0.5) ? m2 : (h * 3 < 2) ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * 255) + 0.5) | 0; + }, + + /** + * @private Parses a color (like #9F0, #FF9900, rgb(255,51,153) or hsl(108, 50%, 10%)) into an array with 3 elements for red, green, and blue or if toHSL parameter is true, it will populate the array with hue, saturation, and lightness values. If a relative value is found in an hsl() or hsla() string, it will preserve those relative prefixes and all the values in the array will be strings instead of numbers (in all other cases it will be populated with numbers). + * @param {(string|number)} v The value the should be parsed which could be a string like #9F0 or rgb(255,102,51) or rgba(255,0,0,0.5) or it could be a number like 0xFF00CC or even a named color like red, blue, purple, etc. + * @param {(boolean)} toHSL If true, an hsl() or hsla() value will be returned instead of rgb() or rgba() + * @return {Array.} An array containing red, green, and blue (and optionally alpha) in that order, or if the toHSL parameter was true, the array will contain hue, saturation and lightness (and optionally alpha) in that order. Always numbers unless there's a relative prefix found in an hsl() or hsla() string and toHSL is true. + */ + _parseColor = CSSPlugin.parseColor = function(v, toHSL) { + var a, r, g, b, h, s, l, max, min, d, wasHSL; + if (!v) { + a = _colorLookup.black; + } else if (typeof(v) === "number") { + a = [v >> 16, (v >> 8) & 255, v & 255]; + } else { + if (v.charAt(v.length - 1) === ",") { //sometimes a trailing comma is included and we should chop it off (typically from a comma-delimited list of values like a textShadow:"2px 2px 2px blue, 5px 5px 5px rgb(255,0,0)" - in this example "blue," has a trailing comma. We could strip it out inside parseComplex() but we'd need to do it to the beginning and ending values plus it wouldn't provide protection from other potential scenarios like if the user passes in a similar value. + v = v.substr(0, v.length - 1); + } + if (_colorLookup[v]) { + a = _colorLookup[v]; + } else if (v.charAt(0) === "#") { + if (v.length === 4) { //for shorthand like #9F0 + r = v.charAt(1); + g = v.charAt(2); + b = v.charAt(3); + v = "#" + r + r + g + g + b + b; + } + v = parseInt(v.substr(1), 16); + a = [v >> 16, (v >> 8) & 255, v & 255]; + } else if (v.substr(0, 3) === "hsl") { + a = wasHSL = v.match(_numExp); + if (!toHSL) { + h = (Number(a[0]) % 360) / 360; + s = Number(a[1]) / 100; + l = Number(a[2]) / 100; + g = (l <= 0.5) ? l * (s + 1) : l + s - l * s; + r = l * 2 - g; + if (a.length > 3) { + a[3] = Number(a[3]); + } + a[0] = _hue(h + 1 / 3, r, g); + a[1] = _hue(h, r, g); + a[2] = _hue(h - 1 / 3, r, g); + } else if (v.indexOf("=") !== -1) { //if relative values are found, just return the raw strings with the relative prefixes in place. + return v.match(_relNumExp); + } + } else { + a = v.match(_numExp) || _colorLookup.transparent; + } + a[0] = Number(a[0]); + a[1] = Number(a[1]); + a[2] = Number(a[2]); + if (a.length > 3) { + a[3] = Number(a[3]); + } + } + if (toHSL && !wasHSL) { + r = a[0] / 255; + g = a[1] / 255; + b = a[2] / 255; + max = Math.max(r, g, b); + min = Math.min(r, g, b); + l = (max + min) / 2; + if (max === min) { + h = s = 0; + } else { + d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + h = (max === r) ? (g - b) / d + (g < b ? 6 : 0) : (max === g) ? (b - r) / d + 2 : (r - g) / d + 4; + h *= 60; + } + a[0] = (h + 0.5) | 0; + a[1] = (s * 100 + 0.5) | 0; + a[2] = (l * 100 + 0.5) | 0; + } + return a; + }, + _formatColors = function(s, toHSL) { + var colors = s.match(_colorExp) || [], + charIndex = 0, + parsed = "", + i, color, temp; + if (!colors.length) { + return s; + } + for (i = 0; i < colors.length; i++) { + color = colors[i]; + temp = s.substr(charIndex, s.indexOf(color, charIndex)-charIndex); + charIndex += temp.length + color.length; + color = _parseColor(color, toHSL); + if (color.length === 3) { + color.push(1); + } + parsed += temp + (toHSL ? "hsla(" + color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : "rgba(" + color.join(",")) + ")"; + } + return parsed + s.substr(charIndex); + }, + _colorExp = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3}){1,2}\\b"; //we'll dynamically build this Regular Expression to conserve file size. After building it, it will be able to find rgb(), rgba(), # (hexadecimal), and named color values like red, blue, purple, etc. + + for (p in _colorLookup) { + _colorExp += "|" + p + "\\b"; + } + _colorExp = new RegExp(_colorExp+")", "gi"); + + CSSPlugin.colorStringFilter = function(a) { + var combined = a[0] + " " + a[1], + toHSL; + if (_colorExp.test(combined)) { + toHSL = (combined.indexOf("hsl(") !== -1 || combined.indexOf("hsla(") !== -1); + a[0] = _formatColors(a[0], toHSL); + a[1] = _formatColors(a[1], toHSL); + } + _colorExp.lastIndex = 0; + }; + + if (!TweenLite.defaultStringFilter) { + TweenLite.defaultStringFilter = CSSPlugin.colorStringFilter; + } + + /** + * @private Returns a formatter function that handles taking a string (or number in some cases) and returning a consistently formatted one in terms of delimiters, quantity of values, etc. For example, we may get boxShadow values defined as "0px red" or "0px 0px 10px rgb(255,0,0)" or "0px 0px 20px 20px #F00" and we need to ensure that what we get back is described with 4 numbers and a color. This allows us to feed it into the _parseComplex() method and split the values up appropriately. The neat thing about this _getFormatter() function is that the dflt defines a pattern as well as a default, so for example, _getFormatter("0px 0px 0px 0px #777", true) not only sets the default as 0px for all distances and #777 for the color, but also sets the pattern such that 4 numbers and a color will always get returned. + * @param {!string} dflt The default value and pattern to follow. So "0px 0px 0px 0px #777" will ensure that 4 numbers and a color will always get returned. + * @param {boolean=} clr If true, the values should be searched for color-related data. For example, boxShadow values typically contain a color whereas borderRadius don't. + * @param {boolean=} collapsible If true, the value is a top/left/right/bottom style one that acts like margin or padding, where if only one value is received, it's used for all 4; if 2 are received, the first is duplicated for 3rd (bottom) and the 2nd is duplicated for the 4th spot (left), etc. + * @return {Function} formatter function + */ + var _getFormatter = function(dflt, clr, collapsible, multi) { + if (dflt == null) { + return function(v) {return v;}; + } + var dColor = clr ? (dflt.match(_colorExp) || [""])[0] : "", + dVals = dflt.split(dColor).join("").match(_valuesExp) || [], + pfx = dflt.substr(0, dflt.indexOf(dVals[0])), + sfx = (dflt.charAt(dflt.length - 1) === ")") ? ")" : "", + delim = (dflt.indexOf(" ") !== -1) ? " " : ",", + numVals = dVals.length, + dSfx = (numVals > 0) ? dVals[0].replace(_numExp, "") : "", + formatter; + if (!numVals) { + return function(v) {return v;}; + } + if (clr) { + formatter = function(v) { + var color, vals, i, a; + if (typeof(v) === "number") { + v += dSfx; + } else if (multi && _commasOutsideParenExp.test(v)) { + a = v.replace(_commasOutsideParenExp, "|").split("|"); + for (i = 0; i < a.length; i++) { + a[i] = formatter(a[i]); + } + return a.join(","); + } + color = (v.match(_colorExp) || [dColor])[0]; + vals = v.split(color).join("").match(_valuesExp) || []; + i = vals.length; + if (numVals > i--) { + while (++i < numVals) { + vals[i] = collapsible ? vals[(((i - 1) / 2) | 0)] : dVals[i]; + } + } + return pfx + vals.join(delim) + delim + color + sfx + (v.indexOf("inset") !== -1 ? " inset" : ""); + }; + return formatter; + + } + formatter = function(v) { + var vals, a, i; + if (typeof(v) === "number") { + v += dSfx; + } else if (multi && _commasOutsideParenExp.test(v)) { + a = v.replace(_commasOutsideParenExp, "|").split("|"); + for (i = 0; i < a.length; i++) { + a[i] = formatter(a[i]); + } + return a.join(","); + } + vals = v.match(_valuesExp) || []; + i = vals.length; + if (numVals > i--) { + while (++i < numVals) { + vals[i] = collapsible ? vals[(((i - 1) / 2) | 0)] : dVals[i]; + } + } + return pfx + vals.join(delim) + sfx; + }; + return formatter; + }, + + /** + * @private returns a formatter function that's used for edge-related values like marginTop, marginLeft, paddingBottom, paddingRight, etc. Just pass a comma-delimited list of property names related to the edges. + * @param {!string} props a comma-delimited list of property names in order from top to left, like "marginTop,marginRight,marginBottom,marginLeft" + * @return {Function} a formatter function + */ + _getEdgeParser = function(props) { + props = props.split(","); + return function(t, e, p, cssp, pt, plugin, vars) { + var a = (e + "").split(" "), + i; + vars = {}; + for (i = 0; i < 4; i++) { + vars[props[i]] = a[i] = a[i] || a[(((i - 1) / 2) >> 0)]; + } + return cssp.parse(t, vars, pt, plugin); + }; + }, + + // @private used when other plugins must tween values first, like BezierPlugin or ThrowPropsPlugin, etc. That plugin's setRatio() gets called first so that the values are updated, and then we loop through the MiniPropTweens which handle copying the values into their appropriate slots so that they can then be applied correctly in the main CSSPlugin setRatio() method. Remember, we typically create a proxy object that has a bunch of uniquely-named properties that we feed to the sub-plugin and it does its magic normally, and then we must interpret those values and apply them to the css because often numbers must get combined/concatenated, suffixes added, etc. to work with css, like boxShadow could have 4 values plus a color. + _setPluginRatio = _internals._setPluginRatio = function(v) { + this.plugin.setRatio(v); + var d = this.data, + proxy = d.proxy, + mpt = d.firstMPT, + min = 0.000001, + val, pt, i, str, p; + while (mpt) { + val = proxy[mpt.v]; + if (mpt.r) { + val = mpt.r(val); + } else if (val < min && val > -min) { + val = 0; + } + mpt.t[mpt.p] = val; + mpt = mpt._next; + } + if (d.autoRotate) { + d.autoRotate.rotation = d.mod ? d.mod.call(this._tween, proxy.rotation, this.t, this._tween) : proxy.rotation; //special case for ModifyPlugin to hook into an auto-rotating bezier + } + //at the end, we must set the CSSPropTween's "e" (end) value dynamically here because that's what is used in the final setRatio() method. Same for "b" at the beginning. + if (v === 1 || v === 0) { + mpt = d.firstMPT; + p = (v === 1) ? "e" : "b"; + while (mpt) { + pt = mpt.t; + if (!pt.type) { + pt[p] = pt.s + pt.xs0; + } else if (pt.type === 1) { + str = pt.xs0 + pt.s + pt.xs1; + for (i = 1; i < pt.l; i++) { + str += pt["xn"+i] + pt["xs"+(i+1)]; + } + pt[p] = str; + } + mpt = mpt._next; + } + } + }, + + /** + * @private @constructor Used by a few SpecialProps to hold important values for proxies. For example, _parseToProxy() creates a MiniPropTween instance for each property that must get tweened on the proxy, and we record the original property name as well as the unique one we create for the proxy, plus whether or not the value needs to be rounded plus the original value. + * @param {!Object} t target object whose property we're tweening (often a CSSPropTween) + * @param {!string} p property name + * @param {(number|string|object)} v value + * @param {MiniPropTween=} next next MiniPropTween in the linked list + * @param {boolean=} r if true, the tweened value should be rounded to the nearest integer + */ + MiniPropTween = function(t, p, v, next, r) { + this.t = t; + this.p = p; + this.v = v; + this.r = r; + if (next) { + next._prev = this; + this._next = next; + } + }, + + /** + * @private Most other plugins (like BezierPlugin and ThrowPropsPlugin and others) can only tween numeric values, but CSSPlugin must accommodate special values that have a bunch of extra data (like a suffix or strings between numeric values, etc.). For example, boxShadow has values like "10px 10px 20px 30px rgb(255,0,0)" which would utterly confuse other plugins. This method allows us to split that data apart and grab only the numeric data and attach it to uniquely-named properties of a generic proxy object ({}) so that we can feed that to virtually any plugin to have the numbers tweened. However, we must also keep track of which properties from the proxy go with which CSSPropTween values and instances. So we create a linked list of MiniPropTweens. Each one records a target (the original CSSPropTween), property (like "s" or "xn1" or "xn2") that we're tweening and the unique property name that was used for the proxy (like "boxShadow_xn1" and "boxShadow_xn2") and whether or not they need to be rounded. That way, in the _setPluginRatio() method we can simply copy the values over from the proxy to the CSSPropTween instance(s). Then, when the main CSSPlugin setRatio() method runs and applies the CSSPropTween values accordingly, they're updated nicely. So the external plugin tweens the numbers, _setPluginRatio() copies them over, and setRatio() acts normally, applying css-specific values to the element. + * This method returns an object that has the following properties: + * - proxy: a generic object containing the starting values for all the properties that will be tweened by the external plugin. This is what we feed to the external _onInitTween() as the target + * - end: a generic object containing the ending values for all the properties that will be tweened by the external plugin. This is what we feed to the external plugin's _onInitTween() as the destination values + * - firstMPT: the first MiniPropTween in the linked list + * - pt: the first CSSPropTween in the linked list that was created when parsing. If shallow is true, this linked list will NOT attach to the one passed into the _parseToProxy() as the "pt" (4th) parameter. + * @param {!Object} t target object to be tweened + * @param {!(Object|string)} vars the object containing the information about the tweening values (typically the end/destination values) that should be parsed + * @param {!CSSPlugin} cssp The CSSPlugin instance + * @param {CSSPropTween=} pt the next CSSPropTween in the linked list + * @param {TweenPlugin=} plugin the external TweenPlugin instance that will be handling tweening the numeric values + * @param {boolean=} shallow if true, the resulting linked list from the parse will NOT be attached to the CSSPropTween that was passed in as the "pt" (4th) parameter. + * @return An object containing the following properties: proxy, end, firstMPT, and pt (see above for descriptions) + */ + _parseToProxy = _internals._parseToProxy = function(t, vars, cssp, pt, plugin, shallow) { + var bpt = pt, + start = {}, + end = {}, + transform = cssp._transform, + oldForce = _forcePT, + i, p, xp, mpt, firstPT; + cssp._transform = null; + _forcePT = vars; + pt = firstPT = cssp.parse(t, vars, pt, plugin); + _forcePT = oldForce; + //break off from the linked list so the new ones are isolated. + if (shallow) { + cssp._transform = transform; + if (bpt) { + bpt._prev = null; + if (bpt._prev) { + bpt._prev._next = null; + } + } + } + while (pt && pt !== bpt) { + if (pt.type <= 1) { + p = pt.p; + end[p] = pt.s + pt.c; + start[p] = pt.s; + if (!shallow) { + mpt = new MiniPropTween(pt, "s", p, mpt, pt.r); + pt.c = 0; + } + if (pt.type === 1) { + i = pt.l; + while (--i > 0) { + xp = "xn" + i; + p = pt.p + "_" + xp; + end[p] = pt.data[xp]; + start[p] = pt[xp]; + if (!shallow) { + mpt = new MiniPropTween(pt, xp, p, mpt, pt.rxp[xp]); + } + } + } + } + pt = pt._next; + } + return {proxy:start, end:end, firstMPT:mpt, pt:firstPT}; + }, + + + + /** + * @constructor Each property that is tweened has at least one CSSPropTween associated with it. These instances store important information like the target, property, starting value, amount of change, etc. They can also optionally have a number of "extra" strings and numeric values named xs1, xn1, xs2, xn2, xs3, xn3, etc. where "s" indicates string and "n" indicates number. These can be pieced together in a complex-value tween (type:1) that has alternating types of data like a string, number, string, number, etc. For example, boxShadow could be "5px 5px 8px rgb(102, 102, 51)". In that value, there are 6 numbers that may need to tween and then pieced back together into a string again with spaces, suffixes, etc. xs0 is special in that it stores the suffix for standard (type:0) tweens, -OR- the first string (prefix) in a complex-value (type:1) CSSPropTween -OR- it can be the non-tweening value in a type:-1 CSSPropTween. We do this to conserve memory. + * CSSPropTweens have the following optional properties as well (not defined through the constructor): + * - l: Length in terms of the number of extra properties that the CSSPropTween has (default: 0). For example, for a boxShadow we may need to tween 5 numbers in which case l would be 5; Keep in mind that the start/end values for the first number that's tweened are always stored in the s and c properties to conserve memory. All additional values thereafter are stored in xn1, xn2, etc. + * - xfirst: The first instance of any sub-CSSPropTweens that are tweening properties of this instance. For example, we may split up a boxShadow tween so that there's a main CSSPropTween of type:1 that has various xs* and xn* values associated with the h-shadow, v-shadow, blur, color, etc. Then we spawn a CSSPropTween for each of those that has a higher priority and runs BEFORE the main CSSPropTween so that the values are all set by the time it needs to re-assemble them. The xfirst gives us an easy way to identify the first one in that chain which typically ends at the main one (because they're all prepende to the linked list) + * - plugin: The TweenPlugin instance that will handle the tweening of any complex values. For example, sometimes we don't want to use normal subtweens (like xfirst refers to) to tween the values - we might want ThrowPropsPlugin or BezierPlugin some other plugin to do the actual tweening, so we create a plugin instance and store a reference here. We need this reference so that if we get a request to round values or disable a tween, we can pass along that request. + * - data: Arbitrary data that needs to be stored with the CSSPropTween. Typically if we're going to have a plugin handle the tweening of a complex-value tween, we create a generic object that stores the END values that we're tweening to and the CSSPropTween's xs1, xs2, etc. have the starting values. We store that object as data. That way, we can simply pass that object to the plugin and use the CSSPropTween as the target. + * - setRatio: Only used for type:2 tweens that require custom functionality. In this case, we call the CSSPropTween's setRatio() method and pass the ratio each time the tween updates. This isn't quite as efficient as doing things directly in the CSSPlugin's setRatio() method, but it's very convenient and flexible. + * @param {!Object} t Target object whose property will be tweened. Often a DOM element, but not always. It could be anything. + * @param {string} p Property to tween (name). For example, to tween element.width, p would be "width". + * @param {number} s Starting numeric value + * @param {number} c Change in numeric value over the course of the entire tween. For example, if element.width starts at 5 and should end at 100, c would be 95. + * @param {CSSPropTween=} next The next CSSPropTween in the linked list. If one is defined, we will define its _prev as the new instance, and the new instance's _next will be pointed at it. + * @param {number=} type The type of CSSPropTween where -1 = a non-tweening value, 0 = a standard simple tween, 1 = a complex value (like one that has multiple numbers in a comma- or space-delimited string like border:"1px solid red"), and 2 = one that uses a custom setRatio function that does all of the work of applying the values on each update. + * @param {string=} n Name of the property that should be used for overwriting purposes which is typically the same as p but not always. For example, we may need to create a subtween for the 2nd part of a "clip:rect(...)" tween in which case "p" might be xs1 but "n" is still "clip" + * @param {boolean=} r If true, the value(s) should be rounded + * @param {number=} pr Priority in the linked list order. Higher priority CSSPropTweens will be updated before lower priority ones. The default priority is 0. + * @param {string=} b Beginning value. We store this to ensure that it is EXACTLY what it was when the tween began without any risk of interpretation issues. + * @param {string=} e Ending value. We store this to ensure that it is EXACTLY what the user defined at the end of the tween without any risk of interpretation issues. + */ + CSSPropTween = _internals.CSSPropTween = function(t, p, s, c, next, type, n, r, pr, b, e) { + this.t = t; //target + this.p = p; //property + this.s = s; //starting value + this.c = c; //change value + this.n = n || p; //name that this CSSPropTween should be associated to (usually the same as p, but not always - n is what overwriting looks at) + if (!(t instanceof CSSPropTween)) { + _overwriteProps.push(this.n); + } + this.r = !r ? r : (typeof(r) === "function") ? r : Math.round; //round (boolean) + this.type = type || 0; //0 = normal tween, -1 = non-tweening (in which case xs0 will be applied to the target's property, like tp.t[tp.p] = tp.xs0), 1 = complex-value SpecialProp, 2 = custom setRatio() that does all the work + if (pr) { + this.pr = pr; + _hasPriority = true; + } + this.b = (b === undefined) ? s : b; + this.e = (e === undefined) ? s + c : e; + if (next) { + this._next = next; + next._prev = this; + } + }, + + _addNonTweeningNumericPT = function(target, prop, start, end, next, overwriteProp) { //cleans up some code redundancies and helps minification. Just a fast way to add a NUMERIC non-tweening CSSPropTween + var pt = new CSSPropTween(target, prop, start, end - start, next, -1, overwriteProp); + pt.b = start; + pt.e = pt.xs0 = end; + return pt; + }, + + /** + * Takes a target, the beginning value and ending value (as strings) and parses them into a CSSPropTween (possibly with child CSSPropTweens) that accommodates multiple numbers, colors, comma-delimited values, etc. For example: + * sp.parseComplex(element, "boxShadow", "5px 10px 20px rgb(255,102,51)", "0px 0px 0px red", true, "0px 0px 0px rgb(0,0,0,0)", pt); + * It will walk through the beginning and ending values (which should be in the same format with the same number and type of values) and figure out which parts are numbers, what strings separate the numeric/tweenable values, and then create the CSSPropTweens accordingly. If a plugin is defined, no child CSSPropTweens will be created. Instead, the ending values will be stored in the "data" property of the returned CSSPropTween like: {s:-5, xn1:-10, xn2:-20, xn3:255, xn4:0, xn5:0} so that it can be fed to any other plugin and it'll be plain numeric tweens but the recomposition of the complex value will be handled inside CSSPlugin's setRatio(). + * If a setRatio is defined, the type of the CSSPropTween will be set to 2 and recomposition of the values will be the responsibility of that method. + * + * @param {!Object} t Target whose property will be tweened + * @param {!string} p Property that will be tweened (its name, like "left" or "backgroundColor" or "boxShadow") + * @param {string} b Beginning value + * @param {string} e Ending value + * @param {boolean} clrs If true, the value could contain a color value like "rgb(255,0,0)" or "#F00" or "red". The default is false, so no colors will be recognized (a performance optimization) + * @param {(string|number|Object)} dflt The default beginning value that should be used if no valid beginning value is defined or if the number of values inside the complex beginning and ending values don't match + * @param {?CSSPropTween} pt CSSPropTween instance that is the current head of the linked list (we'll prepend to this). + * @param {number=} pr Priority in the linked list order. Higher priority properties will be updated before lower priority ones. The default priority is 0. + * @param {TweenPlugin=} plugin If a plugin should handle the tweening of extra properties, pass the plugin instance here. If one is defined, then NO subtweens will be created for any extra properties (the properties will be created - just not additional CSSPropTween instances to tween them) because the plugin is expected to do so. However, the end values WILL be populated in the "data" property, like {s:100, xn1:50, xn2:300} + * @param {function(number)=} setRatio If values should be set in a custom function instead of being pieced together in a type:1 (complex-value) CSSPropTween, define that custom function here. + * @return {CSSPropTween} The first CSSPropTween in the linked list which includes the new one(s) added by the parseComplex() call. + */ + _parseComplex = CSSPlugin.parseComplex = function(t, p, b, e, clrs, dflt, pt, pr, plugin, setRatio) { + //DEBUG: _log("parseComplex: "+p+", b: "+b+", e: "+e); + b = b || dflt || ""; + if (typeof(e) === "function") { + e = e(_index, _target); + } + pt = new CSSPropTween(t, p, 0, 0, pt, (setRatio ? 2 : 1), null, false, pr, b, e); + e += ""; //ensures it's a string + if (clrs && _colorExp.test(e + b)) { //if colors are found, normalize the formatting to rgba() or hsla(). + e = [b, e]; + CSSPlugin.colorStringFilter(e); + b = e[0]; + e = e[1]; + } + var ba = b.split(", ").join(",").split(" "), //beginning array + ea = e.split(", ").join(",").split(" "), //ending array + l = ba.length, + autoRound = (_autoRound !== false), + i, xi, ni, bv, ev, bnums, enums, bn, hasAlpha, temp, cv, str, useHSL; + if (e.indexOf(",") !== -1 || b.indexOf(",") !== -1) { + if ((e + b).indexOf("rgb") !== -1 || (e + b).indexOf("hsl") !== -1) { //keep rgb(), rgba(), hsl(), and hsla() values together! (remember, we're splitting on spaces) + ba = ba.join(" ").replace(_commasOutsideParenExp, ", ").split(" "); + ea = ea.join(" ").replace(_commasOutsideParenExp, ", ").split(" "); + } else { + ba = ba.join(" ").split(",").join(", ").split(" "); + ea = ea.join(" ").split(",").join(", ").split(" "); + } + l = ba.length; + } + if (l !== ea.length) { + //DEBUG: _log("mismatched formatting detected on " + p + " (" + b + " vs " + e + ")"); + ba = (dflt || "").split(" "); + l = ba.length; + } + pt.plugin = plugin; + pt.setRatio = setRatio; + _colorExp.lastIndex = 0; + for (i = 0; i < l; i++) { + bv = ba[i]; + ev = ea[i] + ""; + bn = parseFloat(bv); + //if the value begins with a number (most common). It's fine if it has a suffix like px + if (bn || bn === 0) { + pt.appendXtra("", bn, _parseChange(ev, bn), ev.replace(_relNumExp, ""), (autoRound && ev.indexOf("px") !== -1) ? Math.round : false, true); + + //if the value is a color + } else if (clrs && _colorExp.test(bv)) { + str = ev.indexOf(")") + 1; + str = ")" + (str ? ev.substr(str) : ""); //if there's a comma or ) at the end, retain it. + useHSL = (ev.indexOf("hsl") !== -1 && _supportsOpacity); + temp = ev; //original string value so we can look for any prefix later. + bv = _parseColor(bv, useHSL); + ev = _parseColor(ev, useHSL); + hasAlpha = (bv.length + ev.length > 6); + if (hasAlpha && !_supportsOpacity && ev[3] === 0) { //older versions of IE don't support rgba(), so if the destination alpha is 0, just use "transparent" for the end color + pt["xs" + pt.l] += pt.l ? " transparent" : "transparent"; + pt.e = pt.e.split(ea[i]).join("transparent"); + } else { + if (!_supportsOpacity) { //old versions of IE don't support rgba(). + hasAlpha = false; + } + if (useHSL) { + pt.appendXtra(temp.substr(0, temp.indexOf("hsl")) + (hasAlpha ? "hsla(" : "hsl("), bv[0], _parseChange(ev[0], bv[0]), ",", false, true) + .appendXtra("", bv[1], _parseChange(ev[1], bv[1]), "%,", false) + .appendXtra("", bv[2], _parseChange(ev[2], bv[2]), (hasAlpha ? "%," : "%" + str), false); + } else { + pt.appendXtra(temp.substr(0, temp.indexOf("rgb")) + (hasAlpha ? "rgba(" : "rgb("), bv[0], ev[0] - bv[0], ",", Math.round, true) + .appendXtra("", bv[1], ev[1] - bv[1], ",", Math.round) + .appendXtra("", bv[2], ev[2] - bv[2], (hasAlpha ? "," : str), Math.round); + } + + if (hasAlpha) { + bv = (bv.length < 4) ? 1 : bv[3]; + pt.appendXtra("", bv, ((ev.length < 4) ? 1 : ev[3]) - bv, str, false); + } + } + _colorExp.lastIndex = 0; //otherwise the test() on the RegExp could move the lastIndex and taint future results. + + } else { + bnums = bv.match(_numExp); //gets each group of numbers in the beginning value string and drops them into an array + + //if no number is found, treat it as a non-tweening value and just append the string to the current xs. + if (!bnums) { + pt["xs" + pt.l] += (pt.l || pt["xs" + pt.l]) ? " " + ev : ev; + + //loop through all the numbers that are found and construct the extra values on the pt. + } else { + enums = ev.match(_relNumExp); //get each group of numbers in the end value string and drop them into an array. We allow relative values too, like +=50 or -=.5 + if (!enums || enums.length !== bnums.length) { + //DEBUG: _log("mismatched formatting detected on " + p + " (" + b + " vs " + e + ")"); + return pt; + } + ni = 0; + for (xi = 0; xi < bnums.length; xi++) { + cv = bnums[xi]; + temp = bv.indexOf(cv, ni); + pt.appendXtra(bv.substr(ni, temp - ni), Number(cv), _parseChange(enums[xi], cv), "", (autoRound && bv.substr(temp + cv.length, 2) === "px") ? Math.round : false, (xi === 0)); + ni = temp + cv.length; + } + pt["xs" + pt.l] += bv.substr(ni); + } + } + } + //if there are relative values ("+=" or "-=" prefix), we need to adjust the ending value to eliminate the prefixes and combine the values properly. + if (e.indexOf("=") !== -1) if (pt.data) { + str = pt.xs0 + pt.data.s; + for (i = 1; i < pt.l; i++) { + str += pt["xs" + i] + pt.data["xn" + i]; + } + pt.e = str + pt["xs" + i]; + } + if (!pt.l) { + pt.type = -1; + pt.xs0 = pt.e; + } + return pt.xfirst || pt; + }, + i = 9; + + + p = CSSPropTween.prototype; + p.l = p.pr = 0; //length (number of extra properties like xn1, xn2, xn3, etc. + while (--i > 0) { + p["xn" + i] = 0; + p["xs" + i] = ""; + } + p.xs0 = ""; + p._next = p._prev = p.xfirst = p.data = p.plugin = p.setRatio = p.rxp = null; + + + /** + * Appends and extra tweening value to a CSSPropTween and automatically manages any prefix and suffix strings. The first extra value is stored in the s and c of the main CSSPropTween instance, but thereafter any extras are stored in the xn1, xn2, xn3, etc. The prefixes and suffixes are stored in the xs0, xs1, xs2, etc. properties. For example, if I walk through a clip value like "rect(10px, 5px, 0px, 20px)", the values would be stored like this: + * xs0:"rect(", s:10, xs1:"px, ", xn1:5, xs2:"px, ", xn2:0, xs3:"px, ", xn3:20, xn4:"px)" + * And they'd all get joined together when the CSSPlugin renders (in the setRatio() method). + * @param {string=} pfx Prefix (if any) + * @param {!number} s Starting value + * @param {!number} c Change in numeric value over the course of the entire tween. For example, if the start is 5 and the end is 100, the change would be 95. + * @param {string=} sfx Suffix (if any) + * @param {boolean=} r Round (if true). + * @param {boolean=} pad If true, this extra value should be separated by the previous one by a space. If there is no previous extra and pad is true, it will automatically drop the space. + * @return {CSSPropTween} returns itself so that multiple methods can be chained together. + */ + p.appendXtra = function(pfx, s, c, sfx, r, pad) { + var pt = this, + l = pt.l; + pt["xs" + l] += (pad && (l || pt["xs" + l])) ? " " + pfx : pfx || ""; + if (!c) if (l !== 0 && !pt.plugin) { //typically we'll combine non-changing values right into the xs to optimize performance, but we don't combine them when there's a plugin that will be tweening the values because it may depend on the values being split apart, like for a bezier, if a value doesn't change between the first and second iteration but then it does on the 3rd, we'll run into trouble because there's no xn slot for that value! + pt["xs" + l] += s + (sfx || ""); + return pt; + } + pt.l++; + pt.type = pt.setRatio ? 2 : 1; + pt["xs" + pt.l] = sfx || ""; + if (l > 0) { + pt.data["xn" + l] = s + c; + pt.rxp["xn" + l] = r; //round extra property (we need to tap into this in the _parseToProxy() method) + pt["xn" + l] = s; + if (!pt.plugin) { + pt.xfirst = new CSSPropTween(pt, "xn" + l, s, c, pt.xfirst || pt, 0, pt.n, r, pt.pr); + pt.xfirst.xs0 = 0; //just to ensure that the property stays numeric which helps modern browsers speed up processing. Remember, in the setRatio() method, we do pt.t[pt.p] = val + pt.xs0 so if pt.xs0 is "" (the default), it'll cast the end value as a string. When a property is a number sometimes and a string sometimes, it prevents the compiler from locking in the data type, slowing things down slightly. + } + return pt; + } + pt.data = {s:s + c}; + pt.rxp = {}; + pt.s = s; + pt.c = c; + pt.r = r; + return pt; + }; + + /** + * @constructor A SpecialProp is basically a css property that needs to be treated in a non-standard way, like if it may contain a complex value like boxShadow:"5px 10px 15px rgb(255, 102, 51)" or if it is associated with another plugin like ThrowPropsPlugin or BezierPlugin. Every SpecialProp is associated with a particular property name like "boxShadow" or "throwProps" or "bezier" and it will intercept those values in the vars object that's passed to the CSSPlugin and handle them accordingly. + * @param {!string} p Property name (like "boxShadow" or "throwProps") + * @param {Object=} options An object containing any of the following configuration options: + * - defaultValue: the default value + * - parser: A function that should be called when the associated property name is found in the vars. This function should return a CSSPropTween instance and it should ensure that it is properly inserted into the linked list. It will receive 4 paramters: 1) The target, 2) The value defined in the vars, 3) The CSSPlugin instance (whose _firstPT should be used for the linked list), and 4) A computed style object if one was calculated (this is a speed optimization that allows retrieval of starting values quicker) + * - formatter: a function that formats any value received for this special property (for example, boxShadow could take "5px 5px red" and format it to "5px 5px 0px 0px red" so that both the beginning and ending values have a common order and quantity of values.) + * - prefix: if true, we'll determine whether or not this property requires a vendor prefix (like Webkit or Moz or ms or O) + * - color: set this to true if the value for this SpecialProp may contain color-related values like rgb(), rgba(), etc. + * - priority: priority in the linked list order. Higher priority SpecialProps will be updated before lower priority ones. The default priority is 0. + * - multi: if true, the formatter should accommodate a comma-delimited list of values, like boxShadow could have multiple boxShadows listed out. + * - collapsible: if true, the formatter should treat the value like it's a top/right/bottom/left value that could be collapsed, like "5px" would apply to all, "5px, 10px" would use 5px for top/bottom and 10px for right/left, etc. + * - keyword: a special keyword that can [optionally] be found inside the value (like "inset" for boxShadow). This allows us to validate beginning/ending values to make sure they match (if the keyword is found in one, it'll be added to the other for consistency by default). + */ + var SpecialProp = function(p, options) { + options = options || {}; + this.p = options.prefix ? _checkPropPrefix(p) || p : p; + _specialProps[p] = _specialProps[this.p] = this; + this.format = options.formatter || _getFormatter(options.defaultValue, options.color, options.collapsible, options.multi); + if (options.parser) { + this.parse = options.parser; + } + this.clrs = options.color; + this.multi = options.multi; + this.keyword = options.keyword; + this.dflt = options.defaultValue; + this.allowFunc = options.allowFunc; + this.pr = options.priority || 0; + }, + + //shortcut for creating a new SpecialProp that can accept multiple properties as a comma-delimited list (helps minification). dflt can be an array for multiple values (we don't do a comma-delimited list because the default value may contain commas, like rect(0px,0px,0px,0px)). We attach this method to the SpecialProp class/object instead of using a private _createSpecialProp() method so that we can tap into it externally if necessary, like from another plugin. + _registerComplexSpecialProp = _internals._registerComplexSpecialProp = function(p, options, defaults) { + if (typeof(options) !== "object") { + options = {parser:defaults}; //to make backwards compatible with older versions of BezierPlugin and ThrowPropsPlugin + } + var a = p.split(","), + d = options.defaultValue, + i, temp; + defaults = defaults || [d]; + for (i = 0; i < a.length; i++) { + options.prefix = (i === 0 && options.prefix); + options.defaultValue = defaults[i] || d; + temp = new SpecialProp(a[i], options); + } + }, + + //creates a placeholder special prop for a plugin so that the property gets caught the first time a tween of it is attempted, and at that time it makes the plugin register itself, thus taking over for all future tweens of that property. This allows us to not mandate that things load in a particular order and it also allows us to log() an error that informs the user when they attempt to tween an external plugin-related property without loading its .js file. + _registerPluginProp = _internals._registerPluginProp = function(p) { + if (!_specialProps[p]) { + var pluginName = p.charAt(0).toUpperCase() + p.substr(1) + "Plugin"; + _registerComplexSpecialProp(p, {parser:function(t, e, p, cssp, pt, plugin, vars) { + var pluginClass = _globals.com.greensock.plugins[pluginName]; + if (!pluginClass) { + _log("Error: " + pluginName + " js file not loaded."); + return pt; + } + pluginClass._cssRegister(); + return _specialProps[p].parse(t, e, p, cssp, pt, plugin, vars); + }}); + } + }; + + + p = SpecialProp.prototype; + + /** + * Alias for _parseComplex() that automatically plugs in certain values for this SpecialProp, like its property name, whether or not colors should be sensed, the default value, and priority. It also looks for any keyword that the SpecialProp defines (like "inset" for boxShadow) and ensures that the beginning and ending values have the same number of values for SpecialProps where multi is true (like boxShadow and textShadow can have a comma-delimited list) + * @param {!Object} t target element + * @param {(string|number|object)} b beginning value + * @param {(string|number|object)} e ending (destination) value + * @param {CSSPropTween=} pt next CSSPropTween in the linked list + * @param {TweenPlugin=} plugin If another plugin will be tweening the complex value, that TweenPlugin instance goes here. + * @param {function=} setRatio If a custom setRatio() method should be used to handle this complex value, that goes here. + * @return {CSSPropTween=} First CSSPropTween in the linked list + */ + p.parseComplex = function(t, b, e, pt, plugin, setRatio) { + var kwd = this.keyword, + i, ba, ea, l, bi, ei; + //if this SpecialProp's value can contain a comma-delimited list of values (like boxShadow or textShadow), we must parse them in a special way, and look for a keyword (like "inset" for boxShadow) and ensure that the beginning and ending BOTH have it if the end defines it as such. We also must ensure that there are an equal number of values specified (we can't tween 1 boxShadow to 3 for example) + if (this.multi) if (_commasOutsideParenExp.test(e) || _commasOutsideParenExp.test(b)) { + ba = b.replace(_commasOutsideParenExp, "|").split("|"); + ea = e.replace(_commasOutsideParenExp, "|").split("|"); + } else if (kwd) { + ba = [b]; + ea = [e]; + } + if (ea) { + l = (ea.length > ba.length) ? ea.length : ba.length; + for (i = 0; i < l; i++) { + b = ba[i] = ba[i] || this.dflt; + e = ea[i] = ea[i] || this.dflt; + if (kwd) { + bi = b.indexOf(kwd); + ei = e.indexOf(kwd); + if (bi !== ei) { + if (ei === -1) { //if the keyword isn't in the end value, remove it from the beginning one. + ba[i] = ba[i].split(kwd).join(""); + } else if (bi === -1) { //if the keyword isn't in the beginning, add it. + ba[i] += " " + kwd; + } + } + } + } + b = ba.join(", "); + e = ea.join(", "); + } + return _parseComplex(t, this.p, b, e, this.clrs, this.dflt, pt, this.pr, plugin, setRatio); + }; + + /** + * Accepts a target and end value and spits back a CSSPropTween that has been inserted into the CSSPlugin's linked list and conforms with all the conventions we use internally, like type:-1, 0, 1, or 2, setting up any extra property tweens, priority, etc. For example, if we have a boxShadow SpecialProp and call: + * this._firstPT = sp.parse(element, "5px 10px 20px rgb(2550,102,51)", "boxShadow", this); + * It should figure out the starting value of the element's boxShadow, compare it to the provided end value and create all the necessary CSSPropTweens of the appropriate types to tween the boxShadow. The CSSPropTween that gets spit back should already be inserted into the linked list (the 4th parameter is the current head, so prepend to that). + * @param {!Object} t Target object whose property is being tweened + * @param {Object} e End value as provided in the vars object (typically a string, but not always - like a throwProps would be an object). + * @param {!string} p Property name + * @param {!CSSPlugin} cssp The CSSPlugin instance that should be associated with this tween. + * @param {?CSSPropTween} pt The CSSPropTween that is the current head of the linked list (we'll prepend to it) + * @param {TweenPlugin=} plugin If a plugin will be used to tween the parsed value, this is the plugin instance. + * @param {Object=} vars Original vars object that contains the data for parsing. + * @return {CSSPropTween} The first CSSPropTween in the linked list which includes the new one(s) added by the parse() call. + */ + p.parse = function(t, e, p, cssp, pt, plugin, vars) { + return this.parseComplex(t.style, this.format(_getStyle(t, this.p, _cs, false, this.dflt)), this.format(e), pt, plugin); + }; + + /** + * Registers a special property that should be intercepted from any "css" objects defined in tweens. This allows you to handle them however you want without CSSPlugin doing it for you. The 2nd parameter should be a function that accepts 3 parameters: + * 1) Target object whose property should be tweened (typically a DOM element) + * 2) The end/destination value (could be a string, number, object, or whatever you want) + * 3) The tween instance (you probably don't need to worry about this, but it can be useful for looking up information like the duration) + * + * Then, your function should return a function which will be called each time the tween gets rendered, passing a numeric "ratio" parameter to your function that indicates the change factor (usually between 0 and 1). For example: + * + * CSSPlugin.registerSpecialProp("myCustomProp", function(target, value, tween) { + * var start = target.style.width; + * return function(ratio) { + * target.style.width = (start + value * ratio) + "px"; + * console.log("set width to " + target.style.width); + * } + * }, 0); + * + * Then, when I do this tween, it will trigger my special property: + * + * TweenLite.to(element, 1, {css:{myCustomProp:100}}); + * + * In the example, of course, we're just changing the width, but you can do anything you want. + * + * @param {!string} name Property name (or comma-delimited list of property names) that should be intercepted and handled by your function. For example, if I define "myCustomProp", then it would handle that portion of the following tween: TweenLite.to(element, 1, {css:{myCustomProp:100}}) + * @param {!function(Object, Object, Object, string):function(number)} onInitTween The function that will be called when a tween of this special property is performed. The function will receive 4 parameters: 1) Target object that should be tweened, 2) Value that was passed to the tween, 3) The tween instance itself (rarely used), and 4) The property name that's being tweened. Your function should return a function that should be called on every update of the tween. That function will receive a single parameter that is a "change factor" value (typically between 0 and 1) indicating the amount of change as a ratio. You can use this to determine how to set the values appropriately in your function. + * @param {number=} priority Priority that helps the engine determine the order in which to set the properties (default: 0). Higher priority properties will be updated before lower priority ones. + */ + CSSPlugin.registerSpecialProp = function(name, onInitTween, priority) { + _registerComplexSpecialProp(name, {parser:function(t, e, p, cssp, pt, plugin, vars) { + var rv = new CSSPropTween(t, p, 0, 0, pt, 2, p, false, priority); + rv.plugin = plugin; + rv.setRatio = onInitTween(t, e, cssp._tween, p); + return rv; + }, priority:priority}); + }; + + + + + + + //transform-related methods and properties + CSSPlugin.useSVGTransformAttr = true; //Safari and Firefox both have some rendering bugs when applying CSS transforms to SVG elements, so default to using the "transform" attribute instead (users can override this). + var _transformProps = ("scaleX,scaleY,scaleZ,x,y,z,skewX,skewY,rotation,rotationX,rotationY,perspective,xPercent,yPercent").split(","), + _transformProp = _checkPropPrefix("transform"), //the Javascript (camelCase) transform property, like msTransform, WebkitTransform, MozTransform, or OTransform. + _transformPropCSS = _prefixCSS + "transform", + _transformOriginProp = _checkPropPrefix("transformOrigin"), + _supports3D = (_checkPropPrefix("perspective") !== null), + Transform = _internals.Transform = function() { + this.perspective = parseFloat(CSSPlugin.defaultTransformPerspective) || 0; + this.force3D = (CSSPlugin.defaultForce3D === false || !_supports3D) ? false : CSSPlugin.defaultForce3D || "auto"; + }, + _SVGElement = _gsScope.SVGElement, + _useSVGTransformAttr, + //Some browsers (like Firefox and IE) don't honor transform-origin properly in SVG elements, so we need to manually adjust the matrix accordingly. We feature detect here rather than always doing the conversion for certain browsers because they may fix the problem at some point in the future. + + _createSVG = function(type, container, attributes) { + var element = _doc.createElementNS("http://www.w3.org/2000/svg", type), + reg = /([a-z])([A-Z])/g, + p; + for (p in attributes) { + element.setAttributeNS(null, p.replace(reg, "$1-$2").toLowerCase(), attributes[p]); + } + container.appendChild(element); + return element; + }, + _docElement = _doc.documentElement || {}, + _forceSVGTransformAttr = (function() { + //IE and Android stock don't support CSS transforms on SVG elements, so we must write them to the "transform" attribute. We populate this variable in the _parseTransform() method, and only if/when we come across an SVG element + var force = _ieVers || (/Android/i.test(_agent) && !_gsScope.chrome), + svg, rect, width; + if (_doc.createElementNS && !force) { //IE8 and earlier doesn't support SVG anyway + svg = _createSVG("svg", _docElement); + rect = _createSVG("rect", svg, {width:100, height:50, x:100}); + width = rect.getBoundingClientRect().width; + rect.style[_transformOriginProp] = "50% 50%"; + rect.style[_transformProp] = "scaleX(0.5)"; + force = (width === rect.getBoundingClientRect().width && !(_isFirefox && _supports3D)); //note: Firefox fails the test even though it does support CSS transforms in 3D. Since we can't push 3D stuff into the transform attribute, we force Firefox to pass the test here (as long as it does truly support 3D). + _docElement.removeChild(svg); + } + return force; + })(), + _parseSVGOrigin = function(e, local, decoratee, absolute, smoothOrigin, skipRecord) { + var tm = e._gsTransform, + m = _getMatrix(e, true), + v, x, y, xOrigin, yOrigin, a, b, c, d, tx, ty, determinant, xOriginOld, yOriginOld; + if (tm) { + xOriginOld = tm.xOrigin; //record the original values before we alter them. + yOriginOld = tm.yOrigin; + } + if (!absolute || (v = absolute.split(" ")).length < 2) { + b = e.getBBox(); + if (b.x === 0 && b.y === 0 && b.width + b.height === 0) { //some browsers (like Firefox) misreport the bounds if the element has zero width and height (it just assumes it's at x:0, y:0), thus we need to manually grab the position in that case. + b = {x: parseFloat(e.hasAttribute("x") ? e.getAttribute("x") : e.hasAttribute("cx") ? e.getAttribute("cx") : 0) || 0, y: parseFloat(e.hasAttribute("y") ? e.getAttribute("y") : e.hasAttribute("cy") ? e.getAttribute("cy") : 0) || 0, width:0, height:0}; + } + local = _parsePosition(local).split(" "); + v = [(local[0].indexOf("%") !== -1 ? parseFloat(local[0]) / 100 * b.width : parseFloat(local[0])) + b.x, + (local[1].indexOf("%") !== -1 ? parseFloat(local[1]) / 100 * b.height : parseFloat(local[1])) + b.y]; + } + decoratee.xOrigin = xOrigin = parseFloat(v[0]); + decoratee.yOrigin = yOrigin = parseFloat(v[1]); + if (absolute && m !== _identity2DMatrix) { //if svgOrigin is being set, we must invert the matrix and determine where the absolute point is, factoring in the current transforms. Otherwise, the svgOrigin would be based on the element's non-transformed position on the canvas. + a = m[0]; + b = m[1]; + c = m[2]; + d = m[3]; + tx = m[4]; + ty = m[5]; + determinant = (a * d - b * c); + if (determinant) { //if it's zero (like if scaleX and scaleY are zero), skip it to avoid errors with dividing by zero. + x = xOrigin * (d / determinant) + yOrigin * (-c / determinant) + ((c * ty - d * tx) / determinant); + y = xOrigin * (-b / determinant) + yOrigin * (a / determinant) - ((a * ty - b * tx) / determinant); + xOrigin = decoratee.xOrigin = v[0] = x; + yOrigin = decoratee.yOrigin = v[1] = y; + } + } + if (tm) { //avoid jump when transformOrigin is changed - adjust the x/y values accordingly + if (skipRecord) { + decoratee.xOffset = tm.xOffset; + decoratee.yOffset = tm.yOffset; + tm = decoratee; + } + if (smoothOrigin || (smoothOrigin !== false && CSSPlugin.defaultSmoothOrigin !== false)) { + x = xOrigin - xOriginOld; + y = yOrigin - yOriginOld; + //originally, we simply adjusted the x and y values, but that would cause problems if, for example, you created a rotational tween part-way through an x/y tween. Managing the offset in a separate variable gives us ultimate flexibility. + //tm.x -= x - (x * m[0] + y * m[2]); + //tm.y -= y - (x * m[1] + y * m[3]); + tm.xOffset += (x * m[0] + y * m[2]) - x; + tm.yOffset += (x * m[1] + y * m[3]) - y; + } else { + tm.xOffset = tm.yOffset = 0; + } + } + if (!skipRecord) { + e.setAttribute("data-svg-origin", v.join(" ")); + } + }, + _getBBoxHack = function(swapIfPossible) { //works around issues in some browsers (like Firefox) that don't correctly report getBBox() on SVG elements inside a element and/or . We try creating an SVG, adding it to the documentElement and toss the element in there so that it's definitely part of the rendering tree, then grab the bbox and if it works, we actually swap out the original getBBox() method for our own that does these extra steps whenever getBBox is needed. This helps ensure that performance is optimal (only do all these extra steps when absolutely necessary...most elements don't need it). + var svg = _createElement("svg", (this.ownerSVGElement && this.ownerSVGElement.getAttribute("xmlns")) || "http://www.w3.org/2000/svg"), + oldParent = this.parentNode, + oldSibling = this.nextSibling, + oldCSS = this.style.cssText, + bbox; + _docElement.appendChild(svg); + svg.appendChild(this); + this.style.display = "block"; + if (swapIfPossible) { + try { + bbox = this.getBBox(); + this._originalGetBBox = this.getBBox; + this.getBBox = _getBBoxHack; + } catch (e) { } + } else if (this._originalGetBBox) { + bbox = this._originalGetBBox(); + } + if (oldSibling) { + oldParent.insertBefore(this, oldSibling); + } else { + oldParent.appendChild(this); + } + _docElement.removeChild(svg); + this.style.cssText = oldCSS; + return bbox; + }, + _getBBox = function(e) { + try { + return e.getBBox(); //Firefox throws errors if you try calling getBBox() on an SVG element that's not rendered (like in a or ). https://bugzilla.mozilla.org/show_bug.cgi?id=612118 + } catch (error) { + return _getBBoxHack.call(e, true); + } + }, + _isSVG = function(e) { //reports if the element is an SVG on which getBBox() actually works + return !!(_SVGElement && e.getCTM && (!e.parentNode || e.ownerSVGElement) && _getBBox(e)); + }, + _identity2DMatrix = [1,0,0,1,0,0], + _getMatrix = function(e, force2D) { + var tm = e._gsTransform || new Transform(), + rnd = 100000, + style = e.style, + isDefault, s, m, n, dec, nextSibling, parent; + if (_transformProp) { + s = _getStyle(e, _transformPropCSS, null, true); + } else if (e.currentStyle) { + //for older versions of IE, we need to interpret the filter portion that is in the format: progid:DXImageTransform.Microsoft.Matrix(M11=6.123233995736766e-17, M12=-1, M21=1, M22=6.123233995736766e-17, sizingMethod='auto expand') Notice that we need to swap b and c compared to a normal matrix. + s = e.currentStyle.filter.match(_ieGetMatrixExp); + s = (s && s.length === 4) ? [s[0].substr(4), Number(s[2].substr(4)), Number(s[1].substr(4)), s[3].substr(4), (tm.x || 0), (tm.y || 0)].join(",") : ""; + } + isDefault = (!s || s === "none" || s === "matrix(1, 0, 0, 1, 0, 0)"); + if (_transformProp && isDefault && !e.offsetParent) { //note: if offsetParent is null, that means the element isn't in the normal document flow, like if it has display:none or one of its ancestors has display:none). Firefox returns null for getComputedStyle() if the element is in an iframe that has display:none. https://bugzilla.mozilla.org/show_bug.cgi?id=548397 + //browsers don't report transforms accurately unless the element is in the DOM and has a display value that's not "none". Firefox and Microsoft browsers have a partial bug where they'll report transforms even if display:none BUT not any percentage-based values like translate(-50%, 8px) will be reported as if it's translate(0, 8px). + n = style.display; + style.display = "block"; + parent = e.parentNode; + if (!parent || !e.offsetParent) { + dec = 1; //flag + nextSibling = e.nextSibling; + _docElement.appendChild(e); //we must add it to the DOM in order to get values properly + } + s = _getStyle(e, _transformPropCSS, null, true); + isDefault = (!s || s === "none" || s === "matrix(1, 0, 0, 1, 0, 0)"); + if (n) { + style.display = n; + } else { + _removeProp(style, "display"); + } + if (dec) { + if (nextSibling) { + parent.insertBefore(e, nextSibling); + } else if (parent) { + parent.appendChild(e); + } else { + _docElement.removeChild(e); + } + } + } + if (tm.svg || (e.getCTM && _isSVG(e))) { + if (isDefault && (style[_transformProp] + "").indexOf("matrix") !== -1) { //some browsers (like Chrome 40) don't correctly report transforms that are applied inline on an SVG element (they don't get included in the computed style), so we double-check here and accept matrix values + s = style[_transformProp]; + isDefault = 0; + } + m = e.getAttribute("transform"); + if (isDefault && m) { + m = e.transform.baseVal.consolidate().matrix; //ensures that even complex values like "translate(50,60) rotate(135,0,0)" are parsed because it mashes it into a matrix. + s = "matrix(" + m.a + "," + m.b + "," + m.c + "," + m.d + "," + m.e + "," + m.f + ")"; + isDefault = 0; + } + } + if (isDefault) { + return _identity2DMatrix; + } + //split the matrix values out into an array (m for matrix) + m = (s || "").match(_numExp) || []; + i = m.length; + while (--i > -1) { + n = Number(m[i]); + m[i] = (dec = n - (n |= 0)) ? ((dec * rnd + (dec < 0 ? -0.5 : 0.5)) | 0) / rnd + n : n; //convert strings to Numbers and round to 5 decimal places to avoid issues with tiny numbers. Roughly 20x faster than Number.toFixed(). We also must make sure to round before dividing so that values like 0.9999999999 become 1 to avoid glitches in browser rendering and interpretation of flipped/rotated 3D matrices. And don't just multiply the number by rnd, floor it, and then divide by rnd because the bitwise operations max out at a 32-bit signed integer, thus it could get clipped at a relatively low value (like 22,000.00000 for example). + } + return (force2D && m.length > 6) ? [m[0], m[1], m[4], m[5], m[12], m[13]] : m; + }, + + /** + * Parses the transform values for an element, returning an object with x, y, z, scaleX, scaleY, scaleZ, rotation, rotationX, rotationY, skewX, and skewY properties. Note: by default (for performance reasons), all skewing is combined into skewX and rotation but skewY still has a place in the transform object so that we can record how much of the skew is attributed to skewX vs skewY. Remember, a skewY of 10 looks the same as a rotation of 10 and skewX of -10. + * @param {!Object} t target element + * @param {Object=} cs computed style object (optional) + * @param {boolean=} rec if true, the transform values will be recorded to the target element's _gsTransform object, like target._gsTransform = {x:0, y:0, z:0, scaleX:1...} + * @param {boolean=} parse if true, we'll ignore any _gsTransform values that already exist on the element, and force a reparsing of the css (calculated style) + * @return {object} object containing all of the transform properties/values like {x:0, y:0, z:0, scaleX:1...} + */ + _getTransform = _internals.getTransform = function(t, cs, rec, parse) { + if (t._gsTransform && rec && !parse) { + return t._gsTransform; //if the element already has a _gsTransform, use that. Note: some browsers don't accurately return the calculated style for the transform (particularly for SVG), so it's almost always safest to just use the values we've already applied rather than re-parsing things. + } + var tm = rec ? t._gsTransform || new Transform() : new Transform(), + invX = (tm.scaleX < 0), //in order to interpret things properly, we need to know if the user applied a negative scaleX previously so that we can adjust the rotation and skewX accordingly. Otherwise, if we always interpret a flipped matrix as affecting scaleY and the user only wants to tween the scaleX on multiple sequential tweens, it would keep the negative scaleY without that being the user's intent. + min = 0.00002, + rnd = 100000, + zOrigin = _supports3D ? parseFloat(_getStyle(t, _transformOriginProp, cs, false, "0 0 0").split(" ")[2]) || tm.zOrigin || 0 : 0, + defaultTransformPerspective = parseFloat(CSSPlugin.defaultTransformPerspective) || 0, + m, i, scaleX, scaleY, rotation, skewX; + + tm.svg = !!(t.getCTM && _isSVG(t)); + if (tm.svg) { + _parseSVGOrigin(t, _getStyle(t, _transformOriginProp, cs, false, "50% 50%") + "", tm, t.getAttribute("data-svg-origin")); + _useSVGTransformAttr = CSSPlugin.useSVGTransformAttr || _forceSVGTransformAttr; + } + m = _getMatrix(t); + if (m !== _identity2DMatrix) { + + if (m.length === 16) { + //we'll only look at these position-related 6 variables first because if x/y/z all match, it's relatively safe to assume we don't need to re-parse everything which risks losing important rotational information (like rotationX:180 plus rotationY:180 would look the same as rotation:180 - there's no way to know for sure which direction was taken based solely on the matrix3d() values) + var a11 = m[0], a21 = m[1], a31 = m[2], a41 = m[3], + a12 = m[4], a22 = m[5], a32 = m[6], a42 = m[7], + a13 = m[8], a23 = m[9], a33 = m[10], + a14 = m[12], a24 = m[13], a34 = m[14], + a43 = m[11], + angle = Math.atan2(a32, a33), + t1, t2, t3, t4, cos, sin; + //we manually compensate for non-zero z component of transformOrigin to work around bugs in Safari + if (tm.zOrigin) { + a34 = -tm.zOrigin; + a14 = a13*a34-m[12]; + a24 = a23*a34-m[13]; + a34 = a33*a34+tm.zOrigin-m[14]; + } + //note for possible future consolidation: rotationX: Math.atan2(a32, a33), rotationY: Math.atan2(-a31, Math.sqrt(a33 * a33 + a32 * a32)), rotation: Math.atan2(a21, a11), skew: Math.atan2(a12, a22). However, it doesn't seem to be quite as reliable as the full-on backwards rotation procedure. + tm.rotationX = angle * _RAD2DEG; + //rotationX + if (angle) { + cos = Math.cos(-angle); + sin = Math.sin(-angle); + t1 = a12*cos+a13*sin; + t2 = a22*cos+a23*sin; + t3 = a32*cos+a33*sin; + a13 = a12*-sin+a13*cos; + a23 = a22*-sin+a23*cos; + a33 = a32*-sin+a33*cos; + a43 = a42*-sin+a43*cos; + a12 = t1; + a22 = t2; + a32 = t3; + } + //rotationY + angle = Math.atan2(-a31, a33); + tm.rotationY = angle * _RAD2DEG; + if (angle) { + cos = Math.cos(-angle); + sin = Math.sin(-angle); + t1 = a11*cos-a13*sin; + t2 = a21*cos-a23*sin; + t3 = a31*cos-a33*sin; + a23 = a21*sin+a23*cos; + a33 = a31*sin+a33*cos; + a43 = a41*sin+a43*cos; + a11 = t1; + a21 = t2; + a31 = t3; + } + //rotationZ + angle = Math.atan2(a21, a11); + tm.rotation = angle * _RAD2DEG; + if (angle) { + cos = Math.cos(angle); + sin = Math.sin(angle); + t1 = a11*cos+a21*sin; + t2 = a12*cos+a22*sin; + t3 = a13*cos+a23*sin; + a21 = a21*cos-a11*sin; + a22 = a22*cos-a12*sin; + a23 = a23*cos-a13*sin; + a11 = t1; + a12 = t2; + a13 = t3; + } + + if (tm.rotationX && Math.abs(tm.rotationX) + Math.abs(tm.rotation) > 359.9) { //when rotationY is set, it will often be parsed as 180 degrees different than it should be, and rotationX and rotation both being 180 (it looks the same), so we adjust for that here. + tm.rotationX = tm.rotation = 0; + tm.rotationY = 180 - tm.rotationY; + } + + //skewX + angle = Math.atan2(a12, a22); + + //scales + tm.scaleX = ((Math.sqrt(a11 * a11 + a21 * a21 + a31 * a31) * rnd + 0.5) | 0) / rnd; + tm.scaleY = ((Math.sqrt(a22 * a22 + a32 * a32) * rnd + 0.5) | 0) / rnd; + tm.scaleZ = ((Math.sqrt(a13 * a13 + a23 * a23 + a33 * a33) * rnd + 0.5) | 0) / rnd; + a11 /= tm.scaleX; + a12 /= tm.scaleY; + a21 /= tm.scaleX; + a22 /= tm.scaleY; + if (Math.abs(angle) > min) { + tm.skewX = angle * _RAD2DEG; + a12 = 0; //unskews + if (tm.skewType !== "simple") { + tm.scaleY *= 1 / Math.cos(angle); //by default, we compensate the scale based on the skew so that the element maintains a similar proportion when skewed, so we have to alter the scaleY here accordingly to match the default (non-adjusted) skewing that CSS does (stretching more and more as it skews). + } + + } else { + tm.skewX = 0; + } + + /* //for testing purposes + var transform = "matrix3d(", + comma = ",", + zero = "0"; + a13 /= tm.scaleZ; + a23 /= tm.scaleZ; + a31 /= tm.scaleX; + a32 /= tm.scaleY; + a33 /= tm.scaleZ; + transform += ((a11 < min && a11 > -min) ? zero : a11) + comma + ((a21 < min && a21 > -min) ? zero : a21) + comma + ((a31 < min && a31 > -min) ? zero : a31); + transform += comma + ((a41 < min && a41 > -min) ? zero : a41) + comma + ((a12 < min && a12 > -min) ? zero : a12) + comma + ((a22 < min && a22 > -min) ? zero : a22); + transform += comma + ((a32 < min && a32 > -min) ? zero : a32) + comma + ((a42 < min && a42 > -min) ? zero : a42) + comma + ((a13 < min && a13 > -min) ? zero : a13); + transform += comma + ((a23 < min && a23 > -min) ? zero : a23) + comma + ((a33 < min && a33 > -min) ? zero : a33) + comma + ((a43 < min && a43 > -min) ? zero : a43) + comma; + transform += a14 + comma + a24 + comma + a34 + comma + (tm.perspective ? (1 + (-a34 / tm.perspective)) : 1) + ")"; + console.log(transform); + document.querySelector(".test").style[_transformProp] = transform; + */ + + tm.perspective = a43 ? 1 / ((a43 < 0) ? -a43 : a43) : 0; + tm.x = a14; + tm.y = a24; + tm.z = a34; + if (tm.svg) { + tm.x -= tm.xOrigin - (tm.xOrigin * a11 - tm.yOrigin * a12); + tm.y -= tm.yOrigin - (tm.yOrigin * a21 - tm.xOrigin * a22); + } + + } else if ((!_supports3D || parse || !m.length || tm.x !== m[4] || tm.y !== m[5] || (!tm.rotationX && !tm.rotationY))) { //sometimes a 6-element matrix is returned even when we performed 3D transforms, like if rotationX and rotationY are 180. In cases like this, we still need to honor the 3D transforms. If we just rely on the 2D info, it could affect how the data is interpreted, like scaleY might get set to -1 or rotation could get offset by 180 degrees. For example, do a TweenLite.to(element, 1, {css:{rotationX:180, rotationY:180}}) and then later, TweenLite.to(element, 1, {css:{rotationX:0}}) and without this conditional logic in place, it'd jump to a state of being unrotated when the 2nd tween starts. Then again, we need to honor the fact that the user COULD alter the transforms outside of CSSPlugin, like by manually applying new css, so we try to sense that by looking at x and y because if those changed, we know the changes were made outside CSSPlugin and we force a reinterpretation of the matrix values. Also, in Webkit browsers, if the element's "display" is "none", its calculated style value will always return empty, so if we've already recorded the values in the _gsTransform object, we'll just rely on those. + var k = (m.length >= 6), + a = k ? m[0] : 1, + b = m[1] || 0, + c = m[2] || 0, + d = k ? m[3] : 1; + tm.x = m[4] || 0; + tm.y = m[5] || 0; + scaleX = Math.sqrt(a * a + b * b); + scaleY = Math.sqrt(d * d + c * c); + rotation = (a || b) ? Math.atan2(b, a) * _RAD2DEG : tm.rotation || 0; //note: if scaleX is 0, we cannot accurately measure rotation. Same for skewX with a scaleY of 0. Therefore, we default to the previously recorded value (or zero if that doesn't exist). + skewX = (c || d) ? Math.atan2(c, d) * _RAD2DEG + rotation : tm.skewX || 0; + tm.scaleX = scaleX; + tm.scaleY = scaleY; + tm.rotation = rotation; + tm.skewX = skewX; + if (_supports3D) { + tm.rotationX = tm.rotationY = tm.z = 0; + tm.perspective = defaultTransformPerspective; + tm.scaleZ = 1; + } + if (tm.svg) { + tm.x -= tm.xOrigin - (tm.xOrigin * a + tm.yOrigin * c); + tm.y -= tm.yOrigin - (tm.xOrigin * b + tm.yOrigin * d); + } + } + if (Math.abs(tm.skewX) > 90 && Math.abs(tm.skewX) < 270) { + if (invX) { + tm.scaleX *= -1; + tm.skewX += (tm.rotation <= 0) ? 180 : -180; + tm.rotation += (tm.rotation <= 0) ? 180 : -180; + } else { + tm.scaleY *= -1; + tm.skewX += (tm.skewX <= 0) ? 180 : -180; + } + } + tm.zOrigin = zOrigin; + //some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 0 in these cases. The conditional logic here is faster than calling Math.abs(). Also, browsers tend to render a SLIGHTLY rotated object in a fuzzy way, so we need to snap to exactly 0 when appropriate. + for (i in tm) { + if (tm[i] < min) if (tm[i] > -min) { + tm[i] = 0; + } + } + } + //DEBUG: _log("parsed rotation of " + t.getAttribute("id")+": "+(tm.rotationX)+", "+(tm.rotationY)+", "+(tm.rotation)+", scale: "+tm.scaleX+", "+tm.scaleY+", "+tm.scaleZ+", position: "+tm.x+", "+tm.y+", "+tm.z+", perspective: "+tm.perspective+ ", origin: "+ tm.xOrigin+ ","+ tm.yOrigin); + if (rec) { + t._gsTransform = tm; //record to the object's _gsTransform which we use so that tweens can control individual properties independently (we need all the properties to accurately recompose the matrix in the setRatio() method) + if (tm.svg) { //if we're supposed to apply transforms to the SVG element's "transform" attribute, make sure there aren't any CSS transforms applied or they'll override the attribute ones. Also clear the transform attribute if we're using CSS, just to be clean. + if (_useSVGTransformAttr && t.style[_transformProp]) { + TweenLite.delayedCall(0.001, function(){ //if we apply this right away (before anything has rendered), we risk there being no transforms for a brief moment and it also interferes with adjusting the transformOrigin in a tween with immediateRender:true (it'd try reading the matrix and it wouldn't have the appropriate data in place because we just removed it). + _removeProp(t.style, _transformProp); + }); + } else if (!_useSVGTransformAttr && t.getAttribute("transform")) { + TweenLite.delayedCall(0.001, function(){ + t.removeAttribute("transform"); + }); + } + } + } + return tm; + }, + + //for setting 2D transforms in IE6, IE7, and IE8 (must use a "filter" to emulate the behavior of modern day browser transforms) + _setIETransformRatio = function(v) { + var t = this.data, //refers to the element's _gsTransform object + ang = -t.rotation * _DEG2RAD, + skew = ang + t.skewX * _DEG2RAD, + rnd = 100000, + a = ((Math.cos(ang) * t.scaleX * rnd) | 0) / rnd, + b = ((Math.sin(ang) * t.scaleX * rnd) | 0) / rnd, + c = ((Math.sin(skew) * -t.scaleY * rnd) | 0) / rnd, + d = ((Math.cos(skew) * t.scaleY * rnd) | 0) / rnd, + style = this.t.style, + cs = this.t.currentStyle, + filters, val; + if (!cs) { + return; + } + val = b; //just for swapping the variables an inverting them (reused "val" to avoid creating another variable in memory). IE's filter matrix uses a non-standard matrix configuration (angle goes the opposite way, and b and c are reversed and inverted) + b = -c; + c = -val; + filters = cs.filter; + style.filter = ""; //remove filters so that we can accurately measure offsetWidth/offsetHeight + var w = this.t.offsetWidth, + h = this.t.offsetHeight, + clip = (cs.position !== "absolute"), + m = "progid:DXImageTransform.Microsoft.Matrix(M11=" + a + ", M12=" + b + ", M21=" + c + ", M22=" + d, + ox = t.x + (w * t.xPercent / 100), + oy = t.y + (h * t.yPercent / 100), + dx, dy; + + //if transformOrigin is being used, adjust the offset x and y + if (t.ox != null) { + dx = ((t.oxp) ? w * t.ox * 0.01 : t.ox) - w / 2; + dy = ((t.oyp) ? h * t.oy * 0.01 : t.oy) - h / 2; + ox += dx - (dx * a + dy * b); + oy += dy - (dx * c + dy * d); + } + + if (!clip) { + m += ", sizingMethod='auto expand')"; + } else { + dx = (w / 2); + dy = (h / 2); + //translate to ensure that transformations occur around the correct origin (default is center). + m += ", Dx=" + (dx - (dx * a + dy * b) + ox) + ", Dy=" + (dy - (dx * c + dy * d) + oy) + ")"; + } + if (filters.indexOf("DXImageTransform.Microsoft.Matrix(") !== -1) { + style.filter = filters.replace(_ieSetMatrixExp, m); + } else { + style.filter = m + " " + filters; //we must always put the transform/matrix FIRST (before alpha(opacity=xx)) to avoid an IE bug that slices part of the object when rotation is applied with alpha. + } + + //at the end or beginning of the tween, if the matrix is normal (1, 0, 0, 1) and opacity is 100 (or doesn't exist), remove the filter to improve browser performance. + if (v === 0 || v === 1) if (a === 1) if (b === 0) if (c === 0) if (d === 1) if (!clip || m.indexOf("Dx=0, Dy=0") !== -1) if (!_opacityExp.test(filters) || parseFloat(RegExp.$1) === 100) if (filters.indexOf("gradient(" && filters.indexOf("Alpha")) === -1) { + style.removeAttribute("filter"); + } + + //we must set the margins AFTER applying the filter in order to avoid some bugs in IE8 that could (in rare scenarios) cause them to be ignored intermittently (vibration). + if (!clip) { + var mult = (_ieVers < 8) ? 1 : -1, //in Internet Explorer 7 and before, the box model is broken, causing the browser to treat the width/height of the actual rotated filtered image as the width/height of the box itself, but Microsoft corrected that in IE8. We must use a negative offset in IE8 on the right/bottom + marg, prop, dif; + dx = t.ieOffsetX || 0; + dy = t.ieOffsetY || 0; + t.ieOffsetX = Math.round((w - ((a < 0 ? -a : a) * w + (b < 0 ? -b : b) * h)) / 2 + ox); + t.ieOffsetY = Math.round((h - ((d < 0 ? -d : d) * h + (c < 0 ? -c : c) * w)) / 2 + oy); + for (i = 0; i < 4; i++) { + prop = _margins[i]; + marg = cs[prop]; + //we need to get the current margin in case it is being tweened separately (we want to respect that tween's changes) + val = (marg.indexOf("px") !== -1) ? parseFloat(marg) : _convertToPixels(this.t, prop, parseFloat(marg), marg.replace(_suffixExp, "")) || 0; + if (val !== t[prop]) { + dif = (i < 2) ? -t.ieOffsetX : -t.ieOffsetY; //if another tween is controlling a margin, we cannot only apply the difference in the ieOffsets, so we essentially zero-out the dx and dy here in that case. We record the margin(s) later so that we can keep comparing them, making this code very flexible. + } else { + dif = (i < 2) ? dx - t.ieOffsetX : dy - t.ieOffsetY; + } + style[prop] = (t[prop] = Math.round( val - dif * ((i === 0 || i === 2) ? 1 : mult) )) + "px"; + } + } + }, + + /* translates a super small decimal to a string WITHOUT scientific notation + _safeDecimal = function(n) { + var s = (n < 0 ? -n : n) + "", + a = s.split("e-"); + return (n < 0 ? "-0." : "0.") + new Array(parseInt(a[1], 10) || 0).join("0") + a[0].split(".").join(""); + }, + */ + + _setTransformRatio = _internals.set3DTransformRatio = _internals.setTransformRatio = function(v) { + var t = this.data, //refers to the element's _gsTransform object + style = this.t.style, + angle = t.rotation, + rotationX = t.rotationX, + rotationY = t.rotationY, + sx = t.scaleX, + sy = t.scaleY, + sz = t.scaleZ, + x = t.x, + y = t.y, + z = t.z, + isSVG = t.svg, + perspective = t.perspective, + force3D = t.force3D, + skewY = t.skewY, + skewX = t.skewX, + t1, a11, a12, a13, a21, a22, a23, a31, a32, a33, a41, a42, a43, + zOrigin, min, cos, sin, t2, transform, comma, zero, skew, rnd; + if (skewY) { //for performance reasons, we combine all skewing into the skewX and rotation values. Remember, a skewY of 10 degrees looks the same as a rotation of 10 degrees plus a skewX of 10 degrees. + skewX += skewY; + angle += skewY; + } + + //check to see if we should render as 2D (and SVGs must use 2D when _useSVGTransformAttr is true) + if (((((v === 1 || v === 0) && force3D === "auto" && (this.tween._totalTime === this.tween._totalDuration || !this.tween._totalTime)) || !force3D) && !z && !perspective && !rotationY && !rotationX && sz === 1) || (_useSVGTransformAttr && isSVG) || !_supports3D) { //on the final render (which could be 0 for a from tween), if there are no 3D aspects, render in 2D to free up memory and improve performance especially on mobile devices. Check the tween's totalTime/totalDuration too in order to make sure it doesn't happen between repeats if it's a repeating tween. + + //2D + if (angle || skewX || isSVG) { + angle *= _DEG2RAD; + skew = skewX * _DEG2RAD; + rnd = 100000; + a11 = Math.cos(angle) * sx; + a21 = Math.sin(angle) * sx; + a12 = Math.sin(angle - skew) * -sy; + a22 = Math.cos(angle - skew) * sy; + if (skew && t.skewType === "simple") { //by default, we compensate skewing on the other axis to make it look more natural, but you can set the skewType to "simple" to use the uncompensated skewing that CSS does + t1 = Math.tan(skew - skewY * _DEG2RAD); + t1 = Math.sqrt(1 + t1 * t1); + a12 *= t1; + a22 *= t1; + if (skewY) { + t1 = Math.tan(skewY * _DEG2RAD); + t1 = Math.sqrt(1 + t1 * t1); + a11 *= t1; + a21 *= t1; + } + } + if (isSVG) { + x += t.xOrigin - (t.xOrigin * a11 + t.yOrigin * a12) + t.xOffset; + y += t.yOrigin - (t.xOrigin * a21 + t.yOrigin * a22) + t.yOffset; + if (_useSVGTransformAttr && (t.xPercent || t.yPercent)) { //The SVG spec doesn't support percentage-based translation in the "transform" attribute, so we merge it into the matrix to simulate it. + min = this.t.getBBox(); + x += t.xPercent * 0.01 * min.width; + y += t.yPercent * 0.01 * min.height; + } + min = 0.000001; + if (x < min) if (x > -min) { + x = 0; + } + if (y < min) if (y > -min) { + y = 0; + } + } + transform = (((a11 * rnd) | 0) / rnd) + "," + (((a21 * rnd) | 0) / rnd) + "," + (((a12 * rnd) | 0) / rnd) + "," + (((a22 * rnd) | 0) / rnd) + "," + x + "," + y + ")"; + if (isSVG && _useSVGTransformAttr) { + this.t.setAttribute("transform", "matrix(" + transform); + } else { + //some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 5 decimal places. + style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix(" : "matrix(") + transform; + } + } else { + style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix(" : "matrix(") + sx + ",0,0," + sy + "," + x + "," + y + ")"; + } + return; + + } + if (_isFirefox) { //Firefox has a bug (at least in v25) that causes it to render the transparent part of 32-bit PNG images as black when displayed inside an iframe and the 3D scale is very small and doesn't change sufficiently enough between renders (like if you use a Power4.easeInOut to scale from 0 to 1 where the beginning values only change a tiny amount to begin the tween before accelerating). In this case, we force the scale to be 0.00002 instead which is visually the same but works around the Firefox issue. + min = 0.0001; + if (sx < min && sx > -min) { + sx = sz = 0.00002; + } + if (sy < min && sy > -min) { + sy = sz = 0.00002; + } + if (perspective && !t.z && !t.rotationX && !t.rotationY) { //Firefox has a bug that causes elements to have an odd super-thin, broken/dotted black border on elements that have a perspective set but aren't utilizing 3D space (no rotationX, rotationY, or z). + perspective = 0; + } + } + if (angle || skewX) { + angle *= _DEG2RAD; + cos = a11 = Math.cos(angle); + sin = a21 = Math.sin(angle); + if (skewX) { + angle -= skewX * _DEG2RAD; + cos = Math.cos(angle); + sin = Math.sin(angle); + if (t.skewType === "simple") { //by default, we compensate skewing on the other axis to make it look more natural, but you can set the skewType to "simple" to use the uncompensated skewing that CSS does + t1 = Math.tan((skewX - skewY) * _DEG2RAD); + t1 = Math.sqrt(1 + t1 * t1); + cos *= t1; + sin *= t1; + if (t.skewY) { + t1 = Math.tan(skewY * _DEG2RAD); + t1 = Math.sqrt(1 + t1 * t1); + a11 *= t1; + a21 *= t1; + } + } + } + a12 = -sin; + a22 = cos; + + } else if (!rotationY && !rotationX && sz === 1 && !perspective && !isSVG) { //if we're only translating and/or 2D scaling, this is faster... + style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) translate3d(" : "translate3d(") + x + "px," + y + "px," + z +"px)" + ((sx !== 1 || sy !== 1) ? " scale(" + sx + "," + sy + ")" : ""); + return; + } else { + a11 = a22 = 1; + a12 = a21 = 0; + } + // KEY INDEX AFFECTS a[row][column] + // a11 0 rotation, rotationY, scaleX + // a21 1 rotation, rotationY, scaleX + // a31 2 rotationY, scaleX + // a41 3 rotationY, scaleX + // a12 4 rotation, skewX, rotationX, scaleY + // a22 5 rotation, skewX, rotationX, scaleY + // a32 6 rotationX, scaleY + // a42 7 rotationX, scaleY + // a13 8 rotationY, rotationX, scaleZ + // a23 9 rotationY, rotationX, scaleZ + // a33 10 rotationY, rotationX, scaleZ + // a43 11 rotationY, rotationX, perspective, scaleZ + // a14 12 x, zOrigin, svgOrigin + // a24 13 y, zOrigin, svgOrigin + // a34 14 z, zOrigin + // a44 15 + // rotation: Math.atan2(a21, a11) + // rotationY: Math.atan2(a13, a33) (or Math.atan2(a13, a11)) + // rotationX: Math.atan2(a32, a33) + a33 = 1; + a13 = a23 = a31 = a32 = a41 = a42 = 0; + a43 = (perspective) ? -1 / perspective : 0; + zOrigin = t.zOrigin; + min = 0.000001; //threshold below which browsers use scientific notation which won't work. + comma = ","; + zero = "0"; + angle = rotationY * _DEG2RAD; + if (angle) { + cos = Math.cos(angle); + sin = Math.sin(angle); + a31 = -sin; + a41 = a43*-sin; + a13 = a11*sin; + a23 = a21*sin; + a33 = cos; + a43 *= cos; + a11 *= cos; + a21 *= cos; + } + angle = rotationX * _DEG2RAD; + if (angle) { + cos = Math.cos(angle); + sin = Math.sin(angle); + t1 = a12*cos+a13*sin; + t2 = a22*cos+a23*sin; + a32 = a33*sin; + a42 = a43*sin; + a13 = a12*-sin+a13*cos; + a23 = a22*-sin+a23*cos; + a33 = a33*cos; + a43 = a43*cos; + a12 = t1; + a22 = t2; + } + if (sz !== 1) { + a13*=sz; + a23*=sz; + a33*=sz; + a43*=sz; + } + if (sy !== 1) { + a12*=sy; + a22*=sy; + a32*=sy; + a42*=sy; + } + if (sx !== 1) { + a11*=sx; + a21*=sx; + a31*=sx; + a41*=sx; + } + + if (zOrigin || isSVG) { + if (zOrigin) { + x += a13*-zOrigin; + y += a23*-zOrigin; + z += a33*-zOrigin+zOrigin; + } + if (isSVG) { //due to bugs in some browsers, we need to manage the transform-origin of SVG manually + x += t.xOrigin - (t.xOrigin * a11 + t.yOrigin * a12) + t.xOffset; + y += t.yOrigin - (t.xOrigin * a21 + t.yOrigin * a22) + t.yOffset; + } + if (x < min && x > -min) { + x = zero; + } + if (y < min && y > -min) { + y = zero; + } + if (z < min && z > -min) { + z = 0; //don't use string because we calculate perspective later and need the number. + } + } + + //optimized way of concatenating all the values into a string. If we do it all in one shot, it's slower because of the way browsers have to create temp strings and the way it affects memory. If we do it piece-by-piece with +=, it's a bit slower too. We found that doing it in these sized chunks works best overall: + transform = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix3d(" : "matrix3d("); + transform += ((a11 < min && a11 > -min) ? zero : a11) + comma + ((a21 < min && a21 > -min) ? zero : a21) + comma + ((a31 < min && a31 > -min) ? zero : a31); + transform += comma + ((a41 < min && a41 > -min) ? zero : a41) + comma + ((a12 < min && a12 > -min) ? zero : a12) + comma + ((a22 < min && a22 > -min) ? zero : a22); + if (rotationX || rotationY || sz !== 1) { //performance optimization (often there's no rotationX or rotationY, so we can skip these calculations) + transform += comma + ((a32 < min && a32 > -min) ? zero : a32) + comma + ((a42 < min && a42 > -min) ? zero : a42) + comma + ((a13 < min && a13 > -min) ? zero : a13); + transform += comma + ((a23 < min && a23 > -min) ? zero : a23) + comma + ((a33 < min && a33 > -min) ? zero : a33) + comma + ((a43 < min && a43 > -min) ? zero : a43) + comma; + } else { + transform += ",0,0,0,0,1,0,"; + } + transform += x + comma + y + comma + z + comma + (perspective ? (1 + (-z / perspective)) : 1) + ")"; + + style[_transformProp] = transform; + }; + + p = Transform.prototype; + p.x = p.y = p.z = p.skewX = p.skewY = p.rotation = p.rotationX = p.rotationY = p.zOrigin = p.xPercent = p.yPercent = p.xOffset = p.yOffset = 0; + p.scaleX = p.scaleY = p.scaleZ = 1; + + _registerComplexSpecialProp("transform,scale,scaleX,scaleY,scaleZ,x,y,z,rotation,rotationX,rotationY,rotationZ,skewX,skewY,shortRotation,shortRotationX,shortRotationY,shortRotationZ,transformOrigin,svgOrigin,transformPerspective,directionalRotation,parseTransform,force3D,skewType,xPercent,yPercent,smoothOrigin", {parser:function(t, e, parsingProp, cssp, pt, plugin, vars) { + if (cssp._lastParsedTransform === vars) { return pt; } //only need to parse the transform once, and only if the browser supports it. + cssp._lastParsedTransform = vars; + var scaleFunc = (vars.scale && typeof(vars.scale) === "function") ? vars.scale : 0; //if there's a function-based "scale" value, swap in the resulting numeric value temporarily. Otherwise, if it's called for both scaleX and scaleY independently, they may not match (like if the function uses Math.random()). + if (scaleFunc) { + vars.scale = scaleFunc(_index, t); + } + var originalGSTransform = t._gsTransform, + style = t.style, + min = 0.000001, + i = _transformProps.length, + v = vars, + endRotations = {}, + transformOriginString = "transformOrigin", + m1 = _getTransform(t, _cs, true, v.parseTransform), + orig = v.transform && ((typeof(v.transform) === "function") ? v.transform(_index, _target) : v.transform), + m2, copy, has3D, hasChange, dr, x, y, matrix, p; + m1.skewType = v.skewType || m1.skewType || CSSPlugin.defaultSkewType; + cssp._transform = m1; + if ("rotationZ" in v) { + v.rotation = v.rotationZ; + } + if (orig && typeof(orig) === "string" && _transformProp) { //for values like transform:"rotate(60deg) scale(0.5, 0.8)" + copy = _tempDiv.style; //don't use the original target because it might be SVG in which case some browsers don't report computed style correctly. + copy[_transformProp] = orig; + copy.display = "block"; //if display is "none", the browser often refuses to report the transform properties correctly. + copy.position = "absolute"; + if (orig.indexOf("%") !== -1) { //%-based translations will fail unless we set the width/height to match the original target... + copy.width = _getStyle(t, "width"); + copy.height = _getStyle(t, "height"); + } + _doc.body.appendChild(_tempDiv); + m2 = _getTransform(_tempDiv, null, false); + if (m1.skewType === "simple") { //the default _getTransform() reports the skewX/scaleY as if skewType is "compensated", thus we need to adjust that here if skewType is "simple". + m2.scaleY *= Math.cos(m2.skewX * _DEG2RAD); + } + if (m1.svg) { //if it's an SVG element, x/y part of the matrix will be affected by whatever we use as the origin and the offsets, so compensate here... + x = m1.xOrigin; + y = m1.yOrigin; + m2.x -= m1.xOffset; + m2.y -= m1.yOffset; + if (v.transformOrigin || v.svgOrigin) { //if this tween is altering the origin, we must factor that in here. The actual work of recording the transformOrigin values and setting up the PropTween is done later (still inside this function) so we cannot leave the changes intact here - we only want to update the x/y accordingly. + orig = {}; + _parseSVGOrigin(t, _parsePosition(v.transformOrigin), orig, v.svgOrigin, v.smoothOrigin, true); + x = orig.xOrigin; + y = orig.yOrigin; + m2.x -= orig.xOffset - m1.xOffset; + m2.y -= orig.yOffset - m1.yOffset; + } + if (x || y) { + matrix = _getMatrix(_tempDiv, true); + m2.x -= x - (x * matrix[0] + y * matrix[2]); + m2.y -= y - (x * matrix[1] + y * matrix[3]); + } + } + _doc.body.removeChild(_tempDiv); + if (!m2.perspective) { + m2.perspective = m1.perspective; //tweening to no perspective gives very unintuitive results - just keep the same perspective in that case. + } + if (v.xPercent != null) { + m2.xPercent = _parseVal(v.xPercent, m1.xPercent); + } + if (v.yPercent != null) { + m2.yPercent = _parseVal(v.yPercent, m1.yPercent); + } + } else if (typeof(v) === "object") { //for values like scaleX, scaleY, rotation, x, y, skewX, and skewY or transform:{...} (object) + m2 = {scaleX:_parseVal((v.scaleX != null) ? v.scaleX : v.scale, m1.scaleX), + scaleY:_parseVal((v.scaleY != null) ? v.scaleY : v.scale, m1.scaleY), + scaleZ:_parseVal(v.scaleZ, m1.scaleZ), + x:_parseVal(v.x, m1.x), + y:_parseVal(v.y, m1.y), + z:_parseVal(v.z, m1.z), + xPercent:_parseVal(v.xPercent, m1.xPercent), + yPercent:_parseVal(v.yPercent, m1.yPercent), + perspective:_parseVal(v.transformPerspective, m1.perspective)}; + dr = v.directionalRotation; + if (dr != null) { + if (typeof(dr) === "object") { + for (copy in dr) { + v[copy] = dr[copy]; + } + } else { + v.rotation = dr; + } + } + if (typeof(v.x) === "string" && v.x.indexOf("%") !== -1) { + m2.x = 0; + m2.xPercent = _parseVal(v.x, m1.xPercent); + } + if (typeof(v.y) === "string" && v.y.indexOf("%") !== -1) { + m2.y = 0; + m2.yPercent = _parseVal(v.y, m1.yPercent); + } + + m2.rotation = _parseAngle(("rotation" in v) ? v.rotation : ("shortRotation" in v) ? v.shortRotation + "_short" : m1.rotation, m1.rotation, "rotation", endRotations); + if (_supports3D) { + m2.rotationX = _parseAngle(("rotationX" in v) ? v.rotationX : ("shortRotationX" in v) ? v.shortRotationX + "_short" : m1.rotationX || 0, m1.rotationX, "rotationX", endRotations); + m2.rotationY = _parseAngle(("rotationY" in v) ? v.rotationY : ("shortRotationY" in v) ? v.shortRotationY + "_short" : m1.rotationY || 0, m1.rotationY, "rotationY", endRotations); + } + m2.skewX = _parseAngle(v.skewX, m1.skewX); + m2.skewY = _parseAngle(v.skewY, m1.skewY); + } + if (_supports3D && v.force3D != null) { + m1.force3D = v.force3D; + hasChange = true; + } + + has3D = (m1.force3D || m1.z || m1.rotationX || m1.rotationY || m2.z || m2.rotationX || m2.rotationY || m2.perspective); + if (!has3D && v.scale != null) { + m2.scaleZ = 1; //no need to tween scaleZ. + } + + while (--i > -1) { + p = _transformProps[i]; + orig = m2[p] - m1[p]; + if (orig > min || orig < -min || v[p] != null || _forcePT[p] != null) { + hasChange = true; + pt = new CSSPropTween(m1, p, m1[p], orig, pt); + if (p in endRotations) { + pt.e = endRotations[p]; //directional rotations typically have compensated values during the tween, but we need to make sure they end at exactly what the user requested + } + pt.xs0 = 0; //ensures the value stays numeric in setRatio() + pt.plugin = plugin; + cssp._overwriteProps.push(pt.n); + } + } + + orig = (typeof(v.transformOrigin) === "function") ? v.transformOrigin(_index, _target) : v.transformOrigin; + if (m1.svg && (orig || v.svgOrigin)) { + x = m1.xOffset; //when we change the origin, in order to prevent things from jumping we adjust the x/y so we must record those here so that we can create PropTweens for them and flip them at the same time as the origin + y = m1.yOffset; + _parseSVGOrigin(t, _parsePosition(orig), m2, v.svgOrigin, v.smoothOrigin); + pt = _addNonTweeningNumericPT(m1, "xOrigin", (originalGSTransform ? m1 : m2).xOrigin, m2.xOrigin, pt, transformOriginString); //note: if there wasn't a transformOrigin defined yet, just start with the destination one; it's wasteful otherwise, and it causes problems with fromTo() tweens. For example, TweenLite.to("#wheel", 3, {rotation:180, transformOrigin:"50% 50%", delay:1}); TweenLite.fromTo("#wheel", 3, {scale:0.5, transformOrigin:"50% 50%"}, {scale:1, delay:2}); would cause a jump when the from values revert at the beginning of the 2nd tween. + pt = _addNonTweeningNumericPT(m1, "yOrigin", (originalGSTransform ? m1 : m2).yOrigin, m2.yOrigin, pt, transformOriginString); + if (x !== m1.xOffset || y !== m1.yOffset) { + pt = _addNonTweeningNumericPT(m1, "xOffset", (originalGSTransform ? x : m1.xOffset), m1.xOffset, pt, transformOriginString); + pt = _addNonTweeningNumericPT(m1, "yOffset", (originalGSTransform ? y : m1.yOffset), m1.yOffset, pt, transformOriginString); + } + orig = "0px 0px"; //certain browsers (like firefox) completely botch transform-origin, so we must remove it to prevent it from contaminating transforms. We manage it ourselves with xOrigin and yOrigin + } + if (orig || (_supports3D && has3D && m1.zOrigin)) { //if anything 3D is happening and there's a transformOrigin with a z component that's non-zero, we must ensure that the transformOrigin's z-component is set to 0 so that we can manually do those calculations to get around Safari bugs. Even if the user didn't specifically define a "transformOrigin" in this particular tween (maybe they did it via css directly). + if (_transformProp) { + hasChange = true; + p = _transformOriginProp; + if (!orig) { + orig = (_getStyle(t, p, _cs, false, "50% 50%") + "").split(" "); + orig = orig[0] + " " + orig[1] + " " + m1.zOrigin + "px"; + } + orig += ""; + pt = new CSSPropTween(style, p, 0, 0, pt, -1, transformOriginString); + pt.b = style[p]; + pt.plugin = plugin; + if (_supports3D) { + copy = m1.zOrigin; + orig = orig.split(" "); + m1.zOrigin = ((orig.length > 2) ? parseFloat(orig[2]) : copy) || 0; //Safari doesn't handle the z part of transformOrigin correctly, so we'll manually handle it in the _set3DTransformRatio() method. + pt.xs0 = pt.e = orig[0] + " " + (orig[1] || "50%") + " 0px"; //we must define a z value of 0px specifically otherwise iOS 5 Safari will stick with the old one (if one was defined)! + pt = new CSSPropTween(m1, "zOrigin", 0, 0, pt, -1, pt.n); //we must create a CSSPropTween for the _gsTransform.zOrigin so that it gets reset properly at the beginning if the tween runs backward (as opposed to just setting m1.zOrigin here) + pt.b = copy; + pt.xs0 = pt.e = m1.zOrigin; + } else { + pt.xs0 = pt.e = orig; + } + + //for older versions of IE (6-8), we need to manually calculate things inside the setRatio() function. We record origin x and y (ox and oy) and whether or not the values are percentages (oxp and oyp). + } else { + _parsePosition(orig + "", m1); + } + } + if (hasChange) { + cssp._transformType = (!(m1.svg && _useSVGTransformAttr) && (has3D || this._transformType === 3)) ? 3 : 2; //quicker than calling cssp._enableTransforms(); + } + if (scaleFunc) { + vars.scale = scaleFunc; + } + return pt; + }, allowFunc:true, prefix:true}); + + _registerComplexSpecialProp("boxShadow", {defaultValue:"0px 0px 0px 0px #999", prefix:true, color:true, multi:true, keyword:"inset"}); + _registerComplexSpecialProp("clipPath", {defaultValue:"inset(0px)", prefix:true, multi:true, formatter:_getFormatter("inset(0px 0px 0px 0px)", false, true)}); + + _registerComplexSpecialProp("borderRadius", {defaultValue:"0px", parser:function(t, e, p, cssp, pt, plugin) { + e = this.format(e); + var props = ["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"], + style = t.style, + ea1, i, es2, bs2, bs, es, bn, en, w, h, esfx, bsfx, rel, hn, vn, em; + w = parseFloat(t.offsetWidth); + h = parseFloat(t.offsetHeight); + ea1 = e.split(" "); + for (i = 0; i < props.length; i++) { //if we're dealing with percentages, we must convert things separately for the horizontal and vertical axis! + if (this.p.indexOf("border")) { //older browsers used a prefix + props[i] = _checkPropPrefix(props[i]); + } + bs = bs2 = _getStyle(t, props[i], _cs, false, "0px"); + if (bs.indexOf(" ") !== -1) { + bs2 = bs.split(" "); + bs = bs2[0]; + bs2 = bs2[1]; + } + es = es2 = ea1[i]; + bn = parseFloat(bs); + bsfx = bs.substr((bn + "").length); + rel = (es.charAt(1) === "="); + if (rel) { + en = parseInt(es.charAt(0)+"1", 10); + es = es.substr(2); + en *= parseFloat(es); + esfx = es.substr((en + "").length - (en < 0 ? 1 : 0)) || ""; + } else { + en = parseFloat(es); + esfx = es.substr((en + "").length); + } + if (esfx === "") { + esfx = _suffixMap[p] || bsfx; + } + if (esfx !== bsfx) { + hn = _convertToPixels(t, "borderLeft", bn, bsfx); //horizontal number (we use a bogus "borderLeft" property just because the _convertToPixels() method searches for the keywords "Left", "Right", "Top", and "Bottom" to determine of it's a horizontal or vertical property, and we need "border" in the name so that it knows it should measure relative to the element itself, not its parent. + vn = _convertToPixels(t, "borderTop", bn, bsfx); //vertical number + if (esfx === "%") { + bs = (hn / w * 100) + "%"; + bs2 = (vn / h * 100) + "%"; + } else if (esfx === "em") { + em = _convertToPixels(t, "borderLeft", 1, "em"); + bs = (hn / em) + "em"; + bs2 = (vn / em) + "em"; + } else { + bs = hn + "px"; + bs2 = vn + "px"; + } + if (rel) { + es = (parseFloat(bs) + en) + esfx; + es2 = (parseFloat(bs2) + en) + esfx; + } + } + pt = _parseComplex(style, props[i], bs + " " + bs2, es + " " + es2, false, "0px", pt); + } + return pt; + }, prefix:true, formatter:_getFormatter("0px 0px 0px 0px", false, true)}); + _registerComplexSpecialProp("borderBottomLeftRadius,borderBottomRightRadius,borderTopLeftRadius,borderTopRightRadius", {defaultValue:"0px", parser:function(t, e, p, cssp, pt, plugin) { + return _parseComplex(t.style, p, this.format(_getStyle(t, p, _cs, false, "0px 0px")), this.format(e), false, "0px", pt); + }, prefix:true, formatter:_getFormatter("0px 0px", false, true)}); + _registerComplexSpecialProp("backgroundPosition", {defaultValue:"0 0", parser:function(t, e, p, cssp, pt, plugin) { + var bp = "background-position", + cs = (_cs || _getComputedStyle(t, null)), + bs = this.format( ((cs) ? _ieVers ? cs.getPropertyValue(bp + "-x") + " " + cs.getPropertyValue(bp + "-y") : cs.getPropertyValue(bp) : t.currentStyle.backgroundPositionX + " " + t.currentStyle.backgroundPositionY) || "0 0"), //Internet Explorer doesn't report background-position correctly - we must query background-position-x and background-position-y and combine them (even in IE10). Before IE9, we must do the same with the currentStyle object and use camelCase + es = this.format(e), + ba, ea, i, pct, overlap, src; + if ((bs.indexOf("%") !== -1) !== (es.indexOf("%") !== -1) && es.split(",").length < 2) { + src = _getStyle(t, "backgroundImage").replace(_urlExp, ""); + if (src && src !== "none") { + ba = bs.split(" "); + ea = es.split(" "); + _tempImg.setAttribute("src", src); //set the temp IMG's src to the background-image so that we can measure its width/height + i = 2; + while (--i > -1) { + bs = ba[i]; + pct = (bs.indexOf("%") !== -1); + if (pct !== (ea[i].indexOf("%") !== -1)) { + overlap = (i === 0) ? t.offsetWidth - _tempImg.width : t.offsetHeight - _tempImg.height; + ba[i] = pct ? (parseFloat(bs) / 100 * overlap) + "px" : (parseFloat(bs) / overlap * 100) + "%"; + } + } + bs = ba.join(" "); + } + } + return this.parseComplex(t.style, bs, es, pt, plugin); + }, formatter:_parsePosition}); + _registerComplexSpecialProp("backgroundSize", {defaultValue:"0 0", formatter:function(v) { + v += ""; //ensure it's a string + return (v.substr(0,2) === "co") ? v : _parsePosition(v.indexOf(" ") === -1 ? v + " " + v : v); //if set to something like "100% 100%", Safari typically reports the computed style as just "100%" (no 2nd value), but we should ensure that there are two values, so copy the first one. Otherwise, it'd be interpreted as "100% 0" (wrong). Also remember that it could be "cover" or "contain" which we can't tween but should be able to set. + }}); + _registerComplexSpecialProp("perspective", {defaultValue:"0px", prefix:true}); + _registerComplexSpecialProp("perspectiveOrigin", {defaultValue:"50% 50%", prefix:true}); + _registerComplexSpecialProp("transformStyle", {prefix:true}); + _registerComplexSpecialProp("backfaceVisibility", {prefix:true}); + _registerComplexSpecialProp("userSelect", {prefix:true}); + _registerComplexSpecialProp("margin", {parser:_getEdgeParser("marginTop,marginRight,marginBottom,marginLeft")}); + _registerComplexSpecialProp("padding", {parser:_getEdgeParser("paddingTop,paddingRight,paddingBottom,paddingLeft")}); + _registerComplexSpecialProp("clip", {defaultValue:"rect(0px,0px,0px,0px)", parser:function(t, e, p, cssp, pt, plugin){ + var b, cs, delim; + if (_ieVers < 9) { //IE8 and earlier don't report a "clip" value in the currentStyle - instead, the values are split apart into clipTop, clipRight, clipBottom, and clipLeft. Also, in IE7 and earlier, the values inside rect() are space-delimited, not comma-delimited. + cs = t.currentStyle; + delim = _ieVers < 8 ? " " : ","; + b = "rect(" + cs.clipTop + delim + cs.clipRight + delim + cs.clipBottom + delim + cs.clipLeft + ")"; + e = this.format(e).split(",").join(delim); + } else { + b = this.format(_getStyle(t, this.p, _cs, false, this.dflt)); + e = this.format(e); + } + return this.parseComplex(t.style, b, e, pt, plugin); + }}); + _registerComplexSpecialProp("textShadow", {defaultValue:"0px 0px 0px #999", color:true, multi:true}); + _registerComplexSpecialProp("autoRound,strictUnits", {parser:function(t, e, p, cssp, pt) {return pt;}}); //just so that we can ignore these properties (not tween them) + _registerComplexSpecialProp("border", {defaultValue:"0px solid #000", parser:function(t, e, p, cssp, pt, plugin) { + var bw = _getStyle(t, "borderTopWidth", _cs, false, "0px"), + end = this.format(e).split(" "), + esfx = end[0].replace(_suffixExp, ""); + if (esfx !== "px") { //if we're animating to a non-px value, we need to convert the beginning width to that unit. + bw = (parseFloat(bw) / _convertToPixels(t, "borderTopWidth", 1, esfx)) + esfx; + } + return this.parseComplex(t.style, this.format(bw + " " + _getStyle(t, "borderTopStyle", _cs, false, "solid") + " " + _getStyle(t, "borderTopColor", _cs, false, "#000")), end.join(" "), pt, plugin); + }, color:true, formatter:function(v) { + var a = v.split(" "); + return a[0] + " " + (a[1] || "solid") + " " + (v.match(_colorExp) || ["#000"])[0]; + }}); + _registerComplexSpecialProp("borderWidth", {parser:_getEdgeParser("borderTopWidth,borderRightWidth,borderBottomWidth,borderLeftWidth")}); //Firefox doesn't pick up on borderWidth set in style sheets (only inline). + _registerComplexSpecialProp("float,cssFloat,styleFloat", {parser:function(t, e, p, cssp, pt, plugin) { + var s = t.style, + prop = ("cssFloat" in s) ? "cssFloat" : "styleFloat"; + return new CSSPropTween(s, prop, 0, 0, pt, -1, p, false, 0, s[prop], e); + }}); + + //opacity-related + var _setIEOpacityRatio = function(v) { + var t = this.t, //refers to the element's style property + filters = t.filter || _getStyle(this.data, "filter") || "", + val = (this.s + this.c * v) | 0, + skip; + if (val === 100) { //for older versions of IE that need to use a filter to apply opacity, we should remove the filter if opacity hits 1 in order to improve performance, but make sure there isn't a transform (matrix) or gradient in the filters. + if (filters.indexOf("atrix(") === -1 && filters.indexOf("radient(") === -1 && filters.indexOf("oader(") === -1) { + t.removeAttribute("filter"); + skip = (!_getStyle(this.data, "filter")); //if a class is applied that has an alpha filter, it will take effect (we don't want that), so re-apply our alpha filter in that case. We must first remove it and then check. + } else { + t.filter = filters.replace(_alphaFilterExp, ""); + skip = true; + } + } + if (!skip) { + if (this.xn1) { + t.filter = filters = filters || ("alpha(opacity=" + val + ")"); //works around bug in IE7/8 that prevents changes to "visibility" from being applied properly if the filter is changed to a different alpha on the same frame. + } + if (filters.indexOf("pacity") === -1) { //only used if browser doesn't support the standard opacity style property (IE 7 and 8). We omit the "O" to avoid case-sensitivity issues + if (val !== 0 || !this.xn1) { //bugs in IE7/8 won't render the filter properly if opacity is ADDED on the same frame/render as "visibility" changes (this.xn1 is 1 if this tween is an "autoAlpha" tween) + t.filter = filters + " alpha(opacity=" + val + ")"; //we round the value because otherwise, bugs in IE7/8 can prevent "visibility" changes from being applied properly. + } + } else { + t.filter = filters.replace(_opacityExp, "opacity=" + val); + } + } + }; + _registerComplexSpecialProp("opacity,alpha,autoAlpha", {defaultValue:"1", parser:function(t, e, p, cssp, pt, plugin) { + var b = parseFloat(_getStyle(t, "opacity", _cs, false, "1")), + style = t.style, + isAutoAlpha = (p === "autoAlpha"); + if (typeof(e) === "string" && e.charAt(1) === "=") { + e = ((e.charAt(0) === "-") ? -1 : 1) * parseFloat(e.substr(2)) + b; + } + if (isAutoAlpha && b === 1 && _getStyle(t, "visibility", _cs) === "hidden" && e !== 0) { //if visibility is initially set to "hidden", we should interpret that as intent to make opacity 0 (a convenience) + b = 0; + } + if (_supportsOpacity) { + pt = new CSSPropTween(style, "opacity", b, e - b, pt); + } else { + pt = new CSSPropTween(style, "opacity", b * 100, (e - b) * 100, pt); + pt.xn1 = isAutoAlpha ? 1 : 0; //we need to record whether or not this is an autoAlpha so that in the setRatio(), we know to duplicate the setting of the alpha in order to work around a bug in IE7 and IE8 that prevents changes to "visibility" from taking effect if the filter is changed to a different alpha(opacity) at the same time. Setting it to the SAME value first, then the new value works around the IE7/8 bug. + style.zoom = 1; //helps correct an IE issue. + pt.type = 2; + pt.b = "alpha(opacity=" + pt.s + ")"; + pt.e = "alpha(opacity=" + (pt.s + pt.c) + ")"; + pt.data = t; + pt.plugin = plugin; + pt.setRatio = _setIEOpacityRatio; + } + if (isAutoAlpha) { //we have to create the "visibility" PropTween after the opacity one in the linked list so that they run in the order that works properly in IE8 and earlier + pt = new CSSPropTween(style, "visibility", 0, 0, pt, -1, null, false, 0, ((b !== 0) ? "inherit" : "hidden"), ((e === 0) ? "hidden" : "inherit")); + pt.xs0 = "inherit"; + cssp._overwriteProps.push(pt.n); + cssp._overwriteProps.push(p); + } + return pt; + }}); + + + var _removeProp = function(s, p) { + if (p) { + if (s.removeProperty) { + if (p.substr(0,2) === "ms" || p.substr(0,6) === "webkit") { //Microsoft and some Webkit browsers don't conform to the standard of capitalizing the first prefix character, so we adjust so that when we prefix the caps with a dash, it's correct (otherwise it'd be "ms-transform" instead of "-ms-transform" for IE9, for example) + p = "-" + p; + } + s.removeProperty(p.replace(_capsExp, "-$1").toLowerCase()); + } else { //note: old versions of IE use "removeAttribute()" instead of "removeProperty()" + s.removeAttribute(p); + } + } + }, + _setClassNameRatio = function(v) { + this.t._gsClassPT = this; + if (v === 1 || v === 0) { + this.t.setAttribute("class", (v === 0) ? this.b : this.e); + var mpt = this.data, //first MiniPropTween + s = this.t.style; + while (mpt) { + if (!mpt.v) { + _removeProp(s, mpt.p); + } else { + s[mpt.p] = mpt.v; + } + mpt = mpt._next; + } + if (v === 1 && this.t._gsClassPT === this) { + this.t._gsClassPT = null; + } + } else if (this.t.getAttribute("class") !== this.e) { + this.t.setAttribute("class", this.e); + } + }; + _registerComplexSpecialProp("className", {parser:function(t, e, p, cssp, pt, plugin, vars) { + var b = t.getAttribute("class") || "", //don't use t.className because it doesn't work consistently on SVG elements; getAttribute("class") and setAttribute("class", value") is more reliable. + cssText = t.style.cssText, + difData, bs, cnpt, cnptLookup, mpt; + pt = cssp._classNamePT = new CSSPropTween(t, p, 0, 0, pt, 2); + pt.setRatio = _setClassNameRatio; + pt.pr = -11; + _hasPriority = true; + pt.b = b; + bs = _getAllStyles(t, _cs); + //if there's a className tween already operating on the target, force it to its end so that the necessary inline styles are removed and the class name is applied before we determine the end state (we don't want inline styles interfering that were there just for class-specific values) + cnpt = t._gsClassPT; + if (cnpt) { + cnptLookup = {}; + mpt = cnpt.data; //first MiniPropTween which stores the inline styles - we need to force these so that the inline styles don't contaminate things. Otherwise, there's a small chance that a tween could start and the inline values match the destination values and they never get cleaned. + while (mpt) { + cnptLookup[mpt.p] = 1; + mpt = mpt._next; + } + cnpt.setRatio(1); + } + t._gsClassPT = pt; + pt.e = (e.charAt(1) !== "=") ? e : b.replace(new RegExp("(?:\\s|^)" + e.substr(2) + "(?![\\w-])"), "") + ((e.charAt(0) === "+") ? " " + e.substr(2) : ""); + t.setAttribute("class", pt.e); + difData = _cssDif(t, bs, _getAllStyles(t), vars, cnptLookup); + t.setAttribute("class", b); + pt.data = difData.firstMPT; + t.style.cssText = cssText; //we recorded cssText before we swapped classes and ran _getAllStyles() because in cases when a className tween is overwritten, we remove all the related tweening properties from that class change (otherwise class-specific stuff can't override properties we've directly set on the target's style object due to specificity). + pt = pt.xfirst = cssp.parse(t, difData.difs, pt, plugin); //we record the CSSPropTween as the xfirst so that we can handle overwriting propertly (if "className" gets overwritten, we must kill all the properties associated with the className part of the tween, so we can loop through from xfirst to the pt itself) + return pt; + }}); + + + var _setClearPropsRatio = function(v) { + if (v === 1 || v === 0) if (this.data._totalTime === this.data._totalDuration && this.data.data !== "isFromStart") { //this.data refers to the tween. Only clear at the END of the tween (remember, from() tweens make the ratio go from 1 to 0, so we can't just check that and if the tween is the zero-duration one that's created internally to render the starting values in a from() tween, ignore that because otherwise, for example, from(...{height:100, clearProps:"height", delay:1}) would wipe the height at the beginning of the tween and after 1 second, it'd kick back in). + var s = this.t.style, + transformParse = _specialProps.transform.parse, + a, p, i, clearTransform, transform; + if (this.e === "all") { + s.cssText = ""; + clearTransform = true; + } else { + a = this.e.split(" ").join("").split(","); + i = a.length; + while (--i > -1) { + p = a[i]; + if (_specialProps[p]) { + if (_specialProps[p].parse === transformParse) { + clearTransform = true; + } else { + p = (p === "transformOrigin") ? _transformOriginProp : _specialProps[p].p; //ensures that special properties use the proper browser-specific property name, like "scaleX" might be "-webkit-transform" or "boxShadow" might be "-moz-box-shadow" + } + } + _removeProp(s, p); + } + } + if (clearTransform) { + _removeProp(s, _transformProp); + transform = this.t._gsTransform; + if (transform) { + if (transform.svg) { + this.t.removeAttribute("data-svg-origin"); + this.t.removeAttribute("transform"); + } + delete this.t._gsTransform; + } + } + + } + }; + _registerComplexSpecialProp("clearProps", {parser:function(t, e, p, cssp, pt) { + pt = new CSSPropTween(t, p, 0, 0, pt, 2); + pt.setRatio = _setClearPropsRatio; + pt.e = e; + pt.pr = -10; + pt.data = cssp._tween; + _hasPriority = true; + return pt; + }}); + + p = "bezier,throwProps,physicsProps,physics2D".split(","); + i = p.length; + while (i--) { + _registerPluginProp(p[i]); + } + + + + + + + + + p = CSSPlugin.prototype; + p._firstPT = p._lastParsedTransform = p._transform = null; + + //gets called when the tween renders for the first time. This kicks everything off, recording start/end values, etc. + p._onInitTween = function(target, vars, tween, index) { + if (!target.nodeType) { //css is only for dom elements + return false; + } + this._target = _target = target; + this._tween = tween; + this._vars = vars; + _index = index; + _autoRound = vars.autoRound; + _hasPriority = false; + _suffixMap = vars.suffixMap || CSSPlugin.suffixMap; + _cs = _getComputedStyle(target, ""); + _overwriteProps = this._overwriteProps; + var style = target.style, + v, pt, pt2, first, last, next, zIndex, tpt, threeD; + if (_reqSafariFix) if (style.zIndex === "") { + v = _getStyle(target, "zIndex", _cs); + if (v === "auto" || v === "") { + //corrects a bug in [non-Android] Safari that prevents it from repainting elements in their new positions if they don't have a zIndex set. We also can't just apply this inside _parseTransform() because anything that's moved in any way (like using "left" or "top" instead of transforms like "x" and "y") can be affected, so it is best to ensure that anything that's tweening has a z-index. Setting "WebkitPerspective" to a non-zero value worked too except that on iOS Safari things would flicker randomly. Plus zIndex is less memory-intensive. + this._addLazySet(style, "zIndex", 0); + } + } + + if (typeof(vars) === "string") { + first = style.cssText; + v = _getAllStyles(target, _cs); + style.cssText = first + ";" + vars; + v = _cssDif(target, v, _getAllStyles(target)).difs; + if (!_supportsOpacity && _opacityValExp.test(vars)) { + v.opacity = parseFloat( RegExp.$1 ); + } + vars = v; + style.cssText = first; + } + + if (vars.className) { //className tweens will combine any differences they find in the css with the vars that are passed in, so {className:"myClass", scale:0.5, left:20} would work. + this._firstPT = pt = _specialProps.className.parse(target, vars.className, "className", this, null, null, vars); + } else { + this._firstPT = pt = this.parse(target, vars, null); + } + + if (this._transformType) { + threeD = (this._transformType === 3); + if (!_transformProp) { + style.zoom = 1; //helps correct an IE issue. + } else if (_isSafari) { + _reqSafariFix = true; + //if zIndex isn't set, iOS Safari doesn't repaint things correctly sometimes (seemingly at random). + if (style.zIndex === "") { + zIndex = _getStyle(target, "zIndex", _cs); + if (zIndex === "auto" || zIndex === "") { + this._addLazySet(style, "zIndex", 0); + } + } + //Setting WebkitBackfaceVisibility corrects 3 bugs: + // 1) [non-Android] Safari skips rendering changes to "top" and "left" that are made on the same frame/render as a transform update. + // 2) iOS Safari sometimes neglects to repaint elements in their new positions. Setting "WebkitPerspective" to a non-zero value worked too except that on iOS Safari things would flicker randomly. + // 3) Safari sometimes displayed odd artifacts when tweening the transform (or WebkitTransform) property, like ghosts of the edges of the element remained. Definitely a browser bug. + //Note: we allow the user to override the auto-setting by defining WebkitBackfaceVisibility in the vars of the tween. + if (_isSafariLT6) { + this._addLazySet(style, "WebkitBackfaceVisibility", this._vars.WebkitBackfaceVisibility || (threeD ? "visible" : "hidden")); + } + } + pt2 = pt; + while (pt2 && pt2._next) { + pt2 = pt2._next; + } + tpt = new CSSPropTween(target, "transform", 0, 0, null, 2); + this._linkCSSP(tpt, null, pt2); + tpt.setRatio = _transformProp ? _setTransformRatio : _setIETransformRatio; + tpt.data = this._transform || _getTransform(target, _cs, true); + tpt.tween = tween; + tpt.pr = -1; //ensures that the transforms get applied after the components are updated. + _overwriteProps.pop(); //we don't want to force the overwrite of all "transform" tweens of the target - we only care about individual transform properties like scaleX, rotation, etc. The CSSPropTween constructor automatically adds the property to _overwriteProps which is why we need to pop() here. + } + + if (_hasPriority) { + //reorders the linked list in order of pr (priority) + while (pt) { + next = pt._next; + pt2 = first; + while (pt2 && pt2.pr > pt.pr) { + pt2 = pt2._next; + } + if ((pt._prev = pt2 ? pt2._prev : last)) { + pt._prev._next = pt; + } else { + first = pt; + } + if ((pt._next = pt2)) { + pt2._prev = pt; + } else { + last = pt; + } + pt = next; + } + this._firstPT = first; + } + return true; + }; + + + p.parse = function(target, vars, pt, plugin) { + var style = target.style, + p, sp, bn, en, bs, es, bsfx, esfx, isStr, rel; + for (p in vars) { + es = vars[p]; //ending value string + sp = _specialProps[p]; //SpecialProp lookup. + if (typeof(es) === "function" && !(sp && sp.allowFunc)) { + es = es(_index, _target); + } + if (sp) { + pt = sp.parse(target, es, p, this, pt, plugin, vars); + } else if (p.substr(0,2) === "--") { //for tweening CSS variables (which always start with "--"). To maximize performance and simplicity, we bypass CSSPlugin altogether and just add a normal property tween to the tween instance itself. + this._tween._propLookup[p] = this._addTween.call(this._tween, target.style, "setProperty", _getComputedStyle(target).getPropertyValue(p) + "", es + "", p, false, p); + continue; + } else { + bs = _getStyle(target, p, _cs) + ""; + isStr = (typeof(es) === "string"); + if (p === "color" || p === "fill" || p === "stroke" || p.indexOf("Color") !== -1 || (isStr && _rgbhslExp.test(es))) { //Opera uses background: to define color sometimes in addition to backgroundColor: + if (!isStr) { + es = _parseColor(es); + es = ((es.length > 3) ? "rgba(" : "rgb(") + es.join(",") + ")"; + } + pt = _parseComplex(style, p, bs, es, true, "transparent", pt, 0, plugin); + + } else if (isStr && _complexExp.test(es)) { + pt = _parseComplex(style, p, bs, es, true, null, pt, 0, plugin); + + } else { + bn = parseFloat(bs); + bsfx = (bn || bn === 0) ? bs.substr((bn + "").length) : ""; //remember, bs could be non-numeric like "normal" for fontWeight, so we should default to a blank suffix in that case. + + if (bs === "" || bs === "auto") { + if (p === "width" || p === "height") { + bn = _getDimension(target, p, _cs); + bsfx = "px"; + } else if (p === "left" || p === "top") { + bn = _calculateOffset(target, p, _cs); + bsfx = "px"; + } else { + bn = (p !== "opacity") ? 0 : 1; + bsfx = ""; + } + } + + rel = (isStr && es.charAt(1) === "="); + if (rel) { + en = parseInt(es.charAt(0) + "1", 10); + es = es.substr(2); + en *= parseFloat(es); + esfx = es.replace(_suffixExp, ""); + } else { + en = parseFloat(es); + esfx = isStr ? es.replace(_suffixExp, "") : ""; + } + + if (esfx === "") { + esfx = (p in _suffixMap) ? _suffixMap[p] : bsfx; //populate the end suffix, prioritizing the map, then if none is found, use the beginning suffix. + } + + es = (en || en === 0) ? (rel ? en + bn : en) + esfx : vars[p]; //ensures that any += or -= prefixes are taken care of. Record the end value before normalizing the suffix because we always want to end the tween on exactly what they intended even if it doesn't match the beginning value's suffix. + //if the beginning/ending suffixes don't match, normalize them... + if (bsfx !== esfx) if (esfx !== "" || p === "lineHeight") if (en || en === 0) if (bn) { //note: if the beginning value (bn) is 0, we don't need to convert units! + bn = _convertToPixels(target, p, bn, bsfx); + if (esfx === "%") { + bn /= _convertToPixels(target, p, 100, "%") / 100; + if (vars.strictUnits !== true) { //some browsers report only "px" values instead of allowing "%" with getComputedStyle(), so we assume that if we're tweening to a %, we should start there too unless strictUnits:true is defined. This approach is particularly useful for responsive designs that use from() tweens. + bs = bn + "%"; + } + + } else if (esfx === "em" || esfx === "rem" || esfx === "vw" || esfx === "vh") { + bn /= _convertToPixels(target, p, 1, esfx); + + //otherwise convert to pixels. + } else if (esfx !== "px") { + en = _convertToPixels(target, p, en, esfx); + esfx = "px"; //we don't use bsfx after this, so we don't need to set it to px too. + } + if (rel) if (en || en === 0) { + es = (en + bn) + esfx; //the changes we made affect relative calculations, so adjust the end value here. + } + } + + if (rel) { + en += bn; + } + + if ((bn || bn === 0) && (en || en === 0)) { //faster than isNaN(). Also, previously we required en !== bn but that doesn't really gain much performance and it prevents _parseToProxy() from working properly if beginning and ending values match but need to get tweened by an external plugin anyway. For example, a bezier tween where the target starts at left:0 and has these points: [{left:50},{left:0}] wouldn't work properly because when parsing the last point, it'd match the first (current) one and a non-tweening CSSPropTween would be recorded when we actually need a normal tween (type:0) so that things get updated during the tween properly. + pt = new CSSPropTween(style, p, bn, en - bn, pt, 0, p, (_autoRound !== false && (esfx === "px" || p === "zIndex")), 0, bs, es); + pt.xs0 = esfx; + //DEBUG: _log("tween "+p+" from "+pt.b+" ("+bn+esfx+") to "+pt.e+" with suffix: "+pt.xs0); + } else if (style[p] === undefined || !es && (es + "" === "NaN" || es == null)) { + _log("invalid " + p + " tween value: " + vars[p]); + } else { + pt = new CSSPropTween(style, p, en || bn || 0, 0, pt, -1, p, false, 0, bs, es); + pt.xs0 = (es === "none" && (p === "display" || p.indexOf("Style") !== -1)) ? bs : es; //intermediate value should typically be set immediately (end value) except for "display" or things like borderTopStyle, borderBottomStyle, etc. which should use the beginning value during the tween. + //DEBUG: _log("non-tweening value "+p+": "+pt.xs0); + } + } + } + if (plugin) if (pt && !pt.plugin) { + pt.plugin = plugin; + } + } + return pt; + }; + + + //gets called every time the tween updates, passing the new ratio (typically a value between 0 and 1, but not always (for example, if an Elastic.easeOut is used, the value can jump above 1 mid-tween). It will always start and 0 and end at 1. + p.setRatio = function(v) { + var pt = this._firstPT, + min = 0.000001, + val, str, i; + //at the end of the tween, we set the values to exactly what we received in order to make sure non-tweening values (like "position" or "float" or whatever) are set and so that if the beginning/ending suffixes (units) didn't match and we normalized to px, the value that the user passed in is used here. We check to see if the tween is at its beginning in case it's a from() tween in which case the ratio will actually go from 1 to 0 over the course of the tween (backwards). + if (v === 1 && (this._tween._time === this._tween._duration || this._tween._time === 0)) { + while (pt) { + if (pt.type !== 2) { + if (pt.r && pt.type !== -1) { + val = pt.r(pt.s + pt.c); + if (!pt.type) { + pt.t[pt.p] = val + pt.xs0; + } else if (pt.type === 1) { //complex value (one that typically has multiple numbers inside a string, like "rect(5px,10px,20px,25px)" + i = pt.l; + str = pt.xs0 + val + pt.xs1; + for (i = 1; i < pt.l; i++) { + str += pt["xn"+i] + pt["xs"+(i+1)]; + } + pt.t[pt.p] = str; + } + } else { + pt.t[pt.p] = pt.e; + } + } else { + pt.setRatio(v); + } + pt = pt._next; + } + + } else if (v || !(this._tween._time === this._tween._duration || this._tween._time === 0) || this._tween._rawPrevTime === -0.000001) { + while (pt) { + val = pt.c * v + pt.s; + if (pt.r) { + val = pt.r(val); + } else if (val < min) if (val > -min) { + val = 0; + } + if (!pt.type) { + pt.t[pt.p] = val + pt.xs0; + } else if (pt.type === 1) { //complex value (one that typically has multiple numbers inside a string, like "rect(5px,10px,20px,25px)" + i = pt.l; + if (i === 2) { + pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2; + } else if (i === 3) { + pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2 + pt.xn2 + pt.xs3; + } else if (i === 4) { + pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2 + pt.xn2 + pt.xs3 + pt.xn3 + pt.xs4; + } else if (i === 5) { + pt.t[pt.p] = pt.xs0 + val + pt.xs1 + pt.xn1 + pt.xs2 + pt.xn2 + pt.xs3 + pt.xn3 + pt.xs4 + pt.xn4 + pt.xs5; + } else { + str = pt.xs0 + val + pt.xs1; + for (i = 1; i < pt.l; i++) { + str += pt["xn"+i] + pt["xs"+(i+1)]; + } + pt.t[pt.p] = str; + } + + } else if (pt.type === -1) { //non-tweening value + pt.t[pt.p] = pt.xs0; + + } else if (pt.setRatio) { //custom setRatio() for things like SpecialProps, external plugins, etc. + pt.setRatio(v); + } + pt = pt._next; + } + + //if the tween is reversed all the way back to the beginning, we need to restore the original values which may have different units (like % instead of px or em or whatever). + } else { + while (pt) { + if (pt.type !== 2) { + pt.t[pt.p] = pt.b; + } else { + pt.setRatio(v); + } + pt = pt._next; + } + } + }; + + /** + * @private + * Forces rendering of the target's transforms (rotation, scale, etc.) whenever the CSSPlugin's setRatio() is called. + * Basically, this tells the CSSPlugin to create a CSSPropTween (type 2) after instantiation that runs last in the linked + * list and calls the appropriate (3D or 2D) rendering function. We separate this into its own method so that we can call + * it from other plugins like BezierPlugin if, for example, it needs to apply an autoRotation and this CSSPlugin + * doesn't have any transform-related properties of its own. You can call this method as many times as you + * want and it won't create duplicate CSSPropTweens. + * + * @param {boolean} threeD if true, it should apply 3D tweens (otherwise, just 2D ones are fine and typically faster) + */ + p._enableTransforms = function(threeD) { + this._transform = this._transform || _getTransform(this._target, _cs, true); //ensures that the element has a _gsTransform property with the appropriate values. + this._transformType = (!(this._transform.svg && _useSVGTransformAttr) && (threeD || this._transformType === 3)) ? 3 : 2; + }; + + var lazySet = function(v) { + this.t[this.p] = this.e; + this.data._linkCSSP(this, this._next, null, true); //we purposefully keep this._next even though it'd make sense to null it, but this is a performance optimization, as this happens during the while (pt) {} loop in setRatio() at the bottom of which it sets pt = pt._next, so if we null it, the linked list will be broken in that loop. + }; + /** @private Gives us a way to set a value on the first render (and only the first render). **/ + p._addLazySet = function(t, p, v) { + var pt = this._firstPT = new CSSPropTween(t, p, 0, 0, this._firstPT, 2); + pt.e = v; + pt.setRatio = lazySet; + pt.data = this; + }; + + /** @private **/ + p._linkCSSP = function(pt, next, prev, remove) { + if (pt) { + if (next) { + next._prev = pt; + } + if (pt._next) { + pt._next._prev = pt._prev; + } + if (pt._prev) { + pt._prev._next = pt._next; + } else if (this._firstPT === pt) { + this._firstPT = pt._next; + remove = true; //just to prevent resetting this._firstPT 5 lines down in case pt._next is null. (optimized for speed) + } + if (prev) { + prev._next = pt; + } else if (!remove && this._firstPT === null) { + this._firstPT = pt; + } + pt._next = next; + pt._prev = prev; + } + return pt; + }; + + p._mod = function(lookup) { + var pt = this._firstPT; + while (pt) { + if (typeof(lookup[pt.p]) === "function") { //only gets called by RoundPropsPlugin (ModifyPlugin manages all the rendering internally for CSSPlugin properties that need modification). Remember, we handle rounding a bit differently in this plugin for performance reasons, leveraging "r" as an indicator that the value should be rounded internally. + pt.r = lookup[pt.p]; + } + pt = pt._next; + } + }; + + //we need to make sure that if alpha or autoAlpha is killed, opacity is too. And autoAlpha affects the "visibility" property. + p._kill = function(lookup) { + var copy = lookup, + pt, p, xfirst; + if (lookup.autoAlpha || lookup.alpha) { + copy = {}; + for (p in lookup) { //copy the lookup so that we're not changing the original which may be passed elsewhere. + copy[p] = lookup[p]; + } + copy.opacity = 1; + if (copy.autoAlpha) { + copy.visibility = 1; + } + } + if (lookup.className && (pt = this._classNamePT)) { //for className tweens, we need to kill any associated CSSPropTweens too; a linked list starts at the className's "xfirst". + xfirst = pt.xfirst; + if (xfirst && xfirst._prev) { + this._linkCSSP(xfirst._prev, pt._next, xfirst._prev._prev); //break off the prev + } else if (xfirst === this._firstPT) { + this._firstPT = pt._next; + } + if (pt._next) { + this._linkCSSP(pt._next, pt._next._next, xfirst._prev); + } + this._classNamePT = null; + } + pt = this._firstPT; + while (pt) { + if (pt.plugin && pt.plugin !== p && pt.plugin._kill) { //for plugins that are registered with CSSPlugin, we should notify them of the kill. + pt.plugin._kill(lookup); + p = pt.plugin; + } + pt = pt._next; + } + return TweenPlugin.prototype._kill.call(this, copy); + }; + + + + //used by cascadeTo() for gathering all the style properties of each child element into an array for comparison. + var _getChildStyles = function(e, props, targets) { + var children, i, child, type; + if (e.slice) { + i = e.length; + while (--i > -1) { + _getChildStyles(e[i], props, targets); + } + return; + } + children = e.childNodes; + i = children.length; + while (--i > -1) { + child = children[i]; + type = child.type; + if (child.style) { + props.push(_getAllStyles(child)); + if (targets) { + targets.push(child); + } + } + if ((type === 1 || type === 9 || type === 11) && child.childNodes.length) { + _getChildStyles(child, props, targets); + } + } + }; + + /** + * Typically only useful for className tweens that may affect child elements, this method creates a TweenLite + * and then compares the style properties of all the target's child elements at the tween's start and end, and + * if any are different, it also creates tweens for those and returns an array containing ALL of the resulting + * tweens (so that you can easily add() them to a TimelineLite, for example). The reason this functionality is + * wrapped into a separate static method of CSSPlugin instead of being integrated into all regular className tweens + * is because it creates entirely new tweens that may have completely different targets than the original tween, + * so if they were all lumped into the original tween instance, it would be inconsistent with the rest of the API + * and it would create other problems. For example: + * - If I create a tween of elementA, that tween instance may suddenly change its target to include 50 other elements (unintuitive if I specifically defined the target I wanted) + * - We can't just create new independent tweens because otherwise, what happens if the original/parent tween is reversed or pause or dropped into a TimelineLite for tight control? You'd expect that tween's behavior to affect all the others. + * - Analyzing every style property of every child before and after the tween is an expensive operation when there are many children, so this behavior shouldn't be imposed on all className tweens by default, especially since it's probably rare that this extra functionality is needed. + * + * @param {Object} target object to be tweened + * @param {number} Duration in seconds (or frames for frames-based tweens) + * @param {Object} Object containing the end values, like {className:"newClass", ease:Linear.easeNone} + * @return {Array} An array of TweenLite instances + */ + CSSPlugin.cascadeTo = function(target, duration, vars) { + var tween = TweenLite.to(target, duration, vars), + results = [tween], + b = [], + e = [], + targets = [], + _reservedProps = TweenLite._internals.reservedProps, + i, difs, p, from; + target = tween._targets || tween.target; + _getChildStyles(target, b, targets); + tween.render(duration, true, true); + _getChildStyles(target, e); + tween.render(0, true, true); + tween._enabled(true); + i = targets.length; + while (--i > -1) { + difs = _cssDif(targets[i], b[i], e[i]); + if (difs.firstMPT) { + difs = difs.difs; + for (p in vars) { + if (_reservedProps[p]) { + difs[p] = vars[p]; + } + } + from = {}; + for (p in difs) { + from[p] = b[i][p]; + } + results.push(TweenLite.fromTo(targets[i], duration, from, difs)); + } + } + return results; + }; + + TweenPlugin.activate([CSSPlugin]); + return CSSPlugin; + + }, true); + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("CSSPlugin")); + +/*! + * VERSION: 0.6.6 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + _gsScope._gsDefine("plugins.CSSRulePlugin", ["plugins.TweenPlugin","TweenLite","plugins.CSSPlugin"], function(TweenPlugin, TweenLite, CSSPlugin) { + + /** @constructor **/ + var CSSRulePlugin = function() { + TweenPlugin.call(this, "cssRule"); + this._overwriteProps.length = 0; + }, + _doc = _gsScope.document, + _superSetRatio = CSSPlugin.prototype.setRatio, + p = CSSRulePlugin.prototype = new CSSPlugin(); + + p._propName = "cssRule"; + p.constructor = CSSRulePlugin; + CSSRulePlugin.version = "0.6.6"; + CSSRulePlugin.API = 2; + + /** + * Searches the style sheets in the document for a particular selector like ".myClass" or "a" or "a:hover" or ":after" and + * returns a reference to that style sheet (or an array of them in the case of a pseudo selector like ":after"). Then you + * can animate the individual properties of the style sheet. + * + * @param {!string} selector a string describing the selector, like ".myClass" or "a" or "a:hover" or ":after" + * @return a reference to the style sheet (or an array of them in the case of a pseudo selector). If none was found, null is returned (or an empty array for a pseudo selector) + */ + CSSRulePlugin.getRule = function(selector) { + var ruleProp = _doc.all ? "rules" : "cssRules", + ss = _doc.styleSheets, + i = ss.length, + pseudo = (selector.charAt(0) === ":"), + j, curSS, cs, a; + selector = (pseudo ? "" : ",") + selector.split("::").join(":").toLowerCase() + ","; //note: old versions of IE report tag name selectors as upper case, so we just change everything to lowercase. + if (pseudo) { + a = []; + } + while (--i > -1) { + //Firefox may throw insecure operation errors when css is loaded from other domains, so try/catch. + try { + curSS = ss[i][ruleProp]; + if (!curSS) { + continue; + } + j = curSS.length; + } catch (e) { + console.log(e); + continue; + } + while (--j > -1) { + cs = curSS[j]; + if (cs.selectorText && ("," + cs.selectorText.split("::").join(":").toLowerCase() + ",").indexOf(selector) !== -1) { //note: IE adds an extra ":" to pseudo selectors, so .myClass:after becomes .myClass::after, so we need to strip the extra one out. + if (pseudo) { + a.push(cs.style); + } else { + return cs.style; + } + } + } + } + return a; + }; + + + // @private gets called when the tween renders for the first time. This kicks everything off, recording start/end values, etc. + p._onInitTween = function(target, value, tween) { + if (target.cssText === undefined) { + return false; + } + var div = target._gsProxy = target._gsProxy || _doc.createElement("div"); + this._ss = target; + this._proxy = div.style; + div.style.cssText = target.cssText; + CSSPlugin.prototype._onInitTween.call(this, div, value, tween); //we just offload all the work to the regular CSSPlugin and then copy the cssText back over to the rule in the setRatio() method. This allows us to have all of the updates to CSSPlugin automatically flow through to CSSRulePlugin instead of having to maintain both + return true; + }; + + + + // @private gets called every time the tween updates, passing the new ratio (typically a value between 0 and 1, but not always (for example, if an Elastic.easeOut is used, the value can jump above 1 mid-tween). It will always start and 0 and end at 1. + p.setRatio = function(v) { + _superSetRatio.call(this, v); + this._ss.cssText = this._proxy.cssText; + }; + + + TweenPlugin.activate([CSSRulePlugin]); + return CSSRulePlugin; + + }, true); + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("CSSRulePlugin")); +/*! + * VERSION: 1.5.3 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + **/ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _numExp = /(\d|\.)+/g, + _relNumExp = /(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g, + _colorLookup = {aqua:[0,255,255], + lime:[0,255,0], + silver:[192,192,192], + black:[0,0,0], + maroon:[128,0,0], + teal:[0,128,128], + blue:[0,0,255], + navy:[0,0,128], + white:[255,255,255], + fuchsia:[255,0,255], + olive:[128,128,0], + yellow:[255,255,0], + orange:[255,165,0], + gray:[128,128,128], + purple:[128,0,128], + green:[0,128,0], + red:[255,0,0], + pink:[255,192,203], + cyan:[0,255,255], + transparent:[255,255,255,0]}, + _hue = function(h, m1, m2) { + h = (h < 0) ? h + 1 : (h > 1) ? h - 1 : h; + return ((((h * 6 < 1) ? m1 + (m2 - m1) * h * 6 : (h < 0.5) ? m2 : (h * 3 < 2) ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * 255) + 0.5) | 0; + }, + /** + * @private Parses a color (like #9F0, #FF9900, rgb(255,51,153) or hsl(108, 50%, 10%)) into an array with 3 elements for red, green, and blue or if toHSL parameter is true, it will populate the array with hue, saturation, and lightness values. If a relative value is found in an hsl() or hsla() string, it will preserve those relative prefixes and all the values in the array will be strings instead of numbers (in all other cases it will be populated with numbers). + * @param {(string|number)} v The value the should be parsed which could be a string like #9F0 or rgb(255,102,51) or rgba(255,0,0,0.5) or it could be a number like 0xFF00CC or even a named color like red, blue, purple, etc. + * @param {(boolean)} toHSL If true, an hsl() or hsla() value will be returned instead of rgb() or rgba() + * @return {Array.} An array containing red, green, and blue (and optionally alpha) in that order, or if the toHSL parameter was true, the array will contain hue, saturation and lightness (and optionally alpha) in that order. Always numbers unless there's a relative prefix found in an hsl() or hsla() string and toHSL is true. + */ + _parseColor = function(v, toHSL) { + var a, r, g, b, h, s, l, max, min, d, wasHSL; + if (!v) { + a = _colorLookup.black; + } else if (typeof(v) === "number") { + a = [v >> 16, (v >> 8) & 255, v & 255]; + } else { + if (v.charAt(v.length - 1) === ",") { //sometimes a trailing comma is included and we should chop it off (typically from a comma-delimited list of values like a textShadow:"2px 2px 2px blue, 5px 5px 5px rgb(255,0,0)" - in this example "blue," has a trailing comma. We could strip it out inside parseComplex() but we'd need to do it to the beginning and ending values plus it wouldn't provide protection from other potential scenarios like if the user passes in a similar value. + v = v.substr(0, v.length - 1); + } + if (_colorLookup[v]) { + a = _colorLookup[v]; + } else if (v.charAt(0) === "#") { + if (v.length === 4) { //for shorthand like #9F0 + r = v.charAt(1); + g = v.charAt(2); + b = v.charAt(3); + v = "#" + r + r + g + g + b + b; + } + v = parseInt(v.substr(1), 16); + a = [v >> 16, (v >> 8) & 255, v & 255]; + } else if (v.substr(0, 3) === "hsl") { + a = wasHSL = v.match(_numExp); + if (!toHSL) { + h = (Number(a[0]) % 360) / 360; + s = Number(a[1]) / 100; + l = Number(a[2]) / 100; + g = (l <= 0.5) ? l * (s + 1) : l + s - l * s; + r = l * 2 - g; + if (a.length > 3) { + a[3] = Number(a[3]); + } + a[0] = _hue(h + 1 / 3, r, g); + a[1] = _hue(h, r, g); + a[2] = _hue(h - 1 / 3, r, g); + } else if (v.indexOf("=") !== -1) { //if relative values are found, just return the raw strings with the relative prefixes in place. + return v.match(_relNumExp); + } + } else { + a = v.match(_numExp) || _colorLookup.transparent; + } + a[0] = Number(a[0]); + a[1] = Number(a[1]); + a[2] = Number(a[2]); + if (a.length > 3) { + a[3] = Number(a[3]); + } + } + if (toHSL && !wasHSL) { + r = a[0] / 255; + g = a[1] / 255; + b = a[2] / 255; + max = Math.max(r, g, b); + min = Math.min(r, g, b); + l = (max + min) / 2; + if (max === min) { + h = s = 0; + } else { + d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + h = (max === r) ? (g - b) / d + (g < b ? 6 : 0) : (max === g) ? (b - r) / d + 2 : (r - g) / d + 4; + h *= 60; + } + a[0] = (h + 0.5) | 0; + a[1] = (s * 100 + 0.5) | 0; + a[2] = (l * 100 + 0.5) | 0; + } + return a; + }, + _formatColors = function(s, toHSL) { + var colors = (s + "").match(_colorExp) || [], + charIndex = 0, + parsed = "", + i, color, temp; + if (!colors.length) { + return s; + } + for (i = 0; i < colors.length; i++) { + color = colors[i]; + temp = s.substr(charIndex, s.indexOf(color, charIndex)-charIndex); + charIndex += temp.length + color.length; + color = _parseColor(color, toHSL); + if (color.length === 3) { + color.push(1); + } + parsed += temp + (toHSL ? "hsla(" + color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : "rgba(" + color.join(",")) + ")"; + } + return parsed + s.substr(charIndex); + }, p, _colorStringFilter, + TweenLite = (_gsScope.GreenSockGlobals || _gsScope).TweenLite, + _colorExp = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3}){1,2}\\b", //we'll dynamically build this Regular Expression to conserve file size. After building it, it will be able to find rgb(), rgba(), # (hexadecimal), and named color values like red, blue, purple, etc. + + ColorPropsPlugin = _gsScope._gsDefine.plugin({ + propName: "colorProps", + version: "1.5.3", + priority: -1, + API: 2, + global: true, + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween, index) { + var p, proxy, pt, val; + this._target = target; + this._proxy = proxy = ((value.format + "").toUpperCase() === "NUMBER") ? {} : 0; + for (p in value) { + if (p !== "format") { + if (proxy) { + this._firstNumPT = pt = {_next:this._firstNumPT, t:target, p:p, f:(typeof(target[p]) === "function")}; + proxy[p] = "rgb(" + _parseColor(!pt.f ? target[p] : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]()).join(",") + ")"; + val = value[p]; + if (typeof(val) === "function") { + val = val(index, target); + } + this._addTween(proxy, p, "get", ((typeof(val) === "number") ? "rgb(" + _parseColor(val, false).join(",") + ")" : val), p, null, null, _colorStringFilter); + } else { + this._addTween(target, p, "get", value[p], p, null, null, _colorStringFilter, index); + } + + } + } + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(v) { + var pt = this._firstNumPT, + val; + this._super.setRatio.call(this, v); + while (pt) { + val = _parseColor(this._proxy[pt.p], false); + val = val[0] << 16 | val[1] << 8 | val[2]; + if (pt.f) { + this._target[pt.p](val); + } else { + this._target[pt.p] = val; + } + pt = pt._next; + } + } + }); + + for (p in _colorLookup) { + _colorExp += "|" + p + "\\b"; + } + _colorExp = new RegExp(_colorExp+")", "gi"); + ColorPropsPlugin.colorStringFilter = _colorStringFilter = function(a) { + var combined = a[0] + " " + a[1], + toHSL; + _colorExp.lastIndex = 0; + if (_colorExp.test(combined)) { + toHSL = (combined.indexOf("hsl(") !== -1 || combined.indexOf("hsla(") !== -1); + a[0] = _formatColors(a[0], toHSL); + a[1] = _formatColors(a[1], toHSL); + } + }; + + if (!TweenLite.defaultStringFilter) { + TweenLite.defaultStringFilter = ColorPropsPlugin.colorStringFilter; + } + + ColorPropsPlugin.parseColor = _parseColor; + p = ColorPropsPlugin.prototype; + p._firstNumPT = null; + p._kill = function(lookup) { + var pt = this._firstNumPT, + prev; + while (pt) { + if (pt.p in lookup) { + if (pt === p._firstNumPT) { + this._firstNumPT = pt._next; + } + if (prev) { + prev._next = pt._next; + } + } else { + prev = pt; + } + pt = pt._next; + } + return this._super._kill(lookup); + }; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("ColorPropsPlugin")); +/*! + * VERSION: 0.3.1 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + **/ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + _gsScope._gsDefine.plugin({ + propName: "directionalRotation", + version: "0.3.1", + API: 2, + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween, index) { + if (typeof(value) !== "object") { + value = {rotation:value}; + } + this.finals = {}; + var cap = (value.useRadians === true) ? Math.PI * 2 : 360, + min = 0.000001, + p, v, start, end, dif, split; + for (p in value) { + if (p !== "useRadians") { + end = value[p]; + if (typeof(end) === "function") { + end = end(index, target); + } + split = (end + "").split("_"); + v = split[0]; + start = parseFloat( (typeof(target[p]) !== "function") ? target[p] : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() ); + end = this.finals[p] = (typeof(v) === "string" && v.charAt(1) === "=") ? start + parseInt(v.charAt(0) + "1", 10) * Number(v.substr(2)) : Number(v) || 0; + dif = end - start; + if (split.length) { + v = split.join("_"); + if (v.indexOf("short") !== -1) { + dif = dif % cap; + if (dif !== dif % (cap / 2)) { + dif = (dif < 0) ? dif + cap : dif - cap; + } + } + if (v.indexOf("_cw") !== -1 && dif < 0) { + dif = ((dif + cap * 9999999999) % cap) - ((dif / cap) | 0) * cap; + } else if (v.indexOf("ccw") !== -1 && dif > 0) { + dif = ((dif - cap * 9999999999) % cap) - ((dif / cap) | 0) * cap; + } + } + if (dif > min || dif < -min) { + this._addTween(target, p, start, start + dif, p); + this._overwriteProps.push(p); + } + } + } + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(ratio) { + var pt; + if (ratio !== 1) { + this._super.setRatio.call(this, ratio); + } else { + pt = this._firstPT; + while (pt) { + if (pt.f) { + pt.t[pt.p](this.finals[pt.p]); + } else { + pt.t[pt.p] = this.finals[pt.p]; + } + pt = pt._next; + } + } + } + + })._autoCSS = true; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("DirectionalRotationPlugin")); +/*! + * VERSION: 0.2.1 + * DATE: 2019-02-07 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * DrawSVGPlugin is a Club GreenSock membership benefit; You must have a valid membership to use + * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. + * This work is subject to the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _doc = _gsScope.document, + _computedStyleScope = (typeof(window) !== "undefined" ? window : _doc.defaultView || {getComputedStyle:function() {}}), + _getComputedStyle = function(e) { + return _computedStyleScope.getComputedStyle(e); //to avoid errors in Microsoft Edge, we need to call getComputedStyle() from a specific scope, typically window. + }, + _numbersExp = /(?:(-|-=|\+=)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig, + _isEdge = (((_gsScope.navigator || {}).userAgent || "").indexOf("Edge") !== -1), //Microsoft Edge has a bug that causes it not to redraw the path correctly if the stroke-linecap is anything other than "butt" (like "round") and it doesn't match the stroke-linejoin. A way to trigger it is to change the stroke-miterlimit, so we'll only do that if/when we have to (to maximize performance) + _types = {rect:["width","height"], circle:["r","r"], ellipse:["rx","ry"], line:["x2","y2"]}, + DrawSVGPlugin; + + function getDistance(x1, y1, x2, y2, scaleX, scaleY) { + x2 = (parseFloat(x2 || 0) - parseFloat(x1 || 0)) * scaleX; + y2 = (parseFloat(y2 || 0) - parseFloat(y1 || 0)) * scaleY; + return Math.sqrt(x2 * x2 + y2 * y2); + } + + function unwrap(element) { + if (typeof(element) === "string" || !element.nodeType) { + element = _gsScope.TweenLite.selector(element); + if (element.length) { + element = element[0]; + } + } + return element; + } + + //accepts values like "100%" or "20% 80%" or "20 50" and parses it into an absolute start and end position on the line/stroke based on its length. Returns an an array with the start and end values, like [0, 243] + function parse(value, length, defaultStart) { + var i = value.indexOf(" "), + s, e; + if (i === -1) { + s = defaultStart !== undefined ? defaultStart + "" : value; + e = value; + } else { + s = value.substr(0, i); + e = value.substr(i+1); + } + s = (s.indexOf("%") !== -1) ? (parseFloat(s) / 100) * length : parseFloat(s); + e = (e.indexOf("%") !== -1) ? (parseFloat(e) / 100) * length : parseFloat(e); + return (s > e) ? [e, s] : [s, e]; + } + + function getLength(element) { + if (!element) { + return 0; + } + element = unwrap(element); + var type = element.tagName.toLowerCase(), + scaleX = 1, + scaleY = 1, + length, bbox, points, prevPoint, i, rx, ry; + if (element.getAttribute("vector-effect") === "non-scaling-stroke") { //non-scaling-stroke basically scales the shape and then strokes it at the screen-level (after transforms), thus we need to adjust the length accordingly. + scaleY = element.getScreenCTM(); + scaleX = Math.sqrt(scaleY.a * scaleY.a + scaleY.b * scaleY.b); + scaleY = Math.sqrt(scaleY.d * scaleY.d + scaleY.c * scaleY.c); + } + try { //IE bug: calling .getTotalLength() locks the repaint area of the stroke to whatever its current dimensions are on that frame/tick. To work around that, we must call getBBox() to force IE to recalculate things. + bbox = element.getBBox(); //solely for fixing bug in IE - we don't actually use the bbox. + } catch (e) { + //firefox has a bug that throws an error if the element isn't visible. + console.log("Error: Some browsers like Firefox won't report measurements of invisible elements (like display:none or masks inside defs)."); + } + if ((!bbox || (!bbox.width && !bbox.height)) && _types[type]) { //if the element isn't visible, try to discern width/height using its attributes. + bbox = { + width: parseFloat( element.getAttribute(_types[type][0]) ), + height: parseFloat( element.getAttribute(_types[type][1]) ) + }; + if (type !== "rect" && type !== "line") { //double the radius for circles and ellipses + bbox.width *= 2; + bbox.height *= 2; + } + if (type === "line") { + bbox.x = parseFloat( element.getAttribute("x1") ); + bbox.y = parseFloat( element.getAttribute("y1") ); + bbox.width = Math.abs(bbox.width - bbox.x); + bbox.height = Math.abs(bbox.height - bbox.y); + } + } + if (type === "path") { + prevPoint = element.style.strokeDasharray; + element.style.strokeDasharray = "none"; + length = element.getTotalLength() || 0; + if (scaleX !== scaleY) { + console.log("Warning: length cannot be measured accurately when vector-effect is non-scaling-stroke and the element isn't proportionally scaled."); + } + length *= (scaleX + scaleY) / 2; + element.style.strokeDasharray = prevPoint; + } else if (type === "rect") { + length = bbox.width * 2 * scaleX + bbox.height * 2 * scaleY; + } else if (type === "line") { + length = getDistance(bbox.x, bbox.y, bbox.x + bbox.width, bbox.y + bbox.height, scaleX, scaleY); + } else if (type === "polyline" || type === "polygon") { + points = element.getAttribute("points").match(_numbersExp) || []; + if (type === "polygon") { + points.push(points[0], points[1]); + } + length = 0; + for (i = 2; i < points.length; i+=2) { + length += getDistance(points[i-2], points[i-1], points[i], points[i+1], scaleX, scaleY) || 0; + } + } else if (type === "circle" || type === "ellipse") { + rx = (bbox.width / 2) * scaleX; + ry = (bbox.height / 2) * scaleY; + length = Math.PI * ( 3 * (rx + ry) - Math.sqrt((3 * rx + ry) * (rx + 3 * ry)) ); + } + return length || 0; + } + + function getPosition(element, length) { + if (!element) { + return [0, 0]; + } + element = unwrap(element); + length = length || (getLength(element) + 1); + var cs = _getComputedStyle(element), + dash = cs.strokeDasharray || "", + offset = parseFloat(cs.strokeDashoffset), + i = dash.indexOf(","); + if (i < 0) { + i = dash.indexOf(" "); + } + dash = (i < 0) ? length : parseFloat(dash.substr(0, i)) || 0.00001; + if (dash > length) { + dash = length; + } + return [Math.max(0, -offset), Math.max(0, dash - offset)]; + } + + DrawSVGPlugin = _gsScope._gsDefine.plugin({ + propName: "drawSVG", + API: 2, + version: "0.2.1", + global: true, + overwriteProps: ["drawSVG"], + + init: function(target, value, tween, index) { + if (!target.getBBox) { + return false; + } + var length = getLength(target) + 1, + start, end, overage, cs; + this._style = target.style; + this._target = target; + if (typeof(value) === "function") { + value = value(index, target); + } + if (value === true || value === "true") { + value = "0 100%"; + } else if (!value) { + value = "0 0"; + } else if ((value + "").indexOf(" ") === -1) { + value = "0 " + value; + } + start = getPosition(target, length); + end = parse(value, length, start[0]); + this._length = length + 10; + if (start[0] === 0 && end[0] === 0) { + overage = Math.max(0.00001, end[1] - length); //allow people to go past the end, like values of 105% because for some paths, Firefox doesn't return an accurate getTotalLength(), so it could end up coming up short. + this._dash = length + overage; + this._offset = length - start[1] + overage; + this._offsetPT = this._addTween(this, "_offset", this._offset, length - end[1] + overage, "drawSVG"); + } else { + this._dash = (start[1] - start[0]) || 0.000001; //some browsers render artifacts if dash is 0, so we use a very small number in that case. + this._offset = -start[0]; + this._dashPT = this._addTween(this, "_dash", this._dash, (end[1] - end[0]) || 0.00001, "drawSVG"); + this._offsetPT = this._addTween(this, "_offset", this._offset, -end[0], "drawSVG"); + } + if (_isEdge) { //to work around a bug in Microsoft Edge, animate the stroke-miterlimit by 0.0001 just to trigger the repaint (unnecessary if it's "round" and stroke-linejoin is also "round"). Imperceptible, relatively high-performance, and effective. Another option was to set the "d" attribute to its current value on every tick, but that seems like it'd be much less performant. + cs = _getComputedStyle(target); + if (cs.strokeLinecap !== cs.strokeLinejoin) { + end = parseFloat(cs.strokeMiterlimit); + this._addTween(target.style, "strokeMiterlimit", end, end + 0.0001, "strokeMiterlimit"); + } + } + this._live = (target.getAttribute("vector-effect") === "non-scaling-stroke" || (value + "").indexOf("live") !== -1); + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(ratio) { + if (this._firstPT) { + //when the element has vector-effect="non-scaling-stroke" and the SVG is resized (like on a window resize), it actually changes the length of the stroke! So we must sense that and make the proper adjustments. + if (this._live) { + var length = getLength(this._target) + 11, + lengthRatio; + if (length !== this._length) { + lengthRatio = length / this._length; + this._length = length; + this._offsetPT.s *= lengthRatio; + this._offsetPT.c *= lengthRatio; + if (this._dashPT) { + this._dashPT.s *= lengthRatio; + this._dashPT.c *= lengthRatio; + } else { + this._dash *= lengthRatio; + } + } + } + this._super.setRatio.call(this, ratio); + this._style.strokeDashoffset = this._offset; + if (ratio === 1 || ratio === 0) { + this._style.strokeDasharray = (this._offset < 0.001 && this._length - this._dash <= 10) ? "none" : (this._offset === this._dash) ? "0px, 999999px" : this._dash + "px," + this._length + "px"; + } else { + this._style.strokeDasharray = this._dash + "px," + this._length + "px"; + } + } + } + + }); + + DrawSVGPlugin.getLength = getLength; + DrawSVGPlugin.getPosition = getPosition; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("DrawSVGPlugin")); +/*! + * VERSION: 0.2.2 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + **/ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _numExp = /(\d|\.)+/g, + _ColorFilter, _ColorMatrixFilter, + _colorProps = ["redMultiplier","greenMultiplier","blueMultiplier","alphaMultiplier","redOffset","greenOffset","blueOffset","alphaOffset"], + _colorLookup = {aqua:[0,255,255], + lime:[0,255,0], + silver:[192,192,192], + black:[0,0,0], + maroon:[128,0,0], + teal:[0,128,128], + blue:[0,0,255], + navy:[0,0,128], + white:[255,255,255], + fuchsia:[255,0,255], + olive:[128,128,0], + yellow:[255,255,0], + orange:[255,165,0], + gray:[128,128,128], + purple:[128,0,128], + green:[0,128,0], + red:[255,0,0], + pink:[255,192,203], + cyan:[0,255,255], + transparent:[255,255,255,0]}, + _parseColor = function(color) { + if (color === "" || color == null || color === "none") { + return _colorLookup.transparent; + } else if (_colorLookup[color]) { + return _colorLookup[color]; + } else if (typeof(color) === "number") { + return [color >> 16, (color >> 8) & 255, color & 255]; + } else if (color.charAt(0) === "#") { + if (color.length === 4) { //for shorthand like #9F0 + color = "#" + color.charAt(1) + color.charAt(1) + color.charAt(2) + color.charAt(2) + color.charAt(3) + color.charAt(3); + } + color = parseInt(color.substr(1), 16); + return [color >> 16, (color >> 8) & 255, color & 255]; + } + return color.match(_numExp) || _colorLookup.transparent; + }, + _parseColorFilter = function(t, v, pg) { + if (!_ColorFilter) { + _ColorFilter = (_gsScope.ColorFilter || _gsScope.createjs.ColorFilter); + if (!_ColorFilter) { + throw("EaselPlugin error: The EaselJS ColorFilter JavaScript file wasn't loaded."); + } + } + var filters = t.filters || [], + i = filters.length, + c, s, e, a, p; + while (--i > -1) { + if (filters[i] instanceof _ColorFilter) { + s = filters[i]; + break; + } + } + if (!s) { + s = new _ColorFilter(); + filters.push(s); + t.filters = filters; + } + e = s.clone(); + if (v.tint != null) { + c = _parseColor(v.tint); + a = (v.tintAmount != null) ? Number(v.tintAmount) : 1; + e.redOffset = Number(c[0]) * a; + e.greenOffset = Number(c[1]) * a; + e.blueOffset = Number(c[2]) * a; + e.redMultiplier = e.greenMultiplier = e.blueMultiplier = 1 - a; + } else { + for (p in v) { + if (p !== "exposure") if (p !== "brightness") { + e[p] = Number(v[p]); + } + } + } + if (v.exposure != null) { + e.redOffset = e.greenOffset = e.blueOffset = 255 * (Number(v.exposure) - 1); + e.redMultiplier = e.greenMultiplier = e.blueMultiplier = 1; + } else if (v.brightness != null) { + a = Number(v.brightness) - 1; + e.redOffset = e.greenOffset = e.blueOffset = (a > 0) ? a * 255 : 0; + e.redMultiplier = e.greenMultiplier = e.blueMultiplier = 1 - Math.abs(a); + } + i = 8; + while (--i > -1) { + p = _colorProps[i]; + if (s[p] !== e[p]) { + pg._addTween(s, p, s[p], e[p], "easel_colorFilter"); + } + } + pg._overwriteProps.push("easel_colorFilter"); + if (!t.cacheID) { + throw("EaselPlugin warning: for filters to display in EaselJS, you must call the object's cache() method first. " + t); + } + }, + + _idMatrix = [1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0], + _lumR = 0.212671, + _lumG = 0.715160, + _lumB = 0.072169, + + _applyMatrix = function(m, m2) { + if (!(m instanceof Array) || !(m2 instanceof Array)) { + return m2; + } + var temp = [], + i = 0, + z = 0, + y, x; + for (y = 0; y < 4; y++) { + for (x = 0; x < 5; x++) { + z = (x === 4) ? m[i + 4] : 0; + temp[i + x] = m[i] * m2[x] + m[i+1] * m2[x + 5] + m[i+2] * m2[x + 10] + m[i+3] * m2[x + 15] + z; + } + i += 5; + } + return temp; + }, + + _setSaturation = function(m, n) { + if (isNaN(n)) { + return m; + } + var inv = 1 - n, + r = inv * _lumR, + g = inv * _lumG, + b = inv * _lumB; + return _applyMatrix([r + n, g, b, 0, 0, r, g + n, b, 0, 0, r, g, b + n, 0, 0, 0, 0, 0, 1, 0], m); + }, + + _colorize = function(m, color, amount) { + if (isNaN(amount)) { + amount = 1; + } + var c = _parseColor(color), + r = c[0] / 255, + g = c[1] / 255, + b = c[2] / 255, + inv = 1 - amount; + return _applyMatrix([inv + amount * r * _lumR, amount * r * _lumG, amount * r * _lumB, 0, 0, amount * g * _lumR, inv + amount * g * _lumG, amount * g * _lumB, 0, 0, amount * b * _lumR, amount * b * _lumG, inv + amount * b * _lumB, 0, 0, 0, 0, 0, 1, 0], m); + }, + + _setHue = function(m, n) { + if (isNaN(n)) { + return m; + } + n *= Math.PI / 180; + var c = Math.cos(n), + s = Math.sin(n); + return _applyMatrix([(_lumR + (c * (1 - _lumR))) + (s * (-_lumR)), (_lumG + (c * (-_lumG))) + (s * (-_lumG)), (_lumB + (c * (-_lumB))) + (s * (1 - _lumB)), 0, 0, (_lumR + (c * (-_lumR))) + (s * 0.143), (_lumG + (c * (1 - _lumG))) + (s * 0.14), (_lumB + (c * (-_lumB))) + (s * -0.283), 0, 0, (_lumR + (c * (-_lumR))) + (s * (-(1 - _lumR))), (_lumG + (c * (-_lumG))) + (s * _lumG), (_lumB + (c * (1 - _lumB))) + (s * _lumB), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], m); + }, + + _setContrast = function(m, n) { + if (isNaN(n)) { + return m; + } + n += 0.01; + return _applyMatrix([n,0,0,0,128 * (1 - n), 0,n,0,0,128 * (1 - n), 0,0,n,0,128 * (1 - n), 0,0,0,1,0], m); + }, + + _parseColorMatrixFilter = function(t, v, pg) { + if (!_ColorMatrixFilter) { + _ColorMatrixFilter = (_gsScope.ColorMatrixFilter || _gsScope.createjs.ColorMatrixFilter); + if (!_ColorMatrixFilter) { + throw("EaselPlugin error: The EaselJS ColorMatrixFilter JavaScript file wasn't loaded."); + } + } + var filters = t.filters || [], + i = filters.length, + matrix, startMatrix, s; + while (--i > -1) { + if (filters[i] instanceof _ColorMatrixFilter) { + s = filters[i]; + break; + } + } + if (!s) { + s = new _ColorMatrixFilter(_idMatrix.slice()); + filters.push(s); + t.filters = filters; + } + startMatrix = s.matrix; + matrix = _idMatrix.slice(); + if (v.colorize != null) { + matrix = _colorize(matrix, v.colorize, Number(v.colorizeAmount)); + } + if (v.contrast != null) { + matrix = _setContrast(matrix, Number(v.contrast)); + } + if (v.hue != null) { + matrix = _setHue(matrix, Number(v.hue)); + } + if (v.saturation != null) { + matrix = _setSaturation(matrix, Number(v.saturation)); + } + + i = matrix.length; + while (--i > -1) { + if (matrix[i] !== startMatrix[i]) { + pg._addTween(startMatrix, i, startMatrix[i], matrix[i], "easel_colorMatrixFilter"); + } + } + + pg._overwriteProps.push("easel_colorMatrixFilter"); + if (!t.cacheID) { + throw("EaselPlugin warning: for filters to display in EaselJS, you must call the object's cache() method first. " + t); + } + + pg._matrix = startMatrix; + }; + + + var EaselPlugin = _gsScope._gsDefine.plugin({ + propName: "easel", + priority: -1, + version: "0.2.2", + API: 2, + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween, index) { + this._target = target; + var p, pt, tint, colorMatrix, end, labels, i; + for (p in value) { + + end = value[p]; + if (typeof(end) === "function") { + end = end(index, target); + } + if (p === "colorFilter" || p === "tint" || p === "tintAmount" || p === "exposure" || p === "brightness") { + if (!tint) { + _parseColorFilter(target, value.colorFilter || value, this); + tint = true; + } + + } else if (p === "saturation" || p === "contrast" || p === "hue" || p === "colorize" || p === "colorizeAmount") { + if (!colorMatrix) { + _parseColorMatrixFilter(target, value.colorMatrixFilter || value, this); + colorMatrix = true; + } + + } else if (p === "frame") { + this._firstPT = pt = {_next:this._firstPT, t:target, p:"gotoAndStop", s:target.currentFrame, f:true, n:"frame", pr:0, type:0, m:Math.round}; + if (typeof(end) === "string" && end.charAt(1) !== "=" && (labels = target.labels)) { + for (i = 0; i < labels.length; i++) { + if (labels[i].label === end) { + end = labels[i].position; + } + } + } + pt.c = (typeof(end) === "number") ? end - pt.s : parseFloat((end+"").split("=").join("")); + if (pt._next) { + pt._next._prev = pt; + } + + } else if (target[p] != null) { + this._firstPT = pt = {_next:this._firstPT, t:target, p:p, f:(typeof(target[p]) === "function"), n:p, pr:0, type:0}; + pt.s = (!pt.f) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ](); + pt.c = (typeof(end) === "number") ? end - pt.s : (typeof(end) === "string") ? parseFloat(end.split("=").join("")) : 0; + + if (pt._next) { + pt._next._prev = pt; + } + } + + } + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(v) { + var pt = this._firstPT, + min = 0.000001, + val; + while (pt) { + val = pt.c * v + pt.s; + if (pt.m) { + val = pt.m(val, pt.t); + } else if (val < min && val > -min) { + val = 0; + } + if (pt.f) { + pt.t[pt.p](val); + } else { + pt.t[pt.p] = val; + } + pt = pt._next; + } + if (this._target.cacheID) { + this._target.updateCache(); + } + } + + }); + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("EaselPlugin")); +/*! + * VERSION: 0.1.3 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + _gsScope._gsDefine.plugin({ + propName: "endArray", + API: 2, + version: "0.1.3", + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween) { + var i = value.length, + a = this.a = [], + start, end; + this.target = target; + this._mod = 0; + if (!i) { + return false; + } + while (--i > -1) { + start = target[i]; + end = value[i]; + if (start !== end) { + a.push({i:i, s:start, c:end - start}); + } + } + return true; + }, + + mod: function(lookup) { + if (typeof(lookup.endArray) === "function") { + this._mod = lookup.endArray; + } + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(ratio) { + var target = this.target, + a = this.a, + i = a.length, + mod = this._mod, + e, val; + if (mod) { + while (--i > -1) { + e = a[i]; + target[e.i] = mod(e.s + e.c * ratio, target); + } + } else { + while (--i > -1) { + e = a[i]; + val = e.s + e.c * ratio; + target[e.i] = (val < 0.000001 && val > -0.000001) ? 0 : val; + } + } + } + + }); + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } +/*! + * VERSION: 0.0.4 + * DATE: 2018-05-21 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _cssRatioSetter = function(pt, cssp, mod) { //Takes an individual CSSPropTween and converts it into a type:2 that has a setRatio that does everything the regular CSSPlugin.setRatio() method does but applying the mod() too. We do this to keep the main CSSPlugin.setRatio() as fast as possible (the vast majority of times, no mod() will be necessary) + var type = pt.type, + oldSetRatio = pt.setRatio, + tween = cssp._tween, + target = cssp._target; + pt.type = 2; + pt.m = mod; + pt.setRatio = function(v) { + var min = 0.000001, + val, str, i; + if (v === 1 && (tween._time === tween._duration || tween._time === 0)) { + + if (type !== 2) { + if (pt.r && type !== -1) { + val = Math.round(pt.s + pt.c); + if (!type) { + pt.t[pt.p] = mod.call(tween, val + pt.xs0, target, tween); + } else if (type === 1) { + str = pt.xs0 + val + pt.xs1; + for (i = 1; i < pt.l; i++) { + str += pt["xn"+i] + pt["xs"+(i+1)]; + } + pt.t[pt.p] = mod.call(tween, str, target, tween); + } + } else { + pt.t[pt.p] = mod.call(tween, pt.e, target, tween); + } + } else { + oldSetRatio.call(pt, v); + } + + } else if (v || !(tween._time === tween._duration || tween._time === 0) || tween._rawPrevTime === -0.000001) { + val = pt.c * v + pt.s; + if (pt.r) { + val = Math.round(val); + } else if (val < min) if (val > -min) { + val = 0; + } + if (!type) { + pt.t[pt.p] = mod.call(tween, val + pt.xs0, target, tween); + } else if (type === 1) { + str = pt.xs0 + val + pt.xs1; + for (i = 1; i < pt.l; i++) { + str += pt["xn"+i] + pt["xs"+(i+1)]; + } + pt.t[pt.p] = mod.call(tween, str, target, tween); + + } else if (type === -1) { //non-tweening value + pt.t[pt.p] = mod.call(tween, pt.xs0, target, tween); + + } else if (oldSetRatio) { + oldSetRatio.call(pt, v); + } + + } else { + if (type !== 2) { + pt.t[pt.p] = mod.call(tween, pt.b, target, tween); + } else { + oldSetRatio.call(pt, v); + } + } + }; + }, + _modCSS = function(lookup, cssp) { + var pt = cssp._firstPT, + hasBezier = (lookup.rotation && cssp._overwriteProps.join("").indexOf("bezier") !== -1); //when a Bezier tween is applying autoRotation, it's a very special case we need to handle differently. + if (lookup.scale) { + lookup.scaleX = lookup.scaleY = lookup.scale; + } else if (lookup.rotationZ) { + lookup.rotation = lookup.rotationZ; + } + while (pt) { + if (typeof(lookup[pt.p]) === "function") { + _cssRatioSetter(pt, cssp, lookup[pt.p]); + } else if (hasBezier && pt.n === "bezier" && pt.plugin._overwriteProps.join("").indexOf("rotation") !== -1) { + pt.data.mod = lookup.rotation; + } + pt = pt._next; + } + }, + + ModifiersPlugin = _gsScope._gsDefine.plugin({ + propName: "modifiers", + version: "0.0.4", + API: 2, + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween) { + this._tween = tween; + this._vars = value; + return true; + }, + + initAll: function() { + var tween = this._tween, + lookup = this._vars, + mpt = this, + pt = tween._firstPT, + val, next; + //initAll() gets called for each and every ModifiersPlugin instance in a tween, so if there are multiple targets, there will be multiple instances. Since we're ripping through the whole tween (and all the PropTweens), we only need to run this code ONCE. So we're setting a toggle on the first PropTween that just tells us if we've done it already. We don't set it on the tween instance because if it gets invalidated, we don't want to have to track this property and reset it. PropTweens get blown away when a tween is invalidated. + if (pt._modInitted) { + return false; + } else { + pt._modInitted = 1; + } + while (pt) { + next = pt._next; //record here, because it may get removed + val = lookup[pt.n]; + if (pt.pg) { + if (pt.t._propName === "css") { //handle CSSPlugin uniquely (for performance, due to the fact that the values almost always are a concatenation of numbers and strings, like suffixes, and we don't want to slow down the regular CSSPlugin setRatio() performance with conditional checks for if the value needs to be modded, so we pull any modding prop out and change it to a type:2 one that simply calls a setRatio() method where we encapsulate the modding and update all together. That way, it says in the main CSSProp linked list and just has some custom logic applied to it inside its setRatio()) + _modCSS(lookup, pt.t); + } else if (pt.t !== mpt) { //don't run modProps on modProps :) + val = lookup[pt.t._propName]; + pt.t._tween = tween; + pt.t._mod((typeof(val) === "object") ? val : lookup); + } + } else if (typeof(val) === "function") { + if (pt.f === 2 && pt.t) { //a blob (text containing multiple numeric values) + pt.t._applyPT.m = val; + pt.t._tween = tween; + } else { + this._add(pt.t, pt.p, pt.s, pt.c, val); + //remove from linked list + if (next) { + next._prev = pt._prev; + } + if (pt._prev) { + pt._prev._next = next; + } else if (tween._firstPT === pt) { + tween._firstPT = next; + } + pt._next = pt._prev = null; + tween._propLookup[pt.n] = mpt; + } + } + pt = next; + } + return false; + } + + }), + p = ModifiersPlugin.prototype; + + p._add = function(target, p, s, c, mod) { + this._addTween(target, p, s, s + c, p, mod); + this._overwriteProps.push(p); + }; + + p = _gsScope._gsDefine.globals.TweenLite.version.split("."); + if (Number(p[0]) <= 1 && Number(p[1]) < 19 && _gsScope.console) { + console.log("ModifiersPlugin requires GSAP 1.19.0 or later."); + } + + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("ModifiersPlugin")); +/*! + * VERSION: 0.9.0 + * DATE: 2019-02-07 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * MorphSVGPlugin is a Club GreenSock membership benefit; You must have a valid membership to use + * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. + * This work is subject to the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + + var _PI = Math.PI, + _DEG2RAD = _PI / 180, + _svgPathExp = /[achlmqstvz]|(-?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig, + _numbersExp = /(?:(-|-=|\+=)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig, + _selectorExp = /(^[#\.][a-z]|[a-y][a-z])/gi, + _commands = /[achlmqstvz]/ig, + _scientific = /[\+\-]?\d*\.?\d+e[\+\-]?\d+/ig, + _atan2 = Math.atan2, + _cos = Math.cos, + _sin = Math.sin, + _sqrt = Math.sqrt, + _2PI = _PI * 2, + _angleMin = _PI * 0.3, + _angleMax = _PI * 0.7, + _lastLinkedAnchor, + TweenLite = _gsScope._gsDefine.globals.TweenLite, + + _log = function(message) { + if (_gsScope.console) { + console.log(message); + } + }, + + // translates SVG arc data into an array of cubic beziers + _arcToBeziers = function(lastX, lastY, rx, ry, angle, largeArcFlag, sweepFlag, x, y) { + if (lastX === x && lastY === y) { + return; + } + rx = Math.abs(rx); + ry = Math.abs(ry); + var angleRad = (angle % 360) * _DEG2RAD, + cosAngle = _cos(angleRad), + sinAngle = _sin(angleRad), + dx2 = (lastX - x) / 2, + dy2 = (lastY - y) / 2, + x1 = (cosAngle * dx2 + sinAngle * dy2), + y1 = (-sinAngle * dx2 + cosAngle * dy2), + x1_sq = x1 * x1, + y1_sq = y1 * y1, + radiiCheck = x1_sq / (rx * rx) + y1_sq / (ry * ry); + if (radiiCheck > 1) { + rx = _sqrt(radiiCheck) * rx; + ry = _sqrt(radiiCheck) * ry; + } + var rx_sq = rx * rx, + ry_sq = ry * ry, + sq = ((rx_sq * ry_sq) - (rx_sq * y1_sq) - (ry_sq * x1_sq)) / ((rx_sq * y1_sq) + (ry_sq * x1_sq)); + if (sq < 0) { + sq = 0; + } + var coef = ((largeArcFlag === sweepFlag) ? -1 : 1) * _sqrt(sq), + cx1 = coef * ((rx * y1) / ry), + cy1 = coef * -((ry * x1) / rx), + sx2 = (lastX + x) / 2, + sy2 = (lastY + y) / 2, + cx = sx2 + (cosAngle * cx1 - sinAngle * cy1), + cy = sy2 + (sinAngle * cx1 + cosAngle * cy1), + ux = (x1 - cx1) / rx, + uy = (y1 - cy1) / ry, + vx = (-x1 - cx1) / rx, + vy = (-y1 - cy1) / ry, + temp = ux * ux + uy * uy, + angleStart = ((uy < 0) ? -1 : 1) * Math.acos(ux / _sqrt(temp)), + angleExtent = ((ux * vy - uy * vx < 0) ? -1 : 1) * Math.acos((ux * vx + uy * vy) / _sqrt(temp * (vx * vx + vy * vy))); + if (!sweepFlag && angleExtent > 0) { + angleExtent -= _2PI; + } else if (sweepFlag && angleExtent < 0) { + angleExtent += _2PI; + } + angleStart %= _2PI; + angleExtent %= _2PI; + var segments = Math.ceil(Math.abs(angleExtent) / (_2PI / 4)), + rawPath = [], + angleIncrement = angleExtent / segments, + controlLength = 4 / 3 * _sin(angleIncrement / 2) / (1 + _cos(angleIncrement / 2)), + ma = cosAngle * rx, + mb = sinAngle * rx, + mc = sinAngle * -ry, + md = cosAngle * ry, + i; + for (i = 0; i < segments; i++) { + angle = angleStart + i * angleIncrement; + x1 = _cos(angle); + y1 = _sin(angle); + ux = _cos(angle += angleIncrement); + uy = _sin(angle); + rawPath.push(x1 - controlLength * y1, y1 + controlLength * x1, ux + controlLength * uy, uy - controlLength * ux, ux, uy); + } + //now transform according to the actual size of the ellipse/arc (the beziers were noramlized, between 0 and 1 on a circle). + for (i = 0; i < rawPath.length; i+=2) { + x1 = rawPath[i]; + y1 = rawPath[i+1]; + rawPath[i] = x1 * ma + y1 * mc + cx; + rawPath[i+1] = x1 * mb + y1 * md + cy; + } + rawPath[i-2] = x; //always set the end to exactly where it's supposed to be + rawPath[i-1] = y; + return rawPath; + }, + + //Spits back an array of cubic Bezier segments that use absolute coordinates. Each segment starts with a "moveTo" command (x coordinate, then y) and then 2 control points (x, y, x, y), then anchor. The goal is to minimize memory and maximize speed. + _stringToRawPath = function(d) { + var a = (d + "").replace(_scientific, function(m) { var n = +m; return (n < 0.0001 && n > -0.0001) ? 0 : n; }).match(_svgPathExp) || [], //some authoring programs spit out very small numbers in scientific notation like "1e-5", so make sure we round that down to 0 first. + path = [], + relativeX = 0, + relativeY = 0, + twoThirds = 2 / 3, + elements = a.length, + points = 0, + errorMessage = "ERROR: malformed path: " + d, + line = function(sx, sy, ex, ey) { + difX = (ex - sx) / 3; + difY = (ey - sy) / 3; + segment.push(sx + difX, sy + difY, ex - difX, ey - difY, ex, ey); + }, + i, j, x, y, command, isRelative, segment, startX, startY, difX, difY, beziers, prevCommand; + if (!d || !isNaN(a[0]) || isNaN(a[1])) { + _log(errorMessage); + return path; + } + for (i = 0; i < elements; i++) { + prevCommand = command; + if (isNaN(a[i])) { + command = a[i].toUpperCase(); + isRelative = (command !== a[i]); //lower case means relative + } else { //commands like "C" can be strung together without any new command characters between. + i--; + } + x = +a[i + 1]; + y = +a[i + 2]; + if (isRelative) { + x += relativeX; + y += relativeY; + } + if (!i) { + startX = x; + startY = y; + } + + // "M" (move) + if (command === "M") { + if (segment) { + if (segment.length < 8) { //if the path data was funky and just had a M with no actual drawing anywhere, skip it. + path.length -= 1; + } else { + points += segment.length; + } + } + relativeX = startX = x; + relativeY = startY = y; + segment = [x, y]; + path.push(segment); + i += 2; + command = "L"; //an "M" with more than 2 values gets interpreted as "lineTo" commands ("L"). + + // "C" (cubic bezier) + } else if (command === "C") { + if (!segment) { + segment = [0, 0]; + } + if (!isRelative) { + relativeX = relativeY = 0; + } + //note: "*1" is just a fast/short way to cast the value as a Number. WAAAY faster in Chrome, slightly slower in Firefox. + segment.push(x, y, relativeX + a[i + 3] * 1, relativeY + a[i + 4] * 1, (relativeX += a[i + 5] * 1), (relativeY += a[i + 6] * 1)); + i += 6; + + // "S" (continuation of cubic bezier) + } else if (command === "S") { + difX = relativeX; + difY = relativeY; + if (prevCommand === "C" || prevCommand === "S") { + difX += relativeX - segment[segment.length - 4]; + difY += relativeY - segment[segment.length - 3]; + } + if (!isRelative) { + relativeX = relativeY = 0; + } + segment.push(difX, difY, x, y, (relativeX += a[i + 3] * 1), (relativeY += a[i + 4] * 1)); + i += 4; + + // "Q" (quadratic bezier) + } else if (command === "Q") { + difX = relativeX + (x - relativeX) * twoThirds; + difY = relativeY + (y - relativeY) * twoThirds; + if (!isRelative) { + relativeX = relativeY = 0; + } + relativeX += a[i + 3] * 1; + relativeY += a[i + 4] * 1; + segment.push(difX, difY, relativeX + (x - relativeX) * twoThirds, relativeY + (y - relativeY) * twoThirds, relativeX, relativeY); + i += 4; + + // "T" (continuation of quadratic bezier) + } else if (command === "T") { + difX = relativeX - segment[segment.length - 4]; + difY = relativeY - segment[segment.length - 3]; + segment.push(relativeX + difX, relativeY + difY, x + ((relativeX + difX * 1.5) - x) * twoThirds, y + ((relativeY + difY * 1.5) - y) * twoThirds, (relativeX = x), (relativeY = y)); + i += 2; + + // "H" (horizontal line) + } else if (command === "H") { + line(relativeX, relativeY, (relativeX = x), relativeY); + i += 1; + + // "V" (vertical line) + } else if (command === "V") { + //adjust values because the first (and only one) isn't x in this case, it's y. + line(relativeX, relativeY, relativeX, (relativeY = x + (isRelative ? relativeY - relativeX : 0))); + i += 1; + + // "L" (line) or "Z" (close) + } else if (command === "L" || command === "Z") { + if (command === "Z") { + x = startX; + y = startY; + segment.closed = true; + } + if (command === "L" || Math.abs(relativeX - x) > 0.5 || Math.abs(relativeY - y) > 0.5) { + line(relativeX, relativeY, x, y); + if (command === "L") { + i += 2; + } + } + relativeX = x; + relativeY = y; + + // "A" (arc) + } else if (command === "A") { + beziers = _arcToBeziers(relativeX, relativeY, +a[i+1], +a[i+2], +a[i+3], +a[i+4], +a[i+5], (isRelative ? relativeX : 0) + a[i+6]*1, (isRelative ? relativeY : 0) + a[i+7]*1); + if (beziers) { + for (j = 0; j < beziers.length; j++) { + segment.push(beziers[j]); + } + } + relativeX = segment[segment.length-2]; + relativeY = segment[segment.length-1]; + i += 7; + + } else { + _log(errorMessage); + } + } + i = segment.length; + if (segment[0] === segment[i-2] && segment[1] === segment[i-1]) { + segment.closed = true; + } + path.totalPoints = points + i; + return path; + }, + + //adds a certain number of Beziers while maintaining the path shape (so that the start/end values can have a matching quantity of points to animate). Only pass in ONE segment of the Bezier at a time. Format: [xAnchor, yAnchor, xControlPoint1, yControlPoint1, xControlPoint2, yControlPoint2, xAnchor, yAnchor, xControlPoint1, etc...] + _subdivideSegment = function(segment, quantity) { + var tally = 0, + max = 0.999999, + l = segment.length, + newPointsPerSegment = quantity / ((l - 2) / 6), + ax, ay, cp1x, cp1y, cp2x, cp2y, bx, by, + x1, y1, x2, y2, i, t; + for (i = 2; i < l; i += 6) { + tally += newPointsPerSegment; + while (tally > max) { //compare with 0.99999 instead of 1 in order to prevent rounding errors + ax = segment[i-2]; + ay = segment[i-1]; + cp1x = segment[i]; + cp1y = segment[i+1]; + cp2x = segment[i+2]; + cp2y = segment[i+3]; + bx = segment[i+4]; + by = segment[i+5]; + t = 1 / ((Math.floor(tally) || 1) + 1); //progress along the bezier (value between 0 and 1) + x1 = ax + (cp1x - ax) * t; + x2 = cp1x + (cp2x - cp1x) * t; + x1 += (x2 - x1) * t; + x2 += ((cp2x + (bx - cp2x) * t) - x2) * t; + + y1 = ay + (cp1y - ay) * t; + y2 = cp1y + (cp2y - cp1y) * t; + y1 += (y2 - y1) * t; + y2 += ((cp2y + (by - cp2y) * t) - y2) * t; + + segment.splice(i, 4, + ax + (cp1x - ax) * t, //first control point + ay + (cp1y - ay) * t, + x1, //second control point + y1, + x1 + (x2 - x1) * t, //new fabricated anchor on line + y1 + (y2 - y1) * t, + x2, //third control point + y2, + cp2x + (bx - cp2x) * t, //fourth control point + cp2y + (by - cp2y) * t + ); + i += 6; + l += 6; + tally--; + } + } + return segment; + }, + _rawPathToString = function(rawPath, precision) { + var s = "", + space = " ", + l = rawPath.length, + rnd = Math.pow(10, precision || 2), + i, j, segment; + for (j = 0; j < rawPath.length; j++) { + segment = rawPath[j]; + l = segment.length; + s += "M" + (((segment[0] * rnd) | 0) / rnd) + space + (((segment[1] * rnd) | 0) / rnd) + " C"; + for (i = 2; i < l; i++) { //this is actually faster than just doing a join() on the array, possibly because the numbers have so many decimal places + s += (((segment[i] * rnd) | 0) / rnd) + space; + } + if (segment.closed) { + s += "z"; + } + } + return s; + }, + _reverseBezier = function(segment) { + var a = [], + i = segment.length - 1, + l = 0; + while (--i > -1) { + a[l++] = segment[i]; + a[l++] = segment[i+1]; + i--; + } + for (i = 0; i < l; i++) { + segment[i] = a[i]; + } + segment.reversed = !segment.reversed; + }, + _getAverageXY = function(segment) { + var l = segment.length, + x = 0, + y = 0, + i; + for (i = 0; i < l; i++) { + x += segment[i++]; + y += segment[i]; + } + return [x / (l / 2), y / (l / 2)]; + }, + _getSize = function(segment) { //rough estimate of the bounding box (based solely on the anchors) of a single segment. sets "size", "centerX", and "centerY" properties on the bezier array itself, and returns the size (width * height) + var l = segment.length, + xMax = segment[0], + xMin = xMax, + yMax = segment[1], + yMin = yMax, + x, y, i; + for (i = 6; i < l; i+=6) { + x = segment[i]; + y = segment[i+1]; + if (x > xMax) { + xMax = x; + } else if (x < xMin) { + xMin = x; + } + if (y > yMax) { + yMax = y; + } else if (y < yMin) { + yMin = y; + } + } + segment.centerX = (xMax + xMin) / 2; + segment.centerY = (yMax + yMin) / 2; + return (segment.size = (xMax - xMin) * (yMax - yMin)); + }, + _getTotalSize = function(rawPath, samplesPerBezier) { //rough estimate of the bounding box of the entire list of Bezier segments (based solely on the anchors). sets "size", "centerX", and "centerY" properties on the bezier array itself, and returns the size (width * height) + samplesPerBezier = samplesPerBezier || 3; + var j = rawPath.length, + xMax = rawPath[0][0], + xMin = xMax, + yMax = rawPath[0][1], + yMin = yMax, + inc = 1 / samplesPerBezier, + l, x, y, i, segment, k, t, inv, x1, y1, x2, x3, x4, y2, y3, y4; + while (--j > -1) { + segment = rawPath[j]; + l = segment.length; + for (i = 6; i < l; i+=6) { + x1 = segment[i]; + y1 = segment[i+1]; + x2 = segment[i+2] - x1; + y2 = segment[i+3] - y1; + x3 = segment[i+4] - x1; + y3 = segment[i+5] - y1; + x4 = segment[i+6] - x1; + y4 = segment[i+7] - y1; + k = samplesPerBezier; + while (--k > -1) { + t = inc * k; + inv = 1 - t; + x = (t * t * x4 + 3 * inv * (t * x3 + inv * x2)) * t + x1; + y = (t * t * y4 + 3 * inv * (t * y3 + inv * y2)) * t + y1; + if (x > xMax) { + xMax = x; + } else if (x < xMin) { + xMin = x; + } + if (y > yMax) { + yMax = y; + } else if (y < yMin) { + yMin = y; + } + } + } + } + rawPath.centerX = (xMax + xMin) / 2; + rawPath.centerY = (yMax + yMin) / 2; + rawPath.left = xMin; + rawPath.width = (xMax - xMin); + rawPath.top = yMin; + rawPath.height = (yMax - yMin); + return (rawPath.size = (xMax - xMin) * (yMax - yMin)); + }, + _sortByComplexity = function(a, b) { + return b.length - a.length; + }, + _sortBySize = function(a, b) { + var sizeA = a.size || _getSize(a), + sizeB = b.size || _getSize(b); + return (Math.abs(sizeB - sizeA) < (sizeA + sizeB) / 20) ? (b.centerX - a.centerX) || (b.centerY - a.centerY) : sizeB - sizeA; //if the size is within 10% of each other, prioritize position from left to right, then top to bottom. + }, + _offsetSegment = function(segment, shapeIndex) { + var a = segment.slice(0), + l = segment.length, + wrap = l - 2, + i, index; + shapeIndex = shapeIndex | 0; + for (i = 0; i < l; i++) { + index = (i + shapeIndex) % wrap; + segment[i++] = a[index]; + segment[i] = a[index+1]; + } + }, + _getTotalMovement = function(sb, eb, shapeIndex, offsetX, offsetY) { + var l = sb.length, + d = 0, + wrap = l - 2, + index, i, x, y; + shapeIndex *= 6; + for (i = 0; i < l; i += 6) { + index = (i + shapeIndex) % wrap; + y = sb[index] - (eb[i] - offsetX); + x = sb[index+1] - (eb[i+1] - offsetY); + d += _sqrt(x * x + y * y); + } + return d; + }, + _getClosestShapeIndex = function(sb, eb, checkReverse) { //finds the index in a closed cubic bezier array that's closest to the angle provided (angle measured from the center or average x/y). + var l = sb.length, + sCenter = _getAverageXY(sb), //when comparing distances, adjust the coordinates as if the shapes are centered with each other. + eCenter = _getAverageXY(eb), + offsetX = eCenter[0] - sCenter[0], + offsetY = eCenter[1] - sCenter[1], + min = _getTotalMovement(sb, eb, 0, offsetX, offsetY), + minIndex = 0, + copy, d, i; + for (i = 6; i < l; i += 6) { + d = _getTotalMovement(sb, eb, i / 6, offsetX, offsetY); + if (d < min) { + min = d; + minIndex = i; + } + } + if (checkReverse) { + copy = sb.slice(0); + _reverseBezier(copy); + for (i = 6; i < l; i += 6) { + d = _getTotalMovement(copy, eb, i / 6, offsetX, offsetY); + if (d < min) { + min = d; + minIndex = -i; + } + } + } + return minIndex / 6; + }, + _getClosestAnchor = function(bezier, x, y) { //finds the x/y of the anchor that's closest to the provided x/y coordinate (returns an array, like [x, y]). The bezier should be the top-level type that contains an array for each segment. + var j = bezier.length, + closestDistance = 99999999999, + closestX = 0, + closestY = 0, + b, dx, dy, d, i, l; + while (--j > -1) { + b = bezier[j]; + l = b.length; + for (i = 0; i < l; i += 6) { + dx = b[i] - x; + dy = b[i+1] - y; + d = _sqrt(dx * dx + dy * dy); + if (d < closestDistance) { + closestDistance = d; + closestX = b[i]; + closestY = b[i+1]; + } + } + } + return [closestX, closestY]; + }, + _getClosestSegment = function(bezier, pool, startIndex, sortRatio, offsetX, offsetY) { //matches the bezier to the closest one in a pool (array) of beziers, assuming they are in order of size and we shouldn't drop more than 20% of the size, otherwise prioritizing location (total distance to the center). Extracts the segment out of the pool array and returns it. + var l = pool.length, + index = 0, + minSize = Math.min(bezier.size || _getSize(bezier), pool[startIndex].size || _getSize(pool[startIndex])) * sortRatio, //limit things based on a percentage of the size of either the bezier or the next element in the array, whichever is smaller. + min = 999999999999, + cx = bezier.centerX + offsetX, + cy = bezier.centerY + offsetY, + size, i, dx, dy, d; + for (i = startIndex; i < l; i++) { + size = pool[i].size || _getSize(pool[i]); + if (size < minSize) { + break; + } + dx = pool[i].centerX - cx; + dy = pool[i].centerY - cy; + d = _sqrt(dx * dx + dy * dy); + if (d < min) { + index = i; + min = d; + } + } + d = pool[index]; + pool.splice(index, 1); + return d; + }, + _equalizeSegmentQuantity = function(start, end, shapeIndex, map, fillSafe) { //returns an array of shape indexes, 1 for each segment. + var dif = end.length - start.length, + longer = dif > 0 ? end : start, + shorter = dif > 0 ? start : end, + added = 0, + sortMethod = (map === "complexity") ? _sortByComplexity : _sortBySize, + sortRatio = (map === "position") ? 0 : (typeof(map) === "number") ? map : 0.8, + i = shorter.length, + shapeIndices = (typeof(shapeIndex) === "object" && shapeIndex.push) ? shapeIndex.slice(0) : [shapeIndex], + reverse = (shapeIndices[0] === "reverse" || shapeIndices[0] < 0), + log = (shapeIndex === "log"), + eb, sb, b, x, y, offsetX, offsetY; + if (!shorter[0]) { + return; + } + if (longer.length > 1) { + start.sort(sortMethod); + end.sort(sortMethod); + offsetX = longer.size || _getTotalSize(longer); //ensures centerX and centerY are defined (used below). + offsetX = shorter.size || _getTotalSize(shorter); + offsetX = longer.centerX - shorter.centerX; + offsetY = longer.centerY - shorter.centerY; + if (sortMethod === _sortBySize) { + for (i = 0; i < shorter.length; i++) { + longer.splice(i, 0, _getClosestSegment(shorter[i], longer, i, sortRatio, offsetX, offsetY)); + } + } + } + if (dif) { + if (dif < 0) { + dif = -dif; + } + if (longer[0].length > shorter[0].length) { //since we use shorter[0] as the one to map the origination point of any brand new fabricated segments, do any subdividing first so that there are more points to choose from (if necessary) + _subdivideSegment(shorter[0], ((longer[0].length - shorter[0].length)/6) | 0); + } + i = shorter.length; + while (added < dif) { + x = longer[i].size || _getSize(longer[i]); //just to ensure centerX and centerY are calculated which we use on the next line. + b = _getClosestAnchor(shorter, longer[i].centerX, longer[i].centerY); + x = b[0]; + y = b[1]; + shorter[i++] = [x, y, x, y, x, y, x, y]; + shorter.totalPoints += 8; + added++; + } + } + for (i = 0; i < start.length; i++) { + eb = end[i]; + sb = start[i]; + dif = eb.length - sb.length; + if (dif < 0) { + _subdivideSegment(eb, (-dif/6) | 0); + } else if (dif > 0) { + _subdivideSegment(sb, (dif/6) | 0); + } + if (reverse && fillSafe !== false && !sb.reversed) { + _reverseBezier(sb); + } + shapeIndex = (shapeIndices[i] || shapeIndices[i] === 0) ? shapeIndices[i] : "auto"; + if (shapeIndex) { + //if start shape is closed, find the closest point to the start/end, and re-organize the bezier points accordingly so that the shape morphs in a more intuitive way. + if (sb.closed || (Math.abs(sb[0] - sb[sb.length - 2]) < 0.5 && Math.abs(sb[1] - sb[sb.length - 1]) < 0.5)) { + if (shapeIndex === "auto" || shapeIndex === "log") { + shapeIndices[i] = shapeIndex = _getClosestShapeIndex(sb, eb, (!i || fillSafe === false)); + if (shapeIndex < 0) { + reverse = true; + _reverseBezier(sb); + shapeIndex = -shapeIndex; + } + _offsetSegment(sb, shapeIndex * 6); + + } else if (shapeIndex !== "reverse") { + if (i && shapeIndex < 0) { //only happens if an array is passed as shapeIndex and a negative value is defined for an index beyond 0. Very rare, but helpful sometimes. + _reverseBezier(sb); + } + _offsetSegment(sb, (shapeIndex < 0 ? -shapeIndex : shapeIndex) * 6); + } + //otherwise, if it's not a closed shape, consider reversing it if that would make the overall travel less + } else if (!reverse && (shapeIndex === "auto" && (Math.abs(eb[0] - sb[0]) + Math.abs(eb[1] - sb[1]) + Math.abs(eb[eb.length - 2] - sb[sb.length - 2]) + Math.abs(eb[eb.length - 1] - sb[sb.length - 1]) > Math.abs(eb[0] - sb[sb.length - 2]) + Math.abs(eb[1] - sb[sb.length - 1]) + Math.abs(eb[eb.length - 2] - sb[0]) + Math.abs(eb[eb.length - 1] - sb[1])) || (shapeIndex % 2))) { + _reverseBezier(sb); + shapeIndices[i] = -1; + reverse = true; + } else if (shapeIndex === "auto") { + shapeIndices[i] = 0; + } else if (shapeIndex === "reverse") { + shapeIndices[i] = -1; + } + if (sb.closed !== eb.closed) { //if one is closed and one isn't, don't close either one otherwise the tweening will look weird (but remember, the beginning and final states will honor the actual values, so this only affects the inbetween state) + sb.closed = eb.closed = false; + } + } + } + if (log) { + _log("shapeIndex:[" + shapeIndices.join(",") + "]"); + } + start.shapeIndex = shapeIndices; + return shapeIndices; + }, + _pathFilter = function(a, shapeIndex, map, precompile, fillSafe) { + var start = _stringToRawPath(a[0]), + end = _stringToRawPath(a[1]); + if (!_equalizeSegmentQuantity(start, end, (shapeIndex || shapeIndex === 0) ? shapeIndex : "auto", map, fillSafe)) { + return; //malformed path data or null target + } + a[0] = _rawPathToString(start); + a[1] = _rawPathToString(end); + if (precompile === "log" || precompile === true) { + _log('precompile:["' + a[0] + '","' + a[1] + '"]'); + } + }, + /* + _buildPathFilter = function(shapeIndex, map, precompile) { + return (map || precompile || shapeIndex || shapeIndex === 0) ? function(a) { + _pathFilter(a, shapeIndex, map, precompile); + } : _pathFilter; + }, + */ + _offsetPoints = function(text, offset) { + if (!offset) { + return text; + } + var a = text.match(_numbersExp) || [], + l = a.length, + s = "", + inc, i, j; + if (offset === "reverse") { + i = l-1; + inc = -2; + } else { + i = (((parseInt(offset, 10) || 0) * 2 + 1) + l * 100) % l; + inc = 2; + } + for (j = 0; j < l; j += 2) { + s += a[i-1] + "," + a[i] + " "; + i = (i + inc) % l; + } + return s; + }, + //adds a certain number of points while maintaining the polygon/polyline shape (so that the start/end values can have a matching quantity of points to animate). Returns the revised string. + _equalizePointQuantity = function(a, quantity) { + var tally = 0, + x = parseFloat(a[0]), + y = parseFloat(a[1]), + s = x + "," + y + " ", + max = 0.999999, + newPointsPerSegment, i, l, j, factor, nextX, nextY; + l = a.length; + newPointsPerSegment = quantity * 0.5 / (l * 0.5 - 1); + for (i = 0; i < l-2; i += 2) { + tally += newPointsPerSegment; + nextX = parseFloat(a[i+2]); + nextY = parseFloat(a[i+3]); + if (tally > max) { //compare with 0.99999 instead of 1 in order to prevent rounding errors + factor = 1 / (Math.floor(tally) + 1); + j = 1; + while (tally > max) { + s += (x + (nextX - x) * factor * j).toFixed(2) + "," + (y + (nextY - y) * factor * j).toFixed(2) + " "; + tally--; + j++; + } + } + s += nextX + "," + nextY + " "; + x = nextX; + y = nextY; + } + return s; + }, + _pointsFilter = function(a) { + var startNums = a[0].match(_numbersExp) || [], + endNums = a[1].match(_numbersExp) || [], + dif = endNums.length - startNums.length; + if (dif > 0) { + a[0] = _equalizePointQuantity(startNums, dif); + } else { + a[1] = _equalizePointQuantity(endNums, -dif); + } + }, + _buildPointsFilter = function(shapeIndex) { + return !isNaN(shapeIndex) ? function(a) { + _pointsFilter(a); + a[1] = _offsetPoints(a[1], parseInt(shapeIndex, 10)); + } : _pointsFilter; + }, + _createPath = function(e, ignore) { + var path = _gsScope.document.createElementNS("http://www.w3.org/2000/svg", "path"), + attr = Array.prototype.slice.call(e.attributes), + i = attr.length, + name; + ignore = "," + ignore + ","; + while (--i > -1) { + name = attr[i].nodeName.toLowerCase(); //in Microsoft Edge, if you don't set the attribute with a lowercase name, it doesn't render correctly! Super weird. + if (ignore.indexOf("," + name + ",") === -1) { + path.setAttributeNS(null, name, attr[i].nodeValue); + } + } + return path; + }, + _typeAttrs = { + rect:"rx,ry,x,y,width,height", + circle:"r,cx,cy", + ellipse:"rx,ry,cx,cy", + line:"x1,x2,y1,y2" + }, + _attrToObj = function(e, attrs) { + var props = attrs ? attrs.split(",") : [], + obj = {}, + i = props.length; + while (--i > -1) { + obj[props[i]] = +e.getAttribute(props[i]) || 0; + } + return obj; + }, + _convertToPath = function(e, swap) { + var type = e.tagName.toLowerCase(), + circ = 0.552284749831, + data, x, y, r, ry, path, rcirc, rycirc, points, w, h, x2, x3, x4, x5, x6, y2, y3, y4, y5, y6, attr; + if (type === "path" || !e.getBBox) { + return e; + } + path = _createPath(e, "x,y,width,height,cx,cy,rx,ry,r,x1,x2,y1,y2,points"); + attr = _attrToObj(e, _typeAttrs[type]); + if (type === "rect") { + r = attr.rx; + ry = attr.ry; + x = attr.x; + y = attr.y; + w = attr.width - r * 2; + h = attr.height - ry * 2; + if (r || ry) { //if there are rounded corners, render cubic beziers + x2 = x + r * (1 - circ); + x3 = x + r; + x4 = x3 + w; + x5 = x4 + r * circ; + x6 = x4 + r; + y2 = y + ry * (1 - circ); + y3 = y + ry; + y4 = y3 + h; + y5 = y4 + ry * circ; + y6 = y4 + ry; + data = "M" + x6 + "," + y3 + " V" + y4 + " C" + [x6, y5, x5, y6, x4, y6, x4 - (x4 - x3) / 3, y6, x3 + (x4 - x3) / 3, y6, x3, y6, x2, y6, x, y5, x, y4, x, y4 - (y4 - y3) / 3, x, y3 + (y4 - y3) / 3, x, y3, x, y2, x2, y, x3, y, x3 + (x4 - x3) / 3, y, x4 - (x4 - x3) / 3, y, x4, y, x5, y, x6, y2, x6, y3].join(",") + "z"; + } else { + data = "M" + (x + w) + "," + y + " v" + h + " h" + (-w) + " v" + (-h) + " h" + w + "z"; + } + + } else if (type === "circle" || type === "ellipse") { + if (type === "circle") { + r = ry = attr.r; + rycirc = r * circ; + } else { + r = attr.rx; + ry = attr.ry; + rycirc = ry * circ; + } + x = attr.cx; + y = attr.cy; + rcirc = r * circ; + data = "M" + (x+r) + "," + y + " C" + [x+r, y + rycirc, x + rcirc, y + ry, x, y + ry, x - rcirc, y + ry, x - r, y + rycirc, x - r, y, x - r, y - rycirc, x - rcirc, y - ry, x, y - ry, x + rcirc, y - ry, x + r, y - rycirc, x + r, y].join(",") + "z"; + } else if (type === "line") { + data = "M" + attr.x1 + "," + attr.y1 + " L" + attr.x2 + "," + attr.y2; //previously, we just converted to "Mx,y Lx,y" but Safari has bugs that cause that not to render properly when using a stroke-dasharray that's not fully visible! Using a cubic bezier fixes that issue. + } else if (type === "polyline" || type === "polygon") { + points = (e.getAttribute("points") + "").match(_numbersExp) || []; + x = points.shift(); + y = points.shift(); + data = "M" + x + "," + y + " L" + points.join(","); + if (type === "polygon") { + data += "," + x + "," + y + "z"; + } + } + path.setAttribute("d", _rawPathToString(path._gsRawPath = _stringToRawPath(data))); + if (swap && e.parentNode) { + e.parentNode.insertBefore(path, e); + e.parentNode.removeChild(e); + } + + return path; + }, + _parseShape = function(shape, forcePath, target) { + var isString = typeof(shape) === "string", + e, type; + if (!isString || _selectorExp.test(shape) || (shape.match(_numbersExp) || []).length < 3) { + e = isString ? TweenLite.selector(shape) : (shape && shape[0]) ? shape : [shape]; //allow array-like objects like jQuery objects. + if (e && e[0]) { + e = e[0]; + type = (e.nodeName + "").toUpperCase(); + if (forcePath && type !== "PATH") { //if we were passed an element (or selector text for an element) that isn't a path, convert it. + e = _convertToPath(e, false); + type = "PATH"; + } + shape = e.getAttribute(type === "PATH" ? "d" : "points") || ""; + if (e === target) { //if the shape matches the target element, the user wants to revert to the original which should have been stored in the data-original attribute + shape = e.getAttributeNS(null, "data-original") || shape; + } + } else { + _log("WARNING: invalid morph to: " + shape); + shape = false; + } + } + return shape; + }, + //adds an "isSmooth" array to each segment and populates it with a boolean value indicating whether or not it's smooth (the control points have basically the same slope). For any smooth control points, it converts the coordinates into angle (x, in radians) and length (y) and puts them into the same index value in a smoothData array. + _populateSmoothData = function(rawPath, tolerance) { + var j = rawPath.length, + limit = 0.2 * (tolerance || 1), + smooth, segment, x, y, x2, y2, i, l, a, a2, isSmooth, smoothData; + while (--j > -1) { + segment = rawPath[j]; + isSmooth = segment.isSmooth = segment.isSmooth || [0, 0, 0, 0]; + smoothData = segment.smoothData = segment.smoothData || [0, 0, 0, 0]; + isSmooth.length = 4; + l = segment.length - 2; + for (i = 6; i < l; i += 6) { + x = segment[i] - segment[i - 2]; + y = segment[i + 1] - segment[i - 1]; + x2 = segment[i + 2] - segment[i]; + y2 = segment[i + 3] - segment[i + 1]; + a = _atan2(y, x); + a2 = _atan2(y2, x2); + smooth = (Math.abs(a - a2) < limit); + if (smooth) { + smoothData[i - 2] = a; + smoothData[i + 2] = a2; + smoothData[i - 1] = _sqrt(x * x + y * y); + smoothData[i + 3] = _sqrt(x2 * x2 + y2 * y2); + } + isSmooth.push(smooth, smooth, 0, 0, smooth, smooth); + } + //if the first and last points are identical, check to see if there's a smooth transition. We must handle this a bit differently due to their positions in the array. + if (segment[l] === segment[0] && segment[l+1] === segment[1]) { + x = segment[0] - segment[l-2]; + y = segment[1] - segment[l-1]; + x2 = segment[2] - segment[0]; + y2 = segment[3] - segment[1]; + a = _atan2(y, x); + a2 = _atan2(y2, x2); + if (Math.abs(a - a2) < limit) { + smoothData[l-2] = a; + smoothData[2] = a2; + smoothData[l-1] = _sqrt(x * x + y * y); + smoothData[3] = _sqrt(x2 * x2 + y2 * y2); + isSmooth[l-2] = isSmooth[l-1] = true; //don't change indexes 2 and 3 because we'll trigger everything from the END, and this will optimize file size a bit. + } + } + } + return rawPath; + }, + _parseOriginFactors = function(v) { + var a = v.trim().split(" "), + x = (v.indexOf("left") >= 0) ? 0 : (v.indexOf("right") >= 0) ? 100 : isNaN(parseFloat(a[0])) ? 50 : parseFloat(a[0]), + y = (v.indexOf("top") >= 0) ? 0 : (v.indexOf("bottom") >= 0) ? 100 : isNaN(parseFloat(a[1])) ? 50 : parseFloat(a[1]); + return {x:x / 100, y:y / 100}; + }, + _shortAngle = function(dif) { + return (dif !== dif % _PI) ? dif + ((dif < 0) ? _2PI : -_2PI) : dif; + }, + _morphMessage = "Use MorphSVGPlugin.convertToPath(elementOrSelectorText) to convert to a path before morphing.", + + + + MorphSVGPlugin = _gsScope._gsDefine.plugin({ + propName: "morphSVG", + API: 2, + global: true, + version: "0.9.0", + overwriteProps: ["morphSVG"], + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween, index) { + var cs = window.getComputedStyle(target), + fill = cs.fill + "", + fillSafe = !(fill === "none" || (fill.match(_numbersExp) || [])[3] === "0" || cs.fillRule === "evenodd"), + origins = (value.origin || "50 50").split(","), + type, p, pt, shape, isPoly, shapeIndex, map, startSmooth, endSmooth, start, end, i, j, l, startSeg, endSeg, precompiled, sData, eData, originFactors, useRotation, offset; + if (typeof(value) === "function") { + value = value(index, target); + } + type = (target.nodeName + "").toUpperCase(); + isPoly = (type === "POLYLINE" || type === "POLYGON"); + if (type !== "PATH" && !isPoly && !value.prop) { + _log("WARNING: cannot morph a <" + type + "> element. " + _morphMessage); + return false; + } + p = (type === "PATH") ? "d" : "points"; + if (typeof(value) === "string" || value.getBBox || value[0]) { + value = {shape:value}; + } + if (!value.prop && typeof(target.setAttribute) !== "function") { + return false; + } + shape = _parseShape(value.shape || value.d || value.points || "", (p === "d"), target); + if (isPoly && _commands.test(shape)) { + _log("WARNING: a <" + type + "> cannot accept path data. " + _morphMessage); + return false; + } + shapeIndex = (value.shapeIndex || value.shapeIndex === 0) ? value.shapeIndex : "auto"; + map = value.map || MorphSVGPlugin.defaultMap; + this._prop = value.prop; + this._render = value.render || MorphSVGPlugin.defaultRender; + this._apply = ("updateTarget" in value) ? value.updateTarget : MorphSVGPlugin.defaultUpdateTarget; + this._rnd = Math.pow(10, isNaN(value.precision) ? 2 : +value.precision); + this._tween = tween; + if (shape) { + this._target = target; + precompiled = (typeof(value.precompile) === "object"); + start = this._prop ? target[this._prop] : target.getAttribute(p); + if (!this._prop && !target.getAttributeNS(null, "data-original")) { + target.setAttributeNS(null, "data-original", start); //record the original state in a data-original attribute so that we can revert to it later. + } + if (p === "d" || this._prop) { + start = _stringToRawPath(precompiled ? value.precompile[0] : start); + end = _stringToRawPath(precompiled ? value.precompile[1] : shape); + if (!precompiled && !_equalizeSegmentQuantity(start, end, shapeIndex, map, fillSafe)) { + return false; //malformed path data or null target + } + if (value.precompile === "log" || value.precompile === true) { + _log('precompile:["' + _rawPathToString(start) + '","' + _rawPathToString(end) + '"]'); + } + + useRotation = (value.type || MorphSVGPlugin.defaultType) !== "linear"; + + if (useRotation) { + start = _populateSmoothData(start, value.smoothTolerance); + end = _populateSmoothData(end, value.smoothTolerance ); + if (!start.size) { + _getTotalSize(start); //adds top/left/width/height values + } + if (!end.size) { + _getTotalSize(end); + } + originFactors = _parseOriginFactors(origins[0]); + this._origin = start.origin = {x:start.left + originFactors.x * start.width, y:start.top + originFactors.y * start.height}; + if (origins[1]) { + originFactors = _parseOriginFactors(origins[1]); + } + this._eOrigin = {x:end.left + originFactors.x * end.width, y:end.top + originFactors.y * end.height}; + } + + this._rawPath = target._gsRawPath = start; + + j = start.length; + while (--j > -1) { + startSeg = start[j]; + endSeg = end[j]; + startSmooth = startSeg.isSmooth || []; + endSmooth = endSeg.isSmooth || []; + l = startSeg.length; + _lastLinkedAnchor = 0; //reset; we use _lastLinkedAnchor in the _tweenRotation() method to help make sure that close points don't get ripped apart and rotate opposite directions. Typically we want to go the shortest direction, but if the previous anchor is going a different direction, we override this logic (within certain thresholds) + for (i = 0; i < l; i+=2) { + if (endSeg[i] !== startSeg[i] || endSeg[i+1] !== startSeg[i+1]) { + if (useRotation) { + if (startSmooth[i] && endSmooth[i]) { //if BOTH starting and ending values are smooth (meaning control points have basically the same slope), interpolate the rotation and length instead of the coordinates (this is what makes things smooth). + sData = startSeg.smoothData; + eData = endSeg.smoothData; + offset = i + ((i === l - 4) ? 7 - l : 5); //helps us accommodate wrapping (like if the end and start anchors are identical and the control points are smooth). + this._controlPT = {_next:this._controlPT, i:i, j:j, l1s:sData[i+1], l1c:eData[i+1] - sData[i+1], l2s:sData[offset], l2c:eData[offset] - sData[offset]}; + pt = this._tweenRotation(startSeg, endSeg, i+2); + this._tweenRotation(startSeg, endSeg, i, pt); + this._tweenRotation(startSeg, endSeg, offset-1, pt); + i+=4; + } else { + this._tweenRotation(startSeg, endSeg, i); + } + } else { + this._addTween(startSeg, i, startSeg[i], endSeg[i]); + pt = this._addTween(startSeg, i+1, startSeg[i+1], endSeg[i+1]); + } + } + } + } + } else { + pt = this._addTween(target, "setAttribute", target.getAttribute(p) + "", shape + "", "morphSVG", false, p, _buildPointsFilter(shapeIndex)); + } + + if (useRotation) { + this._addTween(this._origin, "x", this._origin.x, this._eOrigin.x); + pt = this._addTween(this._origin, "y", this._origin.y, this._eOrigin.y); + } + + if (pt) { + this._overwriteProps.push("morphSVG"); + pt.end = shape; + pt.endProp = p; + } + } + return true; + }, + + set: function(ratio) { + var rawPath = this._rawPath, + controlPT = this._controlPT, + anchorPT = this._anchorPT, + rnd = this._rnd, + target = this._target, + s, space, easeInOut, pt, segment, l, angle, i, j, x, y, sin, cos, offset; + this._super.setRatio.call(this, ratio); + if (ratio === 1 && this._apply) { + pt = this._firstPT; + while (pt) { + if (pt.end) { + if (this._prop) { + target[this._prop] = pt.end; + } else { + target.setAttribute(pt.endProp, pt.end); //make sure the end value is exactly as specified (in case we had to add fabricated points during the tween) + } + } + pt = pt._next; + } + } else if (rawPath) { + + //rotationally position the anchors + while (anchorPT) { + angle = anchorPT.sa + ratio * anchorPT.ca; + l = anchorPT.sl + ratio * anchorPT.cl; //length + anchorPT.t[anchorPT.i] = this._origin.x + _cos(angle) * l; + anchorPT.t[anchorPT.i + 1] = this._origin.y + _sin(angle) * l; + anchorPT = anchorPT._next; + } + + //smooth out the control points + easeInOut = ratio < 0.5 ? 2 * ratio * ratio : (4 - 2 * ratio) * ratio - 1; + while (controlPT) { + i = controlPT.i; + segment = rawPath[controlPT.j]; + offset = i + ((i === segment.length - 4) ? 7 - segment.length : 5); //accommodates wrapping around of smooth points, like if the start and end anchors are on top of each other and their handles are smooth. + angle = _atan2(segment[offset] - segment[i+1], segment[offset-1] - segment[i]); //average the angles + sin = _sin(angle); + cos = _cos(angle); + x = segment[i+2]; + y = segment[i+3]; + l = controlPT.l1s + easeInOut * controlPT.l1c; //length + segment[i] = x - cos * l; + segment[i+1] = y - sin * l; + l = controlPT.l2s + easeInOut * controlPT.l2c; + segment[offset-1] = x + cos * l; + segment[offset] = y + sin * l; + controlPT = controlPT._next; + } + + target._gsRawPath = rawPath; + + if (this._apply) { + s = ""; + space = " "; + for (j = 0; j < rawPath.length; j++) { + segment = rawPath[j]; + l = segment.length; + s += "M" + (((segment[0] * rnd) | 0) / rnd) + space + (((segment[1] * rnd) | 0) / rnd) + " C"; + for (i = 2; i < l; i++) { //this is actually faster than just doing a join() on the array, possibly because the numbers have so many decimal places + s += (((segment[i] * rnd) | 0) / rnd) + space; + } + } + if (this._prop) { + target[this._prop] = s; + } else { + target.setAttribute("d", s); + } + } + } + if (this._render && rawPath) { + this._render.call(this._tween, rawPath, target); + } + } + }); + + + MorphSVGPlugin.prototype._tweenRotation = function(start, end, i, linkedPT) { + var so = this._origin, //starting origin + eo = this._eOrigin, //ending origin + dx = start[i] - so.x, + dy = start[i+1] - so.y, + d = _sqrt(dx * dx + dy * dy), //length from starting origin to starting point + sa = _atan2(dy, dx), + angleDif, short; + dx = end[i] - eo.x; + dy = end[i+1] - eo.y; + angleDif = _atan2(dy, dx) - sa; + short = _shortAngle(angleDif); + //in the case of control points, we ALWAYS link them to their anchor so that they don't get torn apart and rotate the opposite direction. If it's not a control point, we look at the most recently linked point as long as they're within a certain rotational range of each other. + if (!linkedPT && _lastLinkedAnchor && Math.abs(short + _lastLinkedAnchor.ca) < _angleMin) { + linkedPT = _lastLinkedAnchor; + } + return (this._anchorPT = _lastLinkedAnchor = { + _next:this._anchorPT, + t:start, + sa:sa, //starting angle + ca:(linkedPT && short * linkedPT.ca < 0 && Math.abs(short) > _angleMax) ? angleDif : short, //change in angle + sl:d, //starting length + cl:_sqrt(dx * dx + dy * dy) - d, //change in length + i:i + }); + }; + + MorphSVGPlugin.pathFilter = _pathFilter; + MorphSVGPlugin.pointsFilter = _pointsFilter; + MorphSVGPlugin.getTotalSize = _getTotalSize; + MorphSVGPlugin.subdivideRawBezier = MorphSVGPlugin.subdivideSegment = _subdivideSegment; + MorphSVGPlugin.rawPathToString = _rawPathToString; + MorphSVGPlugin.defaultType = "linear"; + MorphSVGPlugin.defaultUpdateTarget = true; + MorphSVGPlugin.defaultMap = "size"; + MorphSVGPlugin.stringToRawPath = MorphSVGPlugin.pathDataToRawBezier = function(data) { + return _stringToRawPath(_parseShape(data, true)); + }; + MorphSVGPlugin.equalizeSegmentQuantity = _equalizeSegmentQuantity; + + MorphSVGPlugin.convertToPath = function(targets, swap) { + if (typeof(targets) === "string") { + targets = TweenLite.selector(targets); + } + var a = (!targets || targets.length === 0) ? [] : (targets.length && targets[0] && targets[0].nodeType) ? Array.prototype.slice.call(targets, 0) : [targets], + i = a.length; + while (--i > -1) { + a[i] = _convertToPath(a[i], (swap !== false)); + } + return a; + }; + + MorphSVGPlugin.pathDataToBezier = function(data, vars) { //converts SVG path data into an array of {x, y} objects that can be plugged directly into a bezier tween. You can optionally pass in a 2D matrix like [a, b, c, d, tx, ty] containing numbers that should transform each point. + var bezier = _stringToRawPath(_parseShape(data, true))[0] || [], + prefix = 0, + a, i, l, matrix, offsetX, offsetY, bbox, e; + vars = vars || {}; + e = vars.align || vars.relative; + matrix = vars.matrix || [1,0,0,1,0,0]; + offsetX = vars.offsetX || 0; + offsetY = vars.offsetY || 0; + if (e === "relative" || e === true) { + offsetX -= bezier[0] * matrix[0] + bezier[1] * matrix[2]; + offsetY -= bezier[0] * matrix[1] + bezier[1] * matrix[3]; + prefix = "+="; + } else { + offsetX += matrix[4]; + offsetY += matrix[5]; + if (e) { + e = (typeof(e) === "string") ? TweenLite.selector(e) : (e && e[0]) ? e : [e]; //allow array-like objects like jQuery objects. + if (e && e[0]) { + bbox = e[0].getBBox() || {x:0, y:0}; + offsetX -= bbox.x; + offsetY -= bbox.y; + } + } + } + a = []; + l = bezier.length; + if (matrix && matrix.join(",") !== "1,0,0,1,0,0") { + for (i = 0; i < l; i+=2) { + a.push({x:prefix + (bezier[i] * matrix[0] + bezier[i+1] * matrix[2] + offsetX), y:prefix + (bezier[i] * matrix[1] + bezier[i+1] * matrix[3] + offsetY)}); + } + } else { + for (i = 0; i < l; i+=2) { + a.push({x:prefix + (bezier[i] + offsetX), y:prefix + (bezier[i+1] + offsetY)}); + } + } + return a; + }; + + + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("MorphSVGPlugin")); +/*! + * VERSION: 0.2.1 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * Physics2DPlugin is a Club GreenSock membership benefit; You must have a valid membership to use + * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. + * This work is subject to the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _DEG2RAD = Math.PI / 180, + Physics2DProp = function(target, p, velocity, acceleration, stepsPerTimeUnit) { + this.p = p; + this.f = (typeof(target[p]) === "function"); + this.start = this.value = (!this.f) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ](); + this.velocity = velocity || 0; + this.v = this.velocity / stepsPerTimeUnit; + if (acceleration || acceleration === 0) { + this.acceleration = acceleration; + this.a = this.acceleration / (stepsPerTimeUnit * stepsPerTimeUnit); + } else { + this.acceleration = this.a = 0; + } + }, + _random = Math.random(), + _globals = _gsScope._gsDefine.globals, + _rootFramesTimeline = _globals.com.greensock.core.Animation._rootFramesTimeline, + + Physics2DPlugin = _gsScope._gsDefine.plugin({ + propName: "physics2D", + version: "0.2.1", + API: 2, + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween, index) { + if (typeof(value) === "function") { + value = value(index, target); + } + this._target = target; + this._tween = tween; + this._runBackwards = (tween.vars.runBackwards === true); + this._step = 0; + var tl = tween._timeline, + angle = Number(value.angle) || 0, + velocity = Number(value.velocity) || 0, + acceleration = Number(value.acceleration) || 0, + xProp = value.xProp || "x", + yProp = value.yProp || "y", + aAngle = (value.accelerationAngle || value.accelerationAngle === 0) ? Number(value.accelerationAngle) : angle, + stepsPerTimeUnit; + while (tl._timeline) { + tl = tl._timeline; + } + this._stepsPerTimeUnit = stepsPerTimeUnit = (tl === _rootFramesTimeline) ? 1 : 30; + if (value.gravity) { + acceleration = Number(value.gravity); + aAngle = 90; + } + angle *= _DEG2RAD; + aAngle *= _DEG2RAD; + this._friction = 1 - Number(value.friction || 0); + this._overwriteProps.push(xProp); + this._overwriteProps.push(yProp); + + this._x = new Physics2DProp(target, xProp, Math.cos(angle) * velocity, Math.cos(aAngle) * acceleration, stepsPerTimeUnit); + this._y = new Physics2DProp(target, yProp, Math.sin(angle) * velocity, Math.sin(aAngle) * acceleration, stepsPerTimeUnit); + this._skipX = this._skipY = false; + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(ratio) { + var time = this._tween._time, + xp = this._x, + yp = this._y, + x, y, tt, steps, remainder, i; + if (this._runBackwards === true) { + time = this._tween._duration - time; + } + if (this._friction === 1) { + tt = time * time * 0.5; + x = xp.start + ((xp.velocity * time) + (xp.acceleration * tt)); + y = yp.start + ((yp.velocity * time) + (yp.acceleration * tt)); + } else { + time *= this._stepsPerTimeUnit; + steps = i = (time | 0) - this._step; + remainder = (time % 1); + if (i >= 0) { //going forward + while (--i > -1) { + xp.v += xp.a; + yp.v += yp.a; + xp.v *= this._friction; + yp.v *= this._friction; + xp.value += xp.v; + yp.value += yp.v; + } + + } else { //going backwards + i = -i; + while (--i > -1) { + xp.value -= xp.v; + yp.value -= yp.v; + xp.v /= this._friction; + yp.v /= this._friction; + xp.v -= xp.a; + yp.v -= yp.a; + } + } + x = xp.value + (xp.v * remainder); + y = yp.value + (yp.v * remainder); + this._step += steps; + } + if (!this._skipX) { + if (xp.m) { + x = xp.m(x, this._target); + } + if (xp.f) { + this._target[xp.p](x); + } else { + this._target[xp.p] = x; + } + } + if (!this._skipY) { + if (yp.m) { + y = yp.m(y, this._target); + } + if (yp.f) { + this._target[yp.p](y); + } else { + this._target[yp.p] = y; + } + } + } + + }), + p = Physics2DPlugin.prototype; + + p._kill = function(lookup) { + if (lookup[this._x.p] != null) { + this._skipX = true; + } + if (lookup[this._y.p] != null) { + this._skipY = true; + } + return this._super._kill.call(this, lookup); + }; + + p._mod = function(lookup) { + var val = lookup[this._x.p] || lookup.physics2D; + if (val && typeof(val) === "function") { + this._x.m = val; + } + val = lookup[this._y.p] || lookup.physics2D; + if (val && typeof(val) === "function") { + this._y.m = val; + } + }; + + Physics2DPlugin._autoCSS = true; //indicates that this plugin can be inserted into the "css" object using the autoCSS feature of TweenLite + Physics2DPlugin._cssRegister = function() { + var CSSPlugin = _globals.CSSPlugin; + if (!CSSPlugin) { + return; + } + var _internals = CSSPlugin._internals, + _parseToProxy = _internals._parseToProxy, + _setPluginRatio = _internals._setPluginRatio, + CSSPropTween = _internals.CSSPropTween; + _internals._registerComplexSpecialProp("physics2D", {parser:function(t, e, prop, cssp, pt, plugin) { + plugin = new Physics2DPlugin(); + var xProp = e.xProp || "x", + yProp = e.yProp || "y", + vars = {}, + data; + vars[xProp] = vars[yProp] = _random++; //doesn't really matter what values we put here because the plugin will determine end values, but it'd be best of the values don't match the current ones so that CSSPlugin doesn't skip creating a CSSPropTween. + data = _parseToProxy(t, vars, cssp, pt, plugin); + pt = new CSSPropTween(t, "physics2D", 0, 0, data.pt, 2); + pt.data = data; + pt.plugin = plugin; + pt.setRatio = _setPluginRatio; + plugin._onInitTween(data.proxy, e, cssp._tween); + return pt; + }}); + }; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("Physics2DPlugin")); +/*! + * VERSION: 0.2.1 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * PhysicsPropsPlugin is a Club GreenSock membership benefit; You must have a valid membership to use + * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. + * This work is subject to the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var PhysicsProp = function(target, p, velocity, acceleration, friction, stepsPerTimeUnit) { + this.p = p; + this.f = (typeof(target[p]) === "function"); + this.start = this.value = (!this.f) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ](); + this.velocity = velocity || 0; + this.v = this.velocity / stepsPerTimeUnit; + if (acceleration || acceleration == 0) { + this.acceleration = acceleration; + this.a = this.acceleration / (stepsPerTimeUnit * stepsPerTimeUnit); + } else { + this.acceleration = this.a = 0; + } + this.friction = 1 - (friction || 0) ; + }, + _random = Math.random(), + _globals = _gsScope._gsDefine.globals, + _rootFramesTimeline = _globals.com.greensock.core.Animation._rootFramesTimeline, + + PhysicsPropsPlugin = _gsScope._gsDefine.plugin({ + propName: "physicsProps", + version: "0.2.1", + API: 2, + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween, index) { + if (typeof(value) === "function") { + value = value(target); + } + this._target = target; + this._tween = tween; + this._runBackwards = (tween.vars.runBackwards === true); + this._step = 0; + var tl = tween._timeline, + cnt = 0, + p, curProp; + while (tl._timeline) { + tl = tl._timeline; + } + this._stepsPerTimeUnit = (tl === _rootFramesTimeline) ? 1 : 30; + this._props = []; + for (p in value) { + curProp = value[p]; + if (typeof(curProp) === "function") { + curProp = curProp(index, target); + } + if (curProp.velocity || curProp.acceleration) { + this._props[cnt++] = new PhysicsProp(target, p, curProp.velocity, curProp.acceleration, curProp.friction, this._stepsPerTimeUnit); + this._overwriteProps[cnt] = p; + if (curProp.friction) { + this._hasFriction = true; + } + } + } + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(ratio) { + var i = this._props.length, + time = this._tween._time, + target = this._target, + curProp, val, steps, remainder, j, tt; + if (this._runBackwards) { + time = this._tween._duration - time; + } + if (this._hasFriction) { + time *= this._stepsPerTimeUnit; + steps = (time | 0) - this._step; + remainder = time % 1; + if (steps >= 0) { //going forward + while (--i > -1) { + curProp = this._props[i]; + j = steps; + while (--j > -1) { + curProp.v += curProp.a; + curProp.v *= curProp.friction; + curProp.value += curProp.v; + } + val = curProp.value + (curProp.v * remainder); + if (curProp.m) { + val = curProp.m(val, target); + } + if (curProp.f) { + target[curProp.p](val); + } else { + target[curProp.p] = val; + } + } + + } else { //going backwards + while (--i > -1) { + curProp = this._props[i]; + j = -steps; + while (--j > -1) { + curProp.value -= curProp.v; + curProp.v /= curProp.friction; + curProp.v -= curProp.a; + } + val = curProp.value + (curProp.v * remainder); + if (curProp.m) { + val = curProp.m(val, target); + } + if (curProp.f) { + target[curProp.p](val); + } else { + target[curProp.p] = val; + } + } + } + this._step += steps; + + } else { + tt = time * time * 0.5; + while (--i > -1) { + curProp = this._props[i]; + val = curProp.start + ((curProp.velocity * time) + (curProp.acceleration * tt)); + if (curProp.m) { + val = curProp.m(val, target); + } + if (curProp.f) { + target[curProp.p](val); + } else { + target[curProp.p] = val; + } + } + } + } + + }), + p = PhysicsPropsPlugin.prototype; + + p._kill = function(lookup) { + var i = this._props.length; + while (--i > -1) { + if (this._props[i].p in lookup) { + this._props.splice(i, 1); + } + } + return this._super._kill.call(this, lookup); + }; + + p._mod = function(lookup) { + var i = this._props.length, + val; + while (--i > -1) { + val = lookup[this._props[i].p] || lookup.physicsProps; + if (typeof(val) === "function") { + this._props[i].m = val; + } + } + }; + + PhysicsPropsPlugin._autoCSS = true; //indicates that this plugin can be inserted into the "css" object using the autoCSS feature of TweenLite + PhysicsPropsPlugin._cssRegister = function() { + var CSSPlugin = _globals.CSSPlugin; + if (!CSSPlugin) { + return; + } + var _internals = CSSPlugin._internals, + _parseToProxy = _internals._parseToProxy, + _setPluginRatio = _internals._setPluginRatio, + CSSPropTween = _internals.CSSPropTween; + _internals._registerComplexSpecialProp("physicsProps", {parser:function(t, e, prop, cssp, pt, plugin) { + plugin = new PhysicsPropsPlugin(); + var vars = {}, + p, data; + if (e.scale) { + e.scaleX = e.scaleY = e.scale; + delete e.scale; + } + for (p in e) { + vars[p] = _random++; //doesn't really matter what values we put here because the plugin will determine end values, but it'd be best of the values don't match the current ones so that CSSPlugin doesn't skip creating a CSSPropTween. + } + data = _parseToProxy(t, vars, cssp, pt, plugin); + pt = new CSSPropTween(t, "physicsProps", 0, 0, data.pt, 2); + pt.data = data; + pt.plugin = plugin; + pt.setRatio = _setPluginRatio; + plugin._onInitTween(data.proxy, e, cssp._tween); + return pt; + }}); + }; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("PhysicsPropsPlugin")); +/*! + * VERSION: 0.2.1 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * PixiPlugin is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof module !== "undefined" && module.exports && typeof global !== "undefined") ? global : this || window; +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push(function () { + "use strict"; + + var _numExp = /(\d|\.)+/g, + _relNumExp = /(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g, + _colorLookup = {aqua:[0,255,255], + lime:[0,255,0], + silver:[192,192,192], + black:[0,0,0], + maroon:[128,0,0], + teal:[0,128,128], + blue:[0,0,255], + navy:[0,0,128], + white:[255,255,255], + fuchsia:[255,0,255], + olive:[128,128,0], + yellow:[255,255,0], + orange:[255,165,0], + gray:[128,128,128], + purple:[128,0,128], + green:[0,128,0], + red:[255,0,0], + pink:[255,192,203], + cyan:[0,255,255], + transparent:[255,255,255,0]}, + _hue = function(h, m1, m2) { + h = (h < 0) ? h + 1 : (h > 1) ? h - 1 : h; + return ((((h * 6 < 1) ? m1 + (m2 - m1) * h * 6 : (h < 0.5) ? m2 : (h * 3 < 2) ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * 255) + 0.5) | 0; + }, + /** + * @private Parses a color (like #9F0, #FF9900, rgb(255,51,153) or hsl(108, 50%, 10%)) into an array with 3 elements for red, green, and blue or if "format" parameter is "hsl", it will populate the array with hue, saturation, and lightness values. Or if "format" is "number", it'll return a number like 0xFF0000 instead of an array. If a relative value is found in an hsl() or hsla() string, it will preserve those relative prefixes and all the values in the array will be strings instead of numbers (in all other cases it will be populated with numbers). + * @param {(string|number)} v The value the should be parsed which could be a string like #9F0 or rgb(255,102,51) or rgba(255,0,0,0.5) or it could be a number like 0xFF00CC or even a named color like red, blue, purple, etc. + * @param {(string)} format If "hsl", an hsl() or hsla() value will be returned instead of rgb() or rgba(). Or if "number", then a numeric value will be returned, like 0xFF0000. Default is rgb. + * @return {(array|number)} An array containing red, green, and blue (and optionally alpha) in that order, or if the format parameter was "hsl", the array will contain hue, saturation and lightness (and optionally alpha) in that order. Or if "format" is defined as "number", it'll return a number like 0xFF0000. Always numbers unless there's a relative prefix found in an hsl() or hsla() string and "format" is "hsl". + */ + _parseColor = function(v, format) { + var toHSL = (format === "hsl"), + a, r, g, b, h, s, l, max, min, d, wasHSL; + if (!v) { + a = _colorLookup.black; + } else if (typeof(v) === "number") { + a = [v >> 16, (v >> 8) & 255, v & 255]; + } else { + if (v.charAt(v.length - 1) === ",") { //sometimes a trailing comma is included and we should chop it off (typically from a comma-delimited list of values like a textShadow:"2px 2px 2px blue, 5px 5px 5px rgb(255,0,0)" - in this example "blue," has a trailing comma. We could strip it out inside parseComplex() but we'd need to do it to the beginning and ending values plus it wouldn't provide protection from other potential scenarios like if the user passes in a similar value. + v = v.substr(0, v.length - 1); + } + if (_colorLookup[v]) { + a = _colorLookup[v]; + } else if (v.charAt(0) === "#") { + if (v.length === 4) { //for shorthand like #9F0 + r = v.charAt(1); + g = v.charAt(2); + b = v.charAt(3); + v = "#" + r + r + g + g + b + b; + } + v = parseInt(v.substr(1), 16); + a = [v >> 16, (v >> 8) & 255, v & 255]; + } else if (v.substr(0, 3) === "hsl") { + a = wasHSL = v.match(_numExp); + if (!toHSL) { + h = (Number(a[0]) % 360) / 360; + s = Number(a[1]) / 100; + l = Number(a[2]) / 100; + g = (l <= 0.5) ? l * (s + 1) : l + s - l * s; + r = l * 2 - g; + if (a.length > 3) { + a[3] = Number(v[3]); + } + a[0] = _hue(h + 1 / 3, r, g); + a[1] = _hue(h, r, g); + a[2] = _hue(h - 1 / 3, r, g); + } else if (v.indexOf("=") !== -1) { //if relative values are found, just return the raw strings with the relative prefixes in place. + return v.match(_relNumExp); + } + } else { + a = v.match(_numExp) || _colorLookup.transparent; + } + a[0] = Number(a[0]); + a[1] = Number(a[1]); + a[2] = Number(a[2]); + if (a.length > 3) { + a[3] = Number(a[3]); + } + } + if (toHSL && !wasHSL) { + r = a[0] / 255; + g = a[1] / 255; + b = a[2] / 255; + max = Math.max(r, g, b); + min = Math.min(r, g, b); + l = (max + min) / 2; + if (max === min) { + h = s = 0; + } else { + d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + h = (max === r) ? (g - b) / d + (g < b ? 6 : 0) : (max === g) ? (b - r) / d + 2 : (r - g) / d + 4; + h *= 60; + } + a[0] = (h + 0.5) | 0; + a[1] = (s * 100 + 0.5) | 0; + a[2] = (l * 100 + 0.5) | 0; + } + return (format === "number") ? (a[0] << 16 | a[1] << 8 | a[2]) : a; + }, + _formatColors = function(s, toHSL) { + var colors = (s + "").match(_colorExp) || [], + charIndex = 0, + parsed = "", + i, color, temp; + if (!colors.length) { + return s; + } + for (i = 0; i < colors.length; i++) { + color = colors[i]; + temp = s.substr(charIndex, s.indexOf(color, charIndex)-charIndex); + charIndex += temp.length + color.length; + color = _parseColor(color, (toHSL ? "hsl" : "rgb")); + if (color.length === 3) { + color.push(1); + } + parsed += temp + (toHSL ? "hsla(" + color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : "rgba(" + color.join(",")) + ")"; + } + return parsed + s.substr(charIndex); + }, _colorStringFilter, + TweenLite = (_gsScope.GreenSockGlobals || _gsScope).TweenLite, + _colorExp = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3}){1,2}\\b", //we'll dynamically build this Regular Expression to conserve file size. After building it, it will be able to find rgb(), rgba(), # (hexadecimal), and named color values like red, blue, purple, etc. + + _idMatrix = [1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0], + _lumR = 0.212671, + _lumG = 0.715160, + _lumB = 0.072169, + + _applyMatrix = function(m, m2) { + var temp = [], + i = 0, + z = 0, + y, x; + for (y = 0; y < 4; y++) { + for (x = 0; x < 5; x++) { + z = (x === 4) ? m[i + 4] : 0; + temp[i + x] = m[i] * m2[x] + m[i+1] * m2[x + 5] + m[i+2] * m2[x + 10] + m[i+3] * m2[x + 15] + z; + } + i += 5; + } + return temp; + }, + + _setSaturation = function(m, n) { + var inv = 1 - n, + r = inv * _lumR, + g = inv * _lumG, + b = inv * _lumB; + return _applyMatrix([r + n, g, b, 0, 0, r, g + n, b, 0, 0, r, g, b + n, 0, 0, 0, 0, 0, 1, 0], m); + }, + + _colorize = function(m, color, amount) { + var c = _parseColor(color), + r = c[0] / 255, + g = c[1] / 255, + b = c[2] / 255, + inv = 1 - amount; + return _applyMatrix([inv + amount * r * _lumR, amount * r * _lumG, amount * r * _lumB, 0, 0, amount * g * _lumR, inv + amount * g * _lumG, amount * g * _lumB, 0, 0, amount * b * _lumR, amount * b * _lumG, inv + amount * b * _lumB, 0, 0, 0, 0, 0, 1, 0], m); + }, + + _setHue = function(m, n) { + n *= Math.PI / 180; + var c = Math.cos(n), + s = Math.sin(n); + return _applyMatrix([(_lumR + (c * (1 - _lumR))) + (s * (-_lumR)), (_lumG + (c * (-_lumG))) + (s * (-_lumG)), (_lumB + (c * (-_lumB))) + (s * (1 - _lumB)), 0, 0, (_lumR + (c * (-_lumR))) + (s * 0.143), (_lumG + (c * (1 - _lumG))) + (s * 0.14), (_lumB + (c * (-_lumB))) + (s * -0.283), 0, 0, (_lumR + (c * (-_lumR))) + (s * (-(1 - _lumR))), (_lumG + (c * (-_lumG))) + (s * _lumG), (_lumB + (c * (1 - _lumB))) + (s * _lumB), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], m); + }, + + _setContrast = function(m, n) { + return _applyMatrix([n,0,0,0,0.5 * (1 - n), 0,n,0,0,0.5 * (1 - n), 0,0,n,0,0.5 * (1 - n), 0,0,0,1,0], m); + }, + + _getFilter = function(t, type) { + var filterClass = _gsScope.PIXI.filters[type], + filters = t.filters || [], + i = filters.length, + filter; + if (!filterClass) { + throw("PixiPlugin error: " + type + " isn't present."); + } + while (--i > -1) { + if (filters[i] instanceof filterClass) { + return filters[i]; + } + } + filter = new filterClass(); + if (type === "BlurFilter") { + filter.blur = 0; + } + filters.push(filter); + t.filters = filters; + return filter; + }, + + _addColorMatrixFilterCacheTween = function(p, pg, cache, vars) { //we cache the ColorMatrixFilter components in a _gsColorMatrixFilter object attached to the target object so that it's easy to grab the current value at any time. + pg._addTween(cache, p, cache[p], vars[p], p); + pg._overwriteProps.push(p); + }, + + _applyBrightnessToMatrix = function(brightness, matrix) { + var temp = new _gsScope.PIXI.filters.ColorMatrixFilter(); + temp.matrix = matrix; + temp.brightness(brightness, true); + return temp.matrix; + }, + + _CMFdefaults = {contrast:1, saturation:1, colorizeAmount:0, colorize:"rgb(255,255,255)", hue:0, brightness:1}, + + _parseColorMatrixFilter = function(t, v, pg) { + var filter = _getFilter(t, "ColorMatrixFilter"), + cache = t._gsColorMatrixFilter = t._gsColorMatrixFilter || {contrast:1, saturation:1, colorizeAmount:0, colorize:"rgb(255,255,255)", hue:0, brightness:1}, + combine = v.combineCMF && !("colorMatrixFilter" in v && !v.colorMatrixFilter), + i, matrix, startMatrix; + startMatrix = filter.matrix; + if (v.resolution) { + filter.resolution = v.resolution; + } + if (v.matrix && v.matrix.length === startMatrix.length) { + matrix = v.matrix; + if (cache.contrast !== 1) { + _addColorMatrixFilterCacheTween("contrast", pg, cache, _CMFdefaults); + } + if (cache.hue) { + _addColorMatrixFilterCacheTween("hue", pg, cache, _CMFdefaults); + } + if (cache.brightness !== 1) { + _addColorMatrixFilterCacheTween("brightness", pg, cache, _CMFdefaults); + } + if (cache.colorizeAmount) { + _addColorMatrixFilterCacheTween("colorize", pg, cache, _CMFdefaults); + _addColorMatrixFilterCacheTween("colorizeAmount", pg, cache, _CMFdefaults); + } + if (cache.saturation !== 1) { + _addColorMatrixFilterCacheTween("saturation", pg, cache, _CMFdefaults); + } + + } else { + matrix = _idMatrix.slice(); + if (v.contrast != null) { + matrix = _setContrast(matrix, Number(v.contrast)); + _addColorMatrixFilterCacheTween("contrast", pg, cache, v); + } else if (cache.contrast !== 1) { + if (combine) { + matrix = _setContrast(matrix, cache.contrast); + } else { + _addColorMatrixFilterCacheTween("contrast", pg, cache, _CMFdefaults); + } + } + if (v.hue != null) { + matrix = _setHue(matrix, Number(v.hue)); + _addColorMatrixFilterCacheTween("hue", pg, cache, v); + } else if (cache.hue) { + if (combine) { + matrix = _setHue(matrix, cache.hue); + } else { + _addColorMatrixFilterCacheTween("hue", pg, cache, _CMFdefaults); + } + } + if (v.brightness != null) { + matrix = _applyBrightnessToMatrix(Number(v.brightness), matrix); + _addColorMatrixFilterCacheTween("brightness", pg, cache, v); + } else if (cache.brightness !== 1) { + if (combine) { + matrix = _applyBrightnessToMatrix(cache.brightness, matrix); + } else { + _addColorMatrixFilterCacheTween("brightness", pg, cache, _CMFdefaults); + } + } + if (v.colorize != null) { + v.colorizeAmount = ("colorizeAmount" in v) ? Number(v.colorizeAmount) : 1; + matrix = _colorize(matrix, v.colorize, v.colorizeAmount); + _addColorMatrixFilterCacheTween("colorize", pg, cache, v); + _addColorMatrixFilterCacheTween("colorizeAmount", pg, cache, v); + } else if (cache.colorizeAmount) { + if (combine) { + matrix = _colorize(matrix, cache.colorize, cache.colorizeAmount); + } else { + _addColorMatrixFilterCacheTween("colorize", pg, cache, _CMFdefaults); + _addColorMatrixFilterCacheTween("colorizeAmount", pg, cache, _CMFdefaults); + } + } + if (v.saturation != null) { + matrix = _setSaturation(matrix, Number(v.saturation)); + _addColorMatrixFilterCacheTween("saturation", pg, cache, v); + } else if (cache.saturation !== 1) { + if (combine) { + matrix = _setSaturation(matrix, cache.saturation); + } else { + _addColorMatrixFilterCacheTween("saturation", pg, cache, _CMFdefaults); + } + } + } + i = matrix.length; + while (--i > -1) { + if (matrix[i] !== startMatrix[i]) { + pg._addTween(startMatrix, i, startMatrix[i], matrix[i], "colorMatrixFilter"); + } + } + pg._overwriteProps.push("colorMatrixFilter"); + }, + + _addColorTween = function(target, p, value, colorSetter, plugin) { + var pt = colorSetter._firstPT = {_next:colorSetter._firstPT, t:target, p:p, proxy:{}, f:(typeof(target[p]) === "function")}; + pt.proxy[p] = "rgb(" + _parseColor(!pt.f ? target[p] : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]()).join(",") + ")"; + plugin._addTween(pt.proxy, p, "get", ((typeof(value) === "number") ? "rgb(" + _parseColor(value, false).join(",") + ")" : value), p, null, null, _colorStringFilter); + }, + + //to improve performance, when a color is sensed, we hijack the setRatio() method of the plugin instance with a new function that this method spits back. This is a special method that handles parsing color values on-the-fly and turns them into numeric values which PixiJS requires. In other words, instead of "rgb(255, 0, 0)", PixiJS wants 0xFF0000. This also works with hsl() values. + _buildColorSetter = function(tween, plugin) { + var setRatio = plugin.setRatio, //save the original (super) setRatio() function + func = function(v) { + var pt = func._firstPT, + val; + setRatio.call(plugin, v); + while (pt) { + val = _parseColor(pt.proxy[pt.p], "number"); + if (pt.f) { + pt.t[pt.p](val); + } else { + pt.t[pt.p] = val; + } + pt = pt._next; + } + if (func.graphics) { //in order for PixiJS to actually redraw GraphicsData, we've gotta increment the "dirty" and "clearDirty" values. If we don't do this, the values will be tween properly, but not rendered. + func.graphics.dirty++; + func.graphics.clearDirty++; + } + }; + plugin.setRatio = func; + return func; + }, + + + _colorProps = {tint:1, lineColor:1, fillColor:1}, + _xyContexts = "position,scale,skew,pivot,anchor,tilePosition,tileScale".split(","), + _contexts = {x:"position", y:"position", tileX:"tilePosition", tileY:"tilePosition"}, + _colorMatrixFilterProps = {colorMatrixFilter:1, saturation:1, contrast:1, hue:1, colorize:1, colorizeAmount:1, brightness:1, combineCMF:1}, + _DEG2RAD = Math.PI / 180, + _degreesToRadians = function(value) { + return (typeof(value) === "string" && value.charAt(1) === "=") ? value.substr(0, 2) + (parseFloat(value.substr(2)) * _DEG2RAD) : value * _DEG2RAD; + }, i, p; + + //context setup... + for (i = 0; i < _xyContexts.length; i++) { + p = _xyContexts[i]; + _contexts[p + "X"] = p; + _contexts[p + "Y"] = p; + } + + //color parsing setup... + for (p in _colorLookup) { + _colorExp += "|" + p + "\\b"; + } + _colorExp = new RegExp(_colorExp+")", "gi"); + _colorStringFilter = function(a) { + var combined = a[0] + " " + a[1], + toHSL; + _colorExp.lastIndex = 0; + if (_colorExp.test(combined)) { + toHSL = (combined.indexOf("hsl(") !== -1 || combined.indexOf("hsla(") !== -1); + a[0] = _formatColors(a[0], toHSL); + a[1] = _formatColors(a[1], toHSL); + } + }; + + if (!TweenLite.defaultStringFilter) { + TweenLite.defaultStringFilter = _colorStringFilter; + } + + var PixiPlugin = _gsScope._gsDefine.plugin({ + propName: "pixi", + priority: 0, + API: 2, + global: true, + version: "0.2.1", + + init: function (target, values, tween, index) { + if (!target instanceof _gsScope.PIXI.DisplayObject) { + return false; + } + var context, axis, value, colorMatrix, filter, p, padding, colorSetter, i, data, pt; + for (p in values) { + context = _contexts[p]; + value = values[p]; + if (typeof(value) === "function") { + value = value(index || 0, target); + } + if (context) { + axis = (p.charAt(p.length-1).toLowerCase().indexOf("x") !== -1) ? "x" : "y"; + this._addTween(target[context], axis, target[context][axis], (context === "skew") ? _degreesToRadians(value) : value, p); + } else if (p === "scale" || p === "anchor" || p === "pivot" || p === "tileScale") { + this._addTween(target[p], "x", target[p].x, value, p + "X"); + this._addTween(target[p], "y", target[p].y, value, p + "Y"); + } else if (p === "rotation") { //PIXI expects rotation in radians, but as a convenience we let folks define it in degrees and we do the conversion. + this._addTween(target, p, target.rotation, _degreesToRadians(value), p); + + } else if (_colorMatrixFilterProps[p]) { + if (!colorMatrix) { + _parseColorMatrixFilter(target, values.colorMatrixFilter || values, this); + colorMatrix = true; + } + } else if (p === "blur" || p === "blurX" || p === "blurY" || p === "blurPadding") { + filter = _getFilter(target, "BlurFilter"); + this._addTween(filter, p, filter[p], value, p); + if (values.blurPadding !== 0) { + padding = values.blurPadding || Math.max(filter[p], value) * 2; + i = target.filters.length; + while (--i > -1) { + target.filters[i].padding = Math.max(target.filters[i].padding, padding); //if we don't expand the padding on all the filters, it can look clipped. + } + } + } else if (_colorProps[p]) { + if (!colorSetter) { + colorSetter = _buildColorSetter(tween, this); + } + if ((p === "lineColor" || p === "fillColor") && target instanceof _gsScope.PIXI.Graphics) { + data = target.graphicsData; + i = data.length; + while (--i > -1) { + _addColorTween(data[i], p, value, colorSetter, this); + } + colorSetter.graphics = target; + } else { + _addColorTween(target, p, value, colorSetter, this); + } + } else if (p === "autoAlpha") { + this._firstPT = pt = {t: {setRatio:function() { target.visible = !!target.alpha; }}, p: "setRatio", s: 0, c: 1, f: 1, pg: 0, n: "visible", pr: 0, m: 0, _next:this._firstPT}; + if (pt._next) { + pt._next._prev = pt; + } + this._addTween(target, "alpha", target.alpha, value, "alpha"); + this._overwriteProps.push("alpha", "visible"); + } else { + this._addTween(target, p, target[p], value, p); + } + this._overwriteProps.push(p); + } + return true; + } + }); + + PixiPlugin.colorProps = _colorProps; + PixiPlugin.parseColor = _parseColor; + PixiPlugin.formatColors = _formatColors; + PixiPlugin.colorStringFilter = _colorStringFilter; + + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("PixiPlugin")); +/*! + * VERSION: 0.2.2 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _NaNExp = /[^\d\-\.]/g, + _DEG2RAD = Math.PI / 180, + _numExp = /(\d|\.)+/g, + _colorLookup = {aqua:[0,255,255], + lime:[0,255,0], + silver:[192,192,192], + black:[0,0,0], + maroon:[128,0,0], + teal:[0,128,128], + blue:[0,0,255], + navy:[0,0,128], + white:[255,255,255], + fuchsia:[255,0,255], + olive:[128,128,0], + yellow:[255,255,0], + orange:[255,165,0], + gray:[128,128,128], + purple:[128,0,128], + green:[0,128,0], + red:[255,0,0], + pink:[255,192,203], + cyan:[0,255,255], + transparent:[255,255,255,0]}, + //parses a color (like #9F0, #FF9900, or rgb(255,51,153)) into an array with 3 elements for red, green, and blue. Also handles rgba() values (splits into array of 4 elements of course) + _parseColor = function(color) { + if (typeof(color) === "number") { + return [color >> 16, (color >> 8) & 255, color & 255]; + } else if (color === "" || color == null || color === "none" || typeof(color) !== "string") { + return _colorLookup.transparent; + } else if (_colorLookup[color]) { + return _colorLookup[color]; + } else if (color.charAt(0) === "#") { + if (color.length === 4) { //for shorthand like #9F0 + color = "#" + color.charAt(1) + color.charAt(1) + color.charAt(2) + color.charAt(2) + color.charAt(3) + color.charAt(3); + } + color = parseInt(color.substr(1), 16); + return [color >> 16, (color >> 8) & 255, color & 255]; + } + return color.match(_numExp) || _colorLookup.transparent; + }, + + _transformMap = {scaleX:1, scaleY:1, tx:1, ty:1, rotation:1, shortRotation:1, skewX:1, skewY:1, scale:1}, + + //parses the transform values for an element, returning an object with x, y, scaleX, scaleY, rotation, skewX, and skewY properties. Note: by default (for performance reasons), all skewing is combined into skewX and rotation but skewY still has a place in the transform object so that we can record how much of the skew is attributed to skewX vs skewY. Remember, a skewY of 10 looks the same as a rotation of 10 and skewX of -10. + _getTransform = function(t, rec) { + var s = t.matrix, + min = 0.000001, + a = s.a, + b = s.b, + c = s.c, + d = s.d, + m = rec ? t._gsTransform || {skewY:0} : {skewY:0}, + invX = (m.scaleX < 0); //in order to interpret things properly, we need to know if the user applied a negative scaleX previously so that we can adjust the rotation and skewX accordingly. Otherwise, if we always interpret a flipped matrix as affecting scaleY and the user only wants to tween the scaleX on multiple sequential tweens, it would keep the negative scaleY without that being the user's intent. + + m.tx = s.e - (m.ox || 0); //ox is the offset x that we record in setRatio() whenever we apply a custom transform that might use a pivot point. Remember, s.e and s.f get affected by things like scale. For example, imagine an object whose top left corner is at 100,100 and then we scale it up to 300% using the center as the pivot point - that corner would now be very different even though to the user, they didn't intend to change/tween the x/y position per se. Therefore, we record whatever offsets we make so that we can compensate when reading the values back. + m.ty = s.f - (m.oy || 0); //oy is the offset y (see note above) + m.scaleX = Math.sqrt(a * a + b * b); + m.scaleY = Math.sqrt(d * d + c * c); + m.rotation = (a || b) ? Math.atan2(b, a) : m.rotation || 0; //note: if scaleX is 0, we cannot accurately measure rotation. Same for skewX with a scaleY of 0. Therefore, we default to the previously recorded value (or zero if that doesn't exist). + m.skewX = (c || d) ? Math.atan2(c, d) + m.rotation : m.skewX || 0; + if (Math.abs(m.skewX) > Math.PI / 2) { + if (invX) { + m.scaleX *= -1; + m.skewX += (m.rotation <= 0) ? Math.PI : -Math.PI; + m.rotation += (m.rotation <= 0) ? Math.PI : -Math.PI; + } else { + m.scaleY *= -1; + m.skewX += (m.skewX <= 0) ? Math.PI : -Math.PI; + } + } + //some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 0 in these cases. The conditional logic here is faster than calling Math.abs(). + if (m.rotation < min) if (m.rotation > -min) if (a || b) { + m.rotation = 0; + } + if (m.skewX < min) if (m.skewX > -min) if (b || c) { + m.skewX = 0; + } + if (rec) { + t._gsTransform = m; //record to the object's _gsTransform which we use so that tweens can control individual properties independently (we need all the properties to accurately recompose the matrix in the setRatio() method) + } + return m; + }, + + //takes a value and a default number, checks if the value is relative, null, or numeric and spits back a normalized number accordingly. Primarily used in the _parseTransform() function. + _parseVal = function(v, d) { + return (v == null) ? d : (typeof(v) === "string" && v.indexOf("=") === 1) ? parseInt(v.charAt(0)+"1", 10) * Number(v.substr(2)) + d : Number(v); + }, + + //translates strings like "40deg" or "40" or 40rad" or "+=40deg" to a numeric radian angle, optionally relative to a default value (if "+=" or "-=" prefix is found) + _parseAngle = function(v, d) { + var m = (v.indexOf("rad") === -1) ? _DEG2RAD : 1, + r = (v.indexOf("=") === 1); + v = Number(v.replace(_NaNExp, "")) * m; + return r ? v + d : v; + }, + + + RaphaelPlugin = _gsScope._gsDefine.plugin({ + propName: "raphael", + version: "0.2.2", + API: 2, + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween) { + if (!target.attr) { //raphael must have attr() method + return false; + } + this._target = target; + this._tween = tween; + this._props = target._gsProps = target._gsProps || {}; + var p, s, v, pt, clr1, clr2, rel; + + for (p in value) { + + v = value[p]; + + if (p === "transform") { + this._parseTransform(target, v); + continue; + } else if (_transformMap[p] || p === "pivot") { + this._parseTransform(target, value); + continue; + } + + s = target.attr(p); + + //Some of these properties are in place in order to conform with the standard PropTweens in TweenPlugins so that overwriting and roundProps occur properly. For example, f and r may seem unnecessary here, but they enable other functionality. + //_next:* next linked list node [object] + //t: * target [object] + //p: * property (camelCase) [string] + //s: * starting value [number] + //c: * change value [number] + //f: * is function [boolean] + //n: * name (for overwriting) [string] + //b: beginning value [string] + //i: intermediate value [string] + //e: ending value [string] + //r: * round [boolean] + //type: 0=normal, 1=color, 2=rgba, -1=non-tweening prop [number] + this._firstPT = pt = {_next:this._firstPT, + t:this._props, + p:p, + b:s, + f:false, + n:"raphael_" + p, + r:false, + type:0}; + + //color values must be split apart into their R, G, B (and sometimes alpha) values and tweened independently. + if (p === "fill" || p === "stroke") { + clr1 = _parseColor(s); + clr2 = _parseColor(v); + pt.e = v; + pt.s = Number(clr1[0]); //red starting value + pt.c = Number(clr2[0]) - pt.s; //red change + pt.gs = Number(clr1[1]); //green starting value + pt.gc = Number(clr2[1]) - pt.gs; //green change + pt.bs = Number(clr1[2]); //blue starting value + pt.bc = Number(clr2[2]) - pt.bs; //blue change + if (clr1.length > 3 || clr2.length > 3) { //detect an rgba() value + pt.as = (clr1.length < 4) ? 1 : Number(clr1[3]); + pt.ac = ((clr2.length < 4) ? 1 : Number(clr2[3])) - pt.as; + pt.type = 2; //2 = rgba() tween + } else { + pt.type = 1; //1 = color tween, -1 = no tween, just set the value at the end because there's no changes + } + + } else { + + s = (typeof(s) === "string") ? parseFloat(s.replace(_NaNExp, "")) : Number(s); + + if (typeof(v) === "string") { + rel = (v.charAt(1) === "="); + v = parseFloat(v.replace(_NaNExp, "")); + } else { + rel = false; + } + + pt.e = (v || v === 0) ? (rel ? v + s : v) : value[p]; //ensures that any += or -= prefixes are taken care of. + + if ((s || s === 0) && (v || v === 0) && (pt.c = (rel ? v : v - s))) { //faster than isNaN(). Also, we set pt.c (change) here because if it's 0, we'll just treat it like a non-tweening value. can't do (v !== start) because if it's a relative value and the CHANGE is identical to the START, the condition will fail unnecessarily. + pt.s = s; + } else { + pt.type = -1; + pt.i = value[p]; //intermediate value is typically the same as the end value. + pt.s = pt.c = 0; + } + + } + + this._overwriteProps.push("raphael_" + p); + if (pt._next) { + pt._next._prev = pt; + } + } + + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(v) { + var pt = this._firstPT, val; + + while (pt) { + val = pt.c * v + pt.s; + if (pt.r) { + val = Math.round(val); + } + if (!pt.type) { + pt.t[pt.p] = val; + } else if (pt.type === 1) { //rgb() + pt.t[pt.p] = "rgb(" + (val >> 0) + ", " + ((pt.gs + (v * pt.gc)) >> 0) + ", " + ((pt.bs + (v * pt.bc)) >> 0) + ")"; + } else if (pt.type === 2) { //rgba() + pt.t[pt.p] = "rgba(" + (val >> 0) + ", " + ((pt.gs + (v * pt.gc)) >> 0) + ", " + ((pt.bs + (v * pt.bc)) >> 0) + ", " + (pt.as + (v * pt.ac)) + ")"; + } else if (pt.type === -1) { //non-tweening + pt.t[pt.p] = pt.i; + } + pt = pt._next; + } + + this._target.attr(this._props); + + //apply transform values like x, y, scaleX, scaleY, rotation, skewX, or skewY. We do these after looping through all the PropTweens because those are where the changes are made to scaleX/scaleY/rotation/skewX/skewY/x/y. + if (this._transform) { + pt = this._transform; //to improve speed and reduce size, reuse the pt variable as an alias to the _transform property + var ang = pt.rotation, + skew = ang - pt.skewX, + a = Math.cos(ang) * pt.scaleX, + b = Math.sin(ang) * pt.scaleX, + c = Math.sin(skew) * -pt.scaleY, + d = Math.cos(skew) * pt.scaleY, + min = 0.000001, + pxl = this._pxl, + pyl = this._pyl; + + //some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 0 in these cases for both b and c. The conditional logic here is faster than calling Math.abs(). + if (b < min) if (b > -min) { + b = 0; + } + if (c < min) if (c > -min) { + c = 0; + } + pt.ox = this._pxg - (pxl * a + pyl * c); //we must record the offset x/y that we're making from the regular tx/ty (matrix.e and f) so that we can correctly interpret positional data in _getTransform(). See note there on tx and ox. + pt.oy = this._pyg - (pxl * b + pyl * d); + this._target.transform("m" + a + "," + b + "," + c + "," + d + "," + (pt.tx + pt.ox) + "," + (pt.ty + pt.oy)); + } + + } + + }), + p = RaphaelPlugin.prototype; + + //compares the beginning x, y, scaleX, scaleY, rotation, and skewX properties with the ending ones and adds PropTweens accordingly wherever necessary. We must tween them individually (rather than just tweening the matrix values) so that elgant overwriting can occur, like if one tween is controlling scaleX, scaleY, and rotation and then another one starts mid-tween that is trying to control the scaleX only - this tween should continue tweening scaleY and rotation. + p._parseTransform = function(t, v) { + if (this._transform) { return; } //only need to parse the transform once, and only if the browser supports it. + + var m1 = this._transform = _getTransform(t, true), + min = 0.000001, + m2, skewY, p, pt, copy, dx, dy, mtx, pivot; + + if (typeof(v) === "object") { //for values like scaleX, scaleY, rotation, x, y, skewX, and skewY or transform:{...} (object) + + m2 = {scaleX:_parseVal((v.scaleX != null) ? v.scaleX : v.scale, m1.scaleX), + scaleY:_parseVal((v.scaleY != null) ? v.scaleY : v.scale, m1.scaleY), + tx:_parseVal(v.tx, m1.tx), + ty:_parseVal(v.ty, m1.ty)}; + + if (v.shortRotation != null) { + m2.rotation = (typeof(v.shortRotation) === "number") ? v.shortRotation * _DEG2RAD : _parseAngle(v.shortRotation, m1.rotation); + var dif = (m2.rotation - m1.rotation) % (Math.PI * 2); + if (dif !== dif % Math.PI) { + dif += Math.PI * ((dif < 0) ? 2 : -2); + } + m2.rotation = m1.rotation + dif; + + } else { + m2.rotation = (v.rotation == null) ? m1.rotation : (typeof(v.rotation) === "number") ? v.rotation * _DEG2RAD : _parseAngle(v.rotation, m1.rotation); + } + m2.skewX = (v.skewX == null) ? m1.skewX : (typeof(v.skewX) === "number") ? v.skewX * _DEG2RAD : _parseAngle(v.skewX, m1.skewX); + + //note: for performance reasons, we combine all skewing into the skewX and rotation values, ignoring skewY but we must still record it so that we can discern how much of the overall skew is attributed to skewX vs. skewY. Otherwise, if the skewY would always act relative (tween skewY to 10deg, for example, multiple times and if we always combine things into skewX, we can't remember that skewY was 10 from last time). Remember, a skewY of 10 degrees looks the same as a rotation of 10 degrees plus a skewX of -10 degrees. + m2.skewY = (v.skewY == null) ? m1.skewY : (typeof(v.skewY) === "number") ? v.skewY * _DEG2RAD : _parseAngle(v.skewY, m1.skewY); + if ((skewY = m2.skewY - m1.skewY)) { + m2.skewX += skewY; + m2.rotation += skewY; + } + //don't allow rotation/skew values to be a SUPER small decimal because when they're translated back to strings for setting the css property, the browser reports them in a funky way, like 1-e7. Of course we could use toFixed() to resolve that issue but that hurts performance quite a bit with all those function calls on every frame, plus it is virtually impossible to discern values that small visually (nobody will notice changing a rotation of 0.0000001 to 0, so the performance improvement is well worth it). + if (m2.skewY < min) if (m2.skewY > -min) { + m2.skewY = 0; + } + if (m2.skewX < min) if (m2.skewX > -min) { + m2.skewX = 0; + } + if (m2.rotation < min) if (m2.rotation > -min) { + m2.rotation = 0; + } + + pivot = v.localPivot || v.globalPivot; + + if (typeof(pivot) === "string") { + copy = pivot.split(","); + dx = Number(copy[0]); + dy = Number(copy[1]); + } else if (typeof(pivot) === "object") { + dx = Number(pivot.x); + dy = Number(pivot.y); + } else if (v.localPivot) { + copy = t.getBBox(true); + dx = copy.width / 2; + dy = copy.height / 2; + } else { + copy = t.getBBox(); + dx = copy.x + copy.width / 2; + dy = copy.y + copy.height / 2; + } + + if (v.localPivot) { + mtx = t.matrix; + dx += t.attr("x"); + dy += t.attr("y"); + this._pxl = dx; + this._pyl = dy; + this._pxg = dx * mtx.a + dy * mtx.c + mtx.e - m1.tx; + this._pyg = dx * mtx.b + dy * mtx.d + mtx.f - m1.ty; + } else { + mtx = t.matrix.invert(); + this._pxl = dx * mtx.a + dy * mtx.c + mtx.e; + this._pyl = dx * mtx.b + dy * mtx.d + mtx.f; + this._pxg = dx - m1.tx; + this._pyg = dy - m1.ty; + } + + } else if (typeof(v) === "string") { //for values like transform:"rotate(60deg) scale(0.5, 0.8)" + copy = this._target.transform(); + t.transform(v); + m2 = _getTransform(t, false); + t.transform(copy); + } else { + return; + } + + for (p in _transformMap) { + if (m1[p] !== m2[p]) if (p !== "shortRotation") if (p !== "scale") { + this._firstPT = pt = {_next:this._firstPT, t:m1, p:p, s:m1[p], c:m2[p] - m1[p], n:p, f:false, r:false, b:m1[p], e:m2[p], type:0}; + if (pt._next) { + pt._next._prev = pt; + } + this._overwriteProps.push("raphael_" + p); + } + } + }; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } +/*! + * VERSION: 1.7.0 + * DATE: 2018-05-21 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + **/ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var RoundPropsPlugin = _gsScope._gsDefine.plugin({ + propName: "roundProps", + version: "1.7.0", + priority: -1, + API: 2, + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween) { + this._tween = tween; + return true; + } + + }), + _getRoundFunc = function(v) { //pass in 0.1 get a function that'll round to the nearest tenth, or 5 to round to the closest 5, or 0.001 to the closest 1000th, etc. + var p = v < 1 ? Math.pow(10, (v + "").length - 2) : 1; //to avoid floating point math errors (like 24 * 0.1 == 2.4000000000000004), we chop off at a specific number of decimal places (much faster than toFixed() + return function(n) { + return ((Math.round(n / v) * v * p) | 0) / p; + }; + }, + _roundLinkedList = function(node, mod) { + while (node) { + if (!node.f && !node.blob) { + node.m = mod || Math.round; + } + node = node._next; + } + }, + p = RoundPropsPlugin.prototype; + + p._onInitAllProps = function() { + var tween = this._tween, + rp = tween.vars.roundProps, + lookup = {}, + rpt = tween._propLookup.roundProps, + pt, next, i, p; + if (typeof(rp) === "object" && !rp.push) { + for (p in rp) { + lookup[p] = _getRoundFunc(rp[p]); + } + } else { + if (typeof(rp) === "string") { + rp = rp.split(","); + } + i = rp.length; + while (--i > -1) { + lookup[rp[i]] = Math.round; + } + } + + for (p in lookup) { + pt = tween._firstPT; + while (pt) { + next = pt._next; //record here, because it may get removed + if (pt.pg) { + pt.t._mod(lookup); + } else if (pt.n === p) { + if (pt.f === 2 && pt.t) { //a blob (text containing multiple numeric values) + _roundLinkedList(pt.t._firstPT, lookup[p]); + } else { + this._add(pt.t, p, pt.s, pt.c, lookup[p]); + //remove from linked list + if (next) { + next._prev = pt._prev; + } + if (pt._prev) { + pt._prev._next = next; + } else if (tween._firstPT === pt) { + tween._firstPT = next; + } + pt._next = pt._prev = null; + tween._propLookup[p] = rpt; + } + } + pt = next; + } + } + return false; + }; + + p._add = function(target, p, s, c, mod) { + this._addTween(target, p, s, s + c, p, mod || Math.round); + this._overwriteProps.push(p); + }; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } +/*! + * VERSION: 0.5.2 + * DATE: 2019-02-07 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * ScrambleTextPlugin is a Club GreenSock membership benefit; You must have a valid membership to use + * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. + * This work is subject to the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _trimExp = /(^\s+|\s+$)/g, + _spacesExp = /\s+/g, + _getText = function(e) { + var type = e.nodeType, + result = ""; + if (type === 1 || type === 9 || type === 11) { + if (typeof(e.textContent) === "string") { + return e.textContent; + } else { + for (e = e.firstChild; e; e = e.nextSibling ) { + result += _getText(e); + } + } + } else if (type === 3 || type === 4) { + return e.nodeValue; + } + return result; + }, + _scrambleText = function(length, chars) { + var l = chars.length, + s = ""; + while (--length > -1) { + s += chars[ ((Math.random() * l) | 0) ]; + } + return s; + }, + CharSet = function(chars) { + this.chars = _emojiSafeSplit(chars); + this.sets = []; + this.length = 50; + var i; + for (i = 0; i < 20; i++) { + this.sets[i] = _scrambleText(80, this.chars); //we create 20 strings that are 80 characters long, randomly chosen and pack them into an array. We then randomly choose the scrambled text from this array in order to greatly improve efficiency compared to creating new randomized text from scratch each and every time it's needed. This is a simple lookup whereas the other technique requires looping through as many times as there are characters needed, and calling Math.random() each time through the loop, building the string, etc. + } + this.grow = function(newLength) { //if we encounter a tween that has more than 80 characters, we'll need to add to the character sets accordingly. Once it's cached, it'll only need to grow again if we exceed that new length. Again, this is an efficiency tactic. + for (i = 0; i < 20; i++) { + this.sets[i] += _scrambleText(newLength - this.length, this.chars); + } + this.length = newLength; + }; + }, + _emoji = "[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2694-\u2697]|\uD83E[\uDD10-\uDD5D]|[\uD800-\uDBFF][\uDC00-\uDFFF]", + _emojiExp = new RegExp(_emoji), + _emojiAndCharsExp = new RegExp(_emoji + "|.", "g"), + _emojiSafeSplit = function(text, delimiter, trim) { + if (trim) { + text = text.replace(_trimExp, ""); + } + return ((delimiter === "" || !delimiter) && _emojiExp.test(text)) ? text.match(_emojiAndCharsExp) : text.split(delimiter || ""); + }, + _upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", + _lower = _upper.toLowerCase(), + _charsLookup = { + upperCase: new CharSet(_upper), + lowerCase: new CharSet(_lower), + upperAndLowerCase: new CharSet(_upper + _lower) + }, + + + + ScrambleTextPlugin = _gsScope._gsDefine.plugin({ + propName: "scrambleText", + version: "0.5.2", + API: 2, + overwriteProps:["scrambleText","text"], + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween, index) { + this._prop = ("innerHTML" in target) ? "innerHTML" : ("textContent" in target) ? "textContent" : 0; // SVG text in IE doesn't have innerHTML, but it does have textContent. + if (!this._prop) { + return false; + } + if (typeof(value) === "function") { + value = value(index, target); + } + this._target = target; + if (typeof(value) !== "object") { + value = {text:value}; + } + var text = value.text || value.value, + trim = (value.trim !== false), + delim, maxLength, charset, splitByChars; + this._delimiter = delim = value.delimiter || ""; + this._original = _emojiSafeSplit(_getText(target).replace(_spacesExp, " ").split(" ").join(""), delim, trim); + if (text === "{original}" || text === true || text == null) { + text = this._original.join(delim); + } + this._text = _emojiSafeSplit((text || "").replace(_spacesExp, " "), delim, trim); + this._hasClass = false; + if (typeof(value.newClass) === "string") { + this._newClass = value.newClass; + this._hasClass = true; + } + if (typeof(value.oldClass) === "string") { + this._oldClass = value.oldClass; + this._hasClass = true; + } + splitByChars = (delim === ""); + this._textHasEmoji = (_emojiExp.test(this._text.join(delim)) && splitByChars); + this._charsHaveEmoji = !!value.chars && _emojiExp.test(value.chars); + this._length = splitByChars ? this._original.length : this._original.join(delim).length; + this._lengthDif = (splitByChars ? this._text.length : this._text.join(delim).length) - this._length; + this._fillChar = value.fillChar || (value.chars && value.chars.indexOf(" ") !== -1) ? " " : ""; + this._charSet = charset = _charsLookup[(value.chars || "upperCase")] || new CharSet(value.chars); + this._speed = 0.016 / (value.speed || 1); + this._prevScrambleTime = 0; + this._setIndex = (Math.random() * 20) | 0; + maxLength = this._length + Math.max(this._lengthDif, 0); + if (maxLength > charset.length) { + charset.grow(maxLength); + } + this._chars = charset.sets[this._setIndex]; + this._revealDelay = value.revealDelay || 0; + this._tweenLength = (value.tweenLength !== false); + this._tween = tween; + this._rightToLeft = !!value.rightToLeft; + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(ratio) { + var l = this._text.length, + delim = this._delimiter, + time = this._tween._time, + timeDif = time - this._prevScrambleTime, + i, i2, startText, endText, applyNew, applyOld, str, startClass, endClass; + if (this._revealDelay) { + if (this._tween.vars.runBackwards) { + time = this._tween._duration - time; //invert the time for from() tweens + } + ratio = (time === 0) ? 0 : (time < this._revealDelay) ? 0.000001 : (time === this._tween._duration) ? 1 : this._tween._ease.getRatio((time - this._revealDelay) / (this._tween._duration - this._revealDelay)); + } + if (ratio < 0) { + ratio = 0; + } else if (ratio > 1) { + ratio = 1; + } + if (this._rightToLeft) { + ratio = 1 - ratio; + } + i = (ratio * l + 0.5) | 0; + if (ratio) { + if (timeDif > this._speed || timeDif < -this._speed) { + this._setIndex = (this._setIndex + ((Math.random() * 19) | 0)) % 20; + this._chars = this._charSet.sets[this._setIndex]; + this._prevScrambleTime += timeDif; + } + endText = this._chars; + } else { + endText = this._original.join(delim); + } + + if (this._rightToLeft) { + if (ratio === 1 && (this._tween.vars.runBackwards || this._tween.data === "isFromStart")) { //special case for from() tweens + startText = ""; + endText = this._original.join(delim); + } else { + str = this._text.slice(i).join(delim); + if (this._charsHaveEmoji) { + startText = _emojiSafeSplit(endText).slice(0, ((this._length + (this._tweenLength ? 1 - (ratio * ratio * ratio) : 1) * this._lengthDif) - ((this._textHasEmoji ? _emojiSafeSplit(str) : str).length) + 0.5) | 0).join(""); + } else { + startText = endText.substr(0, ((this._length + (this._tweenLength ? 1 - (ratio * ratio * ratio) : 1) * this._lengthDif) - ((this._textHasEmoji ? _emojiSafeSplit(str) : str).length) + 0.5) | 0); + } + endText = str; + } + + } else { + startText = this._text.slice(0, i).join(delim); + i2 = (this._textHasEmoji ? _emojiSafeSplit(startText) : startText).length; + if (this._charsHaveEmoji) { + endText = _emojiSafeSplit(endText).slice(i2, ((this._length + (this._tweenLength ? 1 - ((ratio = 1 - ratio) * ratio * ratio * ratio) : 1) * this._lengthDif) + 0.5) | 0).join(""); + } else { + endText = endText.substr(i2, ((this._length + (this._tweenLength ? 1 - ((ratio = 1 - ratio) * ratio * ratio * ratio) : 1) * this._lengthDif) - i2 + 0.5) | 0); + } + } + + if (this._hasClass) { + startClass = this._rightToLeft ? this._oldClass : this._newClass; + endClass = this._rightToLeft ? this._newClass : this._oldClass; + applyNew = (startClass && i !== 0); + applyOld = (endClass && i !== l); + str = (applyNew ? "" : "") + startText + (applyNew ? "" : "") + (applyOld ? "" : "") + delim + endText + (applyOld ? "" : ""); + } else { + str = startText + delim + endText; + } + this._target[this._prop] = (this._fillChar === " " && str.indexOf(" ") !== -1) ? str.split(" ").join("  ") : str; + } + + }), + p = ScrambleTextPlugin.prototype; + + p._newClass = p._oldClass = ""; + for (p in _charsLookup) { + _charsLookup[p.toLowerCase()] = _charsLookup[p]; + _charsLookup[p.toUpperCase()] = _charsLookup[p]; + } + + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("ScrambleTextPlugin")); +/*! + * VERSION: 1.9.2 + * DATE: 2019-02-07 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + **/ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _doc = (_gsScope.document || {}).documentElement, + _window = _gsScope, + _max = function(element, axis) { + var dim = (axis === "x") ? "Width" : "Height", + scroll = "scroll" + dim, + client = "client" + dim, + body = document.body; + return (element === _window || element === _doc || element === body) ? Math.max(_doc[scroll], body[scroll]) - (_window["inner" + dim] || _doc[client] || body[client]) : element[scroll] - element["offset" + dim]; + }, + _unwrapElement = function(value) { + if (typeof(value) === "string") { + value = TweenLite.selector(value); + } + if (value.length && value !== _window && value[0] && value[0].style && !value.nodeType) { + value = value[0]; + } + return (value === _window || (value.nodeType && value.style)) ? value : null; + }, + _buildGetter = function(e, axis) { //pass in an element and an axis ("x" or "y") and it'll return a getter function for the scroll position of that element (like scrollTop or scrollLeft, although if the element is the window, it'll use the pageXOffset/pageYOffset or the documentElement's scrollTop/scrollLeft or document.body's. Basically this streamlines things and makes a very fast getter across browsers. + var p = "scroll" + ((axis === "x") ? "Left" : "Top"); + if (e === _window) { + if (e.pageXOffset != null) { + p = "page" + axis.toUpperCase() + "Offset"; + } else if (_doc[p] != null) { + e = _doc; + } else { + e = document.body; + } + } + return function() { + return e[p]; + }; + }, + _getOffset = function(element, container) { + var rect = _unwrapElement(element).getBoundingClientRect(), + b = document.body, + isRoot = (!container || container === _window || container === b), + cRect = isRoot ? {top:_doc.clientTop - (window.pageYOffset || _doc.scrollTop || b.scrollTop || 0), left:_doc.clientLeft - (window.pageXOffset || _doc.scrollLeft || b.scrollLeft || 0)} : container.getBoundingClientRect(), + offsets = {x: rect.left - cRect.left, y: rect.top - cRect.top}; + if (!isRoot && container) { //only add the current scroll position if it's not the window/body. + offsets.x += _buildGetter(container, "x")(); + offsets.y += _buildGetter(container, "y")(); + } + return offsets; + /* PREVIOUS + var rect = _unwrapElement(element).getBoundingClientRect(), + isRoot = (!container || container === _window || container === document.body), + cRect = (isRoot ? _doc : container).getBoundingClientRect(), + offsets = {x: rect.left - cRect.left, y: rect.top - cRect.top}; + if (!isRoot && container) { //only add the current scroll position if it's not the window/body. + offsets.x += _buildGetter(container, "x")(); + offsets.y += _buildGetter(container, "y")(); + } + return offsets; + */ + }, + _parseVal = function(value, target, axis, currentVal) { + var type = typeof(value); + return !isNaN(value) ? parseFloat(value) : (type === "string" && value.charAt(1) === "=") ? parseInt(value.charAt(0) + "1", 10) * parseFloat(value.substr(2)) + currentVal : (value === "max") ? _max(target, axis) : Math.min(_max(target, axis), _getOffset(value, target)[axis]); + }, + + ScrollToPlugin = _gsScope._gsDefine.plugin({ + propName: "scrollTo", + API: 2, + global: true, + version:"1.9.2", + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween) { + this._wdw = (target === _window); + this._target = target; + this._tween = tween; + if (typeof(value) !== "object") { + value = {y:value}; //if we don't receive an object as the parameter, assume the user intends "y". + if (typeof(value.y) === "string" && value.y !== "max" && value.y.charAt(1) !== "=") { + value.x = value.y; + } + } else if (value.nodeType) { + value = {y:value, x:value}; + } + this.vars = value; + this._autoKill = (value.autoKill !== false); + this.getX = _buildGetter(target, "x"); + this.getY = _buildGetter(target, "y"); + this.x = this.xPrev = this.getX(); + this.y = this.yPrev = this.getY(); + if (value.x != null) { + this._addTween(this, "x", this.x, _parseVal(value.x, target, "x", this.x) - (value.offsetX || 0), "scrollTo_x", true); + this._overwriteProps.push("scrollTo_x"); + } else { + this.skipX = true; + } + if (value.y != null) { + this._addTween(this, "y", this.y, _parseVal(value.y, target, "y", this.y) - (value.offsetY || 0), "scrollTo_y", true); + this._overwriteProps.push("scrollTo_y"); + } else { + this.skipY = true; + } + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(v) { + this._super.setRatio.call(this, v); + + var x = (this._wdw || !this.skipX) ? this.getX() : this.xPrev, + y = (this._wdw || !this.skipY) ? this.getY() : this.yPrev, + yDif = y - this.yPrev, + xDif = x - this.xPrev, + threshold = ScrollToPlugin.autoKillThreshold; + + if (this.x < 0) { //can't scroll to a position less than 0! Might happen if someone uses a Back.easeOut or Elastic.easeOut when scrolling back to the top of the page (for example) + this.x = 0; + } + if (this.y < 0) { + this.y = 0; + } + if (this._autoKill) { + //note: iOS has a bug that throws off the scroll by several pixels, so we need to check if it's within 7 pixels of the previous one that we set instead of just looking for an exact match. + if (!this.skipX && (xDif > threshold || xDif < -threshold) && x < _max(this._target, "x")) { + this.skipX = true; //if the user scrolls separately, we should stop tweening! + } + if (!this.skipY && (yDif > threshold || yDif < -threshold) && y < _max(this._target, "y")) { + this.skipY = true; //if the user scrolls separately, we should stop tweening! + } + if (this.skipX && this.skipY) { + this._tween.kill(); + if (this.vars.onAutoKill) { + this.vars.onAutoKill.apply(this.vars.onAutoKillScope || this._tween, this.vars.onAutoKillParams || []); + } + } + } + if (this._wdw) { + _window.scrollTo((!this.skipX) ? this.x : x, (!this.skipY) ? this.y : y); + } else { + if (!this.skipY) { + this._target.scrollTop = this.y; + } + if (!this.skipX) { + this._target.scrollLeft = this.x; + } + } + this.xPrev = this.x; + this.yPrev = this.y; + } + + }), + p = ScrollToPlugin.prototype; + + ScrollToPlugin.max = _max; + ScrollToPlugin.getOffset = _getOffset; + ScrollToPlugin.buildGetter = _buildGetter; + ScrollToPlugin.autoKillThreshold = 7; + + p._kill = function(lookup) { + if (lookup.scrollTo_x) { + this.skipX = true; + } + if (lookup.scrollTo_y) { + this.skipY = true; + } + return this._super._kill.call(this, lookup); + }; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("ScrollToPlugin")); +/*! + * VERSION: 1.2.0 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * This file is to be used as a simple template for writing your own plugin. See the + * TweenPlugin docs for more details. + * + * You can start by doing a search for "yourCustomProperty" and replace it with whatever the name + * of your property is. This way of defining a plugin was introduced in version 1.9.0 - previous versions + * of TweenLite won't work with this. + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + **/ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + //ignore the line above this and at the very end - those are for ensuring things load in the proper order + "use strict"; + + _gsScope._gsDefine.plugin({ + propName: "yourCustomProperty", //the name of the property that will get intercepted and handled by this plugin (obviously change it to whatever you want, typically it is camelCase starting with lowercase). + priority: 0, //the priority in the rendering pipeline (0 by default). A priority of -1 would mean this plugin will run after all those with 0 or greater. A priority of 1 would get run before 0, etc. This only matters when a plugin relies on other plugins finishing their work before it runs (or visa-versa) + API: 2, //the API should stay 2 - it just gives us a way to know the method/property structure so that if in the future we change to a different TweenPlugin architecture, we can identify this plugin's structure. + version: "1.0.0", //your plugin's version number + overwriteProps: ["yourCustomProperty"], //an array of property names whose tweens should be overwritten by this plugin. For example, if you create a "scale" plugin that handles both "scaleX" and "scaleY", the overwriteProps would be ["scaleX","scaleY"] so that if there's a scaleX or scaleY tween in-progress when a new "scale" tween starts (using this plugin), it would overwrite the scaleX or scaleY tween. + + /* + * The init function is called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. It receives 3 parameters: + * 1) target [object] - the target of the tween. In cases where the tween's original target is an array (or jQuery object), this target will be the individual object inside that array (a new plugin instance is created for each target in the array). For example, TweenLite.to([obj1, obj2, obj3], 1, {x:100}) the target will be obj1 or obj2 or obj3 rather than the array containing them. + * 2) value [*] - whatever value is passed as the special property value. For example, TweenLite.to(element, 1, {yourCustomProperty:3}) the value would be 3. Or for TweenLite.to(element, 1, {yourCustomProperty:{subProp1:3, subProp2:"whatever"}});, value would be {subProp1:3, subProp2:"whatever"}. + * 3) tween [TweenLite] - the TweenLite (or TweenMax) instance that is managing this plugin instance. This can be useful if you need to check certain state-related properties on the tween (maybe in the set method) like its duration or time. Most of the time, however, you don't need to do anything with the tween. It is provided just in case you want to reference it. + * 4) index [integer] - the index number of the target in the tween. For example, if an array is passed in as the target (or selector text), this would be 0 for the first one, 1 for the second, 2 for the third, etc. This was introduced in GSAP 1.19.0 + * + * This function should return true unless you want to have TweenLite/Max skip the plugin altogether and instead treat the property/value like a normal tween (as if the plugin wasn't activated). This is rarely useful, so you should almost always return true. + */ + init: function(target, value, tween, index) { + this._target = target; //we record the target so that we can refer to it in the set method when doing updates. + + /* Next, we create a property tween for "scaleX" and "scaleY" properties of our target + * (we're just using them as a examples of how to set up a property tween with a name, start, and end value). + * the _addTween() method accepts the following parameters: + * 1) target [object] - target object whose property this tween will control. + * 2) property [string] - the name of the property, like "scaleX" or "scaleY" + * 3) start [number] - The starting value of the property. For example, if you're tweening from 0 to 100, start would be 0. + * 4) end [number] - the ending value of the property. For example, if you're tweening from 0 to 100, end would be 100. + * 5) overwriteProperty [string] - the name that gets registered as the overwrite property so that if another concurrent tween of the same target gets created and it is tweening a property with this name, this one will be overwritten. Typically this is the same as "property". + * 6) round [boolean] - if true, the updated value on each update will be rounded to the nearest integer. [false by default] + * You do NOT need to use _addTween() at all. It is merely a convenience. You can record your own values internally or whatever you want. + */ + this._addTween(target, "scaleX", target.scaleX, value, "scaleX", false); + this._addTween(target, "scaleY", target.scaleY, value, "scaleY", false); + + //now, just for kicks, we'll record the starting "alpha" value and amount of change so that we can manage this manually rather than _addTween() (again, totally fictitious, just for an example) + this._alphaStart = target.alpha; + this._alphaChange = value.alpha - target.alpha; + + //always return true unless we want to scrap the plugin and have the value treated as a normal property tween (very uncommon) + return true; + }, + + //[optional] - called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.). If you're using this._super._addTween() for all your tweens and you don't need to do anything special on each frame besides updating those values, you can omit this "set" function altogether. + set: function(ratio) { + //since we used _addTween() inside init function, it created some property tweens that we'll update by calling the parent prototype's setRatio() (otherwise, the property tweens wouldn't get their values updated). this._super refers to the TweenPlugin prototype from which the plugin inherits (not that you need to worry about that). + this._super.setRatio.call(this, ratio); + + //now manually set the alpha + this._target.alpha = this._alphaStart + this._alphaChange * ratio; + } + + }); + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } +/*! + * VERSION: 0.6.2 + * DATE: 2018-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + var _getText = function(e) { + var type = e.nodeType, + result = ""; + if (type === 1 || type === 9 || type === 11) { + if (typeof(e.textContent) === "string") { + return e.textContent; + } else { + for ( e = e.firstChild; e; e = e.nextSibling ) { + result += _getText(e); + } + } + } else if (type === 3 || type === 4) { + return e.nodeValue; + } + return result; + }, + _emoji = "[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2694-\u2697]|\uD83E[\uDD10-\uDD5D]|[\uD800-\uDBFF][\uDC00-\uDFFF]", + _emojiExp = new RegExp(_emoji), + _emojiAndCharsExp = new RegExp(_emoji + "|.", "g"), + _emojiSafeSplit = function(text, delimiter) { + return ((delimiter === "" || !delimiter) && _emojiExp.test(text)) ? text.match(_emojiAndCharsExp) : text.split(delimiter || ""); + }, + /* //previous emoji-related splitting. New method above is faster and more concise. + _emojiStart = 0xD800, + _emojiEnd = 0xDBFF, + _emojiLowStart = 0xDC00, + _emojiRegionStart = 0x1F1E6, + _emojiRegionEnd = 0x1F1FF, + _emojiModStart = 0x1f3fb, + _emojiModEnd = 0x1f3ff, + _emojiPairCode = function(s) { + return ((s.charCodeAt(0) - _emojiStart) << 10) + (s.charCodeAt(1) - _emojiLowStart) + 0x10000; + }, + _emojiSafeSplit = function(text, delimiter) { //like calling String.split(delimiter) except that it keeps emoji characters together. + if (delimiter !== "") { + return text.split(delimiter); + } + var l = text.length, + a = [], + character, i, emojiPair1, emojiPair2, j; + for (i = 0; i < l; i++) { + character = text.charAt(i); + if ((character.charCodeAt(0) >= _emojiStart && character.charCodeAt(0) <= _emojiEnd) || (text.charCodeAt(i+1) >= 0xFE00 && text.charCodeAt(i+1) <= 0xFE0F)) { //special emoji characters use 2 or 4 unicode characters that we must keep together. + emojiPair1 = _emojiPairCode(text.substr(i, 2)); + emojiPair2 = _emojiPairCode(text.substr(i + 2, 2)); + j = ((emojiPair1 >= _emojiRegionStart && emojiPair1 <= _emojiRegionEnd && emojiPair2 >= _emojiRegionStart && emojiPair2 <= _emojiRegionEnd) || (emojiPair2 >= _emojiModStart && emojiPair2 <= _emojiModEnd)) ? 4 : 2; + a.push(text.substr(i, j)); + i += j - 1; + } else { + a.push(character); + } + } + return a; + }, + */ + TextPlugin = _gsScope._gsDefine.plugin({ + propName: "text", + API: 2, + version:"0.6.2", + + //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. + init: function(target, value, tween, index) { + var i = target.nodeName.toUpperCase(), + shrt; + if (typeof(value) === "function") { + value = value(index, target); + } + this._svg = (target.getBBox && (i === "TEXT" || i === "TSPAN")); + if (!("innerHTML" in target) && !this._svg) { + return false; + } + this._target = target; + if (typeof(value) !== "object") { + value = {value:value}; + } + if (value.value === undefined) { + this._text = this._original = [""]; + return true; + } + this._delimiter = value.delimiter || ""; + this._original = _emojiSafeSplit(_getText(target).replace(/\s+/g, " "), this._delimiter); + this._text = _emojiSafeSplit(value.value.replace(/\s+/g, " "), this._delimiter); + this._runBackwards = (tween.vars.runBackwards === true); + if (this._runBackwards) { + i = this._original; + this._original = this._text; + this._text = i; + } + if (typeof(value.newClass) === "string") { + this._newClass = value.newClass; + this._hasClass = true; + } + if (typeof(value.oldClass) === "string") { + this._oldClass = value.oldClass; + this._hasClass = true; + } + i = this._original.length - this._text.length; + shrt = (i < 0) ? this._original : this._text; + this._fillChar = value.fillChar || (value.padSpace ? " " : ""); + if (i < 0) { + i = -i; + } + while (--i > -1) { + shrt.push(this._fillChar); + } + return true; + }, + + //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) + set: function(ratio) { + if (ratio > 1) { + ratio = 1; + } else if (ratio < 0) { + ratio = 0; + } + if (this._runBackwards) { + ratio = 1 - ratio; + } + var l = this._text.length, + i = (ratio * l + 0.5) | 0, + applyNew, applyOld, str; + if (this._hasClass) { + applyNew = (this._newClass && i !== 0); + applyOld = (this._oldClass && i !== l); + str = (applyNew ? "" : "") + this._text.slice(0, i).join(this._delimiter) + (applyNew ? "" : "") + (applyOld ? "" : "") + this._delimiter + this._original.slice(i).join(this._delimiter) + (applyOld ? "" : ""); + } else { + str = this._text.slice(0, i).join(this._delimiter) + this._delimiter + this._original.slice(i).join(this._delimiter); + } + if (this._svg) { //SVG text elements don't have an "innerHTML" in Microsoft browsers. + this._target.textContent = str; + } else { + this._target.innerHTML = (this._fillChar === " " && str.indexOf(" ") !== -1) ? str.split(" ").join("  ") : str; + } + } + + }), + p = TextPlugin.prototype; + + p._newClass = p._oldClass = p._delimiter = ""; + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("TextPlugin")); +/*! + * VERSION: 0.11.2 + * DATE: 2019-02-07 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * ThrowPropsPlugin is a Club GreenSock membership benefit; You must have a valid membership to use + * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. + * This work is subject to the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node +(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() { + + "use strict"; + + _gsScope._gsDefine("plugins.ThrowPropsPlugin", ["plugins.TweenPlugin", "TweenLite", "easing.Ease", "utils.VelocityTracker"], function(TweenPlugin, TweenLite, Ease, VelocityTracker) { + + var ThrowPropsPlugin = function(props, priority) { + TweenPlugin.call(this, "throwProps"); + this._overwriteProps.length = 0; + }, + _max = 999999999999999, + _min = 0.0000000001, + _globals = _gsScope._gsDefine.globals, + _recordEndMode = false,//in a typical throwProps css tween that has an "end" defined as a function, it grabs that value initially when the tween is rendered, then again when we calculate the necessary duration, and then a 3rd time after we invalidate() the tween, so we toggle _recordEndMode to true when we're about to begin such a tween which tells the engine to grab the end value(s) once and record them as "max" and "min" on the throwProps object, thus we can skip those extra calls. Then we set it back to false when we're done with our fancy initialization routine. + _transforms = {x:1,y:1,z:2,scale:1,scaleX:1,scaleY:1,rotation:1,rotationZ:1,rotationX:2,rotationY:2,skewX:1,skewY:1,xPercent:1,yPercent:1}, + _getClosest = function(n, values, max, min, radius) { + var i = values.length, + closest = 0, + absDif = _max, + val, dif, p, dist; + if (typeof(n) === "object") { + while (--i > -1) { + val = values[i]; + dif = 0; + for (p in n) { + dist = val[p] - n[p]; + dif += dist * dist; + } + if (dif < absDif) { + closest = i; + absDif = dif; + } + } + if ((radius || _max) < _max && radius < Math.sqrt(absDif)) { + return n; + } + } else { + while (--i > -1) { + val = values[i]; + dif = val - n; + if (dif < 0) { + dif = -dif; + } + if (dif < absDif && val >= min && val <= max) { + closest = i; + absDif = dif; + } + } + } + return values[closest]; + }, + _parseEnd = function(curProp, end, max, min, name, radius) { + if (curProp.end === "auto") { + return curProp; + } + var endVar = curProp.end, + adjustedEnd, p; + max = isNaN(max) ? _max : max; + min = isNaN(min) ? -_max : min; + if (typeof(end) === "object") { //for objects, like {x, y} where they're linked and we must pass an object to the function or find the closest value in an array. + adjustedEnd = end.calculated ? end : ((typeof(endVar) === "function") ? endVar(end) : _getClosest(end, endVar, max, min, radius)) || end; + if (!end.calculated) { + for (p in adjustedEnd) { + end[p] = adjustedEnd[p]; + } + end.calculated = true; + } + adjustedEnd = adjustedEnd[name]; + } else { + adjustedEnd = (typeof(endVar) === "function") ? endVar(end) : (endVar instanceof Array) ? _getClosest(end, endVar, max, min, radius) : Number(endVar); + } + if (adjustedEnd > max) { + adjustedEnd = max; + } else if (adjustedEnd < min) { + adjustedEnd = min; + } + return {max:adjustedEnd, min:adjustedEnd, unitFactor:curProp.unitFactor}; + }, + _extend = function(decoratee, extras, exclude) { + for (var p in extras) { + if (decoratee[p] === undefined && p !== exclude) { + decoratee[p] = extras[p]; + } + } + return decoratee; + }, + _calculateChange = ThrowPropsPlugin.calculateChange = function(velocity, ease, duration, checkpoint) { + if (checkpoint == null) { + checkpoint = 0.05; + } + var e = (ease instanceof Ease) ? ease : (!ease) ? TweenLite.defaultEase : new Ease(ease); + return (duration * checkpoint * velocity) / e.getRatio(checkpoint); + }, + _calculateDuration = ThrowPropsPlugin.calculateDuration = function(start, end, velocity, ease, checkpoint) { + checkpoint = checkpoint || 0.05; + var e = (ease instanceof Ease) ? ease : (!ease) ? TweenLite.defaultEase : new Ease(ease); + return Math.abs( (end - start) * e.getRatio(checkpoint) / velocity / checkpoint ); + }, + _calculateTweenDuration = ThrowPropsPlugin.calculateTweenDuration = function(target, vars, maxDuration, minDuration, overshootTolerance, recordEnd) { + if (typeof(target) === "string") { + target = TweenLite.selector(target); + } + if (!target) { + return 0; + } + if (maxDuration == null) { + maxDuration = 10; + } + if (minDuration == null) { + minDuration = 0.2; + } + if (overshootTolerance == null) { + overshootTolerance = 1; + } + if (target.length) { + target = target[0] || target; + } + var duration = 0, + clippedDuration = 9999999999, + throwPropsVars = vars.throwProps || vars, + ease = (vars.ease instanceof Ease) ? vars.ease : (!vars.ease) ? TweenLite.defaultEase : new Ease(vars.ease), + checkpoint = isNaN(throwPropsVars.checkpoint) ? 0.05 : Number(throwPropsVars.checkpoint), + resistance = isNaN(throwPropsVars.resistance) ? ThrowPropsPlugin.defaultResistance : Number(throwPropsVars.resistance), + p, curProp, curDuration, curVelocity, curResistance, curVal, end, curClippedDuration, tracker, unitFactor, + linkedProps, linkedPropNames, i; + + if (throwPropsVars.linkedProps) { //when there are linkedProps (typically "x,y" where snapping has to factor in multiple properties, we must first populate an object with all of those end values, then feed it to the function that make any necessary alterations. So the point of this first loop is to simply build an object (like {x:100, y:204.5}) for feeding into that function which we'll do later in the "real" loop. + linkedPropNames = throwPropsVars.linkedProps.split(","); + linkedProps = {}; + for (i = 0; i < linkedPropNames.length; i++) { + p = linkedPropNames[i]; + curProp = throwPropsVars[p]; + if (curProp) { + if (curProp.velocity !== undefined && typeof(curProp.velocity) === "number") { + curVelocity = Number(curProp.velocity) || 0; + } else { + tracker = tracker || VelocityTracker.getByTarget(target); + curVelocity = (tracker && tracker.isTrackingProp(p)) ? tracker.getVelocity(p) : 0; + } + curResistance = isNaN(curProp.resistance) ? resistance : Number(curProp.resistance); + curDuration = (curVelocity * curResistance > 0) ? curVelocity / curResistance : curVelocity / -curResistance; + curVal = (typeof(target[p]) === "function") ? target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() : target[p] || 0; + linkedProps[p] = curVal + _calculateChange(curVelocity, ease, curDuration, checkpoint); + } + } + } + + for (p in throwPropsVars) { + + if (p !== "resistance" && p !== "checkpoint" && p !== "preventOvershoot" && p !== "linkedProps" && p !== "radius") { + curProp = throwPropsVars[p]; + if (typeof(curProp) !== "object") { + tracker = tracker || VelocityTracker.getByTarget(target); + if (tracker && tracker.isTrackingProp(p)) { + curProp = (typeof(curProp) === "number") ? {velocity:curProp} : {velocity:tracker.getVelocity(p)}; //if we're tracking this property, we should use the tracking velocity and then use the numeric value that was passed in as the min and max so that it tweens exactly there. + } else { + curVelocity = Number(curProp) || 0; + curDuration = (curVelocity * resistance > 0) ? curVelocity / resistance : curVelocity / -resistance; + } + } + if (typeof(curProp) === "object") { + + if (curProp.velocity !== undefined && typeof(curProp.velocity) === "number") { + curVelocity = Number(curProp.velocity) || 0; + } else { + tracker = tracker || VelocityTracker.getByTarget(target); + curVelocity = (tracker && tracker.isTrackingProp(p)) ? tracker.getVelocity(p) : 0; + } + curResistance = isNaN(curProp.resistance) ? resistance : Number(curProp.resistance); + curDuration = (curVelocity * curResistance > 0) ? curVelocity / curResistance : curVelocity / -curResistance; + curVal = (typeof(target[p]) === "function") ? target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() : target[p] || 0; + end = curVal + _calculateChange(curVelocity, ease, curDuration, checkpoint); + if (curProp.end !== undefined) { + curProp = _parseEnd(curProp, (linkedProps && p in linkedProps) ? linkedProps : end, curProp.max, curProp.min, p, throwPropsVars.radius); + if (recordEnd || _recordEndMode) { + throwPropsVars[p] = _extend(curProp, throwPropsVars[p], "end"); + } + } + if (curProp.max !== undefined && end > Number(curProp.max) + _min) { + unitFactor = curProp.unitFactor || ThrowPropsPlugin.defaultUnitFactors[p] || 1; //some values are measured in special units like radians in which case our thresholds need to be adjusted accordingly. + //if the value is already exceeding the max or the velocity is too low, the duration can end up being uncomfortably long but in most situations, users want the snapping to occur relatively quickly (0.75 seconds), so we implement a cap here to make things more intuitive. If the max and min match, it means we're animating to a particular value and we don't want to shorten the time unless the velocity is really slow. Example: a rotation where the start and natural end value are less than the snapping spot, but the natural end is pretty close to the snap. + curClippedDuration = ((curVal > curProp.max && curProp.min !== curProp.max) || (curVelocity * unitFactor > -15 && curVelocity * unitFactor < 45)) ? (minDuration + (maxDuration - minDuration) * 0.1) : _calculateDuration(curVal, curProp.max, curVelocity, ease, checkpoint); + if (curClippedDuration + overshootTolerance < clippedDuration) { + clippedDuration = curClippedDuration + overshootTolerance; + } + + } else if (curProp.min !== undefined && end < Number(curProp.min) - _min) { + unitFactor = curProp.unitFactor || ThrowPropsPlugin.defaultUnitFactors[p] || 1; //some values are measured in special units like radians in which case our thresholds need to be adjusted accordingly. + //if the value is already exceeding the min or if the velocity is too low, the duration can end up being uncomfortably long but in most situations, users want the snapping to occur relatively quickly (0.75 seconds), so we implement a cap here to make things more intuitive. + curClippedDuration = ((curVal < curProp.min && curProp.min !== curProp.max) || (curVelocity * unitFactor > -45 && curVelocity * unitFactor < 15)) ? (minDuration + (maxDuration - minDuration) * 0.1) : _calculateDuration(curVal, curProp.min, curVelocity, ease, checkpoint); + if (curClippedDuration + overshootTolerance < clippedDuration) { + clippedDuration = curClippedDuration + overshootTolerance; + } + } + + if (curClippedDuration > duration) { + duration = curClippedDuration; + } + } + + if (curDuration > duration) { + duration = curDuration; + } + + } + } + if (duration > clippedDuration) { + duration = clippedDuration; + } + if (duration > maxDuration) { + return maxDuration; + } else if (duration < minDuration) { + return minDuration; + } + return duration; + }, + p = ThrowPropsPlugin.prototype = new TweenPlugin("throwProps"), + _cssProxy, _cssVars, _last, _lastValue; //these serve as a cache of sorts, recording the last css-related proxy and the throwProps vars that get calculated in the _cssRegister() method. This allows us to grab them in the ThrowPropsPlugin.to() function and calculate the duration. Of course we could have structured things in a more "clean" fashion, but performance is of paramount importance. + + + + p.constructor = ThrowPropsPlugin; + ThrowPropsPlugin.version = "0.11.2"; + ThrowPropsPlugin.API = 2; + ThrowPropsPlugin._autoCSS = true; //indicates that this plugin can be inserted into the "css" object using the autoCSS feature of TweenLite + ThrowPropsPlugin.defaultResistance = 100; + ThrowPropsPlugin.defaultUnitFactors = {time:1000, totalTime:1000}; //setting the unitFactor to a higher value (default is 1) reduces the chance of the auto-accelerating behavior kicking in when determining durations when the initial velocity is adequately low - imagine dragging something past a boundary and then letting go - snapping back relatively quickly should be prioritized over matching the initial velocity (at least that's the behavior most people consider intuitive). But in some situations when the units are very low (like "time" of a timeline or rotation when using radians), it can kick in too frequently so this allows tweaking. + + ThrowPropsPlugin.track = function(target, props, types) { + return VelocityTracker.track(target, props, types); + }; + + ThrowPropsPlugin.untrack = function(target, props) { + VelocityTracker.untrack(target, props); + }; + + ThrowPropsPlugin.isTracking = function(target, prop) { + return VelocityTracker.isTracking(target, prop); + }; + + ThrowPropsPlugin.getVelocity = function(target, prop) { + var vt = VelocityTracker.getByTarget(target); + return vt ? vt.getVelocity(prop) : NaN; + }; + + ThrowPropsPlugin._cssRegister = function() { + var CSSPlugin = _globals.com.greensock.plugins.CSSPlugin; + if (!CSSPlugin) { + return; + } + var _internals = CSSPlugin._internals, + _parseToProxy = _internals._parseToProxy, + _setPluginRatio = _internals._setPluginRatio, + CSSPropTween = _internals.CSSPropTween; + _internals._registerComplexSpecialProp("throwProps", {parser:function(t, e, prop, cssp, pt, plugin) { + plugin = new ThrowPropsPlugin(); + var velocities = {}, + min = {}, + max = {}, + end = {}, + res = {}, + preventOvershoot = {}, + hasResistance, val, p, data, tracker; + _cssVars = {}; + for (p in e) { + if (p !== "resistance" && p !== "preventOvershoot" && p !== "linkedProps" && p !== "radius") { + val = e[p]; + if (typeof(val) === "object") { + if (val.velocity !== undefined && typeof(val.velocity) === "number") { + velocities[p] = Number(val.velocity) || 0; + } else { + tracker = tracker || VelocityTracker.getByTarget(t); + velocities[p] = (tracker && tracker.isTrackingProp(p)) ? tracker.getVelocity(p) : 0; //rotational values are actually converted to radians in CSSPlugin, but our tracking velocity is in radians already, so make it into degrees to avoid a funky conversion + } + if (val.end !== undefined) { + end[p] = val.end; + } + if (val.min !== undefined) { + min[p] = val.min; + } + if (val.max !== undefined) { + max[p] = val.max; + } + if (val.preventOvershoot) { + preventOvershoot[p] = true; + } + if (val.resistance !== undefined) { + hasResistance = true; + res[p] = val.resistance; + } + } else if (typeof(val) === "number") { + velocities[p] = val; + } else { + tracker = tracker || VelocityTracker.getByTarget(t); + if (tracker && tracker.isTrackingProp(p)) { + velocities[p] = tracker.getVelocity(p); + } else { + velocities[p] = val || 0; + } + } + if (_transforms[p]) { + cssp._enableTransforms((_transforms[p] === 2)); + } + } + } + data = _parseToProxy(t, velocities, cssp, pt, plugin); + _cssProxy = data.proxy; + velocities = data.end; + for (p in _cssProxy) { + _cssVars[p] = {velocity:velocities[p], min:min[p], max:max[p], end:end[p], resistance:res[p], preventOvershoot:preventOvershoot[p]}; + } + if (e.resistance != null) { + _cssVars.resistance = e.resistance; + } + if (e.linkedProps != null) { + _cssVars.linkedProps = e.linkedProps; + } + if (e.radius != null) { + _cssVars.radius = e.radius; + } + if (e.preventOvershoot) { + _cssVars.preventOvershoot = true; + } + pt = new CSSPropTween(t, "throwProps", 0, 0, data.pt, 2); + cssp._overwriteProps.pop(); //don't overwrite all other throwProps tweens. In the CSSPropTween constructor, we add the property to the _overwriteProps, so remove it here. + pt.plugin = plugin; + pt.setRatio = _setPluginRatio; + pt.data = data; + plugin._onInitTween(_cssProxy, _cssVars, cssp._tween); + return pt; + }}); + }; + + + ThrowPropsPlugin.to = function(target, vars, maxDuration, minDuration, overshootTolerance) { + if (!vars.throwProps) { + vars = {throwProps:vars}; + } + if (overshootTolerance === 0) { + vars.throwProps.preventOvershoot = true; + } + _recordEndMode = true; //if we encounter a function-based "end" value, ThrowPropsPlugin will record it as "max" and "min" properties, replacing "end" (this is an optimization so that the function only gets called once) + var tween = new TweenLite(target, minDuration || 1, vars); + tween.render(0, true, true); //we force a render so that the CSSPlugin instantiates and populates the _cssProxy and _cssVars which we need in order to calculate the tween duration. Remember, we can't use the regular target for calculating the duration because the current values wouldn't be able to be grabbed like target["propertyName"], as css properties can be complex like boxShadow:"10px 10px 20px 30px red" or backgroundPosition:"25px 50px". The proxy is the result of breaking all that complex data down and finding just the numeric values and assigning them to a generic proxy object with unique names. THAT is what the _calculateTweenDuration() can look at. We also needed to do the same break down of any min or max or velocity data + if (tween.vars.css) { + tween.duration(_calculateTweenDuration(_cssProxy, {throwProps:_cssVars, ease:vars.ease}, maxDuration, minDuration, overshootTolerance)); + if (tween._delay && !tween.vars.immediateRender) { + tween.invalidate(); //if there's a delay, the starting values could be off, so invalidate() to force reinstantiation when the tween actually starts. + } else { + _last._onInitTween(_cssProxy, _lastValue, tween); + } + _recordEndMode = false; + return tween; + } else { + tween.kill(); + tween = new TweenLite(target, _calculateTweenDuration(target, vars, maxDuration, minDuration, overshootTolerance), vars); + _recordEndMode = false; + return tween; + } + }; + + p._onInitTween = function(target, value, tween, index) { + this.target = target; + this._props = []; + _last = this; + _lastValue = value; + var ease = tween._ease, + checkpoint = isNaN(value.checkpoint) ? 0.05 : Number(value.checkpoint), + duration = tween._duration, + preventOvershoot = value.preventOvershoot, + cnt = 0, + p, curProp, curVal, isFunc, velocity, change1, end, change2, tracker, + linkedProps, linkedPropNames, i; + + if (value.linkedProps) { //when there are linkedProps (typically "x,y" where snapping has to factor in multiple properties, we must first populate an object with all of those end values, then feed it to the function that make any necessary alterations. So the point of this first loop is to simply build an object (like {x:100, y:204.5}) for feeding into that function which we'll do later in the "real" loop. + linkedPropNames = value.linkedProps.split(","); + linkedProps = {}; + for (i = 0; i < linkedPropNames.length; i++) { + p = linkedPropNames[i]; + curProp = value[p]; + if (curProp) { + if (curProp.velocity !== undefined && typeof(curProp.velocity) === "number") { + velocity = Number(curProp.velocity) || 0; + } else { + tracker = tracker || VelocityTracker.getByTarget(target); + velocity = (tracker && tracker.isTrackingProp(p)) ? tracker.getVelocity(p) : 0; + } + curVal = (typeof(target[p]) === "function") ? target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() : target[p] || 0; + linkedProps[p] = curVal + _calculateChange(velocity, ease, duration, checkpoint); + } + } + } + + for (p in value) { + if (p !== "resistance" && p !== "checkpoint" && p !== "preventOvershoot" && p !== "linkedProps" && p !== "radius") { + curProp = value[p]; + if (typeof(curProp) === "function") { + curProp = curProp(index, target); + } + if (typeof(curProp) === "number") { + velocity = Number(curProp) || 0; + } else if (typeof(curProp) === "object" && !isNaN(curProp.velocity)) { + velocity = Number(curProp.velocity); + } else { + tracker = tracker || VelocityTracker.getByTarget(target); + if (tracker && tracker.isTrackingProp(p)) { + velocity = tracker.getVelocity(p); + } else { + throw("ERROR: No velocity was defined in the throwProps tween of " + target + " property: " + p); + } + } + change1 = _calculateChange(velocity, ease, duration, checkpoint); + change2 = 0; + isFunc = (typeof(target[p]) === "function"); + curVal = (isFunc) ? target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() : target[p]; + if (typeof(curProp) === "object") { + end = curVal + change1; + if (curProp.end !== undefined) { + curProp = _parseEnd(curProp, (linkedProps && p in linkedProps) ? linkedProps : end, curProp.max, curProp.min, p, value.radius); + if (_recordEndMode) { + value[p] = _extend(curProp, value[p], "end"); + } + } + if (curProp.max !== undefined && Number(curProp.max) < end) { + if (preventOvershoot || curProp.preventOvershoot) { + change1 = curProp.max - curVal; + } else { + change2 = (curProp.max - curVal) - change1; + } + } else if (curProp.min !== undefined && Number(curProp.min) > end) { + if (preventOvershoot || curProp.preventOvershoot) { + change1 = curProp.min - curVal; + } else { + change2 = (curProp.min - curVal) - change1; + } + } + } + this._overwriteProps[cnt] = p; + this._props[cnt++] = {p:p, s:curVal, c1:change1, c2:change2, f:isFunc, r:false}; + } + } + return true; + }; + + p._kill = function(lookup) { + var i = this._props.length; + while (--i > -1) { + if (lookup[this._props[i].p] != null) { + this._props.splice(i, 1); + } + } + return TweenPlugin.prototype._kill.call(this, lookup); + }; + + p._mod = function(lookup) { + var p = this._props, + i = p.length, + val; + while (--i > -1) { + val = lookup[p[i].p] || lookup.throwProps; + if (typeof(val) === "function") { + p[i].m = val; + } + } + }; + + p.setRatio = function(v) { + var i = this._props.length, + cp, val; + while (--i > -1) { + cp = this._props[i]; + val = cp.s + cp.c1 * v + cp.c2 * v * v; + if (cp.m) { + val = cp.m(val, this.target); + } else if (v === 1) { + val = ((val * 10000 + (val < 0 ? -0.5 : 0.5)) | 0) / 10000; //if we don't round things at the very end, binary math issues can creep in and cause snapping not to be exact (like landing on 20.000000000001 instead of 20). + } + if (cp.f) { + this.target[cp.p](val); + } else { + this.target[cp.p] = val; + } + } + }; + + TweenPlugin.activate([ThrowPropsPlugin]); + + return ThrowPropsPlugin; + + }, true); + + + +/* + * ---------------------------------------------------------------- + * VelocityTracker + * ---------------------------------------------------------------- + */ + _gsScope._gsDefine("utils.VelocityTracker", ["TweenLite"], function(TweenLite) { + + var _first, _initted, _time1, _time2, + _capsExp = /([A-Z])/g, + _empty = {}, + _doc = _gsScope.document, + _transforms = {x:1,y:1,z:2,scale:1,scaleX:1,scaleY:1,rotation:1,rotationZ:1,rotationX:2,rotationY:2,skewX:1,skewY:1,xPercent:1,yPercent:1}, + _computedStyleScope = (typeof(window) !== "undefined" ? window : _doc.defaultView || {getComputedStyle:function() {}}), + _getComputedStyle = function(e) { + return _computedStyleScope.getComputedStyle(e); //to avoid errors in Microsoft Edge, we need to call getComputedStyle() from a specific scope, typically window. + }, + _getStyle = function(t, p, cs) { + var rv = (t._gsTransform || _empty)[p]; + if (rv || rv === 0) { + return rv; + } else if (t.style[p]) { + rv = t.style[p]; + } else if ((cs = cs || _getComputedStyle(t, null))) { + rv = cs[p] || cs.getPropertyValue(p) || cs.getPropertyValue(p.replace(_capsExp, "-$1").toLowerCase()); + } else if (t.currentStyle) { + rv = t.currentStyle[p]; + } + return parseFloat(rv) || 0; + }, + _ticker = TweenLite.ticker, + VelocityProp = function(p, isFunc, next) { + this.p = p; + this.f = isFunc; + this.v1 = this.v2 = 0; + this.t1 = this.t2 = _ticker.time; + this.css = false; + this.type = ""; + this._prev = null; + if (next) { + this._next = next; + next._prev = this; + } + }, + _update = function() { + var vt = _first, + t = _ticker.time, + val, vp; + //if the frame rate is too high, we won't be able to track the velocity as well, so only update the values about 33 times per second + if (t - _time1 >= 0.03) { + _time2 = _time1; + _time1 = t; + while (vt) { + vp = vt._firstVP; + while (vp) { + val = vp.css ? _getStyle(vt.target, vp.p) : vp.f ? vt.target[vp.p]() : vt.target[vp.p]; + if (val !== vp.v1 || t - vp.t1 > 0.15) { //use a threshold of 0.15 seconds for zeroing-out velocity. If we only use 0.03 and things update slightly slower, like some Android devices dispatch "touchmove" events sluggishly so 2 or 3 ticks of the TweenLite.ticker may elapse inbetween, thus it may appear like the object is not moving but it actually is but it's not updating as frequently. A threshold of 0.15 seconds seems to be a good balance. We want to update things frequently (0.03 seconds) when they're moving so that we can respond to fast motions accurately, but we want to be more resistant to go back to a zero velocity. + vp.v2 = vp.v1; + vp.v1 = val; + vp.t2 = vp.t1; + vp.t1 = t; + } + vp = vp._next; + } + vt = vt._next; + } + } + }, + VelocityTracker = function(target) { + this._lookup = {}; + this.target = target; + this.elem = (target.style && target.nodeType) ? true : false; + if (!_initted) { + _ticker.addEventListener("tick", _update, null, false, -100); + _time1 = _time2 = _ticker.time; + _initted = true; + } + if (_first) { + this._next = _first; + _first._prev = this; + } + _first = this; + }, + getByTarget = VelocityTracker.getByTarget = function(target) { + var vt = _first; + while (vt) { + if (vt.target === target) { + return vt; + } + vt = vt._next; + } + }, + p = VelocityTracker.prototype; + + p.addProp = function(prop, type) { + if (!this._lookup[prop]) { + var t = this.target, + isFunc = (typeof(t[prop]) === "function"), + alt = isFunc ? this._altProp(prop) : prop, + vp = this._firstVP; + this._firstVP = this._lookup[prop] = this._lookup[alt] = vp = new VelocityProp((alt !== prop && prop.indexOf("set") === 0) ? alt : prop, isFunc, vp); + vp.css = (this.elem && (this.target.style[vp.p] !== undefined || _transforms[vp.p])); + if (vp.css && _transforms[vp.p] && !t._gsTransform) { + TweenLite.set(t, {x:"+=0", overwrite:false}); //just forces CSSPlugin to create a _gsTransform for the element if it doesn't exist + } + vp.type = type || (vp.css && prop.indexOf("rotation") === 0) ? "deg" : ""; + vp.v1 = vp.v2 = vp.css ? _getStyle(t, vp.p) : isFunc ? t[vp.p]() : t[vp.p]; + } + }; + + p.removeProp = function(prop) { + var vp = this._lookup[prop]; + if (vp) { + if (vp._prev) { + vp._prev._next = vp._next; + } else if (vp === this._firstVP) { + this._firstVP = vp._next; + } + if (vp._next) { + vp._next._prev = vp._prev; + } + this._lookup[prop] = 0; + if (vp.f) { + this._lookup[this._altProp(prop)] = 0; //if it's a getter/setter, we should remove the matching counterpart (if one exists) + } + } + }; + + p.isTrackingProp = function(prop) { + return (this._lookup[prop] instanceof VelocityProp); + }; + + p.getVelocity = function(prop) { + var vp = this._lookup[prop], + target = this.target, + val, dif, rotationCap; + if (!vp) { + throw "The velocity of " + prop + " is not being tracked."; + } + val = vp.css ? _getStyle(target, vp.p) : vp.f ? target[vp.p]() : target[vp.p]; + dif = (val - vp.v2); + if (vp.type === "rad" || vp.type === "deg") { //rotational values need special interpretation so that if, for example, they go from 179 to -178 degrees it is interpreted as a change of 3 instead of -357. + rotationCap = (vp.type === "rad") ? Math.PI * 2 : 360; + dif = dif % rotationCap; + if (dif !== dif % (rotationCap / 2)) { + dif = (dif < 0) ? dif + rotationCap : dif - rotationCap; + } + } + return dif / (_ticker.time - vp.t2); + }; + + p._altProp = function(p) { //for getters/setters like getCustomProp() and setCustomProp() - we should accommodate both + var pre = p.substr(0, 3), + alt = ((pre === "get") ? "set" : (pre === "set") ? "get" : pre) + p.substr(3); + return (typeof(this.target[alt]) === "function") ? alt : p; + }; + + VelocityTracker.getByTarget = function(target) { + var vt = _first; + if (typeof(target) === "string") { + target = TweenLite.selector(target); + } + if (target.length && target !== window && target[0] && target[0].style && !target.nodeType) { + target = target[0]; + } + while (vt) { + if (vt.target === target) { + return vt; + } + vt = vt._next; + } + }; + + VelocityTracker.track = function(target, props, types) { + var vt = getByTarget(target), + a = props.split(","), + i = a.length; + types = (types || "").split(","); + if (!vt) { + vt = new VelocityTracker(target); + } + while (--i > -1) { + vt.addProp(a[i], types[i] || types[0]); + } + return vt; + }; + + VelocityTracker.untrack = function(target, props) { + var vt = getByTarget(target), + a = (props || "").split(","), + i = a.length; + if (!vt) { + return; + } + while (--i > -1) { + vt.removeProp(a[i]); + } + if (!vt._firstVP || !props) { + if (vt._prev) { + vt._prev._next = vt._next; + } else if (vt === _first) { + _first = vt._next; + } + if (vt._next) { + vt._next._prev = vt._prev; + } + } + }; + + VelocityTracker.isTracking = function(target, prop) { + var vt = getByTarget(target); + return (!vt) ? false : (!prop && vt._firstVP) ? true : vt.isTrackingProp(prop); + }; + + return VelocityTracker; + + }, true); + + +}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } + +//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date) +(function(name) { + "use strict"; + var getGlobal = function() { + return (_gsScope.GreenSockGlobals || _gsScope)[name]; + }; + if (typeof(module) !== "undefined" && module.exports) { //node + require("../TweenLite.js"); + module.exports = getGlobal(); + } else if (typeof(define) === "function" && define.amd) { //AMD + define(["TweenLite"], getGlobal); + } +}("ThrowPropsPlugin")); +/*! + * VERSION: 2.1.0 + * DATE: 2019-02-15 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. + * This work is subject to the terms at http://greensock.com/standard-license or for + * Club GreenSock members, the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +/* eslint-disable */ +(function(window, moduleName) { + + "use strict"; + var _exports = {}, + _doc = window.document, + _globals = window.GreenSockGlobals = window.GreenSockGlobals || window, + existingModule = _globals[moduleName]; + if (existingModule) { + if (typeof(module) !== "undefined" && module.exports) { //node + module.exports = existingModule; + } + return existingModule; //in case the core set of classes is already loaded, don't instantiate twice. + } + var _namespace = function(ns) { + var a = ns.split("."), + p = _globals, i; + for (i = 0; i < a.length; i++) { + p[a[i]] = p = p[a[i]] || {}; + } + return p; + }, + gs = _namespace("com.greensock"), + _tinyNum = 0.00000001, + _slice = function(a) { //don't use Array.prototype.slice.call(target, 0) because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll() + var b = [], + l = a.length, + i; + for (i = 0; i !== l; b.push(a[i++])) {} + return b; + }, + _emptyFunc = function() {}, + _isArray = (function() { //works around issues in iframe environments where the Array global isn't shared, thus if the object originates in a different window/iframe, "(obj instanceof Array)" will evaluate false. We added some speed optimizations to avoid Object.prototype.toString.call() unless it's absolutely necessary because it's VERY slow (like 20x slower) + var toString = Object.prototype.toString, + array = toString.call([]); + return function(obj) { + return obj != null && (obj instanceof Array || (typeof(obj) === "object" && !!obj.push && toString.call(obj) === array)); + }; + }()), + a, i, p, _ticker, _tickerActive, + _defLookup = {}, + + /** + * @constructor + * Defines a GreenSock class, optionally with an array of dependencies that must be instantiated first and passed into the definition. + * This allows users to load GreenSock JS files in any order even if they have interdependencies (like CSSPlugin extends TweenPlugin which is + * inside TweenLite.js, but if CSSPlugin is loaded first, it should wait to run its code until TweenLite.js loads and instantiates TweenPlugin + * and then pass TweenPlugin to CSSPlugin's definition). This is all done automatically and internally. + * + * Every definition will be added to a "com.greensock" global object (typically window, but if a window.GreenSockGlobals object is found, + * it will go there as of v1.7). For example, TweenLite will be found at window.com.greensock.TweenLite and since it's a global class that should be available anywhere, + * it is ALSO referenced at window.TweenLite. However some classes aren't considered global, like the base com.greensock.core.Animation class, so + * those will only be at the package like window.com.greensock.core.Animation. Again, if you define a GreenSockGlobals object on the window, everything + * gets tucked neatly inside there instead of on the window directly. This allows you to do advanced things like load multiple versions of GreenSock + * files and put them into distinct objects (imagine a banner ad uses a newer version but the main site uses an older one). In that case, you could + * sandbox the banner one like: + * + * + * + * + * + * + * + * @param {!string} ns The namespace of the class definition, leaving off "com.greensock." as that's assumed. For example, "TweenLite" or "plugins.CSSPlugin" or "easing.Back". + * @param {!Array.} dependencies An array of dependencies (described as their namespaces minus "com.greensock." prefix). For example ["TweenLite","plugins.TweenPlugin","core.Animation"] + * @param {!function():Object} func The function that should be called and passed the resolved dependencies which will return the actual class for this definition. + * @param {boolean=} global If true, the class will be added to the global scope (typically window unless you define a window.GreenSockGlobals object) + */ + Definition = function(ns, dependencies, func, global) { + this.sc = (_defLookup[ns]) ? _defLookup[ns].sc : []; //subclasses + _defLookup[ns] = this; + this.gsClass = null; + this.func = func; + var _classes = []; + this.check = function(init) { + var i = dependencies.length, + missing = i, + cur, a, n, cl; + while (--i > -1) { + if ((cur = _defLookup[dependencies[i]] || new Definition(dependencies[i], [])).gsClass) { + _classes[i] = cur.gsClass; + missing--; + } else if (init) { + cur.sc.push(this); + } + } + if (missing === 0 && func) { + a = ("com.greensock." + ns).split("."); + n = a.pop(); + cl = _namespace(a.join("."))[n] = this.gsClass = func.apply(func, _classes); + + //exports to multiple environments + if (global) { + _globals[n] = _exports[n] = cl; //provides a way to avoid global namespace pollution. By default, the main classes like TweenLite, Power1, Strong, etc. are added to window unless a GreenSockGlobals is defined. So if you want to have things added to a custom object instead, just do something like window.GreenSockGlobals = {} before loading any GreenSock files. You can even set up an alias like window.GreenSockGlobals = windows.gs = {} so that you can access everything like gs.TweenLite. Also remember that ALL classes are added to the window.com.greensock object (in their respective packages, like com.greensock.easing.Power1, com.greensock.TweenLite, etc.) + if (typeof(module) !== "undefined" && module.exports) { //node + if (ns === moduleName) { + module.exports = _exports[moduleName] = cl; + for (i in _exports) { + cl[i] = _exports[i]; + } + } else if (_exports[moduleName]) { + _exports[moduleName][n] = cl; + } + } else if (typeof(define) === "function" && define.amd){ //AMD + define((window.GreenSockAMDPath ? window.GreenSockAMDPath + "/" : "") + ns.split(".").pop(), [], function() { return cl; }); + } + } + for (i = 0; i < this.sc.length; i++) { + this.sc[i].check(); + } + } + }; + this.check(true); + }, + + //used to create Definition instances (which basically registers a class that has dependencies). + _gsDefine = window._gsDefine = function(ns, dependencies, func, global) { + return new Definition(ns, dependencies, func, global); + }, + + //a quick way to create a class that doesn't have any dependencies. Returns the class, but first registers it in the GreenSock namespace so that other classes can grab it (other classes might be dependent on the class). + _class = gs._class = function(ns, func, global) { + func = func || function() {}; + _gsDefine(ns, [], function(){ return func; }, global); + return func; + }; + + _gsDefine.globals = _globals; + + + +/* + * ---------------------------------------------------------------- + * Ease + * ---------------------------------------------------------------- + */ + var _baseParams = [0, 0, 1, 1], + Ease = _class("easing.Ease", function(func, extraParams, type, power) { + this._func = func; + this._type = type || 0; + this._power = power || 0; + this._params = extraParams ? _baseParams.concat(extraParams) : _baseParams; + }, true), + _easeMap = Ease.map = {}, + _easeReg = Ease.register = function(ease, names, types, create) { + var na = names.split(","), + i = na.length, + ta = (types || "easeIn,easeOut,easeInOut").split(","), + e, name, j, type; + while (--i > -1) { + name = na[i]; + e = create ? _class("easing."+name, null, true) : gs.easing[name] || {}; + j = ta.length; + while (--j > -1) { + type = ta[j]; + _easeMap[name + "." + type] = _easeMap[type + name] = e[type] = ease.getRatio ? ease : ease[type] || new ease(); + } + } + }; + + p = Ease.prototype; + p._calcEnd = false; + p.getRatio = function(p) { + if (this._func) { + this._params[0] = p; + return this._func.apply(null, this._params); + } + var t = this._type, + pw = this._power, + r = (t === 1) ? 1 - p : (t === 2) ? p : (p < 0.5) ? p * 2 : (1 - p) * 2; + if (pw === 1) { + r *= r; + } else if (pw === 2) { + r *= r * r; + } else if (pw === 3) { + r *= r * r * r; + } else if (pw === 4) { + r *= r * r * r * r; + } + return (t === 1) ? 1 - r : (t === 2) ? r : (p < 0.5) ? r / 2 : 1 - (r / 2); + }; + + //create all the standard eases like Linear, Quad, Cubic, Quart, Quint, Strong, Power0, Power1, Power2, Power3, and Power4 (each with easeIn, easeOut, and easeInOut) + a = ["Linear","Quad","Cubic","Quart","Quint,Strong"]; + i = a.length; + while (--i > -1) { + p = a[i]+",Power"+i; + _easeReg(new Ease(null,null,1,i), p, "easeOut", true); + _easeReg(new Ease(null,null,2,i), p, "easeIn" + ((i === 0) ? ",easeNone" : "")); + _easeReg(new Ease(null,null,3,i), p, "easeInOut"); + } + _easeMap.linear = gs.easing.Linear.easeIn; + _easeMap.swing = gs.easing.Quad.easeInOut; //for jQuery folks + + +/* + * ---------------------------------------------------------------- + * EventDispatcher + * ---------------------------------------------------------------- + */ + var EventDispatcher = _class("events.EventDispatcher", function(target) { + this._listeners = {}; + this._eventTarget = target || this; + }); + p = EventDispatcher.prototype; + + p.addEventListener = function(type, callback, scope, useParam, priority) { + priority = priority || 0; + var list = this._listeners[type], + index = 0, + listener, i; + if (this === _ticker && !_tickerActive) { + _ticker.wake(); + } + if (list == null) { + this._listeners[type] = list = []; + } + i = list.length; + while (--i > -1) { + listener = list[i]; + if (listener.c === callback && listener.s === scope) { + list.splice(i, 1); + } else if (index === 0 && listener.pr < priority) { + index = i + 1; + } + } + list.splice(index, 0, {c:callback, s:scope, up:useParam, pr:priority}); + }; + + p.removeEventListener = function(type, callback) { + var list = this._listeners[type], i; + if (list) { + i = list.length; + while (--i > -1) { + if (list[i].c === callback) { + list.splice(i, 1); + return; + } + } + } + }; + + p.dispatchEvent = function(type) { + var list = this._listeners[type], + i, t, listener; + if (list) { + i = list.length; + if (i > 1) { + list = list.slice(0); //in case addEventListener() is called from within a listener/callback (otherwise the index could change, resulting in a skip) + } + t = this._eventTarget; + while (--i > -1) { + listener = list[i]; + if (listener) { + if (listener.up) { + listener.c.call(listener.s || t, {type:type, target:t}); + } else { + listener.c.call(listener.s || t); + } + } + } + } + }; + + +/* + * ---------------------------------------------------------------- + * Ticker + * ---------------------------------------------------------------- + */ + var _reqAnimFrame = window.requestAnimationFrame, + _cancelAnimFrame = window.cancelAnimationFrame, + _getTime = Date.now || function() {return new Date().getTime();}, + _lastUpdate = _getTime(); + + //now try to determine the requestAnimationFrame and cancelAnimationFrame functions and if none are found, we'll use a setTimeout()/clearTimeout() polyfill. + a = ["ms","moz","webkit","o"]; + i = a.length; + while (--i > -1 && !_reqAnimFrame) { + _reqAnimFrame = window[a[i] + "RequestAnimationFrame"]; + _cancelAnimFrame = window[a[i] + "CancelAnimationFrame"] || window[a[i] + "CancelRequestAnimationFrame"]; + } + + _class("Ticker", function(fps, useRAF) { + var _self = this, + _startTime = _getTime(), + _useRAF = (useRAF !== false && _reqAnimFrame) ? "auto" : false, + _lagThreshold = 500, + _adjustedLag = 33, + _tickWord = "tick", //helps reduce gc burden + _fps, _req, _id, _gap, _nextTime, + _tick = function(manual) { + var elapsed = _getTime() - _lastUpdate, + overlap, dispatch; + if (elapsed > _lagThreshold) { + _startTime += elapsed - _adjustedLag; + } + _lastUpdate += elapsed; + _self.time = (_lastUpdate - _startTime) / 1000; + overlap = _self.time - _nextTime; + if (!_fps || overlap > 0 || manual === true) { + _self.frame++; + _nextTime += overlap + (overlap >= _gap ? 0.004 : _gap - overlap); + dispatch = true; + } + if (manual !== true) { //make sure the request is made before we dispatch the "tick" event so that timing is maintained. Otherwise, if processing the "tick" requires a bunch of time (like 15ms) and we're using a setTimeout() that's based on 16.7ms, it'd technically take 31.7ms between frames otherwise. + _id = _req(_tick); + } + if (dispatch) { + _self.dispatchEvent(_tickWord); + } + }; + + EventDispatcher.call(_self); + _self.time = _self.frame = 0; + _self.tick = function() { + _tick(true); + }; + + _self.lagSmoothing = function(threshold, adjustedLag) { + if (!arguments.length) { //if lagSmoothing() is called with no arguments, treat it like a getter that returns a boolean indicating if it's enabled or not. This is purposely undocumented and is for internal use. + return (_lagThreshold < 1 / _tinyNum); + } + _lagThreshold = threshold || (1 / _tinyNum); //zero should be interpreted as basically unlimited + _adjustedLag = Math.min(adjustedLag, _lagThreshold, 0); + }; + + _self.sleep = function() { + if (_id == null) { + return; + } + if (!_useRAF || !_cancelAnimFrame) { + clearTimeout(_id); + } else { + _cancelAnimFrame(_id); + } + _req = _emptyFunc; + _id = null; + if (_self === _ticker) { + _tickerActive = false; + } + }; + + _self.wake = function(seamless) { + if (_id !== null) { + _self.sleep(); + } else if (seamless) { + _startTime += -_lastUpdate + (_lastUpdate = _getTime()); + } else if (_self.frame > 10) { //don't trigger lagSmoothing if we're just waking up, and make sure that at least 10 frames have elapsed because of the iOS bug that we work around below with the 1.5-second setTimout(). + _lastUpdate = _getTime() - _lagThreshold + 5; + } + _req = (_fps === 0) ? _emptyFunc : (!_useRAF || !_reqAnimFrame) ? function(f) { return setTimeout(f, ((_nextTime - _self.time) * 1000 + 1) | 0); } : _reqAnimFrame; + if (_self === _ticker) { + _tickerActive = true; + } + _tick(2); + }; + + _self.fps = function(value) { + if (!arguments.length) { + return _fps; + } + _fps = value; + _gap = 1 / (_fps || 60); + _nextTime = this.time + _gap; + _self.wake(); + }; + + _self.useRAF = function(value) { + if (!arguments.length) { + return _useRAF; + } + _self.sleep(); + _useRAF = value; + _self.fps(_fps); + }; + _self.fps(fps); + + //a bug in iOS 6 Safari occasionally prevents the requestAnimationFrame from working initially, so we use a 1.5-second timeout that automatically falls back to setTimeout() if it senses this condition. + setTimeout(function() { + if (_useRAF === "auto" && _self.frame < 5 && (_doc || {}).visibilityState !== "hidden") { + _self.useRAF(false); + } + }, 1500); + }); + + p = gs.Ticker.prototype = new gs.events.EventDispatcher(); + p.constructor = gs.Ticker; + + +/* + * ---------------------------------------------------------------- + * Animation + * ---------------------------------------------------------------- + */ + var Animation = _class("core.Animation", function(duration, vars) { + this.vars = vars = vars || {}; + this._duration = this._totalDuration = duration || 0; + this._delay = Number(vars.delay) || 0; + this._timeScale = 1; + this._active = !!vars.immediateRender; + this.data = vars.data; + this._reversed = !!vars.reversed; + + if (!_rootTimeline) { + return; + } + if (!_tickerActive) { //some browsers (like iOS 6 Safari) shut down JavaScript execution when the tab is disabled and they [occasionally] neglect to start up requestAnimationFrame again when returning - this code ensures that the engine starts up again properly. + _ticker.wake(); + } + + var tl = this.vars.useFrames ? _rootFramesTimeline : _rootTimeline; + tl.add(this, tl._time); + + if (this.vars.paused) { + this.paused(true); + } + }); + + _ticker = Animation.ticker = new gs.Ticker(); + p = Animation.prototype; + p._dirty = p._gc = p._initted = p._paused = false; + p._totalTime = p._time = 0; + p._rawPrevTime = -1; + p._next = p._last = p._onUpdate = p._timeline = p.timeline = null; + p._paused = false; + + + //some browsers (like iOS) occasionally drop the requestAnimationFrame event when the user switches to a different tab and then comes back again, so we use a 2-second setTimeout() to sense if/when that condition occurs and then wake() the ticker. + var _checkTimeout = function() { + if (_tickerActive && _getTime() - _lastUpdate > 2000 && ((_doc || {}).visibilityState !== "hidden" || !_ticker.lagSmoothing())) { //note: if the tab is hidden, we should still wake if lagSmoothing has been disabled. + _ticker.wake(); + } + var t = setTimeout(_checkTimeout, 2000); + if (t.unref) { + // allows a node process to exit even if the timeout’s callback hasn't been invoked. Without it, the node process could hang as this function is called every two seconds. + t.unref(); + } + }; + _checkTimeout(); + + + p.play = function(from, suppressEvents) { + if (from != null) { + this.seek(from, suppressEvents); + } + return this.reversed(false).paused(false); + }; + + p.pause = function(atTime, suppressEvents) { + if (atTime != null) { + this.seek(atTime, suppressEvents); + } + return this.paused(true); + }; + + p.resume = function(from, suppressEvents) { + if (from != null) { + this.seek(from, suppressEvents); + } + return this.paused(false); + }; + + p.seek = function(time, suppressEvents) { + return this.totalTime(Number(time), suppressEvents !== false); + }; + + p.restart = function(includeDelay, suppressEvents) { + return this.reversed(false).paused(false).totalTime(includeDelay ? -this._delay : 0, (suppressEvents !== false), true); + }; + + p.reverse = function(from, suppressEvents) { + if (from != null) { + this.seek((from || this.totalDuration()), suppressEvents); + } + return this.reversed(true).paused(false); + }; + + p.render = function(time, suppressEvents, force) { + //stub - we override this method in subclasses. + }; + + p.invalidate = function() { + this._time = this._totalTime = 0; + this._initted = this._gc = false; + this._rawPrevTime = -1; + if (this._gc || !this.timeline) { + this._enabled(true); + } + return this; + }; + + p.isActive = function() { + var tl = this._timeline, //the 2 root timelines won't have a _timeline; they're always active. + startTime = this._startTime, + rawTime; + return (!tl || (!this._gc && !this._paused && tl.isActive() && (rawTime = tl.rawTime(true)) >= startTime && rawTime < startTime + this.totalDuration() / this._timeScale - _tinyNum)); + }; + + p._enabled = function (enabled, ignoreTimeline) { + if (!_tickerActive) { + _ticker.wake(); + } + this._gc = !enabled; + this._active = this.isActive(); + if (ignoreTimeline !== true) { + if (enabled && !this.timeline) { + this._timeline.add(this, this._startTime - this._delay); + } else if (!enabled && this.timeline) { + this._timeline._remove(this, true); + } + } + return false; + }; + + + p._kill = function(vars, target) { + return this._enabled(false, false); + }; + + p.kill = function(vars, target) { + this._kill(vars, target); + return this; + }; + + p._uncache = function(includeSelf) { + var tween = includeSelf ? this : this.timeline; + while (tween) { + tween._dirty = true; + tween = tween.timeline; + } + return this; + }; + + p._swapSelfInParams = function(params) { + var i = params.length, + copy = params.concat(); + while (--i > -1) { + if (params[i] === "{self}") { + copy[i] = this; + } + } + return copy; + }; + + p._callback = function(type) { + var v = this.vars, + callback = v[type], + params = v[type + "Params"], + scope = v[type + "Scope"] || v.callbackScope || this, + l = params ? params.length : 0; + switch (l) { //speed optimization; call() is faster than apply() so use it when there are only a few parameters (which is by far most common). Previously we simply did var v = this.vars; v[type].apply(v[type + "Scope"] || v.callbackScope || this, v[type + "Params"] || _blankArray); + case 0: callback.call(scope); break; + case 1: callback.call(scope, params[0]); break; + case 2: callback.call(scope, params[0], params[1]); break; + default: callback.apply(scope, params); + } + }; + +//----Animation getters/setters -------------------------------------------------------- + + p.eventCallback = function(type, callback, params, scope) { + if ((type || "").substr(0,2) === "on") { + var v = this.vars; + if (arguments.length === 1) { + return v[type]; + } + if (callback == null) { + delete v[type]; + } else { + v[type] = callback; + v[type + "Params"] = (_isArray(params) && params.join("").indexOf("{self}") !== -1) ? this._swapSelfInParams(params) : params; + v[type + "Scope"] = scope; + } + if (type === "onUpdate") { + this._onUpdate = callback; + } + } + return this; + }; + + p.delay = function(value) { + if (!arguments.length) { + return this._delay; + } + if (this._timeline.smoothChildTiming) { + this.startTime( this._startTime + value - this._delay ); + } + this._delay = value; + return this; + }; + + p.duration = function(value) { + if (!arguments.length) { + this._dirty = false; + return this._duration; + } + this._duration = this._totalDuration = value; + this._uncache(true); //true in case it's a TweenMax or TimelineMax that has a repeat - we'll need to refresh the totalDuration. + if (this._timeline.smoothChildTiming) if (this._time > 0) if (this._time < this._duration) if (value !== 0) { + this.totalTime(this._totalTime * (value / this._duration), true); + } + return this; + }; + + p.totalDuration = function(value) { + this._dirty = false; + return (!arguments.length) ? this._totalDuration : this.duration(value); + }; + + p.time = function(value, suppressEvents) { + if (!arguments.length) { + return this._time; + } + if (this._dirty) { + this.totalDuration(); + } + return this.totalTime((value > this._duration) ? this._duration : value, suppressEvents); + }; + + p.totalTime = function(time, suppressEvents, uncapped) { + if (!_tickerActive) { + _ticker.wake(); + } + if (!arguments.length) { + return this._totalTime; + } + if (this._timeline) { + if (time < 0 && !uncapped) { + time += this.totalDuration(); + } + if (this._timeline.smoothChildTiming) { + if (this._dirty) { + this.totalDuration(); + } + var totalDuration = this._totalDuration, + tl = this._timeline; + if (time > totalDuration && !uncapped) { + time = totalDuration; + } + this._startTime = (this._paused ? this._pauseTime : tl._time) - ((!this._reversed ? time : totalDuration - time) / this._timeScale); + if (!tl._dirty) { //for performance improvement. If the parent's cache is already dirty, it already took care of marking the ancestors as dirty too, so skip the function call here. + this._uncache(false); + } + //in case any of the ancestor timelines had completed but should now be enabled, we should reset their totalTime() which will also ensure that they're lined up properly and enabled. Skip for animations that are on the root (wasteful). Example: a TimelineLite.exportRoot() is performed when there's a paused tween on the root, the export will not complete until that tween is unpaused, but imagine a child gets restarted later, after all [unpaused] tweens have completed. The startTime of that child would get pushed out, but one of the ancestors may have completed. + if (tl._timeline) { + while (tl._timeline) { + if (tl._timeline._time !== (tl._startTime + tl._totalTime) / tl._timeScale) { + tl.totalTime(tl._totalTime, true); + } + tl = tl._timeline; + } + } + } + if (this._gc) { + this._enabled(true, false); + } + if (this._totalTime !== time || this._duration === 0) { + if (_lazyTweens.length) { + _lazyRender(); + } + this.render(time, suppressEvents, false); + if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when someone calls seek() or time() or progress(), they expect an immediate render. + _lazyRender(); + } + } + } + return this; + }; + + p.progress = p.totalProgress = function(value, suppressEvents) { + var duration = this.duration(); + return (!arguments.length) ? (duration ? this._time / duration : this.ratio) : this.totalTime(duration * value, suppressEvents); + }; + + p.startTime = function(value) { + if (!arguments.length) { + return this._startTime; + } + if (value !== this._startTime) { + this._startTime = value; + if (this.timeline) if (this.timeline._sortChildren) { + this.timeline.add(this, value - this._delay); //ensures that any necessary re-sequencing of Animations in the timeline occurs to make sure the rendering order is correct. + } + } + return this; + }; + + p.endTime = function(includeRepeats) { + return this._startTime + ((includeRepeats != false) ? this.totalDuration() : this.duration()) / this._timeScale; + }; + + p.timeScale = function(value) { + if (!arguments.length) { + return this._timeScale; + } + var pauseTime, t; + value = value || _tinyNum; //can't allow zero because it'll throw the math off + if (this._timeline && this._timeline.smoothChildTiming) { + pauseTime = this._pauseTime; + t = (pauseTime || pauseTime === 0) ? pauseTime : this._timeline.totalTime(); + this._startTime = t - ((t - this._startTime) * this._timeScale / value); + } + this._timeScale = value; + t = this.timeline; + while (t && t.timeline) { //must update the duration/totalDuration of all ancestor timelines immediately in case in the middle of a render loop, one tween alters another tween's timeScale which shoves its startTime before 0, forcing the parent timeline to shift around and shiftChildren() which could affect that next tween's render (startTime). Doesn't matter for the root timeline though. + t._dirty = true; + t.totalDuration(); + t = t.timeline; + } + return this; + }; + + p.reversed = function(value) { + if (!arguments.length) { + return this._reversed; + } + if (value != this._reversed) { + this._reversed = value; + this.totalTime(((this._timeline && !this._timeline.smoothChildTiming) ? this.totalDuration() - this._totalTime : this._totalTime), true); + } + return this; + }; + + p.paused = function(value) { + if (!arguments.length) { + return this._paused; + } + var tl = this._timeline, + raw, elapsed; + if (value != this._paused) if (tl) { + if (!_tickerActive && !value) { + _ticker.wake(); + } + raw = tl.rawTime(); + elapsed = raw - this._pauseTime; + if (!value && tl.smoothChildTiming) { + this._startTime += elapsed; + this._uncache(false); + } + this._pauseTime = value ? raw : null; + this._paused = value; + this._active = this.isActive(); + if (!value && elapsed !== 0 && this._initted && this.duration()) { + raw = tl.smoothChildTiming ? this._totalTime : (raw - this._startTime) / this._timeScale; + this.render(raw, (raw === this._totalTime), true); //in case the target's properties changed via some other tween or manual update by the user, we should force a render. + } + } + if (this._gc && !value) { + this._enabled(true, false); + } + return this; + }; + + +/* + * ---------------------------------------------------------------- + * SimpleTimeline + * ---------------------------------------------------------------- + */ + var SimpleTimeline = _class("core.SimpleTimeline", function(vars) { + Animation.call(this, 0, vars); + this.autoRemoveChildren = this.smoothChildTiming = true; + }); + + p = SimpleTimeline.prototype = new Animation(); + p.constructor = SimpleTimeline; + p.kill()._gc = false; + p._first = p._last = p._recent = null; + p._sortChildren = false; + + p.add = p.insert = function(child, position, align, stagger) { + var prevTween, st; + child._startTime = Number(position || 0) + child._delay; + if (child._paused) if (this !== child._timeline) { //we only adjust the _pauseTime if it wasn't in this timeline already. Remember, sometimes a tween will be inserted again into the same timeline when its startTime is changed so that the tweens in the TimelineLite/Max are re-ordered properly in the linked list (so everything renders in the proper order). + child._pauseTime = this.rawTime() - (child._timeline.rawTime() - child._pauseTime); + } + if (child.timeline) { + child.timeline._remove(child, true); //removes from existing timeline so that it can be properly added to this one. + } + child.timeline = child._timeline = this; + if (child._gc) { + child._enabled(true, true); + } + prevTween = this._last; + if (this._sortChildren) { + st = child._startTime; + while (prevTween && prevTween._startTime > st) { + prevTween = prevTween._prev; + } + } + if (prevTween) { + child._next = prevTween._next; + prevTween._next = child; + } else { + child._next = this._first; + this._first = child; + } + if (child._next) { + child._next._prev = child; + } else { + this._last = child; + } + child._prev = prevTween; + this._recent = child; + if (this._timeline) { + this._uncache(true); + } + return this; + }; + + p._remove = function(tween, skipDisable) { + if (tween.timeline === this) { + if (!skipDisable) { + tween._enabled(false, true); + } + + if (tween._prev) { + tween._prev._next = tween._next; + } else if (this._first === tween) { + this._first = tween._next; + } + if (tween._next) { + tween._next._prev = tween._prev; + } else if (this._last === tween) { + this._last = tween._prev; + } + tween._next = tween._prev = tween.timeline = null; + if (tween === this._recent) { + this._recent = this._last; + } + + if (this._timeline) { + this._uncache(true); + } + } + return this; + }; + + p.render = function(time, suppressEvents, force) { + var tween = this._first, + next; + this._totalTime = this._time = this._rawPrevTime = time; + while (tween) { + next = tween._next; //record it here because the value could change after rendering... + if (tween._active || (time >= tween._startTime && !tween._paused && !tween._gc)) { + if (!tween._reversed) { + tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force); + } else { + tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force); + } + } + tween = next; + } + }; + + p.rawTime = function() { + if (!_tickerActive) { + _ticker.wake(); + } + return this._totalTime; + }; + +/* + * ---------------------------------------------------------------- + * TweenLite + * ---------------------------------------------------------------- + */ + var TweenLite = _class("TweenLite", function(target, duration, vars) { + Animation.call(this, duration, vars); + this.render = TweenLite.prototype.render; //speed optimization (avoid prototype lookup on this "hot" method) + + if (target == null) { + throw "Cannot tween a null target."; + } + + this.target = target = (typeof(target) !== "string") ? target : TweenLite.selector(target) || target; + + var isSelector = (target.jquery || (target.length && target !== window && target[0] && (target[0] === window || (target[0].nodeType && target[0].style && !target.nodeType)))), + overwrite = this.vars.overwrite, + i, targ, targets; + + this._overwrite = overwrite = (overwrite == null) ? _overwriteLookup[TweenLite.defaultOverwrite] : (typeof(overwrite) === "number") ? overwrite >> 0 : _overwriteLookup[overwrite]; + + if ((isSelector || target instanceof Array || (target.push && _isArray(target))) && typeof(target[0]) !== "number") { + this._targets = targets = _slice(target); //don't use Array.prototype.slice.call(target, 0) because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll() + this._propLookup = []; + this._siblings = []; + for (i = 0; i < targets.length; i++) { + targ = targets[i]; + if (!targ) { + targets.splice(i--, 1); + continue; + } else if (typeof(targ) === "string") { + targ = targets[i--] = TweenLite.selector(targ); //in case it's an array of strings + if (typeof(targ) === "string") { + targets.splice(i+1, 1); //to avoid an endless loop (can't imagine why the selector would return a string, but just in case) + } + continue; + } else if (targ.length && targ !== window && targ[0] && (targ[0] === window || (targ[0].nodeType && targ[0].style && !targ.nodeType))) { //in case the user is passing in an array of selector objects (like jQuery objects), we need to check one more level and pull things out if necessary. Also note that